summaryrefslogtreecommitdiff
path: root/libavcodec/psymodel.h
Commit message (Collapse)AuthorAgeFilesLines
* avcodec: stop using deprecated codec flagsJames Almer2017-03-251-1/+1
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* doc: fix spelling errorsAndreas Cadhalpun2016-10-211-1/+1
| | | | | | | | Thanks to Mathieu Malaterre <malat@debian.org> for reporting the Que/Queue typo. (https://bugs.debian.org/839542) Reviewed-by: Lou Logan <lou@lrcd.com> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
* AAC encoder: improve SF range utilizationClaudio Freire2015-12-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch does 4 things, all of which interact and thus it woudln't be possible to commit them separately without causing either quality regressions or assertion failures. Fate comparison targets don't all reflect improvements in quality, yet listening tests show substantially improved quality and stability. 1. Increase SF range utilization. The spec requires SF delta values to be constrained within the range -60..60. The previous code was applying that range to the whole SF array and not only the deltas of consecutive values, because doing so requires smarter code: zeroing or otherwise skipping a band may invalidate lots of SF choices. This patch implements that logic to allow the coders to utilize the full dynamic range of scalefactors, increasing quality quite considerably, and fixing delta-SF-related assertion failures, since now the limitation is enforced rather than asserted. 2. PNS tweaks The previous modification makes big improvements in twoloop's efficiency, and every time that happens PNS logic needs to be tweaked accordingly to avoid it from stepping all over twoloop's decisions. This patch includes modifications of the sort. 3. Account for lowpass cutoff during PSY analysis The closer PSY's allocation is to final allocation the better the quality is, and given these modifications, twoloop is now very efficient at avoiding holes. Thus, to compute accurate thresholds, PSY needs to account for the lowpass applied implicitly during twoloop (by zeroing high bands). This patch makes twoloop set the cutoff in psymodel's context the first time it runs, and makes PSY account for it during threshold computation, making PE and threshold computations closer to the final allocation and thus achieving better subjective quality. 4. Tweaks to RC lambda tracking loop in relation to PNS Without this tweak some corner cases cause quality regressions. Basically, lambda needs to react faster to overall bitrate efficiency changes since now PNS can be quite successful in enforcing maximum bitrates, when PSY allocates too many bits to the lower bands, suppressing the signals RC logic uses to lower lambda in those cases and causing aggressive PNS. This tweak makes PNS much less aggressive, though it can still use some further tweaks. Also update MIPS specializations and adjust fuzz Also in lavc/mips/aacpsy_mips.h: remove trailing whitespace
* AAC encoder: Extensive improvementsClaudio Freire2015-10-111-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This finalizes merging of the work in the patches in ticket #2686. Improvements to twoloop and RC logic are extensive. The non-exhaustive list of twoloop improvments includes: - Tweaks to distortion limits on the RD optimization phase of twoloop - Deeper search in twoloop - PNS information marking to let twoloop decide when to use it (turned out having the decision made separately wasn't working) - Tonal band detection and priorization - Better band energy conservation rules - Strict hole avoidance For rate control: - Use psymodel's bit allocation to allow proper use of the bit reservoir. Don't work against the bit reservoir by moving lambda in the opposite direction when psymodel decides to allocate more/less bits to a frame. - Retry the encode if the effective rate lies outside a reasonable margin of psymodel's allocation or the selected ABR. - Log average lambda at the end. Useful info for everyone, but especially for tuning of the various encoder constants that relate to lambda feedback. Psy: - Do not apply lowpass with a FIR filter, instead just let the coder zero bands above the cutoff. The FIR filter induces group delay, and while zeroing bands causes ripple, it's lost in the quantization noise. - Experimental VBR bit allocation code - Tweak automatic lowpass filter threshold to maximize audio bandwidth at all bitrates while still providing acceptable, stable quality. I/S: - Phase decision fixes. Unrelated to #2686, but the bugs only surfaced when the merge was finalized. Measure I/S band energy accounting for phase, and prevent I/S and M/S from being applied both. PNS: - Avoid marking short bands with PNS when they're part of a window group in which there's a large variation of energy from one window to the next. PNS can't preserve those and the effect is extremely noticeable. M/S: - Implement BMLD protection similar to the specified in ISO-IEC/13818:7-2003, Appendix C Section 6.1. Since M/S decision doesn't conform to section 6.1, a different method had to be implemented, but should provide equivalent protection. - Move the decision logic closer to the method specified in ISO-IEC/13818:7-2003, Appendix C Section 6.1. Specifically, make sure M/S needs less bits than dual stereo. - Don't apply M/S in bands that are using I/S Now, this of course needed adjustments in the compare targets and fuzz factors of the AAC encoder's fate tests, but if wondering why the targets go up (more distortion), consider the previous coder was using too many bits on LF content (far more than required by psy), and thus those signals will now be more distorted, not less. The extra distortion isn't audible though, I carried extensive ABX testing to make sure. A very similar patch was also extensively tested by Kamendo2 in the context of #2686.
* AAC encoder: tweak rate-distortion logicClaudio Freire2015-09-231-0/+1
| | | | | | | | | | | | This patch modifies the encode frame function to retry encoding the frame when the resulting bit count is too far off target, but only adjusting lambda in small, incremental step. It also makes the logic more conservative - otherwise it will contend with bit reservoir-related variations in bit allocation, and result in artifacts when frame have to be truncated (usually at high bit rates transitioning from low complexity to high complexity).
* AAC Encoder: clipping avoidanceClaudio Freire2015-07-271-0/+1
| | | | | | | | | | | | | | | | | Avoid clipping due to quantization noise to produce audible artifacts, by detecting near-clipping signals and both attenuating them a little and encoding escape-encoded bands (usually the loudest) rounding towards zero instead of nearest, which tends to decrease overall energy and thus clipping. Currently fate tests measure numerical error so this change makes tests using asynth (which are near clipping) report higher error not less, because of window attenuation. Yet, they sound better, not worse (albeit subtle, other samples aren't subtle at all). Only measuring psychoacoustically weighted error would make for a representative test, so that will be left for a future patch. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* aacpsy: Add energy spread for each bandRostislav Pehlivanov2015-06-281-2/+1
| | | | | | | | | | This commit adds the energy spread to the struct for each band and removes 2 unused fields. distortion and perceptual_weight were not referenced in any file nor were they set to any value, so it was safe to remove them. The energy spread is currently only used in the aac psy model. It's defined as being proportional to the tonality of each band. Reviewed-by: Claudio Freire <klaussfreire@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avcodec/psymodel: Fix () in AAC_CUTOFF() macroMichael Niedermayer2014-05-251-1/+1
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* Merge commit '040c565e51985477a8fa5e42d2ddfb26ebde6608'Michael Niedermayer2013-02-241-6/+6
|\ | | | | | | | | | | | | | | | | | | | | * commit '040c565e51985477a8fa5e42d2ddfb26ebde6608': doc: developer: Allow tabs in the vim configuration for Automake files Remove pointless av_cold attributes in header files Conflicts: libavcodec/h264.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * Remove pointless av_cold attributes in header filesDiego Biurrun2013-02-231-6/+6
| | | | | | | | | | | | The init functions marked as av_cold have to be executed in any case, so there is no gain from trying to mark paths leading to such functions as unlikely.
* | aacenc: new default cutoffMichael Niedermayer2012-07-291-0/+2
| | | | | | | | | | | | | | Improves subjective quality Formula and testing by: kamedo2 <fujisakihir90@yahoo.co.jp> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge remote-tracking branch 'qatar/master'Michael Niedermayer2012-01-241-8/+4
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * qatar/master: Remove ffmpeg. aacenc: Simplify windowing aacenc: Move saved overlap samples to the beginning of the same buffer as incoming samples. aacenc: Deinterleave input samples before processing. aacenc: Store channel count in AACEncContext. aacenc: Move Q^3/4 calculation to it's own table aacenc: Request normalized float samples instead of converting s16 samples to float. aacpsy: Replace an if with FFMAX in LAME windowing. aacenc: cosmetics, replace 'rd' with 'bits' in codebook_trellis_rate to make it more clear what is being calculated. aacpsy: cosmetics, change a FIXME to a NOTE about subshort comparisons aacenc: cosmetics: move init() and end() to the bottom of the file. aacenc: aac_encode_init() cleanup XWD encoder and decoder vc1: don't read the interpfrm and bfraction elements for interlaced frames mxfdec: fix memleak on mxf_read_close() westwood: split the AUD and VQA demuxers into separate files. Conflicts: .gitignore Changelog Makefile configure doc/ffmpeg.texi ffmpeg.c libavcodec/Makefile libavcodec/aacenc.c libavcodec/allcodecs.c libavcodec/avcodec.h libavcodec/version.h libavformat/Makefile libavformat/img2.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * aacenc: Deinterleave input samples before processing.Nathan Caldwell2012-01-231-6/+3
| | | | | | | | Signed-off-by: Alex Converse <alex.converse@gmail.com>
| * aacenc: Request normalized float samples instead of converting s16 samples ↵Nathan Caldwell2012-01-231-4/+3
| | | | | | | | | | | | to float. Signed-off-by: Alex Converse <alex.converse@gmail.com>
* | Merge remote-tracking branch 'qatar/master'Michael Niedermayer2011-06-301-12/+41
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * qatar/master: rational-test: Add proper main() declaration to fix gcc warnings. configure: Add vdpau and dxva2 to configure results output. Remove unused, never built libavutil/pca.[ch] matroskadec: forward parsing errors to caller. av_find_stream_info: simplify EAGAIN handling. aacenc: Fix determination of Mid/Side Mode. psymodel: Remove the single channel analysis function aacenc: Implement dummy channel group analysis that just calls the single channel analysis for each channel. psymodel: Add channels and channel groups to the psymodel. ARM: remove check for PLD instruction fate: move amr[nw]b test rules into separate files ogg: fix double free when finding length of small chained oggs. swscale: implement >8bit scaling support. build: fix creation of tools dir with make 3.81 build: Mark all-yes Makefile target as phony. pixfmt: fix YUV422/444 wrong endian comment build: create output directories as needed Add new yuv444 pixfmts to avcodec_align_dimensions2 Conflicts: Makefile configure libavutil/pca.c libavutil/pca.h libavutil/pixfmt.h libswscale/swscale.c libswscale/utils.c libswscale/x86/swscale_template.c tests/ref/lavfi/pixdesc tests/ref/lavfi/pixfmts_copy tests/ref/lavfi/pixfmts_null tests/ref/lavfi/pixfmts_scale tests/ref/lavfi/pixfmts_vflip Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * psymodel: Remove the single channel analysis functionNathan Caldwell2011-06-291-11/+1
| |
| * psymodel: Add channels and channel groups to the psymodel.Nathan Caldwell2011-06-291-7/+46
| |
* | Merge remote branch 'qatar/master'Michael Niedermayer2011-05-091-27/+22
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | * qatar/master: log: Fix an oob array read. cosmetics: trim trailing whitespace in postproc Ban strncpy() it's too easy to misuse. psymodel: Remove wrapper functions. aacenc: Replace loop counters in aac_encode_frame() with more descriptive 'ch' and 'w'. regtest: remove redundant flags in jpg test regtest: use run_ffmpeg in do_image_formats regtest: simplify encoding functions ffmpeg.c: check for interlaced flag in the correct place. Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * psymodel: Remove wrapper functions.Nathan Caldwell2011-05-081-27/+22
| | | | | | | | Instead use the function pointers directly.
* | Merge remote branch 'qatar/master'Michael Niedermayer2011-04-061-0/+9
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * qatar/master: psymodel: extend API to include PE and bit allocation. avio: always compile dyn_buf functions Remove unnecessary parameter from ff_thread_init() and fix behavior Revert "aac_latm_dec: use aac context and aac m4ac" configure: tell user if libva is enabled like the rest of external libs. Add silence support for AV_SAMPLE_FMT_U8. avio: make URL_PROTOCOL_FLAG_NESTED_SCHEME internal avio: deprecate av_url_read_seek avio: deprecate av_url_read_pause ac3enc: NEON optimised extract_exponents Conflicts: libavcodec/utils.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * psymodel: extend API to include PE and bit allocation.Nathan Caldwell2011-04-051-0/+9
| | | | | | | | Signed-off-by: Janne Grunau <janne-libav@jannau.net>
| * Replace FFmpeg with Libav in licence headersMans Rullgard2011-03-191-4/+4
|/ | | | Signed-off-by: Mans Rullgard <mans@mansr.com>
* psymodel: Const correct FFPsyWindowInfo.Alex Converse2010-08-301-2/+2
| | | | Originally committed as revision 24999 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Cosmetics: Pretty print the AAC encoder.Alex Converse2009-07-081-7/+7
| | | | Originally committed as revision 19376 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Merge the AAC encoder from SoC svn. It is still considered experimental.Alex Converse2009-07-081-0/+158
Originally committed as revision 19375 to svn://svn.ffmpeg.org/ffmpeg/trunk