Go to the documentation of this file.
127 ptl->ptl_frame_only_constraint_flag;
133 if (
ptl->num_bytes_constraint_info) {
136 &
ptl->general_constraint_info[0],
ptl->num_bytes_constraint_info);
153 ptl->ptl_sublayer_level_present_flag[
i];
157 ptl->sublayer_level_idc[
i]);
173 ptl->general_sub_profile_idc[
i];
180 unsigned int profileTierPresentFlag,
181 unsigned int max_sub_layers_minus1)
185 if (profileTierPresentFlag) {
193 if (profileTierPresentFlag) {
196 int gci_num_reserved_bits, j;
197 for (j = 0; j < 8; j++)
201 gci_num_reserved_bits =
get_bits(gb, 8);
208 for (
int i = max_sub_layers_minus1 - 1;
i >= 0;
i--)
213 for (
int i = max_sub_layers_minus1 - 1;
i >= 0;
i--) {
218 if (profileTierPresentFlag) {
232 unsigned int vps_max_layers_minus1;
233 unsigned int vps_max_sublayers_minus1;
234 unsigned int vps_default_ptl_dpb_hrd_max_tid_flag;
235 unsigned int vps_all_independent_layers_flag;
239 unsigned int vps_num_ptls_minus1 = 0;
246 vps_max_layers_minus1 =
get_bits(gb, 6);
247 vps_max_sublayers_minus1 =
get_bits(gb, 3);
258 vps_max_sublayers_minus1 + 1);
260 if (vps_max_layers_minus1 > 0 && vps_max_sublayers_minus1 > 0)
261 vps_default_ptl_dpb_hrd_max_tid_flag =
get_bits1(gb);
263 vps_default_ptl_dpb_hrd_max_tid_flag = 0;
264 if (vps_max_layers_minus1 > 0)
265 vps_all_independent_layers_flag =
get_bits1(gb);
267 vps_all_independent_layers_flag = 1;
269 for (
int i = 0;
i <= vps_max_layers_minus1;
i++) {
271 if (
i > 0 && !vps_all_independent_layers_flag) {
273 unsigned int vps_max_tid_ref_present_flag =
get_bits1(gb);
274 for (
int j = 0; j <
i; j++) {
275 unsigned int vps_direct_ref_layer_flag =
get_bits1(gb);
276 if (vps_max_tid_ref_present_flag && vps_direct_ref_layer_flag)
283 if (vps_max_layers_minus1 > 0) {
284 unsigned int vps_each_layer_is_an_ols_flag;
285 if (vps_all_independent_layers_flag)
286 vps_each_layer_is_an_ols_flag =
get_bits1(gb);
288 vps_each_layer_is_an_ols_flag = 0;
289 if (!vps_each_layer_is_an_ols_flag) {
290 unsigned int vps_ols_mode_idc;
291 if (!vps_all_independent_layers_flag)
294 vps_ols_mode_idc = 2;
295 if (vps_ols_mode_idc == 2) {
296 unsigned int vps_num_output_layer_sets_minus2 =
get_bits(gb, 8);
297 for (
int i = 1;
i <= vps_num_output_layer_sets_minus2 + 1;
i++) {
298 for (
int j = 0; j <= vps_max_layers_minus1; j++) {
304 vps_num_ptls_minus1 =
get_bits(gb, 8);
307 for (
int i = 0;
i <= vps_num_ptls_minus1;
i++) {
311 vps_pt_present_flag[
i] = 1;
313 if (!vps_default_ptl_dpb_hrd_max_tid_flag)
316 vps_ptl_max_tid[
i] = vps_max_sublayers_minus1;
321 for (
int i = 0;
i <= vps_num_ptls_minus1;
i++)
332 unsigned int sps_max_sublayers_minus1, sps_log2_ctu_size_minus5;
333 unsigned int sps_subpic_same_size_flag, sps_pic_height_max_in_luma_samples,
334 sps_pic_width_max_in_luma_samples;
335 unsigned int sps_independent_subpics_flag;
338 sps_max_sublayers_minus1 =
get_bits(gb, 3);
349 sps_max_sublayers_minus1 + 1);
352 sps_log2_ctu_size_minus5 =
get_bits(gb, 2);
379 const int ctb_log2_size_y = sps_log2_ctu_size_minus5 + 5;
380 const int ctb_size_y = 1 << ctb_log2_size_y;
381 const int tmp_width_val =
AV_CEIL_RSHIFT(sps_pic_width_max_in_luma_samples, ctb_log2_size_y);
382 const int tmp_height_val =
AV_CEIL_RSHIFT(sps_pic_height_max_in_luma_samples, ctb_log2_size_y);
385 unsigned int sps_subpic_id_len;
386 if (sps_num_subpics_minus1 > 0) {
387 sps_independent_subpics_flag =
get_bits1(gb);
388 sps_subpic_same_size_flag =
get_bits1(gb);
390 for (
int i = 0; sps_num_subpics_minus1 > 0 &&
i <= sps_num_subpics_minus1;
i++) {
391 if (!sps_subpic_same_size_flag ||
i == 0) {
392 if (
i > 0 && sps_pic_width_max_in_luma_samples > ctb_size_y)
394 if (
i > 0 && sps_pic_height_max_in_luma_samples > ctb_size_y)
396 if (i < sps_num_subpics_minus1 && sps_pic_width_max_in_luma_samples > ctb_size_y)
398 if (i < sps_num_subpics_minus1 && sps_pic_height_max_in_luma_samples > ctb_size_y)
401 if (!sps_independent_subpics_flag) {
408 for (
int i = 0;
i <= sps_num_subpics_minus1;
i++) {
445 uint8_t nal_type,
int ps_array_completeness,
451 num_nalus =
array->num_nalus;
463 array->nal_unit[num_nalus] = nal_buf;
464 array->nal_unit_length[num_nalus] = nal_size;
465 array->NAL_unit_type = nal_type;
490 array->array_completeness = ps_array_completeness;
496 int ps_array_completeness,
524 ps_array_completeness,
525 &vvcc->
arrays[array_idx]);
561 array->num_nalus = 0;
571 uint16_t vps_count = 0, sps_count = 0, pps_count = 0;
580 "lengthSizeMinusOne: %" PRIu8
"\n",
583 "ptl_present_flag: %" PRIu8
"\n",
586 "ols_idx: %" PRIu16
"\n", vvcc->
ols_idx);
588 "num_sublayers: %" PRIu8
"\n",
591 "constant_frame_rate: %" PRIu8
"\n",
594 "chroma_format_idc: %" PRIu8
"\n",
598 "bit_depth_minus8: %" PRIu8
"\n",
601 "num_bytes_constraint_info: %" PRIu8
"\n",
604 "general_profile_idc: %" PRIu8
"\n",
607 "general_tier_flag: %" PRIu8
"\n",
610 "general_level_idc: %" PRIu8
"\n",
613 "ptl_frame_only_constraint_flag: %" PRIu8
"\n",
616 "ptl_multilayer_enabled_flag: %" PRIu8
"\n",
620 "general_constraint_info[%d]: %" PRIu8
"\n",
i,
626 "ptl_sublayer_level_present_flag[%d]: %" PRIu8
"\n",
i,
629 "sublayer_level_idc[%d]: %" PRIu8
"\n",
i,
634 "num_sub_profiles: %" PRIu8
"\n",
639 "general_sub_profile_idc[%u]: %" PRIx32
"\n",
i,
644 "max_picture_width: %" PRIu16
"\n",
647 "max_picture_height: %" PRIu16
"\n",
650 "avg_frame_rate: %" PRIu16
"\n",
654 "num_of_arrays: %" PRIu8
"\n",
659 if (
array->num_nalus == 0)
663 "array_completeness[%u]: %" PRIu8
"\n",
i,
664 array->array_completeness);
666 "NAL_unit_type[%u]: %" PRIu8
"\n",
i,
667 array->NAL_unit_type);
669 "num_nalus[%u]: %" PRIu16
"\n",
i,
671 for (
unsigned j = 0; j <
array->num_nalus; j++)
673 "nal_unit_length[%u][%u]: %"
674 PRIu16
"\n",
i, j,
array->nal_unit_length[j]);
741 uint8_t ptl_sublayer_level_present_flags = 0;
743 ptl_sublayer_level_present_flags =
744 (ptl_sublayer_level_present_flags << 1 | vvcc->
ptl.
745 ptl_sublayer_level_present_flag[
i]);
747 avio_w8(pb, ptl_sublayer_level_present_flags);
784 if (!
array->num_nalus)
792 array->NAL_unit_type & 0x1f);
797 for (
int j = 0; j <
array->num_nalus; j++) {
803 array->nal_unit_length[j]);
811 int size,
int filter_ps,
int *ps_count)
813 int num_ps = 0,
ret = 0;
814 uint8_t *buf, *end, *start =
NULL;
829 while (end - buf > 4) {
831 uint8_t
type = (buf[5] >> 3);
859 int *
size,
int filter_ps,
int *ps_count)
880 int size,
int ps_array_completeness)
883 uint8_t *buf, *end, *start;
889 }
else if ((*
data & 0xf8) == 0xf8) {
907 while (end - buf > 4) {
909 uint8_t
type = (buf[5] >> 3);
914 static const uint8_t array_idx_to_type[] =
918 if (
type == array_idx_to_type[
i]) {
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 int put_bytes_output(const PutBitContext *s)
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.
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 vvcc_update_ptl(VVCDecoderConfigurationRecord *vvcc, VVCPTLRecord *ptl)
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
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
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
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.
#define FF_ARRAY_ELEMS(a)
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 general_profile_idc
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int ff_nal_parse_units(AVIOContext *pb, const uint8_t *buf_in, int size)
static int vvcc_parse_vps(GetBitContext *gb, VVCDecoderConfigurationRecord *vvcc)
uint8_t chroma_format_idc
uint8_t * ff_nal_unit_extract_rbsp(const uint8_t *src, uint32_t src_len, uint32_t *dst_len, int header_len)
uint16_t * nal_unit_length
static unsigned int get_bits1(GetBitContext *s)
void avio_w8(AVIOContext *s, int b)
uint8_t general_tier_flag
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.
int ff_nal_parse_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size)
static int vvcc_add_nal_unit(uint8_t *nal_buf, uint32_t nal_size, int ps_array_completeness, VVCDecoderConfigurationRecord *vvcc, unsigned array_idx)
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)
static int vvcc_array_add_nal_unit(uint8_t *nal_buf, uint32_t nal_size, uint8_t nal_type, int ps_array_completeness, VVCCNALUnitArray *array)
uint8_t lengthSizeMinusOne
VVCCNALUnitArray arrays[NB_ARRAYS]
#define i(width, name, range_min, range_max)
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]
uint8_t num_bytes_constraint_info
static const uint8_t * align_get_bits(GetBitContext *s)
uint16_t max_picture_height
static void vvcc_init(VVCDecoderConfigurationRecord *vvcc)
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