1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

cbs_h265: Add PTL parsing for sublayers

With fate test using the SLPPLP_A_VIDYO_2 conformance file, which contains
two sublayers with full PTL information.
This commit is contained in:
Mark Thompson 2018-10-27 22:01:16 +01:00
parent fd1d735c0b
commit 252e79663d
4 changed files with 85 additions and 5 deletions

View File

@ -71,7 +71,31 @@ typedef struct H265RawProfileTierLevel {
uint8_t sub_layer_profile_present_flag[HEVC_MAX_SUB_LAYERS];
uint8_t sub_layer_level_present_flag[HEVC_MAX_SUB_LAYERS];
// TODO: much of that again for each sub-layer.
uint8_t sub_layer_profile_space[HEVC_MAX_SUB_LAYERS];
uint8_t sub_layer_tier_flag[HEVC_MAX_SUB_LAYERS];
uint8_t sub_layer_profile_idc[HEVC_MAX_SUB_LAYERS];
uint8_t sub_layer_profile_compatibility_flag[HEVC_MAX_SUB_LAYERS][32];
uint8_t sub_layer_progressive_source_flag[HEVC_MAX_SUB_LAYERS];
uint8_t sub_layer_interlaced_source_flag[HEVC_MAX_SUB_LAYERS];
uint8_t sub_layer_non_packed_constraint_flag[HEVC_MAX_SUB_LAYERS];
uint8_t sub_layer_frame_only_constraint_flag[HEVC_MAX_SUB_LAYERS];
uint8_t sub_layer_max_12bit_constraint_flag[HEVC_MAX_SUB_LAYERS];
uint8_t sub_layer_max_10bit_constraint_flag[HEVC_MAX_SUB_LAYERS];
uint8_t sub_layer_max_8bit_constraint_flag[HEVC_MAX_SUB_LAYERS];
uint8_t sub_layer_max_422chroma_constraint_flag[HEVC_MAX_SUB_LAYERS];
uint8_t sub_layer_max_420chroma_constraint_flag[HEVC_MAX_SUB_LAYERS];
uint8_t sub_layer_max_monochrome_constraint_flag[HEVC_MAX_SUB_LAYERS];
uint8_t sub_layer_intra_constraint_flag[HEVC_MAX_SUB_LAYERS];
uint8_t sub_layer_one_picture_only_constraint_flag[HEVC_MAX_SUB_LAYERS];
uint8_t sub_layer_lower_bit_rate_constraint_flag[HEVC_MAX_SUB_LAYERS];
uint8_t sub_layer_max_14bit_constraint_flag[HEVC_MAX_SUB_LAYERS];
uint8_t sub_layer_inbld_flag[HEVC_MAX_SUB_LAYERS];
uint8_t sub_layer_level_idc[HEVC_MAX_SUB_LAYERS];
} H265RawProfileTierLevel;
typedef struct H265RawSubLayerHRDParameters {

View File

@ -163,10 +163,64 @@ static int FUNC(profile_tier_level)(CodedBitstreamContext *ctx, RWContext *rw,
}
for (i = 0; i < max_num_sub_layers_minus1; i++) {
if (current->sub_layer_profile_present_flag[i])
return AVERROR_PATCHWELCOME;
if (current->sub_layer_profile_present_flag[i]) {
us(2, sub_layer_profile_space[i], 0, 0, 1, i);
flags(sub_layer_tier_flag[i], 1, i);
us(5, sub_layer_profile_idc[i], 0, 31, 1, i);
for (j = 0; j < 32; j++)
flags(sub_layer_profile_compatibility_flag[i][j], 2, i, j);
flags(sub_layer_progressive_source_flag[i], 1, i);
flags(sub_layer_interlaced_source_flag[i], 1, i);
flags(sub_layer_non_packed_constraint_flag[i], 1, i);
flags(sub_layer_frame_only_constraint_flag[i], 1, i);
#define profile_compatible(x) (current->sub_layer_profile_idc[i] == (x) || \
current->sub_layer_profile_compatibility_flag[i][x])
if (profile_compatible(4) || profile_compatible(5) ||
profile_compatible(6) || profile_compatible(7) ||
profile_compatible(8) || profile_compatible(9) ||
profile_compatible(10)) {
flags(sub_layer_max_12bit_constraint_flag[i], 1, i);
flags(sub_layer_max_10bit_constraint_flag[i], 1, i);
flags(sub_layer_max_8bit_constraint_flag[i], 1, i);
flags(sub_layer_max_422chroma_constraint_flag[i], 1, i);
flags(sub_layer_max_420chroma_constraint_flag[i], 1, i);
flags(sub_layer_max_monochrome_constraint_flag[i], 1, i);
flags(sub_layer_intra_constraint_flag[i], 1, i);
flags(sub_layer_one_picture_only_constraint_flag[i], 1, i);
flags(sub_layer_lower_bit_rate_constraint_flag[i], 1, i);
if (profile_compatible(5)) {
flags(sub_layer_max_14bit_constraint_flag[i], 1, i);
fixed(24, sub_layer_reserved_zero_33bits, 0);
fixed( 9, sub_layer_reserved_zero_33bits, 0);
} else {
fixed(24, sub_layer_reserved_zero_34bits, 0);
fixed(10, sub_layer_reserved_zero_34bits, 0);
}
} else if (profile_compatible(2)) {
fixed(7, sub_layer_reserved_zero_7bits, 0);
flags(sub_layer_one_picture_only_constraint_flag[i], 1, i);
fixed(24, sub_layer_reserved_zero_43bits, 0);
fixed(11, sub_layer_reserved_zero_43bits, 0);
} else {
fixed(24, sub_layer_reserved_zero_43bits, 0);
fixed(19, sub_layer_reserved_zero_43bits, 0);
}
if (profile_compatible(1) || profile_compatible(2) ||
profile_compatible(3) || profile_compatible(4) ||
profile_compatible(5) || profile_compatible(9)) {
flags(sub_layer_inbld_flag[i], 1, i);
} else {
fixed(1, sub_layer_reserved_zero_bit, 0);
}
#undef profile_compatible
}
if (current->sub_layer_level_present_flag[i])
return AVERROR_PATCHWELCOME;
us(8, sub_layer_level_idc[i], 0, 255, 1, i);
}
return 0;

View File

@ -61,7 +61,8 @@ FATE_CBS_HEVC_SAMPLES = \
LTRPSPS_A_Qualcomm_1.bit \
RPLM_A_qualcomm_4.bit \
CONFWIN_A_Sony_1.bit \
HRD_A_Fujitsu_2.bit
HRD_A_Fujitsu_2.bit \
SLPPLP_A_VIDYO_2.bit
$(foreach N,$(FATE_CBS_HEVC_SAMPLES),$(eval $(call FATE_CBS_TEST,hevc,$(basename $(N)),hevc-conformance/$(N),hevc)))

View File

@ -0,0 +1 @@
e5309cf061c06496f8fe2b8b313e6c39