1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-09-28 16:02:17 +02:00

avcodec/tta: simplify final samples conversion

Remove dubious overflow message and counter.
This commit is contained in:
Paul B Mahol 2022-09-17 09:55:47 +02:00
parent b11813708d
commit 695bf82bfb

View File

@ -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;