[FFmpeg-soc] [soc]: r5493 - aac-sbr/aacsbr.c
alexc
subversion at mplayerhq.hu
Sat Dec 5 15:57:58 CET 2009
Author: alexc
Date: Sat Dec 5 15:57:58 2009
New Revision: 5493
Log:
Subtract LAVs from SBR Huffman tables as described in section 4.A.6.1 "SBR
Huffman Tables".
Modified:
aac-sbr/aacsbr.c
Modified: aac-sbr/aacsbr.c
==============================================================================
--- aac-sbr/aacsbr.c Sat Dec 5 02:01:55 2009 (r5492)
+++ aac-sbr/aacsbr.c Sat Dec 5 15:57:58 2009 (r5493)
@@ -33,6 +33,8 @@
#include <stdint.h>
static VLC vlc_sbr[10];
+static const int8_t vlc_sbr_lav[10] =
+ { 60, 60, 24, 24, 31, 31, 12, 12, 31, 12 };
av_cold void ff_aac_sbr_init(void)
{
@@ -614,28 +616,37 @@ static void sbr_envelope(SpectralBandRep
int bits, max_depth;
int i, j;
VLC_TYPE (*t_huff)[2], (*f_huff)[2];
+ int t_lav, f_lav;
if (sbr->bs_coupling && ch) {
max_depth = 2;
if (ch_data->bs_amp_res) {
bits = 5;
t_huff = vlc_sbr[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_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_lav = vlc_sbr_lav[T_HUFFMAN_ENV_BAL_1_5DB];
f_huff = vlc_sbr[F_HUFFMAN_ENV_BAL_1_5DB].table;
+ f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_BAL_1_5DB];
}
} else {
max_depth = 3;
if (ch_data->bs_amp_res) {
bits = 6;
t_huff = vlc_sbr[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_lav = vlc_sbr_lav[F_HUFFMAN_ENV_3_0DB];
} else {
bits = 7;
t_huff = vlc_sbr[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_lav = vlc_sbr_lav[F_HUFFMAN_ENV_1_5DB];
}
}
@@ -643,10 +654,10 @@ static void sbr_envelope(SpectralBandRep
if (!ch_data->bs_df_env[i]) {
ch_data->bs_data_env[i][0] = get_bits(gb, bits); // bs_env_start_value_balance
for (j = 1; j < sbr->n[ch_data->bs_freq_res[i]]; j++)
- ch_data->bs_data_env[i][j] = get_vlc2(gb, f_huff, 9, max_depth);
+ ch_data->bs_data_env[i][j] = get_vlc2(gb, f_huff, 9, max_depth) - f_lav;
} else {
for (j = 0; j < sbr->n[ch_data->bs_freq_res[i]]; j++)
- ch_data->bs_data_env[i][j] = get_vlc2(gb, t_huff, 9, max_depth);
+ ch_data->bs_data_env[i][j] = get_vlc2(gb, t_huff, 9, max_depth) - t_lav;
}
}
}
@@ -657,25 +668,30 @@ static void sbr_noise(SpectralBandReplic
int max_depth;
int i, j;
VLC_TYPE (*t_huff)[2], (*f_huff)[2];
+ int t_lav, f_lav;
if (sbr->bs_coupling && ch) {
max_depth = 1;
t_huff = vlc_sbr[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_lav = vlc_sbr_lav[F_HUFFMAN_ENV_BAL_3_0DB];
} else {
max_depth = 2;
t_huff = vlc_sbr[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_lav = vlc_sbr_lav[F_HUFFMAN_ENV_3_0DB];
}
for (i = 0; i < ch_data->bs_num_noise; i++) {
if (!ch_data->bs_df_noise[i]) {
ch_data->bs_data_noise[i][0] = get_bits(gb, 5); // bs_noise_start_value_balance or bs_noise_start_value_level
for (j = 1; j < sbr->n_q; j++)
- ch_data->bs_data_noise[i][j] = get_vlc2(gb, f_huff, 9, max_depth + 1);
+ ch_data->bs_data_noise[i][j] = get_vlc2(gb, f_huff, 9, max_depth + 1) - f_lav;
} else {
for (j = 0; j < sbr->n_q; j++)
- ch_data->bs_data_noise[i][j] = get_vlc2(gb, t_huff, 9, max_depth);
+ ch_data->bs_data_noise[i][j] = get_vlc2(gb, t_huff, 9, max_depth) - t_lav;
}
}
}
More information about the FFmpeg-soc
mailing list