[FFmpeg-soc] [soc]: r5450 - aac-sbr/aacsbr.c
alexc
subversion at mplayerhq.hu
Fri Nov 20 21:28:55 CET 2009
Author: alexc
Date: Fri Nov 20 21:28:54 2009
New Revision: 5450
Log:
Replace ceil(log() / M_LN2) with a ceil_log2[] lookup table. The result of this
calculation is a number of bits to be read therefore we must be exact.
Modified:
aac-sbr/aacsbr.c
Modified: aac-sbr/aacsbr.c
==============================================================================
--- aac-sbr/aacsbr.c Wed Nov 18 13:08:22 2009 (r5449)
+++ aac-sbr/aacsbr.c Fri Nov 20 21:28:54 2009 (r5450)
@@ -489,6 +489,10 @@ static int sbr_make_f_derived(AACContext
return 0;
}
+static int8_t ceil_log2[] = {
+ 0, 0, 1, 2, 2, 3, 3,
+};
+
static int sbr_grid(AACContext *ac, SpectralBandReplication *sbr,
GetBitContext *gb, SBRData *ch_data)
{
@@ -514,7 +518,7 @@ static int sbr_grid(AACContext *ac, Spec
for (i = 0; i < ch_data->bs_num_rel[1]; i++)
ch_data->bs_rel_bord[1][i] = (get_bits(gb, 2) << 1) + 2;
- ch_data->bs_pointer = get_bits(gb, ceil(logf(ch_data->bs_num_env[1] + 1) / M_LN2));
+ ch_data->bs_pointer = get_bits(gb, ceil_log2[ch_data->bs_num_env[1] + 1]);
for (i = 0; i < ch_data->bs_num_env[1]; i++)
ch_data->bs_freq_res[ch_data->bs_num_env[1] - 1 - i] = get_bits1(gb);
@@ -527,7 +531,7 @@ static int sbr_grid(AACContext *ac, Spec
for (i = 0; i < ch_data->bs_num_rel[0]; i++)
ch_data->bs_rel_bord[0][i] = (get_bits(gb, 2) << 1) + 2;
- ch_data->bs_pointer = get_bits(gb, ceil(logf(ch_data->bs_num_env[1] + 1) / M_LN2));
+ ch_data->bs_pointer = get_bits(gb, ceil_log2[ch_data->bs_num_env[1] + 1]);
for (i = 0; i < ch_data->bs_num_env[1]; i++)
ch_data->bs_freq_res[i] = get_bits1(gb);
@@ -544,7 +548,7 @@ static int sbr_grid(AACContext *ac, Spec
for (i = 0; i < ch_data->bs_num_rel[1]; i++)
ch_data->bs_rel_bord[1][i] = (get_bits(gb, 2) << 1) + 2;
- ch_data->bs_pointer = get_bits(gb, ceil(logf(ch_data->bs_num_env[1] + 1) / M_LN2));
+ ch_data->bs_pointer = get_bits(gb, ceil_log2[ch_data->bs_num_env[1] + 1]);
for (i = 0; i < ch_data->bs_num_env[1]; i++)
ch_data->bs_freq_res[i] = get_bits1(gb);
More information about the FFmpeg-soc
mailing list