summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavcodec/tta.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libavcodec/tta.c b/libavcodec/tta.c
index afc4907432..593cb6629a 100644
--- a/libavcodec/tta.c
+++ b/libavcodec/tta.c
@@ -371,8 +371,15 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data,
case 3: {
// shift samples for 24-bit sample format
int32_t *samples = (int32_t *)frame->data[0];
- for (i = 0; i < framelen * s->channels; i++)
- *samples++ *= 256;
+ 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);
// reset decode buffer
s->decode_buffer = NULL;
break;