FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/vc1_loopfilter.c
Date: 2024-11-20 23:03:26
Exec Total Coverage
Lines: 718 751 95.6%
Functions: 15 16 93.8%
Branches: 689 790 87.2%

Line Branch Exec Source
1 /*
2 * VC-1 and WMV3 decoder
3 * Copyright (c) 2011 Mashiat Sarker Shakkhar
4 * Copyright (c) 2006-2007 Konstantin Shishkov
5 * Partly based on vc9.c (c) 2005 Anonymous, Alex Beregszaszi, Michael Niedermayer
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 /**
25 * @file
26 * VC-1 and WMV3 loopfilter
27 */
28
29 #include "avcodec.h"
30 #include "mpegvideo.h"
31 #include "vc1.h"
32 #include "vc1dsp.h"
33
34 2688 static av_always_inline void vc1_h_overlap_filter(VC1Context *v, int16_t (*left_block)[64],
35 int16_t (*right_block)[64], int left_fieldtx,
36 int right_fieldtx, int block_num)
37 {
38
5/6
✓ Branch 0 taken 420 times.
✓ Branch 1 taken 504 times.
✓ Branch 2 taken 420 times.
✓ Branch 3 taken 504 times.
✓ Branch 4 taken 840 times.
✗ Branch 5 not taken.
2688 switch (block_num) {
39 420 case 0:
40
4/8
✓ Branch 0 taken 420 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 420 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 420 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 420 times.
420 v->vc1dsp.vc1_h_s_overlap(left_block[2],
41 right_block[0],
42 left_fieldtx ^ right_fieldtx ? 16 - 8 * left_fieldtx : 8,
43 left_fieldtx ^ right_fieldtx ? 16 - 8 * right_fieldtx : 8,
44 left_fieldtx || right_fieldtx ? 0 : 1);
45 420 break;
46
47 504 case 1:
48 504 v->vc1dsp.vc1_h_s_overlap(right_block[0],
49 504 right_block[2],
50 8,
51 8,
52 right_fieldtx ? 0 : 1);
53 504 break;
54
55 420 case 2:
56
6/12
✓ Branch 0 taken 420 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 420 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 420 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 420 times.
✓ Branch 8 taken 420 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 420 times.
840 v->vc1dsp.vc1_h_s_overlap(!left_fieldtx && right_fieldtx ? left_block[2] + 8 : left_block[3],
57 left_fieldtx && !right_fieldtx ? right_block[0] + 8 : right_block[1],
58 left_fieldtx ^ right_fieldtx ? 16 - 8 * left_fieldtx : 8,
59 left_fieldtx ^ right_fieldtx ? 16 - 8 * right_fieldtx : 8,
60
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 420 times.
420 left_fieldtx || right_fieldtx ? 2 : 1);
61 420 break;
62
63 504 case 3:
64
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 504 times.
504 v->vc1dsp.vc1_h_s_overlap(right_block[1],
65 504 right_block[3],
66 8,
67 8,
68 right_fieldtx ? 2 : 1);
69 504 break;
70
71 840 case 4:
72 case 5:
73 840 v->vc1dsp.vc1_h_s_overlap(left_block[block_num], right_block[block_num], 8, 8, 1);
74 840 break;
75 }
76 2688 }
77
78 2456 static av_always_inline void vc1_v_overlap_filter(VC1Context *v, int16_t (*top_block)[64],
79 int16_t (*bottom_block)[64], int block_num)
80 {
81
5/6
✓ Branch 0 taken 362 times.
✓ Branch 1 taken 362 times.
✓ Branch 2 taken 504 times.
✓ Branch 3 taken 504 times.
✓ Branch 4 taken 724 times.
✗ Branch 5 not taken.
2456 switch (block_num) {
82 362 case 0:
83 362 v->vc1dsp.vc1_v_s_overlap(top_block[1], bottom_block[0]);
84 362 break;
85
86 362 case 1:
87 362 v->vc1dsp.vc1_v_s_overlap(top_block[3], bottom_block[2]);
88 362 break;
89
90 504 case 2:
91 504 v->vc1dsp.vc1_v_s_overlap(bottom_block[0], bottom_block[1]);
92 504 break;
93
94 504 case 3:
95 504 v->vc1dsp.vc1_v_s_overlap(bottom_block[2], bottom_block[3]);
96 504 break;
97
98 724 case 4:
99 case 5:
100 724 v->vc1dsp.vc1_v_s_overlap(top_block[block_num], bottom_block[block_num]);
101 724 break;
102 }
103 2456 }
104
105 798 void ff_vc1_i_overlap_filter(VC1Context *v)
106 {
107 798 MpegEncContext *s = &v->s;
108 int16_t (*topleft_blk)[64], (*top_blk)[64], (*left_blk)[64], (*cur_blk)[64];
109 798 int block_count = CONFIG_GRAY && (s->avctx->flags & AV_CODEC_FLAG_GRAY) ? 4 : 6;
110 798 int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
111 int i;
112
113 798 topleft_blk = v->block[v->topleft_blk_idx];
114 798 top_blk = v->block[v->top_blk_idx];
115 798 left_blk = v->block[v->left_blk_idx];
116 798 cur_blk = v->block[v->cur_blk_idx];
117
118 /* Within a MB, the horizontal overlap always runs before the vertical.
119 * To accomplish that, we run the H on the left and internal vertical
120 * borders of the currently decoded MB. Then, we wait for the next overlap
121 * iteration to do H overlap on the right edge of this MB, before moving
122 * over and running the V overlap on the top and internal horizontal
123 * borders. Therefore, the H overlap trails by one MB col and the
124 * V overlap trails by one MB row. This is reflected in the time at which
125 * we run the put_pixels loop, i.e. delayed by one row and one column. */
126
2/2
✓ Branch 0 taken 4788 times.
✓ Branch 1 taken 798 times.
5586 for (i = 0; i < block_count; i++) {
127
4/4
✓ Branch 0 taken 288 times.
✓ Branch 1 taken 4500 times.
✓ Branch 2 taken 192 times.
✓ Branch 3 taken 96 times.
4788 if (s->mb_x == 0 && (i & 5) != 1)
128 192 continue;
129
130
2/4
✓ Branch 0 taken 4596 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4596 times.
✗ Branch 3 not taken.
4596 if (v->pq >= 9 || (v->profile == PROFILE_ADVANCED &&
131
1/2
✓ Branch 0 taken 4596 times.
✗ Branch 1 not taken.
4596 (v->condover == CONDOVER_ALL ||
132
2/2
✓ Branch 0 taken 2896 times.
✓ Branch 1 taken 1700 times.
4596 (v->over_flags_plane[mb_pos] &&
133
4/4
✓ Branch 0 taken 1888 times.
✓ Branch 1 taken 1008 times.
✓ Branch 2 taken 1680 times.
✓ Branch 3 taken 208 times.
2896 ((i & 5) == 1 || v->over_flags_plane[mb_pos - 1])))))
134 8064 vc1_h_overlap_filter(v,
135
2/2
✓ Branch 0 taken 2624 times.
✓ Branch 1 taken 64 times.
2688 s->mb_x ? left_blk : cur_blk, cur_blk,
136
1/6
✗ Branch 0 not taken.
✓ Branch 1 taken 2688 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
2688 v->fcm == ILACE_FRAME && s->mb_x && v->fieldtx_plane[mb_pos - 1],
137
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 2688 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
2688 v->fcm == ILACE_FRAME && v->fieldtx_plane[mb_pos],
138 i);
139 }
140
141
1/2
✓ Branch 0 taken 798 times.
✗ Branch 1 not taken.
798 if (v->fcm != ILACE_FRAME)
142
2/2
✓ Branch 0 taken 4788 times.
✓ Branch 1 taken 798 times.
5586 for (i = 0; i < block_count; i++) {
143
4/4
✓ Branch 0 taken 372 times.
✓ Branch 1 taken 4416 times.
✓ Branch 2 taken 248 times.
✓ Branch 3 taken 124 times.
4788 if (s->first_slice_line && !(i & 2))
144 248 continue;
145
146
2/2
✓ Branch 0 taken 4268 times.
✓ Branch 1 taken 272 times.
4540 if (s->mb_x &&
147
2/4
✓ Branch 0 taken 4268 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4268 times.
✗ Branch 3 not taken.
4268 (v->pq >= 9 || (v->profile == PROFILE_ADVANCED &&
148
1/2
✓ Branch 0 taken 4268 times.
✗ Branch 1 not taken.
4268 (v->condover == CONDOVER_ALL ||
149
2/2
✓ Branch 0 taken 2596 times.
✓ Branch 1 taken 1672 times.
4268 (v->over_flags_plane[mb_pos - 1] &&
150
4/4
✓ Branch 0 taken 1656 times.
✓ Branch 1 taken 940 times.
✓ Branch 2 taken 1344 times.
✓ Branch 3 taken 312 times.
2596 ((i & 2) || v->over_flags_plane[mb_pos - 1 - s->mb_stride]))))))
151
2/2
✓ Branch 0 taken 112 times.
✓ Branch 1 taken 2172 times.
2284 vc1_v_overlap_filter(v, s->first_slice_line ? left_blk : topleft_blk, left_blk, i);
152
2/2
✓ Branch 0 taken 272 times.
✓ Branch 1 taken 4268 times.
4540 if (s->mb_x == s->mb_width - 1 &&
153
2/4
✓ Branch 0 taken 272 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 272 times.
✗ Branch 3 not taken.
272 (v->pq >= 9 || (v->profile == PROFILE_ADVANCED &&
154
1/2
✓ Branch 0 taken 272 times.
✗ Branch 1 not taken.
272 (v->condover == CONDOVER_ALL ||
155
2/2
✓ Branch 0 taken 188 times.
✓ Branch 1 taken 84 times.
272 (v->over_flags_plane[mb_pos] &&
156
4/4
✓ Branch 0 taken 120 times.
✓ Branch 1 taken 68 times.
✓ Branch 2 taken 104 times.
✓ Branch 3 taken 16 times.
188 ((i & 2) || v->over_flags_plane[mb_pos - s->mb_stride]))))))
157
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 164 times.
172 vc1_v_overlap_filter(v, s->first_slice_line ? cur_blk : top_blk, cur_blk, i);
158 }
159 798 }
160
161 void ff_vc1_p_overlap_filter(VC1Context *v)
162 {
163 MpegEncContext *s = &v->s;
164 int16_t (*topleft_blk)[64], (*top_blk)[64], (*left_blk)[64], (*cur_blk)[64];
165 int block_count = CONFIG_GRAY && (s->avctx->flags & AV_CODEC_FLAG_GRAY) ? 4 : 6;
166 int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
167 int i;
168
169 topleft_blk = v->block[v->topleft_blk_idx];
170 top_blk = v->block[v->top_blk_idx];
171 left_blk = v->block[v->left_blk_idx];
172 cur_blk = v->block[v->cur_blk_idx];
173
174 for (i = 0; i < block_count; i++) {
175 if (s->mb_x == 0 && (i & 5) != 1)
176 continue;
177
178 if (v->mb_type[0][s->block_index[i]] && v->mb_type[0][s->block_index[i] - 1])
179 vc1_h_overlap_filter(v,
180 s->mb_x ? left_blk : cur_blk, cur_blk,
181 v->fcm == ILACE_FRAME && s->mb_x && v->fieldtx_plane[mb_pos - 1],
182 v->fcm == ILACE_FRAME && v->fieldtx_plane[mb_pos],
183 i);
184 }
185
186 if (v->fcm != ILACE_FRAME)
187 for (i = 0; i < block_count; i++) {
188 if (s->first_slice_line && !(i & 2))
189 continue;
190
191 if (s->mb_x && v->mb_type[0][s->block_index[i] - 2 + (i > 3)] &&
192 v->mb_type[0][s->block_index[i] - s->block_wrap[i] - 2 + (i > 3)])
193 vc1_v_overlap_filter(v, s->first_slice_line ? left_blk : topleft_blk, left_blk, i);
194 if (s->mb_x == s->mb_width - 1)
195 if (v->mb_type[0][s->block_index[i]] &&
196 v->mb_type[0][s->block_index[i] - s->block_wrap[i]])
197 vc1_v_overlap_filter(v, s->first_slice_line ? cur_blk : top_blk, cur_blk, i);
198 }
199 }
200
201 #define LEFT_EDGE (1 << 0)
202 #define RIGHT_EDGE (1 << 1)
203 #define TOP_EDGE (1 << 2)
204 #define BOTTOM_EDGE (1 << 3)
205
206 257268 static av_always_inline void vc1_i_h_loop_filter(VC1Context *v, uint8_t *dest,
207 uint32_t flags, int block_num)
208 {
209 257268 MpegEncContext *s = &v->s;
210 257268 int pq = v->pq;
211 uint8_t *dst;
212
213
2/2
✓ Branch 0 taken 85756 times.
✓ Branch 1 taken 171512 times.
257268 if (block_num & 2)
214 85756 return;
215
216
4/4
✓ Branch 0 taken 6480 times.
✓ Branch 1 taken 165032 times.
✓ Branch 2 taken 1620 times.
✓ Branch 3 taken 4860 times.
171512 if (!(flags & LEFT_EDGE) || (block_num & 5) == 1) {
217
2/2
✓ Branch 0 taken 82516 times.
✓ Branch 1 taken 84136 times.
166652 if (block_num > 3)
218 82516 dst = dest;
219 else
220 84136 dst = dest + (block_num & 2) * 4 * s->linesize + (block_num & 1) * 8;
221
222
2/2
✓ Branch 0 taken 64872 times.
✓ Branch 1 taken 101780 times.
166652 if (v->fcm == ILACE_FRAME)
223
2/2
✓ Branch 0 taken 32368 times.
✓ Branch 1 taken 32504 times.
64872 if (block_num > 3) {
224 32368 v->vc1dsp.vc1_h_loop_filter4(dst, 2 * s->uvlinesize, pq);
225 32368 v->vc1dsp.vc1_h_loop_filter4(dst + s->uvlinesize, 2 * s->uvlinesize, pq);
226 } else {
227 32504 v->vc1dsp.vc1_h_loop_filter8(dst, 2 * s->linesize, pq);
228 32504 v->vc1dsp.vc1_h_loop_filter8(dst + s->linesize, 2 * s->linesize, pq);
229 }
230 else
231
2/2
✓ Branch 0 taken 50148 times.
✓ Branch 1 taken 51632 times.
101780 if (block_num > 3)
232 50148 v->vc1dsp.vc1_h_loop_filter8(dst, s->uvlinesize, pq);
233 else
234 51632 v->vc1dsp.vc1_h_loop_filter16(dst, s->linesize, pq);
235 }
236 }
237
238 257268 static av_always_inline void vc1_i_v_loop_filter(VC1Context *v, uint8_t *dest,
239 uint32_t flags, uint8_t fieldtx,
240 int block_num)
241 {
242 257268 MpegEncContext *s = &v->s;
243 257268 int pq = v->pq;
244 uint8_t *dst;
245
246
2/2
✓ Branch 0 taken 85756 times.
✓ Branch 1 taken 171512 times.
257268 if ((block_num & 5) == 1)
247 85756 return;
248
249
4/4
✓ Branch 0 taken 12616 times.
✓ Branch 1 taken 158896 times.
✓ Branch 2 taken 3154 times.
✓ Branch 3 taken 9462 times.
171512 if (!(flags & TOP_EDGE) || block_num & 2) {
250
2/2
✓ Branch 0 taken 79448 times.
✓ Branch 1 taken 82602 times.
162050 if (block_num > 3)
251 79448 dst = dest;
252 else
253 82602 dst = dest + (block_num & 2) * 4 * s->linesize + (block_num & 1) * 8;
254
255
2/2
✓ Branch 0 taken 64560 times.
✓ Branch 1 taken 97490 times.
162050 if (v->fcm == ILACE_FRAME) {
256
2/2
✓ Branch 0 taken 32160 times.
✓ Branch 1 taken 32400 times.
64560 if (block_num > 3) {
257 32160 v->vc1dsp.vc1_v_loop_filter8(dst, 2 * s->uvlinesize, pq);
258 32160 v->vc1dsp.vc1_v_loop_filter8(dst + s->uvlinesize, 2 * s->uvlinesize, pq);
259
4/4
✓ Branch 0 taken 16320 times.
✓ Branch 1 taken 16080 times.
✓ Branch 2 taken 11066 times.
✓ Branch 3 taken 5254 times.
32400 } else if (block_num < 2 || !fieldtx) {
260 27146 v->vc1dsp.vc1_v_loop_filter16(dst, 2 * s->linesize, pq);
261 27146 v->vc1dsp.vc1_v_loop_filter16(dst + s->linesize, 2 * s->linesize, pq);
262 }
263 } else
264
2/2
✓ Branch 0 taken 47288 times.
✓ Branch 1 taken 50202 times.
97490 if (block_num > 3)
265 47288 v->vc1dsp.vc1_v_loop_filter8(dst, s->uvlinesize, pq);
266 else
267 50202 v->vc1dsp.vc1_v_loop_filter16(dst, s->linesize, pq);
268 }
269 }
270
271 42878 void ff_vc1_i_loop_filter(VC1Context *v)
272 {
273 42878 MpegEncContext *s = &v->s;
274 42878 int block_count = CONFIG_GRAY && (s->avctx->flags & AV_CODEC_FLAG_GRAY) ? 4 : 6;
275 42878 int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
276 uint8_t *dest, fieldtx;
277 42878 uint32_t flags = 0;
278 int i;
279
280 /* Within a MB, the vertical loop filter always runs before the horizontal.
281 * To accomplish that, we run the V loop filter on top and internal
282 * horizontal borders of the last overlap filtered MB. Then, we wait for
283 * the loop filter iteration on the next row to do V loop filter on the
284 * bottom edge of this MB, before moving over and running the H loop
285 * filter on the left and internal vertical borders. Therefore, the loop
286 * filter trails by one row and one column relative to the overlap filter
287 * and two rows and two columns relative to the decoding loop. */
288
2/2
✓ Branch 0 taken 39724 times.
✓ Branch 1 taken 3154 times.
42878 if (!s->first_slice_line) {
289 39724 dest = s->dest[0] - 16 * s->linesize - 16;
290
2/2
✓ Branch 0 taken 2976 times.
✓ Branch 1 taken 36748 times.
39724 flags = s->mb_y == s->start_mb_y + 1 ? TOP_EDGE : 0;
291
2/2
✓ Branch 0 taken 38274 times.
✓ Branch 1 taken 1450 times.
39724 if (s->mb_x) {
292 38274 fieldtx = v->fieldtx_plane[mb_pos - s->mb_stride - 1];
293
2/2
✓ Branch 0 taken 229644 times.
✓ Branch 1 taken 38274 times.
267918 for (i = 0; i < block_count; i++)
294
2/2
✓ Branch 0 taken 76548 times.
✓ Branch 1 taken 153096 times.
229644 vc1_i_v_loop_filter(v, i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize - 8 : dest, flags, fieldtx, i);
295 }
296
2/2
✓ Branch 0 taken 1450 times.
✓ Branch 1 taken 38274 times.
39724 if (s->mb_x == v->end_mb_x - 1) {
297 1450 dest += 16;
298 1450 fieldtx = v->fieldtx_plane[mb_pos - s->mb_stride];
299
2/2
✓ Branch 0 taken 8700 times.
✓ Branch 1 taken 1450 times.
10150 for (i = 0; i < block_count; i++)
300
2/2
✓ Branch 0 taken 2900 times.
✓ Branch 1 taken 5800 times.
8700 vc1_i_v_loop_filter(v, i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize : dest, flags, fieldtx, i);
301 }
302 }
303
2/2
✓ Branch 0 taken 3154 times.
✓ Branch 1 taken 39724 times.
42878 if (s->mb_y == s->end_mb_y - 1) {
304 3154 dest = s->dest[0] - 16;
305
2/2
✓ Branch 0 taken 178 times.
✓ Branch 1 taken 2976 times.
3154 flags = s->first_slice_line ? TOP_EDGE | BOTTOM_EDGE : BOTTOM_EDGE;
306
2/2
✓ Branch 0 taken 2984 times.
✓ Branch 1 taken 170 times.
3154 if (s->mb_x) {
307 2984 fieldtx = v->fieldtx_plane[mb_pos - 1];
308
2/2
✓ Branch 0 taken 17904 times.
✓ Branch 1 taken 2984 times.
20888 for (i = 0; i < block_count; i++)
309
2/2
✓ Branch 0 taken 5968 times.
✓ Branch 1 taken 11936 times.
17904 vc1_i_v_loop_filter(v, i > 3 ? s->dest[i - 3] - 8 : dest, flags, fieldtx, i);
310 }
311
2/2
✓ Branch 0 taken 170 times.
✓ Branch 1 taken 2984 times.
3154 if (s->mb_x == v->end_mb_x - 1) {
312 170 dest += 16;
313 170 fieldtx = v->fieldtx_plane[mb_pos];
314
2/2
✓ Branch 0 taken 1020 times.
✓ Branch 1 taken 170 times.
1190 for (i = 0; i < block_count; i++)
315
2/2
✓ Branch 0 taken 340 times.
✓ Branch 1 taken 680 times.
1020 vc1_i_v_loop_filter(v, i > 3 ? s->dest[i - 3] : dest, flags, fieldtx, i);
316 }
317 }
318
319
2/2
✓ Branch 0 taken 36748 times.
✓ Branch 1 taken 6130 times.
42878 if (s->mb_y >= s->start_mb_y + 2) {
320 36748 dest = s->dest[0] - 32 * s->linesize - 16;
321
2/2
✓ Branch 0 taken 35464 times.
✓ Branch 1 taken 1284 times.
36748 if (s->mb_x) {
322 35464 flags = s->mb_x == 1 ? LEFT_EDGE : 0;
323
2/2
✓ Branch 0 taken 212784 times.
✓ Branch 1 taken 35464 times.
248248 for (i = 0; i < block_count; i++)
324
2/2
✓ Branch 0 taken 70928 times.
✓ Branch 1 taken 141856 times.
212784 vc1_i_h_loop_filter(v, i > 3 ? s->dest[i - 3] - 16 * s->uvlinesize - 8 : dest, flags, i);
325 }
326
2/2
✓ Branch 0 taken 1284 times.
✓ Branch 1 taken 35464 times.
36748 if (s->mb_x == v->end_mb_x - 1) {
327 1284 dest += 16;
328
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1284 times.
1284 flags = s->mb_x == 0 ? LEFT_EDGE | RIGHT_EDGE : RIGHT_EDGE;
329
2/2
✓ Branch 0 taken 7704 times.
✓ Branch 1 taken 1284 times.
8988 for (i = 0; i < block_count; i++)
330
2/2
✓ Branch 0 taken 2568 times.
✓ Branch 1 taken 5136 times.
7704 vc1_i_h_loop_filter(v, i > 3 ? s->dest[i - 3] - 16 * s->uvlinesize : dest, flags, i);
331 }
332 }
333
2/2
✓ Branch 0 taken 3154 times.
✓ Branch 1 taken 39724 times.
42878 if (s->mb_y == s->end_mb_y - 1) {
334
2/2
✓ Branch 0 taken 2976 times.
✓ Branch 1 taken 178 times.
3154 if (s->mb_y >= s->start_mb_y + 1) {
335 2976 dest = s->dest[0] - 16 * s->linesize - 16;
336
2/2
✓ Branch 0 taken 2810 times.
✓ Branch 1 taken 166 times.
2976 if (s->mb_x) {
337 2810 flags = s->mb_x == 1 ? LEFT_EDGE : 0;
338
2/2
✓ Branch 0 taken 16860 times.
✓ Branch 1 taken 2810 times.
19670 for (i = 0; i < block_count; i++)
339
2/2
✓ Branch 0 taken 5620 times.
✓ Branch 1 taken 11240 times.
16860 vc1_i_h_loop_filter(v, i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize - 8 : dest, flags, i);
340 }
341
2/2
✓ Branch 0 taken 166 times.
✓ Branch 1 taken 2810 times.
2976 if (s->mb_x == v->end_mb_x - 1) {
342
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 166 times.
166 flags = s->mb_x == 0 ? LEFT_EDGE | RIGHT_EDGE : RIGHT_EDGE;
343 166 dest += 16;
344
2/2
✓ Branch 0 taken 996 times.
✓ Branch 1 taken 166 times.
1162 for (i = 0; i < block_count; i++)
345
2/2
✓ Branch 0 taken 332 times.
✓ Branch 1 taken 664 times.
996 vc1_i_h_loop_filter(v, i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize : dest, flags, i);
346 }
347 }
348 3154 dest = s->dest[0] - 16;
349
2/2
✓ Branch 0 taken 2984 times.
✓ Branch 1 taken 170 times.
3154 if (s->mb_x) {
350 2984 flags = s->mb_x == 1 ? LEFT_EDGE : 0;
351
2/2
✓ Branch 0 taken 17904 times.
✓ Branch 1 taken 2984 times.
20888 for (i = 0; i < block_count; i++)
352
2/2
✓ Branch 0 taken 5968 times.
✓ Branch 1 taken 11936 times.
17904 vc1_i_h_loop_filter(v, i > 3 ? s->dest[i - 3] - 8 : dest, flags, i);
353 }
354
2/2
✓ Branch 0 taken 170 times.
✓ Branch 1 taken 2984 times.
3154 if (s->mb_x == v->end_mb_x - 1) {
355 170 dest += 16;
356
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 170 times.
170 flags = s->mb_x == 0 ? LEFT_EDGE | RIGHT_EDGE : RIGHT_EDGE;
357
2/2
✓ Branch 0 taken 1020 times.
✓ Branch 1 taken 170 times.
1190 for (i = 0; i < block_count; i++)
358
2/2
✓ Branch 0 taken 340 times.
✓ Branch 1 taken 680 times.
1020 vc1_i_h_loop_filter(v, i > 3 ? s->dest[i - 3] : dest, flags, i);
359 }
360 }
361 42878 }
362
363 787344 static av_always_inline void vc1_p_h_loop_filter(VC1Context *v, uint8_t *dest, uint32_t *cbp,
364 uint8_t *is_intra, int16_t (*mv)[2], uint8_t *mv_f,
365 int *ttblk, uint32_t flags, int block_num)
366 {
367 787344 MpegEncContext *s = &v->s;
368 787344 int pq = v->pq;
369 787344 uint32_t left_cbp = cbp[0] >> (block_num * 4), right_cbp;
370 uint8_t left_is_intra, right_is_intra;
371 int tt;
372
2/2
✓ Branch 0 taken 262448 times.
✓ Branch 1 taken 524896 times.
787344 int idx, linesize = block_num > 3 ? s->uvlinesize : s->linesize;
373 uint8_t *dst;
374
375
2/2
✓ Branch 0 taken 262448 times.
✓ Branch 1 taken 524896 times.
787344 if (block_num > 3)
376 262448 dst = dest;
377 else
378 524896 dst = dest + (block_num & 2) * 4 * s->linesize + (block_num & 1) * 8;
379
380
4/4
✓ Branch 0 taken 22842 times.
✓ Branch 1 taken 764502 times.
✓ Branch 2 taken 7614 times.
✓ Branch 3 taken 15228 times.
787344 if (!(flags & RIGHT_EDGE) || !(block_num & 5)) {
381 772116 left_is_intra = is_intra[0] & (1 << block_num);
382
383
2/2
✓ Branch 0 taken 254834 times.
✓ Branch 1 taken 517282 times.
772116 if (block_num > 3) {
384 254834 right_is_intra = is_intra[1] & (1 << block_num);
385 254834 right_cbp = cbp[1] >> (block_num * 4);
386
2/2
✓ Branch 0 taken 254834 times.
✓ Branch 1 taken 262448 times.
517282 } else if (block_num & 1) {
387 254834 right_is_intra = is_intra[1] & (1 << block_num - 1);
388 254834 right_cbp = cbp[1] >> ((block_num - 1) * 4);
389 } else {
390 262448 right_is_intra = is_intra[0] & (1 << block_num + 1);
391 262448 right_cbp = cbp[0] >> ((block_num + 1) * 4);
392 }
393
394
4/4
✓ Branch 0 taken 575422 times.
✓ Branch 1 taken 196694 times.
✓ Branch 2 taken 496503 times.
✓ Branch 3 taken 78919 times.
772116 if (left_is_intra || right_is_intra ||
395
4/4
✓ Branch 0 taken 309318 times.
✓ Branch 1 taken 187185 times.
✓ Branch 2 taken 271431 times.
✓ Branch 3 taken 37887 times.
496503 mv[0][0] != mv[1][0] || mv[0][1] != mv[1][1] ||
396
4/4
✓ Branch 0 taken 80650 times.
✓ Branch 1 taken 190781 times.
✓ Branch 2 taken 5796 times.
✓ Branch 3 taken 74854 times.
271431 (v->fcm == ILACE_FIELD && mv_f[0] != mv_f[1]))
397 506481 v->vc1dsp.vc1_h_loop_filter8(dst + 8, linesize, pq);
398 else {
399 265635 idx = (left_cbp | (right_cbp >> 1)) & 5;
400
2/2
✓ Branch 0 taken 104922 times.
✓ Branch 1 taken 160713 times.
265635 if (idx & 1)
401 104922 v->vc1dsp.vc1_h_loop_filter4(dst + 4 * linesize + 8, linesize, pq);
402
2/2
✓ Branch 0 taken 104480 times.
✓ Branch 1 taken 161155 times.
265635 if (idx & 4)
403 104480 v->vc1dsp.vc1_h_loop_filter4(dst + 8, linesize, pq);
404 }
405 }
406
407 787344 tt = ttblk[0] >> (block_num * 4) & 0xf;
408
4/4
✓ Branch 0 taken 751163 times.
✓ Branch 1 taken 36181 times.
✓ Branch 2 taken 49749 times.
✓ Branch 3 taken 701414 times.
787344 if (tt == TT_4X4 || tt == TT_4X8) {
409
2/2
✓ Branch 0 taken 79045 times.
✓ Branch 1 taken 6885 times.
85930 if (left_cbp & 3)
410 79045 v->vc1dsp.vc1_h_loop_filter4(dst + 4 * linesize + 4, linesize, pq);
411
2/2
✓ Branch 0 taken 78481 times.
✓ Branch 1 taken 7449 times.
85930 if (left_cbp & 12)
412 78481 v->vc1dsp.vc1_h_loop_filter4(dst + 4, linesize, pq);
413 }
414 787344 }
415
416 static av_always_inline
417 787344 void vc1_p_v_loop_filter(VC1Context *v, uint8_t *dest, const uint32_t *cbp,
418 const uint8_t *is_intra, int16_t (*mv)[2], const uint8_t *mv_f,
419 const int *ttblk, uint32_t flags, int block_num)
420 {
421 787344 MpegEncContext *s = &v->s;
422 787344 int pq = v->pq;
423 787344 uint32_t top_cbp = cbp[0] >> (block_num * 4), bottom_cbp;
424 uint8_t top_is_intra, bottom_is_intra;
425 int tt;
426
2/2
✓ Branch 0 taken 262448 times.
✓ Branch 1 taken 524896 times.
787344 int idx, linesize = block_num > 3 ? s->uvlinesize : s->linesize;
427 uint8_t *dst;
428
429
2/2
✓ Branch 0 taken 262448 times.
✓ Branch 1 taken 524896 times.
787344 if (block_num > 3)
430 262448 dst = dest;
431 else
432 524896 dst = dest + (block_num & 2) * 4 * s->linesize + (block_num & 1) * 8;
433
434
4/4
✓ Branch 0 taken 201216 times.
✓ Branch 1 taken 586128 times.
✓ Branch 2 taken 67072 times.
✓ Branch 3 taken 134144 times.
787344 if(!(flags & BOTTOM_EDGE) || block_num < 2) {
435 653200 top_is_intra = is_intra[0] & (1 << block_num);
436
437
2/2
✓ Branch 0 taken 195376 times.
✓ Branch 1 taken 457824 times.
653200 if (block_num > 3) {
438 195376 bottom_is_intra = is_intra[s->mb_stride] & (1 << block_num);
439 195376 bottom_cbp = cbp[s->mb_stride] >> (block_num * 4);
440
2/2
✓ Branch 0 taken 262448 times.
✓ Branch 1 taken 195376 times.
457824 } else if (block_num < 2) {
441 262448 bottom_is_intra = is_intra[0] & (1 << block_num + 2);
442 262448 bottom_cbp = cbp[0] >> ((block_num + 2) * 4);
443 } else {
444 195376 bottom_is_intra = is_intra[s->mb_stride] & (1 << block_num - 2);
445 195376 bottom_cbp = cbp[s->mb_stride] >> ((block_num - 2) * 4);
446 }
447
448
4/4
✓ Branch 0 taken 497372 times.
✓ Branch 1 taken 155828 times.
✓ Branch 2 taken 443018 times.
✓ Branch 3 taken 54354 times.
653200 if (top_is_intra || bottom_is_intra ||
449
4/4
✓ Branch 0 taken 125238 times.
✓ Branch 1 taken 317780 times.
✓ Branch 2 taken 281193 times.
✓ Branch 3 taken 161825 times.
443018 mv[0][0] != mv[block_num > 3 ? s->mb_stride : s->b8_stride][0] ||
450
4/4
✓ Branch 0 taken 55496 times.
✓ Branch 1 taken 225697 times.
✓ Branch 2 taken 245396 times.
✓ Branch 3 taken 35797 times.
281193 mv[0][1] != mv[block_num > 3 ? s->mb_stride : s->b8_stride][1] ||
451
6/6
✓ Branch 0 taken 75136 times.
✓ Branch 1 taken 170260 times.
✓ Branch 2 taken 13094 times.
✓ Branch 3 taken 62042 times.
✓ Branch 4 taken 6349 times.
✓ Branch 5 taken 68787 times.
245396 (v->fcm == ILACE_FIELD && mv_f[0] != mv_f[block_num > 3 ? s->mb_stride : s->b8_stride]))
452 414153 v->vc1dsp.vc1_v_loop_filter8(dst + 8 * linesize, linesize, pq);
453 else {
454 239047 idx = (top_cbp | (bottom_cbp >> 2)) & 3;
455
2/2
✓ Branch 0 taken 99812 times.
✓ Branch 1 taken 139235 times.
239047 if (idx & 1)
456 99812 v->vc1dsp.vc1_v_loop_filter4(dst + 8 * linesize + 4, linesize, pq);
457
2/2
✓ Branch 0 taken 99786 times.
✓ Branch 1 taken 139261 times.
239047 if (idx & 2)
458 99786 v->vc1dsp.vc1_v_loop_filter4(dst + 8 * linesize, linesize, pq);
459 }
460 }
461
462 787344 tt = ttblk[0] >> (block_num * 4) & 0xf;
463
4/4
✓ Branch 0 taken 751163 times.
✓ Branch 1 taken 36181 times.
✓ Branch 2 taken 49424 times.
✓ Branch 3 taken 701739 times.
787344 if (tt == TT_4X4 || tt == TT_8X4) {
464
2/2
✓ Branch 0 taken 79159 times.
✓ Branch 1 taken 6446 times.
85605 if (top_cbp & 5)
465 79159 v->vc1dsp.vc1_v_loop_filter4(dst + 4 * linesize + 4, linesize, pq);
466
2/2
✓ Branch 0 taken 79196 times.
✓ Branch 1 taken 6409 times.
85605 if (top_cbp & 10)
467 79196 v->vc1dsp.vc1_v_loop_filter4(dst + 4 * linesize, linesize, pq);
468 }
469 787344 }
470
471 131248 void ff_vc1_p_loop_filter(VC1Context *v)
472 {
473 131248 MpegEncContext *s = &v->s;
474 131248 int block_count = CONFIG_GRAY && (s->avctx->flags & AV_CODEC_FLAG_GRAY) ? 4 : 6;
475 uint8_t *dest;
476 uint32_t *cbp;
477 uint8_t *is_intra;
478 int16_t (*uvmv)[2];
479 int *ttblk;
480 uint32_t flags;
481 int i;
482
483 /* Within a MB, the vertical loop filter always runs before the horizontal.
484 * To accomplish that, we run the V loop filter on all applicable
485 * horizontal borders of the MB above the last overlap filtered MB. Then,
486 * we wait for the next loop filter iteration to do H loop filter on all
487 * applicable vertical borders of this MB. Therefore, the loop filter
488 * trails by one row and one column relative to the overlap filter and two
489 * rows and two columns relative to the decoding loop. */
490
2/2
✓ Branch 0 taken 83223 times.
✓ Branch 1 taken 48025 times.
131248 if (s->mb_y >= s->start_mb_y + 2) {
491
2/2
✓ Branch 0 taken 80713 times.
✓ Branch 1 taken 2510 times.
83223 if (s->mb_x) {
492 80713 dest = s->dest[0] - 32 * s->linesize - 16;
493 80713 cbp = &v->cbp[s->mb_x - 2 * s->mb_stride - 1];
494 80713 is_intra = &v->is_intra[s->mb_x - 2 * s->mb_stride - 1];
495 80713 uvmv = &v->luma_mv[s->mb_x - 2 * s->mb_stride - 1];
496 80713 ttblk = &v->ttblk[s->mb_x - 2 * s->mb_stride - 1];
497
2/2
✓ Branch 0 taken 9923 times.
✓ Branch 1 taken 70790 times.
80713 flags = s->mb_y == s->start_mb_y + 2 ? TOP_EDGE : 0;
498
2/2
✓ Branch 0 taken 484278 times.
✓ Branch 1 taken 80713 times.
564991 for (i = 0; i < block_count; i++)
499
6/6
✓ Branch 0 taken 161426 times.
✓ Branch 1 taken 322852 times.
✓ Branch 2 taken 322852 times.
✓ Branch 3 taken 161426 times.
✓ Branch 4 taken 161426 times.
✓ Branch 5 taken 322852 times.
1452834 vc1_p_v_loop_filter(v,
500 161426 i > 3 ? s->dest[i - 3] - 16 * s->uvlinesize - 8 : dest,
501 cbp,
502 is_intra,
503 i > 3 ? uvmv :
504 322852 &s->cur_pic.motion_val[0][s->block_index[i] - 4 * s->b8_stride - 2 + v->blocks_off],
505 161426 i > 3 ? &v->mv_f[0][s->block_index[i] - 2 * s->mb_stride - 1 + v->mb_off] :
506 322852 &v->mv_f[0][s->block_index[i] - 4 * s->b8_stride - 2 + v->blocks_off],
507 ttblk,
508 flags,
509 i);
510 }
511
2/2
✓ Branch 0 taken 2510 times.
✓ Branch 1 taken 80713 times.
83223 if (s->mb_x == s->mb_width - 1) {
512 2510 dest = s->dest[0] - 32 * s->linesize;
513 2510 cbp = &v->cbp[s->mb_x - 2 * s->mb_stride];
514 2510 is_intra = &v->is_intra[s->mb_x - 2 * s->mb_stride];
515 2510 uvmv = &v->luma_mv[s->mb_x - 2 * s->mb_stride];
516 2510 ttblk = &v->ttblk[s->mb_x - 2 * s->mb_stride];
517
2/2
✓ Branch 0 taken 338 times.
✓ Branch 1 taken 2172 times.
2510 flags = s->mb_y == s->start_mb_y + 2 ? TOP_EDGE : 0;
518
2/2
✓ Branch 0 taken 15060 times.
✓ Branch 1 taken 2510 times.
17570 for (i = 0; i < block_count; i++)
519
6/6
✓ Branch 0 taken 5020 times.
✓ Branch 1 taken 10040 times.
✓ Branch 2 taken 10040 times.
✓ Branch 3 taken 5020 times.
✓ Branch 4 taken 5020 times.
✓ Branch 5 taken 10040 times.
45180 vc1_p_v_loop_filter(v,
520 5020 i > 3 ? s->dest[i - 3] - 16 * s->uvlinesize : dest,
521 cbp,
522 is_intra,
523 i > 3 ? uvmv :
524 10040 &s->cur_pic.motion_val[0][s->block_index[i] - 4 * s->b8_stride + v->blocks_off],
525 5020 i > 3 ? &v->mv_f[0][s->block_index[i] - 2 * s->mb_stride + v->mb_off] :
526 10040 &v->mv_f[0][s->block_index[i] - 4 * s->b8_stride + v->blocks_off],
527 ttblk,
528 flags,
529 i);
530 }
531 }
532
2/2
✓ Branch 0 taken 33536 times.
✓ Branch 1 taken 97712 times.
131248 if (s->mb_y == s->end_mb_y - 1) {
533
2/2
✓ Branch 0 taken 32672 times.
✓ Branch 1 taken 864 times.
33536 if (s->mb_x) {
534
2/2
✓ Branch 0 taken 14032 times.
✓ Branch 1 taken 18640 times.
32672 if (s->mb_y >= s->start_mb_y + 1) {
535 14032 dest = s->dest[0] - 16 * s->linesize - 16;
536 14032 cbp = &v->cbp[s->mb_x - s->mb_stride - 1];
537 14032 is_intra = &v->is_intra[s->mb_x - s->mb_stride - 1];
538 14032 uvmv = &v->luma_mv[s->mb_x - s->mb_stride - 1];
539 14032 ttblk = &v->ttblk[s->mb_x - s->mb_stride - 1];
540
2/2
✓ Branch 0 taken 4109 times.
✓ Branch 1 taken 9923 times.
14032 flags = s->mb_y == s->start_mb_y + 1 ? TOP_EDGE : 0;
541
2/2
✓ Branch 0 taken 84192 times.
✓ Branch 1 taken 14032 times.
98224 for (i = 0; i < block_count; i++)
542
6/6
✓ Branch 0 taken 28064 times.
✓ Branch 1 taken 56128 times.
✓ Branch 2 taken 56128 times.
✓ Branch 3 taken 28064 times.
✓ Branch 4 taken 28064 times.
✓ Branch 5 taken 56128 times.
252576 vc1_p_v_loop_filter(v,
543 28064 i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize - 8 : dest,
544 cbp,
545 is_intra,
546 i > 3 ? uvmv :
547 56128 &s->cur_pic.motion_val[0][s->block_index[i] - 2 * s->b8_stride - 2 + v->blocks_off],
548 28064 i > 3 ? &v->mv_f[0][s->block_index[i] - s->mb_stride - 1 + v->mb_off] :
549 56128 &v->mv_f[0][s->block_index[i] - 2 * s->b8_stride - 2 + v->blocks_off],
550 ttblk,
551 flags,
552 i);
553 }
554 32672 dest = s->dest[0] - 16;
555 32672 cbp = &v->cbp[s->mb_x - 1];
556 32672 is_intra = &v->is_intra[s->mb_x - 1];
557 32672 uvmv = &v->luma_mv[s->mb_x - 1];
558 32672 ttblk = &v->ttblk[s->mb_x - 1];
559
2/2
✓ Branch 0 taken 18640 times.
✓ Branch 1 taken 14032 times.
32672 flags = s->mb_y == s->start_mb_y ? TOP_EDGE | BOTTOM_EDGE : BOTTOM_EDGE;
560
2/2
✓ Branch 0 taken 196032 times.
✓ Branch 1 taken 32672 times.
228704 for (i = 0; i < block_count; i++)
561
6/6
✓ Branch 0 taken 65344 times.
✓ Branch 1 taken 130688 times.
✓ Branch 2 taken 130688 times.
✓ Branch 3 taken 65344 times.
✓ Branch 4 taken 65344 times.
✓ Branch 5 taken 130688 times.
588096 vc1_p_v_loop_filter(v,
562 65344 i > 3 ? s->dest[i - 3] - 8 : dest,
563 cbp,
564 is_intra,
565 i > 3 ? uvmv :
566 130688 &s->cur_pic.motion_val[0][s->block_index[i] - 2 + v->blocks_off],
567 65344 i > 3 ? &v->mv_f[0][s->block_index[i] - 1 + v->mb_off] :
568 130688 &v->mv_f[0][s->block_index[i] - 2 + v->blocks_off],
569 ttblk,
570 flags,
571 i);
572 }
573
2/2
✓ Branch 0 taken 864 times.
✓ Branch 1 taken 32672 times.
33536 if (s->mb_x == s->mb_width - 1) {
574
2/2
✓ Branch 0 taken 433 times.
✓ Branch 1 taken 431 times.
864 if (s->mb_y >= s->start_mb_y + 1) {
575 433 dest = s->dest[0] - 16 * s->linesize;
576 433 cbp = &v->cbp[s->mb_x - s->mb_stride];
577 433 is_intra = &v->is_intra[s->mb_x - s->mb_stride];
578 433 uvmv = &v->luma_mv[s->mb_x - s->mb_stride];
579 433 ttblk = &v->ttblk[s->mb_x - s->mb_stride];
580
2/2
✓ Branch 0 taken 95 times.
✓ Branch 1 taken 338 times.
433 flags = s->mb_y == s->start_mb_y + 1 ? TOP_EDGE : 0;
581
2/2
✓ Branch 0 taken 2598 times.
✓ Branch 1 taken 433 times.
3031 for (i = 0; i < block_count; i++)
582
6/6
✓ Branch 0 taken 866 times.
✓ Branch 1 taken 1732 times.
✓ Branch 2 taken 1732 times.
✓ Branch 3 taken 866 times.
✓ Branch 4 taken 866 times.
✓ Branch 5 taken 1732 times.
7794 vc1_p_v_loop_filter(v,
583 866 i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize : dest,
584 cbp,
585 is_intra,
586 i > 3 ? uvmv :
587 1732 &s->cur_pic.motion_val[0][s->block_index[i] - 2 * s->b8_stride + v->blocks_off],
588 866 i > 3 ? &v->mv_f[0][s->block_index[i] - s->mb_stride + v->mb_off] :
589 1732 &v->mv_f[0][s->block_index[i] - 2 * s->b8_stride + v->blocks_off],
590 ttblk,
591 flags,
592 i);
593 }
594 864 dest = s->dest[0];
595 864 cbp = &v->cbp[s->mb_x];
596 864 is_intra = &v->is_intra[s->mb_x];
597 864 uvmv = &v->luma_mv[s->mb_x];
598 864 ttblk = &v->ttblk[s->mb_x];
599
2/2
✓ Branch 0 taken 431 times.
✓ Branch 1 taken 433 times.
864 flags = s->mb_y == s->start_mb_y ? TOP_EDGE | BOTTOM_EDGE : BOTTOM_EDGE;
600
2/2
✓ Branch 0 taken 5184 times.
✓ Branch 1 taken 864 times.
6048 for (i = 0; i < block_count; i++)
601
6/6
✓ Branch 0 taken 1728 times.
✓ Branch 1 taken 3456 times.
✓ Branch 2 taken 3456 times.
✓ Branch 3 taken 1728 times.
✓ Branch 4 taken 1728 times.
✓ Branch 5 taken 3456 times.
15552 vc1_p_v_loop_filter(v,
602 1728 i > 3 ? s->dest[i - 3] : dest,
603 cbp,
604 is_intra,
605 i > 3 ? uvmv :
606 3456 &s->cur_pic.motion_val[0][s->block_index[i] + v->blocks_off],
607 1728 i > 3 ? &v->mv_f[0][s->block_index[i] + v->mb_off] :
608 3456 &v->mv_f[0][s->block_index[i] + v->blocks_off],
609 ttblk,
610 flags,
611 i);
612 }
613 }
614
615
2/2
✓ Branch 0 taken 83223 times.
✓ Branch 1 taken 48025 times.
131248 if (s->mb_y >= s->start_mb_y + 2) {
616
2/2
✓ Branch 0 taken 78203 times.
✓ Branch 1 taken 5020 times.
83223 if (s->mb_x >= 2) {
617 78203 dest = s->dest[0] - 32 * s->linesize - 32;
618 78203 cbp = &v->cbp[s->mb_x - 2 * s->mb_stride - 2];
619 78203 is_intra = &v->is_intra[s->mb_x - 2 * s->mb_stride - 2];
620 78203 uvmv = &v->luma_mv[s->mb_x - 2 * s->mb_stride - 2];
621 78203 ttblk = &v->ttblk[s->mb_x - 2 * s->mb_stride - 2];
622 78203 flags = s->mb_x == 2 ? LEFT_EDGE : 0;
623
2/2
✓ Branch 0 taken 469218 times.
✓ Branch 1 taken 78203 times.
547421 for (i = 0; i < block_count; i++)
624
6/6
✓ Branch 0 taken 156406 times.
✓ Branch 1 taken 312812 times.
✓ Branch 2 taken 312812 times.
✓ Branch 3 taken 156406 times.
✓ Branch 4 taken 156406 times.
✓ Branch 5 taken 312812 times.
1407654 vc1_p_h_loop_filter(v,
625 156406 i > 3 ? s->dest[i - 3] - 16 * s->uvlinesize - 16 : dest,
626 cbp,
627 is_intra,
628 i > 3 ? uvmv :
629 312812 &s->cur_pic.motion_val[0][s->block_index[i] - 4 * s->b8_stride - 4 + v->blocks_off],
630 156406 i > 3 ? &v->mv_f[0][s->block_index[i] - 2 * s->mb_stride - 2 + v->mb_off] :
631 312812 &v->mv_f[0][s->block_index[i] - 4 * s->b8_stride - 4 + v->blocks_off],
632 ttblk,
633 flags,
634 i);
635 }
636
2/2
✓ Branch 0 taken 2510 times.
✓ Branch 1 taken 80713 times.
83223 if (s->mb_x == s->mb_width - 1) {
637
1/2
✓ Branch 0 taken 2510 times.
✗ Branch 1 not taken.
2510 if (s->mb_x >= 1) {
638 2510 dest = s->dest[0] - 32 * s->linesize - 16;
639 2510 cbp = &v->cbp[s->mb_x - 2 * s->mb_stride - 1];
640 2510 is_intra = &v->is_intra[s->mb_x - 2 * s->mb_stride - 1];
641 2510 uvmv = &v->luma_mv[s->mb_x - 2 * s->mb_stride - 1];
642 2510 ttblk = &v->ttblk[s->mb_x - 2 * s->mb_stride - 1];
643 2510 flags = s->mb_x == 1 ? LEFT_EDGE : 0;
644
2/2
✓ Branch 0 taken 15060 times.
✓ Branch 1 taken 2510 times.
17570 for (i = 0; i < block_count; i++)
645
6/6
✓ Branch 0 taken 5020 times.
✓ Branch 1 taken 10040 times.
✓ Branch 2 taken 10040 times.
✓ Branch 3 taken 5020 times.
✓ Branch 4 taken 5020 times.
✓ Branch 5 taken 10040 times.
45180 vc1_p_h_loop_filter(v,
646 5020 i > 3 ? s->dest[i - 3] - 16 * s->uvlinesize - 8 : dest,
647 cbp,
648 is_intra,
649 i > 3 ? uvmv :
650 10040 &s->cur_pic.motion_val[0][s->block_index[i] - 4 * s->b8_stride - 2 + v->blocks_off],
651 5020 i > 3 ? &v->mv_f[0][s->block_index[i] - 2 * s->mb_stride - 1 + v->mb_off] :
652 10040 &v->mv_f[0][s->block_index[i] - 4 * s->b8_stride - 2 + v->blocks_off],
653 ttblk,
654 flags,
655 i);
656 }
657 2510 dest = s->dest[0] - 32 * s->linesize;
658 2510 cbp = &v->cbp[s->mb_x - 2 * s->mb_stride];
659 2510 is_intra = &v->is_intra[s->mb_x - 2 * s->mb_stride];
660 2510 uvmv = &v->luma_mv[s->mb_x - 2 * s->mb_stride];
661 2510 ttblk = &v->ttblk[s->mb_x - 2 * s->mb_stride];
662
1/2
✓ Branch 0 taken 2510 times.
✗ Branch 1 not taken.
2510 flags = s->mb_x ? RIGHT_EDGE : LEFT_EDGE | RIGHT_EDGE;
663
2/2
✓ Branch 0 taken 15060 times.
✓ Branch 1 taken 2510 times.
17570 for (i = 0; i < block_count; i++)
664
6/6
✓ Branch 0 taken 5020 times.
✓ Branch 1 taken 10040 times.
✓ Branch 2 taken 10040 times.
✓ Branch 3 taken 5020 times.
✓ Branch 4 taken 5020 times.
✓ Branch 5 taken 10040 times.
45180 vc1_p_h_loop_filter(v,
665 5020 i > 3 ? s->dest[i - 3] - 16 * s->uvlinesize : dest,
666 cbp,
667 is_intra,
668 i > 3 ? uvmv :
669 10040 &s->cur_pic.motion_val[0][s->block_index[i] - 4 * s->b8_stride + v->blocks_off],
670 5020 i > 3 ? &v->mv_f[0][s->block_index[i] - 2 * s->mb_stride + v->mb_off] :
671 10040 &v->mv_f[0][s->block_index[i] - 4 * s->b8_stride + v->blocks_off],
672 ttblk,
673 flags,
674 i);
675 }
676 }
677
2/2
✓ Branch 0 taken 33536 times.
✓ Branch 1 taken 97712 times.
131248 if (s->mb_y == s->end_mb_y - 1) {
678
2/2
✓ Branch 0 taken 14465 times.
✓ Branch 1 taken 19071 times.
33536 if (s->mb_y >= s->start_mb_y + 1) {
679
2/2
✓ Branch 0 taken 13599 times.
✓ Branch 1 taken 866 times.
14465 if (s->mb_x >= 2) {
680 13599 dest = s->dest[0] - 16 * s->linesize - 32;
681 13599 cbp = &v->cbp[s->mb_x - s->mb_stride - 2];
682 13599 is_intra = &v->is_intra[s->mb_x - s->mb_stride - 2];
683 13599 uvmv = &v->luma_mv[s->mb_x - s->mb_stride - 2];
684 13599 ttblk = &v->ttblk[s->mb_x - s->mb_stride - 2];
685 13599 flags = s->mb_x == 2 ? LEFT_EDGE : 0;
686
2/2
✓ Branch 0 taken 81594 times.
✓ Branch 1 taken 13599 times.
95193 for (i = 0; i < block_count; i++)
687
6/6
✓ Branch 0 taken 27198 times.
✓ Branch 1 taken 54396 times.
✓ Branch 2 taken 54396 times.
✓ Branch 3 taken 27198 times.
✓ Branch 4 taken 27198 times.
✓ Branch 5 taken 54396 times.
244782 vc1_p_h_loop_filter(v,
688 27198 i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize - 16 : dest,
689 cbp,
690 is_intra,
691 i > 3 ? uvmv :
692 54396 &s->cur_pic.motion_val[0][s->block_index[i] - 2 * s->b8_stride - 4 + v->blocks_off],
693 27198 i > 3 ? &v->mv_f[0][s->block_index[i] - s->mb_stride - 2 + v->mb_off] :
694 54396 &v->mv_f[0][s->block_index[i] - 2 * s->b8_stride - 4 + v->blocks_off],
695 ttblk,
696 flags,
697 i);
698 }
699
2/2
✓ Branch 0 taken 433 times.
✓ Branch 1 taken 14032 times.
14465 if (s->mb_x == s->mb_width - 1) {
700
1/2
✓ Branch 0 taken 433 times.
✗ Branch 1 not taken.
433 if (s->mb_x >= 1) {
701 433 dest = s->dest[0] - 16 * s->linesize - 16;
702 433 cbp = &v->cbp[s->mb_x - s->mb_stride - 1];
703 433 is_intra = &v->is_intra[s->mb_x - s->mb_stride - 1];
704 433 uvmv = &v->luma_mv[s->mb_x - s->mb_stride - 1];
705 433 ttblk = &v->ttblk[s->mb_x - s->mb_stride - 1];
706 433 flags = s->mb_x == 1 ? LEFT_EDGE : 0;
707
2/2
✓ Branch 0 taken 2598 times.
✓ Branch 1 taken 433 times.
3031 for (i = 0; i < block_count; i++)
708
6/6
✓ Branch 0 taken 866 times.
✓ Branch 1 taken 1732 times.
✓ Branch 2 taken 1732 times.
✓ Branch 3 taken 866 times.
✓ Branch 4 taken 866 times.
✓ Branch 5 taken 1732 times.
7794 vc1_p_h_loop_filter(v,
709 866 i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize - 8 : dest,
710 cbp,
711 is_intra,
712 i > 3 ? uvmv :
713 1732 &s->cur_pic.motion_val[0][s->block_index[i] - 2 * s->b8_stride - 2 + v->blocks_off],
714 866 i > 3 ? &v->mv_f[0][s->block_index[i] - s->mb_stride - 1 + v->mb_off] :
715 1732 &v->mv_f[0][s->block_index[i] - 2 * s->b8_stride - 2 + v->blocks_off],
716 ttblk,
717 flags,
718 i);
719 }
720 433 dest = s->dest[0] - 16 * s->linesize;
721 433 cbp = &v->cbp[s->mb_x - s->mb_stride];
722 433 is_intra = &v->is_intra[s->mb_x - s->mb_stride];
723 433 uvmv = &v->luma_mv[s->mb_x - s->mb_stride];
724 433 ttblk = &v->ttblk[s->mb_x - s->mb_stride];
725
1/2
✓ Branch 0 taken 433 times.
✗ Branch 1 not taken.
433 flags = s->mb_x ? RIGHT_EDGE : LEFT_EDGE | RIGHT_EDGE;
726
2/2
✓ Branch 0 taken 2598 times.
✓ Branch 1 taken 433 times.
3031 for (i = 0; i < block_count; i++)
727
6/6
✓ Branch 0 taken 866 times.
✓ Branch 1 taken 1732 times.
✓ Branch 2 taken 1732 times.
✓ Branch 3 taken 866 times.
✓ Branch 4 taken 866 times.
✓ Branch 5 taken 1732 times.
7794 vc1_p_h_loop_filter(v,
728 866 i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize : dest,
729 cbp,
730 is_intra,
731 i > 3 ? uvmv :
732 1732 &s->cur_pic.motion_val[0][s->block_index[i] - 2 * s->b8_stride + v->blocks_off],
733 866 i > 3 ? &v->mv_f[0][s->block_index[i] - s->mb_stride + v->mb_off] :
734 1732 &v->mv_f[0][s->block_index[i] - 2 * s->b8_stride + v->blocks_off],
735 ttblk,
736 flags,
737 i);
738 }
739 }
740
2/2
✓ Branch 0 taken 31808 times.
✓ Branch 1 taken 1728 times.
33536 if (s->mb_x >= 2) {
741 31808 dest = s->dest[0] - 32;
742 31808 cbp = &v->cbp[s->mb_x - 2];
743 31808 is_intra = &v->is_intra[s->mb_x - 2];
744 31808 uvmv = &v->luma_mv[s->mb_x - 2];
745 31808 ttblk = &v->ttblk[s->mb_x - 2];
746 31808 flags = s->mb_x == 2 ? LEFT_EDGE : 0;
747
2/2
✓ Branch 0 taken 190848 times.
✓ Branch 1 taken 31808 times.
222656 for (i = 0; i < block_count; i++)
748
6/6
✓ Branch 0 taken 63616 times.
✓ Branch 1 taken 127232 times.
✓ Branch 2 taken 127232 times.
✓ Branch 3 taken 63616 times.
✓ Branch 4 taken 63616 times.
✓ Branch 5 taken 127232 times.
572544 vc1_p_h_loop_filter(v,
749 63616 i > 3 ? s->dest[i - 3] - 16 : dest,
750 cbp,
751 is_intra,
752 i > 3 ? uvmv :
753 127232 &s->cur_pic.motion_val[0][s->block_index[i] - 4 + v->blocks_off],
754 63616 i > 3 ? &v->mv_f[0][s->block_index[i] - 2 + v->mb_off] :
755 127232 &v->mv_f[0][s->block_index[i] - 4 + v->blocks_off],
756 ttblk,
757 flags,
758 i);
759 }
760
2/2
✓ Branch 0 taken 864 times.
✓ Branch 1 taken 32672 times.
33536 if (s->mb_x == s->mb_width - 1) {
761
1/2
✓ Branch 0 taken 864 times.
✗ Branch 1 not taken.
864 if (s->mb_x >= 1) {
762 864 dest = s->dest[0] - 16;
763 864 cbp = &v->cbp[s->mb_x - 1];
764 864 is_intra = &v->is_intra[s->mb_x - 1];
765 864 uvmv = &v->luma_mv[s->mb_x - 1];
766 864 ttblk = &v->ttblk[s->mb_x - 1];
767 864 flags = s->mb_x == 1 ? LEFT_EDGE : 0;
768
2/2
✓ Branch 0 taken 5184 times.
✓ Branch 1 taken 864 times.
6048 for (i = 0; i < block_count; i++)
769
6/6
✓ Branch 0 taken 1728 times.
✓ Branch 1 taken 3456 times.
✓ Branch 2 taken 3456 times.
✓ Branch 3 taken 1728 times.
✓ Branch 4 taken 1728 times.
✓ Branch 5 taken 3456 times.
15552 vc1_p_h_loop_filter(v,
770 1728 i > 3 ? s->dest[i - 3] - 8 : dest,
771 cbp,
772 is_intra,
773 i > 3 ? uvmv :
774 3456 &s->cur_pic.motion_val[0][s->block_index[i] - 2 + v->blocks_off],
775 1728 i > 3 ? &v->mv_f[0][s->block_index[i] - 1 + v->mb_off] :
776 3456 &v->mv_f[0][s->block_index[i] - 2 + v->blocks_off],
777 ttblk,
778 flags,
779 i);
780 }
781 864 dest = s->dest[0];
782 864 cbp = &v->cbp[s->mb_x];
783 864 is_intra = &v->is_intra[s->mb_x];
784 864 uvmv = &v->luma_mv[s->mb_x];
785 864 ttblk = &v->ttblk[s->mb_x];
786
1/2
✓ Branch 0 taken 864 times.
✗ Branch 1 not taken.
864 flags = s->mb_x ? RIGHT_EDGE : LEFT_EDGE | RIGHT_EDGE;
787
2/2
✓ Branch 0 taken 5184 times.
✓ Branch 1 taken 864 times.
6048 for (i = 0; i < block_count; i++)
788
6/6
✓ Branch 0 taken 1728 times.
✓ Branch 1 taken 3456 times.
✓ Branch 2 taken 3456 times.
✓ Branch 3 taken 1728 times.
✓ Branch 4 taken 1728 times.
✓ Branch 5 taken 3456 times.
15552 vc1_p_h_loop_filter(v,
789 1728 i > 3 ? s->dest[i - 3] : dest,
790 cbp,
791 is_intra,
792 i > 3 ? uvmv :
793 3456 &s->cur_pic.motion_val[0][s->block_index[i] + v->blocks_off],
794 1728 i > 3 ? &v->mv_f[0][s->block_index[i] + v->mb_off] :
795 3456 &v->mv_f[0][s->block_index[i] + v->blocks_off],
796 ttblk,
797 flags,
798 i);
799 }
800 }
801 131248 }
802
803 293760 static av_always_inline void vc1_p_h_intfr_loop_filter(VC1Context *v, uint8_t *dest, const int *ttblk,
804 uint32_t flags, uint8_t fieldtx, int block_num)
805 {
806 293760 MpegEncContext *s = &v->s;
807 293760 int pq = v->pq;
808 int tt;
809
2/2
✓ Branch 0 taken 97920 times.
✓ Branch 1 taken 195840 times.
293760 int linesize = block_num > 3 ? s->uvlinesize : s->linesize;
810 uint8_t *dst;
811
812
2/2
✓ Branch 0 taken 97920 times.
✓ Branch 1 taken 195840 times.
293760 if (block_num > 3)
813 97920 dst = dest;
814 else
815 195840 dst = dest + (block_num & 2) * 4 * s->linesize + (block_num & 1) * 8;
816
817 293760 tt = ttblk[0] >> (block_num * 4) & 0xf;
818
2/2
✓ Branch 0 taken 195840 times.
✓ Branch 1 taken 97920 times.
293760 if (block_num < 4) {
819
2/2
✓ Branch 0 taken 81784 times.
✓ Branch 1 taken 114056 times.
195840 if (fieldtx) {
820
2/2
✓ Branch 0 taken 40892 times.
✓ Branch 1 taken 40892 times.
81784 if (block_num < 2) {
821
4/4
✓ Branch 0 taken 38482 times.
✓ Branch 1 taken 2410 times.
✓ Branch 2 taken 5011 times.
✓ Branch 3 taken 33471 times.
40892 if (tt == TT_4X4 || tt == TT_4X8)
822 7421 v->vc1dsp.vc1_h_loop_filter8(dst + 4, 2 * linesize, pq);
823
4/4
✓ Branch 0 taken 340 times.
✓ Branch 1 taken 40552 times.
✓ Branch 2 taken 170 times.
✓ Branch 3 taken 170 times.
40892 if (!(flags & RIGHT_EDGE) || block_num == 0)
824 40722 v->vc1dsp.vc1_h_loop_filter8(dst + 8, 2 * linesize, pq);
825 } else {
826
4/4
✓ Branch 0 taken 38543 times.
✓ Branch 1 taken 2349 times.
✓ Branch 2 taken 4917 times.
✓ Branch 3 taken 33626 times.
40892 if (tt == TT_4X4 || tt == TT_4X8)
827 7266 v->vc1dsp.vc1_h_loop_filter8(dst - 7 * linesize + 4, 2 * linesize, pq);
828
4/4
✓ Branch 0 taken 340 times.
✓ Branch 1 taken 40552 times.
✓ Branch 2 taken 170 times.
✓ Branch 3 taken 170 times.
40892 if (!(flags & RIGHT_EDGE) || block_num == 2)
829 40722 v->vc1dsp.vc1_h_loop_filter8(dst - 7 * linesize + 8, 2 * linesize, pq);
830 }
831 } else {
832
4/4
✓ Branch 0 taken 107886 times.
✓ Branch 1 taken 6170 times.
✓ Branch 2 taken 16740 times.
✓ Branch 3 taken 91146 times.
114056 if(tt == TT_4X4 || tt == TT_4X8) {
833 22910 v->vc1dsp.vc1_h_loop_filter4(dst + 4, 2 * linesize, pq);
834 22910 v->vc1dsp.vc1_h_loop_filter4(dst + linesize + 4, 2 * linesize, pq);
835 }
836
4/4
✓ Branch 0 taken 952 times.
✓ Branch 1 taken 113104 times.
✓ Branch 2 taken 476 times.
✓ Branch 3 taken 476 times.
114056 if (!(flags & RIGHT_EDGE) || !(block_num & 5)) {
837 113580 v->vc1dsp.vc1_h_loop_filter4(dst + 8, 2 * linesize, pq);
838 113580 v->vc1dsp.vc1_h_loop_filter4(dst + linesize + 8, 2 * linesize, pq);
839 }
840 }
841 } else {
842
4/4
✓ Branch 0 taken 95825 times.
✓ Branch 1 taken 2095 times.
✓ Branch 2 taken 10183 times.
✓ Branch 3 taken 85642 times.
97920 if (tt == TT_4X4 || tt == TT_4X8) {
843 12278 v->vc1dsp.vc1_h_loop_filter4(dst + 4, 2 * linesize, pq);
844 12278 v->vc1dsp.vc1_h_loop_filter4(dst + linesize + 4, 2 * linesize, pq);
845 }
846
2/2
✓ Branch 0 taken 97104 times.
✓ Branch 1 taken 816 times.
97920 if (!(flags & RIGHT_EDGE)) {
847 97104 v->vc1dsp.vc1_h_loop_filter4(dst + 8, 2 * linesize, pq);
848 97104 v->vc1dsp.vc1_h_loop_filter4(dst + linesize + 8, 2 * linesize, pq);
849 }
850 }
851 293760 }
852
853 static av_always_inline
854 293760 void vc1_p_v_intfr_loop_filter(VC1Context *v, uint8_t *dest, const int *ttblk,
855 uint32_t flags, uint8_t fieldtx, int block_num)
856 {
857 293760 MpegEncContext *s = &v->s;
858 293760 int pq = v->pq;
859 int tt;
860
2/2
✓ Branch 0 taken 97920 times.
✓ Branch 1 taken 195840 times.
293760 int linesize = block_num > 3 ? s->uvlinesize : s->linesize;
861 uint8_t *dst;
862
863
2/2
✓ Branch 0 taken 97920 times.
✓ Branch 1 taken 195840 times.
293760 if (block_num > 3)
864 97920 dst = dest;
865 else
866 195840 dst = dest + (block_num & 2) * 4 * s->linesize + (block_num & 1) * 8;
867
868 293760 tt = ttblk[0] >> (block_num * 4) & 0xf;
869
2/2
✓ Branch 0 taken 195840 times.
✓ Branch 1 taken 97920 times.
293760 if (block_num < 4) {
870
2/2
✓ Branch 0 taken 81784 times.
✓ Branch 1 taken 114056 times.
195840 if (fieldtx) {
871
2/2
✓ Branch 0 taken 40892 times.
✓ Branch 1 taken 40892 times.
81784 if (block_num < 2) {
872
4/4
✓ Branch 0 taken 38482 times.
✓ Branch 1 taken 2410 times.
✓ Branch 2 taken 5492 times.
✓ Branch 3 taken 32990 times.
40892 if (tt == TT_4X4 || tt == TT_8X4)
873 7902 v->vc1dsp.vc1_v_loop_filter8(dst + 8 * linesize, 2 * linesize, pq);
874
2/2
✓ Branch 0 taken 40500 times.
✓ Branch 1 taken 392 times.
40892 if (!(flags & BOTTOM_EDGE))
875 40500 v->vc1dsp.vc1_v_loop_filter8(dst + 16 * linesize, 2 * linesize, pq);
876 } else {
877
4/4
✓ Branch 0 taken 38543 times.
✓ Branch 1 taken 2349 times.
✓ Branch 2 taken 5227 times.
✓ Branch 3 taken 33316 times.
40892 if (tt == TT_4X4 || tt == TT_8X4)
878 7576 v->vc1dsp.vc1_v_loop_filter8(dst + linesize, 2 * linesize, pq);
879
2/2
✓ Branch 0 taken 40500 times.
✓ Branch 1 taken 392 times.
40892 if (!(flags & BOTTOM_EDGE))
880 40500 v->vc1dsp.vc1_v_loop_filter8(dst + 9 * linesize, 2 * linesize, pq);
881 }
882 } else {
883
2/2
✓ Branch 0 taken 57028 times.
✓ Branch 1 taken 57028 times.
114056 if (block_num < 2) {
884
6/6
✓ Branch 0 taken 56208 times.
✓ Branch 1 taken 820 times.
✓ Branch 2 taken 53138 times.
✓ Branch 3 taken 3070 times.
✓ Branch 4 taken 6577 times.
✓ Branch 5 taken 46561 times.
57028 if (!(flags & TOP_EDGE) && (tt == TT_4X4 || tt == TT_8X4)) {
885 9647 v->vc1dsp.vc1_v_loop_filter8(dst + 4 * linesize, 2 * linesize, pq);
886 9647 v->vc1dsp.vc1_v_loop_filter8(dst + 5 * linesize, 2 * linesize, pq);
887 }
888 57028 v->vc1dsp.vc1_v_loop_filter8(dst + 8 * linesize, 2 * linesize, pq);
889 57028 v->vc1dsp.vc1_v_loop_filter8(dst + 9 * linesize, 2 * linesize, pq);
890
2/2
✓ Branch 0 taken 55980 times.
✓ Branch 1 taken 1048 times.
57028 } else if (!(flags & BOTTOM_EDGE)) {
891
4/4
✓ Branch 0 taken 52932 times.
✓ Branch 1 taken 3048 times.
✓ Branch 2 taken 6565 times.
✓ Branch 3 taken 46367 times.
55980 if (tt == TT_4X4 || tt == TT_8X4) {
892 9613 v->vc1dsp.vc1_v_loop_filter8(dst + 4 * linesize, 2 * linesize, pq);
893 9613 v->vc1dsp.vc1_v_loop_filter8(dst + 5 * linesize, 2 * linesize, pq);
894 }
895 55980 v->vc1dsp.vc1_v_loop_filter8(dst + 8 * linesize, 2 * linesize, pq);
896 55980 v->vc1dsp.vc1_v_loop_filter8(dst + 9 * linesize, 2 * linesize, pq);
897 }
898 }
899 } else {
900
2/2
✓ Branch 0 taken 96480 times.
✓ Branch 1 taken 1440 times.
97920 if (!(flags & BOTTOM_EDGE)) {
901
6/6
✓ Branch 0 taken 95040 times.
✓ Branch 1 taken 1440 times.
✓ Branch 2 taken 92969 times.
✓ Branch 3 taken 2071 times.
✓ Branch 4 taken 7630 times.
✓ Branch 5 taken 85339 times.
96480 if (!(flags & TOP_EDGE) && (tt == TT_4X4 || tt == TT_8X4)) {
902 9701 v->vc1dsp.vc1_v_loop_filter8(dst + 4 * linesize, 2 * linesize, pq);
903 9701 v->vc1dsp.vc1_v_loop_filter8(dst + 5 * linesize, 2 * linesize, pq);
904 }
905 96480 v->vc1dsp.vc1_v_loop_filter8(dst + 8 * linesize, 2 * linesize, pq);
906 96480 v->vc1dsp.vc1_v_loop_filter8(dst + 9 * linesize, 2 * linesize, pq);
907 }
908 }
909 293760 }
910
911 48960 void ff_vc1_p_intfr_loop_filter(VC1Context *v)
912 {
913 48960 MpegEncContext *s = &v->s;
914 48960 int block_count = CONFIG_GRAY && (s->avctx->flags & AV_CODEC_FLAG_GRAY) ? 4 : 6;
915 48960 int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
916 uint8_t *dest;
917 int *ttblk;
918 uint32_t flags;
919 uint8_t fieldtx;
920 int i;
921
922 /* Within a MB, the vertical loop filter always runs before the horizontal.
923 * To accomplish that, we run the V loop filter on all applicable
924 * horizontal borders of the MB above the last overlap filtered MB. Then,
925 * we wait for the loop filter iteration on the next row and next column to
926 * do H loop filter on all applicable vertical borders of this MB.
927 * Therefore, the loop filter trails by two rows and one column relative to
928 * the overlap filter and two rows and two columns relative to the decoding
929 * loop. */
930
2/2
✓ Branch 0 taken 48552 times.
✓ Branch 1 taken 408 times.
48960 if (s->mb_x) {
931
2/2
✓ Branch 0 taken 47838 times.
✓ Branch 1 taken 714 times.
48552 if (s->mb_y >= s->start_mb_y + 1) {
932 47838 dest = s->dest[0] - 16 * s->linesize - 16;
933 47838 ttblk = &v->ttblk[s->mb_x - s->mb_stride - 1];
934
2/2
✓ Branch 0 taken 714 times.
✓ Branch 1 taken 47124 times.
47838 flags = s->mb_y == s->start_mb_y + 1 ? TOP_EDGE : 0;
935 47838 fieldtx = v->fieldtx_plane[mb_pos - s->mb_stride - 1];
936
2/2
✓ Branch 0 taken 287028 times.
✓ Branch 1 taken 47838 times.
334866 for (i = 0; i < block_count; i++)
937
2/2
✓ Branch 0 taken 95676 times.
✓ Branch 1 taken 191352 times.
382704 vc1_p_v_intfr_loop_filter(v,
938 95676 i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize - 8 : dest,
939 ttblk,
940 flags,
941 fieldtx,
942 i);
943 }
944 }
945
2/2
✓ Branch 0 taken 408 times.
✓ Branch 1 taken 48552 times.
48960 if (s->mb_x == s->mb_width - 1) {
946
2/2
✓ Branch 0 taken 402 times.
✓ Branch 1 taken 6 times.
408 if (s->mb_y >= s->start_mb_y + 1) {
947 402 dest = s->dest[0] - 16 * s->linesize;
948 402 ttblk = &v->ttblk[s->mb_x - s->mb_stride];
949
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 396 times.
402 flags = s->mb_y == s->start_mb_y + 1 ? TOP_EDGE : 0;
950 402 fieldtx = v->fieldtx_plane[mb_pos - s->mb_stride];
951
2/2
✓ Branch 0 taken 2412 times.
✓ Branch 1 taken 402 times.
2814 for (i = 0; i < block_count; i++)
952
2/2
✓ Branch 0 taken 804 times.
✓ Branch 1 taken 1608 times.
3216 vc1_p_v_intfr_loop_filter(v,
953 804 i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize : dest,
954 ttblk,
955 flags,
956 fieldtx,
957 i);
958 }
959 }
960
2/2
✓ Branch 0 taken 720 times.
✓ Branch 1 taken 48240 times.
48960 if (s->mb_y == s->end_mb_y - 1) {
961
2/2
✓ Branch 0 taken 714 times.
✓ Branch 1 taken 6 times.
720 if (s->mb_x) {
962 714 dest = s->dest[0] - 16;
963 714 ttblk = &v->ttblk[s->mb_x - 1];
964
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 714 times.
714 flags = s->mb_y == s->start_mb_y ? TOP_EDGE | BOTTOM_EDGE : BOTTOM_EDGE;
965 714 fieldtx = v->fieldtx_plane[mb_pos - 1];
966
2/2
✓ Branch 0 taken 4284 times.
✓ Branch 1 taken 714 times.
4998 for (i = 0; i < block_count; i++)
967
2/2
✓ Branch 0 taken 1428 times.
✓ Branch 1 taken 2856 times.
5712 vc1_p_v_intfr_loop_filter(v,
968 1428 i > 3 ? s->dest[i - 3] - 8 : dest,
969 ttblk,
970 flags,
971 fieldtx,
972 i);
973 }
974
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 714 times.
720 if (s->mb_x == s->mb_width - 1) {
975 6 dest = s->dest[0];
976 6 ttblk = &v->ttblk[s->mb_x];
977
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 flags = s->mb_y == s->start_mb_y ? TOP_EDGE | BOTTOM_EDGE : BOTTOM_EDGE;
978 6 fieldtx = v->fieldtx_plane[mb_pos];
979
2/2
✓ Branch 0 taken 36 times.
✓ Branch 1 taken 6 times.
42 for (i = 0; i < block_count; i++)
980
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 24 times.
48 vc1_p_v_intfr_loop_filter(v,
981 12 i > 3 ? s->dest[i - 3] : dest,
982 ttblk,
983 flags,
984 fieldtx,
985 i);
986 }
987 }
988
989
2/2
✓ Branch 0 taken 47520 times.
✓ Branch 1 taken 1440 times.
48960 if (s->mb_y >= s->start_mb_y + 2) {
990
2/2
✓ Branch 0 taken 46728 times.
✓ Branch 1 taken 792 times.
47520 if (s->mb_x >= 2) {
991 46728 dest = s->dest[0] - 32 * s->linesize - 32;
992 46728 ttblk = &v->ttblk[s->mb_x - 2 * s->mb_stride - 2];
993 46728 flags = s->mb_x == 2 ? LEFT_EDGE : 0;
994 46728 fieldtx = v->fieldtx_plane[mb_pos - 2 * s->mb_stride - 2];
995
2/2
✓ Branch 0 taken 280368 times.
✓ Branch 1 taken 46728 times.
327096 for (i = 0; i < block_count; i++)
996
2/2
✓ Branch 0 taken 93456 times.
✓ Branch 1 taken 186912 times.
373824 vc1_p_h_intfr_loop_filter(v,
997 93456 i > 3 ? s->dest[i - 3] - 16 * s->uvlinesize - 16 : dest,
998 ttblk,
999 flags,
1000 fieldtx,
1001 i);
1002 }
1003
2/2
✓ Branch 0 taken 396 times.
✓ Branch 1 taken 47124 times.
47520 if (s->mb_x == s->mb_width - 1) {
1004
1/2
✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
396 if (s->mb_x >= 1) {
1005 396 dest = s->dest[0] - 32 * s->linesize - 16;
1006 396 ttblk = &v->ttblk[s->mb_x - 2 * s->mb_stride - 1];
1007 396 flags = s->mb_x == 1 ? LEFT_EDGE : 0;
1008 396 fieldtx = v->fieldtx_plane[mb_pos - 2 * s->mb_stride - 1];
1009
2/2
✓ Branch 0 taken 2376 times.
✓ Branch 1 taken 396 times.
2772 for (i = 0; i < block_count; i++)
1010
2/2
✓ Branch 0 taken 792 times.
✓ Branch 1 taken 1584 times.
3168 vc1_p_h_intfr_loop_filter(v,
1011 792 i > 3 ? s->dest[i - 3] - 16 * s->uvlinesize - 8 : dest,
1012 ttblk,
1013 flags,
1014 fieldtx,
1015 i);
1016 }
1017 396 dest = s->dest[0] - 32 * s->linesize;
1018 396 ttblk = &v->ttblk[s->mb_x - 2 * s->mb_stride];
1019
1/2
✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
396 flags = s->mb_x ? RIGHT_EDGE : LEFT_EDGE | RIGHT_EDGE;
1020 396 fieldtx = v->fieldtx_plane[mb_pos - 2 * s->mb_stride];
1021
2/2
✓ Branch 0 taken 2376 times.
✓ Branch 1 taken 396 times.
2772 for (i = 0; i < block_count; i++)
1022
2/2
✓ Branch 0 taken 792 times.
✓ Branch 1 taken 1584 times.
3168 vc1_p_h_intfr_loop_filter(v,
1023 792 i > 3 ? s->dest[i - 3] - 16 * s->uvlinesize : dest,
1024 ttblk,
1025 flags,
1026 fieldtx,
1027 i);
1028 }
1029 }
1030
2/2
✓ Branch 0 taken 720 times.
✓ Branch 1 taken 48240 times.
48960 if (s->mb_y == s->end_mb_y - 1) {
1031
1/2
✓ Branch 0 taken 720 times.
✗ Branch 1 not taken.
720 if (s->mb_y >= s->start_mb_y + 1) {
1032
2/2
✓ Branch 0 taken 708 times.
✓ Branch 1 taken 12 times.
720 if (s->mb_x >= 2) {
1033 708 dest = s->dest[0] - 16 * s->linesize - 32;
1034 708 ttblk = &v->ttblk[s->mb_x - s->mb_stride - 2];
1035 708 flags = s->mb_x == 2 ? LEFT_EDGE : 0;
1036 708 fieldtx = v->fieldtx_plane[mb_pos - s->mb_stride - 2];
1037
2/2
✓ Branch 0 taken 4248 times.
✓ Branch 1 taken 708 times.
4956 for (i = 0; i < block_count; i++)
1038
2/2
✓ Branch 0 taken 1416 times.
✓ Branch 1 taken 2832 times.
5664 vc1_p_h_intfr_loop_filter(v,
1039 1416 i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize - 16 : dest,
1040 ttblk,
1041 flags,
1042 fieldtx,
1043 i);
1044 }
1045
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 714 times.
720 if (s->mb_x == s->mb_width - 1) {
1046
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (s->mb_x >= 1) {
1047 6 dest = s->dest[0] - 16 * s->linesize - 16;
1048 6 ttblk = &v->ttblk[s->mb_x - s->mb_stride - 1];
1049 6 flags = s->mb_x == 1 ? LEFT_EDGE : 0;
1050 6 fieldtx = v->fieldtx_plane[mb_pos - s->mb_stride - 1];
1051
2/2
✓ Branch 0 taken 36 times.
✓ Branch 1 taken 6 times.
42 for (i = 0; i < block_count; i++)
1052
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 24 times.
48 vc1_p_h_intfr_loop_filter(v,
1053 12 i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize - 8 : dest,
1054 ttblk,
1055 flags,
1056 fieldtx,
1057 i);
1058 }
1059 6 dest = s->dest[0] - 16 * s->linesize;
1060 6 ttblk = &v->ttblk[s->mb_x - s->mb_stride];
1061
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 flags = s->mb_x ? RIGHT_EDGE : LEFT_EDGE | RIGHT_EDGE;
1062 6 fieldtx = v->fieldtx_plane[mb_pos - s->mb_stride];
1063
2/2
✓ Branch 0 taken 36 times.
✓ Branch 1 taken 6 times.
42 for (i = 0; i < block_count; i++)
1064
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 24 times.
48 vc1_p_h_intfr_loop_filter(v,
1065 12 i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize : dest,
1066 ttblk,
1067 flags,
1068 fieldtx,
1069 i);
1070 }
1071 }
1072
2/2
✓ Branch 0 taken 708 times.
✓ Branch 1 taken 12 times.
720 if (s->mb_x >= 2) {
1073 708 dest = s->dest[0] - 32;
1074 708 ttblk = &v->ttblk[s->mb_x - 2];
1075 708 flags = s->mb_x == 2 ? LEFT_EDGE : 0;
1076 708 fieldtx = v->fieldtx_plane[mb_pos - 2];
1077
2/2
✓ Branch 0 taken 4248 times.
✓ Branch 1 taken 708 times.
4956 for (i = 0; i < block_count; i++)
1078
2/2
✓ Branch 0 taken 1416 times.
✓ Branch 1 taken 2832 times.
5664 vc1_p_h_intfr_loop_filter(v,
1079 1416 i > 3 ? s->dest[i - 3] - 16 : dest,
1080 ttblk,
1081 flags,
1082 fieldtx,
1083 i);
1084 }
1085
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 714 times.
720 if (s->mb_x == s->mb_width - 1) {
1086
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (s->mb_x >= 1) {
1087 6 dest = s->dest[0] - 16;
1088 6 ttblk = &v->ttblk[s->mb_x - 1];
1089 6 flags = s->mb_x == 1 ? LEFT_EDGE : 0;
1090 6 fieldtx = v->fieldtx_plane[mb_pos - 1];
1091
2/2
✓ Branch 0 taken 36 times.
✓ Branch 1 taken 6 times.
42 for (i = 0; i < block_count; i++)
1092
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 24 times.
48 vc1_p_h_intfr_loop_filter(v,
1093 12 i > 3 ? s->dest[i - 3] - 8 : dest,
1094 ttblk,
1095 flags,
1096 fieldtx,
1097 i);
1098 }
1099 6 dest = s->dest[0];
1100 6 ttblk = &v->ttblk[s->mb_x];
1101
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 flags = s->mb_x ? RIGHT_EDGE : LEFT_EDGE | RIGHT_EDGE;
1102 6 fieldtx = v->fieldtx_plane[mb_pos];
1103
2/2
✓ Branch 0 taken 36 times.
✓ Branch 1 taken 6 times.
42 for (i = 0; i < block_count; i++)
1104
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 24 times.
48 vc1_p_h_intfr_loop_filter(v,
1105 12 i > 3 ? s->dest[i - 3] : dest,
1106 ttblk,
1107 flags,
1108 fieldtx,
1109 i);
1110 }
1111 }
1112 48960 }
1113
1114 static av_always_inline
1115 309240 void vc1_b_h_intfi_loop_filter(VC1Context *v, uint8_t *dest, const uint32_t *cbp,
1116 const int *ttblk, uint32_t flags, int block_num)
1117 {
1118 309240 MpegEncContext *s = &v->s;
1119 309240 int pq = v->pq;
1120 uint8_t *dst;
1121 309240 uint32_t block_cbp = cbp[0] >> (block_num * 4);
1122 int tt;
1123
2/2
✓ Branch 0 taken 103080 times.
✓ Branch 1 taken 206160 times.
309240 int idx, linesize = block_num > 3 ? s->uvlinesize : s->linesize;
1124
1125
2/2
✓ Branch 0 taken 103080 times.
✓ Branch 1 taken 206160 times.
309240 if (block_num > 3)
1126 103080 dst = dest;
1127 else
1128 206160 dst = dest + (block_num & 2) * 4 * s->linesize + (block_num & 1) * 8;
1129
1130
4/4
✓ Branch 0 taken 4152 times.
✓ Branch 1 taken 305088 times.
✓ Branch 2 taken 1384 times.
✓ Branch 3 taken 2768 times.
309240 if (!(flags & RIGHT_EDGE) || !(block_num & 5)) {
1131 306472 v->vc1dsp.vc1_h_loop_filter8(dst + 8, linesize, pq);
1132 }
1133
1134 309240 tt = ttblk[0] >> (block_num * 4) & 0xf;
1135
4/4
✓ Branch 0 taken 294456 times.
✓ Branch 1 taken 14784 times.
✓ Branch 2 taken 23865 times.
✓ Branch 3 taken 270591 times.
309240 if (tt == TT_4X4 || tt == TT_4X8) {
1136 38649 idx = (block_cbp | (block_cbp >> 1)) & 5;
1137
2/2
✓ Branch 0 taken 34919 times.
✓ Branch 1 taken 3730 times.
38649 if (idx & 1)
1138 34919 v->vc1dsp.vc1_h_loop_filter4(dst + 4 * linesize + 4, linesize, pq);
1139
2/2
✓ Branch 0 taken 34510 times.
✓ Branch 1 taken 4139 times.
38649 if (idx & 4)
1140 34510 v->vc1dsp.vc1_h_loop_filter4(dst + 4, linesize, pq);
1141 }
1142 309240 }
1143
1144 static av_always_inline
1145 309240 void vc1_b_v_intfi_loop_filter(VC1Context *v, uint8_t *dest, const uint32_t *cbp,
1146 const int *ttblk, uint32_t flags, int block_num)
1147 {
1148 309240 MpegEncContext *s = &v->s;
1149 309240 int pq = v->pq;
1150 uint8_t *dst;
1151 309240 uint32_t block_cbp = cbp[0] >> (block_num * 4);
1152 int tt;
1153
2/2
✓ Branch 0 taken 103080 times.
✓ Branch 1 taken 206160 times.
309240 int idx, linesize = block_num > 3 ? s->uvlinesize : s->linesize;
1154
1155
2/2
✓ Branch 0 taken 103080 times.
✓ Branch 1 taken 206160 times.
309240 if (block_num > 3)
1156 103080 dst = dest;
1157 else
1158 206160 dst = dest + (block_num & 2) * 4 * s->linesize + (block_num & 1) * 8;
1159
1160
4/4
✓ Branch 0 taken 13320 times.
✓ Branch 1 taken 295920 times.
✓ Branch 2 taken 4440 times.
✓ Branch 3 taken 8880 times.
309240 if(!(flags & BOTTOM_EDGE) || block_num < 2)
1161 300360 v->vc1dsp.vc1_v_loop_filter8(dst + 8 * linesize, linesize, pq);
1162
1163 309240 tt = ttblk[0] >> (block_num * 4) & 0xf;
1164
4/4
✓ Branch 0 taken 294456 times.
✓ Branch 1 taken 14784 times.
✓ Branch 2 taken 23465 times.
✓ Branch 3 taken 270991 times.
309240 if (tt == TT_4X4 || tt == TT_8X4) {
1165 38249 idx = (block_cbp | (block_cbp >> 2)) & 3;
1166
2/2
✓ Branch 0 taken 34613 times.
✓ Branch 1 taken 3636 times.
38249 if (idx & 1)
1167 34613 v->vc1dsp.vc1_v_loop_filter4(dst + 4 * linesize + 4, linesize, pq);
1168
2/2
✓ Branch 0 taken 34929 times.
✓ Branch 1 taken 3320 times.
38249 if (idx & 2)
1169 34929 v->vc1dsp.vc1_v_loop_filter4(dst + 4 * linesize, linesize, pq);
1170 }
1171 309240 }
1172
1173 51540 void ff_vc1_b_intfi_loop_filter(VC1Context *v)
1174 {
1175 51540 MpegEncContext *s = &v->s;
1176 51540 int block_count = CONFIG_GRAY && (s->avctx->flags & AV_CODEC_FLAG_GRAY) ? 4 : 6;
1177 uint8_t *dest;
1178 const uint32_t *cbp;
1179 int *ttblk;
1180 51540 uint32_t flags = 0;
1181 int i;
1182
1183 /* Within a MB, the vertical loop filter always runs before the horizontal.
1184 * To accomplish that, we run the V loop filter on all applicable
1185 * horizontal borders of the MB above the currently decoded MB. Then,
1186 * we wait for the next loop filter iteration to do H loop filter on all
1187 * applicable vertical borders of this MB. Therefore, the loop filter
1188 * trails by one row and one column relative to the decoding loop. */
1189
2/2
✓ Branch 0 taken 49320 times.
✓ Branch 1 taken 2220 times.
51540 if (!s->first_slice_line) {
1190 49320 dest = s->dest[0] - 16 * s->linesize;
1191 49320 cbp = &v->cbp[s->mb_x - s->mb_stride];
1192 49320 ttblk = &v->ttblk[s->mb_x - s->mb_stride];
1193
2/2
✓ Branch 0 taken 2220 times.
✓ Branch 1 taken 47100 times.
49320 flags = s->mb_y == s->start_mb_y + 1 ? TOP_EDGE : 0;
1194
2/2
✓ Branch 0 taken 295920 times.
✓ Branch 1 taken 49320 times.
345240 for (i = 0; i < block_count; i++)
1195
2/2
✓ Branch 0 taken 98640 times.
✓ Branch 1 taken 197280 times.
295920 vc1_b_v_intfi_loop_filter(v, i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize : dest, cbp, ttblk, flags, i);
1196 }
1197
2/2
✓ Branch 0 taken 2220 times.
✓ Branch 1 taken 49320 times.
51540 if (s->mb_y == s->end_mb_y - 1) {
1198 2220 dest = s->dest[0];
1199 2220 cbp = &v->cbp[s->mb_x];
1200 2220 ttblk = &v->ttblk[s->mb_x];
1201
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2220 times.
2220 flags = s->first_slice_line ? TOP_EDGE | BOTTOM_EDGE : BOTTOM_EDGE;
1202
2/2
✓ Branch 0 taken 13320 times.
✓ Branch 1 taken 2220 times.
15540 for (i = 0; i < block_count; i++)
1203
2/2
✓ Branch 0 taken 4440 times.
✓ Branch 1 taken 8880 times.
13320 vc1_b_v_intfi_loop_filter(v, i > 3 ? s->dest[i - 3] : dest, cbp, ttblk, flags, i);
1204 }
1205
1206
2/2
✓ Branch 0 taken 49320 times.
✓ Branch 1 taken 2220 times.
51540 if (!s->first_slice_line) {
1207 49320 dest = s->dest[0] - 16 * s->linesize - 16;
1208 49320 cbp = &v->cbp[s->mb_x - s->mb_stride - 1];
1209 49320 ttblk = &v->ttblk[s->mb_x - s->mb_stride - 1];
1210
2/2
✓ Branch 0 taken 48664 times.
✓ Branch 1 taken 656 times.
49320 if (s->mb_x) {
1211 48664 flags = s->mb_x == 1 ? LEFT_EDGE : 0;
1212
2/2
✓ Branch 0 taken 291984 times.
✓ Branch 1 taken 48664 times.
340648 for (i = 0; i < block_count; i++)
1213
2/2
✓ Branch 0 taken 97328 times.
✓ Branch 1 taken 194656 times.
291984 vc1_b_h_intfi_loop_filter(v, i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize - 8 : dest, cbp, ttblk, flags, i);
1214 }
1215
2/2
✓ Branch 0 taken 656 times.
✓ Branch 1 taken 48664 times.
49320 if (s->mb_x == s->mb_width - 1) {
1216 656 dest += 16;
1217 656 cbp++;
1218 656 ttblk++;
1219
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 656 times.
656 flags = s->mb_x == 0 ? LEFT_EDGE | RIGHT_EDGE : RIGHT_EDGE;
1220
2/2
✓ Branch 0 taken 3936 times.
✓ Branch 1 taken 656 times.
4592 for (i = 0; i < block_count; i++)
1221
2/2
✓ Branch 0 taken 1312 times.
✓ Branch 1 taken 2624 times.
3936 vc1_b_h_intfi_loop_filter(v, i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize : dest, cbp, ttblk, flags, i);
1222 }
1223 }
1224
2/2
✓ Branch 0 taken 2220 times.
✓ Branch 1 taken 49320 times.
51540 if (s->mb_y == s->end_mb_y - 1) {
1225 2220 dest = s->dest[0] - 16;
1226 2220 cbp = &v->cbp[s->mb_x - 1];
1227 2220 ttblk = &v->ttblk[s->mb_x - 1];
1228
2/2
✓ Branch 0 taken 2184 times.
✓ Branch 1 taken 36 times.
2220 if (s->mb_x) {
1229 2184 flags = s->mb_x == 1 ? LEFT_EDGE : 0;
1230
2/2
✓ Branch 0 taken 13104 times.
✓ Branch 1 taken 2184 times.
15288 for (i = 0; i < block_count; i++)
1231
2/2
✓ Branch 0 taken 4368 times.
✓ Branch 1 taken 8736 times.
13104 vc1_b_h_intfi_loop_filter(v, i > 3 ? s->dest[i - 3] - 8 : dest, cbp, ttblk, flags, i);
1232 }
1233
2/2
✓ Branch 0 taken 36 times.
✓ Branch 1 taken 2184 times.
2220 if (s->mb_x == s->mb_width - 1) {
1234 36 dest += 16;
1235 36 cbp++;
1236 36 ttblk++;
1237
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 36 times.
36 flags = s->mb_x == 0 ? LEFT_EDGE | RIGHT_EDGE : RIGHT_EDGE;
1238
2/2
✓ Branch 0 taken 216 times.
✓ Branch 1 taken 36 times.
252 for (i = 0; i < block_count; i++)
1239
2/2
✓ Branch 0 taken 72 times.
✓ Branch 1 taken 144 times.
216 vc1_b_h_intfi_loop_filter(v, i > 3 ? s->dest[i - 3] : dest, cbp, ttblk, flags, i);
1240 }
1241 }
1242 51540 }
1243