38 #define MAX_LOG2_MAX_FRAME_NUM (12 + 4) 39 #define MIN_LOG2_MAX_FRAME_NUM 4 41 #define EXTENDED_SAR 255 64 { 6, 13, 20, 28, 13, 20, 28, 32,
65 20, 28, 32, 37, 28, 32, 37, 42 },
66 { 10, 14, 20, 24, 14, 20, 24, 27,
67 20, 24, 27, 30, 24, 27, 30, 34 }
71 { 6, 10, 13, 16, 18, 23, 25, 27,
72 10, 11, 16, 18, 23, 25, 27, 29,
73 13, 16, 18, 23, 25, 27, 29, 31,
74 16, 18, 23, 25, 27, 29, 31, 33,
75 18, 23, 25, 27, 29, 31, 33, 36,
76 23, 25, 27, 29, 31, 33, 36, 38,
77 25, 27, 29, 31, 33, 36, 38, 40,
78 27, 29, 31, 33, 36, 38, 40, 42 },
79 { 9, 13, 15, 17, 19, 21, 22, 24,
80 13, 13, 17, 19, 21, 22, 24, 25,
81 15, 17, 19, 21, 22, 24, 25, 27,
82 17, 19, 21, 22, 24, 25, 27, 28,
83 19, 21, 22, 24, 25, 27, 28, 30,
84 21, 22, 24, 25, 27, 28, 30, 32,
85 22, 24, 25, 27, 28, 30, 32, 33,
86 24, 25, 27, 28, 30, 32, 33, 35 }
137 if (cpb_count > 32
U) {
144 for (i = 0; i < cpb_count; i++) {
160 int aspect_ratio_info_present_flag;
161 unsigned int aspect_ratio_idc;
163 aspect_ratio_info_present_flag =
get_bits1(gb);
165 if (aspect_ratio_info_present_flag) {
171 sps->
sar = pixel_aspect[aspect_ratio_idc];
216 "time_scale/num_units_in_tick invalid or unsupported (%"PRIu32
"/%"PRIu32
")\n",
254 "Clipping illegal num_reorder_frames %d\n",
273 int i, last = 8, next = 8;
276 memcpy(factors, fallback_list, size *
sizeof(
uint8_t));
278 for (i = 0; i <
size; i++) {
282 memcpy(factors, jvt_list, size *
sizeof(
uint8_t));
285 last = factors[scan[i]] = next ? next : last;
290 PPS *pps,
int is_sps,
328 int profile_idc, level_idc, constraint_set_flags = 0;
330 int i, log2_max_frame_num_minus4;
334 constraint_set_flags |=
get_bits1(gb) << 0;
335 constraint_set_flags |=
get_bits1(gb) << 1;
336 constraint_set_flags |=
get_bits1(gb) << 2;
337 constraint_set_flags |=
get_bits1(gb) << 3;
338 constraint_set_flags |=
get_bits1(gb) << 4;
339 constraint_set_flags |=
get_bits1(gb) << 5;
387 "Different chroma and luma bit depth");
403 "log2_max_frame_num_minus4 out of range (0-12): %d\n",
404 log2_max_frame_num_minus4);
451 if ((
unsigned)sps->
mb_width >= INT_MAX / 16 ||
452 (
unsigned)sps->
mb_height >= INT_MAX / 16 ||
467 "This stream was generated by a broken encoder, invalid 8x8 inference\n");
471 #ifndef ALLOW_INTERLACE 474 "MBAFF support not included; enable it at compile-time.\n");
485 "values are l:%d r:%d t:%d b:%d\n",
486 crop_left, crop_right, crop_top, crop_bottom);
496 int step_x = 1 << hsub;
503 "Reducing left cropping to %d " 504 "chroma samples to preserve alignment.\n",
508 if (INT_MAX / step_x <= crop_left ||
509 INT_MAX / step_x - crop_left <= crop_right ||
510 16 * sps->
mb_width <= step_x * (crop_left + crop_right) ||
511 INT_MAX / step_y <= crop_top ||
512 INT_MAX / step_y - crop_top <= crop_bottom ||
513 16 * sps->
mb_height <= step_y * (crop_top + crop_bottom)) {
517 crop_left = crop_right = crop_top = crop_bottom = 0;
558 static const char csp[4][5] = {
"Gray",
"420",
"422",
"444" };
560 "sps:%u profile:%d/%d poc:%d ref:%d %dx%d %s %s crop:%u/%u/%u/%u %s %s %"PRId32
"/%"PRId32
"\n",
598 for (i = 0; i < 6; i++) {
600 for (j = 0; j < i; j++)
609 for (q = 0; q < max_qp + 1; q++) {
612 for (x = 0; x < 64; x++)
624 for (i = 0; i < 6; i++) {
626 for (j = 0; j < i; j++)
635 for (q = 0; q < max_qp + 1; q++) {
638 for (x = 0; x < 16; x++)
653 for (i = 0; i < 6; i++)
654 for (x = 0; x < 16; x++)
657 for (i = 0; i < 6; i++)
658 for (x = 0; x < 64; x++)
666 const int max_qp = 51 + 6 * (depth - 8);
667 for (i = 0; i < max_qp + 1; i++)
704 "Unimplemented luma bit depth=%d (max=10)\n",
743 if (bits_left && (bits_left > 8 ||
744 show_bits(gb, bits_left) != 1 << (bits_left - 1))) {
766 "pps:%u sps:%u %s slice_groups:%d ref:%u/%u %s qp:%d/%d/%d/%d %s %s %s %s\n",
768 pps->
cabac ?
"CABAC" :
"CAVLC",
int ff_h264_decode_picture_parameter_set(GetBitContext *gb, AVCodecContext *avctx, H264ParamSets *ps, int bit_length)
Decode PPS.
#define MAX_LOG2_MAX_FRAME_NUM
int video_signal_type_present_flag
static void remove_pps(H264ParamSets *s, int id)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int decode_hrd_parameters(GetBitContext *gb, AVCodecContext *avctx, SPS *sps)
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it...
static int get_se_golomb(GetBitContext *gb)
read signed exp golomb code.
const uint8_t ff_zigzag_scan[16]
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AV_LOG_WARNING
Something somehow does not look correct.
int chroma_qp_index_offset[2]
AVBufferRef * sps_list[MAX_SPS_COUNT]
int scaling_matrix_present
uint8_t scaling_matrix4[6][16]
int bitstream_restriction_flag
unsigned int ref_count[2]
num_ref_idx_l0/1_active_minus1 + 1
av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (%s)\, len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic ? ac->func_descr_generic :ac->func_descr)
#define FF_ARRAY_ELEMS(a)
const uint8_t ff_h264_quant_rem6[QP_MAX_NUM+1]
uint32_t num_units_in_tick
static const AVRational pixel_aspect[17]
unsigned int crop_top
frame_cropping_rect_top_offset
int fixed_frame_rate_flag
uint8_t scaling_matrix4[6][16]
int deblocking_filter_parameters_present
deblocking_filter_parameters_present_flag
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
const uint8_t ff_h264_dequant4_coeff_init[6][3]
unsigned int crop_left
frame_cropping_rect_left_offset
int offset_for_non_ref_pic
int gaps_in_frame_num_allowed_flag
int bit_depth_chroma
bit_depth_chroma_minus8 + 8
#define FF_DEBUG_PICT_INFO
enum AVColorPrimaries color_primaries
#define AV_CODEC_FLAG_UNALIGNED
Allow decoders to produce frames with data planes that are not aligned to CPU requirements (e...
int cabac
entropy_coding_mode_flag
unsigned int crop_right
frame_cropping_rect_right_offset
uint32_t(*[6] dequant4_coeff)[16]
int transform_bypass
qpprime_y_zero_transform_bypass_flag
uint32_t(*[6] dequant8_coeff)[64]
static int get_bits_count(const GetBitContext *s)
uint8_t chroma_qp_table[2][64]
pre-scaled (with chroma_qp_index_offset) version of qp_table
static const int level_max_dpb_mbs[][2]
int redundant_pic_cnt_present
redundant_pic_cnt_present_flag
enum AVChromaLocation chroma_sample_location
This defines the location of chroma samples.
static void decode_scaling_list(GetBitContext *gb, uint8_t *factors, int size, const uint8_t *jvt_list, const uint8_t *fallback_list)
static int get_bits_left(GetBitContext *gb)
H.264 parameter set handling.
int mb_aff
mb_adaptive_frame_field_flag
enum AVColorTransferCharacteristic color_trc
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define AV_CODEC_FLAG2_IGNORE_CROP
Discard cropping information from SPS.
static int get_ue_golomb(GetBitContext *gb)
read unsigned exp golomb code.
int poc_type
pic_order_cnt_type
int constrained_intra_pred
constrained_intra_pred_flag
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int flags
AV_CODEC_FLAG_*.
int weighted_pred
weighted_pred_flag
#define MIN_LOG2_MAX_FRAME_NUM
int residual_color_transform_flag
residual_colour_transform_flag
int delta_pic_order_always_zero_flag
int offset_for_top_to_bottom_field
static void remove_sps(H264ParamSets *s, int id)
static void init_dequant8_coeff_table(PPS *pps, const SPS *sps)
int crop
frame_cropping_flag
uint8_t scaling_matrix8[6][64]
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
int ref_frame_count
num_ref_frames
int initial_cpb_removal_delay_length
initial_cpb_removal_delay_length_minus1 + 1
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
int poc_cycle_length
num_ref_frames_in_pic_order_cnt_cycle
int colour_description_present_flag
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
int init_qp
pic_init_qp_minus26 + 26
int direct_8x8_inference_flag
uint8_t scaling_matrix8[6][64]
if(ac->has_optimized_func)
static unsigned get_ue_golomb_long(GetBitContext *gb)
Read an unsigned Exp-Golomb code in the range 0 to UINT32_MAX-1.
#define AVERROR_PATCHWELCOME
Not yet implemented in Libav, patches welcome.
int pic_order_present
pic_order_present_flag
short offset_for_ref_frame[256]
static int decode_vui_parameters(GetBitContext *gb, AVCodecContext *avctx, SPS *sps)
int timing_info_present_flag
int vcl_hrd_parameters_present_flag
Libavcodec external API header.
#define MAX_DELAYED_PIC_COUNT
AVBufferRef * pps_list[MAX_PPS_COUNT]
static int get_ue_golomb_31(GetBitContext *gb)
read unsigned exp golomb code, constraint to a max of 31.
main external API structure.
int dpb_output_delay_length
dpb_output_delay_length_minus1 + 1
uint8_t * data
The data buffer.
int vui_parameters_present_flag
static void init_dequant4_coeff_table(PPS *pps, const SPS *sps)
AVBufferRef * av_buffer_allocz(int size)
Same as av_buffer_alloc(), except the returned buffer will be initialized to zero.
int constraint_set_flags
constraint_set[0-3]_flag
static unsigned int get_bits1(GetBitContext *s)
const uint8_t ff_h264_quant_div6[QP_MAX_NUM+1]
static void skip_bits(GetBitContext *s, int n)
rational number numerator/denominator
const uint8_t ff_zigzag_direct[64]
#define FF_COMPLIANCE_STRICT
Strictly conform to all the things in the spec no matter what consequences.
int log2_max_poc_lsb
log2_max_pic_order_cnt_lsb_minus4
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
int size
Size of data in bytes.
int transform_8x8_mode
transform_8x8_mode_flag
int pic_struct_present_flag
const uint8_t ff_h264_dequant8_coeff_init[6][6]
A reference to a data buffer.
int init_qs
pic_init_qs_minus26 + 26
common internal api header.
int nal_hrd_parameters_present_flag
int log2_max_frame_num
log2_max_frame_num_minus4 + 4
static const uint8_t default_scaling4[2][16]
static void decode_scaling_matrices(GetBitContext *gb, SPS *sps, PPS *pps, int is_sps, uint8_t(*scaling_matrix4)[16], uint8_t(*scaling_matrix8)[64])
int bit_depth_luma
bit_depth_luma_minus8 + 8
const uint8_t ff_h264_chroma_qp[3][QP_MAX_NUM+1]
int mb_width
pic_width_in_mbs_minus1 + 1
int flags2
AV_CODEC_FLAG2_*.
int slice_group_count
num_slice_groups_minus1 + 1
int cpb_cnt
See H.264 E.1.2.
uint32_t dequant4_buffer[6][QP_MAX_NUM+1][16]
static const uint8_t default_scaling8[2][64]
uint32_t dequant8_buffer[6][QP_MAX_NUM+1][64]
int cpb_removal_delay_length
cpb_removal_delay_length_minus1 + 1
static void init_dequant_tables(PPS *pps, const SPS *sps)
unsigned int crop_bottom
frame_cropping_rect_bottom_offset
int strict_std_compliance
strictly follow the standard (MPEG-4, ...).
const uint8_t ff_h264_dequant8_coeff_init_scan[16]
int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx, H264ParamSets *ps)
Decode SPS.
static void build_qp_table(PPS *pps, int t, int index, const int depth)
int mb_slice_group_map_type
enum AVColorSpace colorspace