avcodec/pcm-dvdenc: Fix encoding 24bit samples

The earlier code ignored the lower 16 bits and instead used
the highest 8 bits twice.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2022-07-10 15:22:52 +02:00
parent 7259eef711
commit d0b050562a
1 changed files with 6 additions and 6 deletions

View File

@ -146,8 +146,8 @@ static int pcm_dvd_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
for (int i = 2; i; i--) {
bytestream2_put_be16(&pb, src32[0] >> 16);
bytestream2_put_be16(&pb, src32[1] >> 16);
bytestream2_put_byte(&pb, (*src32++) >> 24);
bytestream2_put_byte(&pb, (*src32++) >> 24);
bytestream2_put_byte(&pb, (uint8_t)((*src32++) >> 8));
bytestream2_put_byte(&pb, (uint8_t)((*src32++) >> 8));
}
} while (--blocks);
} else {
@ -157,10 +157,10 @@ static int pcm_dvd_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
bytestream2_put_be16(&pb, src32[1] >> 16);
bytestream2_put_be16(&pb, src32[2] >> 16);
bytestream2_put_be16(&pb, src32[3] >> 16);
bytestream2_put_byte(&pb, (*src32++) >> 24);
bytestream2_put_byte(&pb, (*src32++) >> 24);
bytestream2_put_byte(&pb, (*src32++) >> 24);
bytestream2_put_byte(&pb, (*src32++) >> 24);
bytestream2_put_byte(&pb, (uint8_t)((*src32++) >> 8));
bytestream2_put_byte(&pb, (uint8_t)((*src32++) >> 8));
bytestream2_put_byte(&pb, (uint8_t)((*src32++) >> 8));
bytestream2_put_byte(&pb, (uint8_t)((*src32++) >> 8));
}
} while (--blocks);
}