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 | 16742 | static int FUNC(obu_header)(CodedBitstreamContext *ctx, RWContext *rw, | |
20 | AV1RawOBUHeader *current) | ||
21 | { | ||
22 | 16742 | CodedBitstreamAV1Context *priv = ctx->priv_data; | |
23 | int err; | ||
24 | |||
25 | 16742 | HEADER("OBU header"); | |
26 | |||
27 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8371 times.
|
16742 | fc(1, obu_forbidden_bit, 0, 0); |
28 | |||
29 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8371 times.
|
16742 | fc(4, obu_type, 0, AV1_OBU_PADDING); |
30 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8371 times.
|
16742 | flag(obu_extension_flag); |
31 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8371 times.
|
16742 | flag(obu_has_size_field); |
32 | |||
33 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8371 times.
|
16742 | fc(1, obu_reserved_1bit, 0, 0); |
34 | |||
35 |
2/2✓ Branch 0 taken 608 times.
✓ Branch 1 taken 7763 times.
|
16742 | if (current->obu_extension_flag) { |
36 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 608 times.
|
1216 | fb(3, temporal_id); |
37 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 608 times.
|
1216 | fb(2, spatial_id); |
38 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 608 times.
|
1216 | fc(3, extension_header_reserved_3bits, 0, 0); |
39 | } else { | ||
40 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 937 times.
|
15526 | infer(temporal_id, 0); |
41 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 937 times.
|
15526 | infer(spatial_id, 0); |
42 | } | ||
43 | |||
44 | 16742 | priv->temporal_id = current->temporal_id; | |
45 | 16742 | priv->spatial_id = current->spatial_id; | |
46 | |||
47 | 16742 | return 0; | |
48 | } | ||
49 | |||
50 | 2130 | static int FUNC(trailing_bits)(CodedBitstreamContext *ctx, RWContext *rw, int nb_bits) | |
51 | { | ||
52 | int err; | ||
53 | |||
54 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1065 times.
|
2130 | av_assert0(nb_bits > 0); |
55 | |||
56 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1065 times.
|
2130 | fixed(1, trailing_one_bit, 1); |
57 | 2130 | --nb_bits; | |
58 | |||
59 |
2/2✓ Branch 0 taken 4703 times.
✓ Branch 1 taken 1065 times.
|
11536 | while (nb_bits > 0) { |
60 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4703 times.
|
9406 | fixed(1, trailing_zero_bit, 0); |
61 | 9406 | --nb_bits; | |
62 | } | ||
63 | |||
64 | 2130 | return 0; | |
65 | } | ||
66 | |||
67 | 7384 | static int FUNC(byte_alignment)(CodedBitstreamContext *ctx, RWContext *rw) | |
68 | { | ||
69 | int err; | ||
70 | |||
71 |
2/2✓ Branch 1 taken 8985 times.
✓ Branch 2 taken 3692 times.
|
25354 | while (byte_alignment(rw) != 0) |
72 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8985 times.
|
17970 | fixed(1, zero_bit, 0); |
73 | |||
74 | 7384 | return 0; | |
75 | } | ||
76 | |||
77 | 1300 | static int FUNC(color_config)(CodedBitstreamContext *ctx, RWContext *rw, | |
78 | AV1RawColorConfig *current, int seq_profile) | ||
79 | { | ||
80 | 1300 | CodedBitstreamAV1Context *priv = ctx->priv_data; | |
81 | int err; | ||
82 | |||
83 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | flag(high_bitdepth); |
84 | |||
85 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 650 times.
|
1300 | if (seq_profile == FF_PROFILE_AV1_PROFESSIONAL && |
86 | ✗ | current->high_bitdepth) { | |
87 | ✗ | flag(twelve_bit); | |
88 | ✗ | priv->bit_depth = current->twelve_bit ? 12 : 10; | |
89 | } else { | ||
90 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 642 times.
|
1300 | priv->bit_depth = current->high_bitdepth ? 10 : 8; |
91 | } | ||
92 | |||
93 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 650 times.
|
1300 | if (seq_profile == FF_PROFILE_AV1_HIGH) |
94 | ✗ | infer(mono_chrome, 0); | |
95 | else | ||
96 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | flag(mono_chrome); |
97 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 650 times.
|
1300 | priv->num_planes = current->mono_chrome ? 1 : 3; |
98 | |||
99 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | flag(color_description_present_flag); |
100 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 650 times.
|
1300 | if (current->color_description_present_flag) { |
101 | ✗ | fb(8, color_primaries); | |
102 | ✗ | fb(8, transfer_characteristics); | |
103 | ✗ | fb(8, matrix_coefficients); | |
104 | } else { | ||
105 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 143 times.
|
1300 | infer(color_primaries, AVCOL_PRI_UNSPECIFIED); |
106 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 143 times.
|
1300 | infer(transfer_characteristics, AVCOL_TRC_UNSPECIFIED); |
107 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 143 times.
|
1300 | infer(matrix_coefficients, AVCOL_SPC_UNSPECIFIED); |
108 | } | ||
109 | |||
110 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 650 times.
|
1300 | if (current->mono_chrome) { |
111 | ✗ | flag(color_range); | |
112 | |||
113 | ✗ | infer(subsampling_x, 1); | |
114 | ✗ | infer(subsampling_y, 1); | |
115 | ✗ | infer(chroma_sample_position, AV1_CSP_UNKNOWN); | |
116 | ✗ | infer(separate_uv_delta_q, 0); | |
117 | |||
118 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 650 times.
|
1300 | } else if (current->color_primaries == AVCOL_PRI_BT709 && |
119 | ✗ | current->transfer_characteristics == AVCOL_TRC_IEC61966_2_1 && | |
120 | ✗ | current->matrix_coefficients == AVCOL_SPC_RGB) { | |
121 | ✗ | infer(color_range, 1); | |
122 | ✗ | infer(subsampling_x, 0); | |
123 | ✗ | infer(subsampling_y, 0); | |
124 | ✗ | flag(separate_uv_delta_q); | |
125 | |||
126 | } else { | ||
127 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | flag(color_range); |
128 | |||
129 |
1/2✓ Branch 0 taken 650 times.
✗ Branch 1 not taken.
|
1300 | if (seq_profile == FF_PROFILE_AV1_MAIN) { |
130 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 143 times.
|
1300 | infer(subsampling_x, 1); |
131 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 143 times.
|
1300 | infer(subsampling_y, 1); |
132 | ✗ | } else if (seq_profile == FF_PROFILE_AV1_HIGH) { | |
133 | ✗ | infer(subsampling_x, 0); | |
134 | ✗ | infer(subsampling_y, 0); | |
135 | } else { | ||
136 | ✗ | if (priv->bit_depth == 12) { | |
137 | ✗ | fb(1, subsampling_x); | |
138 | ✗ | if (current->subsampling_x) | |
139 | ✗ | fb(1, subsampling_y); | |
140 | else | ||
141 | ✗ | infer(subsampling_y, 0); | |
142 | } else { | ||
143 | ✗ | infer(subsampling_x, 1); | |
144 | ✗ | infer(subsampling_y, 0); | |
145 | } | ||
146 | } | ||
147 |
2/4✓ Branch 0 taken 650 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
✗ Branch 3 not taken.
|
1300 | if (current->subsampling_x && current->subsampling_y) { |
148 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | fc(2, chroma_sample_position, AV1_CSP_UNKNOWN, |
149 | AV1_CSP_COLOCATED); | ||
150 | } | ||
151 | |||
152 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | flag(separate_uv_delta_q); |
153 | } | ||
154 | |||
155 | 1300 | return 0; | |
156 | } | ||
157 | |||
158 | 710 | static int FUNC(timing_info)(CodedBitstreamContext *ctx, RWContext *rw, | |
159 | AV1RawTimingInfo *current) | ||
160 | { | ||
161 | int err; | ||
162 | |||
163 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 355 times.
|
710 | fc(32, num_units_in_display_tick, 1, MAX_UINT_BITS(32)); |
164 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 355 times.
|
710 | fc(32, time_scale, 1, MAX_UINT_BITS(32)); |
165 | |||
166 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 355 times.
|
710 | flag(equal_picture_interval); |
167 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 355 times.
|
710 | if (current->equal_picture_interval) |
168 | ✗ | uvlc(num_ticks_per_picture_minus_1, 0, MAX_UINT_BITS(32) - 1); | |
169 | |||
170 | 710 | return 0; | |
171 | } | ||
172 | |||
173 | 710 | static int FUNC(decoder_model_info)(CodedBitstreamContext *ctx, RWContext *rw, | |
174 | AV1RawDecoderModelInfo *current) | ||
175 | { | ||
176 | int err; | ||
177 | |||
178 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 355 times.
|
710 | fb(5, buffer_delay_length_minus_1); |
179 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 355 times.
|
710 | fb(32, num_units_in_decoding_tick); |
180 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 355 times.
|
710 | fb(5, buffer_removal_time_length_minus_1); |
181 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 355 times.
|
710 | fb(5, frame_presentation_time_length_minus_1); |
182 | |||
183 | 710 | return 0; | |
184 | } | ||
185 | |||
186 | 1300 | static int FUNC(sequence_header_obu)(CodedBitstreamContext *ctx, RWContext *rw, | |
187 | AV1RawSequenceHeader *current) | ||
188 | { | ||
189 | int i, err; | ||
190 | |||
191 | 1300 | HEADER("Sequence Header"); | |
192 | |||
193 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | fc(3, seq_profile, FF_PROFILE_AV1_MAIN, |
194 | FF_PROFILE_AV1_PROFESSIONAL); | ||
195 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | flag(still_picture); |
196 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | flag(reduced_still_picture_header); |
197 | |||
198 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 650 times.
|
1300 | if (current->reduced_still_picture_header) { |
199 | ✗ | infer(timing_info_present_flag, 0); | |
200 | ✗ | infer(decoder_model_info_present_flag, 0); | |
201 | ✗ | infer(initial_display_delay_present_flag, 0); | |
202 | ✗ | infer(operating_points_cnt_minus_1, 0); | |
203 | ✗ | infer(operating_point_idc[0], 0); | |
204 | |||
205 | ✗ | fb(5, seq_level_idx[0]); | |
206 | |||
207 | ✗ | infer(seq_tier[0], 0); | |
208 | ✗ | infer(decoder_model_present_for_this_op[0], 0); | |
209 | ✗ | infer(initial_display_delay_present_for_this_op[0], 0); | |
210 | |||
211 | } else { | ||
212 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | flag(timing_info_present_flag); |
213 |
2/2✓ Branch 0 taken 355 times.
✓ Branch 1 taken 295 times.
|
1300 | if (current->timing_info_present_flag) { |
214 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 355 times.
|
710 | CHECK(FUNC(timing_info)(ctx, rw, ¤t->timing_info)); |
215 | |||
216 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 355 times.
|
710 | flag(decoder_model_info_present_flag); |
217 |
1/2✓ Branch 0 taken 355 times.
✗ Branch 1 not taken.
|
710 | if (current->decoder_model_info_present_flag) { |
218 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 355 times.
|
710 | CHECK(FUNC(decoder_model_info) |
219 | (ctx, rw, ¤t->decoder_model_info)); | ||
220 | } | ||
221 | } else { | ||
222 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
590 | infer(decoder_model_info_present_flag, 0); |
223 | } | ||
224 | |||
225 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | flag(initial_display_delay_present_flag); |
226 | |||
227 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | fb(5, operating_points_cnt_minus_1); |
228 |
2/2✓ Branch 0 taken 690 times.
✓ Branch 1 taken 650 times.
|
2680 | for (i = 0; i <= current->operating_points_cnt_minus_1; i++) { |
229 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 690 times.
|
1380 | fbs(12, operating_point_idc[i], 1, i); |
230 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 690 times.
|
1380 | fbs(5, seq_level_idx[i], 1, i); |
231 | |||
232 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 690 times.
|
1380 | if (current->seq_level_idx[i] > 7) |
233 | ✗ | flags(seq_tier[i], 1, i); | |
234 | else | ||
235 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 153 times.
|
1380 | infer(seq_tier[i], 0); |
236 | |||
237 |
2/2✓ Branch 0 taken 355 times.
✓ Branch 1 taken 335 times.
|
1380 | if (current->decoder_model_info_present_flag) { |
238 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 355 times.
|
710 | flags(decoder_model_present_for_this_op[i], 1, i); |
239 |
1/2✓ Branch 0 taken 355 times.
✗ Branch 1 not taken.
|
710 | if (current->decoder_model_present_for_this_op[i]) { |
240 | 710 | int n = current->decoder_model_info.buffer_delay_length_minus_1 + 1; | |
241 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 355 times.
|
710 | fbs(n, decoder_buffer_delay[i], 1, i); |
242 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 355 times.
|
710 | fbs(n, encoder_buffer_delay[i], 1, i); |
243 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 355 times.
|
710 | flags(low_delay_mode_flag[i], 1, i); |
244 | } | ||
245 | } else { | ||
246 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 79 times.
|
670 | infer(decoder_model_present_for_this_op[i], 0); |
247 | } | ||
248 | |||
249 |
2/2✓ Branch 0 taken 355 times.
✓ Branch 1 taken 335 times.
|
1380 | if (current->initial_display_delay_present_flag) { |
250 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 355 times.
|
710 | flags(initial_display_delay_present_for_this_op[i], 1, i); |
251 |
1/2✓ Branch 0 taken 355 times.
✗ Branch 1 not taken.
|
710 | if (current->initial_display_delay_present_for_this_op[i]) |
252 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 355 times.
|
710 | fbs(4, initial_display_delay_minus_1[i], 1, i); |
253 | } | ||
254 | } | ||
255 | } | ||
256 | |||
257 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | fb(4, frame_width_bits_minus_1); |
258 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | fb(4, frame_height_bits_minus_1); |
259 | |||
260 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | fb(current->frame_width_bits_minus_1 + 1, max_frame_width_minus_1); |
261 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | fb(current->frame_height_bits_minus_1 + 1, max_frame_height_minus_1); |
262 | |||
263 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 650 times.
|
1300 | if (current->reduced_still_picture_header) |
264 | ✗ | infer(frame_id_numbers_present_flag, 0); | |
265 | else | ||
266 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | flag(frame_id_numbers_present_flag); |
267 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 650 times.
|
1300 | if (current->frame_id_numbers_present_flag) { |
268 | ✗ | fb(4, delta_frame_id_length_minus_2); | |
269 | ✗ | fb(3, additional_frame_id_length_minus_1); | |
270 | } | ||
271 | |||
272 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | flag(use_128x128_superblock); |
273 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | flag(enable_filter_intra); |
274 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | flag(enable_intra_edge_filter); |
275 | |||
276 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 650 times.
|
1300 | if (current->reduced_still_picture_header) { |
277 | ✗ | infer(enable_interintra_compound, 0); | |
278 | ✗ | infer(enable_masked_compound, 0); | |
279 | ✗ | infer(enable_warped_motion, 0); | |
280 | ✗ | infer(enable_dual_filter, 0); | |
281 | ✗ | infer(enable_order_hint, 0); | |
282 | ✗ | infer(enable_jnt_comp, 0); | |
283 | ✗ | infer(enable_ref_frame_mvs, 0); | |
284 | |||
285 | ✗ | infer(seq_force_screen_content_tools, | |
286 | AV1_SELECT_SCREEN_CONTENT_TOOLS); | ||
287 | ✗ | infer(seq_force_integer_mv, | |
288 | AV1_SELECT_INTEGER_MV); | ||
289 | } else { | ||
290 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | flag(enable_interintra_compound); |
291 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | flag(enable_masked_compound); |
292 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | flag(enable_warped_motion); |
293 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | flag(enable_dual_filter); |
294 | |||
295 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | flag(enable_order_hint); |
296 |
1/2✓ Branch 0 taken 650 times.
✗ Branch 1 not taken.
|
1300 | if (current->enable_order_hint) { |
297 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | flag(enable_jnt_comp); |
298 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | flag(enable_ref_frame_mvs); |
299 | } else { | ||
300 | ✗ | infer(enable_jnt_comp, 0); | |
301 | ✗ | infer(enable_ref_frame_mvs, 0); | |
302 | } | ||
303 | |||
304 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | flag(seq_choose_screen_content_tools); |
305 |
1/2✓ Branch 0 taken 650 times.
✗ Branch 1 not taken.
|
1300 | if (current->seq_choose_screen_content_tools) |
306 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 143 times.
|
1300 | infer(seq_force_screen_content_tools, |
307 | AV1_SELECT_SCREEN_CONTENT_TOOLS); | ||
308 | else | ||
309 | ✗ | fb(1, seq_force_screen_content_tools); | |
310 |
1/2✓ Branch 0 taken 650 times.
✗ Branch 1 not taken.
|
1300 | if (current->seq_force_screen_content_tools > 0) { |
311 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | flag(seq_choose_integer_mv); |
312 |
1/2✓ Branch 0 taken 650 times.
✗ Branch 1 not taken.
|
1300 | if (current->seq_choose_integer_mv) |
313 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 143 times.
|
1300 | infer(seq_force_integer_mv, |
314 | AV1_SELECT_INTEGER_MV); | ||
315 | else | ||
316 | ✗ | fb(1, seq_force_integer_mv); | |
317 | } else { | ||
318 | ✗ | infer(seq_force_integer_mv, AV1_SELECT_INTEGER_MV); | |
319 | } | ||
320 | |||
321 |
1/2✓ Branch 0 taken 650 times.
✗ Branch 1 not taken.
|
1300 | if (current->enable_order_hint) |
322 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | fb(3, order_hint_bits_minus_1); |
323 | } | ||
324 | |||
325 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | flag(enable_superres); |
326 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | flag(enable_cdef); |
327 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | flag(enable_restoration); |
328 | |||
329 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | CHECK(FUNC(color_config)(ctx, rw, ¤t->color_config, |
330 | current->seq_profile)); | ||
331 | |||
332 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 650 times.
|
1300 | flag(film_grain_params_present); |
333 | |||
334 | 1300 | return 0; | |
335 | } | ||
336 | |||
337 | 3106 | static int FUNC(temporal_delimiter_obu)(CodedBitstreamContext *ctx, RWContext *rw) | |
338 | { | ||
339 | 3106 | CodedBitstreamAV1Context *priv = ctx->priv_data; | |
340 | |||
341 | 3106 | HEADER("Temporal Delimiter"); | |
342 | |||
343 | 3106 | priv->seen_frame_header = 0; | |
344 | |||
345 | 3106 | return 0; | |
346 | } | ||
347 | |||
348 | 120 | static int FUNC(set_frame_refs)(CodedBitstreamContext *ctx, RWContext *rw, | |
349 | AV1RawFrameHeader *current) | ||
350 | { | ||
351 | 120 | CodedBitstreamAV1Context *priv = ctx->priv_data; | |
352 | 120 | const AV1RawSequenceHeader *seq = priv->sequence_header; | |
353 | static const uint8_t ref_frame_list[AV1_NUM_REF_FRAMES - 2] = { | ||
354 | AV1_REF_FRAME_LAST2, AV1_REF_FRAME_LAST3, AV1_REF_FRAME_BWDREF, | ||
355 | AV1_REF_FRAME_ALTREF2, AV1_REF_FRAME_ALTREF | ||
356 | }; | ||
357 | int8_t ref_frame_idx[AV1_REFS_PER_FRAME], used_frame[AV1_NUM_REF_FRAMES]; | ||
358 | int16_t shifted_order_hints[AV1_NUM_REF_FRAMES]; | ||
359 | int cur_frame_hint, latest_order_hint, earliest_order_hint, ref; | ||
360 | int i, j; | ||
361 | |||
362 |
2/2✓ Branch 0 taken 420 times.
✓ Branch 1 taken 60 times.
|
960 | for (i = 0; i < AV1_REFS_PER_FRAME; i++) |
363 | 840 | ref_frame_idx[i] = -1; | |
364 | 120 | ref_frame_idx[AV1_REF_FRAME_LAST - AV1_REF_FRAME_LAST] = current->last_frame_idx; | |
365 | 120 | ref_frame_idx[AV1_REF_FRAME_GOLDEN - AV1_REF_FRAME_LAST] = current->golden_frame_idx; | |
366 | |||
367 |
2/2✓ Branch 0 taken 480 times.
✓ Branch 1 taken 60 times.
|
1080 | for (i = 0; i < AV1_NUM_REF_FRAMES; i++) |
368 | 960 | used_frame[i] = 0; | |
369 | 120 | used_frame[current->last_frame_idx] = 1; | |
370 | 120 | used_frame[current->golden_frame_idx] = 1; | |
371 | |||
372 | 120 | cur_frame_hint = 1 << (seq->order_hint_bits_minus_1); | |
373 |
2/2✓ Branch 0 taken 480 times.
✓ Branch 1 taken 60 times.
|
1080 | for (i = 0; i < AV1_NUM_REF_FRAMES; i++) |
374 | 960 | shifted_order_hints[i] = cur_frame_hint + | |
375 | 960 | cbs_av1_get_relative_dist(seq, priv->ref[i].order_hint, | |
376 | 960 | priv->order_hint); | |
377 | |||
378 | 120 | latest_order_hint = shifted_order_hints[current->last_frame_idx]; | |
379 | 120 | earliest_order_hint = shifted_order_hints[current->golden_frame_idx]; | |
380 | |||
381 | 120 | ref = -1; | |
382 |
2/2✓ Branch 0 taken 480 times.
✓ Branch 1 taken 60 times.
|
1080 | for (i = 0; i < AV1_NUM_REF_FRAMES; i++) { |
383 | 960 | int hint = shifted_order_hints[i]; | |
384 |
6/6✓ Branch 0 taken 360 times.
✓ Branch 1 taken 120 times.
✓ Branch 2 taken 180 times.
✓ Branch 3 taken 180 times.
✓ Branch 4 taken 120 times.
✓ Branch 5 taken 60 times.
|
960 | if (!used_frame[i] && hint >= cur_frame_hint && |
385 |
2/2✓ Branch 0 taken 67 times.
✓ Branch 1 taken 53 times.
|
240 | (ref < 0 || hint >= latest_order_hint)) { |
386 | 254 | ref = i; | |
387 | 254 | latest_order_hint = hint; | |
388 | } | ||
389 | } | ||
390 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
120 | if (ref >= 0) { |
391 | 120 | ref_frame_idx[AV1_REF_FRAME_ALTREF - AV1_REF_FRAME_LAST] = ref; | |
392 | 120 | used_frame[ref] = 1; | |
393 | } | ||
394 | |||
395 | 120 | ref = -1; | |
396 |
2/2✓ Branch 0 taken 480 times.
✓ Branch 1 taken 60 times.
|
1080 | for (i = 0; i < AV1_NUM_REF_FRAMES; i++) { |
397 | 960 | int hint = shifted_order_hints[i]; | |
398 |
6/6✓ Branch 0 taken 300 times.
✓ Branch 1 taken 180 times.
✓ Branch 2 taken 120 times.
✓ Branch 3 taken 180 times.
✓ Branch 4 taken 60 times.
✓ Branch 5 taken 60 times.
|
960 | if (!used_frame[i] && hint >= cur_frame_hint && |
399 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 55 times.
|
120 | (ref < 0 || hint < earliest_order_hint)) { |
400 | 130 | ref = i; | |
401 | 130 | earliest_order_hint = hint; | |
402 | } | ||
403 | } | ||
404 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
120 | if (ref >= 0) { |
405 | 120 | ref_frame_idx[AV1_REF_FRAME_BWDREF - AV1_REF_FRAME_LAST] = ref; | |
406 | 120 | used_frame[ref] = 1; | |
407 | } | ||
408 | |||
409 | 120 | ref = -1; | |
410 |
2/2✓ Branch 0 taken 480 times.
✓ Branch 1 taken 60 times.
|
1080 | for (i = 0; i < AV1_NUM_REF_FRAMES; i++) { |
411 | 960 | int hint = shifted_order_hints[i]; | |
412 |
6/6✓ Branch 0 taken 240 times.
✓ Branch 1 taken 240 times.
✓ Branch 2 taken 60 times.
✓ Branch 3 taken 180 times.
✓ Branch 4 taken 10 times.
✓ Branch 5 taken 50 times.
|
960 | if (!used_frame[i] && hint >= cur_frame_hint && |
413 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
20 | (ref < 0 || hint < earliest_order_hint)) { |
414 | 100 | ref = i; | |
415 | 100 | earliest_order_hint = hint; | |
416 | } | ||
417 | } | ||
418 |
2/2✓ Branch 0 taken 50 times.
✓ Branch 1 taken 10 times.
|
120 | if (ref >= 0) { |
419 | 100 | ref_frame_idx[AV1_REF_FRAME_ALTREF2 - AV1_REF_FRAME_LAST] = ref; | |
420 | 100 | used_frame[ref] = 1; | |
421 | } | ||
422 | |||
423 |
2/2✓ Branch 0 taken 300 times.
✓ Branch 1 taken 60 times.
|
720 | for (i = 0; i < AV1_REFS_PER_FRAME - 2; i++) { |
424 | 600 | int ref_frame = ref_frame_list[i]; | |
425 |
2/2✓ Branch 0 taken 130 times.
✓ Branch 1 taken 170 times.
|
600 | if (ref_frame_idx[ref_frame - AV1_REF_FRAME_LAST] < 0 ) { |
426 | 260 | ref = -1; | |
427 |
2/2✓ Branch 0 taken 1040 times.
✓ Branch 1 taken 130 times.
|
2340 | for (j = 0; j < AV1_NUM_REF_FRAMES; j++) { |
428 | 2080 | int hint = shifted_order_hints[j]; | |
429 |
6/6✓ Branch 0 taken 340 times.
✓ Branch 1 taken 700 times.
✓ Branch 2 taken 320 times.
✓ Branch 3 taken 20 times.
✓ Branch 4 taken 190 times.
✓ Branch 5 taken 130 times.
|
2080 | if (!used_frame[j] && hint < cur_frame_hint && |
430 |
2/2✓ Branch 0 taken 114 times.
✓ Branch 1 taken 76 times.
|
380 | (ref < 0 || hint >= latest_order_hint)) { |
431 | 488 | ref = j; | |
432 | 488 | latest_order_hint = hint; | |
433 | } | ||
434 | } | ||
435 |
1/2✓ Branch 0 taken 130 times.
✗ Branch 1 not taken.
|
260 | if (ref >= 0) { |
436 | 260 | ref_frame_idx[ref_frame - AV1_REF_FRAME_LAST] = ref; | |
437 | 260 | used_frame[ref] = 1; | |
438 | } | ||
439 | } | ||
440 | } | ||
441 | |||
442 | 120 | ref = -1; | |
443 |
2/2✓ Branch 0 taken 480 times.
✓ Branch 1 taken 60 times.
|
1080 | for (i = 0; i < AV1_NUM_REF_FRAMES; i++) { |
444 | 960 | int hint = shifted_order_hints[i]; | |
445 |
4/4✓ Branch 0 taken 420 times.
✓ Branch 1 taken 60 times.
✓ Branch 2 taken 51 times.
✓ Branch 3 taken 369 times.
|
960 | if (ref < 0 || hint < earliest_order_hint) { |
446 | 222 | ref = i; | |
447 | 222 | earliest_order_hint = hint; | |
448 | } | ||
449 | } | ||
450 |
2/2✓ Branch 0 taken 420 times.
✓ Branch 1 taken 60 times.
|
960 | for (i = 0; i < AV1_REFS_PER_FRAME; i++) { |
451 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 420 times.
|
840 | if (ref_frame_idx[i] < 0) |
452 | ✗ | ref_frame_idx[i] = ref; | |
453 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 98 times.
|
840 | infer(ref_frame_idx[i], ref_frame_idx[i]); |
454 | } | ||
455 | |||
456 | 120 | return 0; | |
457 | } | ||
458 | |||
459 | 3588 | static int FUNC(superres_params)(CodedBitstreamContext *ctx, RWContext *rw, | |
460 | AV1RawFrameHeader *current) | ||
461 | { | ||
462 | 3588 | CodedBitstreamAV1Context *priv = ctx->priv_data; | |
463 | 3588 | const AV1RawSequenceHeader *seq = priv->sequence_header; | |
464 | int denom, err; | ||
465 | |||
466 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1794 times.
|
3588 | if (seq->enable_superres) |
467 | ✗ | flag(use_superres); | |
468 | else | ||
469 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 374 times.
|
3588 | infer(use_superres, 0); |
470 | |||
471 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1794 times.
|
3588 | if (current->use_superres) { |
472 | ✗ | fb(3, coded_denom); | |
473 | ✗ | denom = current->coded_denom + AV1_SUPERRES_DENOM_MIN; | |
474 | } else { | ||
475 | 3588 | denom = AV1_SUPERRES_NUM; | |
476 | } | ||
477 | |||
478 | 3588 | priv->upscaled_width = priv->frame_width; | |
479 | 3588 | priv->frame_width = (priv->upscaled_width * AV1_SUPERRES_NUM + | |
480 | 3588 | denom / 2) / denom; | |
481 | |||
482 | 3588 | return 0; | |
483 | } | ||
484 | |||
485 | 3470 | static int FUNC(frame_size)(CodedBitstreamContext *ctx, RWContext *rw, | |
486 | AV1RawFrameHeader *current) | ||
487 | { | ||
488 | 3470 | CodedBitstreamAV1Context *priv = ctx->priv_data; | |
489 | 3470 | const AV1RawSequenceHeader *seq = priv->sequence_header; | |
490 | int err; | ||
491 | |||
492 |
2/2✓ Branch 0 taken 15 times.
✓ Branch 1 taken 1720 times.
|
3470 | if (current->frame_size_override_flag) { |
493 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
|
30 | fb(seq->frame_width_bits_minus_1 + 1, frame_width_minus_1); |
494 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
|
30 | fb(seq->frame_height_bits_minus_1 + 1, frame_height_minus_1); |
495 | } else { | ||
496 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 356 times.
|
3440 | infer(frame_width_minus_1, seq->max_frame_width_minus_1); |
497 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 356 times.
|
3440 | infer(frame_height_minus_1, seq->max_frame_height_minus_1); |
498 | } | ||
499 | |||
500 | 3470 | priv->frame_width = current->frame_width_minus_1 + 1; | |
501 | 3470 | priv->frame_height = current->frame_height_minus_1 + 1; | |
502 | |||
503 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1735 times.
|
3470 | CHECK(FUNC(superres_params)(ctx, rw, current)); |
504 | |||
505 | 3470 | return 0; | |
506 | } | ||
507 | |||
508 | 3470 | static int FUNC(render_size)(CodedBitstreamContext *ctx, RWContext *rw, | |
509 | AV1RawFrameHeader *current) | ||
510 | { | ||
511 | 3470 | CodedBitstreamAV1Context *priv = ctx->priv_data; | |
512 | int err; | ||
513 | |||
514 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1735 times.
|
3470 | flag(render_and_frame_size_different); |
515 | |||
516 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1735 times.
|
3470 | if (current->render_and_frame_size_different) { |
517 | ✗ | fb(16, render_width_minus_1); | |
518 | ✗ | fb(16, render_height_minus_1); | |
519 | } else { | ||
520 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 359 times.
|
3470 | infer(render_width_minus_1, current->frame_width_minus_1); |
521 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 359 times.
|
3470 | infer(render_height_minus_1, current->frame_height_minus_1); |
522 | } | ||
523 | |||
524 | 3470 | priv->render_width = current->render_width_minus_1 + 1; | |
525 | 3470 | priv->render_height = current->render_height_minus_1 + 1; | |
526 | |||
527 | 3470 | return 0; | |
528 | } | ||
529 | |||
530 | 118 | static int FUNC(frame_size_with_refs)(CodedBitstreamContext *ctx, RWContext *rw, | |
531 | AV1RawFrameHeader *current) | ||
532 | { | ||
533 | 118 | CodedBitstreamAV1Context *priv = ctx->priv_data; | |
534 | int i, err; | ||
535 | |||
536 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
118 | for (i = 0; i < AV1_REFS_PER_FRAME; i++) { |
537 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 59 times.
|
118 | flags(found_ref[i], 1, i); |
538 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
118 | if (current->found_ref[i]) { |
539 | 118 | AV1ReferenceFrameState *ref = | |
540 | 118 | &priv->ref[current->ref_frame_idx[i]]; | |
541 | |||
542 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 59 times.
|
118 | if (!ref->valid) { |
543 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, | |
544 | "Missing reference frame needed for frame size " | ||
545 | "(ref = %d, ref_frame_idx = %d).\n", | ||
546 | ✗ | i, current->ref_frame_idx[i]); | |
547 | ✗ | return AVERROR_INVALIDDATA; | |
548 | } | ||
549 | |||
550 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15 times.
|
118 | infer(frame_width_minus_1, ref->upscaled_width - 1); |
551 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15 times.
|
118 | infer(frame_height_minus_1, ref->frame_height - 1); |
552 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15 times.
|
118 | infer(render_width_minus_1, ref->render_width - 1); |
553 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15 times.
|
118 | infer(render_height_minus_1, ref->render_height - 1); |
554 | |||
555 | 118 | priv->upscaled_width = ref->upscaled_width; | |
556 | 118 | priv->frame_width = priv->upscaled_width; | |
557 | 118 | priv->frame_height = ref->frame_height; | |
558 | 118 | priv->render_width = ref->render_width; | |
559 | 118 | priv->render_height = ref->render_height; | |
560 | 118 | break; | |
561 | } | ||
562 | } | ||
563 | |||
564 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 59 times.
|
118 | if (i >= AV1_REFS_PER_FRAME) { |
565 | ✗ | CHECK(FUNC(frame_size)(ctx, rw, current)); | |
566 | ✗ | CHECK(FUNC(render_size)(ctx, rw, current)); | |
567 | } else { | ||
568 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 59 times.
|
118 | CHECK(FUNC(superres_params)(ctx, rw, current)); |
569 | } | ||
570 | |||
571 | 118 | return 0; | |
572 | } | ||
573 | |||
574 | 3068 | static int FUNC(interpolation_filter)(CodedBitstreamContext *ctx, RWContext *rw, | |
575 | AV1RawFrameHeader *current) | ||
576 | { | ||
577 | int err; | ||
578 | |||
579 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1534 times.
|
3068 | flag(is_filter_switchable); |
580 |
2/2✓ Branch 0 taken 1227 times.
✓ Branch 1 taken 307 times.
|
3068 | if (current->is_filter_switchable) |
581 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 251 times.
|
2454 | infer(interpolation_filter, |
582 | AV1_INTERPOLATION_FILTER_SWITCHABLE); | ||
583 | else | ||
584 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 307 times.
|
614 | fb(2, interpolation_filter); |
585 | |||
586 | 3068 | return 0; | |
587 | } | ||
588 | |||
589 | 3588 | static int FUNC(tile_info)(CodedBitstreamContext *ctx, RWContext *rw, | |
590 | AV1RawFrameHeader *current) | ||
591 | { | ||
592 | 3588 | CodedBitstreamAV1Context *priv = ctx->priv_data; | |
593 | 3588 | const AV1RawSequenceHeader *seq = priv->sequence_header; | |
594 | int mi_cols, mi_rows, sb_cols, sb_rows, sb_shift, sb_size; | ||
595 | int max_tile_width_sb, max_tile_height_sb, max_tile_area_sb; | ||
596 | int min_log2_tile_cols, max_log2_tile_cols, max_log2_tile_rows; | ||
597 | int min_log2_tiles, min_log2_tile_rows; | ||
598 | int i, err; | ||
599 | |||
600 | 3588 | mi_cols = 2 * ((priv->frame_width + 7) >> 3); | |
601 | 3588 | mi_rows = 2 * ((priv->frame_height + 7) >> 3); | |
602 | |||
603 | 8996 | sb_cols = seq->use_128x128_superblock ? ((mi_cols + 31) >> 5) | |
604 |
2/2✓ Branch 0 taken 910 times.
✓ Branch 1 taken 884 times.
|
3588 | : ((mi_cols + 15) >> 4); |
605 | 8996 | sb_rows = seq->use_128x128_superblock ? ((mi_rows + 31) >> 5) | |
606 |
2/2✓ Branch 0 taken 910 times.
✓ Branch 1 taken 884 times.
|
3588 | : ((mi_rows + 15) >> 4); |
607 | |||
608 |
2/2✓ Branch 0 taken 910 times.
✓ Branch 1 taken 884 times.
|
3588 | sb_shift = seq->use_128x128_superblock ? 5 : 4; |
609 | 3588 | sb_size = sb_shift + 2; | |
610 | |||
611 | 3588 | max_tile_width_sb = AV1_MAX_TILE_WIDTH >> sb_size; | |
612 | 3588 | max_tile_area_sb = AV1_MAX_TILE_AREA >> (2 * sb_size); | |
613 | |||
614 | 3588 | min_log2_tile_cols = cbs_av1_tile_log2(max_tile_width_sb, sb_cols); | |
615 | 3588 | max_log2_tile_cols = cbs_av1_tile_log2(1, FFMIN(sb_cols, AV1_MAX_TILE_COLS)); | |
616 | 3588 | max_log2_tile_rows = cbs_av1_tile_log2(1, FFMIN(sb_rows, AV1_MAX_TILE_ROWS)); | |
617 |
1/2✓ Branch 1 taken 1794 times.
✗ Branch 2 not taken.
|
3588 | min_log2_tiles = FFMAX(min_log2_tile_cols, |
618 | cbs_av1_tile_log2(max_tile_area_sb, sb_rows * sb_cols)); | ||
619 | |||
620 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | flag(uniform_tile_spacing_flag); |
621 | |||
622 |
2/2✓ Branch 0 taken 1668 times.
✓ Branch 1 taken 126 times.
|
3588 | if (current->uniform_tile_spacing_flag) { |
623 | int tile_width_sb, tile_height_sb; | ||
624 | |||
625 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1668 times.
|
3336 | increment(tile_cols_log2, min_log2_tile_cols, max_log2_tile_cols); |
626 | |||
627 | 3336 | tile_width_sb = (sb_cols + (1 << current->tile_cols_log2) - 1) >> | |
628 | 3336 | current->tile_cols_log2; | |
629 | 3336 | current->tile_cols = (sb_cols + tile_width_sb - 1) / tile_width_sb; | |
630 | |||
631 | 3336 | min_log2_tile_rows = FFMAX(min_log2_tiles - current->tile_cols_log2, 0); | |
632 | |||
633 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1668 times.
|
3336 | increment(tile_rows_log2, min_log2_tile_rows, max_log2_tile_rows); |
634 | |||
635 | 3336 | tile_height_sb = (sb_rows + (1 << current->tile_rows_log2) - 1) >> | |
636 | 3336 | current->tile_rows_log2; | |
637 | 3336 | current->tile_rows = (sb_rows + tile_height_sb - 1) / tile_height_sb; | |
638 | |||
639 |
2/2✓ Branch 0 taken 502 times.
✓ Branch 1 taken 1668 times.
|
4340 | for (i = 0; i < current->tile_cols - 1; i++) |
640 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118 times.
|
1004 | infer(width_in_sbs_minus_1[i], tile_width_sb - 1); |
641 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 348 times.
|
3336 | infer(width_in_sbs_minus_1[i], |
642 | sb_cols - (current->tile_cols - 1) * tile_width_sb - 1); | ||
643 |
2/2✓ Branch 0 taken 102 times.
✓ Branch 1 taken 1668 times.
|
3540 | for (i = 0; i < current->tile_rows - 1; i++) |
644 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22 times.
|
204 | infer(height_in_sbs_minus_1[i], tile_height_sb - 1); |
645 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 348 times.
|
3336 | infer(height_in_sbs_minus_1[i], |
646 | sb_rows - (current->tile_rows - 1) * tile_height_sb - 1); | ||
647 | |||
648 | } else { | ||
649 | int widest_tile_sb, start_sb, size_sb, max_width, max_height; | ||
650 | |||
651 | 252 | widest_tile_sb = 0; | |
652 | |||
653 | 252 | start_sb = 0; | |
654 |
3/4✓ Branch 0 taken 126 times.
✓ Branch 1 taken 126 times.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
504 | for (i = 0; start_sb < sb_cols && i < AV1_MAX_TILE_COLS; i++) { |
655 | 252 | max_width = FFMIN(sb_cols - start_sb, max_tile_width_sb); | |
656 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
|
252 | ns(max_width, width_in_sbs_minus_1[i], 1, i); |
657 | 252 | size_sb = current->width_in_sbs_minus_1[i] + 1; | |
658 | 252 | widest_tile_sb = FFMAX(size_sb, widest_tile_sb); | |
659 | 252 | start_sb += size_sb; | |
660 | } | ||
661 | 252 | current->tile_cols_log2 = cbs_av1_tile_log2(1, i); | |
662 | 252 | current->tile_cols = i; | |
663 | |||
664 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 126 times.
|
252 | if (min_log2_tiles > 0) |
665 | ✗ | max_tile_area_sb = (sb_rows * sb_cols) >> (min_log2_tiles + 1); | |
666 | else | ||
667 | 252 | max_tile_area_sb = sb_rows * sb_cols; | |
668 | 252 | max_tile_height_sb = FFMAX(max_tile_area_sb / widest_tile_sb, 1); | |
669 | |||
670 | 252 | start_sb = 0; | |
671 |
3/4✓ Branch 0 taken 504 times.
✓ Branch 1 taken 126 times.
✓ Branch 2 taken 504 times.
✗ Branch 3 not taken.
|
1260 | for (i = 0; start_sb < sb_rows && i < AV1_MAX_TILE_ROWS; i++) { |
672 | 1008 | max_height = FFMIN(sb_rows - start_sb, max_tile_height_sb); | |
673 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 504 times.
|
1008 | ns(max_height, height_in_sbs_minus_1[i], 1, i); |
674 | 1008 | size_sb = current->height_in_sbs_minus_1[i] + 1; | |
675 | 1008 | start_sb += size_sb; | |
676 | } | ||
677 | 252 | current->tile_rows_log2 = cbs_av1_tile_log2(1, i); | |
678 | 252 | current->tile_rows = i; | |
679 | } | ||
680 | |||
681 |
2/2✓ Branch 0 taken 1575 times.
✓ Branch 1 taken 219 times.
|
3588 | if (current->tile_cols_log2 > 0 || |
682 |
2/2✓ Branch 0 taken 126 times.
✓ Branch 1 taken 1449 times.
|
3150 | current->tile_rows_log2 > 0) { |
683 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 345 times.
|
690 | fb(current->tile_cols_log2 + current->tile_rows_log2, |
684 | context_update_tile_id); | ||
685 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 345 times.
|
690 | fb(2, tile_size_bytes_minus1); |
686 | } else { | ||
687 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 297 times.
|
2898 | infer(context_update_tile_id, 0); |
688 | } | ||
689 | |||
690 | 3588 | priv->tile_cols = current->tile_cols; | |
691 | 3588 | priv->tile_rows = current->tile_rows; | |
692 | |||
693 | 3588 | return 0; | |
694 | } | ||
695 | |||
696 | 3588 | static int FUNC(quantization_params)(CodedBitstreamContext *ctx, RWContext *rw, | |
697 | AV1RawFrameHeader *current) | ||
698 | { | ||
699 | 3588 | CodedBitstreamAV1Context *priv = ctx->priv_data; | |
700 | 3588 | const AV1RawSequenceHeader *seq = priv->sequence_header; | |
701 | int err; | ||
702 | |||
703 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | fb(8, base_q_idx); |
704 | |||
705 |
2/6✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1794 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
3588 | delta_q(delta_q_y_dc); |
706 | |||
707 |
1/2✓ Branch 0 taken 1794 times.
✗ Branch 1 not taken.
|
3588 | if (priv->num_planes > 1) { |
708 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1794 times.
|
3588 | if (seq->color_config.separate_uv_delta_q) |
709 | ✗ | flag(diff_uv_delta); | |
710 | else | ||
711 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 374 times.
|
3588 | infer(diff_uv_delta, 0); |
712 | |||
713 |
2/6✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1794 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
3588 | delta_q(delta_q_u_dc); |
714 |
2/6✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1794 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
3588 | delta_q(delta_q_u_ac); |
715 | |||
716 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1794 times.
|
3588 | if (current->diff_uv_delta) { |
717 | ✗ | delta_q(delta_q_v_dc); | |
718 | ✗ | delta_q(delta_q_v_ac); | |
719 | } else { | ||
720 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 374 times.
|
3588 | infer(delta_q_v_dc, current->delta_q_u_dc); |
721 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 374 times.
|
3588 | infer(delta_q_v_ac, current->delta_q_u_ac); |
722 | } | ||
723 | } else { | ||
724 | ✗ | infer(delta_q_u_dc, 0); | |
725 | ✗ | infer(delta_q_u_ac, 0); | |
726 | ✗ | infer(delta_q_v_dc, 0); | |
727 | ✗ | infer(delta_q_v_ac, 0); | |
728 | } | ||
729 | |||
730 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | flag(using_qmatrix); |
731 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1794 times.
|
3588 | if (current->using_qmatrix) { |
732 | ✗ | fb(4, qm_y); | |
733 | ✗ | fb(4, qm_u); | |
734 | ✗ | if (seq->color_config.separate_uv_delta_q) | |
735 | ✗ | fb(4, qm_v); | |
736 | else | ||
737 | ✗ | infer(qm_v, current->qm_u); | |
738 | } | ||
739 | |||
740 | 3588 | return 0; | |
741 | } | ||
742 | |||
743 | 3588 | static int FUNC(segmentation_params)(CodedBitstreamContext *ctx, RWContext *rw, | |
744 | AV1RawFrameHeader *current) | ||
745 | { | ||
746 | 3588 | CodedBitstreamAV1Context *priv = ctx->priv_data; | |
747 | static const uint8_t bits[AV1_SEG_LVL_MAX] = { 8, 6, 6, 6, 6, 3, 0, 0 }; | ||
748 | static const uint8_t sign[AV1_SEG_LVL_MAX] = { 1, 1, 1, 1, 1, 0, 0, 0 }; | ||
749 | static const uint8_t default_feature_enabled[AV1_SEG_LVL_MAX] = { 0 }; | ||
750 | static const int16_t default_feature_value[AV1_SEG_LVL_MAX] = { 0 }; | ||
751 | int i, j, err; | ||
752 | |||
753 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | flag(segmentation_enabled); |
754 | |||
755 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1794 times.
|
3588 | if (current->segmentation_enabled) { |
756 | ✗ | if (current->primary_ref_frame == AV1_PRIMARY_REF_NONE) { | |
757 | ✗ | infer(segmentation_update_map, 1); | |
758 | ✗ | infer(segmentation_temporal_update, 0); | |
759 | ✗ | infer(segmentation_update_data, 1); | |
760 | } else { | ||
761 | ✗ | flag(segmentation_update_map); | |
762 | ✗ | if (current->segmentation_update_map) | |
763 | ✗ | flag(segmentation_temporal_update); | |
764 | else | ||
765 | ✗ | infer(segmentation_temporal_update, 0); | |
766 | ✗ | flag(segmentation_update_data); | |
767 | } | ||
768 | |||
769 | ✗ | for (i = 0; i < AV1_MAX_SEGMENTS; i++) { | |
770 | const uint8_t *ref_feature_enabled; | ||
771 | const int16_t *ref_feature_value; | ||
772 | |||
773 | ✗ | if (current->primary_ref_frame == AV1_PRIMARY_REF_NONE) { | |
774 | ✗ | ref_feature_enabled = default_feature_enabled; | |
775 | ✗ | ref_feature_value = default_feature_value; | |
776 | } else { | ||
777 | ✗ | ref_feature_enabled = | |
778 | ✗ | priv->ref[current->ref_frame_idx[current->primary_ref_frame]].feature_enabled[i]; | |
779 | ✗ | ref_feature_value = | |
780 | ✗ | priv->ref[current->ref_frame_idx[current->primary_ref_frame]].feature_value[i]; | |
781 | } | ||
782 | |||
783 | ✗ | for (j = 0; j < AV1_SEG_LVL_MAX; j++) { | |
784 | ✗ | if (current->segmentation_update_data) { | |
785 | ✗ | flags(feature_enabled[i][j], 2, i, j); | |
786 | |||
787 | ✗ | if (current->feature_enabled[i][j] && bits[j] > 0) { | |
788 | ✗ | if (sign[j]) | |
789 | ✗ | sus(1 + bits[j], feature_value[i][j], 2, i, j); | |
790 | else | ||
791 | ✗ | fbs(bits[j], feature_value[i][j], 2, i, j); | |
792 | } else { | ||
793 | ✗ | infer(feature_value[i][j], 0); | |
794 | } | ||
795 | } else { | ||
796 | ✗ | infer(feature_enabled[i][j], ref_feature_enabled[j]); | |
797 | ✗ | infer(feature_value[i][j], ref_feature_value[j]); | |
798 | } | ||
799 | } | ||
800 | } | ||
801 | } else { | ||
802 |
2/2✓ Branch 0 taken 14352 times.
✓ Branch 1 taken 1794 times.
|
32292 | for (i = 0; i < AV1_MAX_SEGMENTS; i++) { |
803 |
2/2✓ Branch 0 taken 114816 times.
✓ Branch 1 taken 14352 times.
|
258336 | for (j = 0; j < AV1_SEG_LVL_MAX; j++) { |
804 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 23936 times.
|
229632 | infer(feature_enabled[i][j], 0); |
805 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 23936 times.
|
229632 | infer(feature_value[i][j], 0); |
806 | } | ||
807 | } | ||
808 | } | ||
809 | |||
810 | 3588 | return 0; | |
811 | } | ||
812 | |||
813 | 3588 | static int FUNC(delta_q_params)(CodedBitstreamContext *ctx, RWContext *rw, | |
814 | AV1RawFrameHeader *current) | ||
815 | { | ||
816 | int err; | ||
817 | |||
818 |
1/2✓ Branch 0 taken 1794 times.
✗ Branch 1 not taken.
|
3588 | if (current->base_q_idx > 0) |
819 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | flag(delta_q_present); |
820 | else | ||
821 | ✗ | infer(delta_q_present, 0); | |
822 | |||
823 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 1774 times.
|
3588 | if (current->delta_q_present) |
824 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 20 times.
|
40 | fb(2, delta_q_res); |
825 | |||
826 | 3588 | return 0; | |
827 | } | ||
828 | |||
829 | 3588 | static int FUNC(delta_lf_params)(CodedBitstreamContext *ctx, RWContext *rw, | |
830 | AV1RawFrameHeader *current) | ||
831 | { | ||
832 | int err; | ||
833 | |||
834 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 1774 times.
|
3588 | if (current->delta_q_present) { |
835 |
1/2✓ Branch 0 taken 20 times.
✗ Branch 1 not taken.
|
40 | if (!current->allow_intrabc) |
836 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 20 times.
|
40 | flag(delta_lf_present); |
837 | else | ||
838 | ✗ | infer(delta_lf_present, 0); | |
839 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
|
40 | if (current->delta_lf_present) { |
840 | ✗ | fb(2, delta_lf_res); | |
841 | ✗ | flag(delta_lf_multi); | |
842 | } else { | ||
843 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
40 | infer(delta_lf_res, 0); |
844 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
40 | infer(delta_lf_multi, 0); |
845 | } | ||
846 | } else { | ||
847 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 370 times.
|
3548 | infer(delta_lf_present, 0); |
848 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 370 times.
|
3548 | infer(delta_lf_res, 0); |
849 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 370 times.
|
3548 | infer(delta_lf_multi, 0); |
850 | } | ||
851 | |||
852 | 3588 | return 0; | |
853 | } | ||
854 | |||
855 | 3588 | static int FUNC(loop_filter_params)(CodedBitstreamContext *ctx, RWContext *rw, | |
856 | AV1RawFrameHeader *current) | ||
857 | { | ||
858 | 3588 | CodedBitstreamAV1Context *priv = ctx->priv_data; | |
859 | static const int8_t default_loop_filter_ref_deltas[AV1_TOTAL_REFS_PER_FRAME] = | ||
860 | { 1, 0, 0, 0, -1, 0, -1, -1 }; | ||
861 | static const int8_t default_loop_filter_mode_deltas[2] = { 0, 0 }; | ||
862 | int i, err; | ||
863 | |||
864 |
2/4✓ Branch 0 taken 1794 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1794 times.
|
3588 | if (priv->coded_lossless || current->allow_intrabc) { |
865 | ✗ | infer(loop_filter_level[0], 0); | |
866 | ✗ | infer(loop_filter_level[1], 0); | |
867 | ✗ | infer(loop_filter_ref_deltas[AV1_REF_FRAME_INTRA], 1); | |
868 | ✗ | infer(loop_filter_ref_deltas[AV1_REF_FRAME_LAST], 0); | |
869 | ✗ | infer(loop_filter_ref_deltas[AV1_REF_FRAME_LAST2], 0); | |
870 | ✗ | infer(loop_filter_ref_deltas[AV1_REF_FRAME_LAST3], 0); | |
871 | ✗ | infer(loop_filter_ref_deltas[AV1_REF_FRAME_BWDREF], 0); | |
872 | ✗ | infer(loop_filter_ref_deltas[AV1_REF_FRAME_GOLDEN], -1); | |
873 | ✗ | infer(loop_filter_ref_deltas[AV1_REF_FRAME_ALTREF], -1); | |
874 | ✗ | infer(loop_filter_ref_deltas[AV1_REF_FRAME_ALTREF2], -1); | |
875 | ✗ | for (i = 0; i < 2; i++) | |
876 | ✗ | infer(loop_filter_mode_deltas[i], 0); | |
877 | ✗ | return 0; | |
878 | } | ||
879 | |||
880 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | fb(6, loop_filter_level[0]); |
881 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | fb(6, loop_filter_level[1]); |
882 | |||
883 |
1/2✓ Branch 0 taken 1794 times.
✗ Branch 1 not taken.
|
3588 | if (priv->num_planes > 1) { |
884 |
2/2✓ Branch 0 taken 899 times.
✓ Branch 1 taken 895 times.
|
3588 | if (current->loop_filter_level[0] || |
885 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 879 times.
|
1798 | current->loop_filter_level[1]) { |
886 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 915 times.
|
1830 | fb(6, loop_filter_level[2]); |
887 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 915 times.
|
1830 | fb(6, loop_filter_level[3]); |
888 | } | ||
889 | } | ||
890 | |||
891 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | fb(3, loop_filter_sharpness); |
892 | |||
893 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | flag(loop_filter_delta_enabled); |
894 |
1/2✓ Branch 0 taken 1794 times.
✗ Branch 1 not taken.
|
3588 | if (current->loop_filter_delta_enabled) { |
895 | const int8_t *ref_loop_filter_ref_deltas, *ref_loop_filter_mode_deltas; | ||
896 | |||
897 |
2/2✓ Branch 0 taken 498 times.
✓ Branch 1 taken 1296 times.
|
3588 | if (current->primary_ref_frame == AV1_PRIMARY_REF_NONE) { |
898 | 996 | ref_loop_filter_ref_deltas = default_loop_filter_ref_deltas; | |
899 | 996 | ref_loop_filter_mode_deltas = default_loop_filter_mode_deltas; | |
900 | } else { | ||
901 | 2592 | ref_loop_filter_ref_deltas = | |
902 | 2592 | priv->ref[current->ref_frame_idx[current->primary_ref_frame]].loop_filter_ref_deltas; | |
903 | 2592 | ref_loop_filter_mode_deltas = | |
904 | 2592 | priv->ref[current->ref_frame_idx[current->primary_ref_frame]].loop_filter_mode_deltas; | |
905 | } | ||
906 | |||
907 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | flag(loop_filter_delta_update); |
908 |
2/2✓ Branch 0 taken 14352 times.
✓ Branch 1 taken 1794 times.
|
32292 | for (i = 0; i < AV1_TOTAL_REFS_PER_FRAME; i++) { |
909 |
2/2✓ Branch 0 taken 3984 times.
✓ Branch 1 taken 10368 times.
|
28704 | if (current->loop_filter_delta_update) |
910 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 3984 times.
|
7968 | flags(update_ref_delta[i], 1, i); |
911 | else | ||
912 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2176 times.
|
20736 | infer(update_ref_delta[i], 0); |
913 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14352 times.
|
28704 | if (current->update_ref_delta[i]) |
914 | ✗ | sus(1 + 6, loop_filter_ref_deltas[i], 1, i); | |
915 | else | ||
916 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2992 times.
|
28704 | infer(loop_filter_ref_deltas[i], ref_loop_filter_ref_deltas[i]); |
917 | } | ||
918 |
2/2✓ Branch 0 taken 3588 times.
✓ Branch 1 taken 1794 times.
|
10764 | for (i = 0; i < 2; i++) { |
919 |
2/2✓ Branch 0 taken 996 times.
✓ Branch 1 taken 2592 times.
|
7176 | if (current->loop_filter_delta_update) |
920 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 996 times.
|
1992 | flags(update_mode_delta[i], 1, i); |
921 | else | ||
922 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 544 times.
|
5184 | infer(update_mode_delta[i], 0); |
923 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3588 times.
|
7176 | if (current->update_mode_delta[i]) |
924 | ✗ | sus(1 + 6, loop_filter_mode_deltas[i], 1, i); | |
925 | else | ||
926 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 748 times.
|
7176 | infer(loop_filter_mode_deltas[i], ref_loop_filter_mode_deltas[i]); |
927 | } | ||
928 | } else { | ||
929 | ✗ | for (i = 0; i < AV1_TOTAL_REFS_PER_FRAME; i++) | |
930 | ✗ | infer(loop_filter_ref_deltas[i], default_loop_filter_ref_deltas[i]); | |
931 | ✗ | for (i = 0; i < 2; i++) | |
932 | ✗ | infer(loop_filter_mode_deltas[i], default_loop_filter_mode_deltas[i]); | |
933 | } | ||
934 | |||
935 | 3588 | return 0; | |
936 | } | ||
937 | |||
938 | 3588 | static int FUNC(cdef_params)(CodedBitstreamContext *ctx, RWContext *rw, | |
939 | AV1RawFrameHeader *current) | ||
940 | { | ||
941 | 3588 | CodedBitstreamAV1Context *priv = ctx->priv_data; | |
942 | 3588 | const AV1RawSequenceHeader *seq = priv->sequence_header; | |
943 | int i, err; | ||
944 | |||
945 |
2/4✓ Branch 0 taken 1794 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
✗ Branch 3 not taken.
|
3588 | if (priv->coded_lossless || current->allow_intrabc || |
946 |
2/2✓ Branch 0 taken 211 times.
✓ Branch 1 taken 1583 times.
|
3588 | !seq->enable_cdef) { |
947 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 43 times.
|
422 | infer(cdef_damping_minus_3, 0); |
948 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 43 times.
|
422 | infer(cdef_bits, 0); |
949 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 43 times.
|
422 | infer(cdef_y_pri_strength[0], 0); |
950 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 43 times.
|
422 | infer(cdef_y_sec_strength[0], 0); |
951 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 43 times.
|
422 | infer(cdef_uv_pri_strength[0], 0); |
952 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 43 times.
|
422 | infer(cdef_uv_sec_strength[0], 0); |
953 | |||
954 | 422 | return 0; | |
955 | } | ||
956 | |||
957 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1583 times.
|
3166 | fb(2, cdef_damping_minus_3); |
958 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1583 times.
|
3166 | fb(2, cdef_bits); |
959 | |||
960 |
2/2✓ Branch 0 taken 6273 times.
✓ Branch 1 taken 1583 times.
|
15712 | for (i = 0; i < (1 << current->cdef_bits); i++) { |
961 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 6273 times.
|
12546 | fbs(4, cdef_y_pri_strength[i], 1, i); |
962 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 6273 times.
|
12546 | fbs(2, cdef_y_sec_strength[i], 1, i); |
963 | |||
964 |
1/2✓ Branch 0 taken 6273 times.
✗ Branch 1 not taken.
|
12546 | if (priv->num_planes > 1) { |
965 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 6273 times.
|
12546 | fbs(4, cdef_uv_pri_strength[i], 1, i); |
966 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 6273 times.
|
12546 | fbs(2, cdef_uv_sec_strength[i], 1, i); |
967 | } | ||
968 | } | ||
969 | |||
970 | 3166 | return 0; | |
971 | } | ||
972 | |||
973 | 3588 | static int FUNC(lr_params)(CodedBitstreamContext *ctx, RWContext *rw, | |
974 | AV1RawFrameHeader *current) | ||
975 | { | ||
976 | 3588 | CodedBitstreamAV1Context *priv = ctx->priv_data; | |
977 | 3588 | const AV1RawSequenceHeader *seq = priv->sequence_header; | |
978 | int uses_lr, uses_chroma_lr; | ||
979 | int i, err; | ||
980 | |||
981 |
2/4✓ Branch 0 taken 1794 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
✗ Branch 3 not taken.
|
3588 | if (priv->all_lossless || current->allow_intrabc || |
982 |
2/2✓ Branch 0 taken 160 times.
✓ Branch 1 taken 1634 times.
|
3588 | !seq->enable_restoration) { |
983 | 320 | return 0; | |
984 | } | ||
985 | |||
986 | 3268 | uses_lr = uses_chroma_lr = 0; | |
987 |
2/2✓ Branch 0 taken 4902 times.
✓ Branch 1 taken 1634 times.
|
13072 | for (i = 0; i < priv->num_planes; i++) { |
988 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4902 times.
|
9804 | fbs(2, lr_type[i], 1, i); |
989 | |||
990 |
2/2✓ Branch 0 taken 1290 times.
✓ Branch 1 taken 3612 times.
|
9804 | if (current->lr_type[i] != AV1_RESTORE_NONE) { |
991 | 2580 | uses_lr = 1; | |
992 |
2/2✓ Branch 0 taken 502 times.
✓ Branch 1 taken 788 times.
|
2580 | if (i > 0) |
993 | 1004 | uses_chroma_lr = 1; | |
994 | } | ||
995 | } | ||
996 | |||
997 |
2/2✓ Branch 0 taken 877 times.
✓ Branch 1 taken 757 times.
|
3268 | if (uses_lr) { |
998 |
2/2✓ Branch 0 taken 551 times.
✓ Branch 1 taken 326 times.
|
1754 | if (seq->use_128x128_superblock) |
999 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 551 times.
|
1102 | increment(lr_unit_shift, 1, 2); |
1000 | else | ||
1001 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 326 times.
|
652 | increment(lr_unit_shift, 0, 2); |
1002 | |||
1003 |
1/2✓ Branch 0 taken 877 times.
✗ Branch 1 not taken.
|
1754 | if(seq->color_config.subsampling_x && |
1004 |
3/4✓ Branch 0 taken 877 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 329 times.
✓ Branch 3 taken 548 times.
|
1754 | seq->color_config.subsampling_y && uses_chroma_lr) { |
1005 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 329 times.
|
658 | fb(1, lr_uv_shift); |
1006 | } else { | ||
1007 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 122 times.
|
1096 | infer(lr_uv_shift, 0); |
1008 | } | ||
1009 | } | ||
1010 | |||
1011 | 3268 | return 0; | |
1012 | } | ||
1013 | |||
1014 | 3588 | static int FUNC(read_tx_mode)(CodedBitstreamContext *ctx, RWContext *rw, | |
1015 | AV1RawFrameHeader *current) | ||
1016 | { | ||
1017 | 3588 | CodedBitstreamAV1Context *priv = ctx->priv_data; | |
1018 | int err; | ||
1019 | |||
1020 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1794 times.
|
3588 | if (priv->coded_lossless) |
1021 | ✗ | infer(tx_mode, 0); | |
1022 | else | ||
1023 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | increment(tx_mode, 1, 2); |
1024 | |||
1025 | 3588 | return 0; | |
1026 | } | ||
1027 | |||
1028 | 3588 | static int FUNC(frame_reference_mode)(CodedBitstreamContext *ctx, RWContext *rw, | |
1029 | AV1RawFrameHeader *current) | ||
1030 | { | ||
1031 | int err; | ||
1032 | |||
1033 |
1/2✓ Branch 0 taken 1794 times.
✗ Branch 1 not taken.
|
3588 | if (current->frame_type == AV1_FRAME_INTRA_ONLY || |
1034 |
2/2✓ Branch 0 taken 260 times.
✓ Branch 1 taken 1534 times.
|
3588 | current->frame_type == AV1_FRAME_KEY) |
1035 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 58 times.
|
520 | infer(reference_select, 0); |
1036 | else | ||
1037 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1534 times.
|
3068 | flag(reference_select); |
1038 | |||
1039 | 3588 | return 0; | |
1040 | } | ||
1041 | |||
1042 | 3588 | static int FUNC(skip_mode_params)(CodedBitstreamContext *ctx, RWContext *rw, | |
1043 | AV1RawFrameHeader *current) | ||
1044 | { | ||
1045 | 3588 | CodedBitstreamAV1Context *priv = ctx->priv_data; | |
1046 | 3588 | const AV1RawSequenceHeader *seq = priv->sequence_header; | |
1047 | int skip_mode_allowed; | ||
1048 | int err; | ||
1049 | |||
1050 |
2/2✓ Branch 0 taken 1534 times.
✓ Branch 1 taken 260 times.
|
3588 | if (current->frame_type == AV1_FRAME_KEY || |
1051 |
1/2✓ Branch 0 taken 1534 times.
✗ Branch 1 not taken.
|
3068 | current->frame_type == AV1_FRAME_INTRA_ONLY || |
1052 |
3/4✓ Branch 0 taken 851 times.
✓ Branch 1 taken 683 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 851 times.
|
3068 | !current->reference_select || !seq->enable_order_hint) { |
1053 | 1886 | skip_mode_allowed = 0; | |
1054 | } else { | ||
1055 | int forward_idx, backward_idx; | ||
1056 | int forward_hint, backward_hint; | ||
1057 | int ref_hint, dist, i; | ||
1058 | |||
1059 | 1702 | forward_idx = -1; | |
1060 | 1702 | backward_idx = -1; | |
1061 |
2/2✓ Branch 0 taken 5957 times.
✓ Branch 1 taken 851 times.
|
13616 | for (i = 0; i < AV1_REFS_PER_FRAME; i++) { |
1062 | 11914 | ref_hint = priv->ref[current->ref_frame_idx[i]].order_hint; | |
1063 | 11914 | dist = cbs_av1_get_relative_dist(seq, ref_hint, | |
1064 | 11914 | priv->order_hint); | |
1065 |
2/2✓ Branch 0 taken 5059 times.
✓ Branch 1 taken 898 times.
|
11914 | if (dist < 0) { |
1066 |
4/4✓ Branch 0 taken 4208 times.
✓ Branch 1 taken 851 times.
✓ Branch 2 taken 179 times.
✓ Branch 3 taken 4029 times.
|
18534 | if (forward_idx < 0 || |
1067 | 8416 | cbs_av1_get_relative_dist(seq, ref_hint, | |
1068 | forward_hint) > 0) { | ||
1069 | 2060 | forward_idx = i; | |
1070 | 2060 | forward_hint = ref_hint; | |
1071 | } | ||
1072 |
2/2✓ Branch 0 taken 865 times.
✓ Branch 1 taken 33 times.
|
1796 | } else if (dist > 0) { |
1073 |
3/4✓ Branch 0 taken 388 times.
✓ Branch 1 taken 477 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 388 times.
|
2506 | if (backward_idx < 0 || |
1074 | 776 | cbs_av1_get_relative_dist(seq, ref_hint, | |
1075 | backward_hint) < 0) { | ||
1076 | 954 | backward_idx = i; | |
1077 | 954 | backward_hint = ref_hint; | |
1078 | } | ||
1079 | } | ||
1080 | } | ||
1081 | |||
1082 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 851 times.
|
1702 | if (forward_idx < 0) { |
1083 | ✗ | skip_mode_allowed = 0; | |
1084 |
2/2✓ Branch 0 taken 477 times.
✓ Branch 1 taken 374 times.
|
1702 | } else if (backward_idx >= 0) { |
1085 | 954 | skip_mode_allowed = 1; | |
1086 | // Frames for skip mode are forward_idx and backward_idx. | ||
1087 | } else { | ||
1088 | int second_forward_idx; | ||
1089 | int second_forward_hint; | ||
1090 | |||
1091 | 748 | second_forward_idx = -1; | |
1092 |
2/2✓ Branch 0 taken 2618 times.
✓ Branch 1 taken 374 times.
|
5984 | for (i = 0; i < AV1_REFS_PER_FRAME; i++) { |
1093 | 5236 | ref_hint = priv->ref[current->ref_frame_idx[i]].order_hint; | |
1094 |
2/2✓ Branch 1 taken 2052 times.
✓ Branch 2 taken 566 times.
|
5236 | if (cbs_av1_get_relative_dist(seq, ref_hint, |
1095 | forward_hint) < 0) { | ||
1096 |
4/4✓ Branch 0 taken 1702 times.
✓ Branch 1 taken 350 times.
✓ Branch 2 taken 52 times.
✓ Branch 3 taken 1650 times.
|
7508 | if (second_forward_idx < 0 || |
1097 | 3404 | cbs_av1_get_relative_dist(seq, ref_hint, | |
1098 | second_forward_hint) > 0) { | ||
1099 | 804 | second_forward_idx = i; | |
1100 | 804 | second_forward_hint = ref_hint; | |
1101 | } | ||
1102 | } | ||
1103 | } | ||
1104 | |||
1105 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 350 times.
|
748 | if (second_forward_idx < 0) { |
1106 | 48 | skip_mode_allowed = 0; | |
1107 | } else { | ||
1108 | 700 | skip_mode_allowed = 1; | |
1109 | // Frames for skip mode are forward_idx and second_forward_idx. | ||
1110 | } | ||
1111 | } | ||
1112 | } | ||
1113 | |||
1114 |
2/2✓ Branch 0 taken 827 times.
✓ Branch 1 taken 967 times.
|
3588 | if (skip_mode_allowed) |
1115 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 827 times.
|
1654 | flag(skip_mode_present); |
1116 | else | ||
1117 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 204 times.
|
1934 | infer(skip_mode_present, 0); |
1118 | |||
1119 | 3588 | return 0; | |
1120 | } | ||
1121 | |||
1122 | 952 | static int FUNC(global_motion_param)(CodedBitstreamContext *ctx, RWContext *rw, | |
1123 | AV1RawFrameHeader *current, | ||
1124 | int type, int ref, int idx) | ||
1125 | { | ||
1126 | uint32_t abs_bits, prec_bits, num_syms; | ||
1127 | int err; | ||
1128 | |||
1129 |
2/2✓ Branch 0 taken 238 times.
✓ Branch 1 taken 238 times.
|
952 | if (idx < 2) { |
1130 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 238 times.
|
476 | if (type == AV1_WARP_MODEL_TRANSLATION) { |
1131 | ✗ | abs_bits = AV1_GM_ABS_TRANS_ONLY_BITS - !current->allow_high_precision_mv; | |
1132 | ✗ | prec_bits = AV1_GM_TRANS_ONLY_PREC_BITS - !current->allow_high_precision_mv; | |
1133 | } else { | ||
1134 | 476 | abs_bits = AV1_GM_ABS_TRANS_BITS; | |
1135 | 476 | prec_bits = AV1_GM_TRANS_PREC_BITS; | |
1136 | } | ||
1137 | } else { | ||
1138 | 476 | abs_bits = AV1_GM_ABS_ALPHA_BITS; | |
1139 | 476 | prec_bits = AV1_GM_ALPHA_PREC_BITS; | |
1140 | } | ||
1141 | |||
1142 | 952 | num_syms = 2 * (1 << abs_bits) + 1; | |
1143 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 476 times.
|
952 | subexp(gm_params[ref][idx], num_syms, 2, ref, idx); |
1144 | |||
1145 | // Actual gm_params value is not reconstructed here. | ||
1146 | (void)prec_bits; | ||
1147 | |||
1148 | 952 | return 0; | |
1149 | } | ||
1150 | |||
1151 | 3588 | static int FUNC(global_motion_params)(CodedBitstreamContext *ctx, RWContext *rw, | |
1152 | AV1RawFrameHeader *current) | ||
1153 | { | ||
1154 | int ref, type; | ||
1155 | int err; | ||
1156 | |||
1157 |
2/2✓ Branch 0 taken 1534 times.
✓ Branch 1 taken 260 times.
|
3588 | if (current->frame_type == AV1_FRAME_KEY || |
1158 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1534 times.
|
3068 | current->frame_type == AV1_FRAME_INTRA_ONLY) |
1159 | 520 | return 0; | |
1160 | |||
1161 |
2/2✓ Branch 0 taken 10738 times.
✓ Branch 1 taken 1534 times.
|
24544 | for (ref = AV1_REF_FRAME_LAST; ref <= AV1_REF_FRAME_ALTREF; ref++) { |
1162 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 10738 times.
|
21476 | flags(is_global[ref], 1, ref); |
1163 |
2/2✓ Branch 0 taken 119 times.
✓ Branch 1 taken 10619 times.
|
21476 | if (current->is_global[ref]) { |
1164 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 119 times.
|
238 | flags(is_rot_zoom[ref], 1, ref); |
1165 |
1/2✓ Branch 0 taken 119 times.
✗ Branch 1 not taken.
|
238 | if (current->is_rot_zoom[ref]) { |
1166 | 238 | type = AV1_WARP_MODEL_ROTZOOM; | |
1167 | } else { | ||
1168 | ✗ | flags(is_translation[ref], 1, ref); | |
1169 | ✗ | type = current->is_translation[ref] ? AV1_WARP_MODEL_TRANSLATION | |
1170 | ✗ | : AV1_WARP_MODEL_AFFINE; | |
1171 | } | ||
1172 | } else { | ||
1173 | 21238 | type = AV1_WARP_MODEL_IDENTITY; | |
1174 | } | ||
1175 | |||
1176 |
2/2✓ Branch 0 taken 119 times.
✓ Branch 1 taken 10619 times.
|
21476 | if (type >= AV1_WARP_MODEL_ROTZOOM) { |
1177 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 119 times.
|
238 | CHECK(FUNC(global_motion_param)(ctx, rw, current, type, ref, 2)); |
1178 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 119 times.
|
238 | CHECK(FUNC(global_motion_param)(ctx, rw, current, type, ref, 3)); |
1179 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 119 times.
|
238 | if (type == AV1_WARP_MODEL_AFFINE) { |
1180 | ✗ | CHECK(FUNC(global_motion_param)(ctx, rw, current, type, ref, 4)); | |
1181 | ✗ | CHECK(FUNC(global_motion_param)(ctx, rw, current, type, ref, 5)); | |
1182 | } else { | ||
1183 | // gm_params[ref][4] = -gm_params[ref][3] | ||
1184 | // gm_params[ref][5] = gm_params[ref][2] | ||
1185 | } | ||
1186 | } | ||
1187 |
2/2✓ Branch 0 taken 119 times.
✓ Branch 1 taken 10619 times.
|
21476 | if (type >= AV1_WARP_MODEL_TRANSLATION) { |
1188 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 119 times.
|
238 | CHECK(FUNC(global_motion_param)(ctx, rw, current, type, ref, 0)); |
1189 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 119 times.
|
238 | CHECK(FUNC(global_motion_param)(ctx, rw, current, type, ref, 1)); |
1190 | } | ||
1191 | } | ||
1192 | |||
1193 | 3068 | return 0; | |
1194 | } | ||
1195 | |||
1196 | 3588 | static int FUNC(film_grain_params)(CodedBitstreamContext *ctx, RWContext *rw, | |
1197 | AV1RawFilmGrainParams *current, | ||
1198 | AV1RawFrameHeader *frame_header) | ||
1199 | { | ||
1200 | 3588 | CodedBitstreamAV1Context *priv = ctx->priv_data; | |
1201 | 3588 | const AV1RawSequenceHeader *seq = priv->sequence_header; | |
1202 | int num_pos_luma, num_pos_chroma; | ||
1203 | int i, err; | ||
1204 | |||
1205 |
2/2✓ Branch 0 taken 98 times.
✓ Branch 1 taken 1696 times.
|
3588 | if (!seq->film_grain_params_present || |
1206 |
4/4✓ Branch 0 taken 36 times.
✓ Branch 1 taken 62 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 26 times.
|
196 | (!frame_header->show_frame && !frame_header->showable_frame)) |
1207 | 3412 | return 0; | |
1208 | |||
1209 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
|
176 | flag(apply_grain); |
1210 | |||
1211 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 88 times.
|
176 | if (!current->apply_grain) |
1212 | ✗ | return 0; | |
1213 | |||
1214 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
|
176 | fb(16, grain_seed); |
1215 | |||
1216 |
2/2✓ Branch 0 taken 78 times.
✓ Branch 1 taken 10 times.
|
176 | if (frame_header->frame_type == AV1_FRAME_INTER) |
1217 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 78 times.
|
156 | flag(update_grain); |
1218 | else | ||
1219 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
20 | infer(update_grain, 1); |
1220 | |||
1221 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 88 times.
|
176 | if (!current->update_grain) { |
1222 | ✗ | fb(3, film_grain_params_ref_idx); | |
1223 | ✗ | return 0; | |
1224 | } | ||
1225 | |||
1226 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
|
176 | fc(4, num_y_points, 0, 14); |
1227 |
2/2✓ Branch 0 taken 610 times.
✓ Branch 1 taken 88 times.
|
1396 | for (i = 0; i < current->num_y_points; i++) { |
1228 |
3/4✓ Branch 0 taken 522 times.
✓ Branch 1 taken 88 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 610 times.
|
1220 | fcs(8, point_y_value[i], |
1229 | i ? current->point_y_value[i - 1] + 1 : 0, | ||
1230 | MAX_UINT_BITS(8) - (current->num_y_points - i - 1), | ||
1231 | 1, i); | ||
1232 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 610 times.
|
1220 | fbs(8, point_y_scaling[i], 1, i); |
1233 | } | ||
1234 | |||
1235 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 88 times.
|
176 | if (seq->color_config.mono_chrome) |
1236 | ✗ | infer(chroma_scaling_from_luma, 0); | |
1237 | else | ||
1238 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
|
176 | flag(chroma_scaling_from_luma); |
1239 | |||
1240 |
1/2✓ Branch 0 taken 88 times.
✗ Branch 1 not taken.
|
176 | if (seq->color_config.mono_chrome || |
1241 |
1/2✓ Branch 0 taken 88 times.
✗ Branch 1 not taken.
|
176 | current->chroma_scaling_from_luma || |
1242 |
1/2✓ Branch 0 taken 88 times.
✗ Branch 1 not taken.
|
176 | (seq->color_config.subsampling_x == 1 && |
1243 |
1/2✓ Branch 0 taken 88 times.
✗ Branch 1 not taken.
|
176 | seq->color_config.subsampling_y == 1 && |
1244 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 88 times.
|
176 | current->num_y_points == 0)) { |
1245 | ✗ | infer(num_cb_points, 0); | |
1246 | ✗ | infer(num_cr_points, 0); | |
1247 | } else { | ||
1248 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
|
176 | fc(4, num_cb_points, 0, 10); |
1249 |
2/2✓ Branch 0 taken 344 times.
✓ Branch 1 taken 88 times.
|
864 | for (i = 0; i < current->num_cb_points; i++) { |
1250 |
3/4✓ Branch 0 taken 256 times.
✓ Branch 1 taken 88 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 344 times.
|
688 | fcs(8, point_cb_value[i], |
1251 | i ? current->point_cb_value[i - 1] + 1 : 0, | ||
1252 | MAX_UINT_BITS(8) - (current->num_cb_points - i - 1), | ||
1253 | 1, i); | ||
1254 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 344 times.
|
688 | fbs(8, point_cb_scaling[i], 1, i); |
1255 | } | ||
1256 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
|
176 | fc(4, num_cr_points, 0, 10); |
1257 |
2/2✓ Branch 0 taken 350 times.
✓ Branch 1 taken 88 times.
|
876 | for (i = 0; i < current->num_cr_points; i++) { |
1258 |
3/4✓ Branch 0 taken 262 times.
✓ Branch 1 taken 88 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 350 times.
|
700 | fcs(8, point_cr_value[i], |
1259 | i ? current->point_cr_value[i - 1] + 1 : 0, | ||
1260 | MAX_UINT_BITS(8) - (current->num_cr_points - i - 1), | ||
1261 | 1, i); | ||
1262 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 350 times.
|
700 | fbs(8, point_cr_scaling[i], 1, i); |
1263 | } | ||
1264 | } | ||
1265 | |||
1266 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
|
176 | fb(2, grain_scaling_minus_8); |
1267 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
|
176 | fb(2, ar_coeff_lag); |
1268 | 176 | num_pos_luma = 2 * current->ar_coeff_lag * (current->ar_coeff_lag + 1); | |
1269 |
1/2✓ Branch 0 taken 88 times.
✗ Branch 1 not taken.
|
176 | if (current->num_y_points) { |
1270 | 176 | num_pos_chroma = num_pos_luma + 1; | |
1271 |
2/2✓ Branch 0 taken 2112 times.
✓ Branch 1 taken 88 times.
|
4400 | for (i = 0; i < num_pos_luma; i++) |
1272 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2112 times.
|
4224 | fbs(8, ar_coeffs_y_plus_128[i], 1, i); |
1273 | } else { | ||
1274 | ✗ | num_pos_chroma = num_pos_luma; | |
1275 | } | ||
1276 |
2/4✓ Branch 0 taken 88 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
✗ Branch 3 not taken.
|
176 | if (current->chroma_scaling_from_luma || current->num_cb_points) { |
1277 |
2/2✓ Branch 0 taken 2200 times.
✓ Branch 1 taken 88 times.
|
4576 | for (i = 0; i < num_pos_chroma; i++) |
1278 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2200 times.
|
4400 | fbs(8, ar_coeffs_cb_plus_128[i], 1, i); |
1279 | } | ||
1280 |
2/4✓ Branch 0 taken 88 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
✗ Branch 3 not taken.
|
176 | if (current->chroma_scaling_from_luma || current->num_cr_points) { |
1281 |
2/2✓ Branch 0 taken 2200 times.
✓ Branch 1 taken 88 times.
|
4576 | for (i = 0; i < num_pos_chroma; i++) |
1282 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2200 times.
|
4400 | fbs(8, ar_coeffs_cr_plus_128[i], 1, i); |
1283 | } | ||
1284 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
|
176 | fb(2, ar_coeff_shift_minus_6); |
1285 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
|
176 | fb(2, grain_scale_shift); |
1286 |
1/2✓ Branch 0 taken 88 times.
✗ Branch 1 not taken.
|
176 | if (current->num_cb_points) { |
1287 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
|
176 | fb(8, cb_mult); |
1288 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
|
176 | fb(8, cb_luma_mult); |
1289 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
|
176 | fb(9, cb_offset); |
1290 | } | ||
1291 |
1/2✓ Branch 0 taken 88 times.
✗ Branch 1 not taken.
|
176 | if (current->num_cr_points) { |
1292 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
|
176 | fb(8, cr_mult); |
1293 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
|
176 | fb(8, cr_luma_mult); |
1294 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
|
176 | fb(9, cr_offset); |
1295 | } | ||
1296 | |||
1297 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
|
176 | flag(overlap_flag); |
1298 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
|
176 | flag(clip_to_restricted_range); |
1299 | |||
1300 | 176 | return 0; | |
1301 | } | ||
1302 | |||
1303 | 4018 | static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw, | |
1304 | AV1RawFrameHeader *current) | ||
1305 | { | ||
1306 | 4018 | CodedBitstreamAV1Context *priv = ctx->priv_data; | |
1307 | const AV1RawSequenceHeader *seq; | ||
1308 | int id_len, diff_len, all_frames, frame_is_intra, order_hint_bits; | ||
1309 | int i, err; | ||
1310 | |||
1311 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2009 times.
|
4018 | if (!priv->sequence_header) { |
1312 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, "No sequence header available: " | |
1313 | "unable to decode frame header.\n"); | ||
1314 | ✗ | return AVERROR_INVALIDDATA; | |
1315 | } | ||
1316 | 4018 | seq = priv->sequence_header; | |
1317 | |||
1318 | 4018 | id_len = seq->additional_frame_id_length_minus_1 + | |
1319 | 4018 | seq->delta_frame_id_length_minus_2 + 3; | |
1320 | 4018 | all_frames = (1 << AV1_NUM_REF_FRAMES) - 1; | |
1321 | |||
1322 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2009 times.
|
4018 | if (seq->reduced_still_picture_header) { |
1323 | ✗ | infer(show_existing_frame, 0); | |
1324 | ✗ | infer(frame_type, AV1_FRAME_KEY); | |
1325 | ✗ | infer(show_frame, 1); | |
1326 | ✗ | infer(showable_frame, 0); | |
1327 | ✗ | frame_is_intra = 1; | |
1328 | |||
1329 | } else { | ||
1330 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2009 times.
|
4018 | flag(show_existing_frame); |
1331 | |||
1332 |
2/2✓ Branch 0 taken 215 times.
✓ Branch 1 taken 1794 times.
|
4018 | if (current->show_existing_frame) { |
1333 | AV1ReferenceFrameState *ref; | ||
1334 | |||
1335 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
|
430 | fb(3, frame_to_show_map_idx); |
1336 | 430 | ref = &priv->ref[current->frame_to_show_map_idx]; | |
1337 | |||
1338 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 215 times.
|
430 | if (!ref->valid) { |
1339 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, "Missing reference frame needed for " | |
1340 | "show_existing_frame (frame_to_show_map_idx = %d).\n", | ||
1341 | ✗ | current->frame_to_show_map_idx); | |
1342 | ✗ | return AVERROR_INVALIDDATA; | |
1343 | } | ||
1344 | |||
1345 |
2/2✓ Branch 0 taken 43 times.
✓ Branch 1 taken 172 times.
|
430 | if (seq->decoder_model_info_present_flag && |
1346 |
1/2✓ Branch 0 taken 43 times.
✗ Branch 1 not taken.
|
86 | !seq->timing_info.equal_picture_interval) { |
1347 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 43 times.
|
86 | fb(seq->decoder_model_info.frame_presentation_time_length_minus_1 + 1, |
1348 | frame_presentation_time); | ||
1349 | } | ||
1350 | |||
1351 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 215 times.
|
430 | if (seq->frame_id_numbers_present_flag) |
1352 | ✗ | fb(id_len, display_frame_id); | |
1353 | |||
1354 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 47 times.
|
430 | infer(frame_type, ref->frame_type); |
1355 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 207 times.
|
430 | if (current->frame_type == AV1_FRAME_KEY) { |
1356 |
0/2✗ Branch 0 not taken.
✗ Branch 1 not taken.
|
16 | infer(refresh_frame_flags, all_frames); |
1357 | |||
1358 | // Section 7.21 | ||
1359 |
0/2✗ Branch 0 not taken.
✗ Branch 1 not taken.
|
16 | infer(current_frame_id, ref->frame_id); |
1360 | 16 | priv->upscaled_width = ref->upscaled_width; | |
1361 | 16 | priv->frame_width = ref->frame_width; | |
1362 | 16 | priv->frame_height = ref->frame_height; | |
1363 | 16 | priv->render_width = ref->render_width; | |
1364 | 16 | priv->render_height = ref->render_height; | |
1365 | 16 | priv->bit_depth = ref->bit_depth; | |
1366 | 16 | priv->order_hint = ref->order_hint; | |
1367 | } else | ||
1368 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 47 times.
|
414 | infer(refresh_frame_flags, 0); |
1369 | |||
1370 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 47 times.
|
430 | infer(frame_width_minus_1, ref->upscaled_width - 1); |
1371 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 47 times.
|
430 | infer(frame_height_minus_1, ref->frame_height - 1); |
1372 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 47 times.
|
430 | infer(render_width_minus_1, ref->render_width - 1); |
1373 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 47 times.
|
430 | infer(render_height_minus_1, ref->render_height - 1); |
1374 | |||
1375 | // Section 7.20 | ||
1376 | 430 | goto update_refs; | |
1377 | } | ||
1378 | |||
1379 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | fb(2, frame_type); |
1380 |
1/2✓ Branch 0 taken 1794 times.
✗ Branch 1 not taken.
|
7176 | frame_is_intra = (current->frame_type == AV1_FRAME_INTRA_ONLY || |
1381 |
2/2✓ Branch 0 taken 260 times.
✓ Branch 1 taken 1534 times.
|
3588 | current->frame_type == AV1_FRAME_KEY); |
1382 | |||
1383 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | flag(show_frame); |
1384 |
2/2✓ Branch 0 taken 1446 times.
✓ Branch 1 taken 348 times.
|
3588 | if (current->show_frame && |
1385 |
2/2✓ Branch 0 taken 417 times.
✓ Branch 1 taken 1029 times.
|
2892 | seq->decoder_model_info_present_flag && |
1386 |
1/2✓ Branch 0 taken 417 times.
✗ Branch 1 not taken.
|
834 | !seq->timing_info.equal_picture_interval) { |
1387 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 417 times.
|
834 | fb(seq->decoder_model_info.frame_presentation_time_length_minus_1 + 1, |
1388 | frame_presentation_time); | ||
1389 | } | ||
1390 |
2/2✓ Branch 0 taken 1446 times.
✓ Branch 1 taken 348 times.
|
3588 | if (current->show_frame) |
1391 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 306 times.
|
2892 | infer(showable_frame, current->frame_type != AV1_FRAME_KEY); |
1392 | else | ||
1393 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 348 times.
|
696 | flag(showable_frame); |
1394 | |||
1395 |
2/2✓ Branch 0 taken 1789 times.
✓ Branch 1 taken 5 times.
|
3588 | if (current->frame_type == AV1_FRAME_SWITCH || |
1396 |
3/4✓ Branch 0 taken 260 times.
✓ Branch 1 taken 1529 times.
✓ Branch 2 taken 260 times.
✗ Branch 3 not taken.
|
3578 | (current->frame_type == AV1_FRAME_KEY && current->show_frame)) |
1397 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 59 times.
|
530 | infer(error_resilient_mode, 1); |
1398 | else | ||
1399 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1529 times.
|
3058 | flag(error_resilient_mode); |
1400 | } | ||
1401 | |||
1402 |
3/4✓ Branch 0 taken 260 times.
✓ Branch 1 taken 1534 times.
✓ Branch 2 taken 260 times.
✗ Branch 3 not taken.
|
3588 | if (current->frame_type == AV1_FRAME_KEY && current->show_frame) { |
1403 |
2/2✓ Branch 0 taken 2080 times.
✓ Branch 1 taken 260 times.
|
4680 | for (i = 0; i < AV1_NUM_REF_FRAMES; i++) { |
1404 | 4160 | priv->ref[i].valid = 0; | |
1405 | 4160 | priv->ref[i].order_hint = 0; | |
1406 | } | ||
1407 | } | ||
1408 | |||
1409 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | flag(disable_cdf_update); |
1410 | |||
1411 |
1/2✓ Branch 0 taken 1794 times.
✗ Branch 1 not taken.
|
3588 | if (seq->seq_force_screen_content_tools == |
1412 | AV1_SELECT_SCREEN_CONTENT_TOOLS) { | ||
1413 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | flag(allow_screen_content_tools); |
1414 | } else { | ||
1415 | ✗ | infer(allow_screen_content_tools, | |
1416 | seq->seq_force_screen_content_tools); | ||
1417 | } | ||
1418 |
2/2✓ Branch 0 taken 51 times.
✓ Branch 1 taken 1743 times.
|
3588 | if (current->allow_screen_content_tools) { |
1419 |
1/2✓ Branch 0 taken 51 times.
✗ Branch 1 not taken.
|
102 | if (seq->seq_force_integer_mv == AV1_SELECT_INTEGER_MV) |
1420 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 51 times.
|
102 | flag(force_integer_mv); |
1421 | else | ||
1422 | ✗ | infer(force_integer_mv, seq->seq_force_integer_mv); | |
1423 | } else { | ||
1424 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 363 times.
|
3486 | infer(force_integer_mv, 0); |
1425 | } | ||
1426 | |||
1427 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1794 times.
|
3588 | if (seq->frame_id_numbers_present_flag) { |
1428 | ✗ | fb(id_len, current_frame_id); | |
1429 | |||
1430 | ✗ | diff_len = seq->delta_frame_id_length_minus_2 + 2; | |
1431 | ✗ | for (i = 0; i < AV1_NUM_REF_FRAMES; i++) { | |
1432 | ✗ | if (current->current_frame_id > (1 << diff_len)) { | |
1433 | ✗ | if (priv->ref[i].frame_id > current->current_frame_id || | |
1434 | ✗ | priv->ref[i].frame_id < (current->current_frame_id - | |
1435 | ✗ | (1 << diff_len))) | |
1436 | ✗ | priv->ref[i].valid = 0; | |
1437 | } else { | ||
1438 | ✗ | if (priv->ref[i].frame_id > current->current_frame_id && | |
1439 | ✗ | priv->ref[i].frame_id < ((1 << id_len) + | |
1440 | ✗ | current->current_frame_id - | |
1441 | ✗ | (1 << diff_len))) | |
1442 | ✗ | priv->ref[i].valid = 0; | |
1443 | } | ||
1444 | } | ||
1445 | } else { | ||
1446 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 374 times.
|
3588 | infer(current_frame_id, 0); |
1447 | } | ||
1448 | |||
1449 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1789 times.
|
3588 | if (current->frame_type == AV1_FRAME_SWITCH) |
1450 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
10 | infer(frame_size_override_flag, 1); |
1451 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1789 times.
|
3578 | else if(seq->reduced_still_picture_header) |
1452 | ✗ | infer(frame_size_override_flag, 0); | |
1453 | else | ||
1454 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1789 times.
|
3578 | flag(frame_size_override_flag); |
1455 | |||
1456 | 3588 | order_hint_bits = | |
1457 |
1/2✓ Branch 0 taken 1794 times.
✗ Branch 1 not taken.
|
3588 | seq->enable_order_hint ? seq->order_hint_bits_minus_1 + 1 : 0; |
1458 |
1/2✓ Branch 0 taken 1794 times.
✗ Branch 1 not taken.
|
3588 | if (order_hint_bits > 0) |
1459 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | fb(order_hint_bits, order_hint); |
1460 | else | ||
1461 | ✗ | infer(order_hint, 0); | |
1462 | 3588 | priv->order_hint = current->order_hint; | |
1463 | |||
1464 |
4/4✓ Branch 0 taken 1534 times.
✓ Branch 1 taken 260 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 1529 times.
|
3588 | if (frame_is_intra || current->error_resilient_mode) |
1465 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 59 times.
|
530 | infer(primary_ref_frame, AV1_PRIMARY_REF_NONE); |
1466 | else | ||
1467 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1529 times.
|
3058 | fb(3, primary_ref_frame); |
1468 | |||
1469 |
2/2✓ Branch 0 taken 511 times.
✓ Branch 1 taken 1283 times.
|
3588 | if (seq->decoder_model_info_present_flag) { |
1470 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 511 times.
|
1022 | flag(buffer_removal_time_present_flag); |
1471 |
1/2✓ Branch 0 taken 511 times.
✗ Branch 1 not taken.
|
1022 | if (current->buffer_removal_time_present_flag) { |
1472 |
2/2✓ Branch 0 taken 511 times.
✓ Branch 1 taken 511 times.
|
2044 | for (i = 0; i <= seq->operating_points_cnt_minus_1; i++) { |
1473 |
1/2✓ Branch 0 taken 511 times.
✗ Branch 1 not taken.
|
1022 | if (seq->decoder_model_present_for_this_op[i]) { |
1474 | 1022 | int op_pt_idc = seq->operating_point_idc[i]; | |
1475 | 1022 | int in_temporal_layer = (op_pt_idc >> priv->temporal_id ) & 1; | |
1476 | 1022 | int in_spatial_layer = (op_pt_idc >> (priv->spatial_id + 8)) & 1; | |
1477 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 511 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1022 | if (seq->operating_point_idc[i] == 0 || |
1478 | ✗ | (in_temporal_layer && in_spatial_layer)) { | |
1479 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 511 times.
|
1022 | fbs(seq->decoder_model_info.buffer_removal_time_length_minus_1 + 1, |
1480 | buffer_removal_time[i], 1, i); | ||
1481 | } | ||
1482 | } | ||
1483 | } | ||
1484 | } | ||
1485 | } | ||
1486 | |||
1487 |
2/2✓ Branch 0 taken 1789 times.
✓ Branch 1 taken 5 times.
|
3588 | if (current->frame_type == AV1_FRAME_SWITCH || |
1488 |
3/4✓ Branch 0 taken 260 times.
✓ Branch 1 taken 1529 times.
✓ Branch 2 taken 260 times.
✗ Branch 3 not taken.
|
3578 | (current->frame_type == AV1_FRAME_KEY && current->show_frame)) |
1489 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 59 times.
|
530 | infer(refresh_frame_flags, all_frames); |
1490 | else | ||
1491 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1529 times.
|
3058 | fb(8, refresh_frame_flags); |
1492 | |||
1493 |
3/4✓ Branch 0 taken 260 times.
✓ Branch 1 taken 1534 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 260 times.
|
3588 | if (!frame_is_intra || current->refresh_frame_flags != all_frames) { |
1494 |
1/2✓ Branch 0 taken 1534 times.
✗ Branch 1 not taken.
|
3068 | if (seq->enable_order_hint) { |
1495 |
2/2✓ Branch 0 taken 12272 times.
✓ Branch 1 taken 1534 times.
|
27612 | for (i = 0; i < AV1_NUM_REF_FRAMES; i++) { |
1496 |
2/2✓ Branch 0 taken 40 times.
✓ Branch 1 taken 12232 times.
|
24544 | if (current->error_resilient_mode) |
1497 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 40 times.
|
80 | fbs(order_hint_bits, ref_order_hint[i], 1, i); |
1498 | else | ||
1499 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2520 times.
|
24464 | infer(ref_order_hint[i], priv->ref[i].order_hint); |
1500 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12272 times.
|
24544 | if (current->ref_order_hint[i] != priv->ref[i].order_hint) |
1501 | ✗ | priv->ref[i].valid = 0; | |
1502 | } | ||
1503 | } | ||
1504 | } | ||
1505 | |||
1506 |
2/2✓ Branch 0 taken 1534 times.
✓ Branch 1 taken 260 times.
|
3588 | if (current->frame_type == AV1_FRAME_KEY || |
1507 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1534 times.
|
3068 | current->frame_type == AV1_FRAME_INTRA_ONLY) { |
1508 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 260 times.
|
520 | CHECK(FUNC(frame_size)(ctx, rw, current)); |
1509 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 260 times.
|
520 | CHECK(FUNC(render_size)(ctx, rw, current)); |
1510 | |||
1511 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 255 times.
|
520 | if (current->allow_screen_content_tools && |
1512 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
10 | priv->upscaled_width == priv->frame_width) |
1513 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
|
10 | flag(allow_intrabc); |
1514 | else | ||
1515 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
510 | infer(allow_intrabc, 0); |
1516 | |||
1517 | } else { | ||
1518 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1534 times.
|
3068 | if (!seq->enable_order_hint) { |
1519 | ✗ | infer(frame_refs_short_signaling, 0); | |
1520 | } else { | ||
1521 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1534 times.
|
3068 | flag(frame_refs_short_signaling); |
1522 |
2/2✓ Branch 0 taken 60 times.
✓ Branch 1 taken 1474 times.
|
3068 | if (current->frame_refs_short_signaling) { |
1523 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 60 times.
|
120 | fb(3, last_frame_idx); |
1524 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 60 times.
|
120 | fb(3, golden_frame_idx); |
1525 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 60 times.
|
120 | CHECK(FUNC(set_frame_refs)(ctx, rw, current)); |
1526 | } | ||
1527 | } | ||
1528 | |||
1529 |
2/2✓ Branch 0 taken 10738 times.
✓ Branch 1 taken 1534 times.
|
24544 | for (i = 0; i < AV1_REFS_PER_FRAME; i++) { |
1530 |
2/2✓ Branch 0 taken 10318 times.
✓ Branch 1 taken 420 times.
|
21476 | if (!current->frame_refs_short_signaling) |
1531 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 10318 times.
|
20636 | fbs(3, ref_frame_idx[i], 1, i); |
1532 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10738 times.
|
21476 | if (seq->frame_id_numbers_present_flag) { |
1533 | ✗ | fbs(seq->delta_frame_id_length_minus_2 + 2, | |
1534 | delta_frame_id_minus1[i], 1, i); | ||
1535 | } | ||
1536 | } | ||
1537 | |||
1538 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 1470 times.
|
3068 | if (current->frame_size_override_flag && |
1539 |
2/2✓ Branch 0 taken 59 times.
✓ Branch 1 taken 5 times.
|
128 | !current->error_resilient_mode) { |
1540 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 59 times.
|
118 | CHECK(FUNC(frame_size_with_refs)(ctx, rw, current)); |
1541 | } else { | ||
1542 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1475 times.
|
2950 | CHECK(FUNC(frame_size)(ctx, rw, current)); |
1543 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1475 times.
|
2950 | CHECK(FUNC(render_size)(ctx, rw, current)); |
1544 | } | ||
1545 | |||
1546 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1534 times.
|
3068 | if (current->force_integer_mv) |
1547 | ✗ | infer(allow_high_precision_mv, 0); | |
1548 | else | ||
1549 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1534 times.
|
3068 | flag(allow_high_precision_mv); |
1550 | |||
1551 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1534 times.
|
3068 | CHECK(FUNC(interpolation_filter)(ctx, rw, current)); |
1552 | |||
1553 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1534 times.
|
3068 | flag(is_motion_mode_switchable); |
1554 | |||
1555 |
2/2✓ Branch 0 taken 1529 times.
✓ Branch 1 taken 5 times.
|
3068 | if (current->error_resilient_mode || |
1556 |
2/2✓ Branch 0 taken 150 times.
✓ Branch 1 taken 1379 times.
|
3058 | !seq->enable_ref_frame_mvs) |
1557 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 31 times.
|
310 | infer(use_ref_frame_mvs, 0); |
1558 | else | ||
1559 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1379 times.
|
2758 | flag(use_ref_frame_mvs); |
1560 | |||
1561 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 316 times.
|
3068 | infer(allow_intrabc, 0); |
1562 | } | ||
1563 | |||
1564 | if (!frame_is_intra) { | ||
1565 | // Derive reference frame sign biases. | ||
1566 | } | ||
1567 | |||
1568 |
2/4✓ Branch 0 taken 1794 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1794 times.
|
3588 | if (seq->reduced_still_picture_header || current->disable_cdf_update) |
1569 | ✗ | infer(disable_frame_end_update_cdf, 1); | |
1570 | else | ||
1571 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | flag(disable_frame_end_update_cdf); |
1572 | |||
1573 | 3588 | if (current->primary_ref_frame == AV1_PRIMARY_REF_NONE) { | |
1574 | // Init non-coeff CDFs. | ||
1575 | // Setup past independence. | ||
1576 | } else { | ||
1577 | // Load CDF tables from previous frame. | ||
1578 | // Load params from previous frame. | ||
1579 | } | ||
1580 | |||
1581 | 3588 | if (current->use_ref_frame_mvs) { | |
1582 | // Perform motion field estimation process. | ||
1583 | } | ||
1584 | |||
1585 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | CHECK(FUNC(tile_info)(ctx, rw, current)); |
1586 | |||
1587 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | CHECK(FUNC(quantization_params)(ctx, rw, current)); |
1588 | |||
1589 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | CHECK(FUNC(segmentation_params)(ctx, rw, current)); |
1590 | |||
1591 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | CHECK(FUNC(delta_q_params)(ctx, rw, current)); |
1592 | |||
1593 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | CHECK(FUNC(delta_lf_params)(ctx, rw, current)); |
1594 | |||
1595 | // Init coeff CDFs / load previous segments. | ||
1596 | |||
1597 | 3588 | priv->coded_lossless = 1; | |
1598 |
2/2✓ Branch 0 taken 14352 times.
✓ Branch 1 taken 1794 times.
|
32292 | for (i = 0; i < AV1_MAX_SEGMENTS; i++) { |
1599 | int qindex; | ||
1600 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14352 times.
|
28704 | if (current->feature_enabled[i][AV1_SEG_LVL_ALT_Q]) { |
1601 | ✗ | qindex = (current->base_q_idx + | |
1602 | ✗ | current->feature_value[i][AV1_SEG_LVL_ALT_Q]); | |
1603 | } else { | ||
1604 | 28704 | qindex = current->base_q_idx; | |
1605 | } | ||
1606 | 28704 | qindex = av_clip_uintp2(qindex, 8); | |
1607 | |||
1608 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 14352 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
28704 | if (qindex || current->delta_q_y_dc || |
1609 | ✗ | current->delta_q_u_ac || current->delta_q_u_dc || | |
1610 | ✗ | current->delta_q_v_ac || current->delta_q_v_dc) { | |
1611 | 28704 | priv->coded_lossless = 0; | |
1612 | } | ||
1613 | } | ||
1614 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1794 times.
|
3588 | priv->all_lossless = priv->coded_lossless && |
1615 | ✗ | priv->frame_width == priv->upscaled_width; | |
1616 | |||
1617 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | CHECK(FUNC(loop_filter_params)(ctx, rw, current)); |
1618 | |||
1619 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | CHECK(FUNC(cdef_params)(ctx, rw, current)); |
1620 | |||
1621 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | CHECK(FUNC(lr_params)(ctx, rw, current)); |
1622 | |||
1623 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | CHECK(FUNC(read_tx_mode)(ctx, rw, current)); |
1624 | |||
1625 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | CHECK(FUNC(frame_reference_mode)(ctx, rw, current)); |
1626 | |||
1627 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | CHECK(FUNC(skip_mode_params)(ctx, rw, current)); |
1628 | |||
1629 |
4/4✓ Branch 0 taken 1534 times.
✓ Branch 1 taken 260 times.
✓ Branch 2 taken 1529 times.
✓ Branch 3 taken 5 times.
|
3588 | if (frame_is_intra || current->error_resilient_mode || |
1630 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1529 times.
|
3058 | !seq->enable_warped_motion) |
1631 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 59 times.
|
530 | infer(allow_warped_motion, 0); |
1632 | else | ||
1633 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1529 times.
|
3058 | flag(allow_warped_motion); |
1634 | |||
1635 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | flag(reduced_tx_set); |
1636 | |||
1637 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | CHECK(FUNC(global_motion_params)(ctx, rw, current)); |
1638 | |||
1639 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1794 times.
|
3588 | CHECK(FUNC(film_grain_params)(ctx, rw, ¤t->film_grain, current)); |
1640 | |||
1641 | 3588 | av_log(ctx->log_ctx, AV_LOG_DEBUG, "Frame %d: size %dx%d " | |
1642 | "upscaled %d render %dx%d subsample %dx%d " | ||
1643 | "bitdepth %d tiles %dx%d.\n", priv->order_hint, | ||
1644 | priv->frame_width, priv->frame_height, priv->upscaled_width, | ||
1645 | priv->render_width, priv->render_height, | ||
1646 | 3588 | seq->color_config.subsampling_x + 1, | |
1647 | 3588 | seq->color_config.subsampling_y + 1, priv->bit_depth, | |
1648 | priv->tile_rows, priv->tile_cols); | ||
1649 | |||
1650 | 4018 | update_refs: | |
1651 |
2/2✓ Branch 0 taken 16072 times.
✓ Branch 1 taken 2009 times.
|
36162 | for (i = 0; i < AV1_NUM_REF_FRAMES; i++) { |
1652 |
2/2✓ Branch 0 taken 3650 times.
✓ Branch 1 taken 12422 times.
|
32144 | if (current->refresh_frame_flags & (1 << i)) { |
1653 | 7300 | priv->ref[i] = (AV1ReferenceFrameState) { | |
1654 | .valid = 1, | ||
1655 | 7300 | .frame_id = current->current_frame_id, | |
1656 | 7300 | .upscaled_width = priv->upscaled_width, | |
1657 | 7300 | .frame_width = priv->frame_width, | |
1658 | 7300 | .frame_height = priv->frame_height, | |
1659 | 7300 | .render_width = priv->render_width, | |
1660 | 7300 | .render_height = priv->render_height, | |
1661 | 7300 | .frame_type = current->frame_type, | |
1662 | 7300 | .subsampling_x = seq->color_config.subsampling_x, | |
1663 | 7300 | .subsampling_y = seq->color_config.subsampling_y, | |
1664 | 7300 | .bit_depth = priv->bit_depth, | |
1665 | 7300 | .order_hint = priv->order_hint, | |
1666 | }; | ||
1667 | 7300 | memcpy(priv->ref[i].loop_filter_ref_deltas, current->loop_filter_ref_deltas, | |
1668 | sizeof(current->loop_filter_ref_deltas)); | ||
1669 | 7300 | memcpy(priv->ref[i].loop_filter_mode_deltas, current->loop_filter_mode_deltas, | |
1670 | sizeof(current->loop_filter_mode_deltas)); | ||
1671 | 7300 | memcpy(priv->ref[i].feature_enabled, current->feature_enabled, | |
1672 | sizeof(current->feature_enabled)); | ||
1673 | 7300 | memcpy(priv->ref[i].feature_value, current->feature_value, | |
1674 | sizeof(current->feature_value)); | ||
1675 | } | ||
1676 | } | ||
1677 | |||
1678 | 4018 | return 0; | |
1679 | } | ||
1680 | |||
1681 | 4018 | static int FUNC(frame_header_obu)(CodedBitstreamContext *ctx, RWContext *rw, | |
1682 | AV1RawFrameHeader *current, int redundant, | ||
1683 | AVBufferRef *rw_buffer_ref) | ||
1684 | { | ||
1685 | 4018 | CodedBitstreamAV1Context *priv = ctx->priv_data; | |
1686 | int start_pos, fh_bits, fh_bytes, err; | ||
1687 | uint8_t *fh_start; | ||
1688 | |||
1689 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2009 times.
|
4018 | if (priv->seen_frame_header) { |
1690 | ✗ | if (!redundant) { | |
1691 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid repeated " | |
1692 | "frame header OBU.\n"); | ||
1693 | ✗ | return AVERROR_INVALIDDATA; | |
1694 | } else { | ||
1695 | GetBitContext fh; | ||
1696 | size_t i, b; | ||
1697 | uint32_t val; | ||
1698 | |||
1699 | ✗ | HEADER("Redundant Frame Header"); | |
1700 | |||
1701 | ✗ | av_assert0(priv->frame_header_ref && priv->frame_header); | |
1702 | |||
1703 | ✗ | init_get_bits(&fh, priv->frame_header, | |
1704 | ✗ | priv->frame_header_size); | |
1705 | ✗ | for (i = 0; i < priv->frame_header_size; i += 8) { | |
1706 | ✗ | b = FFMIN(priv->frame_header_size - i, 8); | |
1707 | ✗ | val = get_bits(&fh, b); | |
1708 | ✗ | xf(b, frame_header_copy[i], | |
1709 | val, val, val, 1, i / 8); | ||
1710 | } | ||
1711 | } | ||
1712 | } else { | ||
1713 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2009 times.
|
4018 | if (redundant) |
1714 | ✗ | HEADER("Redundant Frame Header (used as Frame Header)"); | |
1715 | else | ||
1716 | 4018 | HEADER("Frame Header"); | |
1717 | |||
1718 | #ifdef READ | ||
1719 | 3176 | start_pos = get_bits_count(rw); | |
1720 | #else | ||
1721 | 842 | start_pos = put_bits_count(rw); | |
1722 | #endif | ||
1723 | |||
1724 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2009 times.
|
4018 | CHECK(FUNC(uncompressed_header)(ctx, rw, current)); |
1725 | |||
1726 | 4018 | priv->tile_num = 0; | |
1727 | |||
1728 |
2/2✓ Branch 0 taken 215 times.
✓ Branch 1 taken 1794 times.
|
4018 | if (current->show_existing_frame) { |
1729 | 430 | priv->seen_frame_header = 0; | |
1730 | } else { | ||
1731 | 3588 | priv->seen_frame_header = 1; | |
1732 | |||
1733 | 3588 | av_buffer_unref(&priv->frame_header_ref); | |
1734 | |||
1735 | #ifdef READ | ||
1736 | 2840 | fh_bits = get_bits_count(rw) - start_pos; | |
1737 | 2840 | fh_start = (uint8_t*)rw->buffer + start_pos / 8; | |
1738 | #else | ||
1739 | // Need to flush the bitwriter so that we can copy its output, | ||
1740 | // but use a copy so we don't affect the caller's structure. | ||
1741 | { | ||
1742 | 748 | PutBitContext tmp = *rw; | |
1743 | 748 | flush_put_bits(&tmp); | |
1744 | } | ||
1745 | |||
1746 | 748 | fh_bits = put_bits_count(rw) - start_pos; | |
1747 | 748 | fh_start = rw->buf + start_pos / 8; | |
1748 | #endif | ||
1749 | 3588 | fh_bytes = (fh_bits + 7) / 8; | |
1750 | |||
1751 | 3588 | priv->frame_header_size = fh_bits; | |
1752 | |||
1753 |
2/2✓ Branch 0 taken 1420 times.
✓ Branch 1 taken 374 times.
|
3588 | if (rw_buffer_ref) { |
1754 | 2840 | priv->frame_header_ref = av_buffer_ref(rw_buffer_ref); | |
1755 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1420 times.
|
2840 | if (!priv->frame_header_ref) |
1756 | ✗ | return AVERROR(ENOMEM); | |
1757 | 2840 | priv->frame_header = fh_start; | |
1758 | } else { | ||
1759 | 748 | priv->frame_header_ref = | |
1760 | 748 | av_buffer_alloc(fh_bytes + AV_INPUT_BUFFER_PADDING_SIZE); | |
1761 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 374 times.
|
748 | if (!priv->frame_header_ref) |
1762 | ✗ | return AVERROR(ENOMEM); | |
1763 | 748 | priv->frame_header = priv->frame_header_ref->data; | |
1764 | 748 | memcpy(priv->frame_header, fh_start, fh_bytes); | |
1765 | } | ||
1766 | } | ||
1767 | } | ||
1768 | |||
1769 | 4018 | return 0; | |
1770 | } | ||
1771 | |||
1772 | 4132 | static int FUNC(tile_group_obu)(CodedBitstreamContext *ctx, RWContext *rw, | |
1773 | AV1RawTileGroup *current) | ||
1774 | { | ||
1775 | 4132 | CodedBitstreamAV1Context *priv = ctx->priv_data; | |
1776 | int num_tiles, tile_bits; | ||
1777 | int err; | ||
1778 | |||
1779 | 4132 | HEADER("Tile Group"); | |
1780 | |||
1781 | 4132 | num_tiles = priv->tile_cols * priv->tile_rows; | |
1782 |
2/2✓ Branch 0 taken 617 times.
✓ Branch 1 taken 1449 times.
|
4132 | if (num_tiles > 1) |
1783 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 617 times.
|
1234 | flag(tile_start_and_end_present_flag); |
1784 | else | ||
1785 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 297 times.
|
2898 | infer(tile_start_and_end_present_flag, 0); |
1786 | |||
1787 |
4/4✓ Branch 0 taken 617 times.
✓ Branch 1 taken 1449 times.
✓ Branch 2 taken 177 times.
✓ Branch 3 taken 440 times.
|
4132 | if (num_tiles == 1 || !current->tile_start_and_end_present_flag) { |
1788 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 334 times.
|
3252 | infer(tg_start, 0); |
1789 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 334 times.
|
3252 | infer(tg_end, num_tiles - 1); |
1790 | } else { | ||
1791 | 880 | tile_bits = cbs_av1_tile_log2(1, priv->tile_cols) + | |
1792 | 880 | cbs_av1_tile_log2(1, priv->tile_rows); | |
1793 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 440 times.
|
880 | fc(tile_bits, tg_start, priv->tile_num, num_tiles - 1); |
1794 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 440 times.
|
880 | fc(tile_bits, tg_end, current->tg_start, num_tiles - 1); |
1795 | } | ||
1796 | |||
1797 | 4132 | priv->tile_num = current->tg_end + 1; | |
1798 | |||
1799 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2066 times.
|
4132 | CHECK(FUNC(byte_alignment)(ctx, rw)); |
1800 | |||
1801 | // Reset header for next frame. | ||
1802 |
2/2✓ Branch 0 taken 1794 times.
✓ Branch 1 taken 272 times.
|
4132 | if (current->tg_end == num_tiles - 1) |
1803 | 3588 | priv->seen_frame_header = 0; | |
1804 | |||
1805 | // Tile data follows. | ||
1806 | |||
1807 | 4132 | return 0; | |
1808 | } | ||
1809 | |||
1810 | 3252 | static int FUNC(frame_obu)(CodedBitstreamContext *ctx, RWContext *rw, | |
1811 | AV1RawFrame *current, | ||
1812 | AVBufferRef *rw_buffer_ref) | ||
1813 | { | ||
1814 | int err; | ||
1815 | |||
1816 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1626 times.
|
3252 | CHECK(FUNC(frame_header_obu)(ctx, rw, ¤t->header, |
1817 | 0, rw_buffer_ref)); | ||
1818 | |||
1819 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1626 times.
|
3252 | CHECK(FUNC(byte_alignment)(ctx, rw)); |
1820 | |||
1821 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1626 times.
|
3252 | CHECK(FUNC(tile_group_obu)(ctx, rw, ¤t->tile_group)); |
1822 | |||
1823 | 3252 | return 0; | |
1824 | } | ||
1825 | |||
1826 | ✗ | static int FUNC(tile_list_obu)(CodedBitstreamContext *ctx, RWContext *rw, | |
1827 | AV1RawTileList *current) | ||
1828 | { | ||
1829 | int err; | ||
1830 | |||
1831 | ✗ | fb(8, output_frame_width_in_tiles_minus_1); | |
1832 | ✗ | fb(8, output_frame_height_in_tiles_minus_1); | |
1833 | |||
1834 | ✗ | fb(16, tile_count_minus_1); | |
1835 | |||
1836 | // Tile data follows. | ||
1837 | |||
1838 | ✗ | return 0; | |
1839 | } | ||
1840 | |||
1841 | 32 | static int FUNC(metadata_hdr_cll)(CodedBitstreamContext *ctx, RWContext *rw, | |
1842 | AV1RawMetadataHDRCLL *current) | ||
1843 | { | ||
1844 | int err; | ||
1845 | |||
1846 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
|
32 | fb(16, max_cll); |
1847 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
|
32 | fb(16, max_fall); |
1848 | |||
1849 | 32 | return 0; | |
1850 | } | ||
1851 | |||
1852 | 32 | static int FUNC(metadata_hdr_mdcv)(CodedBitstreamContext *ctx, RWContext *rw, | |
1853 | AV1RawMetadataHDRMDCV *current) | ||
1854 | { | ||
1855 | int err, i; | ||
1856 | |||
1857 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 16 times.
|
128 | for (i = 0; i < 3; i++) { |
1858 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 48 times.
|
96 | fbs(16, primary_chromaticity_x[i], 1, i); |
1859 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 48 times.
|
96 | fbs(16, primary_chromaticity_y[i], 1, i); |
1860 | } | ||
1861 | |||
1862 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
|
32 | fb(16, white_point_chromaticity_x); |
1863 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
|
32 | fb(16, white_point_chromaticity_y); |
1864 | |||
1865 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
|
32 | fb(32, luminance_max); |
1866 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
|
32 | fb(32, luminance_min); |
1867 | |||
1868 | 32 | return 0; | |
1869 | } | ||
1870 | |||
1871 | ✗ | static int FUNC(scalability_structure)(CodedBitstreamContext *ctx, RWContext *rw, | |
1872 | AV1RawMetadataScalability *current) | ||
1873 | { | ||
1874 | ✗ | CodedBitstreamAV1Context *priv = ctx->priv_data; | |
1875 | const AV1RawSequenceHeader *seq; | ||
1876 | int err, i, j; | ||
1877 | |||
1878 | ✗ | if (!priv->sequence_header) { | |
1879 | ✗ | av_log(ctx->log_ctx, AV_LOG_ERROR, "No sequence header available: " | |
1880 | "unable to parse scalability metadata.\n"); | ||
1881 | ✗ | return AVERROR_INVALIDDATA; | |
1882 | } | ||
1883 | ✗ | seq = priv->sequence_header; | |
1884 | |||
1885 | ✗ | fb(2, spatial_layers_cnt_minus_1); | |
1886 | ✗ | flag(spatial_layer_dimensions_present_flag); | |
1887 | ✗ | flag(spatial_layer_description_present_flag); | |
1888 | ✗ | flag(temporal_group_description_present_flag); | |
1889 | ✗ | fc(3, scalability_structure_reserved_3bits, 0, 0); | |
1890 | ✗ | if (current->spatial_layer_dimensions_present_flag) { | |
1891 | ✗ | for (i = 0; i <= current->spatial_layers_cnt_minus_1; i++) { | |
1892 | ✗ | fcs(16, spatial_layer_max_width[i], | |
1893 | 0, seq->max_frame_width_minus_1 + 1, 1, i); | ||
1894 | ✗ | fcs(16, spatial_layer_max_height[i], | |
1895 | 0, seq->max_frame_height_minus_1 + 1, 1, i); | ||
1896 | } | ||
1897 | } | ||
1898 | ✗ | if (current->spatial_layer_description_present_flag) { | |
1899 | ✗ | for (i = 0; i <= current->spatial_layers_cnt_minus_1; i++) | |
1900 | ✗ | fbs(8, spatial_layer_ref_id[i], 1, i); | |
1901 | } | ||
1902 | ✗ | if (current->temporal_group_description_present_flag) { | |
1903 | ✗ | fb(8, temporal_group_size); | |
1904 | ✗ | for (i = 0; i < current->temporal_group_size; i++) { | |
1905 | ✗ | fbs(3, temporal_group_temporal_id[i], 1, i); | |
1906 | ✗ | flags(temporal_group_temporal_switching_up_point_flag[i], 1, i); | |
1907 | ✗ | flags(temporal_group_spatial_switching_up_point_flag[i], 1, i); | |
1908 | ✗ | fbs(3, temporal_group_ref_cnt[i], 1, i); | |
1909 | ✗ | for (j = 0; j < current->temporal_group_ref_cnt[i]; j++) { | |
1910 | ✗ | fbs(8, temporal_group_ref_pic_diff[i][j], 2, i, j); | |
1911 | } | ||
1912 | } | ||
1913 | } | ||
1914 | |||
1915 | ✗ | return 0; | |
1916 | } | ||
1917 | |||
1918 | ✗ | static int FUNC(metadata_scalability)(CodedBitstreamContext *ctx, RWContext *rw, | |
1919 | AV1RawMetadataScalability *current) | ||
1920 | { | ||
1921 | int err; | ||
1922 | |||
1923 | ✗ | fb(8, scalability_mode_idc); | |
1924 | |||
1925 | ✗ | if (current->scalability_mode_idc == AV1_SCALABILITY_SS) | |
1926 | ✗ | CHECK(FUNC(scalability_structure)(ctx, rw, current)); | |
1927 | |||
1928 | ✗ | return 0; | |
1929 | } | ||
1930 | |||
1931 | ✗ | static int FUNC(metadata_itut_t35)(CodedBitstreamContext *ctx, RWContext *rw, | |
1932 | AV1RawMetadataITUTT35 *current) | ||
1933 | { | ||
1934 | int err; | ||
1935 | size_t i; | ||
1936 | |||
1937 | ✗ | fb(8, itu_t_t35_country_code); | |
1938 | ✗ | if (current->itu_t_t35_country_code == 0xff) | |
1939 | ✗ | fb(8, itu_t_t35_country_code_extension_byte); | |
1940 | |||
1941 | #ifdef READ | ||
1942 | // The payload runs up to the start of the trailing bits, but there might | ||
1943 | // be arbitrarily many trailing zeroes so we need to read through twice. | ||
1944 | ✗ | current->payload_size = cbs_av1_get_payload_bytes_left(rw); | |
1945 | |||
1946 | ✗ | current->payload_ref = av_buffer_alloc(current->payload_size); | |
1947 | ✗ | if (!current->payload_ref) | |
1948 | ✗ | return AVERROR(ENOMEM); | |
1949 | ✗ | current->payload = current->payload_ref->data; | |
1950 | #endif | ||
1951 | |||
1952 | ✗ | for (i = 0; i < current->payload_size; i++) | |
1953 | ✗ | xf(8, itu_t_t35_payload_bytes[i], current->payload[i], | |
1954 | 0x00, 0xff, 1, i); | ||
1955 | |||
1956 | ✗ | return 0; | |
1957 | } | ||
1958 | |||
1959 | ✗ | static int FUNC(metadata_timecode)(CodedBitstreamContext *ctx, RWContext *rw, | |
1960 | AV1RawMetadataTimecode *current) | ||
1961 | { | ||
1962 | int err; | ||
1963 | |||
1964 | ✗ | fb(5, counting_type); | |
1965 | ✗ | flag(full_timestamp_flag); | |
1966 | ✗ | flag(discontinuity_flag); | |
1967 | ✗ | flag(cnt_dropped_flag); | |
1968 | ✗ | fb(9, n_frames); | |
1969 | |||
1970 | ✗ | if (current->full_timestamp_flag) |