diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-04-13 04:23:56 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-04-13 04:23:56 +0200 |
commit | a676e48d394cf9972730859d62f537dfe0a9dce2 (patch) | |
tree | 3907298c9cd51a8b9e77e8c11b2ff89799e07e38 /libavcodec/dcadec.c | |
parent | 952614b8996e33fe406ef91f537e5776cd55111c (diff) | |
parent | 801c39e1e3058fc4ba822bfb5d8612d777111e32 (diff) | |
download | ffmpeg-a676e48d394cf9972730859d62f537dfe0a9dce2.tar.gz |
Merge commit '801c39e1e3058fc4ba822bfb5d8612d777111e32'
* commit '801c39e1e3058fc4ba822bfb5d8612d777111e32':
dcadec: Use correct channel count in stereo downmix check
Conflicts:
libavcodec/dcadec.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/dcadec.c')
-rw-r--r-- | libavcodec/dcadec.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c index 4ad58ee38c..254865bb64 100644 --- a/libavcodec/dcadec.c +++ b/libavcodec/dcadec.c @@ -2173,7 +2173,7 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data, if (s->core_downmix && (s->core_downmix_amode == DCA_STEREO || s->core_downmix_amode == DCA_STEREO_TOTAL)) { int sign, code; - for (i = 0; i < s->prim_channels + !!s->lfe; i++) { + for (i = 0; i < num_core_channels + !!s->lfe; i++) { sign = s->core_downmix_codes[i][0] & 0x100 ? 1 : -1; code = s->core_downmix_codes[i][0] & 0x0FF; s->downmix_coef[i][0] = (!code ? 0.0f : @@ -2191,19 +2191,19 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data, "Invalid channel mode %d\n", am); return AVERROR_INVALIDDATA; } - if (s->prim_channels + !!s->lfe > + if (num_core_channels + !!s->lfe > FF_ARRAY_ELEMS(dca_default_coeffs[0])) { avpriv_request_sample(s->avctx, "Downmixing %d channels", s->prim_channels + !!s->lfe); return AVERROR_PATCHWELCOME; } - for (i = 0; i < s->prim_channels + !!s->lfe; i++) { + for (i = 0; i < num_core_channels + !!s->lfe; i++) { s->downmix_coef[i][0] = dca_default_coeffs[am][i][0]; s->downmix_coef[i][1] = dca_default_coeffs[am][i][1]; } } av_dlog(s->avctx, "Stereo downmix coeffs:\n"); - for (i = 0; i < s->prim_channels + !!s->lfe; i++) { + for (i = 0; i < num_core_channels + !!s->lfe; i++) { av_dlog(s->avctx, "L, input channel %d = %f\n", i, s->downmix_coef[i][0]); av_dlog(s->avctx, "R, input channel %d = %f\n", i, @@ -2377,7 +2377,7 @@ FF_ENABLE_DEPRECATION_WARNINGS return AVERROR_INVALIDDATA; } - if (s->prim_channels + !!s->lfe > 2 && + if (num_core_channels + !!s->lfe > 2 && avctx->request_channel_layout == AV_CH_LAYOUT_STEREO) { channels = 2; s->output = s->prim_channels == 2 ? s->amode : DCA_STEREO; @@ -2444,6 +2444,7 @@ FF_ENABLE_DEPRECATION_WARNINGS s->xxch_order_tab[j++] = posn; } } + } s->lfe_index = av_popcount(channel_layout & (AV_CH_LOW_FREQUENCY-1)); |