* [FFmpeg-devel] [PATCH v2 2/8] cbs_h266: fix inference for sh_alf_enabled_flag
[not found] ` <20230808105903.6667-1-nuomi2021@gmail.com>
@ 2023-08-08 10:58 ` 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
` (5 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Nuo Mi @ 2023-08-08 10:58 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
Failed clip:
LTRP_A_ERICSSON_3.bit
---
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] 12+ messages in thread
* [FFmpeg-devel] [PATCH v2 3/8] cbs_h266: fix inference for xh_deblocking_filter_disabled_flag
[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 ` 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
` (4 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Nuo Mi @ 2023-08-08 10:58 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
Failed clips:
ENT444MAINTIER_C_Sony_3.bit
ENT444HIGHTIER_D_Sony_3.bit
---
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] 12+ messages in thread
* [FFmpeg-devel] [PATCH v2 4/8] cbs_h266: fix slice_height_in_ctus for single slice tile
[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 ` Nuo Mi
2023-08-08 10:59 ` [FFmpeg-devel] [PATCH v2 5/8] cbs_h266: H266RawSliceHeader, expose NumEntryPoints Nuo Mi
` (3 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Nuo Mi @ 2023-08-08 10:58 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Nuo Mi
Failed clips:
TILE_E_Nokia_2.bit
TILE_D_Nokia_2.bit
LMCS_A_Dolby_3.bit
---
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] 12+ messages in thread
* [FFmpeg-devel] [PATCH v2 5/8] cbs_h266: H266RawSliceHeader, expose NumEntryPoints
[not found] ` <20230808105903.6667-1-nuomi2021@gmail.com>
` (2 preceding siblings ...)
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
2023-08-08 10:59 ` [FFmpeg-devel] [PATCH v2 6/8] cbs_h266: H266RawPredWeightTable, expose num_weights_l0 and num_weights_l1 Nuo Mi
` (2 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Nuo Mi @ 2023-08-08 10:59 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] 12+ messages in thread
* [FFmpeg-devel] [PATCH v2 6/8] cbs_h266: H266RawPredWeightTable, expose num_weights_l0 and num_weights_l1
[not found] ` <20230808105903.6667-1-nuomi2021@gmail.com>
` (3 preceding siblings ...)
2023-08-08 10:59 ` [FFmpeg-devel] [PATCH v2 5/8] cbs_h266: H266RawSliceHeader, expose NumEntryPoints Nuo Mi
@ 2023-08-08 10:59 ` 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
6 siblings, 0 replies; 12+ messages in thread
From: Nuo Mi @ 2023-08-08 10:59 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Nuo Mi
---
libavcodec/cbs_h266.h | 3 ++
libavcodec/cbs_h266_syntax_template.c | 43 +++++++++++++--------------
2 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/libavcodec/cbs_h266.h b/libavcodec/cbs_h266.h
index 1d80c74feb..87a2d02cfd 100644
--- a/libavcodec/cbs_h266.h
+++ b/libavcodec/cbs_h266.h
@@ -666,6 +666,9 @@ typedef struct H266RawPredWeightTable {
int8_t luma_offset_l1[15];
int8_t delta_chroma_weight_l1[15][2];
int16_t delta_chroma_offset_l1[15][2];
+
+ uint8_t num_weights_l0; ///< NumWeightsL0
+ uint8_t num_weights_l1; ///< NumWeightsL1
} H266RawPredWeightTable;
typedef struct H266RawPictureHeader {
diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c
index d0d1ccadd2..501c066faa 100644
--- a/libavcodec/cbs_h266_syntax_template.c
+++ b/libavcodec/cbs_h266_syntax_template.c
@@ -2507,7 +2507,6 @@ static int FUNC(pred_weight_table) (CodedBitstreamContext *ctx, RWContext *rw,
H266RawPredWeightTable *current)
{
int err, i, j;
- uint8_t num_weights_l0, num_weights_l1;
ue(luma_log2_weight_denom, 0, 7);
if (sps->sps_chroma_format_idc != 0) {
se(delta_chroma_log2_weight_denom,
@@ -2516,21 +2515,21 @@ static int FUNC(pred_weight_table) (CodedBitstreamContext *ctx, RWContext *rw,
} else {
infer(delta_chroma_log2_weight_denom, 0);
}
- if (pps->pps_wp_info_in_ph_flag)
+ if (pps->pps_wp_info_in_ph_flag) {
ue(num_l0_weights, 0,
FFMIN(15, ref_lists->rpl_ref_list[0].num_ref_entries));
- else
- infer(num_l0_weights, 0);
- num_weights_l0 = pps->pps_wp_info_in_ph_flag ?
- current->num_l0_weights : num_ref_idx_active[0];
- for (i = 0; i < num_weights_l0; i++) {
+ infer(num_weights_l0, current->num_l0_weights);
+ } else {
+ infer(num_weights_l0, num_ref_idx_active[0]);
+ }
+ for (i = 0; i < current->num_weights_l0; i++) {
flags(luma_weight_l0_flag[i], 1, i);
}
if (sps->sps_chroma_format_idc != 0) {
- for (i = 0; i < num_weights_l0; i++)
+ for (i = 0; i < current->num_weights_l0; i++)
flags(chroma_weight_l0_flag[i], 1, i);
}
- for (i = 0; i < num_weights_l0; i++) {
+ for (i = 0; i < current->num_weights_l0; i++) {
if (current->luma_weight_l0_flag[i]) {
ses(delta_luma_weight_l0[i], -128, 127, 1, i);
ses(luma_offset_l0[i], -128, 127, 1, i);
@@ -2546,28 +2545,26 @@ static int FUNC(pred_weight_table) (CodedBitstreamContext *ctx, RWContext *rw,
}
}
- if (pps->pps_weighted_bipred_flag && pps->pps_wp_info_in_ph_flag &&
+ if (pps->pps_weighted_bipred_flag &&
ref_lists->rpl_ref_list[1].num_ref_entries > 0) {
- ue(num_l1_weights, 0,
- FFMIN(15, ref_lists->rpl_ref_list[1].num_ref_entries));
- }
- if (!pps->pps_weighted_bipred_flag ||
- (pps->pps_wp_info_in_ph_flag &&
- ref_lists->rpl_ref_list[1].num_ref_entries == 0)) {
- num_weights_l1 = 0;
- } else if (pps->pps_wp_info_in_ph_flag) {
- num_weights_l1 = current->num_l1_weights;
+ if (pps->pps_wp_info_in_ph_flag) {
+ ue(num_l1_weights, 0,
+ FFMIN(15, ref_lists->rpl_ref_list[1].num_ref_entries));
+ infer(num_weights_l1, current->num_l1_weights);
+ } else {
+ infer(num_weights_l1, num_ref_idx_active[1]);
+ }
} else {
- num_weights_l1 = num_ref_idx_active[1];
+ infer(num_weights_l1, 0);
}
- for (i = 0; i < num_weights_l1; i++)
+ for (i = 0; i < current->num_weights_l1; i++)
flags(luma_weight_l1_flag[i], 1, i);
if (sps->sps_chroma_format_idc != 0) {
- for (i = 0; i < num_weights_l1; i++)
+ for (i = 0; i < current->num_weights_l1; i++)
flags(chroma_weight_l1_flag[i], 1, i);
}
- for (i = 0; i < num_weights_l1; i++) {
+ for (i = 0; i < current->num_weights_l1; i++) {
if (current->luma_weight_l1_flag[i]) {
ses(delta_luma_weight_l1[i], -128, 127, 1, i);
ses(luma_offset_l1[i], -128, 127, 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] 12+ messages in thread
* [FFmpeg-devel] [PATCH v2 7/8] cbs_h266: H266RawSliceHeader, expose NumRefIdxActive[]
[not found] ` <20230808105903.6667-1-nuomi2021@gmail.com>
` (4 preceding siblings ...)
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 ` 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
6 siblings, 0 replies; 12+ messages in thread
From: Nuo Mi @ 2023-08-08 10:59 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,
¤t->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] 12+ messages in thread
* [FFmpeg-devel] [PATCH v2 8/8] cbs_h266: slice_header, fix inference for pred_weight_table
[not found] ` <20230808105903.6667-1-nuomi2021@gmail.com>
` (5 preceding siblings ...)
2023-08-08 10:59 ` [FFmpeg-devel] [PATCH v2 7/8] cbs_h266: H266RawSliceHeader, expose NumRefIdxActive[] Nuo Mi
@ 2023-08-08 10:59 ` Nuo Mi
6 siblings, 0 replies; 12+ messages in thread
From: Nuo Mi @ 2023-08-08 10:59 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,
- ¤t->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,
+ ¤t->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] 12+ messages in thread