summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <[email protected]>2022-11-24 20:00:18 -0300
committerJames Almer <[email protected]>2022-11-28 08:41:10 -0300
commit5746987bad4dd3880cd3a321ef3d970663cd8085 (patch)
treef256d3ee722a2593492e7f1ddd4944f32a984694
parenta6e26053c21362bb882932f3cfd1f1dfa2551f1d (diff)
avcodec/mjpegenc: take into account component count when writing the SOF header size
Fixes ticket #10069 Signed-off-by: James Almer <[email protected]> (cherry picked from commit 100939695307743396e30e6310d2ea9cf42f9aab)
-rw-r--r--libavcodec/mjpegenc_common.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/mjpegenc_common.c b/libavcodec/mjpegenc_common.c
index 98c464fc62..18e72ebd98 100644
--- a/libavcodec/mjpegenc_common.c
+++ b/libavcodec/mjpegenc_common.c
@@ -309,7 +309,7 @@ void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
default: av_assert0(0);
}
- put_bits(pb, 16, 17);
+ put_bits(pb, 16, 8 + 3 * components);
if (lossless && ( avctx->pix_fmt == AV_PIX_FMT_BGR0
|| avctx->pix_fmt == AV_PIX_FMT_BGRA
|| avctx->pix_fmt == AV_PIX_FMT_BGR24))