diff options
author | Paul B Mahol <onemda@gmail.com> | 2020-09-11 13:28:12 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2020-09-12 14:52:31 +0200 |
commit | ca49476ace90ddebc5f92d9d82297f77e528c21e (patch) | |
tree | 8d05bf50e09108ffa7bb66d084392975a3093009 | |
parent | 60c4459075c947244961dac5d372ab6bd6591ac2 (diff) | |
download | ffmpeg-ca49476ace90ddebc5f92d9d82297f77e528c21e.tar.gz |
avcodec/adpcm: take into account block_align when decoding ADPCM_PSX
Should reduce decoding overhead.
-rw-r--r-- | libavcodec/adpcm.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index 71e37efde7..e409a3aa6a 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -1966,11 +1966,13 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data, } break; case AV_CODEC_ID_ADPCM_PSX: + for (int block = 0; block < avpkt->size / FFMAX(avctx->block_align, 16 * avctx->channels); block++) { + int nb_samples_per_block = 28 * FFMAX(avctx->block_align, 16 * avctx->channels) / (16 * avctx->channels); for (channel = 0; channel < avctx->channels; channel++) { - samples = samples_p[channel]; + samples = samples_p[channel] + block * nb_samples_per_block; /* Read in every sample for this channel. */ - for (i = 0; i < nb_samples / 28; i++) { + for (i = 0; i < nb_samples_per_block / 28; i++) { int filter, shift, flag, byte; filter = bytestream2_get_byteu(&gb); @@ -2001,6 +2003,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data, } } } + } break; case AV_CODEC_ID_ADPCM_ARGO: /* |