summaryrefslogtreecommitdiff
path: root/libavcodec/mpc.c
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2010-11-21 20:42:06 +0000
committerKostya Shishkov <kostya.shishkov@gmail.com>2010-11-21 20:42:06 +0000
commit7d3829a87a7465f3effe8e0e09760882578e5a0a (patch)
treeff9437b356567089b0a5bbe3016629dfd163f10e /libavcodec/mpc.c
parent63e8d9760f23a4edf81e9ae58c4f6d3baa6ff4dd (diff)
Musepack SV8 supports "mono" files (though it still codes them as stereo),
so extend decoder to output only one channel for it. This fixes issue 2368. Originally committed as revision 25790 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpc.c')
-rw-r--r--libavcodec/mpc.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libavcodec/mpc.c b/libavcodec/mpc.c
index 30ae591a0f..d9a1fb776a 100644
--- a/libavcodec/mpc.c
+++ b/libavcodec/mpc.c
@@ -42,27 +42,27 @@ void ff_mpc_init(void)
/**
* Process decoded Musepack data and produce PCM
*/
-static void mpc_synth(MPCContext *c, int16_t *out)
+static void mpc_synth(MPCContext *c, int16_t *out, int channels)
{
int dither_state = 0;
int i, ch;
OUT_INT samples[MPA_MAX_CHANNELS * MPA_FRAME_SIZE], *samples_ptr;
- for(ch = 0; ch < 2; ch++){
+ for(ch = 0; ch < channels; ch++){
samples_ptr = samples + ch;
for(i = 0; i < SAMPLES_PER_BAND; i++) {
ff_mpa_synth_filter(c->synth_buf[ch], &(c->synth_buf_offset[ch]),
ff_mpa_synth_window, &dither_state,
- samples_ptr, 2,
+ samples_ptr, channels,
c->sb_samples[ch][i]);
- samples_ptr += 64;
+ samples_ptr += 32 * channels;
}
}
- for(i = 0; i < MPC_FRAME_SIZE*2; i++)
+ for(i = 0; i < MPC_FRAME_SIZE*channels; i++)
*out++=samples[i];
}
-void ff_mpc_dequantize_and_synth(MPCContext * c, int maxband, void *data)
+void ff_mpc_dequantize_and_synth(MPCContext * c, int maxband, void *data, int channels)
{
int i, j, ch;
Band *bands = c->bands;
@@ -98,5 +98,5 @@ void ff_mpc_dequantize_and_synth(MPCContext * c, int maxband, void *data)
}
}
- mpc_synth(c, data);
+ mpc_synth(c, data, channels);
}