diff options
author | Paul B Mahol <onemda@gmail.com> | 2012-03-17 03:05:12 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-03-17 05:31:26 +0100 |
commit | 32a5775a9192ed9d88d50ed2ff602d3ef4e98c84 (patch) | |
tree | c70db7bf9214d11ff5adc36f85d00861381bb524 /libavcodec/pcm.c | |
parent | 8a91da9575dd54fca6f411f28b5f0847a39d0bff (diff) | |
download | ffmpeg-streaming-32a5775a9192ed9d88d50ed2ff602d3ef4e98c84.zip ffmpeg-streaming-32a5775a9192ed9d88d50ed2ff602d3ef4e98c84.tar.gz |
pcm: leave sample format conversion to libswresample
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/pcm.c')
-rw-r--r-- | libavcodec/pcm.c | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index d041d77..f082dcb 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -340,15 +340,15 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data, break; case CODEC_ID_PCM_S16LE_PLANAR: { - const uint8_t *src2[MAX_CHANNELS]; + int i; n /= avctx->channels; - for(c=0;c<avctx->channels;c++) - src2[c] = &src[c*n*2]; - for(;n>0;n--) - for(c=0;c<avctx->channels;c++) { - AV_WN16A(samples, bytestream_get_le16(&src2[c])); + for(c=0;c<avctx->channels;c++) { + samples = s->frame.data[c]; + for(i=n;i>0;i--) { + AV_WN16A(samples, bytestream_get_le16(&src)); samples += 2; } + } break; } case CODEC_ID_PCM_U16LE: @@ -445,21 +445,18 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data, case CODEC_ID_PCM_LXF: { int i; - const uint8_t *src8; - dst_int32_t = (int32_t *)s->frame.data[0]; n /= avctx->channels; - //unpack and de-planerize - for (i = 0; i < n; i++) { - for (c = 0, src8 = src + i*5; c < avctx->channels; c++, src8 += n*5) { + //unpack + for (c = 0; c < avctx->channels; c++) { + dst_int32_t = (int32_t *)s->frame.data[c]; + for (i = 0; i < n; i++) { //extract low 20 bits and expand to 32 bits - *dst_int32_t++ = (src8[2] << 28) | (src8[1] << 20) | (src8[0] << 12) | - ((src8[2] & 0xF) << 8) | src8[1]; - } - - for (c = 0, src8 = src + i*5; c < avctx->channels; c++, src8 += n*5) { + *dst_int32_t++ = (src[2] << 28) | (src[1] << 20) | (src[0] << 12) | + ((src[2] & 0xF) << 8) | src[1]; //extract high 20 bits and expand to 32 bits - *dst_int32_t++ = (src8[4] << 24) | (src8[3] << 16) | - ((src8[2] & 0xF0) << 8) | (src8[4] << 4) | (src8[3] >> 4); + *dst_int32_t++ = (src[4] << 24) | (src[3] << 16) | + ((src[2] & 0xF0) << 8) | (src[4] << 4) | (src[3] >> 4); + src += 5; } } break; @@ -518,12 +515,12 @@ PCM_CODEC (CODEC_ID_PCM_F32BE, AV_SAMPLE_FMT_FLT, pcm_f32be, "PCM 32-bit floati PCM_CODEC (CODEC_ID_PCM_F32LE, AV_SAMPLE_FMT_FLT, pcm_f32le, "PCM 32-bit floating point little-endian"); PCM_CODEC (CODEC_ID_PCM_F64BE, AV_SAMPLE_FMT_DBL, pcm_f64be, "PCM 64-bit floating point big-endian"); PCM_CODEC (CODEC_ID_PCM_F64LE, AV_SAMPLE_FMT_DBL, pcm_f64le, "PCM 64-bit floating point little-endian"); -PCM_DECODER(CODEC_ID_PCM_LXF, AV_SAMPLE_FMT_S32, pcm_lxf, "PCM signed 20-bit little-endian planar"); +PCM_DECODER(CODEC_ID_PCM_LXF, AV_SAMPLE_FMT_S32P, pcm_lxf, "PCM signed 20-bit little-endian planar"); PCM_CODEC (CODEC_ID_PCM_MULAW, AV_SAMPLE_FMT_S16, pcm_mulaw, "PCM mu-law / G.711 mu-law"); PCM_CODEC (CODEC_ID_PCM_S8, AV_SAMPLE_FMT_U8, pcm_s8, "PCM signed 8-bit"); PCM_CODEC (CODEC_ID_PCM_S16BE, AV_SAMPLE_FMT_S16, pcm_s16be, "PCM signed 16-bit big-endian"); PCM_CODEC (CODEC_ID_PCM_S16LE, AV_SAMPLE_FMT_S16, pcm_s16le, "PCM signed 16-bit little-endian"); -PCM_DECODER(CODEC_ID_PCM_S16LE_PLANAR, AV_SAMPLE_FMT_S16, pcm_s16le_planar, "PCM 16-bit little-endian planar"); +PCM_DECODER(CODEC_ID_PCM_S16LE_PLANAR, AV_SAMPLE_FMT_S16P, pcm_s16le_planar, "PCM 16-bit little-endian planar"); PCM_CODEC (CODEC_ID_PCM_S24BE, AV_SAMPLE_FMT_S32, pcm_s24be, "PCM signed 24-bit big-endian"); PCM_CODEC (CODEC_ID_PCM_S24DAUD, AV_SAMPLE_FMT_S16, pcm_s24daud, "PCM D-Cinema audio signed 24-bit"); PCM_CODEC (CODEC_ID_PCM_S24LE, AV_SAMPLE_FMT_S32, pcm_s24le, "PCM signed 24-bit little-endian"); |