Revision 7333f849

View differences:

libavcodec/aacsbr.c
763 763
    } else
764 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 773
    return 0;
767 774
}
768 775

  
......
771 778
    dst->bs_freq_res[0] = dst->bs_freq_res[dst->bs_num_env[1]];
772 779
    dst->bs_num_env[0]  = dst->bs_num_env[1];
773 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 783
    //These variables are read from the bitstream and therefore copied
776 784
    memcpy(dst->bs_freq_res+1, src->bs_freq_res+1, sizeof(dst->bs_freq_res)-sizeof(*dst->bs_freq_res));
......
784 792
    dst->bs_num_noise   = src->bs_num_noise;
785 793
    dst->bs_pointer     = src->bs_pointer;
786 794
    dst->bs_frame_class = src->bs_frame_class;
795
    dst->e_a[1]         = src->e_a[1];
787 796
}
788 797

  
789 798
/// Read how the envelope and noise floor data is delta coded
......
1464 1473
{
1465 1474
    int e, i, m;
1466 1475

  
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

  
1474 1476
    memset(ch_data->s_indexmapped[1], 0, 7*sizeof(ch_data->s_indexmapped[1]));
1475 1477
    for (e = 0; e < ch_data->bs_num_env[1]; e++) {
1476 1478
        const unsigned int ilim = sbr->n[ch_data->bs_freq_res[e + 1]];

Also available in: Unified diff