Commit ac7785bc authored by superdump's avatar superdump

AAC: Use a sign LUT rather than 1-2*get_bits1()

Patch by Alex Converse (alex converse gmail com)


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@16041 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 3d4602b7
......@@ -741,6 +741,7 @@ static int decode_spectrum_and_dequant(AACContext * ac, float coef[1024], GetBit
const int c = 1024/ics->num_windows;
const uint16_t * offsets = ics->swb_offset;
float *coef_base = coef;
static const float sign_lookup[] = { 1.0f, -1.0f };
for (g = 0; g < ics->num_windows; g++)
memset(coef + g * 128 + offsets[ics->max_sfb], 0, sizeof(float)*(c - offsets[ics->max_sfb]));
......@@ -784,11 +785,11 @@ static int decode_spectrum_and_dequant(AACContext * ac, float coef[1024], GetBit
}
vq_ptr = &ff_aac_codebook_vectors[cur_band_type - 1][index * dim];
if (is_cb_unsigned) {
if (vq_ptr[0]) coef[coef_tmp_idx ] = 1 - 2*(int)get_bits1(gb);
if (vq_ptr[1]) coef[coef_tmp_idx + 1] = 1 - 2*(int)get_bits1(gb);
if (vq_ptr[0]) coef[coef_tmp_idx ] = sign_lookup[get_bits1(gb)];
if (vq_ptr[1]) coef[coef_tmp_idx + 1] = sign_lookup[get_bits1(gb)];
if (dim == 4) {
if (vq_ptr[2]) coef[coef_tmp_idx + 2] = 1 - 2*(int)get_bits1(gb);
if (vq_ptr[3]) coef[coef_tmp_idx + 3] = 1 - 2*(int)get_bits1(gb);
if (vq_ptr[2]) coef[coef_tmp_idx + 2] = sign_lookup[get_bits1(gb)];
if (vq_ptr[3]) coef[coef_tmp_idx + 3] = sign_lookup[get_bits1(gb)];
}
}else {
coef[coef_tmp_idx ] = 1.0f;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment