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

Git pushed a commit to branch master
in repository ffmpeg.

commit 1586fd2dc2069ccd9decb76fd14bd9403205699f
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Sat Sep 26 01:08:09 2026 +0200
Commit:     James Almer <[email protected]>
CommitDate: Sat Sep 26 00:03:12 2026 +0000

    avcodec/cbs_h265: factor the picture size in CTBs out of the slice header 
parser
    
    PicWidthInCtbsY and PicHeightInCtbsY are also needed by the picture
    timing SEI parser.
---
 libavcodec/cbs_h265.c                 | 10 ++++++++++
 libavcodec/cbs_h265_syntax_template.c |  9 +--------
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/libavcodec/cbs_h265.c b/libavcodec/cbs_h265.c
index 9aedc7793c..5d6718dfa1 100644
--- a/libavcodec/cbs_h265.c
+++ b/libavcodec/cbs_h265.c
@@ -26,6 +26,16 @@
 #include "cbs_sei.h"
 #include "get_bits.h"
 
+// PicWidthInCtbsY and PicHeightInCtbsY (7.4.3.2.1).
+static void cbs_h265_pic_size_in_ctbs(const H265RawSPS *sps,
+                                      unsigned int *width, unsigned int 
*height)
+{
+    unsigned int ctb_log2_size_y = sps->log2_min_luma_coding_block_size_minus3 
+ 3 +
+                                   
sps->log2_diff_max_min_luma_coding_block_size;
+    *width  = AV_CEIL_RSHIFT(sps->pic_width_in_luma_samples,  ctb_log2_size_y);
+    *height = AV_CEIL_RSHIFT(sps->pic_height_in_luma_samples, ctb_log2_size_y);
+}
+
 #define HEADER(name) do { \
         ff_cbs_trace_header(ctx, name); \
     } while (0)
diff --git a/libavcodec/cbs_h265_syntax_template.c 
b/libavcodec/cbs_h265_syntax_template.c
index c97b7ed361..0550ed074c 100644
--- a/libavcodec/cbs_h265_syntax_template.c
+++ b/libavcodec/cbs_h265_syntax_template.c
@@ -1515,7 +1515,6 @@ static int 
FUNC(slice_segment_header)(CodedBitstreamContext *ctx, RWContext *rw,
     CodedBitstreamH265Context *h265 = ctx->priv_data;
     const H265RawSPS *sps;
     const H265RawPPS *pps;
-    unsigned int min_cb_log2_size_y, ctb_log2_size_y, ctb_size_y;
     unsigned int pic_width_in_ctbs_y, pic_height_in_ctbs_y, pic_size_in_ctbs_y;
     unsigned int num_pic_total_curr = 0;
     int err, i;
@@ -1548,13 +1547,7 @@ static int 
FUNC(slice_segment_header)(CodedBitstreamContext *ctx, RWContext *rw,
     }
     h265->active_sps = sps;
 
-    min_cb_log2_size_y = sps->log2_min_luma_coding_block_size_minus3 + 3;
-    ctb_log2_size_y = min_cb_log2_size_y + 
sps->log2_diff_max_min_luma_coding_block_size;
-    ctb_size_y = 1 << ctb_log2_size_y;
-    pic_width_in_ctbs_y =
-        (sps->pic_width_in_luma_samples + ctb_size_y - 1) / ctb_size_y;
-    pic_height_in_ctbs_y =
-        (sps->pic_height_in_luma_samples + ctb_size_y - 1) / ctb_size_y;
+    cbs_h265_pic_size_in_ctbs(sps, &pic_width_in_ctbs_y, 
&pic_height_in_ctbs_y);
     pic_size_in_ctbs_y = pic_width_in_ctbs_y * pic_height_in_ctbs_y;
 
     if (!current->first_slice_segment_in_pic_flag) {

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to