Commit Graph

74 Commits

Author SHA1 Message Date
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
Rostislav Pehlivanov
1e75bee3d6 fate: readjust AAC encoder TNS test
The recent commits change the value slightly. Even though it's
within the threshold it's better to risk as little as possible
especially when different systems, processors, FPUs and compilers
are involved.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2015-09-12 13:17:04 +01:00
Rostislav Pehlivanov
da64bd6a99 aaccoder: tweak PNS implementation further
This commit changes a few things about the noise substitution
logic:
 - Brings back the quantization factor (reduced to 3) during
   scalefactor index calculations.
 - Rejects any zeroed bands. They should be inaudiable and it's
   a waste transmitting the scalefactor indices for these.
 - Uses swb_offsets instead of incrementing a 'start' with every
   window group size.
 - Rejects all PNS during short windows.
Overall improves quality. There was a plan to use the lfg system
to create the random numbers instead of using whatever the decoder
uses but for now this works fine. Entropy is far from important here.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2015-09-09 10:44:33 +01:00
Rostislav Pehlivanov
b6cc8ec7ec aaccoder: add frequency scaling and quantization correction for PNS
This commit once again improves the PNS implementation by scaling the
thresholds with frequency. The thresholds get looser as the frequency
increases since higher frequencies are basically noise to human ears.

Also, this introduces quantization error correction for PNS. Should
the error be too much, no PNS will be used. The energy_ratio is used
to regulate the actual encoded PNS energy: if the generated PNS
energy is higher than the energy from the psy system, energy_ratio
is used to correct it so that hopefully once requantized and
transmitted the value in the decoder will be closer to what the
encoder has.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2015-09-07 12:44:09 +01:00
Rostislav Pehlivanov
1956cfbaed aacenc_is: take absolute coefficient value upon energy calculations
This was an oversight when the IS system was being first implemented.
The ener01 part was largely a result of trial and error and the fact
that the sum of coef0 and coef1 could result in a zero was
overlooked. Once ener01 turns to zero it's used to divide the left
channel energy which doesn't turn out so well as it fills IS[]
with -nan's and inf's which in turn confused the quantize_band_cost.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2015-09-06 18:36:42 +01:00
Rostislav Pehlivanov
ff99a38855 fate: adjust AAC encoder tests values
Since the new commits improve quality.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2015-09-06 15:30:26 +01:00
Rostislav Pehlivanov
cf6fb6f3f7 fate: increase the fuzz of the AAC encoder aref test
Almost fine on SunOS without yasm but 5 wasn't enough.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2015-09-05 21:47:26 +01:00
Rostislav Pehlivanov
5ab3b6a8a5 fate: adjust AAC encoder TNS test target
The new commits improve the quality.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2015-09-05 09:11:05 +01:00
Claudio Freire
bcb3332b1b AAC: Increase fuzziness of fate-aac tests
Needed to make them pass in mips
2015-09-03 10:16:33 -03:00
Rostislav Pehlivanov
10d16647cc fate: increase fuzziness for the AAC encoder prediction test
Fails on x86_64 using ICC 13.1.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2015-09-02 08:36:53 +01:00
Rostislav Pehlivanov
dcf72da841 fate: add fuzziness to the AAC Encode prediction test
Fails on ppc64 architecture under Ubuntu.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2015-09-02 07:15:42 +01:00
Rostislav Pehlivanov
72adf24310 fate: update AAC encoder tests
TNS had both IS and PNS switched on when it makes more sense
to have them both off.

Prediction had a redundant argument.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2015-09-02 06:39:59 +01:00
Rostislav Pehlivanov
b86532810d fate: adjust fuzz of AAC Encoder's TNS test
Have to adjust it again, this time because of --enable-small on
gcc 4.5 in Linaro.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2015-09-01 09:08:31 +01:00
Rostislav Pehlivanov
555f513769 fate: update AAC tests to the new defaults
IS and PNS increase quality a ton so as a result the PSNR changed.
Disable the extensions and keep the tests separate such that there
will be no red herrings if one test fails.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2015-09-01 07:26:03 +01:00
Rostislav Pehlivanov
a8ced764f7 fate: update AAC Encoder TNS test for the new changes
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2015-09-01 07:07:59 +01:00
Rostislav Pehlivanov
8323d9b8af fate: adjust AAC encoder TNS test fuzziness
Tests fails on some ARM builds but it's close enough so it's okay.
NEON, half-precision floats, rounding errors, who knows.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2015-08-29 09:26:05 +01:00
Rostislav Pehlivanov
4ff897a536 fate: add a test for encoding AAC-Main prediction
This commit introduces a test for AAC-Main prediction
which was just reworked in this series of commits.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2015-08-29 07:00:54 +01:00
Rostislav Pehlivanov
fe12ba6f30 fate: reenable TNS test
Hopefully without errors like last time, but I'm prepared.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2015-08-29 07:00:17 +01:00
Rostislav Pehlivanov
4f396a6f30 fate: temporarily disable AAC TNS test
Fixing it will take a bit longer, so just suspend the test.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2015-08-23 01:04:06 +01:00
Rostislav Pehlivanov
ae1b9c9754 fate: added PNS, TNS and IS tests for the AAC encoder
This commit adds tests for the PNS, TNS and IS functionality
of the encoder.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2015-08-22 08:12:20 +01:00
Claudio Freire
59216e0525 AAC Encoder: clipping avoidance
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>
2015-07-27 19:13:48 +02:00
Nedeljko Babic
978a8540b6 tests: Add aac_fixed decoder test
Signed-off-by: Nedeljko Babic <nedeljko.babic@imgtec.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-22 21:51:37 +02:00
Michael Niedermayer
d48c8540a2 fate-aac-aref-encode: increase FUZZ to 5, needed for ppc64be
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-05 13:41:51 +01:00
Claudio Freire
84f4be424d avcodec/aacpsy: Fix AAC Psy PE reduction calculation when multiple iterations are required
This is a small change, but it does have a big impact on bit allocation.

all the regressions marked in the report have no audible
difference (I didn't check them all though), but the improvements can
be heard.

This affects mostly high bit rates. It's related to issue #2686.

In the report, A is the patched version, B is unpatched, all
comparisons show deltas in the form (A-B), so a positive pSNR delta
means a better quality in the patched version, and negative a
regression. Regressions are only considered for pSNR deltas below
-1db, they're considered serious below -6db.

All measurements were done with tiny_psnr.

The summary of the report inline for quick reading:

Files: 58
Bitrates: 6
Tests: 347
Serious Regressions: 0 (0%)
Regressions: 10 (2%)
Improvements: 54 (15%)
Big improvements: 26 (7%)
Worst regression - sine_tester.flac - 384k
  - StdDev: 1.68        pSNR: -3.05     maxdiff: -178.00
Best improvement - 07 - Bound.flac - 384k
  - StdDev: -1700.05    pSNR: 20.64     maxdiff: -29595.00
Average          - StdDev: -55.67       pSNR: 1.20      maxdiff: -1593.00

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-02 13:31:31 +01:00
Michael Niedermayer
a40de9ac07 Merge commit '9295d10ea9d138462b7f67d16bf95ae9ca76aca6'
* commit '9295d10ea9d138462b7f67d16bf95ae9ca76aca6':
  fate: Add a test for AAC ELD480.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-07 04:54:39 +01:00
Alex Converse
9295d10ea9 fate: Add a test for AAC ELD480.
The source is er_eld_2100np_48_ep0.mp4 from the official test set.
2015-02-06 18:56:22 -08:00
Carl Eugen Hoyos
12d6ae0142 Fix fate-aac-ln-encode with --target-path (second try). 2014-06-04 00:00:32 +02:00
Carl Eugen Hoyos
ad7de82218 Fix fate-opus and fate-aac-ln-encode with --target-path. 2014-06-03 10:43:14 +02:00
Michael Niedermayer
a57da850c0 Merge commit '9d18a7d3ec09d6d933d648570643fde924aa391a'
* commit '9d18a7d3ec09d6d933d648570643fde924aa391a':
  fate: Update AAC ELD 5.1 ref for recent bugfixes.

also reenable fate-aac-er_ad6000np_44_ep0, as this commit updates the pcm
reference, so that the test works again

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-05 02:37:22 +01:00
Michael Niedermayer
f200ec20b8 Merge commit '42d1b41983971da63302ac3d12091cad1f3d6324'
* commit '42d1b41983971da63302ac3d12091cad1f3d6324':
  fate: Add a test vector for AAC ELD with TNS.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-05 02:09:55 +01:00
Michael Niedermayer
4195ae0fd8 Merge commit 'b2212dec0f011893ec68eecaa990170fa24050d7'
* commit 'b2212dec0f011893ec68eecaa990170fa24050d7':
  aac: Fix TNS decoding for the 512 sample window family.

also temporarily disable fate-aac-er_ad6000np_44_ep0 as this commit
causes a mismatch with the reference pcm file
The test will be reenabled after all fixes and with a new pcm reference

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-05 02:02:02 +01:00
Michael Niedermayer
c69906151b Merge commit 'e2096e2eaa9e75663d6bf0c37d342752aa5a146d'
* commit 'e2096e2eaa9e75663d6bf0c37d342752aa5a146d':
  fate: Add a downsampled SBR testvector

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-05 01:13:48 +01:00
Alex Converse
9d18a7d3ec fate: Update AAC ELD 5.1 ref for recent bugfixes. 2014-01-04 14:42:38 -08:00
Alex Converse
42d1b41983 fate: Add a test vector for AAC ELD with TNS. 2014-01-04 14:42:38 -08:00
Alex Converse
e2096e2eaa fate: Add a downsampled SBR testvector 2014-01-04 14:42:38 -08:00
Michael Niedermayer
7e19c549ba Merge remote-tracking branch 'qatar/master'
* qatar/master:
  fate: aac: Add test for AAC-ELD

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-26 02:58:08 +02:00
Alex Converse
4e326ec769 fate: aac: Add test for AAC-ELD 2013-10-25 19:41:23 +00:00
Michael Niedermayer
123c6ca809 Merge commit 'f52fd3f3b26f0d80e4f0b374b7695383feca5b92'
* commit 'f52fd3f3b26f0d80e4f0b374b7695383feca5b92':
  fate: aac: Add test for AAC-LD

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-17 19:51:12 +02:00
Diego Biurrun
f52fd3f3b2 fate: aac: Add test for AAC-LD 2013-10-17 12:36:35 +02:00
Michael Niedermayer
1f5e5d2205 Merge commit 'ba13606ca6adbc74b4db4a72b0769397d6408791'
* commit 'ba13606ca6adbc74b4db4a72b0769397d6408791':
  fate: Add a --target-samples path parameter

Conflicts:
	configure
	tests/fate/audio.mak
	tests/fate/cover-art.mak
	tests/fate/demux.mak
	tests/fate/ea.mak
	tests/fate/filter-video.mak
	tests/fate/h264.mak
	tests/fate/image.mak
	tests/fate/lossless-audio.mak
	tests/fate/lossless-video.mak
	tests/fate/microsoft.mak
	tests/fate/pcm.mak
	tests/fate/prores.mak
	tests/fate/qt.mak
	tests/fate/real.mak
	tests/fate/screen.mak
	tests/fate/video.mak
	tests/fate/voice.mak
	tests/fate/vpx.mak
	tests/fate/vqf.mak

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-29 04:25:37 +02:00
Martin Storsjö
ba13606ca6 fate: Add a --target-samples path parameter
This allows having the samples accessible via different paths
on the target and on the host.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-05-28 17:16:54 +03:00
Carl Eugen Hoyos
53e3bc3024 Add dependencies for the aac encoding fate tests. 2013-03-08 02:44:07 +01:00
Michael Niedermayer
4d941eac16 Merge commit '3b4296f41473a5b39e84d7a49d480624c9c60040'
* commit '3b4296f41473a5b39e84d7a49d480624c9c60040':
  avformat: clarify stream id for muxing
  fate: Add dependencies for aac, alac, amrnb, amrwb, atrac tests
  ppc: do not pass redundant compiler flags
  avutil: change GET_UTF8 to not use av_log2()
  segment: fix NULL pointer dereference in seg_write_header()

Conflicts:
	tests/fate/aac.mak

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-15 11:12:25 +01:00
Diego Biurrun
a3138ebfa8 fate: Add dependencies for aac, alac, amrnb, amrwb, atrac tests 2012-11-14 15:09:59 +01:00
Michael Niedermayer
1e4e497911 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  fate: atrac: Place atrac1 and atrac3 tests in different groups
  fate: aac: cosmetics: Group AAC LATM tests together
  x86: avresample: Add missing colons to assembly labels

Conflicts:
	tests/fate/aac.mak

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-06 15:11:53 +01:00
Diego Biurrun
06c7b33831 fate: aac: cosmetics: Group AAC LATM tests together 2012-11-06 13:37:36 +01:00
Michael Niedermayer
7d26be63c2 Merge commit '5ff998a233d759d0de83ea6f95c383d03d25d88e'
* commit '5ff998a233d759d0de83ea6f95c383d03d25d88e':
  flacenc: use uint64_t for bit counts
  flacenc: remove wasted trailing 0 bits
  lavu: add av_ctz() for trailing zero bit count
  flacenc: use a separate buffer for byte-swapping for MD5 checksum on big-endian
  fate: aac: Place LATM tests and general AAC tests in different groups
  build: The A64 muxer depends on rawenc.o for ff_raw_write_packet()

Conflicts:
	doc/APIchanges
	libavutil/version.h
	tests/fate/aac.mak

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-05 22:51:20 +01:00