FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/vc1_loopfilter.c
Date: 2024-04-25 15:36:26
Exec Total Coverage
Lines: 720 753 95.6%
Functions: 15 16 93.8%
Branches: 691 792 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 787344 static av_always_inline void vc1_p_v_loop_filter(VC1Context *v, uint8_t *dest, uint32_t *cbp,
417 uint8_t *is_intra, int16_t (*mv)[2], uint8_t *mv_f,
418 int *ttblk, uint32_t flags, int block_num)
419 {
420 787344 MpegEncContext *s = &v->s;
421 787344 int pq = v->pq;
422 787344 uint32_t top_cbp = cbp[0] >> (block_num * 4), bottom_cbp;
423 uint8_t top_is_intra, bottom_is_intra;
424 int tt;
425
2/2
✓ Branch 0 taken 262448 times.
✓ Branch 1 taken 524896 times.
787344 int idx, linesize = block_num > 3 ? s->uvlinesize : s->linesize;
426 uint8_t *dst;
427
428
2/2
✓ Branch 0 taken 262448 times.
✓ Branch 1 taken 524896 times.
787344 if (block_num > 3)
429 262448 dst = dest;
430 else
431 524896 dst = dest + (block_num & 2) * 4 * s->linesize + (block_num & 1) * 8;
432
433
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) {
434 653200 top_is_intra = is_intra[0] & (1 << block_num);
435
436
2/2
✓ Branch 0 taken 195376 times.
✓ Branch 1 taken 457824 times.
653200 if (block_num > 3) {
437 195376 bottom_is_intra = is_intra[s->mb_stride] & (1 << block_num);
438 195376 bottom_cbp = cbp[s->mb_stride] >> (block_num * 4);
439
2/2
✓ Branch 0 taken 262448 times.
✓ Branch 1 taken 195376 times.
457824 } else if (block_num < 2) {
440 262448 bottom_is_intra = is_intra[0] & (1 << block_num + 2);
441 262448 bottom_cbp = cbp[0] >> ((block_num + 2) * 4);
442 } else {
443 195376 bottom_is_intra = is_intra[s->mb_stride] & (1 << block_num - 2);
444 195376 bottom_cbp = cbp[s->mb_stride] >> ((block_num - 2) * 4);
445 }
446
447
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 ||
448
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] ||
449
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] ||
450
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]))
451 414153 v->vc1dsp.vc1_v_loop_filter8(dst + 8 * linesize, linesize, pq);
452 else {
453 239047 idx = (top_cbp | (bottom_cbp >> 2)) & 3;
454
2/2
✓ Branch 0 taken 99812 times.
✓ Branch 1 taken 139235 times.
239047 if (idx & 1)
455 99812 v->vc1dsp.vc1_v_loop_filter4(dst + 8 * linesize + 4, linesize, pq);
456
2/2
✓ Branch 0 taken 99786 times.
✓ Branch 1 taken 139261 times.
239047 if (idx & 2)
457 99786 v->vc1dsp.vc1_v_loop_filter4(dst + 8 * linesize, linesize, pq);
458 }
459 }
460
461 787344 tt = ttblk[0] >> (block_num * 4) & 0xf;
462
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) {
463
2/2
✓ Branch 0 taken 79159 times.
✓ Branch 1 taken 6446 times.
85605 if (top_cbp & 5)
464 79159 v->vc1dsp.vc1_v_loop_filter4(dst + 4 * linesize + 4, linesize, pq);
465
2/2
✓ Branch 0 taken 79196 times.
✓ Branch 1 taken 6409 times.
85605 if (top_cbp & 10)
466 79196 v->vc1dsp.vc1_v_loop_filter4(dst + 4 * linesize, linesize, pq);
467 }
468 787344 }
469
470 131248 void ff_vc1_p_loop_filter(VC1Context *v)
471 {
472 131248 MpegEncContext *s = &v->s;
473 131248 int block_count = CONFIG_GRAY && (s->avctx->flags & AV_CODEC_FLAG_GRAY) ? 4 : 6;
474 uint8_t *dest;
475 uint32_t *cbp;
476 uint8_t *is_intra;
477 int16_t (*uvmv)[2];
478 int *ttblk;
479 uint32_t flags;
480 int i;
481
482 /* Within a MB, the vertical loop filter always runs before the horizontal.
483 * To accomplish that, we run the V loop filter on all applicable
484 * horizontal borders of the MB above the last overlap filtered MB. Then,
485 * we wait for the next loop filter iteration to do H loop filter on all
486 * applicable vertical borders of this MB. Therefore, the loop filter
487 * trails by one row and one column relative to the overlap filter and two
488 * rows and two columns relative to the decoding loop. */
489
2/2
✓ Branch 0 taken 83223 times.
✓ Branch 1 taken 48025 times.
131248 if (s->mb_y >= s->start_mb_y + 2) {
490
2/2
✓ Branch 0 taken 80713 times.
✓ Branch 1 taken 2510 times.
83223 if (s->mb_x) {
491 80713 dest = s->dest[0] - 32 * s->linesize - 16;
492 80713 cbp = &v->cbp[s->mb_x - 2 * s->mb_stride - 1];
493 80713 is_intra = &v->is_intra[s->mb_x - 2 * s->mb_stride - 1];
494 80713 uvmv = &v->luma_mv[s->mb_x - 2 * s->mb_stride - 1];
495 80713 ttblk = &v->ttblk[s->mb_x - 2 * s->mb_stride - 1];
496
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;
497
2/2
✓ Branch 0 taken 484278 times.
✓ Branch 1 taken 80713 times.
564991 for (i = 0; i < block_count; i++)
498
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,
499 161426 i > 3 ? s->dest[i - 3] - 16 * s->uvlinesize - 8 : dest,
500 cbp,
501 is_intra,
502 i > 3 ? uvmv :
503 322852 &s->current_picture.motion_val[0][s->block_index[i] - 4 * s->b8_stride - 2 + v->blocks_off],
504 161426 i > 3 ? &v->mv_f[0][s->block_index[i] - 2 * s->mb_stride - 1 + v->mb_off] :
505 322852 &v->mv_f[0][s->block_index[i] - 4 * s->b8_stride - 2 + v->blocks_off],
506 ttblk,
507 flags,
508 i);
509 }
510
2/2
✓ Branch 0 taken 2510 times.
✓ Branch 1 taken 80713 times.
83223 if (s->mb_x == s->mb_width - 1) {
511 2510 dest = s->dest[0] - 32 * s->linesize;
512 2510 cbp = &v->cbp[s->mb_x - 2 * s->mb_stride];
513 2510 is_intra = &v->is_intra[s->mb_x - 2 * s->mb_stride];
514 2510 uvmv = &v->luma_mv[s->mb_x - 2 * s->mb_stride];
515 2510 ttblk = &v->ttblk[s->mb_x - 2 * s->mb_stride];
516
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;
517
2/2
✓ Branch 0 taken 15060 times.
✓ Branch 1 taken 2510 times.
17570 for (i = 0; i < block_count; i++)
518
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,
519 5020 i > 3 ? s->dest[i - 3] - 16 * s->uvlinesize : dest,
520 cbp,
521 is_intra,
522 i > 3 ? uvmv :
523 10040 &s->current_picture.motion_val[0][s->block_index[i] - 4 * s->b8_stride + v->blocks_off],
524 5020 i > 3 ? &v->mv_f[0][s->block_index[i] - 2 * s->mb_stride + v->mb_off] :
525 10040 &v->mv_f[0][s->block_index[i] - 4 * s->b8_stride + v->blocks_off],
526 ttblk,
527 flags,
528 i);
529 }
530 }
531
2/2
✓ Branch 0 taken 33536 times.
✓ Branch 1 taken 97712 times.
131248 if (s->mb_y == s->end_mb_y - 1) {
532
2/2
✓ Branch 0 taken 32672 times.
✓ Branch 1 taken 864 times.
33536 if (s->mb_x) {
533
2/2
✓ Branch 0 taken 14032 times.
✓ Branch 1 taken 18640 times.
32672 if (s->mb_y >= s->start_mb_y + 1) {
534 14032 dest = s->dest[0] - 16 * s->linesize - 16;
535 14032 cbp = &v->cbp[s->mb_x - s->mb_stride - 1];
536 14032 is_intra = &v->is_intra[s->mb_x - s->mb_stride - 1];
537 14032 uvmv = &v->luma_mv[s->mb_x - s->mb_stride - 1];
538 14032 ttblk = &v->ttblk[s->mb_x - s->mb_stride - 1];
539
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;
540
2/2
✓ Branch 0 taken 84192 times.
✓ Branch 1 taken 14032 times.
98224 for (i = 0; i < block_count; i++)
541
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,
542 28064 i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize - 8 : dest,
543 cbp,
544 is_intra,
545 i > 3 ? uvmv :
546 56128 &s->current_picture.motion_val[0][s->block_index[i] - 2 * s->b8_stride - 2 + v->blocks_off],
547 28064 i > 3 ? &v->mv_f[0][s->block_index[i] - s->mb_stride - 1 + v->mb_off] :
548 56128 &v->mv_f[0][s->block_index[i] - 2 * s->b8_stride - 2 + v->blocks_off],
549 ttblk,
550 flags,
551 i);
552 }
553 32672 dest = s->dest[0] - 16;
554 32672 cbp = &v->cbp[s->mb_x - 1];
555 32672 is_intra = &v->is_intra[s->mb_x - 1];
556 32672 uvmv = &v->luma_mv[s->mb_x - 1];
557 32672 ttblk = &v->ttblk[s->mb_x - 1];
558
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;
559
2/2
✓ Branch 0 taken 196032 times.
✓ Branch 1 taken 32672 times.
228704 for (i = 0; i < block_count; i++)
560
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,
561 65344 i > 3 ? s->dest[i - 3] - 8 : dest,
562 cbp,
563 is_intra,
564 i > 3 ? uvmv :
565 130688 &s->current_picture.motion_val[0][s->block_index[i] - 2 + v->blocks_off],
566 65344 i > 3 ? &v->mv_f[0][s->block_index[i] - 1 + v->mb_off] :
567 130688 &v->mv_f[0][s->block_index[i] - 2 + v->blocks_off],
568 ttblk,
569 flags,
570 i);
571 }
572
2/2
✓ Branch 0 taken 864 times.
✓ Branch 1 taken 32672 times.
33536 if (s->mb_x == s->mb_width - 1) {
573
2/2
✓ Branch 0 taken 433 times.
✓ Branch 1 taken 431 times.
864 if (s->mb_y >= s->start_mb_y + 1) {
574 433 dest = s->dest[0] - 16 * s->linesize;
575 433 cbp = &v->cbp[s->mb_x - s->mb_stride];
576 433 is_intra = &v->is_intra[s->mb_x - s->mb_stride];
577 433 uvmv = &v->luma_mv[s->mb_x - s->mb_stride];
578 433 ttblk = &v->ttblk[s->mb_x - s->mb_stride];
579
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;
580
2/2
✓ Branch 0 taken 2598 times.
✓ Branch 1 taken 433 times.
3031 for (i = 0; i < block_count; i++)
581
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,
582 866 i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize : dest,
583 cbp,
584 is_intra,
585 i > 3 ? uvmv :
586 1732 &s->current_picture.motion_val[0][s->block_index[i] - 2 * s->b8_stride + v->blocks_off],
587 866 i > 3 ? &v->mv_f[0][s->block_index[i] - s->mb_stride + v->mb_off] :
588 1732 &v->mv_f[0][s->block_index[i] - 2 * s->b8_stride + v->blocks_off],
589 ttblk,
590 flags,
591 i);
592 }
593 864 dest = s->dest[0];
594 864 cbp = &v->cbp[s->mb_x];
595 864 is_intra = &v->is_intra[s->mb_x];
596 864 uvmv = &v->luma_mv[s->mb_x];
597 864 ttblk = &v->ttblk[s->mb_x];
598
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;
599
2/2
✓ Branch 0 taken 5184 times.
✓ Branch 1 taken 864 times.
6048 for (i = 0; i < block_count; i++)
600
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,
601 1728 i > 3 ? s->dest[i - 3] : dest,
602 cbp,
603 is_intra,
604 i > 3 ? uvmv :
605 3456 &s->current_picture.motion_val[0][s->block_index[i] + v->blocks_off],
606 1728 i > 3 ? &v->mv_f[0][s->block_index[i] + v->mb_off] :
607 3456 &v->mv_f[0][s->block_index[i] + v->blocks_off],
608 ttblk,
609 flags,
610 i);
611 }
612 }
613
614
2/2
✓ Branch 0 taken 83223 times.
✓ Branch 1 taken 48025 times.
131248 if (s->mb_y >= s->start_mb_y + 2) {
615
2/2
✓ Branch 0 taken 78203 times.
✓ Branch 1 taken 5020 times.
83223 if (s->mb_x >= 2) {
616 78203 dest = s->dest[0] - 32 * s->linesize - 32;
617 78203 cbp = &v->cbp[s->mb_x - 2 * s->mb_stride - 2];
618 78203 is_intra = &v->is_intra[s->mb_x - 2 * s->mb_stride - 2];
619 78203 uvmv = &v->luma_mv[s->mb_x - 2 * s->mb_stride - 2];
620 78203 ttblk = &v->ttblk[s->mb_x - 2 * s->mb_stride - 2];
621 78203 flags = s->mb_x == 2 ? LEFT_EDGE : 0;
622
2/2
✓ Branch 0 taken 469218 times.
✓ Branch 1 taken 78203 times.
547421 for (i = 0; i < block_count; i++)
623
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,
624 156406 i > 3 ? s->dest[i - 3] - 16 * s->uvlinesize - 16 : dest,
625 cbp,
626 is_intra,
627 i > 3 ? uvmv :
628 312812 &s->current_picture.motion_val[0][s->block_index[i] - 4 * s->b8_stride - 4 + v->blocks_off],
629 156406 i > 3 ? &v->mv_f[0][s->block_index[i] - 2 * s->mb_stride - 2 + v->mb_off] :
630 312812 &v->mv_f[0][s->block_index[i] - 4 * s->b8_stride - 4 + v->blocks_off],
631 ttblk,
632 flags,
633 i);
634 }
635
2/2
✓ Branch 0 taken 2510 times.
✓ Branch 1 taken 80713 times.
83223 if (s->mb_x == s->mb_width - 1) {
636
1/2
✓ Branch 0 taken 2510 times.
✗ Branch 1 not taken.
2510 if (s->mb_x >= 1) {
637 2510 dest = s->dest[0] - 32 * s->linesize - 16;
638 2510 cbp = &v->cbp[s->mb_x - 2 * s->mb_stride - 1];
639 2510 is_intra = &v->is_intra[s->mb_x - 2 * s->mb_stride - 1];
640 2510 uvmv = &v->luma_mv[s->mb_x - 2 * s->mb_stride - 1];
641 2510 ttblk = &v->ttblk[s->mb_x - 2 * s->mb_stride - 1];
642 2510 flags = s->mb_x == 1 ? LEFT_EDGE : 0;
643
2/2
✓ Branch 0 taken 15060 times.
✓ Branch 1 taken 2510 times.
17570 for (i = 0; i < block_count; i++)
644
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,
645 5020 i > 3 ? s->dest[i - 3] - 16 * s->uvlinesize - 8 : dest,
646 cbp,
647 is_intra,
648 i > 3 ? uvmv :
649 10040 &s->current_picture.motion_val[0][s->block_index[i] - 4 * s->b8_stride - 2 + v->blocks_off],
650 5020 i > 3 ? &v->mv_f[0][s->block_index[i] - 2 * s->mb_stride - 1 + v->mb_off] :
651 10040 &v->mv_f[0][s->block_index[i] - 4 * s->b8_stride - 2 + v->blocks_off],
652 ttblk,
653 flags,
654 i);
655 }
656 2510 dest = s->dest[0] - 32 * s->linesize;
657 2510 cbp = &v->cbp[s->mb_x - 2 * s->mb_stride];
658 2510 is_intra = &v->is_intra[s->mb_x - 2 * s->mb_stride];
659 2510 uvmv = &v->luma_mv[s->mb_x - 2 * s->mb_stride];
660 2510 ttblk = &v->ttblk[s->mb_x - 2 * s->mb_stride];
661
1/2
✓ Branch 0 taken 2510 times.
✗ Branch 1 not taken.
2510 flags = s->mb_x ? RIGHT_EDGE : LEFT_EDGE | RIGHT_EDGE;
662
2/2
✓ Branch 0 taken 15060 times.
✓ Branch 1 taken 2510 times.
17570 for (i = 0; i < block_count; i++)
663
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,
664 5020 i > 3 ? s->dest[i - 3] - 16 * s->uvlinesize : dest,
665 cbp,
666 is_intra,
667 i > 3 ? uvmv :
668 10040 &s->current_picture.motion_val[0][s->block_index[i] - 4 * s->b8_stride + v->blocks_off],
669 5020 i > 3 ? &v->mv_f[0][s->block_index[i] - 2 * s->mb_stride + v->mb_off] :
670 10040 &v->mv_f[0][s->block_index[i] - 4 * s->b8_stride + v->blocks_off],
671 ttblk,
672 flags,
673 i);
674 }
675 }
676
2/2
✓ Branch 0 taken 33536 times.
✓ Branch 1 taken 97712 times.
131248 if (s->mb_y == s->end_mb_y - 1) {
677
2/2
✓ Branch 0 taken 14465 times.
✓ Branch 1 taken 19071 times.
33536 if (s->mb_y >= s->start_mb_y + 1) {
678
2/2
✓ Branch 0 taken 13599 times.
✓ Branch 1 taken 866 times.
14465 if (s->mb_x >= 2) {
679 13599 dest = s->dest[0] - 16 * s->linesize - 32;
680 13599 cbp = &v->cbp[s->mb_x - s->mb_stride - 2];
681 13599 is_intra = &v->is_intra[s->mb_x - s->mb_stride - 2];
682 13599 uvmv = &v->luma_mv[s->mb_x - s->mb_stride - 2];
683 13599 ttblk = &v->ttblk[s->mb_x - s->mb_stride - 2];
684 13599 flags = s->mb_x == 2 ? LEFT_EDGE : 0;
685
2/2
✓ Branch 0 taken 81594 times.
✓ Branch 1 taken 13599 times.
95193 for (i = 0; i < block_count; i++)
686
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,
687 27198 i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize - 16 : dest,
688 cbp,
689 is_intra,
690 i > 3 ? uvmv :
691 54396 &s->current_picture.motion_val[0][s->block_index[i] - 2 * s->b8_stride - 4 + v->blocks_off],
692 27198 i > 3 ? &v->mv_f[0][s->block_index[i] - s->mb_stride - 2 + v->mb_off] :
693 54396 &v->mv_f[0][s->block_index[i] - 2 * s->b8_stride - 4 + v->blocks_off],
694 ttblk,
695 flags,
696 i);
697 }
698
2/2
✓ Branch 0 taken 433 times.
✓ Branch 1 taken 14032 times.
14465 if (s->mb_x == s->mb_width - 1) {
699
1/2
✓ Branch 0 taken 433 times.
✗ Branch 1 not taken.
433 if (s->mb_x >= 1) {
700 433 dest = s->dest[0] - 16 * s->linesize - 16;
701 433 cbp = &v->cbp[s->mb_x - s->mb_stride - 1];
702 433 is_intra = &v->is_intra[s->mb_x - s->mb_stride - 1];
703 433 uvmv = &v->luma_mv[s->mb_x - s->mb_stride - 1];
704 433 ttblk = &v->ttblk[s->mb_x - s->mb_stride - 1];
705 433 flags = s->mb_x == 1 ? LEFT_EDGE : 0;
706
2/2
✓ Branch 0 taken 2598 times.
✓ Branch 1 taken 433 times.
3031 for (i = 0; i < block_count; i++)
707
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,
708 866 i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize - 8 : dest,
709 cbp,
710 is_intra,
711 i > 3 ? uvmv :
712 1732 &s->current_picture.motion_val[0][s->block_index[i] - 2 * s->b8_stride - 2 + v->blocks_off],
713 866 i > 3 ? &v->mv_f[0][s->block_index[i] - s->mb_stride - 1 + v->mb_off] :
714 1732 &v->mv_f[0][s->block_index[i] - 2 * s->b8_stride - 2 + v->blocks_off],
715 ttblk,
716 flags,
717 i);
718 }
719 433 dest = s->dest[0] - 16 * s->linesize;
720 433 cbp = &v->cbp[s->mb_x - s->mb_stride];
721 433 is_intra = &v->is_intra[s->mb_x - s->mb_stride];
722 433 uvmv = &v->luma_mv[s->mb_x - s->mb_stride];
723 433 ttblk = &v->ttblk[s->mb_x - s->mb_stride];
724
1/2
✓ Branch 0 taken 433 times.
✗ Branch 1 not taken.
433 flags = s->mb_x ? RIGHT_EDGE : LEFT_EDGE | RIGHT_EDGE;
725
2/2
✓ Branch 0 taken 2598 times.
✓ Branch 1 taken 433 times.
3031 for (i = 0; i < block_count; i++)
726
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,
727 866 i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize : dest,
728 cbp,
729 is_intra,
730 i > 3 ? uvmv :
731 1732 &s->current_picture.motion_val[0][s->block_index[i] - 2 * s->b8_stride + v->blocks_off],
732 866 i > 3 ? &v->mv_f[0][s->block_index[i] - s->mb_stride + v->mb_off] :
733 1732 &v->mv_f[0][s->block_index[i] - 2 * s->b8_stride + v->blocks_off],
734 ttblk,
735 flags,
736 i);
737 }
738 }
739
2/2
✓ Branch 0 taken 31808 times.
✓ Branch 1 taken 1728 times.
33536 if (s->mb_x >= 2) {
740 31808 dest = s->dest[0] - 32;
741 31808 cbp = &v->cbp[s->mb_x - 2];
742 31808 is_intra = &v->is_intra[s->mb_x - 2];
743 31808 uvmv = &v->luma_mv[s->mb_x - 2];
744 31808 ttblk = &v->ttblk[s->mb_x - 2];
745 31808 flags = s->mb_x == 2 ? LEFT_EDGE : 0;
746
2/2
✓ Branch 0 taken 190848 times.
✓ Branch 1 taken 31808 times.
222656 for (i = 0; i < block_count; i++)
747
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,
748 63616 i > 3 ? s->dest[i - 3] - 16 : dest,
749 cbp,
750 is_intra,
751 i > 3 ? uvmv :
752 127232 &s->current_picture.motion_val[0][s->block_index[i] - 4 + v->blocks_off],
753 63616 i > 3 ? &v->mv_f[0][s->block_index[i] - 2 + v->mb_off] :
754 127232 &v->mv_f[0][s->block_index[i] - 4 + v->blocks_off],
755 ttblk,
756 flags,
757 i);
758 }
759
2/2
✓ Branch 0 taken 864 times.
✓ Branch 1 taken 32672 times.
33536 if (s->mb_x == s->mb_width - 1) {
760
1/2
✓ Branch 0 taken 864 times.
✗ Branch 1 not taken.
864 if (s->mb_x >= 1) {
761 864 dest = s->dest[0] - 16;
762 864 cbp = &v->cbp[s->mb_x - 1];
763 864 is_intra = &v->is_intra[s->mb_x - 1];
764 864 uvmv = &v->luma_mv[s->mb_x - 1];
765 864 ttblk = &v->ttblk[s->mb_x - 1];
766 864 flags = s->mb_x == 1 ? LEFT_EDGE : 0;
767
2/2
✓ Branch 0 taken 5184 times.
✓ Branch 1 taken 864 times.
6048 for (i = 0; i < block_count; i++)
768
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,
769 1728 i > 3 ? s->dest[i - 3] - 8 : dest,
770 cbp,
771 is_intra,
772 i > 3 ? uvmv :
773 3456 &s->current_picture.motion_val[0][s->block_index[i] - 2 + v->blocks_off],
774 1728 i > 3 ? &v->mv_f[0][s->block_index[i] - 1 + v->mb_off] :
775 3456 &v->mv_f[0][s->block_index[i] - 2 + v->blocks_off],
776 ttblk,
777 flags,
778 i);
779 }
780 864 dest = s->dest[0];
781 864 cbp = &v->cbp[s->mb_x];
782 864 is_intra = &v->is_intra[s->mb_x];
783 864 uvmv = &v->luma_mv[s->mb_x];
784 864 ttblk = &v->ttblk[s->mb_x];
785
1/2
✓ Branch 0 taken 864 times.
✗ Branch 1 not taken.
864 flags = s->mb_x ? RIGHT_EDGE : LEFT_EDGE | RIGHT_EDGE;
786
2/2
✓ Branch 0 taken 5184 times.
✓ Branch 1 taken 864 times.
6048 for (i = 0; i < block_count; i++)
787
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,
788 1728 i > 3 ? s->dest[i - 3] : dest,
789 cbp,
790 is_intra,
791 i > 3 ? uvmv :
792 3456 &s->current_picture.motion_val[0][s->block_index[i] + v->blocks_off],
793 1728 i > 3 ? &v->mv_f[0][s->block_index[i] + v->mb_off] :
794 3456 &v->mv_f[0][s->block_index[i] + v->blocks_off],
795 ttblk,
796 flags,
797 i);
798 }
799 }
800 131248 }
801
802 293760 static av_always_inline void vc1_p_h_intfr_loop_filter(VC1Context *v, uint8_t *dest, int *ttblk,
803 uint32_t flags, uint8_t fieldtx, int block_num)
804 {
805 293760 MpegEncContext *s = &v->s;
806 293760 int pq = v->pq;
807 int tt;
808
2/2
✓ Branch 0 taken 97920 times.
✓ Branch 1 taken 195840 times.
293760 int linesize = block_num > 3 ? s->uvlinesize : s->linesize;
809 uint8_t *dst;
810
811
2/2
✓ Branch 0 taken 97920 times.
✓ Branch 1 taken 195840 times.
293760 if (block_num > 3)
812 97920 dst = dest;
813 else
814 195840 dst = dest + (block_num & 2) * 4 * s->linesize + (block_num & 1) * 8;
815
816 293760 tt = ttblk[0] >> (block_num * 4) & 0xf;
817
2/2
✓ Branch 0 taken 195840 times.
✓ Branch 1 taken 97920 times.
293760 if (block_num < 4) {
818
2/2
✓ Branch 0 taken 81784 times.
✓ Branch 1 taken 114056 times.
195840 if (fieldtx) {
819
2/2
✓ Branch 0 taken 40892 times.
✓ Branch 1 taken 40892 times.
81784 if (block_num < 2) {
820
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)
821 7421 v->vc1dsp.vc1_h_loop_filter8(dst + 4, 2 * linesize, pq);
822
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)
823 40722 v->vc1dsp.vc1_h_loop_filter8(dst + 8, 2 * linesize, pq);
824 } else {
825
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)
826 7266 v->vc1dsp.vc1_h_loop_filter8(dst - 7 * linesize + 4, 2 * linesize, pq);
827
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)
828 40722 v->vc1dsp.vc1_h_loop_filter8(dst - 7 * linesize + 8, 2 * linesize, pq);
829 }
830 } else {
831
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) {
832 22910 v->vc1dsp.vc1_h_loop_filter4(dst + 4, 2 * linesize, pq);
833 22910 v->vc1dsp.vc1_h_loop_filter4(dst + linesize + 4, 2 * linesize, pq);
834 }
835
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)) {
836 113580 v->vc1dsp.vc1_h_loop_filter4(dst + 8, 2 * linesize, pq);
837 113580 v->vc1dsp.vc1_h_loop_filter4(dst + linesize + 8, 2 * linesize, pq);
838 }
839 }
840 } else {
841
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) {
842 12278 v->vc1dsp.vc1_h_loop_filter4(dst + 4, 2 * linesize, pq);
843 12278 v->vc1dsp.vc1_h_loop_filter4(dst + linesize + 4, 2 * linesize, pq);
844 }
845
2/2
✓ Branch 0 taken 97104 times.
✓ Branch 1 taken 816 times.
97920 if (!(flags & RIGHT_EDGE)) {
846 97104 v->vc1dsp.vc1_h_loop_filter4(dst + 8, 2 * linesize, pq);
847 97104 v->vc1dsp.vc1_h_loop_filter4(dst + linesize + 8, 2 * linesize, pq);
848 }
849 }
850 293760 }
851
852 293760 static av_always_inline void vc1_p_v_intfr_loop_filter(VC1Context *v, uint8_t *dest, int *ttblk,
853 uint32_t flags, uint8_t fieldtx, int block_num)
854 {
855 293760 MpegEncContext *s = &v->s;
856 293760 int pq = v->pq;
857 int tt;
858
2/2
✓ Branch 0 taken 97920 times.
✓ Branch 1 taken 195840 times.
293760 int linesize = block_num > 3 ? s->uvlinesize : s->linesize;
859 uint8_t *dst;
860
861
2/2
✓ Branch 0 taken 97920 times.
✓ Branch 1 taken 195840 times.
293760 if (block_num > 3)
862 97920 dst = dest;
863 else
864 195840 dst = dest + (block_num & 2) * 4 * s->linesize + (block_num & 1) * 8;
865
866 293760 tt = ttblk[0] >> (block_num * 4) & 0xf;
867
2/2
✓ Branch 0 taken 195840 times.
✓ Branch 1 taken 97920 times.
293760 if (block_num < 4) {
868
2/2
✓ Branch 0 taken 81784 times.
✓ Branch 1 taken 114056 times.
195840 if (fieldtx) {
869
2/2
✓ Branch 0 taken 40892 times.
✓ Branch 1 taken 40892 times.
81784 if (block_num < 2) {
870
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)
871 7902 v->vc1dsp.vc1_v_loop_filter8(dst + 8 * linesize, 2 * linesize, pq);
872
2/2
✓ Branch 0 taken 40500 times.
✓ Branch 1 taken 392 times.
40892 if (!(flags & BOTTOM_EDGE))
873 40500 v->vc1dsp.vc1_v_loop_filter8(dst + 16 * linesize, 2 * linesize, pq);
874 } else {
875
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)
876 7576 v->vc1dsp.vc1_v_loop_filter8(dst + linesize, 2 * linesize, pq);
877
2/2
✓ Branch 0 taken 40500 times.
✓ Branch 1 taken 392 times.
40892 if (!(flags & BOTTOM_EDGE))
878 40500 v->vc1dsp.vc1_v_loop_filter8(dst + 9 * linesize, 2 * linesize, pq);
879 }
880 } else {
881
2/2
✓ Branch 0 taken 57028 times.
✓ Branch 1 taken 57028 times.
114056 if (block_num < 2) {
882
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)) {
883 9647 v->vc1dsp.vc1_v_loop_filter8(dst + 4 * linesize, 2 * linesize, pq);
884 9647 v->vc1dsp.vc1_v_loop_filter8(dst + 5 * linesize, 2 * linesize, pq);
885 }
886 57028 v->vc1dsp.vc1_v_loop_filter8(dst + 8 * linesize, 2 * linesize, pq);
887 57028 v->vc1dsp.vc1_v_loop_filter8(dst + 9 * linesize, 2 * linesize, pq);
888
2/2
✓ Branch 0 taken 55980 times.
✓ Branch 1 taken 1048 times.
57028 } else if (!(flags & BOTTOM_EDGE)) {
889
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) {
890 9613 v->vc1dsp.vc1_v_loop_filter8(dst + 4 * linesize, 2 * linesize, pq);
891 9613 v->vc1dsp.vc1_v_loop_filter8(dst + 5 * linesize, 2 * linesize, pq);
892 }
893 55980 v->vc1dsp.vc1_v_loop_filter8(dst + 8 * linesize, 2 * linesize, pq);
894 55980 v->vc1dsp.vc1_v_loop_filter8(dst + 9 * linesize, 2 * linesize, pq);
895 }
896 }
897 } else {
898
2/2
✓ Branch 0 taken 96480 times.
✓ Branch 1 taken 1440 times.
97920 if (!(flags & BOTTOM_EDGE)) {
899
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)) {
900 9701 v->vc1dsp.vc1_v_loop_filter8(dst + 4 * linesize, 2 * linesize, pq);
901 9701 v->vc1dsp.vc1_v_loop_filter8(dst + 5 * linesize, 2 * linesize, pq);
902 }
903 96480 v->vc1dsp.vc1_v_loop_filter8(dst + 8 * linesize, 2 * linesize, pq);
904 96480 v->vc1dsp.vc1_v_loop_filter8(dst + 9 * linesize, 2 * linesize, pq);
905 }
906 }
907 293760 }
908
909 48960 void ff_vc1_p_intfr_loop_filter(VC1Context *v)
910 {
911 48960 MpegEncContext *s = &v->s;
912 48960 int block_count = CONFIG_GRAY && (s->avctx->flags & AV_CODEC_FLAG_GRAY) ? 4 : 6;
913 48960 int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
914 uint8_t *dest;
915 int *ttblk;
916 uint32_t flags;
917 uint8_t fieldtx;
918 int i;
919
920 /* Within a MB, the vertical loop filter always runs before the horizontal.
921 * To accomplish that, we run the V loop filter on all applicable
922 * horizontal borders of the MB above the last overlap filtered MB. Then,
923 * we wait for the loop filter iteration on the next row and next column to
924 * do H loop filter on all applicable vertical borders of this MB.
925 * Therefore, the loop filter trails by two rows and one column relative to
926 * the overlap filter and two rows and two columns relative to the decoding
927 * loop. */
928
2/2
✓ Branch 0 taken 48552 times.
✓ Branch 1 taken 408 times.
48960 if (s->mb_x) {
929
2/2
✓ Branch 0 taken 47838 times.
✓ Branch 1 taken 714 times.
48552 if (s->mb_y >= s->start_mb_y + 1) {
930 47838 dest = s->dest[0] - 16 * s->linesize - 16;
931 47838 ttblk = &v->ttblk[s->mb_x - s->mb_stride - 1];
932
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;
933 47838 fieldtx = v->fieldtx_plane[mb_pos - s->mb_stride - 1];
934
2/2
✓ Branch 0 taken 287028 times.
✓ Branch 1 taken 47838 times.
334866 for (i = 0; i < block_count; i++)
935
2/2
✓ Branch 0 taken 95676 times.
✓ Branch 1 taken 191352 times.
382704 vc1_p_v_intfr_loop_filter(v,
936 95676 i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize - 8 : dest,
937 ttblk,
938 flags,
939 fieldtx,
940 i);
941 }
942 }
943
2/2
✓ Branch 0 taken 408 times.
✓ Branch 1 taken 48552 times.
48960 if (s->mb_x == s->mb_width - 1) {
944
2/2
✓ Branch 0 taken 402 times.
✓ Branch 1 taken 6 times.
408 if (s->mb_y >= s->start_mb_y + 1) {
945 402 dest = s->dest[0] - 16 * s->linesize;
946 402 ttblk = &v->ttblk[s->mb_x - s->mb_stride];
947
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;
948 402 fieldtx = v->fieldtx_plane[mb_pos - s->mb_stride];
949
2/2
✓ Branch 0 taken 2412 times.
✓ Branch 1 taken 402 times.
2814 for (i = 0; i < block_count; i++)
950
2/2
✓ Branch 0 taken 804 times.
✓ Branch 1 taken 1608 times.
3216 vc1_p_v_intfr_loop_filter(v,
951 804 i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize : dest,
952 ttblk,
953 flags,
954 fieldtx,
955 i);
956 }
957 }
958
2/2
✓ Branch 0 taken 720 times.
✓ Branch 1 taken 48240 times.
48960 if (s->mb_y == s->end_mb_y - 1) {
959
2/2
✓ Branch 0 taken 714 times.
✓ Branch 1 taken 6 times.
720 if (s->mb_x) {
960 714 dest = s->dest[0] - 16;
961 714 ttblk = &v->ttblk[s->mb_x - 1];
962
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;
963 714 fieldtx = v->fieldtx_plane[mb_pos - 1];
964
2/2
✓ Branch 0 taken 4284 times.
✓ Branch 1 taken 714 times.
4998 for (i = 0; i < block_count; i++)
965
2/2
✓ Branch 0 taken 1428 times.
✓ Branch 1 taken 2856 times.
5712 vc1_p_v_intfr_loop_filter(v,
966 1428 i > 3 ? s->dest[i - 3] - 8 : dest,
967 ttblk,
968 flags,
969 fieldtx,
970 i);
971 }
972
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 714 times.
720 if (s->mb_x == s->mb_width - 1) {
973 6 dest = s->dest[0];
974 6 ttblk = &v->ttblk[s->mb_x];
975
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;
976 6 fieldtx = v->fieldtx_plane[mb_pos];
977
2/2
✓ Branch 0 taken 36 times.
✓ Branch 1 taken 6 times.
42 for (i = 0; i < block_count; i++)
978
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 24 times.
48 vc1_p_v_intfr_loop_filter(v,
979 12 i > 3 ? s->dest[i - 3] : dest,
980 ttblk,
981 flags,
982 fieldtx,
983 i);
984 }
985 }
986
987
2/2
✓ Branch 0 taken 47520 times.
✓ Branch 1 taken 1440 times.
48960 if (s->mb_y >= s->start_mb_y + 2) {
988
2/2
✓ Branch 0 taken 46728 times.
✓ Branch 1 taken 792 times.
47520 if (s->mb_x >= 2) {
989 46728 dest = s->dest[0] - 32 * s->linesize - 32;
990 46728 ttblk = &v->ttblk[s->mb_x - 2 * s->mb_stride - 2];
991 46728 flags = s->mb_x == 2 ? LEFT_EDGE : 0;
992 46728 fieldtx = v->fieldtx_plane[mb_pos - 2 * s->mb_stride - 2];
993
2/2
✓ Branch 0 taken 280368 times.
✓ Branch 1 taken 46728 times.
327096 for (i = 0; i < block_count; i++)
994
2/2
✓ Branch 0 taken 93456 times.
✓ Branch 1 taken 186912 times.
373824 vc1_p_h_intfr_loop_filter(v,
995 93456 i > 3 ? s->dest[i - 3] - 16 * s->uvlinesize - 16 : dest,
996 ttblk,
997 flags,
998 fieldtx,
999 i);
1000 }
1001
2/2
✓ Branch 0 taken 396 times.
✓ Branch 1 taken 47124 times.
47520 if (s->mb_x == s->mb_width - 1) {
1002
1/2
✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
396 if (s->mb_x >= 1) {
1003 396 dest = s->dest[0] - 32 * s->linesize - 16;
1004 396 ttblk = &v->ttblk[s->mb_x - 2 * s->mb_stride - 1];
1005 396 flags = s->mb_x == 1 ? LEFT_EDGE : 0;
1006 396 fieldtx = v->fieldtx_plane[mb_pos - 2 * s->mb_stride - 1];
1007
2/2
✓ Branch 0 taken 2376 times.
✓ Branch 1 taken 396 times.
2772 for (i = 0; i < block_count; i++)
1008
2/2
✓ Branch 0 taken 792 times.
✓ Branch 1 taken 1584 times.
3168 vc1_p_h_intfr_loop_filter(v,
1009 792 i > 3 ? s->dest[i - 3] - 16 * s->uvlinesize - 8 : dest,
1010 ttblk,
1011 flags,
1012 fieldtx,
1013 i);
1014 }
1015 396 dest = s->dest[0] - 32 * s->linesize;
1016 396 ttblk = &v->ttblk[s->mb_x - 2 * s->mb_stride];
1017
1/2
✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
396 flags = s->mb_x ? RIGHT_EDGE : LEFT_EDGE | RIGHT_EDGE;
1018 396 fieldtx = v->fieldtx_plane[mb_pos - 2 * s->mb_stride];
1019
2/2
✓ Branch 0 taken 2376 times.
✓ Branch 1 taken 396 times.
2772 for (i = 0; i < block_count; i++)
1020
2/2
✓ Branch 0 taken 792 times.
✓ Branch 1 taken 1584 times.
3168 vc1_p_h_intfr_loop_filter(v,
1021 792 i > 3 ? s->dest[i - 3] - 16 * s->uvlinesize : dest,
1022 ttblk,
1023 flags,
1024 fieldtx,
1025 i);
1026 }
1027 }
1028
2/2
✓ Branch 0 taken 720 times.
✓ Branch 1 taken 48240 times.
48960 if (s->mb_y == s->end_mb_y - 1) {
1029
1/2
✓ Branch 0 taken 720 times.
✗ Branch 1 not taken.
720 if (s->mb_y >= s->start_mb_y + 1) {
1030
2/2
✓ Branch 0 taken 708 times.
✓ Branch 1 taken 12 times.
720 if (s->mb_x >= 2) {
1031 708 dest = s->dest[0] - 16 * s->linesize - 32;
1032 708 ttblk = &v->ttblk[s->mb_x - s->mb_stride - 2];
1033 708 flags = s->mb_x == 2 ? LEFT_EDGE : 0;
1034 708 fieldtx = v->fieldtx_plane[mb_pos - s->mb_stride - 2];
1035
2/2
✓ Branch 0 taken 4248 times.
✓ Branch 1 taken 708 times.
4956 for (i = 0; i < block_count; i++)
1036
2/2
✓ Branch 0 taken 1416 times.
✓ Branch 1 taken 2832 times.
5664 vc1_p_h_intfr_loop_filter(v,
1037 1416 i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize - 16 : dest,
1038 ttblk,
1039 flags,
1040 fieldtx,
1041 i);
1042 }
1043
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 714 times.
720 if (s->mb_x == s->mb_width - 1) {
1044
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (s->mb_x >= 1) {
1045 6 dest = s->dest[0] - 16 * s->linesize - 16;
1046 6 ttblk = &v->ttblk[s->mb_x - s->mb_stride - 1];
1047 6 flags = s->mb_x == 1 ? LEFT_EDGE : 0;
1048 6 fieldtx = v->fieldtx_plane[mb_pos - s->mb_stride - 1];
1049
2/2
✓ Branch 0 taken 36 times.
✓ Branch 1 taken 6 times.
42 for (i = 0; i < block_count; i++)
1050
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 24 times.
48 vc1_p_h_intfr_loop_filter(v,
1051 12 i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize - 8 : dest,
1052 ttblk,
1053 flags,
1054 fieldtx,
1055 i);
1056 }
1057 6 dest = s->dest[0] - 16 * s->linesize;
1058 6 ttblk = &v->ttblk[s->mb_x - s->mb_stride];
1059
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 flags = s->mb_x ? RIGHT_EDGE : LEFT_EDGE | RIGHT_EDGE;
1060 6 fieldtx = v->fieldtx_plane[mb_pos - s->mb_stride];
1061
2/2
✓ Branch 0 taken 36 times.
✓ Branch 1 taken 6 times.
42 for (i = 0; i < block_count; i++)
1062
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 24 times.
48 vc1_p_h_intfr_loop_filter(v,
1063 12 i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize : dest,
1064 ttblk,
1065 flags,
1066 fieldtx,
1067 i);
1068 }
1069 }
1070
2/2
✓ Branch 0 taken 708 times.
✓ Branch 1 taken 12 times.
720 if (s->mb_x >= 2) {
1071 708 dest = s->dest[0] - 32;
1072 708 ttblk = &v->ttblk[s->mb_x - 2];
1073 708 flags = s->mb_x == 2 ? LEFT_EDGE : 0;
1074 708 fieldtx = v->fieldtx_plane[mb_pos - 2];
1075
2/2
✓ Branch 0 taken 4248 times.
✓ Branch 1 taken 708 times.
4956 for (i = 0; i < block_count; i++)
1076
2/2
✓ Branch 0 taken 1416 times.
✓ Branch 1 taken 2832 times.
5664 vc1_p_h_intfr_loop_filter(v,
1077 1416 i > 3 ? s->dest[i - 3] - 16 : dest,
1078 ttblk,
1079 flags,
1080 fieldtx,
1081 i);
1082 }
1083
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 714 times.
720 if (s->mb_x == s->mb_width - 1) {
1084
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (s->mb_x >= 1) {
1085 6 dest = s->dest[0] - 16;
1086 6 ttblk = &v->ttblk[s->mb_x - 1];
1087 6 flags = s->mb_x == 1 ? LEFT_EDGE : 0;
1088 6 fieldtx = v->fieldtx_plane[mb_pos - 1];
1089
2/2
✓ Branch 0 taken 36 times.
✓ Branch 1 taken 6 times.
42 for (i = 0; i < block_count; i++)
1090
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 24 times.
48 vc1_p_h_intfr_loop_filter(v,
1091 12 i > 3 ? s->dest[i - 3] - 8 : dest,
1092 ttblk,
1093 flags,
1094 fieldtx,
1095 i);
1096 }
1097 6 dest = s->dest[0];
1098 6 ttblk = &v->ttblk[s->mb_x];
1099
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 flags = s->mb_x ? RIGHT_EDGE : LEFT_EDGE | RIGHT_EDGE;
1100 6 fieldtx = v->fieldtx_plane[mb_pos];
1101
2/2
✓ Branch 0 taken 36 times.
✓ Branch 1 taken 6 times.
42 for (i = 0; i < block_count; i++)
1102
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 24 times.
48 vc1_p_h_intfr_loop_filter(v,
1103 12 i > 3 ? s->dest[i - 3] : dest,
1104 ttblk,
1105 flags,
1106 fieldtx,
1107 i);
1108 }
1109 }
1110 48960 }
1111
1112 309240 static av_always_inline void vc1_b_h_intfi_loop_filter(VC1Context *v, uint8_t *dest, uint32_t *cbp,
1113 int *ttblk, uint32_t flags, int block_num)
1114 {
1115 309240 MpegEncContext *s = &v->s;
1116 309240 int pq = v->pq;
1117 uint8_t *dst;
1118 309240 uint32_t block_cbp = cbp[0] >> (block_num * 4);
1119 int tt;
1120
2/2
✓ Branch 0 taken 103080 times.
✓ Branch 1 taken 206160 times.
309240 int idx, linesize = block_num > 3 ? s->uvlinesize : s->linesize;
1121
1122
2/2
✓ Branch 0 taken 103080 times.
✓ Branch 1 taken 206160 times.
309240 if (block_num > 3)
1123 103080 dst = dest;
1124 else
1125 206160 dst = dest + (block_num & 2) * 4 * s->linesize + (block_num & 1) * 8;
1126
1127
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)) {
1128
2/2
✓ Branch 0 taken 101696 times.
✓ Branch 1 taken 204776 times.
306472 if (block_num > 3)
1129 101696 v->vc1dsp.vc1_h_loop_filter8(dst + 8, linesize, pq);
1130 else
1131 204776 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 309240 static av_always_inline void vc1_b_v_intfi_loop_filter(VC1Context *v, uint8_t *dest, uint32_t *cbp,
1145 int *ttblk, uint32_t flags, int block_num)
1146 {
1147 309240 MpegEncContext *s = &v->s;
1148 309240 int pq = v->pq;
1149 uint8_t *dst;
1150 309240 uint32_t block_cbp = cbp[0] >> (block_num * 4);
1151 int tt;
1152
2/2
✓ Branch 0 taken 103080 times.
✓ Branch 1 taken 206160 times.
309240 int idx, linesize = block_num > 3 ? s->uvlinesize : s->linesize;
1153
1154
2/2
✓ Branch 0 taken 103080 times.
✓ Branch 1 taken 206160 times.
309240 if (block_num > 3)
1155 103080 dst = dest;
1156 else
1157 206160 dst = dest + (block_num & 2) * 4 * s->linesize + (block_num & 1) * 8;
1158
1159
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)
1160 300360 v->vc1dsp.vc1_v_loop_filter8(dst + 8 * linesize, linesize, pq);
1161
1162 309240 tt = ttblk[0] >> (block_num * 4) & 0xf;
1163
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) {
1164 38249 idx = (block_cbp | (block_cbp >> 2)) & 3;
1165
2/2
✓ Branch 0 taken 34613 times.
✓ Branch 1 taken 3636 times.
38249 if (idx & 1)
1166 34613 v->vc1dsp.vc1_v_loop_filter4(dst + 4 * linesize + 4, linesize, pq);
1167
2/2
✓ Branch 0 taken 34929 times.
✓ Branch 1 taken 3320 times.
38249 if (idx & 2)
1168 34929 v->vc1dsp.vc1_v_loop_filter4(dst + 4 * linesize, linesize, pq);
1169 }
1170 309240 }
1171
1172 51540 void ff_vc1_b_intfi_loop_filter(VC1Context *v)
1173 {
1174 51540 MpegEncContext *s = &v->s;
1175 51540 int block_count = CONFIG_GRAY && (s->avctx->flags & AV_CODEC_FLAG_GRAY) ? 4 : 6;
1176 uint8_t *dest;
1177 uint32_t *cbp;
1178 int *ttblk;
1179 51540 uint32_t flags = 0;
1180 int i;
1181
1182 /* Within a MB, the vertical loop filter always runs before the horizontal.
1183 * To accomplish that, we run the V loop filter on all applicable
1184 * horizontal borders of the MB above the currently decoded MB. Then,
1185 * we wait for the next loop filter iteration to do H loop filter on all
1186 * applicable vertical borders of this MB. Therefore, the loop filter
1187 * trails by one row and one column relative to the decoding loop. */
1188
2/2
✓ Branch 0 taken 49320 times.
✓ Branch 1 taken 2220 times.
51540 if (!s->first_slice_line) {
1189 49320 dest = s->dest[0] - 16 * s->linesize;
1190 49320 cbp = &v->cbp[s->mb_x - s->mb_stride];
1191 49320 ttblk = &v->ttblk[s->mb_x - s->mb_stride];
1192
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;
1193
2/2
✓ Branch 0 taken 295920 times.
✓ Branch 1 taken 49320 times.
345240 for (i = 0; i < block_count; i++)
1194
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);
1195 }
1196
2/2
✓ Branch 0 taken 2220 times.
✓ Branch 1 taken 49320 times.
51540 if (s->mb_y == s->end_mb_y - 1) {
1197 2220 dest = s->dest[0];
1198 2220 cbp = &v->cbp[s->mb_x];
1199 2220 ttblk = &v->ttblk[s->mb_x];
1200
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2220 times.
2220 flags = s->first_slice_line ? TOP_EDGE | BOTTOM_EDGE : BOTTOM_EDGE;
1201
2/2
✓ Branch 0 taken 13320 times.
✓ Branch 1 taken 2220 times.
15540 for (i = 0; i < block_count; i++)
1202
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);
1203 }
1204
1205
2/2
✓ Branch 0 taken 49320 times.
✓ Branch 1 taken 2220 times.
51540 if (!s->first_slice_line) {
1206 49320 dest = s->dest[0] - 16 * s->linesize - 16;
1207 49320 cbp = &v->cbp[s->mb_x - s->mb_stride - 1];
1208 49320 ttblk = &v->ttblk[s->mb_x - s->mb_stride - 1];
1209
2/2
✓ Branch 0 taken 48664 times.
✓ Branch 1 taken 656 times.
49320 if (s->mb_x) {
1210 48664 flags = s->mb_x == 1 ? LEFT_EDGE : 0;
1211
2/2
✓ Branch 0 taken 291984 times.
✓ Branch 1 taken 48664 times.
340648 for (i = 0; i < block_count; i++)
1212
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);
1213 }
1214
2/2
✓ Branch 0 taken 656 times.
✓ Branch 1 taken 48664 times.
49320 if (s->mb_x == s->mb_width - 1) {
1215 656 dest += 16;
1216 656 cbp++;
1217 656 ttblk++;
1218
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 656 times.
656 flags = s->mb_x == 0 ? LEFT_EDGE | RIGHT_EDGE : RIGHT_EDGE;
1219
2/2
✓ Branch 0 taken 3936 times.
✓ Branch 1 taken 656 times.
4592 for (i = 0; i < block_count; i++)
1220
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);
1221 }
1222 }
1223
2/2
✓ Branch 0 taken 2220 times.
✓ Branch 1 taken 49320 times.
51540 if (s->mb_y == s->end_mb_y - 1) {
1224 2220 dest = s->dest[0] - 16;
1225 2220 cbp = &v->cbp[s->mb_x - 1];
1226 2220 ttblk = &v->ttblk[s->mb_x - 1];
1227
2/2
✓ Branch 0 taken 2184 times.
✓ Branch 1 taken 36 times.
2220 if (s->mb_x) {
1228 2184 flags = s->mb_x == 1 ? LEFT_EDGE : 0;
1229
2/2
✓ Branch 0 taken 13104 times.
✓ Branch 1 taken 2184 times.
15288 for (i = 0; i < block_count; i++)
1230
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);
1231 }
1232
2/2
✓ Branch 0 taken 36 times.
✓ Branch 1 taken 2184 times.
2220 if (s->mb_x == s->mb_width - 1) {
1233 36 dest += 16;
1234 36 cbp++;
1235 36 ttblk++;
1236
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 36 times.
36 flags = s->mb_x == 0 ? LEFT_EDGE | RIGHT_EDGE : RIGHT_EDGE;
1237
2/2
✓ Branch 0 taken 216 times.
✓ Branch 1 taken 36 times.
252 for (i = 0; i < block_count; i++)
1238
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);
1239 }
1240 }
1241 51540 }
1242