aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2012-08-28 09:11:45 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2012-10-01 13:42:44 -0400
commit1a3459033dc94d3f6e1b7e7c4de227fda369f2bf (patch)
treebae054f19164d46ba265fba3f21da2bc4feab65e
parent3fca0d72105a607926adea702065b1a00adb0b5d (diff)
downloadffmpeg-1a3459033dc94d3f6e1b7e7c4de227fda369f2bf.tar.gz
mpc7/8: use planar sample format
-rw-r--r--libavcodec/mpc.c14
-rw-r--r--libavcodec/mpc.h2
-rw-r--r--libavcodec/mpc7.c6
-rw-r--r--libavcodec/mpc8.c7
4 files changed, 15 insertions, 14 deletions
diff --git a/libavcodec/mpc.c b/libavcodec/mpc.c
index 6b15a33e5a..5a54a9bad9 100644
--- a/libavcodec/mpc.c
+++ b/libavcodec/mpc.c
@@ -43,28 +43,24 @@ void ff_mpc_init(void)
/**
* Process decoded Musepack data and produce PCM
*/
-static void mpc_synth(MPCContext *c, int16_t *out, int channels)
+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 < channels; ch++){
- samples_ptr = samples + ch;
for(i = 0; i < SAMPLES_PER_BAND; i++) {
ff_mpa_synth_filter_fixed(&c->mpadsp,
c->synth_buf[ch], &(c->synth_buf_offset[ch]),
ff_mpa_synth_window_fixed, &dither_state,
- samples_ptr, channels,
+ out[ch] + 32 * i, 1,
c->sb_samples[ch][i]);
- samples_ptr += 32 * channels;
}
}
- for(i = 0; i < MPC_FRAME_SIZE*channels; i++)
- *out++=samples[i];
}
-void ff_mpc_dequantize_and_synth(MPCContext * c, int maxband, void *data, int channels)
+void ff_mpc_dequantize_and_synth(MPCContext * c, int maxband, int16_t **out,
+ int channels)
{
int i, j, ch;
Band *bands = c->bands;
@@ -100,5 +96,5 @@ void ff_mpc_dequantize_and_synth(MPCContext * c, int maxband, void *data, int ch
}
}
- mpc_synth(c, data, channels);
+ mpc_synth(c, out, channels);
}
diff --git a/libavcodec/mpc.h b/libavcodec/mpc.h
index 1a6e7943af..2ee3c6d416 100644
--- a/libavcodec/mpc.h
+++ b/libavcodec/mpc.h
@@ -73,6 +73,6 @@ typedef struct {
} MPCContext;
void ff_mpc_init(void);
-void ff_mpc_dequantize_and_synth(MPCContext *c, int maxband, void *dst, int channels);
+void ff_mpc_dequantize_and_synth(MPCContext *c, int maxband, int16_t **out, int channels);
#endif /* AVCODEC_MPC_H */
diff --git a/libavcodec/mpc7.c b/libavcodec/mpc7.c
index 0d7e9dfc28..b013eeb3d5 100644
--- a/libavcodec/mpc7.c
+++ b/libavcodec/mpc7.c
@@ -94,7 +94,7 @@ static av_cold int mpc7_decode_init(AVCodecContext * avctx)
c->IS, c->MSS, c->gapless, c->lastframelen, c->maxbands);
c->frames_to_skip = 0;
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+ avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
avctx->channel_layout = AV_CH_LAYOUT_STEREO;
if(vlc_initialized) return 0;
@@ -293,7 +293,7 @@ static int mpc7_decode_frame(AVCodecContext * avctx, void *data,
for(ch = 0; ch < 2; ch++)
idx_to_quant(c, &gb, bands[i].res[ch], c->Q[ch] + off);
- ff_mpc_dequantize_and_synth(c, mb, c->frame.data[0], 2);
+ ff_mpc_dequantize_and_synth(c, mb, (int16_t **)c->frame.extended_data, 2);
bits_used = get_bits_count(&gb);
bits_avail = buf_size * 8;
@@ -340,4 +340,6 @@ AVCodec ff_mpc7_decoder = {
.flush = mpc7_decode_flush,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("Musepack SV7"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
+ AV_SAMPLE_FMT_NONE },
};
diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c
index 79225c4275..91e228b07c 100644
--- a/libavcodec/mpc8.c
+++ b/libavcodec/mpc8.c
@@ -135,7 +135,7 @@ static av_cold int mpc8_decode_init(AVCodecContext * avctx)
c->MSS = get_bits1(&gb);
c->frames = 1 << (get_bits(&gb, 3) * 2);
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+ avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;
if(vlc_initialized) return 0;
@@ -405,7 +405,8 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void *data,
}
}
- ff_mpc_dequantize_and_synth(c, maxband - 1, c->frame.data[0],
+ ff_mpc_dequantize_and_synth(c, maxband - 1,
+ (int16_t **)c->frame.extended_data,
avctx->channels);
c->cur_frame++;
@@ -438,4 +439,6 @@ AVCodec ff_mpc8_decoder = {
.flush = mpc8_decode_flush,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("Musepack SV8"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
+ AV_SAMPLE_FMT_NONE },
};