Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 7/8] cbs_h266: H266RawSliceHeader, expose NumRefIdxActive[]
       [not found] <20230807155341.21438-1-nuomi2021@gmail.com>
@ 2023-08-07 15:53 ` Nuo Mi
  2023-08-07 15:53 ` [FFmpeg-devel] [PATCH 8/8] cbs_h266: slice_header, fix inference for pred_weight_table Nuo Mi
  1 sibling, 0 replies; 2+ messages in thread
From: Nuo Mi @ 2023-08-07 15:53 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Nuo Mi

---
 libavcodec/cbs_h266.h                 |  1 +
 libavcodec/cbs_h266_syntax_template.c | 41 +++++++++++++--------------
 2 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/libavcodec/cbs_h266.h b/libavcodec/cbs_h266.h
index 87a2d02cfd..3a6f6d96b5 100644
--- a/libavcodec/cbs_h266.h
+++ b/libavcodec/cbs_h266.h
@@ -833,6 +833,7 @@ typedef struct  H266RawSliceHeader {
 
     // derived values
     uint32_t num_entry_points;              ///< NumEntryPoints
+    uint8_t  num_ref_idx_active[2];         ///< NumRefIdxActive[]
 
 } H266RawSliceHeader;
 
diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c
index 501c066faa..b26d7c1a72 100644
--- a/libavcodec/cbs_h266_syntax_template.c
+++ b/libavcodec/cbs_h266_syntax_template.c
@@ -3191,39 +3191,38 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw,
     } else {
         infer(sh_num_ref_idx_active_override_flag, 1);
     }
+
+    for (i = 0; i < 2; i++) {
+        if (current->sh_slice_type == VVC_SLICE_TYPE_B ||
+            (current->sh_slice_type == VVC_SLICE_TYPE_P && i == 0)) {
+            if (current->sh_num_ref_idx_active_override_flag) {
+                current->num_ref_idx_active[i] = current->sh_num_ref_idx_active_minus1[i] + 1;
+            } else {
+                current->num_ref_idx_active[i] =
+                    FFMIN(ref_pic_lists->rpl_ref_list[i].num_ref_entries,
+                        pps->pps_num_ref_idx_default_active_minus1[i] + 1);
+            }
+        } else {
+            current->num_ref_idx_active[i] = 0;
+        }
+    }
+
     if (current->sh_slice_type != VVC_SLICE_TYPE_I) {
         if (pps->pps_cabac_init_present_flag)
             flag(sh_cabac_init_flag);
         else
             infer(sh_cabac_init_flag, 0);
         if (ph->ph_temporal_mvp_enabled_flag && !pps->pps_rpl_info_in_ph_flag) {
-            uint8_t num_ref_idx_active[2];
-            for (i = 0; i < 2; i++) {
-                if (current->sh_slice_type == VVC_SLICE_TYPE_B ||
-                    (current->sh_slice_type == VVC_SLICE_TYPE_P && i == 0)) {
-                    if (current->sh_num_ref_idx_active_override_flag) {
-                        num_ref_idx_active[i] =
-                            current->sh_num_ref_idx_active_minus1[i] + 1;
-                    } else {
-                        num_ref_idx_active[i] =
-                            FFMIN(ref_pic_lists->rpl_ref_list[i].num_ref_entries,
-                                  pps->pps_num_ref_idx_default_active_minus1[i] + 1);
-                    }
-                } else {
-                    num_ref_idx_active[i] = 0;
-                }
-            }
-
             if (current->sh_slice_type == VVC_SLICE_TYPE_B)
                 flag(sh_collocated_from_l0_flag);
             else
                 infer(sh_collocated_from_l0_flag, 1);
             if ((current->sh_collocated_from_l0_flag &&
-                 num_ref_idx_active[0] > 1) ||
+                 current->num_ref_idx_active[0] > 1) ||
                 (!current->sh_collocated_from_l0_flag &&
-                 num_ref_idx_active[1] > 1)) {
+                 current->num_ref_idx_active[1] > 1)) {
                 unsigned int idx = current->sh_collocated_from_l0_flag ? 0 : 1;
-                ue(sh_collocated_ref_idx, 0, num_ref_idx_active[idx] - 1);
+                ue(sh_collocated_ref_idx, 0, current->num_ref_idx_active[idx] - 1);
             } else {
                 infer(sh_collocated_ref_idx, 0);
             }
@@ -3233,7 +3232,7 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw,
                  (pps->pps_weighted_bipred_flag &&
                   current->sh_slice_type == VVC_SLICE_TYPE_B))) {
                 CHECK(FUNC(pred_weight_table) (ctx, rw, sps, pps, ref_pic_lists,
-                                               num_ref_idx_active,
+                                               current->num_ref_idx_active,
                                                &current->sh_pred_weight_table));
             }
         }
-- 
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".

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [FFmpeg-devel] [PATCH 8/8] cbs_h266: slice_header, fix inference for pred_weight_table
       [not found] <20230807155341.21438-1-nuomi2021@gmail.com>
  2023-08-07 15:53 ` [FFmpeg-devel] [PATCH 7/8] cbs_h266: H266RawSliceHeader, expose NumRefIdxActive[] Nuo Mi
@ 2023-08-07 15:53 ` Nuo Mi
  1 sibling, 0 replies; 2+ messages in thread
From: Nuo Mi @ 2023-08-07 15:53 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Nuo Mi

---
 libavcodec/cbs_h266_syntax_template.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c
index b26d7c1a72..4075897b9a 100644
--- a/libavcodec/cbs_h266_syntax_template.c
+++ b/libavcodec/cbs_h266_syntax_template.c
@@ -3226,17 +3226,16 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw,
             } else {
                 infer(sh_collocated_ref_idx, 0);
             }
-            if (!pps->pps_wp_info_in_ph_flag &&
-                ((pps->pps_weighted_pred_flag &&
-                  current->sh_slice_type == VVC_SLICE_TYPE_P) ||
-                 (pps->pps_weighted_bipred_flag &&
-                  current->sh_slice_type == VVC_SLICE_TYPE_B))) {
-                CHECK(FUNC(pred_weight_table) (ctx, rw, sps, pps, ref_pic_lists,
-                                               current->num_ref_idx_active,
-                                               &current->sh_pred_weight_table));
-            }
         }
-
+        if (!pps->pps_wp_info_in_ph_flag &&
+            ((pps->pps_weighted_pred_flag &&
+            current->sh_slice_type == VVC_SLICE_TYPE_P) ||
+            (pps->pps_weighted_bipred_flag &&
+            current->sh_slice_type == VVC_SLICE_TYPE_B))) {
+            CHECK(FUNC(pred_weight_table) (ctx, rw, sps, pps, ref_pic_lists,
+                                           current->num_ref_idx_active,
+                                           &current->sh_pred_weight_table));
+        }
     }
     qp_bd_offset = 6 * sps->sps_bitdepth_minus8;
     if (!pps->pps_qp_delta_info_in_ph_flag)
-- 
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".

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-07 15:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20230807155341.21438-1-nuomi2021@gmail.com>
2023-08-07 15:53 ` [FFmpeg-devel] [PATCH 7/8] cbs_h266: H266RawSliceHeader, expose NumRefIdxActive[] Nuo Mi
2023-08-07 15:53 ` [FFmpeg-devel] [PATCH 8/8] cbs_h266: slice_header, fix inference for pred_weight_table Nuo Mi

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