38 #define MAX_LOG2_MAX_FRAME_NUM (12 + 4)
39 #define MIN_LOG2_MAX_FRAME_NUM 4
41 #define EXTENDED_SAR 255
44 { 6, 13, 20, 28, 13, 20, 28, 32,
45 20, 28, 32, 37, 28, 32, 37, 42 },
46 { 10, 14, 20, 24, 14, 20, 24, 27,
47 20, 24, 27, 30, 24, 27, 30, 34 }
51 { 6, 10, 13, 16, 18, 23, 25, 27,
52 10, 11, 16, 18, 23, 25, 27, 29,
53 13, 16, 18, 23, 25, 27, 29, 31,
54 16, 18, 23, 25, 27, 29, 31, 33,
55 18, 23, 25, 27, 29, 31, 33, 36,
56 23, 25, 27, 29, 31, 33, 36, 38,
57 25, 27, 29, 31, 33, 36, 38, 40,
58 27, 29, 31, 33, 36, 38, 40, 42 },
59 { 9, 13, 15, 17, 19, 21, 22, 24,
60 13, 13, 17, 19, 21, 22, 24, 25,
61 15, 17, 19, 21, 22, 24, 25, 27,
62 17, 19, 21, 22, 24, 25, 27, 28,
63 19, 21, 22, 24, 25, 27, 28, 30,
64 21, 22, 24, 25, 27, 28, 30, 32,
65 22, 24, 25, 27, 28, 30, 32, 33,
66 24, 25, 27, 28, 30, 32, 33, 35 }
114 if (cpb_count > 32
U) {
121 for (i = 0; i < cpb_count; i++) {
137 int aspect_ratio_info_present_flag;
138 unsigned int aspect_ratio_idc;
140 aspect_ratio_info_present_flag =
get_bits1(gb);
142 if (aspect_ratio_info_present_flag) {
198 if (!num_units_in_tick || !time_scale) {
200 "time_scale/num_units_in_tick invalid or unsupported (%u/%u)\n",
201 time_scale, num_units_in_tick);
242 "Clipping illegal num_reorder_frames %d\n",
256 int i, last = 8, next = 8;
259 memcpy(factors, fallback_list, size *
sizeof(
uint8_t));
261 for (i = 0; i <
size; i++) {
264 if (v < -128 || v > 127) {
268 next = (last + v) & 0xff;
271 memcpy(factors, jvt_list, size *
sizeof(
uint8_t));
274 last = factors[scan[i]] = next ? next : last;
281 const PPS *pps,
int is_sps,
338 int profile_idc, level_idc, constraint_set_flags = 0;
340 int i, log2_max_frame_num_minus4;
357 constraint_set_flags |=
get_bits1(gb) << 0;
358 constraint_set_flags |=
get_bits1(gb) << 1;
359 constraint_set_flags |=
get_bits1(gb) << 2;
360 constraint_set_flags |=
get_bits1(gb) << 3;
361 constraint_set_flags |=
get_bits1(gb) << 4;
362 constraint_set_flags |=
get_bits1(gb) << 5;
411 "Different chroma and luma bit depth");
436 "log2_max_frame_num_minus4 out of range (0-12): %d\n",
437 log2_max_frame_num_minus4);
496 if ((
unsigned)sps->
mb_width >= INT_MAX / 16 ||
497 (
unsigned)sps->
mb_height >= INT_MAX / 16 ||
506 #ifndef ALLOW_INTERLACE
509 "MBAFF support not included; enable it at compile-time.\n");
522 "values are l:%d r:%d t:%d b:%d\n",
523 crop_left, crop_right, crop_top, crop_bottom);
533 int step_x = 1 << hsub;
536 if (crop_left > (
unsigned)INT_MAX / 4 / step_x ||
537 crop_right > (unsigned)INT_MAX / 4 / step_x ||
538 crop_top > (
unsigned)INT_MAX / 4 / step_y ||
539 crop_bottom> (unsigned)INT_MAX / 4 / step_y ||
540 (crop_left + crop_right ) * step_x >= width ||
541 (crop_top + crop_bottom) * step_y >= height
543 av_log(avctx,
AV_LOG_ERROR,
"crop values invalid %d %d %d %d / %d %d\n", crop_left, crop_right, crop_top, crop_bottom, width, height);
570 if (!ignore_truncation)
592 static const char csp[4][5] = {
"Gray",
"420",
"422",
"444" };
594 "sps:%u profile:%d/%d poc:%d ref:%d %dx%d %s %s crop:%u/%u/%u/%u %s %s %"PRId32
"/%"PRId32
" b%d reo:%d\n",
635 for (i = 0; i < 6; i++) {
637 for (j = 0; j < i; j++)
646 for (q = 0; q < max_qp + 1; q++) {
649 for (x = 0; x < 64; x++)
661 for (i = 0; i < 6; i++) {
663 for (j = 0; j < i; j++)
672 for (q = 0; q < max_qp + 1; q++) {
675 for (x = 0; x < 16; x++)
692 for (i = 0; i < 6; i++)
693 for (x = 0; x < 16; x++)
696 for (i = 0; i < 6; i++)
697 for (x = 0; x < 64; x++)
705 const int max_qp = 51 + 6 * (depth - 8);
706 for (i = 0; i < max_qp + 1; i++)
715 if ((profile_idc == 66 || profile_idc == 77 ||
718 "Current profile doesn't provide more RBSP data in PPS, skipping\n");
765 "Invalid luma bit depth=%d\n",
771 "Unimplemented luma bit depth=%d",
843 "pps:%u sps:%u %s slice_groups:%d ref:%u/%u %s qp:%d/%d/%d/%d %s %s %s %s\n",
845 pps->
cabac ?
"CABAC" :
"CAVLC",
int ff_h264_decode_picture_parameter_set(GetBitContext *gb, AVCodecContext *avctx, H264ParamSets *ps, int bit_length)
Decode PPS.
static unsigned int show_bits1(GetBitContext *s)
#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)
static int shift(int a, int b)
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.
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
const uint8_t ff_h264_quant_rem6[QP_MAX_NUM+1]
uint32_t num_units_in_tick
const char * av_color_space_name(enum AVColorSpace space)
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
static const AVRational ff_h264_pixel_aspect[17]
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
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)
static const int level_max_dpb_mbs[][2]
int redundant_pic_cnt_present
redundant_pic_cnt_present_flag
#define AV_LOG_VERBOSE
Detailed information.
enum AVChromaLocation chroma_sample_location
This defines the location of chroma samples.
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 an unsigned Exp-Golomb code in the range 0 to 8190.
int poc_type
pic_order_cnt_type
int constrained_intra_pred
constrained_intra_pred_flag
const uint8_t ff_zigzag_scan[16+1]
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int weighted_pred
weighted_pred_flag
static int decode_scaling_matrices(GetBitContext *gb, const SPS *sps, const PPS *pps, int is_sps, uint8_t(*scaling_matrix4)[16], uint8_t(*scaling_matrix8)[64])
#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
const char * av_color_primaries_name(enum AVColorPrimaries primaries)
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 poc_cycle_length
num_ref_frames_in_pic_order_cnt_cycle
int colour_description_present_flag
uint8_t chroma_qp_table[2][QP_MAX_NUM+1]
pre-scaled (with chroma_qp_index_offset) version of qp_table
int init_qp
pic_init_qp_minus26 + 26
int direct_8x8_inference_flag
uint8_t scaling_matrix8[6][64]
static int decode_scaling_list(GetBitContext *gb, uint8_t *factors, int size, const uint8_t *jvt_list, const uint8_t *fallback_list)
#define FF_ARRAY_ELEMS(a)
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 FFmpeg, patches welcome.
int pic_order_present
pic_order_present_flag
short offset_for_ref_frame[256]
static int more_rbsp_data_in_pps(const SPS *sps, void *logctx)
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.
const uint8_t ff_h264_chroma_qp[7][QP_MAX_NUM+1]
int dpb_output_delay_length
dpb_output_delay_length_minus1 + 1
uint8_t * data
The data buffer.
int vui_parameters_present_flag
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
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)
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.
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
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
const char * av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
const uint8_t * buffer_end
static const uint8_t default_scaling4[2][16]
void ff_h264_ps_uninit(H264ParamSets *ps)
Uninit H264 param sets structure.
int bit_depth_luma
bit_depth_luma_minus8 + 8
int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx, H264ParamSets *ps, int ignore_truncation)
Decode SPS.
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)
#define MKTAG(a, b, c, d)
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]
static void build_qp_table(PPS *pps, int t, int index, const int depth)
int mb_slice_group_map_type
enum AVColorSpace colorspace