Go to the documentation of this file.
132 ptl->ptl_frame_only_constraint_flag;
138 if (
ptl->gci_present_flag) {
141 &
ptl->gci_general_constraints[0],
sizeof(uint8_t) * 9);
159 ptl->ptl_sublayer_level_present_flag[
i];
163 ptl->sublayer_level_idc[
i]);
179 ptl->general_sub_profile_idc[
i];
186 unsigned int profileTierPresentFlag,
187 unsigned int max_sub_layers_minus1)
192 if (profileTierPresentFlag) {
200 if (profileTierPresentFlag) {
203 for (j = 0; j < 8; j++)
210 while (gb->
index % 8 != 0)
214 for (
int i = max_sub_layers_minus1 - 1;
i >= 0;
i--)
217 while (gb->
index % 8 != 0)
220 for (
int i = max_sub_layers_minus1 - 1;
i >= 0;
i--) {
225 if (profileTierPresentFlag) {
239 unsigned int vps_max_layers_minus1;
240 unsigned int vps_max_sublayers_minus1;
241 unsigned int vps_default_ptl_dpb_hrd_max_tid_flag;
242 unsigned int vps_all_independent_layers_flag;
243 unsigned int vps_each_layer_is_an_ols_flag;
244 unsigned int vps_ols_mode_idc;
248 unsigned int vps_num_ptls_minus1 = 0;
255 vps_max_layers_minus1 =
get_bits(gb, 6);
256 vps_max_sublayers_minus1 =
get_bits(gb, 3);
267 vps_max_sublayers_minus1 + 1);
269 if (vps_max_layers_minus1 > 0 && vps_max_sublayers_minus1 > 0)
270 vps_default_ptl_dpb_hrd_max_tid_flag =
get_bits1(gb);
272 vps_default_ptl_dpb_hrd_max_tid_flag = 0;
273 if (vps_max_layers_minus1 > 0)
274 vps_all_independent_layers_flag =
get_bits1(gb);
276 vps_all_independent_layers_flag = 1;
278 for (
int i = 0;
i <= vps_max_layers_minus1;
i++) {
280 if (
i > 0 && !vps_all_independent_layers_flag) {
282 unsigned int vps_max_tid_ref_present_flag =
get_bits1(gb);
283 for (
int j = 0; j <
i; j++) {
284 unsigned int vps_direct_ref_layer_flag =
get_bits1(gb);
285 if (vps_max_tid_ref_present_flag && vps_direct_ref_layer_flag)
292 if (vps_max_layers_minus1 > 0) {
293 if (vps_all_independent_layers_flag)
294 vps_each_layer_is_an_ols_flag =
get_bits1(gb);
296 vps_each_layer_is_an_ols_flag = 0;
297 if (!vps_each_layer_is_an_ols_flag) {
298 if (!vps_all_independent_layers_flag)
301 vps_ols_mode_idc = 2;
302 if (vps_ols_mode_idc == 2) {
303 unsigned int vps_num_output_layer_sets_minus2 =
get_bits(gb, 8);
304 for (
int i = 1;
i <= vps_num_output_layer_sets_minus2 + 1;
i++) {
305 for (
int j = 0; j <= vps_max_layers_minus1; j++) {
311 vps_num_ptls_minus1 =
get_bits(gb, 8);
313 vps_each_layer_is_an_ols_flag = 0;
316 for (
int i = 0;
i <= vps_num_ptls_minus1;
i++) {
320 vps_pt_present_flag[
i] = 1;
322 if (!vps_default_ptl_dpb_hrd_max_tid_flag)
325 vps_ptl_max_tid[
i] = vps_max_sublayers_minus1;
328 while (gb->
index % 8 != 0)
331 for (
int i = 0;
i <= vps_num_ptls_minus1;
i++)
342 unsigned int sps_max_sublayers_minus1, sps_log2_ctu_size_minus5;
343 unsigned int sps_subpic_same_size_flag, sps_pic_height_max_in_luma_samples,
344 sps_pic_width_max_in_luma_samples;
345 unsigned int sps_independent_subpics_flag;
348 sps_max_sublayers_minus1 =
get_bits(gb, 3);
359 sps_max_sublayers_minus1 + 1);
362 sps_log2_ctu_size_minus5 =
get_bits(gb, 2);
389 const int ctb_log2_size_y = sps_log2_ctu_size_minus5 + 5;
390 const int ctb_size_y = 1 << ctb_log2_size_y;
391 const int tmp_width_val =
AV_CEIL_RSHIFT(sps_pic_width_max_in_luma_samples, ctb_log2_size_y);
392 const int tmp_height_val =
AV_CEIL_RSHIFT(sps_pic_height_max_in_luma_samples, ctb_log2_size_y);
395 unsigned int sps_subpic_id_len;
396 if (sps_num_subpics_minus1 > 0) {
397 sps_independent_subpics_flag =
get_bits1(gb);
398 sps_subpic_same_size_flag =
get_bits1(gb);
400 for (
int i = 0; sps_num_subpics_minus1 > 0 &&
i <= sps_num_subpics_minus1;
i++) {
401 if (!sps_subpic_same_size_flag ||
i == 0) {
402 if (
i > 0 && sps_pic_width_max_in_luma_samples > ctb_size_y)
404 if (
i > 0 && sps_pic_height_max_in_luma_samples > ctb_size_y)
406 if (i < sps_num_subpics_minus1 && sps_pic_width_max_in_luma_samples > ctb_size_y)
408 if (i < sps_num_subpics_minus1 && sps_pic_height_max_in_luma_samples > ctb_size_y)
411 if (!sps_independent_subpics_flag) {
418 for (
int i = 0;
i <= sps_num_subpics_minus1;
i++) {
455 uint8_t nal_type,
int ps_array_completeness,
482 num_nalus =
array->num_nalus;
494 array->nal_unit[num_nalus] = nal_buf;
495 array->nal_unit_length[num_nalus] = nal_size;
496 array->NAL_unit_type = nal_type;
521 array->array_completeness = ps_array_completeness;
527 int ps_array_completeness,
561 ps_array_completeness, vvcc);
611 uint16_t j, vps_count = 0, sps_count = 0, pps_count = 0;
620 "lengthSizeMinusOne: %" PRIu8
"\n",
623 "ptl_present_flag: %" PRIu8
"\n",
626 "ols_idx: %" PRIu16
"\n", vvcc->
ols_idx);
628 "num_sublayers: %" PRIu8
"\n",
631 "constant_frame_rate: %" PRIu8
"\n",
634 "chroma_format_idc: %" PRIu8
"\n",
638 "bit_depth_minus8: %" PRIu8
"\n",
641 "num_bytes_constraint_info: %" PRIu8
"\n",
644 "general_profile_idc: %" PRIu8
"\n",
647 "general_tier_flag: %" PRIu8
"\n",
650 "general_level_idc: %" PRIu8
"\n",
653 "ptl_frame_only_constraint_flag: %" PRIu8
"\n",
656 "ptl_multilayer_enabled_flag: %" PRIu8
"\n",
660 "general_constraint_info[%d]: %" PRIu8
"\n",
i,
666 "ptl_sublayer_level_present_flag[%" PRIu8
"]: %" PRIu8
"\n",
i,
669 "sublayer_level_idc[%" PRIu8
"]: %" PRIu8
"\n",
i,
674 "num_sub_profiles: %" PRIu8
"\n",
679 "general_sub_profile_idc[%" PRIu8
"]: %" PRIx32
"\n",
i,
684 "max_picture_width: %" PRIu16
"\n",
687 "max_picture_height: %" PRIu16
"\n",
690 "avg_frame_rate: %" PRIu16
"\n",
694 "num_of_arrays: %" PRIu8
"\n",
698 "array_completeness[%" PRIu8
"]: %" PRIu8
"\n",
i,
701 "NAL_unit_type[%" PRIu8
"]: %" PRIu8
"\n",
i,
704 "num_nalus[%" PRIu8
"]: %" PRIu16
"\n",
i,
708 "nal_unit_length[%" PRIu8
"][%" PRIu16
"]: %"
788 uint8_t ptl_sublayer_level_present_flags = 0;
790 ptl_sublayer_level_present_flags =
791 (ptl_sublayer_level_present_flags << 1 | vvcc->
ptl.
792 ptl_sublayer_level_present_flag[
i]);
794 avio_w8(pb, ptl_sublayer_level_present_flags);
854 int size,
int filter_ps,
int *ps_count)
856 int num_ps = 0,
ret = 0;
857 uint8_t *buf, *end, *start =
NULL;
872 while (end - buf > 4) {
874 uint8_t
type = (buf[5] >> 3);
902 int *
size,
int filter_ps,
int *ps_count)
923 int size,
int ps_array_completeness)
926 uint8_t *buf, *end, *start;
932 }
else if ((*
data & 0xf8) == 0xf8) {
950 while (end - buf > 4) {
952 uint8_t
type = (buf[5] >> 3);
uint8_t ptl_frame_only_constraint_flag
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
uint8_t general_level_idc
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
int ff_vvc_annexb2mp4(AVIOContext *pb, const uint8_t *buf_in, int size, int filter_ps, int *ps_count)
Writes Annex B formatted H.266/VVC NAL units to the provided AVIOContext.
uint8_t ptl_num_sub_profiles
int ff_isom_write_vvcc(AVIOContext *pb, const uint8_t *data, int size, int ps_array_completeness)
Writes H.266/VVC extradata (parameter sets, declarative SEI NAL units) to the provided AVIOContext.
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
static int put_bytes_count(const PutBitContext *s, int round_up)
uint8_t ptl_num_sub_profiles
uint8_t general_profile_idc
static void vvcc_close(VVCDecoderConfigurationRecord *vvcc)
uint8_t general_constraint_info[9]
uint8_t constant_frame_rate
static int vvcc_parse_sps(GetBitContext *gb, VVCDecoderConfigurationRecord *vvcc)
static void skip_bits(GetBitContext *s, int n)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
uint8_t general_level_idc
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
uint8_t gci_general_constraints[9]
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
uint8_t sublayer_level_idc[VVC_MAX_SUBLAYERS - 1]
static void vvcc_parse_ptl(GetBitContext *gb, VVCDecoderConfigurationRecord *vvcc, unsigned int profileTierPresentFlag, unsigned int max_sub_layers_minus1)
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
uint8_t sublayer_level_idc[VVC_MAX_SUBLAYERS - 1]
const H265RawProfileTierLevel * ptl
int avio_open_dyn_buf(AVIOContext **s)
Open a write only memory stream.
#define AV_CEIL_RSHIFT(a, b)
uint8_t * ff_nal_unit_extract_rbsp(const uint8_t *src, uint32_t src_len, uint32_t *dst_len, int header_len)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static int vvcc_parse_vps(GetBitContext *gb, VVCDecoderConfigurationRecord *vvcc)
uint8_t ptl_multilayer_enabled_flag
uint8_t chroma_format_idc
uint16_t * nal_unit_length
static unsigned int get_bits1(GetBitContext *s)
int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size)
void avio_w8(AVIOContext *s, int b)
int ff_avc_parse_nal_units(AVIOContext *pb, const uint8_t *buf_in, int size)
int ff_vvc_annexb2mp4_buf(const uint8_t *buf_in, uint8_t **buf_out, int *size, int filter_ps, int *ps_count)
Writes Annex B formatted H.266/VVC NAL units to a data buffer.
static int vvcc_parse_pps(GetBitContext *gb, VVCDecoderConfigurationRecord *vvcc)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
void avio_wb32(AVIOContext *s, unsigned int val)
int av_reallocp_array(void *ptr, size_t nmemb, size_t size)
Allocate, reallocate an array through a pointer to a pointer.
static void skip_bits1(GetBitContext *s)
uint8_t general_level_idc
uint8_t lengthSizeMinusOne
#define i(width, name, range_min, range_max)
uint8_t gci_num_reserved_bits
uint8_t ptl_sublayer_level_present_flag[VVC_MAX_SUBLAYERS - 1]
static int array[MAX_W *MAX_W]
void ffio_free_dyn_buf(AVIOContext **s)
Free a dynamic buffer.
uint32_t general_sub_profile_idc[VVC_MAX_SUB_PROFILES]
static void vvcc_update_ptl(VVCDecoderConfigurationRecord *vvcc, VVCCProfileTierLevel *ptl)
static int vvcc_array_add_nal_unit(uint8_t *nal_buf, uint32_t nal_size, uint8_t nal_type, int ps_array_completeness, VVCDecoderConfigurationRecord *vvcc)
uint8_t num_bytes_constraint_info
void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length)
Copy the content of src to the bitstream.
uint16_t max_picture_height
static void vvcc_init(VVCDecoderConfigurationRecord *vvcc)
uint32_t general_sub_profile_idc[VVC_MAX_SUB_PROFILES]
static int vvcc_write(AVIOContext *pb, VVCDecoderConfigurationRecord *vvcc)
static void nal_unit_parse_header(GetBitContext *gb, uint8_t *nal_type)
static unsigned get_ue_golomb_long(GetBitContext *gb)
Read an unsigned Exp-Golomb code in the range 0 to UINT32_MAX-1.
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
uint8_t ptl_sublayer_level_present_flag[VVC_MAX_SUBLAYERS - 1]
uint16_t max_picture_width
void avio_wb16(AVIOContext *s, unsigned int val)
uint8_t general_tier_flag
uint8_t array_completeness
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_RB24
uint8_t ptl_multilayer_enabled_flag
uint8_t ptl_frame_only_constraint_flag
static int vvcc_add_nal_unit(uint8_t *nal_buf, uint32_t nal_size, int ps_array_completeness, VVCDecoderConfigurationRecord *vvcc)