FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/cbs_mpeg2_syntax_template.c
Date: 2024-11-20 23:03:26
Exec Total Coverage
Lines: 193 220 87.7%
Functions: 24 24 100.0%
Branches: 155 289 53.6%

Line Branch Exec Source
1 /*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19 24 static int FUNC(sequence_header)(CodedBitstreamContext *ctx, RWContext *rw,
20 MPEG2RawSequenceHeader *current)
21 {
22 24 CodedBitstreamMPEG2Context *mpeg2 = ctx->priv_data;
23 int err, i;
24
25 24 HEADER("Sequence Header");
26
27
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
24 ui(8, sequence_header_code);
28
29
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
24 uir(12, horizontal_size_value);
30
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
24 uir(12, vertical_size_value);
31
32 24 mpeg2->horizontal_size = current->horizontal_size_value;
33 24 mpeg2->vertical_size = current->vertical_size_value;
34
35
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
24 uir(4, aspect_ratio_information);
36
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
24 uir(4, frame_rate_code);
37
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
24 ui(18, bit_rate_value);
38
39
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
24 marker_bit();
40
41
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
24 ui(10, vbv_buffer_size_value);
42
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
24 ui(1, constrained_parameters_flag);
43
44
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
24 ui(1, load_intra_quantiser_matrix);
45
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 4 times.
24 if (current->load_intra_quantiser_matrix) {
46
2/2
✓ Branch 0 taken 512 times.
✓ Branch 1 taken 8 times.
1040 for (i = 0; i < 64; i++)
47
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 512 times.
1024 uirs(8, intra_quantiser_matrix[i], 1, i);
48 }
49
50
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
24 ui(1, load_non_intra_quantiser_matrix);
51
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 4 times.
24 if (current->load_non_intra_quantiser_matrix) {
52
2/2
✓ Branch 0 taken 512 times.
✓ Branch 1 taken 8 times.
1040 for (i = 0; i < 64; i++)
53
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 512 times.
1024 uirs(8, non_intra_quantiser_matrix[i], 1, i);
54 }
55
56 24 return 0;
57 }
58
59 56 static int FUNC(user_data)(CodedBitstreamContext *ctx, RWContext *rw,
60 MPEG2RawUserData *current)
61 {
62 size_t k;
63 int err;
64
65 56 HEADER("User Data");
66
67
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 28 times.
56 ui(8, user_data_start_code);
68
69 #ifdef READ
70 28 k = get_bits_left(rw);
71
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
28 av_assert0(k % 8 == 0);
72 28 current->user_data_length = k /= 8;
73
1/2
✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
28 if (k > 0) {
74 28 current->user_data_ref = av_buffer_allocz(k + AV_INPUT_BUFFER_PADDING_SIZE);
75
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
28 if (!current->user_data_ref)
76 return AVERROR(ENOMEM);
77 28 current->user_data = current->user_data_ref->data;
78 }
79 #endif
80
81
2/2
✓ Branch 0 taken 650 times.
✓ Branch 1 taken 28 times.
1356 for (k = 0; k < current->user_data_length; k++)
82
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
1300 uis(8, user_data[k], 1, k);
83
84 56 return 0;
85 }
86
87 24 static int FUNC(sequence_extension)(CodedBitstreamContext *ctx, RWContext *rw,
88 MPEG2RawSequenceExtension *current)
89 {
90 24 CodedBitstreamMPEG2Context *mpeg2 = ctx->priv_data;
91 int err;
92
93 24 HEADER("Sequence Extension");
94
95
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
24 ui(8, profile_and_level_indication);
96
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
24 ui(1, progressive_sequence);
97
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
24 ui(2, chroma_format);
98
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
24 ui(2, horizontal_size_extension);
99
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
24 ui(2, vertical_size_extension);
100
101 24 mpeg2->horizontal_size = (mpeg2->horizontal_size & 0xfff) |
102 24 current->horizontal_size_extension << 12;
103 24 mpeg2->vertical_size = (mpeg2->vertical_size & 0xfff) |
104 24 current->vertical_size_extension << 12;
105 24 mpeg2->progressive_sequence = current->progressive_sequence;
106
107
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
24 ui(12, bit_rate_extension);
108
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
24 marker_bit();
109
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
24 ui(8, vbv_buffer_size_extension);
110
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
24 ui(1, low_delay);
111
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
24 ui(2, frame_rate_extension_n);
112
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
24 ui(5, frame_rate_extension_d);
113
114 24 return 0;
115 }
116
117 12 static int FUNC(sequence_display_extension)(CodedBitstreamContext *ctx, RWContext *rw,
118 MPEG2RawSequenceDisplayExtension *current)
119 {
120 int err;
121
122 12 HEADER("Sequence Display Extension");
123
124
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
12 ui(3, video_format);
125
126
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
12 ui(1, colour_description);
127
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 4 times.
12 if (current->colour_description) {
128 #ifdef READ
129 #define READ_AND_PATCH(name) do { \
130 ui(8, name); \
131 if (current->name == 0) { \
132 current->name = 2; \
133 av_log(ctx->log_ctx, AV_LOG_WARNING, "%s in a sequence display " \
134 "extension had the invalid value 0. Setting it to 2 " \
135 "(meaning unknown) instead.\n", #name); \
136 } \
137 } while (0)
138
2/4
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 READ_AND_PATCH(colour_primaries);
139
2/4
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 READ_AND_PATCH(transfer_characteristics);
140
2/4
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 READ_AND_PATCH(matrix_coefficients);
141 #undef READ_AND_PATCH
142 #else
143
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
2 uir(8, colour_primaries);
144
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
2 uir(8, transfer_characteristics);
145
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
2 uir(8, matrix_coefficients);
146 #endif
147 } else {
148
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
8 infer(colour_primaries, 2);
149
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
8 infer(transfer_characteristics, 2);
150
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
8 infer(matrix_coefficients, 2);
151 }
152
153
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
12 ui(14, display_horizontal_size);
154
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
12 marker_bit();
155
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
12 ui(14, display_vertical_size);
156
157 12 return 0;
158 }
159
160 8 static int FUNC(group_of_pictures_header)(CodedBitstreamContext *ctx, RWContext *rw,
161 MPEG2RawGroupOfPicturesHeader *current)
162 {
163 int err;
164
165 8 HEADER("Group of Pictures Header");
166
167
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
8 ui(8, group_start_code);
168
169
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
8 ui(25, time_code);
170
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
8 ui(1, closed_gop);
171
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
8 ui(1, broken_link);
172
173 8 return 0;
174 }
175
176 35060 static int FUNC(extra_information)(CodedBitstreamContext *ctx, RWContext *rw,
177 MPEG2RawExtraInformation *current,
178 const char *element_name, const char *marker_name)
179 {
180 int err;
181 size_t k;
182 #ifdef READ
183 17530 GetBitContext start = *rw;
184 uint8_t bit;
185
186
2/4
✓ Branch 1 taken 8765 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8765 times.
17530 for (k = 0; nextbits(1, 1, bit); k++)
187 skip_bits(rw, 1 + 8);
188 17530 current->extra_information_length = k;
189
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8765 times.
17530 if (k > 0) {
190 *rw = start;
191 current->extra_information_ref =
192 av_buffer_allocz(k + AV_INPUT_BUFFER_PADDING_SIZE);
193 if (!current->extra_information_ref)
194 return AVERROR(ENOMEM);
195 current->extra_information = current->extra_information_ref->data;
196 }
197 #endif
198
199
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 17530 times.
35060 for (k = 0; k < current->extra_information_length; k++) {
200 bit(marker_name, 1);
201 xuia(8, element_name,
202 current->extra_information[k], 0, 255, 1, k);
203 }
204
205
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 17530 times.
35060 bit(marker_name, 0);
206
207 35060 return 0;
208 }
209
210 76 static int FUNC(picture_header)(CodedBitstreamContext *ctx, RWContext *rw,
211 MPEG2RawPictureHeader *current)
212 {
213 int err;
214
215 76 HEADER("Picture Header");
216
217
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
76 ui(8, picture_start_code);
218
219
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
76 ui(10, temporal_reference);
220
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
76 uir(3, picture_coding_type);
221
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
76 ui(16, vbv_delay);
222
223
2/2
✓ Branch 0 taken 26 times.
✓ Branch 1 taken 12 times.
76 if (current->picture_coding_type == 2 ||
224
2/2
✓ Branch 0 taken 18 times.
✓ Branch 1 taken 8 times.
52 current->picture_coding_type == 3) {
225
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 30 times.
60 ui(1, full_pel_forward_vector);
226
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 30 times.
60 ui(3, forward_f_code);
227 }
228
229
2/2
✓ Branch 0 taken 18 times.
✓ Branch 1 taken 20 times.
76 if (current->picture_coding_type == 3) {
230
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 18 times.
36 ui(1, full_pel_backward_vector);
231
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 18 times.
36 ui(3, backward_f_code);
232 }
233
234
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
76 CHECK(FUNC(extra_information)(ctx, rw, &current->extra_information_picture,
235 "extra_information_picture[k]", "extra_bit_picture"));
236
237 76 return 0;
238 }
239
240 76 static int FUNC(picture_coding_extension)(CodedBitstreamContext *ctx, RWContext *rw,
241 MPEG2RawPictureCodingExtension *current)
242 {
243 76 CodedBitstreamMPEG2Context *mpeg2 = ctx->priv_data;
244 int err;
245
246 76 HEADER("Picture Coding Extension");
247
248
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
76 uir(4, f_code[0][0]);
249
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
76 uir(4, f_code[0][1]);
250
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
76 uir(4, f_code[1][0]);
251
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
76 uir(4, f_code[1][1]);
252
253
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
76 ui(2, intra_dc_precision);
254
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
76 ui(2, picture_structure);
255
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
76 ui(1, top_field_first);
256
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
76 ui(1, frame_pred_frame_dct);
257
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
76 ui(1, concealment_motion_vectors);
258
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
76 ui(1, q_scale_type);
259
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
76 ui(1, intra_vlc_format);
260
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
76 ui(1, alternate_scan);
261
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
76 ui(1, repeat_first_field);
262
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
76 ui(1, chroma_420_type);
263
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
76 ui(1, progressive_frame);
264
265
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 38 times.
76 if (mpeg2->progressive_sequence) {
266 if (current->repeat_first_field) {
267 if (current->top_field_first)
268 mpeg2->number_of_frame_centre_offsets = 3;
269 else
270 mpeg2->number_of_frame_centre_offsets = 2;
271 } else {
272 mpeg2->number_of_frame_centre_offsets = 1;
273 }
274 } else {
275
2/2
✓ Branch 0 taken 30 times.
✓ Branch 1 taken 8 times.
76 if (current->picture_structure == 1 || // Top field.
276
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 22 times.
60 current->picture_structure == 2) { // Bottom field.
277 32 mpeg2->number_of_frame_centre_offsets = 1;
278 } else {
279
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 16 times.
44 if (current->repeat_first_field)
280 12 mpeg2->number_of_frame_centre_offsets = 3;
281 else
282 32 mpeg2->number_of_frame_centre_offsets = 2;
283 }
284 }
285
286
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
76 ui(1, composite_display_flag);
287
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 38 times.
76 if (current->composite_display_flag) {
288 ui(1, v_axis);
289 ui(3, field_sequence);
290 ui(1, sub_carrier);
291 ui(7, burst_amplitude);
292 ui(8, sub_carrier_phase);
293 }
294
295 76 return 0;
296 }
297
298 44 static int FUNC(quant_matrix_extension)(CodedBitstreamContext *ctx, RWContext *rw,
299 MPEG2RawQuantMatrixExtension *current)
300 {
301 int err, i;
302
303 44 HEADER("Quant Matrix Extension");
304
305
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 22 times.
44 ui(1, load_intra_quantiser_matrix);
306
2/2
✓ Branch 0 taken 20 times.
✓ Branch 1 taken 2 times.
44 if (current->load_intra_quantiser_matrix) {
307
2/2
✓ Branch 0 taken 1280 times.
✓ Branch 1 taken 20 times.
2600 for (i = 0; i < 64; i++)
308
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1280 times.
2560 uirs(8, intra_quantiser_matrix[i], 1, i);
309 }
310
311
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 22 times.
44 ui(1, load_non_intra_quantiser_matrix);
312
1/2
✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
44 if (current->load_non_intra_quantiser_matrix) {
313
2/2
✓ Branch 0 taken 1408 times.
✓ Branch 1 taken 22 times.
2860 for (i = 0; i < 64; i++)
314
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1408 times.
2816 uirs(8, non_intra_quantiser_matrix[i], 1, i);
315 }
316
317
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 22 times.
44 ui(1, load_chroma_intra_quantiser_matrix);
318
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 20 times.
44 if (current->load_chroma_intra_quantiser_matrix) {
319
2/2
✓ Branch 0 taken 128 times.
✓ Branch 1 taken 2 times.
260 for (i = 0; i < 64; i++)
320
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 128 times.
256 uirs(8, intra_quantiser_matrix[i], 1, i);
321 }
322
323
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 22 times.
44 ui(1, load_chroma_non_intra_quantiser_matrix);
324
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 20 times.
44 if (current->load_chroma_non_intra_quantiser_matrix) {
325
2/2
✓ Branch 0 taken 128 times.
✓ Branch 1 taken 2 times.
260 for (i = 0; i < 64; i++)
326
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 128 times.
256 uirs(8, chroma_non_intra_quantiser_matrix[i], 1, i);
327 }
328
329 44 return 0;
330 }
331
332 56 static int FUNC(picture_display_extension)(CodedBitstreamContext *ctx, RWContext *rw,
333 MPEG2RawPictureDisplayExtension *current)
334 {
335 56 CodedBitstreamMPEG2Context *mpeg2 = ctx->priv_data;
336 int err, i;
337
338 56 HEADER("Picture Display Extension");
339
340
2/2
✓ Branch 0 taken 50 times.
✓ Branch 1 taken 28 times.
156 for (i = 0; i < mpeg2->number_of_frame_centre_offsets; i++) {
341
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 50 times.
100 sis(16, frame_centre_horizontal_offset[i], 1, i);
342
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 50 times.
100 marker_bit();
343
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 50 times.
100 sis(16, frame_centre_vertical_offset[i], 1, i);
344
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 50 times.
100 marker_bit();
345 }
346
347 56 return 0;
348 }
349
350 212 static int FUNC(extension_data)(CodedBitstreamContext *ctx, RWContext *rw,
351 MPEG2RawExtensionData *current)
352 {
353 int err;
354
355 212 HEADER("Extension Data");
356
357
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 106 times.
212 ui(8, extension_start_code);
358
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 106 times.
212 ui(4, extension_start_code_identifier);
359
360
5/6
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 22 times.
✓ Branch 3 taken 28 times.
✓ Branch 4 taken 38 times.
✗ Branch 5 not taken.
212 switch (current->extension_start_code_identifier) {
361 24 case MPEG2_EXTENSION_SEQUENCE:
362 24 return FUNC(sequence_extension)
363 (ctx, rw, &current->data.sequence);
364 12 case MPEG2_EXTENSION_SEQUENCE_DISPLAY:
365 12 return FUNC(sequence_display_extension)
366 (ctx, rw, &current->data.sequence_display);
367 44 case MPEG2_EXTENSION_QUANT_MATRIX:
368 44 return FUNC(quant_matrix_extension)
369 (ctx, rw, &current->data.quant_matrix);
370 56 case MPEG2_EXTENSION_PICTURE_DISPLAY:
371 56 return FUNC(picture_display_extension)
372 (ctx, rw, &current->data.picture_display);
373 76 case MPEG2_EXTENSION_PICTURE_CODING:
374 76 return FUNC(picture_coding_extension)
375 (ctx, rw, &current->data.picture_coding);
376 default:
377 av_log(ctx->log_ctx, AV_LOG_ERROR, "Extension ID %d not supported.\n",
378 current->extension_start_code_identifier);
379 return AVERROR_PATCHWELCOME;
380 }
381 }
382
383 34984 static int FUNC(slice_header)(CodedBitstreamContext *ctx, RWContext *rw,
384 MPEG2RawSliceHeader *current)
385 {
386 34984 CodedBitstreamMPEG2Context *mpeg2 = ctx->priv_data;
387 int err;
388
389 34984 HEADER("Slice Header");
390
391
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 17492 times.
34984 ui(8, slice_vertical_position);
392
393
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 17492 times.
34984 if (mpeg2->vertical_size > 2800)
394 ui(3, slice_vertical_position_extension);
395
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 17492 times.
34984 if (mpeg2->scalable) {
396 if (mpeg2->scalable_mode == 0)
397 ui(7, priority_breakpoint);
398 }
399
400
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 17492 times.
34984 uir(5, quantiser_scale_code);
401
402
4/5
✓ Branch 0 taken 6957 times.
✓ Branch 1 taken 10535 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6957 times.
✓ Branch 5 taken 1789 times.
34984 if (nextbits(1, 1, current->slice_extension_flag)) {
403
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 13914 times.
27828 ui(1, slice_extension_flag);
404
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 13914 times.
27828 ui(1, intra_slice);
405
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 13914 times.
27828 ui(1, slice_picture_id_enable);
406
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 13914 times.
27828 ui(6, slice_picture_id);
407 }
408
409
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 17492 times.
34984 CHECK(FUNC(extra_information)(ctx, rw, &current->extra_information_slice,
410 "extra_information_slice[k]", "extra_bit_slice"));
411
412 34984 return 0;
413 }
414
415 6 static int FUNC(sequence_end)(CodedBitstreamContext *ctx, RWContext *rw,
416 MPEG2RawSequenceEnd *current)
417 {
418 int err;
419
420 6 HEADER("Sequence End");
421
422 6 ui(8, sequence_end_code);
423
424 6 return 0;
425 }
426