Go to the documentation of this file.
31 #define MAX_SPATIAL_SEGMENTATION 4096 // max. value of u(12) field
128 unsigned int max_sub_layers_minus1)
143 for (
i = 0;
i < max_sub_layers_minus1;
i++) {
144 sub_layer_profile_present_flag[
i] =
get_bits1(gb);
145 sub_layer_level_present_flag[
i] =
get_bits1(gb);
148 if (max_sub_layers_minus1 > 0)
149 for (
i = max_sub_layers_minus1;
i < 8;
i++)
152 for (
i = 0;
i < max_sub_layers_minus1;
i++) {
153 if (sub_layer_profile_present_flag[
i]) {
170 if (sub_layer_level_present_flag[
i])
176 unsigned int cpb_cnt_minus1,
177 uint8_t sub_pic_hrd_params_present_flag)
181 for (
i = 0;
i <= cpb_cnt_minus1;
i++) {
185 if (sub_pic_hrd_params_present_flag) {
195 unsigned int max_sub_layers_minus1)
198 uint8_t sub_pic_hrd_params_present_flag = 0;
199 uint8_t nal_hrd_parameters_present_flag = 0;
200 uint8_t vcl_hrd_parameters_present_flag = 0;
202 if (cprms_present_flag) {
203 nal_hrd_parameters_present_flag =
get_bits1(gb);
204 vcl_hrd_parameters_present_flag =
get_bits1(gb);
206 if (nal_hrd_parameters_present_flag ||
207 vcl_hrd_parameters_present_flag) {
208 sub_pic_hrd_params_present_flag =
get_bits1(gb);
210 if (sub_pic_hrd_params_present_flag)
225 if (sub_pic_hrd_params_present_flag)
237 for (
i = 0;
i <= max_sub_layers_minus1;
i++) {
238 unsigned int cpb_cnt_minus1 = 0;
239 uint8_t low_delay_hrd_flag = 0;
240 uint8_t fixed_pic_rate_within_cvs_flag = 0;
243 if (!fixed_pic_rate_general_flag)
244 fixed_pic_rate_within_cvs_flag =
get_bits1(gb);
246 if (fixed_pic_rate_within_cvs_flag)
251 if (!low_delay_hrd_flag) {
253 if (cpb_cnt_minus1 > 31)
257 if (nal_hrd_parameters_present_flag)
259 sub_pic_hrd_params_present_flag);
261 if (vcl_hrd_parameters_present_flag)
263 sub_pic_hrd_params_present_flag);
280 unsigned int max_sub_layers_minus1)
282 unsigned int min_spatial_segmentation_idc;
347 min_spatial_segmentation_idc);
366 unsigned int vps_max_sub_layers_minus1;
375 vps_max_sub_layers_minus1 =
get_bits(gb, 3);
386 vps_max_sub_layers_minus1 + 1);
402 int i, j, k, num_coeffs;
404 for (
i = 0;
i < 4;
i++)
405 for (j = 0; j < (
i == 3 ? 2 : 6); j++)
409 num_coeffs =
FFMIN(64, 1 << (4 + (
i << 1)));
414 for (k = 0; k < num_coeffs; k++)
420 unsigned int num_rps,
427 if (rps_idx >= num_rps)
433 num_delta_pocs[rps_idx] = 0;
454 for (
i = 0;
i <= num_delta_pocs[rps_idx - 1];
i++) {
457 if (!used_by_curr_pic_flag)
460 if (used_by_curr_pic_flag || use_delta_flag)
461 num_delta_pocs[rps_idx]++;
467 if ((num_positive_pics + (uint64_t)num_negative_pics) * 2 >
get_bits_left(gb))
470 num_delta_pocs[rps_idx] = num_negative_pics + num_positive_pics;
472 for (
i = 0;
i < num_negative_pics;
i++) {
477 for (
i = 0;
i < num_positive_pics;
i++) {
489 unsigned int i, sps_max_sub_layers_minus1, log2_max_pic_order_cnt_lsb_minus4;
494 sps_max_sub_layers_minus1 =
get_bits (gb, 3);
505 sps_max_sub_layers_minus1 + 1);
533 i =
get_bits1(gb) ? 0 : sps_max_sub_layers_minus1;
534 for (;
i <= sps_max_sub_layers_minus1;
i++)
563 for (
i = 0;
i < num_short_term_ref_pic_sets;
i++) {
564 int ret =
parse_rps(gb,
i, num_short_term_ref_pic_sets, num_delta_pocs);
571 if (num_long_term_ref_pics_sps > 31
U)
573 for (
i = 0;
i < num_long_term_ref_pics_sps;
i++) {
574 int len =
FFMIN(log2_max_pic_order_cnt_lsb_minus4 + 4, 16);
593 uint8_t tiles_enabled_flag, entropy_coding_sync_enabled_flag;
632 entropy_coding_sync_enabled_flag =
get_bits1(gb);
634 if (entropy_coding_sync_enabled_flag && tiles_enabled_flag)
636 else if (entropy_coding_sync_enabled_flag)
638 else if (tiles_enabled_flag)
661 uint8_t nal_type,
int ps_array_completeness,
686 numNalus =
array->numNalus;
696 array->nalUnit [numNalus] = nal_buf;
697 array->nalUnitLength[numNalus] = nal_size;
698 array->NAL_unit_type = nal_type;
708 array->array_completeness = ps_array_completeness;
714 int ps_array_completeness,
747 ps_array_completeness, hvcc);
806 uint16_t j, vps_count = 0, sps_count = 0, pps_count = 0;
879 "nalUnitLength[%"PRIu8
"][%"PRIu16
"]: %"PRIu16
"\n",
1000 int size,
int filter_ps,
int *ps_count)
1002 int num_ps = 0,
ret = 0;
1018 while (
end - buf > 4) {
1048 int *
size,
int filter_ps,
int *ps_count)
1069 int size,
int ps_array_completeness)
1081 }
else if (*
data == 1) {
1098 while (
end - buf > 4) {
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)
@ HEVC_MAX_SHORT_TERM_REF_PIC_SETS
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
static av_cold int end(AVCodecContext *avctx)
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.
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)