mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2026-01-23 23:21:06 +01:00
avcodec/tta: simplify final samples conversion
Remove dubious overflow message and counter.
This commit is contained in:
parent
b11813708d
commit
695bf82bfb
1 changed files with 8 additions and 12 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue