diff options
author | Paul B Mahol <onemda@gmail.com> | 2022-09-17 09:55:47 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2022-09-17 10:00:41 +0200 |
commit | 695bf82bfb233fa0e77af4029c88620d943c3cba (patch) | |
tree | c1812b6d26c0124e5604c89511f10c9bac848320 /libavcodec/tta.c | |
parent | b11813708dc463b678d7e0a2638e47d217a03ed1 (diff) | |
download | ffmpeg-695bf82bfb233fa0e77af4029c88620d943c3cba.tar.gz |
avcodec/tta: simplify final samples conversion
Remove dubious overflow message and counter.
Diffstat (limited to 'libavcodec/tta.c')
-rw-r--r-- | libavcodec/tta.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/libavcodec/tta.c b/libavcodec/tta.c index d66e25af05..e63d08bb44 100644 --- a/libavcodec/tta.c +++ b/libavcodec/tta.c @@ -364,28 +364,24 @@ static int tta_decode_frame(AVCodecContext *avctx, AVFrame *frame, switch (s->bps) { case 1: { uint8_t *samples = (uint8_t *)frame->data[0]; - for (p = s->decode_buffer; (int32_t*)p < s->decode_buffer + (framelen * s->channels); p++) - *samples++ = *p + 0x80; + p = s->decode_buffer; + for (i = 0; i < framelen * s->channels; i++) + samples[i] = p[i] + 0x80; break; } case 2: { int16_t *samples = (int16_t *)frame->data[0]; - for (p = s->decode_buffer; (int32_t*)p < s->decode_buffer + (framelen * s->channels); p++) - *samples++ = *p; + p = s->decode_buffer; + for (i = 0; i < framelen * s->channels; i++) + samples[i] = p[i]; break; } case 3: { // shift samples for 24-bit sample format int32_t *samples = (int32_t *)frame->data[0]; - int overflow = 0; - for (i = 0; i < framelen * s->channels; i++) { - int scaled = *samples * 256U; - overflow += (scaled >> 8 != *samples); - *samples++ = scaled; - } - if (overflow) - av_log(avctx, AV_LOG_WARNING, "%d overflows occurred on 24bit upscale\n", overflow); + for (i = 0; i < framelen * s->channels; i++) + samples[i] = samples[i] * 256U; // reset decode buffer s->decode_buffer = NULL; break; |