This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 6f9849cbe533feac03ff62eabd4eb316ea12ea1c
Author:     Andreas Rheinhardt <[email protected]>
AuthorDate: Sun Dec 14 17:06:07 2025 +0100
Commit:     Andreas Rheinhardt <[email protected]>
CommitDate: Sun Dec 14 21:06:03 2025 +0100

    avcodec/libsvtjpegxsenc: Replace divisions by shifts
    
    Also simplify setting alloc_size.
    
    Reviewed-by: James Almer <[email protected]>
    Signed-off-by: Andreas Rheinhardt <[email protected]>
---
 libavcodec/libsvtjpegxsenc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/libsvtjpegxsenc.c b/libavcodec/libsvtjpegxsenc.c
index 2a7c67fe44..ba626b03c0 100644
--- a/libavcodec/libsvtjpegxsenc.c
+++ b/libavcodec/libsvtjpegxsenc.c
@@ -61,7 +61,6 @@ static int svt_jpegxs_enc_encode(AVCodecContext* avctx, 
AVPacket* pkt,
     svt_jpeg_xs_frame_t enc_output;
 
     SvtJxsErrorType_t err = SvtJxsErrorNone;
-    uint32_t pixel_size = svt_enc->encoder.input_bit_depth <= 8 ? 1 : 2;
 
     int ret = ff_get_encode_buffer(avctx, pkt, svt_enc->bitstream_frame_size, 
0);
     if (ret < 0)
@@ -71,11 +70,12 @@ static int svt_jpegxs_enc_encode(AVCodecContext* avctx, 
AVPacket* pkt,
     out_buf->allocation_size = pkt->size;// output bitstream size
     out_buf->used_size = 0;
 
+    unsigned pixel_shift = svt_enc->encoder.input_bit_depth <= 8 ? 0 : 1;
     for (int comp = 0; comp < 3; comp++) {
         // svt-jpegxs require stride in pixel's not in bytes, this means that 
for 10 bit-depth, stride is half the linesize
-        in_buf->stride[comp]     = frame->linesize[comp] / pixel_size;
+        in_buf->stride[comp]     = frame->linesize[comp] >> pixel_shift;
         in_buf->data_yuv[comp]   = frame->data[comp];
-        in_buf->alloc_size[comp] = in_buf->stride[comp] * 
svt_enc->encoder.source_height * pixel_size;
+        in_buf->alloc_size[comp] = frame->linesize[comp] * 
svt_enc->encoder.source_height;
     }
 
     enc_input.user_prv_ctx_ptr = pkt;

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to