38 #define MIN_LOG2_MAX_FRAME_NUM 4
40 #define EXTENDED_SAR 255
43 { 6, 13, 20, 28, 13, 20, 28, 32,
44 20, 28, 32, 37, 28, 32, 37, 42 },
45 { 10, 14, 20, 24, 14, 20, 24, 27,
46 20, 24, 27, 30, 24, 27, 30, 34 }
50 { 6, 10, 13, 16, 18, 23, 25, 27,
51 10, 11, 16, 18, 23, 25, 27, 29,
52 13, 16, 18, 23, 25, 27, 29, 31,
53 16, 18, 23, 25, 27, 29, 31, 33,
54 18, 23, 25, 27, 29, 31, 33, 36,
55 23, 25, 27, 29, 31, 33, 36, 38,
56 25, 27, 29, 31, 33, 36, 38, 40,
57 27, 29, 31, 33, 36, 38, 40, 42 },
58 { 9, 13, 15, 17, 19, 21, 22, 24,
59 13, 13, 17, 19, 21, 22, 24, 25,
60 15, 17, 19, 21, 22, 24, 25, 27,
61 17, 19, 21, 22, 24, 25, 27, 28,
62 19, 21, 22, 24, 25, 27, 28, 30,
63 21, 22, 24, 25, 27, 28, 30, 32,
64 22, 24, 25, 27, 28, 30, 32, 33,
65 24, 25, 27, 28, 30, 32, 33, 35 }
113 if (cpb_count > 32
U) {
120 for (i = 0; i < cpb_count; i++) {
136 int aspect_ratio_info_present_flag;
137 unsigned int aspect_ratio_idc;
139 aspect_ratio_info_present_flag =
get_bits1(gb);
141 if (aspect_ratio_info_present_flag) {
197 if (!num_units_in_tick || !time_scale) {
199 "time_scale/num_units_in_tick invalid or unsupported (%u/%u)\n",
200 time_scale, num_units_in_tick);
241 "Clipping illegal num_reorder_frames %d\n",
255 int i, last = 8, next = 8;
258 memcpy(factors, fallback_list, size *
sizeof(
uint8_t));
260 for (i = 0; i <
size; i++) {
263 if (v < -128 || v > 127) {
267 next = (last + v) & 0xff;
270 memcpy(factors, jvt_list, size *
sizeof(
uint8_t));
273 last = factors[scan[i]] = next ? next : last;
280 const PPS *
pps,
int is_sps,
339 int i, log2_max_frame_num_minus4;
356 constraint_set_flags |=
get_bits1(gb) << 0;
357 constraint_set_flags |=
get_bits1(gb) << 1;
358 constraint_set_flags |=
get_bits1(gb) << 2;
359 constraint_set_flags |=
get_bits1(gb) << 3;
360 constraint_set_flags |=
get_bits1(gb) << 4;
361 constraint_set_flags |=
get_bits1(gb) << 5;
410 "Different chroma and luma bit depth");
435 "log2_max_frame_num_minus4 out of range (0-12): %d\n",
436 log2_max_frame_num_minus4);
495 if ((
unsigned)sps->
mb_width >= INT_MAX / 16 ||
496 (
unsigned)sps->
mb_height >= INT_MAX / 16 ||
505 #ifndef ALLOW_INTERLACE
508 "MBAFF support not included; enable it at compile-time.\n");
521 "values are l:%d r:%d t:%d b:%d\n",
522 crop_left, crop_right, crop_top, crop_bottom);
532 int step_x = 1 << hsub;
535 if (crop_left > (
unsigned)INT_MAX / 4 / step_x ||
536 crop_right > (unsigned)INT_MAX / 4 / step_x ||
537 crop_top > (
unsigned)INT_MAX / 4 / step_y ||
538 crop_bottom> (unsigned)INT_MAX / 4 / step_y ||
539 (crop_left + crop_right ) * step_x >= width ||
540 (crop_top + crop_bottom) * step_y >= height
542 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);
569 if (!ignore_truncation)
591 static const char csp[4][5] = {
"Gray",
"420",
"422",
"444" };
593 "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",
634 for (i = 0; i < 6; i++) {
636 for (j = 0; j < i; j++)
645 for (q = 0; q < max_qp + 1; q++) {
648 for (x = 0; x < 64; x++)
660 for (i = 0; i < 6; i++) {
662 for (j = 0; j < i; j++)
671 for (q = 0; q < max_qp + 1; q++) {
674 for (x = 0; x < 16; x++)
691 for (i = 0; i < 6; i++)
692 for (x = 0; x < 16; x++)
695 for (i = 0; i < 6; i++)
696 for (x = 0; x < 64; x++)
704 const int max_qp = 51 + 6 * (depth - 8);
705 for (i = 0; i < max_qp + 1; i++)
714 if ((profile_idc == 66 || profile_idc == 77 ||
717 "Current profile doesn't provide more RBSP data in PPS, skipping\n");
764 "Invalid luma bit depth=%d\n",
770 "Unimplemented luma bit depth=%d",
842 "pps:%u sps:%u %s slice_groups:%d ref:%u/%u %s qp:%d/%d/%d/%d %s %s %s %s\n",
844 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)
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)
static int FUNC() pps(CodedBitstreamContext *ctx, RWContext *rw, H264RawPPS *current)
const uint8_t ff_zigzag_direct[64]
static int FUNC() sps(CodedBitstreamContext *ctx, RWContext *rw, H264RawSPS *current)
#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]
#define MAX_LOG2_MAX_FRAME_NUM
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