diff options
author | Alex Converse <alex.converse@gmail.com> | 2008-12-09 17:14:42 +0000 |
---|---|---|
committer | Robert Swain <robert.swain@gmail.com> | 2008-12-09 17:14:42 +0000 |
commit | 4a904903dc553403cac22b03faa597519d46cd47 (patch) | |
tree | 305722a8e1ad16cb20befcdd717f7b938063d4e5 | |
parent | c0893c3abb640fb9f2f337de7753bc53cf44b910 (diff) | |
download | ffmpeg-4a904903dc553403cac22b03faa597519d46cd47.tar.gz |
AAC: Use a sign LUT rather than 1-2*get_bits1()
Patch by Alex Converse (alex converse gmail com)
Originally committed as revision 16041 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/aac.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libavcodec/aac.c b/libavcodec/aac.c index 5be16165b5..1803d4d7f1 100644 --- a/libavcodec/aac.c +++ b/libavcodec/aac.c @@ -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; |