Go to the documentation of this file.
30 #define MAX_SPATIAL_SEGMENTATION 4096 // max. value of u(12) field
127 unsigned int max_sub_layers_minus1)
142 for (
i = 0;
i < max_sub_layers_minus1;
i++) {
143 sub_layer_profile_present_flag[
i] =
get_bits1(gb);
144 sub_layer_level_present_flag[
i] =
get_bits1(gb);
147 if (max_sub_layers_minus1 > 0)
148 for (
i = max_sub_layers_minus1;
i < 8;
i++)
151 for (
i = 0;
i < max_sub_layers_minus1;
i++) {
152 if (sub_layer_profile_present_flag[
i]) {
169 if (sub_layer_level_present_flag[
i])
175 unsigned int cpb_cnt_minus1,
176 uint8_t sub_pic_hrd_params_present_flag)
180 for (
i = 0;
i <= cpb_cnt_minus1;
i++) {
184 if (sub_pic_hrd_params_present_flag) {
194 unsigned int max_sub_layers_minus1)
197 uint8_t sub_pic_hrd_params_present_flag = 0;
198 uint8_t nal_hrd_parameters_present_flag = 0;
199 uint8_t vcl_hrd_parameters_present_flag = 0;
201 if (cprms_present_flag) {
202 nal_hrd_parameters_present_flag =
get_bits1(gb);
203 vcl_hrd_parameters_present_flag =
get_bits1(gb);
205 if (nal_hrd_parameters_present_flag ||
206 vcl_hrd_parameters_present_flag) {
207 sub_pic_hrd_params_present_flag =
get_bits1(gb);
209 if (sub_pic_hrd_params_present_flag)
224 if (sub_pic_hrd_params_present_flag)
236 for (
i = 0;
i <= max_sub_layers_minus1;
i++) {
237 unsigned int cpb_cnt_minus1 = 0;
238 uint8_t low_delay_hrd_flag = 0;
239 uint8_t fixed_pic_rate_within_cvs_flag = 0;
240 uint8_t fixed_pic_rate_general_flag =
get_bits1(gb);
242 if (!fixed_pic_rate_general_flag)
243 fixed_pic_rate_within_cvs_flag =
get_bits1(gb);
245 if (fixed_pic_rate_within_cvs_flag)
250 if (!low_delay_hrd_flag) {
252 if (cpb_cnt_minus1 > 31)
256 if (nal_hrd_parameters_present_flag)
258 sub_pic_hrd_params_present_flag);
260 if (vcl_hrd_parameters_present_flag)
262 sub_pic_hrd_params_present_flag);
279 unsigned int max_sub_layers_minus1)
281 unsigned int min_spatial_segmentation_idc;
346 min_spatial_segmentation_idc);
365 unsigned int vps_max_sub_layers_minus1;
374 vps_max_sub_layers_minus1 =
get_bits(gb, 3);
385 vps_max_sub_layers_minus1 + 1);
401 int i, j, k, num_coeffs;
403 for (
i = 0;
i < 4;
i++)
404 for (j = 0; j < (
i == 3 ? 2 : 6); j++)
408 num_coeffs =
FFMIN(64, 1 << (4 + (
i << 1)));
413 for (k = 0; k < num_coeffs; k++)
419 unsigned int num_rps,
426 if (rps_idx >= num_rps)
432 num_delta_pocs[rps_idx] = 0;
453 for (
i = 0;
i <= num_delta_pocs[rps_idx - 1];
i++) {
454 uint8_t use_delta_flag = 0;
455 uint8_t used_by_curr_pic_flag =
get_bits1(gb);
456 if (!used_by_curr_pic_flag)
459 if (used_by_curr_pic_flag || use_delta_flag)
460 num_delta_pocs[rps_idx]++;
466 if ((num_positive_pics + (uint64_t)num_negative_pics) * 2 >
get_bits_left(gb))
469 num_delta_pocs[rps_idx] = num_negative_pics + num_positive_pics;
471 for (
i = 0;
i < num_negative_pics;
i++) {
476 for (
i = 0;
i < num_positive_pics;
i++) {
488 unsigned int i, sps_max_sub_layers_minus1, log2_max_pic_order_cnt_lsb_minus4;
493 sps_max_sub_layers_minus1 =
get_bits (gb, 3);
504 sps_max_sub_layers_minus1 + 1);
532 i =
get_bits1(gb) ? 0 : sps_max_sub_layers_minus1;
533 for (;
i <= sps_max_sub_layers_minus1;
i++)
562 for (
i = 0;
i < num_short_term_ref_pic_sets;
i++) {
563 int ret =
parse_rps(gb,
i, num_short_term_ref_pic_sets, num_delta_pocs);
570 if (num_long_term_ref_pics_sps > 31
U)
572 for (
i = 0;
i < num_long_term_ref_pics_sps;
i++) {
573 int len =
FFMIN(log2_max_pic_order_cnt_lsb_minus4 + 4, 16);
592 uint8_t tiles_enabled_flag, entropy_coding_sync_enabled_flag;
631 entropy_coding_sync_enabled_flag =
get_bits1(gb);
633 if (entropy_coding_sync_enabled_flag && tiles_enabled_flag)
635 else if (entropy_coding_sync_enabled_flag)
637 else if (tiles_enabled_flag)
660 uint8_t nal_type,
int ps_array_completeness,
685 numNalus =
array->numNalus;
695 array->nalUnit [numNalus] = nal_buf;
696 array->nalUnitLength[numNalus] = nal_size;
697 array->NAL_unit_type = nal_type;
707 array->array_completeness = ps_array_completeness;
713 int ps_array_completeness,
746 ps_array_completeness, hvcc);
805 uint16_t j, vps_count = 0, sps_count = 0, pps_count = 0;
878 "nalUnitLength[%"PRIu8
"][%"PRIu16
"]: %"PRIu16
"\n",
999 int size,
int filter_ps,
int *ps_count)
1001 int num_ps = 0,
ret = 0;
1002 uint8_t *buf, *end, *start =
NULL;
1017 while (end - buf > 4) {
1019 uint8_t
type = (buf[4] >> 1) & 0x3f;
1047 int *
size,
int filter_ps,
int *ps_count)
1068 int size,
int ps_array_completeness)
1071 uint8_t *buf, *end, *start;
1077 }
else if (*
data == 1) {
1095 while (end - buf > 4) {
1097 uint8_t
type = (buf[4] >> 1) & 0x3f;
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
static int get_bits_left(GetBitContext *gb)
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
static void nal_unit_parse_header(GetBitContext *gb, uint8_t *nal_type)
static int get_se_golomb_long(GetBitContext *gb)
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
static void hvcc_close(HEVCDecoderConfigurationRecord *hvcc)
uint8_t general_profile_idc
static void hvcc_init(HEVCDecoderConfigurationRecord *hvcc)
static void skip_bits(GetBitContext *s, int n)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static void skip_scaling_list_data(GetBitContext *gb)
uint8_t numTemporalLayers
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
static int parse_rps(GetBitContext *gb, unsigned int rps_idx, unsigned int num_rps, unsigned int num_delta_pocs[HEVC_MAX_SHORT_TERM_REF_PIC_SETS])
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
#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.
const H265RawProfileTierLevel * ptl
int avio_open_dyn_buf(AVIOContext **s)
Open a write only memory stream.
uint64_t general_constraint_indicator_flags
static void hvcc_parse_vui(GetBitContext *gb, HEVCDecoderConfigurationRecord *hvcc, unsigned int max_sub_layers_minus1)
uint8_t * ff_nal_unit_extract_rbsp(const uint8_t *src, uint32_t src_len, uint32_t *dst_len, int header_len)
uint32_t general_profile_compatibility_flags
static int skip_hrd_parameters(GetBitContext *gb, uint8_t cprms_present_flag, unsigned int max_sub_layers_minus1)
int ff_hevc_annexb2mp4_buf(const uint8_t *buf_in, uint8_t **buf_out, int *size, int filter_ps, int *ps_count)
Writes Annex B formatted HEVC NAL units to a data buffer.
@ HEVC_MAX_SHORT_TERM_REF_PIC_SETS
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)
uint8_t lengthSizeMinusOne
static void skip_timing_info(GetBitContext *gb)
uint8_t bitDepthLumaMinus8
int ff_avc_parse_nal_units(AVIOContext *pb, const uint8_t *buf_in, int size)
static int hvcc_add_nal_unit(uint8_t *nal_buf, uint32_t nal_size, int ps_array_completeness, HEVCDecoderConfigurationRecord *hvcc)
static int hvcc_parse_pps(GetBitContext *gb, HEVCDecoderConfigurationRecord *hvcc)
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, or free an array through a pointer to a pointer.
uint8_t constantFrameRate
static void skip_bits1(GetBitContext *s)
uint16_t min_spatial_segmentation_idc
uint8_t bitDepthChromaMinus8
static uint64_t get_bits64(GetBitContext *s, int n)
Read 0-64 bits.
int ff_isom_write_hvcc(AVIOContext *pb, const uint8_t *data, int size, int ps_array_completeness)
Writes HEVC extradata (parameter sets, declarative SEI NAL units) to the provided AVIOContext.
#define i(width, name, range_min, range_max)
uint32_t profile_compatibility_flags
static void hvcc_update_ptl(HEVCDecoderConfigurationRecord *hvcc, HVCCProfileTierLevel *ptl)
uint8_t general_tier_flag
uint8_t general_level_idc
uint8_t configurationVersion
static int array[MAX_W *MAX_W]
void ffio_free_dyn_buf(AVIOContext **s)
Free a dynamic buffer.
static void skip_sub_layer_hrd_parameters(GetBitContext *gb, unsigned int cpb_cnt_minus1, uint8_t sub_pic_hrd_params_present_flag)
static int hvcc_write(AVIOContext *pb, HEVCDecoderConfigurationRecord *hvcc)
static int hvcc_array_add_nal_unit(uint8_t *nal_buf, uint32_t nal_size, uint8_t nal_type, int ps_array_completeness, HEVCDecoderConfigurationRecord *hvcc)
uint8_t array_completeness
static unsigned get_ue_golomb_long(GetBitContext *gb)
Read an unsigned Exp-Golomb code in the range 0 to UINT32_MAX-1.
uint64_t constraint_indicator_flags
static int hvcc_parse_sps(GetBitContext *gb, HEVCDecoderConfigurationRecord *hvcc)
void avio_wb16(AVIOContext *s, unsigned int val)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int hvcc_parse_vps(GetBitContext *gb, HEVCDecoderConfigurationRecord *hvcc)
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
#define MAX_SPATIAL_SEGMENTATION
static void skip_sub_layer_ordering_info(GetBitContext *gb)
int ff_hevc_annexb2mp4(AVIOContext *pb, const uint8_t *buf_in, int size, int filter_ps, int *ps_count)
Writes Annex B formatted HEVC NAL units to the provided AVIOContext.
uint8_t general_profile_space
static void hvcc_parse_ptl(GetBitContext *gb, HEVCDecoderConfigurationRecord *hvcc, unsigned int max_sub_layers_minus1)