../../../ffmpeg/
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
789 / 812
97.2%
Branches:
872 / 930
93.8%
Functions:
12 / 12
100.0%

libavcodec/vp9block.c
Line Branch Exec Source
1 /*
2 * VP9 compatible video decoder
3 *
4 * Copyright (C) 2013 Ronald S. Bultje <rsbultje gmail com>
5 * Copyright (C) 2013 Clément Bœsch <u pkh me>
6 *
7 * This file is part of FFmpeg.
8 *
9 * FFmpeg is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * FFmpeg is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with FFmpeg; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24 #include "libavutil/avassert.h"
25 #include "libavutil/frame.h"
26
27 #include "progressframe.h"
28 #include "vp89_rac.h"
29 #include "vp9.h"
30 #include "vp9data.h"
31 #include "vp9dec.h"
32 #include "vpx_rac.h"
33
34 860919 static av_always_inline void setctx_2d(uint8_t *ptr, int w, int h,
35 ptrdiff_t stride, int v)
36 {
37
4/5
✓ Branch 2 → 3 taken 570511 times.
✓ Branch 2 → 8 taken 228578 times.
✓ Branch 2 → 12 taken 49576 times.
✓ Branch 2 → 16 taken 12254 times.
✗ Branch 2 → 20 not taken.
860919 switch (w) {
38 611685 case 1:
39 do {
40 611685 *ptr = v;
41 611685 ptr += stride;
42
2/2
✓ Branch 4 → 5 taken 41174 times.
✓ Branch 4 → 7 taken 570511 times.
611685 } while (--h);
43 570511 break;
44 228578 case 2: {
45 228578 int v16 = v * 0x0101;
46 do {
47 419027 AV_WN16A(ptr, v16);
48 419027 ptr += stride;
49
2/2
✓ Branch 9 → 10 taken 190449 times.
✓ Branch 9 → 11 taken 228578 times.
419027 } while (--h);
50 228578 break;
51 }
52 49576 case 4: {
53 49576 uint32_t v32 = v * 0x01010101;
54 do {
55 181628 AV_WN32A(ptr, v32);
56 181628 ptr += stride;
57
2/2
✓ Branch 13 → 14 taken 132052 times.
✓ Branch 13 → 15 taken 49576 times.
181628 } while (--h);
58 49576 break;
59 }
60 12254 case 8: {
61 #if HAVE_FAST_64BIT
62 12254 uint64_t v64 = v * 0x0101010101010101ULL;
63 do {
64 91072 AV_WN64A(ptr, v64);
65 91072 ptr += stride;
66
2/2
✓ Branch 17 → 18 taken 78818 times.
✓ Branch 17 → 19 taken 12254 times.
91072 } while (--h);
67 #else
68 uint32_t v32 = v * 0x01010101;
69 do {
70 AV_WN32A(ptr, v32);
71 AV_WN32A(ptr + 4, v32);
72 ptr += stride;
73 } while (--h);
74 #endif
75 12254 break;
76 }
77 }
78 860919 }
79
80 820758 static void decode_mode(VP9TileData *td)
81 {
82 static const uint8_t left_ctx[N_BS_SIZES] = {
83 0x0, 0x8, 0x0, 0x8, 0xc, 0x8, 0xc, 0xe, 0xc, 0xe, 0xf, 0xe, 0xf
84 };
85 static const uint8_t above_ctx[N_BS_SIZES] = {
86 0x0, 0x0, 0x8, 0x8, 0x8, 0xc, 0xc, 0xc, 0xe, 0xe, 0xe, 0xf, 0xf
87 };
88 static const uint8_t max_tx_for_bl_bp[N_BS_SIZES] = {
89 TX_32X32, TX_32X32, TX_32X32, TX_32X32, TX_16X16, TX_16X16,
90 TX_16X16, TX_8X8, TX_8X8, TX_8X8, TX_4X4, TX_4X4, TX_4X4
91 };
92 820758 const VP9Context *s = td->s;
93 820758 VP9Block *b = td->b;
94 820758 int row = td->row, col = td->col, row7 = td->row7;
95 820758 enum TxfmMode max_tx = max_tx_for_bl_bp[b->bs];
96 820758 int bw4 = ff_vp9_bwh_tab[1][b->bs][0], w4 = FFMIN(s->cols - col, bw4);
97 820758 int bh4 = ff_vp9_bwh_tab[1][b->bs][1], h4 = FFMIN(s->rows - row, bh4), y;
98 820758 int have_a = row > 0, have_l = col > td->tile_col_start;
99 int vref, filter_id;
100
101
2/2
✓ Branch 2 → 3 taken 577100 times.
✓ Branch 2 → 4 taken 243658 times.
820758 if (!s->s.h.segmentation.enabled) {
102 577100 b->seg_id = 0;
103
3/4
✓ Branch 4 → 5 taken 234362 times.
✓ Branch 4 → 6 taken 9296 times.
✗ Branch 5 → 6 not taken.
✓ Branch 5 → 11 taken 234362 times.
243658 } else if (s->s.h.keyframe || s->s.h.intraonly) {
104
1/2
✓ Branch 6 → 7 taken 9296 times.
✗ Branch 6 → 9 not taken.
18592 b->seg_id = !s->s.h.segmentation.update_map ? 0 :
105 9296 vp89_rac_get_tree(td->c, ff_vp9_segmentation_tree,
106 9296 s->s.h.segmentation.prob);
107
2/2
✓ Branch 11 → 12 taken 63275 times.
✓ Branch 11 → 15 taken 171087 times.
234362 } else if (!s->s.h.segmentation.update_map ||
108
3/4
✓ Branch 12 → 13 taken 63275 times.
✗ Branch 12 → 28 not taken.
✓ Branch 14 → 15 taken 56354 times.
✓ Branch 14 → 28 taken 6921 times.
126550 (s->s.h.segmentation.temporal &&
109 63275 vpx_rac_get_prob_branchy(td->c,
110 63275 s->s.h.segmentation.pred_prob[s->above_segpred_ctx[col] +
111 63275 td->left_segpred_ctx[row7]]))) {
112
3/4
✓ Branch 15 → 16 taken 220485 times.
✓ Branch 15 → 26 taken 6956 times.
✓ Branch 16 → 17 taken 220485 times.
✗ Branch 16 → 26 not taken.
227441 if (!s->s.h.errorres && s->s.frames[REF_FRAME_SEGMAP].segmentation_map) {
113 220485 int pred = 8, x;
114 220485 uint8_t *refsegmap = s->s.frames[REF_FRAME_SEGMAP].segmentation_map;
115
116
1/2
✓ Branch 17 → 18 taken 220485 times.
✗ Branch 17 → 19 not taken.
220485 if (!s->s.frames[REF_FRAME_SEGMAP].uses_2pass)
117 220485 ff_progress_frame_await(&s->s.frames[REF_FRAME_SEGMAP].tf, row >> 3);
118
2/2
✓ Branch 24 → 20 taken 388438 times.
✓ Branch 24 → 25 taken 220485 times.
608923 for (y = 0; y < h4; y++) {
119 388438 int idx_base = (y + row) * 8 * s->sb_cols + col;
120
2/2
✓ Branch 22 → 21 taken 1178112 times.
✓ Branch 22 → 23 taken 388438 times.
1566550 for (x = 0; x < w4; x++)
121 1178112 pred = FFMIN(pred, refsegmap[idx_base + x]);
122 }
123 av_assert1(pred < 8);
124 220485 b->seg_id = pred;
125 } else {
126 6956 b->seg_id = 0;
127 }
128
129 227441 memset(&s->above_segpred_ctx[col], 1, w4);
130 227441 memset(&td->left_segpred_ctx[row7], 1, h4);
131 } else {
132 13842 b->seg_id = vp89_rac_get_tree(td->c, ff_vp9_segmentation_tree,
133 6921 s->s.h.segmentation.prob);
134
135 6921 memset(&s->above_segpred_ctx[col], 0, w4);
136 6921 memset(&td->left_segpred_ctx[row7], 0, h4);
137 }
138
2/2
✓ Branch 30 → 31 taken 243658 times.
✓ Branch 30 → 35 taken 577100 times.
820758 if (s->s.h.segmentation.enabled &&
139
4/6
✓ Branch 31 → 32 taken 171087 times.
✓ Branch 31 → 34 taken 72571 times.
✓ Branch 32 → 33 taken 171087 times.
✗ Branch 32 → 34 not taken.
✗ Branch 33 → 34 not taken.
✓ Branch 33 → 35 taken 171087 times.
243658 (s->s.h.segmentation.update_map || s->s.h.keyframe || s->s.h.intraonly)) {
140 72571 setctx_2d(&s->s.frames[CUR_FRAME].segmentation_map[row * 8 * s->sb_cols + col],
141 72571 bw4, bh4, 8 * s->sb_cols, b->seg_id);
142 }
143
144
2/2
✓ Branch 35 → 36 taken 243658 times.
✓ Branch 35 → 38 taken 577100 times.
1064416 b->skip = s->s.h.segmentation.enabled &&
145
2/2
✓ Branch 36 → 37 taken 801 times.
✓ Branch 36 → 38 taken 242857 times.
243658 s->s.h.segmentation.feat[b->seg_id].skip_enabled;
146
2/2
✓ Branch 39 → 40 taken 819957 times.
✓ Branch 39 → 42 taken 801 times.
820758 if (!b->skip) {
147 819957 int c = td->left_skip_ctx[row7] + s->above_skip_ctx[col];
148 819957 b->skip = vpx_rac_get_prob(td->c, s->prob.p.skip[c]);
149 819957 td->counts.skip[c][b->skip]++;
150 }
151
152
4/4
✓ Branch 42 → 43 taken 568090 times.
✓ Branch 42 → 44 taken 252668 times.
✓ Branch 43 → 44 taken 2376 times.
✓ Branch 43 → 45 taken 565714 times.
820758 if (s->s.h.keyframe || s->s.h.intraonly) {
153 255044 b->intra = 1;
154
4/4
✓ Branch 45 → 46 taken 234362 times.
✓ Branch 45 → 48 taken 331352 times.
✓ Branch 46 → 47 taken 801 times.
✓ Branch 46 → 48 taken 233561 times.
565714 } else if (s->s.h.segmentation.enabled && s->s.h.segmentation.feat[b->seg_id].ref_enabled) {
155 801 b->intra = !s->s.h.segmentation.feat[b->seg_id].ref_val;
156 } else {
157 int c, bit;
158
159
4/4
✓ Branch 48 → 49 taken 537369 times.
✓ Branch 48 → 51 taken 27544 times.
✓ Branch 49 → 50 taken 521077 times.
✓ Branch 49 → 51 taken 16292 times.
564913 if (have_a && have_l) {
160 521077 c = s->above_intra_ctx[col] + td->left_intra_ctx[row7];
161 521077 c += (c == 2);
162 } else {
163
2/2
✓ Branch 51 → 52 taken 16292 times.
✓ Branch 51 → 53 taken 27544 times.
45656 c = have_a ? 2 * s->above_intra_ctx[col] :
164
2/2
✓ Branch 53 → 54 taken 25724 times.
✓ Branch 53 → 55 taken 1820 times.
27544 have_l ? 2 * td->left_intra_ctx[row7] : 0;
165 }
166 564913 bit = vpx_rac_get_prob(td->c, s->prob.p.intra[c]);
167 564913 td->counts.intra[c][bit]++;
168 564913 b->intra = !bit;
169 }
170
171
6/6
✓ Branch 58 → 59 taken 533188 times.
✓ Branch 58 → 60 taken 287570 times.
✓ Branch 59 → 60 taken 139751 times.
✓ Branch 59 → 99 taken 393437 times.
✓ Branch 60 → 61 taken 397657 times.
✓ Branch 60 → 99 taken 29664 times.
1218415 if ((b->intra || !b->skip) && s->s.h.txfmmode == TX_SWITCHABLE) {
172 int c;
173
2/2
✓ Branch 61 → 62 taken 373960 times.
✓ Branch 61 → 75 taken 23697 times.
397657 if (have_a) {
174
2/2
✓ Branch 62 → 63 taken 362293 times.
✓ Branch 62 → 70 taken 11667 times.
373960 if (have_l) {
175
2/2
✓ Branch 63 → 64 taken 291627 times.
✓ Branch 63 → 65 taken 70666 times.
362293 c = (s->above_skip_ctx[col] ? max_tx :
176 291627 s->above_txfm_ctx[col]) +
177
2/2
✓ Branch 66 → 67 taken 282757 times.
✓ Branch 66 → 68 taken 79536 times.
362293 (td->left_skip_ctx[row7] ? max_tx :
178 362293 td->left_txfm_ctx[row7]) > max_tx;
179 } else {
180
2/2
✓ Branch 70 → 71 taken 9774 times.
✓ Branch 70 → 72 taken 1893 times.
21441 c = s->above_skip_ctx[col] ? 1 :
181
2/2
✓ Branch 71 → 72 taken 4576 times.
✓ Branch 71 → 73 taken 5198 times.
9774 (s->above_txfm_ctx[col] * 2 > max_tx);
182 }
183
2/2
✓ Branch 75 → 76 taken 22386 times.
✓ Branch 75 → 81 taken 1311 times.
23697 } else if (have_l) {
184
2/2
✓ Branch 76 → 77 taken 19713 times.
✓ Branch 76 → 78 taken 2673 times.
42099 c = td->left_skip_ctx[row7] ? 1 :
185
2/2
✓ Branch 77 → 78 taken 6500 times.
✓ Branch 77 → 79 taken 13213 times.
19713 (td->left_txfm_ctx[row7] * 2 > max_tx);
186 } else {
187 1311 c = 1;
188 }
189
4/5
✓ Branch 82 → 83 taken 12156 times.
✓ Branch 82 → 90 taken 55305 times.
✓ Branch 82 → 95 taken 210236 times.
✓ Branch 82 → 97 taken 119960 times.
✗ Branch 82 → 98 not taken.
397657 switch (max_tx) {
190 12156 case TX_32X32:
191 12156 b->tx = vpx_rac_get_prob(td->c, s->prob.p.tx32p[c][0]);
192
2/2
✓ Branch 84 → 85 taken 11986 times.
✓ Branch 84 → 89 taken 170 times.
12156 if (b->tx) {
193 11986 b->tx += vpx_rac_get_prob(td->c, s->prob.p.tx32p[c][1]);
194
2/2
✓ Branch 86 → 87 taken 10881 times.
✓ Branch 86 → 89 taken 1105 times.
11986 if (b->tx == 2)
195 10881 b->tx += vpx_rac_get_prob(td->c, s->prob.p.tx32p[c][2]);
196 }
197 12156 td->counts.tx32p[c][b->tx]++;
198 12156 break;
199 55305 case TX_16X16:
200 55305 b->tx = vpx_rac_get_prob(td->c, s->prob.p.tx16p[c][0]);
201
2/2
✓ Branch 91 → 92 taken 52056 times.
✓ Branch 91 → 94 taken 3249 times.
55305 if (b->tx)
202 52056 b->tx += vpx_rac_get_prob(td->c, s->prob.p.tx16p[c][1]);
203 55305 td->counts.tx16p[c][b->tx]++;
204 55305 break;
205 210236 case TX_8X8:
206 210236 b->tx = vpx_rac_get_prob(td->c, s->prob.p.tx8p[c]);
207 210236 td->counts.tx8p[c][b->tx]++;
208 210236 break;
209 119960 case TX_4X4:
210 119960 b->tx = TX_4X4;
211 119960 break;
212 }
213 } else {
214 423101 b->tx = FFMIN(max_tx, s->s.h.txfmmode);
215 }
216
217
4/4
✓ Branch 100 → 101 taken 568090 times.
✓ Branch 100 → 102 taken 252668 times.
✓ Branch 101 → 102 taken 2376 times.
✓ Branch 101 → 119 taken 565714 times.
820758 if (s->s.h.keyframe || s->s.h.intraonly) {
218 255044 uint8_t *a = &s->above_mode_ctx[col * 2];
219 255044 uint8_t *l = &td->left_mode_ctx[(row7) << 1];
220
221 255044 b->comp = 0;
222
2/2
✓ Branch 102 → 103 taken 84779 times.
✓ Branch 102 → 115 taken 170265 times.
255044 if (b->bs > BS_8x8) {
223 // FIXME the memory storage intermediates here aren't really
224 // necessary, they're just there to make the code slightly
225 // simpler for now
226 84779 b->mode[0] =
227 169558 a[0] = vp89_rac_get_tree(td->c, ff_vp9_intramode_tree,
228 84779 ff_vp9_default_kf_ymode_probs[a[0]][l[0]]);
229
2/2
✓ Branch 104 → 105 taken 60212 times.
✓ Branch 104 → 107 taken 24567 times.
84779 if (b->bs != BS_8x4) {
230 120424 b->mode[1] = vp89_rac_get_tree(td->c, ff_vp9_intramode_tree,
231 60212 ff_vp9_default_kf_ymode_probs[a[1]][b->mode[0]]);
232 60212 l[0] =
233 60212 a[1] = b->mode[1];
234 } else {
235 24567 l[0] =
236 24567 a[1] =
237 24567 b->mode[1] = b->mode[0];
238 }
239
2/2
✓ Branch 108 → 109 taken 68865 times.
✓ Branch 108 → 114 taken 15914 times.
84779 if (b->bs != BS_4x8) {
240 68865 b->mode[2] =
241 137730 a[0] = vp89_rac_get_tree(td->c, ff_vp9_intramode_tree,
242 68865 ff_vp9_default_kf_ymode_probs[a[0]][l[1]]);
243
2/2
✓ Branch 110 → 111 taken 44298 times.
✓ Branch 110 → 113 taken 24567 times.
68865 if (b->bs != BS_8x4) {
244 88596 b->mode[3] = vp89_rac_get_tree(td->c, ff_vp9_intramode_tree,
245 44298 ff_vp9_default_kf_ymode_probs[a[1]][b->mode[2]]);
246 44298 l[1] =
247 44298 a[1] = b->mode[3];
248 } else {
249 24567 l[1] =
250 24567 a[1] =
251 24567 b->mode[3] = b->mode[2];
252 }
253 } else {
254 15914 b->mode[2] = b->mode[0];
255 15914 l[1] =
256 15914 a[1] =
257 15914 b->mode[3] = b->mode[1];
258 }
259 } else {
260 340530 b->mode[0] = vp89_rac_get_tree(td->c, ff_vp9_intramode_tree,
261 170265 ff_vp9_default_kf_ymode_probs[*a][*l]);
262 170265 b->mode[3] =
263 170265 b->mode[2] =
264 170265 b->mode[1] = b->mode[0];
265 // FIXME this can probably be optimized
266 170265 memset(a, b->mode[0], ff_vp9_bwh_tab[0][b->bs][0]);
267 170265 memset(l, b->mode[0], ff_vp9_bwh_tab[0][b->bs][1]);
268 }
269 255044 b->uvmode = vp89_rac_get_tree(td->c, ff_vp9_intramode_tree,
270 255044 ff_vp9_default_kf_uvmode_probs[b->mode[3]]);
271
2/2
✓ Branch 119 → 120 taken 32526 times.
✓ Branch 119 → 137 taken 533188 times.
565714 } else if (b->intra) {
272 32526 b->comp = 0;
273
2/2
✓ Branch 120 → 121 taken 1699 times.
✓ Branch 120 → 133 taken 30827 times.
32526 if (b->bs > BS_8x8) {
274 3398 b->mode[0] = vp89_rac_get_tree(td->c, ff_vp9_intramode_tree,
275 1699 s->prob.p.y_mode[0]);
276 1699 td->counts.y_mode[0][b->mode[0]]++;
277
2/2
✓ Branch 122 → 123 taken 1208 times.
✓ Branch 122 → 125 taken 491 times.
1699 if (b->bs != BS_8x4) {
278 2416 b->mode[1] = vp89_rac_get_tree(td->c, ff_vp9_intramode_tree,
279 1208 s->prob.p.y_mode[0]);
280 1208 td->counts.y_mode[0][b->mode[1]]++;
281 } else {
282 491 b->mode[1] = b->mode[0];
283 }
284
2/2
✓ Branch 126 → 127 taken 1192 times.
✓ Branch 126 → 132 taken 507 times.
1699 if (b->bs != BS_4x8) {
285 2384 b->mode[2] = vp89_rac_get_tree(td->c, ff_vp9_intramode_tree,
286 1192 s->prob.p.y_mode[0]);
287 1192 td->counts.y_mode[0][b->mode[2]]++;
288
2/2
✓ Branch 128 → 129 taken 701 times.
✓ Branch 128 → 131 taken 491 times.
1192 if (b->bs != BS_8x4) {
289 1402 b->mode[3] = vp89_rac_get_tree(td->c, ff_vp9_intramode_tree,
290 701 s->prob.p.y_mode[0]);
291 701 td->counts.y_mode[0][b->mode[3]]++;
292 } else {
293 491 b->mode[3] = b->mode[2];
294 }
295 } else {
296 507 b->mode[2] = b->mode[0];
297 507 b->mode[3] = b->mode[1];
298 }
299 } else {
300 static const uint8_t size_group[10] = {
301 3, 3, 3, 3, 2, 2, 2, 1, 1, 1
302 };
303 30827 int sz = size_group[b->bs];
304
305 61654 b->mode[0] = vp89_rac_get_tree(td->c, ff_vp9_intramode_tree,
306 30827 s->prob.p.y_mode[sz]);
307 30827 b->mode[1] =
308 30827 b->mode[2] =
309 30827 b->mode[3] = b->mode[0];
310 30827 td->counts.y_mode[sz][b->mode[3]]++;
311 }
312 65052 b->uvmode = vp89_rac_get_tree(td->c, ff_vp9_intramode_tree,
313 32526 s->prob.p.uv_mode[b->mode[3]]);
314 32526 td->counts.uv_mode[b->mode[3]][b->uvmode]++;
315 } else {
316 static const uint8_t inter_mode_ctx_lut[14][14] = {
317 { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
318 { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
319 { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
320 { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
321 { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
322 { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
323 { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
324 { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
325 { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
326 { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
327 { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2, 2, 1, 3 },
328 { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2, 2, 1, 3 },
329 { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 1, 0, 3 },
330 { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3, 3, 3, 4 },
331 };
332
333
4/4
✓ Branch 137 → 138 taken 219611 times.
✓ Branch 137 → 140 taken 313577 times.
✓ Branch 138 → 139 taken 801 times.
✓ Branch 138 → 140 taken 218810 times.
533188 if (s->s.h.segmentation.enabled && s->s.h.segmentation.feat[b->seg_id].ref_enabled) {
334 av_assert2(s->s.h.segmentation.feat[b->seg_id].ref_val != 0);
335 801 b->comp = 0;
336 801 b->ref[0] = s->s.h.segmentation.feat[b->seg_id].ref_val - 1;
337 } else {
338 // read comp_pred flag
339
2/2
✓ Branch 140 → 141 taken 346886 times.
✓ Branch 140 → 142 taken 185501 times.
532387 if (s->s.h.comppredmode != PRED_SWITCHABLE) {
340 346886 b->comp = s->s.h.comppredmode == PRED_COMPREF;
341 } else {
342 int c;
343
344 // FIXME add intra as ref=0xff (or -1) to make these easier?
345
2/2
✓ Branch 142 → 143 taken 180588 times.
✓ Branch 142 → 176 taken 4913 times.
185501 if (have_a) {
346
2/2
✓ Branch 143 → 144 taken 177443 times.
✓ Branch 143 → 169 taken 3145 times.
180588 if (have_l) {
347
4/4
✓ Branch 144 → 145 taken 28396 times.
✓ Branch 144 → 147 taken 149047 times.
✓ Branch 145 → 146 taken 18565 times.
✓ Branch 145 → 147 taken 9831 times.
177443 if (s->above_comp_ctx[col] && td->left_comp_ctx[row7]) {
348 18565 c = 4;
349
2/2
✓ Branch 147 → 148 taken 9831 times.
✓ Branch 147 → 153 taken 149047 times.
158878 } else if (s->above_comp_ctx[col]) {
350
2/2
✓ Branch 148 → 149 taken 9720 times.
✓ Branch 148 → 150 taken 111 times.
19551 c = 2 + (td->left_intra_ctx[row7] ||
351
2/2
✓ Branch 149 → 150 taken 3853 times.
✓ Branch 149 → 151 taken 5867 times.
9720 td->left_ref_ctx[row7] == s->s.h.fixcompref);
352
2/2
✓ Branch 153 → 154 taken 8508 times.
✓ Branch 153 → 159 taken 140539 times.
149047 } else if (td->left_comp_ctx[row7]) {
353
2/2
✓ Branch 154 → 155 taken 8396 times.
✓ Branch 154 → 156 taken 112 times.
16904 c = 2 + (s->above_intra_ctx[col] ||
354
2/2
✓ Branch 155 → 156 taken 2011 times.
✓ Branch 155 → 157 taken 6385 times.
8396 s->above_ref_ctx[col] == s->s.h.fixcompref);
355 } else {
356
2/2
✓ Branch 159 → 160 taken 139661 times.
✓ Branch 159 → 162 taken 878 times.
420739 c = (!s->above_intra_ctx[col] &&
357
2/2
✓ Branch 160 → 161 taken 12783 times.
✓ Branch 160 → 162 taken 126878 times.
139661 s->above_ref_ctx[col] == s->s.h.fixcompref) ^
358
2/2
✓ Branch 163 → 164 taken 138697 times.
✓ Branch 163 → 166 taken 1842 times.
279236 (!td->left_intra_ctx[row7] &&
359
2/2
✓ Branch 164 → 165 taken 14376 times.
✓ Branch 164 → 166 taken 124321 times.
138697 td->left_ref_ctx[row & 7] == s->s.h.fixcompref);
360 }
361 } else {
362
2/2
✓ Branch 169 → 170 taken 2858 times.
✓ Branch 169 → 175 taken 287 times.
6003 c = s->above_comp_ctx[col] ? 3 :
363
4/4
✓ Branch 170 → 171 taken 2793 times.
✓ Branch 170 → 173 taken 65 times.
✓ Branch 171 → 172 taken 902 times.
✓ Branch 171 → 173 taken 1891 times.
2858 (!s->above_intra_ctx[col] && s->above_ref_ctx[col] == s->s.h.fixcompref);
364 }
365
2/2
✓ Branch 176 → 177 taken 4595 times.
✓ Branch 176 → 184 taken 318 times.
4913 } else if (have_l) {
366
2/2
✓ Branch 177 → 178 taken 3934 times.
✓ Branch 177 → 183 taken 661 times.
8529 c = td->left_comp_ctx[row7] ? 3 :
367
4/4
✓ Branch 178 → 179 taken 3908 times.
✓ Branch 178 → 181 taken 26 times.
✓ Branch 179 → 180 taken 1036 times.
✓ Branch 179 → 181 taken 2872 times.
3934 (!td->left_intra_ctx[row7] && td->left_ref_ctx[row7] == s->s.h.fixcompref);
368 } else {
369 318 c = 1;
370 }
371 185501 b->comp = vpx_rac_get_prob(td->c, s->prob.p.comp[c]);
372 185501 td->counts.comp[c][b->comp]++;
373 }
374
375 // read actual references
376 // FIXME probably cache a few variables here to prevent repetitive
377 // memory accesses below
378
2/2
✓ Branch 187 → 188 taken 27251 times.
✓ Branch 187 → 258 taken 505136 times.
532387 if (b->comp) { /* two references */
379 27251 int fix_idx = s->s.h.signbias[s->s.h.fixcompref], var_idx = !fix_idx, c, bit;
380
381 27251 b->ref[fix_idx] = s->s.h.fixcompref;
382 // FIXME can this codeblob be replaced by some sort of LUT?
383
2/2
✓ Branch 188 → 189 taken 26541 times.
✓ Branch 188 → 245 taken 710 times.
27251 if (have_a) {
384
2/2
✓ Branch 189 → 190 taken 26239 times.
✓ Branch 189 → 236 taken 302 times.
26541 if (have_l) {
385
2/2
✓ Branch 190 → 191 taken 68 times.
✓ Branch 190 → 196 taken 26171 times.
26239 if (s->above_intra_ctx[col]) {
386
2/2
✓ Branch 191 → 192 taken 14 times.
✓ Branch 191 → 193 taken 54 times.
68 if (td->left_intra_ctx[row7]) {
387 14 c = 2;
388 } else {
389
2/2
✓ Branch 193 → 194 taken 47 times.
✓ Branch 193 → 195 taken 7 times.
54 c = 1 + 2 * (td->left_ref_ctx[row7] != s->s.h.varcompref[1]);
390 }
391
2/2
✓ Branch 196 → 197 taken 87 times.
✓ Branch 196 → 200 taken 26084 times.
26171 } else if (td->left_intra_ctx[row7]) {
392
2/2
✓ Branch 197 → 198 taken 66 times.
✓ Branch 197 → 199 taken 21 times.
87 c = 1 + 2 * (s->above_ref_ctx[col] != s->s.h.varcompref[1]);
393 } else {
394 26084 int refl = td->left_ref_ctx[row7], refa = s->above_ref_ctx[col];
395
396
4/4
✓ Branch 200 → 201 taken 21688 times.
✓ Branch 200 → 203 taken 4396 times.
✓ Branch 201 → 202 taken 2446 times.
✓ Branch 201 → 203 taken 19242 times.
26084 if (refl == refa && refa == s->s.h.varcompref[1]) {
397 2446 c = 0;
398
4/4
✓ Branch 203 → 204 taken 4921 times.
✓ Branch 203 → 214 taken 18717 times.
✓ Branch 204 → 205 taken 2175 times.
✓ Branch 204 → 214 taken 2746 times.
23638 } else if (!td->left_comp_ctx[row7] && !s->above_comp_ctx[col]) {
399
4/4
✓ Branch 205 → 206 taken 720 times.
✓ Branch 205 → 207 taken 1455 times.
✓ Branch 206 → 207 taken 354 times.
✓ Branch 206 → 209 taken 366 times.
2175 if ((refa == s->s.h.fixcompref && refl == s->s.h.varcompref[0]) ||
400
4/4
✓ Branch 207 → 208 taken 741 times.
✓ Branch 207 → 210 taken 1068 times.
✓ Branch 208 → 209 taken 408 times.
✓ Branch 208 → 210 taken 333 times.
1809 (refl == s->s.h.fixcompref && refa == s->s.h.varcompref[0])) {
401 774 c = 4;
402 } else {
403
2/2
✓ Branch 210 → 211 taken 1088 times.
✓ Branch 210 → 212 taken 313 times.
1401 c = (refa == refl) ? 3 : 1;
404 }
405
2/2
✓ Branch 214 → 215 taken 2746 times.
✓ Branch 214 → 223 taken 18717 times.
21463 } else if (!td->left_comp_ctx[row7]) {
406
3/4
✓ Branch 215 → 216 taken 450 times.
✓ Branch 215 → 218 taken 2296 times.
✓ Branch 216 → 217 taken 450 times.
✗ Branch 216 → 218 not taken.
2746 if (refa == s->s.h.varcompref[1] && refl != s->s.h.varcompref[1]) {
407 450 c = 1;
408 } else {
409 2296 c = (refl == s->s.h.varcompref[1] &&
410
3/4
✓ Branch 218 → 219 taken 104 times.
✓ Branch 218 → 221 taken 2192 times.
✓ Branch 219 → 220 taken 104 times.
✗ Branch 219 → 221 not taken.
2296 refa != s->s.h.varcompref[1]) ? 2 : 4;
411 }
412
2/2
✓ Branch 223 → 224 taken 3206 times.
✓ Branch 223 → 232 taken 15511 times.
18717 } else if (!s->above_comp_ctx[col]) {
413
3/4
✓ Branch 224 → 225 taken 442 times.
✓ Branch 224 → 227 taken 2764 times.
✓ Branch 225 → 226 taken 442 times.
✗ Branch 225 → 227 not taken.
3206 if (refl == s->s.h.varcompref[1] && refa != s->s.h.varcompref[1]) {
414 442 c = 1;
415 } else {
416 2764 c = (refa == s->s.h.varcompref[1] &&
417
3/4
✓ Branch 227 → 228 taken 185 times.
✓ Branch 227 → 230 taken 2579 times.
✓ Branch 228 → 229 taken 185 times.
✗ Branch 228 → 230 not taken.
2764 refl != s->s.h.varcompref[1]) ? 2 : 4;
418 }
419 } else {
420
2/2
✓ Branch 232 → 233 taken 14747 times.
✓ Branch 232 → 234 taken 764 times.
15511 c = (refl == refa) ? 4 : 2;
421 }
422 }
423 } else {
424
2/2
✓ Branch 236 → 237 taken 1 time.
✓ Branch 236 → 238 taken 301 times.
302 if (s->above_intra_ctx[col]) {
425 1 c = 2;
426
2/2
✓ Branch 238 → 239 taken 130 times.
✓ Branch 238 → 242 taken 171 times.
301 } else if (s->above_comp_ctx[col]) {
427
2/2
✓ Branch 239 → 240 taken 108 times.
✓ Branch 239 → 241 taken 22 times.
130 c = 4 * (s->above_ref_ctx[col] != s->s.h.varcompref[1]);
428 } else {
429
2/2
✓ Branch 242 → 243 taken 156 times.
✓ Branch 242 → 244 taken 15 times.
171 c = 3 * (s->above_ref_ctx[col] != s->s.h.varcompref[1]);
430 }
431 }
432
2/2
✓ Branch 245 → 246 taken 692 times.
✓ Branch 245 → 255 taken 18 times.
710 } else if (have_l) {
433
2/2
✓ Branch 246 → 247 taken 4 times.
✓ Branch 246 → 248 taken 688 times.
692 if (td->left_intra_ctx[row7]) {
434 4 c = 2;
435
2/2
✓ Branch 248 → 249 taken 409 times.
✓ Branch 248 → 252 taken 279 times.
688 } else if (td->left_comp_ctx[row7]) {
436
2/2
✓ Branch 249 → 250 taken 294 times.
✓ Branch 249 → 251 taken 115 times.
409 c = 4 * (td->left_ref_ctx[row7] != s->s.h.varcompref[1]);
437 } else {
438
2/2
✓ Branch 252 → 253 taken 242 times.
✓ Branch 252 → 254 taken 37 times.
279 c = 3 * (td->left_ref_ctx[row7] != s->s.h.varcompref[1]);
439 }
440 } else {
441 18 c = 2;
442 }
443 27251 bit = vpx_rac_get_prob(td->c, s->prob.p.comp_ref[c]);
444 27251 b->ref[var_idx] = s->s.h.varcompref[bit];
445 27251 td->counts.comp_ref[c][bit]++;
446 } else /* single reference */ {
447 int bit, c;
448
449
4/4
✓ Branch 258 → 259 taken 480125 times.
✓ Branch 258 → 307 taken 25011 times.
✓ Branch 259 → 260 taken 467771 times.
✓ Branch 259 → 307 taken 12354 times.
505136 if (have_a && !s->above_intra_ctx[col]) {
450
4/4
✓ Branch 260 → 261 taken 452953 times.
✓ Branch 260 → 295 taken 14818 times.
✓ Branch 261 → 262 taken 442385 times.
✓ Branch 261 → 295 taken 10568 times.
467771 if (have_l && !td->left_intra_ctx[row7]) {
451
2/2
✓ Branch 262 → 263 taken 6259 times.
✓ Branch 262 → 278 taken 436126 times.
442385 if (td->left_comp_ctx[row7]) {
452
2/2
✓ Branch 263 → 264 taken 1572 times.
✓ Branch 263 → 270 taken 4687 times.
6259 if (s->above_comp_ctx[col]) {
453
3/4
✓ Branch 264 → 265 taken 1572 times.
✗ Branch 264 → 267 not taken.
✓ Branch 265 → 266 taken 531 times.
✓ Branch 265 → 267 taken 1041 times.
2103 c = 1 + (!s->s.h.fixcompref || !td->left_ref_ctx[row7] ||
454
2/2
✓ Branch 266 → 267 taken 133 times.
✓ Branch 266 → 268 taken 398 times.
531 !s->above_ref_ctx[col]);
455 } else {
456
2/2
✓ Branch 270 → 271 taken 2895 times.
✓ Branch 270 → 272 taken 1792 times.
9374 c = (3 * !s->above_ref_ctx[col]) +
457
3/4
✓ Branch 273 → 274 taken 4687 times.
✗ Branch 273 → 275 not taken.
✓ Branch 274 → 275 taken 3764 times.
✓ Branch 274 → 276 taken 923 times.
4687 (!s->s.h.fixcompref || !td->left_ref_ctx[row7]);
458 }
459
2/2
✓ Branch 278 → 279 taken 6712 times.
✓ Branch 278 → 287 taken 429414 times.
436126 } else if (s->above_comp_ctx[col]) {
460
2/2
✓ Branch 279 → 280 taken 3113 times.
✓ Branch 279 → 281 taken 3599 times.
13424 c = (3 * !td->left_ref_ctx[row7]) +
461
3/4
✓ Branch 282 → 283 taken 6712 times.
✗ Branch 282 → 284 not taken.
✓ Branch 283 → 284 taken 5576 times.
✓ Branch 283 → 285 taken 1136 times.
6712 (!s->s.h.fixcompref || !s->above_ref_ctx[col]);
462 } else {
463
4/4
✓ Branch 287 → 288 taken 347985 times.
✓ Branch 287 → 289 taken 81429 times.
✓ Branch 290 → 291 taken 348833 times.
✓ Branch 290 → 292 taken 80581 times.
429414 c = 2 * !td->left_ref_ctx[row7] + 2 * !s->above_ref_ctx[col];
464 }
465
1/2
✗ Branch 295 → 296 not taken.
✓ Branch 295 → 297 taken 25386 times.
25386 } else if (s->above_intra_ctx[col]) {
466 ✗ c = 2;
467
2/2
✓ Branch 297 → 298 taken 231 times.
✓ Branch 297 → 303 taken 25155 times.
25386 } else if (s->above_comp_ctx[col]) {
468
3/4
✓ Branch 298 → 299 taken 231 times.
✗ Branch 298 → 300 not taken.
✓ Branch 299 → 300 taken 198 times.
✓ Branch 299 → 301 taken 33 times.
231 c = 1 + (!s->s.h.fixcompref || !s->above_ref_ctx[col]);
469 } else {
470
2/2
✓ Branch 303 → 304 taken 19672 times.
✓ Branch 303 → 305 taken 5483 times.
25155 c = 4 * (!s->above_ref_ctx[col]);
471 }
472
4/4
✓ Branch 307 → 308 taken 35381 times.
✓ Branch 307 → 321 taken 1984 times.
✓ Branch 308 → 309 taken 32287 times.
✓ Branch 308 → 321 taken 3094 times.
37365 } else if (have_l && !td->left_intra_ctx[row7]) {
473
1/2
✗ Branch 309 → 310 not taken.
✓ Branch 309 → 311 taken 32287 times.
32287 if (td->left_intra_ctx[row7]) {
474 ✗ c = 2;
475
2/2
✓ Branch 311 → 312 taken 342 times.
✓ Branch 311 → 317 taken 31945 times.
32287 } else if (td->left_comp_ctx[row7]) {
476
3/4
✓ Branch 312 → 313 taken 342 times.
✗ Branch 312 → 314 not taken.
✓ Branch 313 → 314 taken 268 times.
✓ Branch 313 → 315 taken 74 times.
342 c = 1 + (!s->s.h.fixcompref || !td->left_ref_ctx[row7]);
477 } else {
478
2/2
✓ Branch 317 → 318 taken 25791 times.
✓ Branch 317 → 319 taken 6154 times.
31945 c = 4 * (!td->left_ref_ctx[row7]);
479 }
480 } else {
481 5078 c = 2;
482 }
483 505136 bit = vpx_rac_get_prob(td->c, s->prob.p.single_ref[c][0]);
484 505136 td->counts.single_ref[c][0][bit]++;
485
2/2
✓ Branch 323 → 324 taken 403873 times.
✓ Branch 323 → 325 taken 101263 times.
505136 if (!bit) {
486 403873 b->ref[0] = 0;
487 } else {
488 // FIXME can this codeblob be replaced by some sort of LUT?
489
2/2
✓ Branch 325 → 326 taken 96117 times.
✓ Branch 325 → 424 taken 5146 times.
101263 if (have_a) {
490
2/2
✓ Branch 326 → 327 taken 92973 times.
✓ Branch 326 → 410 taken 3144 times.
96117 if (have_l) {
491
2/2
✓ Branch 327 → 328 taken 3459 times.
✓ Branch 327 → 341 taken 89514 times.
92973 if (td->left_intra_ctx[row7]) {
492
2/2
✓ Branch 328 → 329 taken 786 times.
✓ Branch 328 → 330 taken 2673 times.
3459 if (s->above_intra_ctx[col]) {
493 786 c = 2;
494
2/2
✓ Branch 330 → 331 taken 50 times.
✓ Branch 330 → 336 taken 2623 times.
2673 } else if (s->above_comp_ctx[col]) {
495
1/2
✓ Branch 331 → 332 taken 50 times.
✗ Branch 331 → 333 not taken.
100 c = 1 + 2 * (s->s.h.fixcompref == 1 ||
496
2/2
✓ Branch 332 → 333 taken 9 times.
✓ Branch 332 → 334 taken 41 times.
50 s->above_ref_ctx[col] == 1);
497
2/2
✓ Branch 336 → 337 taken 718 times.
✓ Branch 336 → 338 taken 1905 times.
2623 } else if (!s->above_ref_ctx[col]) {
498 718 c = 3;
499 } else {
500
2/2
✓ Branch 338 → 339 taken 1566 times.
✓ Branch 338 → 340 taken 339 times.
1905 c = 4 * (s->above_ref_ctx[col] == 1);
501 }
502
2/2
✓ Branch 341 → 342 taken 1948 times.
✓ Branch 341 → 355 taken 87566 times.
89514 } else if (s->above_intra_ctx[col]) {
503
1/2
✗ Branch 342 → 343 not taken.
✓ Branch 342 → 344 taken 1948 times.
1948 if (td->left_intra_ctx[row7]) {
504 ✗ c = 2;
505
2/2
✓ Branch 344 → 345 taken 45 times.
✓ Branch 344 → 350 taken 1903 times.
1948 } else if (td->left_comp_ctx[row7]) {
506
1/2
✓ Branch 345 → 346 taken 45 times.
✗ Branch 345 → 347 not taken.
90 c = 1 + 2 * (s->s.h.fixcompref == 1 ||
507
2/2
✓ Branch 346 → 347 taken 6 times.
✓ Branch 346 → 348 taken 39 times.
45 td->left_ref_ctx[row7] == 1);
508
2/2
✓ Branch 350 → 351 taken 563 times.
✓ Branch 350 → 352 taken 1340 times.
1903 } else if (!td->left_ref_ctx[row7]) {
509 563 c = 3;
510 } else {
511
2/2
✓ Branch 352 → 353 taken 1007 times.
✓ Branch 352 → 354 taken 333 times.
1340 c = 4 * (td->left_ref_ctx[row7] == 1);
512 }
513
2/2
✓ Branch 355 → 356 taken 4390 times.
✓ Branch 355 → 378 taken 83176 times.
87566 } else if (s->above_comp_ctx[col]) {
514
2/2
✓ Branch 356 → 357 taken 850 times.
✓ Branch 356 → 364 taken 3540 times.
4390 if (td->left_comp_ctx[row7]) {
515
2/2
✓ Branch 357 → 358 taken 729 times.
✓ Branch 357 → 363 taken 121 times.
850 if (td->left_ref_ctx[row7] == s->above_ref_ctx[col]) {
516
1/2
✓ Branch 358 → 359 taken 729 times.
✗ Branch 358 → 360 not taken.
1458 c = 3 * (s->s.h.fixcompref == 1 ||
517
2/2
✓ Branch 359 → 360 taken 327 times.
✓ Branch 359 → 361 taken 402 times.
729 td->left_ref_ctx[row7] == 1);
518 } else {
519 121 c = 2;
520 }
521
2/2
✓ Branch 364 → 365 taken 344 times.
✓ Branch 364 → 370 taken 3196 times.
3540 } else if (!td->left_ref_ctx[row7]) {
522
1/2
✓ Branch 365 → 366 taken 344 times.
✗ Branch 365 → 367 not taken.
688 c = 1 + 2 * (s->s.h.fixcompref == 1 ||
523
2/2
✓ Branch 366 → 367 taken 72 times.
✓ Branch 366 → 368 taken 272 times.
344 s->above_ref_ctx[col] == 1);
524 } else {
525
2/2
✓ Branch 370 → 371 taken 640 times.
✓ Branch 370 → 372 taken 2556 times.
6392 c = 3 * (td->left_ref_ctx[row7] == 1) +
526
3/4
✓ Branch 373 → 374 taken 3196 times.
✗ Branch 373 → 375 not taken.
✓ Branch 374 → 375 taken 767 times.
✓ Branch 374 → 376 taken 2429 times.
3196 (s->s.h.fixcompref == 1 || s->above_ref_ctx[col] == 1);
527 }
528
2/2
✓ Branch 378 → 379 taken 1759 times.
✓ Branch 378 → 393 taken 81417 times.
83176 } else if (td->left_comp_ctx[row7]) {
529
2/2
✓ Branch 379 → 380 taken 334 times.
✓ Branch 379 → 385 taken 1425 times.
1759 if (!s->above_ref_ctx[col]) {
530
1/2
✓ Branch 380 → 381 taken 334 times.
✗ Branch 380 → 382 not taken.
668 c = 1 + 2 * (s->s.h.fixcompref == 1 ||
531
2/2
✓ Branch 381 → 382 taken 72 times.
✓ Branch 381 → 383 taken 262 times.
334 td->left_ref_ctx[row7] == 1);
532 } else {
533
2/2
✓ Branch 385 → 386 taken 512 times.
✓ Branch 385 → 387 taken 913 times.
2850 c = 3 * (s->above_ref_ctx[col] == 1) +
534
3/4
✓ Branch 388 → 389 taken 1425 times.
✗ Branch 388 → 390 not taken.
✓ Branch 389 → 390 taken 569 times.
✓ Branch 389 → 391 taken 856 times.
1425 (s->s.h.fixcompref == 1 || td->left_ref_ctx[row7] == 1);
535 }
536
2/2
✓ Branch 393 → 394 taken 18428 times.
✓ Branch 393 → 399 taken 62989 times.
81417 } else if (!s->above_ref_ctx[col]) {
537
2/2
✓ Branch 394 → 395 taken 7620 times.
✓ Branch 394 → 396 taken 10808 times.
18428 if (!td->left_ref_ctx[row7]) {
538 7620 c = 3;
539 } else {
540
2/2
✓ Branch 396 → 397 taken 7162 times.
✓ Branch 396 → 398 taken 3646 times.
10808 c = 4 * (td->left_ref_ctx[row7] == 1);
541 }
542
2/2
✓ Branch 399 → 400 taken 9432 times.
✓ Branch 399 → 403 taken 53557 times.
62989 } else if (!td->left_ref_ctx[row7]) {
543
2/2
✓ Branch 400 → 401 taken 7166 times.
✓ Branch 400 → 402 taken 2266 times.
9432 c = 4 * (s->above_ref_ctx[col] == 1);
544 } else {
545
2/2
✓ Branch 403 → 404 taken 39497 times.
✓ Branch 403 → 405 taken 14060 times.
107114 c = 2 * (td->left_ref_ctx[row7] == 1) +
546
2/2
✓ Branch 406 → 407 taken 39506 times.
✓ Branch 406 → 408 taken 14051 times.
53557 2 * (s->above_ref_ctx[col] == 1);
547 }
548 } else {
549
2/2
✓ Branch 410 → 411 taken 3074 times.
✓ Branch 410 → 413 taken 70 times.
3144 if (s->above_intra_ctx[col] ||
550
4/4
✓ Branch 411 → 412 taken 2969 times.
✓ Branch 411 → 414 taken 105 times.
✓ Branch 412 → 413 taken 699 times.
✓ Branch 412 → 414 taken 2270 times.
3074 (!s->above_comp_ctx[col] && !s->above_ref_ctx[col])) {
551 769 c = 2;
552
2/2
✓ Branch 414 → 415 taken 105 times.
✓ Branch 414 → 420 taken 2270 times.
2375 } else if (s->above_comp_ctx[col]) {
553
3/4
✓ Branch 415 → 416 taken 105 times.
✗ Branch 415 → 417 not taken.
✓ Branch 416 → 417 taken 16 times.
✓ Branch 416 → 418 taken 89 times.
105 c = 3 * (s->s.h.fixcompref == 1 || s->above_ref_ctx[col] == 1);
554 } else {
555
2/2
✓ Branch 420 → 421 taken 1234 times.
✓ Branch 420 → 422 taken 1036 times.
2270 c = 4 * (s->above_ref_ctx[col] == 1);
556 }
557 }
558
2/2
✓ Branch 424 → 425 taken 4736 times.
✓ Branch 424 → 439 taken 410 times.
5146 } else if (have_l) {
559
2/2
✓ Branch 425 → 426 taken 4579 times.
✓ Branch 425 → 428 taken 157 times.
4736 if (td->left_intra_ctx[row7] ||
560
4/4
✓ Branch 426 → 427 taken 4463 times.
✓ Branch 426 → 429 taken 116 times.
✓ Branch 427 → 428 taken 846 times.
✓ Branch 427 → 429 taken 3617 times.
4579 (!td->left_comp_ctx[row7] && !td->left_ref_ctx[row7])) {
561 1003 c = 2;
562
2/2
✓ Branch 429 → 430 taken 116 times.
✓ Branch 429 → 435 taken 3617 times.
3733 } else if (td->left_comp_ctx[row7]) {
563
3/4
✓ Branch 430 → 431 taken 116 times.
✗ Branch 430 → 432 not taken.
✓ Branch 431 → 432 taken 53 times.
✓ Branch 431 → 433 taken 63 times.
116 c = 3 * (s->s.h.fixcompref == 1 || td->left_ref_ctx[row7] == 1);
564 } else {
565
2/2
✓ Branch 435 → 436 taken 2216 times.
✓ Branch 435 → 437 taken 1401 times.
3617 c = 4 * (td->left_ref_ctx[row7] == 1);
566 }
567 } else {
568 410 c = 2;
569 }
570 101263 bit = vpx_rac_get_prob(td->c, s->prob.p.single_ref[c][1]);
571 101263 td->counts.single_ref[c][1][bit]++;
572 101263 b->ref[0] = 1 + bit;
573 }
574 }
575 }
576
577
2/2
✓ Branch 442 → 443 taken 483035 times.
✓ Branch 442 → 448 taken 50153 times.
533188 if (b->bs <= BS_8x8) {
578
4/4
✓ Branch 443 → 444 taken 214276 times.
✓ Branch 443 → 446 taken 268759 times.
✓ Branch 444 → 445 taken 801 times.
✓ Branch 444 → 446 taken 213475 times.
483035 if (s->s.h.segmentation.enabled && s->s.h.segmentation.feat[b->seg_id].skip_enabled) {
579 801 b->mode[0] =
580 801 b->mode[1] =
581 801 b->mode[2] =
582 801 b->mode[3] = ZEROMV;
583 } else {
584 static const uint8_t off[10] = {
585 3, 0, 0, 1, 0, 0, 0, 0, 0, 0
586 };
587
588 // FIXME this needs to use the LUT tables from find_ref_mvs
589 // because not all are -1,0/0,-1
590 482234 int c = inter_mode_ctx_lut[s->above_mode_ctx[col + off[b->bs]]]
591 482234 [td->left_mode_ctx[row7 + off[b->bs]]];
592
593 964468 b->mode[0] = vp89_rac_get_tree(td->c, ff_vp9_inter_mode_tree,
594 482234 s->prob.p.mv_mode[c]);
595 482234 b->mode[1] =
596 482234 b->mode[2] =
597 482234 b->mode[3] = b->mode[0];
598 482234 td->counts.mv_mode[c][b->mode[0] - 10]++;
599 }
600 }
601
602
2/2
✓ Branch 448 → 449 taken 431656 times.
✓ Branch 448 → 465 taken 101532 times.
533188 if (s->s.h.filtermode == FILTER_SWITCHABLE) {
603 int c;
604
605
4/4
✓ Branch 449 → 450 taken 409442 times.
✓ Branch 449 → 459 taken 22214 times.
✓ Branch 450 → 451 taken 397712 times.
✓ Branch 450 → 459 taken 11730 times.
431656 if (have_a && s->above_mode_ctx[col] >= NEARESTMV) {
606
4/4
✓ Branch 451 → 452 taken 384744 times.
✓ Branch 451 → 457 taken 12968 times.
✓ Branch 452 → 453 taken 375123 times.
✓ Branch 452 → 457 taken 9621 times.
397712 if (have_l && td->left_mode_ctx[row7] >= NEARESTMV) {
607 55209 c = s->above_filter_ctx[col] == td->left_filter_ctx[row7] ?
608
2/2
✓ Branch 453 → 454 taken 319914 times.
✓ Branch 453 → 455 taken 55209 times.
375123 td->left_filter_ctx[row7] : 3;
609 } else {
610 22589 c = s->above_filter_ctx[col];
611 }
612
4/4
✓ Branch 459 → 460 taken 32462 times.
✓ Branch 459 → 462 taken 1482 times.
✓ Branch 460 → 461 taken 29492 times.
✓ Branch 460 → 462 taken 2970 times.
33944 } else if (have_l && td->left_mode_ctx[row7] >= NEARESTMV) {
613 29492 c = td->left_filter_ctx[row7];
614 } else {
615 4452 c = 3;
616 }
617
618 431656 filter_id = vp89_rac_get_tree(td->c, ff_vp9_filter_tree,
619 431656 s->prob.p.filter[c]);
620 431656 td->counts.filter[c][filter_id]++;
621 431656 b->filter = ff_vp9_filter_lut[filter_id];
622 } else {
623 101532 b->filter = s->s.h.filtermode;
624 }
625
626
2/2
✓ Branch 466 → 467 taken 50153 times.
✓ Branch 466 → 481 taken 483035 times.
533188 if (b->bs > BS_8x8) {
627 50153 int c = inter_mode_ctx_lut[s->above_mode_ctx[col]][td->left_mode_ctx[row7]];
628
629 100306 b->mode[0] = vp89_rac_get_tree(td->c, ff_vp9_inter_mode_tree,
630 50153 s->prob.p.mv_mode[c]);
631 50153 td->counts.mv_mode[c][b->mode[0] - 10]++;
632 50153 ff_vp9_fill_mv(td, b->mv[0], b->mode[0], 0);
633
634
2/2
✓ Branch 469 → 470 taken 32766 times.
✓ Branch 469 → 472 taken 17387 times.
50153 if (b->bs != BS_8x4) {
635 65532 b->mode[1] = vp89_rac_get_tree(td->c, ff_vp9_inter_mode_tree,
636 32766 s->prob.p.mv_mode[c]);
637 32766 td->counts.mv_mode[c][b->mode[1] - 10]++;
638 32766 ff_vp9_fill_mv(td, b->mv[1], b->mode[1], 1);
639 } else {
640 17387 b->mode[1] = b->mode[0];
641 17387 AV_COPY32(&b->mv[1][0], &b->mv[0][0]);
642 17387 AV_COPY32(&b->mv[1][1], &b->mv[0][1]);
643 }
644
645
2/2
✓ Branch 473 → 474 taken 34426 times.
✓ Branch 473 → 480 taken 15727 times.
50153 if (b->bs != BS_4x8) {
646 68852 b->mode[2] = vp89_rac_get_tree(td->c, ff_vp9_inter_mode_tree,
647 34426 s->prob.p.mv_mode[c]);
648 34426 td->counts.mv_mode[c][b->mode[2] - 10]++;
649 34426 ff_vp9_fill_mv(td, b->mv[2], b->mode[2], 2);
650
651
2/2
✓ Branch 476 → 477 taken 17039 times.
✓ Branch 476 → 479 taken 17387 times.
34426 if (b->bs != BS_8x4) {
652 34078 b->mode[3] = vp89_rac_get_tree(td->c, ff_vp9_inter_mode_tree,
653 17039 s->prob.p.mv_mode[c]);
654 17039 td->counts.mv_mode[c][b->mode[3] - 10]++;
655 17039 ff_vp9_fill_mv(td, b->mv[3], b->mode[3], 3);
656 } else {
657 17387 b->mode[3] = b->mode[2];
658 17387 AV_COPY32(&b->mv[3][0], &b->mv[2][0]);
659 17387 AV_COPY32(&b->mv[3][1], &b->mv[2][1]);
660 }
661 } else {
662 15727 b->mode[2] = b->mode[0];
663 15727 AV_COPY32(&b->mv[2][0], &b->mv[0][0]);
664 15727 AV_COPY32(&b->mv[2][1], &b->mv[0][1]);
665 15727 b->mode[3] = b->mode[1];
666 15727 AV_COPY32(&b->mv[3][0], &b->mv[1][0]);
667 15727 AV_COPY32(&b->mv[3][1], &b->mv[1][1]);
668 }
669 } else {
670 483035 ff_vp9_fill_mv(td, b->mv[0], b->mode[0], -1);
671 483035 AV_COPY32(&b->mv[1][0], &b->mv[0][0]);
672 483035 AV_COPY32(&b->mv[2][0], &b->mv[0][0]);
673 483035 AV_COPY32(&b->mv[3][0], &b->mv[0][0]);
674 483035 AV_COPY32(&b->mv[1][1], &b->mv[0][1]);
675 483035 AV_COPY32(&b->mv[2][1], &b->mv[0][1]);
676 483035 AV_COPY32(&b->mv[3][1], &b->mv[0][1]);
677 }
678
679
2/2
✓ Branch 483 → 484 taken 27251 times.
✓ Branch 483 → 485 taken 505937 times.
533188 vref = b->ref[b->comp ? s->s.h.signbias[s->s.h.varcompref[0]] : 0];
680 }
681
682 #if HAVE_FAST_64BIT
683 #define SPLAT_CTX(var, val, n) \
684 switch (n) { \
685 case 1: var = val; break; \
686 case 2: AV_WN16A(&var, val * 0x0101); break; \
687 case 4: AV_WN32A(&var, val * 0x01010101); break; \
688 case 8: AV_WN64A(&var, val * 0x0101010101010101ULL); break; \
689 case 16: { \
690 uint64_t v64 = val * 0x0101010101010101ULL; \
691 AV_WN64A( &var, v64); \
692 AV_WN64A(&((uint8_t *) &var)[8], v64); \
693 break; \
694 } \
695 }
696 #else
697 #define SPLAT_CTX(var, val, n) \
698 switch (n) { \
699 case 1: var = val; break; \
700 case 2: AV_WN16A(&var, val * 0x0101); break; \
701 case 4: AV_WN32A(&var, val * 0x01010101); break; \
702 case 8: { \
703 uint32_t v32 = val * 0x01010101; \
704 AV_WN32A( &var, v32); \
705 AV_WN32A(&((uint8_t *) &var)[4], v32); \
706 break; \
707 } \
708 case 16: { \
709 uint32_t v32 = val * 0x01010101; \
710 AV_WN32A( &var, v32); \
711 AV_WN32A(&((uint8_t *) &var)[4], v32); \
712 AV_WN32A(&((uint8_t *) &var)[8], v32); \
713 AV_WN32A(&((uint8_t *) &var)[12], v32); \
714 break; \
715 } \
716 }
717 #endif
718
719
4/5
✓ Branch 487 → 488 taken 544725 times.
✓ Branch 487 → 501 taken 215103 times.
✓ Branch 487 → 514 taken 46334 times.
✓ Branch 487 → 527 taken 14596 times.
✗ Branch 487 → 540 not taken.
820758 switch (ff_vp9_bwh_tab[1][b->bs][0]) {
720 #define SET_CTXS(perf, dir, off, n) \
721 do { \
722 SPLAT_CTX(perf->dir##_skip_ctx[off], b->skip, n); \
723 SPLAT_CTX(perf->dir##_txfm_ctx[off], b->tx, n); \
724 SPLAT_CTX(perf->dir##_partition_ctx[off], dir##_ctx[b->bs], n); \
725 if (!s->s.h.keyframe && !s->s.h.intraonly) { \
726 SPLAT_CTX(perf->dir##_intra_ctx[off], b->intra, n); \
727 SPLAT_CTX(perf->dir##_comp_ctx[off], b->comp, n); \
728 SPLAT_CTX(perf->dir##_mode_ctx[off], b->mode[3], n); \
729 if (!b->intra) { \
730 SPLAT_CTX(perf->dir##_ref_ctx[off], vref, n); \
731 if (s->s.h.filtermode == FILTER_SWITCHABLE) { \
732 SPLAT_CTX(perf->dir##_filter_ctx[off], filter_id, n); \
733 } \
734 } \
735 } \
736 } while (0)
737
7/8
✓ Branch 491 → 492 taken 359812 times.
✓ Branch 491 → 500 taken 184913 times.
✓ Branch 492 → 493 taken 359812 times.
✗ Branch 492 → 500 not taken.
✓ Branch 496 → 497 taken 335457 times.
✓ Branch 496 → 500 taken 24355 times.
✓ Branch 498 → 499 taken 278211 times.
✓ Branch 498 → 500 taken 57246 times.
544725 case 1: SET_CTXS(s, above, col, 1); break;
738
8/8
✓ Branch 504 → 505 taken 160580 times.
✓ Branch 504 → 513 taken 54523 times.
✓ Branch 505 → 506 taken 158204 times.
✓ Branch 505 → 513 taken 2376 times.
✓ Branch 509 → 510 taken 150989 times.
✓ Branch 509 → 513 taken 7215 times.
✓ Branch 511 → 512 taken 123493 times.
✓ Branch 511 → 513 taken 27496 times.
215103 case 2: SET_CTXS(s, above, col, 2); break;
739
7/8
✓ Branch 517 → 518 taken 36364 times.
✓ Branch 517 → 526 taken 9970 times.
✓ Branch 518 → 519 taken 36364 times.
✗ Branch 518 → 526 not taken.
✓ Branch 522 → 523 taken 35466 times.
✓ Branch 522 → 526 taken 898 times.
✓ Branch 524 → 525 taken 24140 times.
✓ Branch 524 → 526 taken 11326 times.
46334 case 4: SET_CTXS(s, above, col, 4); break;
740
7/8
✓ Branch 530 → 531 taken 11334 times.
✓ Branch 530 → 539 taken 3262 times.
✓ Branch 531 → 532 taken 11334 times.
✗ Branch 531 → 539 not taken.
✓ Branch 535 → 536 taken 11276 times.
✓ Branch 535 → 539 taken 58 times.
✓ Branch 537 → 538 taken 5812 times.
✓ Branch 537 → 539 taken 5464 times.
14596 case 8: SET_CTXS(s, above, col, 8); break;
741 }
742
4/5
✓ Branch 540 → 541 taken 556317 times.
✓ Branch 540 → 554 taken 206374 times.
✓ Branch 540 → 567 taken 44391 times.
✓ Branch 540 → 580 taken 13676 times.
✗ Branch 540 → 593 not taken.
820758 switch (ff_vp9_bwh_tab[1][b->bs][1]) {
743
7/8
✓ Branch 544 → 545 taken 362514 times.
✓ Branch 544 → 553 taken 193803 times.
✓ Branch 545 → 546 taken 362514 times.
✗ Branch 545 → 553 not taken.
✓ Branch 549 → 550 taken 338685 times.
✓ Branch 549 → 553 taken 23829 times.
✓ Branch 551 → 552 taken 280926 times.
✓ Branch 551 → 553 taken 57759 times.
556317 case 1: SET_CTXS(td, left, row7, 1); break;
744
8/8
✓ Branch 557 → 558 taken 159315 times.
✓ Branch 557 → 566 taken 47059 times.
✓ Branch 558 → 559 taken 156939 times.
✓ Branch 558 → 566 taken 2376 times.
✓ Branch 562 → 563 taken 149260 times.
✓ Branch 562 → 566 taken 7679 times.
✓ Branch 564 → 565 taken 122136 times.
✓ Branch 564 → 566 taken 27124 times.
206374 case 2: SET_CTXS(td, left, row7, 2); break;
745
7/8
✓ Branch 570 → 571 taken 35618 times.
✓ Branch 570 → 579 taken 8773 times.
✓ Branch 571 → 572 taken 35618 times.
✗ Branch 571 → 579 not taken.
✓ Branch 575 → 576 taken 34651 times.
✓ Branch 575 → 579 taken 967 times.
✓ Branch 577 → 578 taken 23574 times.
✓ Branch 577 → 579 taken 11077 times.
44391 case 4: SET_CTXS(td, left, row7, 4); break;
746
7/8
✓ Branch 583 → 584 taken 10643 times.
✓ Branch 583 → 592 taken 3033 times.
✓ Branch 584 → 585 taken 10643 times.
✗ Branch 584 → 592 not taken.
✓ Branch 588 → 589 taken 10592 times.
✓ Branch 588 → 592 taken 51 times.
✓ Branch 590 → 591 taken 5020 times.
✓ Branch 590 → 592 taken 5572 times.
13676 case 8: SET_CTXS(td, left, row7, 8); break;
747 }
748 #undef SPLAT_CTX
749 #undef SET_CTXS
750
751
4/4
✓ Branch 593 → 594 taken 568090 times.
✓ Branch 593 → 603 taken 252668 times.
✓ Branch 594 → 595 taken 565714 times.
✓ Branch 594 → 603 taken 2376 times.
820758 if (!s->s.h.keyframe && !s->s.h.intraonly) {
752
2/2
✓ Branch 595 → 596 taken 51852 times.
✓ Branch 595 → 597 taken 513862 times.
565714 if (b->bs > BS_8x8) {
753 51852 int mv0 = AV_RN32A(&b->mv[3][0]), mv1 = AV_RN32A(&b->mv[3][1]);
754
755 51852 AV_COPY32(&td->left_mv_ctx[row7 * 2 + 0][0], &b->mv[1][0]);
756 51852 AV_COPY32(&td->left_mv_ctx[row7 * 2 + 0][1], &b->mv[1][1]);
757 51852 AV_WN32A(&td->left_mv_ctx[row7 * 2 + 1][0], mv0);
758 51852 AV_WN32A(&td->left_mv_ctx[row7 * 2 + 1][1], mv1);
759 51852 AV_COPY32(&s->above_mv_ctx[col * 2 + 0][0], &b->mv[2][0]);
760 51852 AV_COPY32(&s->above_mv_ctx[col * 2 + 0][1], &b->mv[2][1]);
761 51852 AV_WN32A(&s->above_mv_ctx[col * 2 + 1][0], mv0);
762 51852 AV_WN32A(&s->above_mv_ctx[col * 2 + 1][1], mv1);
763 } else {
764 513862 int n, mv0 = AV_RN32A(&b->mv[3][0]), mv1 = AV_RN32A(&b->mv[3][1]);
765
766
2/2
✓ Branch 599 → 598 taken 1720190 times.
✓ Branch 599 → 600 taken 513862 times.
2234052 for (n = 0; n < w4 * 2; n++) {
767 1720190 AV_WN32A(&s->above_mv_ctx[col * 2 + n][0], mv0);
768 1720190 AV_WN32A(&s->above_mv_ctx[col * 2 + n][1], mv1);
769 }
770
2/2
✓ Branch 602 → 601 taken 1699918 times.
✓ Branch 602 → 603 taken 513862 times.
2213780 for (n = 0; n < h4 * 2; n++) {
771 1699918 AV_WN32A(&td->left_mv_ctx[row7 * 2 + n][0], mv0);
772 1699918 AV_WN32A(&td->left_mv_ctx[row7 * 2 + n][1], mv1);
773 }
774 }
775 }
776
777 // FIXME kinda ugly
778
2/2
✓ Branch 616 → 604 taken 1253144 times.
✓ Branch 616 → 617 taken 820758 times.
2073902 for (y = 0; y < h4; y++) {
779 1253144 int x, o = (row + y) * s->sb_cols * 8 + col;
780 1253144 VP9mvrefPair *mv = &s->s.frames[CUR_FRAME].mv[o];
781
782
2/2
✓ Branch 604 → 605 taken 394728 times.
✓ Branch 604 → 608 taken 858416 times.
1253144 if (b->intra) {
783
2/2
✓ Branch 607 → 606 taken 789471 times.
✓ Branch 607 → 615 taken 394728 times.
1184199 for (x = 0; x < w4; x++) {
784 789471 mv[x].ref[0] =
785 789471 mv[x].ref[1] = -1;
786 }
787
2/2
✓ Branch 608 → 609 taken 52951 times.
✓ Branch 608 → 612 taken 805465 times.
858416 } else if (b->comp) {
788
2/2
✓ Branch 611 → 610 taken 153979 times.
✓ Branch 611 → 615 taken 52951 times.
206930 for (x = 0; x < w4; x++) {
789 153979 mv[x].ref[0] = b->ref[0];
790 153979 mv[x].ref[1] = b->ref[1];
791 153979 AV_COPY32(&mv[x].mv[0], &b->mv[3][0]);
792 153979 AV_COPY32(&mv[x].mv[1], &b->mv[3][1]);
793 }
794 } else {
795
2/2
✓ Branch 614 → 613 taken 1962154 times.
✓ Branch 614 → 615 taken 805465 times.
2767619 for (x = 0; x < w4; x++) {
796 1962154 mv[x].ref[0] = b->ref[0];
797 1962154 mv[x].ref[1] = -1;
798 1962154 AV_COPY32(&mv[x].mv[0], &b->mv[3][0]);
799 }
800 }
801 }
802 820758 }
803
804 // FIXME merge cnt/eob arguments?
805 static av_always_inline int
806 2087925 decode_coeffs_b_generic(VPXRangeCoder *c, int16_t *coef, int n_coeffs,
807 int is_tx32x32, int is8bitsperpixel, int bpp, unsigned (*cnt)[6][3],
808 unsigned (*eob)[6][2], const uint8_t (*p)[6][11],
809 int nnz, const int16_t *scan, const int16_t (*nb)[2],
810 const int16_t *band_counts, const int16_t *qmul)
811 {
812 2087925 int i = 0, band = 0, band_left = band_counts[band];
813 2087925 const uint8_t *tp = p[0][nnz];
814 uint8_t cache[1024];
815
816 do {
817 int val, rc;
818
819 11228859 val = vpx_rac_get_prob_branchy(c, tp[0]); // eob
820 11228859 eob[band][nnz][val]++;
821
2/2
✓ Branch 4 → 5 taken 9202778 times.
✓ Branch 4 → 7 taken 2026081 times.
11228859 if (!val)
822 2026081 break;
823
824 9202778 skip_eob:
825
2/2
✓ Branch 9 → 10 taken 9239340 times.
✓ Branch 9 → 15 taken 9202778 times.
18442118 if (!vpx_rac_get_prob_branchy(c, tp[1])) { // zero
826 9239340 cnt[band][nnz][0]++;
827
2/2
✓ Branch 10 → 11 taken 1237943 times.
✓ Branch 10 → 12 taken 8001397 times.
9239340 if (!--band_left)
828 1237943 band_left = band_counts[++band];
829 9239340 cache[scan[i]] = 0;
830 9239340 nnz = (1 + cache[nb[i][0]] + cache[nb[i][1]]) >> 1;
831 9239340 tp = p[band][nnz];
832
1/2
✗ Branch 12 → 13 not taken.
✓ Branch 12 → 14 taken 9239340 times.
9239340 if (++i == n_coeffs)
833 ✗ break; //invalid input; blocks should end with EOB
834 9239340 goto skip_eob;
835 }
836
837 9202778 rc = scan[i];
838
2/2
✓ Branch 16 → 17 taken 5231285 times.
✓ Branch 16 → 18 taken 3971493 times.
9202778 if (!vpx_rac_get_prob_branchy(c, tp[2])) { // one
839 5231285 cnt[band][nnz][1]++;
840 5231285 val = 1;
841 5231285 cache[rc] = 1;
842 } else {
843 3971493 cnt[band][nnz][2]++;
844
2/2
✓ Branch 19 → 20 taken 2620467 times.
✓ Branch 19 → 25 taken 1351026 times.
3971493 if (!vpx_rac_get_prob_branchy(c, tp[3])) { // 2, 3, 4
845
2/2
✓ Branch 21 → 22 taken 1493404 times.
✓ Branch 21 → 23 taken 1127063 times.
2620467 if (!vpx_rac_get_prob_branchy(c, tp[4])) {
846 1493404 cache[rc] = val = 2;
847 } else {
848 1127063 val = 3 + vpx_rac_get_prob(c, tp[5]);
849 1127063 cache[rc] = 3;
850 }
851
2/2
✓ Branch 26 → 27 taken 847548 times.
✓ Branch 26 → 34 taken 503478 times.
1351026 } else if (!vpx_rac_get_prob_branchy(c, tp[6])) { // cat1/2
852 847548 cache[rc] = 4;
853
2/2
✓ Branch 28 → 29 taken 453019 times.
✓ Branch 28 → 31 taken 394529 times.
847548 if (!vpx_rac_get_prob_branchy(c, tp[7])) {
854 453019 val = vpx_rac_get_prob(c, 159) + 5;
855 } else {
856 394529 val = (vpx_rac_get_prob(c, 165) << 1) + 7;
857 394529 val += vpx_rac_get_prob(c, 145);
858 }
859 } else { // cat 3-6
860 503478 cache[rc] = 5;
861
2/2
✓ Branch 35 → 36 taken 417832 times.
✓ Branch 35 → 47 taken 85646 times.
503478 if (!vpx_rac_get_prob_branchy(c, tp[8])) {
862
2/2
✓ Branch 37 → 38 taken 269447 times.
✓ Branch 37 → 42 taken 148385 times.
417832 if (!vpx_rac_get_prob_branchy(c, tp[9])) {
863 269447 val = 11 + (vpx_rac_get_prob(c, 173) << 2);
864 269447 val += (vpx_rac_get_prob(c, 148) << 1);
865 269447 val += vpx_rac_get_prob(c, 140);
866 } else {
867 148385 val = 19 + (vpx_rac_get_prob(c, 176) << 3);
868 148385 val += (vpx_rac_get_prob(c, 155) << 2);
869 148385 val += (vpx_rac_get_prob(c, 140) << 1);
870 148385 val += vpx_rac_get_prob(c, 135);
871 }
872
2/2
✓ Branch 48 → 49 taken 62360 times.
✓ Branch 48 → 55 taken 23286 times.
85646 } else if (!vpx_rac_get_prob_branchy(c, tp[10])) {
873 62360 val = (vpx_rac_get_prob(c, 180) << 4) + 35;
874 62360 val += (vpx_rac_get_prob(c, 157) << 3);
875 62360 val += (vpx_rac_get_prob(c, 141) << 2);
876 62360 val += (vpx_rac_get_prob(c, 134) << 1);
877 62360 val += vpx_rac_get_prob(c, 130);
878 } else {
879 23286 val = 67;
880
2/2
✓ Branch 55 → 56 taken 81 times.
✓ Branch 55 → 63 taken 23205 times.
23286 if (!is8bitsperpixel) {
881
2/2
✓ Branch 56 → 57 taken 60 times.
✓ Branch 56 → 60 taken 21 times.
81 if (bpp == 12) {
882 60 val += vpx_rac_get_prob(c, 255) << 17;
883 60 val += vpx_rac_get_prob(c, 255) << 16;
884 }
885 81 val += (vpx_rac_get_prob(c, 255) << 15);
886 81 val += (vpx_rac_get_prob(c, 255) << 14);
887 }
888 23286 val += (vpx_rac_get_prob(c, 254) << 13);
889 23286 val += (vpx_rac_get_prob(c, 254) << 12);
890 23286 val += (vpx_rac_get_prob(c, 254) << 11);
891 23286 val += (vpx_rac_get_prob(c, 252) << 10);
892 23286 val += (vpx_rac_get_prob(c, 249) << 9);
893 23286 val += (vpx_rac_get_prob(c, 243) << 8);
894 23286 val += (vpx_rac_get_prob(c, 230) << 7);
895 23286 val += (vpx_rac_get_prob(c, 196) << 6);
896 23286 val += (vpx_rac_get_prob(c, 177) << 5);
897 23286 val += (vpx_rac_get_prob(c, 153) << 4);
898 23286 val += (vpx_rac_get_prob(c, 140) << 3);
899 23286 val += (vpx_rac_get_prob(c, 133) << 2);
900 23286 val += (vpx_rac_get_prob(c, 130) << 1);
901 23286 val += vpx_rac_get_prob(c, 129);
902 }
903 }
904 }
905 #define STORE_COEF(c, i, v) do { \
906 if (is8bitsperpixel) { \
907 c[i] = v; \
908 } else { \
909 AV_WN32A(&c[i * 2], v); \
910 } \
911 } while (0)
912
2/2
✓ Branch 78 → 79 taken 2256565 times.
✓ Branch 78 → 80 taken 6946213 times.
9202778 if (!--band_left)
913 2256565 band_left = band_counts[++band];
914
2/2
✓ Branch 80 → 81 taken 1386395 times.
✓ Branch 80 → 98 taken 7816383 times.
9202778 if (is_tx32x32)
915
10/10
✓ Branch 81 → 82 taken 1311659 times.
✓ Branch 81 → 90 taken 74736 times.
✓ Branch 83 → 84 taken 663080 times.
✓ Branch 83 → 85 taken 648579 times.
✓ Branch 86 → 87 taken 1300117 times.
✓ Branch 86 → 88 taken 11542 times.
✓ Branch 91 → 92 taken 36700 times.
✓ Branch 91 → 93 taken 38036 times.
✓ Branch 94 → 95 taken 73342 times.
✓ Branch 94 → 96 taken 1394 times.
1386395 STORE_COEF(coef, rc, (int)((vp89_rac_get(c) ? -val : val) * (unsigned)qmul[!!i]) / 2);
916 else
917
10/10
✓ Branch 98 → 99 taken 7218124 times.
✓ Branch 98 → 107 taken 598259 times.
✓ Branch 100 → 101 taken 3619184 times.
✓ Branch 100 → 102 taken 3598940 times.
✓ Branch 103 → 104 taken 6407616 times.
✓ Branch 103 → 105 taken 810508 times.
✓ Branch 108 → 109 taken 303609 times.
✓ Branch 108 → 110 taken 294650 times.
✓ Branch 111 → 112 taken 533640 times.
✓ Branch 111 → 113 taken 64619 times.
7816383 STORE_COEF(coef, rc, (vp89_rac_get(c) ? -val : val) * (unsigned)qmul[!!i]);
918 9202778 nnz = (1 + cache[nb[i][0]] + cache[nb[i][1]]) >> 1;
919 9202778 tp = p[band][nnz];
920
2/2
✓ Branch 115 → 116 taken 9140934 times.
✓ Branch 115 → 117 taken 61844 times.
9202778 } while (++i < n_coeffs);
921
922 2087925 return i;
923 }
924
925 1908412 static int decode_coeffs_b_8bpp(VP9TileData *td, int16_t *coef, int n_coeffs,
926 unsigned (*cnt)[6][3], unsigned (*eob)[6][2],
927 const uint8_t (*p)[6][11], int nnz, const int16_t *scan,
928 const int16_t (*nb)[2], const int16_t *band_counts,
929 const int16_t *qmul)
930 {
931 1908412 return decode_coeffs_b_generic(td->c, coef, n_coeffs, 0, 1, 8, cnt, eob, p,
932 nnz, scan, nb, band_counts, qmul);
933 }
934
935 13732 static int decode_coeffs_b32_8bpp(VP9TileData *td, int16_t *coef, int n_coeffs,
936 unsigned (*cnt)[6][3], unsigned (*eob)[6][2],
937 const uint8_t (*p)[6][11], int nnz, const int16_t *scan,
938 const int16_t (*nb)[2], const int16_t *band_counts,
939 const int16_t *qmul)
940 {
941 13732 return decode_coeffs_b_generic(td->c, coef, n_coeffs, 1, 1, 8, cnt, eob, p,
942 nnz, scan, nb, band_counts, qmul);
943 }
944
945 163494 static int decode_coeffs_b_16bpp(VP9TileData *td, int16_t *coef, int n_coeffs,
946 unsigned (*cnt)[6][3], unsigned (*eob)[6][2],
947 const uint8_t (*p)[6][11], int nnz, const int16_t *scan,
948 const int16_t (*nb)[2], const int16_t *band_counts,
949 const int16_t *qmul)
950 {
951 163494 return decode_coeffs_b_generic(td->c, coef, n_coeffs, 0, 0, td->s->s.h.bpp, cnt, eob, p,
952 nnz, scan, nb, band_counts, qmul);
953 }
954
955 2287 static int decode_coeffs_b32_16bpp(VP9TileData *td, int16_t *coef, int n_coeffs,
956 unsigned (*cnt)[6][3], unsigned (*eob)[6][2],
957 const uint8_t (*p)[6][11], int nnz, const int16_t *scan,
958 const int16_t (*nb)[2], const int16_t *band_counts,
959 const int16_t *qmul)
960 {
961 2287 return decode_coeffs_b_generic(td->c, coef, n_coeffs, 1, 0, td->s->s.h.bpp, cnt, eob, p,
962 nnz, scan, nb, band_counts, qmul);
963 }
964
965 385016 static av_always_inline int decode_coeffs(VP9TileData *td, int is8bitsperpixel)
966 {
967 385016 const VP9Context *s = td->s;
968 385016 VP9Block *b = td->b;
969 385016 int row = td->row, col = td->col;
970 385016 const uint8_t (*p)[6][11] = s->prob.coef[b->tx][0 /* y */][!b->intra];
971 385016 unsigned (*c)[6][3] = td->counts.coef[b->tx][0 /* y */][!b->intra];
972 385016 unsigned (*e)[6][2] = td->counts.eob[b->tx][0 /* y */][!b->intra];
973 385016 int w4 = ff_vp9_bwh_tab[1][b->bs][0] << 1, h4 = ff_vp9_bwh_tab[1][b->bs][1] << 1;
974 385016 int end_x = FFMIN(2 * (s->cols - col), w4);
975 385016 int end_y = FFMIN(2 * (s->rows - row), h4);
976 int n, pl, x, y, ret;
977 385016 const int16_t (*qmul)[2] = s->s.h.segmentation.feat[b->seg_id].qmul;
978 385016 int tx = 4 * s->s.h.lossless + b->tx;
979 385016 const int16_t * const *yscans = ff_vp9_scans[tx];
980 385016 const int16_t (* const * ynbs)[2] = ff_vp9_scans_nb[tx];
981 385016 const int16_t *uvscan = ff_vp9_scans[b->uvtx][DCT_DCT];
982 385016 const int16_t (*uvnb)[2] = ff_vp9_scans_nb[b->uvtx][DCT_DCT];
983 385016 uint8_t *a = &s->above_y_nnz_ctx[col * 2];
984 385016 uint8_t *l = &td->left_y_nnz_ctx[(row & 7) << 1];
985 static const int16_t band_counts[4][8] = {
986 { 1, 2, 3, 4, 3, 16 - 13 },
987 { 1, 2, 3, 4, 11, 64 - 21 },
988 { 1, 2, 3, 4, 11, 256 - 21 },
989 { 1, 2, 3, 4, 11, 1024 - 21 },
990 };
991 385016 const int16_t *y_band_counts = band_counts[b->tx];
992 385016 const int16_t *uv_band_counts = band_counts[b->uvtx];
993
2/2
✓ Branch 2 → 3 taken 359489 times.
✓ Branch 2 → 4 taken 25527 times.
385016 int bytesperpixel = is8bitsperpixel ? 1 : 2;
994 385016 int total_coeff = 0;
995
996 #define MERGE(la, end, step, rd) \
997 for (n = 0; n < end; n += step) \
998 la[n] = !!rd(&la[n])
999 #define MERGE_CTX(step, rd) \
1000 do { \
1001 MERGE(l, end_y, step, rd); \
1002 MERGE(a, end_x, step, rd); \
1003 } while (0)
1004
1005 #define DECODE_Y_COEF_LOOP(step, mode_index, v) \
1006 for (n = 0, y = 0; y < end_y; y += step) { \
1007 for (x = 0; x < end_x; x += step, n += step * step) { \
1008 enum TxfmType txtp = ff_vp9_intra_txfm_type[b->mode[mode_index]]; \
1009 ret = (is8bitsperpixel ? decode_coeffs_b##v##_8bpp : decode_coeffs_b##v##_16bpp) \
1010 (td, td->block + 16 * n * bytesperpixel, 16 * step * step, \
1011 c, e, p, a[x] + l[y], yscans[txtp], \
1012 ynbs[txtp], y_band_counts, qmul[0]); \
1013 a[x] = l[y] = !!ret; \
1014 total_coeff |= !!ret; \
1015 if (step >= 4) { \
1016 AV_WN16A(&td->eob[n], ret); \
1017 } else { \
1018 td->eob[n] = ret; \
1019 } \
1020 } \
1021 }
1022
1023 #define SPLAT(la, end, step, cond) \
1024 if (step == 2) { \
1025 for (n = 1; n < end; n += step) \
1026 la[n] = la[n - 1]; \
1027 } else if (step == 4) { \
1028 if (cond) { \
1029 for (n = 0; n < end; n += step) \
1030 AV_WN32A(&la[n], la[n] * 0x01010101); \
1031 } else { \
1032 for (n = 0; n < end; n += step) \
1033 memset(&la[n + 1], la[n], FFMIN(end - n - 1, 3)); \
1034 } \
1035 } else /* step == 8 */ { \
1036 if (cond) { \
1037 if (HAVE_FAST_64BIT) { \
1038 for (n = 0; n < end; n += step) \
1039 AV_WN64A(&la[n], la[n] * 0x0101010101010101ULL); \
1040 } else { \
1041 for (n = 0; n < end; n += step) { \
1042 uint32_t v32 = la[n] * 0x01010101; \
1043 AV_WN32A(&la[n], v32); \
1044 AV_WN32A(&la[n + 4], v32); \
1045 } \
1046 } \
1047 } else { \
1048 for (n = 0; n < end; n += step) \
1049 memset(&la[n + 1], la[n], FFMIN(end - n - 1, 7)); \
1050 } \
1051 }
1052 #define SPLAT_CTX(step) \
1053 do { \
1054 SPLAT(a, end_x, step, end_x == w4); \
1055 SPLAT(l, end_y, step, end_y == h4); \
1056 } while (0)
1057
1058 /* y tokens */
1059
4/5
✓ Branch 5 → 6 taken 184949 times.
✓ Branch 5 → 20 taken 147208 times.
✓ Branch 5 → 43 taken 43195 times.
✓ Branch 5 → 74 taken 9664 times.
✗ Branch 5 → 105 not taken.
385016 switch (b->tx) {
1060 184949 case TX_4X4:
1061
8/8
✓ Branch 8 → 9 taken 489540 times.
✓ Branch 8 → 10 taken 354928 times.
✓ Branch 11 → 12 taken 788752 times.
✓ Branch 11 → 13 taken 55716 times.
✓ Branch 16 → 8 taken 844468 times.
✓ Branch 16 → 17 taken 389640 times.
✓ Branch 18 → 7 taken 389640 times.
✓ Branch 18 → 19 taken 184949 times.
1419057 DECODE_Y_COEF_LOOP(1, b->bs > BS_8x8 ? n : 0,);
1062 184949 break;
1063 147208 case TX_8X8:
1064
4/4
✓ Branch 22 → 21 taken 175540 times.
✓ Branch 22 → 23 taken 147208 times.
✓ Branch 25 → 24 taken 179943 times.
✓ Branch 25 → 26 taken 147208 times.
502691 MERGE_CTX(2, AV_RN16A);
1065
6/6
✓ Branch 28 → 29 taken 232121 times.
✓ Branch 28 → 30 taken 15414 times.
✓ Branch 33 → 28 taken 247535 times.
✓ Branch 33 → 34 taken 175540 times.
✓ Branch 35 → 27 taken 175540 times.
✓ Branch 35 → 36 taken 147208 times.
570283 DECODE_Y_COEF_LOOP(2, 0,);
1066
4/4
✓ Branch 38 → 37 taken 179943 times.
✓ Branch 38 → 39 taken 147208 times.
✓ Branch 41 → 40 taken 175540 times.
✓ Branch 41 → 42 taken 147208 times.
502691 SPLAT_CTX(2);
1067 147208 break;
1068 43195 case TX_16X16:
1069
4/4
✓ Branch 45 → 44 taken 45438 times.
✓ Branch 45 → 46 taken 43195 times.
✓ Branch 48 → 47 taken 45879 times.
✓ Branch 48 → 49 taken 43195 times.
134512 MERGE_CTX(4, AV_RN32A);
1070
6/6
✓ Branch 51 → 52 taken 46441 times.
✓ Branch 51 → 53 taken 2742 times.
✓ Branch 56 → 51 taken 49183 times.
✓ Branch 56 → 57 taken 45438 times.
✓ Branch 58 → 50 taken 45438 times.
✓ Branch 58 → 59 taken 43195 times.
137816 DECODE_Y_COEF_LOOP(4, 0,);
1071
12/12
✓ Branch 59 → 60 taken 43181 times.
✓ Branch 59 → 63 taken 14 times.
✓ Branch 62 → 61 taken 45865 times.
✓ Branch 62 → 66 taken 43181 times.
✓ Branch 65 → 64 taken 14 times.
✓ Branch 65 → 66 taken 14 times.
✓ Branch 66 → 67 taken 43138 times.
✓ Branch 66 → 70 taken 57 times.
✓ Branch 69 → 68 taken 45380 times.
✓ Branch 69 → 73 taken 43138 times.
✓ Branch 72 → 71 taken 58 times.
✓ Branch 72 → 73 taken 57 times.
134512 SPLAT_CTX(4);
1072 43195 break;
1073 9664 case TX_32X32:
1074
4/4
✓ Branch 76 → 75 taken 10968 times.
✓ Branch 76 → 77 taken 9664 times.
✓ Branch 79 → 78 taken 11124 times.
✓ Branch 79 → 80 taken 9664 times.
31756 MERGE_CTX(8, AV_RN64A);
1075
6/6
✓ Branch 82 → 83 taken 11758 times.
✓ Branch 82 → 84 taken 1785 times.
✓ Branch 87 → 82 taken 13543 times.
✓ Branch 87 → 88 taken 10968 times.
✓ Branch 89 → 81 taken 10968 times.
✓ Branch 89 → 90 taken 9664 times.
34175 DECODE_Y_COEF_LOOP(8, 0, 32);
1076
12/12
✓ Branch 90 → 91 taken 9656 times.
✓ Branch 90 → 94 taken 8 times.
✓ Branch 93 → 92 taken 11116 times.
✓ Branch 93 → 97 taken 9656 times.
✓ Branch 96 → 95 taken 8 times.
✓ Branch 96 → 97 taken 8 times.
✓ Branch 97 → 98 taken 9568 times.
✓ Branch 97 → 101 taken 96 times.
✓ Branch 100 → 99 taken 10870 times.
✓ Branch 100 → 104 taken 9568 times.
✓ Branch 103 → 102 taken 98 times.
✓ Branch 103 → 104 taken 96 times.
31756 SPLAT_CTX(8);
1077 9664 break;
1078 }
1079
1080 #define DECODE_UV_COEF_LOOP(step, v) \
1081 for (n = 0, y = 0; y < end_y; y += step) { \
1082 for (x = 0; x < end_x; x += step, n += step * step) { \
1083 ret = (is8bitsperpixel ? decode_coeffs_b##v##_8bpp : decode_coeffs_b##v##_16bpp) \
1084 (td, td->uvblock[pl] + 16 * n * bytesperpixel, \
1085 16 * step * step, c, e, p, a[x] + l[y], \
1086 uvscan, uvnb, uv_band_counts, qmul[1]); \
1087 a[x] = l[y] = !!ret; \
1088 total_coeff |= !!ret; \
1089 if (step >= 4) { \
1090 AV_WN16A(&td->uveob[pl][n], ret); \
1091 } else { \
1092 td->uveob[pl][n] = ret; \
1093 } \
1094 } \
1095 }
1096
1097 385016 p = s->prob.coef[b->uvtx][1 /* uv */][!b->intra];
1098 385016 c = td->counts.coef[b->uvtx][1 /* uv */][!b->intra];
1099 385016 e = td->counts.eob[b->uvtx][1 /* uv */][!b->intra];
1100 385016 w4 >>= s->ss_h;
1101 385016 end_x >>= s->ss_h;
1102 385016 h4 >>= s->ss_v;
1103 385016 end_y >>= s->ss_v;
1104
2/2
✓ Branch 204 → 106 taken 770032 times.
✓ Branch 204 → 205 taken 385016 times.
1155048 for (pl = 0; pl < 2; pl++) {
1105 770032 a = &s->above_uv_nnz_ctx[pl][col << !s->ss_h];
1106 770032 l = &td->left_uv_nnz_ctx[pl][(row & 7) << !s->ss_v];
1107
4/5
✓ Branch 106 → 107 taken 630862 times.
✓ Branch 106 → 118 taken 116766 times.
✓ Branch 106 → 141 taken 19956 times.
✓ Branch 106 → 172 taken 2448 times.
✗ Branch 106 → 203 not taken.
770032 switch (b->uvtx) {
1108 630862 case TX_4X4:
1109
6/6
✓ Branch 109 → 110 taken 688158 times.
✓ Branch 109 → 111 taken 78208 times.
✓ Branch 114 → 109 taken 766366 times.
✓ Branch 114 → 115 taken 681636 times.
✓ Branch 116 → 108 taken 681636 times.
✓ Branch 116 → 117 taken 630862 times.
2078864 DECODE_UV_COEF_LOOP(1,);
1110 630862 break;
1111 116766 case TX_8X8:
1112
4/4
✓ Branch 120 → 119 taken 124976 times.
✓ Branch 120 → 121 taken 116766 times.
✓ Branch 123 → 122 taken 126458 times.
✓ Branch 123 → 124 taken 116766 times.
368200 MERGE_CTX(2, AV_RN16A);
1113
6/6
✓ Branch 126 → 127 taken 133552 times.
✓ Branch 126 → 128 taken 9396 times.
✓ Branch 131 → 126 taken 142948 times.
✓ Branch 131 → 132 taken 124976 times.
✓ Branch 133 → 125 taken 124976 times.
✓ Branch 133 → 134 taken 116766 times.
384690 DECODE_UV_COEF_LOOP(2,);
1114
4/4
✓ Branch 136 → 135 taken 126382 times.
✓ Branch 136 → 137 taken 116766 times.
✓ Branch 139 → 138 taken 124716 times.
✓ Branch 139 → 140 taken 116766 times.
367864 SPLAT_CTX(2);
1115 116766 break;
1116 19956 case TX_16X16:
1117
4/4
✓ Branch 143 → 142 taken 20428 times.
✓ Branch 143 → 144 taken 19956 times.
✓ Branch 146 → 145 taken 20904 times.
✓ Branch 146 → 147 taken 19956 times.
61288 MERGE_CTX(4, AV_RN32A);
1118
6/6
✓ Branch 149 → 150 taken 19388 times.
✓ Branch 149 → 151 taken 2018 times.
✓ Branch 154 → 149 taken 21406 times.
✓ Branch 154 → 155 taken 20428 times.
✓ Branch 156 → 148 taken 20428 times.
✓ Branch 156 → 157 taken 19956 times.
61790 DECODE_UV_COEF_LOOP(4,);
1119
12/12
✓ Branch 157 → 158 taken 19940 times.
✓ Branch 157 → 161 taken 16 times.
✓ Branch 160 → 159 taken 20888 times.
✓ Branch 160 → 164 taken 19940 times.
✓ Branch 163 → 162 taken 16 times.
✓ Branch 163 → 164 taken 16 times.
✓ Branch 164 → 165 taken 19746 times.
✓ Branch 164 → 168 taken 210 times.
✓ Branch 167 → 166 taken 20218 times.
✓ Branch 167 → 171 taken 19746 times.
✓ Branch 170 → 169 taken 210 times.
✓ Branch 170 → 171 taken 210 times.
61288 SPLAT_CTX(4);
1120 19956 break;
1121 2448 case TX_32X32:
1122
4/4
✓ Branch 174 → 173 taken 2458 times.
✓ Branch 174 → 175 taken 2448 times.
✓ Branch 177 → 176 taken 2464 times.
✓ Branch 177 → 178 taken 2448 times.
7370 MERGE_CTX(8, AV_RN64A);
1123
6/6
✓ Branch 180 → 181 taken 1974 times.
✓ Branch 180 → 182 taken 502 times.
✓ Branch 185 → 180 taken 2476 times.
✓ Branch 185 → 186 taken 2458 times.
✓ Branch 187 → 179 taken 2458 times.
✓ Branch 187 → 188 taken 2448 times.
7382 DECODE_UV_COEF_LOOP(8, 32);
1124
9/12
✓ Branch 188 → 189 taken 2448 times.
✗ Branch 188 → 192 not taken.
✓ Branch 191 → 190 taken 2464 times.
✓ Branch 191 → 195 taken 2448 times.
✗ Branch 194 → 193 not taken.
✗ Branch 194 → 195 not taken.
✓ Branch 195 → 196 taken 2444 times.
✓ Branch 195 → 199 taken 4 times.
✓ Branch 198 → 197 taken 2454 times.
✓ Branch 198 → 202 taken 2444 times.
✓ Branch 201 → 200 taken 4 times.
✓ Branch 201 → 202 taken 4 times.
7370 SPLAT_CTX(8);
1125 2448 break;
1126 }
1127 }
1128
1129 385016 return total_coeff;
1130 }
1131
1132 359489 static int decode_coeffs_8bpp(VP9TileData *td)
1133 {
1134 359489 return decode_coeffs(td, 1);
1135 }
1136
1137 25527 static int decode_coeffs_16bpp(VP9TileData *td)
1138 {
1139 25527 return decode_coeffs(td, 0);
1140 }
1141
1142 1566740 static av_always_inline void mask_edges(uint8_t (*mask)[8][4], int ss_h, int ss_v,
1143 int row_and_7, int col_and_7,
1144 int w, int h, int col_end, int row_end,
1145 enum TxfmMode tx, int skip_inter)
1146 {
1147 static const unsigned wide_filter_col_mask[2] = { 0x11, 0x01 };
1148 static const unsigned wide_filter_row_mask[2] = { 0x03, 0x07 };
1149
1150 // FIXME I'm pretty sure all loops can be replaced by a single LUT if
1151 // we make VP9Filter.mask uint64_t (i.e. row/col all single variable)
1152 // and make the LUT 5-indexed (bl, bp, is_uv, tx and row/col), and then
1153 // use row_and_7/col_and_7 as shifts (1*col_and_7+8*row_and_7)
1154
1155 // the intended behaviour of the vp9 loopfilter is to work on 8-pixel
1156 // edges. This means that for UV, we work on two subsampled blocks at
1157 // a time, and we only use the topleft block's mode information to set
1158 // things like block strength. Thus, for any block size smaller than
1159 // 16x16, ignore the odd portion of the block.
1160
4/4
✓ Branch 2 → 3 taken 759862 times.
✓ Branch 2 → 14 taken 806878 times.
✓ Branch 3 → 4 taken 570217 times.
✓ Branch 3 → 14 taken 189645 times.
1566740 if (tx == TX_4X4 && (ss_v | ss_h)) {
1161
2/2
✓ Branch 4 → 5 taken 521735 times.
✓ Branch 4 → 9 taken 48482 times.
570217 if (h == ss_v) {
1162
2/2
✓ Branch 5 → 6 taken 258738 times.
✓ Branch 5 → 7 taken 262997 times.
521735 if (row_and_7 & 1)
1163 258738 return;
1164
2/2
✓ Branch 7 → 8 taken 258737 times.
✓ Branch 7 → 9 taken 4260 times.
262997 if (!row_end)
1165 258737 h += 1;
1166 }
1167
2/2
✓ Branch 9 → 10 taken 278205 times.
✓ Branch 9 → 14 taken 33274 times.
311479 if (w == ss_h) {
1168
2/2
✓ Branch 10 → 11 taken 134006 times.
✓ Branch 10 → 12 taken 144199 times.
278205 if (col_and_7 & 1)
1169 134006 return;
1170
2/2
✓ Branch 12 → 13 taken 134006 times.
✓ Branch 12 → 14 taken 10193 times.
144199 if (!col_end)
1171 134006 w += 1;
1172 }
1173 }
1174
1175
4/4
✓ Branch 14 → 15 taken 367118 times.
✓ Branch 14 → 35 taken 806878 times.
✓ Branch 15 → 16 taken 277032 times.
✓ Branch 15 → 35 taken 90086 times.
1451028 if (tx == TX_4X4 && !skip_inter) {
1176 277032 int t = 1 << col_and_7, m_col = (t << w) - t, y;
1177 // on 32-px edges, use the 8-px wide loopfilter; else, use 4-px wide
1178 277032 int m_row_8 = m_col & wide_filter_col_mask[ss_h], m_row_4 = m_col - m_row_8;
1179
1180
2/2
✓ Branch 33 → 17 taken 385064 times.
✓ Branch 33 → 34 taken 277032 times.
662096 for (y = row_and_7; y < h + row_and_7; y++) {
1181
2/2
✓ Branch 17 → 18 taken 85741 times.
✓ Branch 17 → 19 taken 299323 times.
385064 int col_mask_id = 2 - !(y & wide_filter_row_mask[ss_v]);
1182
1183 385064 mask[0][y][1] |= m_row_8;
1184 385064 mask[0][y][2] |= m_row_4;
1185 // for odd lines, if the odd col is not being filtered,
1186 // skip odd row also:
1187 // .---. <-- a
1188 // | |
1189 // |___| <-- b
1190 // ^ ^
1191 // c d
1192 //
1193 // if a/c are even row/col and b/d are odd, and d is skipped,
1194 // e.g. right edge of size-66x66.webm, then skip b also (bug)
1195
6/6
✓ Branch 20 → 21 taken 187544 times.
✓ Branch 20 → 24 taken 197520 times.
✓ Branch 21 → 22 taken 8637 times.
✓ Branch 21 → 24 taken 178907 times.
✓ Branch 22 → 23 taken 4224 times.
✓ Branch 22 → 24 taken 4413 times.
385064 if ((ss_h & ss_v) && (col_end & 1) && (y & 1)) {
1196 4224 mask[1][y][col_mask_id] |= (t << (w - 1)) - t;
1197 } else {
1198 380840 mask[1][y][col_mask_id] |= m_col;
1199 }
1200
2/2
✓ Branch 25 → 26 taken 195354 times.
✓ Branch 25 → 27 taken 189710 times.
385064 if (!ss_h)
1201 195354 mask[0][y][3] |= m_col;
1202
2/2
✓ Branch 27 → 28 taken 189632 times.
✓ Branch 27 → 32 taken 195432 times.
385064 if (!ss_v) {
1203
3/4
✓ Branch 28 → 29 taken 2166 times.
✓ Branch 28 → 31 taken 187466 times.
✗ Branch 29 → 30 not taken.
✓ Branch 29 → 31 taken 2166 times.
189632 if (ss_h && (col_end & 1))
1204 ✗ mask[1][y][3] |= (t << (w - 1)) - t;
1205 else
1206 189632 mask[1][y][3] |= m_col;
1207 }
1208 }
1209 } else {
1210 896964 int y, t = 1 << col_and_7, m_col = (t << w) - t;
1211
1212
2/2
✓ Branch 35 → 36 taken 291672 times.
✓ Branch 35 → 59 taken 605292 times.
896964 if (!skip_inter) {
1213 291672 int mask_id = (tx == TX_8X8);
1214 291672 int l2 = tx + ss_h - 1, step1d;
1215 static const unsigned masks[4] = { 0xff, 0x55, 0x11, 0x01 };
1216 291672 int m_row = m_col & masks[l2];
1217
1218 // at odd UV col/row edges tx16/tx32 loopfilter edges, force
1219 // 8wd loopfilter to prevent going off the visible edge.
1220
6/6
✓ Branch 36 → 37 taken 69541 times.
✓ Branch 36 → 43 taken 222131 times.
✓ Branch 37 → 38 taken 11268 times.
✓ Branch 37 → 43 taken 58273 times.
✓ Branch 38 → 39 taken 8 times.
✓ Branch 38 → 43 taken 11260 times.
291680 if (ss_h && tx > TX_8X8 && (w ^ (w - 1)) == 1) {
1221 8 int m_row_16 = ((t << (w - 1)) - t) & masks[l2];
1222 8 int m_row_8 = m_row - m_row_16;
1223
1224
2/2
✓ Branch 41 → 40 taken 52 times.
✓ Branch 41 → 42 taken 8 times.
60 for (y = row_and_7; y < h + row_and_7; y++) {
1225 52 mask[0][y][0] |= m_row_16;
1226 52 mask[0][y][1] |= m_row_8;
1227 }
1228 } else {
1229
2/2
✓ Branch 45 → 44 taken 510945 times.
✓ Branch 45 → 46 taken 291664 times.
802609 for (y = row_and_7; y < h + row_and_7; y++)
1230 510945 mask[0][y][mask_id] |= m_row;
1231 }
1232
1233 291672 l2 = tx + ss_v - 1;
1234 291672 step1d = 1 << l2;
1235
6/6
✓ Branch 46 → 47 taken 69766 times.
✓ Branch 46 → 55 taken 221906 times.
✓ Branch 47 → 48 taken 11347 times.
✓ Branch 47 → 55 taken 58419 times.
✓ Branch 48 → 49 taken 79 times.
✓ Branch 48 → 55 taken 11268 times.
291672 if (ss_v && tx > TX_8X8 && (h ^ (h - 1)) == 1) {
1236
2/2
✓ Branch 51 → 50 taken 77 times.
✓ Branch 51 → 52 taken 79 times.
156 for (y = row_and_7; y < h + row_and_7 - 1; y += step1d)
1237 77 mask[1][y][0] |= m_col;
1238
2/2
✓ Branch 52 → 53 taken 2 times.
✓ Branch 52 → 54 taken 77 times.
79 if (y - row_and_7 == h - 1)
1239 2 mask[1][y][1] |= m_col;
1240 } else {
1241
2/2
✓ Branch 57 → 56 taken 326011 times.
✓ Branch 57 → 58 taken 291593 times.
617604 for (y = row_and_7; y < h + row_and_7; y += step1d)
1242 326011 mask[1][y][mask_id] |= m_col;
1243 }
1244
2/2
✓ Branch 59 → 60 taken 515206 times.
✓ Branch 59 → 71 taken 90086 times.
605292 } else if (tx != TX_4X4) {
1245 int mask_id;
1246
1247
4/4
✓ Branch 60 → 61 taken 164801 times.
✓ Branch 60 → 62 taken 350405 times.
✓ Branch 61 → 62 taken 104 times.
✓ Branch 61 → 63 taken 164697 times.
515206 mask_id = (tx == TX_8X8) || (h == ss_v);
1248 515206 mask[1][row_and_7][mask_id] |= m_col;
1249
3/4
✓ Branch 64 → 65 taken 164801 times.
✓ Branch 64 → 66 taken 350405 times.
✗ Branch 65 → 66 not taken.
✓ Branch 65 → 67 taken 164801 times.
515206 mask_id = (tx == TX_8X8) || (w == ss_h);
1250
2/2
✓ Branch 70 → 69 taken 1032903 times.
✓ Branch 70 → 81 taken 515206 times.
1548109 for (y = row_and_7; y < h + row_and_7; y++)
1251 1032903 mask[0][y][mask_id] |= t;
1252 } else {
1253 90086 int t8 = t & wide_filter_col_mask[ss_h], t4 = t - t8;
1254
1255
2/2
✓ Branch 73 → 72 taken 165531 times.
✓ Branch 73 → 74 taken 90086 times.
255617 for (y = row_and_7; y < h + row_and_7; y++) {
1256 165531 mask[0][y][2] |= t4;
1257 165531 mask[0][y][1] |= t8;
1258 }
1259
4/4
✓ Branch 74 → 75 taken 24717 times.
✓ Branch 74 → 76 taken 65369 times.
✓ Branch 77 → 78 taken 24717 times.
✓ Branch 77 → 79 taken 65369 times.
90086 mask[1][row_and_7][2 - !(row_and_7 & wide_filter_row_mask[ss_v])] |= m_col;
1260 }
1261 }
1262 }
1263
1264 820758 void ff_vp9_decode_block(VP9TileData *td, int row, int col,
1265 VP9Filter *lflvl, ptrdiff_t yoff, ptrdiff_t uvoff,
1266 enum BlockLevel bl, enum BlockPartition bp)
1267 {
1268 820758 const VP9Context *s = td->s;
1269 820758 VP9Block *b = td->b;
1270 820758 enum BlockSize bs = bl * 3 + bp;
1271 820758 int bytesperpixel = s->bytesperpixel;
1272 820758 int w4 = ff_vp9_bwh_tab[1][bs][0], h4 = ff_vp9_bwh_tab[1][bs][1], lvl;
1273 int emu[2];
1274 820758 AVFrame *f = s->s.frames[CUR_FRAME].tf.f;
1275
1276 820758 td->row = row;
1277 820758 td->row7 = row & 7;
1278 820758 td->col = col;
1279 820758 td->col7 = col & 7;
1280
1281 820758 td->min_mv.x = -(128 + col * 64);
1282 820758 td->min_mv.y = -(128 + row * 64);
1283 820758 td->max_mv.x = 128 + (s->cols - col - w4) * 64;
1284 820758 td->max_mv.y = 128 + (s->rows - row - h4) * 64;
1285
1286
1/2
✓ Branch 2 → 3 taken 820758 times.
✗ Branch 2 → 88 not taken.
820758 if (s->pass < 2) {
1287 820758 b->bs = bs;
1288 820758 b->bl = bl;
1289 820758 b->bp = bp;
1290 820758 decode_mode(td);
1291
4/4
✓ Branch 4 → 5 taken 801204 times.
✓ Branch 4 → 6 taken 19554 times.
✓ Branch 5 → 6 taken 281652 times.
✓ Branch 5 → 8 taken 519552 times.
1121964 b->uvtx = b->tx - ((s->ss_h && w4 * 2 == (1 << b->tx)) ||
1292
4/4
✓ Branch 6 → 7 taken 287627 times.
✓ Branch 6 → 9 taken 13579 times.
✓ Branch 7 → 8 taken 56405 times.
✓ Branch 7 → 9 taken 231222 times.
301206 (s->ss_v && h4 * 2 == (1 << b->tx)));
1293
1294
2/2
✓ Branch 10 → 11 taken 1204 times.
✓ Branch 10 → 12 taken 819554 times.
820758 if (td->block_structure) {
1295 1204 td->block_structure[td->nb_block_structure].row = row;
1296 1204 td->block_structure[td->nb_block_structure].col = col;
1297 1204 td->block_structure[td->nb_block_structure].block_size_idx_x = av_log2(w4);
1298 1204 td->block_structure[td->nb_block_structure].block_size_idx_y = av_log2(h4);
1299 1204 td->nb_block_structure++;
1300 }
1301
1302
2/2
✓ Branch 12 → 13 taken 385016 times.
✓ Branch 12 → 20 taken 435742 times.
820758 if (!b->skip) {
1303 int has_coeffs;
1304
1305
2/2
✓ Branch 13 → 14 taken 359489 times.
✓ Branch 13 → 15 taken 25527 times.
385016 if (bytesperpixel == 1) {
1306 359489 has_coeffs = decode_coeffs_8bpp(td);
1307 } else {
1308 25527 has_coeffs = decode_coeffs_16bpp(td);
1309 }
1310
1/6
✗ Branch 16 → 17 not taken.
✓ Branch 16 → 86 taken 385016 times.
✗ Branch 17 → 18 not taken.
✗ Branch 17 → 86 not taken.
✗ Branch 18 → 19 not taken.
✗ Branch 18 → 86 not taken.
385016 if (!has_coeffs && b->bs <= BS_8x8 && !b->intra) {
1311 ✗ b->skip = 1;
1312 ✗ memset(&s->above_skip_ctx[col], 1, w4);
1313 ✗ memset(&td->left_skip_ctx[td->row7], 1, h4);
1314 }
1315 } else {
1316 435742 int row7 = td->row7;
1317
1318 #define SPLAT_ZERO_CTX(v, n) \
1319 switch (n) { \
1320 case 1: v = 0; break; \
1321 case 2: AV_ZERO16(&v); break; \
1322 case 4: AV_ZERO32(&v); break; \
1323 case 8: AV_ZERO64(&v); break; \
1324 case 16: AV_ZERO128(&v); break; \
1325 }
1326 #define SPLAT_ZERO_YUV(dir, var, off, n, dir2) \
1327 do { \
1328 SPLAT_ZERO_CTX(dir##_y_##var[off * 2], n * 2); \
1329 if (s->ss_##dir2) { \
1330 SPLAT_ZERO_CTX(dir##_uv_##var[0][off], n); \
1331 SPLAT_ZERO_CTX(dir##_uv_##var[1][off], n); \
1332 } else { \
1333 SPLAT_ZERO_CTX(dir##_uv_##var[0][off * 2], n * 2); \
1334 SPLAT_ZERO_CTX(dir##_uv_##var[1][off * 2], n * 2); \
1335 } \
1336 } while (0)
1337
1338
4/5
✓ Branch 20 → 21 taken 251438 times.
✓ Branch 20 → 29 taken 137733 times.
✓ Branch 20 → 37 taken 33878 times.
✓ Branch 20 → 45 taken 12693 times.
✗ Branch 20 → 53 not taken.
435742 switch (w4) {
1339
2/2
✓ Branch 22 → 23 taken 246983 times.
✓ Branch 22 → 26 taken 4455 times.
498421 case 1: SPLAT_ZERO_YUV(s->above, nnz_ctx, col, 1, h); break;
1340
2/2
✓ Branch 30 → 31 taken 136218 times.
✓ Branch 30 → 34 taken 1515 times.
273951 case 2: SPLAT_ZERO_YUV(s->above, nnz_ctx, col, 2, h); break;
1341
2/2
✓ Branch 38 → 39 taken 33545 times.
✓ Branch 38 → 42 taken 333 times.
67423 case 4: SPLAT_ZERO_YUV(s->above, nnz_ctx, col, 4, h); break;
1342
2/2
✓ Branch 46 → 47 taken 12616 times.
✓ Branch 46 → 50 taken 77 times.
25309 case 8: SPLAT_ZERO_YUV(s->above, nnz_ctx, col, 8, h); break;
1343 }
1344
4/5
✓ Branch 53 → 54 taken 257587 times.
✓ Branch 53 → 62 taken 133638 times.
✓ Branch 53 → 70 taken 32550 times.
✓ Branch 53 → 78 taken 11967 times.
✗ Branch 53 → 86 not taken.
435742 switch (h4) {
1345
2/2
✓ Branch 55 → 56 taken 252113 times.
✓ Branch 55 → 59 taken 5474 times.
509700 case 1: SPLAT_ZERO_YUV(td->left, nnz_ctx, row7, 1, v); break;
1346
2/2
✓ Branch 63 → 64 taken 131517 times.
✓ Branch 63 → 67 taken 2121 times.
265155 case 2: SPLAT_ZERO_YUV(td->left, nnz_ctx, row7, 2, v); break;
1347
2/2
✓ Branch 71 → 72 taken 32242 times.
✓ Branch 71 → 75 taken 308 times.
64792 case 4: SPLAT_ZERO_YUV(td->left, nnz_ctx, row7, 4, v); break;
1348
2/2
✓ Branch 79 → 80 taken 11880 times.
✓ Branch 79 → 83 taken 87 times.
23847 case 8: SPLAT_ZERO_YUV(td->left, nnz_ctx, row7, 8, v); break;
1349 }
1350 }
1351
1352
1/2
✗ Branch 86 → 87 not taken.
✓ Branch 86 → 88 taken 820758 times.
820758 if (s->pass == 1) {
1353 ✗ s->td[0].b++;
1354 ✗ s->td[0].block += w4 * h4 * 64 * bytesperpixel;
1355 ✗ s->td[0].uvblock[0] += w4 * h4 * 64 * bytesperpixel >> (s->ss_h + s->ss_v);
1356 ✗ s->td[0].uvblock[1] += w4 * h4 * 64 * bytesperpixel >> (s->ss_h + s->ss_v);
1357 ✗ s->td[0].eob += 4 * w4 * h4;
1358 ✗ s->td[0].uveob[0] += 4 * w4 * h4 >> (s->ss_h + s->ss_v);
1359 ✗ s->td[0].uveob[1] += 4 * w4 * h4 >> (s->ss_h + s->ss_v);
1360
1361 ✗ return;
1362 }
1363 }
1364
1365 // emulated overhangs if the stride of the target buffer can't hold. This
1366 // makes it possible to support emu-edge and so on even if we have large block
1367 // overhangs
1368
1/2
✓ Branch 88 → 89 taken 820758 times.
✗ Branch 88 → 90 not taken.
1641516 emu[0] = (col + w4) * 8 * bytesperpixel > f->linesize[0] ||
1369
2/2
✓ Branch 89 → 90 taken 2376 times.
✓ Branch 89 → 91 taken 818382 times.
820758 (row + h4) > s->rows;
1370
1/2
✓ Branch 92 → 93 taken 820758 times.
✗ Branch 92 → 94 not taken.
1641516 emu[1] = ((col + w4) * 8 >> s->ss_h) * bytesperpixel > f->linesize[1] ||
1371
2/2
✓ Branch 93 → 94 taken 2376 times.
✓ Branch 93 → 95 taken 818382 times.
820758 (row + h4) > s->rows;
1372
2/2
✓ Branch 96 → 97 taken 2376 times.
✓ Branch 96 → 98 taken 818382 times.
820758 if (emu[0]) {
1373 2376 td->dst[0] = td->tmp_y;
1374 2376 td->y_stride = 128;
1375 } else {
1376 818382 td->dst[0] = f->data[0] + yoff;
1377 818382 td->y_stride = f->linesize[0];
1378 }
1379
2/2
✓ Branch 99 → 100 taken 2376 times.
✓ Branch 99 → 101 taken 818382 times.
820758 if (emu[1]) {
1380 2376 td->dst[1] = td->tmp_uv[0];
1381 2376 td->dst[2] = td->tmp_uv[1];
1382 2376 td->uv_stride = 128;
1383 } else {
1384 818382 td->dst[1] = f->data[1] + uvoff;
1385 818382 td->dst[2] = f->data[2] + uvoff;
1386 818382 td->uv_stride = f->linesize[1];
1387 }
1388
2/2
✓ Branch 102 → 103 taken 287570 times.
✓ Branch 102 → 106 taken 533188 times.
820758 if (b->intra) {
1389
2/2
✓ Branch 103 → 104 taken 24029 times.
✓ Branch 103 → 105 taken 263541 times.
287570 if (s->s.h.bpp > 8) {
1390 24029 ff_vp9_intra_recon_16bpp(td, yoff, uvoff);
1391 } else {
1392 263541 ff_vp9_intra_recon_8bpp(td, yoff, uvoff);
1393 }
1394 } else {
1395
2/2
✓ Branch 106 → 107 taken 15787 times.
✓ Branch 106 → 108 taken 517401 times.
533188 if (s->s.h.bpp > 8) {
1396 15787 ff_vp9_inter_recon_16bpp(td);
1397 } else {
1398 517401 ff_vp9_inter_recon_8bpp(td);
1399 }
1400 }
1401
2/2
✓ Branch 109 → 110 taken 2376 times.
✓ Branch 109 → 116 taken 818382 times.
820758 if (emu[0]) {
1402 2376 int w = FFMIN(s->cols - col, w4) * 8, h = FFMIN(s->rows - row, h4) * 8, n, o = 0;
1403
1404
2/2
✓ Branch 115 → 111 taken 4365 times.
✓ Branch 115 → 116 taken 2376 times.
6741 for (n = 0; o < w; n++) {
1405 4365 int bw = 64 >> n;
1406
1407 av_assert2(n <= 4);
1408
2/2
✓ Branch 111 → 112 taken 2391 times.
✓ Branch 111 → 114 taken 1974 times.
4365 if (w & bw) {
1409 2391 s->dsp.mc[n][0][0][0][0](f->data[0] + yoff + o * bytesperpixel, f->linesize[0],
1410 2391 td->tmp_y + o * bytesperpixel, 128, h, 0, 0);
1411 2391 o += bw;
1412 }
1413 }
1414 }
1415
2/2
✓ Branch 116 → 117 taken 2376 times.
✓ Branch 116 → 124 taken 818382 times.
820758 if (emu[1]) {
1416 2376 int w = FFMIN(s->cols - col, w4) * 8 >> s->ss_h;
1417 2376 int h = FFMIN(s->rows - row, h4) * 8 >> s->ss_v, n, o = 0;
1418
1419
2/2
✓ Branch 123 → 118 taken 4365 times.
✓ Branch 123 → 124 taken 2376 times.
6741 for (n = s->ss_h; o < w; n++) {
1420 4365 int bw = 64 >> n;
1421
1422 av_assert2(n <= 4);
1423
2/2
✓ Branch 118 → 119 taken 2391 times.
✓ Branch 118 → 122 taken 1974 times.
4365 if (w & bw) {
1424 2391 s->dsp.mc[n][0][0][0][0](f->data[1] + uvoff + o * bytesperpixel, f->linesize[1],
1425 2391 td->tmp_uv[0] + o * bytesperpixel, 128, h, 0, 0);
1426 2391 s->dsp.mc[n][0][0][0][0](f->data[2] + uvoff + o * bytesperpixel, f->linesize[2],
1427 2391 td->tmp_uv[1] + o * bytesperpixel, 128, h, 0, 0);
1428 2391 o += bw;
1429 }
1430 }
1431 }
1432
1433 // pick filter level and find edges to apply filter to
1434
2/2
✓ Branch 124 → 125 taken 788439 times.
✓ Branch 124 → 146 taken 32319 times.
820758 if (s->s.h.filter.level &&
1435
2/2
✓ Branch 125 → 126 taken 524954 times.
✓ Branch 125 → 127 taken 263485 times.
788439 (lvl = s->s.h.segmentation.feat[b->seg_id].lflvl[b->intra ? 0 : b->ref[0] + 1]
1436
2/2
✓ Branch 128 → 129 taken 788348 times.
✓ Branch 128 → 146 taken 91 times.
788439 [b->mode[3] != ZEROMV]) > 0) {
1437 788348 int x_end = FFMIN(s->cols - col, w4), y_end = FFMIN(s->rows - row, h4);
1438
4/4
✓ Branch 129 → 130 taken 524863 times.
✓ Branch 129 → 132 taken 263485 times.
✓ Branch 130 → 131 taken 389680 times.
✓ Branch 130 → 132 taken 135183 times.
788348 int skip_inter = !b->intra && b->skip, col7 = td->col7, row7 = td->row7;
1439
1440 788348 setctx_2d(&lflvl->level[row7 * 8 + col7], w4, h4, 8, lvl);
1441 788348 mask_edges(lflvl->mask[0], 0, 0, row7, col7, x_end, y_end, 0, 0, b->tx, skip_inter);
1442
4/4
✓ Branch 135 → 136 taken 19535 times.
✓ Branch 135 → 137 taken 768813 times.
✓ Branch 136 → 137 taken 9579 times.
✓ Branch 136 → 146 taken 9956 times.
788348 if (s->ss_h || s->ss_v)
1443 1550443 mask_edges(lflvl->mask[1], s->ss_h, s->ss_v, row7, col7, x_end, y_end,
1444
4/4
✓ Branch 141 → 142 taken 372903 times.
✓ Branch 141 → 144 taken 405489 times.
✓ Branch 142 → 143 taken 17651 times.
✓ Branch 142 → 144 taken 355252 times.
778392 s->cols & 1 && col + w4 >= s->cols ? s->cols & 7 : 0,
1445
4/4
✓ Branch 137 → 138 taken 181644 times.
✓ Branch 137 → 140 taken 596748 times.
✓ Branch 138 → 139 taken 6341 times.
✓ Branch 138 → 140 taken 175303 times.
778392 s->rows & 1 && row + h4 >= s->rows ? s->rows & 7 : 0,
1446 b->uvtx, skip_inter);
1447 }
1448
1449
1/2
✗ Branch 146 → 147 not taken.
✓ Branch 146 → 148 taken 820758 times.
820758 if (s->pass == 2) {
1450 ✗ s->td[0].b++;
1451 ✗ s->td[0].block += w4 * h4 * 64 * bytesperpixel;
1452 ✗ s->td[0].uvblock[0] += w4 * h4 * 64 * bytesperpixel >> (s->ss_v + s->ss_h);
1453 ✗ s->td[0].uvblock[1] += w4 * h4 * 64 * bytesperpixel >> (s->ss_v + s->ss_h);
1454 ✗ s->td[0].eob += 4 * w4 * h4;
1455 ✗ s->td[0].uveob[0] += 4 * w4 * h4 >> (s->ss_v + s->ss_h);
1456 ✗ s->td[0].uveob[1] += 4 * w4 * h4 >> (s->ss_v + s->ss_h);
1457 }
1458 }
1459