diff options
author | Nuo Mi <nuomi2021@gmail.com> | 2023-08-08 18:59:00 +0800 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2023-08-17 10:05:24 -0300 |
commit | ea8571dc997d8fd41235a9f870828a61c878f607 (patch) | |
tree | 4f170e9420e61965cf2edb401a9acdc6999ff224 /libavcodec | |
parent | ad8dc5e81420d59d39dae16f31b0d15a73ad71f9 (diff) | |
download | ffmpeg-ea8571dc997d8fd41235a9f870828a61c878f607.tar.gz |
cbs_h266: H266RawSliceHeader, expose NumEntryPoints
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/cbs_h266.h | 3 | ||||
-rw-r--r-- | 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); } |