27 ui(8, sequence_header_code);
29 ui(12, horizontal_size_value);
30 ui(12, vertical_size_value);
35 ui(4, aspect_ratio_information);
36 ui(4, frame_rate_code);
37 ui(18, bit_rate_value);
41 ui(10, vbv_buffer_size_value);
42 ui(1, constrained_parameters_flag);
44 ui(1, load_intra_quantiser_matrix);
45 if (current->load_intra_quantiser_matrix) {
46 for (i = 0; i < 64; i++)
47 uis(8, intra_quantiser_matrix[i], 1, i);
50 ui(1, load_non_intra_quantiser_matrix);
51 if (current->load_non_intra_quantiser_matrix) {
52 for (i = 0; i < 64; i++)
53 uis(8, non_intra_quantiser_matrix[i], 1, i);
67 ui(8, user_data_start_code);
72 current->user_data_length = k /= 8;
75 if (!current->user_data_ref)
77 current->user_data = current->user_data_ref->data;
81 for (k = 0; k < current->user_data_length; k++)
93 HEADER(
"Sequence Extension");
95 ui(8, profile_and_level_indication);
96 ui(1, progressive_sequence);
98 ui(2, horizontal_size_extension);
99 ui(2, vertical_size_extension);
102 current->horizontal_size_extension << 12;
104 current->vertical_size_extension << 12;
107 ui(12, bit_rate_extension);
109 ui(8, vbv_buffer_size_extension);
111 ui(2, frame_rate_extension_n);
112 ui(5, frame_rate_extension_d);
122 HEADER(
"Sequence Display Extension");
126 ui(1, colour_description);
127 if (current->colour_description) {
128 ui(8, colour_primaries);
130 ui(8, matrix_coefficients);
133 ui(14, display_horizontal_size);
135 ui(14, display_vertical_size);
145 HEADER(
"Group of Pictures Header");
147 ui(8, group_start_code);
163 ui(8, picture_start_code);
165 ui(10, temporal_reference);
166 ui(3, picture_coding_type);
169 if (current->picture_coding_type == 2 ||
170 current->picture_coding_type == 3) {
171 ui(1, full_pel_forward_vector);
172 ui(3, forward_f_code);
175 if (current->picture_coding_type == 3) {
176 ui(1, full_pel_backward_vector);
177 ui(3, backward_f_code);
180 ui(1, extra_bit_picture);
191 HEADER(
"Picture Coding Extension");
198 ui(2, intra_dc_precision);
199 ui(2, picture_structure);
200 ui(1, top_field_first);
201 ui(1, frame_pred_frame_dct);
202 ui(1, concealment_motion_vectors);
204 ui(1, intra_vlc_format);
205 ui(1, alternate_scan);
206 ui(1, repeat_first_field);
207 ui(1, chroma_420_type);
208 ui(1, progressive_frame);
211 if (current->repeat_first_field) {
212 if (current->top_field_first)
220 if (current->picture_structure == 1 ||
221 current->picture_structure == 2) {
224 if (current->repeat_first_field)
231 ui(1, composite_display_flag);
232 if (current->composite_display_flag) {
234 ui(3, field_sequence);
236 ui(7, burst_amplitude);
237 ui(8, sub_carrier_phase);
248 HEADER(
"Quant Matrix Extension");
250 ui(1, load_intra_quantiser_matrix);
251 if (current->load_intra_quantiser_matrix) {
252 for (i = 0; i < 64; i++)
253 uis(8, intra_quantiser_matrix[i], 1, i);
256 ui(1, load_non_intra_quantiser_matrix);
257 if (current->load_non_intra_quantiser_matrix) {
258 for (i = 0; i < 64; i++)
259 uis(8, non_intra_quantiser_matrix[i], 1, i);
262 ui(1, load_chroma_intra_quantiser_matrix);
263 if (current->load_chroma_intra_quantiser_matrix) {
264 for (i = 0; i < 64; i++)
265 uis(8, intra_quantiser_matrix[i], 1, i);
268 ui(1, load_chroma_non_intra_quantiser_matrix);
269 if (current->load_chroma_non_intra_quantiser_matrix) {
270 for (i = 0; i < 64; i++)
271 uis(8, chroma_non_intra_quantiser_matrix[i], 1, i);
283 HEADER(
"Picture Display Extension");
286 ui(16, frame_centre_horizontal_offset[i]);
288 ui(16, frame_centre_vertical_offset[i]);
302 ui(8, extension_start_code);
303 ui(4, extension_start_code_identifier);
305 switch (current->extension_start_code_identifier) {
308 (
ctx, rw, ¤t->data.sequence);
311 (
ctx, rw, ¤t->data.sequence_display);
314 (
ctx, rw, ¤t->data.quant_matrix);
317 (
ctx, rw, ¤t->data.picture_display);
320 (
ctx, rw, ¤t->data.picture_coding);
323 current->extension_start_code_identifier);
336 ui(8, slice_vertical_position);
339 ui(3, slice_vertical_position_extension);
342 ui(7, priority_breakpoint);
345 ui(5, quantiser_scale_code);
347 if (
nextbits(1, 1, current->slice_extension_flag)) {
348 ui(1, slice_extension_flag);
350 ui(1, slice_picture_id_enable);
351 ui(6, slice_picture_id);
359 for (k = 0;
nextbits(1, 1, bit); k++)
361 current->extra_information_length = k;
364 current->extra_information =
365 av_malloc(current->extra_information_length);
366 if (!current->extra_information)
368 for (k = 0; k < current->extra_information_length; k++) {
369 xui(1, extra_bit_slice, bit, 0);
370 xui(8, extra_information_slice[k],
371 current->extra_information[k], 1, k);
375 for (k = 0; k < current->extra_information_length; k++) {
376 xui(1, extra_bit_slice, 1, 0);
377 xui(8, extra_information_slice[k],
378 current->extra_information[k], 1, k);
383 ui(1, extra_bit_slice);
#define nextbits(width, compare, var)
static int FUNC() picture_coding_extension(CodedBitstreamContext *ctx, RWContext *rw, MPEG2RawPictureCodingExtension *current)
uint8_t number_of_frame_centre_offsets
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int FUNC() extension_data(CodedBitstreamContext *ctx, RWContext *rw, MPEG2RawExtensionData *current)
#define xui(width, name, var, subs,...)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static int FUNC() picture_display_extension(CodedBitstreamContext *ctx, RWContext *rw, MPEG2RawPictureDisplayExtension *current)
static int get_bits_left(GetBitContext *gb)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVS_Value void * user_data
static int FUNC() sequence_display_extension(CodedBitstreamContext *ctx, RWContext *rw, MPEG2RawSequenceDisplayExtension *current)
static int FUNC() quant_matrix_extension(CodedBitstreamContext *ctx, RWContext *rw, MPEG2RawQuantMatrixExtension *current)
uint8_t progressive_sequence
static int FUNC() picture_header(CodedBitstreamContext *ctx, RWContext *rw, MPEG2RawPictureHeader *current)
static const struct TransferCharacteristics transfer_characteristics[AVCOL_TRC_NB]
static int FUNC() slice_header(CodedBitstreamContext *ctx, RWContext *rw, MPEG2RawSliceHeader *current)
static int FUNC() sequence_extension(CodedBitstreamContext *ctx, RWContext *rw, MPEG2RawSequenceExtension *current)
#define uis(width, name, subs,...)
static int FUNC() sequence_header(CodedBitstreamContext *ctx, RWContext *rw, MPEG2RawSequenceHeader *current)
AVBufferRef * av_buffer_allocz(int size)
Same as av_buffer_alloc(), except the returned buffer will be initialized to zero.
static void skip_bits(GetBitContext *s, int n)
Context structure for coded bitstream operations.
static int FUNC() group_of_pictures_header(CodedBitstreamContext *ctx, RWContext *rw, MPEG2RawGroupOfPicturesHeader *current)
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
void * priv_data
Format private data.