diff mbox series

[FFmpeg-devel,v2,4/8] lavc/cbs_h266: Add NumSlicesInTile to H266RawPPS

Message ID 20240918071031.1377336-4-fei.w.wang@intel.com
State New
Headers show
Series [FFmpeg-devel,v2,1/8] lavc/vaapi_dec: Create VA parameters dynamically | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Wang, Fei W Sept. 18, 2024, 7:10 a.m. UTC
From: Fei Wang <fei.w.wang@intel.com>

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
---
 libavcodec/cbs_h266.h                 |  1 +
 libavcodec/cbs_h266_syntax_template.c | 16 ++++++++++------
 2 files changed, 11 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/cbs_h266.h b/libavcodec/cbs_h266.h
index 7f0e537b31..67a3ff6151 100644
--- a/libavcodec/cbs_h266.h
+++ b/libavcodec/cbs_h266.h
@@ -594,6 +594,7 @@  typedef struct H266RawPPS {
     uint16_t col_width_val[VVC_MAX_TILE_COLUMNS];           ///< ColWidthVal
     uint16_t row_height_val[VVC_MAX_TILE_ROWS];             ///< RowHeightVal
     uint16_t slice_top_left_tile_idx[VVC_MAX_SLICES];
+    uint16_t num_slices_in_tile[VVC_MAX_SLICES];
 } H266RawPPS;
 
 typedef struct H266RawAPS {
diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c
index 2e20119cc6..a6d926052d 100644
--- a/libavcodec/cbs_h266_syntax_template.c
+++ b/libavcodec/cbs_h266_syntax_template.c
@@ -2005,14 +2005,13 @@  static int FUNC(pps) (CodedBitstreamContext *ctx, RWContext *rw,
                 if (current->pps_slice_width_in_tiles_minus1[i] == 0 &&
                     current->pps_slice_height_in_tiles_minus1[i] == 0 &&
                     current->row_height_val[tile_y] > 1) {
-                    int num_slices_in_tile,
-                        uniform_slice_height, remaining_height_in_ctbs_y;
+                    int uniform_slice_height, remaining_height_in_ctbs_y;
                     remaining_height_in_ctbs_y =
                         current->row_height_val[tile_y];
                     ues(pps_num_exp_slices_in_tile[i],
                         0, current->row_height_val[tile_y] - 1, 1, i);
                     if (current->pps_num_exp_slices_in_tile[i] == 0) {
-                        num_slices_in_tile = 1;
+                        current->num_slices_in_tile[i] = 1;
                         current->slice_height_in_ctus[i] = current->row_height_val[tile_y];
                         slice_top_left_ctu_x[i] = ctu_x;
                         slice_top_left_ctu_y[i] = ctu_y;
@@ -2055,14 +2054,18 @@  static int FUNC(pps) (CodedBitstreamContext *ctx, RWContext *rw,
                             slice_top_left_ctu_y[i + j] = ctu_y;
                             j++;
                         }
-                        num_slices_in_tile = j;
+                        current->num_slices_in_tile[i] = j;
                     }
-                    for (int k = 0; k < num_slices_in_tile; k++)
+                    for (int k = 0; k < current->num_slices_in_tile[i]; k++)
                         current->slice_top_left_tile_idx[i + k] = tile_idx;
-                    i += num_slices_in_tile - 1;
+                    i += current->num_slices_in_tile[i] - 1;
                 } else {
                     uint16_t height = 0;
                     infer(pps_num_exp_slices_in_tile[i], 0);
+                    if (current->pps_slice_width_in_tiles_minus1[i] == 0 &&
+                        current->pps_slice_height_in_tiles_minus1[i] == 0)
+                        current->num_slices_in_tile[i] = 1;
+
                     for (j = 0;
                          j <= current->pps_slice_height_in_tiles_minus1[i];
                          j++) {
@@ -2103,6 +2106,7 @@  static int FUNC(pps) (CodedBitstreamContext *ctx, RWContext *rw,
                 uint16_t height = 0;
 
                 current->slice_top_left_tile_idx[i] = tile_idx;
+                current->num_slices_in_tile[i] = 1;
                 tile_x = tile_idx % current->num_tile_columns;
                 tile_y = tile_idx / current->num_tile_columns;
                 if (tile_y >= current->num_tile_rows)