From fcb681ac3edd708f26c3b5014c06e32fd2723887 Mon Sep 17 00:00:00 2001 From: Rostislav Pehlivanov Date: Sat, 13 Jan 2018 11:46:29 +0000 Subject: [PATCH] aacenc: use the fast coder as the default The twoloop coder sounds decent at low bitrates, however at higher bitrates it sounds worse than the fast coder (which used to be the old twoloop coder before October 2015) and needs quite a lot more CPU. Change the default to fast. It has been well tested and has had little changes over the years so its been confirmed to be quite stable. Also change its description (not valid for more than a year) and the documentation. Signed-off-by: Rostislav Pehlivanov --- doc/encoders.texi | 9 ++++----- libavcodec/aacenc.c | 4 ++-- tests/fate/aac.mak | 20 ++++++++++---------- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/doc/encoders.texi b/doc/encoders.texi index 88ef8f9b230..6a410a8cb64 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -64,7 +64,6 @@ to find an optimal combination by adding or subtracting a specific value from all quantizers and adjusting some individual quantizer a little. Will tune itself based on whether @option{aac_is}, @option{aac_ms} and @option{aac_pns} are enabled. -This is the default choice for a coder. @item anmr Average noise to mask ratio (ANMR) trellis-based solution. @@ -77,10 +76,10 @@ Not currently recommended. @item fast Constant quantizer method. -This method sets a constant quantizer for all bands. This is the fastest of all -the methods and has no rate control or support for @option{aac_is} or -@option{aac_pns}. -Not recommended. +Uses a cheaper version of twoloop algorithm that doesn't try to do as many +clever adjustments. Worse with low bitrates (less than 64kbps), but is better +and much faster at higher bitrates. +This is the default choice for a coder @end table diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index fa7932d42d7..6d94c769059 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -1118,10 +1118,10 @@ fail: #define AACENC_FLAGS AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM static const AVOption aacenc_options[] = { - {"aac_coder", "Coding algorithm", offsetof(AACEncContext, options.coder), AV_OPT_TYPE_INT, {.i64 = AAC_CODER_TWOLOOP}, 0, AAC_CODER_NB-1, AACENC_FLAGS, "coder"}, + {"aac_coder", "Coding algorithm", offsetof(AACEncContext, options.coder), AV_OPT_TYPE_INT, {.i64 = AAC_CODER_FAST}, 0, AAC_CODER_NB-1, AACENC_FLAGS, "coder"}, {"anmr", "ANMR method", 0, AV_OPT_TYPE_CONST, {.i64 = AAC_CODER_ANMR}, INT_MIN, INT_MAX, AACENC_FLAGS, "coder"}, {"twoloop", "Two loop searching method", 0, AV_OPT_TYPE_CONST, {.i64 = AAC_CODER_TWOLOOP}, INT_MIN, INT_MAX, AACENC_FLAGS, "coder"}, - {"fast", "Constant quantizer", 0, AV_OPT_TYPE_CONST, {.i64 = AAC_CODER_FAST}, INT_MIN, INT_MAX, AACENC_FLAGS, "coder"}, + {"fast", "Default fast search", 0, AV_OPT_TYPE_CONST, {.i64 = AAC_CODER_FAST}, INT_MIN, INT_MAX, AACENC_FLAGS, "coder"}, {"aac_ms", "Force M/S stereo coding", offsetof(AACEncContext, options.mid_side), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, AACENC_FLAGS}, {"aac_is", "Intensity stereo coding", offsetof(AACEncContext, options.intensity_stereo), AV_OPT_TYPE_BOOL, {.i64 = 1}, -1, 1, AACENC_FLAGS}, {"aac_pns", "Perceptual noise substitution", offsetof(AACEncContext, options.pns), AV_OPT_TYPE_BOOL, {.i64 = 1}, -1, 1, AACENC_FLAGS}, diff --git a/tests/fate/aac.mak b/tests/fate/aac.mak index e8cbcef54d7..5bc6779c39d 100644 --- a/tests/fate/aac.mak +++ b/tests/fate/aac.mak @@ -154,7 +154,7 @@ fate-aac-aref-encode: CMD = enc_dec_pcm adts wav s16le $(REF) -c:a aac -aac_is 0 fate-aac-aref-encode: CMP = stddev fate-aac-aref-encode: REF = ./tests/data/asynth-44100-2.wav fate-aac-aref-encode: CMP_SHIFT = -4096 -fate-aac-aref-encode: CMP_TARGET = 669 +fate-aac-aref-encode: CMP_TARGET = 596 fate-aac-aref-encode: SIZE_TOLERANCE = 2464 fate-aac-aref-encode: FUZZ = 89 @@ -163,7 +163,7 @@ fate-aac-ln-encode: CMD = enc_dec_pcm adts wav s16le $(TARGET_SAMPLES)/audio-ref fate-aac-ln-encode: CMP = stddev fate-aac-ln-encode: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav fate-aac-ln-encode: CMP_SHIFT = -4096 -fate-aac-ln-encode: CMP_TARGET = 61 +fate-aac-ln-encode: CMP_TARGET = 72 fate-aac-ln-encode: SIZE_TOLERANCE = 3560 fate-aac-ln-encode: FUZZ = 30 @@ -172,7 +172,7 @@ fate-aac-ln-encode-128k: CMD = enc_dec_pcm adts wav s16le $(TARGET_SAMPLES)/audi fate-aac-ln-encode-128k: CMP = stddev fate-aac-ln-encode-128k: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav fate-aac-ln-encode-128k: CMP_SHIFT = -4096 -fate-aac-ln-encode-128k: CMP_TARGET = 800 +fate-aac-ln-encode-128k: CMP_TARGET = 622 fate-aac-ln-encode-128k: SIZE_TOLERANCE = 3560 fate-aac-ln-encode-128k: FUZZ = 5 @@ -181,7 +181,7 @@ fate-aac-pns-encode: CMD = enc_dec_pcm adts wav s16le $(TARGET_SAMPLES)/audio-re fate-aac-pns-encode: CMP = stddev fate-aac-pns-encode: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav fate-aac-pns-encode: CMP_SHIFT = -4096 -fate-aac-pns-encode: CMP_TARGET = 616 +fate-aac-pns-encode: CMP_TARGET = 655 fate-aac-pns-encode: SIZE_TOLERANCE = 3560 fate-aac-pns-encode: FUZZ = 74 @@ -190,7 +190,7 @@ fate-aac-tns-encode: CMD = enc_dec_pcm adts wav s16le $(TARGET_SAMPLES)/audio-re fate-aac-tns-encode: CMP = stddev fate-aac-tns-encode: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav fate-aac-tns-encode: CMP_SHIFT = -4096 -fate-aac-tns-encode: CMP_TARGET = 817 +fate-aac-tns-encode: CMP_TARGET = 637 fate-aac-tns-encode: FUZZ = 7 fate-aac-tns-encode: SIZE_TOLERANCE = 3560 @@ -199,7 +199,7 @@ fate-aac-is-encode: CMD = enc_dec_pcm adts wav s16le $(TARGET_SAMPLES)/audio-ref fate-aac-is-encode: CMP = stddev fate-aac-is-encode: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav fate-aac-is-encode: CMP_SHIFT = -4096 -fate-aac-is-encode: CMP_TARGET = 615 +fate-aac-is-encode: CMP_TARGET = 514 fate-aac-is-encode: SIZE_TOLERANCE = 3560 fate-aac-is-encode: FUZZ = 10 @@ -208,7 +208,7 @@ fate-aac-ms-encode: CMD = enc_dec_pcm adts wav s16le $(TARGET_SAMPLES)/audio-ref fate-aac-ms-encode: CMP = stddev fate-aac-ms-encode: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav fate-aac-ms-encode: CMP_SHIFT = -4096 -fate-aac-ms-encode: CMP_TARGET = 675 +fate-aac-ms-encode: CMP_TARGET = 558 fate-aac-ms-encode: SIZE_TOLERANCE = 3560 fate-aac-ms-encode: FUZZ = 15 @@ -217,7 +217,7 @@ fate-aac-ltp-encode: CMD = enc_dec_pcm adts wav s16le $(TARGET_SAMPLES)/audio-re fate-aac-ltp-encode: CMP = stddev fate-aac-ltp-encode: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav fate-aac-ltp-encode: CMP_SHIFT = -4096 -fate-aac-ltp-encode: CMP_TARGET = 1270 +fate-aac-ltp-encode: CMP_TARGET = 1207 fate-aac-ltp-encode: SIZE_TOLERANCE = 3560 fate-aac-ltp-encode: FUZZ = 17 @@ -227,7 +227,7 @@ fate-aac-yoraw-encode: CMD = enc_dec_pcm adts wav s16le $(TARGET_SAMPLES)/audio- fate-aac-yoraw-encode: CMP = stddev fate-aac-yoraw-encode: REF = $(SAMPLES)/audio-reference/yo.raw-short.wav fate-aac-yoraw-encode: CMP_SHIFT = -12288 -fate-aac-yoraw-encode: CMP_TARGET = 259 +fate-aac-yoraw-encode: CMP_TARGET = 226 fate-aac-yoraw-encode: SIZE_TOLERANCE = 3560 fate-aac-yoraw-encode: FUZZ = 17 @@ -237,7 +237,7 @@ fate-aac-pred-encode: CMD = enc_dec_pcm adts wav s16le $(TARGET_SAMPLES)/audio-r fate-aac-pred-encode: CMP = stddev fate-aac-pred-encode: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav fate-aac-pred-encode: CMP_SHIFT = -4096 -fate-aac-pred-encode: CMP_TARGET = 841 +fate-aac-pred-encode: CMP_TARGET = 662 fate-aac-pred-encode: FUZZ = 12 fate-aac-pred-encode: SIZE_TOLERANCE = 3560 -- 2.39.5