This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 8abb40a8d89434b4cbfb4dad87894878c1c84f42 Author: Ramiro Polla <[email protected]> AuthorDate: Wed Sep 24 00:17:02 2025 +0200 Commit: Ramiro Polla <[email protected]> CommitDate: Fri Feb 20 16:32:10 2026 +0100 avcodec/mjpegdec: simplify away mjpeg_unescape_sos()'s parameters The input is always obtained from s->gB and the output is always used to initialize s->gb, so we can move that inside the function itself. --- libavcodec/mjpegdec.c | 45 +++++++++++++++++++-------------------------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 88205ee5c7..cd36bc6022 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -55,10 +55,7 @@ #include "put_bits.h" -static int mjpeg_unescape_sos(MJpegDecodeContext *s, - const uint8_t *buf_ptr, const uint8_t *buf_end, - const uint8_t **unescaped_buf_ptr, - size_t *unescaped_buf_size); +static int mjpeg_unescape_sos(MJpegDecodeContext *s); static int init_default_huffman_tables(MJpegDecodeContext *s) { @@ -1796,14 +1793,7 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const uint8_t *mb_bitmask, if (s->mjpb_skiptosod) bytestream2_skip(&s->gB, s->mjpb_skiptosod); - const uint8_t *unescaped_buf_ptr; - size_t unescaped_buf_size; - ret = mjpeg_unescape_sos(s, s->gB.buffer, s->gB.buffer + bytestream2_get_bytes_left(&s->gB), - &unescaped_buf_ptr, &unescaped_buf_size); - if (ret < 0) - return ret; - - ret = init_get_bits8(&s->gb, unescaped_buf_ptr, unescaped_buf_size); + ret = mjpeg_unescape_sos(s); if (ret < 0) return ret; @@ -2242,17 +2232,19 @@ found: return val; } -static int mjpeg_unescape_sos(MJpegDecodeContext *s, - const uint8_t *buf_ptr, const uint8_t *buf_end, - const uint8_t **unescaped_buf_ptr, - size_t *unescaped_buf_size) +static int mjpeg_unescape_sos(MJpegDecodeContext *s) { + const uint8_t *buf_ptr = s->gB.buffer; + const uint8_t *buf_end = buf_ptr + bytestream2_get_bytes_left(&s->gB); + const uint8_t *unescaped_buf_ptr; + size_t unescaped_buf_size; + if (s->avctx->codec_id == AV_CODEC_ID_MEDIA100 || s->avctx->codec_id == AV_CODEC_ID_MJPEGB || s->avctx->codec_id == AV_CODEC_ID_THP) { - *unescaped_buf_ptr = buf_ptr; - *unescaped_buf_size = buf_end - buf_ptr; - return 0; + unescaped_buf_ptr = buf_ptr; + unescaped_buf_size = buf_end - buf_ptr; + goto the_end; } av_fast_padded_malloc(&s->buffer, &s->buffer_size, buf_end - buf_ptr); @@ -2305,9 +2297,9 @@ static int mjpeg_unescape_sos(MJpegDecodeContext *s, copy_data_segment(0); #undef copy_data_segment - *unescaped_buf_ptr = s->buffer; - *unescaped_buf_size = dst - s->buffer; - memset(s->buffer + *unescaped_buf_size, 0, + unescaped_buf_ptr = s->buffer; + unescaped_buf_size = dst - s->buffer; + memset(s->buffer + unescaped_buf_size, 0, AV_INPUT_BUFFER_PADDING_SIZE); av_log(s->avctx, AV_LOG_DEBUG, "escaping removed %td bytes\n", @@ -2350,13 +2342,14 @@ static int mjpeg_unescape_sos(MJpegDecodeContext *s, } flush_put_bits(&pb); - *unescaped_buf_ptr = dst; - *unescaped_buf_size = (bit_count + 7) >> 3; - memset(s->buffer + *unescaped_buf_size, 0, + unescaped_buf_ptr = dst; + unescaped_buf_size = (bit_count + 7) >> 3; + memset(s->buffer + unescaped_buf_size, 0, AV_INPUT_BUFFER_PADDING_SIZE); } - return 0; +the_end: + return init_get_bits8(&s->gb, unescaped_buf_ptr, unescaped_buf_size); } static void reset_icc_profile(MJpegDecodeContext *s) _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
