42#define AVERROR_PS_NOT_FOUND FFERRTAG(0xF8,'?','P','S')
45 1, 1, 1, 2, 2, 3, 3, 2, 3
50 h->recovery_point.recovery_frame_cnt = -1;
52 h->picture_timing.dpb_output_delay = 0;
53 h->picture_timing.cpb_removal_delay = -1;
55 h->picture_timing.present = 0;
56 h->buffering_period.present = 0;
57 h->common.frame_packing.present = 0;
58 h->common.display_orientation.present = 0;
72 if (
sps->nal_hrd_parameters_present_flag ||
73 sps->vcl_hrd_parameters_present_flag) {
77 if (
sps->pic_struct_present_flag) {
78 unsigned int i, num_clock_ts;
88 for (
i = 0;
i < num_clock_ts;
i++) {
91 unsigned int full_timestamp_flag;
92 unsigned int counting_type, cnt_dropped_flag;
96 full_timestamp_flag =
get_bits(&gb, 1);
99 if (cnt_dropped_flag && counting_type > 1 && counting_type < 7)
102 if (full_timestamp_flag) {
119 if (
sps->time_offset_length > 0)
121 sps->time_offset_length);
126 h->ct_type,
h->pic_struct);
137 if (
size >
sizeof(
h->payload)) {
143 h->payload_size_bytes =
size;
154 av_log(logctx,
AV_LOG_ERROR,
"recovery_frame_cnt %u is out of range\n", recovery_frame_cnt);
158 h->recovery_frame_cnt = recovery_frame_cnt;
175 if (sps_id > 31 || !ps->
sps_list[sps_id]) {
177 "non-existing SPS %d referenced in buffering period\n", sps_id);
183 if (
sps->nal_hrd_parameters_present_flag) {
184 for (sched_sel_idx = 0; sched_sel_idx <
sps->cpb_cnt; sched_sel_idx++) {
185 h->initial_cpb_removal_delay[sched_sel_idx] =
191 if (
sps->vcl_hrd_parameters_present_flag) {
192 for (sched_sel_idx = 0; sched_sel_idx <
sps->cpb_cnt; sched_sel_idx++) {
193 h->initial_cpb_removal_delay[sched_sel_idx] =
206 h->green_metadata_type = bytestream2_get_byte(gb);
208 if (
h->green_metadata_type == 0) {
209 h->period_type = bytestream2_get_byte(gb);
211 if (
h->period_type == 2)
212 h->num_seconds = bytestream2_get_be16(gb);
213 else if (
h->period_type == 3)
214 h->num_pictures = bytestream2_get_be16(gb);
216 h->percent_non_zero_macroblocks = bytestream2_get_byte(gb);
217 h->percent_intra_coded_macroblocks = bytestream2_get_byte(gb);
218 h->percent_six_tap_filtering = bytestream2_get_byte(gb);
219 h->percent_alpha_point_deblocking_instance = bytestream2_get_byte(gb);
221 }
else if (
h->green_metadata_type == 1) {
222 h->xsd_metric_type = bytestream2_get_byte(gb);
223 h->xsd_metric_value = bytestream2_get_be16(gb);
249 type += bytestream2_peek_byteu(&gbyte);
250 }
while (bytestream2_get_byteu(&gbyte) == 255);
255 size += bytestream2_peek_byteu(&gbyte);
256 }
while (bytestream2_get_byteu(&gbyte) == 255);
284 &gb_payload, &gbyte_payload, logctx);
306 if (
h->arrangement_cancel_flag == 0) {
307 switch (
h->arrangement_type) {
309 if (
h->content_interpretation_type == 2)
310 return "checkerboard_rl";
312 return "checkerboard_lr";
314 if (
h->content_interpretation_type == 2)
315 return "col_interleaved_rl";
317 return "col_interleaved_lr";
319 if (
h->content_interpretation_type == 2)
320 return "row_interleaved_rl";
322 return "row_interleaved_lr";
324 if (
h->content_interpretation_type == 2)
329 if (
h->content_interpretation_type == 2)
334 if (
h->content_interpretation_type == 2)
342 }
else if (
h->arrangement_cancel_flag == 1) {
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
#define bytestream2_peek_ne16
static av_always_inline void bytestream2_skipu(GetByteContext *g, unsigned int size)
static av_always_inline unsigned int bytestream2_get_bufferu(GetByteContext *g, uint8_t *dst, unsigned int size)
static av_always_inline int bytestream2_get_bytes_left(const GetByteContext *g)
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
#define i(width, name, range_min, range_max)
static int FUNC sps(CodedBitstreamContext *ctx, RWContext *rw, H264RawSPS *current)
bitstream reader API header.
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
static int get_bits_left(GetBitContext *gb)
static void skip_bits(GetBitContext *s, int n)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static int get_bits_count(const GetBitContext *s)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static int get_ue_golomb_31(GetBitContext *gb)
read unsigned exp golomb code, constraint to a max of 31.
static unsigned get_ue_golomb_long(GetBitContext *gb)
Read an unsigned Exp-Golomb code in the range 0 to UINT32_MAX-1.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void ff_h2645_sei_reset(H2645SEI *s)
int ff_h2645_sei_message_decode(H2645SEI *h, enum SEIType type, enum AVCodecID codec_id, GetBitContext *gb, GetByteContext *gbyte, void *logctx)
Decode a single SEI message.
@ FF_H2645_SEI_MESSAGE_UNHANDLED
H.264 parameter set handling.
#define MAX_LOG2_MAX_FRAME_NUM
#define AVERROR_PS_NOT_FOUND
int ff_h264_sei_decode(H264SEIContext *h, GetBitContext *gb, const H264ParamSets *ps, void *logctx)
const char * ff_h264_sei_stereo_mode(const H2645SEIFramePacking *h)
Get stereo_mode string from the h264 frame_packing_arrangement.
void ff_h264_sei_uninit(H264SEIContext *h)
Reset SEI values at the beginning of the frame.
static int decode_green_metadata(H264SEIGreenMetaData *h, GetByteContext *gb)
static int decode_picture_timing(H264SEIPictureTiming *h, GetByteContext *gb, void *logctx)
static int decode_recovery_point(H264SEIRecoveryPoint *h, GetBitContext *gb, void *logctx)
static const uint8_t sei_num_clock_ts_table[9]
int ff_h264_sei_process_picture_timing(H264SEIPictureTiming *h, const SPS *sps, void *logctx)
Parse the contents of a picture timing message given an active SPS.
static int decode_buffering_period(H264SEIBufferingPeriod *h, GetBitContext *gb, const H264ParamSets *ps, void *logctx)
@ H264_SEI_PIC_STRUCT_FRAME_TRIPLING
8: frame tripling
Utility Preprocessor macros.
Memory handling functions.
@ SEI_FPA_TYPE_TOP_BOTTOM
@ SEI_FPA_H264_TYPE_CHECKERBOARD
@ SEI_FPA_TYPE_INTERLEAVE_TEMPORAL
@ SEI_FPA_H264_TYPE_INTERLEAVE_COLUMN
@ SEI_FPA_H264_TYPE_INTERLEAVE_ROW
@ SEI_FPA_TYPE_SIDE_BY_SIDE
@ SEI_TYPE_RECOVERY_POINT
@ SEI_TYPE_GREEN_METADATA
@ SEI_TYPE_BUFFERING_PERIOD
const SPS * sps_list[MAX_SPS_COUNT]
RefStruct references.