Mercurial > libavcodec.hg
comparison aacsbr.c @ 11436:d90f6c676063 libavcodec
aacsbr: Move the e_a calculation from sbr_mapping() to read_sbr_grid().
author | alexc |
---|---|
date | Tue, 09 Mar 2010 10:26:54 +0000 |
parents | 4dfd0bfbb8dc |
children | 8b2d9e680000 |
comparison
equal
deleted
inserted
replaced
11435:4dfd0bfbb8dc | 11436:d90f6c676063 |
---|---|
761 ch_data->t_q[1] = ch_data->t_env[idx]; | 761 ch_data->t_q[1] = ch_data->t_env[idx]; |
762 ch_data->t_q[2] = ch_data->t_env[ch_data->bs_num_env[1]]; | 762 ch_data->t_q[2] = ch_data->t_env[ch_data->bs_num_env[1]]; |
763 } else | 763 } else |
764 ch_data->t_q[1] = ch_data->t_env[ch_data->bs_num_env[1]]; | 764 ch_data->t_q[1] = ch_data->t_env[ch_data->bs_num_env[1]]; |
765 | 765 |
766 ch_data->e_a[0] = -(ch_data->e_a[1] != ch_data->bs_num_env[0]); // l_APrev | |
767 ch_data->e_a[1] = -1; | |
768 if ((ch_data->bs_frame_class & 1) && ch_data->bs_pointer) { // FIXVAR or VARVAR and bs_pointer != 0 | |
769 ch_data->e_a[1] = ch_data->bs_num_env[1] + 1 - ch_data->bs_pointer; | |
770 } else if ((ch_data->bs_frame_class == 2) && (ch_data->bs_pointer > 1)) // VARFIX and bs_pointer > 1 | |
771 ch_data->e_a[1] = ch_data->bs_pointer - 1; | |
772 | |
766 return 0; | 773 return 0; |
767 } | 774 } |
768 | 775 |
769 static void copy_sbr_grid(SBRData *dst, const SBRData *src) { | 776 static void copy_sbr_grid(SBRData *dst, const SBRData *src) { |
770 //These variables are saved from the previous frame rather than copied | 777 //These variables are saved from the previous frame rather than copied |
771 dst->bs_freq_res[0] = dst->bs_freq_res[dst->bs_num_env[1]]; | 778 dst->bs_freq_res[0] = dst->bs_freq_res[dst->bs_num_env[1]]; |
772 dst->bs_num_env[0] = dst->bs_num_env[1]; | 779 dst->bs_num_env[0] = dst->bs_num_env[1]; |
773 dst->t_env_num_env_old = dst->t_env[dst->bs_num_env[0]]; | 780 dst->t_env_num_env_old = dst->t_env[dst->bs_num_env[0]]; |
781 dst->e_a[0] = -(dst->e_a[1] != dst->bs_num_env[0]); | |
774 | 782 |
775 //These variables are read from the bitstream and therefore copied | 783 //These variables are read from the bitstream and therefore copied |
776 memcpy(dst->bs_freq_res+1, src->bs_freq_res+1, sizeof(dst->bs_freq_res)-sizeof(*dst->bs_freq_res)); | 784 memcpy(dst->bs_freq_res+1, src->bs_freq_res+1, sizeof(dst->bs_freq_res)-sizeof(*dst->bs_freq_res)); |
777 memcpy(dst->bs_num_env+1, src->bs_num_env+1, sizeof(dst->bs_num_env)- sizeof(*dst->bs_num_env)); | 785 memcpy(dst->bs_num_env+1, src->bs_num_env+1, sizeof(dst->bs_num_env)- sizeof(*dst->bs_num_env)); |
778 memcpy(dst->bs_var_bord, src->bs_var_bord, sizeof(dst->bs_var_bord)); | 786 memcpy(dst->bs_var_bord, src->bs_var_bord, sizeof(dst->bs_var_bord)); |
782 memcpy(dst->t_q, src->t_q, sizeof(dst->t_q)); | 790 memcpy(dst->t_q, src->t_q, sizeof(dst->t_q)); |
783 dst->bs_amp_res = src->bs_amp_res; | 791 dst->bs_amp_res = src->bs_amp_res; |
784 dst->bs_num_noise = src->bs_num_noise; | 792 dst->bs_num_noise = src->bs_num_noise; |
785 dst->bs_pointer = src->bs_pointer; | 793 dst->bs_pointer = src->bs_pointer; |
786 dst->bs_frame_class = src->bs_frame_class; | 794 dst->bs_frame_class = src->bs_frame_class; |
795 dst->e_a[1] = src->e_a[1]; | |
787 } | 796 } |
788 | 797 |
789 /// Read how the envelope and noise floor data is delta coded | 798 /// Read how the envelope and noise floor data is delta coded |
790 static void read_sbr_dtdf(SpectralBandReplication *sbr, GetBitContext *gb, | 799 static void read_sbr_dtdf(SpectralBandReplication *sbr, GetBitContext *gb, |
791 SBRData *ch_data) | 800 SBRData *ch_data) |
1461 */ | 1470 */ |
1462 static void sbr_mapping(AACContext *ac, SpectralBandReplication *sbr, | 1471 static void sbr_mapping(AACContext *ac, SpectralBandReplication *sbr, |
1463 SBRData *ch_data, int e_a[2]) | 1472 SBRData *ch_data, int e_a[2]) |
1464 { | 1473 { |
1465 int e, i, m; | 1474 int e, i, m; |
1466 | |
1467 e_a[0] = -(e_a[1] != ch_data->bs_num_env[0]); // l_APrev | |
1468 e_a[1] = -1; | |
1469 if ((ch_data->bs_frame_class & 1) && ch_data->bs_pointer) { // FIXVAR or VARVAR and bs_pointer != 0 | |
1470 e_a[1] = ch_data->bs_num_env[1] + 1 - ch_data->bs_pointer; | |
1471 } else if ((ch_data->bs_frame_class == 2) && (ch_data->bs_pointer > 1)) // VARFIX and bs_pointer > 1 | |
1472 e_a[1] = ch_data->bs_pointer - 1; | |
1473 | 1475 |
1474 memset(ch_data->s_indexmapped[1], 0, 7*sizeof(ch_data->s_indexmapped[1])); | 1476 memset(ch_data->s_indexmapped[1], 0, 7*sizeof(ch_data->s_indexmapped[1])); |
1475 for (e = 0; e < ch_data->bs_num_env[1]; e++) { | 1477 for (e = 0; e < ch_data->bs_num_env[1]; e++) { |
1476 const unsigned int ilim = sbr->n[ch_data->bs_freq_res[e + 1]]; | 1478 const unsigned int ilim = sbr->n[ch_data->bs_freq_res[e + 1]]; |
1477 uint16_t *table = ch_data->bs_freq_res[e + 1] ? sbr->f_tablehigh : sbr->f_tablelow; | 1479 uint16_t *table = ch_data->bs_freq_res[e + 1] ? sbr->f_tablehigh : sbr->f_tablelow; |