FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/cbs_vp9_syntax_template.c
Date: 2025-08-19 23:55:23
Exec Total Coverage
Lines: 250 257 97.3%
Functions: 26 26 100.0%
Branches: 205 332 61.7%

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 1026 static int FUNC(frame_sync_code)(CodedBitstreamContext *ctx, RWContext *rw,
20 VP9RawFrameHeader *current)
21 {
22 int err;
23
24
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 513 times.
1026 fixed(8, frame_sync_byte_0, VP9_FRAME_SYNC_0);
25
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 513 times.
1026 fixed(8, frame_sync_byte_1, VP9_FRAME_SYNC_1);
26
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 513 times.
1026 fixed(8, frame_sync_byte_2, VP9_FRAME_SYNC_2);
27
28 1026 return 0;
29 }
30
31 1014 static int FUNC(color_config)(CodedBitstreamContext *ctx, RWContext *rw,
32 VP9RawFrameHeader *current, int profile)
33 {
34 1014 CodedBitstreamVP9Context *vp9 = ctx->priv_data;
35 int err;
36
37
2/2
✓ Branch 0 taken 32 times.
✓ Branch 1 taken 475 times.
1014 if (profile >= 2) {
38
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 32 times.
64 f(1, ten_or_twelve_bit);
39
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 20 times.
64 vp9->bit_depth = current->ten_or_twelve_bit ? 12 : 10;
40 } else
41 950 vp9->bit_depth = 8;
42
43
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 507 times.
1014 f(3, color_space);
44
45
1/2
✓ Branch 0 taken 507 times.
✗ Branch 1 not taken.
1014 if (current->color_space != VP9_CS_RGB) {
46
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 507 times.
1014 f(1, color_range);
47
4/4
✓ Branch 0 taken 495 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 19 times.
✓ Branch 3 taken 476 times.
1014 if (profile == 1 || profile == 3) {
48
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 31 times.
62 f(1, subsampling_x);
49
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 31 times.
62 f(1, subsampling_y);
50
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 31 times.
62 fixed(1, reserved_zero, 0);
51 } else {
52
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
952 infer(subsampling_x, 1);
53
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
952 infer(subsampling_y, 1);
54 }
55 } else {
56 infer(color_range, 1);
57 if (profile == 1 || profile == 3) {
58 infer(subsampling_x, 0);
59 infer(subsampling_y, 0);
60 fixed(1, reserved_zero, 0);
61 }
62 }
63
64 1014 vp9->subsampling_x = current->subsampling_x;
65 1014 vp9->subsampling_y = current->subsampling_y;
66
67 1014 return 0;
68 }
69
70 1032 static int FUNC(frame_size)(CodedBitstreamContext *ctx, RWContext *rw,
71 VP9RawFrameHeader *current)
72 {
73 1032 CodedBitstreamVP9Context *vp9 = ctx->priv_data;
74 int err;
75
76
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 516 times.
1032 f(16, frame_width_minus_1);
77
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 516 times.
1032 f(16, frame_height_minus_1);
78
79 1032 vp9->frame_width = current->frame_width_minus_1 + 1;
80 1032 vp9->frame_height = current->frame_height_minus_1 + 1;
81
82 1032 vp9->mi_cols = (vp9->frame_width + 7) >> 3;
83 1032 vp9->mi_rows = (vp9->frame_height + 7) >> 3;
84 1032 vp9->sb64_cols = (vp9->mi_cols + 7) >> 3;
85 1032 vp9->sb64_rows = (vp9->mi_rows + 7) >> 3;
86
87 1032 return 0;
88 }
89
90 5324 static int FUNC(render_size)(CodedBitstreamContext *ctx, RWContext *rw,
91 VP9RawFrameHeader *current)
92 {
93 int err;
94
95
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2662 times.
5324 f(1, render_and_frame_size_different);
96
97
2/2
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 2653 times.
5324 if (current->render_and_frame_size_different) {
98
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
18 f(16, render_width_minus_1);
99
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
18 f(16, render_height_minus_1);
100 }
101
102 5324 return 0;
103 }
104
105 4298 static int FUNC(frame_size_with_refs)(CodedBitstreamContext *ctx, RWContext *rw,
106 VP9RawFrameHeader *current)
107 {
108 4298 CodedBitstreamVP9Context *vp9 = ctx->priv_data;
109 int err, i;
110
111
2/2
✓ Branch 0 taken 2158 times.
✓ Branch 1 taken 3 times.
4322 for (i = 0; i < VP9_REFS_PER_FRAME; i++) {
112
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2158 times.
4316 fs(1, found_ref[i], 1, i);
113
2/2
✓ Branch 0 taken 2146 times.
✓ Branch 1 taken 12 times.
4316 if (current->found_ref[i]) {
114 4292 VP9ReferenceFrameState *ref =
115 4292 &vp9->ref[current->ref_frame_idx[i]];
116
117 4292 vp9->frame_width = ref->frame_width;
118 4292 vp9->frame_height = ref->frame_height;
119
120 4292 vp9->subsampling_x = ref->subsampling_x;
121 4292 vp9->subsampling_y = ref->subsampling_y;
122 4292 vp9->bit_depth = ref->bit_depth;
123
124 4292 break;
125 }
126 }
127
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 2146 times.
4298 if (i >= VP9_REFS_PER_FRAME)
128
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
6 CHECK(FUNC(frame_size)(ctx, rw, current));
129 else {
130 4292 vp9->mi_cols = (vp9->frame_width + 7) >> 3;
131 4292 vp9->mi_rows = (vp9->frame_height + 7) >> 3;
132 4292 vp9->sb64_cols = (vp9->mi_cols + 7) >> 3;
133 4292 vp9->sb64_rows = (vp9->mi_rows + 7) >> 3;
134 }
135
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2149 times.
4298 CHECK(FUNC(render_size)(ctx, rw, current));
136
137 4298 return 0;
138 }
139
140 4298 static int FUNC(interpolation_filter)(CodedBitstreamContext *ctx, RWContext *rw,
141 VP9RawFrameHeader *current)
142 {
143 int err;
144
145
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2149 times.
4298 f(1, is_filter_switchable);
146
2/2
✓ Branch 0 taken 654 times.
✓ Branch 1 taken 1495 times.
4298 if (!current->is_filter_switchable)
147
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 654 times.
1308 f(2, raw_interpolation_filter_type);
148
149 4298 return 0;
150 }
151
152 5324 static int FUNC(loop_filter_params)(CodedBitstreamContext *ctx, RWContext *rw,
153 VP9RawFrameHeader *current)
154 {
155 int err, i;
156
157
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2662 times.
5324 f(6, loop_filter_level);
158
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2662 times.
5324 f(3, loop_filter_sharpness);
159
160
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2662 times.
5324 f(1, loop_filter_delta_enabled);
161
2/2
✓ Branch 0 taken 2617 times.
✓ Branch 1 taken 45 times.
5324 if (current->loop_filter_delta_enabled) {
162
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2617 times.
5234 f(1, loop_filter_delta_update);
163
2/2
✓ Branch 0 taken 564 times.
✓ Branch 1 taken 2053 times.
5234 if (current->loop_filter_delta_update) {
164
2/2
✓ Branch 0 taken 2256 times.
✓ Branch 1 taken 564 times.
5640 for (i = 0; i < VP9_MAX_REF_FRAMES; i++) {
165
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2256 times.
4512 fs(1, update_ref_delta[i], 1, i);
166
2/2
✓ Branch 0 taken 1575 times.
✓ Branch 1 taken 681 times.
4512 if (current->update_ref_delta[i])
167
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1575 times.
3150 ss(6, loop_filter_ref_deltas[i], 1, i);
168 }
169
2/2
✓ Branch 0 taken 1128 times.
✓ Branch 1 taken 564 times.
3384 for (i = 0; i < 2; i++) {
170
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1128 times.
2256 fs(1, update_mode_delta[i], 1, i);
171
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 1122 times.
2256 if (current->update_mode_delta[i])
172
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
12 ss(6, loop_filter_mode_deltas[i], 1, i);
173 }
174 }
175 } else {
176
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 15 times.
90 infer(loop_filter_delta_update, 0);
177 }
178
179 5324 return 0;
180 }
181
182 5324 static int FUNC(quantization_params)(CodedBitstreamContext *ctx, RWContext *rw,
183 VP9RawFrameHeader *current)
184 {
185 int err;
186
187
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2662 times.
5324 f(8, base_q_idx);
188
189
4/6
✗ Branch 1 not taken.
✓ Branch 2 taken 2662 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 2657 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 5 times.
5324 delta_q(delta_q_y_dc);
190
4/6
✗ Branch 1 not taken.
✓ Branch 2 taken 2662 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 2657 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 5 times.
5324 delta_q(delta_q_uv_dc);
191
4/6
✗ Branch 1 not taken.
✓ Branch 2 taken 2662 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 2657 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 5 times.
5324 delta_q(delta_q_uv_ac);
192
193 5324 return 0;
194 }
195
196 5324 static int FUNC(segmentation_params)(CodedBitstreamContext *ctx, RWContext *rw,
197 VP9RawFrameHeader *current)
198 {
199 static const uint8_t segmentation_feature_bits[VP9_SEG_LVL_MAX] = { 8, 6, 2, 0 };
200 static const uint8_t segmentation_feature_signed[VP9_SEG_LVL_MAX] = { 1, 1, 0, 0 };
201 int err, i, j;
202
203
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2662 times.
5324 f(1, segmentation_enabled);
204
205
2/2
✓ Branch 0 taken 322 times.
✓ Branch 1 taken 2340 times.
5324 if (current->segmentation_enabled) {
206
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 322 times.
644 f(1, segmentation_update_map);
207
2/2
✓ Branch 0 taken 122 times.
✓ Branch 1 taken 200 times.
644 if (current->segmentation_update_map) {
208
2/2
✓ Branch 0 taken 854 times.
✓ Branch 1 taken 122 times.
1952 for (i = 0; i < 7; i++)
209
4/6
✗ Branch 1 not taken.
✓ Branch 2 taken 854 times.
✓ Branch 3 taken 611 times.
✓ Branch 4 taken 243 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 611 times.
1708 prob(segmentation_tree_probs[i], 1, i);
210
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 122 times.
244 f(1, segmentation_temporal_update);
211
2/2
✓ Branch 0 taken 366 times.
✓ Branch 1 taken 122 times.
976 for (i = 0; i < 3; i++) {
212
2/2
✓ Branch 0 taken 336 times.
✓ Branch 1 taken 30 times.
732 if (current->segmentation_temporal_update)
213
3/6
✗ Branch 1 not taken.
✓ Branch 2 taken 336 times.
✓ Branch 3 taken 336 times.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 336 times.
672 prob(segmentation_pred_prob[i], 1, i);
214 else
215
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
60 infer(segmentation_pred_prob[i], 255);
216 }
217 }
218
219
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 322 times.
644 f(1, segmentation_update_data);
220
2/2
✓ Branch 0 taken 128 times.
✓ Branch 1 taken 194 times.
644 if (current->segmentation_update_data) {
221
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 128 times.
256 f(1, segmentation_abs_or_delta_update);
222
2/2
✓ Branch 0 taken 1024 times.
✓ Branch 1 taken 128 times.
2304 for (i = 0; i < VP9_MAX_SEGMENTS; i++) {
223
2/2
✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 1024 times.
10240 for (j = 0; j < VP9_SEG_LVL_MAX; j++) {
224
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 4096 times.
8192 fs(1, feature_enabled[i][j], 2, i, j);
225
2/2
✓ Branch 0 taken 594 times.
✓ Branch 1 taken 3502 times.
8192 if (current->feature_enabled[i][j] &&
226
2/2
✓ Branch 0 taken 585 times.
✓ Branch 1 taken 9 times.
1188 segmentation_feature_bits[j]) {
227
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 585 times.
1170 fs(segmentation_feature_bits[j],
228 feature_value[i][j], 2, i, j);
229
2/2
✓ Branch 0 taken 576 times.
✓ Branch 1 taken 9 times.
1170 if (segmentation_feature_signed[j])
230
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 576 times.
1152 fs(1, feature_sign[i][j], 2, i, j);
231 else
232
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
18 infer(feature_sign[i][j], 0);
233 } else {
234
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 763 times.
7022 infer(feature_value[i][j], 0);
235
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 763 times.
7022 infer(feature_sign[i][j], 0);
236 }
237 }
238 }
239 }
240 } else {
241
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 138 times.
4680 infer(segmentation_update_data, 0);
242 }
243
244 5324 return 0;
245 }
246
247 5324 static int FUNC(tile_info)(CodedBitstreamContext *ctx, RWContext *rw,
248 VP9RawFrameHeader *current)
249 {
250 5324 CodedBitstreamVP9Context *vp9 = ctx->priv_data;
251 int min_log2_tile_cols, max_log2_tile_cols;
252 int err;
253
254 5324 min_log2_tile_cols = 0;
255
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2662 times.
5324 while ((VP9_MAX_TILE_WIDTH_B64 << min_log2_tile_cols) < vp9->sb64_cols)
256 ++min_log2_tile_cols;
257 5324 max_log2_tile_cols = 0;
258
2/2
✓ Branch 0 taken 227 times.
✓ Branch 1 taken 2662 times.
5778 while ((vp9->sb64_cols >> (max_log2_tile_cols + 1)) >= VP9_MIN_TILE_WIDTH_B64)
259 454 ++max_log2_tile_cols;
260
261
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2662 times.
5324 increment(tile_cols_log2, min_log2_tile_cols, max_log2_tile_cols);
262
263
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2662 times.
5324 increment(tile_rows_log2, 0, 2);
264
265 5324 return 0;
266 }
267
268 5426 static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw,
269 VP9RawFrameHeader *current)
270 {
271 5426 CodedBitstreamVP9Context *vp9 = ctx->priv_data;
272 int err, i;
273
274
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2713 times.
5426 f(2, frame_marker);
275
276
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2713 times.
5426 f(1, profile_low_bit);
277
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2713 times.
5426 f(1, profile_high_bit);
278 5426 vp9->profile = (current->profile_high_bit << 1) + current->profile_low_bit;
279
2/2
✓ Branch 0 taken 156 times.
✓ Branch 1 taken 2557 times.
5426 if (vp9->profile == 3)
280
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 156 times.
312 fixed(1, reserved_zero, 0);
281
282
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2713 times.
5426 f(1, show_existing_frame);
283
2/2
✓ Branch 0 taken 51 times.
✓ Branch 1 taken 2662 times.
5426 if (current->show_existing_frame) {
284
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 51 times.
102 f(3, frame_to_show_map_idx);
285
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
102 infer(header_size_in_bytes, 0);
286
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
102 infer(refresh_frame_flags, 0x00);
287
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
102 infer(loop_filter_level, 0);
288 102 return 0;
289 }
290
291
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2662 times.
5324 f(1, frame_type);
292
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2662 times.
5324 f(1, show_frame);
293
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2662 times.
5324 f(1, error_resilient_mode);
294
295
2/2
✓ Branch 0 taken 507 times.
✓ Branch 1 taken 2155 times.
5324 if (current->frame_type == VP9_KEY_FRAME) {
296
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 507 times.
1014 CHECK(FUNC(frame_sync_code)(ctx, rw, current));
297
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 507 times.
1014 CHECK(FUNC(color_config)(ctx, rw, current, vp9->profile));
298
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 507 times.
1014 CHECK(FUNC(frame_size)(ctx, rw, current));
299
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 507 times.
1014 CHECK(FUNC(render_size)(ctx, rw, current));
300
301
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
1014 infer(refresh_frame_flags, 0xff);
302
303 } else {
304
2/2
✓ Branch 0 taken 93 times.
✓ Branch 1 taken 2062 times.
4310 if (current->show_frame == 0)
305
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 93 times.
186 f(1, intra_only);
306 else
307
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 153 times.
4124 infer(intra_only, 0);
308
309
2/2
✓ Branch 0 taken 2146 times.
✓ Branch 1 taken 9 times.
4310 if (current->error_resilient_mode == 0)
310
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2146 times.
4292 f(2, reset_frame_context);
311 else
312
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
18 infer(reset_frame_context, 0);
313
314
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 2149 times.
4310 if (current->intra_only == 1) {
315
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
12 CHECK(FUNC(frame_sync_code)(ctx, rw, current));
316
317
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
12 if (vp9->profile > 0) {
318 CHECK(FUNC(color_config)(ctx, rw, current, vp9->profile));
319 } else {
320
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
12 infer(color_space, 1);
321
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
12 infer(subsampling_x, 1);
322
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
12 infer(subsampling_y, 1);
323 12 vp9->bit_depth = 8;
324
325 12 vp9->subsampling_x = current->subsampling_x;
326 12 vp9->subsampling_y = current->subsampling_y;
327 }
328
329
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
12 f(8, refresh_frame_flags);
330
331
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
12 CHECK(FUNC(frame_size)(ctx, rw, current));
332
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
12 CHECK(FUNC(render_size)(ctx, rw, current));
333 } else {
334
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2149 times.
4298 f(8, refresh_frame_flags);
335
336
2/2
✓ Branch 0 taken 6447 times.
✓ Branch 1 taken 2149 times.
17192 for (i = 0; i < VP9_REFS_PER_FRAME; i++) {
337
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6447 times.
12894 fs(3, ref_frame_idx[i], 1, i);
338
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6447 times.
12894 fs(1, ref_frame_sign_bias[VP9_LAST_FRAME + i],
339 1, VP9_LAST_FRAME + i);
340 }
341
342
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2149 times.
4298 CHECK(FUNC(frame_size_with_refs)(ctx, rw, current));
343
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2149 times.
4298 f(1, allow_high_precision_mv);
344
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2149 times.
4298 CHECK(FUNC(interpolation_filter)(ctx, rw, current));
345 }
346 }
347
348
2/2
✓ Branch 0 taken 2651 times.
✓ Branch 1 taken 11 times.
5324 if (current->error_resilient_mode == 0) {
349
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2651 times.
5302 f(1, refresh_frame_context);
350
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2651 times.
5302 f(1, frame_parallel_decoding_mode);
351 } else {
352
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
22 infer(refresh_frame_context, 0);
353
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
22 infer(frame_parallel_decoding_mode, 1);
354 }
355
356
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2662 times.
5324 f(2, frame_context_idx);
357
358
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2662 times.
5324 CHECK(FUNC(loop_filter_params)(ctx, rw, current));
359
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2662 times.
5324 CHECK(FUNC(quantization_params)(ctx, rw, current));
360
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2662 times.
5324 CHECK(FUNC(segmentation_params)(ctx, rw, current));
361
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2662 times.
5324 CHECK(FUNC(tile_info)(ctx, rw, current));
362
363
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2662 times.
5324 f(16, header_size_in_bytes);
364
365
2/2
✓ Branch 0 taken 21296 times.
✓ Branch 1 taken 2662 times.
47916 for (i = 0; i < VP9_NUM_REF_FRAMES; i++) {
366
2/2
✓ Branch 0 taken 6256 times.
✓ Branch 1 taken 15040 times.
42592 if (current->refresh_frame_flags & (1 << i)) {
367 12512 vp9->ref[i] = (VP9ReferenceFrameState) {
368 12512 .frame_width = vp9->frame_width,
369 12512 .frame_height = vp9->frame_height,
370 12512 .subsampling_x = vp9->subsampling_x,
371 12512 .subsampling_y = vp9->subsampling_y,
372 12512 .bit_depth = vp9->bit_depth,
373 };
374 }
375 }
376
377 // Update top-level loop filter and segmentation state with changes
378 // from this frame.
379
2/2
✓ Branch 0 taken 2155 times.
✓ Branch 1 taken 507 times.
5324 if (current->frame_type == VP9_KEY_FRAME ||
380
2/2
✓ Branch 0 taken 2149 times.
✓ Branch 1 taken 6 times.
4310 current->intra_only ||
381
2/2
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 2140 times.
4298 current->error_resilient_mode) {
382 // setup_past_independence() - fill with the initial values.
383
384 1044 vp9->loop_filter_ref_deltas[VP9_INTRA_FRAME] = 1;
385 1044 vp9->loop_filter_ref_deltas[VP9_LAST_FRAME] = 0;
386 1044 vp9->loop_filter_ref_deltas[VP9_GOLDEN_FRAME] = -1;
387 1044 vp9->loop_filter_ref_deltas[VP9_ALTREF_FRAME] = -1;
388
389 1044 vp9->loop_filter_mode_deltas[0] = 0;
390 1044 vp9->loop_filter_mode_deltas[1] = 0;
391
392 1044 memset(vp9->feature_enabled, 0, sizeof(vp9->feature_enabled));
393 1044 memset(vp9->feature_value, 0, sizeof(vp9->feature_value));
394 1044 memset(vp9->feature_sign, 0, sizeof(vp9->feature_sign));
395
396 } else {
397 // Modify previous state based on updates in this frame.
398
399
2/2
✓ Branch 0 taken 42 times.
✓ Branch 1 taken 2098 times.
4280 if (current->loop_filter_delta_update) {
400
2/2
✓ Branch 0 taken 168 times.
✓ Branch 1 taken 42 times.
420 for (i = 0; i < 4; i++) {
401
2/2
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 159 times.
336 if (current->update_ref_delta[i])
402 18 vp9->loop_filter_ref_deltas[i] =
403 18 current->loop_filter_ref_deltas[i];
404 }
405
2/2
✓ Branch 0 taken 84 times.
✓ Branch 1 taken 42 times.
252 for (i = 0; i < 2; i++) {
406
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 78 times.
168 if (current->update_mode_delta[i])
407 12 vp9->loop_filter_mode_deltas[i] =
408 12 current->loop_filter_mode_deltas[i];
409 }
410 }
411
412
2/2
✓ Branch 0 taken 109 times.
✓ Branch 1 taken 2031 times.
4280 if (current->segmentation_update_data) {
413 218 memcpy(vp9->feature_enabled, current->feature_enabled,
414 sizeof(vp9->feature_enabled));
415 218 memcpy(vp9->feature_value, current->feature_value,
416 sizeof(vp9->feature_value));
417 218 memcpy(vp9->feature_sign, current->feature_sign,
418 sizeof(vp9->feature_sign));
419
420
2/2
✓ Branch 0 taken 103 times.
✓ Branch 1 taken 6 times.
218 if (current->segmentation_update_map) {
421 206 memcpy(vp9->segmentation_tree_probs,
422 206 current->segmentation_tree_probs,
423 sizeof(vp9->segmentation_tree_probs));
424 206 memcpy(vp9->segmentation_pred_prob,
425 206 current->segmentation_pred_prob,
426 sizeof(vp9->segmentation_pred_prob));
427 }
428 }
429 }
430
431 5324 av_log(ctx->log_ctx, AV_LOG_DEBUG, "Frame: size %dx%d "
432 "subsample %dx%d bit_depth %d tiles %dx%d.\n",
433 vp9->frame_width, vp9->frame_height,
434 5324 vp9->subsampling_x, vp9->subsampling_y,
435 5324 vp9->bit_depth, 1 << current->tile_cols_log2,
436 5324 1 << current->tile_rows_log2);
437
438 5324 return 0;
439 }
440
441 5426 static int FUNC(trailing_bits)(CodedBitstreamContext *ctx, RWContext *rw)
442 {
443 int err;
444
2/2
✓ Branch 1 taken 6546 times.
✓ Branch 2 taken 2713 times.
18518 while (byte_alignment(rw) != 0)
445
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6546 times.
13092 fixed(1, zero_bit, 0);
446
447 5426 return 0;
448 }
449
450 5426 static int FUNC(frame)(CodedBitstreamContext *ctx, RWContext *rw,
451 VP9RawFrame *current)
452 {
453 int err;
454
455 5426 HEADER("Frame");
456
457
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2713 times.
5426 CHECK(FUNC(uncompressed_header)(ctx, rw, &current->header));
458
459
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2713 times.
5426 CHECK(FUNC(trailing_bits)(ctx, rw));
460
461 5426 return 0;
462 }
463
464 26 static int FUNC(superframe_index)(CodedBitstreamContext *ctx, RWContext *rw,
465 VP9RawSuperframeIndex *current)
466 {
467 int err, i;
468
469 26 HEADER("Superframe Index");
470
471 26 f(3, superframe_marker);
472 26 f(2, bytes_per_framesize_minus_1);
473 26 f(3, frames_in_superframe_minus_1);
474
475 80 for (i = 0; i <= current->frames_in_superframe_minus_1; i++) {
476 // Surprise little-endian!
477 54 fle(8 * (current->bytes_per_framesize_minus_1 + 1),
478 frame_sizes[i], 1, i);
479 }
480
481 26 f(3, superframe_marker);
482 26 f(2, bytes_per_framesize_minus_1);
483 26 f(3, frames_in_superframe_minus_1);
484
485 26 return 0;
486 }
487