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 | 11266 | static int FUNC(rbsp_trailing_bits)(CodedBitstreamContext *ctx, RWContext *rw) | |
20 | { | ||
21 | int err; | ||
22 | |||
23 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 2 taken 5632 times.
|
11266 | fixed(1, rbsp_stop_one_bit, 1); |
24 |
2/2✓ Branch 1 taken 24719 times.
✓ Branch 2 taken 5632 times.
|
60702 | while (byte_alignment(rw) != 0) |
25 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24719 times.
|
49438 | fixed(1, rbsp_alignment_zero_bit, 0); |
26 | |||
27 | 11264 | return 0; | |
28 | } | ||
29 | |||
30 | 34532 | static int FUNC(nal_unit_header)(CodedBitstreamContext *ctx, RWContext *rw, | |
31 | H264RawNALUnitHeader *current, | ||
32 | uint32_t valid_type_mask) | ||
33 | { | ||
34 | int err; | ||
35 | |||
36 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 17266 times.
|
34532 | fixed(1, forbidden_zero_bit, 0); |
37 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 17266 times.
|
34532 | ub(2, nal_ref_idc); |
38 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 17266 times.
|
34532 | ub(5, nal_unit_type); |
39 | |||
40 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17266 times.
|
34532 | if (!(1 << current->nal_unit_type & valid_type_mask)) { |
41 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid NAL unit type %d.\n", | |
42 | ✗ | current->nal_unit_type); | |
43 | ✗ | return AVERROR_INVALIDDATA; | |
44 | } | ||
45 | |||
46 |
1/2✓ Branch 0 taken 17266 times.
✗ Branch 1 not taken.
|
34532 | if (current->nal_unit_type == 14 || |
47 |
1/2✓ Branch 0 taken 17266 times.
✗ Branch 1 not taken.
|
34532 | current->nal_unit_type == 20 || |
48 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17266 times.
|
34532 | current->nal_unit_type == 21) { |
49 | ✗ | if (current->nal_unit_type != 21) | |
50 | ✗ | flag(svc_extension_flag); | |
51 | else | ||
52 | ✗ | flag(avc_3d_extension_flag); | |
53 | |||
54 | ✗ | if (current->svc_extension_flag) { | |
55 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, "SVC not supported.\n"); | |
56 | ✗ | return AVERROR_PATCHWELCOME; | |
57 | |||
58 | ✗ | } else if (current->avc_3d_extension_flag) { | |
59 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, "3DAVC not supported.\n"); | |
60 | ✗ | return AVERROR_PATCHWELCOME; | |
61 | |||
62 | } else { | ||
63 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, "MVC not supported.\n"); | |
64 | ✗ | return AVERROR_PATCHWELCOME; | |
65 | } | ||
66 | } | ||
67 | |||
68 | 34532 | return 0; | |
69 | } | ||
70 | |||
71 | ✗ | static int FUNC(scaling_list)(CodedBitstreamContext *ctx, RWContext *rw, | |
72 | H264RawScalingList *current, | ||
73 | int size_of_scaling_list) | ||
74 | { | ||
75 | int err, i, scale; | ||
76 | |||
77 | ✗ | scale = 8; | |
78 | ✗ | for (i = 0; i < size_of_scaling_list; i++) { | |
79 | ✗ | ses(delta_scale[i], -128, +127, 1, i); | |
80 | ✗ | scale = (scale + current->delta_scale[i] + 256) % 256; | |
81 | ✗ | if (scale == 0) | |
82 | ✗ | break; | |
83 | } | ||
84 | |||
85 | ✗ | return 0; | |
86 | } | ||
87 | |||
88 | 48 | static int FUNC(hrd_parameters)(CodedBitstreamContext *ctx, RWContext *rw, | |
89 | H264RawHRD *current) | ||
90 | { | ||
91 | int err, i; | ||
92 | |||
93 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
48 | ue(cpb_cnt_minus1, 0, 31); |
94 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
48 | ub(4, bit_rate_scale); |
95 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
48 | ub(4, cpb_size_scale); |
96 | |||
97 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 24 times.
|
96 | for (i = 0; i <= current->cpb_cnt_minus1; i++) { |
98 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
48 | ues(bit_rate_value_minus1[i], 0, UINT32_MAX - 1, 1, i); |
99 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
48 | ues(cpb_size_value_minus1[i], 0, UINT32_MAX - 1, 1, i); |
100 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
48 | flags(cbr_flag[i], 1, i); |
101 | } | ||
102 | |||
103 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
48 | ub(5, initial_cpb_removal_delay_length_minus1); |
104 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
48 | ub(5, cpb_removal_delay_length_minus1); |
105 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
48 | ub(5, dpb_output_delay_length_minus1); |
106 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
48 | ub(5, time_offset_length); |
107 | |||
108 | 48 | return 0; | |
109 | } | ||
110 | |||
111 | 64 | static int FUNC(vui_parameters)(CodedBitstreamContext *ctx, RWContext *rw, | |
112 | H264RawVUI *current, H264RawSPS *sps) | ||
113 | { | ||
114 | int err; | ||
115 | |||
116 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 32 times.
|
64 | flag(aspect_ratio_info_present_flag); |
117 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 8 times.
|
64 | if (current->aspect_ratio_info_present_flag) { |
118 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
48 | ub(8, aspect_ratio_idc); |
119 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
48 | if (current->aspect_ratio_idc == 255) { |
120 | ✗ | ub(16, sar_width); | |
121 | ✗ | ub(16, sar_height); | |
122 | } | ||
123 | } else { | ||
124 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
16 | infer(aspect_ratio_idc, 0); |
125 | } | ||
126 | |||
127 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 32 times.
|
64 | flag(overscan_info_present_flag); |
128 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 28 times.
|
64 | if (current->overscan_info_present_flag) |
129 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
|
8 | flag(overscan_appropriate_flag); |
130 | |||
131 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 32 times.
|
64 | flag(video_signal_type_present_flag); |
132 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 20 times.
|
64 | if (current->video_signal_type_present_flag) { |
133 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
|
24 | ub(3, video_format); |
134 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
|
24 | flag(video_full_range_flag); |
135 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
|
24 | flag(colour_description_present_flag); |
136 |
1/2✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
|
24 | if (current->colour_description_present_flag) { |
137 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
|
24 | ub(8, colour_primaries); |
138 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
|
24 | ub(8, transfer_characteristics); |
139 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
|
24 | ub(8, matrix_coefficients); |
140 | } else { | ||
141 | ✗ | infer(colour_primaries, 2); | |
142 | ✗ | infer(transfer_characteristics, 2); | |
143 | ✗ | infer(matrix_coefficients, 2); | |
144 | } | ||
145 | } else { | ||
146 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
40 | infer(video_format, 5); |
147 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
40 | infer(video_full_range_flag, 0); |
148 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
40 | infer(colour_primaries, 2); |
149 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
40 | infer(transfer_characteristics, 2); |
150 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
40 | infer(matrix_coefficients, 2); |
151 | } | ||
152 | |||
153 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 32 times.
|
64 | flag(chroma_loc_info_present_flag); |
154 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 24 times.
|
64 | if (current->chroma_loc_info_present_flag) { |
155 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | ue(chroma_sample_loc_type_top_field, 0, 5); |
156 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | ue(chroma_sample_loc_type_bottom_field, 0, 5); |
157 | } else { | ||
158 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
48 | infer(chroma_sample_loc_type_top_field, 0); |
159 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
48 | infer(chroma_sample_loc_type_bottom_field, 0); |
160 | } | ||
161 | |||
162 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 32 times.
|
64 | flag(timing_info_present_flag); |
163 |
2/2✓ Branch 0 taken 28 times.
✓ Branch 1 taken 4 times.
|
64 | if (current->timing_info_present_flag) { |
164 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 28 times.
|
56 | u(32, num_units_in_tick, 1, UINT32_MAX); |
165 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 28 times.
|
56 | u(32, time_scale, 1, UINT32_MAX); |
166 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 28 times.
|
56 | flag(fixed_frame_rate_flag); |
167 | } else { | ||
168 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
8 | infer(fixed_frame_rate_flag, 0); |
169 | } | ||
170 | |||
171 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 32 times.
|
64 | flag(nal_hrd_parameters_present_flag); |
172 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 12 times.
|
64 | if (current->nal_hrd_parameters_present_flag) |
173 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 20 times.
|
40 | CHECK(FUNC(hrd_parameters)(ctx, rw, ¤t->nal_hrd_parameters)); |
174 | |||
175 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 32 times.
|
64 | flag(vcl_hrd_parameters_present_flag); |
176 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 28 times.
|
64 | if (current->vcl_hrd_parameters_present_flag) |
177 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
|
8 | CHECK(FUNC(hrd_parameters)(ctx, rw, ¤t->vcl_hrd_parameters)); |
178 | |||
179 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 20 times.
|
64 | if (current->nal_hrd_parameters_present_flag || |
180 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
24 | current->vcl_hrd_parameters_present_flag) |
181 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 20 times.
|
40 | flag(low_delay_hrd_flag); |
182 | else | ||
183 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
24 | infer(low_delay_hrd_flag, 1 - current->fixed_frame_rate_flag); |
184 | |||
185 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 32 times.
|
64 | flag(pic_struct_present_flag); |
186 | |||
187 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 32 times.
|
64 | flag(bitstream_restriction_flag); |
188 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 8 times.
|
64 | if (current->bitstream_restriction_flag) { |
189 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
48 | flag(motion_vectors_over_pic_boundaries_flag); |
190 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
48 | ue(max_bytes_per_pic_denom, 0, 16); |
191 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
48 | ue(max_bits_per_mb_denom, 0, 16); |
192 | // The current version of the standard constrains this to be in | ||
193 | // [0,15], but older versions allow 16. | ||
194 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
48 | ue(log2_max_mv_length_horizontal, 0, 16); |
195 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
48 | ue(log2_max_mv_length_vertical, 0, 16); |
196 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
48 | ue(max_num_reorder_frames, 0, H264_MAX_DPB_FRAMES); |
197 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
48 | ue(max_dec_frame_buffering, 0, H264_MAX_DPB_FRAMES); |
198 | } else { | ||
199 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
16 | infer(motion_vectors_over_pic_boundaries_flag, 1); |
200 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
16 | infer(max_bytes_per_pic_denom, 2); |
201 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
16 | infer(max_bits_per_mb_denom, 1); |
202 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
16 | infer(log2_max_mv_length_horizontal, 15); |
203 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
16 | infer(log2_max_mv_length_vertical, 15); |
204 | |||
205 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
16 | if ((sps->profile_idc == 44 || sps->profile_idc == 86 || |
206 |
3/4✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
|
16 | sps->profile_idc == 100 || sps->profile_idc == 110 || |
207 |
2/4✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
|
8 | sps->profile_idc == 122 || sps->profile_idc == 244) && |
208 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
8 | sps->constraint_set3_flag) { |
209 | ✗ | infer(max_num_reorder_frames, 0); | |
210 | ✗ | infer(max_dec_frame_buffering, 0); | |
211 | } else { | ||
212 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
16 | infer(max_num_reorder_frames, H264_MAX_DPB_FRAMES); |
213 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
16 | infer(max_dec_frame_buffering, H264_MAX_DPB_FRAMES); |
214 | } | ||
215 | } | ||
216 | |||
217 | 64 | return 0; | |
218 | } | ||
219 | |||
220 | 232 | static int FUNC(vui_parameters_default)(CodedBitstreamContext *ctx, | |
221 | RWContext *rw, H264RawVUI *current, | ||
222 | H264RawSPS *sps) | ||
223 | { | ||
224 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
232 | infer(aspect_ratio_idc, 0); |
225 | |||
226 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
232 | infer(video_format, 5); |
227 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
232 | infer(video_full_range_flag, 0); |
228 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
232 | infer(colour_primaries, 2); |
229 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
232 | infer(transfer_characteristics, 2); |
230 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
232 | infer(matrix_coefficients, 2); |
231 | |||
232 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
232 | infer(chroma_sample_loc_type_top_field, 0); |
233 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
232 | infer(chroma_sample_loc_type_bottom_field, 0); |
234 | |||
235 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
232 | infer(fixed_frame_rate_flag, 0); |
236 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
232 | infer(low_delay_hrd_flag, 1); |
237 | |||
238 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
232 | infer(pic_struct_present_flag, 0); |
239 | |||
240 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
232 | infer(motion_vectors_over_pic_boundaries_flag, 1); |
241 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
232 | infer(max_bytes_per_pic_denom, 2); |
242 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
232 | infer(max_bits_per_mb_denom, 1); |
243 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
232 | infer(log2_max_mv_length_horizontal, 15); |
244 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
232 | infer(log2_max_mv_length_vertical, 15); |
245 | |||
246 |
2/4✓ Branch 0 taken 116 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
✗ Branch 3 not taken.
|
232 | if ((sps->profile_idc == 44 || sps->profile_idc == 86 || |
247 |
2/4✓ Branch 0 taken 116 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
✗ Branch 3 not taken.
|
232 | sps->profile_idc == 100 || sps->profile_idc == 110 || |
248 |
2/4✓ Branch 0 taken 116 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 116 times.
|
232 | sps->profile_idc == 122 || sps->profile_idc == 244) && |
249 | ✗ | sps->constraint_set3_flag) { | |
250 | ✗ | infer(max_num_reorder_frames, 0); | |
251 | ✗ | infer(max_dec_frame_buffering, 0); | |
252 | } else { | ||
253 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
232 | infer(max_num_reorder_frames, H264_MAX_DPB_FRAMES); |
254 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
232 | infer(max_dec_frame_buffering, H264_MAX_DPB_FRAMES); |
255 | } | ||
256 | |||
257 | 232 | return 0; | |
258 | } | ||
259 | |||
260 | 296 | static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw, | |
261 | H264RawSPS *current) | ||
262 | { | ||
263 | int err, i; | ||
264 | |||
265 | 296 | HEADER("Sequence Parameter Set"); | |
266 | |||
267 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 148 times.
|
296 | CHECK(FUNC(nal_unit_header)(ctx, rw, ¤t->nal_unit_header, |
268 | 1 << H264_NAL_SPS)); | ||
269 | |||
270 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 148 times.
|
296 | ub(8, profile_idc); |
271 | |||
272 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 148 times.
|
296 | flag(constraint_set0_flag); |
273 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 148 times.
|
296 | flag(constraint_set1_flag); |
274 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 148 times.
|
296 | flag(constraint_set2_flag); |
275 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 148 times.
|
296 | flag(constraint_set3_flag); |
276 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 148 times.
|
296 | flag(constraint_set4_flag); |
277 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 148 times.
|
296 | flag(constraint_set5_flag); |
278 | |||
279 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 148 times.
|
296 | u(2, reserved_zero_2bits, 0, 0); |
280 | |||
281 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 148 times.
|
296 | ub(8, level_idc); |
282 | |||
283 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 148 times.
|
296 | ue(seq_parameter_set_id, 0, 31); |
284 | |||
285 |
3/4✓ Branch 0 taken 140 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 140 times.
✗ Branch 3 not taken.
|
296 | if (current->profile_idc == 100 || current->profile_idc == 110 || |
286 |
2/4✓ Branch 0 taken 140 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 140 times.
✗ Branch 3 not taken.
|
280 | current->profile_idc == 122 || current->profile_idc == 244 || |
287 |
2/4✓ Branch 0 taken 140 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 140 times.
✗ Branch 3 not taken.
|
280 | current->profile_idc == 44 || current->profile_idc == 83 || |
288 |
2/4✓ Branch 0 taken 140 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 140 times.
✗ Branch 3 not taken.
|
280 | current->profile_idc == 86 || current->profile_idc == 118 || |
289 |
2/4✓ Branch 0 taken 140 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 140 times.
|
280 | current->profile_idc == 128 || current->profile_idc == 138) { |
290 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | ue(chroma_format_idc, 0, 3); |
291 | |||
292 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
16 | if (current->chroma_format_idc == 3) |
293 | ✗ | flag(separate_colour_plane_flag); | |
294 | else | ||
295 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
16 | infer(separate_colour_plane_flag, 0); |
296 | |||
297 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | ue(bit_depth_luma_minus8, 0, 6); |
298 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | ue(bit_depth_chroma_minus8, 0, 6); |
299 | |||
300 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | flag(qpprime_y_zero_transform_bypass_flag); |
301 | |||
302 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | flag(seq_scaling_matrix_present_flag); |
303 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
16 | if (current->seq_scaling_matrix_present_flag) { |
304 | ✗ | for (i = 0; i < ((current->chroma_format_idc != 3) ? 8 : 12); i++) { | |
305 | ✗ | flags(seq_scaling_list_present_flag[i], 1, i); | |
306 | ✗ | if (current->seq_scaling_list_present_flag[i]) { | |
307 | ✗ | if (i < 6) | |
308 | ✗ | CHECK(FUNC(scaling_list)(ctx, rw, | |
309 | ¤t->scaling_list_4x4[i], | ||
310 | 16)); | ||
311 | else | ||
312 | ✗ | CHECK(FUNC(scaling_list)(ctx, rw, | |
313 | ¤t->scaling_list_8x8[i - 6], | ||
314 | 64)); | ||
315 | } | ||
316 | } | ||
317 | } | ||
318 | } else { | ||
319 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
280 | infer(chroma_format_idc, current->profile_idc == 183 ? 0 : 1); |
320 | |||
321 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
280 | infer(separate_colour_plane_flag, 0); |
322 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
280 | infer(bit_depth_luma_minus8, 0); |
323 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
280 | infer(bit_depth_chroma_minus8, 0); |
324 | } | ||
325 | |||
326 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 148 times.
|
296 | ue(log2_max_frame_num_minus4, 0, 12); |
327 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 148 times.
|
296 | ue(pic_order_cnt_type, 0, 2); |
328 | |||
329 |
2/2✓ Branch 0 taken 68 times.
✓ Branch 1 taken 80 times.
|
296 | if (current->pic_order_cnt_type == 0) { |
330 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 68 times.
|
136 | ue(log2_max_pic_order_cnt_lsb_minus4, 0, 12); |
331 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 64 times.
|
160 | } else if (current->pic_order_cnt_type == 1) { |
332 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
|
32 | flag(delta_pic_order_always_zero_flag); |
333 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
|
32 | se(offset_for_non_ref_pic, INT32_MIN + 1, INT32_MAX); |
334 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
|
32 | se(offset_for_top_to_bottom_field, INT32_MIN + 1, INT32_MAX); |
335 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
|
32 | ue(num_ref_frames_in_pic_order_cnt_cycle, 0, 255); |
336 | |||
337 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 16 times.
|
64 | for (i = 0; i < current->num_ref_frames_in_pic_order_cnt_cycle; i++) |
338 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
|
32 | ses(offset_for_ref_frame[i], INT32_MIN + 1, INT32_MAX, 1, i); |
339 | } | ||
340 | |||
341 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 148 times.
|
296 | ue(max_num_ref_frames, 0, H264_MAX_DPB_FRAMES); |
342 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 148 times.
|
296 | flag(gaps_in_frame_num_allowed_flag); |
343 | |||
344 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 148 times.
|
296 | ue(pic_width_in_mbs_minus1, 0, H264_MAX_MB_WIDTH); |
345 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 148 times.
|
296 | ue(pic_height_in_map_units_minus1, 0, H264_MAX_MB_HEIGHT); |
346 | |||
347 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 148 times.
|
296 | flag(frame_mbs_only_flag); |
348 |
2/2✓ Branch 0 taken 36 times.
✓ Branch 1 taken 112 times.
|
296 | if (!current->frame_mbs_only_flag) |
349 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
|
72 | flag(mb_adaptive_frame_field_flag); |
350 | |||
351 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 148 times.
|
296 | flag(direct_8x8_inference_flag); |
352 | |||
353 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 148 times.
|
296 | flag(frame_cropping_flag); |
354 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 124 times.
|
296 | if (current->frame_cropping_flag) { |
355 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
48 | ue(frame_crop_left_offset, 0, H264_MAX_WIDTH); |
356 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
48 | ue(frame_crop_right_offset, 0, H264_MAX_WIDTH); |
357 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
48 | ue(frame_crop_top_offset, 0, H264_MAX_HEIGHT); |
358 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
48 | ue(frame_crop_bottom_offset, 0, H264_MAX_HEIGHT); |
359 | } | ||
360 | |||
361 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 148 times.
|
296 | flag(vui_parameters_present_flag); |
362 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 116 times.
|
296 | if (current->vui_parameters_present_flag) |
363 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 32 times.
|
64 | CHECK(FUNC(vui_parameters)(ctx, rw, ¤t->vui, current)); |
364 | else | ||
365 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
|
232 | CHECK(FUNC(vui_parameters_default)(ctx, rw, ¤t->vui, current)); |
366 | |||
367 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 148 times.
|
296 | CHECK(FUNC(rbsp_trailing_bits)(ctx, rw)); |
368 | |||
369 | 296 | return 0; | |
370 | } | ||
371 | |||
372 | ✗ | static int FUNC(sps_extension)(CodedBitstreamContext *ctx, RWContext *rw, | |
373 | H264RawSPSExtension *current) | ||
374 | { | ||
375 | int err; | ||
376 | |||
377 | ✗ | HEADER("Sequence Parameter Set Extension"); | |
378 | |||
379 | ✗ | CHECK(FUNC(nal_unit_header)(ctx, rw, ¤t->nal_unit_header, | |
380 | 1 << H264_NAL_SPS_EXT)); | ||
381 | |||
382 | ✗ | ue(seq_parameter_set_id, 0, 31); | |
383 | |||
384 | ✗ | ue(aux_format_idc, 0, 3); | |
385 | |||
386 | ✗ | if (current->aux_format_idc != 0) { | |
387 | int bits; | ||
388 | |||
389 | ✗ | ue(bit_depth_aux_minus8, 0, 4); | |
390 | ✗ | flag(alpha_incr_flag); | |
391 | |||
392 | ✗ | bits = current->bit_depth_aux_minus8 + 9; | |
393 | ✗ | ub(bits, alpha_opaque_value); | |
394 | ✗ | ub(bits, alpha_transparent_value); | |
395 | } | ||
396 | |||
397 | ✗ | flag(additional_extension_flag); | |
398 | |||
399 | ✗ | CHECK(FUNC(rbsp_trailing_bits)(ctx, rw)); | |
400 | |||
401 | ✗ | return 0; | |
402 | } | ||
403 | |||
404 | 5984 | static int FUNC(pps)(CodedBitstreamContext *ctx, RWContext *rw, | |
405 | H264RawPPS *current) | ||
406 | { | ||
407 | 5984 | CodedBitstreamH264Context *h264 = ctx->priv_data; | |
408 | const H264RawSPS *sps; | ||
409 | int err, i; | ||
410 | |||
411 | 5984 | HEADER("Picture Parameter Set"); | |
412 | |||
413 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2992 times.
|
5984 | CHECK(FUNC(nal_unit_header)(ctx, rw, ¤t->nal_unit_header, |
414 | 1 << H264_NAL_PPS)); | ||
415 | |||
416 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2992 times.
|
5984 | ue(pic_parameter_set_id, 0, 255); |
417 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2992 times.
|
5984 | ue(seq_parameter_set_id, 0, 31); |
418 | |||
419 | 5984 | sps = h264->sps[current->seq_parameter_set_id]; | |
420 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2992 times.
|
5984 | if (!sps) { |
421 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, "SPS id %d not available.\n", | |
422 | ✗ | current->seq_parameter_set_id); | |
423 | ✗ | return AVERROR_INVALIDDATA; | |
424 | } | ||
425 | |||
426 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2992 times.
|
5984 | flag(entropy_coding_mode_flag); |
427 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2992 times.
|
5984 | flag(bottom_field_pic_order_in_frame_present_flag); |
428 | |||
429 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2992 times.
|
5984 | ue(num_slice_groups_minus1, 0, 7); |
430 |
2/2✓ Branch 0 taken 28 times.
✓ Branch 1 taken 2964 times.
|
5984 | if (current->num_slice_groups_minus1 > 0) { |
431 | unsigned int pic_size; | ||
432 | int iGroup; | ||
433 | |||
434 | 56 | pic_size = (sps->pic_width_in_mbs_minus1 + 1) * | |
435 | 56 | (sps->pic_height_in_map_units_minus1 + 1); | |
436 | |||
437 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 28 times.
|
56 | ue(slice_group_map_type, 0, 6); |
438 | |||
439 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 24 times.
|
56 | if (current->slice_group_map_type == 0) { |
440 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 4 times.
|
72 | for (iGroup = 0; iGroup <= current->num_slice_groups_minus1; iGroup++) |
441 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 32 times.
|
64 | ues(run_length_minus1[iGroup], 0, pic_size - 1, 1, iGroup); |
442 | |||
443 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 20 times.
|
48 | } else if (current->slice_group_map_type == 2) { |
444 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 4 times.
|
24 | for (iGroup = 0; iGroup < current->num_slice_groups_minus1; iGroup++) { |
445 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | ues(top_left[iGroup], 0, pic_size - 1, 1, iGroup); |
446 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | ues(bottom_right[iGroup], |
447 | current->top_left[iGroup], pic_size - 1, 1, iGroup); | ||
448 | } | ||
449 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 4 times.
|
40 | } else if (current->slice_group_map_type == 3 || |
450 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 4 times.
|
32 | current->slice_group_map_type == 4 || |
451 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 8 times.
|
24 | current->slice_group_map_type == 5) { |
452 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
|
24 | flag(slice_group_change_direction_flag); |
453 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
|
24 | ue(slice_group_change_rate_minus1, 0, pic_size - 1); |
454 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4 times.
|
16 | } else if (current->slice_group_map_type == 6) { |
455 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
|
8 | ue(pic_size_in_map_units_minus1, pic_size - 1, pic_size - 1); |
456 | |||
457 |
2/3✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 2 times.
|
8 | allocate(current->slice_group_id, |
458 | current->pic_size_in_map_units_minus1 + 1); | ||
459 |
2/2✓ Branch 0 taken 396 times.
✓ Branch 1 taken 4 times.
|
800 | for (i = 0; i <= current->pic_size_in_map_units_minus1; i++) |
460 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 396 times.
|
792 | us(av_log2(2 * current->num_slice_groups_minus1 + 1), |
461 | slice_group_id[i], 0, current->num_slice_groups_minus1, 1, i); | ||
462 | } | ||
463 | } | ||
464 | |||
465 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2992 times.
|
5984 | ue(num_ref_idx_l0_default_active_minus1, 0, 31); |
466 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2992 times.
|
5984 | ue(num_ref_idx_l1_default_active_minus1, 0, 31); |
467 | |||
468 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2992 times.
|
5984 | flag(weighted_pred_flag); |
469 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2992 times.
|
5984 | u(2, weighted_bipred_idc, 0, 2); |
470 | |||
471 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2992 times.
|
5984 | se(pic_init_qp_minus26, -26 - 6 * sps->bit_depth_luma_minus8, +25); |
472 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2992 times.
|
5984 | se(pic_init_qs_minus26, -26, +25); |
473 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2992 times.
|
5984 | se(chroma_qp_index_offset, -12, +12); |
474 | |||
475 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2992 times.
|
5984 | flag(deblocking_filter_control_present_flag); |
476 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2992 times.
|
5984 | flag(constrained_intra_pred_flag); |
477 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2992 times.
|
5984 | flag(redundant_pic_cnt_present_flag); |
478 | |||
479 |
3/3✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1495 times.
✓ Branch 2 taken 1493 times.
|
5984 | if (more_rbsp_data(current->more_rbsp_data)) |
480 | { | ||
481 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | flag(transform_8x8_mode_flag); |
482 | |||
483 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | flag(pic_scaling_matrix_present_flag); |
484 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
16 | if (current->pic_scaling_matrix_present_flag) { |
485 | ✗ | for (i = 0; i < 6 + (((sps->chroma_format_idc != 3) ? 2 : 6) * | |
486 | ✗ | current->transform_8x8_mode_flag); i++) { | |
487 | ✗ | flags(pic_scaling_list_present_flag[i], 1, i); | |
488 | ✗ | if (current->pic_scaling_list_present_flag[i]) { | |
489 | ✗ | if (i < 6) | |
490 | ✗ | CHECK(FUNC(scaling_list)(ctx, rw, | |
491 | ¤t->scaling_list_4x4[i], | ||
492 | 16)); | ||
493 | else | ||
494 | ✗ | CHECK(FUNC(scaling_list)(ctx, rw, | |
495 | ¤t->scaling_list_8x8[i - 6], | ||
496 | 64)); | ||
497 | } | ||
498 | } | ||
499 | } | ||
500 | |||
501 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
16 | se(second_chroma_qp_index_offset, -12, +12); |
502 | } else { | ||
503 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1491 times.
|
5968 | infer(transform_8x8_mode_flag, 0); |
504 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1491 times.
|
5968 | infer(pic_scaling_matrix_present_flag, 0); |
505 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1491 times.
|
5968 | infer(second_chroma_qp_index_offset, current->chroma_qp_index_offset); |
506 | } | ||
507 | |||
508 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2992 times.
|
5984 | CHECK(FUNC(rbsp_trailing_bits)(ctx, rw)); |
509 | |||
510 | 5984 | return 0; | |
511 | } | ||
512 | |||
513 | 284 | SEI_FUNC(sei_buffering_period, (CodedBitstreamContext *ctx, RWContext *rw, | |
514 | H264RawSEIBufferingPeriod *current, | ||
515 | SEIMessageState *sei)) | ||
516 | { | ||
517 | 142 | CodedBitstreamH264Context *h264 = ctx->priv_data; | |
518 | const H264RawSPS *sps; | ||
519 | int err, i, length; | ||
520 | |||
521 | 142 | HEADER("Buffering Period"); | |
522 | |||
523 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 71 times.
|
142 | ue(seq_parameter_set_id, 0, 31); |
524 | |||
525 | 142 | sps = h264->sps[current->seq_parameter_set_id]; | |
526 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 71 times.
|
142 | if (!sps) { |
527 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, "SPS id %d not available.\n", | |
528 | ✗ | current->seq_parameter_set_id); | |
529 | ✗ | return AVERROR_INVALIDDATA; | |
530 | } | ||
531 | 142 | h264->active_sps = sps; | |
532 | |||
533 |
2/2✓ Branch 0 taken 68 times.
✓ Branch 1 taken 3 times.
|
142 | if (sps->vui.nal_hrd_parameters_present_flag) { |
534 |
2/2✓ Branch 0 taken 68 times.
✓ Branch 1 taken 68 times.
|
272 | for (i = 0; i <= sps->vui.nal_hrd_parameters.cpb_cnt_minus1; i++) { |
535 | 136 | length = sps->vui.nal_hrd_parameters.initial_cpb_removal_delay_length_minus1 + 1; | |
536 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 68 times.
|
136 | xu(length, initial_cpb_removal_delay[SchedSelIdx], |
537 | current->nal.initial_cpb_removal_delay[i], | ||
538 | 1, MAX_UINT_BITS(length), 1, i); | ||
539 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 68 times.
|
136 | xu(length, initial_cpb_removal_delay_offset[SchedSelIdx], |
540 | current->nal.initial_cpb_removal_delay_offset[i], | ||
541 | 0, MAX_UINT_BITS(length), 1, i); | ||
542 | } | ||
543 | } | ||
544 | |||
545 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 68 times.
|
142 | if (sps->vui.vcl_hrd_parameters_present_flag) { |
546 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 3 times.
|
12 | for (i = 0; i <= sps->vui.vcl_hrd_parameters.cpb_cnt_minus1; i++) { |
547 | 6 | length = sps->vui.vcl_hrd_parameters.initial_cpb_removal_delay_length_minus1 + 1; | |
548 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
|
6 | xu(length, initial_cpb_removal_delay[SchedSelIdx], |
549 | current->vcl.initial_cpb_removal_delay[i], | ||
550 | 1, MAX_UINT_BITS(length), 1, i); | ||
551 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
|
6 | xu(length, initial_cpb_removal_delay_offset[SchedSelIdx], |
552 | current->vcl.initial_cpb_removal_delay_offset[i], | ||
553 | 0, MAX_UINT_BITS(length), 1, i); | ||
554 | } | ||
555 | } | ||
556 | |||
557 | 142 | return 0; | |
558 | } | ||
559 | |||
560 | ✗ | static int FUNC(sei_pic_timestamp)(CodedBitstreamContext *ctx, RWContext *rw, | |
561 | H264RawSEIPicTimestamp *current, | ||
562 | const H264RawSPS *sps) | ||
563 | { | ||
564 | uint8_t time_offset_length; | ||
565 | int err; | ||
566 | |||
567 | ✗ | u(2, ct_type, 0, 2); | |
568 | ✗ | flag(nuit_field_based_flag); | |
569 | ✗ | u(5, counting_type, 0, 6); | |
570 | ✗ | flag(full_timestamp_flag); | |
571 | ✗ | flag(discontinuity_flag); | |
572 | ✗ | flag(cnt_dropped_flag); | |
573 | ✗ | ub(8, n_frames); | |
574 | ✗ | if (current->full_timestamp_flag) { | |
575 | ✗ | u(6, seconds_value, 0, 59); | |
576 | ✗ | u(6, minutes_value, 0, 59); | |
577 | ✗ | u(5, hours_value, 0, 23); | |
578 | } else { | ||
579 | ✗ | flag(seconds_flag); | |
580 | ✗ | if (current->seconds_flag) { | |
581 | ✗ | u(6, seconds_value, 0, 59); | |
582 | ✗ | flag(minutes_flag); | |
583 | ✗ | if (current->minutes_flag) { | |
584 | ✗ | u(6, minutes_value, 0, 59); | |
585 | ✗ | flag(hours_flag); | |
586 | ✗ | if (current->hours_flag) | |
587 | ✗ | u(5, hours_value, 0, 23); | |
588 | } | ||
589 | } | ||
590 | } | ||
591 | |||
592 | ✗ | if (sps->vui.nal_hrd_parameters_present_flag) | |
593 | ✗ | time_offset_length = sps->vui.nal_hrd_parameters.time_offset_length; | |
594 | ✗ | else if (sps->vui.vcl_hrd_parameters_present_flag) | |
595 | ✗ | time_offset_length = sps->vui.vcl_hrd_parameters.time_offset_length; | |
596 | else | ||
597 | ✗ | time_offset_length = 24; | |
598 | |||
599 | ✗ | if (time_offset_length > 0) | |
600 | ✗ | ib(time_offset_length, time_offset); | |
601 | else | ||
602 | ✗ | infer(time_offset, 0); | |
603 | |||
604 | ✗ | return 0; | |
605 | } | ||
606 | |||
607 | 6740 | SEI_FUNC(sei_pic_timing, (CodedBitstreamContext *ctx, RWContext *rw, | |
608 | H264RawSEIPicTiming *current, SEIMessageState *sei)) | ||
609 | { | ||
610 | 3370 | CodedBitstreamH264Context *h264 = ctx->priv_data; | |
611 | const H264RawSPS *sps; | ||
612 | int err; | ||
613 | |||
614 | 3370 | HEADER("Picture Timing"); | |
615 | |||
616 | 3370 | sps = h264->active_sps; | |
617 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1685 times.
|
3370 | if (!sps) { |
618 | // If there is exactly one possible SPS but it is not yet active | ||
619 | // then just assume that it should be the active one. | ||
620 | ✗ | int i, k = -1; | |
621 | ✗ | for (i = 0; i < H264_MAX_SPS_COUNT; i++) { | |
622 | ✗ | if (h264->sps[i]) { | |
623 | ✗ | if (k >= 0) { | |
624 | ✗ | k = -1; | |
625 | ✗ | break; | |
626 | } | ||
627 | ✗ | k = i; | |
628 | } | ||
629 | } | ||
630 | ✗ | if (k >= 0) | |
631 | ✗ | sps = h264->sps[k]; | |
632 | } | ||
633 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1685 times.
|
3370 | if (!sps) { |
634 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, | |
635 | "No active SPS for pic_timing.\n"); | ||
636 | ✗ | return AVERROR_INVALIDDATA; | |
637 | } | ||
638 | |||
639 |
2/2✓ Branch 0 taken 118 times.
✓ Branch 1 taken 1567 times.
|
3370 | if (sps->vui.nal_hrd_parameters_present_flag || |
640 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118 times.
|
236 | sps->vui.vcl_hrd_parameters_present_flag) { |
641 | const H264RawHRD *hrd; | ||
642 | |||
643 |
1/2✓ Branch 0 taken 1567 times.
✗ Branch 1 not taken.
|
3134 | if (sps->vui.nal_hrd_parameters_present_flag) |
644 | 3134 | hrd = &sps->vui.nal_hrd_parameters; | |
645 | ✗ | else if (sps->vui.vcl_hrd_parameters_present_flag) | |
646 | ✗ | hrd = &sps->vui.vcl_hrd_parameters; | |
647 | else { | ||
648 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, | |
649 | "No HRD parameters for pic_timing.\n"); | ||
650 | ✗ | return AVERROR_INVALIDDATA; | |
651 | } | ||
652 | |||
653 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1567 times.
|
3134 | ub(hrd->cpb_removal_delay_length_minus1 + 1, cpb_removal_delay); |
654 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1567 times.
|
3134 | ub(hrd->dpb_output_delay_length_minus1 + 1, dpb_output_delay); |
655 | } | ||
656 | |||
657 |
2/2✓ Branch 0 taken 1670 times.
✓ Branch 1 taken 15 times.
|
3370 | if (sps->vui.pic_struct_present_flag) { |
658 | static const uint8_t num_clock_ts[9] = { | ||
659 | 1, 1, 1, 2, 2, 3, 3, 2, 3 | ||
660 | }; | ||
661 | int i; | ||
662 | |||
663 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1670 times.
|
3340 | u(4, pic_struct, 0, 8); |
664 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1670 times.
|
3340 | if (current->pic_struct > 8) |
665 | ✗ | return AVERROR_INVALIDDATA; | |
666 | |||
667 |
2/2✓ Branch 0 taken 3636 times.
✓ Branch 1 taken 1670 times.
|
10612 | for (i = 0; i < num_clock_ts[current->pic_struct]; i++) { |
668 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 3636 times.
|
7272 | flags(clock_timestamp_flag[i], 1, i); |
669 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3636 times.
|
7272 | if (current->clock_timestamp_flag[i]) |
670 | ✗ | CHECK(FUNC(sei_pic_timestamp)(ctx, rw, | |
671 | ¤t->timestamp[i], sps)); | ||
672 | } | ||
673 | } | ||
674 | |||
675 | 3370 | return 0; | |
676 | } | ||
677 | |||
678 | 60 | SEI_FUNC(sei_pan_scan_rect, (CodedBitstreamContext *ctx, RWContext *rw, | |
679 | H264RawSEIPanScanRect *current, | ||
680 | SEIMessageState *sei)) | ||
681 | { | ||
682 | int err, i; | ||
683 | |||
684 | 30 | HEADER("Pan-Scan Rectangle"); | |
685 | |||
686 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
|
30 | ue(pan_scan_rect_id, 0, UINT32_MAX - 1); |
687 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
|
30 | flag(pan_scan_rect_cancel_flag); |
688 | |||
689 |
1/2✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
|
30 | if (!current->pan_scan_rect_cancel_flag) { |
690 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
|
30 | ue(pan_scan_cnt_minus1, 0, 2); |
691 | |||
692 |
2/2✓ Branch 0 taken 15 times.
✓ Branch 1 taken 15 times.
|
60 | for (i = 0; i <= current->pan_scan_cnt_minus1; i++) { |
693 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
|
30 | ses(pan_scan_rect_left_offset[i], INT32_MIN + 1, INT32_MAX, 1, i); |
694 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
|
30 | ses(pan_scan_rect_right_offset[i], INT32_MIN + 1, INT32_MAX, 1, i); |
695 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
|
30 | ses(pan_scan_rect_top_offset[i], INT32_MIN + 1, INT32_MAX, 1, i); |
696 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
|
30 | ses(pan_scan_rect_bottom_offset[i], INT32_MIN + 1, INT32_MAX, 1, i); |
697 | } | ||
698 | |||
699 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
|
30 | ue(pan_scan_rect_repetition_period, 0, 16384); |
700 | } | ||
701 | |||
702 | 30 | return 0; | |
703 | } | ||
704 | |||
705 | 224 | SEI_FUNC(sei_recovery_point, (CodedBitstreamContext *ctx, RWContext *rw, | |
706 | H264RawSEIRecoveryPoint *current, | ||
707 | SEIMessageState *sei)) | ||
708 | { | ||
709 | int err; | ||
710 | |||
711 | 112 | HEADER("Recovery Point"); | |
712 | |||
713 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 56 times.
|
112 | ue(recovery_frame_cnt, 0, 65535); |
714 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 56 times.
|
112 | flag(exact_match_flag); |
715 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 56 times.
|
112 | flag(broken_link_flag); |
716 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 56 times.
|
112 | u(2, changing_slice_group_idc, 0, 2); |
717 | |||
718 | 112 | return 0; | |
719 | } | ||
720 | |||
721 | ✗ | SEI_FUNC(film_grain_characteristics, (CodedBitstreamContext *ctx, RWContext *rw, | |
722 | H264RawFilmGrainCharacteristics *current, | ||
723 | SEIMessageState *state)) | ||
724 | { | ||
725 | ✗ | CodedBitstreamH264Context *h264 = ctx->priv_data; | |
726 | const H264RawSPS *sps; | ||
727 | int err, c, i, j; | ||
728 | |||
729 | ✗ | HEADER("Film Grain Characteristics"); | |
730 | |||
731 | ✗ | sps = h264->active_sps; | |
732 | ✗ | if (!sps) { | |
733 | // If there is exactly one possible SPS but it is not yet active | ||
734 | // then just assume that it should be the active one. | ||
735 | ✗ | int i, k = -1; | |
736 | ✗ | for (i = 0; i < H264_MAX_SPS_COUNT; i++) { | |
737 | ✗ | if (h264->sps[i]) { | |
738 | ✗ | if (k >= 0) { | |
739 | ✗ | k = -1; | |
740 | ✗ | break; | |
741 | } | ||
742 | ✗ | k = i; | |
743 | } | ||
744 | } | ||
745 | ✗ | if (k >= 0) | |
746 | ✗ | sps = h264->sps[k]; | |
747 | } | ||
748 | |||
749 | ✗ | flag(film_grain_characteristics_cancel_flag); | |
750 | ✗ | if (!current->film_grain_characteristics_cancel_flag) { | |
751 | int filmGrainBitDepth[3]; | ||
752 | |||
753 | ✗ | u(2, film_grain_model_id, 0, 1); | |
754 | ✗ | flag(separate_colour_description_present_flag); | |
755 | ✗ | if (current->separate_colour_description_present_flag) { | |
756 | ✗ | ub(3, film_grain_bit_depth_luma_minus8); | |
757 | ✗ | ub(3, film_grain_bit_depth_chroma_minus8); | |
758 | ✗ | flag(film_grain_full_range_flag); | |
759 | ✗ | ub(8, film_grain_colour_primaries); | |
760 | ✗ | ub(8, film_grain_transfer_characteristics); | |
761 | ✗ | ub(8, film_grain_matrix_coefficients); | |
762 | } else { | ||
763 | ✗ | if (!sps) { | |
764 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, | |
765 | "No active SPS for film_grain_characteristics.\n"); | ||
766 | ✗ | return AVERROR_INVALIDDATA; | |
767 | } | ||
768 | ✗ | infer(film_grain_bit_depth_luma_minus8, sps->bit_depth_luma_minus8); | |
769 | ✗ | infer(film_grain_bit_depth_chroma_minus8, sps->bit_depth_chroma_minus8); | |
770 | ✗ | infer(film_grain_full_range_flag, sps->vui.video_full_range_flag); | |
771 | ✗ | infer(film_grain_colour_primaries, sps->vui.colour_primaries); | |
772 | ✗ | infer(film_grain_transfer_characteristics, sps->vui.transfer_characteristics); | |
773 | ✗ | infer(film_grain_matrix_coefficients, sps->vui.matrix_coefficients); | |
774 | } | ||
775 | |||
776 | ✗ | filmGrainBitDepth[0] = current->film_grain_bit_depth_luma_minus8 + 8; | |
777 | ✗ | filmGrainBitDepth[1] = | |
778 | ✗ | filmGrainBitDepth[2] = current->film_grain_bit_depth_chroma_minus8 + 8; | |
779 | |||
780 | ✗ | u(2, blending_mode_id, 0, 1); | |
781 | ✗ | ub(4, log2_scale_factor); | |
782 | ✗ | for (c = 0; c < 3; c++) | |
783 | ✗ | flags(comp_model_present_flag[c], 1, c); | |
784 | ✗ | for (c = 0; c < 3; c++) { | |
785 | ✗ | if (current->comp_model_present_flag[c]) { | |
786 | ✗ | ubs(8, num_intensity_intervals_minus1[c], 1, c); | |
787 | ✗ | us(3, num_model_values_minus1[c], 0, 5, 1, c); | |
788 | ✗ | for (i = 0; i <= current->num_intensity_intervals_minus1[c]; i++) { | |
789 | ✗ | ubs(8, intensity_interval_lower_bound[c][i], 2, c, i); | |
790 | ✗ | ubs(8, intensity_interval_upper_bound[c][i], 2, c, i); | |
791 | ✗ | for (j = 0; j <= current->num_model_values_minus1[c]; j++) | |
792 | ✗ | ses(comp_model_value[c][i][j], 0 - current->film_grain_model_id * (1 << (filmGrainBitDepth[c] - 1)), | |
793 | ((1 << filmGrainBitDepth[c]) - 1) - current->film_grain_model_id * (1 << (filmGrainBitDepth[c] - 1)), | ||
794 | 3, c, i, j); | ||
795 | } | ||
796 | } | ||
797 | } | ||
798 | ✗ | ue(film_grain_characteristics_repetition_period, 0, 16384); | |
799 | } | ||
800 | |||
801 | ✗ | return 0; | |
802 | } | ||
803 | |||
804 | ✗ | SEI_FUNC(sei_frame_packing_arrangement, (CodedBitstreamContext *ctx, RWContext *rw, | |
805 | H264RawSEIFramePackingArrangement *current, | ||
806 | SEIMessageState *sei)) | ||
807 | { | ||
808 | int err; | ||
809 | |||
810 | ✗ | HEADER("Frame Packing Arrangement"); | |
811 | |||
812 | ✗ | ue(frame_packing_arrangement_id, 0, MAX_UINT_BITS(31)); | |
813 | ✗ | flag(frame_packing_arrangement_cancel_flag); | |
814 | ✗ | if (!current->frame_packing_arrangement_cancel_flag) { | |
815 | ✗ | u(7, frame_packing_arrangement_type, 0, 7); | |
816 | ✗ | flag(quincunx_sampling_flag); | |
817 | ✗ | u(6, content_interpretation_type, 0, 2); | |
818 | ✗ | flag(spatial_flipping_flag); | |
819 | ✗ | flag(frame0_flipped_flag); | |
820 | ✗ | flag(field_views_flag); | |
821 | ✗ | flag(current_frame_is_frame0_flag); | |
822 | ✗ | flag(frame0_self_contained_flag); | |
823 | ✗ | flag(frame1_self_contained_flag); | |
824 | ✗ | if (!current->quincunx_sampling_flag && current->frame_packing_arrangement_type != 5) { | |
825 | ✗ | ub(4, frame0_grid_position_x); | |
826 | ✗ | ub(4, frame0_grid_position_y); | |
827 | ✗ | ub(4, frame1_grid_position_x); | |
828 | ✗ | ub(4, frame1_grid_position_y); | |
829 | } | ||
830 | ✗ | fixed(8, frame_packing_arrangement_reserved_byte, 0); | |
831 | ✗ | ue(frame_packing_arrangement_repetition_period, 0, 16384); | |
832 | } | ||
833 | ✗ | flag(frame_packing_arrangement_extension_flag); | |
834 | |||
835 | ✗ | return 0; | |
836 | } | ||
837 | |||
838 | 12 | SEI_FUNC(sei_display_orientation, (CodedBitstreamContext *ctx, RWContext *rw, | |
839 | H264RawSEIDisplayOrientation *current, | ||
840 | SEIMessageState *sei)) | ||
841 | { | ||
842 | int err; | ||
843 | |||
844 | 6 | HEADER("Display Orientation"); | |
845 | |||
846 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
|
6 | flag(display_orientation_cancel_flag); |
847 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
6 | if (!current->display_orientation_cancel_flag) { |
848 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
|
6 | flag(hor_flip); |
849 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
|
6 | flag(ver_flip); |
850 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
|
6 | ub(16, anticlockwise_rotation); |
851 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
|
6 | ue(display_orientation_repetition_period, 0, 16384); |
852 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
|
6 | flag(display_orientation_extension_flag); |
853 | } | ||
854 | |||
855 | 6 | return 0; | |
856 | } | ||
857 | |||
858 | 2836 | static int FUNC(sei)(CodedBitstreamContext *ctx, RWContext *rw, | |
859 | H264RawSEI *current) | ||
860 | { | ||
861 | int err; | ||
862 | |||
863 | 2836 | HEADER("Supplemental Enhancement Information"); | |
864 | |||
865 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1418 times.
|
2836 | CHECK(FUNC(nal_unit_header)(ctx, rw, ¤t->nal_unit_header, |
866 | 1 << H264_NAL_SEI)); | ||
867 | |||
868 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1418 times.
|
2836 | CHECK(FUNC_SEI(message_list)(ctx, rw, ¤t->message_list, 1)); |
869 | |||
870 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1418 times.
|
2836 | CHECK(FUNC(rbsp_trailing_bits)(ctx, rw)); |
871 | |||
872 | 2836 | return 0; | |
873 | } | ||
874 | |||
875 | 2082 | static int FUNC(aud)(CodedBitstreamContext *ctx, RWContext *rw, | |
876 | H264RawAUD *current) | ||
877 | { | ||
878 | int err; | ||
879 | |||
880 | 2082 | HEADER("Access Unit Delimiter"); | |
881 | |||
882 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1041 times.
|
2082 | CHECK(FUNC(nal_unit_header)(ctx, rw, ¤t->nal_unit_header, |
883 | 1 << H264_NAL_AUD)); | ||
884 | |||
885 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1041 times.
|
2082 | ub(3, primary_pic_type); |
886 | |||
887 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1041 times.
|
2082 | CHECK(FUNC(rbsp_trailing_bits)(ctx, rw)); |
888 | |||
889 | 2082 | return 0; | |
890 | } | ||
891 | |||
892 | 23254 | static int FUNC(ref_pic_list_modification)(CodedBitstreamContext *ctx, RWContext *rw, | |
893 | H264RawSliceHeader *current) | ||
894 | { | ||
895 | 23254 | CodedBitstreamH264Context *h264 = ctx->priv_data; | |
896 | 23254 | const H264RawSPS *sps = h264->active_sps; | |
897 | int err, i, mopn; | ||
898 | |||
899 |
2/2✓ Branch 0 taken 10933 times.
✓ Branch 1 taken 694 times.
|
23254 | if (current->slice_type % 5 != 2 && |
900 |
1/2✓ Branch 0 taken 10933 times.
✗ Branch 1 not taken.
|
21866 | current->slice_type % 5 != 4) { |
901 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 10933 times.
|
21866 | flag(ref_pic_list_modification_flag_l0); |
902 |
2/2✓ Branch 0 taken 1140 times.
✓ Branch 1 taken 9793 times.
|
21866 | if (current->ref_pic_list_modification_flag_l0) { |
903 |
1/2✓ Branch 0 taken 3716 times.
✗ Branch 1 not taken.
|
7432 | for (i = 0; i < H264_MAX_RPLM_COUNT; i++) { |
904 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 3716 times.
|
7432 | xue(modification_of_pic_nums_idc, |
905 | current->rplm_l0[i].modification_of_pic_nums_idc, 0, 3, 0); | ||
906 | |||
907 | 7432 | mopn = current->rplm_l0[i].modification_of_pic_nums_idc; | |
908 |
2/2✓ Branch 0 taken 1140 times.
✓ Branch 1 taken 2576 times.
|
7432 | if (mopn == 3) |
909 | 2280 | break; | |
910 | |||
911 |
4/4✓ Branch 0 taken 286 times.
✓ Branch 1 taken 2290 times.
✓ Branch 2 taken 272 times.
✓ Branch 3 taken 14 times.
|
5152 | if (mopn == 0 || mopn == 1) |
912 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2562 times.
|
5124 | xue(abs_diff_pic_num_minus1, |
913 | current->rplm_l0[i].abs_diff_pic_num_minus1, | ||
914 | 0, (1 + current->field_pic_flag) * | ||
915 | (1 << (sps->log2_max_frame_num_minus4 + 4)), 0); | ||
916 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
28 | else if (mopn == 2) |
917 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 14 times.
|
28 | xue(long_term_pic_num, |
918 | current->rplm_l0[i].long_term_pic_num, | ||
919 | 0, sps->max_num_ref_frames - 1, 0); | ||
920 | } | ||
921 | } | ||
922 | } | ||
923 | |||
924 |
2/2✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 8907 times.
|
23254 | if (current->slice_type % 5 == 1) { |
925 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2720 times.
|
5440 | flag(ref_pic_list_modification_flag_l1); |
926 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2720 times.
|
5440 | if (current->ref_pic_list_modification_flag_l1) { |
927 | ✗ | for (i = 0; i < H264_MAX_RPLM_COUNT; i++) { | |
928 | ✗ | xue(modification_of_pic_nums_idc, | |
929 | current->rplm_l1[i].modification_of_pic_nums_idc, 0, 3, 0); | ||
930 | |||
931 | ✗ | mopn = current->rplm_l1[i].modification_of_pic_nums_idc; | |
932 | ✗ | if (mopn == 3) | |
933 | ✗ | break; | |
934 | |||
935 | ✗ | if (mopn == 0 || mopn == 1) | |
936 | ✗ | xue(abs_diff_pic_num_minus1, | |
937 | current->rplm_l1[i].abs_diff_pic_num_minus1, | ||
938 | 0, (1 + current->field_pic_flag) * | ||
939 | (1 << (sps->log2_max_frame_num_minus4 + 4)), 0); | ||
940 | ✗ | else if (mopn == 2) | |
941 | ✗ | xue(long_term_pic_num, | |
942 | current->rplm_l1[i].long_term_pic_num, | ||
943 | 0, sps->max_num_ref_frames - 1, 0); | ||
944 | } | ||
945 | } | ||
946 | } | ||
947 | |||
948 | 23254 | return 0; | |
949 | } | ||
950 | |||
951 | 1212 | static int FUNC(pred_weight_table)(CodedBitstreamContext *ctx, RWContext *rw, | |
952 | H264RawSliceHeader *current) | ||
953 | { | ||
954 | 1212 | CodedBitstreamH264Context *h264 = ctx->priv_data; | |
955 | 1212 | const H264RawSPS *sps = h264->active_sps; | |
956 | int chroma; | ||
957 | int err, i, j; | ||
958 | |||
959 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 606 times.
|
1212 | ue(luma_log2_weight_denom, 0, 7); |
960 | |||
961 |
2/4✓ Branch 0 taken 606 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 606 times.
✗ Branch 3 not taken.
|
1212 | chroma = !sps->separate_colour_plane_flag && sps->chroma_format_idc != 0; |
962 |
1/2✓ Branch 0 taken 606 times.
✗ Branch 1 not taken.
|
1212 | if (chroma) |
963 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 606 times.
|
1212 | ue(chroma_log2_weight_denom, 0, 7); |
964 | |||
965 |
2/2✓ Branch 0 taken 2368 times.
✓ Branch 1 taken 606 times.
|
5948 | for (i = 0; i <= current->num_ref_idx_l0_active_minus1; i++) { |
966 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2368 times.
|
4736 | flags(luma_weight_l0_flag[i], 1, i); |
967 |
2/2✓ Branch 0 taken 436 times.
✓ Branch 1 taken 1932 times.
|
4736 | if (current->luma_weight_l0_flag[i]) { |
968 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 436 times.
|
872 | ses(luma_weight_l0[i], -128, +127, 1, i); |
969 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 436 times.
|
872 | ses(luma_offset_l0[i], -128, +127, 1, i); |
970 | } | ||
971 |
1/2✓ Branch 0 taken 2368 times.
✗ Branch 1 not taken.
|
4736 | if (chroma) { |
972 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2368 times.
|
4736 | flags(chroma_weight_l0_flag[i], 1, i); |
973 |
2/2✓ Branch 0 taken 416 times.
✓ Branch 1 taken 1952 times.
|
4736 | if (current->chroma_weight_l0_flag[i]) { |
974 |
2/2✓ Branch 0 taken 832 times.
✓ Branch 1 taken 416 times.
|
2496 | for (j = 0; j < 2; j++) { |
975 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 832 times.
|
1664 | ses(chroma_weight_l0[i][j], -128, +127, 2, i, j); |
976 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 832 times.
|
1664 | ses(chroma_offset_l0[i][j], -128, +127, 2, i, j); |
977 | } | ||
978 | } | ||
979 | } | ||
980 | } | ||
981 | |||
982 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 606 times.
|
1212 | if (current->slice_type % 5 == 1) { |
983 | ✗ | for (i = 0; i <= current->num_ref_idx_l1_active_minus1; i++) { | |
984 | ✗ | flags(luma_weight_l1_flag[i], 1, i); | |
985 | ✗ | if (current->luma_weight_l1_flag[i]) { | |
986 | ✗ | ses(luma_weight_l1[i], -128, +127, 1, i); | |
987 | ✗ | ses(luma_offset_l1[i], -128, +127, 1, i); | |
988 | } | ||
989 | ✗ | if (chroma) { | |
990 | ✗ | flags(chroma_weight_l1_flag[i], 1, i); | |
991 | ✗ | if (current->chroma_weight_l1_flag[i]) { | |
992 | ✗ | for (j = 0; j < 2; j++) { | |
993 | ✗ | ses(chroma_weight_l1[i][j], -128, +127, 2, i, j); | |
994 | ✗ | ses(chroma_offset_l1[i][j], -128, +127, 2, i, j); | |
995 | } | ||
996 | } | ||
997 | } | ||
998 | } | ||
999 | } | ||
1000 | |||
1001 | 1212 | return 0; | |
1002 | } | ||
1003 | |||
1004 | 18114 | static int FUNC(dec_ref_pic_marking)(CodedBitstreamContext *ctx, RWContext *rw, | |
1005 | H264RawSliceHeader *current, int idr_pic_flag) | ||
1006 | { | ||
1007 | 18114 | CodedBitstreamH264Context *h264 = ctx->priv_data; | |
1008 | 18114 | const H264RawSPS *sps = h264->active_sps; | |
1009 | int err, i; | ||
1010 | uint32_t mmco; | ||
1011 | |||
1012 |
2/2✓ Branch 0 taken 167 times.
✓ Branch 1 taken 8890 times.
|
18114 | if (idr_pic_flag) { |
1013 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 167 times.
|
334 | flag(no_output_of_prior_pics_flag); |
1014 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 167 times.
|
334 | flag(long_term_reference_flag); |
1015 | } else { | ||
1016 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8890 times.
|
17780 | flag(adaptive_ref_pic_marking_mode_flag); |
1017 |
2/2✓ Branch 0 taken 587 times.
✓ Branch 1 taken 8303 times.
|
17780 | if (current->adaptive_ref_pic_marking_mode_flag) { |
1018 |
1/2✓ Branch 0 taken 1356 times.
✗ Branch 1 not taken.
|
2712 | for (i = 0; i < H264_MAX_MMCO_COUNT; i++) { |
1019 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1356 times.
|
2712 | xue(memory_management_control_operation, |
1020 | current->mmco[i].memory_management_control_operation, | ||
1021 | 0, 6, 0); | ||
1022 | |||
1023 | 2712 | mmco = current->mmco[i].memory_management_control_operation; | |
1024 |
2/2✓ Branch 0 taken 587 times.
✓ Branch 1 taken 769 times.
|
2712 | if (mmco == 0) |
1025 | 1174 | break; | |
1026 | |||
1027 |
4/4✓ Branch 0 taken 138 times.
✓ Branch 1 taken 631 times.
✓ Branch 2 taken 56 times.
✓ Branch 3 taken 82 times.
|
1538 | if (mmco == 1 || mmco == 3) |
1028 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 687 times.
|
1374 | xue(difference_of_pic_nums_minus1, |
1029 | current->mmco[i].difference_of_pic_nums_minus1, | ||
1030 | 0, INT32_MAX, 0); | ||
1031 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 769 times.
|
1538 | if (mmco == 2) |
1032 | ✗ | xue(long_term_pic_num, | |
1033 | current->mmco[i].long_term_pic_num, | ||
1034 | 0, sps->max_num_ref_frames - 1, 0); | ||
1035 |
3/4✓ Branch 0 taken 713 times.
✓ Branch 1 taken 56 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 713 times.
|
1538 | if (mmco == 3 || mmco == 6) |
1036 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 56 times.
|
112 | xue(long_term_frame_idx, |
1037 | current->mmco[i].long_term_frame_idx, | ||
1038 | 0, sps->max_num_ref_frames - 1, 0); | ||
1039 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 765 times.
|
1538 | if (mmco == 4) |
1040 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
|
8 | xue(max_long_term_frame_idx_plus1, |
1041 | current->mmco[i].max_long_term_frame_idx_plus1, | ||
1042 | 0, sps->max_num_ref_frames, 0); | ||
1043 | } | ||
1044 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 587 times.
|
1174 | if (i == H264_MAX_MMCO_COUNT) { |
1045 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, "Too many " | |
1046 | "memory management control operations.\n"); | ||
1047 | ✗ | return AVERROR_INVALIDDATA; | |
1048 | } | ||
1049 | } | ||
1050 | } | ||
1051 | |||
1052 | 18114 | return 0; | |
1053 | } | ||
1054 | |||
1055 | 23254 | static int FUNC(slice_header)(CodedBitstreamContext *ctx, RWContext *rw, | |
1056 | H264RawSliceHeader *current) | ||
1057 | { | ||
1058 | 23254 | CodedBitstreamH264Context *h264 = ctx->priv_data; | |
1059 | const H264RawSPS *sps; | ||
1060 | const H264RawPPS *pps; | ||
1061 | int err; | ||
1062 | int idr_pic_flag; | ||
1063 | int slice_type_i, slice_type_p, slice_type_b; | ||
1064 | int slice_type_si, slice_type_sp; | ||
1065 | |||
1066 | 23254 | HEADER("Slice Header"); | |
1067 | |||
1068 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 11627 times.
|
23254 | CHECK(FUNC(nal_unit_header)(ctx, rw, ¤t->nal_unit_header, |
1069 | 1 << H264_NAL_SLICE | | ||
1070 | 1 << H264_NAL_IDR_SLICE | | ||
1071 | 1 << H264_NAL_AUXILIARY_SLICE)); | ||
1072 | |||
1073 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11627 times.
|
23254 | if (current->nal_unit_header.nal_unit_type == H264_NAL_AUXILIARY_SLICE) { |
1074 | ✗ | if (!h264->last_slice_nal_unit_type) { | |
1075 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, "Auxiliary slice " | |
1076 | "is not decodable without the main picture " | ||
1077 | "in the same access unit.\n"); | ||
1078 | ✗ | return AVERROR_INVALIDDATA; | |
1079 | } | ||
1080 | ✗ | idr_pic_flag = h264->last_slice_nal_unit_type == H264_NAL_IDR_SLICE; | |
1081 | } else { | ||
1082 | 23254 | idr_pic_flag = current->nal_unit_header.nal_unit_type == H264_NAL_IDR_SLICE; | |
1083 | } | ||
1084 | |||
1085 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 11627 times.
|
23254 | ue(first_mb_in_slice, 0, H264_MAX_MB_PIC_SIZE - 1); |
1086 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 11627 times.
|
23254 | ue(slice_type, 0, 9); |
1087 | |||
1088 | 23254 | slice_type_i = current->slice_type % 5 == 2; | |
1089 | 23254 | slice_type_p = current->slice_type % 5 == 0; | |
1090 | 23254 | slice_type_b = current->slice_type % 5 == 1; | |
1091 | 23254 | slice_type_si = current->slice_type % 5 == 4; | |
1092 | 23254 | slice_type_sp = current->slice_type % 5 == 3; | |
1093 | |||
1094 |
3/6✓ Branch 0 taken 167 times.
✓ Branch 1 taken 11460 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 167 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
23254 | if (idr_pic_flag && !(slice_type_i || slice_type_si)) { |
1095 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid slice type %d " | |
1096 | ✗ | "for IDR picture.\n", current->slice_type); | |
1097 | ✗ | return AVERROR_INVALIDDATA; | |
1098 | } | ||
1099 | |||
1100 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 11627 times.
|
23254 | ue(pic_parameter_set_id, 0, 255); |
1101 | |||
1102 | 23254 | pps = h264->pps[current->pic_parameter_set_id]; | |
1103 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11627 times.
|
23254 | if (!pps) { |
1104 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, "PPS id %d not available.\n", | |
1105 | ✗ | current->pic_parameter_set_id); | |
1106 | ✗ | return AVERROR_INVALIDDATA; | |
1107 | } | ||
1108 | 23254 | h264->active_pps = pps; | |
1109 | |||
1110 | 23254 | sps = h264->sps[pps->seq_parameter_set_id]; | |
1111 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11627 times.
|
23254 | if (!sps) { |
1112 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, "SPS id %d not available.\n", | |
1113 | ✗ | pps->seq_parameter_set_id); | |
1114 | ✗ | return AVERROR_INVALIDDATA; | |
1115 | } | ||
1116 | 23254 | h264->active_sps = sps; | |
1117 | |||
1118 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11627 times.
|
23254 | if (sps->separate_colour_plane_flag) |
1119 | ✗ | u(2, colour_plane_id, 0, 2); | |
1120 | |||
1121 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 11627 times.
|
23254 | ub(sps->log2_max_frame_num_minus4 + 4, frame_num); |
1122 | |||
1123 |
2/2✓ Branch 0 taken 1471 times.
✓ Branch 1 taken 10156 times.
|
23254 | if (!sps->frame_mbs_only_flag) { |
1124 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1471 times.
|
2942 | flag(field_pic_flag); |
1125 |
2/2✓ Branch 0 taken 645 times.
✓ Branch 1 taken 826 times.
|
2942 | if (current->field_pic_flag) |
1126 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 645 times.
|
1290 | flag(bottom_field_flag); |
1127 | else | ||
1128 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 204 times.
|
1652 | infer(bottom_field_flag, 0); |
1129 | } else { | ||
1130 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5078 times.
|
20312 | infer(field_pic_flag, 0); |
1131 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5078 times.
|
20312 | infer(bottom_field_flag, 0); |
1132 | } | ||
1133 | |||
1134 |
2/2✓ Branch 0 taken 167 times.
✓ Branch 1 taken 11460 times.
|
23254 | if (idr_pic_flag) |
1135 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 167 times.
|
334 | ue(idr_pic_id, 0, 65535); |
1136 | |||
1137 |
2/2✓ Branch 0 taken 5967 times.
✓ Branch 1 taken 5660 times.
|
23254 | if (sps->pic_order_cnt_type == 0) { |
1138 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 5967 times.
|
11934 | ub(sps->log2_max_pic_order_cnt_lsb_minus4 + 4, pic_order_cnt_lsb); |
1139 |
2/2✓ Branch 0 taken 999 times.
✓ Branch 1 taken 4968 times.
|
11934 | if (pps->bottom_field_pic_order_in_frame_present_flag && |
1140 |
1/2✓ Branch 0 taken 999 times.
✗ Branch 1 not taken.
|
1998 | !current->field_pic_flag) |
1141 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 999 times.
|
1998 | se(delta_pic_order_cnt_bottom, INT32_MIN + 1, INT32_MAX); |
1142 | |||
1143 |
2/2✓ Branch 0 taken 4562 times.
✓ Branch 1 taken 1098 times.
|
11320 | } else if (sps->pic_order_cnt_type == 1) { |
1144 |
2/2✓ Branch 0 taken 846 times.
✓ Branch 1 taken 3716 times.
|
9124 | if (!sps->delta_pic_order_always_zero_flag) { |
1145 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 846 times.
|
1692 | se(delta_pic_order_cnt[0], INT32_MIN + 1, INT32_MAX); |
1146 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 846 times.
|
1692 | if (pps->bottom_field_pic_order_in_frame_present_flag && |
1147 | ✗ | !current->field_pic_flag) | |
1148 | ✗ | se(delta_pic_order_cnt[1], INT32_MIN + 1, INT32_MAX); | |
1149 | else | ||
1150 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 423 times.
|
1692 | infer(delta_pic_order_cnt[1], 0); |
1151 | } else { | ||
1152 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1858 times.
|
7432 | infer(delta_pic_order_cnt[0], 0); |
1153 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1858 times.
|
7432 | infer(delta_pic_order_cnt[1], 0); |
1154 | } | ||
1155 | } | ||
1156 | |||
1157 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11627 times.
|
23254 | if (pps->redundant_pic_cnt_present_flag) |
1158 | ✗ | ue(redundant_pic_cnt, 0, 127); | |
1159 | else | ||
1160 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5575 times.
|
23254 | infer(redundant_pic_cnt, 0); |
1161 | |||
1162 |
1/2✓ Branch 0 taken 11627 times.
✗ Branch 1 not taken.
|
23254 | if (current->nal_unit_header.nal_unit_type != H264_NAL_AUXILIARY_SLICE |
1163 |
1/2✓ Branch 0 taken 11627 times.
✗ Branch 1 not taken.
|
23254 | && !current->redundant_pic_cnt) |
1164 | 23254 | h264->last_slice_nal_unit_type = | |
1165 | 23254 | current->nal_unit_header.nal_unit_type; | |
1166 | |||
1167 |
2/2✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 8907 times.
|
23254 | if (slice_type_b) |
1168 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2720 times.
|
5440 | flag(direct_spatial_mv_pred_flag); |
1169 | |||
1170 |
6/6✓ Branch 0 taken 3492 times.
✓ Branch 1 taken 8135 times.
✓ Branch 2 taken 3414 times.
✓ Branch 3 taken 78 times.
✓ Branch 4 taken 2720 times.
✓ Branch 5 taken 694 times.
|
23254 | if (slice_type_p || slice_type_sp || slice_type_b) { |
1171 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 10933 times.
|
21866 | flag(num_ref_idx_active_override_flag); |
1172 |
2/2✓ Branch 0 taken 4983 times.
✓ Branch 1 taken 5950 times.
|
21866 | if (current->num_ref_idx_active_override_flag) { |
1173 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4983 times.
|
9966 | ue(num_ref_idx_l0_active_minus1, 0, 31); |
1174 |
2/2✓ Branch 0 taken 2427 times.
✓ Branch 1 taken 2556 times.
|
9966 | if (slice_type_b) |
1175 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2427 times.
|
4854 | ue(num_ref_idx_l1_active_minus1, 0, 31); |
1176 | } else { | ||
1177 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2955 times.
|
11900 | infer(num_ref_idx_l0_active_minus1, |
1178 | pps->num_ref_idx_l0_default_active_minus1); | ||
1179 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2955 times.
|
11900 | infer(num_ref_idx_l1_active_minus1, |
1180 | pps->num_ref_idx_l1_default_active_minus1); | ||
1181 | } | ||
1182 | } | ||
1183 | |||
1184 |
1/2✓ Branch 0 taken 11627 times.
✗ Branch 1 not taken.
|
23254 | if (current->nal_unit_header.nal_unit_type == 20 || |
1185 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11627 times.
|
23254 | current->nal_unit_header.nal_unit_type == 21) { |
1186 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, "MVC / 3DAVC not supported.\n"); | |
1187 | ✗ | return AVERROR_PATCHWELCOME; | |
1188 | } else { | ||
1189 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 11627 times.
|
23254 | CHECK(FUNC(ref_pic_list_modification)(ctx, rw, current)); |
1190 | } | ||
1191 | |||
1192 |
5/6✓ Branch 0 taken 688 times.
✓ Branch 1 taken 10939 times.
✓ Branch 2 taken 82 times.
✓ Branch 3 taken 606 times.
✓ Branch 4 taken 82 times.
✗ Branch 5 not taken.
|
23254 | if ((pps->weighted_pred_flag && (slice_type_p || slice_type_sp)) || |
1193 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 11021 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
22042 | (pps->weighted_bipred_idc == 1 && slice_type_b)) { |
1194 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 606 times.
|
1212 | CHECK(FUNC(pred_weight_table)(ctx, rw, current)); |
1195 | } | ||
1196 | |||
1197 |
2/2✓ Branch 0 taken 9057 times.
✓ Branch 1 taken 2570 times.
|
23254 | if (current->nal_unit_header.nal_ref_idc != 0) { |
1198 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 9057 times.
|
18114 | CHECK(FUNC(dec_ref_pic_marking)(ctx, rw, current, idr_pic_flag)); |
1199 | } | ||
1200 | |||
1201 |
4/4✓ Branch 0 taken 3777 times.
✓ Branch 1 taken 7850 times.
✓ Branch 2 taken 3523 times.
✓ Branch 3 taken 254 times.
|
23254 | if (pps->entropy_coding_mode_flag && |
1202 |
1/2✓ Branch 0 taken 3523 times.
✗ Branch 1 not taken.
|
7046 | !slice_type_i && !slice_type_si) { |
1203 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 3523 times.
|
7046 | ue(cabac_init_idc, 0, 2); |
1204 | } | ||
1205 | |||
1206 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 11627 times.
|
23254 | se(slice_qp_delta, - 51 - 6 * sps->bit_depth_luma_minus8, |
1207 | + 51 + 6 * sps->bit_depth_luma_minus8); | ||
1208 |
3/4✓ Branch 0 taken 11549 times.
✓ Branch 1 taken 78 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 11549 times.
|
23254 | if (slice_type_sp || slice_type_si) { |
1209 |
1/2✓ Branch 0 taken 78 times.
✗ Branch 1 not taken.
|
156 | if (slice_type_sp) |
1210 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 78 times.
|
156 | flag(sp_for_switch_flag); |
1211 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 78 times.
|
156 | se(slice_qs_delta, -51, +51); |
1212 | } | ||
1213 | |||
1214 |
2/2✓ Branch 0 taken 6861 times.
✓ Branch 1 taken 4766 times.
|
23254 | if (pps->deblocking_filter_control_present_flag) { |
1215 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 6861 times.
|
13722 | ue(disable_deblocking_filter_idc, 0, 2); |
1216 |
2/2✓ Branch 0 taken 4735 times.
✓ Branch 1 taken 2126 times.
|
13722 | if (current->disable_deblocking_filter_idc != 1) { |
1217 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4735 times.
|
9470 | se(slice_alpha_c0_offset_div2, -6, +6); |
1218 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4735 times.
|
9470 | se(slice_beta_offset_div2, -6, +6); |
1219 | } else { | ||
1220 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1063 times.
|
4252 | infer(slice_alpha_c0_offset_div2, 0); |
1221 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1063 times.
|
4252 | infer(slice_beta_offset_div2, 0); |
1222 | } | ||
1223 | } else { | ||
1224 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2343 times.
|
9532 | infer(disable_deblocking_filter_idc, 0); |
1225 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2343 times.
|
9532 | infer(slice_alpha_c0_offset_div2, 0); |
1226 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2343 times.
|
9532 | infer(slice_beta_offset_div2, 0); |
1227 | } | ||
1228 | |||
1229 |
2/2✓ Branch 0 taken 3238 times.
✓ Branch 1 taken 8389 times.
|
23254 | if (pps->num_slice_groups_minus1 > 0 && |
1230 |
2/2✓ Branch 0 taken 1328 times.
✓ Branch 1 taken 1910 times.
|
6476 | pps->slice_group_map_type >= 3 && |
1231 |
2/2✓ Branch 0 taken 628 times.
✓ Branch 1 taken 700 times.
|
2656 | pps->slice_group_map_type <= 5) { |
1232 | unsigned int pic_size, max, bits; | ||
1233 | |||
1234 | 1256 | pic_size = (sps->pic_width_in_mbs_minus1 + 1) * | |
1235 | 1256 | (sps->pic_height_in_map_units_minus1 + 1); | |
1236 | 1256 | max = (pic_size + pps->slice_group_change_rate_minus1) / | |
1237 | 1256 | (pps->slice_group_change_rate_minus1 + 1); | |
1238 | 1256 | bits = av_ceil_log2(max + 1); | |
1239 | |||
1240 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 628 times.
|
1256 | u(bits, slice_group_change_cycle, 0, max); |
1241 | } | ||
1242 | |||
1243 |
2/2✓ Branch 0 taken 3777 times.
✓ Branch 1 taken 7850 times.
|
23254 | if (pps->entropy_coding_mode_flag) { |
1244 |
2/2✓ Branch 1 taken 12291 times.
✓ Branch 2 taken 3777 times.
|
32136 | while (byte_alignment(rw)) |
1245 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 12291 times.
|
24582 | fixed(1, cabac_alignment_one_bit, 1); |
1246 | } | ||
1247 | |||
1248 | 23254 | return 0; | |
1249 | } | ||
1250 | |||
1251 | 68 | static int FUNC(filler)(CodedBitstreamContext *ctx, RWContext *rw, | |
1252 | H264RawFiller *current) | ||
1253 | { | ||
1254 | int err; | ||
1255 | |||
1256 | 68 | HEADER("Filler Data"); | |
1257 | |||
1258 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 34 times.
|
68 | CHECK(FUNC(nal_unit_header)(ctx, rw, ¤t->nal_unit_header, |
1259 | 1 << H264_NAL_FILLER_DATA)); | ||
1260 | |||
1261 | #ifdef READ | ||
1262 |
2/2✓ Branch 1 taken 927636 times.
✓ Branch 2 taken 34 times.
|
1855340 | while (show_bits(rw, 8) == 0xff) { |
1263 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 927636 times.
|
1855272 | fixed(8, ff_byte, 0xff); |
1264 | 1855272 | ++current->filler_size; | |
1265 | } | ||
1266 | #else | ||
1267 | { | ||
1268 | uint32_t i; | ||
1269 | ✗ | for (i = 0; i < current->filler_size; i++) | |
1270 | ✗ | fixed(8, ff_byte, 0xff); | |
1271 | } | ||
1272 | #endif | ||
1273 | |||
1274 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 2 taken 33 times.
|
68 | CHECK(FUNC(rbsp_trailing_bits)(ctx, rw)); |
1275 | |||
1276 | 66 | return 0; | |
1277 | } | ||
1278 | |||
1279 | 4 | static int FUNC(end_of_sequence)(CodedBitstreamContext *ctx, RWContext *rw, | |
1280 | H264RawNALUnitHeader *current) | ||
1281 | { | ||
1282 | 4 | HEADER("End of Sequence"); | |
1283 | |||
1284 | 4 | return FUNC(nal_unit_header)(ctx, rw, current, | |
1285 | 1 << H264_NAL_END_SEQUENCE); | ||
1286 | } | ||
1287 | |||
1288 | 4 | static int FUNC(end_of_stream)(CodedBitstreamContext *ctx, RWContext *rw, | |
1289 | H264RawNALUnitHeader *current) | ||
1290 | { | ||
1291 | 4 | HEADER("End of Stream"); | |
1292 | |||
1293 | 4 | return FUNC(nal_unit_header)(ctx, rw, current, | |
1294 | 1 << H264_NAL_END_STREAM); | ||
1295 | } | ||
1296 |