ffmpeg-cvslog
Threads by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
October 2023
- 2 participants
- 561 discussions
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com> | Mon Sep 25 01:22:09 2023 +0200| [1aca4e7fc533a9ebb79c19b511b8bffd77a6a80b] | committer: Andreas Rheinhardt
avcodec/aacdec_common: Combine huffman tabs
This allows to avoid the relocations inherent in a table
to individual tables; it also reduces padding.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1aca4e7fc533a9ebb…
---
libavcodec/aacdec_common.c | 59 ++++++++--------------------------------------
1 file changed, 10 insertions(+), 49 deletions(-)
diff --git a/libavcodec/aacdec_common.c b/libavcodec/aacdec_common.c
index d03fbdbaec..6a592600dc 100644
--- a/libavcodec/aacdec_common.c
+++ b/libavcodec/aacdec_common.c
@@ -128,8 +128,8 @@ const VLCElem *ff_vlc_spectral[11];
/// Huffman tables for SBR
+static const uint8_t sbr_huffman_tab[][2] = {
/* t_huffman_env_1_5dB - 121 entries */
-static const uint8_t t_huffman_env_1_5dB_tab[][2] = {
{ 60, 2 }, { 59, 2 }, { 61, 3 }, { 58, 3 }, { 62, 4 },
{ 57, 4 }, { 63, 5 }, { 56, 5 }, { 64, 6 }, { 55, 6 },
{ 65, 7 }, { 54, 7 }, { 66, 8 }, { 53, 8 }, { 67, 9 },
@@ -155,10 +155,7 @@ static const uint8_t t_huffman_env_1_5dB_tab[][2] = {
{ 110, 19 }, { 111, 19 }, { 112, 19 }, { 113, 19 }, { 114, 19 },
{ 115, 19 }, { 116, 19 }, { 117, 19 }, { 118, 19 }, { 119, 19 },
{ 120, 19 },
-};
-
/* f_huffman_env_1_5dB - 121 entries */
-static const uint8_t f_huffman_env_1_5dB_tab[][2] = {
{ 60, 2 }, { 59, 2 }, { 61, 3 }, { 58, 3 }, { 57, 4 },
{ 62, 4 }, { 56, 5 }, { 63, 5 }, { 55, 6 }, { 64, 6 },
{ 54, 7 }, { 65, 8 }, { 53, 8 }, { 66, 8 }, { 52, 9 },
@@ -184,10 +181,7 @@ static const uint8_t f_huffman_env_1_5dB_tab[][2] = {
{ 110, 20 }, { 111, 20 }, { 112, 20 }, { 113, 20 }, { 114, 20 },
{ 115, 20 }, { 116, 20 }, { 117, 20 }, { 118, 20 }, { 119, 20 },
{ 120, 20 },
-};
-
/* t_huffman_env_bal_1_5dB - 49 entries */
-static const uint8_t t_huffman_env_bal_1_5dB_tab[][2] = {
{ 24, 1 }, { 25, 2 }, { 23, 3 }, { 26, 4 }, { 22, 5 },
{ 27, 6 }, { 21, 7 }, { 28, 8 }, { 20, 9 }, { 19, 11 },
{ 29, 11 }, { 18, 12 }, { 30, 12 }, { 31, 15 }, { 17, 16 },
@@ -198,10 +192,7 @@ static const uint8_t t_huffman_env_bal_1_5dB_tab[][2] = {
{ 35, 16 }, { 36, 16 }, { 37, 16 }, { 38, 16 }, { 39, 17 },
{ 40, 17 }, { 41, 17 }, { 42, 17 }, { 43, 17 }, { 44, 17 },
{ 45, 17 }, { 46, 17 }, { 47, 17 }, { 48, 17 },
-};
-
/* f_huffman_env_bal_1_5dB - 49 entries */
-static const uint8_t f_huffman_env_bal_1_5dB_tab[][2] = {
{ 24, 1 }, { 23, 2 }, { 25, 3 }, { 22, 4 }, { 26, 5 },
{ 27, 6 }, { 21, 7 }, { 20, 8 }, { 28, 9 }, { 19, 11 },
{ 29, 11 }, { 18, 11 }, { 30, 12 }, { 17, 14 }, { 31, 15 },
@@ -212,10 +203,7 @@ static const uint8_t f_huffman_env_bal_1_5dB_tab[][2] = {
{ 35, 18 }, { 36, 18 }, { 37, 18 }, { 38, 18 }, { 39, 18 },
{ 40, 18 }, { 41, 18 }, { 42, 18 }, { 43, 18 }, { 44, 18 },
{ 45, 18 }, { 46, 18 }, { 47, 19 }, { 48, 19 },
-};
-
/* t_huffman_env_3_0dB - 63 entries */
-static const uint8_t t_huffman_env_3_0dB_tab[][2] = {
{ 31, 1 }, { 30, 2 }, { 32, 3 }, { 29, 4 }, { 33, 5 },
{ 28, 6 }, { 34, 7 }, { 27, 8 }, { 35, 9 }, { 26, 11 },
{ 36, 11 }, { 25, 12 }, { 24, 13 }, { 37, 13 }, { 23, 14 },
@@ -229,10 +217,7 @@ static const uint8_t t_huffman_env_3_0dB_tab[][2] = {
{ 50, 19 }, { 51, 19 }, { 52, 19 }, { 53, 19 }, { 54, 19 },
{ 55, 19 }, { 56, 19 }, { 57, 19 }, { 58, 19 }, { 59, 19 },
{ 60, 19 }, { 61, 19 }, { 62, 19 },
-};
-
/* f_huffman_env_3_0dB - 63 entries */
-static const uint8_t f_huffman_env_3_0dB_tab[][2] = {
{ 31, 1 }, { 30, 2 }, { 32, 3 }, { 29, 4 }, { 33, 5 },
{ 28, 6 }, { 34, 8 }, { 27, 8 }, { 35, 9 }, { 26, 9 },
{ 36, 10 }, { 25, 10 }, { 37, 11 }, { 24, 11 }, { 38, 12 },
@@ -246,28 +231,19 @@ static const uint8_t f_huffman_env_3_0dB_tab[][2] = {
{ 3, 20 }, { 4, 20 }, { 5, 20 }, { 6, 20 }, { 14, 20 },
{ 50, 20 }, { 54, 20 }, { 57, 20 }, { 58, 20 }, { 59, 20 },
{ 60, 20 }, { 61, 20 }, { 62, 20 },
-};
-
/* t_huffman_env_bal_3_0dB - 25 entries */
-static const uint8_t t_huffman_env_bal_3_0dB_tab[][2] = {
{ 12, 1 }, { 13, 2 }, { 11, 3 }, { 10, 4 }, { 14, 5 },
{ 15, 6 }, { 9, 7 }, { 8, 8 }, { 16, 9 }, { 7, 12 },
{ 0, 13 }, { 1, 13 }, { 2, 13 }, { 3, 13 }, { 4, 13 },
{ 5, 13 }, { 6, 13 }, { 17, 13 }, { 18, 13 }, { 19, 13 },
{ 20, 13 }, { 21, 13 }, { 22, 13 }, { 23, 14 }, { 24, 14 },
-};
-
/* f_huffman_env_bal_3_0dB - 25 entries */
-static const uint8_t f_huffman_env_bal_3_0dB_tab[][2] = {
{ 12, 1 }, { 11, 2 }, { 13, 3 }, { 10, 4 }, { 14, 5 },
{ 15, 6 }, { 9, 7 }, { 8, 8 }, { 16, 9 }, { 7, 11 },
{ 17, 12 }, { 18, 13 }, { 0, 13 }, { 1, 13 }, { 2, 13 },
{ 3, 13 }, { 4, 13 }, { 5, 14 }, { 6, 14 }, { 19, 14 },
{ 20, 14 }, { 21, 14 }, { 22, 14 }, { 23, 14 }, { 24, 14 },
-};
-
/* t_huffman_noise_3_0dB - 63 entries */
-static const uint8_t t_huffman_noise_3_0dB_tab[][2] = {
{ 31, 1 }, { 32, 2 }, { 30, 3 }, { 29, 4 }, { 33, 5 },
{ 28, 6 }, { 34, 8 }, { 27, 8 }, { 35, 10 }, { 26, 11 },
{ 36, 13 }, { 42, 13 }, { 0, 13 }, { 1, 13 }, { 2, 13 },
@@ -281,10 +257,7 @@ static const uint8_t t_huffman_noise_3_0dB_tab[][2] = {
{ 50, 13 }, { 51, 13 }, { 52, 13 }, { 53, 13 }, { 54, 13 },
{ 55, 13 }, { 56, 13 }, { 57, 13 }, { 58, 13 }, { 59, 13 },
{ 60, 13 }, { 61, 14 }, { 62, 14 },
-};
-
/* t_huffman_noise_bal_3_0dB - 25 entries */
-static const uint8_t t_huffman_noise_bal_3_0dB_tab[][2] = {
{ 12, 1 }, { 11, 2 }, { 13, 3 }, { 10, 5 }, { 14, 6 },
{ 0, 8 }, { 1, 8 }, { 2, 8 }, { 3, 8 }, { 4, 8 },
{ 5, 8 }, { 6, 8 }, { 7, 8 }, { 8, 8 }, { 9, 8 },
@@ -292,33 +265,20 @@ static const uint8_t t_huffman_noise_bal_3_0dB_tab[][2] = {
{ 20, 8 }, { 21, 8 }, { 22, 8 }, { 23, 8 }, { 24, 8 },
};
+static const uint8_t sbr_huffman_nb_codes[] = {
+ 121, 121, 49, 49, 63, 63, 25, 25, 63, 25
+};
+
const VLCElem *ff_aac_sbr_vlc[10];
static av_cold void aacdec_common_init(void)
{
-#define SBR_VLC_ROW(name) \
- { name ## _tab, FF_ARRAY_ELEMS(name ## _tab) }
- static const struct {
- const uint8_t (*sbr_tab)[2];
- const unsigned int table_size;
- } sbr_tmp[] = {
- SBR_VLC_ROW(t_huffman_env_1_5dB),
- SBR_VLC_ROW(f_huffman_env_1_5dB),
- SBR_VLC_ROW(t_huffman_env_bal_1_5dB),
- SBR_VLC_ROW(f_huffman_env_bal_1_5dB),
- SBR_VLC_ROW(t_huffman_env_3_0dB),
- SBR_VLC_ROW(f_huffman_env_3_0dB),
- SBR_VLC_ROW(t_huffman_env_bal_3_0dB),
- SBR_VLC_ROW(f_huffman_env_bal_3_0dB),
- SBR_VLC_ROW(t_huffman_noise_3_0dB),
- SBR_VLC_ROW(t_huffman_noise_bal_3_0dB),
- };
-
static VLCElem vlc_buf[(304 + 270 + 550 + 300 + 328 +
294 + 306 + 268 + 510 + 366 + 462) +
(1098 + 1092 + 768 + 1026 + 1058 +
1052 + 544 + 544 + 592 + 512)];
VLCInitState state = VLC_INIT_STATE(vlc_buf);
+ const uint8_t (*tab)[2] = sbr_huffman_tab;
for (unsigned i = 0; i < 11; i++) {
#define TAB_WRAP_SIZE(name) name[i], sizeof(name[i][0]), sizeof(name[i][0])
@@ -342,10 +302,11 @@ static av_cold void aacdec_common_init(void)
// SBR VLC table initialization
for (int i = 0; i < FF_ARRAY_ELEMS(ff_aac_sbr_vlc); i++) {
ff_aac_sbr_vlc[i] =
- ff_vlc_init_tables_from_lengths(&state, 9, sbr_tmp[i].table_size,
- &sbr_tmp[i].sbr_tab[0][1], 2,
- &sbr_tmp[i].sbr_tab[0][0], 2, 1,
+ ff_vlc_init_tables_from_lengths(&state, 9, sbr_huffman_nb_codes[i],
+ &tab[0][1], 2,
+ &tab[0][0], 2, 1,
0, 0);
+ tab += sbr_huffman_nb_codes[i];
}
}
1
0
31 Oct '23
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com> | Mon Sep 25 01:05:59 2023 +0200| [2c131f126dc138f3f9cc29cb0b23930a0293434b] | committer: Andreas Rheinhardt
avcodec/aacdec_common: Switch to ff_vlc_init_tables_from_lengths()
It allows to replace code tables of type uint32_t or uint16_t
by symbols of type uint8_t. It is also faster.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2c131f126dc138f3f…
---
libavcodec/aacdec_common.c | 377 ++++++++++++++++++---------------------------
1 file changed, 154 insertions(+), 223 deletions(-)
diff --git a/libavcodec/aacdec_common.c b/libavcodec/aacdec_common.c
index 295ea87dce..d03fbdbaec 100644
--- a/libavcodec/aacdec_common.c
+++ b/libavcodec/aacdec_common.c
@@ -128,245 +128,179 @@ const VLCElem *ff_vlc_spectral[11];
/// Huffman tables for SBR
-static const uint8_t t_huffman_env_1_5dB_bits[121] = {
- 18, 18, 18, 18, 18, 18, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 17, 18, 16, 17, 18, 17,
- 16, 16, 16, 16, 15, 14, 14, 13,
- 13, 12, 11, 10, 9, 8, 7, 6,
- 5, 4, 3, 2, 2, 3, 4, 5,
- 6, 7, 8, 9, 10, 12, 13, 14,
- 14, 15, 16, 17, 16, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19,
- 19,
+ /* t_huffman_env_1_5dB - 121 entries */
+static const uint8_t t_huffman_env_1_5dB_tab[][2] = {
+ { 60, 2 }, { 59, 2 }, { 61, 3 }, { 58, 3 }, { 62, 4 },
+ { 57, 4 }, { 63, 5 }, { 56, 5 }, { 64, 6 }, { 55, 6 },
+ { 65, 7 }, { 54, 7 }, { 66, 8 }, { 53, 8 }, { 67, 9 },
+ { 52, 9 }, { 51, 10 }, { 68, 10 }, { 50, 11 }, { 69, 12 },
+ { 49, 12 }, { 70, 13 }, { 48, 13 }, { 47, 13 }, { 71, 14 },
+ { 46, 14 }, { 72, 14 }, { 45, 14 }, { 44, 15 }, { 73, 15 },
+ { 41, 16 }, { 42, 16 }, { 43, 16 }, { 74, 16 }, { 36, 16 },
+ { 40, 16 }, { 76, 16 }, { 34, 17 }, { 39, 17 }, { 75, 17 },
+ { 37, 17 }, { 35, 18 }, { 38, 18 }, { 0, 18 }, { 1, 18 },
+ { 2, 18 }, { 3, 18 }, { 4, 18 }, { 5, 18 }, { 6, 19 },
+ { 7, 19 }, { 8, 19 }, { 9, 19 }, { 10, 19 }, { 11, 19 },
+ { 12, 19 }, { 13, 19 }, { 14, 19 }, { 15, 19 }, { 16, 19 },
+ { 17, 19 }, { 18, 19 }, { 19, 19 }, { 20, 19 }, { 21, 19 },
+ { 22, 19 }, { 23, 19 }, { 24, 19 }, { 25, 19 }, { 26, 19 },
+ { 27, 19 }, { 28, 19 }, { 29, 19 }, { 30, 19 }, { 31, 19 },
+ { 32, 19 }, { 33, 19 }, { 77, 19 }, { 78, 19 }, { 79, 19 },
+ { 80, 19 }, { 81, 19 }, { 82, 19 }, { 83, 19 }, { 84, 19 },
+ { 85, 19 }, { 86, 19 }, { 87, 19 }, { 88, 19 }, { 89, 19 },
+ { 90, 19 }, { 91, 19 }, { 92, 19 }, { 93, 19 }, { 94, 19 },
+ { 95, 19 }, { 96, 19 }, { 97, 19 }, { 98, 19 }, { 99, 19 },
+ { 100, 19 }, { 101, 19 }, { 102, 19 }, { 103, 19 }, { 104, 19 },
+ { 105, 19 }, { 106, 19 }, { 107, 19 }, { 108, 19 }, { 109, 19 },
+ { 110, 19 }, { 111, 19 }, { 112, 19 }, { 113, 19 }, { 114, 19 },
+ { 115, 19 }, { 116, 19 }, { 117, 19 }, { 118, 19 }, { 119, 19 },
+ { 120, 19 },
};
-static const uint32_t t_huffman_env_1_5dB_codes[121] = {
- 0x3ffd6, 0x3ffd7, 0x3ffd8, 0x3ffd9, 0x3ffda, 0x3ffdb, 0x7ffb8, 0x7ffb9,
- 0x7ffba, 0x7ffbb, 0x7ffbc, 0x7ffbd, 0x7ffbe, 0x7ffbf, 0x7ffc0, 0x7ffc1,
- 0x7ffc2, 0x7ffc3, 0x7ffc4, 0x7ffc5, 0x7ffc6, 0x7ffc7, 0x7ffc8, 0x7ffc9,
- 0x7ffca, 0x7ffcb, 0x7ffcc, 0x7ffcd, 0x7ffce, 0x7ffcf, 0x7ffd0, 0x7ffd1,
- 0x7ffd2, 0x7ffd3, 0x1ffe6, 0x3ffd4, 0x0fff0, 0x1ffe9, 0x3ffd5, 0x1ffe7,
- 0x0fff1, 0x0ffec, 0x0ffed, 0x0ffee, 0x07ff4, 0x03ff9, 0x03ff7, 0x01ffa,
- 0x01ff9, 0x00ffb, 0x007fc, 0x003fc, 0x001fd, 0x000fd, 0x0007d, 0x0003d,
- 0x0001d, 0x0000d, 0x00005, 0x00001, 0x00000, 0x00004, 0x0000c, 0x0001c,
- 0x0003c, 0x0007c, 0x000fc, 0x001fc, 0x003fd, 0x00ffa, 0x01ff8, 0x03ff6,
- 0x03ff8, 0x07ff5, 0x0ffef, 0x1ffe8, 0x0fff2, 0x7ffd4, 0x7ffd5, 0x7ffd6,
- 0x7ffd7, 0x7ffd8, 0x7ffd9, 0x7ffda, 0x7ffdb, 0x7ffdc, 0x7ffdd, 0x7ffde,
- 0x7ffdf, 0x7ffe0, 0x7ffe1, 0x7ffe2, 0x7ffe3, 0x7ffe4, 0x7ffe5, 0x7ffe6,
- 0x7ffe7, 0x7ffe8, 0x7ffe9, 0x7ffea, 0x7ffeb, 0x7ffec, 0x7ffed, 0x7ffee,
- 0x7ffef, 0x7fff0, 0x7fff1, 0x7fff2, 0x7fff3, 0x7fff4, 0x7fff5, 0x7fff6,
- 0x7fff7, 0x7fff8, 0x7fff9, 0x7fffa, 0x7fffb, 0x7fffc, 0x7fffd, 0x7fffe,
- 0x7ffff,
+ /* f_huffman_env_1_5dB - 121 entries */
+static const uint8_t f_huffman_env_1_5dB_tab[][2] = {
+ { 60, 2 }, { 59, 2 }, { 61, 3 }, { 58, 3 }, { 57, 4 },
+ { 62, 4 }, { 56, 5 }, { 63, 5 }, { 55, 6 }, { 64, 6 },
+ { 54, 7 }, { 65, 8 }, { 53, 8 }, { 66, 8 }, { 52, 9 },
+ { 67, 9 }, { 51, 9 }, { 68, 10 }, { 50, 10 }, { 69, 11 },
+ { 49, 11 }, { 70, 11 }, { 71, 11 }, { 48, 12 }, { 72, 12 },
+ { 47, 12 }, { 73, 12 }, { 74, 13 }, { 46, 13 }, { 45, 13 },
+ { 75, 13 }, { 76, 14 }, { 77, 14 }, { 44, 14 }, { 43, 15 },
+ { 42, 15 }, { 41, 16 }, { 78, 16 }, { 79, 16 }, { 40, 16 },
+ { 39, 16 }, { 80, 17 }, { 81, 17 }, { 36, 17 }, { 37, 17 },
+ { 38, 17 }, { 34, 17 }, { 32, 18 }, { 82, 18 }, { 83, 18 },
+ { 85, 18 }, { 19, 18 }, { 35, 18 }, { 86, 18 }, { 87, 18 },
+ { 30, 18 }, { 33, 18 }, { 84, 18 }, { 88, 18 }, { 104, 18 },
+ { 9, 19 }, { 14, 19 }, { 16, 19 }, { 17, 19 }, { 23, 19 },
+ { 27, 19 }, { 29, 19 }, { 31, 19 }, { 90, 19 }, { 97, 19 },
+ { 102, 19 }, { 107, 19 }, { 108, 19 }, { 0, 19 }, { 1, 19 },
+ { 2, 20 }, { 3, 20 }, { 4, 20 }, { 5, 20 }, { 6, 20 },
+ { 7, 20 }, { 8, 20 }, { 10, 20 }, { 11, 20 }, { 12, 20 },
+ { 13, 20 }, { 15, 20 }, { 18, 20 }, { 20, 20 }, { 21, 20 },
+ { 22, 20 }, { 24, 20 }, { 25, 20 }, { 26, 20 }, { 28, 20 },
+ { 89, 20 }, { 91, 20 }, { 92, 20 }, { 93, 20 }, { 94, 20 },
+ { 95, 20 }, { 96, 20 }, { 98, 20 }, { 99, 20 }, { 100, 20 },
+ { 101, 20 }, { 103, 20 }, { 105, 20 }, { 106, 20 }, { 109, 20 },
+ { 110, 20 }, { 111, 20 }, { 112, 20 }, { 113, 20 }, { 114, 20 },
+ { 115, 20 }, { 116, 20 }, { 117, 20 }, { 118, 20 }, { 119, 20 },
+ { 120, 20 },
};
-static const uint8_t f_huffman_env_1_5dB_bits[121] = {
- 19, 19, 20, 20, 20, 20, 20, 20,
- 20, 19, 20, 20, 20, 20, 19, 20,
- 19, 19, 20, 18, 20, 20, 20, 19,
- 20, 20, 20, 19, 20, 19, 18, 19,
- 18, 18, 17, 18, 17, 17, 17, 16,
- 16, 16, 15, 15, 14, 13, 13, 12,
- 12, 11, 10, 9, 9, 8, 7, 6,
- 5, 4, 3, 2, 2, 3, 4, 5,
- 6, 8, 8, 9, 10, 11, 11, 11,
- 12, 12, 13, 13, 14, 14, 16, 16,
- 17, 17, 18, 18, 18, 18, 18, 18,
- 18, 20, 19, 20, 20, 20, 20, 20,
- 20, 19, 20, 20, 20, 20, 19, 20,
- 18, 20, 20, 19, 19, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20,
- 20,
+ /* t_huffman_env_bal_1_5dB - 49 entries */
+static const uint8_t t_huffman_env_bal_1_5dB_tab[][2] = {
+ { 24, 1 }, { 25, 2 }, { 23, 3 }, { 26, 4 }, { 22, 5 },
+ { 27, 6 }, { 21, 7 }, { 28, 8 }, { 20, 9 }, { 19, 11 },
+ { 29, 11 }, { 18, 12 }, { 30, 12 }, { 31, 15 }, { 17, 16 },
+ { 32, 16 }, { 0, 16 }, { 1, 16 }, { 2, 16 }, { 3, 16 },
+ { 4, 16 }, { 5, 16 }, { 6, 16 }, { 7, 16 }, { 8, 16 },
+ { 9, 16 }, { 10, 16 }, { 11, 16 }, { 12, 16 }, { 13, 16 },
+ { 14, 16 }, { 15, 16 }, { 16, 16 }, { 33, 16 }, { 34, 16 },
+ { 35, 16 }, { 36, 16 }, { 37, 16 }, { 38, 16 }, { 39, 17 },
+ { 40, 17 }, { 41, 17 }, { 42, 17 }, { 43, 17 }, { 44, 17 },
+ { 45, 17 }, { 46, 17 }, { 47, 17 }, { 48, 17 },
};
-static const uint32_t f_huffman_env_1_5dB_codes[121] = {
- 0x7ffe7, 0x7ffe8, 0xfffd2, 0xfffd3, 0xfffd4, 0xfffd5, 0xfffd6, 0xfffd7,
- 0xfffd8, 0x7ffda, 0xfffd9, 0xfffda, 0xfffdb, 0xfffdc, 0x7ffdb, 0xfffdd,
- 0x7ffdc, 0x7ffdd, 0xfffde, 0x3ffe4, 0xfffdf, 0xfffe0, 0xfffe1, 0x7ffde,
- 0xfffe2, 0xfffe3, 0xfffe4, 0x7ffdf, 0xfffe5, 0x7ffe0, 0x3ffe8, 0x7ffe1,
- 0x3ffe0, 0x3ffe9, 0x1ffef, 0x3ffe5, 0x1ffec, 0x1ffed, 0x1ffee, 0x0fff4,
- 0x0fff3, 0x0fff0, 0x07ff7, 0x07ff6, 0x03ffa, 0x01ffa, 0x01ff9, 0x00ffa,
- 0x00ff8, 0x007f9, 0x003fb, 0x001fc, 0x001fa, 0x000fb, 0x0007c, 0x0003c,
- 0x0001c, 0x0000c, 0x00005, 0x00001, 0x00000, 0x00004, 0x0000d, 0x0001d,
- 0x0003d, 0x000fa, 0x000fc, 0x001fb, 0x003fa, 0x007f8, 0x007fa, 0x007fb,
- 0x00ff9, 0x00ffb, 0x01ff8, 0x01ffb, 0x03ff8, 0x03ff9, 0x0fff1, 0x0fff2,
- 0x1ffea, 0x1ffeb, 0x3ffe1, 0x3ffe2, 0x3ffea, 0x3ffe3, 0x3ffe6, 0x3ffe7,
- 0x3ffeb, 0xfffe6, 0x7ffe2, 0xfffe7, 0xfffe8, 0xfffe9, 0xfffea, 0xfffeb,
- 0xfffec, 0x7ffe3, 0xfffed, 0xfffee, 0xfffef, 0xffff0, 0x7ffe4, 0xffff1,
- 0x3ffec, 0xffff2, 0xffff3, 0x7ffe5, 0x7ffe6, 0xffff4, 0xffff5, 0xffff6,
- 0xffff7, 0xffff8, 0xffff9, 0xffffa, 0xffffb, 0xffffc, 0xffffd, 0xffffe,
- 0xfffff,
+ /* f_huffman_env_bal_1_5dB - 49 entries */
+static const uint8_t f_huffman_env_bal_1_5dB_tab[][2] = {
+ { 24, 1 }, { 23, 2 }, { 25, 3 }, { 22, 4 }, { 26, 5 },
+ { 27, 6 }, { 21, 7 }, { 20, 8 }, { 28, 9 }, { 19, 11 },
+ { 29, 11 }, { 18, 11 }, { 30, 12 }, { 17, 14 }, { 31, 15 },
+ { 32, 16 }, { 15, 16 }, { 16, 17 }, { 0, 18 }, { 1, 18 },
+ { 2, 18 }, { 3, 18 }, { 4, 18 }, { 5, 18 }, { 6, 18 },
+ { 7, 18 }, { 8, 18 }, { 9, 18 }, { 10, 18 }, { 11, 18 },
+ { 12, 18 }, { 13, 18 }, { 14, 18 }, { 33, 18 }, { 34, 18 },
+ { 35, 18 }, { 36, 18 }, { 37, 18 }, { 38, 18 }, { 39, 18 },
+ { 40, 18 }, { 41, 18 }, { 42, 18 }, { 43, 18 }, { 44, 18 },
+ { 45, 18 }, { 46, 18 }, { 47, 19 }, { 48, 19 },
};
-static const uint8_t t_huffman_env_bal_1_5dB_bits[49] = {
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 12, 11, 9, 7, 5, 3,
- 1, 2, 4, 6, 8, 11, 12, 15,
- 16, 16, 16, 16, 16, 16, 16, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17,
+ /* t_huffman_env_3_0dB - 63 entries */
+static const uint8_t t_huffman_env_3_0dB_tab[][2] = {
+ { 31, 1 }, { 30, 2 }, { 32, 3 }, { 29, 4 }, { 33, 5 },
+ { 28, 6 }, { 34, 7 }, { 27, 8 }, { 35, 9 }, { 26, 11 },
+ { 36, 11 }, { 25, 12 }, { 24, 13 }, { 37, 13 }, { 23, 14 },
+ { 38, 14 }, { 22, 14 }, { 21, 14 }, { 39, 14 }, { 40, 15 },
+ { 41, 16 }, { 18, 16 }, { 20, 16 }, { 19, 16 }, { 17, 17 },
+ { 42, 17 }, { 43, 18 }, { 0, 18 }, { 1, 18 }, { 2, 19 },
+ { 3, 19 }, { 4, 19 }, { 5, 19 }, { 6, 19 }, { 7, 19 },
+ { 8, 19 }, { 9, 19 }, { 10, 19 }, { 11, 19 }, { 12, 19 },
+ { 13, 19 }, { 14, 19 }, { 15, 19 }, { 16, 19 }, { 44, 19 },
+ { 45, 19 }, { 46, 19 }, { 47, 19 }, { 48, 19 }, { 49, 19 },
+ { 50, 19 }, { 51, 19 }, { 52, 19 }, { 53, 19 }, { 54, 19 },
+ { 55, 19 }, { 56, 19 }, { 57, 19 }, { 58, 19 }, { 59, 19 },
+ { 60, 19 }, { 61, 19 }, { 62, 19 },
};
-static const uint32_t t_huffman_env_bal_1_5dB_codes[49] = {
- 0x0ffe4, 0x0ffe5, 0x0ffe6, 0x0ffe7, 0x0ffe8, 0x0ffe9, 0x0ffea, 0x0ffeb,
- 0x0ffec, 0x0ffed, 0x0ffee, 0x0ffef, 0x0fff0, 0x0fff1, 0x0fff2, 0x0fff3,
- 0x0fff4, 0x0ffe2, 0x00ffc, 0x007fc, 0x001fe, 0x0007e, 0x0001e, 0x00006,
- 0x00000, 0x00002, 0x0000e, 0x0003e, 0x000fe, 0x007fd, 0x00ffd, 0x07ff0,
- 0x0ffe3, 0x0fff5, 0x0fff6, 0x0fff7, 0x0fff8, 0x0fff9, 0x0fffa, 0x1fff6,
- 0x1fff7, 0x1fff8, 0x1fff9, 0x1fffa, 0x1fffb, 0x1fffc, 0x1fffd, 0x1fffe,
- 0x1ffff,
+ /* f_huffman_env_3_0dB - 63 entries */
+static const uint8_t f_huffman_env_3_0dB_tab[][2] = {
+ { 31, 1 }, { 30, 2 }, { 32, 3 }, { 29, 4 }, { 33, 5 },
+ { 28, 6 }, { 34, 8 }, { 27, 8 }, { 35, 9 }, { 26, 9 },
+ { 36, 10 }, { 25, 10 }, { 37, 11 }, { 24, 11 }, { 38, 12 },
+ { 23, 12 }, { 39, 13 }, { 40, 14 }, { 22, 14 }, { 21, 15 },
+ { 41, 15 }, { 42, 15 }, { 20, 16 }, { 19, 16 }, { 43, 16 },
+ { 44, 16 }, { 18, 17 }, { 16, 17 }, { 45, 17 }, { 46, 17 },
+ { 17, 18 }, { 49, 18 }, { 13, 18 }, { 7, 18 }, { 12, 18 },
+ { 47, 18 }, { 48, 18 }, { 9, 19 }, { 10, 19 }, { 15, 19 },
+ { 51, 19 }, { 52, 19 }, { 53, 19 }, { 56, 19 }, { 8, 19 },
+ { 11, 19 }, { 55, 19 }, { 0, 20 }, { 1, 20 }, { 2, 20 },
+ { 3, 20 }, { 4, 20 }, { 5, 20 }, { 6, 20 }, { 14, 20 },
+ { 50, 20 }, { 54, 20 }, { 57, 20 }, { 58, 20 }, { 59, 20 },
+ { 60, 20 }, { 61, 20 }, { 62, 20 },
};
-static const uint8_t f_huffman_env_bal_1_5dB_bits[49] = {
- 18, 18, 18, 18, 18, 18, 18, 18,
- 18, 18, 18, 18, 18, 18, 18, 16,
- 17, 14, 11, 11, 8, 7, 4, 2,
- 1, 3, 5, 6, 9, 11, 12, 15,
- 16, 18, 18, 18, 18, 18, 18, 18,
- 18, 18, 18, 18, 18, 18, 18, 19,
- 19,
+ /* t_huffman_env_bal_3_0dB - 25 entries */
+static const uint8_t t_huffman_env_bal_3_0dB_tab[][2] = {
+ { 12, 1 }, { 13, 2 }, { 11, 3 }, { 10, 4 }, { 14, 5 },
+ { 15, 6 }, { 9, 7 }, { 8, 8 }, { 16, 9 }, { 7, 12 },
+ { 0, 13 }, { 1, 13 }, { 2, 13 }, { 3, 13 }, { 4, 13 },
+ { 5, 13 }, { 6, 13 }, { 17, 13 }, { 18, 13 }, { 19, 13 },
+ { 20, 13 }, { 21, 13 }, { 22, 13 }, { 23, 14 }, { 24, 14 },
};
-static const uint32_t f_huffman_env_bal_1_5dB_codes[49] = {
- 0x3ffe2, 0x3ffe3, 0x3ffe4, 0x3ffe5, 0x3ffe6, 0x3ffe7, 0x3ffe8, 0x3ffe9,
- 0x3ffea, 0x3ffeb, 0x3ffec, 0x3ffed, 0x3ffee, 0x3ffef, 0x3fff0, 0x0fff7,
- 0x1fff0, 0x03ffc, 0x007fe, 0x007fc, 0x000fe, 0x0007e, 0x0000e, 0x00002,
- 0x00000, 0x00006, 0x0001e, 0x0003e, 0x001fe, 0x007fd, 0x00ffe, 0x07ffa,
- 0x0fff6, 0x3fff1, 0x3fff2, 0x3fff3, 0x3fff4, 0x3fff5, 0x3fff6, 0x3fff7,
- 0x3fff8, 0x3fff9, 0x3fffa, 0x3fffb, 0x3fffc, 0x3fffd, 0x3fffe, 0x7fffe,
- 0x7ffff,
+ /* f_huffman_env_bal_3_0dB - 25 entries */
+static const uint8_t f_huffman_env_bal_3_0dB_tab[][2] = {
+ { 12, 1 }, { 11, 2 }, { 13, 3 }, { 10, 4 }, { 14, 5 },
+ { 15, 6 }, { 9, 7 }, { 8, 8 }, { 16, 9 }, { 7, 11 },
+ { 17, 12 }, { 18, 13 }, { 0, 13 }, { 1, 13 }, { 2, 13 },
+ { 3, 13 }, { 4, 13 }, { 5, 14 }, { 6, 14 }, { 19, 14 },
+ { 20, 14 }, { 21, 14 }, { 22, 14 }, { 23, 14 }, { 24, 14 },
};
-static const uint8_t t_huffman_env_3_0dB_bits[63] = {
- 18, 18, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 17, 16, 16, 16, 14, 14, 14,
- 13, 12, 11, 8, 6, 4, 2, 1,
- 3, 5, 7, 9, 11, 13, 14, 14,
- 15, 16, 17, 18, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19,
+ /* t_huffman_noise_3_0dB - 63 entries */
+static const uint8_t t_huffman_noise_3_0dB_tab[][2] = {
+ { 31, 1 }, { 32, 2 }, { 30, 3 }, { 29, 4 }, { 33, 5 },
+ { 28, 6 }, { 34, 8 }, { 27, 8 }, { 35, 10 }, { 26, 11 },
+ { 36, 13 }, { 42, 13 }, { 0, 13 }, { 1, 13 }, { 2, 13 },
+ { 3, 13 }, { 4, 13 }, { 5, 13 }, { 6, 13 }, { 7, 13 },
+ { 8, 13 }, { 9, 13 }, { 10, 13 }, { 11, 13 }, { 12, 13 },
+ { 13, 13 }, { 14, 13 }, { 15, 13 }, { 16, 13 }, { 17, 13 },
+ { 18, 13 }, { 19, 13 }, { 20, 13 }, { 21, 13 }, { 22, 13 },
+ { 23, 13 }, { 24, 13 }, { 25, 13 }, { 37, 13 }, { 38, 13 },
+ { 39, 13 }, { 40, 13 }, { 41, 13 }, { 43, 13 }, { 44, 13 },
+ { 45, 13 }, { 46, 13 }, { 47, 13 }, { 48, 13 }, { 49, 13 },
+ { 50, 13 }, { 51, 13 }, { 52, 13 }, { 53, 13 }, { 54, 13 },
+ { 55, 13 }, { 56, 13 }, { 57, 13 }, { 58, 13 }, { 59, 13 },
+ { 60, 13 }, { 61, 14 }, { 62, 14 },
};
-static const uint32_t t_huffman_env_3_0dB_codes[63] = {
- 0x3ffed, 0x3ffee, 0x7ffde, 0x7ffdf, 0x7ffe0, 0x7ffe1, 0x7ffe2, 0x7ffe3,
- 0x7ffe4, 0x7ffe5, 0x7ffe6, 0x7ffe7, 0x7ffe8, 0x7ffe9, 0x7ffea, 0x7ffeb,
- 0x7ffec, 0x1fff4, 0x0fff7, 0x0fff9, 0x0fff8, 0x03ffb, 0x03ffa, 0x03ff8,
- 0x01ffa, 0x00ffc, 0x007fc, 0x000fe, 0x0003e, 0x0000e, 0x00002, 0x00000,
- 0x00006, 0x0001e, 0x0007e, 0x001fe, 0x007fd, 0x01ffb, 0x03ff9, 0x03ffc,
- 0x07ffa, 0x0fff6, 0x1fff5, 0x3ffec, 0x7ffed, 0x7ffee, 0x7ffef, 0x7fff0,
- 0x7fff1, 0x7fff2, 0x7fff3, 0x7fff4, 0x7fff5, 0x7fff6, 0x7fff7, 0x7fff8,
- 0x7fff9, 0x7fffa, 0x7fffb, 0x7fffc, 0x7fffd, 0x7fffe, 0x7ffff,
-};
-
-static const uint8_t f_huffman_env_3_0dB_bits[63] = {
- 20, 20, 20, 20, 20, 20, 20, 18,
- 19, 19, 19, 19, 18, 18, 20, 19,
- 17, 18, 17, 16, 16, 15, 14, 12,
- 11, 10, 9, 8, 6, 4, 2, 1,
- 3, 5, 8, 9, 10, 11, 12, 13,
- 14, 15, 15, 16, 16, 17, 17, 18,
- 18, 18, 20, 19, 19, 19, 20, 19,
- 19, 20, 20, 20, 20, 20, 20,
-};
-
-static const uint32_t f_huffman_env_3_0dB_codes[63] = {
- 0xffff0, 0xffff1, 0xffff2, 0xffff3, 0xffff4, 0xffff5, 0xffff6, 0x3fff3,
- 0x7fff5, 0x7ffee, 0x7ffef, 0x7fff6, 0x3fff4, 0x3fff2, 0xffff7, 0x7fff0,
- 0x1fff5, 0x3fff0, 0x1fff4, 0x0fff7, 0x0fff6, 0x07ff8, 0x03ffb, 0x00ffd,
- 0x007fd, 0x003fd, 0x001fd, 0x000fd, 0x0003e, 0x0000e, 0x00002, 0x00000,
- 0x00006, 0x0001e, 0x000fc, 0x001fc, 0x003fc, 0x007fc, 0x00ffc, 0x01ffc,
- 0x03ffa, 0x07ff9, 0x07ffa, 0x0fff8, 0x0fff9, 0x1fff6, 0x1fff7, 0x3fff5,
- 0x3fff6, 0x3fff1, 0xffff8, 0x7fff1, 0x7fff2, 0x7fff3, 0xffff9, 0x7fff7,
- 0x7fff4, 0xffffa, 0xffffb, 0xffffc, 0xffffd, 0xffffe, 0xfffff,
-};
-
-static const uint8_t t_huffman_env_bal_3_0dB_bits[25] = {
- 13, 13, 13, 13, 13, 13, 13, 12,
- 8, 7, 4, 3, 1, 2, 5, 6,
- 9, 13, 13, 13, 13, 13, 13, 14,
- 14,
-};
-
-static const uint16_t t_huffman_env_bal_3_0dB_codes[25] = {
- 0x1ff2, 0x1ff3, 0x1ff4, 0x1ff5, 0x1ff6, 0x1ff7, 0x1ff8, 0x0ff8,
- 0x00fe, 0x007e, 0x000e, 0x0006, 0x0000, 0x0002, 0x001e, 0x003e,
- 0x01fe, 0x1ff9, 0x1ffa, 0x1ffb, 0x1ffc, 0x1ffd, 0x1ffe, 0x3ffe,
- 0x3fff,
-};
-
-static const uint8_t f_huffman_env_bal_3_0dB_bits[25] = {
- 13, 13, 13, 13, 13, 14, 14, 11,
- 8, 7, 4, 2, 1, 3, 5, 6,
- 9, 12, 13, 14, 14, 14, 14, 14,
- 14,
-};
-
-static const uint16_t f_huffman_env_bal_3_0dB_codes[25] = {
- 0x1ff7, 0x1ff8, 0x1ff9, 0x1ffa, 0x1ffb, 0x3ff8, 0x3ff9, 0x07fc,
- 0x00fe, 0x007e, 0x000e, 0x0002, 0x0000, 0x0006, 0x001e, 0x003e,
- 0x01fe, 0x0ffa, 0x1ff6, 0x3ffa, 0x3ffb, 0x3ffc, 0x3ffd, 0x3ffe,
- 0x3fff,
-};
-
-static const uint8_t t_huffman_noise_3_0dB_bits[63] = {
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 11, 8, 6, 4, 3, 1,
- 2, 5, 8, 10, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 14, 14,
-};
-
-static const uint16_t t_huffman_noise_3_0dB_codes[63] = {
- 0x1fce, 0x1fcf, 0x1fd0, 0x1fd1, 0x1fd2, 0x1fd3, 0x1fd4, 0x1fd5,
- 0x1fd6, 0x1fd7, 0x1fd8, 0x1fd9, 0x1fda, 0x1fdb, 0x1fdc, 0x1fdd,
- 0x1fde, 0x1fdf, 0x1fe0, 0x1fe1, 0x1fe2, 0x1fe3, 0x1fe4, 0x1fe5,
- 0x1fe6, 0x1fe7, 0x07f2, 0x00fd, 0x003e, 0x000e, 0x0006, 0x0000,
- 0x0002, 0x001e, 0x00fc, 0x03f8, 0x1fcc, 0x1fe8, 0x1fe9, 0x1fea,
- 0x1feb, 0x1fec, 0x1fcd, 0x1fed, 0x1fee, 0x1fef, 0x1ff0, 0x1ff1,
- 0x1ff2, 0x1ff3, 0x1ff4, 0x1ff5, 0x1ff6, 0x1ff7, 0x1ff8, 0x1ff9,
- 0x1ffa, 0x1ffb, 0x1ffc, 0x1ffd, 0x1ffe, 0x3ffe, 0x3fff,
-};
-
-static const uint8_t t_huffman_noise_bal_3_0dB_bits[25] = {
- 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 5, 2, 1, 3, 6, 8,
- 8, 8, 8, 8, 8, 8, 8, 8,
- 8,
-};
-
-static const uint8_t t_huffman_noise_bal_3_0dB_codes[25] = {
- 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3,
- 0xf4, 0xf5, 0x1c, 0x02, 0x00, 0x06, 0x3a, 0xf6,
- 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe,
- 0xff,
+ /* t_huffman_noise_bal_3_0dB - 25 entries */
+static const uint8_t t_huffman_noise_bal_3_0dB_tab[][2] = {
+ { 12, 1 }, { 11, 2 }, { 13, 3 }, { 10, 5 }, { 14, 6 },
+ { 0, 8 }, { 1, 8 }, { 2, 8 }, { 3, 8 }, { 4, 8 },
+ { 5, 8 }, { 6, 8 }, { 7, 8 }, { 8, 8 }, { 9, 8 },
+ { 15, 8 }, { 16, 8 }, { 17, 8 }, { 18, 8 }, { 19, 8 },
+ { 20, 8 }, { 21, 8 }, { 22, 8 }, { 23, 8 }, { 24, 8 },
};
const VLCElem *ff_aac_sbr_vlc[10];
static av_cold void aacdec_common_init(void)
{
-#define SBR_INIT_VLC_STATIC(num) \
- ff_aac_sbr_vlc[num] = \
- ff_vlc_init_tables_sparse(&state, 9, sbr_tmp[num].table_size / sbr_tmp[num].elem_size, \
- sbr_tmp[num].sbr_bits , 1, 1, \
- sbr_tmp[num].sbr_codes, sbr_tmp[num].elem_size, sbr_tmp[num].elem_size, \
- NULL, 0, 0, 0)
#define SBR_VLC_ROW(name) \
- { name ## _codes, name ## _bits, sizeof(name ## _codes), sizeof(name ## _codes[0]) }
+ { name ## _tab, FF_ARRAY_ELEMS(name ## _tab) }
static const struct {
- const void *sbr_codes, *sbr_bits;
- const unsigned int table_size, elem_size;
+ const uint8_t (*sbr_tab)[2];
+ const unsigned int table_size;
} sbr_tmp[] = {
SBR_VLC_ROW(t_huffman_env_1_5dB),
SBR_VLC_ROW(f_huffman_env_1_5dB),
@@ -406,16 +340,13 @@ static av_cold void aacdec_common_init(void)
sizeof(ff_aac_scalefactor_code[0]), 0);
// SBR VLC table initialization
- SBR_INIT_VLC_STATIC(0);
- SBR_INIT_VLC_STATIC(1);
- SBR_INIT_VLC_STATIC(2);
- SBR_INIT_VLC_STATIC(3);
- SBR_INIT_VLC_STATIC(4);
- SBR_INIT_VLC_STATIC(5);
- SBR_INIT_VLC_STATIC(6);
- SBR_INIT_VLC_STATIC(7);
- SBR_INIT_VLC_STATIC(8);
- SBR_INIT_VLC_STATIC(9);
+ for (int i = 0; i < FF_ARRAY_ELEMS(ff_aac_sbr_vlc); i++) {
+ ff_aac_sbr_vlc[i] =
+ ff_vlc_init_tables_from_lengths(&state, 9, sbr_tmp[i].table_size,
+ &sbr_tmp[i].sbr_tab[0][1], 2,
+ &sbr_tmp[i].sbr_tab[0][0], 2, 1,
+ 0, 0);
+ }
}
av_cold void ff_aacdec_common_init_once(void)
1
0
avcodec/aacdec_common: Avoid superfluous VLC structures for SBR VLCs
by Andreas Rheinhardt 31 Oct '23
by Andreas Rheinhardt 31 Oct '23
31 Oct '23
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com> | Mon Sep 25 00:54:01 2023 +0200| [0b4e69cc87a01b92788b63e423620a5dfdf88f4b] | committer: Andreas Rheinhardt
avcodec/aacdec_common: Avoid superfluous VLC structures for SBR VLCs
For all VLCs here, the number of bits of the VLC is
write-only, because it is hardcoded at the call site.
Therefore one can replace these VLC structures with
the only thing that is actually used: The pointer
to the VLCElem table.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0b4e69cc87a01b927…
---
libavcodec/aacdec_common.c | 35 +++++++++++++++++++----------------
libavcodec/aacdectab.h | 2 +-
libavcodec/aacsbr_template.c | 24 ++++++++++++------------
3 files changed, 32 insertions(+), 29 deletions(-)
diff --git a/libavcodec/aacdec_common.c b/libavcodec/aacdec_common.c
index cbd2a9ccd2..295ea87dce 100644
--- a/libavcodec/aacdec_common.c
+++ b/libavcodec/aacdec_common.c
@@ -352,15 +352,16 @@ static const uint8_t t_huffman_noise_bal_3_0dB_codes[25] = {
0xff,
};
-VLC ff_aac_sbr_vlc[10];
+const VLCElem *ff_aac_sbr_vlc[10];
static av_cold void aacdec_common_init(void)
{
-#define SBR_INIT_VLC_STATIC(num, size) \
- VLC_INIT_STATIC(&ff_aac_sbr_vlc[num], 9, sbr_tmp[num].table_size / sbr_tmp[num].elem_size, \
+#define SBR_INIT_VLC_STATIC(num) \
+ ff_aac_sbr_vlc[num] = \
+ ff_vlc_init_tables_sparse(&state, 9, sbr_tmp[num].table_size / sbr_tmp[num].elem_size, \
sbr_tmp[num].sbr_bits , 1, 1, \
sbr_tmp[num].sbr_codes, sbr_tmp[num].elem_size, sbr_tmp[num].elem_size, \
- size)
+ NULL, 0, 0, 0)
#define SBR_VLC_ROW(name) \
{ name ## _codes, name ## _bits, sizeof(name ## _codes), sizeof(name ## _codes[0]) }
static const struct {
@@ -379,8 +380,10 @@ static av_cold void aacdec_common_init(void)
SBR_VLC_ROW(t_huffman_noise_bal_3_0dB),
};
- static VLCElem vlc_buf[304 + 270 + 550 + 300 + 328 +
- 294 + 306 + 268 + 510 + 366 + 462];
+ static VLCElem vlc_buf[(304 + 270 + 550 + 300 + 328 +
+ 294 + 306 + 268 + 510 + 366 + 462) +
+ (1098 + 1092 + 768 + 1026 + 1058 +
+ 1052 + 544 + 544 + 592 + 512)];
VLCInitState state = VLC_INIT_STATE(vlc_buf);
for (unsigned i = 0; i < 11; i++) {
@@ -403,16 +406,16 @@ static av_cold void aacdec_common_init(void)
sizeof(ff_aac_scalefactor_code[0]), 0);
// SBR VLC table initialization
- SBR_INIT_VLC_STATIC(0, 1098);
- SBR_INIT_VLC_STATIC(1, 1092);
- SBR_INIT_VLC_STATIC(2, 768);
- SBR_INIT_VLC_STATIC(3, 1026);
- SBR_INIT_VLC_STATIC(4, 1058);
- SBR_INIT_VLC_STATIC(5, 1052);
- SBR_INIT_VLC_STATIC(6, 544);
- SBR_INIT_VLC_STATIC(7, 544);
- SBR_INIT_VLC_STATIC(8, 592);
- SBR_INIT_VLC_STATIC(9, 512);
+ SBR_INIT_VLC_STATIC(0);
+ SBR_INIT_VLC_STATIC(1);
+ SBR_INIT_VLC_STATIC(2);
+ SBR_INIT_VLC_STATIC(3);
+ SBR_INIT_VLC_STATIC(4);
+ SBR_INIT_VLC_STATIC(5);
+ SBR_INIT_VLC_STATIC(6);
+ SBR_INIT_VLC_STATIC(7);
+ SBR_INIT_VLC_STATIC(8);
+ SBR_INIT_VLC_STATIC(9);
}
av_cold void ff_aacdec_common_init_once(void)
diff --git a/libavcodec/aacdectab.h b/libavcodec/aacdectab.h
index 02e0d8a48e..7079b061fc 100644
--- a/libavcodec/aacdectab.h
+++ b/libavcodec/aacdectab.h
@@ -38,7 +38,7 @@
FF_VISIBILITY_PUSH_HIDDEN
void ff_aacdec_common_init_once(void);
-extern VLC ff_aac_sbr_vlc[10];
+extern const VLCElem *ff_aac_sbr_vlc[10];
extern VLCElem ff_vlc_scalefactors[];
extern const VLCElem *ff_vlc_spectral[11];
diff --git a/libavcodec/aacsbr_template.c b/libavcodec/aacsbr_template.c
index 26be2739d3..a82be8a8d5 100644
--- a/libavcodec/aacsbr_template.c
+++ b/libavcodec/aacsbr_template.c
@@ -811,29 +811,29 @@ static int read_sbr_envelope(AACContext *ac, SpectralBandReplication *sbr, GetBi
if (sbr->bs_coupling && ch) {
if (ch_data->bs_amp_res) {
bits = 5;
- t_huff = ff_aac_sbr_vlc[T_HUFFMAN_ENV_BAL_3_0DB].table;
+ t_huff = ff_aac_sbr_vlc[T_HUFFMAN_ENV_BAL_3_0DB];
t_lav = vlc_sbr_lav[T_HUFFMAN_ENV_BAL_3_0DB];
- f_huff = ff_aac_sbr_vlc[F_HUFFMAN_ENV_BAL_3_0DB].table;
+ f_huff = ff_aac_sbr_vlc[F_HUFFMAN_ENV_BAL_3_0DB];
f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_BAL_3_0DB];
} else {
bits = 6;
- t_huff = ff_aac_sbr_vlc[T_HUFFMAN_ENV_BAL_1_5DB].table;
+ t_huff = ff_aac_sbr_vlc[T_HUFFMAN_ENV_BAL_1_5DB];
t_lav = vlc_sbr_lav[T_HUFFMAN_ENV_BAL_1_5DB];
- f_huff = ff_aac_sbr_vlc[F_HUFFMAN_ENV_BAL_1_5DB].table;
+ f_huff = ff_aac_sbr_vlc[F_HUFFMAN_ENV_BAL_1_5DB];
f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_BAL_1_5DB];
}
} else {
if (ch_data->bs_amp_res) {
bits = 6;
- t_huff = ff_aac_sbr_vlc[T_HUFFMAN_ENV_3_0DB].table;
+ t_huff = ff_aac_sbr_vlc[T_HUFFMAN_ENV_3_0DB];
t_lav = vlc_sbr_lav[T_HUFFMAN_ENV_3_0DB];
- f_huff = ff_aac_sbr_vlc[F_HUFFMAN_ENV_3_0DB].table;
+ f_huff = ff_aac_sbr_vlc[F_HUFFMAN_ENV_3_0DB];
f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_3_0DB];
} else {
bits = 7;
- t_huff = ff_aac_sbr_vlc[T_HUFFMAN_ENV_1_5DB].table;
+ t_huff = ff_aac_sbr_vlc[T_HUFFMAN_ENV_1_5DB];
t_lav = vlc_sbr_lav[T_HUFFMAN_ENV_1_5DB];
- f_huff = ff_aac_sbr_vlc[F_HUFFMAN_ENV_1_5DB].table;
+ f_huff = ff_aac_sbr_vlc[F_HUFFMAN_ENV_1_5DB];
f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_1_5DB];
}
}
@@ -896,14 +896,14 @@ static int read_sbr_noise(AACContext *ac, SpectralBandReplication *sbr, GetBitCo
int delta = (ch == 1 && sbr->bs_coupling == 1) + 1;
if (sbr->bs_coupling && ch) {
- t_huff = ff_aac_sbr_vlc[T_HUFFMAN_NOISE_BAL_3_0DB].table;
+ t_huff = ff_aac_sbr_vlc[T_HUFFMAN_NOISE_BAL_3_0DB];
t_lav = vlc_sbr_lav[T_HUFFMAN_NOISE_BAL_3_0DB];
- f_huff = ff_aac_sbr_vlc[F_HUFFMAN_ENV_BAL_3_0DB].table;
+ f_huff = ff_aac_sbr_vlc[F_HUFFMAN_ENV_BAL_3_0DB];
f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_BAL_3_0DB];
} else {
- t_huff = ff_aac_sbr_vlc[T_HUFFMAN_NOISE_3_0DB].table;
+ t_huff = ff_aac_sbr_vlc[T_HUFFMAN_NOISE_3_0DB];
t_lav = vlc_sbr_lav[T_HUFFMAN_NOISE_3_0DB];
- f_huff = ff_aac_sbr_vlc[F_HUFFMAN_ENV_3_0DB].table;
+ f_huff = ff_aac_sbr_vlc[F_HUFFMAN_ENV_3_0DB];
f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_3_0DB];
}
1
0
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com> | Sun Sep 24 23:58:05 2023 +0200| [22d60524d8dd1ba2468260cfd0c0ee2a15b9c34d] | committer: Andreas Rheinhardt
avcodec/aacsbr_template: Deduplicate VLCs
The VLCs, their init code and the tables used for initialization
are currently duplicated for the floating- and fixed-point decoders.
This commit stops doing so and moves this stuff to aacdec_common.c.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=22d60524d8dd1ba24…
---
libavcodec/aacdec_common.c | 263 +++++++++++++++++++++++++++++++++++++++++++
libavcodec/aacdectab.h | 2 +
libavcodec/aacsbr.c | 1 -
libavcodec/aacsbr.h | 11 +-
libavcodec/aacsbr_fixed.c | 1 -
libavcodec/aacsbr_template.c | 53 +++------
libavcodec/aacsbrdata.h | 226 -------------------------------------
7 files changed, 279 insertions(+), 278 deletions(-)
diff --git a/libavcodec/aacdec_common.c b/libavcodec/aacdec_common.c
index 61d81343fe..cbd2a9ccd2 100644
--- a/libavcodec/aacdec_common.c
+++ b/libavcodec/aacdec_common.c
@@ -126,8 +126,259 @@ const AVChannelLayout ff_aac_ch_layout[] = {
VLCElem ff_vlc_scalefactors[352];
const VLCElem *ff_vlc_spectral[11];
+/// Huffman tables for SBR
+
+static const uint8_t t_huffman_env_1_5dB_bits[121] = {
+ 18, 18, 18, 18, 18, 18, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 17, 18, 16, 17, 18, 17,
+ 16, 16, 16, 16, 15, 14, 14, 13,
+ 13, 12, 11, 10, 9, 8, 7, 6,
+ 5, 4, 3, 2, 2, 3, 4, 5,
+ 6, 7, 8, 9, 10, 12, 13, 14,
+ 14, 15, 16, 17, 16, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19,
+ 19,
+};
+
+static const uint32_t t_huffman_env_1_5dB_codes[121] = {
+ 0x3ffd6, 0x3ffd7, 0x3ffd8, 0x3ffd9, 0x3ffda, 0x3ffdb, 0x7ffb8, 0x7ffb9,
+ 0x7ffba, 0x7ffbb, 0x7ffbc, 0x7ffbd, 0x7ffbe, 0x7ffbf, 0x7ffc0, 0x7ffc1,
+ 0x7ffc2, 0x7ffc3, 0x7ffc4, 0x7ffc5, 0x7ffc6, 0x7ffc7, 0x7ffc8, 0x7ffc9,
+ 0x7ffca, 0x7ffcb, 0x7ffcc, 0x7ffcd, 0x7ffce, 0x7ffcf, 0x7ffd0, 0x7ffd1,
+ 0x7ffd2, 0x7ffd3, 0x1ffe6, 0x3ffd4, 0x0fff0, 0x1ffe9, 0x3ffd5, 0x1ffe7,
+ 0x0fff1, 0x0ffec, 0x0ffed, 0x0ffee, 0x07ff4, 0x03ff9, 0x03ff7, 0x01ffa,
+ 0x01ff9, 0x00ffb, 0x007fc, 0x003fc, 0x001fd, 0x000fd, 0x0007d, 0x0003d,
+ 0x0001d, 0x0000d, 0x00005, 0x00001, 0x00000, 0x00004, 0x0000c, 0x0001c,
+ 0x0003c, 0x0007c, 0x000fc, 0x001fc, 0x003fd, 0x00ffa, 0x01ff8, 0x03ff6,
+ 0x03ff8, 0x07ff5, 0x0ffef, 0x1ffe8, 0x0fff2, 0x7ffd4, 0x7ffd5, 0x7ffd6,
+ 0x7ffd7, 0x7ffd8, 0x7ffd9, 0x7ffda, 0x7ffdb, 0x7ffdc, 0x7ffdd, 0x7ffde,
+ 0x7ffdf, 0x7ffe0, 0x7ffe1, 0x7ffe2, 0x7ffe3, 0x7ffe4, 0x7ffe5, 0x7ffe6,
+ 0x7ffe7, 0x7ffe8, 0x7ffe9, 0x7ffea, 0x7ffeb, 0x7ffec, 0x7ffed, 0x7ffee,
+ 0x7ffef, 0x7fff0, 0x7fff1, 0x7fff2, 0x7fff3, 0x7fff4, 0x7fff5, 0x7fff6,
+ 0x7fff7, 0x7fff8, 0x7fff9, 0x7fffa, 0x7fffb, 0x7fffc, 0x7fffd, 0x7fffe,
+ 0x7ffff,
+};
+
+static const uint8_t f_huffman_env_1_5dB_bits[121] = {
+ 19, 19, 20, 20, 20, 20, 20, 20,
+ 20, 19, 20, 20, 20, 20, 19, 20,
+ 19, 19, 20, 18, 20, 20, 20, 19,
+ 20, 20, 20, 19, 20, 19, 18, 19,
+ 18, 18, 17, 18, 17, 17, 17, 16,
+ 16, 16, 15, 15, 14, 13, 13, 12,
+ 12, 11, 10, 9, 9, 8, 7, 6,
+ 5, 4, 3, 2, 2, 3, 4, 5,
+ 6, 8, 8, 9, 10, 11, 11, 11,
+ 12, 12, 13, 13, 14, 14, 16, 16,
+ 17, 17, 18, 18, 18, 18, 18, 18,
+ 18, 20, 19, 20, 20, 20, 20, 20,
+ 20, 19, 20, 20, 20, 20, 19, 20,
+ 18, 20, 20, 19, 19, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20,
+ 20,
+};
+
+static const uint32_t f_huffman_env_1_5dB_codes[121] = {
+ 0x7ffe7, 0x7ffe8, 0xfffd2, 0xfffd3, 0xfffd4, 0xfffd5, 0xfffd6, 0xfffd7,
+ 0xfffd8, 0x7ffda, 0xfffd9, 0xfffda, 0xfffdb, 0xfffdc, 0x7ffdb, 0xfffdd,
+ 0x7ffdc, 0x7ffdd, 0xfffde, 0x3ffe4, 0xfffdf, 0xfffe0, 0xfffe1, 0x7ffde,
+ 0xfffe2, 0xfffe3, 0xfffe4, 0x7ffdf, 0xfffe5, 0x7ffe0, 0x3ffe8, 0x7ffe1,
+ 0x3ffe0, 0x3ffe9, 0x1ffef, 0x3ffe5, 0x1ffec, 0x1ffed, 0x1ffee, 0x0fff4,
+ 0x0fff3, 0x0fff0, 0x07ff7, 0x07ff6, 0x03ffa, 0x01ffa, 0x01ff9, 0x00ffa,
+ 0x00ff8, 0x007f9, 0x003fb, 0x001fc, 0x001fa, 0x000fb, 0x0007c, 0x0003c,
+ 0x0001c, 0x0000c, 0x00005, 0x00001, 0x00000, 0x00004, 0x0000d, 0x0001d,
+ 0x0003d, 0x000fa, 0x000fc, 0x001fb, 0x003fa, 0x007f8, 0x007fa, 0x007fb,
+ 0x00ff9, 0x00ffb, 0x01ff8, 0x01ffb, 0x03ff8, 0x03ff9, 0x0fff1, 0x0fff2,
+ 0x1ffea, 0x1ffeb, 0x3ffe1, 0x3ffe2, 0x3ffea, 0x3ffe3, 0x3ffe6, 0x3ffe7,
+ 0x3ffeb, 0xfffe6, 0x7ffe2, 0xfffe7, 0xfffe8, 0xfffe9, 0xfffea, 0xfffeb,
+ 0xfffec, 0x7ffe3, 0xfffed, 0xfffee, 0xfffef, 0xffff0, 0x7ffe4, 0xffff1,
+ 0x3ffec, 0xffff2, 0xffff3, 0x7ffe5, 0x7ffe6, 0xffff4, 0xffff5, 0xffff6,
+ 0xffff7, 0xffff8, 0xffff9, 0xffffa, 0xffffb, 0xffffc, 0xffffd, 0xffffe,
+ 0xfffff,
+};
+
+static const uint8_t t_huffman_env_bal_1_5dB_bits[49] = {
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 12, 11, 9, 7, 5, 3,
+ 1, 2, 4, 6, 8, 11, 12, 15,
+ 16, 16, 16, 16, 16, 16, 16, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17,
+ 17,
+};
+
+static const uint32_t t_huffman_env_bal_1_5dB_codes[49] = {
+ 0x0ffe4, 0x0ffe5, 0x0ffe6, 0x0ffe7, 0x0ffe8, 0x0ffe9, 0x0ffea, 0x0ffeb,
+ 0x0ffec, 0x0ffed, 0x0ffee, 0x0ffef, 0x0fff0, 0x0fff1, 0x0fff2, 0x0fff3,
+ 0x0fff4, 0x0ffe2, 0x00ffc, 0x007fc, 0x001fe, 0x0007e, 0x0001e, 0x00006,
+ 0x00000, 0x00002, 0x0000e, 0x0003e, 0x000fe, 0x007fd, 0x00ffd, 0x07ff0,
+ 0x0ffe3, 0x0fff5, 0x0fff6, 0x0fff7, 0x0fff8, 0x0fff9, 0x0fffa, 0x1fff6,
+ 0x1fff7, 0x1fff8, 0x1fff9, 0x1fffa, 0x1fffb, 0x1fffc, 0x1fffd, 0x1fffe,
+ 0x1ffff,
+};
+
+static const uint8_t f_huffman_env_bal_1_5dB_bits[49] = {
+ 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 16,
+ 17, 14, 11, 11, 8, 7, 4, 2,
+ 1, 3, 5, 6, 9, 11, 12, 15,
+ 16, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 19,
+ 19,
+};
+
+static const uint32_t f_huffman_env_bal_1_5dB_codes[49] = {
+ 0x3ffe2, 0x3ffe3, 0x3ffe4, 0x3ffe5, 0x3ffe6, 0x3ffe7, 0x3ffe8, 0x3ffe9,
+ 0x3ffea, 0x3ffeb, 0x3ffec, 0x3ffed, 0x3ffee, 0x3ffef, 0x3fff0, 0x0fff7,
+ 0x1fff0, 0x03ffc, 0x007fe, 0x007fc, 0x000fe, 0x0007e, 0x0000e, 0x00002,
+ 0x00000, 0x00006, 0x0001e, 0x0003e, 0x001fe, 0x007fd, 0x00ffe, 0x07ffa,
+ 0x0fff6, 0x3fff1, 0x3fff2, 0x3fff3, 0x3fff4, 0x3fff5, 0x3fff6, 0x3fff7,
+ 0x3fff8, 0x3fff9, 0x3fffa, 0x3fffb, 0x3fffc, 0x3fffd, 0x3fffe, 0x7fffe,
+ 0x7ffff,
+};
+
+static const uint8_t t_huffman_env_3_0dB_bits[63] = {
+ 18, 18, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 17, 16, 16, 16, 14, 14, 14,
+ 13, 12, 11, 8, 6, 4, 2, 1,
+ 3, 5, 7, 9, 11, 13, 14, 14,
+ 15, 16, 17, 18, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19,
+};
+
+static const uint32_t t_huffman_env_3_0dB_codes[63] = {
+ 0x3ffed, 0x3ffee, 0x7ffde, 0x7ffdf, 0x7ffe0, 0x7ffe1, 0x7ffe2, 0x7ffe3,
+ 0x7ffe4, 0x7ffe5, 0x7ffe6, 0x7ffe7, 0x7ffe8, 0x7ffe9, 0x7ffea, 0x7ffeb,
+ 0x7ffec, 0x1fff4, 0x0fff7, 0x0fff9, 0x0fff8, 0x03ffb, 0x03ffa, 0x03ff8,
+ 0x01ffa, 0x00ffc, 0x007fc, 0x000fe, 0x0003e, 0x0000e, 0x00002, 0x00000,
+ 0x00006, 0x0001e, 0x0007e, 0x001fe, 0x007fd, 0x01ffb, 0x03ff9, 0x03ffc,
+ 0x07ffa, 0x0fff6, 0x1fff5, 0x3ffec, 0x7ffed, 0x7ffee, 0x7ffef, 0x7fff0,
+ 0x7fff1, 0x7fff2, 0x7fff3, 0x7fff4, 0x7fff5, 0x7fff6, 0x7fff7, 0x7fff8,
+ 0x7fff9, 0x7fffa, 0x7fffb, 0x7fffc, 0x7fffd, 0x7fffe, 0x7ffff,
+};
+
+static const uint8_t f_huffman_env_3_0dB_bits[63] = {
+ 20, 20, 20, 20, 20, 20, 20, 18,
+ 19, 19, 19, 19, 18, 18, 20, 19,
+ 17, 18, 17, 16, 16, 15, 14, 12,
+ 11, 10, 9, 8, 6, 4, 2, 1,
+ 3, 5, 8, 9, 10, 11, 12, 13,
+ 14, 15, 15, 16, 16, 17, 17, 18,
+ 18, 18, 20, 19, 19, 19, 20, 19,
+ 19, 20, 20, 20, 20, 20, 20,
+};
+
+static const uint32_t f_huffman_env_3_0dB_codes[63] = {
+ 0xffff0, 0xffff1, 0xffff2, 0xffff3, 0xffff4, 0xffff5, 0xffff6, 0x3fff3,
+ 0x7fff5, 0x7ffee, 0x7ffef, 0x7fff6, 0x3fff4, 0x3fff2, 0xffff7, 0x7fff0,
+ 0x1fff5, 0x3fff0, 0x1fff4, 0x0fff7, 0x0fff6, 0x07ff8, 0x03ffb, 0x00ffd,
+ 0x007fd, 0x003fd, 0x001fd, 0x000fd, 0x0003e, 0x0000e, 0x00002, 0x00000,
+ 0x00006, 0x0001e, 0x000fc, 0x001fc, 0x003fc, 0x007fc, 0x00ffc, 0x01ffc,
+ 0x03ffa, 0x07ff9, 0x07ffa, 0x0fff8, 0x0fff9, 0x1fff6, 0x1fff7, 0x3fff5,
+ 0x3fff6, 0x3fff1, 0xffff8, 0x7fff1, 0x7fff2, 0x7fff3, 0xffff9, 0x7fff7,
+ 0x7fff4, 0xffffa, 0xffffb, 0xffffc, 0xffffd, 0xffffe, 0xfffff,
+};
+
+static const uint8_t t_huffman_env_bal_3_0dB_bits[25] = {
+ 13, 13, 13, 13, 13, 13, 13, 12,
+ 8, 7, 4, 3, 1, 2, 5, 6,
+ 9, 13, 13, 13, 13, 13, 13, 14,
+ 14,
+};
+
+static const uint16_t t_huffman_env_bal_3_0dB_codes[25] = {
+ 0x1ff2, 0x1ff3, 0x1ff4, 0x1ff5, 0x1ff6, 0x1ff7, 0x1ff8, 0x0ff8,
+ 0x00fe, 0x007e, 0x000e, 0x0006, 0x0000, 0x0002, 0x001e, 0x003e,
+ 0x01fe, 0x1ff9, 0x1ffa, 0x1ffb, 0x1ffc, 0x1ffd, 0x1ffe, 0x3ffe,
+ 0x3fff,
+};
+
+static const uint8_t f_huffman_env_bal_3_0dB_bits[25] = {
+ 13, 13, 13, 13, 13, 14, 14, 11,
+ 8, 7, 4, 2, 1, 3, 5, 6,
+ 9, 12, 13, 14, 14, 14, 14, 14,
+ 14,
+};
+
+static const uint16_t f_huffman_env_bal_3_0dB_codes[25] = {
+ 0x1ff7, 0x1ff8, 0x1ff9, 0x1ffa, 0x1ffb, 0x3ff8, 0x3ff9, 0x07fc,
+ 0x00fe, 0x007e, 0x000e, 0x0002, 0x0000, 0x0006, 0x001e, 0x003e,
+ 0x01fe, 0x0ffa, 0x1ff6, 0x3ffa, 0x3ffb, 0x3ffc, 0x3ffd, 0x3ffe,
+ 0x3fff,
+};
+
+static const uint8_t t_huffman_noise_3_0dB_bits[63] = {
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 11, 8, 6, 4, 3, 1,
+ 2, 5, 8, 10, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 14, 14,
+};
+
+static const uint16_t t_huffman_noise_3_0dB_codes[63] = {
+ 0x1fce, 0x1fcf, 0x1fd0, 0x1fd1, 0x1fd2, 0x1fd3, 0x1fd4, 0x1fd5,
+ 0x1fd6, 0x1fd7, 0x1fd8, 0x1fd9, 0x1fda, 0x1fdb, 0x1fdc, 0x1fdd,
+ 0x1fde, 0x1fdf, 0x1fe0, 0x1fe1, 0x1fe2, 0x1fe3, 0x1fe4, 0x1fe5,
+ 0x1fe6, 0x1fe7, 0x07f2, 0x00fd, 0x003e, 0x000e, 0x0006, 0x0000,
+ 0x0002, 0x001e, 0x00fc, 0x03f8, 0x1fcc, 0x1fe8, 0x1fe9, 0x1fea,
+ 0x1feb, 0x1fec, 0x1fcd, 0x1fed, 0x1fee, 0x1fef, 0x1ff0, 0x1ff1,
+ 0x1ff2, 0x1ff3, 0x1ff4, 0x1ff5, 0x1ff6, 0x1ff7, 0x1ff8, 0x1ff9,
+ 0x1ffa, 0x1ffb, 0x1ffc, 0x1ffd, 0x1ffe, 0x3ffe, 0x3fff,
+};
+
+static const uint8_t t_huffman_noise_bal_3_0dB_bits[25] = {
+ 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 8, 5, 2, 1, 3, 6, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8,
+ 8,
+};
+
+static const uint8_t t_huffman_noise_bal_3_0dB_codes[25] = {
+ 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3,
+ 0xf4, 0xf5, 0x1c, 0x02, 0x00, 0x06, 0x3a, 0xf6,
+ 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe,
+ 0xff,
+};
+
+VLC ff_aac_sbr_vlc[10];
+
static av_cold void aacdec_common_init(void)
{
+#define SBR_INIT_VLC_STATIC(num, size) \
+ VLC_INIT_STATIC(&ff_aac_sbr_vlc[num], 9, sbr_tmp[num].table_size / sbr_tmp[num].elem_size, \
+ sbr_tmp[num].sbr_bits , 1, 1, \
+ sbr_tmp[num].sbr_codes, sbr_tmp[num].elem_size, sbr_tmp[num].elem_size, \
+ size)
+#define SBR_VLC_ROW(name) \
+ { name ## _codes, name ## _bits, sizeof(name ## _codes), sizeof(name ## _codes[0]) }
+ static const struct {
+ const void *sbr_codes, *sbr_bits;
+ const unsigned int table_size, elem_size;
+ } sbr_tmp[] = {
+ SBR_VLC_ROW(t_huffman_env_1_5dB),
+ SBR_VLC_ROW(f_huffman_env_1_5dB),
+ SBR_VLC_ROW(t_huffman_env_bal_1_5dB),
+ SBR_VLC_ROW(f_huffman_env_bal_1_5dB),
+ SBR_VLC_ROW(t_huffman_env_3_0dB),
+ SBR_VLC_ROW(f_huffman_env_3_0dB),
+ SBR_VLC_ROW(t_huffman_env_bal_3_0dB),
+ SBR_VLC_ROW(f_huffman_env_bal_3_0dB),
+ SBR_VLC_ROW(t_huffman_noise_3_0dB),
+ SBR_VLC_ROW(t_huffman_noise_bal_3_0dB),
+ };
+
static VLCElem vlc_buf[304 + 270 + 550 + 300 + 328 +
294 + 306 + 268 + 510 + 366 + 462];
VLCInitState state = VLC_INIT_STATE(vlc_buf);
@@ -150,6 +401,18 @@ static av_cold void aacdec_common_init(void)
ff_aac_scalefactor_code,
sizeof(ff_aac_scalefactor_code[0]),
sizeof(ff_aac_scalefactor_code[0]), 0);
+
+ // SBR VLC table initialization
+ SBR_INIT_VLC_STATIC(0, 1098);
+ SBR_INIT_VLC_STATIC(1, 1092);
+ SBR_INIT_VLC_STATIC(2, 768);
+ SBR_INIT_VLC_STATIC(3, 1026);
+ SBR_INIT_VLC_STATIC(4, 1058);
+ SBR_INIT_VLC_STATIC(5, 1052);
+ SBR_INIT_VLC_STATIC(6, 544);
+ SBR_INIT_VLC_STATIC(7, 544);
+ SBR_INIT_VLC_STATIC(8, 592);
+ SBR_INIT_VLC_STATIC(9, 512);
}
av_cold void ff_aacdec_common_init_once(void)
diff --git a/libavcodec/aacdectab.h b/libavcodec/aacdectab.h
index d62f170136..02e0d8a48e 100644
--- a/libavcodec/aacdectab.h
+++ b/libavcodec/aacdectab.h
@@ -38,6 +38,8 @@
FF_VISIBILITY_PUSH_HIDDEN
void ff_aacdec_common_init_once(void);
+extern VLC ff_aac_sbr_vlc[10];
+
extern VLCElem ff_vlc_scalefactors[];
extern const VLCElem *ff_vlc_spectral[11];
diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c
index 47aa6cb3c1..683c079b91 100644
--- a/libavcodec/aacsbr.c
+++ b/libavcodec/aacsbr.c
@@ -47,7 +47,6 @@
#include "mips/aacsbr_mips.h"
#endif /* ARCH_MIPS */
-static VLC vlc_sbr[10];
static void aacsbr_func_ptr_init(AACSBRContext *c);
static void make_bands(int16_t* bands, int start, int stop, int num_bands)
diff --git a/libavcodec/aacsbr.h b/libavcodec/aacsbr.h
index 09f9eb1d2c..0d182f822c 100644
--- a/libavcodec/aacsbr.h
+++ b/libavcodec/aacsbr.h
@@ -30,7 +30,7 @@
#define AVCODEC_AACSBR_H
#include "get_bits.h"
-#include "aac.h"
+#include "aac_defines.h"
#include "sbr.h"
#define ENVELOPE_ADJUSTMENT_OFFSET 2
@@ -69,15 +69,6 @@ enum {
static const int8_t vlc_sbr_lav[10] =
{ 60, 60, 24, 24, 31, 31, 12, 12, 31, 12 };
-#define SBR_INIT_VLC_STATIC(num, size) \
- VLC_INIT_STATIC(&vlc_sbr[num], 9, sbr_tmp[num].table_size / sbr_tmp[num].elem_size, \
- sbr_tmp[num].sbr_bits , 1, 1, \
- sbr_tmp[num].sbr_codes, sbr_tmp[num].elem_size, sbr_tmp[num].elem_size, \
- size)
-
-#define SBR_VLC_ROW(name) \
- { name ## _codes, name ## _bits, sizeof(name ## _codes), sizeof(name ## _codes[0]) }
-
/** Initialize SBR. */
void AAC_RENAME(ff_aac_sbr_init)(void);
/** Initialize one SBR context. */
diff --git a/libavcodec/aacsbr_fixed.c b/libavcodec/aacsbr_fixed.c
index cac472552e..3dbda32447 100644
--- a/libavcodec/aacsbr_fixed.c
+++ b/libavcodec/aacsbr_fixed.c
@@ -70,7 +70,6 @@
#include <float.h>
#include <math.h>
-static VLC vlc_sbr[10];
static void aacsbr_func_ptr_init(AACSBRContext *c);
static const int CONST_LN2 = Q31(0.6931471806/256); // ln(2)/256
static const int CONST_RECIP_LN2 = Q31(0.7213475204); // 0.5/ln(2)
diff --git a/libavcodec/aacsbr_template.c b/libavcodec/aacsbr_template.c
index f3d3258d2e..26be2739d3 100644
--- a/libavcodec/aacsbr_template.c
+++ b/libavcodec/aacsbr_template.c
@@ -32,6 +32,7 @@
* @author Zoran Basaric ( zoran.basaric(a)imgtec.com )
*/
+#include "aacdectab.h"
#include "libavutil/qsort.h"
static av_cold void aacsbr_tableinit(void)
@@ -44,34 +45,6 @@ static av_cold void aacsbr_tableinit(void)
av_cold void AAC_RENAME(ff_aac_sbr_init)(void)
{
- static const struct {
- const void *sbr_codes, *sbr_bits;
- const unsigned int table_size, elem_size;
- } sbr_tmp[] = {
- SBR_VLC_ROW(t_huffman_env_1_5dB),
- SBR_VLC_ROW(f_huffman_env_1_5dB),
- SBR_VLC_ROW(t_huffman_env_bal_1_5dB),
- SBR_VLC_ROW(f_huffman_env_bal_1_5dB),
- SBR_VLC_ROW(t_huffman_env_3_0dB),
- SBR_VLC_ROW(f_huffman_env_3_0dB),
- SBR_VLC_ROW(t_huffman_env_bal_3_0dB),
- SBR_VLC_ROW(f_huffman_env_bal_3_0dB),
- SBR_VLC_ROW(t_huffman_noise_3_0dB),
- SBR_VLC_ROW(t_huffman_noise_bal_3_0dB),
- };
-
- // SBR VLC table initialization
- SBR_INIT_VLC_STATIC(0, 1098);
- SBR_INIT_VLC_STATIC(1, 1092);
- SBR_INIT_VLC_STATIC(2, 768);
- SBR_INIT_VLC_STATIC(3, 1026);
- SBR_INIT_VLC_STATIC(4, 1058);
- SBR_INIT_VLC_STATIC(5, 1052);
- SBR_INIT_VLC_STATIC(6, 544);
- SBR_INIT_VLC_STATIC(7, 544);
- SBR_INIT_VLC_STATIC(8, 592);
- SBR_INIT_VLC_STATIC(9, 512);
-
aacsbr_tableinit();
AAC_RENAME(ff_ps_init)();
@@ -838,29 +811,29 @@ static int read_sbr_envelope(AACContext *ac, SpectralBandReplication *sbr, GetBi
if (sbr->bs_coupling && ch) {
if (ch_data->bs_amp_res) {
bits = 5;
- t_huff = vlc_sbr[T_HUFFMAN_ENV_BAL_3_0DB].table;
+ t_huff = ff_aac_sbr_vlc[T_HUFFMAN_ENV_BAL_3_0DB].table;
t_lav = vlc_sbr_lav[T_HUFFMAN_ENV_BAL_3_0DB];
- f_huff = vlc_sbr[F_HUFFMAN_ENV_BAL_3_0DB].table;
+ f_huff = ff_aac_sbr_vlc[F_HUFFMAN_ENV_BAL_3_0DB].table;
f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_BAL_3_0DB];
} else {
bits = 6;
- t_huff = vlc_sbr[T_HUFFMAN_ENV_BAL_1_5DB].table;
+ t_huff = ff_aac_sbr_vlc[T_HUFFMAN_ENV_BAL_1_5DB].table;
t_lav = vlc_sbr_lav[T_HUFFMAN_ENV_BAL_1_5DB];
- f_huff = vlc_sbr[F_HUFFMAN_ENV_BAL_1_5DB].table;
+ f_huff = ff_aac_sbr_vlc[F_HUFFMAN_ENV_BAL_1_5DB].table;
f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_BAL_1_5DB];
}
} else {
if (ch_data->bs_amp_res) {
bits = 6;
- t_huff = vlc_sbr[T_HUFFMAN_ENV_3_0DB].table;
+ t_huff = ff_aac_sbr_vlc[T_HUFFMAN_ENV_3_0DB].table;
t_lav = vlc_sbr_lav[T_HUFFMAN_ENV_3_0DB];
- f_huff = vlc_sbr[F_HUFFMAN_ENV_3_0DB].table;
+ f_huff = ff_aac_sbr_vlc[F_HUFFMAN_ENV_3_0DB].table;
f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_3_0DB];
} else {
bits = 7;
- t_huff = vlc_sbr[T_HUFFMAN_ENV_1_5DB].table;
+ t_huff = ff_aac_sbr_vlc[T_HUFFMAN_ENV_1_5DB].table;
t_lav = vlc_sbr_lav[T_HUFFMAN_ENV_1_5DB];
- f_huff = vlc_sbr[F_HUFFMAN_ENV_1_5DB].table;
+ f_huff = ff_aac_sbr_vlc[F_HUFFMAN_ENV_1_5DB].table;
f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_1_5DB];
}
}
@@ -923,14 +896,14 @@ static int read_sbr_noise(AACContext *ac, SpectralBandReplication *sbr, GetBitCo
int delta = (ch == 1 && sbr->bs_coupling == 1) + 1;
if (sbr->bs_coupling && ch) {
- t_huff = vlc_sbr[T_HUFFMAN_NOISE_BAL_3_0DB].table;
+ t_huff = ff_aac_sbr_vlc[T_HUFFMAN_NOISE_BAL_3_0DB].table;
t_lav = vlc_sbr_lav[T_HUFFMAN_NOISE_BAL_3_0DB];
- f_huff = vlc_sbr[F_HUFFMAN_ENV_BAL_3_0DB].table;
+ f_huff = ff_aac_sbr_vlc[F_HUFFMAN_ENV_BAL_3_0DB].table;
f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_BAL_3_0DB];
} else {
- t_huff = vlc_sbr[T_HUFFMAN_NOISE_3_0DB].table;
+ t_huff = ff_aac_sbr_vlc[T_HUFFMAN_NOISE_3_0DB].table;
t_lav = vlc_sbr_lav[T_HUFFMAN_NOISE_3_0DB];
- f_huff = vlc_sbr[F_HUFFMAN_ENV_3_0DB].table;
+ f_huff = ff_aac_sbr_vlc[F_HUFFMAN_ENV_3_0DB].table;
f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_3_0DB];
}
diff --git a/libavcodec/aacsbrdata.h b/libavcodec/aacsbrdata.h
index af86af01c2..b0585309e0 100644
--- a/libavcodec/aacsbrdata.h
+++ b/libavcodec/aacsbrdata.h
@@ -32,232 +32,6 @@
#include "libavutil/mem_internal.h"
#include "aac_defines.h"
-///< Huffman tables for SBR
-
-static const uint8_t t_huffman_env_1_5dB_bits[121] = {
- 18, 18, 18, 18, 18, 18, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 17, 18, 16, 17, 18, 17,
- 16, 16, 16, 16, 15, 14, 14, 13,
- 13, 12, 11, 10, 9, 8, 7, 6,
- 5, 4, 3, 2, 2, 3, 4, 5,
- 6, 7, 8, 9, 10, 12, 13, 14,
- 14, 15, 16, 17, 16, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19,
- 19,
-};
-
-static const uint32_t t_huffman_env_1_5dB_codes[121] = {
- 0x3ffd6, 0x3ffd7, 0x3ffd8, 0x3ffd9, 0x3ffda, 0x3ffdb, 0x7ffb8, 0x7ffb9,
- 0x7ffba, 0x7ffbb, 0x7ffbc, 0x7ffbd, 0x7ffbe, 0x7ffbf, 0x7ffc0, 0x7ffc1,
- 0x7ffc2, 0x7ffc3, 0x7ffc4, 0x7ffc5, 0x7ffc6, 0x7ffc7, 0x7ffc8, 0x7ffc9,
- 0x7ffca, 0x7ffcb, 0x7ffcc, 0x7ffcd, 0x7ffce, 0x7ffcf, 0x7ffd0, 0x7ffd1,
- 0x7ffd2, 0x7ffd3, 0x1ffe6, 0x3ffd4, 0x0fff0, 0x1ffe9, 0x3ffd5, 0x1ffe7,
- 0x0fff1, 0x0ffec, 0x0ffed, 0x0ffee, 0x07ff4, 0x03ff9, 0x03ff7, 0x01ffa,
- 0x01ff9, 0x00ffb, 0x007fc, 0x003fc, 0x001fd, 0x000fd, 0x0007d, 0x0003d,
- 0x0001d, 0x0000d, 0x00005, 0x00001, 0x00000, 0x00004, 0x0000c, 0x0001c,
- 0x0003c, 0x0007c, 0x000fc, 0x001fc, 0x003fd, 0x00ffa, 0x01ff8, 0x03ff6,
- 0x03ff8, 0x07ff5, 0x0ffef, 0x1ffe8, 0x0fff2, 0x7ffd4, 0x7ffd5, 0x7ffd6,
- 0x7ffd7, 0x7ffd8, 0x7ffd9, 0x7ffda, 0x7ffdb, 0x7ffdc, 0x7ffdd, 0x7ffde,
- 0x7ffdf, 0x7ffe0, 0x7ffe1, 0x7ffe2, 0x7ffe3, 0x7ffe4, 0x7ffe5, 0x7ffe6,
- 0x7ffe7, 0x7ffe8, 0x7ffe9, 0x7ffea, 0x7ffeb, 0x7ffec, 0x7ffed, 0x7ffee,
- 0x7ffef, 0x7fff0, 0x7fff1, 0x7fff2, 0x7fff3, 0x7fff4, 0x7fff5, 0x7fff6,
- 0x7fff7, 0x7fff8, 0x7fff9, 0x7fffa, 0x7fffb, 0x7fffc, 0x7fffd, 0x7fffe,
- 0x7ffff,
-};
-
-static const uint8_t f_huffman_env_1_5dB_bits[121] = {
- 19, 19, 20, 20, 20, 20, 20, 20,
- 20, 19, 20, 20, 20, 20, 19, 20,
- 19, 19, 20, 18, 20, 20, 20, 19,
- 20, 20, 20, 19, 20, 19, 18, 19,
- 18, 18, 17, 18, 17, 17, 17, 16,
- 16, 16, 15, 15, 14, 13, 13, 12,
- 12, 11, 10, 9, 9, 8, 7, 6,
- 5, 4, 3, 2, 2, 3, 4, 5,
- 6, 8, 8, 9, 10, 11, 11, 11,
- 12, 12, 13, 13, 14, 14, 16, 16,
- 17, 17, 18, 18, 18, 18, 18, 18,
- 18, 20, 19, 20, 20, 20, 20, 20,
- 20, 19, 20, 20, 20, 20, 19, 20,
- 18, 20, 20, 19, 19, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20,
- 20,
-};
-
-static const uint32_t f_huffman_env_1_5dB_codes[121] = {
- 0x7ffe7, 0x7ffe8, 0xfffd2, 0xfffd3, 0xfffd4, 0xfffd5, 0xfffd6, 0xfffd7,
- 0xfffd8, 0x7ffda, 0xfffd9, 0xfffda, 0xfffdb, 0xfffdc, 0x7ffdb, 0xfffdd,
- 0x7ffdc, 0x7ffdd, 0xfffde, 0x3ffe4, 0xfffdf, 0xfffe0, 0xfffe1, 0x7ffde,
- 0xfffe2, 0xfffe3, 0xfffe4, 0x7ffdf, 0xfffe5, 0x7ffe0, 0x3ffe8, 0x7ffe1,
- 0x3ffe0, 0x3ffe9, 0x1ffef, 0x3ffe5, 0x1ffec, 0x1ffed, 0x1ffee, 0x0fff4,
- 0x0fff3, 0x0fff0, 0x07ff7, 0x07ff6, 0x03ffa, 0x01ffa, 0x01ff9, 0x00ffa,
- 0x00ff8, 0x007f9, 0x003fb, 0x001fc, 0x001fa, 0x000fb, 0x0007c, 0x0003c,
- 0x0001c, 0x0000c, 0x00005, 0x00001, 0x00000, 0x00004, 0x0000d, 0x0001d,
- 0x0003d, 0x000fa, 0x000fc, 0x001fb, 0x003fa, 0x007f8, 0x007fa, 0x007fb,
- 0x00ff9, 0x00ffb, 0x01ff8, 0x01ffb, 0x03ff8, 0x03ff9, 0x0fff1, 0x0fff2,
- 0x1ffea, 0x1ffeb, 0x3ffe1, 0x3ffe2, 0x3ffea, 0x3ffe3, 0x3ffe6, 0x3ffe7,
- 0x3ffeb, 0xfffe6, 0x7ffe2, 0xfffe7, 0xfffe8, 0xfffe9, 0xfffea, 0xfffeb,
- 0xfffec, 0x7ffe3, 0xfffed, 0xfffee, 0xfffef, 0xffff0, 0x7ffe4, 0xffff1,
- 0x3ffec, 0xffff2, 0xffff3, 0x7ffe5, 0x7ffe6, 0xffff4, 0xffff5, 0xffff6,
- 0xffff7, 0xffff8, 0xffff9, 0xffffa, 0xffffb, 0xffffc, 0xffffd, 0xffffe,
- 0xfffff,
-};
-
-static const uint8_t t_huffman_env_bal_1_5dB_bits[49] = {
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 12, 11, 9, 7, 5, 3,
- 1, 2, 4, 6, 8, 11, 12, 15,
- 16, 16, 16, 16, 16, 16, 16, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17,
-};
-
-static const uint32_t t_huffman_env_bal_1_5dB_codes[49] = {
- 0x0ffe4, 0x0ffe5, 0x0ffe6, 0x0ffe7, 0x0ffe8, 0x0ffe9, 0x0ffea, 0x0ffeb,
- 0x0ffec, 0x0ffed, 0x0ffee, 0x0ffef, 0x0fff0, 0x0fff1, 0x0fff2, 0x0fff3,
- 0x0fff4, 0x0ffe2, 0x00ffc, 0x007fc, 0x001fe, 0x0007e, 0x0001e, 0x00006,
- 0x00000, 0x00002, 0x0000e, 0x0003e, 0x000fe, 0x007fd, 0x00ffd, 0x07ff0,
- 0x0ffe3, 0x0fff5, 0x0fff6, 0x0fff7, 0x0fff8, 0x0fff9, 0x0fffa, 0x1fff6,
- 0x1fff7, 0x1fff8, 0x1fff9, 0x1fffa, 0x1fffb, 0x1fffc, 0x1fffd, 0x1fffe,
- 0x1ffff,
-};
-
-static const uint8_t f_huffman_env_bal_1_5dB_bits[49] = {
- 18, 18, 18, 18, 18, 18, 18, 18,
- 18, 18, 18, 18, 18, 18, 18, 16,
- 17, 14, 11, 11, 8, 7, 4, 2,
- 1, 3, 5, 6, 9, 11, 12, 15,
- 16, 18, 18, 18, 18, 18, 18, 18,
- 18, 18, 18, 18, 18, 18, 18, 19,
- 19,
-};
-
-static const uint32_t f_huffman_env_bal_1_5dB_codes[49] = {
- 0x3ffe2, 0x3ffe3, 0x3ffe4, 0x3ffe5, 0x3ffe6, 0x3ffe7, 0x3ffe8, 0x3ffe9,
- 0x3ffea, 0x3ffeb, 0x3ffec, 0x3ffed, 0x3ffee, 0x3ffef, 0x3fff0, 0x0fff7,
- 0x1fff0, 0x03ffc, 0x007fe, 0x007fc, 0x000fe, 0x0007e, 0x0000e, 0x00002,
- 0x00000, 0x00006, 0x0001e, 0x0003e, 0x001fe, 0x007fd, 0x00ffe, 0x07ffa,
- 0x0fff6, 0x3fff1, 0x3fff2, 0x3fff3, 0x3fff4, 0x3fff5, 0x3fff6, 0x3fff7,
- 0x3fff8, 0x3fff9, 0x3fffa, 0x3fffb, 0x3fffc, 0x3fffd, 0x3fffe, 0x7fffe,
- 0x7ffff,
-};
-
-static const uint8_t t_huffman_env_3_0dB_bits[63] = {
- 18, 18, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 17, 16, 16, 16, 14, 14, 14,
- 13, 12, 11, 8, 6, 4, 2, 1,
- 3, 5, 7, 9, 11, 13, 14, 14,
- 15, 16, 17, 18, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19,
-};
-
-static const uint32_t t_huffman_env_3_0dB_codes[63] = {
- 0x3ffed, 0x3ffee, 0x7ffde, 0x7ffdf, 0x7ffe0, 0x7ffe1, 0x7ffe2, 0x7ffe3,
- 0x7ffe4, 0x7ffe5, 0x7ffe6, 0x7ffe7, 0x7ffe8, 0x7ffe9, 0x7ffea, 0x7ffeb,
- 0x7ffec, 0x1fff4, 0x0fff7, 0x0fff9, 0x0fff8, 0x03ffb, 0x03ffa, 0x03ff8,
- 0x01ffa, 0x00ffc, 0x007fc, 0x000fe, 0x0003e, 0x0000e, 0x00002, 0x00000,
- 0x00006, 0x0001e, 0x0007e, 0x001fe, 0x007fd, 0x01ffb, 0x03ff9, 0x03ffc,
- 0x07ffa, 0x0fff6, 0x1fff5, 0x3ffec, 0x7ffed, 0x7ffee, 0x7ffef, 0x7fff0,
- 0x7fff1, 0x7fff2, 0x7fff3, 0x7fff4, 0x7fff5, 0x7fff6, 0x7fff7, 0x7fff8,
- 0x7fff9, 0x7fffa, 0x7fffb, 0x7fffc, 0x7fffd, 0x7fffe, 0x7ffff,
-};
-
-static const uint8_t f_huffman_env_3_0dB_bits[63] = {
- 20, 20, 20, 20, 20, 20, 20, 18,
- 19, 19, 19, 19, 18, 18, 20, 19,
- 17, 18, 17, 16, 16, 15, 14, 12,
- 11, 10, 9, 8, 6, 4, 2, 1,
- 3, 5, 8, 9, 10, 11, 12, 13,
- 14, 15, 15, 16, 16, 17, 17, 18,
- 18, 18, 20, 19, 19, 19, 20, 19,
- 19, 20, 20, 20, 20, 20, 20,
-};
-
-static const uint32_t f_huffman_env_3_0dB_codes[63] = {
- 0xffff0, 0xffff1, 0xffff2, 0xffff3, 0xffff4, 0xffff5, 0xffff6, 0x3fff3,
- 0x7fff5, 0x7ffee, 0x7ffef, 0x7fff6, 0x3fff4, 0x3fff2, 0xffff7, 0x7fff0,
- 0x1fff5, 0x3fff0, 0x1fff4, 0x0fff7, 0x0fff6, 0x07ff8, 0x03ffb, 0x00ffd,
- 0x007fd, 0x003fd, 0x001fd, 0x000fd, 0x0003e, 0x0000e, 0x00002, 0x00000,
- 0x00006, 0x0001e, 0x000fc, 0x001fc, 0x003fc, 0x007fc, 0x00ffc, 0x01ffc,
- 0x03ffa, 0x07ff9, 0x07ffa, 0x0fff8, 0x0fff9, 0x1fff6, 0x1fff7, 0x3fff5,
- 0x3fff6, 0x3fff1, 0xffff8, 0x7fff1, 0x7fff2, 0x7fff3, 0xffff9, 0x7fff7,
- 0x7fff4, 0xffffa, 0xffffb, 0xffffc, 0xffffd, 0xffffe, 0xfffff,
-};
-
-static const uint8_t t_huffman_env_bal_3_0dB_bits[25] = {
- 13, 13, 13, 13, 13, 13, 13, 12,
- 8, 7, 4, 3, 1, 2, 5, 6,
- 9, 13, 13, 13, 13, 13, 13, 14,
- 14,
-};
-
-static const uint16_t t_huffman_env_bal_3_0dB_codes[25] = {
- 0x1ff2, 0x1ff3, 0x1ff4, 0x1ff5, 0x1ff6, 0x1ff7, 0x1ff8, 0x0ff8,
- 0x00fe, 0x007e, 0x000e, 0x0006, 0x0000, 0x0002, 0x001e, 0x003e,
- 0x01fe, 0x1ff9, 0x1ffa, 0x1ffb, 0x1ffc, 0x1ffd, 0x1ffe, 0x3ffe,
- 0x3fff,
-};
-
-static const uint8_t f_huffman_env_bal_3_0dB_bits[25] = {
- 13, 13, 13, 13, 13, 14, 14, 11,
- 8, 7, 4, 2, 1, 3, 5, 6,
- 9, 12, 13, 14, 14, 14, 14, 14,
- 14,
-};
-
-static const uint16_t f_huffman_env_bal_3_0dB_codes[25] = {
- 0x1ff7, 0x1ff8, 0x1ff9, 0x1ffa, 0x1ffb, 0x3ff8, 0x3ff9, 0x07fc,
- 0x00fe, 0x007e, 0x000e, 0x0002, 0x0000, 0x0006, 0x001e, 0x003e,
- 0x01fe, 0x0ffa, 0x1ff6, 0x3ffa, 0x3ffb, 0x3ffc, 0x3ffd, 0x3ffe,
- 0x3fff,
-};
-
-static const uint8_t t_huffman_noise_3_0dB_bits[63] = {
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 11, 8, 6, 4, 3, 1,
- 2, 5, 8, 10, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 14, 14,
-};
-
-static const uint16_t t_huffman_noise_3_0dB_codes[63] = {
- 0x1fce, 0x1fcf, 0x1fd0, 0x1fd1, 0x1fd2, 0x1fd3, 0x1fd4, 0x1fd5,
- 0x1fd6, 0x1fd7, 0x1fd8, 0x1fd9, 0x1fda, 0x1fdb, 0x1fdc, 0x1fdd,
- 0x1fde, 0x1fdf, 0x1fe0, 0x1fe1, 0x1fe2, 0x1fe3, 0x1fe4, 0x1fe5,
- 0x1fe6, 0x1fe7, 0x07f2, 0x00fd, 0x003e, 0x000e, 0x0006, 0x0000,
- 0x0002, 0x001e, 0x00fc, 0x03f8, 0x1fcc, 0x1fe8, 0x1fe9, 0x1fea,
- 0x1feb, 0x1fec, 0x1fcd, 0x1fed, 0x1fee, 0x1fef, 0x1ff0, 0x1ff1,
- 0x1ff2, 0x1ff3, 0x1ff4, 0x1ff5, 0x1ff6, 0x1ff7, 0x1ff8, 0x1ff9,
- 0x1ffa, 0x1ffb, 0x1ffc, 0x1ffd, 0x1ffe, 0x3ffe, 0x3fff,
-};
-
-static const uint8_t t_huffman_noise_bal_3_0dB_bits[25] = {
- 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 5, 2, 1, 3, 6, 8,
- 8, 8, 8, 8, 8, 8, 8, 8,
- 8,
-};
-
-static const uint8_t t_huffman_noise_bal_3_0dB_codes[25] = {
- 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3,
- 0xf4, 0xf5, 0x1c, 0x02, 0x00, 0x06, 0x3a, 0xf6,
- 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe,
- 0xff,
-};
-
static const int8_t sbr_offset[6][16] = {
{-8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7}, // fs_sbr = 16000 Hz
{-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13}, // fs_sbr = 22050 Hz
1
0
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com> | Sun Sep 24 23:04:11 2023 +0200| [4d6042e9d7f89c94c434b082685d93e3f96e00ed] | committer: Andreas Rheinhardt
avcodec/aacdec_common: Avoid superfluous VLC structures
For all VLCs here, the number of bits of the VLC is
write-only, because it is hardcoded at the call site.
Therefore one can replace these VLC structures with
the only thing that is actually used: The pointer
to the VLCElem table. And in some cases one can even
avoid this.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4d6042e9d7f89c94c…
---
libavcodec/aacdec_common.c | 43 ++++++++++++++++++++-----------------------
libavcodec/aacdec_template.c | 12 ++++++------
libavcodec/aacdectab.h | 4 ++--
3 files changed, 28 insertions(+), 31 deletions(-)
diff --git a/libavcodec/aacdec_common.c b/libavcodec/aacdec_common.c
index 45f1986258..61d81343fe 100644
--- a/libavcodec/aacdec_common.c
+++ b/libavcodec/aacdec_common.c
@@ -123,36 +123,33 @@ const AVChannelLayout ff_aac_ch_layout[] = {
{ 0 },
};
-VLC ff_vlc_scalefactors;
-VLC ff_vlc_spectral[11];
+VLCElem ff_vlc_scalefactors[352];
+const VLCElem *ff_vlc_spectral[11];
static av_cold void aacdec_common_init(void)
{
static VLCElem vlc_buf[304 + 270 + 550 + 300 + 328 +
294 + 306 + 268 + 510 + 366 + 462];
- for (unsigned i = 0, offset = 0; i < 11; i++) {
- ff_vlc_spectral[i].table = &vlc_buf[offset];
- ff_vlc_spectral[i].table_allocated = FF_ARRAY_ELEMS(vlc_buf) - offset;
- ff_vlc_init_sparse(&ff_vlc_spectral[i], 8, ff_aac_spectral_sizes[i],
- ff_aac_spectral_bits[i], sizeof(ff_aac_spectral_bits[i][0]),
- sizeof(ff_aac_spectral_bits[i][0]),
- ff_aac_spectral_codes[i], sizeof(ff_aac_spectral_codes[i][0]),
- sizeof(ff_aac_spectral_codes[i][0]),
- ff_aac_codebook_vector_idx[i], sizeof(ff_aac_codebook_vector_idx[i][0]),
- sizeof(ff_aac_codebook_vector_idx[i][0]),
- VLC_INIT_STATIC_OVERLONG);
- offset += ff_vlc_spectral[i].table_size;
+ VLCInitState state = VLC_INIT_STATE(vlc_buf);
+
+ for (unsigned i = 0; i < 11; i++) {
+#define TAB_WRAP_SIZE(name) name[i], sizeof(name[i][0]), sizeof(name[i][0])
+ ff_vlc_spectral[i] =
+ ff_vlc_init_tables_sparse(&state, 8, ff_aac_spectral_sizes[i],
+ TAB_WRAP_SIZE(ff_aac_spectral_bits),
+ TAB_WRAP_SIZE(ff_aac_spectral_codes),
+ TAB_WRAP_SIZE(ff_aac_codebook_vector_idx),
+ 0);
}
- VLC_INIT_STATIC(&ff_vlc_scalefactors, 7,
- FF_ARRAY_ELEMS(ff_aac_scalefactor_code),
- ff_aac_scalefactor_bits,
- sizeof(ff_aac_scalefactor_bits[0]),
- sizeof(ff_aac_scalefactor_bits[0]),
- ff_aac_scalefactor_code,
- sizeof(ff_aac_scalefactor_code[0]),
- sizeof(ff_aac_scalefactor_code[0]),
- 352);
+ VLC_INIT_STATIC_TABLE(ff_vlc_scalefactors, 7,
+ FF_ARRAY_ELEMS(ff_aac_scalefactor_code),
+ ff_aac_scalefactor_bits,
+ sizeof(ff_aac_scalefactor_bits[0]),
+ sizeof(ff_aac_scalefactor_bits[0]),
+ ff_aac_scalefactor_code,
+ sizeof(ff_aac_scalefactor_code[0]),
+ sizeof(ff_aac_scalefactor_code[0]), 0);
}
av_cold void ff_aacdec_common_init_once(void)
diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
index 65dd8b4bf9..2b3509c85f 100644
--- a/libavcodec/aacdec_template.c
+++ b/libavcodec/aacdec_template.c
@@ -1497,7 +1497,7 @@ static int decode_scalefactors(AACContext *ac, INTFLOAT sf[120], GetBitContext *
} else if ((band_type[idx] == INTENSITY_BT) ||
(band_type[idx] == INTENSITY_BT2)) {
for (; i < run_end; i++, idx++) {
- offset[2] += get_vlc2(gb, ff_vlc_scalefactors.table, 7, 3) - SCALE_DIFF_ZERO;
+ offset[2] += get_vlc2(gb, ff_vlc_scalefactors, 7, 3) - SCALE_DIFF_ZERO;
clipped_offset = av_clip(offset[2], -155, 100);
if (offset[2] != clipped_offset) {
avpriv_request_sample(ac->avctx,
@@ -1516,7 +1516,7 @@ static int decode_scalefactors(AACContext *ac, INTFLOAT sf[120], GetBitContext *
if (noise_flag-- > 0)
offset[1] += get_bits(gb, NOISE_PRE_BITS) - NOISE_PRE;
else
- offset[1] += get_vlc2(gb, ff_vlc_scalefactors.table, 7, 3) - SCALE_DIFF_ZERO;
+ offset[1] += get_vlc2(gb, ff_vlc_scalefactors, 7, 3) - SCALE_DIFF_ZERO;
clipped_offset = av_clip(offset[1], -100, 155);
if (offset[1] != clipped_offset) {
avpriv_request_sample(ac->avctx,
@@ -1532,7 +1532,7 @@ static int decode_scalefactors(AACContext *ac, INTFLOAT sf[120], GetBitContext *
}
} else {
for (; i < run_end; i++, idx++) {
- offset[0] += get_vlc2(gb, ff_vlc_scalefactors.table, 7, 3) - SCALE_DIFF_ZERO;
+ offset[0] += get_vlc2(gb, ff_vlc_scalefactors, 7, 3) - SCALE_DIFF_ZERO;
if (offset[0] > 255U) {
av_log(ac->avctx, AV_LOG_ERROR,
"Scalefactor (%d) out of range.\n", offset[0]);
@@ -1705,7 +1705,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, INTFLOAT coef[1024],
#if !USE_FIXED
const float *vq = ff_aac_codebook_vector_vals[cbt_m1];
#endif /* !USE_FIXED */
- const VLCElem *vlc_tab = ff_vlc_spectral[cbt_m1].table;
+ const VLCElem *vlc_tab = ff_vlc_spectral[cbt_m1];
OPEN_READER(re, gb);
switch (cbt_m1 >> 1) {
@@ -2279,7 +2279,7 @@ static int decode_cce(AACContext *ac, GetBitContext *gb, ChannelElement *che)
INTFLOAT gain_cache = FIXR10(1.);
if (c) {
cge = coup->coupling_point == AFTER_IMDCT ? 1 : get_bits1(gb);
- gain = cge ? get_vlc2(gb, ff_vlc_scalefactors.table, 7, 3) - 60: 0;
+ gain = cge ? get_vlc2(gb, ff_vlc_scalefactors, 7, 3) - 60: 0;
gain_cache = GET_GAIN(scale, gain);
#if USE_FIXED
if ((abs(gain_cache)-1024) >> 3 > 30)
@@ -2293,7 +2293,7 @@ static int decode_cce(AACContext *ac, GetBitContext *gb, ChannelElement *che)
for (sfb = 0; sfb < sce->ics.max_sfb; sfb++, idx++) {
if (sce->band_type[idx] != ZERO_BT) {
if (!cge) {
- int t = get_vlc2(gb, ff_vlc_scalefactors.table, 7, 3) - 60;
+ int t = get_vlc2(gb, ff_vlc_scalefactors, 7, 3) - 60;
if (t) {
int s = 1;
t = gain += t;
diff --git a/libavcodec/aacdectab.h b/libavcodec/aacdectab.h
index a009e9f46e..d62f170136 100644
--- a/libavcodec/aacdectab.h
+++ b/libavcodec/aacdectab.h
@@ -38,8 +38,8 @@
FF_VISIBILITY_PUSH_HIDDEN
void ff_aacdec_common_init_once(void);
-extern VLC ff_vlc_scalefactors;
-extern VLC ff_vlc_spectral[11];
+extern VLCElem ff_vlc_scalefactors[];
+extern const VLCElem *ff_vlc_spectral[11];
extern const int8_t ff_tags_per_config[16];
1
0
ffmpeg | branch: release/6.1 | Lynne <dev(a)lynne.ee> | Sun Oct 29 07:19:25 2023 +0100| [4e5f3e6b8e1132354eed810dfdadf87f45c5de27] | committer: Lynne
bwdif_vulkan: fix artifacts on vulkan decode images
Due to making the decode frames context use the coded size, the
filter started to display those artifacts as it reused the input frame's size.
Change it to instead output the real image size for images, not the input.
(cherry picked from commit 0e8abf26983aa0dc72cbfbb094eeed13a9b55404)
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4e5f3e6b8e1132354…
---
libavfilter/vf_bwdif_vulkan.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavfilter/vf_bwdif_vulkan.c b/libavfilter/vf_bwdif_vulkan.c
index f1623e6ef7..690a89c4ba 100644
--- a/libavfilter/vf_bwdif_vulkan.c
+++ b/libavfilter/vf_bwdif_vulkan.c
@@ -325,8 +325,8 @@ static int bwdif_vulkan_config_input(AVFilterLink *inlink)
/* Defaults */
vkctx->output_format = input_frames->sw_format;
- vkctx->output_width = input_frames->width;
- vkctx->output_height = input_frames->height;
+ vkctx->output_width = inlink->w;
+ vkctx->output_height = inlink->h;
return 0;
}
1
0
ffmpeg | branch: release/6.1 | Benjamin Cheng <ben(a)bcheng.me> | Fri Oct 13 15:10:55 2023 -0400| [116cb346e36b71be0e45f97030eebeb893c16bfd] | committer: Lynne
vulkan_h264: fix long-term ref handling
h->long_ref isn't guaranteed to be contiguously filled. Use the approach
from both vaapi_h264 and vdpau_h264 which goes through the 16 frames in
h->long_ref to find the LTR entries.
Fixes MR2_MW_A.264 from JVT-AVC_V1.
(cherry picked from commit 4536de3769796a74ea26fcdfdae73af5e0fa8b5a)
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=116cb346e36b71be0…
---
libavcodec/vulkan_h264.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/libavcodec/vulkan_h264.c b/libavcodec/vulkan_h264.c
index 172c6c4e8e..e727aafb16 100644
--- a/libavcodec/vulkan_h264.c
+++ b/libavcodec/vulkan_h264.c
@@ -406,10 +406,14 @@ static int vk_h264_start_frame(AVCodecContext *avctx,
}
/* Fill in long-term refs */
- for (int r = 0, i = h->short_ref_count; i < h->short_ref_count + h->long_ref_count; i++, r++) {
+ for (int r = 0, i = h->short_ref_count; r < H264_MAX_DPB_FRAMES &&
+ i < h->short_ref_count + h->long_ref_count; r++) {
+ if (!h->long_ref[r])
+ continue;
+
dpb_slot_index = 0;
- for (unsigned slot = 0; slot < H264_MAX_PICTURE_COUNT; slot++) {
- if (h->long_ref[i] == &h->DPB[slot]) {
+ for (unsigned slot = 0; slot < 16; slot++) {
+ if (h->long_ref[r] == &h->DPB[slot]) {
dpb_slot_index = slot;
break;
}
@@ -422,6 +426,7 @@ static int vk_h264_start_frame(AVCodecContext *avctx,
dpb_slot_index);
if (err < 0)
return err;
+ i++;
}
hp->h264pic = (StdVideoDecodeH264PictureInfo) {
1
0
ffmpeg | branch: master | Lynne <dev(a)lynne.ee> | Sun Oct 29 07:19:25 2023 +0100| [0e8abf26983aa0dc72cbfbb094eeed13a9b55404] | committer: Lynne
bwdif_vulkan: fix artifacts on vulkan decode images
Due to making the decode frames context use the coded size, the
filter started to display those artifacts as it reused the input frame's size.
Change it to instead output the real image size for images, not the input.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0e8abf26983aa0dc7…
---
libavfilter/vf_bwdif_vulkan.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavfilter/vf_bwdif_vulkan.c b/libavfilter/vf_bwdif_vulkan.c
index f1623e6ef7..690a89c4ba 100644
--- a/libavfilter/vf_bwdif_vulkan.c
+++ b/libavfilter/vf_bwdif_vulkan.c
@@ -325,8 +325,8 @@ static int bwdif_vulkan_config_input(AVFilterLink *inlink)
/* Defaults */
vkctx->output_format = input_frames->sw_format;
- vkctx->output_width = input_frames->width;
- vkctx->output_height = input_frames->height;
+ vkctx->output_width = inlink->w;
+ vkctx->output_height = inlink->h;
return 0;
}
1
0
ffmpeg | branch: master | Benjamin Cheng <ben(a)bcheng.me> | Fri Oct 13 15:10:55 2023 -0400| [4536de3769796a74ea26fcdfdae73af5e0fa8b5a] | committer: Lynne
vulkan_h264: fix long-term ref handling
h->long_ref isn't guaranteed to be contiguously filled. Use the approach
from both vaapi_h264 and vdpau_h264 which goes through the 16 frames in
h->long_ref to find the LTR entries.
Fixes MR2_MW_A.264 from JVT-AVC_V1.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4536de3769796a74e…
---
libavcodec/vulkan_h264.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/libavcodec/vulkan_h264.c b/libavcodec/vulkan_h264.c
index 172c6c4e8e..e727aafb16 100644
--- a/libavcodec/vulkan_h264.c
+++ b/libavcodec/vulkan_h264.c
@@ -406,10 +406,14 @@ static int vk_h264_start_frame(AVCodecContext *avctx,
}
/* Fill in long-term refs */
- for (int r = 0, i = h->short_ref_count; i < h->short_ref_count + h->long_ref_count; i++, r++) {
+ for (int r = 0, i = h->short_ref_count; r < H264_MAX_DPB_FRAMES &&
+ i < h->short_ref_count + h->long_ref_count; r++) {
+ if (!h->long_ref[r])
+ continue;
+
dpb_slot_index = 0;
- for (unsigned slot = 0; slot < H264_MAX_PICTURE_COUNT; slot++) {
- if (h->long_ref[i] == &h->DPB[slot]) {
+ for (unsigned slot = 0; slot < 16; slot++) {
+ if (h->long_ref[r] == &h->DPB[slot]) {
dpb_slot_index = slot;
break;
}
@@ -422,6 +426,7 @@ static int vk_h264_start_frame(AVCodecContext *avctx,
dpb_slot_index);
if (err < 0)
return err;
+ i++;
}
hp->h264pic = (StdVideoDecodeH264PictureInfo) {
1
0
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com> | Sun Sep 24 22:50:11 2023 +0200| [1e63e24c760dac0b1dc20c0d286a909206c8379c] | committer: Andreas Rheinhardt
avcodec/aactab: Improve included headers
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1e63e24c760dac0b1…
---
libavcodec/aacpsy.c | 2 +-
libavcodec/aactab.c | 8 ++++----
libavcodec/aactab.h | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c
index 933369e445..1fbd259e51 100644
--- a/libavcodec/aacpsy.c
+++ b/libavcodec/aacpsy.c
@@ -28,7 +28,7 @@
#include "libavutil/ffmath.h"
#include "avcodec.h"
-#include "aactab.h"
+#include "aac.h"
#include "psymodel.h"
/***********************************
diff --git a/libavcodec/aactab.c b/libavcodec/aactab.c
index edb51d8810..d20ac56a3f 100644
--- a/libavcodec/aactab.c
+++ b/libavcodec/aactab.c
@@ -27,15 +27,15 @@
* @author Maxim Gavrilov ( maxim.gavrilov gmail com )
*/
-#include "config.h"
+#include <stddef.h>
+#include <stdint.h>
+
#include "config_components.h"
+#include "libavutil/attributes.h"
#include "libavutil/mem_internal.h"
#include "libavutil/thread.h"
-#include "aac.h"
#include "aactab.h"
-#include <stdint.h>
-
#if CONFIG_AAC_ENCODER || CONFIG_AAC_DECODER
#include "kbdwin.h"
#include "sinewin.h"
diff --git a/libavcodec/aactab.h b/libavcodec/aactab.h
index 7693876c34..81db29a4e4 100644
--- a/libavcodec/aactab.h
+++ b/libavcodec/aactab.h
@@ -31,7 +31,7 @@
#define AVCODEC_AACTAB_H
#include "libavutil/mem_internal.h"
-#include "aac.h"
+#include "aac_defines.h"
#include <stdint.h>
1
0