comparison aac.c @ 8284:e1c0cd446955 libavcodec

AAC: Use a sign LUT rather than 1-2*get_bits1() Patch by Alex Converse (alex converse gmail com)
author superdump
date Tue, 09 Dec 2008 17:14:42 +0000
parents ea8e4095d980
children e06b2b848b74
comparison
equal deleted inserted replaced
8283:ea8e4095d980 8284:e1c0cd446955
739 int pulse_present, const Pulse * pulse, const IndividualChannelStream * ics, enum BandType band_type[120]) { 739 int pulse_present, const Pulse * pulse, const IndividualChannelStream * ics, enum BandType band_type[120]) {
740 int i, k, g, idx = 0; 740 int i, k, g, idx = 0;
741 const int c = 1024/ics->num_windows; 741 const int c = 1024/ics->num_windows;
742 const uint16_t * offsets = ics->swb_offset; 742 const uint16_t * offsets = ics->swb_offset;
743 float *coef_base = coef; 743 float *coef_base = coef;
744 static const float sign_lookup[] = { 1.0f, -1.0f };
744 745
745 for (g = 0; g < ics->num_windows; g++) 746 for (g = 0; g < ics->num_windows; g++)
746 memset(coef + g * 128 + offsets[ics->max_sfb], 0, sizeof(float)*(c - offsets[ics->max_sfb])); 747 memset(coef + g * 128 + offsets[ics->max_sfb], 0, sizeof(float)*(c - offsets[ics->max_sfb]));
747 748
748 for (g = 0; g < ics->num_window_groups; g++) { 749 for (g = 0; g < ics->num_window_groups; g++) {
782 cur_band_type - 1, index, ff_aac_spectral_sizes[cur_band_type - 1]); 783 cur_band_type - 1, index, ff_aac_spectral_sizes[cur_band_type - 1]);
783 return -1; 784 return -1;
784 } 785 }
785 vq_ptr = &ff_aac_codebook_vectors[cur_band_type - 1][index * dim]; 786 vq_ptr = &ff_aac_codebook_vectors[cur_band_type - 1][index * dim];
786 if (is_cb_unsigned) { 787 if (is_cb_unsigned) {
787 if (vq_ptr[0]) coef[coef_tmp_idx ] = 1 - 2*(int)get_bits1(gb); 788 if (vq_ptr[0]) coef[coef_tmp_idx ] = sign_lookup[get_bits1(gb)];
788 if (vq_ptr[1]) coef[coef_tmp_idx + 1] = 1 - 2*(int)get_bits1(gb); 789 if (vq_ptr[1]) coef[coef_tmp_idx + 1] = sign_lookup[get_bits1(gb)];
789 if (dim == 4) { 790 if (dim == 4) {
790 if (vq_ptr[2]) coef[coef_tmp_idx + 2] = 1 - 2*(int)get_bits1(gb); 791 if (vq_ptr[2]) coef[coef_tmp_idx + 2] = sign_lookup[get_bits1(gb)];
791 if (vq_ptr[3]) coef[coef_tmp_idx + 3] = 1 - 2*(int)get_bits1(gb); 792 if (vq_ptr[3]) coef[coef_tmp_idx + 3] = sign_lookup[get_bits1(gb)];
792 } 793 }
793 }else { 794 }else {
794 coef[coef_tmp_idx ] = 1.0f; 795 coef[coef_tmp_idx ] = 1.0f;
795 coef[coef_tmp_idx + 1] = 1.0f; 796 coef[coef_tmp_idx + 1] = 1.0f;
796 if (dim == 4) { 797 if (dim == 4) {