Commit Graph

1267 Commits

Author SHA1 Message Date
Rostislav Pehlivanov
ed08cbd7b1 aacenc_ltp: fix out of bounds memory access
Discovered by Coverity.
2015-12-03 23:12:37 +00:00
Claudio Freire
ca203e9985 AAC encoder: improve SF range utilization
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
2015-12-02 07:47:37 -03:00
Chris Cunningham
5e6ce28dab avformat/mp3dec: prefer "fast_seek" to TOC seek for CBR files.
"Fast seek" uses linear interpolation to find the position of the
requested seek time. For CBR this is more direct than using the
mp3 TOC and bypassing the TOC avoids problems with TOC precision.
(see https://crbug.com/545914#c13)

For VBR, fast seek is not precise, so continue to prefer the TOC
when available (the lesser of two evils).

Also, some re-ordering of the logic in mp3_seek to simplify and
give usetoc=1 precedence over fastseek flag.

Signed-off-by: wm4 <nfxjfg@googlemail.com>
2015-12-02 11:02:27 +01:00
Claudio Freire
88e498a87e AAC encoder: make pe.min a local minimum
As noted in a comment, pe.min in the reference encoder
is centered around current pe. The bit reservoir algo
needs pe.min to be a local minimum, because it can only
account for local PE variations. If it's set to a global
minimum as was being done, bit reservoir logic doesn't
work as efficiently.

This patch tries to forget old minimums and converge to
a local minimum without losing the stability of the
previous solution. Listening tests until now suggest this
solves numerous RC issues.
2015-11-29 15:03:45 -03:00
Hendrik Leppkes
5c0dbc20fc Merge commit '823fa7004571cb8404ca5785f9fa6e85f0f9f3d3'
* commit '823fa7004571cb8404ca5785f9fa6e85f0f9f3d3':
  fate: Rework sgi tests into a suite and add the missing ones

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-11-29 16:00:54 +01:00
Rostislav Pehlivanov
1e5dbb3409 aac_ltp: split, reorder and improve prediction algorithm
This commit attempts to mirror what the decoder does more closely
in addition to fixing some shortcomings.
2015-11-26 17:40:04 +00:00
Matthieu Bouron
39290f2715 fate: add FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM tests 2015-11-26 17:05:54 +01:00
Vittorio Giovara
823fa70045 fate: Rework sgi tests into a suite and add the missing ones
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-11-24 09:05:01 -05:00
Daniil Cherednik
6662ca28d4 avcodec/atrac1: fix decoder: QMF delay compensation should be 39 samples
This also adds a new fate test

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-21 11:38:45 +01:00
Derek Buitenhuis
61344c04ca Merge commit '59e8ec0aa8ab174701d01a3bfe96fedd0b7fcead'
All diferences in unit tests have been acounted for.

* commit '59e8ec0aa8ab174701d01a3bfe96fedd0b7fcead':
  movenc: Add an API unit test for fragmenting options/calls

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2015-11-16 16:19:27 +00:00
Marton Balint
9bd4f26b55 fate: fix concat demuxer tests on msys/cygwin by using relative paths
Signed-off-by: Marton Balint <cus@passwd.hu>
2015-11-16 11:05:19 +01:00
Marton Balint
a01046c90c fate: add concat demuxer tests
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Marton Balint <cus@passwd.hu>
2015-11-15 19:22:46 +01:00
Michael Niedermayer
351e625d60 swresample/resample: increase precision for compensation
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-11 18:17:18 +01:00
Martin Storsjö
59e8ec0aa8 movenc: Add an API unit test for fragmenting options/calls
Contrary to the normal fate tests that run via avconv, this tests
nontrivial call sequences that are only doable via the API
(mainly for different corner cases when using the muxer for
segmenting).

The test muxes fake packet data (with extradata that looks
enough like proper data to make the file be viewable with e.g.
boxdumper) and checks the hash of the produced files. The test also
verifies that fragments produced via different call sequences remain
identical (to avoid e.g. updating the output hashes and suddenly
having fragments that used to be identical suddenly diverging), for
fragments written with frag_discont and/or delay_moov.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-11-10 21:50:25 +02:00
Michael Niedermayer
b83c849e87 tests/fate/avformat: Fix fate-lavf
The CMP variable seems to have been inherited from fate-api-seek which set it to null

the mxf reference needed a change due to c7e14a279f

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-10 04:53:47 +01:00
Nicolas George
432e27e6e7 fate: add mpdecimate test. 2015-11-07 16:03:47 +01:00
Nicolas George
b16e569312 lavfi: add testsrc2 test source.
Similar to testsrc, but using drawutils and therefore
supporting a lot of pixel formats instead of just rgb24.
This allows using it as input for other tests without
requiring a format conversion.
It is also slightly faster than testsrc for some reason.
2015-11-07 16:02:48 +01:00
Carl Eugen Hoyos
2f1d6d45af lavc/cdg: Add transparency support. 2015-10-30 01:24:50 +01:00
Hendrik Leppkes
8b3228a329 Merge commit '533a6198505edd1379e1cd722852350ae4a85acc'
* commit '533a6198505edd1379e1cd722852350ae4a85acc':
  innoHeim/Rsupport Screen Capture Codec decoder

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-27 13:58:44 +01:00
Rostislav Pehlivanov
af71c73fb4 FATE: Increase FUZZ value on AAC LTP encoding test
Clang prerelease on Darwin is making the test fail.
2015-10-27 07:41:33 +00:00
Rostislav Pehlivanov
e6f99520aa FATE: Slightly increase thresholds on prediction AAC encoding tests
They barely fail on some systems by being off by 0.81.
2015-10-27 03:48:17 +00:00
Derek Buitenhuis
a7fcc43bcc tests/aac: Add bitexact flags to AAC LTP Encode test
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2015-10-26 14:32:05 +00:00
Michael Niedermayer
4f00d23577 tests/fate/aac: Add bitexact flags to fate-aac-pns-encode
This fixes a fate failure after bumping the minor version
Its unknown why this is not needed for the other aac tests,
more investigation needed but for now i dont want to leave
it broken while its investigated

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-26 13:31:06 +01:00
Vittorio Giovara
533a619850 innoHeim/Rsupport Screen Capture Codec decoder
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-10-23 14:56:43 +02:00
Rostislav Pehlivanov
7303962f14 aacenc_ltp: adjust and speed up autocorrelation calculations
There were some errors in the calculation as well as an entire
unnecessary loop to find the gain coefficient. Merge the
two loops.
Thanks to @ubitux for the suggestions and testing.
2015-10-17 22:53:11 +01:00
Rostislav Pehlivanov
b1d290920d fate: use -profile:a aac_ltp instead of -aac_ltp 1 for LTP encode test
The fate test command line is supposed to serve as an example. It's
nicer to explicitly state the profile rather than setting options
to force it for you.
2015-10-17 12:30:53 +01:00
Rostislav Pehlivanov
6eff30b0bc fate: increase fuzz on AAC LTP encoding test
Fails on some newer systems (archlinux with a modern GCC version).
2015-10-17 11:23:22 +01:00
Rostislav Pehlivanov
d4da15563f fate: add a parameter to disable TNS for the other encoder tests
Since it became the default option, in order to prevent interference
with the other tests, disable it.
2015-10-17 11:10:26 +01:00
Rostislav Pehlivanov
8ce6e24db4 fate: adjust the target for the new TNS changes 2015-10-17 11:10:26 +01:00
Rostislav Pehlivanov
590008e696 aacenc: increase fuzz on aac-ms-encode test
GCC 3.4 miscompiles it on sunos. Date of release? The second of
August two thousand and five, anno Domini. That's ten years two
months and fourteen days ago. Three thousand seven hundred and
twenty seven days ago. One sixth of the average life expectancy
of a person living in a country with a human development index
of zero point eight hundred and eight, equality adjusted.
GCC 4.3 also miscompiles it, though not as bad.
2015-10-17 06:55:19 +01:00
Rostislav Pehlivanov
777b305bed fate: adjust aac encoder test values and introduce MS and LTP tests
The LTP encoding and the test is a bit slow currently, taking twice
the amount of time the other tests do, so in the future the
total time to encode might be cut down on that test.
2015-10-17 05:59:19 +01:00
Hendrik Leppkes
ba94e985a3 Merge commit '1f84b008bf2b1eaca473937c48788cb4e4ce1aea'
* commit '1f84b008bf2b1eaca473937c48788cb4e4ce1aea':
  fate: Move screenpresso to the appropriate screen capture file

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-16 23:00:11 +02:00
Christophe Gisquet
42c1dcde68 fate: use PROGSSUF
May require exporting in the shell var PROGSUF when invoking a
shell script.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-16 14:02:12 +02:00
Vittorio Giovara
1f84b008bf fate: Move screenpresso to the appropriate screen capture file 2015-10-15 15:47:16 +02:00
Christophe Gisquet
f1181e4660 fate: add 10bits YUV4:2:2 dnxhd test
It was useful to (accidentally?) spot an overflow in the column pass
of the x86 simple_idct10 implementation.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-13 04:04:02 +02:00
Ricardo Constantino
a96dbdc14f fate/subtitles: Add a new test for WebVTT
Includes escapes that should now be supported and a few features not yet
fully supported, like comments, regions, classes, ruby, and lang.

All were tested with https://quuz.org/webvtt/ for validation, except
regions because the validator doesn't support them yet, and I couldn't
find any other way to validate WebVTT.

Signed-off-by: Ricardo Constantino <wiiaboo@gmail.com>
2015-10-12 22:14:44 +02:00
Rostislav Pehlivanov
ccd3b3df39 fate: increase fuzz on fate-aac-tns-encode test
Fails on SunOS and old GCC (<=4.6 is ancient) versions.
2015-10-12 17:15:30 +01:00
Andreas Cadhalpun
ec0275843d avcodec: remove leftover iff_byterun1 decoder
It was merged with the iff_ilbm decoder in commit
929a24efff.

Define AV_CODEC_ID_IFF_BYTERUN1 as AV_CODEC_ID_IFF_ILBM for API
compatibility.

Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-10-12 00:21:13 +02:00
Claudio Freire
79f2014f12 AAC encoder tests: increase fuzz for pred test
MIPS needs more fuzz
2015-10-11 18:46:27 -03:00
Claudio Freire
01ecb7172b AAC encoder: Extensive improvements
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.
2015-10-11 17:29:50 -03:00
Christophe Gisquet
25d3013e36 fate: add DNxHD/HR tests
Currently only 2 profiles are evaluated because they are the only 2
with distributed test sequences.
- CID 1260: YUV 4:2:2 10 bits with block-adaptive interlace coding,
  from ticket 4876;
- CID 1270: YUV 4:4:4 10 bits (HR), 1920x839, from ticket 4581.

They were generated from the ticket sequences by running the
following kind of command-line;
ffmpeg -i $INPUT -an -sn -vcodec copy -vframes 1 -y $OUTPUT.mov

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-09 22:36:05 +02:00
Hendrik Leppkes
4d2160c99a Merge commit '9a3202a98b2e095b54dd784c3e01a09a676fc3fa'
* commit '9a3202a98b2e095b54dd784c3e01a09a676fc3fa':
  Screenpresso SPV1 decoder

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-03 12:22:41 +02:00
Vittorio Giovara
9a3202a98b Screenpresso SPV1 decoder
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-09-30 16:45:11 +02:00
Michael Niedermayer
ed18c49f5f fate: Add basic license header check
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-29 18:52:35 +02:00
Claudio Freire
9458a62dec AAC encoder: tweak PNS usage to be more aggressive
This patch tweaks search_for_pns to be both more
aggressive and more careful when applying PNS. On
the one side, it will again try to use PNS on zero
(or effectively zero) bands. For this, both zeroes
and band_type have to be checked (some ZERO bands
aren't marked in zeroes). On the other side, a more
accurate rate-distortion measure avoids using PNS
where it would cause audible distortion.

Also fixed a small bug in the computation of freq
that caused PNS usage on low-frequency bands during
8-short windows. This allows re-enabling PNS during
8-short.
2015-09-25 03:56:32 -03:00
Christophe Gisquet
f94af8d32a fate: add chroma position scale test
The sample position is made weird and non-nominal to force catching
such issues as default values or specialized operations hiding
issues in corner cases.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-23 23:42:28 +02:00
Claudio Freire
7ec74ae4aa AAC encoder: tweak rate-distortion logic
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).
2015-09-23 02:33:44 -03:00
Rostislav Pehlivanov
0cfdaf45c4 lpc: correctly apply windowing to the samples in the float-only lpc
Also change the window to Hamming (using coefficient which make it
a Hanning).

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2015-09-19 16:25:58 +01:00
Claudio Freire
8df9bf8e39 AAC encoder: refactor to resynchronize MIPS port
This patch refactors the AAC coders to reuse code
between the MIPS port and the regular, portable C code.
There were two main functions that had to use
hand-optimized versions of quantization code:
 - search_for_quantizers_twoloop
 - codebook_trellis_rate

Those two were split into their own template header
files so they can be inlined inside both the MIPS port
and the generic code. In each context, they'll link
to their specialized implementations, and thus be
optimized by the compiler.

This approach I believe is better than maintaining
several copies of each function. As past experience has
proven, having to keep those in sync was error prone.
In this way, they will remain in sync by default.

Also, an implementation of the dequantized output
argument for the optimized quantize_and_encode
functions is included in the patch. While the current
implementation of search_for_pred still isn't using
it, future iterations of main prediction probably will.
It should not imply any measurable performance hit while
not being used.
2015-09-16 23:14:26 -03:00
Rostislav Pehlivanov
5ba811bdf0 aacenc_tns: fix coefficient compression condition
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2015-09-16 17:48:02 +01:00