Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Nuo Mi <nuomi2021@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Nuo Mi <nuomi2021@gmail.com>
Subject: [FFmpeg-devel] [PATCH v2 5/8] cbs_h266: H266RawSliceHeader, expose NumEntryPoints
Date: Tue,  8 Aug 2023 18:59:00 +0800
Message-ID: <TYSPR06MB64331823BF41858BCD72E039AA0DA@TYSPR06MB6433.apcprd06.prod.outlook.com> (raw)
In-Reply-To: <20230808105903.6667-1-nuomi2021@gmail.com>

---
 libavcodec/cbs_h266.h                 |  3 +++
 libavcodec/cbs_h266_syntax_template.c | 17 +++++++++--------
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/libavcodec/cbs_h266.h b/libavcodec/cbs_h266.h
index 0196f46bc0..1d80c74feb 100644
--- a/libavcodec/cbs_h266.h
+++ b/libavcodec/cbs_h266.h
@@ -828,6 +828,9 @@ typedef struct  H266RawSliceHeader {
     uint8_t  sh_entry_offset_len_minus1;
     uint32_t sh_entry_point_offset_minus1[VVC_MAX_ENTRY_POINTS];
 
+    // derived values
+    uint32_t num_entry_points;              ///< NumEntryPoints
+
 } H266RawSliceHeader;
 
 typedef struct H266RawSlice {
diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c
index 43b3346359..d0d1ccadd2 100644
--- a/libavcodec/cbs_h266_syntax_template.c
+++ b/libavcodec/cbs_h266_syntax_template.c
@@ -3374,8 +3374,9 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw,
         for (i = 0; i < current->sh_slice_header_extension_length; i++)
             us(8, sh_slice_header_extension_data_byte[i], 0x00, 0xff, 1, i);
     }
+
+    current->num_entry_points = 0;
     if (sps->sps_entry_point_offsets_present_flag) {
-        int num_entry_points = 0;
         uint8_t entropy_sync = sps->sps_entropy_coding_sync_enabled_flag;
         int height;
         if (pps->pps_rect_slice_flag) {
@@ -3392,7 +3393,7 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw,
             else
                 height = pps->pps_slice_height_in_tiles_minus1[slice_idx] + 1;
 
-            num_entry_points = width_in_tiles * height;
+            current->num_entry_points = width_in_tiles * height;
         } else {
             int tile_idx;
             int tile_y;
@@ -3402,18 +3403,18 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw,
                  current->sh_num_tiles_in_slice_minus1; tile_idx++) {
                 tile_y = tile_idx / pps->num_tile_rows;
                 height = pps->row_height_val[tile_y];
-                num_entry_points += (entropy_sync ? height : 1);
+                current->num_entry_points += (entropy_sync ? height : 1);
             }
         }
-        num_entry_points--;
-        if (num_entry_points > VVC_MAX_ENTRY_POINTS) {
+        current->num_entry_points--;
+        if (current->num_entry_points > VVC_MAX_ENTRY_POINTS) {
             av_log(ctx->log_ctx, AV_LOG_ERROR, "Too many entry points: "
-                   "%" PRIu16 ".\n", num_entry_points);
+                   "%" PRIu16 ".\n", current->num_entry_points);
             return AVERROR_PATCHWELCOME;
         }
-        if (num_entry_points > 0) {
+        if (current->num_entry_points > 0) {
             ue(sh_entry_offset_len_minus1, 0, 31);
-            for (i = 0; i < num_entry_points; i++) {
+            for (i = 0; i < current->num_entry_points; i++) {
                 ubs(current->sh_entry_offset_len_minus1 + 1,
                     sh_entry_point_offset_minus1[i], 1, i);
             }
-- 
2.25.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  parent reply	other threads:[~2023-08-08 10:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-07 14:55 [FFmpeg-devel] [PATCH 1/8] cbs_h266: fix inference for sh_lmcs_used_flag and sh_explicit_scaling_list_used_flag Nuo Mi
2023-08-07 15:17 ` James Almer
2023-08-07 15:47   ` Nuo Mi
2023-08-08 10:58 ` [FFmpeg-devel] [PATCH v2 " Nuo Mi
2023-08-17 13:38   ` James Almer
     [not found] ` <20230808105903.6667-1-nuomi2021@gmail.com>
2023-08-08 10:58   ` [FFmpeg-devel] [PATCH v2 2/8] cbs_h266: fix inference for sh_alf_enabled_flag Nuo Mi
2023-08-08 10:58   ` [FFmpeg-devel] [PATCH v2 3/8] cbs_h266: fix inference for xh_deblocking_filter_disabled_flag Nuo Mi
2023-08-08 10:58   ` [FFmpeg-devel] [PATCH v2 4/8] cbs_h266: fix slice_height_in_ctus for single slice tile Nuo Mi
2023-08-08 10:59   ` Nuo Mi [this message]
2023-08-08 10:59   ` [FFmpeg-devel] [PATCH v2 6/8] cbs_h266: H266RawPredWeightTable, expose num_weights_l0 and num_weights_l1 Nuo Mi
2023-08-08 10:59   ` [FFmpeg-devel] [PATCH v2 7/8] cbs_h266: H266RawSliceHeader, expose NumRefIdxActive[] Nuo Mi
2023-08-08 10:59   ` [FFmpeg-devel] [PATCH v2 8/8] cbs_h266: slice_header, fix inference for pred_weight_table Nuo Mi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=TYSPR06MB64331823BF41858BCD72E039AA0DA@TYSPR06MB6433.apcprd06.prod.outlook.com \
    --to=nuomi2021@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git