mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
pcmdec: use memcpy() when possible for planar decoders
This is faster (at least with clang). Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
parent
07a866282f
commit
f17f759544
@ -332,6 +332,9 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
case AV_CODEC_ID_PCM_S24LE:
|
case AV_CODEC_ID_PCM_S24LE:
|
||||||
DECODE(32, le24, src, samples, n, 8, 0)
|
DECODE(32, le24, src, samples, n, 8, 0)
|
||||||
break;
|
break;
|
||||||
|
case AV_CODEC_ID_PCM_S24LE_PLANAR:
|
||||||
|
DECODE_PLANAR(32, le24, src, samples, n, 8, 0);
|
||||||
|
break;
|
||||||
case AV_CODEC_ID_PCM_S24BE:
|
case AV_CODEC_ID_PCM_S24BE:
|
||||||
DECODE(32, be24, src, samples, n, 8, 0)
|
DECODE(32, be24, src, samples, n, 8, 0)
|
||||||
break;
|
break;
|
||||||
@ -350,18 +353,6 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
samples += 2;
|
samples += 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AV_CODEC_ID_PCM_S16BE_PLANAR:
|
|
||||||
DECODE_PLANAR(16, be16, src, samples, n, 0, 0);
|
|
||||||
break;
|
|
||||||
case AV_CODEC_ID_PCM_S16LE_PLANAR:
|
|
||||||
DECODE_PLANAR(16, le16, src, samples, n, 0, 0);
|
|
||||||
break;
|
|
||||||
case AV_CODEC_ID_PCM_S24LE_PLANAR:
|
|
||||||
DECODE_PLANAR(32, le24, src, samples, n, 8, 0);
|
|
||||||
break;
|
|
||||||
case AV_CODEC_ID_PCM_S32LE_PLANAR:
|
|
||||||
DECODE_PLANAR(32, le32, src, samples, n, 0, 0);
|
|
||||||
break;
|
|
||||||
case AV_CODEC_ID_PCM_U16LE:
|
case AV_CODEC_ID_PCM_U16LE:
|
||||||
DECODE(16, le16, src, samples, n, 0, 0x8000)
|
DECODE(16, le16, src, samples, n, 0, 0x8000)
|
||||||
break;
|
break;
|
||||||
@ -389,9 +380,15 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
case AV_CODEC_ID_PCM_F32LE:
|
case AV_CODEC_ID_PCM_F32LE:
|
||||||
DECODE(32, le32, src, samples, n, 0, 0)
|
DECODE(32, le32, src, samples, n, 0, 0)
|
||||||
break;
|
break;
|
||||||
|
case AV_CODEC_ID_PCM_S32LE_PLANAR:
|
||||||
|
DECODE_PLANAR(32, le32, src, samples, n, 0, 0);
|
||||||
|
break;
|
||||||
case AV_CODEC_ID_PCM_S16LE:
|
case AV_CODEC_ID_PCM_S16LE:
|
||||||
DECODE(16, le16, src, samples, n, 0, 0)
|
DECODE(16, le16, src, samples, n, 0, 0)
|
||||||
break;
|
break;
|
||||||
|
case AV_CODEC_ID_PCM_S16LE_PLANAR:
|
||||||
|
DECODE_PLANAR(16, le16, src, samples, n, 0, 0);
|
||||||
|
break;
|
||||||
case AV_CODEC_ID_PCM_F64BE:
|
case AV_CODEC_ID_PCM_F64BE:
|
||||||
case AV_CODEC_ID_PCM_F32BE:
|
case AV_CODEC_ID_PCM_F32BE:
|
||||||
case AV_CODEC_ID_PCM_S32BE:
|
case AV_CODEC_ID_PCM_S32BE:
|
||||||
@ -407,6 +404,9 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
case AV_CODEC_ID_PCM_S16BE:
|
case AV_CODEC_ID_PCM_S16BE:
|
||||||
DECODE(16, be16, src, samples, n, 0, 0)
|
DECODE(16, be16, src, samples, n, 0, 0)
|
||||||
break;
|
break;
|
||||||
|
case AV_CODEC_ID_PCM_S16BE_PLANAR:
|
||||||
|
DECODE_PLANAR(16, be16, src, samples, n, 0, 0);
|
||||||
|
break;
|
||||||
case AV_CODEC_ID_PCM_F64LE:
|
case AV_CODEC_ID_PCM_F64LE:
|
||||||
case AV_CODEC_ID_PCM_F32LE:
|
case AV_CODEC_ID_PCM_F32LE:
|
||||||
case AV_CODEC_ID_PCM_S32LE:
|
case AV_CODEC_ID_PCM_S32LE:
|
||||||
@ -415,6 +415,18 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
case AV_CODEC_ID_PCM_U8:
|
case AV_CODEC_ID_PCM_U8:
|
||||||
memcpy(samples, src, n * sample_size);
|
memcpy(samples, src, n * sample_size);
|
||||||
break;
|
break;
|
||||||
|
#if HAVE_BIGENDIAN
|
||||||
|
case AV_CODEC_ID_PCM_S16BE_PLANAR:
|
||||||
|
#else
|
||||||
|
case AV_CODEC_ID_PCM_S16LE_PLANAR:
|
||||||
|
case AV_CODEC_ID_PCM_S32LE_PLANAR:
|
||||||
|
#endif /* HAVE_BIGENDIAN */
|
||||||
|
n /= avctx->channels;
|
||||||
|
for (c = 0; c < avctx->channels; c++) {
|
||||||
|
samples = s->frame.extended_data[c];
|
||||||
|
bytestream_get_buffer(&src, samples, n * sample_size);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case AV_CODEC_ID_PCM_ZORK:
|
case AV_CODEC_ID_PCM_ZORK:
|
||||||
for (; n > 0; n--) {
|
for (; n > 0; n--) {
|
||||||
int v = *src++;
|
int v = *src++;
|
||||||
|
Loading…
Reference in New Issue
Block a user