[FFmpeg-cvslog] aacdec_usac: use correct TNS values

Lynne git at videolan.org
Sat Jun 8 01:23:20 EEST 2024


ffmpeg | branch: master | Lynne <dev at lynne.ee> | Thu Jun  6 17:33:18 2024 +0200| [722352333524cb2047d09e2548b495f511de4331] | committer: Lynne

aacdec_usac: use correct TNS values

The standard slightly modified the maximum TNS bands allowed.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=722352333524cb2047d09e2548b495f511de4331
---

 libavcodec/aac/aacdec_usac.c | 4 ++--
 libavcodec/aactab.c          | 8 ++++++++
 libavcodec/aactab.h          | 3 +++
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/libavcodec/aac/aacdec_usac.c b/libavcodec/aac/aacdec_usac.c
index 9173f1b354..edbf0bc1be 100644
--- a/libavcodec/aac/aacdec_usac.c
+++ b/libavcodec/aac/aacdec_usac.c
@@ -757,7 +757,7 @@ static int setup_sce(AACDecContext *ac, SingleChannelElement *sce,
             ics->swb_offset = ff_swb_offset_128[usac->rate_idx];
             ics->num_swb = ff_aac_num_swb_128[usac->rate_idx];
         }
-        ics->tns_max_bands = ff_tns_max_bands_128[usac->rate_idx];
+        ics->tns_max_bands = ff_tns_max_bands_usac_128[usac->rate_idx];
 
         /* Setup scalefactor grouping. 7 bit mask. */
         ics->num_window_groups = 0;
@@ -780,7 +780,7 @@ static int setup_sce(AACDecContext *ac, SingleChannelElement *sce,
             ics->swb_offset = ff_swb_offset_1024[usac->rate_idx];
             ics->num_swb = ff_aac_num_swb_1024[usac->rate_idx];
         }
-        ics->tns_max_bands = ff_tns_max_bands_1024[usac->rate_idx];
+        ics->tns_max_bands = ff_tns_max_bands_usac_1024[usac->rate_idx];
 
         ics->group_len[0] = 1;
         ics->num_window_groups = 1;
diff --git a/libavcodec/aactab.c b/libavcodec/aactab.c
index 7b040531aa..8d4587d241 100644
--- a/libavcodec/aactab.c
+++ b/libavcodec/aactab.c
@@ -1985,6 +1985,10 @@ const uint8_t ff_tns_max_bands_1024[] = {
     31, 31, 34, 40, 42, 51, 46, 46, 42, 42, 42, 39, 39
 };
 
+const uint8_t ff_tns_max_bands_usac_1024[] = {
+    31, 31, 34, 40, 42, 51, 47, 47, 43, 43, 43, 40, 40
+};
+
 const uint8_t ff_tns_max_bands_512[] = {
     0, 0, 0, 31, 32, 37, 31, 31, 0, 0, 0, 0, 0
 };
@@ -1996,6 +2000,10 @@ const uint8_t ff_tns_max_bands_480[] = {
 const uint8_t ff_tns_max_bands_128[] = {
     9, 9, 10, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14
 };
+
+const uint8_t ff_tns_max_bands_usac_128[] = {
+    9, 9, 10, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15
+};
 // @}
 
 const uint8_t ff_usac_noise_fill_start_offset[2][2] = {
diff --git a/libavcodec/aactab.h b/libavcodec/aactab.h
index 8dbb2098c5..84879aa8f8 100644
--- a/libavcodec/aactab.h
+++ b/libavcodec/aactab.h
@@ -115,6 +115,9 @@ extern const uint8_t ff_tns_max_bands_512 [13];
 extern const uint8_t ff_tns_max_bands_480 [13];
 extern const uint8_t ff_tns_max_bands_128 [13];
 
+extern const uint8_t ff_tns_max_bands_usac_1024[13];
+extern const uint8_t ff_tns_max_bands_usac_128[13];
+
 /* [x][y], x == 1 -> frame len is 768 frames, y == 1 -> is eight_short */
 extern const uint8_t ff_usac_noise_fill_start_offset[2][2];
 



More information about the ffmpeg-cvslog mailing list