* [FFmpeg-devel] [PATCH 2/8] cbs_h266: fix inference for sh_alf_enabled_flag
[not found] <20230807145533.17949-1-nuomi2021@gmail.com>
@ 2023-08-07 14:55 ` Nuo Mi
2023-08-07 14:55 ` [FFmpeg-devel] [PATCH 3/8] cbs_h266: fix inference for xh_deblocking_filter_disabled_flag Nuo Mi
` (2 subsequent siblings)
3 siblings, 0 replies; 4+ messages in thread
From: Nuo Mi @ 2023-08-07 14:55 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Nuo Mi
if pps_alf_info_in_ph_flag is true
sh_alf_enabled_flag infered from ph
---
libavcodec/cbs_h266_syntax_template.c | 81 ++++++++++++++++-----------
1 file changed, 47 insertions(+), 34 deletions(-)
diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c
index 857882655b..801feedb4a 100644
--- a/libavcodec/cbs_h266_syntax_template.c
+++ b/libavcodec/cbs_h266_syntax_template.c
@@ -3111,44 +3111,57 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw,
if (nal_unit_type == VVC_IDR_W_RADL || nal_unit_type == VVC_IDR_N_LP ||
nal_unit_type == VVC_CRA_NUT || nal_unit_type == VVC_GDR_NUT)
flag(sh_no_output_of_prior_pics_flag);
- if (sps->sps_alf_enabled_flag && !pps->pps_alf_info_in_ph_flag) {
- flag(sh_alf_enabled_flag);
- if (current->sh_alf_enabled_flag) {
- ub(3, sh_num_alf_aps_ids_luma);
- for (i = 0; i < current->sh_num_alf_aps_ids_luma; i++)
- ubs(3, sh_alf_aps_id_luma[i], 1, i);
- if (sps->sps_chroma_format_idc != 0) {
- flag(sh_alf_cb_enabled_flag);
- flag(sh_alf_cr_enabled_flag);
- } else {
+
+ if (sps->sps_alf_enabled_flag) {
+ if (!pps->pps_alf_info_in_ph_flag) {
+ flag(sh_alf_enabled_flag);
+ if (current->sh_alf_enabled_flag) {
+ ub(3, sh_num_alf_aps_ids_luma);
+ for (i = 0; i < current->sh_num_alf_aps_ids_luma; i++)
+ ubs(3, sh_alf_aps_id_luma[i], 1, i);
+
+ if (sps->sps_chroma_format_idc != 0) {
+ flag(sh_alf_cb_enabled_flag);
+ flag(sh_alf_cr_enabled_flag);
+ }
+ if (current->sh_alf_cb_enabled_flag ||
+ current->sh_alf_cr_enabled_flag) {
+ ub(3, sh_alf_aps_id_chroma);
+ }
+
+ if (sps->sps_ccalf_enabled_flag) {
+ flag(sh_alf_cc_cb_enabled_flag);
+ if (current->sh_alf_cc_cb_enabled_flag)
+ ub(3, sh_alf_cc_cb_aps_id);
+
+ flag(sh_alf_cc_cr_enabled_flag);
+ if (current->sh_alf_cc_cr_enabled_flag)
+ ub(3, sh_alf_cc_cr_aps_id);
+ }
+ }
+ } else {
+ infer(sh_alf_enabled_flag, ph->ph_alf_enabled_flag);
+ if (current->sh_alf_enabled_flag) {
+ infer(sh_num_alf_aps_ids_luma, ph->ph_num_alf_aps_ids_luma);
+ for (i = 0; i < current->sh_num_alf_aps_ids_luma; i++)
+ infer(sh_alf_aps_id_luma[i], ph->ph_alf_aps_id_luma[i]);
+
infer(sh_alf_cb_enabled_flag, ph->ph_alf_cb_enabled_flag);
infer(sh_alf_cr_enabled_flag, ph->ph_alf_cr_enabled_flag);
- }
- if (current->sh_alf_cb_enabled_flag ||
- current->sh_alf_cr_enabled_flag)
- ub(3, sh_alf_aps_id_chroma);
- else
- infer(sh_alf_aps_id_chroma, ph->ph_alf_aps_id_chroma);
- if (sps->sps_ccalf_enabled_flag) {
- flag(sh_alf_cc_cb_enabled_flag);
- if (current->sh_alf_cc_cb_enabled_flag)
- ub(3, sh_alf_cc_cb_aps_id);
- else
- infer(sh_alf_cc_cb_aps_id, ph->ph_alf_cc_cb_aps_id);
- flag(sh_alf_cc_cr_enabled_flag);
- if (current->sh_alf_cc_cr_enabled_flag)
- ub(3, sh_alf_cc_cr_aps_id);
- else
- infer(sh_alf_cc_cr_aps_id, ph->ph_alf_cc_cr_aps_id);
- } else {
- infer(sh_alf_cc_cb_enabled_flag, ph->ph_alf_cc_cb_enabled_flag);
- infer(sh_alf_cc_cr_enabled_flag, ph->ph_alf_cc_cr_enabled_flag);
- infer(sh_alf_cc_cb_aps_id, ph->ph_alf_cc_cb_aps_id);
- infer(sh_alf_cc_cr_aps_id, ph->ph_alf_cc_cr_aps_id);
+ if (current->sh_alf_cb_enabled_flag ||current->sh_alf_cr_enabled_flag)
+ infer(sh_alf_aps_id_chroma, ph->ph_alf_aps_id_chroma);
+
+ if (sps->sps_ccalf_enabled_flag) {
+ infer(sh_alf_cc_cb_enabled_flag, ph->ph_alf_cc_cb_enabled_flag);
+ if (current->sh_alf_cc_cb_enabled_flag)
+ infer(sh_alf_cc_cb_aps_id, ph->ph_alf_cc_cb_aps_id);
+
+ infer(sh_alf_cc_cr_enabled_flag, ph->ph_alf_cc_cr_enabled_flag);
+ if (current->sh_alf_cc_cr_enabled_flag)
+ infer(sh_alf_cc_cr_aps_id, ph->ph_alf_cc_cr_aps_id);
+ }
}
}
- } else {
- infer(sh_alf_enabled_flag, 0);
}
if (current->sh_picture_header_in_slice_header_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] 4+ messages in thread
* [FFmpeg-devel] [PATCH 3/8] cbs_h266: fix inference for xh_deblocking_filter_disabled_flag
[not found] <20230807145533.17949-1-nuomi2021@gmail.com>
2023-08-07 14:55 ` [FFmpeg-devel] [PATCH 2/8] cbs_h266: fix inference for sh_alf_enabled_flag Nuo Mi
@ 2023-08-07 14:55 ` Nuo Mi
2023-08-07 14:55 ` [FFmpeg-devel] [PATCH 4/8] cbs_h266: fix slice_height_in_ctus for single slice tile Nuo Mi
2023-08-07 14:55 ` [FFmpeg-devel] [PATCH 5/8] cbs_h266: H266RawSliceHeader, expose NumEntryPoints Nuo Mi
3 siblings, 0 replies; 4+ messages in thread
From: Nuo Mi @ 2023-08-07 14:55 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Nuo Mi
if !ph_deblocking_params_present_flag is true, ph_deblocking_filter_disabled_flag infered from pps
if !sh_deblocking_params_present_flag is true, sh_deblocking_filter_disabled_flag infered from ph
---
libavcodec/cbs_h266_syntax_template.c | 76 ++++++++++-----------------
1 file changed, 28 insertions(+), 48 deletions(-)
diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c
index 801feedb4a..7277154c40 100644
--- a/libavcodec/cbs_h266_syntax_template.c
+++ b/libavcodec/cbs_h266_syntax_template.c
@@ -2938,20 +2938,14 @@ static int FUNC(picture_header) (CodedBitstreamContext *ctx, RWContext *rw,
infer(ph_sao_chroma_enabled_flag, 0);
}
- if (pps->pps_dbf_info_in_ph_flag) {
+ if (pps->pps_dbf_info_in_ph_flag)
flag(ph_deblocking_params_present_flag);
- if (current->ph_deblocking_params_present_flag) {
- if (!pps->pps_deblocking_filter_disabled_flag) {
- flag(ph_deblocking_filter_disabled_flag);
- } else {
- if (pps->pps_deblocking_filter_disabled_flag &&
- current->ph_deblocking_params_present_flag) {
- infer(ph_deblocking_filter_disabled_flag, 0);
- } else {
- infer(ph_deblocking_filter_disabled_flag,
- pps->pps_deblocking_filter_disabled_flag);
- }
- }
+ else
+ infer(ph_deblocking_params_present_flag, 0);
+
+ if (current->ph_deblocking_params_present_flag) {
+ if (!pps->pps_deblocking_filter_disabled_flag) {
+ flag(ph_deblocking_filter_disabled_flag);
if (!current->ph_deblocking_filter_disabled_flag) {
se(ph_luma_beta_offset_div2, -12, 12);
se(ph_luma_tc_offset_div2, -12, 12);
@@ -2970,25 +2964,19 @@ static int FUNC(picture_header) (CodedBitstreamContext *ctx, RWContext *rw,
infer(ph_cr_tc_offset_div2,
current->ph_luma_tc_offset_div2);
}
- } else {
- infer(ph_luma_beta_offset_div2, pps->pps_luma_beta_offset_div2);
- infer(ph_luma_tc_offset_div2, pps->pps_luma_tc_offset_div2);
- if (pps->pps_chroma_tool_offsets_present_flag) {
- infer(ph_cb_beta_offset_div2, pps->pps_cb_beta_offset_div2);
- infer(ph_cb_tc_offset_div2, pps->pps_cb_tc_offset_div2);
- infer(ph_cr_beta_offset_div2, pps->pps_cr_beta_offset_div2);
- infer(ph_cr_tc_offset_div2, pps->pps_cr_tc_offset_div2);
- } else {
- infer(ph_cb_beta_offset_div2,
- current->ph_luma_beta_offset_div2);
- infer(ph_cb_tc_offset_div2,
- current->ph_luma_tc_offset_div2);
- infer(ph_cr_beta_offset_div2,
- current->ph_luma_beta_offset_div2);
- infer(ph_cr_tc_offset_div2,
- current->ph_luma_tc_offset_div2);
- }
}
+ } else {
+ infer(ph_deblocking_filter_disabled_flag, 0);
+ }
+ } else {
+ infer(ph_deblocking_filter_disabled_flag, pps->pps_deblocking_filter_disabled_flag);
+ if (!current->ph_deblocking_filter_disabled_flag) {
+ infer(ph_luma_beta_offset_div2, pps->pps_luma_beta_offset_div2);
+ infer(ph_luma_tc_offset_div2, pps->pps_luma_tc_offset_div2);
+ infer(ph_cb_beta_offset_div2, pps->pps_cb_beta_offset_div2);
+ infer(ph_cb_tc_offset_div2, pps->pps_cb_tc_offset_div2);
+ infer(ph_cr_beta_offset_div2, pps->pps_cr_beta_offset_div2);
+ infer(ph_cr_tc_offset_div2, pps->pps_cr_tc_offset_div2);
}
}
@@ -3321,9 +3309,7 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw,
if (!pps->pps_deblocking_filter_disabled_flag)
flag(sh_deblocking_filter_disabled_flag);
else
- infer(sh_deblocking_filter_disabled_flag,
- !(pps->pps_deblocking_filter_disabled_flag &&
- current->sh_deblocking_params_present_flag));
+ infer(sh_deblocking_filter_disabled_flag, 0);
if (!current->sh_deblocking_filter_disabled_flag) {
se(sh_luma_beta_offset_div2, -12, 12);
se(sh_luma_tc_offset_div2, -12, 12);
@@ -3340,22 +3326,16 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw,
current->sh_luma_beta_offset_div2);
infer(sh_cr_tc_offset_div2, current->sh_luma_tc_offset_div2);
}
- } else {
+ }
+ } else {
+ infer(sh_deblocking_filter_disabled_flag, ph->ph_deblocking_filter_disabled_flag);
+ if (!current->sh_deblocking_filter_disabled_flag) {
infer(sh_luma_beta_offset_div2, ph->ph_luma_beta_offset_div2);
infer(sh_luma_tc_offset_div2, ph->ph_luma_tc_offset_div2);
- if (pps->pps_chroma_tool_offsets_present_flag) {
- infer(sh_cb_beta_offset_div2, ph->ph_cb_beta_offset_div2);
- infer(sh_cb_tc_offset_div2, ph->ph_cb_tc_offset_div2);
- infer(sh_cr_beta_offset_div2, ph->ph_cr_beta_offset_div2);
- infer(sh_cr_tc_offset_div2, ph->ph_cr_beta_offset_div2);
- } else {
- infer(sh_cb_beta_offset_div2,
- current->sh_luma_beta_offset_div2);
- infer(sh_cb_tc_offset_div2, current->sh_luma_tc_offset_div2);
- infer(sh_cr_beta_offset_div2,
- current->sh_luma_beta_offset_div2);
- infer(sh_cr_tc_offset_div2, current->sh_luma_tc_offset_div2);
- }
+ infer(sh_cb_beta_offset_div2, ph->ph_cb_beta_offset_div2);
+ infer(sh_cb_tc_offset_div2, ph->ph_cb_tc_offset_div2);
+ infer(sh_cr_beta_offset_div2, ph->ph_cr_beta_offset_div2);
+ infer(sh_cr_tc_offset_div2, ph->ph_cr_tc_offset_div2);
}
}
--
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] 4+ messages in thread
* [FFmpeg-devel] [PATCH 4/8] cbs_h266: fix slice_height_in_ctus for single slice tile
[not found] <20230807145533.17949-1-nuomi2021@gmail.com>
2023-08-07 14:55 ` [FFmpeg-devel] [PATCH 2/8] cbs_h266: fix inference for sh_alf_enabled_flag Nuo Mi
2023-08-07 14:55 ` [FFmpeg-devel] [PATCH 3/8] cbs_h266: fix inference for xh_deblocking_filter_disabled_flag Nuo Mi
@ 2023-08-07 14:55 ` Nuo Mi
2023-08-07 14:55 ` [FFmpeg-devel] [PATCH 5/8] cbs_h266: H266RawSliceHeader, expose NumEntryPoints Nuo Mi
3 siblings, 0 replies; 4+ messages in thread
From: Nuo Mi @ 2023-08-07 14:55 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Nuo Mi
---
libavcodec/cbs_h266_syntax_template.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c
index 7277154c40..43b3346359 100644
--- a/libavcodec/cbs_h266_syntax_template.c
+++ b/libavcodec/cbs_h266_syntax_template.c
@@ -1984,6 +1984,7 @@ static int FUNC(pps) (CodedBitstreamContext *ctx, RWContext *rw,
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->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;
} else {
--
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] 4+ messages in thread
* [FFmpeg-devel] [PATCH 5/8] cbs_h266: H266RawSliceHeader, expose NumEntryPoints
[not found] <20230807145533.17949-1-nuomi2021@gmail.com>
` (2 preceding siblings ...)
2023-08-07 14:55 ` [FFmpeg-devel] [PATCH 4/8] cbs_h266: fix slice_height_in_ctus for single slice tile Nuo Mi
@ 2023-08-07 14:55 ` Nuo Mi
3 siblings, 0 replies; 4+ messages in thread
From: Nuo Mi @ 2023-08-07 14:55 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Nuo Mi
---
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".
^ permalink raw reply [flat|nested] 4+ messages in thread