| @@ -658,7 +658,9 @@ static int decode_spectrum_and_dequant_ac(AACDecContext *s, float coef[1024], · 657 unmodified lines |
| 658 | | 658 | |
| 659 | static int decode_usac_stereo_cplx(AACDecContext *ac, AACUsacStereo *us, | 659 | static int decode_usac_stereo_cplx(AACDecContext *ac, AACUsacStereo *us, |
| 660 | ChannelElement *cpe, GetBitContext *gb, | 660 | ChannelElement *cpe, GetBitContext *gb, |
| 661 | int num_window_groups, int indep_flag) | 661 | int num_window_groups, |
| | 662 | int prev_num_window_groups, |
| | 663 | int indep_flag) |
| 662 | { | 664 | { |
| 663 | int delta_code_time; | 665 | int delta_code_time; |
| 664 | IndividualChannelStream *ics = &cpe->ch[0].ics; | 666 | IndividualChannelStream *ics = &cpe->ch[0].ics; |
| @@ -696,15 +698,18 @@ static int decode_usac_stereo_cplx(AACDecContext *ac, AACUsacStereo *us, · 31 unmodified lines |
| 696 | float last_alpha_q_im = 0; | 698 | float last_alpha_q_im = 0; |
| 697 | if (delta_code_time) { | 699 | if (delta_code_time) { |
| 698 | if (g) { | 700 | if (g) { |
| 699 | last_alpha_q_re = us->prev_alpha_q_re[(g - 1)*cpe->max_sfb_ste + sfb]; | 701 | /* Transient, after the first group - use the current frame, |
| 700 | last_alpha_q_im = us->prev_alpha_q_im[(g - 1)*cpe->max_sfb_ste + sfb]; | 702 | * previous window, alpha values. */ |
| 701 | } else if ((ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) && | 703 | last_alpha_q_re = us->alpha_q_re[(g - 1)*cpe->max_sfb_ste + sfb]; |
| 702 | ics->window_sequence[1] == EIGHT_SHORT_SEQUENCE || | 704 | last_alpha_q_im = us->alpha_q_im[(g - 1)*cpe->max_sfb_ste + sfb]; |
| 703 | ics->window_sequence[1] == EIGHT_SHORT_SEQUENCE) { | 705 | } else if (!g && |
| | 706 | (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) && |
| | 707 | (ics->window_sequence[1] == EIGHT_SHORT_SEQUENCE)) { |
| 704 | /* The spec doesn't explicitly mention this, but it doesn't make | 708 | /* The spec doesn't explicitly mention this, but it doesn't make |
| 705 | * any other sense otherwise! */ | 709 | * any other sense otherwise! */ |
| 706 | last_alpha_q_re = us->prev_alpha_q_re[7*cpe->max_sfb_ste + sfb]; | 710 | const int wg = prev_num_window_groups - 1; |
| 707 | last_alpha_q_im = us->prev_alpha_q_im[7*cpe->max_sfb_ste + sfb]; | 711 | last_alpha_q_re = us->prev_alpha_q_re[wg*cpe->max_sfb_ste + sfb]; |
| | 712 | last_alpha_q_im = us->prev_alpha_q_im[wg*cpe->max_sfb_ste + sfb]; |
| 708 | } else { | 713 | } else { |
| 709 | last_alpha_q_re = us->prev_alpha_q_re[g*cpe->max_sfb_ste + sfb]; | 714 | last_alpha_q_re = us->prev_alpha_q_re[g*cpe->max_sfb_ste + sfb]; |
| 710 | last_alpha_q_im = us->prev_alpha_q_im[g*cpe->max_sfb_ste + sfb]; | 715 | last_alpha_q_im = us->prev_alpha_q_im[g*cpe->max_sfb_ste + sfb]; |
| @@ -749,6 +754,7 @@ static int setup_sce(AACDecContext *ac, SingleChannelElement *sce, · 38 unmodified lines |
| 749 | IndividualChannelStream *ics = &sce->ics; | 754 | IndividualChannelStream *ics = &sce->ics; |
| 750 | | 755 | |
| 751 | /* Setup window parameters */ | 756 | /* Setup window parameters */ |
| | 757 | ics->prev_num_window_groups = FFMAX(ics->num_window_groups, 1); |
| 752 | if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { | 758 | if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { |
| 753 | if (usac->core_frame_len == 768) { | 759 | if (usac->core_frame_len == 768) { |
| 754 | ics->swb_offset = ff_swb_offset_96[usac->rate_idx]; | 760 | ics->swb_offset = ff_swb_offset_96[usac->rate_idx]; |
| @@ -869,7 +875,9 @@ static int decode_usac_stereo_info(AACDecContext *ac, AACUSACConfig *usac, · 114 unmodified lines |
| 869 | memset(cpe->ms_mask, 0xFF, sizeof(cpe->ms_mask)); | 875 | memset(cpe->ms_mask, 0xFF, sizeof(cpe->ms_mask)); |
| 870 | } else if ((us->ms_mask_mode == 3) && !ec->stereo_config_index) { | 876 | } else if ((us->ms_mask_mode == 3) && !ec->stereo_config_index) { |
| 871 | ret = decode_usac_stereo_cplx(ac, us, cpe, gb, | 877 | ret = decode_usac_stereo_cplx(ac, us, cpe, gb, |
| 872 | ics1->num_window_groups, indep_flag); | 878 | ics1->num_window_groups, |
| | 879 | ics1->prev_num_window_groups, |
| | 880 | indep_flag); |
| 873 | if (ret < 0) | 881 | if (ret < 0) |
| 874 | return ret; | 882 | return ret; |
| 875 | } | 883 | } |