aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/pcm.c
diff options
context:
space:
mode:
authorChristian Schmidt <schmidt@digadd.de>2013-08-30 18:15:47 +0200
committerLuca Barbato <lu_zero@gentoo.org>2013-08-31 11:26:29 +0200
commita42e3a6700547e4e49445bda81d3a89ec3e081a9 (patch)
tree791493f32f608bfa47622c2084158f3033ce6a92 /libavcodec/pcm.c
parent21fd2f84ce21f8e03d0287a759cdcc5a5ea1d0a8 (diff)
downloadffmpeg-a42e3a6700547e4e49445bda81d3a89ec3e081a9.tar.gz
pcm_dvd: consolidate pieces from pcm.c and mpeg.c
Remove the header decoding for PCM audio from mpeg.c and the 20/24bit parts from pcm.c and merge them into a new decoder in pcm-dvd.c. The decoder has added support for samples that span multiple packets and modified 20/24bit group decoding. Both is needed to decode samples that have been generated with DVD-Lab Pro 2. The decoding of 16bit PCM and two channel 24bit is identical to before. No other samples are known to verify the correctness of the encoding this software does. The complete list of tested formats is 48kHz/16bit/2-8 channels 48kHz/24bit/2-5 channels 96kHz/16bit/2-4 channels 96kHz/24bit/2 channels Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavcodec/pcm.c')
-rw-r--r--libavcodec/pcm.c43
1 files changed, 1 insertions, 42 deletions
diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c
index 31ee283daf..5b3bdf44e9 100644
--- a/libavcodec/pcm.c
+++ b/libavcodec/pcm.c
@@ -265,16 +265,7 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
/* av_get_bits_per_sample returns 0 for AV_CODEC_ID_PCM_DVD */
samples_per_block = 1;
- if (avctx->codec->id == AV_CODEC_ID_PCM_DVD) {
- if (avctx->bits_per_coded_sample != 20 &&
- avctx->bits_per_coded_sample != 24) {
- av_log(avctx, AV_LOG_ERROR, "PCM DVD unsupported sample depth\n");
- return AVERROR(EINVAL);
- }
- /* 2 samples are interleaved per block in PCM_DVD */
- samples_per_block = 2;
- sample_size = avctx->bits_per_coded_sample * 2 / 8;
- } else if (avctx->codec_id == AV_CODEC_ID_PCM_LXF) {
+ if (avctx->codec_id == AV_CODEC_ID_PCM_LXF) {
/* we process 40-bit blocks per channel for LXF */
samples_per_block = 2;
sample_size = 5;
@@ -408,37 +399,6 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
samples += 2;
}
break;
- case AV_CODEC_ID_PCM_DVD:
- {
- const uint8_t *src8;
- dst_int32_t = (int32_t *)frame->data[0];
- n /= avctx->channels;
- switch (avctx->bits_per_coded_sample) {
- case 20:
- while (n--) {
- c = avctx->channels;
- src8 = src + 4 * c;
- while (c--) {
- *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8 & 0xf0) << 8);
- *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++ & 0x0f) << 12);
- }
- src = src8;
- }
- break;
- case 24:
- while (n--) {
- c = avctx->channels;
- src8 = src + 4 * c;
- while (c--) {
- *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++) << 8);
- *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++) << 8);
- }
- src = src8;
- }
- break;
- }
- break;
- }
case AV_CODEC_ID_PCM_LXF:
{
int i;
@@ -522,7 +482,6 @@ AVCodec ff_ ## name_ ## _decoder = { \
/* Note: Do not forget to add new entries to the Makefile as well. */
PCM_CODEC (PCM_ALAW, AV_SAMPLE_FMT_S16, pcm_alaw, "PCM A-law");
-PCM_DECODER(PCM_DVD, AV_SAMPLE_FMT_S32, pcm_dvd, "PCM signed 20|24-bit big-endian");
PCM_CODEC (PCM_F32BE, AV_SAMPLE_FMT_FLT, pcm_f32be, "PCM 32-bit floating point big-endian");
PCM_CODEC (PCM_F32LE, AV_SAMPLE_FMT_FLT, pcm_f32le, "PCM 32-bit floating point little-endian");
PCM_CODEC (PCM_F64BE, AV_SAMPLE_FMT_DBL, pcm_f64be, "PCM 64-bit floating point big-endian");