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

Git pushed a commit to branch release/6.1
in repository ffmpeg.

commit 5986b500b285ae7c374ab2f3d54654397b8af012
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Sun Feb 22 21:50:37 2026 +0100
Commit:     Michael Niedermayer <[email protected]>
CommitDate: Sun Jun 14 20:01:01 2026 +0200

    avcodec/hevc/ps: Factor window reading out
    
    Signed-off-by: Michael Niedermayer <[email protected]>
    (cherry picked from commit 8c868a1fd2627c2e88f333c1296e6f5fc511dcfa)
    Signed-off-by: Michael Niedermayer <[email protected]>
    (cherry picked from commit 04b3060413fcfed3e31f3b9197779e75e38faf33)
---
 libavcodec/hevc_ps.c | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index 4606765db4..38d5a3e6c6 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -60,6 +60,22 @@ static const uint8_t hevc_sub_height_c[] = {
     1, 2, 1, 1
 };
 
+static int read_window(HEVCWindow *window, GetBitContext *gb, int 
chroma_format_idc, int w, int h)
+{
+    int64_t vert_mult  = hevc_sub_height_c[chroma_format_idc];
+    int64_t horiz_mult = hevc_sub_width_c [chroma_format_idc];
+    int64_t left   = get_ue_golomb_long(gb) * horiz_mult;
+    int64_t right  = get_ue_golomb_long(gb) * horiz_mult;
+    int64_t top    = get_ue_golomb_long(gb) * vert_mult;
+    int64_t bottom = get_ue_golomb_long(gb) * vert_mult;
+
+    window->left_offset   = left;
+    window->right_offset  = right;
+    window->top_offset    = top;
+    window->bottom_offset = bottom;
+    return 0;
+}
+
 static void remove_pps(HEVCParamSets *s, int id)
 {
     if (s->pps == s->pps_list[id])
@@ -610,12 +626,7 @@ static void decode_vui(GetBitContext *gb, AVCodecContext 
*avctx,
         vui->default_display_window_flag = get_bits1(gb);
 
     if (vui->default_display_window_flag) {
-        int vert_mult  = hevc_sub_height_c[sps->chroma_format_idc];
-        int horiz_mult = hevc_sub_width_c[sps->chroma_format_idc];
-        vui->def_disp_win.left_offset   = get_ue_golomb_long(gb) * horiz_mult;
-        vui->def_disp_win.right_offset  = get_ue_golomb_long(gb) * horiz_mult;
-        vui->def_disp_win.top_offset    = get_ue_golomb_long(gb) *  vert_mult;
-        vui->def_disp_win.bottom_offset = get_ue_golomb_long(gb) *  vert_mult;
+        read_window(&vui->def_disp_win, gb, sps->chroma_format_idc, 
sps->width, sps->height);
 
         if (apply_defdispwin &&
             avctx->flags2 & AV_CODEC_FLAG2_IGNORE_CROP) {
@@ -907,12 +918,9 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, 
unsigned int *sps_id,
 
     sps->conformance_window_flag = get_bits1(gb);
     if (sps->conformance_window_flag) {
-        int vert_mult  = hevc_sub_height_c[sps->chroma_format_idc];
-        int horiz_mult = hevc_sub_width_c[sps->chroma_format_idc];
-        sps->pic_conf_win.left_offset   = get_ue_golomb_long(gb) * horiz_mult;
-        sps->pic_conf_win.right_offset  = get_ue_golomb_long(gb) * horiz_mult;
-        sps->pic_conf_win.top_offset    = get_ue_golomb_long(gb) *  vert_mult;
-        sps->pic_conf_win.bottom_offset = get_ue_golomb_long(gb) *  vert_mult;
+        ret = read_window(&sps->pic_conf_win, gb, sps->chroma_format_idc, 
sps->width, sps->height);
+        if (ret < 0)
+            return ret;
 
         if (avctx->flags2 & AV_CODEC_FLAG2_IGNORE_CROP) {
             av_log(avctx, AV_LOG_DEBUG,

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

Reply via email to