Revision b02fbf75 libavcodec/ac3dec.c

View differences:

libavcodec/ac3dec.c
133 133
    int cpl_in_use;                         ///< coupling in use
134 134
    int channel_in_cpl[AC3_MAX_CHANNELS];   ///< channel in coupling
135 135
    int phase_flags_in_use;                 ///< phase flags in use
136
    int phase_flags[18];                    ///< phase flags
136 137
    int cpl_band_struct[18];                ///< coupling band structure
137 138
    int rematrixing_strategy;               ///< rematrixing strategy
138 139
    int num_rematrixing_bands;              ///< number of rematrixing bands
......
470 471
            subbnd++;
471 472
            for(j=0; j<12; j++) {
472 473
                for(ch=1; ch<=s->fbw_channels; ch++) {
473
                    if(s->channel_in_cpl[ch])
474
                    if(s->channel_in_cpl[ch]) {
474 475
                        s->transform_coeffs[ch][i] = s->transform_coeffs[CPL_CH][i] * s->cpl_coords[ch][bnd] * 8.0f;
476
                        if (ch == 2 && s->phase_flags[bnd])
477
                            s->transform_coeffs[ch][i] = -s->transform_coeffs[ch][i];
478
                    }
475 479
                }
476 480
                i++;
477 481
            }
......
866 870
            }
867 871
        }
868 872
        /* phase flags */
869
        if (channel_mode == AC3_CHMODE_STEREO && s->phase_flags_in_use && cpl_coords_exist) {
873
        if (channel_mode == AC3_CHMODE_STEREO && cpl_coords_exist) {
870 874
            for (bnd = 0; bnd < s->num_cpl_bands; bnd++) {
871
                if (get_bits1(gbc))
872
                    s->cpl_coords[2][bnd] = -s->cpl_coords[2][bnd];
875
                s->phase_flags[bnd] = s->phase_flags_in_use? get_bits1(gbc) : 0;
873 876
            }
874 877
        }
875 878
    }

Also available in: Unified diff