* [FFmpeg-devel] [PATCH v2 01/13] lavc/hevc_ps: remove profile limitation of pps_range_extensions()
@ 2022-12-05 6:09 Fei Wang
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 02/13] lavc/avcodec: Add HEVC Screen Content Coding Extensions profile Fei Wang
` (12 more replies)
0 siblings, 13 replies; 19+ messages in thread
From: Fei Wang @ 2022-12-05 6:09 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Fei Wang
Follow spec 7.3.2.3.1.
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
---
update:
1. fix uninitialized variable which may cause segment fault.
libavcodec/hevc_ps.c | 2 +-
tests/ref/fate/hevc-conformance-PS_A_VIDYO_3 | 50 ++++++++++----------
2 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index 5fe62ec35b..537a3ff99b 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -1658,7 +1658,7 @@ int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx,
if (get_bits1(gb)) { // pps_extension_present_flag
pps->pps_range_extensions_flag = get_bits1(gb);
skip_bits(gb, 7); // pps_extension_7bits
- if (sps->ptl.general_ptl.profile_idc == FF_PROFILE_HEVC_REXT && pps->pps_range_extensions_flag) {
+ if (pps->pps_range_extensions_flag) {
if ((ret = pps_range_extensions(gb, avctx, pps, sps)) < 0)
goto err;
}
diff --git a/tests/ref/fate/hevc-conformance-PS_A_VIDYO_3 b/tests/ref/fate/hevc-conformance-PS_A_VIDYO_3
index 59b82b72bb..d1d86b2dc9 100644
--- a/tests/ref/fate/hevc-conformance-PS_A_VIDYO_3
+++ b/tests/ref/fate/hevc-conformance-PS_A_VIDYO_3
@@ -3,28 +3,28 @@
#codec_id 0: rawvideo
#dimensions 0: 416x240
#sar 0: 0/1
-0, 0, 0, 1, 149760, 0x88619f80
-0, 1, 1, 1, 149760, 0x550bdaf0
-0, 2, 2, 1, 149760, 0x4121f7a2
-0, 3, 3, 1, 149760, 0x210b1d07
-0, 4, 4, 1, 149760, 0x731b7758
-0, 5, 5, 1, 149760, 0x17adb789
-0, 6, 6, 1, 149760, 0x98b2f080
-0, 7, 7, 1, 149760, 0xc0be1f2a
-0, 8, 8, 1, 149760, 0xc01e387a
-0, 9, 9, 1, 149760, 0xd932822b
-0, 10, 10, 1, 149760, 0x16c0a1df
-0, 11, 11, 1, 149760, 0x5aa6c005
-0, 12, 12, 1, 149760, 0xd3aab602
-0, 13, 13, 1, 149760, 0x4e6ecab1
-0, 14, 14, 1, 149760, 0x8a86f1f2
-0, 15, 15, 1, 149760, 0x2ed21e1b
-0, 16, 16, 1, 149760, 0x80892f24
-0, 17, 17, 1, 149760, 0xb8a952ef
-0, 18, 18, 1, 149760, 0x557e57fb
-0, 19, 19, 1, 149760, 0x2b825b2c
-0, 20, 20, 1, 149760, 0x30b69b5e
-0, 21, 21, 1, 149760, 0x802ebf08
-0, 22, 22, 1, 149760, 0x95aadc8e
-0, 23, 23, 1, 149760, 0x4d4c02b7
-0, 24, 24, 1, 149760, 0x3fdd1762
+0, 0, 0, 1, 149760, 0x5c4f70f4
+0, 1, 1, 1, 149760, 0xf4628e59
+0, 2, 2, 1, 149760, 0xa28e5bdc
+0, 3, 3, 1, 149760, 0xda0e53d7
+0, 4, 4, 1, 149760, 0x42dd334a
+0, 5, 5, 1, 149760, 0x25ba9dfe
+0, 6, 6, 1, 149760, 0x8854d8ca
+0, 7, 7, 1, 149760, 0xc04505d4
+0, 8, 8, 1, 149760, 0xd3fce146
+0, 9, 9, 1, 149760, 0x8bfd88bd
+0, 10, 10, 1, 149760, 0x33d965b2
+0, 11, 11, 1, 149760, 0x12746b7a
+0, 12, 12, 1, 149760, 0xb7642694
+0, 13, 13, 1, 149760, 0x32b5035f
+0, 14, 14, 1, 149760, 0x7bea0af1
+0, 15, 15, 1, 149760, 0x577d4fc8
+0, 16, 16, 1, 149760, 0x023a9c66
+0, 17, 17, 1, 149760, 0x9abe76c4
+0, 18, 18, 1, 149760, 0x2b14dba5
+0, 19, 19, 1, 149760, 0x7b8affcf
+0, 20, 20, 1, 149760, 0x21e4c323
+0, 21, 21, 1, 149760, 0xf0b7d9cd
+0, 22, 22, 1, 149760, 0x4db0c5bc
+0, 23, 23, 1, 149760, 0xf455f752
+0, 24, 24, 1, 149760, 0x569fec99
--
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] 19+ messages in thread
* [FFmpeg-devel] [PATCH v2 02/13] lavc/avcodec: Add HEVC Screen Content Coding Extensions profile
2022-12-05 6:09 [FFmpeg-devel] [PATCH v2 01/13] lavc/hevc_ps: remove profile limitation of pps_range_extensions() Fei Wang
@ 2022-12-05 6:09 ` Fei Wang
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 03/13] lavc/hevc_ps: Add SPS/PPS parse support for HEVC extension syntax Fei Wang
` (11 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Fei Wang @ 2022-12-05 6:09 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Linjie Fu, Fei Wang, Linjie Fu
From: Linjie Fu <linjie.fu@intel.com>
Described in HEVC spec A.3.7.
Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
---
libavcodec/avcodec.h | 1 +
libavcodec/hevc_ps.c | 2 ++
libavcodec/profiles.c | 1 +
3 files changed, 4 insertions(+)
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 3edd8e2636..79fad674df 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1639,6 +1639,7 @@ typedef struct AVCodecContext {
#define FF_PROFILE_HEVC_MAIN_10 2
#define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3
#define FF_PROFILE_HEVC_REXT 4
+#define FF_PROFILE_HEVC_SCC 9
#define FF_PROFILE_VVC_MAIN_10 1
#define FF_PROFILE_VVC_MAIN_10_444 33
diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index 537a3ff99b..ad92b6bcbc 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -259,6 +259,8 @@ static int decode_profile_tier_level(GetBitContext *gb, AVCodecContext *avctx,
av_log(avctx, AV_LOG_DEBUG, "Main Still Picture profile bitstream\n");
else if (ptl->profile_idc == FF_PROFILE_HEVC_REXT)
av_log(avctx, AV_LOG_DEBUG, "Range Extension profile bitstream\n");
+ else if (ptl->profile_idc == FF_PROFILE_HEVC_SCC)
+ av_log(avctx, AV_LOG_DEBUG, "Screen Content Coding Extension profile bitstream\n");
else
av_log(avctx, AV_LOG_WARNING, "Unknown HEVC profile: %d\n", ptl->profile_idc);
diff --git a/libavcodec/profiles.c b/libavcodec/profiles.c
index 7af7fbeb13..2230fc5415 100644
--- a/libavcodec/profiles.c
+++ b/libavcodec/profiles.c
@@ -85,6 +85,7 @@ const AVProfile ff_hevc_profiles[] = {
{ FF_PROFILE_HEVC_MAIN_10, "Main 10" },
{ FF_PROFILE_HEVC_MAIN_STILL_PICTURE, "Main Still Picture" },
{ FF_PROFILE_HEVC_REXT, "Rext" },
+ { FF_PROFILE_HEVC_SCC, "Scc" },
{ FF_PROFILE_UNKNOWN },
};
--
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] 19+ messages in thread
* [FFmpeg-devel] [PATCH v2 03/13] lavc/hevc_ps: Add SPS/PPS parse support for HEVC extension syntax
2022-12-05 6:09 [FFmpeg-devel] [PATCH v2 01/13] lavc/hevc_ps: remove profile limitation of pps_range_extensions() Fei Wang
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 02/13] lavc/avcodec: Add HEVC Screen Content Coding Extensions profile Fei Wang
@ 2022-12-05 6:09 ` Fei Wang
2023-01-03 6:20 ` Xiang, Haihao
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 04/13] lavc/hevcdec: Add slice parse support for HEVC SCC extension Fei Wang
` (10 subsequent siblings)
12 siblings, 1 reply; 19+ messages in thread
From: Fei Wang @ 2022-12-05 6:09 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Haihao Xiang, Linjie Fu, Fei Wang, Linjie Fu
From: Linjie Fu <linjie.fu@intel.com>
1. Add extension syntax according to 7.3.2.2.3/7.3.2.3.3 in T-REC-H.265-201911.
2. Keep using parsed PPS when bitstream overread for compatibility. For
example, the clip PS_A_VIDYO_3.bit in FATE test has incomplete extension
syntax which will be overread and un-decodable if without this change.
3. Format brace in pps_range_extensions().
Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
---
libavcodec/hevc.h | 3 +
libavcodec/hevc_ps.c | 288 +++++++++++++++++++++++++++++++++++++++++--
libavcodec/hevc_ps.h | 69 +++++++++++
3 files changed, 349 insertions(+), 11 deletions(-)
diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h
index 1804755327..6b454a75c1 100644
--- a/libavcodec/hevc.h
+++ b/libavcodec/hevc.h
@@ -154,6 +154,9 @@ enum {
// get near that, though, so set a lower limit here with the maximum
// possible value for 4K video (at most 135 16x16 Ctb rows).
HEVC_MAX_ENTRY_POINT_OFFSETS = HEVC_MAX_TILE_COLUMNS * 135,
+
+ // A.3.7: Screen content coding extensions
+ HEVC_MAX_PALETTE_PREDICTOR_SIZE = 128,
};
diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index ad92b6bcbc..3181962918 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -853,7 +853,7 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
HEVCWindow *ow;
int ret = 0;
int log2_diff_max_min_transform_block_size;
- int bit_depth_chroma, start, vui_present, sublayer_ordering_info;
+ int bit_depth_chroma, start, vui_present, sublayer_ordering_info, num_comps;
int i;
// Coded parameters
@@ -1074,8 +1074,12 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
decode_vui(gb, avctx, apply_defdispwin, sps);
if (get_bits1(gb)) { // sps_extension_flag
- sps->sps_range_extension_flag = get_bits1(gb);
- skip_bits(gb, 7); //sps_extension_7bits = get_bits(gb, 7);
+ sps->sps_range_extension_flag = get_bits1(gb);
+ sps->sps_multilayer_extension_flag = get_bits1(gb);
+ sps->sps_3d_extension_flag = get_bits1(gb);
+ sps->sps_scc_extension_flag = get_bits1(gb);
+ skip_bits(gb, 4); // sps_extension_4bits
+
if (sps->sps_range_extension_flag) {
sps->transform_skip_rotation_enabled_flag = get_bits1(gb);
sps->transform_skip_context_enabled_flag = get_bits1(gb);
@@ -1101,6 +1105,57 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
av_log(avctx, AV_LOG_WARNING,
"cabac_bypass_alignment_enabled_flag not yet implemented\n");
}
+
+ if (sps->sps_multilayer_extension_flag) {
+ skip_bits1(gb); // inter_view_mv_vert_constraint_flag
+ av_log(avctx, AV_LOG_WARNING,
+ "sps_multilayer_extension_flag not yet implemented\n");
+ }
+
+ if (sps->sps_3d_extension_flag) {
+ for (i = 0; i <= 1; i++) {
+ skip_bits1(gb); // iv_di_mc_enabled_flag
+ skip_bits1(gb); // iv_mv_scal_enabled_flag
+ if (i == 0) {
+ get_ue_golomb_long(gb); // log2_ivmc_sub_pb_size_minus3
+ skip_bits1(gb); // iv_res_pred_enabled_flag
+ skip_bits1(gb); // depth_ref_enabled_flag
+ skip_bits1(gb); // vsp_mc_enabled_flag
+ skip_bits1(gb); // dbbp_enabled_flag
+ } else {
+ skip_bits1(gb); // tex_mc_enabled_flag
+ get_ue_golomb_long(gb); // log2_ivmc_sub_pb_size_minus3
+ skip_bits1(gb); // intra_contour_enabled_flag
+ skip_bits1(gb); // intra_dc_only_wedge_enabled_flag
+ skip_bits1(gb); // cqt_cu_part_pred_enabled_flag
+ skip_bits1(gb); // inter_dc_only_enabled_flag
+ skip_bits1(gb); // skip_intra_enabled_flag
+ }
+ }
+ av_log(avctx, AV_LOG_WARNING,
+ "sps_3d_extension_flag not yet implemented\n");
+ }
+
+ if (sps->sps_scc_extension_flag) {
+ sps->sps_curr_pic_ref_enabled_flag = get_bits1(gb);
+ sps->palette_mode_enabled_flag = get_bits1(gb);
+ if (sps->palette_mode_enabled_flag) {
+ sps->palette_max_size = get_ue_golomb_long(gb);
+ sps->delta_palette_max_predictor_size = get_ue_golomb_long(gb);
+ sps->sps_palette_predictor_initializers_present_flag = get_bits1(gb);
+
+ if (sps->sps_palette_predictor_initializers_present_flag) {
+ sps->sps_num_palette_predictor_initializers_minus1 = get_ue_golomb_long(gb);
+ num_comps = !sps->chroma_format_idc ? 1 : 3;
+ for (int comp = 0; comp < num_comps; comp++)
+ for (i = 0; i <= sps->sps_num_palette_predictor_initializers_minus1; i++)
+ sps->sps_palette_predictor_initializer[comp][i] =
+ get_bits(gb, !comp ? sps->bit_depth : sps->bit_depth_chroma);
+ }
+ }
+ sps->motion_vector_resolution_control_idc = get_bits(gb, 2);
+ sps->intra_boundary_filtering_disabled_flag = get_bits1(gb);
+ }
}
if (apply_defdispwin) {
sps->output_window.left_offset += sps->vui.def_disp_win.left_offset;
@@ -1265,10 +1320,162 @@ static void hevc_pps_free(void *opaque, uint8_t *data)
av_freep(&pps);
}
-static int pps_range_extensions(GetBitContext *gb, AVCodecContext *avctx,
- HEVCPPS *pps, HEVCSPS *sps) {
- int i;
+static void colour_mapping_octants(GetBitContext *gb, HEVCPPS *pps, int inp_depth,
+ int idx_y, int idx_cb, int idx_cr, int inp_length)
+{
+ unsigned int split_octant_flag, part_num_y, coded_res_flag, res_coeff_q, res_coeff_r;
+ int bit_depth_cm_input_y, bit_depth_cm_output_y, cm_res_bits;
+
+ part_num_y = 1 << pps->cm_y_part_num_log2;
+
+ split_octant_flag = inp_depth < pps->cm_octant_depth ? get_bits1(gb) : 0;
+
+ if (split_octant_flag)
+ for (int k = 0; k < 2; k++)
+ for (int m = 0; m < 2; m++)
+ for (int n = 0; n < 2; n++)
+ colour_mapping_octants(gb, pps, inp_depth + 1,
+ idx_y + part_num_y * k * inp_length / 2,
+ idx_cb + m * inp_length / 2,
+ idx_cr + n * inp_length / 2,
+ inp_length / 2);
+ else
+ for (int i = 0; i < part_num_y; i++) {
+ for (int j = 0; j < 4; j++) {
+ coded_res_flag = get_bits1(gb);
+ if (coded_res_flag)
+ for (int c = 0; c < 3; c++) {
+ res_coeff_q = get_ue_golomb_long(gb);
+ bit_depth_cm_input_y = 8 + pps->luma_bit_depth_cm_input_minus8;
+ bit_depth_cm_output_y = 8 + pps->luma_bit_depth_cm_output_minus8;
+ cm_res_bits = FFMAX(0, 10 + bit_depth_cm_input_y - bit_depth_cm_output_y -
+ pps->cm_res_quant_bits - (pps->cm_delta_flc_bits_minus1 + 1));
+ res_coeff_r = cm_res_bits ? get_bits(gb, cm_res_bits) : 0;
+ if (res_coeff_q || res_coeff_r)
+ skip_bits1(gb);
+ }
+ }
+ }
+}
+static void colour_mapping_table(GetBitContext *gb, HEVCPPS *pps)
+{
+ pps->num_cm_ref_layers_minus1 = get_ue_golomb_long(gb);
+ for (int i = 0; i <= pps->num_cm_ref_layers_minus1; i++)
+ pps->cm_ref_layer_id[i] = get_bits(gb, 6);
+
+ pps->cm_octant_depth = get_bits(gb, 2);
+ pps->cm_y_part_num_log2 = get_bits(gb, 2);
+
+ pps->luma_bit_depth_cm_input_minus8 = get_ue_golomb_long(gb);
+ pps->chroma_bit_depth_cm_input_minus8 = get_ue_golomb_long(gb);
+ pps->luma_bit_depth_cm_output_minus8 = get_ue_golomb_long(gb);
+ pps->chroma_bit_depth_cm_output_minus8 = get_ue_golomb_long(gb);
+
+ pps->cm_res_quant_bits = get_bits(gb, 2);
+ pps->cm_delta_flc_bits_minus1 = get_bits(gb, 2);
+
+ if (pps->cm_octant_depth == 1) {
+ pps->cm_adapt_threshold_u_delta = get_se_golomb_long(gb);
+ pps->cm_adapt_threshold_v_delta = get_se_golomb_long(gb);
+ }
+
+ colour_mapping_octants(gb, pps, 0, 0, 0, 0, 1 << pps->cm_octant_depth);
+}
+
+static int pps_multilayer_extension(GetBitContext *gb, AVCodecContext *avctx,
+ HEVCPPS *pps, HEVCSPS *sps)
+{
+ pps->poc_reset_info_present_flag = get_bits1(gb);
+ pps->pps_infer_scaling_list_flag = get_bits1(gb);
+ if (pps->pps_infer_scaling_list_flag)
+ pps->pps_scaling_list_ref_layer_id = get_bits(gb, 6);
+
+ pps->num_ref_loc_offsets = get_ue_golomb_long(gb);
+ for (int i = 0; i < pps->num_ref_loc_offsets; i++) {
+ pps->ref_loc_offset_layer_id[i] = get_bits(gb, 6);
+ pps->scaled_ref_layer_offset_present_flag[i] = get_bits1(gb);
+ if (pps->scaled_ref_layer_offset_present_flag[i]) {
+ pps->scaled_ref_layer_left_offset[pps->ref_loc_offset_layer_id[i]] = get_se_golomb_long(gb);
+ pps->scaled_ref_layer_top_offset[pps->ref_loc_offset_layer_id[i]] = get_se_golomb_long(gb);
+ pps->scaled_ref_layer_right_offset[pps->ref_loc_offset_layer_id[i]] = get_se_golomb_long(gb);
+ pps->scaled_ref_layer_bottom_offset[pps->ref_loc_offset_layer_id[i]] = get_se_golomb_long(gb);
+ }
+
+ pps->ref_region_offset_present_flag[i] = get_bits1(gb);
+ if (pps->ref_region_offset_present_flag[i]) {
+ pps->ref_region_left_offset[pps->ref_loc_offset_layer_id[i]] = get_se_golomb_long(gb);
+ pps->ref_region_top_offset[pps->ref_loc_offset_layer_id[i]] = get_se_golomb_long(gb);
+ pps->ref_region_right_offset[pps->ref_loc_offset_layer_id[i]] = get_se_golomb_long(gb);
+ pps->ref_region_bottom_offset[pps->ref_loc_offset_layer_id[i]] = get_se_golomb_long(gb);
+ }
+
+ pps->resample_phase_set_present_flag[i] = get_bits1(gb);
+ if (pps->resample_phase_set_present_flag[i]) {
+ pps->phase_hor_luma[pps->ref_loc_offset_layer_id[i]] = get_ue_golomb_long(gb);
+ pps->phase_ver_luma[pps->ref_loc_offset_layer_id[i]] = get_ue_golomb_long(gb);
+ pps->phase_hor_chroma_plus8[pps->ref_loc_offset_layer_id[i]] = get_ue_golomb_long(gb);
+ pps->phase_ver_chroma_plus8[pps->ref_loc_offset_layer_id[i]] = get_ue_golomb_long(gb);
+ }
+ }
+
+ pps->colour_mapping_enabled_flag = get_bits1(gb);
+ if (pps->colour_mapping_enabled_flag)
+ colour_mapping_table(gb, pps);
+
+ return 0;
+}
+
+static void delta_dlt(GetBitContext *gb, HEVCPPS *pps)
+{
+ unsigned int num_val_delta_dlt, max_diff = 0;
+ int min_diff_minus1 = -1;
+ unsigned int len;
+
+ num_val_delta_dlt = get_bits(gb, pps->pps_bit_depth_for_depth_layers_minus8 + 8);
+ if (num_val_delta_dlt) {
+ if (num_val_delta_dlt > 1)
+ max_diff = get_bits(gb, pps->pps_bit_depth_for_depth_layers_minus8 + 8);
+ if (num_val_delta_dlt > 2 && max_diff) {
+ len = av_log2(max_diff) + 1;
+ min_diff_minus1 = get_bits(gb, len);
+ }
+ if (max_diff > (min_diff_minus1 + 1))
+ for (int k = 1; k < num_val_delta_dlt; k++) {
+ len = av_log2(max_diff - (min_diff_minus1 + 1)) + 1;
+ skip_bits(gb, len); // delta_val_diff_minus_min
+ }
+ }
+}
+
+static int pps_3d_extension(GetBitContext *gb, AVCodecContext *avctx,
+ HEVCPPS *pps, HEVCSPS *sps)
+{
+ unsigned int pps_depth_layers_minus1;
+ int i, j;
+
+ if (get_bits1(gb)) { // dlts_present_flag
+ pps_depth_layers_minus1 = get_bits(gb, 6);
+ pps->pps_bit_depth_for_depth_layers_minus8 = get_bits(gb, 4);
+ for (i = 0; i <= pps_depth_layers_minus1; i++) {
+ if (get_bits1(gb)) { // dlt_flag[i]
+ if (!get_bits1(gb)) { // dlt_pred_flag[i]
+ if (get_bits1(gb)) { // dlt_val_flags_present_flag[i]
+ for (j = 0; j <= ((1 << (pps->pps_bit_depth_for_depth_layers_minus8 + 8)) - 1); j++)
+ skip_bits1(gb); // dlt_value_flag[i][j]
+ } else
+ delta_dlt(gb, pps);
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+static int pps_range_extensions(GetBitContext *gb, AVCodecContext *avctx,
+ HEVCPPS *pps, HEVCSPS *sps)
+{
if (pps->transform_skip_enabled_flag) {
pps->log2_max_transform_skip_block_size = get_ue_golomb_long(gb) + 2;
}
@@ -1282,7 +1489,7 @@ static int pps_range_extensions(GetBitContext *gb, AVCodecContext *avctx,
"chroma_qp_offset_list_len_minus1 shall be in the range [0, 5].\n");
return AVERROR_INVALIDDATA;
}
- for (i = 0; i <= pps->chroma_qp_offset_list_len_minus1; i++) {
+ for (int i = 0; i <= pps->chroma_qp_offset_list_len_minus1; i++) {
pps->cb_qp_offset_list[i] = get_se_golomb_long(gb);
if (pps->cb_qp_offset_list[i]) {
av_log(avctx, AV_LOG_WARNING,
@@ -1306,6 +1513,47 @@ static int pps_range_extensions(GetBitContext *gb, AVCodecContext *avctx,
return(0);
}
+static int pps_scc_extension(GetBitContext *gb, AVCodecContext *avctx,
+ HEVCPPS *pps, HEVCSPS *sps)
+{
+ int num_comps, ret;
+
+ pps->pps_curr_pic_ref_enabled_flag = get_bits1(gb);
+ if (pps->residual_adaptive_colour_transform_enabled_flag = get_bits1(gb)) {
+ pps->pps_slice_act_qp_offsets_present_flag = get_bits1(gb);
+ pps->pps_act_y_qp_offset = get_se_golomb_long(gb) - 5;
+ pps->pps_act_cb_qp_offset = get_se_golomb_long(gb) - 5;
+ pps->pps_act_cr_qp_offset = get_se_golomb_long(gb) - 3;
+
+#define CHECK_QP_OFFSET(name) (pps->pps_act_ ## name ## _qp_offset <= -12 || \
+ pps->pps_act_ ## name ## _qp_offset >= 12)
+ ret = CHECK_QP_OFFSET(y) || CHECK_QP_OFFSET(cb) || CHECK_QP_OFFSET(cr);
+#undef CHECK_QP_OFFSET
+ if (ret) {
+ av_log(avctx, AV_LOG_ERROR,
+ "PpsActQpOffsetY/Cb/Cr shall be in the range of [-12, 12].\n");
+ return AVERROR_INVALIDDATA;
+ }
+ }
+
+ if (pps->pps_palette_predictor_initializers_present_flag = get_bits1(gb)) {
+ if ((pps->pps_num_palette_predictor_initializers = get_ue_golomb_long(gb)) > 0) {
+ pps->monochrome_palette_flag = get_bits1(gb);
+ pps->luma_bit_depth_entry_minus8 = get_ue_golomb_long(gb);
+ if (!pps->monochrome_palette_flag)
+ pps->chroma_bit_depth_entry_minus8 = get_ue_golomb_long(gb);
+ num_comps = pps->monochrome_palette_flag ? 1 : 3;
+ for (int comp = 0; comp < num_comps; comp++)
+ for (int i = 0; i < pps->pps_num_palette_predictor_initializers; i++)
+ pps->pps_palette_predictor_initializer[comp][i] =
+ get_bits(gb, 8 + (!comp ? pps->luma_bit_depth_entry_minus8 :
+ pps->chroma_bit_depth_entry_minus8));
+ }
+ }
+
+ return 0;
+}
+
static inline int setup_pps(AVCodecContext *avctx, GetBitContext *gb,
HEVCPPS *pps, HEVCSPS *sps)
{
@@ -1658,12 +1906,31 @@ int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx,
pps->slice_header_extension_present_flag = get_bits1(gb);
if (get_bits1(gb)) { // pps_extension_present_flag
- pps->pps_range_extensions_flag = get_bits1(gb);
- skip_bits(gb, 7); // pps_extension_7bits
+ pps->pps_range_extensions_flag = get_bits1(gb);
+ pps->pps_multilayer_extension_flag = get_bits1(gb);
+ pps->pps_3d_extension_flag = get_bits1(gb);
+ pps->pps_scc_extension_flag = get_bits1(gb);
+ skip_bits(gb, 4); // pps_extension_4bits
+
if (pps->pps_range_extensions_flag) {
if ((ret = pps_range_extensions(gb, avctx, pps, sps)) < 0)
goto err;
}
+
+ if (pps->pps_multilayer_extension_flag) {
+ if ((ret = pps_multilayer_extension(gb, avctx, pps, sps)) < 0)
+ goto err;
+ }
+
+ if (pps->pps_3d_extension_flag) {
+ if ((ret = pps_3d_extension(gb, avctx, pps, sps)) < 0)
+ goto err;
+ }
+
+ if (pps->pps_scc_extension_flag) {
+ if ((ret = pps_scc_extension(gb, avctx, pps, sps)) < 0)
+ goto err;
+ }
}
ret = setup_pps(avctx, gb, pps, sps);
@@ -1671,9 +1938,8 @@ int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx,
goto err;
if (get_bits_left(gb) < 0) {
- av_log(avctx, AV_LOG_ERROR,
+ av_log(avctx, AV_LOG_WARNING,
"Overread PPS by %d bits\n", -get_bits_left(gb));
- goto err;
}
remove_pps(ps, pps_id);
diff --git a/libavcodec/hevc_ps.h b/libavcodec/hevc_ps.h
index 18894cfed1..1f704108e3 100644
--- a/libavcodec/hevc_ps.h
+++ b/libavcodec/hevc_ps.h
@@ -210,6 +210,20 @@ typedef struct HEVCSPS {
int persistent_rice_adaptation_enabled_flag;
int cabac_bypass_alignment_enabled_flag;
+ int sps_multilayer_extension_flag;
+ int sps_3d_extension_flag;
+
+ int sps_scc_extension_flag;
+ int sps_curr_pic_ref_enabled_flag;
+ int palette_mode_enabled_flag;
+ int palette_max_size;
+ int delta_palette_max_predictor_size;
+ int sps_palette_predictor_initializers_present_flag;
+ int sps_num_palette_predictor_initializers_minus1;
+ int sps_palette_predictor_initializer[3][HEVC_MAX_PALETTE_PREDICTOR_SIZE];
+ int motion_vector_resolution_control_idc;
+ int intra_boundary_filtering_disabled_flag;
+
///< coded frame dimension in various units
int width;
int height;
@@ -284,6 +298,9 @@ typedef struct HEVCPPS {
uint8_t slice_header_extension_present_flag;
uint8_t log2_max_transform_skip_block_size;
uint8_t pps_range_extensions_flag;
+ uint8_t pps_multilayer_extension_flag;
+ uint8_t pps_3d_extension_flag;
+ uint8_t pps_scc_extension_flag;
uint8_t cross_component_prediction_enabled_flag;
uint8_t chroma_qp_offset_list_enabled_flag;
uint8_t diff_cu_chroma_qp_offset_depth;
@@ -293,6 +310,58 @@ typedef struct HEVCPPS {
uint8_t log2_sao_offset_scale_luma;
uint8_t log2_sao_offset_scale_chroma;
+ // Multilayer extension parameters
+ uint8_t poc_reset_info_present_flag;
+ uint8_t pps_infer_scaling_list_flag;
+ uint8_t pps_scaling_list_ref_layer_id;
+ uint16_t num_ref_loc_offsets;
+ uint8_t ref_loc_offset_layer_id[64];
+ uint8_t scaled_ref_layer_offset_present_flag[64];
+ int8_t scaled_ref_layer_left_offset[64];
+ int8_t scaled_ref_layer_top_offset[64];
+ int8_t scaled_ref_layer_right_offset[64];
+ int8_t scaled_ref_layer_bottom_offset[64];
+ uint8_t ref_region_offset_present_flag[64];
+ int8_t ref_region_left_offset[64];
+ int8_t ref_region_top_offset[64];
+ int8_t ref_region_right_offset[64];
+ int8_t ref_region_bottom_offset[64];
+ uint8_t resample_phase_set_present_flag[64];
+ uint16_t phase_hor_luma[64];
+ uint16_t phase_ver_luma[64];
+ uint16_t phase_hor_chroma_plus8[64];
+ uint16_t phase_ver_chroma_plus8[64];
+ uint8_t colour_mapping_enabled_flag;
+ uint16_t num_cm_ref_layers_minus1;
+ uint8_t cm_ref_layer_id[63];
+ uint8_t cm_octant_depth;
+ uint8_t cm_y_part_num_log2;
+ uint16_t luma_bit_depth_cm_input_minus8;
+ uint16_t chroma_bit_depth_cm_input_minus8;
+ uint16_t luma_bit_depth_cm_output_minus8;
+ uint16_t chroma_bit_depth_cm_output_minus8;
+ uint8_t cm_res_quant_bits;
+ uint8_t cm_delta_flc_bits_minus1;
+ int8_t cm_adapt_threshold_u_delta;
+ int8_t cm_adapt_threshold_v_delta;
+
+ // 3D extension parameters
+ uint8_t pps_bit_depth_for_depth_layers_minus8;
+
+ // SCC extension parameters
+ uint8_t pps_curr_pic_ref_enabled_flag;
+ uint8_t residual_adaptive_colour_transform_enabled_flag;
+ uint8_t pps_slice_act_qp_offsets_present_flag;
+ int8_t pps_act_y_qp_offset; // _plus5
+ int8_t pps_act_cb_qp_offset; // _plus5
+ int8_t pps_act_cr_qp_offset; // _plus3
+ uint8_t pps_palette_predictor_initializers_present_flag;
+ uint8_t pps_num_palette_predictor_initializers;
+ uint8_t monochrome_palette_flag;
+ uint8_t luma_bit_depth_entry_minus8;
+ uint8_t chroma_bit_depth_entry_minus8;
+ uint8_t pps_palette_predictor_initializer[3][HEVC_MAX_PALETTE_PREDICTOR_SIZE];
+
// Inferred parameters
unsigned int *column_width; ///< ColumnWidth
unsigned int *row_height; ///< RowHeight
--
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] 19+ messages in thread
* [FFmpeg-devel] [PATCH v2 04/13] lavc/hevcdec: Add slice parse support for HEVC SCC extension
2022-12-05 6:09 [FFmpeg-devel] [PATCH v2 01/13] lavc/hevc_ps: remove profile limitation of pps_range_extensions() Fei Wang
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 02/13] lavc/avcodec: Add HEVC Screen Content Coding Extensions profile Fei Wang
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 03/13] lavc/hevc_ps: Add SPS/PPS parse support for HEVC extension syntax Fei Wang
@ 2022-12-05 6:09 ` Fei Wang
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 05/13] lavc/hevcdec: Fix the parsing for use_integer_mv_flag Fei Wang
` (9 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Fei Wang @ 2022-12-05 6:09 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Linjie Fu, Fei Wang, Linjie Fu
From: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
---
libavcodec/hevcdec.c | 6 ++++++
libavcodec/hevcdec.h | 4 ++++
2 files changed, 10 insertions(+)
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 567e8d81d4..f9a97ac7f5 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -856,6 +856,12 @@ static int hls_slice_header(HEVCContext *s)
sh->slice_cr_qp_offset = 0;
}
+ if (s->ps.pps->pps_slice_act_qp_offsets_present_flag) {
+ sh->slice_act_y_qp_offset = get_se_golomb(gb);
+ sh->slice_act_cb_qp_offset = get_se_golomb(gb);
+ sh->slice_act_cr_qp_offset = get_se_golomb(gb);
+ }
+
if (s->ps.pps->chroma_qp_offset_list_enabled_flag)
sh->cu_chroma_qp_offset_enabled_flag = get_bits1(gb);
else
diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h
index 9d3f4adbb3..7841ba8565 100644
--- a/libavcodec/hevcdec.h
+++ b/libavcodec/hevcdec.h
@@ -295,6 +295,10 @@ typedef struct SliceHeader {
int slice_cb_qp_offset;
int slice_cr_qp_offset;
+ int slice_act_y_qp_offset;
+ int slice_act_cb_qp_offset;
+ int slice_act_cr_qp_offset;
+
uint8_t cu_chroma_qp_offset_enabled_flag;
int beta_offset; ///< beta_offset_div2 * 2
--
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] 19+ messages in thread
* [FFmpeg-devel] [PATCH v2 05/13] lavc/hevcdec: Fix the parsing for use_integer_mv_flag
2022-12-05 6:09 [FFmpeg-devel] [PATCH v2 01/13] lavc/hevc_ps: remove profile limitation of pps_range_extensions() Fei Wang
` (2 preceding siblings ...)
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 04/13] lavc/hevcdec: Add slice parse support for HEVC SCC extension Fei Wang
@ 2022-12-05 6:09 ` Fei Wang
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 06/13] lavc/hevcdec: Set max_num_merge_cand to uint8_t Fei Wang
` (8 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Fei Wang @ 2022-12-05 6:09 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Linjie Fu, Fei Wang, Linjie Fu
From: Linjie Fu <linjie.fu@intel.com>
According to 7.3.6.1, use_integer_mv_flag should be parsed if
motion_vector_resolution_control_idc equals to 2. If not present, it
equals to motion_vector_resolution_control_idc.
Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
---
libavcodec/hevcdec.c | 8 ++++++++
libavcodec/hevcdec.h | 1 +
2 files changed, 9 insertions(+)
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index f9a97ac7f5..52fa627133 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -839,6 +839,14 @@ static int hls_slice_header(HEVCContext *s)
sh->max_num_merge_cand);
return AVERROR_INVALIDDATA;
}
+
+ // Syntax in 7.3.6.1
+ if (s->ps.sps->motion_vector_resolution_control_idc == 2)
+ sh->use_integer_mv_flag = get_bits1(gb);
+ else
+ // Inferred to be equal to motion_vector_resolution_control_idc if not present
+ sh->use_integer_mv_flag = s->ps.sps->motion_vector_resolution_control_idc;
+
}
sh->slice_qp_delta = get_se_golomb(gb);
diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h
index 7841ba8565..a7fc669bcb 100644
--- a/libavcodec/hevcdec.h
+++ b/libavcodec/hevcdec.h
@@ -305,6 +305,7 @@ typedef struct SliceHeader {
int tc_offset; ///< tc_offset_div2 * 2
unsigned int max_num_merge_cand; ///< 5 - 5_minus_max_num_merge_cand
+ uint8_t use_integer_mv_flag;
unsigned *entry_point_offset;
int * offset;
--
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] 19+ messages in thread
* [FFmpeg-devel] [PATCH v2 06/13] lavc/hevcdec: Set max_num_merge_cand to uint8_t
2022-12-05 6:09 [FFmpeg-devel] [PATCH v2 01/13] lavc/hevc_ps: remove profile limitation of pps_range_extensions() Fei Wang
` (3 preceding siblings ...)
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 05/13] lavc/hevcdec: Fix the parsing for use_integer_mv_flag Fei Wang
@ 2022-12-05 6:09 ` Fei Wang
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 07/13] lavc/hevc: Update reference list for SCC Fei Wang
` (7 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Fei Wang @ 2022-12-05 6:09 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Linjie Fu, Fei Wang, Linjie Fu
From: Linjie Fu <linjie.fu@intel.com>
uint8_t is big enough and keep consistent with the definition in
cbs_h265.h.
Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
---
libavcodec/hevcdec.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h
index a7fc669bcb..aab816791e 100644
--- a/libavcodec/hevcdec.h
+++ b/libavcodec/hevcdec.h
@@ -304,7 +304,7 @@ typedef struct SliceHeader {
int beta_offset; ///< beta_offset_div2 * 2
int tc_offset; ///< tc_offset_div2 * 2
- unsigned int max_num_merge_cand; ///< 5 - 5_minus_max_num_merge_cand
+ uint8_t max_num_merge_cand; ///< 5 - 5_minus_max_num_merge_cand
uint8_t use_integer_mv_flag;
unsigned *entry_point_offset;
--
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] 19+ messages in thread
* [FFmpeg-devel] [PATCH v2 07/13] lavc/hevc: Update reference list for SCC
2022-12-05 6:09 [FFmpeg-devel] [PATCH v2 01/13] lavc/hevc_ps: remove profile limitation of pps_range_extensions() Fei Wang
` (4 preceding siblings ...)
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 06/13] lavc/hevcdec: Set max_num_merge_cand to uint8_t Fei Wang
@ 2022-12-05 6:09 ` Fei Wang
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 08/13] lavc/vaapi_hevc: Pass SCC parameters Through VA-API Fei Wang
` (6 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Fei Wang @ 2022-12-05 6:09 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Linjie Fu, Fei Wang, Linjie Fu
From: Linjie Fu <linjie.fu@intel.com>
Screen Content Coding allows non-intra slice in an IRAP frame which can
reference the frame itself, and would mark the current decoded picture
as "used for long-term reference", no matter TwoVersionsOfCurrDecPicFlag(8.1.3),
hence some previous restricts are not suitable any more.
Constructe RefPicListTemp and RefPicList according to 8-8/9/10. Disable
slice decoding for SCC profile to avoid unexpected error in hevc native
decoder and patch welcome.
Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
---
libavcodec/hevc_refs.c | 21 ++++++++++++++++++++-
libavcodec/hevcdec.c | 10 +++++++++-
2 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c
index 811e8feff8..96153a2459 100644
--- a/libavcodec/hevc_refs.c
+++ b/libavcodec/hevc_refs.c
@@ -322,7 +322,7 @@ int ff_hevc_slice_rpl(HEVCContext *s)
return ret;
if (!(s->rps[ST_CURR_BEF].nb_refs + s->rps[ST_CURR_AFT].nb_refs +
- s->rps[LT_CURR].nb_refs)) {
+ s->rps[LT_CURR].nb_refs) && !s->ps.pps->pps_curr_pic_ref_enabled_flag) {
av_log(s->avctx, AV_LOG_ERROR, "Zero refs in the frame RPS.\n");
return AVERROR_INVALIDDATA;
}
@@ -349,6 +349,13 @@ int ff_hevc_slice_rpl(HEVCContext *s)
rpl_tmp.nb_refs++;
}
}
+ // Construct RefPicList0, RefPicList1 (8-8, 8-10)
+ if (s->ps.pps->pps_curr_pic_ref_enabled_flag) {
+ rpl_tmp.list[rpl_tmp.nb_refs] = s->ref->poc;
+ rpl_tmp.ref[rpl_tmp.nb_refs] = s->ref;
+ rpl_tmp.isLongTerm[rpl_tmp.nb_refs] = 1;
+ rpl_tmp.nb_refs++;
+ }
}
/* reorder the references if necessary */
@@ -371,6 +378,14 @@ int ff_hevc_slice_rpl(HEVCContext *s)
rpl->nb_refs = FFMIN(rpl->nb_refs, sh->nb_refs[list_idx]);
}
+ // 8-9
+ if (s->ps.pps->pps_curr_pic_ref_enabled_flag &&
+ !sh->rpl_modification_flag[list_idx] &&
+ rpl_tmp.nb_refs > sh->nb_refs[L0]) {
+ rpl->list[sh->nb_refs[L0] - 1] = s->ref->poc;
+ rpl->ref[sh->nb_refs[L0] - 1] = s->ref;
+ }
+
if (sh->collocated_list == list_idx &&
sh->collocated_ref_idx < rpl->nb_refs)
s->ref->collocated_ref = rpl->ref[sh->collocated_ref_idx];
@@ -541,5 +556,9 @@ int ff_hevc_frame_nb_refs(const HEVCContext *s)
for (i = 0; i < long_rps->nb_refs; i++)
ret += !!long_rps->used[i];
}
+
+ if (s->ps.pps->pps_curr_pic_ref_enabled_flag)
+ ret++;
+
return ret;
}
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 52fa627133..121ceb4e75 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -668,7 +668,8 @@ static int hls_slice_header(HEVCContext *s)
sh->slice_type);
return AVERROR_INVALIDDATA;
}
- if (IS_IRAP(s) && sh->slice_type != HEVC_SLICE_I) {
+ if (IS_IRAP(s) && sh->slice_type != HEVC_SLICE_I &&
+ !s->ps.pps->pps_curr_pic_ref_enabled_flag) {
av_log(s->avctx, AV_LOG_ERROR, "Inter slices in an IRAP frame.\n");
return AVERROR_INVALIDDATA;
}
@@ -3123,6 +3124,13 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal)
if (ret < 0)
goto fail;
} else {
+ if (s->avctx->profile == FF_PROFILE_HEVC_SCC) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "SCC profile is not yet implemented in hevc native decoder.\n");
+ ret = AVERROR_PATCHWELCOME;
+ goto fail;
+ }
+
if (s->threads_number > 1 && s->sh.num_entry_point_offsets > 0)
ctb_addr_ts = hls_slice_data_wpp(s, nal);
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] 19+ messages in thread
* [FFmpeg-devel] [PATCH v2 08/13] lavc/vaapi_hevc: Pass SCC parameters Through VA-API
2022-12-05 6:09 [FFmpeg-devel] [PATCH v2 01/13] lavc/hevc_ps: remove profile limitation of pps_range_extensions() Fei Wang
` (5 preceding siblings ...)
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 07/13] lavc/hevc: Update reference list for SCC Fei Wang
@ 2022-12-05 6:09 ` Fei Wang
2023-01-03 6:56 ` Xiang, Haihao
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 09/13] lavc/vaapi_hevc: Add vaapi profile parse support for SCC Fei Wang
` (5 subsequent siblings)
12 siblings, 1 reply; 19+ messages in thread
From: Fei Wang @ 2022-12-05 6:09 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Linjie Fu, Fei Wang, Linjie Fu
From: Linjie Fu <linjie.fu@intel.com>
Including sps/pps/slice parameters.
Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
---
libavcodec/vaapi_hevc.c | 52 +++++++++++++++++++++++++++++++++++++----
1 file changed, 47 insertions(+), 5 deletions(-)
diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c
index 20fb36adfa..750738d36e 100644
--- a/libavcodec/vaapi_hevc.c
+++ b/libavcodec/vaapi_hevc.c
@@ -124,7 +124,7 @@ static int vaapi_hevc_start_frame(AVCodecContext *avctx,
const HEVCPPS *pps = h->ps.pps;
const ScalingList *scaling_list = NULL;
- int pic_param_size, err, i;
+ int pic_param_size, num_comps, pre_palette_size, err, i;
VAPictureParameterBufferHEVC *pic_param = (VAPictureParameterBufferHEVC *)&pic->pic_param;
@@ -245,8 +245,46 @@ static int vaapi_hevc_start_frame(AVCodecContext *avctx,
for (i = 0; i < 6; i++)
pic->pic_param.rext.cr_qp_offset_list[i] = pps->cr_qp_offset_list[i];
}
+
+ pre_palette_size = pps->pps_palette_predictor_initializers_present_flag ?
+ pps->pps_num_palette_predictor_initializers :
+ (sps->sps_palette_predictor_initializers_present_flag ?
+ sps->sps_num_palette_predictor_initializers_minus1 + 1 :
+ 0);
+
+ if (avctx->profile == FF_PROFILE_HEVC_SCC) {
+ pic->pic_param.scc = (VAPictureParameterBufferHEVCScc) {
+ .screen_content_pic_fields.bits = {
+ .pps_curr_pic_ref_enabled_flag = pps->pps_curr_pic_ref_enabled_flag,
+ .palette_mode_enabled_flag = sps->palette_mode_enabled_flag,
+ .motion_vector_resolution_control_idc = sps->motion_vector_resolution_control_idc,
+ .intra_boundary_filtering_disabled_flag = sps->intra_boundary_filtering_disabled_flag,
+ .residual_adaptive_colour_transform_enabled_flag
+ = pps->residual_adaptive_colour_transform_enabled_flag,
+ .pps_slice_act_qp_offsets_present_flag = pps->pps_slice_act_qp_offsets_present_flag,
+ },
+ .palette_max_size = sps->palette_max_size,
+ .delta_palette_max_predictor_size = sps->delta_palette_max_predictor_size,
+ .predictor_palette_size = pre_palette_size,
+ .pps_act_y_qp_offset_plus5 = pps->residual_adaptive_colour_transform_enabled_flag ?
+ pps->pps_act_y_qp_offset + 5 : 0,
+ .pps_act_cb_qp_offset_plus5 = pps->residual_adaptive_colour_transform_enabled_flag ?
+ pps->pps_act_cb_qp_offset + 5 : 0,
+ .pps_act_cr_qp_offset_plus3 = pps->residual_adaptive_colour_transform_enabled_flag ?
+ pps->pps_act_cr_qp_offset + 3 : 0,
+ };
+
+ num_comps = pps->monochrome_palette_flag ? 1 : 3;
+ for (int comp = 0; comp < num_comps; comp++)
+ for (i = 0; i < pre_palette_size; i++)
+ pic->pic_param.scc.predictor_palette_entries[comp][i] =
+ pps->pps_palette_predictor_initializers_present_flag ?
+ pps->pps_palette_predictor_initializer[comp][i]:
+ sps->sps_palette_predictor_initializer[comp][i];
+ }
+
#endif
- pic_param_size = avctx->profile == FF_PROFILE_HEVC_REXT ?
+ pic_param_size = avctx->profile >= FF_PROFILE_HEVC_REXT ?
sizeof(pic->pic_param) : sizeof(VAPictureParameterBufferHEVC);
err = ff_vaapi_decode_make_param_buffer(avctx, &pic->pic,
@@ -299,7 +337,7 @@ static int vaapi_hevc_end_frame(AVCodecContext *avctx)
VASliceParameterBufferHEVC *last_slice_param = (VASliceParameterBufferHEVC *)&pic->last_slice_param;
int ret;
- int slice_param_size = avctx->profile == FF_PROFILE_HEVC_REXT ?
+ int slice_param_size = avctx->profile >= FF_PROFILE_HEVC_REXT ?
sizeof(pic->last_slice_param) : sizeof(VASliceParameterBufferHEVC);
if (pic->last_size) {
@@ -413,7 +451,7 @@ static int vaapi_hevc_decode_slice(AVCodecContext *avctx,
VAAPIDecodePictureHEVC *pic = h->ref->hwaccel_picture_private;
VASliceParameterBufferHEVC *last_slice_param = (VASliceParameterBufferHEVC *)&pic->last_slice_param;
- int slice_param_size = avctx->profile == FF_PROFILE_HEVC_REXT ?
+ int slice_param_size = avctx->profile >= FF_PROFILE_HEVC_REXT ?
sizeof(pic->last_slice_param) : sizeof(VASliceParameterBufferHEVC);
int nb_list = (sh->slice_type == HEVC_SLICE_B) ?
@@ -478,11 +516,15 @@ static int vaapi_hevc_decode_slice(AVCodecContext *avctx,
fill_pred_weight_table(avctx, h, sh, last_slice_param);
#if VA_CHECK_VERSION(1, 2, 0)
- if (avctx->profile == FF_PROFILE_HEVC_REXT) {
+ if (avctx->profile >= FF_PROFILE_HEVC_REXT) {
pic->last_slice_param.rext = (VASliceParameterBufferHEVCRext) {
.slice_ext_flags.bits = {
.cu_chroma_qp_offset_enabled_flag = sh->cu_chroma_qp_offset_enabled_flag,
+ .use_integer_mv_flag = sh->use_integer_mv_flag,
},
+ .slice_act_y_qp_offset = sh->slice_act_y_qp_offset,
+ .slice_act_cb_qp_offset = sh->slice_act_cb_qp_offset,
+ .slice_act_cr_qp_offset = sh->slice_act_cr_qp_offset,
};
for (i = 0; i < 15 && i < sh->nb_refs[L0]; i++) {
pic->last_slice_param.rext.luma_offset_l0[i] = sh->luma_offset_l0[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] 19+ messages in thread
* [FFmpeg-devel] [PATCH v2 09/13] lavc/vaapi_hevc: Add vaapi profile parse support for SCC
2022-12-05 6:09 [FFmpeg-devel] [PATCH v2 01/13] lavc/hevc_ps: remove profile limitation of pps_range_extensions() Fei Wang
` (6 preceding siblings ...)
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 08/13] lavc/vaapi_hevc: Pass SCC parameters Through VA-API Fei Wang
@ 2022-12-05 6:09 ` Fei Wang
2023-01-03 7:08 ` Xiang, Haihao
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 10/13] lavc/vaapi_hevc: Set correct rps type for scc Fei Wang
` (4 subsequent siblings)
12 siblings, 1 reply; 19+ messages in thread
From: Fei Wang @ 2022-12-05 6:09 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Linjie Fu, Fei Wang, Linjie Fu
From: Linjie Fu <linjie.fu@intel.com>
Note that Screen-Extended Main 4:4:4 and 4:4:4 10 supports
chroma_format_idc from 0, 1 or 3, hence both 420 and 444 are
supported.
Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
---
libavcodec/vaapi_decode.c | 4 +++-
libavcodec/vaapi_hevc.c | 14 ++++++++++++--
libavcodec/vaapi_hevc.h | 2 +-
3 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c
index 134f10eca5..29ac439b36 100644
--- a/libavcodec/vaapi_decode.c
+++ b/libavcodec/vaapi_decode.c
@@ -410,7 +410,9 @@ static const struct {
#endif
#if VA_CHECK_VERSION(1, 2, 0) && CONFIG_HEVC_VAAPI_HWACCEL
MAP(HEVC, HEVC_REXT, None,
- ff_vaapi_parse_hevc_rext_profile ),
+ ff_vaapi_parse_hevc_profile ),
+ MAP(HEVC, HEVC_SCC, None,
+ ff_vaapi_parse_hevc_profile ),
#endif
MAP(MJPEG, MJPEG_HUFFMAN_BASELINE_DCT,
JPEGBaseline),
diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c
index 750738d36e..6ce1e17fa8 100644
--- a/libavcodec/vaapi_hevc.c
+++ b/libavcodec/vaapi_hevc.c
@@ -586,9 +586,9 @@ static int ptl_convert(const PTLCommon *general_ptl, H265RawProfileTierLevel *h2
}
/*
- * Find exact va_profile for HEVC Range Extension
+ * Find exact va_profile for HEVC Range Extension and Screen Content Coding Extension
*/
-VAProfile ff_vaapi_parse_hevc_rext_profile(AVCodecContext *avctx)
+VAProfile ff_vaapi_parse_hevc_profile(AVCodecContext *avctx)
{
const HEVCContext *h = avctx->priv_data;
const HEVCSPS *sps = h->ps.sps;
@@ -627,6 +627,16 @@ VAProfile ff_vaapi_parse_hevc_rext_profile(AVCodecContext *avctx)
else if (!strcmp(profile->name, "Main 4:4:4 12") ||
!strcmp(profile->name, "Main 4:4:4 12 Intra"))
return VAProfileHEVCMain444_12;
+ else if (!strcmp(profile->name, "Screen-Extended Main"))
+ return VAProfileHEVCSccMain;
+ else if (!strcmp(profile->name, "Screen-Extended Main 10"))
+ return VAProfileHEVCSccMain10;
+ else if (!strcmp(profile->name, "Screen-Extended Main 4:4:4"))
+ return VAProfileHEVCSccMain444;
+#if VA_CHECK_VERSION(1, 8, 0)
+ else if (!strcmp(profile->name, "Screen-Extended Main 4:4:4 10"))
+ return VAProfileHEVCSccMain444_10;
+#endif
#else
av_log(avctx, AV_LOG_WARNING, "HEVC profile %s is "
"not supported with this VA version.\n", profile->name);
diff --git a/libavcodec/vaapi_hevc.h b/libavcodec/vaapi_hevc.h
index b3b0e6fc1e..7662dca510 100644
--- a/libavcodec/vaapi_hevc.h
+++ b/libavcodec/vaapi_hevc.h
@@ -22,6 +22,6 @@
#include <va/va.h>
#include "avcodec.h"
-VAProfile ff_vaapi_parse_hevc_rext_profile(AVCodecContext *avctx);
+VAProfile ff_vaapi_parse_hevc_profile(AVCodecContext *avctx);
#endif /* AVCODEC_VAAPI_HEVC_H */
--
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] 19+ messages in thread
* [FFmpeg-devel] [PATCH v2 10/13] lavc/vaapi_hevc: Set correct rps type for scc
2022-12-05 6:09 [FFmpeg-devel] [PATCH v2 01/13] lavc/hevc_ps: remove profile limitation of pps_range_extensions() Fei Wang
` (7 preceding siblings ...)
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 09/13] lavc/vaapi_hevc: Add vaapi profile parse support for SCC Fei Wang
@ 2022-12-05 6:09 ` Fei Wang
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 11/13] lavc/vaapi_hevc: Loose the restricts for SCC decoding Fei Wang
` (3 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Fei Wang @ 2022-12-05 6:09 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Linjie Fu, Fei Wang, Linjie Fu
From: Linjie Fu <linjie.fu@intel.com>
According to 8.1.3 and 8.3.2.
Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
---
libavcodec/vaapi_hevc.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c
index 6ce1e17fa8..005d782819 100644
--- a/libavcodec/vaapi_hevc.c
+++ b/libavcodec/vaapi_hevc.c
@@ -71,6 +71,7 @@ static void fill_vaapi_pic(VAPictureHEVC *va_pic, const HEVCFrame *pic, int rps_
static int find_frame_rps_type(const HEVCContext *h, const HEVCFrame *pic)
{
VASurfaceID pic_surf = ff_vaapi_get_surface_id(pic->frame);
+ const HEVCFrame *current_picture = h->ref;
int i;
for (i = 0; i < h->rps[ST_CURR_BEF].nb_refs; i++) {
@@ -88,6 +89,9 @@ static int find_frame_rps_type(const HEVCContext *h, const HEVCFrame *pic)
return VA_PICTURE_HEVC_RPS_LT_CURR;
}
+ if (h->ps.pps->pps_curr_pic_ref_enabled_flag && current_picture->poc == pic->poc)
+ return VA_PICTURE_HEVC_LONG_TERM_REFERENCE;
+
return 0;
}
--
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] 19+ messages in thread
* [FFmpeg-devel] [PATCH v2 11/13] lavc/vaapi_hevc: Loose the restricts for SCC decoding
2022-12-05 6:09 [FFmpeg-devel] [PATCH v2 01/13] lavc/hevc_ps: remove profile limitation of pps_range_extensions() Fei Wang
` (8 preceding siblings ...)
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 10/13] lavc/vaapi_hevc: Set correct rps type for scc Fei Wang
@ 2022-12-05 6:09 ` Fei Wang
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 12/13] avcodec/hevcdec: Replace number with enum Fei Wang
` (2 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Fei Wang @ 2022-12-05 6:09 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Linjie Fu, Fei Wang, Linjie Fu
From: Linjie Fu <linjie.fu@intel.com>
Allow current picture as the reference picture.
Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
---
libavcodec/vaapi_hevc.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c
index 005d782819..ca14052d56 100644
--- a/libavcodec/vaapi_hevc.c
+++ b/libavcodec/vaapi_hevc.c
@@ -104,7 +104,8 @@ static void fill_vaapi_reference_frames(const HEVCContext *h, VAPictureParameter
const HEVCFrame *frame = NULL;
while (!frame && j < FF_ARRAY_ELEMS(h->DPB)) {
- if (&h->DPB[j] != current_picture && (h->DPB[j].flags & (HEVC_FRAME_FLAG_LONG_REF | HEVC_FRAME_FLAG_SHORT_REF)))
+ if ((&h->DPB[j] != current_picture || h->ps.pps->pps_curr_pic_ref_enabled_flag) &&
+ (h->DPB[j].flags & (HEVC_FRAME_FLAG_LONG_REF | HEVC_FRAME_FLAG_SHORT_REF)))
frame = &h->DPB[j];
j++;
}
@@ -222,7 +223,8 @@ static int vaapi_hevc_start_frame(AVCodecContext *avctx,
}
#if VA_CHECK_VERSION(1, 2, 0)
- if (avctx->profile == FF_PROFILE_HEVC_REXT) {
+ if (avctx->profile == FF_PROFILE_HEVC_REXT ||
+ avctx->profile == FF_PROFILE_HEVC_SCC) {
pic->pic_param.rext = (VAPictureParameterBufferHEVCRext) {
.range_extension_pic_fields.bits = {
.transform_skip_rotation_enabled_flag = sps->transform_skip_rotation_enabled_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] 19+ messages in thread
* [FFmpeg-devel] [PATCH v2 12/13] avcodec/hevcdec: Replace number with enum
2022-12-05 6:09 [FFmpeg-devel] [PATCH v2 01/13] lavc/hevc_ps: remove profile limitation of pps_range_extensions() Fei Wang
` (9 preceding siblings ...)
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 11/13] lavc/vaapi_hevc: Loose the restricts for SCC decoding Fei Wang
@ 2022-12-05 6:09 ` Fei Wang
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 13/13] lavc/vaapi_hevc: Remove duplicate code Fei Wang
2022-12-14 2:19 ` [FFmpeg-devel] [PATCH v2 01/13] lavc/hevc_ps: remove profile limitation of pps_range_extensions() Wang, Fei W
12 siblings, 0 replies; 19+ messages in thread
From: Fei Wang @ 2022-12-05 6:09 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Fei Wang
Keep same style with IS_IDR()/IS_BLA().
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
---
libavcodec/hevcdec.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h
index aab816791e..94609e4699 100644
--- a/libavcodec/hevcdec.h
+++ b/libavcodec/hevcdec.h
@@ -75,7 +75,7 @@
#define IS_IDR(s) ((s)->nal_unit_type == HEVC_NAL_IDR_W_RADL || (s)->nal_unit_type == HEVC_NAL_IDR_N_LP)
#define IS_BLA(s) ((s)->nal_unit_type == HEVC_NAL_BLA_W_RADL || (s)->nal_unit_type == HEVC_NAL_BLA_W_LP || \
(s)->nal_unit_type == HEVC_NAL_BLA_N_LP)
-#define IS_IRAP(s) ((s)->nal_unit_type >= 16 && (s)->nal_unit_type <= 23)
+#define IS_IRAP(s) ((s)->nal_unit_type >= HEVC_NAL_BLA_W_LP && (s)->nal_unit_type <= HEVC_NAL_RSV_IRAP_VCL23)
enum RPSType {
ST_CURR_BEF = 0,
--
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] 19+ messages in thread
* [FFmpeg-devel] [PATCH v2 13/13] lavc/vaapi_hevc: Remove duplicate code
2022-12-05 6:09 [FFmpeg-devel] [PATCH v2 01/13] lavc/hevc_ps: remove profile limitation of pps_range_extensions() Fei Wang
` (10 preceding siblings ...)
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 12/13] avcodec/hevcdec: Replace number with enum Fei Wang
@ 2022-12-05 6:09 ` Fei Wang
2022-12-22 2:15 ` Wang, Fei W
2022-12-14 2:19 ` [FFmpeg-devel] [PATCH v2 01/13] lavc/hevc_ps: remove profile limitation of pps_range_extensions() Wang, Fei W
12 siblings, 1 reply; 19+ messages in thread
From: Fei Wang @ 2022-12-05 6:09 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Fei Wang
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
---
libavcodec/vaapi_hevc.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c
index ca14052d56..b3ff2f7344 100644
--- a/libavcodec/vaapi_hevc.c
+++ b/libavcodec/vaapi_hevc.c
@@ -538,12 +538,6 @@ static int vaapi_hevc_decode_slice(AVCodecContext *avctx,
pic->last_slice_param.rext.ChromaOffsetL0[i][1] = sh->chroma_offset_l0[i][1];
}
- for (i = 0; i < 15 && i < sh->nb_refs[L0]; i++) {
- pic->last_slice_param.rext.luma_offset_l0[i] = sh->luma_offset_l0[i];
- pic->last_slice_param.rext.ChromaOffsetL0[i][0] = sh->chroma_offset_l0[i][0];
- pic->last_slice_param.rext.ChromaOffsetL0[i][1] = sh->chroma_offset_l0[i][1];
- }
-
if (sh->slice_type == HEVC_SLICE_B) {
for (i = 0; i < 15 && i < sh->nb_refs[L1]; i++) {
pic->last_slice_param.rext.luma_offset_l1[i] = sh->luma_offset_l1[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] 19+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 01/13] lavc/hevc_ps: remove profile limitation of pps_range_extensions()
2022-12-05 6:09 [FFmpeg-devel] [PATCH v2 01/13] lavc/hevc_ps: remove profile limitation of pps_range_extensions() Fei Wang
` (11 preceding siblings ...)
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 13/13] lavc/vaapi_hevc: Remove duplicate code Fei Wang
@ 2022-12-14 2:19 ` Wang, Fei W
12 siblings, 0 replies; 19+ messages in thread
From: Wang, Fei W @ 2022-12-14 2:19 UTC (permalink / raw)
To: ffmpeg-devel
On Mon, 2022-12-05 at 14:09 +0800, Fei Wang wrote:
> Follow spec 7.3.2.3.1.
>
> Signed-off-by: Fei Wang <fei.w.wang@intel.com>
> ---
> update:
> 1. fix uninitialized variable which may cause segment fault.
Ping for review this patchset.
Confirmed with Qemu locally for Loongarch64 with:
https://github.com/sunhaiyong1978/CLFS-for-LoongArch/releases/tag/7.0
The FATE test hevc-conformance-PS_A_VIDYO_3 pass without any error.
Thanks
Fei
>
> libavcodec/hevc_ps.c | 2 +-
> tests/ref/fate/hevc-conformance-PS_A_VIDYO_3 | 50 ++++++++++------
> ----
> 2 files changed, 26 insertions(+), 26 deletions(-)
>
> diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
> index 5fe62ec35b..537a3ff99b 100644
> --- a/libavcodec/hevc_ps.c
> +++ b/libavcodec/hevc_ps.c
> @@ -1658,7 +1658,7 @@ int ff_hevc_decode_nal_pps(GetBitContext *gb,
> AVCodecContext *avctx,
> if (get_bits1(gb)) { // pps_extension_present_flag
> pps->pps_range_extensions_flag = get_bits1(gb);
> skip_bits(gb, 7); // pps_extension_7bits
> - if (sps->ptl.general_ptl.profile_idc == FF_PROFILE_HEVC_REXT
> && pps->pps_range_extensions_flag) {
> + if (pps->pps_range_extensions_flag) {
> if ((ret = pps_range_extensions(gb, avctx, pps, sps)) <
> 0)
> goto err;
> }
> diff --git a/tests/ref/fate/hevc-conformance-PS_A_VIDYO_3
> b/tests/ref/fate/hevc-conformance-PS_A_VIDYO_3
> index 59b82b72bb..d1d86b2dc9 100644
> --- a/tests/ref/fate/hevc-conformance-PS_A_VIDYO_3
> +++ b/tests/ref/fate/hevc-conformance-PS_A_VIDYO_3
> @@ -3,28 +3,28 @@
> #codec_id 0: rawvideo
> #dimensions 0: 416x240
> #sar 0: 0/1
> -0, 0, 0, 1, 149760, 0x88619f80
> -0, 1, 1, 1, 149760, 0x550bdaf0
> -0, 2, 2, 1, 149760, 0x4121f7a2
> -0, 3, 3, 1, 149760, 0x210b1d07
> -0, 4, 4, 1, 149760, 0x731b7758
> -0, 5, 5, 1, 149760, 0x17adb789
> -0, 6, 6, 1, 149760, 0x98b2f080
> -0, 7, 7, 1, 149760, 0xc0be1f2a
> -0, 8, 8, 1, 149760, 0xc01e387a
> -0, 9, 9, 1, 149760, 0xd932822b
> -0, 10, 10, 1, 149760, 0x16c0a1df
> -0, 11, 11, 1, 149760, 0x5aa6c005
> -0, 12, 12, 1, 149760, 0xd3aab602
> -0, 13, 13, 1, 149760, 0x4e6ecab1
> -0, 14, 14, 1, 149760, 0x8a86f1f2
> -0, 15, 15, 1, 149760, 0x2ed21e1b
> -0, 16, 16, 1, 149760, 0x80892f24
> -0, 17, 17, 1, 149760, 0xb8a952ef
> -0, 18, 18, 1, 149760, 0x557e57fb
> -0, 19, 19, 1, 149760, 0x2b825b2c
> -0, 20, 20, 1, 149760, 0x30b69b5e
> -0, 21, 21, 1, 149760, 0x802ebf08
> -0, 22, 22, 1, 149760, 0x95aadc8e
> -0, 23, 23, 1, 149760, 0x4d4c02b7
> -0, 24, 24, 1, 149760, 0x3fdd1762
> +0, 0, 0, 1, 149760, 0x5c4f70f4
> +0, 1, 1, 1, 149760, 0xf4628e59
> +0, 2, 2, 1, 149760, 0xa28e5bdc
> +0, 3, 3, 1, 149760, 0xda0e53d7
> +0, 4, 4, 1, 149760, 0x42dd334a
> +0, 5, 5, 1, 149760, 0x25ba9dfe
> +0, 6, 6, 1, 149760, 0x8854d8ca
> +0, 7, 7, 1, 149760, 0xc04505d4
> +0, 8, 8, 1, 149760, 0xd3fce146
> +0, 9, 9, 1, 149760, 0x8bfd88bd
> +0, 10, 10, 1, 149760, 0x33d965b2
> +0, 11, 11, 1, 149760, 0x12746b7a
> +0, 12, 12, 1, 149760, 0xb7642694
> +0, 13, 13, 1, 149760, 0x32b5035f
> +0, 14, 14, 1, 149760, 0x7bea0af1
> +0, 15, 15, 1, 149760, 0x577d4fc8
> +0, 16, 16, 1, 149760, 0x023a9c66
> +0, 17, 17, 1, 149760, 0x9abe76c4
> +0, 18, 18, 1, 149760, 0x2b14dba5
> +0, 19, 19, 1, 149760, 0x7b8affcf
> +0, 20, 20, 1, 149760, 0x21e4c323
> +0, 21, 21, 1, 149760, 0xf0b7d9cd
> +0, 22, 22, 1, 149760, 0x4db0c5bc
> +0, 23, 23, 1, 149760, 0xf455f752
> +0, 24, 24, 1, 149760, 0x569fec99
_______________________________________________
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] 19+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 13/13] lavc/vaapi_hevc: Remove duplicate code
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 13/13] lavc/vaapi_hevc: Remove duplicate code Fei Wang
@ 2022-12-22 2:15 ` Wang, Fei W
0 siblings, 0 replies; 19+ messages in thread
From: Wang, Fei W @ 2022-12-22 2:15 UTC (permalink / raw)
To: ffmpeg-devel
On Mon, 2022-12-05 at 14:09 +0800, Fei Wang wrote:
> Signed-off-by: Fei Wang <fei.w.wang@intel.com>
> ---
> libavcodec/vaapi_hevc.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c
> index ca14052d56..b3ff2f7344 100644
> --- a/libavcodec/vaapi_hevc.c
> +++ b/libavcodec/vaapi_hevc.c
> @@ -538,12 +538,6 @@ static int
> vaapi_hevc_decode_slice(AVCodecContext *avctx,
> pic->last_slice_param.rext.ChromaOffsetL0[i][1] = sh-
> >chroma_offset_l0[i][1];
> }
>
> - for (i = 0; i < 15 && i < sh->nb_refs[L0]; i++) {
> - pic->last_slice_param.rext.luma_offset_l0[i] = sh-
> >luma_offset_l0[i];
> - pic->last_slice_param.rext.ChromaOffsetL0[i][0] = sh-
> >chroma_offset_l0[i][0];
> - pic->last_slice_param.rext.ChromaOffsetL0[i][1] = sh-
> >chroma_offset_l0[i][1];
> - }
> -
Confirmed locally, FATE test pass without any error.
Thanks
Fei
> if (sh->slice_type == HEVC_SLICE_B) {
> for (i = 0; i < 15 && i < sh->nb_refs[L1]; i++) {
> pic->last_slice_param.rext.luma_offset_l1[i] = sh-
> >luma_offset_l1[i];
_______________________________________________
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] 19+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 03/13] lavc/hevc_ps: Add SPS/PPS parse support for HEVC extension syntax
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 03/13] lavc/hevc_ps: Add SPS/PPS parse support for HEVC extension syntax Fei Wang
@ 2023-01-03 6:20 ` Xiang, Haihao
0 siblings, 0 replies; 19+ messages in thread
From: Xiang, Haihao @ 2023-01-03 6:20 UTC (permalink / raw)
To: Wang, Fei W, ffmpeg-devel; +Cc: linjie.justin.fu, linjie.fu
On Ma, 2022-12-05 at 14:09 +0800, Fei Wang wrote:
> From: Linjie Fu <linjie.fu@intel.com>
>
> 1. Add extension syntax according to 7.3.2.2.3/7.3.2.3.3 in T-REC-H.265-
> 201911.
> 2. Keep using parsed PPS when bitstream overread for compatibility. For
> example, the clip PS_A_VIDYO_3.bit in FATE test has incomplete extension
> syntax which will be overread and un-decodable if without this change.
> 3. Format brace in pps_range_extensions().
>
> Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
> Signed-off-by: Fei Wang <fei.w.wang@intel.com>
> ---
> libavcodec/hevc.h | 3 +
> libavcodec/hevc_ps.c | 288 +++++++++++++++++++++++++++++++++++++++++--
> libavcodec/hevc_ps.h | 69 +++++++++++
> 3 files changed, 349 insertions(+), 11 deletions(-)
>
> diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h
> index 1804755327..6b454a75c1 100644
> --- a/libavcodec/hevc.h
> +++ b/libavcodec/hevc.h
> @@ -154,6 +154,9 @@ enum {
> // get near that, though, so set a lower limit here with the maximum
> // possible value for 4K video (at most 135 16x16 Ctb rows).
> HEVC_MAX_ENTRY_POINT_OFFSETS = HEVC_MAX_TILE_COLUMNS * 135,
> +
> + // A.3.7: Screen content coding extensions
> + HEVC_MAX_PALETTE_PREDICTOR_SIZE = 128,
> };
>
>
> diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
> index ad92b6bcbc..3181962918 100644
> --- a/libavcodec/hevc_ps.c
> +++ b/libavcodec/hevc_ps.c
> @@ -853,7 +853,7 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb,
> unsigned int *sps_id,
> HEVCWindow *ow;
> int ret = 0;
> int log2_diff_max_min_transform_block_size;
> - int bit_depth_chroma, start, vui_present, sublayer_ordering_info;
> + int bit_depth_chroma, start, vui_present, sublayer_ordering_info,
> num_comps;
> int i;
>
> // Coded parameters
> @@ -1074,8 +1074,12 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb,
> unsigned int *sps_id,
> decode_vui(gb, avctx, apply_defdispwin, sps);
>
> if (get_bits1(gb)) { // sps_extension_flag
> - sps->sps_range_extension_flag = get_bits1(gb);
> - skip_bits(gb, 7); //sps_extension_7bits = get_bits(gb, 7);
> + sps->sps_range_extension_flag = get_bits1(gb);
> + sps->sps_multilayer_extension_flag = get_bits1(gb);
> + sps->sps_3d_extension_flag = get_bits1(gb);
> + sps->sps_scc_extension_flag = get_bits1(gb);
> + skip_bits(gb, 4); // sps_extension_4bits
> +
> if (sps->sps_range_extension_flag) {
> sps->transform_skip_rotation_enabled_flag = get_bits1(gb);
> sps->transform_skip_context_enabled_flag = get_bits1(gb);
> @@ -1101,6 +1105,57 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb,
> unsigned int *sps_id,
> av_log(avctx, AV_LOG_WARNING,
> "cabac_bypass_alignment_enabled_flag not yet
> implemented\n");
> }
> +
> + if (sps->sps_multilayer_extension_flag) {
> + skip_bits1(gb); // inter_view_mv_vert_constraint_flag
> + av_log(avctx, AV_LOG_WARNING,
> + "sps_multilayer_extension_flag not yet implemented\n");
> + }
> +
> + if (sps->sps_3d_extension_flag) {
> + for (i = 0; i <= 1; i++) {
> + skip_bits1(gb); // iv_di_mc_enabled_flag
> + skip_bits1(gb); // iv_mv_scal_enabled_flag
> + if (i == 0) {
> + get_ue_golomb_long(gb); // log2_ivmc_sub_pb_size_minus3
> + skip_bits1(gb); // iv_res_pred_enabled_flag
> + skip_bits1(gb); // depth_ref_enabled_flag
> + skip_bits1(gb); // vsp_mc_enabled_flag
> + skip_bits1(gb); // dbbp_enabled_flag
> + } else {
> + skip_bits1(gb); // tex_mc_enabled_flag
> + get_ue_golomb_long(gb); // log2_ivmc_sub_pb_size_minus3
> + skip_bits1(gb); // intra_contour_enabled_flag
> + skip_bits1(gb); // intra_dc_only_wedge_enabled_flag
> + skip_bits1(gb); // cqt_cu_part_pred_enabled_flag
> + skip_bits1(gb); // inter_dc_only_enabled_flag
> + skip_bits1(gb); // skip_intra_enabled_flag
> + }
> + }
> + av_log(avctx, AV_LOG_WARNING,
> + "sps_3d_extension_flag not yet implemented\n");
> + }
> +
> + if (sps->sps_scc_extension_flag) {
> + sps->sps_curr_pic_ref_enabled_flag = get_bits1(gb);
> + sps->palette_mode_enabled_flag = get_bits1(gb);
> + if (sps->palette_mode_enabled_flag) {
> + sps->palette_max_size = get_ue_golomb_long(gb);
> + sps->delta_palette_max_predictor_size =
> get_ue_golomb_long(gb);
> + sps->sps_palette_predictor_initializers_present_flag =
> get_bits1(gb);
> +
> + if (sps->sps_palette_predictor_initializers_present_flag) {
> + sps->sps_num_palette_predictor_initializers_minus1 =
> get_ue_golomb_long(gb);
> + num_comps = !sps->chroma_format_idc ? 1 : 3;
> + for (int comp = 0; comp < num_comps; comp++)
> + for (i = 0; i <= sps-
> >sps_num_palette_predictor_initializers_minus1; i++)
> + sps->sps_palette_predictor_initializer[comp][i] =
> + get_bits(gb, !comp ? sps->bit_depth :
> sps->bit_depth_chroma);
> + }
> + }
> + sps->motion_vector_resolution_control_idc = get_bits(gb, 2);
> + sps->intra_boundary_filtering_disabled_flag = get_bits1(gb);
> + }
> }
> if (apply_defdispwin) {
> sps->output_window.left_offset += sps-
> >vui.def_disp_win.left_offset;
> @@ -1265,10 +1320,162 @@ static void hevc_pps_free(void *opaque, uint8_t
> *data)
> av_freep(&pps);
> }
>
> -static int pps_range_extensions(GetBitContext *gb, AVCodecContext *avctx,
> - HEVCPPS *pps, HEVCSPS *sps) {
> - int i;
> +static void colour_mapping_octants(GetBitContext *gb, HEVCPPS *pps, int
> inp_depth,
> + int idx_y, int idx_cb, int idx_cr, int
> inp_length)
> +{
> + unsigned int split_octant_flag, part_num_y, coded_res_flag, res_coeff_q,
> res_coeff_r;
> + int bit_depth_cm_input_y, bit_depth_cm_output_y, cm_res_bits;
> +
> + part_num_y = 1 << pps->cm_y_part_num_log2;
> +
> + split_octant_flag = inp_depth < pps->cm_octant_depth ? get_bits1(gb) : 0;
> +
> + if (split_octant_flag)
> + for (int k = 0; k < 2; k++)
> + for (int m = 0; m < 2; m++)
> + for (int n = 0; n < 2; n++)
> + colour_mapping_octants(gb, pps, inp_depth + 1,
> + idx_y + part_num_y * k *
> inp_length / 2,
> + idx_cb + m * inp_length / 2,
> + idx_cr + n * inp_length / 2,
> + inp_length / 2);
> + else
> + for (int i = 0; i < part_num_y; i++) {
> + for (int j = 0; j < 4; j++) {
> + coded_res_flag = get_bits1(gb);
> + if (coded_res_flag)
> + for (int c = 0; c < 3; c++) {
> + res_coeff_q = get_ue_golomb_long(gb);
> + bit_depth_cm_input_y = 8 + pps-
> >luma_bit_depth_cm_input_minus8;
> + bit_depth_cm_output_y = 8 + pps-
> >luma_bit_depth_cm_output_minus8;
> + cm_res_bits = FFMAX(0, 10 + bit_depth_cm_input_y -
> bit_depth_cm_output_y -
> + pps->cm_res_quant_bits - (pps-
> >cm_delta_flc_bits_minus1 + 1));
> + res_coeff_r = cm_res_bits ? get_bits(gb, cm_res_bits)
> : 0;
> + if (res_coeff_q || res_coeff_r)
> + skip_bits1(gb);
> + }
> + }
> + }
> +}
>
> +static void colour_mapping_table(GetBitContext *gb, HEVCPPS *pps)
> +{
> + pps->num_cm_ref_layers_minus1 = get_ue_golomb_long(gb);
> + for (int i = 0; i <= pps->num_cm_ref_layers_minus1; i++)
> + pps->cm_ref_layer_id[i] = get_bits(gb, 6);
> +
> + pps->cm_octant_depth = get_bits(gb, 2);
> + pps->cm_y_part_num_log2 = get_bits(gb, 2);
> +
> + pps->luma_bit_depth_cm_input_minus8 = get_ue_golomb_long(gb);
> + pps->chroma_bit_depth_cm_input_minus8 = get_ue_golomb_long(gb);
> + pps->luma_bit_depth_cm_output_minus8 = get_ue_golomb_long(gb);
> + pps->chroma_bit_depth_cm_output_minus8 = get_ue_golomb_long(gb);
> +
> + pps->cm_res_quant_bits = get_bits(gb, 2);
> + pps->cm_delta_flc_bits_minus1 = get_bits(gb, 2);
> +
> + if (pps->cm_octant_depth == 1) {
> + pps->cm_adapt_threshold_u_delta = get_se_golomb_long(gb);
> + pps->cm_adapt_threshold_v_delta = get_se_golomb_long(gb);
> + }
> +
> + colour_mapping_octants(gb, pps, 0, 0, 0, 0, 1 << pps->cm_octant_depth);
> +}
> +
> +static int pps_multilayer_extension(GetBitContext *gb, AVCodecContext *avctx,
> + HEVCPPS *pps, HEVCSPS *sps)
> +{
> + pps->poc_reset_info_present_flag = get_bits1(gb);
> + pps->pps_infer_scaling_list_flag = get_bits1(gb);
> + if (pps->pps_infer_scaling_list_flag)
> + pps->pps_scaling_list_ref_layer_id = get_bits(gb, 6);
> +
> + pps->num_ref_loc_offsets = get_ue_golomb_long(gb);
> + for (int i = 0; i < pps->num_ref_loc_offsets; i++) {
> + pps->ref_loc_offset_layer_id[i] = get_bits(gb, 6);
> + pps->scaled_ref_layer_offset_present_flag[i] = get_bits1(gb);
> + if (pps->scaled_ref_layer_offset_present_flag[i]) {
> + pps->scaled_ref_layer_left_offset[pps-
> >ref_loc_offset_layer_id[i]] = get_se_golomb_long(gb);
> + pps->scaled_ref_layer_top_offset[pps-
> >ref_loc_offset_layer_id[i]] = get_se_golomb_long(gb);
> + pps->scaled_ref_layer_right_offset[pps-
> >ref_loc_offset_layer_id[i]] = get_se_golomb_long(gb);
> + pps->scaled_ref_layer_bottom_offset[pps-
> >ref_loc_offset_layer_id[i]] = get_se_golomb_long(gb);
> + }
> +
> + pps->ref_region_offset_present_flag[i] = get_bits1(gb);
> + if (pps->ref_region_offset_present_flag[i]) {
> + pps->ref_region_left_offset[pps->ref_loc_offset_layer_id[i]] =
> get_se_golomb_long(gb);
> + pps->ref_region_top_offset[pps->ref_loc_offset_layer_id[i]] =
> get_se_golomb_long(gb);
> + pps->ref_region_right_offset[pps->ref_loc_offset_layer_id[i]] =
> get_se_golomb_long(gb);
> + pps->ref_region_bottom_offset[pps->ref_loc_offset_layer_id[i]] =
> get_se_golomb_long(gb);
> + }
> +
> + pps->resample_phase_set_present_flag[i] = get_bits1(gb);
> + if (pps->resample_phase_set_present_flag[i]) {
> + pps->phase_hor_luma[pps->ref_loc_offset_layer_id[i]] =
> get_ue_golomb_long(gb);
> + pps->phase_ver_luma[pps->ref_loc_offset_layer_id[i]] =
> get_ue_golomb_long(gb);
> + pps->phase_hor_chroma_plus8[pps->ref_loc_offset_layer_id[i]] =
> get_ue_golomb_long(gb);
> + pps->phase_ver_chroma_plus8[pps->ref_loc_offset_layer_id[i]] =
> get_ue_golomb_long(gb);
> + }
> + }
> +
> + pps->colour_mapping_enabled_flag = get_bits1(gb);
> + if (pps->colour_mapping_enabled_flag)
> + colour_mapping_table(gb, pps);
> +
> + return 0;
> +}
> +
> +static void delta_dlt(GetBitContext *gb, HEVCPPS *pps)
> +{
> + unsigned int num_val_delta_dlt, max_diff = 0;
> + int min_diff_minus1 = -1;
> + unsigned int len;
> +
> + num_val_delta_dlt = get_bits(gb, pps-
> >pps_bit_depth_for_depth_layers_minus8 + 8);
> + if (num_val_delta_dlt) {
> + if (num_val_delta_dlt > 1)
> + max_diff = get_bits(gb, pps-
> >pps_bit_depth_for_depth_layers_minus8 + 8);
> + if (num_val_delta_dlt > 2 && max_diff) {
> + len = av_log2(max_diff) + 1;
> + min_diff_minus1 = get_bits(gb, len);
> + }
> + if (max_diff > (min_diff_minus1 + 1))
> + for (int k = 1; k < num_val_delta_dlt; k++) {
> + len = av_log2(max_diff - (min_diff_minus1 + 1)) + 1;
> + skip_bits(gb, len); // delta_val_diff_minus_min
> + }
> + }
> +}
> +
> +static int pps_3d_extension(GetBitContext *gb, AVCodecContext *avctx,
> + HEVCPPS *pps, HEVCSPS *sps)
> +{
> + unsigned int pps_depth_layers_minus1;
> + int i, j;
> +
> + if (get_bits1(gb)) { // dlts_present_flag
> + pps_depth_layers_minus1 = get_bits(gb, 6);
> + pps->pps_bit_depth_for_depth_layers_minus8 = get_bits(gb, 4);
> + for (i = 0; i <= pps_depth_layers_minus1; i++) {
Please use the same coding style,
for (int i = 0; ......)
> + if (get_bits1(gb)) { // dlt_flag[i]
> + if (!get_bits1(gb)) { // dlt_pred_flag[i]
> + if (get_bits1(gb)) { // dlt_val_flags_present_flag[i]
> + for (j = 0; j <= ((1 << (pps-
> >pps_bit_depth_for_depth_layers_minus8 + 8)) - 1); j++)
for (int j = 0; ......)
Thanks
Haihao
> + skip_bits1(gb); // dlt_value_flag[i][j]
> + } else
> + delta_dlt(gb, pps);
> + }
> + }
> + }
> + }
> +
> + return 0;
> +}
> +
> +static int pps_range_extensions(GetBitContext *gb, AVCodecContext *avctx,
> + HEVCPPS *pps, HEVCSPS *sps)
> +{
> if (pps->transform_skip_enabled_flag) {
> pps->log2_max_transform_skip_block_size = get_ue_golomb_long(gb) + 2;
> }
> @@ -1282,7 +1489,7 @@ static int pps_range_extensions(GetBitContext *gb,
> AVCodecContext *avctx,
> "chroma_qp_offset_list_len_minus1 shall be in the range
> [0, 5].\n");
> return AVERROR_INVALIDDATA;
> }
> - for (i = 0; i <= pps->chroma_qp_offset_list_len_minus1; i++) {
> + for (int i = 0; i <= pps->chroma_qp_offset_list_len_minus1; i++) {
> pps->cb_qp_offset_list[i] = get_se_golomb_long(gb);
> if (pps->cb_qp_offset_list[i]) {
> av_log(avctx, AV_LOG_WARNING,
> @@ -1306,6 +1513,47 @@ static int pps_range_extensions(GetBitContext *gb,
> AVCodecContext *avctx,
> return(0);
> }
>
> +static int pps_scc_extension(GetBitContext *gb, AVCodecContext *avctx,
> + HEVCPPS *pps, HEVCSPS *sps)
> +{
> + int num_comps, ret;
> +
> + pps->pps_curr_pic_ref_enabled_flag = get_bits1(gb);
> + if (pps->residual_adaptive_colour_transform_enabled_flag = get_bits1(gb))
> {
> + pps->pps_slice_act_qp_offsets_present_flag = get_bits1(gb);
> + pps->pps_act_y_qp_offset = get_se_golomb_long(gb) - 5;
> + pps->pps_act_cb_qp_offset = get_se_golomb_long(gb) - 5;
> + pps->pps_act_cr_qp_offset = get_se_golomb_long(gb) - 3;
> +
> +#define CHECK_QP_OFFSET(name) (pps->pps_act_ ## name ## _qp_offset <= -12 ||
> \
> + pps->pps_act_ ## name ## _qp_offset >= 12)
> + ret = CHECK_QP_OFFSET(y) || CHECK_QP_OFFSET(cb) ||
> CHECK_QP_OFFSET(cr);
> +#undef CHECK_QP_OFFSET
> + if (ret) {
> + av_log(avctx, AV_LOG_ERROR,
> + "PpsActQpOffsetY/Cb/Cr shall be in the range of [-12,
> 12].\n");
> + return AVERROR_INVALIDDATA;
> + }
> + }
> +
> + if (pps->pps_palette_predictor_initializers_present_flag = get_bits1(gb))
> {
> + if ((pps->pps_num_palette_predictor_initializers =
> get_ue_golomb_long(gb)) > 0) {
> + pps->monochrome_palette_flag = get_bits1(gb);
> + pps->luma_bit_depth_entry_minus8 = get_ue_golomb_long(gb);
> + if (!pps->monochrome_palette_flag)
> + pps->chroma_bit_depth_entry_minus8 = get_ue_golomb_long(gb);
> + num_comps = pps->monochrome_palette_flag ? 1 : 3;
> + for (int comp = 0; comp < num_comps; comp++)
> + for (int i = 0; i < pps-
> >pps_num_palette_predictor_initializers; i++)
> + pps->pps_palette_predictor_initializer[comp][i] =
> + get_bits(gb, 8 + (!comp ? pps-
> >luma_bit_depth_entry_minus8 :
> + pps-
> >chroma_bit_depth_entry_minus8));
> + }
> + }
> +
> + return 0;
> +}
> +
> static inline int setup_pps(AVCodecContext *avctx, GetBitContext *gb,
> HEVCPPS *pps, HEVCSPS *sps)
> {
> @@ -1658,12 +1906,31 @@ int ff_hevc_decode_nal_pps(GetBitContext *gb,
> AVCodecContext *avctx,
> pps->slice_header_extension_present_flag = get_bits1(gb);
>
> if (get_bits1(gb)) { // pps_extension_present_flag
> - pps->pps_range_extensions_flag = get_bits1(gb);
> - skip_bits(gb, 7); // pps_extension_7bits
> + pps->pps_range_extensions_flag = get_bits1(gb);
> + pps->pps_multilayer_extension_flag = get_bits1(gb);
> + pps->pps_3d_extension_flag = get_bits1(gb);
> + pps->pps_scc_extension_flag = get_bits1(gb);
> + skip_bits(gb, 4); // pps_extension_4bits
> +
> if (pps->pps_range_extensions_flag) {
> if ((ret = pps_range_extensions(gb, avctx, pps, sps)) < 0)
> goto err;
> }
> +
> + if (pps->pps_multilayer_extension_flag) {
> + if ((ret = pps_multilayer_extension(gb, avctx, pps, sps)) < 0)
> + goto err;
> + }
> +
> + if (pps->pps_3d_extension_flag) {
> + if ((ret = pps_3d_extension(gb, avctx, pps, sps)) < 0)
> + goto err;
> + }
> +
> + if (pps->pps_scc_extension_flag) {
> + if ((ret = pps_scc_extension(gb, avctx, pps, sps)) < 0)
> + goto err;
> + }
> }
>
> ret = setup_pps(avctx, gb, pps, sps);
> @@ -1671,9 +1938,8 @@ int ff_hevc_decode_nal_pps(GetBitContext *gb,
> AVCodecContext *avctx,
> goto err;
>
> if (get_bits_left(gb) < 0) {
> - av_log(avctx, AV_LOG_ERROR,
> + av_log(avctx, AV_LOG_WARNING,
> "Overread PPS by %d bits\n", -get_bits_left(gb));
> - goto err;
> }
>
> remove_pps(ps, pps_id);
> diff --git a/libavcodec/hevc_ps.h b/libavcodec/hevc_ps.h
> index 18894cfed1..1f704108e3 100644
> --- a/libavcodec/hevc_ps.h
> +++ b/libavcodec/hevc_ps.h
> @@ -210,6 +210,20 @@ typedef struct HEVCSPS {
> int persistent_rice_adaptation_enabled_flag;
> int cabac_bypass_alignment_enabled_flag;
>
> + int sps_multilayer_extension_flag;
> + int sps_3d_extension_flag;
> +
> + int sps_scc_extension_flag;
> + int sps_curr_pic_ref_enabled_flag;
> + int palette_mode_enabled_flag;
> + int palette_max_size;
> + int delta_palette_max_predictor_size;
> + int sps_palette_predictor_initializers_present_flag;
> + int sps_num_palette_predictor_initializers_minus1;
> + int
> sps_palette_predictor_initializer[3][HEVC_MAX_PALETTE_PREDICTOR_SIZE];
> + int motion_vector_resolution_control_idc;
> + int intra_boundary_filtering_disabled_flag;
> +
> ///< coded frame dimension in various units
> int width;
> int height;
> @@ -284,6 +298,9 @@ typedef struct HEVCPPS {
> uint8_t slice_header_extension_present_flag;
> uint8_t log2_max_transform_skip_block_size;
> uint8_t pps_range_extensions_flag;
> + uint8_t pps_multilayer_extension_flag;
> + uint8_t pps_3d_extension_flag;
> + uint8_t pps_scc_extension_flag;
> uint8_t cross_component_prediction_enabled_flag;
> uint8_t chroma_qp_offset_list_enabled_flag;
> uint8_t diff_cu_chroma_qp_offset_depth;
> @@ -293,6 +310,58 @@ typedef struct HEVCPPS {
> uint8_t log2_sao_offset_scale_luma;
> uint8_t log2_sao_offset_scale_chroma;
>
> + // Multilayer extension parameters
> + uint8_t poc_reset_info_present_flag;
> + uint8_t pps_infer_scaling_list_flag;
> + uint8_t pps_scaling_list_ref_layer_id;
> + uint16_t num_ref_loc_offsets;
> + uint8_t ref_loc_offset_layer_id[64];
> + uint8_t scaled_ref_layer_offset_present_flag[64];
> + int8_t scaled_ref_layer_left_offset[64];
> + int8_t scaled_ref_layer_top_offset[64];
> + int8_t scaled_ref_layer_right_offset[64];
> + int8_t scaled_ref_layer_bottom_offset[64];
> + uint8_t ref_region_offset_present_flag[64];
> + int8_t ref_region_left_offset[64];
> + int8_t ref_region_top_offset[64];
> + int8_t ref_region_right_offset[64];
> + int8_t ref_region_bottom_offset[64];
> + uint8_t resample_phase_set_present_flag[64];
> + uint16_t phase_hor_luma[64];
> + uint16_t phase_ver_luma[64];
> + uint16_t phase_hor_chroma_plus8[64];
> + uint16_t phase_ver_chroma_plus8[64];
> + uint8_t colour_mapping_enabled_flag;
> + uint16_t num_cm_ref_layers_minus1;
> + uint8_t cm_ref_layer_id[63];
> + uint8_t cm_octant_depth;
> + uint8_t cm_y_part_num_log2;
> + uint16_t luma_bit_depth_cm_input_minus8;
> + uint16_t chroma_bit_depth_cm_input_minus8;
> + uint16_t luma_bit_depth_cm_output_minus8;
> + uint16_t chroma_bit_depth_cm_output_minus8;
> + uint8_t cm_res_quant_bits;
> + uint8_t cm_delta_flc_bits_minus1;
> + int8_t cm_adapt_threshold_u_delta;
> + int8_t cm_adapt_threshold_v_delta;
> +
> + // 3D extension parameters
> + uint8_t pps_bit_depth_for_depth_layers_minus8;
> +
> + // SCC extension parameters
> + uint8_t pps_curr_pic_ref_enabled_flag;
> + uint8_t residual_adaptive_colour_transform_enabled_flag;
> + uint8_t pps_slice_act_qp_offsets_present_flag;
> + int8_t pps_act_y_qp_offset; // _plus5
> + int8_t pps_act_cb_qp_offset; // _plus5
> + int8_t pps_act_cr_qp_offset; // _plus3
> + uint8_t pps_palette_predictor_initializers_present_flag;
> + uint8_t pps_num_palette_predictor_initializers;
> + uint8_t monochrome_palette_flag;
> + uint8_t luma_bit_depth_entry_minus8;
> + uint8_t chroma_bit_depth_entry_minus8;
> + uint8_t
> pps_palette_predictor_initializer[3][HEVC_MAX_PALETTE_PREDICTOR_SIZE];
> +
> // Inferred parameters
> unsigned int *column_width; ///< ColumnWidth
> unsigned int *row_height; ///< RowHeight
_______________________________________________
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] 19+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 08/13] lavc/vaapi_hevc: Pass SCC parameters Through VA-API
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 08/13] lavc/vaapi_hevc: Pass SCC parameters Through VA-API Fei Wang
@ 2023-01-03 6:56 ` Xiang, Haihao
0 siblings, 0 replies; 19+ messages in thread
From: Xiang, Haihao @ 2023-01-03 6:56 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: linjie.justin.fu, Wang, Fei W, linjie.fu
On Ma, 2022-12-05 at 14:09 +0800, Fei Wang wrote:
> From: Linjie Fu <linjie.fu@intel.com>
>
> Including sps/pps/slice parameters.
>
> Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
> Signed-off-by: Fei Wang <fei.w.wang@intel.com>
> ---
> libavcodec/vaapi_hevc.c | 52 +++++++++++++++++++++++++++++++++++++----
> 1 file changed, 47 insertions(+), 5 deletions(-)
>
> diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c
> index 20fb36adfa..750738d36e 100644
> --- a/libavcodec/vaapi_hevc.c
> +++ b/libavcodec/vaapi_hevc.c
> @@ -124,7 +124,7 @@ static int
> vaapi_hevc_start_frame(AVCodecContext *avctx,
> const HEVCPPS *pps = h->ps.pps;
>
> const ScalingList *scaling_list = NULL;
> - int pic_param_size, err, i;
> + int pic_param_size, num_comps, pre_palette_size, err, i;
>
> VAPictureParameterBufferHEVC *pic_param = (VAPictureParameterBufferHEVC
> *)&pic->pic_param;
>
> @@ -245,8 +245,46 @@ static int
> vaapi_hevc_start_frame(AVCodecContext *avctx,
> for (i = 0; i < 6; i++)
> pic->pic_param.rext.cr_qp_offset_list[i] = pps-
> >cr_qp_offset_list[i];
> }
> +
> + pre_palette_size = pps->pps_palette_predictor_initializers_present_flag ?
> + pps->pps_num_palette_predictor_initializers :
> + (sps->sps_palette_predictor_initializers_present_flag
> ?
> + sps->sps_num_palette_predictor_initializers_minus1 + 1
> :
> + 0);
> +
> + if (avctx->profile == FF_PROFILE_HEVC_SCC) {
> + pic->pic_param.scc = (VAPictureParameterBufferHEVCScc) {
> + .screen_content_pic_fields.bits = {
> + .pps_curr_pic_ref_enabled_flag = pps-
> >pps_curr_pic_ref_enabled_flag,
> + .palette_mode_enabled_flag = sps-
> >palette_mode_enabled_flag,
> + .motion_vector_resolution_control_idc = sps-
> >motion_vector_resolution_control_idc,
> + .intra_boundary_filtering_disabled_flag = sps-
> >intra_boundary_filtering_disabled_flag,
> + .residual_adaptive_colour_transform_enabled_flag
> + = pps-
> >residual_adaptive_colour_transform_enabled_flag,
> + .pps_slice_act_qp_offsets_present_flag = pps-
> >pps_slice_act_qp_offsets_present_flag,
> + },
> + .palette_max_size = sps-
> >palette_max_size,
> + .delta_palette_max_predictor_size = sps-
> >delta_palette_max_predictor_size,
> + .predictor_palette_size =
> pre_palette_size,
> + .pps_act_y_qp_offset_plus5 = pps-
> >residual_adaptive_colour_transform_enabled_flag ?
> + pps-
> >pps_act_y_qp_offset + 5 : 0,
> + .pps_act_cb_qp_offset_plus5 = pps-
> >residual_adaptive_colour_transform_enabled_flag ?
> + pps-
> >pps_act_cb_qp_offset + 5 : 0,
> + .pps_act_cr_qp_offset_plus3 = pps-
> >residual_adaptive_colour_transform_enabled_flag ?
> + pps-
> >pps_act_cr_qp_offset + 3 : 0,
> + };
> +
> + num_comps = pps->monochrome_palette_flag ? 1 : 3;
> + for (int comp = 0; comp < num_comps; comp++)
> + for (i = 0; i < pre_palette_size; i++)
for (int i = 0; ......)
Thanks
Haihao
> + pic->pic_param.scc.predictor_palette_entries[comp][i] =
> + pps->pps_palette_predictor_initializers_present_flag ?
> + pps->pps_palette_predictor_initializer[comp][i]:
> + sps->sps_palette_predictor_initializer[comp][i];
> + }
> +
> #endif
> - pic_param_size = avctx->profile == FF_PROFILE_HEVC_REXT ?
> + pic_param_size = avctx->profile >= FF_PROFILE_HEVC_REXT ?
> sizeof(pic->pic_param) :
> sizeof(VAPictureParameterBufferHEVC);
>
> err = ff_vaapi_decode_make_param_buffer(avctx, &pic->pic,
> @@ -299,7 +337,7 @@ static int vaapi_hevc_end_frame(AVCodecContext *avctx)
> VASliceParameterBufferHEVC *last_slice_param =
> (VASliceParameterBufferHEVC *)&pic->last_slice_param;
> int ret;
>
> - int slice_param_size = avctx->profile == FF_PROFILE_HEVC_REXT ?
> + int slice_param_size = avctx->profile >= FF_PROFILE_HEVC_REXT ?
> sizeof(pic->last_slice_param) :
> sizeof(VASliceParameterBufferHEVC);
>
> if (pic->last_size) {
> @@ -413,7 +451,7 @@ static int vaapi_hevc_decode_slice(AVCodecContext *avctx,
> VAAPIDecodePictureHEVC *pic = h->ref->hwaccel_picture_private;
> VASliceParameterBufferHEVC *last_slice_param =
> (VASliceParameterBufferHEVC *)&pic->last_slice_param;
>
> - int slice_param_size = avctx->profile == FF_PROFILE_HEVC_REXT ?
> + int slice_param_size = avctx->profile >= FF_PROFILE_HEVC_REXT ?
> sizeof(pic->last_slice_param) :
> sizeof(VASliceParameterBufferHEVC);
>
> int nb_list = (sh->slice_type == HEVC_SLICE_B) ?
> @@ -478,11 +516,15 @@ static int vaapi_hevc_decode_slice(AVCodecContext
> *avctx,
> fill_pred_weight_table(avctx, h, sh, last_slice_param);
>
> #if VA_CHECK_VERSION(1, 2, 0)
> - if (avctx->profile == FF_PROFILE_HEVC_REXT) {
> + if (avctx->profile >= FF_PROFILE_HEVC_REXT) {
> pic->last_slice_param.rext = (VASliceParameterBufferHEVCRext) {
> .slice_ext_flags.bits = {
> .cu_chroma_qp_offset_enabled_flag = sh-
> >cu_chroma_qp_offset_enabled_flag,
> + .use_integer_mv_flag = sh->use_integer_mv_flag,
> },
> + .slice_act_y_qp_offset = sh->slice_act_y_qp_offset,
> + .slice_act_cb_qp_offset = sh->slice_act_cb_qp_offset,
> + .slice_act_cr_qp_offset = sh->slice_act_cr_qp_offset,
> };
> for (i = 0; i < 15 && i < sh->nb_refs[L0]; i++) {
> pic->last_slice_param.rext.luma_offset_l0[i] = sh-
> >luma_offset_l0[i];
_______________________________________________
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] 19+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 09/13] lavc/vaapi_hevc: Add vaapi profile parse support for SCC
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 09/13] lavc/vaapi_hevc: Add vaapi profile parse support for SCC Fei Wang
@ 2023-01-03 7:08 ` Xiang, Haihao
2023-01-03 13:01 ` Wang, Fei W
0 siblings, 1 reply; 19+ messages in thread
From: Xiang, Haihao @ 2023-01-03 7:08 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: linjie.justin.fu, Wang, Fei W, linjie.fu
On Ma, 2022-12-05 at 14:09 +0800, Fei Wang wrote:
> From: Linjie Fu <linjie.fu@intel.com>
>
> Note that Screen-Extended Main 4:4:4 and 4:4:4 10 supports
> chroma_format_idc from 0, 1 or 3, hence both 420 and 444 are
> supported.
>
> Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
> Signed-off-by: Fei Wang <fei.w.wang@intel.com>
> ---
> libavcodec/vaapi_decode.c | 4 +++-
> libavcodec/vaapi_hevc.c | 14 ++++++++++++--
> libavcodec/vaapi_hevc.h | 2 +-
> 3 files changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c
> index 134f10eca5..29ac439b36 100644
> --- a/libavcodec/vaapi_decode.c
> +++ b/libavcodec/vaapi_decode.c
> @@ -410,7 +410,9 @@ static const struct {
> #endif
> #if VA_CHECK_VERSION(1, 2, 0) && CONFIG_HEVC_VAAPI_HWACCEL
> MAP(HEVC, HEVC_REXT, None,
> - ff_vaapi_parse_hevc_rext_profile ),
> + ff_vaapi_parse_hevc_profile ),
> + MAP(HEVC, HEVC_SCC, None,
> + ff_vaapi_parse_hevc_profile ),
> #endif
> MAP(MJPEG, MJPEG_HUFFMAN_BASELINE_DCT,
> JPEGBaseline),
> diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c
> index 750738d36e..6ce1e17fa8 100644
> --- a/libavcodec/vaapi_hevc.c
> +++ b/libavcodec/vaapi_hevc.c
> @@ -586,9 +586,9 @@ static int ptl_convert(const PTLCommon *general_ptl,
> H265RawProfileTierLevel *h2
> }
>
> /*
> - * Find exact va_profile for HEVC Range Extension
> + * Find exact va_profile for HEVC Range Extension and Screen Content Coding
> Extension
> */
> -VAProfile ff_vaapi_parse_hevc_rext_profile(AVCodecContext *avctx)
> +VAProfile ff_vaapi_parse_hevc_profile(AVCodecContext *avctx)
It sounds to me the new function is for all hevc profiles, how about to use
ff_vaapi_parse_hevc_rext_scc_profile instead ?
Thanks
Haihao
> @@ -627,6 +627,16 @@ VAProfile ff_vaapi_parse_hevc_rext_profile(AVCodecContext
> *avctx)
> else if (!strcmp(profile->name, "Main 4:4:4 12") ||
> !strcmp(profile->name, "Main 4:4:4 12 Intra"))
> return VAProfileHEVCMain444_12;
> + else if (!strcmp(profile->name, "Screen-Extended Main"))
> + return VAProfileHEVCSccMain;
> + else if (!strcmp(profile->name, "Screen-Extended Main 10"))
> + return VAProfileHEVCSccMain10;
> + else if (!strcmp(profile->name, "Screen-Extended Main 4:4:4"))
> + return VAProfileHEVCSccMain444;
> +#if VA_CHECK_VERSION(1, 8, 0)
> + else if (!strcmp(profile->name, "Screen-Extended Main 4:4:4 10"))
> + return VAProfileHEVCSccMain444_10;
> +#endif
> #else
> av_log(avctx, AV_LOG_WARNING, "HEVC profile %s is "
> "not supported with this VA version.\n", profile->name);
> diff --git a/libavcodec/vaapi_hevc.h b/libavcodec/vaapi_hevc.h
> index b3b0e6fc1e..7662dca510 100644
> --- a/libavcodec/vaapi_hevc.h
> +++ b/libavcodec/vaapi_hevc.h
> @@ -22,6 +22,6 @@
> #include <va/va.h>
> #include "avcodec.h"
>
> -VAProfile ff_vaapi_parse_hevc_rext_profile(AVCodecContext *avctx);
> +VAProfile ff_vaapi_parse_hevc_profile(AVCodecContext *avctx);
>
> #endif /* AVCODEC_VAAPI_HEVC_H */
_______________________________________________
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] 19+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 09/13] lavc/vaapi_hevc: Add vaapi profile parse support for SCC
2023-01-03 7:08 ` Xiang, Haihao
@ 2023-01-03 13:01 ` Wang, Fei W
0 siblings, 0 replies; 19+ messages in thread
From: Wang, Fei W @ 2023-01-03 13:01 UTC (permalink / raw)
To: ffmpeg-devel, Xiang, Haihao; +Cc: linjie.justin.fu, linjie.fu
On Tue, 2023-01-03 at 07:08 +0000, Xiang, Haihao wrote:
> On Ma, 2022-12-05 at 14:09 +0800, Fei Wang wrote:
> > From: Linjie Fu <linjie.fu@intel.com>
> >
> > Note that Screen-Extended Main 4:4:4 and 4:4:4 10 supports
> > chroma_format_idc from 0, 1 or 3, hence both 420 and 444 are
> > supported.
> >
> > Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
> > Signed-off-by: Fei Wang <fei.w.wang@intel.com>
> > ---
> > libavcodec/vaapi_decode.c | 4 +++-
> > libavcodec/vaapi_hevc.c | 14 ++++++++++++--
> > libavcodec/vaapi_hevc.h | 2 +-
> > 3 files changed, 16 insertions(+), 4 deletions(-)
> >
> > diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c
> > index 134f10eca5..29ac439b36 100644
> > --- a/libavcodec/vaapi_decode.c
> > +++ b/libavcodec/vaapi_decode.c
> > @@ -410,7 +410,9 @@ static const struct {
> > #endif
> > #if VA_CHECK_VERSION(1, 2, 0) && CONFIG_HEVC_VAAPI_HWACCEL
> > MAP(HEVC, HEVC_REXT, None,
> > - ff_vaapi_parse_hevc_rext_profile ),
> > + ff_vaapi_parse_hevc_profile ),
> > + MAP(HEVC, HEVC_SCC, None,
> > + ff_vaapi_parse_hevc_profile ),
> > #endif
> > MAP(MJPEG, MJPEG_HUFFMAN_BASELINE_DCT,
> > JPEGBaseline),
> > diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c
> > index 750738d36e..6ce1e17fa8 100644
> > --- a/libavcodec/vaapi_hevc.c
> > +++ b/libavcodec/vaapi_hevc.c
> > @@ -586,9 +586,9 @@ static int ptl_convert(const PTLCommon
> > *general_ptl,
> > H265RawProfileTierLevel *h2
> > }
> >
> > /*
> > - * Find exact va_profile for HEVC Range Extension
> > + * Find exact va_profile for HEVC Range Extension and Screen
> > Content Coding
> > Extension
> > */
> > -VAProfile ff_vaapi_parse_hevc_rext_profile(AVCodecContext *avctx)
> > +VAProfile ff_vaapi_parse_hevc_profile(AVCodecContext *avctx)
>
> It sounds to me the new function is for all hevc profiles, how about
> to use
> ff_vaapi_parse_hevc_rext_scc_profile instead ?
Fixed in V3. Thanks.
Fei
>
> Thanks
> Haihao
>
>
> > @@ -627,6 +627,16 @@ VAProfile
> > ff_vaapi_parse_hevc_rext_profile(AVCodecContext
> > *avctx)
> > else if (!strcmp(profile->name, "Main 4:4:4 12") ||
> > !strcmp(profile->name, "Main 4:4:4 12 Intra"))
> > return VAProfileHEVCMain444_12;
> > + else if (!strcmp(profile->name, "Screen-Extended Main"))
> > + return VAProfileHEVCSccMain;
> > + else if (!strcmp(profile->name, "Screen-Extended Main 10"))
> > + return VAProfileHEVCSccMain10;
> > + else if (!strcmp(profile->name, "Screen-Extended Main 4:4:4"))
> > + return VAProfileHEVCSccMain444;
> > +#if VA_CHECK_VERSION(1, 8, 0)
> > + else if (!strcmp(profile->name, "Screen-Extended Main 4:4:4
> > 10"))
> > + return VAProfileHEVCSccMain444_10;
> > +#endif
> > #else
> > av_log(avctx, AV_LOG_WARNING, "HEVC profile %s is "
> > "not supported with this VA version.\n", profile-
> > >name);
> > diff --git a/libavcodec/vaapi_hevc.h b/libavcodec/vaapi_hevc.h
> > index b3b0e6fc1e..7662dca510 100644
> > --- a/libavcodec/vaapi_hevc.h
> > +++ b/libavcodec/vaapi_hevc.h
> > @@ -22,6 +22,6 @@
> > #include <va/va.h>
> > #include "avcodec.h"
> >
> > -VAProfile ff_vaapi_parse_hevc_rext_profile(AVCodecContext *avctx);
> > +VAProfile ff_vaapi_parse_hevc_profile(AVCodecContext *avctx);
> >
> > #endif /* AVCODEC_VAAPI_HEVC_H */
_______________________________________________
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] 19+ messages in thread
end of thread, other threads:[~2023-01-03 13:02 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-05 6:09 [FFmpeg-devel] [PATCH v2 01/13] lavc/hevc_ps: remove profile limitation of pps_range_extensions() Fei Wang
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 02/13] lavc/avcodec: Add HEVC Screen Content Coding Extensions profile Fei Wang
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 03/13] lavc/hevc_ps: Add SPS/PPS parse support for HEVC extension syntax Fei Wang
2023-01-03 6:20 ` Xiang, Haihao
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 04/13] lavc/hevcdec: Add slice parse support for HEVC SCC extension Fei Wang
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 05/13] lavc/hevcdec: Fix the parsing for use_integer_mv_flag Fei Wang
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 06/13] lavc/hevcdec: Set max_num_merge_cand to uint8_t Fei Wang
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 07/13] lavc/hevc: Update reference list for SCC Fei Wang
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 08/13] lavc/vaapi_hevc: Pass SCC parameters Through VA-API Fei Wang
2023-01-03 6:56 ` Xiang, Haihao
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 09/13] lavc/vaapi_hevc: Add vaapi profile parse support for SCC Fei Wang
2023-01-03 7:08 ` Xiang, Haihao
2023-01-03 13:01 ` Wang, Fei W
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 10/13] lavc/vaapi_hevc: Set correct rps type for scc Fei Wang
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 11/13] lavc/vaapi_hevc: Loose the restricts for SCC decoding Fei Wang
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 12/13] avcodec/hevcdec: Replace number with enum Fei Wang
2022-12-05 6:09 ` [FFmpeg-devel] [PATCH v2 13/13] lavc/vaapi_hevc: Remove duplicate code Fei Wang
2022-12-22 2:15 ` Wang, Fei W
2022-12-14 2:19 ` [FFmpeg-devel] [PATCH v2 01/13] lavc/hevc_ps: remove profile limitation of pps_range_extensions() Wang, Fei W
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