29 #define MAX_SPATIAL_SEGMENTATION 4096 // max. value of u(12) field
126 unsigned int max_sub_layers_minus1)
141 for (i = 0; i < max_sub_layers_minus1; i++) {
142 sub_layer_profile_present_flag[i] =
get_bits1(gb);
143 sub_layer_level_present_flag[i] =
get_bits1(gb);
146 if (max_sub_layers_minus1 > 0)
147 for (i = max_sub_layers_minus1; i < 8; i++)
150 for (i = 0; i < max_sub_layers_minus1; i++) {
151 if (sub_layer_profile_present_flag[i]) {
168 if (sub_layer_level_present_flag[i])
174 unsigned int cpb_cnt_minus1,
175 uint8_t sub_pic_hrd_params_present_flag)
179 for (i = 0; i <= cpb_cnt_minus1; i++) {
183 if (sub_pic_hrd_params_present_flag) {
193 unsigned int max_sub_layers_minus1)
196 uint8_t sub_pic_hrd_params_present_flag = 0;
197 uint8_t nal_hrd_parameters_present_flag = 0;
198 uint8_t vcl_hrd_parameters_present_flag = 0;
200 if (cprms_present_flag) {
201 nal_hrd_parameters_present_flag =
get_bits1(gb);
202 vcl_hrd_parameters_present_flag =
get_bits1(gb);
204 if (nal_hrd_parameters_present_flag ||
205 vcl_hrd_parameters_present_flag) {
206 sub_pic_hrd_params_present_flag =
get_bits1(gb);
208 if (sub_pic_hrd_params_present_flag)
223 if (sub_pic_hrd_params_present_flag)
235 for (i = 0; i <= max_sub_layers_minus1; i++) {
236 unsigned int cpb_cnt_minus1 = 0;
237 uint8_t low_delay_hrd_flag = 0;
238 uint8_t fixed_pic_rate_within_cvs_flag = 0;
241 if (!fixed_pic_rate_general_flag)
242 fixed_pic_rate_within_cvs_flag =
get_bits1(gb);
244 if (fixed_pic_rate_within_cvs_flag)
249 if (!low_delay_hrd_flag) {
251 if (cpb_cnt_minus1 > 31)
255 if (nal_hrd_parameters_present_flag)
257 sub_pic_hrd_params_present_flag);
259 if (vcl_hrd_parameters_present_flag)
261 sub_pic_hrd_params_present_flag);
278 unsigned int max_sub_layers_minus1)
280 unsigned int min_spatial_segmentation_idc;
345 min_spatial_segmentation_idc);
364 unsigned int vps_max_sub_layers_minus1;
373 vps_max_sub_layers_minus1 =
get_bits(gb, 3);
384 vps_max_sub_layers_minus1 + 1);
400 int i, j, k, num_coeffs;
402 for (i = 0; i < 4; i++)
403 for (j = 0; j < (i == 3 ? 2 : 6); j++)
407 num_coeffs =
FFMIN(64, 1 << (4 + (i << 1)));
412 for (k = 0; k < num_coeffs; k++)
418 unsigned int num_rps,
425 if (rps_idx >= num_rps)
431 num_delta_pocs[rps_idx] = 0;
452 for (i = 0; i < num_delta_pocs[rps_idx - 1]; i++) {
455 if (!used_by_curr_pic_flag)
458 if (used_by_curr_pic_flag || use_delta_flag)
459 num_delta_pocs[rps_idx]++;
465 if ((num_positive_pics + (uint64_t)num_negative_pics) * 2 >
get_bits_left(gb))
468 num_delta_pocs[rps_idx] = num_negative_pics + num_positive_pics;
470 for (i = 0; i < num_negative_pics; i++) {
475 for (i = 0; i < num_positive_pics; i++) {
487 unsigned int i, sps_max_sub_layers_minus1, log2_max_pic_order_cnt_lsb_minus4;
492 sps_max_sub_layers_minus1 =
get_bits (gb, 3);
503 sps_max_sub_layers_minus1 + 1);
531 i =
get_bits1(gb) ? 0 : sps_max_sub_layers_minus1;
532 for (; i <= sps_max_sub_layers_minus1; i++)
561 for (i = 0; i < num_short_term_ref_pic_sets; i++) {
562 int ret =
parse_rps(gb, i, num_short_term_ref_pic_sets, num_delta_pocs);
569 int len =
FFMIN(log2_max_pic_order_cnt_lsb_minus4 + 4, 16);
588 uint8_t tiles_enabled_flag, entropy_coding_sync_enabled_flag;
626 entropy_coding_sync_enabled_flag =
get_bits1(gb);
628 if (entropy_coding_sync_enabled_flag && tiles_enabled_flag)
630 else if (entropy_coding_sync_enabled_flag)
632 else if (tiles_enabled_flag)
653 while (i < 2 && i < src_len)
654 dst[len++] = src[i++];
656 while (i + 2 < src_len)
657 if (!src[i] && !src[i + 1] && src[i + 2] == 3) {
658 dst[len++] = src[i++];
659 dst[len++] = src[i++];
662 dst[len++] = src[i++];
665 dst[len++] = src[i++];
687 uint8_t nal_type,
int ps_array_completeness,
695 for (index = 0; index < hvcc->
numOfArrays; index++)
722 array->
nalUnit [numNalus] = nal_buf;
740 int ps_array_completeness,
773 ps_array_completeness, hvcc);
832 uint16_t j, vps_count = 0, sps_count = 0, pps_count = 0;
905 "nalUnitLength[%"PRIu8
"][%"PRIu16
"]: %"PRIu16
"\n",
1026 int size,
int filter_ps,
int *ps_count)
1028 int num_ps = 0,
ret = 0;
1044 while (end - buf > 4) {
1074 int *
size,
int filter_ps,
int *ps_count)
1090 int size,
int ps_array_completeness)
1102 }
else if (*data == 1) {
1119 while (end - buf > 4) {
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
ptrdiff_t const GLvoid * data
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static void skip_bits_long(GetBitContext *s, int n)
uint8_t general_profile_idc
uint64_t general_constraint_indicator_flags
int avio_open_dyn_buf(AVIOContext **s)
Open a write only memory stream.
uint32_t general_profile_compatibility_flags
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
static av_cold int end(AVCodecContext *avctx)
uint8_t constantFrameRate
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
bitstream reader API header.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
uint32_t profile_compatibility_flags
static int get_bits_left(GetBitContext *gb)
static uint64_t get_bits64(GetBitContext *s, int n)
Read 0-64 bits.
int av_reallocp_array(void *ptr, size_t nmemb, size_t size)
#define MAX_SHORT_TERM_RPS_COUNT
int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size)
uint8_t bitDepthChromaMinus8
uint8_t general_profile_space
int ff_avc_parse_nal_units(AVIOContext *pb, const uint8_t *buf_in, int size)
uint8_t lengthSizeMinusOne
uint8_t general_tier_flag
uint8_t numTemporalLayers
static unsigned get_ue_golomb_long(GetBitContext *gb)
Read an unsigned Exp-Golomb code in the range 0 to UINT32_MAX-1.
static int get_se_golomb_long(GetBitContext *gb)
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
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
void avio_w8(AVIOContext *s, int b)
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits1(GetBitContext *s)
static void skip_bits(GetBitContext *s, int n)
#define MAX_SUB_LAYERS
7.4.2.1
uint8_t bitDepthLumaMinus8
uint8_t array_completeness
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
uint8_t general_level_idc
void avio_wb16(AVIOContext *s, unsigned int val)
uint8_t configurationVersion
void avio_wb32(AVIOContext *s, unsigned int val)
uint64_t constraint_indicator_flags
uint16_t min_spatial_segmentation_idc