summaryrefslogtreecommitdiff
path: root/libavcodec/pcm-dvdenc.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-07-10 15:22:52 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-07-10 16:58:43 +0200
commitd0b050562a140f8cc89905815403edc7ddf8cb36 (patch)
tree105e13d69b75d01d9e6c34cf7e4c0f18069b7ea4 /libavcodec/pcm-dvdenc.c
parent7259eef711a52cfa0face2a7d637f4e3f1c6aa43 (diff)
downloadffmpeg-d0b050562a140f8cc89905815403edc7ddf8cb36.tar.gz
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>
Diffstat (limited to 'libavcodec/pcm-dvdenc.c')
-rw-r--r--libavcodec/pcm-dvdenc.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libavcodec/pcm-dvdenc.c b/libavcodec/pcm-dvdenc.c
index c7f1d46ba3..0881697c17 100644
--- a/libavcodec/pcm-dvdenc.c
+++ b/libavcodec/pcm-dvdenc.c
@@ -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);
}