Coverage Report

Created: 2026-04-01 07:49

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/x264/common/deblock.c
Line
Count
Source
1
/*****************************************************************************
2
 * deblock.c: deblocking
3
 *****************************************************************************
4
 * Copyright (C) 2003-2025 x264 project
5
 *
6
 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
7
 *          Loren Merritt <lorenm@u.washington.edu>
8
 *          Fiona Glaser <fiona@x264.com>
9
 *          Henrik Gramner <henrik@gramner.com>
10
 *
11
 * This program is free software; you can redistribute it and/or modify
12
 * it under the terms of the GNU General Public License as published by
13
 * the Free Software Foundation; either version 2 of the License, or
14
 * (at your option) any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 * GNU General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU General Public License
22
 * along with this program; if not, write to the Free Software
23
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111, USA.
24
 *
25
 * This program is also available under a commercial proprietary license.
26
 * For more information, contact us at licensing@x264.com.
27
 *****************************************************************************/
28
29
#include "common.h"
30
31
/* Deblocking filter */
32
static const uint8_t i_alpha_table[52+12*3] =
33
{
34
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
35
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
36
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
37
     0,  0,  0,  0,  0,  0,  4,  4,  5,  6,
38
     7,  8,  9, 10, 12, 13, 15, 17, 20, 22,
39
    25, 28, 32, 36, 40, 45, 50, 56, 63, 71,
40
    80, 90,101,113,127,144,162,182,203,226,
41
   255,255,
42
   255,255,255,255,255,255,255,255,255,255,255,255,
43
};
44
static const uint8_t i_beta_table[52+12*3] =
45
{
46
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
47
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
48
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
49
     0,  0,  0,  0,  0,  0,  2,  2,  2,  3,
50
     3,  3,  3,  4,  4,  4,  6,  6,  7,  7,
51
     8,  8,  9,  9, 10, 10, 11, 11, 12, 12,
52
    13, 13, 14, 14, 15, 15, 16, 16, 17, 17,
53
    18, 18,
54
    18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
55
};
56
static const int8_t i_tc0_table[52+12*3][4] =
57
{
58
    {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
59
    {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
60
    {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
61
    {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
62
    {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
63
    {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
64
    {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 1 },
65
    {-1, 0, 0, 1 }, {-1, 0, 0, 1 }, {-1, 0, 0, 1 }, {-1, 0, 1, 1 }, {-1, 0, 1, 1 }, {-1, 1, 1, 1 },
66
    {-1, 1, 1, 1 }, {-1, 1, 1, 1 }, {-1, 1, 1, 1 }, {-1, 1, 1, 2 }, {-1, 1, 1, 2 }, {-1, 1, 1, 2 },
67
    {-1, 1, 1, 2 }, {-1, 1, 2, 3 }, {-1, 1, 2, 3 }, {-1, 2, 2, 3 }, {-1, 2, 2, 4 }, {-1, 2, 3, 4 },
68
    {-1, 2, 3, 4 }, {-1, 3, 3, 5 }, {-1, 3, 4, 6 }, {-1, 3, 4, 6 }, {-1, 4, 5, 7 }, {-1, 4, 5, 8 },
69
    {-1, 4, 6, 9 }, {-1, 5, 7,10 }, {-1, 6, 8,11 }, {-1, 6, 8,13 }, {-1, 7,10,14 }, {-1, 8,11,16 },
70
    {-1, 9,12,18 }, {-1,10,13,20 }, {-1,11,15,23 }, {-1,13,17,25 },
71
    {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
72
    {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
73
};
74
0
#define alpha_table(x) i_alpha_table[(x)+24]
75
0
#define beta_table(x)  i_beta_table[(x)+24]
76
0
#define tc0_table(x)   i_tc0_table[(x)+24]
77
78
/* From ffmpeg */
79
static ALWAYS_INLINE void deblock_edge_luma_c( pixel *pix, intptr_t xstride, int alpha, int beta, int8_t tc0 )
80
0
{
81
0
    int p2 = pix[-3*xstride];
82
0
    int p1 = pix[-2*xstride];
83
0
    int p0 = pix[-1*xstride];
84
0
    int q0 = pix[ 0*xstride];
85
0
    int q1 = pix[ 1*xstride];
86
0
    int q2 = pix[ 2*xstride];
87
88
0
    if( abs( p0 - q0 ) < alpha && abs( p1 - p0 ) < beta && abs( q1 - q0 ) < beta )
89
0
    {
90
0
        int tc = tc0;
91
0
        int delta;
92
0
        if( abs( p2 - p0 ) < beta )
93
0
        {
94
0
            if( tc0 )
95
0
                pix[-2*xstride] = p1 + x264_clip3( (( p2 + ((p0 + q0 + 1) >> 1)) >> 1) - p1, -tc0, tc0 );
96
0
            tc++;
97
0
        }
98
0
        if( abs( q2 - q0 ) < beta )
99
0
        {
100
0
            if( tc0 )
101
0
                pix[ 1*xstride] = q1 + x264_clip3( (( q2 + ((p0 + q0 + 1) >> 1)) >> 1) - q1, -tc0, tc0 );
102
0
            tc++;
103
0
        }
104
105
0
        delta = x264_clip3( (((q0 - p0 ) * 4) + (p1 - q1) + 4) >> 3, -tc, tc );
106
0
        pix[-1*xstride] = x264_clip_pixel( p0 + delta );    /* p0' */
107
0
        pix[ 0*xstride] = x264_clip_pixel( q0 - delta );    /* q0' */
108
0
    }
109
0
}
110
static inline void deblock_luma_c( pixel *pix, intptr_t xstride, intptr_t ystride, int alpha, int beta, int8_t *tc0 )
111
0
{
112
0
    for( int i = 0; i < 4; i++ )
113
0
    {
114
0
        if( tc0[i] < 0 )
115
0
        {
116
0
            pix += 4*ystride;
117
0
            continue;
118
0
        }
119
0
        for( int d = 0; d < 4; d++, pix += ystride )
120
0
            deblock_edge_luma_c( pix, xstride, alpha, beta, tc0[i] );
121
0
    }
122
0
}
123
static void deblock_h_luma_mbaff_c( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 )
124
0
{
125
0
    for( int d = 0; d < 8; d++, pix += stride )
126
0
        deblock_edge_luma_c( pix, 1, alpha, beta, tc0[d>>1] );
127
0
}
128
static void deblock_v_luma_c( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 )
129
0
{
130
0
    deblock_luma_c( pix, stride, 1, alpha, beta, tc0 );
131
0
}
132
static void deblock_h_luma_c( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 )
133
0
{
134
0
    deblock_luma_c( pix, 1, stride, alpha, beta, tc0 );
135
0
}
136
137
static ALWAYS_INLINE void deblock_edge_chroma_c( pixel *pix, intptr_t xstride, int alpha, int beta, int8_t tc )
138
0
{
139
0
    int p1 = pix[-2*xstride];
140
0
    int p0 = pix[-1*xstride];
141
0
    int q0 = pix[ 0*xstride];
142
0
    int q1 = pix[ 1*xstride];
143
144
0
    if( abs( p0 - q0 ) < alpha && abs( p1 - p0 ) < beta && abs( q1 - q0 ) < beta )
145
0
    {
146
0
        int delta = x264_clip3( (((q0 - p0 ) * 4) + (p1 - q1) + 4) >> 3, -tc, tc );
147
0
        pix[-1*xstride] = x264_clip_pixel( p0 + delta );    /* p0' */
148
0
        pix[ 0*xstride] = x264_clip_pixel( q0 - delta );    /* q0' */
149
0
    }
150
0
}
151
static ALWAYS_INLINE void deblock_chroma_c( pixel *pix, int height, intptr_t xstride, intptr_t ystride, int alpha, int beta, int8_t *tc0 )
152
0
{
153
0
    for( int i = 0; i < 4; i++ )
154
0
    {
155
0
        int tc = tc0[i];
156
0
        if( tc <= 0 )
157
0
        {
158
0
            pix += height*ystride;
159
0
            continue;
160
0
        }
161
0
        for( int d = 0; d < height; d++, pix += ystride-2 )
162
0
            for( int e = 0; e < 2; e++, pix++ )
163
0
                deblock_edge_chroma_c( pix, xstride, alpha, beta, tc0[i] );
164
0
    }
165
0
}
166
static void deblock_h_chroma_mbaff_c( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 )
167
0
{
168
0
    deblock_chroma_c( pix, 1, 2, stride, alpha, beta, tc0 );
169
0
}
170
static void deblock_v_chroma_c( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 )
171
0
{
172
0
    deblock_chroma_c( pix, 2, stride, 2, alpha, beta, tc0 );
173
0
}
174
static void deblock_h_chroma_c( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 )
175
0
{
176
0
    deblock_chroma_c( pix, 2, 2, stride, alpha, beta, tc0 );
177
0
}
178
static void deblock_h_chroma_422_c( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 )
179
0
{
180
0
    deblock_chroma_c( pix, 4, 2, stride, alpha, beta, tc0 );
181
0
}
182
183
static ALWAYS_INLINE void deblock_edge_luma_intra_c( pixel *pix, intptr_t xstride, int alpha, int beta )
184
0
{
185
0
    int p2 = pix[-3*xstride];
186
0
    int p1 = pix[-2*xstride];
187
0
    int p0 = pix[-1*xstride];
188
0
    int q0 = pix[ 0*xstride];
189
0
    int q1 = pix[ 1*xstride];
190
0
    int q2 = pix[ 2*xstride];
191
192
0
    if( abs( p0 - q0 ) < alpha && abs( p1 - p0 ) < beta && abs( q1 - q0 ) < beta )
193
0
    {
194
0
        if( abs( p0 - q0 ) < ((alpha >> 2) + 2) )
195
0
        {
196
0
            if( abs( p2 - p0 ) < beta ) /* p0', p1', p2' */
197
0
            {
198
0
                const int p3 = pix[-4*xstride];
199
0
                pix[-1*xstride] = ( p2 + 2*p1 + 2*p0 + 2*q0 + q1 + 4 ) >> 3;
200
0
                pix[-2*xstride] = ( p2 + p1 + p0 + q0 + 2 ) >> 2;
201
0
                pix[-3*xstride] = ( 2*p3 + 3*p2 + p1 + p0 + q0 + 4 ) >> 3;
202
0
            }
203
0
            else /* p0' */
204
0
                pix[-1*xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2;
205
0
            if( abs( q2 - q0 ) < beta ) /* q0', q1', q2' */
206
0
            {
207
0
                const int q3 = pix[3*xstride];
208
0
                pix[0*xstride] = ( p1 + 2*p0 + 2*q0 + 2*q1 + q2 + 4 ) >> 3;
209
0
                pix[1*xstride] = ( p0 + q0 + q1 + q2 + 2 ) >> 2;
210
0
                pix[2*xstride] = ( 2*q3 + 3*q2 + q1 + q0 + p0 + 4 ) >> 3;
211
0
            }
212
0
            else /* q0' */
213
0
                pix[0*xstride] = ( 2*q1 + q0 + p1 + 2 ) >> 2;
214
0
        }
215
0
        else /* p0', q0' */
216
0
        {
217
0
            pix[-1*xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2;
218
0
            pix[ 0*xstride] = ( 2*q1 + q0 + p1 + 2 ) >> 2;
219
0
        }
220
0
    }
221
0
}
222
static inline void deblock_luma_intra_c( pixel *pix, intptr_t xstride, intptr_t ystride, int alpha, int beta )
223
0
{
224
0
    for( int d = 0; d < 16; d++, pix += ystride )
225
0
        deblock_edge_luma_intra_c( pix, xstride, alpha, beta );
226
0
}
227
static void deblock_h_luma_intra_mbaff_c( pixel *pix, intptr_t ystride, int alpha, int beta )
228
0
{
229
0
    for( int d = 0; d < 8; d++, pix += ystride )
230
0
        deblock_edge_luma_intra_c( pix, 1, alpha, beta );
231
0
}
232
static void deblock_v_luma_intra_c( pixel *pix, intptr_t stride, int alpha, int beta )
233
0
{
234
0
    deblock_luma_intra_c( pix, stride, 1, alpha, beta );
235
0
}
236
static void deblock_h_luma_intra_c( pixel *pix, intptr_t stride, int alpha, int beta )
237
0
{
238
0
    deblock_luma_intra_c( pix, 1, stride, alpha, beta );
239
0
}
240
241
static ALWAYS_INLINE void deblock_edge_chroma_intra_c( pixel *pix, intptr_t xstride, int alpha, int beta )
242
0
{
243
0
    int p1 = pix[-2*xstride];
244
0
    int p0 = pix[-1*xstride];
245
0
    int q0 = pix[ 0*xstride];
246
0
    int q1 = pix[ 1*xstride];
247
248
0
    if( abs( p0 - q0 ) < alpha && abs( p1 - p0 ) < beta && abs( q1 - q0 ) < beta )
249
0
    {
250
0
        pix[-1*xstride] = (2*p1 + p0 + q1 + 2) >> 2;   /* p0' */
251
0
        pix[ 0*xstride] = (2*q1 + q0 + p1 + 2) >> 2;   /* q0' */
252
0
    }
253
0
}
254
static ALWAYS_INLINE void deblock_chroma_intra_c( pixel *pix, int width, int height, intptr_t xstride, intptr_t ystride, int alpha, int beta )
255
0
{
256
0
    for( int d = 0; d < height; d++, pix += ystride-2 )
257
0
        for( int e = 0; e < width; e++, pix++ )
258
0
            deblock_edge_chroma_intra_c( pix, xstride, alpha, beta );
259
0
}
260
static void deblock_h_chroma_intra_mbaff_c( pixel *pix, intptr_t stride, int alpha, int beta )
261
0
{
262
0
    deblock_chroma_intra_c( pix, 2, 4, 2, stride, alpha, beta );
263
0
}
264
static void deblock_v_chroma_intra_c( pixel *pix, intptr_t stride, int alpha, int beta )
265
0
{
266
0
    deblock_chroma_intra_c( pix, 1, 16, stride, 2, alpha, beta );
267
0
}
268
static void deblock_h_chroma_intra_c( pixel *pix, intptr_t stride, int alpha, int beta )
269
0
{
270
0
    deblock_chroma_intra_c( pix, 2, 8, 2, stride, alpha, beta );
271
0
}
272
static void deblock_h_chroma_422_intra_c( pixel *pix, intptr_t stride, int alpha, int beta )
273
0
{
274
0
    deblock_chroma_intra_c( pix, 2, 16, 2, stride, alpha, beta );
275
0
}
276
277
static void deblock_strength_c( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE],
278
                                int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4], int mvy_limit,
279
                                int bframe )
280
0
{
281
0
    for( int dir = 0; dir < 2; dir++ )
282
0
    {
283
0
        int s1 = dir ? 1 : 8;
284
0
        int s2 = dir ? 8 : 1;
285
0
        for( int edge = 0; edge < 4; edge++ )
286
0
            for( int i = 0, loc = X264_SCAN8_0+edge*s2; i < 4; i++, loc += s1 )
287
0
            {
288
0
                int locn = loc - s2;
289
0
                if( nnz[loc] || nnz[locn] )
290
0
                    bs[dir][edge][i] = 2;
291
0
                else if( ref[0][loc] != ref[0][locn] ||
292
0
                         abs( mv[0][loc][0] - mv[0][locn][0] ) >= 4 ||
293
0
                         abs( mv[0][loc][1] - mv[0][locn][1] ) >= mvy_limit ||
294
0
                        (bframe && (ref[1][loc] != ref[1][locn] ||
295
0
                         abs( mv[1][loc][0] - mv[1][locn][0] ) >= 4 ||
296
0
                         abs( mv[1][loc][1] - mv[1][locn][1] ) >= mvy_limit )))
297
0
                {
298
0
                    bs[dir][edge][i] = 1;
299
0
                }
300
0
                else
301
0
                    bs[dir][edge][i] = 0;
302
0
            }
303
0
    }
304
0
}
305
306
static ALWAYS_INLINE void deblock_edge( x264_t *h, pixel *pix, intptr_t i_stride, uint8_t bS[4], int i_qp,
307
                                        int a, int b, int b_chroma, x264_deblock_inter_t pf_inter )
308
0
{
309
0
    int index_a = i_qp + a;
310
0
    int index_b = i_qp + b;
311
0
    int alpha = alpha_table(index_a) << (BIT_DEPTH-8);
312
0
    int beta  = beta_table(index_b) << (BIT_DEPTH-8);
313
0
    int8_t tc[4];
314
315
0
    if( !M32(bS) || !alpha || !beta )
316
0
        return;
317
318
0
    tc[0] = (tc0_table(index_a)[bS[0]] * (1 << (BIT_DEPTH-8))) + b_chroma;
319
0
    tc[1] = (tc0_table(index_a)[bS[1]] * (1 << (BIT_DEPTH-8))) + b_chroma;
320
0
    tc[2] = (tc0_table(index_a)[bS[2]] * (1 << (BIT_DEPTH-8))) + b_chroma;
321
0
    tc[3] = (tc0_table(index_a)[bS[3]] * (1 << (BIT_DEPTH-8))) + b_chroma;
322
323
0
    pf_inter( pix, i_stride, alpha, beta, tc );
324
0
}
325
326
static ALWAYS_INLINE void deblock_edge_intra( x264_t *h, pixel *pix, intptr_t i_stride, uint8_t bS[4], int i_qp,
327
                                              int a, int b, int b_chroma, x264_deblock_intra_t pf_intra )
328
0
{
329
0
    int index_a = i_qp + a;
330
0
    int index_b = i_qp + b;
331
0
    int alpha = alpha_table(index_a) << (BIT_DEPTH-8);
332
0
    int beta  = beta_table(index_b) << (BIT_DEPTH-8);
333
334
0
    if( !alpha || !beta )
335
0
        return;
336
337
0
    pf_intra( pix, i_stride, alpha, beta );
338
0
}
339
340
static ALWAYS_INLINE void macroblock_cache_load_neighbours_deblock( x264_t *h, int mb_x, int mb_y )
341
0
{
342
0
    int deblock_on_slice_edges = h->sh.i_disable_deblocking_filter_idc != 2;
343
344
0
    h->mb.i_neighbour = 0;
345
0
    h->mb.i_mb_xy = mb_y * h->mb.i_mb_stride + mb_x;
346
0
    h->mb.b_interlaced = PARAM_INTERLACED && h->mb.field[h->mb.i_mb_xy];
347
0
    h->mb.i_mb_top_y = mb_y - (1 << MB_INTERLACED);
348
0
    h->mb.i_mb_top_xy = mb_x + h->mb.i_mb_stride*h->mb.i_mb_top_y;
349
0
    h->mb.i_mb_left_xy[1] =
350
0
    h->mb.i_mb_left_xy[0] = h->mb.i_mb_xy - 1;
351
0
    if( SLICE_MBAFF )
352
0
    {
353
0
        if( mb_y&1 )
354
0
        {
355
0
            if( mb_x && h->mb.field[h->mb.i_mb_xy - 1] != MB_INTERLACED )
356
0
                h->mb.i_mb_left_xy[0] -= h->mb.i_mb_stride;
357
0
        }
358
0
        else
359
0
        {
360
0
            if( h->mb.i_mb_top_xy >= 0 && MB_INTERLACED && !h->mb.field[h->mb.i_mb_top_xy] )
361
0
            {
362
0
                h->mb.i_mb_top_xy += h->mb.i_mb_stride;
363
0
                h->mb.i_mb_top_y++;
364
0
            }
365
0
            if( mb_x && h->mb.field[h->mb.i_mb_xy - 1] != MB_INTERLACED )
366
0
                h->mb.i_mb_left_xy[1] += h->mb.i_mb_stride;
367
0
        }
368
0
    }
369
370
0
    if( mb_x > 0 && (deblock_on_slice_edges ||
371
0
        h->mb.slice_table[h->mb.i_mb_left_xy[0]] == h->mb.slice_table[h->mb.i_mb_xy]) )
372
0
        h->mb.i_neighbour |= MB_LEFT;
373
0
    if( mb_y > MB_INTERLACED && (deblock_on_slice_edges
374
0
        || h->mb.slice_table[h->mb.i_mb_top_xy] == h->mb.slice_table[h->mb.i_mb_xy]) )
375
0
        h->mb.i_neighbour |= MB_TOP;
376
0
}
377
378
void x264_frame_deblock_row( x264_t *h, int mb_y )
379
0
{
380
0
    int b_interlaced = SLICE_MBAFF;
381
0
    int a = h->sh.i_alpha_c0_offset - QP_BD_OFFSET;
382
0
    int b = h->sh.i_beta_offset - QP_BD_OFFSET;
383
0
    int qp_thresh = 15 - X264_MIN( a, b ) - X264_MAX( 0, h->pps->i_chroma_qp_index_offset );
384
0
    int stridey   = h->fdec->i_stride[0];
385
0
    int strideuv  = h->fdec->i_stride[1];
386
0
    int chroma_format = CHROMA_FORMAT;
387
0
    int chroma444 = CHROMA444;
388
0
    int chroma_height = 16 >> CHROMA_V_SHIFT;
389
0
    intptr_t uvdiff = chroma444 ? h->fdec->plane[2] - h->fdec->plane[1] : 1;
390
391
0
    for( int mb_x = 0; mb_x < h->mb.i_mb_width; mb_x += (~b_interlaced | mb_y)&1, mb_y ^= b_interlaced )
392
0
    {
393
0
        x264_prefetch_fenc( h, h->fdec, mb_x, mb_y );
394
0
        macroblock_cache_load_neighbours_deblock( h, mb_x, mb_y );
395
396
0
        int mb_xy = h->mb.i_mb_xy;
397
0
        int transform_8x8 = h->mb.mb_transform_size[mb_xy];
398
0
        int intra_cur = IS_INTRA( h->mb.type[mb_xy] );
399
0
        uint8_t (*bs)[8][4] = h->deblock_strength[mb_y&1][h->param.b_sliced_threads?mb_xy:mb_x];
400
401
0
        pixel *pixy = h->fdec->plane[0] + 16*mb_y*stridey  + 16*mb_x;
402
0
        pixel *pixuv = CHROMA_FORMAT ? h->fdec->plane[1] + chroma_height*mb_y*strideuv + 16*mb_x : NULL;
403
404
0
        if( mb_y & MB_INTERLACED )
405
0
        {
406
0
            pixy -= 15*stridey;
407
0
            if( CHROMA_FORMAT )
408
0
                pixuv -= (chroma_height-1)*strideuv;
409
0
        }
410
411
0
        int stride2y  = stridey << MB_INTERLACED;
412
0
        int stride2uv = strideuv << MB_INTERLACED;
413
0
        int qp = h->mb.qp[mb_xy];
414
0
        int qpc = h->chroma_qp_table[qp];
415
0
        int first_edge_only = (h->mb.partition[mb_xy] == D_16x16 && !h->mb.cbp[mb_xy] && !intra_cur) || qp <= qp_thresh;
416
417
0
        #define FILTER( intra, dir, edge, qp, chroma_qp )\
418
0
        do\
419
0
        {\
420
0
            if( !(edge & 1) || !transform_8x8 )\
421
0
            {\
422
0
                deblock_edge##intra( h, pixy + 4*edge*(dir?stride2y:1),\
423
0
                                     stride2y, bs[dir][edge], qp, a, b, 0,\
424
0
                                     h->loopf.deblock_luma##intra[dir] );\
425
0
                if( chroma_format == CHROMA_444 )\
426
0
                {\
427
0
                    deblock_edge##intra( h, pixuv          + 4*edge*(dir?stride2uv:1),\
428
0
                                         stride2uv, bs[dir][edge], chroma_qp, a, b, 0,\
429
0
                                         h->loopf.deblock_luma##intra[dir] );\
430
0
                    deblock_edge##intra( h, pixuv + uvdiff + 4*edge*(dir?stride2uv:1),\
431
0
                                         stride2uv, bs[dir][edge], chroma_qp, a, b, 0,\
432
0
                                         h->loopf.deblock_luma##intra[dir] );\
433
0
                }\
434
0
                else if( chroma_format == CHROMA_420 && !(edge & 1) )\
435
0
                {\
436
0
                    deblock_edge##intra( h, pixuv + edge*(dir?2*stride2uv:4),\
437
0
                                         stride2uv, bs[dir][edge], chroma_qp, a, b, 1,\
438
0
                                         h->loopf.deblock_chroma##intra[dir] );\
439
0
                }\
440
0
            }\
441
0
            if( chroma_format == CHROMA_422 && (dir || !(edge & 1)) )\
442
0
            {\
443
0
                deblock_edge##intra( h, pixuv + edge*(dir?4*stride2uv:4),\
444
0
                                     stride2uv, bs[dir][edge], chroma_qp, a, b, 1,\
445
0
                                     h->loopf.deblock_chroma##intra[dir] );\
446
0
            }\
447
0
        } while( 0 )
448
449
0
        if( h->mb.i_neighbour & MB_LEFT )
450
0
        {
451
0
            if( b_interlaced && h->mb.field[h->mb.i_mb_left_xy[0]] != MB_INTERLACED )
452
0
            {
453
0
                int luma_qp[2];
454
0
                int chroma_qp[2];
455
0
                int left_qp[2];
456
0
                x264_deblock_inter_t luma_deblock = h->loopf.deblock_luma_mbaff;
457
0
                x264_deblock_inter_t chroma_deblock = h->loopf.deblock_chroma_mbaff;
458
0
                x264_deblock_intra_t luma_intra_deblock = h->loopf.deblock_luma_intra_mbaff;
459
0
                x264_deblock_intra_t chroma_intra_deblock = h->loopf.deblock_chroma_intra_mbaff;
460
0
                int c = chroma444 ? 0 : 1;
461
462
0
                left_qp[0] = h->mb.qp[h->mb.i_mb_left_xy[0]];
463
0
                luma_qp[0] = (qp + left_qp[0] + 1) >> 1;
464
0
                chroma_qp[0] = (qpc + h->chroma_qp_table[left_qp[0]] + 1) >> 1;
465
0
                if( intra_cur || IS_INTRA( h->mb.type[h->mb.i_mb_left_xy[0]] ) )
466
0
                {
467
0
                    deblock_edge_intra( h, pixy,           2*stridey,  bs[0][0], luma_qp[0],   a, b, 0, luma_intra_deblock );
468
0
                    if( chroma_format )
469
0
                    {
470
0
                        deblock_edge_intra( h, pixuv,          2*strideuv, bs[0][0], chroma_qp[0], a, b, c, chroma_intra_deblock );
471
0
                        if( chroma444 )
472
0
                            deblock_edge_intra( h, pixuv + uvdiff, 2*strideuv, bs[0][0], chroma_qp[0], a, b, c, chroma_intra_deblock );
473
0
                    }
474
0
                }
475
0
                else
476
0
                {
477
0
                    deblock_edge( h, pixy,           2*stridey,  bs[0][0], luma_qp[0],   a, b, 0, luma_deblock );
478
0
                    if( chroma_format )
479
0
                    {
480
0
                        deblock_edge( h, pixuv,          2*strideuv, bs[0][0], chroma_qp[0], a, b, c, chroma_deblock );
481
0
                        if( chroma444 )
482
0
                            deblock_edge( h, pixuv + uvdiff, 2*strideuv, bs[0][0], chroma_qp[0], a, b, c, chroma_deblock );
483
0
                    }
484
0
                }
485
486
0
                int offy = MB_INTERLACED ? 4 : 0;
487
0
                int offuv = MB_INTERLACED ? 4-CHROMA_V_SHIFT : 0;
488
0
                left_qp[1] = h->mb.qp[h->mb.i_mb_left_xy[1]];
489
0
                luma_qp[1] = (qp + left_qp[1] + 1) >> 1;
490
0
                chroma_qp[1] = (qpc + h->chroma_qp_table[left_qp[1]] + 1) >> 1;
491
0
                if( intra_cur || IS_INTRA( h->mb.type[h->mb.i_mb_left_xy[1]] ) )
492
0
                {
493
0
                    deblock_edge_intra( h, pixy           + (stridey<<offy),   2*stridey,  bs[0][4], luma_qp[1],   a, b, 0, luma_intra_deblock );
494
0
                    if( chroma_format )
495
0
                    {
496
0
                        deblock_edge_intra( h, pixuv          + (strideuv<<offuv), 2*strideuv, bs[0][4], chroma_qp[1], a, b, c, chroma_intra_deblock );
497
0
                        if( chroma444 )
498
0
                            deblock_edge_intra( h, pixuv + uvdiff + (strideuv<<offuv), 2*strideuv, bs[0][4], chroma_qp[1], a, b, c, chroma_intra_deblock );
499
0
                    }
500
0
                }
501
0
                else
502
0
                {
503
0
                    deblock_edge( h, pixy           + (stridey<<offy),   2*stridey,  bs[0][4], luma_qp[1],   a, b, 0, luma_deblock );
504
0
                    if( chroma_format )
505
0
                    {
506
0
                        deblock_edge( h, pixuv          + (strideuv<<offuv), 2*strideuv, bs[0][4], chroma_qp[1], a, b, c, chroma_deblock );
507
0
                        if( chroma444 )
508
0
                            deblock_edge( h, pixuv + uvdiff + (strideuv<<offuv), 2*strideuv, bs[0][4], chroma_qp[1], a, b, c, chroma_deblock );
509
0
                    }
510
0
                }
511
0
            }
512
0
            else
513
0
            {
514
0
                int qpl = h->mb.qp[h->mb.i_mb_xy-1];
515
0
                int qp_left = (qp + qpl + 1) >> 1;
516
0
                int qpc_left = (qpc + h->chroma_qp_table[qpl] + 1) >> 1;
517
0
                int intra_left = IS_INTRA( h->mb.type[h->mb.i_mb_xy-1] );
518
0
                int intra_deblock = intra_cur || intra_left;
519
520
                /* Any MB that was coded, or that analysis decided to skip, has quality commensurate with its QP.
521
                 * But if deblocking affects neighboring MBs that were force-skipped, blur might accumulate there.
522
                 * So reset their effective QP to max, to indicate that lack of guarantee. */
523
0
                if( h->fdec->mb_info && M32( bs[0][0] ) )
524
0
                {
525
0
#define RESET_EFFECTIVE_QP(xy) h->fdec->effective_qp[xy] |= 0xff * !!(h->fdec->mb_info[xy] & X264_MBINFO_CONSTANT);
526
0
                    RESET_EFFECTIVE_QP(mb_xy);
527
0
                    RESET_EFFECTIVE_QP(h->mb.i_mb_left_xy[0]);
528
0
                }
529
530
0
                if( intra_deblock )
531
0
                    FILTER( _intra, 0, 0, qp_left, qpc_left );
532
0
                else
533
0
                    FILTER(       , 0, 0, qp_left, qpc_left );
534
0
            }
535
0
        }
536
0
        if( !first_edge_only )
537
0
        {
538
0
            FILTER( , 0, 1, qp, qpc );
539
0
            FILTER( , 0, 2, qp, qpc );
540
0
            FILTER( , 0, 3, qp, qpc );
541
0
        }
542
543
0
        if( h->mb.i_neighbour & MB_TOP )
544
0
        {
545
0
            if( b_interlaced && !(mb_y&1) && !MB_INTERLACED && h->mb.field[h->mb.i_mb_top_xy] )
546
0
            {
547
0
                int mbn_xy = mb_xy - 2 * h->mb.i_mb_stride;
548
549
0
                for( int j = 0; j < 2; j++, mbn_xy += h->mb.i_mb_stride )
550
0
                {
551
0
                    int qpt = h->mb.qp[mbn_xy];
552
0
                    int qp_top = (qp + qpt + 1) >> 1;
553
0
                    int qpc_top = (qpc + h->chroma_qp_table[qpt] + 1) >> 1;
554
0
                    int intra_top = IS_INTRA( h->mb.type[mbn_xy] );
555
0
                    if( intra_cur || intra_top )
556
0
                        M32( bs[1][4*j] ) = 0x03030303;
557
558
                    // deblock the first horizontal edge of the even rows, then the first horizontal edge of the odd rows
559
0
                    deblock_edge( h, pixy      + j*stridey,  2* stridey, bs[1][4*j], qp_top, a, b, 0, h->loopf.deblock_luma[1] );
560
0
                    if( chroma444 )
561
0
                    {
562
0
                        deblock_edge( h, pixuv          + j*strideuv, 2*strideuv, bs[1][4*j], qpc_top, a, b, 0, h->loopf.deblock_luma[1] );
563
0
                        deblock_edge( h, pixuv + uvdiff + j*strideuv, 2*strideuv, bs[1][4*j], qpc_top, a, b, 0, h->loopf.deblock_luma[1] );
564
0
                    }
565
0
                    else if( chroma_format )
566
0
                        deblock_edge( h, pixuv          + j*strideuv, 2*strideuv, bs[1][4*j], qpc_top, a, b, 1, h->loopf.deblock_chroma[1] );
567
0
                }
568
0
            }
569
0
            else
570
0
            {
571
0
                int qpt = h->mb.qp[h->mb.i_mb_top_xy];
572
0
                int qp_top = (qp + qpt + 1) >> 1;
573
0
                int qpc_top = (qpc + h->chroma_qp_table[qpt] + 1) >> 1;
574
0
                int intra_top = IS_INTRA( h->mb.type[h->mb.i_mb_top_xy] );
575
0
                int intra_deblock = intra_cur || intra_top;
576
577
                /* This edge has been modified, reset effective qp to max. */
578
0
                if( h->fdec->mb_info && M32( bs[1][0] ) )
579
0
                {
580
0
                    RESET_EFFECTIVE_QP(mb_xy);
581
0
                    RESET_EFFECTIVE_QP(h->mb.i_mb_top_xy);
582
0
                }
583
584
0
                if( (!b_interlaced || (!MB_INTERLACED && !h->mb.field[h->mb.i_mb_top_xy])) && intra_deblock )
585
0
                {
586
0
                    FILTER( _intra, 1, 0, qp_top, qpc_top );
587
0
                }
588
0
                else
589
0
                {
590
0
                    if( intra_deblock )
591
0
                        M32( bs[1][0] ) = 0x03030303;
592
0
                    FILTER(       , 1, 0, qp_top, qpc_top );
593
0
                }
594
0
            }
595
0
        }
596
597
0
        if( !first_edge_only )
598
0
        {
599
0
            FILTER( , 1, 1, qp, qpc );
600
0
            FILTER( , 1, 2, qp, qpc );
601
0
            FILTER( , 1, 3, qp, qpc );
602
0
        }
603
604
0
        #undef FILTER
605
0
    }
606
0
}
Unexecuted instantiation: x264_8_frame_deblock_row
Unexecuted instantiation: x264_10_frame_deblock_row
607
608
/* For deblock-aware RD.
609
 * TODO:
610
 *  deblock macroblock edges
611
 *  support analysis partitions smaller than 16x16
612
 *  deblock chroma for 4:2:0/4:2:2
613
 *  handle duplicate refs correctly
614
 */
615
void x264_macroblock_deblock( x264_t *h )
616
0
{
617
0
    int a = h->sh.i_alpha_c0_offset - QP_BD_OFFSET;
618
0
    int b = h->sh.i_beta_offset - QP_BD_OFFSET;
619
0
    int qp_thresh = 15 - X264_MIN( a, b ) - X264_MAX( 0, h->pps->i_chroma_qp_index_offset );
620
0
    int intra_cur = IS_INTRA( h->mb.i_type );
621
0
    int qp = h->mb.i_qp;
622
0
    int qpc = h->mb.i_chroma_qp;
623
0
    if( (h->mb.i_partition == D_16x16 && !h->mb.i_cbp_luma && !intra_cur) || qp <= qp_thresh )
624
0
        return;
625
626
0
    uint8_t (*bs)[8][4] = h->mb.cache.deblock_strength;
627
0
    if( intra_cur )
628
0
    {
629
0
        M32( bs[0][1] ) = 0x03030303;
630
0
        M64( bs[0][2] ) = 0x0303030303030303ULL;
631
0
        M32( bs[1][1] ) = 0x03030303;
632
0
        M64( bs[1][2] ) = 0x0303030303030303ULL;
633
0
    }
634
0
    else
635
0
        h->loopf.deblock_strength( h->mb.cache.non_zero_count, h->mb.cache.ref, h->mb.cache.mv,
636
0
                                   bs, 4 >> MB_INTERLACED, h->sh.i_type == SLICE_TYPE_B );
637
638
0
    int transform_8x8 = h->mb.b_transform_8x8;
639
640
0
    #define FILTER( dir, edge )\
641
0
    do\
642
0
    {\
643
0
        deblock_edge( h, h->mb.pic.p_fdec[0] + 4*edge*(dir?FDEC_STRIDE:1),\
644
0
                      FDEC_STRIDE, bs[dir][edge], qp, a, b, 0,\
645
0
                      h->loopf.deblock_luma[dir] );\
646
0
        if( CHROMA444 )\
647
0
        {\
648
0
            deblock_edge( h, h->mb.pic.p_fdec[1] + 4*edge*(dir?FDEC_STRIDE:1),\
649
0
                          FDEC_STRIDE, bs[dir][edge], qpc, a, b, 0,\
650
0
                          h->loopf.deblock_luma[dir] );\
651
0
            deblock_edge( h, h->mb.pic.p_fdec[2] + 4*edge*(dir?FDEC_STRIDE:1),\
652
0
                          FDEC_STRIDE, bs[dir][edge], qpc, a, b, 0,\
653
0
                          h->loopf.deblock_luma[dir] );\
654
0
        }\
655
0
    } while( 0 )
656
657
0
    if( !transform_8x8 ) FILTER( 0, 1 );
658
0
    FILTER( 0, 2 );
659
0
    if( !transform_8x8 ) FILTER( 0, 3 );
660
661
0
    if( !transform_8x8 ) FILTER( 1, 1 );
662
0
    FILTER( 1, 2 );
663
0
    if( !transform_8x8 ) FILTER( 1, 3 );
664
665
0
    #undef FILTER
666
0
}
Unexecuted instantiation: x264_8_macroblock_deblock
Unexecuted instantiation: x264_10_macroblock_deblock
667
668
#if HAVE_MMX
669
#include "x86/deblock.h"
670
#endif
671
#if HAVE_ALTIVEC
672
#include "ppc/deblock.h"
673
#endif
674
#if HAVE_ARMV6
675
#include "arm/deblock.h"
676
#endif
677
#if HAVE_AARCH64
678
#include "aarch64/deblock.h"
679
#endif
680
#if HAVE_MSA
681
#include "mips/deblock.h"
682
#endif
683
#if HAVE_LSX
684
#include "loongarch/deblock.h"
685
#endif
686
687
void x264_deblock_init( uint32_t cpu, x264_deblock_function_t *pf, int b_mbaff )
688
0
{
689
0
    pf->deblock_luma[1] = deblock_v_luma_c;
690
0
    pf->deblock_luma[0] = deblock_h_luma_c;
691
0
    pf->deblock_chroma[1] = deblock_v_chroma_c;
692
0
    pf->deblock_h_chroma_420 = deblock_h_chroma_c;
693
0
    pf->deblock_h_chroma_422 = deblock_h_chroma_422_c;
694
0
    pf->deblock_luma_intra[1] = deblock_v_luma_intra_c;
695
0
    pf->deblock_luma_intra[0] = deblock_h_luma_intra_c;
696
0
    pf->deblock_chroma_intra[1] = deblock_v_chroma_intra_c;
697
0
    pf->deblock_h_chroma_420_intra = deblock_h_chroma_intra_c;
698
0
    pf->deblock_h_chroma_422_intra = deblock_h_chroma_422_intra_c;
699
0
    pf->deblock_luma_mbaff = deblock_h_luma_mbaff_c;
700
0
    pf->deblock_chroma_420_mbaff = deblock_h_chroma_mbaff_c;
701
0
    pf->deblock_luma_intra_mbaff = deblock_h_luma_intra_mbaff_c;
702
0
    pf->deblock_chroma_420_intra_mbaff = deblock_h_chroma_intra_mbaff_c;
703
0
    pf->deblock_strength = deblock_strength_c;
704
705
#if HAVE_MMX
706
    if( cpu&X264_CPU_MMX2 )
707
    {
708
#if ARCH_X86
709
        pf->deblock_luma[1] = x264_deblock_v_luma_mmx2;
710
        pf->deblock_luma[0] = x264_deblock_h_luma_mmx2;
711
        pf->deblock_chroma[1] = x264_deblock_v_chroma_mmx2;
712
        pf->deblock_h_chroma_420 = x264_deblock_h_chroma_mmx2;
713
        pf->deblock_chroma_420_mbaff = x264_deblock_h_chroma_mbaff_mmx2;
714
        pf->deblock_h_chroma_422 = x264_deblock_h_chroma_422_mmx2;
715
        pf->deblock_h_chroma_422_intra = x264_deblock_h_chroma_422_intra_mmx2;
716
        pf->deblock_luma_intra[1] = x264_deblock_v_luma_intra_mmx2;
717
        pf->deblock_luma_intra[0] = x264_deblock_h_luma_intra_mmx2;
718
        pf->deblock_chroma_intra[1] = x264_deblock_v_chroma_intra_mmx2;
719
        pf->deblock_h_chroma_420_intra = x264_deblock_h_chroma_intra_mmx2;
720
        pf->deblock_chroma_420_intra_mbaff = x264_deblock_h_chroma_intra_mbaff_mmx2;
721
#endif
722
#if !HIGH_BIT_DEPTH
723
        pf->deblock_chroma_420_intra_mbaff = x264_deblock_h_chroma_intra_mbaff_mmx2;
724
#endif
725
        if( cpu&X264_CPU_SSE2 )
726
        {
727
            pf->deblock_strength = x264_deblock_strength_sse2;
728
            pf->deblock_h_chroma_420 = x264_deblock_h_chroma_sse2;
729
            pf->deblock_h_chroma_422 = x264_deblock_h_chroma_422_sse2;
730
            pf->deblock_h_chroma_422_intra = x264_deblock_h_chroma_422_intra_sse2;
731
            pf->deblock_chroma_420_mbaff = x264_deblock_h_chroma_mbaff_sse2;
732
            pf->deblock_luma[1] = x264_deblock_v_luma_sse2;
733
            pf->deblock_luma[0] = x264_deblock_h_luma_sse2;
734
            pf->deblock_luma_intra[1] = x264_deblock_v_luma_intra_sse2;
735
            pf->deblock_luma_intra[0] = x264_deblock_h_luma_intra_sse2;
736
            if( !(cpu&X264_CPU_STACK_MOD4) )
737
            {
738
                pf->deblock_chroma[1] = x264_deblock_v_chroma_sse2;
739
                pf->deblock_chroma_intra[1] = x264_deblock_v_chroma_intra_sse2;
740
                pf->deblock_h_chroma_420_intra = x264_deblock_h_chroma_intra_sse2;
741
#if HIGH_BIT_DEPTH
742
                pf->deblock_chroma_420_intra_mbaff= x264_deblock_h_chroma_intra_mbaff_sse2;
743
#endif
744
            }
745
        }
746
        if( cpu&X264_CPU_SSSE3 )
747
            pf->deblock_strength = x264_deblock_strength_ssse3;
748
        if( cpu&X264_CPU_AVX )
749
        {
750
            pf->deblock_strength = x264_deblock_strength_avx;
751
            pf->deblock_h_chroma_420 = x264_deblock_h_chroma_avx;
752
            pf->deblock_h_chroma_422 = x264_deblock_h_chroma_422_avx;
753
            pf->deblock_h_chroma_422_intra = x264_deblock_h_chroma_422_intra_avx;
754
            pf->deblock_luma[1] = x264_deblock_v_luma_avx;
755
            pf->deblock_luma[0] = x264_deblock_h_luma_avx;
756
            pf->deblock_luma_intra[1] = x264_deblock_v_luma_intra_avx;
757
            pf->deblock_luma_intra[0] = x264_deblock_h_luma_intra_avx;
758
            if( !(cpu&X264_CPU_STACK_MOD4) )
759
            {
760
                pf->deblock_chroma[1] = x264_deblock_v_chroma_avx;
761
                pf->deblock_chroma_intra[1] = x264_deblock_v_chroma_intra_avx;
762
                pf->deblock_h_chroma_420_intra = x264_deblock_h_chroma_intra_avx;
763
#if HIGH_BIT_DEPTH
764
                pf->deblock_chroma_420_mbaff = x264_deblock_h_chroma_mbaff_avx;
765
                pf->deblock_chroma_420_intra_mbaff = x264_deblock_h_chroma_intra_mbaff_avx;
766
#endif
767
            }
768
        }
769
        if( cpu&X264_CPU_AVX2 )
770
        {
771
            pf->deblock_strength = x264_deblock_strength_avx2;
772
        }
773
        if( cpu&X264_CPU_AVX512 )
774
        {
775
            pf->deblock_strength = x264_deblock_strength_avx512;
776
        }
777
    }
778
#endif
779
780
#if !HIGH_BIT_DEPTH
781
#if HAVE_ALTIVEC
782
    if( cpu&X264_CPU_ALTIVEC )
783
    {
784
        pf->deblock_luma[1] = x264_deblock_v_luma_altivec;
785
        pf->deblock_luma[0] = x264_deblock_h_luma_altivec;
786
    }
787
#endif // HAVE_ALTIVEC
788
789
#if HAVE_ARMV6 || HAVE_AARCH64
790
    if( cpu&X264_CPU_NEON )
791
    {
792
        pf->deblock_luma[1] = x264_deblock_v_luma_neon;
793
        pf->deblock_luma[0] = x264_deblock_h_luma_neon;
794
        pf->deblock_chroma[1] = x264_deblock_v_chroma_neon;
795
        pf->deblock_h_chroma_420 = x264_deblock_h_chroma_neon;
796
        pf->deblock_h_chroma_422 = x264_deblock_h_chroma_422_neon;
797
        pf->deblock_chroma_420_mbaff = x264_deblock_h_chroma_mbaff_neon;
798
        pf->deblock_chroma_420_intra_mbaff = x264_deblock_h_chroma_intra_mbaff_neon;
799
        pf->deblock_h_chroma_420_intra = x264_deblock_h_chroma_intra_neon;
800
        pf->deblock_h_chroma_422_intra = x264_deblock_h_chroma_422_intra_neon;
801
        pf->deblock_chroma_intra[1] = x264_deblock_v_chroma_intra_neon;
802
        pf->deblock_luma_intra[0] = x264_deblock_h_luma_intra_neon;
803
        pf->deblock_luma_intra[1] = x264_deblock_v_luma_intra_neon;
804
        pf->deblock_strength     = x264_deblock_strength_neon;
805
    }
806
#if HAVE_SVE
807
    if ( cpu&X264_CPU_SVE )
808
    {
809
        pf->deblock_chroma[1] = x264_deblock_v_chroma_sve;
810
    }
811
#endif
812
#endif
813
814
#if HAVE_MSA
815
    if( cpu&X264_CPU_MSA )
816
    {
817
        pf->deblock_luma[1] = x264_deblock_v_luma_msa;
818
        pf->deblock_luma[0] = x264_deblock_h_luma_msa;
819
        pf->deblock_chroma[1] = x264_deblock_v_chroma_msa;
820
        pf->deblock_h_chroma_420 = x264_deblock_h_chroma_msa;
821
        pf->deblock_luma_intra[1] = x264_deblock_v_luma_intra_msa;
822
        pf->deblock_luma_intra[0] = x264_deblock_h_luma_intra_msa;
823
        pf->deblock_chroma_intra[1] = x264_deblock_v_chroma_intra_msa;
824
        pf->deblock_h_chroma_420_intra = x264_deblock_h_chroma_intra_msa;
825
        pf->deblock_strength = x264_deblock_strength_msa;
826
    }
827
#endif
828
829
#if HAVE_LSX
830
    if( cpu&X264_CPU_LSX )
831
    {
832
        pf->deblock_luma_intra[1] = x264_deblock_v_luma_intra_lsx;
833
        pf->deblock_luma_intra[0] = x264_deblock_h_luma_intra_lsx;
834
        pf->deblock_strength = x264_deblock_strength_lsx;
835
    }
836
    if( cpu&X264_CPU_LASX )
837
    {
838
        pf->deblock_luma[1] = x264_deblock_v_luma_lasx;
839
        pf->deblock_luma[0] = x264_deblock_h_luma_lasx;
840
        pf->deblock_luma_intra[1] = x264_deblock_v_luma_intra_lasx;
841
        pf->deblock_luma_intra[0] = x264_deblock_h_luma_intra_lasx;
842
        pf->deblock_strength = x264_deblock_strength_lasx;
843
    }
844
#endif
845
846
#endif // !HIGH_BIT_DEPTH
847
848
    /* These functions are equivalent, so don't duplicate them. */
849
0
    pf->deblock_chroma_422_mbaff = pf->deblock_h_chroma_420;
850
0
    pf->deblock_chroma_422_intra_mbaff = pf->deblock_h_chroma_420_intra;
851
0
}
Unexecuted instantiation: x264_8_deblock_init
Unexecuted instantiation: x264_10_deblock_init