summaryrefslogtreecommitdiff
path: root/libavcodec/aacenc_tns.h
diff options
context:
space:
mode:
authorRostislav Pehlivanov <atomnuker@gmail.com>2015-09-12 13:04:27 +0100
committerRostislav Pehlivanov <atomnuker@gmail.com>2015-09-12 13:04:27 +0100
commita83a8d70681a7093ff4bd8232b8f75fed3d6af48 (patch)
treea28f3bc5df2467018713f86169a622150fdce7a9 /libavcodec/aacenc_tns.h
parent33be39efe31326dc787efc54f5077e4c4b97896c (diff)
aacenc_tns: redo coefficient quantization and decision making
This finally (and again) gets rid of basically everything the specifications say about how TNS should be done. The main problem used to be that a single filter was used for all coefficients which despite being explicitly recommended by the specifications usually sounds wrong, therefore it's a corner case in the current TNS implementation. This commit also changes the coefficient bit size, as apparently it's better to use lower precision in case the windows are eight short. This is apparently what fdk_aac uses, looking at the bit stream and makes sense. Also the order when 8 SHORT windows happen is important as 7 was too much and according to PSNR was worse while 5 is just about correct. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Diffstat (limited to 'libavcodec/aacenc_tns.h')
-rw-r--r--libavcodec/aacenc_tns.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/aacenc_tns.h b/libavcodec/aacenc_tns.h
index f0e75569ae..46e4794965 100644
--- a/libavcodec/aacenc_tns.h
+++ b/libavcodec/aacenc_tns.h
@@ -33,6 +33,9 @@
/* Could be set to 3 to save an additional bit at the cost of little quality */
#define TNS_Q_BITS 4
+/* Coefficient resolution in short windows */
+#define TNS_Q_BITS_SHORT 3
+
/* TNS will only be used if the LPC gain is within these margins */
#define TNS_GAIN_THRESHOLD_LOW 1.395f
#define TNS_GAIN_THRESHOLD_HIGH 11.19f