Coverage Report

Created: 2026-05-16 07:49

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/ffmpeg/libswscale/output.c
Line
Count
Source
1
/*
2
 * Copyright (C) 2001-2012 Michael Niedermayer <michaelni@gmx.at>
3
 *
4
 * This file is part of FFmpeg.
5
 *
6
 * FFmpeg is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Lesser General Public
8
 * License as published by the Free Software Foundation; either
9
 * version 2.1 of the License, or (at your option) any later version.
10
 *
11
 * FFmpeg is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 * Lesser General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Lesser General Public
17
 * License along with FFmpeg; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
 */
20
21
#include <math.h>
22
#include <stddef.h>
23
#include <stdint.h>
24
#include <string.h>
25
26
#include "libavutil/attributes.h"
27
#include "libavutil/avutil.h"
28
#include "libavutil/avassert.h"
29
#include "libavutil/bswap.h"
30
#include "libavutil/intfloat.h"
31
#include "libavutil/intreadwrite.h"
32
#include "libavutil/mathematics.h"
33
#include "libavutil/mem_internal.h"
34
#include "libavutil/pixdesc.h"
35
#include "config.h"
36
#include "rgb2rgb.h"
37
#include "swscale.h"
38
#include "swscale_internal.h"
39
40
DECLARE_ALIGNED(8, const uint8_t, ff_dither_2x2_4)[][8] = {
41
{  1,   3,   1,   3,   1,   3,   1,   3, },
42
{  2,   0,   2,   0,   2,   0,   2,   0, },
43
{  1,   3,   1,   3,   1,   3,   1,   3, },
44
};
45
46
DECLARE_ALIGNED(8, const uint8_t, ff_dither_2x2_8)[][8] = {
47
{  6,   2,   6,   2,   6,   2,   6,   2, },
48
{  0,   4,   0,   4,   0,   4,   0,   4, },
49
{  6,   2,   6,   2,   6,   2,   6,   2, },
50
};
51
52
DECLARE_ALIGNED(8, const uint8_t, ff_dither_4x4_16)[][8] = {
53
{  8,   4,  11,   7,   8,   4,  11,   7, },
54
{  2,  14,   1,  13,   2,  14,   1,  13, },
55
{ 10,   6,   9,   5,  10,   6,   9,   5, },
56
{  0,  12,   3,  15,   0,  12,   3,  15, },
57
{  8,   4,  11,   7,   8,   4,  11,   7, },
58
};
59
60
DECLARE_ALIGNED(8, const uint8_t, ff_dither_8x8_32)[][8] = {
61
{ 17,   9,  23,  15,  16,   8,  22,  14, },
62
{  5,  29,   3,  27,   4,  28,   2,  26, },
63
{ 21,  13,  19,  11,  20,  12,  18,  10, },
64
{  0,  24,   6,  30,   1,  25,   7,  31, },
65
{ 16,   8,  22,  14,  17,   9,  23,  15, },
66
{  4,  28,   2,  26,   5,  29,   3,  27, },
67
{ 20,  12,  18,  10,  21,  13,  19,  11, },
68
{  1,  25,   7,  31,   0,  24,   6,  30, },
69
{ 17,   9,  23,  15,  16,   8,  22,  14, },
70
};
71
72
DECLARE_ALIGNED(8, const uint8_t, ff_dither_8x8_73)[][8] = {
73
{  0,  55,  14,  68,   3,  58,  17,  72, },
74
{ 37,  18,  50,  32,  40,  22,  54,  35, },
75
{  9,  64,   5,  59,  13,  67,   8,  63, },
76
{ 46,  27,  41,  23,  49,  31,  44,  26, },
77
{  2,  57,  16,  71,   1,  56,  15,  70, },
78
{ 39,  21,  52,  34,  38,  19,  51,  33, },
79
{ 11,  66,   7,  62,  10,  65,   6,  60, },
80
{ 48,  30,  43,  25,  47,  29,  42,  24, },
81
{  0,  55,  14,  68,   3,  58,  17,  72, },
82
};
83
84
#if 1
85
DECLARE_ALIGNED(8, const uint8_t, ff_dither_8x8_220)[][8] = {
86
{117,  62, 158, 103, 113,  58, 155, 100, },
87
{ 34, 199,  21, 186,  31, 196,  17, 182, },
88
{144,  89, 131,  76, 141,  86, 127,  72, },
89
{  0, 165,  41, 206,  10, 175,  52, 217, },
90
{110,  55, 151,  96, 120,  65, 162, 107, },
91
{ 28, 193,  14, 179,  38, 203,  24, 189, },
92
{138,  83, 124,  69, 148,  93, 134,  79, },
93
{  7, 172,  48, 213,   3, 168,  45, 210, },
94
{117,  62, 158, 103, 113,  58, 155, 100, },
95
};
96
#elif 1
97
// tries to correct a gamma of 1.5
98
DECLARE_ALIGNED(8, const uint8_t, ff_dither_8x8_220)[][8] = {
99
{  0, 143,  18, 200,   2, 156,  25, 215, },
100
{ 78,  28, 125,  64,  89,  36, 138,  74, },
101
{ 10, 180,   3, 161,  16, 195,   8, 175, },
102
{109,  51,  93,  38, 121,  60, 105,  47, },
103
{  1, 152,  23, 210,   0, 147,  20, 205, },
104
{ 85,  33, 134,  71,  81,  30, 130,  67, },
105
{ 14, 190,   6, 171,  12, 185,   5, 166, },
106
{117,  57, 101,  44, 113,  54,  97,  41, },
107
{  0, 143,  18, 200,   2, 156,  25, 215, },
108
};
109
#elif 1
110
// tries to correct a gamma of 2.0
111
DECLARE_ALIGNED(8, const uint8_t, ff_dither_8x8_220)[][8] = {
112
{  0, 124,   8, 193,   0, 140,  12, 213, },
113
{ 55,  14, 104,  42,  66,  19, 119,  52, },
114
{  3, 168,   1, 145,   6, 187,   3, 162, },
115
{ 86,  31,  70,  21,  99,  39,  82,  28, },
116
{  0, 134,  11, 206,   0, 129,   9, 200, },
117
{ 62,  17, 114,  48,  58,  16, 109,  45, },
118
{  5, 181,   2, 157,   4, 175,   1, 151, },
119
{ 95,  36,  78,  26,  90,  34,  74,  24, },
120
{  0, 124,   8, 193,   0, 140,  12, 213, },
121
};
122
#else
123
// tries to correct a gamma of 2.5
124
DECLARE_ALIGNED(8, const uint8_t, ff_dither_8x8_220)[][8] = {
125
{  0, 107,   3, 187,   0, 125,   6, 212, },
126
{ 39,   7,  86,  28,  49,  11, 102,  36, },
127
{  1, 158,   0, 131,   3, 180,   1, 151, },
128
{ 68,  19,  52,  12,  81,  25,  64,  17, },
129
{  0, 119,   5, 203,   0, 113,   4, 195, },
130
{ 45,   9,  96,  33,  42,   8,  91,  30, },
131
{  2, 172,   1, 144,   2, 165,   0, 137, },
132
{ 77,  23,  60,  15,  72,  21,  56,  14, },
133
{  0, 107,   3, 187,   0, 125,   6, 212, },
134
};
135
#endif
136
137
#define IS_BE_LE 0
138
#define IS_BE_BE 1
139
/* ENDIAN_IDENTIFIER needs to be "BE" or "LE". */
140
#define IS_BE(ENDIAN_IDENTIFIER) IS_BE_ ## ENDIAN_IDENTIFIER
141
142
#define output_pixel(pos, val, bias, signedness) \
143
1.80M
    if (big_endian) { \
144
840k
        AV_WB16(pos, bias + av_clip_ ## signedness ## 16(val >> shift)); \
145
962k
    } else { \
146
962k
        AV_WL16(pos, bias + av_clip_ ## signedness ## 16(val >> shift)); \
147
962k
    }
148
149
static av_always_inline void
150
yuv2plane1_16_c_template(const int32_t *src, uint16_t *dest, int dstW,
151
                         int big_endian, int output_bits)
152
81.6k
{
153
81.6k
    int i;
154
81.6k
    int shift = 3;
155
81.6k
    av_assert0(output_bits == 16);
156
157
703k
    for (i = 0; i < dstW; i++) {
158
621k
        int val = src[i] + (1 << (shift - 1));
159
621k
        output_pixel(&dest[i], val, 0, uint);
160
621k
    }
161
81.6k
}
162
163
static av_always_inline void
164
yuv2planeX_16_c_template(const int16_t *filter, int filterSize,
165
                         const int32_t **src, uint16_t *dest, int dstW,
166
                         int big_endian, int output_bits)
167
157k
{
168
157k
    int i;
169
157k
    int shift = 15;
170
157k
    av_assert0(output_bits == 16);
171
172
716k
    for (i = 0; i < dstW; i++) {
173
558k
        int val = 1 << (shift - 1);
174
558k
        int j;
175
176
        /* range of val is [0,0x7FFFFFFF], so 31 bits, but with lanczos/spline
177
         * filters (or anything with negative coeffs, the range can be slightly
178
         * wider in both directions. To account for this overflow, we subtract
179
         * a constant so it always fits in the signed range (assuming a
180
         * reasonable filterSize), and re-add that at the end. */
181
558k
        val -= 0x40000000;
182
5.50M
        for (j = 0; j < filterSize; j++)
183
4.94M
            val += src[j][i] * (unsigned)filter[j];
184
185
558k
        output_pixel(&dest[i], val, 0x8000, int);
186
558k
    }
187
157k
}
188
189
static av_always_inline void
190
yuv2nv12cX_16_c_template(int big_endian, const uint8_t *chrDither,
191
                         const int16_t *chrFilter, int chrFilterSize,
192
                         const int16_t **chrUSrc, const int16_t **chrVSrc,
193
                         uint8_t *dest8, int chrDstW, int output_bits)
194
65.5k
{
195
65.5k
    uint16_t *dest = (uint16_t*)dest8;
196
65.5k
    const int32_t **uSrc = (const int32_t **)chrUSrc;
197
65.5k
    const int32_t **vSrc = (const int32_t **)chrVSrc;
198
65.5k
    int shift = 15;
199
65.5k
    int i, j;
200
65.5k
    av_assert0(output_bits == 16);
201
202
253k
    for (i = 0; i < chrDstW; i++) {
203
187k
        int u = 1 << (shift - 1);
204
187k
        int v = 1 << (shift - 1);
205
206
        /* See yuv2planeX_16_c_template for details. */
207
187k
        u -= 0x40000000;
208
187k
        v -= 0x40000000;
209
1.08M
        for (j = 0; j < chrFilterSize; j++) {
210
900k
            u += uSrc[j][i] * (unsigned)chrFilter[j];
211
900k
            v += vSrc[j][i] * (unsigned)chrFilter[j];
212
900k
        }
213
214
187k
        output_pixel(&dest[2*i]  , u, 0x8000, int);
215
187k
        output_pixel(&dest[2*i+1], v, 0x8000, int);
216
187k
    }
217
65.5k
}
218
219
static av_always_inline void
220
yuv2plane1_float_c_template(const int32_t *src, float *dest, int dstW)
221
3.47k
{
222
3.47k
    static const int big_endian = HAVE_BIGENDIAN;
223
3.47k
    static const int shift = 3;
224
3.47k
    static const float float_mult = 1.0f / 65535.0f;
225
3.47k
    int i, val;
226
3.47k
    uint16_t val_uint;
227
228
65.0k
    for (i = 0; i < dstW; ++i){
229
61.5k
        val = src[i] + (1 << (shift - 1));
230
61.5k
        output_pixel(&val_uint, val, 0, uint);
231
61.5k
        dest[i] = float_mult * (float)val_uint;
232
61.5k
    }
233
3.47k
}
234
235
static av_always_inline void
236
yuv2plane1_float_bswap_c_template(const int32_t *src, uint32_t *dest, int dstW)
237
928
{
238
928
    static const int big_endian = HAVE_BIGENDIAN;
239
928
    static const int shift = 3;
240
928
    static const float float_mult = 1.0f / 65535.0f;
241
928
    int i, val;
242
928
    uint16_t val_uint;
243
244
56.3k
    for (i = 0; i < dstW; ++i){
245
55.4k
        val = src[i] + (1 << (shift - 1));
246
55.4k
        output_pixel(&val_uint, val, 0, uint);
247
55.4k
        dest[i] = av_bswap32(av_float2int(float_mult * (float)val_uint));
248
55.4k
    }
249
928
}
250
251
static av_always_inline void
252
yuv2planeX_float_c_template(const int16_t *filter, int filterSize, const int32_t **src,
253
                            float *dest, int dstW)
254
24.6k
{
255
24.6k
    static const int big_endian = HAVE_BIGENDIAN;
256
24.6k
    static const int shift = 15;
257
24.6k
    static const float float_mult = 1.0f / 65535.0f;
258
24.6k
    int i, j, val;
259
24.6k
    uint16_t val_uint;
260
261
125k
    for (i = 0; i < dstW; ++i){
262
100k
        val = (1 << (shift - 1)) - 0x40000000;
263
1.09M
        for (j = 0; j < filterSize; ++j){
264
996k
            val += src[j][i] * (unsigned)filter[j];
265
996k
        }
266
100k
        output_pixel(&val_uint, val, 0x8000, int);
267
100k
        dest[i] = float_mult * (float)val_uint;
268
100k
    }
269
24.6k
}
270
271
static av_always_inline void
272
yuv2planeX_float_bswap_c_template(const int16_t *filter, int filterSize, const int32_t **src,
273
                            uint32_t *dest, int dstW)
274
25.7k
{
275
25.7k
    static const int big_endian = HAVE_BIGENDIAN;
276
25.7k
    static const int shift = 15;
277
25.7k
    static const float float_mult = 1.0f / 65535.0f;
278
25.7k
    int i, j, val;
279
25.7k
    uint16_t val_uint;
280
281
55.5k
    for (i = 0; i < dstW; ++i){
282
29.8k
        val = (1 << (shift - 1)) - 0x40000000;
283
246k
        for (j = 0; j < filterSize; ++j){
284
216k
            val += src[j][i] * (unsigned)filter[j];
285
216k
        }
286
29.8k
        output_pixel(&val_uint, val, 0x8000, int);
287
29.8k
        dest[i] = av_bswap32(av_float2int(float_mult * (float)val_uint));
288
29.8k
    }
289
25.7k
}
290
291
#define yuv2plane1_float(template, dest_type, BE_LE) \
292
static void yuv2plane1_float ## BE_LE ## _c(const int16_t *src, uint8_t *dest, int dstW, \
293
4.40k
                                            const uint8_t *dither, int offset) \
294
4.40k
{ \
295
4.40k
    template((const int32_t *)src, (dest_type *)dest, dstW); \
296
4.40k
}
output.c:yuv2plane1_floatBE_c
Line
Count
Source
293
928
                                            const uint8_t *dither, int offset) \
294
928
{ \
295
928
    template((const int32_t *)src, (dest_type *)dest, dstW); \
296
928
}
output.c:yuv2plane1_floatLE_c
Line
Count
Source
293
3.47k
                                            const uint8_t *dither, int offset) \
294
3.47k
{ \
295
3.47k
    template((const int32_t *)src, (dest_type *)dest, dstW); \
296
3.47k
}
297
298
#define yuv2planeX_float(template, dest_type, BE_LE) \
299
static void yuv2planeX_float ## BE_LE ## _c(const int16_t *filter, int filterSize, \
300
                                            const int16_t **src, uint8_t *dest, int dstW, \
301
50.3k
                                            const uint8_t *dither, int offset) \
302
50.3k
{ \
303
50.3k
    template(filter, filterSize, (const int32_t **)src, (dest_type *)dest, dstW); \
304
50.3k
}
output.c:yuv2planeX_floatBE_c
Line
Count
Source
301
25.7k
                                            const uint8_t *dither, int offset) \
302
25.7k
{ \
303
25.7k
    template(filter, filterSize, (const int32_t **)src, (dest_type *)dest, dstW); \
304
25.7k
}
output.c:yuv2planeX_floatLE_c
Line
Count
Source
301
24.6k
                                            const uint8_t *dither, int offset) \
302
24.6k
{ \
303
24.6k
    template(filter, filterSize, (const int32_t **)src, (dest_type *)dest, dstW); \
304
24.6k
}
305
306
#if HAVE_BIGENDIAN
307
yuv2plane1_float(yuv2plane1_float_c_template,       float,    BE)
308
yuv2plane1_float(yuv2plane1_float_bswap_c_template, uint32_t, LE)
309
yuv2planeX_float(yuv2planeX_float_c_template,       float,    BE)
310
yuv2planeX_float(yuv2planeX_float_bswap_c_template, uint32_t, LE)
311
#else
312
yuv2plane1_float(yuv2plane1_float_c_template,       float,    LE)
313
yuv2plane1_float(yuv2plane1_float_bswap_c_template, uint32_t, BE)
314
yuv2planeX_float(yuv2planeX_float_c_template,       float,    LE)
315
yuv2planeX_float(yuv2planeX_float_bswap_c_template, uint32_t, BE)
316
#endif
317
318
#undef output_pixel
319
320
#define output_pixel(pos, val) \
321
3.47M
    if (big_endian) { \
322
1.79M
        AV_WB16(pos, av_clip_uintp2(val >> shift, output_bits)); \
323
1.79M
    } else { \
324
1.67M
        AV_WL16(pos, av_clip_uintp2(val >> shift, output_bits)); \
325
1.67M
    }
326
327
static av_always_inline void
328
yuv2plane1_10_c_template(const int16_t *src, uint16_t *dest, int dstW,
329
                         int big_endian, int output_bits)
330
171k
{
331
171k
    int i;
332
171k
    int shift = 15 - output_bits;
333
334
1.92M
    for (i = 0; i < dstW; i++) {
335
1.75M
        int val = src[i] + (1 << (shift - 1));
336
1.75M
        output_pixel(&dest[i], val);
337
1.75M
    }
338
171k
}
339
340
static av_always_inline void
341
yuv2planeX_10_c_template(const int16_t *filter, int filterSize,
342
                         const int16_t **src, uint16_t *dest, int dstW,
343
                         int big_endian, int output_bits)
344
548k
{
345
548k
    int i;
346
548k
    int shift = 11 + 16 - output_bits;
347
348
2.26M
    for (i = 0; i < dstW; i++) {
349
1.72M
        int val = 1 << (shift - 1);
350
1.72M
        int j;
351
352
35.0M
        for (j = 0; j < filterSize; j++)
353
33.3M
            val += src[j][i] * filter[j];
354
355
1.72M
        output_pixel(&dest[i], val);
356
1.72M
    }
357
548k
}
358
359
#undef output_pixel
360
361
#define yuv2NBPS(bits, BE_LE, is_be, template_size, typeX_t) \
362
static void yuv2plane1_ ## bits ## BE_LE ## _c(const int16_t *src, \
363
                              uint8_t *dest, int dstW, \
364
253k
                              const uint8_t *dither, int offset)\
365
253k
{ \
366
253k
    yuv2plane1_ ## template_size ## _c_template((const typeX_t *) src, \
367
253k
                         (uint16_t *) dest, dstW, is_be, bits); \
368
253k
}\
output.c:yuv2plane1_16BE_c
Line
Count
Source
364
27.3k
                              const uint8_t *dither, int offset)\
365
27.3k
{ \
366
27.3k
    yuv2plane1_ ## template_size ## _c_template((const typeX_t *) src, \
367
27.3k
                         (uint16_t *) dest, dstW, is_be, bits); \
368
27.3k
}\
output.c:yuv2plane1_16LE_c
Line
Count
Source
364
54.3k
                              const uint8_t *dither, int offset)\
365
54.3k
{ \
366
54.3k
    yuv2plane1_ ## template_size ## _c_template((const typeX_t *) src, \
367
54.3k
                         (uint16_t *) dest, dstW, is_be, bits); \
368
54.3k
}\
output.c:yuv2plane1_9BE_c
Line
Count
Source
364
38.2k
                              const uint8_t *dither, int offset)\
365
38.2k
{ \
366
38.2k
    yuv2plane1_ ## template_size ## _c_template((const typeX_t *) src, \
367
38.2k
                         (uint16_t *) dest, dstW, is_be, bits); \
368
38.2k
}\
output.c:yuv2plane1_9LE_c
Line
Count
Source
364
30.8k
                              const uint8_t *dither, int offset)\
365
30.8k
{ \
366
30.8k
    yuv2plane1_ ## template_size ## _c_template((const typeX_t *) src, \
367
30.8k
                         (uint16_t *) dest, dstW, is_be, bits); \
368
30.8k
}\
output.c:yuv2plane1_10BE_c
Line
Count
Source
364
3.00k
                              const uint8_t *dither, int offset)\
365
3.00k
{ \
366
3.00k
    yuv2plane1_ ## template_size ## _c_template((const typeX_t *) src, \
367
3.00k
                         (uint16_t *) dest, dstW, is_be, bits); \
368
3.00k
}\
output.c:yuv2plane1_10LE_c
Line
Count
Source
364
4.58k
                              const uint8_t *dither, int offset)\
365
4.58k
{ \
366
4.58k
    yuv2plane1_ ## template_size ## _c_template((const typeX_t *) src, \
367
4.58k
                         (uint16_t *) dest, dstW, is_be, bits); \
368
4.58k
}\
output.c:yuv2plane1_12BE_c
Line
Count
Source
364
1.50k
                              const uint8_t *dither, int offset)\
365
1.50k
{ \
366
1.50k
    yuv2plane1_ ## template_size ## _c_template((const typeX_t *) src, \
367
1.50k
                         (uint16_t *) dest, dstW, is_be, bits); \
368
1.50k
}\
output.c:yuv2plane1_12LE_c
Line
Count
Source
364
21.0k
                              const uint8_t *dither, int offset)\
365
21.0k
{ \
366
21.0k
    yuv2plane1_ ## template_size ## _c_template((const typeX_t *) src, \
367
21.0k
                         (uint16_t *) dest, dstW, is_be, bits); \
368
21.0k
}\
output.c:yuv2plane1_14BE_c
Line
Count
Source
364
2.18k
                              const uint8_t *dither, int offset)\
365
2.18k
{ \
366
2.18k
    yuv2plane1_ ## template_size ## _c_template((const typeX_t *) src, \
367
2.18k
                         (uint16_t *) dest, dstW, is_be, bits); \
368
2.18k
}\
output.c:yuv2plane1_14LE_c
Line
Count
Source
364
69.9k
                              const uint8_t *dither, int offset)\
365
69.9k
{ \
366
69.9k
    yuv2plane1_ ## template_size ## _c_template((const typeX_t *) src, \
367
69.9k
                         (uint16_t *) dest, dstW, is_be, bits); \
368
69.9k
}\
369
static void yuv2planeX_ ## bits ## BE_LE ## _c(const int16_t *filter, int filterSize, \
370
                              const int16_t **src, uint8_t *dest, int dstW, \
371
706k
                              const uint8_t *dither, int offset)\
372
706k
{ \
373
706k
    yuv2planeX_## template_size ## _c_template(filter, \
374
706k
                         filterSize, (const typeX_t **) src, \
375
706k
                         (uint16_t *) dest, dstW, is_be, bits); \
376
706k
}
output.c:yuv2planeX_16BE_c
Line
Count
Source
371
107k
                              const uint8_t *dither, int offset)\
372
107k
{ \
373
107k
    yuv2planeX_## template_size ## _c_template(filter, \
374
107k
                         filterSize, (const typeX_t **) src, \
375
107k
                         (uint16_t *) dest, dstW, is_be, bits); \
376
107k
}
output.c:yuv2planeX_16LE_c
Line
Count
Source
371
50.6k
                              const uint8_t *dither, int offset)\
372
50.6k
{ \
373
50.6k
    yuv2planeX_## template_size ## _c_template(filter, \
374
50.6k
                         filterSize, (const typeX_t **) src, \
375
50.6k
                         (uint16_t *) dest, dstW, is_be, bits); \
376
50.6k
}
output.c:yuv2planeX_9BE_c
Line
Count
Source
371
33.2k
                              const uint8_t *dither, int offset)\
372
33.2k
{ \
373
33.2k
    yuv2planeX_## template_size ## _c_template(filter, \
374
33.2k
                         filterSize, (const typeX_t **) src, \
375
33.2k
                         (uint16_t *) dest, dstW, is_be, bits); \
376
33.2k
}
output.c:yuv2planeX_9LE_c
Line
Count
Source
371
140k
                              const uint8_t *dither, int offset)\
372
140k
{ \
373
140k
    yuv2planeX_## template_size ## _c_template(filter, \
374
140k
                         filterSize, (const typeX_t **) src, \
375
140k
                         (uint16_t *) dest, dstW, is_be, bits); \
376
140k
}
output.c:yuv2planeX_10BE_c
Line
Count
Source
371
98.8k
                              const uint8_t *dither, int offset)\
372
98.8k
{ \
373
98.8k
    yuv2planeX_## template_size ## _c_template(filter, \
374
98.8k
                         filterSize, (const typeX_t **) src, \
375
98.8k
                         (uint16_t *) dest, dstW, is_be, bits); \
376
98.8k
}
output.c:yuv2planeX_10LE_c
Line
Count
Source
371
88.9k
                              const uint8_t *dither, int offset)\
372
88.9k
{ \
373
88.9k
    yuv2planeX_## template_size ## _c_template(filter, \
374
88.9k
                         filterSize, (const typeX_t **) src, \
375
88.9k
                         (uint16_t *) dest, dstW, is_be, bits); \
376
88.9k
}
output.c:yuv2planeX_12BE_c
Line
Count
Source
371
17.7k
                              const uint8_t *dither, int offset)\
372
17.7k
{ \
373
17.7k
    yuv2planeX_## template_size ## _c_template(filter, \
374
17.7k
                         filterSize, (const typeX_t **) src, \
375
17.7k
                         (uint16_t *) dest, dstW, is_be, bits); \
376
17.7k
}
output.c:yuv2planeX_12LE_c
Line
Count
Source
371
64.2k
                              const uint8_t *dither, int offset)\
372
64.2k
{ \
373
64.2k
    yuv2planeX_## template_size ## _c_template(filter, \
374
64.2k
                         filterSize, (const typeX_t **) src, \
375
64.2k
                         (uint16_t *) dest, dstW, is_be, bits); \
376
64.2k
}
output.c:yuv2planeX_14BE_c
Line
Count
Source
371
68.1k
                              const uint8_t *dither, int offset)\
372
68.1k
{ \
373
68.1k
    yuv2planeX_## template_size ## _c_template(filter, \
374
68.1k
                         filterSize, (const typeX_t **) src, \
375
68.1k
                         (uint16_t *) dest, dstW, is_be, bits); \
376
68.1k
}
output.c:yuv2planeX_14LE_c
Line
Count
Source
371
36.7k
                              const uint8_t *dither, int offset)\
372
36.7k
{ \
373
36.7k
    yuv2planeX_## template_size ## _c_template(filter, \
374
36.7k
                         filterSize, (const typeX_t **) src, \
375
36.7k
                         (uint16_t *) dest, dstW, is_be, bits); \
376
36.7k
}
377
378
yuv2NBPS( 9, BE, 1, 10, int16_t)
379
yuv2NBPS( 9, LE, 0, 10, int16_t)
380
yuv2NBPS(10, BE, 1, 10, int16_t)
381
yuv2NBPS(10, LE, 0, 10, int16_t)
382
yuv2NBPS(12, BE, 1, 10, int16_t)
383
yuv2NBPS(12, LE, 0, 10, int16_t)
384
yuv2NBPS(14, BE, 1, 10, int16_t)
385
yuv2NBPS(14, LE, 0, 10, int16_t)
386
yuv2NBPS(16, BE, 1, 16, int32_t)
387
yuv2NBPS(16, LE, 0, 16, int32_t)
388
389
#define output_pixel(pos, val) \
390
1.40M
    if (big_endian) { \
391
788k
        AV_WB16(pos, av_clip_uintp2(val >> shift, output_bits) << (16 - output_bits)); \
392
788k
    } else { \
393
618k
        AV_WL16(pos, av_clip_uintp2(val >> shift, output_bits) << (16 - output_bits)); \
394
618k
    }
395
396
static av_always_inline void
397
yuv2msbplane1_10_c_template(const int16_t *src, uint16_t *dest, int dstW,
398
                            int big_endian, int output_bits)
399
57.0k
{
400
57.0k
    int i;
401
57.0k
    int shift = 15 - output_bits;
402
403
748k
    for (i = 0; i < dstW; i++) {
404
691k
        int val = src[i] + (1 << (shift - 1));
405
691k
        output_pixel(&dest[i], val);
406
691k
    }
407
57.0k
}
408
409
static av_always_inline void
410
yuv2msbplaneX_10_c_template(const int16_t *filter, int filterSize,
411
                            const int16_t **src, uint16_t *dest, int dstW,
412
                            int big_endian, int output_bits)
413
305k
{
414
305k
    int i;
415
305k
    int shift = 11 + 16 - output_bits;
416
417
1.02M
    for (i = 0; i < dstW; i++) {
418
716k
        int val = 1 << (shift - 1);
419
716k
        int j;
420
421
4.93M
        for (j = 0; j < filterSize; j++)
422
4.21M
            val += src[j][i] * filter[j];
423
424
716k
        output_pixel(&dest[i], val);
425
716k
    }
426
305k
}
427
428
#define yuv2MSBNBPS(bits, BE_LE, is_be, template_size, typeX_t) \
429
static void yuv2msbplane1_ ## bits ## BE_LE ## _c(const int16_t *src, \
430
                              uint8_t *dest, int dstW, \
431
57.0k
                              const uint8_t *dither, int offset)\
432
57.0k
{ \
433
57.0k
    yuv2msbplane1_ ## template_size ## _c_template((const typeX_t *) src, \
434
57.0k
                         (uint16_t *) dest, dstW, is_be, bits); \
435
57.0k
}\
output.c:yuv2msbplane1_10BE_c
Line
Count
Source
431
20.9k
                              const uint8_t *dither, int offset)\
432
20.9k
{ \
433
20.9k
    yuv2msbplane1_ ## template_size ## _c_template((const typeX_t *) src, \
434
20.9k
                         (uint16_t *) dest, dstW, is_be, bits); \
435
20.9k
}\
output.c:yuv2msbplane1_10LE_c
Line
Count
Source
431
9.49k
                              const uint8_t *dither, int offset)\
432
9.49k
{ \
433
9.49k
    yuv2msbplane1_ ## template_size ## _c_template((const typeX_t *) src, \
434
9.49k
                         (uint16_t *) dest, dstW, is_be, bits); \
435
9.49k
}\
output.c:yuv2msbplane1_12BE_c
Line
Count
Source
431
1.35k
                              const uint8_t *dither, int offset)\
432
1.35k
{ \
433
1.35k
    yuv2msbplane1_ ## template_size ## _c_template((const typeX_t *) src, \
434
1.35k
                         (uint16_t *) dest, dstW, is_be, bits); \
435
1.35k
}\
output.c:yuv2msbplane1_12LE_c
Line
Count
Source
431
25.3k
                              const uint8_t *dither, int offset)\
432
25.3k
{ \
433
25.3k
    yuv2msbplane1_ ## template_size ## _c_template((const typeX_t *) src, \
434
25.3k
                         (uint16_t *) dest, dstW, is_be, bits); \
435
25.3k
}\
436
static void yuv2msbplaneX_ ## bits ## BE_LE ## _c(const int16_t *filter, int filterSize, \
437
                              const int16_t **src, uint8_t *dest, int dstW, \
438
305k
                              const uint8_t *dither, int offset)\
439
305k
{ \
440
305k
    yuv2msbplaneX_## template_size ## _c_template(filter, \
441
305k
                         filterSize, (const typeX_t **) src, \
442
305k
                         (uint16_t *) dest, dstW, is_be, bits); \
443
305k
}
output.c:yuv2msbplaneX_10BE_c
Line
Count
Source
438
89.3k
                              const uint8_t *dither, int offset)\
439
89.3k
{ \
440
89.3k
    yuv2msbplaneX_## template_size ## _c_template(filter, \
441
89.3k
                         filterSize, (const typeX_t **) src, \
442
89.3k
                         (uint16_t *) dest, dstW, is_be, bits); \
443
89.3k
}
output.c:yuv2msbplaneX_10LE_c
Line
Count
Source
438
51.6k
                              const uint8_t *dither, int offset)\
439
51.6k
{ \
440
51.6k
    yuv2msbplaneX_## template_size ## _c_template(filter, \
441
51.6k
                         filterSize, (const typeX_t **) src, \
442
51.6k
                         (uint16_t *) dest, dstW, is_be, bits); \
443
51.6k
}
output.c:yuv2msbplaneX_12BE_c
Line
Count
Source
438
101k
                              const uint8_t *dither, int offset)\
439
101k
{ \
440
101k
    yuv2msbplaneX_## template_size ## _c_template(filter, \
441
101k
                         filterSize, (const typeX_t **) src, \
442
101k
                         (uint16_t *) dest, dstW, is_be, bits); \
443
101k
}
output.c:yuv2msbplaneX_12LE_c
Line
Count
Source
438
63.5k
                              const uint8_t *dither, int offset)\
439
63.5k
{ \
440
63.5k
    yuv2msbplaneX_## template_size ## _c_template(filter, \
441
63.5k
                         filterSize, (const typeX_t **) src, \
442
63.5k
                         (uint16_t *) dest, dstW, is_be, bits); \
443
63.5k
}
444
445
yuv2MSBNBPS(10, BE, 1, 10, int16_t)
446
yuv2MSBNBPS(10, LE, 0, 10, int16_t)
447
yuv2MSBNBPS(12, BE, 1, 10, int16_t)
448
yuv2MSBNBPS(12, LE, 0, 10, int16_t)
449
450
#undef output_pixel
451
452
static void yuv2nv12cX_16LE_c(enum AVPixelFormat dstFormat, const uint8_t *chrDither,
453
                              const int16_t *chrFilter, int chrFilterSize,
454
                              const int16_t **chrUSrc, const int16_t **chrVSrc,
455
                              uint8_t *dest8, int chrDstW)
456
30.4k
{
457
30.4k
    yuv2nv12cX_16_c_template(0, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, dest8, chrDstW, 16);
458
30.4k
}
459
460
static void yuv2nv12cX_16BE_c(enum AVPixelFormat dstFormat, const uint8_t *chrDither,
461
                              const int16_t *chrFilter, int chrFilterSize,
462
                              const int16_t **chrUSrc, const int16_t **chrVSrc,
463
                              uint8_t *dest8, int chrDstW)
464
35.0k
{
465
35.0k
    yuv2nv12cX_16_c_template(1, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, dest8, chrDstW, 16);
466
35.0k
}
467
468
static void yuv2planeX_8_c(const int16_t *filter, int filterSize,
469
                           const int16_t **src, uint8_t *dest, int dstW,
470
                           const uint8_t *dither, int offset)
471
897k
{
472
897k
    int i;
473
3.41M
    for (i=0; i<dstW; i++) {
474
2.52M
        int val = dither[(i + offset) & 7] << 12;
475
2.52M
        int j;
476
111M
        for (j=0; j<filterSize; j++) {
477
109M
            val += (unsigned)(src[j][i] * filter[j]);
478
479
109M
        }
480
481
2.52M
        dest[i]= av_clip_uint8(val>>19);
482
2.52M
    }
483
897k
}
484
485
static void yuv2plane1_8_c(const int16_t *src, uint8_t *dest, int dstW,
486
                           const uint8_t *dither, int offset)
487
124k
{
488
124k
    int i;
489
3.12M
    for (i=0; i<dstW; i++) {
490
2.99M
        int val = (src[i] + dither[(i + offset) & 7]) >> 7;
491
2.99M
        dest[i]= av_clip_uint8(val);
492
2.99M
    }
493
124k
}
494
495
static void yuv2nv12cX_c(enum AVPixelFormat dstFormat, const uint8_t *chrDither,
496
                         const int16_t *chrFilter, int chrFilterSize,
497
                         const int16_t **chrUSrc, const int16_t **chrVSrc,
498
                         uint8_t *dest, int chrDstW)
499
21.8k
{
500
21.8k
    int i;
501
502
21.8k
    if (!isSwappedChroma(dstFormat))
503
81.1k
        for (i=0; i<chrDstW; i++) {
504
67.1k
            int u = chrDither[i & 7] << 12;
505
67.1k
            int v = chrDither[(i + 3) & 7] << 12;
506
67.1k
            int j;
507
1.80M
            for (j=0; j<chrFilterSize; j++) {
508
1.73M
                u += chrUSrc[j][i] * (unsigned)chrFilter[j];
509
1.73M
                v += chrVSrc[j][i] * (unsigned)chrFilter[j];
510
1.73M
            }
511
512
67.1k
            dest[2*i]= av_clip_uint8(u>>19);
513
67.1k
            dest[2*i+1]= av_clip_uint8(v>>19);
514
67.1k
        }
515
7.87k
    else
516
53.0k
        for (i=0; i<chrDstW; i++) {
517
45.1k
            int u = chrDither[i & 7] << 12;
518
45.1k
            int v = chrDither[(i + 3) & 7] << 12;
519
45.1k
            int j;
520
187k
            for (j=0; j<chrFilterSize; j++) {
521
142k
                u += chrUSrc[j][i] * (unsigned)chrFilter[j];
522
142k
                v += chrVSrc[j][i] * (unsigned)chrFilter[j];
523
142k
            }
524
525
45.1k
            dest[2*i]= av_clip_uint8(v>>19);
526
45.1k
            dest[2*i+1]= av_clip_uint8(u>>19);
527
45.1k
        }
528
21.8k
}
529
530
531
#define output_pixel(pos, val) \
532
3.32M
    if (big_endian) { \
533
1.51M
        AV_WB16(pos, av_clip_uintp2(val >> shift, output_bits) << output_shift); \
534
1.81M
    } else { \
535
1.81M
        AV_WL16(pos, av_clip_uintp2(val >> shift, output_bits) << output_shift); \
536
1.81M
    }
537
538
static void yuv2p01xl1_c(const int16_t *src,
539
                         uint16_t *dest, int dstW,
540
                         int big_endian, int output_bits, int output_shift)
541
72.3k
{
542
72.3k
    int i;
543
72.3k
    int shift = 15 - output_bits;
544
545
839k
    for (i = 0; i < dstW; i++) {
546
766k
        int val = src[i] + (1 << (shift - 1));
547
766k
        output_pixel(&dest[i], val);
548
766k
    }
549
72.3k
}
550
551
static void yuv2p01xlX_c(const int16_t *filter, int filterSize,
552
                         const int16_t **src, uint16_t *dest, int dstW,
553
                         int big_endian, int output_bits, int output_shift)
554
218k
{
555
218k
    int i, j;
556
218k
    int shift = 11 + 16 - output_bits;
557
558
920k
    for (i = 0; i < dstW; i++) {
559
701k
        int val = 1 << (shift - 1);
560
561
12.8M
        for (j = 0; j < filterSize; j++)
562
12.1M
            val += src[j][i] * filter[j];
563
564
701k
        output_pixel(&dest[i], val);
565
701k
    }
566
218k
}
567
568
static void yuv2p01xcX_c(int big_endian, const uint8_t *chrDither,
569
                         const int16_t *chrFilter, int chrFilterSize,
570
                         const int16_t **chrUSrc, const int16_t **chrVSrc,
571
                         uint8_t *dest8, int chrDstW, int output_bits, int output_shift)
572
268k
{
573
268k
    uint16_t *dest = (uint16_t*)dest8;
574
268k
    int i, j;
575
268k
    int shift = 11 + 16 - output_bits;
576
577
1.19M
    for (i = 0; i < chrDstW; i++) {
578
928k
        int u = 1 << (shift - 1);
579
928k
        int v = 1 << (shift - 1);
580
581
6.38M
        for (j = 0; j < chrFilterSize; j++) {
582
5.45M
            u += chrUSrc[j][i] * (unsigned)chrFilter[j];
583
5.45M
            v += chrVSrc[j][i] * (unsigned)chrFilter[j];
584
5.45M
        }
585
586
928k
        output_pixel(&dest[2*i]  , u);
587
928k
        output_pixel(&dest[2*i+1], v);
588
928k
    }
589
268k
}
590
591
#undef output_pixel
592
593
#define yuv2p01x_wrapper(fmt, bits, shift)                                     \
594
    static void yuv2 ## fmt ## l1_LE_c(const int16_t *src,                     \
595
                                          uint8_t *dest, int dstW,             \
596
                                          const uint8_t *dither, int offset)   \
597
33.5k
    {                                                                          \
598
33.5k
        yuv2p01xl1_c(src, (uint16_t*)dest, dstW, 0, bits, shift);              \
599
33.5k
    }                                                                          \
output.c:yuv2p010l1_LE_c
Line
Count
Source
597
13.8k
    {                                                                          \
598
13.8k
        yuv2p01xl1_c(src, (uint16_t*)dest, dstW, 0, bits, shift);              \
599
13.8k
    }                                                                          \
output.c:yuv2p012l1_LE_c
Line
Count
Source
597
8.34k
    {                                                                          \
598
8.34k
        yuv2p01xl1_c(src, (uint16_t*)dest, dstW, 0, bits, shift);              \
599
8.34k
    }                                                                          \
output.c:yuv2nv20l1_LE_c
Line
Count
Source
597
11.3k
    {                                                                          \
598
11.3k
        yuv2p01xl1_c(src, (uint16_t*)dest, dstW, 0, bits, shift);              \
599
11.3k
    }                                                                          \
600
                                                                               \
601
    static void yuv2 ## fmt ## l1_BE_c(const int16_t *src,                     \
602
                                          uint8_t *dest, int dstW,             \
603
                                          const uint8_t *dither, int offset)   \
604
38.7k
    {                                                                          \
605
38.7k
        yuv2p01xl1_c(src, (uint16_t*)dest, dstW, 1, bits, shift);              \
606
38.7k
    }                                                                          \
output.c:yuv2p010l1_BE_c
Line
Count
Source
604
21.4k
    {                                                                          \
605
21.4k
        yuv2p01xl1_c(src, (uint16_t*)dest, dstW, 1, bits, shift);              \
606
21.4k
    }                                                                          \
output.c:yuv2p012l1_BE_c
Line
Count
Source
604
3.64k
    {                                                                          \
605
3.64k
        yuv2p01xl1_c(src, (uint16_t*)dest, dstW, 1, bits, shift);              \
606
3.64k
    }                                                                          \
output.c:yuv2nv20l1_BE_c
Line
Count
Source
604
13.6k
    {                                                                          \
605
13.6k
        yuv2p01xl1_c(src, (uint16_t*)dest, dstW, 1, bits, shift);              \
606
13.6k
    }                                                                          \
607
                                                                               \
608
    static void yuv2 ## fmt ## lX_LE_c(const int16_t *filter,                  \
609
                                          int filterSize, const int16_t **src, \
610
                                          uint8_t *dest, int dstW,             \
611
                                          const uint8_t *dither, int offset)   \
612
107k
    {                                                                          \
613
107k
        yuv2p01xlX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 0,        \
614
107k
                     bits, shift);                                             \
615
107k
    }                                                                          \
output.c:yuv2p010lX_LE_c
Line
Count
Source
612
5.94k
    {                                                                          \
613
5.94k
        yuv2p01xlX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 0,        \
614
5.94k
                     bits, shift);                                             \
615
5.94k
    }                                                                          \
output.c:yuv2p012lX_LE_c
Line
Count
Source
612
50.4k
    {                                                                          \
613
50.4k
        yuv2p01xlX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 0,        \
614
50.4k
                     bits, shift);                                             \
615
50.4k
    }                                                                          \
output.c:yuv2nv20lX_LE_c
Line
Count
Source
612
51.2k
    {                                                                          \
613
51.2k
        yuv2p01xlX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 0,        \
614
51.2k
                     bits, shift);                                             \
615
51.2k
    }                                                                          \
616
                                                                               \
617
    static void yuv2 ## fmt ## lX_BE_c(const int16_t *filter,                  \
618
                                          int filterSize, const int16_t **src, \
619
                                          uint8_t *dest, int dstW,             \
620
                                          const uint8_t *dither, int offset)   \
621
111k
    {                                                                          \
622
111k
        yuv2p01xlX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 1,        \
623
111k
                     bits, shift);                                             \
624
111k
    }                                                                          \
output.c:yuv2p010lX_BE_c
Line
Count
Source
621
36.7k
    {                                                                          \
622
36.7k
        yuv2p01xlX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 1,        \
623
36.7k
                     bits, shift);                                             \
624
36.7k
    }                                                                          \
output.c:yuv2p012lX_BE_c
Line
Count
Source
621
53.5k
    {                                                                          \
622
53.5k
        yuv2p01xlX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 1,        \
623
53.5k
                     bits, shift);                                             \
624
53.5k
    }                                                                          \
output.c:yuv2nv20lX_BE_c
Line
Count
Source
621
20.9k
    {                                                                          \
622
20.9k
        yuv2p01xlX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 1,        \
623
20.9k
                     bits, shift);                                             \
624
20.9k
    }                                                                          \
625
                                                                               \
626
    static void yuv2 ## fmt ## cX_LE_c(enum AVPixelFormat dstFormat,           \
627
                                          const uint8_t *chrDither,            \
628
                                          const int16_t *chrFilter,            \
629
                                          int chrFilterSize,                   \
630
                                          const int16_t **chrUSrc,             \
631
                                          const int16_t **chrVSrc,             \
632
                                          uint8_t *dest8, int chrDstW)         \
633
131k
    {                                                                          \
634
131k
        yuv2p01xcX_c(0, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, \
635
131k
                     dest8, chrDstW, bits, shift);                             \
636
131k
    }                                                                          \
output.c:yuv2p010cX_LE_c
Line
Count
Source
633
18.8k
    {                                                                          \
634
18.8k
        yuv2p01xcX_c(0, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, \
635
18.8k
                     dest8, chrDstW, bits, shift);                             \
636
18.8k
    }                                                                          \
output.c:yuv2p012cX_LE_c
Line
Count
Source
633
49.8k
    {                                                                          \
634
49.8k
        yuv2p01xcX_c(0, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, \
635
49.8k
                     dest8, chrDstW, bits, shift);                             \
636
49.8k
    }                                                                          \
output.c:yuv2nv20cX_LE_c
Line
Count
Source
633
62.6k
    {                                                                          \
634
62.6k
        yuv2p01xcX_c(0, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, \
635
62.6k
                     dest8, chrDstW, bits, shift);                             \
636
62.6k
    }                                                                          \
637
                                                                               \
638
    static void yuv2 ## fmt ## cX_BE_c(enum AVPixelFormat dstFormat,           \
639
                                          const uint8_t *chrDither,            \
640
                                          const int16_t *chrFilter,            \
641
                                          int chrFilterSize,                   \
642
                                          const int16_t **chrUSrc,             \
643
                                          const int16_t **chrVSrc,             \
644
                                          uint8_t *dest8, int chrDstW)         \
645
137k
    {                                                                          \
646
137k
        yuv2p01xcX_c(1, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, \
647
137k
                     dest8, chrDstW, bits, shift);                             \
648
137k
    }
output.c:yuv2p010cX_BE_c
Line
Count
Source
645
51.8k
    {                                                                          \
646
51.8k
        yuv2p01xcX_c(1, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, \
647
51.8k
                     dest8, chrDstW, bits, shift);                             \
648
51.8k
    }
output.c:yuv2p012cX_BE_c
Line
Count
Source
645
50.9k
    {                                                                          \
646
50.9k
        yuv2p01xcX_c(1, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, \
647
50.9k
                     dest8, chrDstW, bits, shift);                             \
648
50.9k
    }
output.c:yuv2nv20cX_BE_c
Line
Count
Source
645
34.6k
    {                                                                          \
646
34.6k
        yuv2p01xcX_c(1, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, \
647
34.6k
                     dest8, chrDstW, bits, shift);                             \
648
34.6k
    }
649
650
yuv2p01x_wrapper(p010, 10, 6)
651
yuv2p01x_wrapper(p012, 12, 4)
652
yuv2p01x_wrapper(nv20, 10, 0)
653
654
#define accumulate_bit(acc, val) \
655
559k
    acc <<= 1; \
656
559k
    acc |= (val) >= 234
657
#define output_pixel(pos, acc) \
658
98.8k
    if (target == AV_PIX_FMT_MONOBLACK) { \
659
50.3k
        pos = acc; \
660
50.3k
    } else { \
661
48.4k
        pos = ~acc; \
662
48.4k
    }
663
664
static av_always_inline void
665
yuv2mono_X_c_template(SwsInternal *c, const int16_t *lumFilter,
666
                      const int16_t **lumSrc, int lumFilterSize,
667
                      const int16_t *chrFilter, const int16_t **chrUSrc,
668
                      const int16_t **chrVSrc, int chrFilterSize,
669
                      const int16_t **alpSrc, uint8_t *dest, int dstW,
670
                      int y, enum AVPixelFormat target)
671
17.0k
{
672
17.0k
    const uint8_t * const d128 = ff_dither_8x8_220[y&7];
673
17.0k
    int i;
674
17.0k
    unsigned acc = 0;
675
17.0k
    int err = 0;
676
677
121k
    for (i = 0; i < dstW; i += 2) {
678
104k
        int j;
679
104k
        int Y1 = 1 << 18;
680
104k
        int Y2 = 1 << 18;
681
682
3.61M
        for (j = 0; j < lumFilterSize; j++) {
683
3.50M
            Y1 += lumSrc[j][i]   * (unsigned)lumFilter[j];
684
3.50M
            Y2 += lumSrc[j][i+1] * (unsigned)lumFilter[j];
685
3.50M
        }
686
104k
        Y1 >>= 19;
687
104k
        Y2 >>= 19;
688
104k
        if ((Y1 | Y2) & 0x100) {
689
25.7k
            Y1 = av_clip_uint8(Y1);
690
25.7k
            Y2 = av_clip_uint8(Y2);
691
25.7k
        }
692
104k
        if (c->opts.dither == SWS_DITHER_ED) {
693
51.3k
            Y1 += (7*err + 1*c->dither_error[0][i] + 5*c->dither_error[0][i+1] + 3*c->dither_error[0][i+2] + 8 - 256)>>4;
694
51.3k
            c->dither_error[0][i] = err;
695
51.3k
            acc = 2*acc + (Y1 >= 128);
696
51.3k
            Y1 -= 220*(acc&1);
697
698
51.3k
            err = Y2 + ((7*Y1 + 1*c->dither_error[0][i+1] + 5*c->dither_error[0][i+2] + 3*c->dither_error[0][i+3] + 8 - 256)>>4);
699
51.3k
            c->dither_error[0][i+1] = Y1;
700
51.3k
            acc = 2*acc + (err >= 128);
701
51.3k
            err -= 220*(acc&1);
702
53.5k
        } else {
703
53.5k
            accumulate_bit(acc, Y1 + d128[(i + 0) & 7]);
704
53.5k
            accumulate_bit(acc, Y2 + d128[(i + 1) & 7]);
705
53.5k
        }
706
104k
        if ((i & 7) == 6) {
707
22.4k
            output_pixel(*dest++, acc);
708
22.4k
        }
709
104k
    }
710
17.0k
    c->dither_error[0][i] = err;
711
712
17.0k
    if (i & 6) {
713
11.0k
        output_pixel(*dest, acc);
714
11.0k
    }
715
17.0k
}
716
717
static av_always_inline void
718
yuv2mono_2_c_template(SwsInternal *c, const int16_t *buf[2],
719
                      const int16_t *ubuf[2], const int16_t *vbuf[2],
720
                      const int16_t *abuf[2], uint8_t *dest, int dstW,
721
                      int yalpha, int uvalpha, int y,
722
                      enum AVPixelFormat target)
723
9.03k
{
724
9.03k
    const int16_t *buf0  = buf[0],  *buf1  = buf[1];
725
9.03k
    const uint8_t * const d128 = ff_dither_8x8_220[y & 7];
726
9.03k
    int  yalpha1 = 4096 - yalpha;
727
9.03k
    int i;
728
9.03k
    av_assert2(yalpha  <= 4096U);
729
730
9.03k
    if (c->opts.dither == SWS_DITHER_ED) {
731
3.57k
        int err = 0;
732
3.57k
        unsigned acc = 0;
733
25.0k
        for (i = 0; i < dstW; i +=2) {
734
21.4k
            int Y;
735
736
21.4k
            Y = (buf0[i + 0] * yalpha1 + buf1[i + 0] * yalpha) >> 19;
737
21.4k
            Y += (7*err + 1*c->dither_error[0][i] + 5*c->dither_error[0][i+1] + 3*c->dither_error[0][i+2] + 8 - 256)>>4;
738
21.4k
            c->dither_error[0][i] = err;
739
21.4k
            acc = 2*acc + (Y >= 128);
740
21.4k
            Y -= 220*(acc&1);
741
742
21.4k
            err = (buf0[i + 1] * yalpha1 + buf1[i + 1] * yalpha) >> 19;
743
21.4k
            err += (7*Y + 1*c->dither_error[0][i+1] + 5*c->dither_error[0][i+2] + 3*c->dither_error[0][i+3] + 8 - 256)>>4;
744
21.4k
            c->dither_error[0][i+1] = Y;
745
21.4k
            acc = 2*acc + (err >= 128);
746
21.4k
            err -= 220*(acc&1);
747
748
21.4k
            if ((i & 7) == 6)
749
4.00k
                output_pixel(*dest++, acc);
750
21.4k
        }
751
3.57k
        c->dither_error[0][i] = err;
752
5.45k
    } else {
753
27.1k
        for (i = 0; i < dstW; i += 8) {
754
21.7k
            int Y;
755
21.7k
            unsigned acc = 0;
756
757
21.7k
            Y = (buf0[i + 0] * yalpha1 + buf1[i + 0] * yalpha) >> 19;
758
21.7k
            accumulate_bit(acc, Y + d128[0]);
759
21.7k
            Y = (buf0[i + 1] * yalpha1 + buf1[i + 1] * yalpha) >> 19;
760
21.7k
            accumulate_bit(acc, Y + d128[1]);
761
21.7k
            Y = (buf0[i + 2] * yalpha1 + buf1[i + 2] * yalpha) >> 19;
762
21.7k
            accumulate_bit(acc, Y + d128[2]);
763
21.7k
            Y = (buf0[i + 3] * yalpha1 + buf1[i + 3] * yalpha) >> 19;
764
21.7k
            accumulate_bit(acc, Y + d128[3]);
765
21.7k
            Y = (buf0[i + 4] * yalpha1 + buf1[i + 4] * yalpha) >> 19;
766
21.7k
            accumulate_bit(acc, Y + d128[4]);
767
21.7k
            Y = (buf0[i + 5] * yalpha1 + buf1[i + 5] * yalpha) >> 19;
768
21.7k
            accumulate_bit(acc, Y + d128[5]);
769
21.7k
            Y = (buf0[i + 6] * yalpha1 + buf1[i + 6] * yalpha) >> 19;
770
21.7k
            accumulate_bit(acc, Y + d128[6]);
771
21.7k
            Y = (buf0[i + 7] * yalpha1 + buf1[i + 7] * yalpha) >> 19;
772
21.7k
            accumulate_bit(acc, Y + d128[7]);
773
774
21.7k
            output_pixel(*dest++, acc);
775
21.7k
        }
776
5.45k
    }
777
9.03k
}
778
779
static av_always_inline void
780
yuv2mono_1_c_template(SwsInternal *c, const int16_t *buf0,
781
                      const int16_t *ubuf[2], const int16_t *vbuf[2],
782
                      const int16_t *abuf0, uint8_t *dest, int dstW,
783
                      int uvalpha, int y, enum AVPixelFormat target)
784
12.7k
{
785
12.7k
    const uint8_t * const d128 = ff_dither_8x8_220[y & 7];
786
12.7k
    int i;
787
788
12.7k
    if (c->opts.dither == SWS_DITHER_ED) {
789
4.72k
        int err = 0;
790
4.72k
        unsigned acc = 0;
791
33.3k
        for (i = 0; i < dstW; i +=2) {
792
28.6k
            int Y;
793
794
28.6k
            Y = ((buf0[i + 0] + 64) >> 7);
795
28.6k
            Y += (7*err + 1*c->dither_error[0][i] + 5*c->dither_error[0][i+1] + 3*c->dither_error[0][i+2] + 8 - 256)>>4;
796
28.6k
            c->dither_error[0][i] = err;
797
28.6k
            acc = 2*acc + (Y >= 128);
798
28.6k
            Y -= 220*(acc&1);
799
800
28.6k
            err = ((buf0[i + 1] + 64) >> 7);
801
28.6k
            err += (7*Y + 1*c->dither_error[0][i+1] + 5*c->dither_error[0][i+2] + 3*c->dither_error[0][i+3] + 8 - 256)>>4;
802
28.6k
            c->dither_error[0][i+1] = Y;
803
28.6k
            acc = 2*acc + (err >= 128);
804
28.6k
            err -= 220*(acc&1);
805
806
28.6k
            if ((i & 7) == 6)
807
4.85k
                output_pixel(*dest++, acc);
808
28.6k
        }
809
4.72k
        c->dither_error[0][i] = err;
810
8.02k
    } else {
811
42.8k
        for (i = 0; i < dstW; i += 8) {
812
34.8k
            unsigned acc = 0;
813
34.8k
            accumulate_bit(acc, ((buf0[i + 0] + 64) >> 7) + d128[0]);
814
34.8k
            accumulate_bit(acc, ((buf0[i + 1] + 64) >> 7) + d128[1]);
815
34.8k
            accumulate_bit(acc, ((buf0[i + 2] + 64) >> 7) + d128[2]);
816
34.8k
            accumulate_bit(acc, ((buf0[i + 3] + 64) >> 7) + d128[3]);
817
34.8k
            accumulate_bit(acc, ((buf0[i + 4] + 64) >> 7) + d128[4]);
818
34.8k
            accumulate_bit(acc, ((buf0[i + 5] + 64) >> 7) + d128[5]);
819
34.8k
            accumulate_bit(acc, ((buf0[i + 6] + 64) >> 7) + d128[6]);
820
34.8k
            accumulate_bit(acc, ((buf0[i + 7] + 64) >> 7) + d128[7]);
821
822
34.8k
            output_pixel(*dest++, acc);
823
34.8k
        }
824
8.02k
    }
825
12.7k
}
826
827
#undef output_pixel
828
#undef accumulate_bit
829
830
#define YUV2PACKEDWRAPPER(name, base, ext, fmt) \
831
static void name ## ext ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
832
                                const int16_t **lumSrc, int lumFilterSize, \
833
                                const int16_t *chrFilter, const int16_t **chrUSrc, \
834
                                const int16_t **chrVSrc, int chrFilterSize, \
835
                                const int16_t **alpSrc, uint8_t *dest, int dstW, \
836
164k
                                int y) \
837
164k
{ \
838
164k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
839
164k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
840
164k
                                  alpSrc, dest, dstW, y, fmt); \
841
164k
} \
output.c:yuv2monowhite_X_c
Line
Count
Source
836
3.06k
                                int y) \
837
3.06k
{ \
838
3.06k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
839
3.06k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
840
3.06k
                                  alpSrc, dest, dstW, y, fmt); \
841
3.06k
} \
output.c:yuv2monoblack_X_c
Line
Count
Source
836
13.9k
                                int y) \
837
13.9k
{ \
838
13.9k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
839
13.9k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
840
13.9k
                                  alpSrc, dest, dstW, y, fmt); \
841
13.9k
} \
output.c:yuv2yuyv422_X_c
Line
Count
Source
836
32.3k
                                int y) \
837
32.3k
{ \
838
32.3k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
839
32.3k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
840
32.3k
                                  alpSrc, dest, dstW, y, fmt); \
841
32.3k
} \
output.c:yuv2yvyu422_X_c
Line
Count
Source
836
62.3k
                                int y) \
837
62.3k
{ \
838
62.3k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
839
62.3k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
840
62.3k
                                  alpSrc, dest, dstW, y, fmt); \
841
62.3k
} \
output.c:yuv2uyvy422_X_c
Line
Count
Source
836
52.8k
                                int y) \
837
52.8k
{ \
838
52.8k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
839
52.8k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
840
52.8k
                                  alpSrc, dest, dstW, y, fmt); \
841
52.8k
} \
842
 \
843
static void name ## ext ## _2_c(SwsInternal *c, const int16_t *buf[2], \
844
                                const int16_t *ubuf[2], const int16_t *vbuf[2], \
845
                                const int16_t *abuf[2], uint8_t *dest, int dstW, \
846
33.9k
                                int yalpha, int uvalpha, int y) \
847
33.9k
{ \
848
33.9k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
849
33.9k
                                  dest, dstW, yalpha, uvalpha, y, fmt); \
850
33.9k
} \
output.c:yuv2monowhite_2_c
Line
Count
Source
846
7.78k
                                int yalpha, int uvalpha, int y) \
847
7.78k
{ \
848
7.78k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
849
7.78k
                                  dest, dstW, yalpha, uvalpha, y, fmt); \
850
7.78k
} \
output.c:yuv2monoblack_2_c
Line
Count
Source
846
1.24k
                                int yalpha, int uvalpha, int y) \
847
1.24k
{ \
848
1.24k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
849
1.24k
                                  dest, dstW, yalpha, uvalpha, y, fmt); \
850
1.24k
} \
output.c:yuv2yuyv422_2_c
Line
Count
Source
846
6.12k
                                int yalpha, int uvalpha, int y) \
847
6.12k
{ \
848
6.12k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
849
6.12k
                                  dest, dstW, yalpha, uvalpha, y, fmt); \
850
6.12k
} \
output.c:yuv2yvyu422_2_c
Line
Count
Source
846
15.8k
                                int yalpha, int uvalpha, int y) \
847
15.8k
{ \
848
15.8k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
849
15.8k
                                  dest, dstW, yalpha, uvalpha, y, fmt); \
850
15.8k
} \
output.c:yuv2uyvy422_2_c
Line
Count
Source
846
2.96k
                                int yalpha, int uvalpha, int y) \
847
2.96k
{ \
848
2.96k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
849
2.96k
                                  dest, dstW, yalpha, uvalpha, y, fmt); \
850
2.96k
} \
851
 \
852
static void name ## ext ## _1_c(SwsInternal *c, const int16_t *buf0, \
853
                                const int16_t *ubuf[2], const int16_t *vbuf[2], \
854
                                const int16_t *abuf0, uint8_t *dest, int dstW, \
855
45.7k
                                int uvalpha, int y) \
856
45.7k
{ \
857
45.7k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, \
858
45.7k
                                  abuf0, dest, dstW, uvalpha, \
859
45.7k
                                  y, fmt); \
860
45.7k
}
output.c:yuv2monowhite_1_c
Line
Count
Source
855
5.15k
                                int uvalpha, int y) \
856
5.15k
{ \
857
5.15k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, \
858
5.15k
                                  abuf0, dest, dstW, uvalpha, \
859
5.15k
                                  y, fmt); \
860
5.15k
}
output.c:yuv2monoblack_1_c
Line
Count
Source
855
7.59k
                                int uvalpha, int y) \
856
7.59k
{ \
857
7.59k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, \
858
7.59k
                                  abuf0, dest, dstW, uvalpha, \
859
7.59k
                                  y, fmt); \
860
7.59k
}
output.c:yuv2yuyv422_1_c
Line
Count
Source
855
9.79k
                                int uvalpha, int y) \
856
9.79k
{ \
857
9.79k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, \
858
9.79k
                                  abuf0, dest, dstW, uvalpha, \
859
9.79k
                                  y, fmt); \
860
9.79k
}
output.c:yuv2yvyu422_1_c
Line
Count
Source
855
17.5k
                                int uvalpha, int y) \
856
17.5k
{ \
857
17.5k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, \
858
17.5k
                                  abuf0, dest, dstW, uvalpha, \
859
17.5k
                                  y, fmt); \
860
17.5k
}
output.c:yuv2uyvy422_1_c
Line
Count
Source
855
5.70k
                                int uvalpha, int y) \
856
5.70k
{ \
857
5.70k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, \
858
5.70k
                                  abuf0, dest, dstW, uvalpha, \
859
5.70k
                                  y, fmt); \
860
5.70k
}
861
862
YUV2PACKEDWRAPPER(yuv2mono,, white, AV_PIX_FMT_MONOWHITE)
863
YUV2PACKEDWRAPPER(yuv2mono,, black, AV_PIX_FMT_MONOBLACK)
864
865
#define output_pixels(pos, Y1, U, Y2, V) \
866
1.17M
    if (target == AV_PIX_FMT_YUYV422) { \
867
369k
        dest[pos + 0] = Y1; \
868
369k
        dest[pos + 1] = U;  \
869
369k
        dest[pos + 2] = Y2; \
870
369k
        dest[pos + 3] = V;  \
871
808k
    } else if (target == AV_PIX_FMT_YVYU422) { \
872
384k
        dest[pos + 0] = Y1; \
873
384k
        dest[pos + 1] = V;  \
874
384k
        dest[pos + 2] = Y2; \
875
384k
        dest[pos + 3] = U;  \
876
423k
    } else { /* AV_PIX_FMT_UYVY422 */ \
877
423k
        dest[pos + 0] = U;  \
878
423k
        dest[pos + 1] = Y1; \
879
423k
        dest[pos + 2] = V;  \
880
423k
        dest[pos + 3] = Y2; \
881
423k
    }
882
883
static av_always_inline void
884
yuv2422_X_c_template(SwsInternal *c, const int16_t *lumFilter,
885
                     const int16_t **lumSrc, int lumFilterSize,
886
                     const int16_t *chrFilter, const int16_t **chrUSrc,
887
                     const int16_t **chrVSrc, int chrFilterSize,
888
                     const int16_t **alpSrc, uint8_t *dest, int dstW,
889
                     int y, enum AVPixelFormat target)
890
147k
{
891
147k
    int i;
892
893
543k
    for (i = 0; i < ((dstW + 1) >> 1); i++) {
894
395k
        int j;
895
395k
        int Y1 = 1 << 18;
896
395k
        int Y2 = 1 << 18;
897
395k
        int U  = 1 << 18;
898
395k
        int V  = 1 << 18;
899
900
10.1M
        for (j = 0; j < lumFilterSize; j++) {
901
9.75M
            Y1 += lumSrc[j][i * 2]     * (unsigned)lumFilter[j];
902
9.75M
            Y2 += lumSrc[j][i * 2 + 1] * (unsigned)lumFilter[j];
903
9.75M
        }
904
7.40M
        for (j = 0; j < chrFilterSize; j++) {
905
7.00M
            U += chrUSrc[j][i] * (unsigned)chrFilter[j];
906
7.00M
            V += chrVSrc[j][i] * (unsigned)chrFilter[j];
907
7.00M
        }
908
395k
        Y1 >>= 19;
909
395k
        Y2 >>= 19;
910
395k
        U  >>= 19;
911
395k
        V  >>= 19;
912
395k
        if ((Y1 | Y2 | U | V) & 0x100) {
913
35.3k
            Y1 = av_clip_uint8(Y1);
914
35.3k
            Y2 = av_clip_uint8(Y2);
915
35.3k
            U  = av_clip_uint8(U);
916
35.3k
            V  = av_clip_uint8(V);
917
35.3k
        }
918
395k
        output_pixels(4*i, Y1, U, Y2, V);
919
395k
    }
920
147k
}
921
922
static av_always_inline void
923
yuv2422_2_c_template(SwsInternal *c, const int16_t *buf[2],
924
                     const int16_t *ubuf[2], const int16_t *vbuf[2],
925
                     const int16_t *abuf[2], uint8_t *dest, int dstW,
926
                     int yalpha, int uvalpha, int y,
927
                     enum AVPixelFormat target)
928
24.9k
{
929
24.9k
    const int16_t *buf0  = buf[0],  *buf1  = buf[1],
930
24.9k
                  *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
931
24.9k
                  *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];
932
24.9k
    int  yalpha1 = 4096 - yalpha;
933
24.9k
    int uvalpha1 = 4096 - uvalpha;
934
24.9k
    int i;
935
24.9k
    av_assert2(yalpha  <= 4096U);
936
24.9k
    av_assert2(uvalpha <= 4096U);
937
938
251k
    for (i = 0; i < ((dstW + 1) >> 1); i++) {
939
226k
        int Y1 = (buf0[i * 2]     * yalpha1  + buf1[i * 2]     * yalpha)  >> 19;
940
226k
        int Y2 = (buf0[i * 2 + 1] * yalpha1  + buf1[i * 2 + 1] * yalpha)  >> 19;
941
226k
        int U  = (ubuf0[i]        * uvalpha1 + ubuf1[i]        * uvalpha) >> 19;
942
226k
        int V  = (vbuf0[i]        * uvalpha1 + vbuf1[i]        * uvalpha) >> 19;
943
944
226k
        if ((Y1 | Y2 | U | V) & 0x100) {
945
20.1k
            Y1 = av_clip_uint8(Y1);
946
20.1k
            Y2 = av_clip_uint8(Y2);
947
20.1k
            U  = av_clip_uint8(U);
948
20.1k
            V  = av_clip_uint8(V);
949
20.1k
        }
950
951
226k
        output_pixels(i * 4, Y1, U, Y2, V);
952
226k
    }
953
24.9k
}
954
955
static av_always_inline void
956
yuv2422_1_c_template(SwsInternal *c, const int16_t *buf0,
957
                     const int16_t *ubuf[2], const int16_t *vbuf[2],
958
                     const int16_t *abuf0, uint8_t *dest, int dstW,
959
                     int uvalpha, int y, enum AVPixelFormat target)
960
33.0k
{
961
33.0k
    const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
962
33.0k
    int i;
963
964
33.0k
    if (uvalpha < 2048) {
965
371k
        for (i = 0; i < ((dstW + 1) >> 1); i++) {
966
341k
            int Y1 = (buf0[i * 2    ]+64) >> 7;
967
341k
            int Y2 = (buf0[i * 2 + 1]+64) >> 7;
968
341k
            int U  = (ubuf0[i]       +64) >> 7;
969
341k
            int V  = (vbuf0[i]       +64) >> 7;
970
971
341k
            if ((Y1 | Y2 | U | V) & 0x100) {
972
67.6k
                Y1 = av_clip_uint8(Y1);
973
67.6k
                Y2 = av_clip_uint8(Y2);
974
67.6k
                U  = av_clip_uint8(U);
975
67.6k
                V  = av_clip_uint8(V);
976
67.6k
            }
977
978
341k
            output_pixels(i * 4, Y1, U, Y2, V);
979
341k
        }
980
29.6k
    } else {
981
3.36k
        const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
982
216k
        for (i = 0; i < ((dstW + 1) >> 1); i++) {
983
213k
            int Y1 = (buf0[i * 2    ]    + 64) >> 7;
984
213k
            int Y2 = (buf0[i * 2 + 1]    + 64) >> 7;
985
213k
            int U  = (ubuf0[i] + ubuf1[i]+128) >> 8;
986
213k
            int V  = (vbuf0[i] + vbuf1[i]+128) >> 8;
987
988
213k
            if ((Y1 | Y2 | U | V) & 0x100) {
989
11.9k
                Y1 = av_clip_uint8(Y1);
990
11.9k
                Y2 = av_clip_uint8(Y2);
991
11.9k
                U  = av_clip_uint8(U);
992
11.9k
                V  = av_clip_uint8(V);
993
11.9k
            }
994
995
213k
            output_pixels(i * 4, Y1, U, Y2, V);
996
213k
        }
997
3.36k
    }
998
33.0k
}
999
1000
#undef output_pixels
1001
1002
YUV2PACKEDWRAPPER(yuv2, 422, yuyv422, AV_PIX_FMT_YUYV422)
1003
YUV2PACKEDWRAPPER(yuv2, 422, yvyu422, AV_PIX_FMT_YVYU422)
1004
YUV2PACKEDWRAPPER(yuv2, 422, uyvy422, AV_PIX_FMT_UYVY422)
1005
1006
#define R_B ((target == AV_PIX_FMT_RGB48LE || target == AV_PIX_FMT_RGB48BE || target == AV_PIX_FMT_RGBA64LE || target == AV_PIX_FMT_RGBA64BE) ? R : B)
1007
#define B_R ((target == AV_PIX_FMT_RGB48LE || target == AV_PIX_FMT_RGB48BE || target == AV_PIX_FMT_RGBA64LE || target == AV_PIX_FMT_RGBA64BE) ? B : R)
1008
#define output_pixel(pos, val) \
1009
61.4M
    if (is_be) { \
1010
30.5M
        AV_WB16(pos, val); \
1011
30.8M
    } else { \
1012
30.8M
        AV_WL16(pos, val); \
1013
30.8M
    }
1014
1015
static av_always_inline void
1016
yuv2ya16_X_c_template(SwsInternal *c, const int16_t *lumFilter,
1017
                        const int32_t **lumSrc, int lumFilterSize,
1018
                        const int16_t *chrFilter, const int32_t **unused_chrUSrc,
1019
                        const int32_t **unused_chrVSrc, int unused_chrFilterSize,
1020
                        const int32_t **alpSrc, uint16_t *dest, int dstW,
1021
                        int y, enum AVPixelFormat target,
1022
                        int unused_hasAlpha, int unused_eightbytes, int is_be)
1023
62.5k
{
1024
62.5k
    int hasAlpha = !!alpSrc;
1025
62.5k
    int i;
1026
1027
334k
    for (i = 0; i < dstW; i++) {
1028
271k
        int j;
1029
271k
        int Y = -0x40000000;
1030
271k
        int A = 0xffff;
1031
1032
4.11M
        for (j = 0; j < lumFilterSize; j++)
1033
3.84M
            Y += lumSrc[j][i] * (unsigned)lumFilter[j];
1034
1035
271k
        Y >>= 15;
1036
271k
        Y += (1<<3) + 0x8000;
1037
271k
        Y = av_clip_uint16(Y);
1038
1039
271k
        if (hasAlpha) {
1040
226k
            A = -0x40000000 + (1<<14);
1041
3.43M
            for (j = 0; j < lumFilterSize; j++)
1042
3.20M
                A += alpSrc[j][i] * (unsigned)lumFilter[j];
1043
1044
226k
            A >>= 15;
1045
226k
            A += 0x8000;
1046
226k
            A = av_clip_uint16(A);
1047
226k
        }
1048
1049
271k
        output_pixel(&dest[2 * i    ], Y);
1050
271k
        output_pixel(&dest[2 * i + 1], A);
1051
271k
    }
1052
62.5k
}
1053
1054
static av_always_inline void
1055
yuv2ya16_2_c_template(SwsInternal *c, const int32_t *buf[2],
1056
                        const int32_t *unused_ubuf[2], const int32_t *unused_vbuf[2],
1057
                        const int32_t *abuf[2], uint16_t *dest, int dstW,
1058
                        int yalpha_param, int unused_uvalpha, int y,
1059
                        enum AVPixelFormat target, int unused_hasAlpha,
1060
                        int unused_eightbytes, int is_be)
1061
19.5k
{
1062
19.5k
    unsigned  yalpha =  yalpha_param;
1063
19.5k
    int hasAlpha = abuf && abuf[0] && abuf[1];
1064
19.5k
    const int32_t *buf0  = buf[0],  *buf1  = buf[1],
1065
19.5k
    *abuf0 = hasAlpha ? abuf[0] : NULL,
1066
19.5k
    *abuf1 = hasAlpha ? abuf[1] : NULL;
1067
19.5k
    unsigned  yalpha1 = 4096 - yalpha;
1068
19.5k
    int i;
1069
1070
19.5k
    av_assert2(yalpha  <= 4096U);
1071
1072
206k
    for (i = 0; i < dstW; i++) {
1073
186k
        int Y = (int)(buf0[i] * yalpha1 + buf1[i] * yalpha) >> 15;
1074
186k
        int A;
1075
1076
186k
        Y = av_clip_uint16(Y);
1077
1078
186k
        if (hasAlpha) {
1079
141k
            A = (int)(abuf0[i] * yalpha1 + abuf1[i] * yalpha) >> 15;
1080
141k
            A = av_clip_uint16(A);
1081
141k
        }
1082
1083
186k
        output_pixel(&dest[2 * i    ], Y);
1084
186k
        output_pixel(&dest[2 * i + 1], hasAlpha ? A : 65535);
1085
186k
    }
1086
19.5k
}
1087
1088
static av_always_inline void
1089
yuv2ya16_1_c_template(SwsInternal *c, const int32_t *buf0,
1090
                        const int32_t *unused_ubuf[2], const int32_t *unused_vbuf[2],
1091
                        const int32_t *abuf0, uint16_t *dest, int dstW,
1092
                        int unused_uvalpha, int y, enum AVPixelFormat target,
1093
                        int unused_hasAlpha, int unused_eightbytes, int is_be)
1094
12.5k
{
1095
12.5k
    int hasAlpha = !!abuf0;
1096
12.5k
    int i;
1097
1098
416k
    for (i = 0; i < dstW; i++) {
1099
403k
        int Y = buf0[i] >> 3;/* 19 - 16 */
1100
403k
        int A;
1101
1102
403k
        Y = av_clip_uint16(Y);
1103
1104
403k
        if (hasAlpha) {
1105
277k
            A = abuf0[i] >> 3;
1106
277k
            if (A & 0x100)
1107
42.6k
                A = av_clip_uint16(A);
1108
277k
        }
1109
1110
403k
        output_pixel(&dest[2 * i    ], Y);
1111
403k
        output_pixel(&dest[2 * i + 1], hasAlpha ? A : 65535);
1112
403k
    }
1113
12.5k
}
1114
1115
static av_always_inline void
1116
yuv2rgba64_X_c_template(SwsInternal *c, const int16_t *lumFilter,
1117
                       const int32_t **lumSrc, int lumFilterSize,
1118
                       const int16_t *chrFilter, const int32_t **chrUSrc,
1119
                       const int32_t **chrVSrc, int chrFilterSize,
1120
                       const int32_t **alpSrc, uint16_t *dest, int dstW,
1121
                       int y, enum AVPixelFormat target, int hasAlpha, int eightbytes,
1122
                       int is_be)
1123
107k
{
1124
107k
    int i;
1125
107k
    int A1 = 0xffff<<14, A2 = 0xffff<<14;
1126
1127
1.24M
    for (i = 0; i < ((dstW + 1) >> 1); i++) {
1128
1.13M
        int j;
1129
1.13M
        unsigned Y1 = -0x40000000;
1130
1.13M
        unsigned Y2 = -0x40000000;
1131
1.13M
        unsigned U  = -(128 << 23); // 19
1132
1.13M
        unsigned V  = -(128 << 23);
1133
1.13M
        int R, G, B;
1134
1135
10.6M
        for (j = 0; j < lumFilterSize; j++) {
1136
9.56M
            Y1 += lumSrc[j][i * 2]     * (unsigned)lumFilter[j];
1137
9.56M
            Y2 += lumSrc[j][i * 2 + 1] * (unsigned)lumFilter[j];
1138
9.56M
        }
1139
7.48M
        for (j = 0; j < chrFilterSize; j++) {;
1140
6.35M
            U += chrUSrc[j][i] * (unsigned)chrFilter[j];
1141
6.35M
            V += chrVSrc[j][i] * (unsigned)chrFilter[j];
1142
6.35M
        }
1143
1144
1.13M
        if (hasAlpha) {
1145
639k
            A1 = -0x40000000;
1146
639k
            A2 = -0x40000000;
1147
5.91M
            for (j = 0; j < lumFilterSize; j++) {
1148
5.27M
                A1 += alpSrc[j][i * 2]     * (unsigned)lumFilter[j];
1149
5.27M
                A2 += alpSrc[j][i * 2 + 1] * (unsigned)lumFilter[j];
1150
5.27M
            }
1151
639k
            A1 >>= 1;
1152
639k
            A1 += 0x20002000;
1153
639k
            A2 >>= 1;
1154
639k
            A2 += 0x20002000;
1155
639k
        }
1156
1157
        // 8 bits: 12+15=27; 16 bits: 12+19=31
1158
1.13M
        Y1 = (int)Y1 >> 14; // 10
1159
1.13M
        Y1 += 0x10000;
1160
1.13M
        Y2 = (int)Y2 >> 14;
1161
1.13M
        Y2 += 0x10000;
1162
1.13M
        U  = (int)U >> 14;
1163
1.13M
        V  = (int)V >> 14;
1164
1165
        // 8 bits: 27 -> 17 bits, 16 bits: 31 - 14 = 17 bits
1166
1.13M
        Y1 -= c->yuv2rgb_y_offset;
1167
1.13M
        Y2 -= c->yuv2rgb_y_offset;
1168
1.13M
        Y1 *= c->yuv2rgb_y_coeff;
1169
1.13M
        Y2 *= c->yuv2rgb_y_coeff;
1170
1.13M
        Y1 += (1 << 13) - (1 << 29); // 21
1171
1.13M
        Y2 += (1 << 13) - (1 << 29);
1172
        // 8 bits: 17 + 13 bits = 30 bits, 16 bits: 17 + 13 bits = 30 bits
1173
1174
1.13M
        R = V * c->yuv2rgb_v2r_coeff;
1175
1.13M
        G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
1176
1.13M
        B =                            U * c->yuv2rgb_u2b_coeff;
1177
1178
        // 8 bits: 30 - 22 = 8 bits, 16 bits: 30 bits - 14 = 16 bits
1179
1.13M
        output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y1) >> 14) + (1<<15), 16));
1180
1.13M
        output_pixel(&dest[1], av_clip_uintp2(((int)(  G + Y1) >> 14) + (1<<15), 16));
1181
1.13M
        output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y1) >> 14) + (1<<15), 16));
1182
1.13M
        if (eightbytes) {
1183
945k
            output_pixel(&dest[3], av_clip_uintp2(A1      , 30) >> 14);
1184
945k
            output_pixel(&dest[4], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16));
1185
945k
            output_pixel(&dest[5], av_clip_uintp2(((int)(  G + Y2) >> 14) + (1<<15), 16));
1186
945k
            output_pixel(&dest[6], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16));
1187
945k
            output_pixel(&dest[7], av_clip_uintp2(A2      , 30) >> 14);
1188
945k
            dest += 8;
1189
945k
        } else {
1190
192k
            output_pixel(&dest[3], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16));
1191
192k
            output_pixel(&dest[4], av_clip_uintp2(((int)(  G + Y2) >> 14) + (1<<15), 16));
1192
192k
            output_pixel(&dest[5], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16));
1193
192k
            dest += 6;
1194
192k
        }
1195
1.13M
    }
1196
107k
}
1197
1198
static av_always_inline void
1199
yuv2rgba64_2_c_template(SwsInternal *c, const int32_t *buf[2],
1200
                       const int32_t *ubuf[2], const int32_t *vbuf[2],
1201
                       const int32_t *abuf[2], uint16_t *dest, int dstW,
1202
                       int yalpha_param, int uvalpha_param, int y,
1203
                       enum AVPixelFormat target, int hasAlpha, int eightbytes,
1204
                       int is_be)
1205
124k
{
1206
124k
    unsigned  yalpha =  yalpha_param;
1207
124k
    unsigned uvalpha = uvalpha_param;
1208
124k
    const int32_t *buf0  = buf[0],  *buf1  = buf[1],
1209
124k
                  *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1210
124k
                  *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1211
124k
                  *abuf0 = hasAlpha ? abuf[0] : NULL,
1212
124k
                  *abuf1 = hasAlpha ? abuf[1] : NULL;
1213
124k
    unsigned  yalpha1 = 4096 - yalpha;
1214
124k
    unsigned uvalpha1 = 4096 - uvalpha;
1215
124k
    int i;
1216
124k
    int A1 = 0xffff<<14, A2 = 0xffff<<14;
1217
1218
124k
    av_assert2(yalpha  <= 4096U);
1219
124k
    av_assert2(uvalpha <= 4096U);
1220
1221
1.20M
    for (i = 0; i < ((dstW + 1) >> 1); i++) {
1222
1.07M
        unsigned Y1 = (int)(buf0[i * 2]     * yalpha1  + buf1[i * 2]     * yalpha) >> 14;
1223
1.07M
        unsigned Y2 = (int)(buf0[i * 2 + 1] * yalpha1  + buf1[i * 2 + 1] * yalpha) >> 14;
1224
1.07M
        int U  = (int)(ubuf0[i]        * uvalpha1 + ubuf1[i]        * uvalpha - (128 << 23)) >> 14;
1225
1.07M
        int V  = (int)(vbuf0[i]        * uvalpha1 + vbuf1[i]        * uvalpha - (128 << 23)) >> 14;
1226
1.07M
        int R, G, B;
1227
1228
1.07M
        Y1 -= c->yuv2rgb_y_offset;
1229
1.07M
        Y2 -= c->yuv2rgb_y_offset;
1230
1.07M
        Y1 *= c->yuv2rgb_y_coeff;
1231
1.07M
        Y2 *= c->yuv2rgb_y_coeff;
1232
1.07M
        Y1 += (1 << 13) - (1 << 29);
1233
1.07M
        Y2 += (1 << 13) - (1 << 29);
1234
1235
1.07M
        R = (SUINT)V * c->yuv2rgb_v2r_coeff;
1236
1.07M
        G = (SUINT)V * c->yuv2rgb_v2g_coeff + (SUINT)U * c->yuv2rgb_u2g_coeff;
1237
1.07M
        B =                                   (SUINT)U * c->yuv2rgb_u2b_coeff;
1238
1239
1.07M
        if (hasAlpha) {
1240
506k
            A1 = (int)(abuf0[i * 2    ] * yalpha1 + abuf1[i * 2    ] * yalpha) >> 1;
1241
506k
            A2 = (int)(abuf0[i * 2 + 1] * yalpha1 + abuf1[i * 2 + 1] * yalpha) >> 1;
1242
1243
506k
            A1 += 1 << 13;
1244
506k
            A2 += 1 << 13;
1245
506k
        }
1246
1247
1.07M
        output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y1) >> 14) + (1<<15), 16));
1248
1.07M
        output_pixel(&dest[1], av_clip_uintp2(((int)(  G + Y1) >> 14) + (1<<15), 16));
1249
1.07M
        output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y1) >> 14) + (1<<15), 16));
1250
1.07M
        if (eightbytes) {
1251
828k
            output_pixel(&dest[3], av_clip_uintp2(A1      , 30) >> 14);
1252
828k
            output_pixel(&dest[4], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16));
1253
828k
            output_pixel(&dest[5], av_clip_uintp2(((int)(  G + Y2) >> 14) + (1<<15), 16));
1254
828k
            output_pixel(&dest[6], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16));
1255
828k
            output_pixel(&dest[7], av_clip_uintp2(A2      , 30) >> 14);
1256
828k
            dest += 8;
1257
828k
        } else {
1258
251k
            output_pixel(&dest[3], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16));
1259
251k
            output_pixel(&dest[4], av_clip_uintp2(((int)(  G + Y2) >> 14) + (1<<15), 16));
1260
251k
            output_pixel(&dest[5], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16));
1261
251k
            dest += 6;
1262
251k
        }
1263
1.07M
    }
1264
124k
}
1265
1266
static av_always_inline void
1267
yuv2rgba64_1_c_template(SwsInternal *c, const int32_t *buf0,
1268
                       const int32_t *ubuf[2], const int32_t *vbuf[2],
1269
                       const int32_t *abuf0, uint16_t *dest, int dstW,
1270
                       int uvalpha, int y, enum AVPixelFormat target,
1271
                       int hasAlpha, int eightbytes, int is_be)
1272
47.6k
{
1273
47.6k
    const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1274
47.6k
    int i;
1275
47.6k
    SUINT A1 = 0xffff<<14, A2= 0xffff<<14;
1276
1277
47.6k
    if (uvalpha == 0) {
1278
1.41M
        for (i = 0; i < ((dstW + 1) >> 1); i++) {
1279
1.38M
            SUINT Y1 = (buf0[i * 2]    ) >> 2;
1280
1.38M
            SUINT Y2 = (buf0[i * 2 + 1]) >> 2;
1281
1.38M
            SUINT U  = (ubuf0[i] - (128 << 11)) >> 2;
1282
1.38M
            SUINT V  = (vbuf0[i] - (128 << 11)) >> 2;
1283
1.38M
            int R, G, B;
1284
1285
1.38M
            Y1 -= c->yuv2rgb_y_offset;
1286
1.38M
            Y2 -= c->yuv2rgb_y_offset;
1287
1.38M
            Y1 *= c->yuv2rgb_y_coeff;
1288
1.38M
            Y2 *= c->yuv2rgb_y_coeff;
1289
1.38M
            Y1 += (1 << 13) - (1 << 29);
1290
1.38M
            Y2 += (1 << 13) - (1 << 29);
1291
1292
1.38M
            if (hasAlpha) {
1293
625k
                A1 = abuf0[i * 2    ] * (SUINT)(1 << 11);
1294
625k
                A2 = abuf0[i * 2 + 1] * (SUINT)(1 << 11);
1295
1296
625k
                A1 += 1 << 13;
1297
625k
                A2 += 1 << 13;
1298
625k
            }
1299
1300
1.38M
            R = V * c->yuv2rgb_v2r_coeff;
1301
1.38M
            G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
1302
1.38M
            B =                            U * c->yuv2rgb_u2b_coeff;
1303
1304
1.38M
            output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y1) >> 14) + (1<<15), 16));
1305
1.38M
            output_pixel(&dest[1], av_clip_uintp2(((int)(  G + Y1) >> 14) + (1<<15), 16));
1306
1.38M
            output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y1) >> 14) + (1<<15), 16));
1307
1.38M
            if (eightbytes) {
1308
995k
                output_pixel(&dest[3], av_clip_uintp2(A1      , 30) >> 14);
1309
995k
                output_pixel(&dest[4], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16));
1310
995k
                output_pixel(&dest[5], av_clip_uintp2(((int)(  G + Y2) >> 14) + (1<<15), 16));
1311
995k
                output_pixel(&dest[6], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16));
1312
995k
                output_pixel(&dest[7], av_clip_uintp2(A2      , 30) >> 14);
1313
995k
                dest += 8;
1314
995k
            } else {
1315
393k
                output_pixel(&dest[3], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16));
1316
393k
                output_pixel(&dest[4], av_clip_uintp2(((int)(  G + Y2) >> 14) + (1<<15), 16));
1317
393k
                output_pixel(&dest[5], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16));
1318
393k
                dest += 6;
1319
393k
            }
1320
1.38M
        }
1321
28.2k
    } else {
1322
19.3k
        const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1323
19.3k
        int A1 = 0xffff<<14, A2 = 0xffff<<14;
1324
19.3k
        unsigned uvalpha1 = 4096 - uvalpha;
1325
19.3k
        av_assert2(uvalpha <= 4096U);
1326
1327
1.34M
        for (i = 0; i < ((dstW + 1) >> 1); i++) {
1328
1.32M
            SUINT Y1 = (buf0[i * 2]    ) >> 2;
1329
1.32M
            SUINT Y2 = (buf0[i * 2 + 1]) >> 2;
1330
1.32M
            SUINT U = (int)((SUINT)ubuf0[i] * uvalpha1 + (SUINT)ubuf1[i] * uvalpha - (128 << 23)) >> 14;
1331
1.32M
            SUINT V = (int)((SUINT)vbuf0[i] * uvalpha1 + (SUINT)vbuf1[i] * uvalpha - (128 << 23)) >> 14;
1332
1.32M
            int R, G, B;
1333
1334
1.32M
            Y1 -= c->yuv2rgb_y_offset;
1335
1.32M
            Y2 -= c->yuv2rgb_y_offset;
1336
1.32M
            Y1 *= c->yuv2rgb_y_coeff;
1337
1.32M
            Y2 *= c->yuv2rgb_y_coeff;
1338
1.32M
            Y1 += (1 << 13) - (1 << 29);
1339
1.32M
            Y2 += (1 << 13) - (1 << 29);
1340
1341
1.32M
            if (hasAlpha) {
1342
583k
                A1 = abuf0[i * 2    ] * (1 << 11);
1343
583k
                A2 = abuf0[i * 2 + 1] * (1 << 11);
1344
1345
583k
                A1 += 1 << 13;
1346
583k
                A2 += 1 << 13;
1347
583k
            }
1348
1349
1.32M
            R = V * c->yuv2rgb_v2r_coeff;
1350
1.32M
            G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
1351
1.32M
            B =                            U * c->yuv2rgb_u2b_coeff;
1352
1353
1.32M
            output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y1) >> 14) + (1<<15), 16));
1354
1.32M
            output_pixel(&dest[1], av_clip_uintp2(((int)(  G + Y1) >> 14) + (1<<15), 16));
1355
1.32M
            output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y1) >> 14) + (1<<15), 16));
1356
1.32M
            if (eightbytes) {
1357
905k
                output_pixel(&dest[3], av_clip_uintp2(A1      , 30) >> 14);
1358
905k
                output_pixel(&dest[4], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16));
1359
905k
                output_pixel(&dest[5], av_clip_uintp2(((int)(  G + Y2) >> 14) + (1<<15), 16));
1360
905k
                output_pixel(&dest[6], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16));
1361
905k
                output_pixel(&dest[7], av_clip_uintp2(A2      , 30) >> 14);
1362
905k
                dest += 8;
1363
905k
            } else {
1364
420k
                output_pixel(&dest[3], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16));
1365
420k
                output_pixel(&dest[4], av_clip_uintp2(((int)(  G + Y2) >> 14) + (1<<15), 16));
1366
420k
                output_pixel(&dest[5], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16));
1367
420k
                dest += 6;
1368
420k
            }
1369
1.32M
        }
1370
19.3k
    }
1371
47.6k
}
1372
1373
static av_always_inline void
1374
yuv2rgba64_full_X_c_template(SwsInternal *c, const int16_t *lumFilter,
1375
                       const int32_t **lumSrc, int lumFilterSize,
1376
                       const int16_t *chrFilter, const int32_t **chrUSrc,
1377
                       const int32_t **chrVSrc, int chrFilterSize,
1378
                       const int32_t **alpSrc, uint16_t *dest, int dstW,
1379
                       int y, enum AVPixelFormat target, int hasAlpha,
1380
                       int eightbytes, int is_be)
1381
327k
{
1382
327k
    int i;
1383
327k
    int A = 0xffff<<14;
1384
1385
1.64M
    for (i = 0; i < dstW; i++) {
1386
1.32M
        int j;
1387
1.32M
        int Y  = -0x40000000;
1388
1.32M
        int U  = -(128 << 23); // 19
1389
1.32M
        int V  = -(128 << 23);
1390
1.32M
        int R, G, B;
1391
1392
26.0M
        for (j = 0; j < lumFilterSize; j++) {
1393
24.7M
            Y += lumSrc[j][i]  * (unsigned)lumFilter[j];
1394
24.7M
        }
1395
20.7M
        for (j = 0; j < chrFilterSize; j++) {;
1396
19.3M
            U += chrUSrc[j][i] * (unsigned)chrFilter[j];
1397
19.3M
            V += chrVSrc[j][i] * (unsigned)chrFilter[j];
1398
19.3M
        }
1399
1400
1.32M
        if (hasAlpha) {
1401
542k
            A = -0x40000000;
1402
8.74M
            for (j = 0; j < lumFilterSize; j++) {
1403
8.20M
                A += alpSrc[j][i] * (unsigned)lumFilter[j];
1404
8.20M
            }
1405
542k
            A >>= 1;
1406
542k
            A += 0x20002000;
1407
542k
        }
1408
1409
        // 8bit: 12+15=27; 16-bit: 12+19=31
1410
1.32M
        Y  >>= 14; // 10
1411
1.32M
        Y += 0x10000;
1412
1.32M
        U  >>= 14;
1413
1.32M
        V  >>= 14;
1414
1415
        // 8bit: 27 -> 17bit, 16bit: 31 - 14 = 17bit
1416
1.32M
        Y -= c->yuv2rgb_y_offset;
1417
1.32M
        Y *= c->yuv2rgb_y_coeff;
1418
1.32M
        Y += (1 << 13) - (1<<29); // 21
1419
        // 8bit: 17 + 13bit = 30bit, 16bit: 17 + 13bit = 30bit
1420
1421
1.32M
        R = (unsigned)V * c->yuv2rgb_v2r_coeff;
1422
1.32M
        G = (unsigned)V * c->yuv2rgb_v2g_coeff + (unsigned)U * c->yuv2rgb_u2g_coeff;
1423
1.32M
        B =                                      (unsigned)U * c->yuv2rgb_u2b_coeff;
1424
1425
        // 8bit: 30 - 22 = 8bit, 16bit: 30bit - 14 = 16bit
1426
1.32M
        output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + (unsigned)Y)>>14) + (1<<15), 16));
1427
1.32M
        output_pixel(&dest[1], av_clip_uintp2(((int)(  G + (unsigned)Y)>>14) + (1<<15), 16));
1428
1.32M
        output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + (unsigned)Y)>>14) + (1<<15), 16));
1429
1.32M
        if (eightbytes) {
1430
931k
            output_pixel(&dest[3], av_clip_uintp2(A, 30) >> 14);
1431
931k
            dest += 4;
1432
931k
        } else {
1433
389k
            dest += 3;
1434
389k
        }
1435
1.32M
    }
1436
327k
}
1437
1438
static av_always_inline void
1439
yuv2rgba64_full_2_c_template(SwsInternal *c, const int32_t *buf[2],
1440
                       const int32_t *ubuf[2], const int32_t *vbuf[2],
1441
                       const int32_t *abuf[2], uint16_t *dest, int dstW,
1442
                       int yalpha_param, int uvalpha_param, int y,
1443
                       enum AVPixelFormat target, int hasAlpha, int eightbytes,
1444
                       int is_be)
1445
258k
{
1446
258k
    unsigned  yalpha =  yalpha_param;
1447
258k
    unsigned uvalpha = uvalpha_param;
1448
258k
    const int32_t *buf0  = buf[0],  *buf1  = buf[1],
1449
258k
                  *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1450
258k
                  *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1451
258k
                  *abuf0 = hasAlpha ? abuf[0] : NULL,
1452
258k
                  *abuf1 = hasAlpha ? abuf[1] : NULL;
1453
258k
    unsigned  yalpha1 = 4096 - yalpha;
1454
258k
    unsigned uvalpha1 = 4096 - uvalpha;
1455
258k
    int i;
1456
258k
    int A = 0xffff<<14;
1457
1458
258k
    av_assert2(yalpha  <= 4096U);
1459
258k
    av_assert2(uvalpha <= 4096U);
1460
1461
1.92M
    for (i = 0; i < dstW; i++) {
1462
1.66M
        unsigned Y  = (int)(buf0[i]     * yalpha1  + buf1[i]     * yalpha) >> 14;
1463
1.66M
        unsigned U  = (int)(ubuf0[i]   * uvalpha1 + ubuf1[i]     * uvalpha - (128 << 23)) >> 14;
1464
1.66M
        unsigned V  = (int)(vbuf0[i]   * uvalpha1 + vbuf1[i]     * uvalpha - (128 << 23)) >> 14;
1465
1.66M
        int R, G, B;
1466
1467
1.66M
        Y -= c->yuv2rgb_y_offset;
1468
1.66M
        Y *= c->yuv2rgb_y_coeff;
1469
1.66M
        Y += (1 << 13) - (1 << 29);
1470
1471
1.66M
        R = V * c->yuv2rgb_v2r_coeff;
1472
1.66M
        G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
1473
1.66M
        B =                            U * c->yuv2rgb_u2b_coeff;
1474
1475
1.66M
        if (hasAlpha) {
1476
805k
            A = (int)(abuf0[i] * yalpha1 + abuf1[i] * yalpha) >> 1;
1477
1478
805k
            A += 1 << 13;
1479
805k
        }
1480
1481
1.66M
        output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y) >> 14) + (1<<15), 16));
1482
1.66M
        output_pixel(&dest[1], av_clip_uintp2(((int)(  G + Y) >> 14) + (1<<15), 16));
1483
1.66M
        output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y) >> 14) + (1<<15), 16));
1484
1.66M
        if (eightbytes) {
1485
1.20M
            output_pixel(&dest[3], av_clip_uintp2(A, 30) >> 14);
1486
1.20M
            dest += 4;
1487
1.20M
        } else {
1488
458k
            dest += 3;
1489
458k
        }
1490
1.66M
    }
1491
258k
}
1492
1493
static av_always_inline void
1494
yuv2rgba64_full_1_c_template(SwsInternal *c, const int32_t *buf0,
1495
                       const int32_t *ubuf[2], const int32_t *vbuf[2],
1496
                       const int32_t *abuf0, uint16_t *dest, int dstW,
1497
                       int uvalpha, int y, enum AVPixelFormat target,
1498
                       int hasAlpha, int eightbytes, int is_be)
1499
121k
{
1500
121k
    const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1501
121k
    int i;
1502
121k
    int A = 0xffff<<14;
1503
1504
121k
    if (uvalpha == 0) {
1505
1.76M
        for (i = 0; i < dstW; i++) {
1506
1.66M
            SUINT Y  = (buf0[i]) >> 2;
1507
1.66M
            SUINT U  = (ubuf0[i] - (128 << 11)) >> 2;
1508
1.66M
            SUINT V  = (vbuf0[i] - (128 << 11)) >> 2;
1509
1.66M
            int R, G, B;
1510
1511
1.66M
            Y -= c->yuv2rgb_y_offset;
1512
1.66M
            Y *= c->yuv2rgb_y_coeff;
1513
1.66M
            Y += (1 << 13) - (1 << 29);
1514
1515
1.66M
            if (hasAlpha) {
1516
833k
                A = abuf0[i] * (1 << 11);
1517
1518
833k
                A += 1 << 13;
1519
833k
            }
1520
1521
1.66M
            R = V * c->yuv2rgb_v2r_coeff;
1522
1.66M
            G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
1523
1.66M
            B =                            U * c->yuv2rgb_u2b_coeff;
1524
1525
1.66M
            output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y) >> 14) + (1<<15), 16));
1526
1.66M
            output_pixel(&dest[1], av_clip_uintp2(((int)(  G + Y) >> 14) + (1<<15), 16));
1527
1.66M
            output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y) >> 14) + (1<<15), 16));
1528
1.66M
            if (eightbytes) {
1529
1.26M
                output_pixel(&dest[3], av_clip_uintp2(A, 30) >> 14);
1530
1.26M
                dest += 4;
1531
1.26M
            } else {
1532
404k
                dest += 3;
1533
404k
            }
1534
1.66M
        }
1535
94.9k
    } else {
1536
26.8k
        const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1537
26.8k
        unsigned uvalpha1 = 4096 - uvalpha;
1538
26.8k
        int A = 0xffff<<14;
1539
26.8k
        av_assert2(uvalpha <= 4096U);
1540
1541
1.49M
        for (i = 0; i < dstW; i++) {
1542
1.46M
            SUINT Y  = (buf0[i]    ) >> 2;
1543
1.46M
            SUINT U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha - (128 << 23)) >> 14;
1544
1.46M
            SUINT V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha - (128 << 23)) >> 14;
1545
1.46M
            int R, G, B;
1546
1547
1.46M
            Y -= c->yuv2rgb_y_offset;
1548
1.46M
            Y *= c->yuv2rgb_y_coeff;
1549
1.46M
            Y += (1 << 13) - (1 << 29);
1550
1551
1.46M
            if (hasAlpha) {
1552
528k
                A = abuf0[i] * (1 << 11);
1553
1554
528k
                A += 1 << 13;
1555
528k
            }
1556
1557
1.46M
            R = V * c->yuv2rgb_v2r_coeff;
1558
1.46M
            G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
1559
1.46M
            B =                            U * c->yuv2rgb_u2b_coeff;
1560
1561
1.46M
            output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y) >> 14) + (1<<15), 16));
1562
1.46M
            output_pixel(&dest[1], av_clip_uintp2(((int)(  G + Y) >> 14) + (1<<15), 16));
1563
1.46M
            output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y) >> 14) + (1<<15), 16));
1564
1.46M
            if (eightbytes) {
1565
985k
                output_pixel(&dest[3], av_clip_uintp2(A, 30) >> 14);
1566
985k
                dest += 4;
1567
985k
            } else {
1568
482k
                dest += 3;
1569
482k
            }
1570
1.46M
        }
1571
26.8k
    }
1572
121k
}
1573
1574
#undef output_pixel
1575
#undef r_b
1576
#undef b_r
1577
1578
#define YUV2PACKED16WRAPPER_EXT(name, base, ext, fmt, is_be, hasAlpha, eightbytes) \
1579
static void name ## ext ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
1580
                        const int16_t **_lumSrc, int lumFilterSize, \
1581
                        const int16_t *chrFilter, const int16_t **_chrUSrc, \
1582
                        const int16_t **_chrVSrc, int chrFilterSize, \
1583
                        const int16_t **_alpSrc, uint8_t *_dest, int dstW, \
1584
497k
                        int y) \
1585
497k
{ \
1586
497k
    const int32_t **lumSrc  = (const int32_t **) _lumSrc, \
1587
497k
                  **chrUSrc = (const int32_t **) _chrUSrc, \
1588
497k
                  **chrVSrc = (const int32_t **) _chrVSrc, \
1589
497k
                  **alpSrc  = (const int32_t **) _alpSrc; \
1590
497k
    uint16_t *dest = (uint16_t *) _dest; \
1591
497k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1592
497k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1593
497k
                          alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1594
497k
} \
output.c:yuv2rgba64le_full_X_c
Line
Count
Source
1584
20.2k
                        int y) \
1585
20.2k
{ \
1586
20.2k
    const int32_t **lumSrc  = (const int32_t **) _lumSrc, \
1587
20.2k
                  **chrUSrc = (const int32_t **) _chrUSrc, \
1588
20.2k
                  **chrVSrc = (const int32_t **) _chrVSrc, \
1589
20.2k
                  **alpSrc  = (const int32_t **) _alpSrc; \
1590
20.2k
    uint16_t *dest = (uint16_t *) _dest; \
1591
20.2k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1592
20.2k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1593
20.2k
                          alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1594
20.2k
} \
output.c:yuv2rgbx64le_full_X_c
Line
Count
Source
1584
28.4k
                        int y) \
1585
28.4k
{ \
1586
28.4k
    const int32_t **lumSrc  = (const int32_t **) _lumSrc, \
1587
28.4k
                  **chrUSrc = (const int32_t **) _chrUSrc, \
1588
28.4k
                  **chrVSrc = (const int32_t **) _chrVSrc, \
1589
28.4k
                  **alpSrc  = (const int32_t **) _alpSrc; \
1590
28.4k
    uint16_t *dest = (uint16_t *) _dest; \
1591
28.4k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1592
28.4k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1593
28.4k
                          alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1594
28.4k
} \
output.c:yuv2rgba64be_full_X_c
Line
Count
Source
1584
48.8k
                        int y) \
1585
48.8k
{ \
1586
48.8k
    const int32_t **lumSrc  = (const int32_t **) _lumSrc, \
1587
48.8k
                  **chrUSrc = (const int32_t **) _chrUSrc, \
1588
48.8k
                  **chrVSrc = (const int32_t **) _chrVSrc, \
1589
48.8k
                  **alpSrc  = (const int32_t **) _alpSrc; \
1590
48.8k
    uint16_t *dest = (uint16_t *) _dest; \
1591
48.8k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1592
48.8k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1593
48.8k
                          alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1594
48.8k
} \
output.c:yuv2rgbx64be_full_X_c
Line
Count
Source
1584
20.1k
                        int y) \
1585
20.1k
{ \
1586
20.1k
    const int32_t **lumSrc  = (const int32_t **) _lumSrc, \
1587
20.1k
                  **chrUSrc = (const int32_t **) _chrUSrc, \
1588
20.1k
                  **chrVSrc = (const int32_t **) _chrVSrc, \
1589
20.1k
                  **alpSrc  = (const int32_t **) _alpSrc; \
1590
20.1k
    uint16_t *dest = (uint16_t *) _dest; \
1591
20.1k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1592
20.1k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1593
20.1k
                          alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1594
20.1k
} \
output.c:yuv2bgra64le_full_X_c
Line
Count
Source
1584
39.1k
                        int y) \
1585
39.1k
{ \
1586
39.1k
    const int32_t **lumSrc  = (const int32_t **) _lumSrc, \
1587
39.1k
                  **chrUSrc = (const int32_t **) _chrUSrc, \
1588
39.1k
                  **chrVSrc = (const int32_t **) _chrVSrc, \
1589
39.1k
                  **alpSrc  = (const int32_t **) _alpSrc; \
1590
39.1k
    uint16_t *dest = (uint16_t *) _dest; \
1591
39.1k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1592
39.1k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1593
39.1k
                          alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1594
39.1k
} \
output.c:yuv2bgrx64le_full_X_c
Line
Count
Source
1584
31.7k
                        int y) \
1585
31.7k
{ \
1586
31.7k
    const int32_t **lumSrc  = (const int32_t **) _lumSrc, \
1587
31.7k
                  **chrUSrc = (const int32_t **) _chrUSrc, \
1588
31.7k
                  **chrVSrc = (const int32_t **) _chrVSrc, \
1589
31.7k
                  **alpSrc  = (const int32_t **) _alpSrc; \
1590
31.7k
    uint16_t *dest = (uint16_t *) _dest; \
1591
31.7k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1592
31.7k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1593
31.7k
                          alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1594
31.7k
} \
output.c:yuv2bgra64be_full_X_c
Line
Count
Source
1584
28.1k
                        int y) \
1585
28.1k
{ \
1586
28.1k
    const int32_t **lumSrc  = (const int32_t **) _lumSrc, \
1587
28.1k
                  **chrUSrc = (const int32_t **) _chrUSrc, \
1588
28.1k
                  **chrVSrc = (const int32_t **) _chrVSrc, \
1589
28.1k
                  **alpSrc  = (const int32_t **) _alpSrc; \
1590
28.1k
    uint16_t *dest = (uint16_t *) _dest; \
1591
28.1k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1592
28.1k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1593
28.1k
                          alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1594
28.1k
} \
output.c:yuv2bgrx64be_full_X_c
Line
Count
Source
1584
5.42k
                        int y) \
1585
5.42k
{ \
1586
5.42k
    const int32_t **lumSrc  = (const int32_t **) _lumSrc, \
1587
5.42k
                  **chrUSrc = (const int32_t **) _chrUSrc, \
1588
5.42k
                  **chrVSrc = (const int32_t **) _chrVSrc, \
1589
5.42k
                  **alpSrc  = (const int32_t **) _alpSrc; \
1590
5.42k
    uint16_t *dest = (uint16_t *) _dest; \
1591
5.42k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1592
5.42k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1593
5.42k
                          alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1594
5.42k
} \
output.c:yuv2rgb48le_full_X_c
Line
Count
Source
1584
20.8k
                        int y) \
1585
20.8k
{ \
1586
20.8k
    const int32_t **lumSrc  = (const int32_t **) _lumSrc, \
1587
20.8k
                  **chrUSrc = (const int32_t **) _chrUSrc, \
1588
20.8k
                  **chrVSrc = (const int32_t **) _chrVSrc, \
1589
20.8k
                  **alpSrc  = (const int32_t **) _alpSrc; \
1590
20.8k
    uint16_t *dest = (uint16_t *) _dest; \
1591
20.8k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1592
20.8k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1593
20.8k
                          alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1594
20.8k
} \
output.c:yuv2bgr48le_full_X_c
Line
Count
Source
1584
10.0k
                        int y) \
1585
10.0k
{ \
1586
10.0k
    const int32_t **lumSrc  = (const int32_t **) _lumSrc, \
1587
10.0k
                  **chrUSrc = (const int32_t **) _chrUSrc, \
1588
10.0k
                  **chrVSrc = (const int32_t **) _chrVSrc, \
1589
10.0k
                  **alpSrc  = (const int32_t **) _alpSrc; \
1590
10.0k
    uint16_t *dest = (uint16_t *) _dest; \
1591
10.0k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1592
10.0k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1593
10.0k
                          alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1594
10.0k
} \
output.c:yuv2rgb48be_full_X_c
Line
Count
Source
1584
17.8k
                        int y) \
1585
17.8k
{ \
1586
17.8k
    const int32_t **lumSrc  = (const int32_t **) _lumSrc, \
1587
17.8k
                  **chrUSrc = (const int32_t **) _chrUSrc, \
1588
17.8k
                  **chrVSrc = (const int32_t **) _chrVSrc, \
1589
17.8k
                  **alpSrc  = (const int32_t **) _alpSrc; \
1590
17.8k
    uint16_t *dest = (uint16_t *) _dest; \
1591
17.8k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1592
17.8k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1593
17.8k
                          alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1594
17.8k
} \
output.c:yuv2bgr48be_full_X_c
Line
Count
Source
1584
56.3k
                        int y) \
1585
56.3k
{ \
1586
56.3k
    const int32_t **lumSrc  = (const int32_t **) _lumSrc, \
1587
56.3k
                  **chrUSrc = (const int32_t **) _chrUSrc, \
1588
56.3k
                  **chrVSrc = (const int32_t **) _chrVSrc, \
1589
56.3k
                  **alpSrc  = (const int32_t **) _alpSrc; \
1590
56.3k
    uint16_t *dest = (uint16_t *) _dest; \
1591
56.3k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1592
56.3k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1593
56.3k
                          alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1594
56.3k
} \
output.c:yuv2rgba64le_X_c
Line
Count
Source
1584
4.33k
                        int y) \
1585
4.33k
{ \
1586
4.33k
    const int32_t **lumSrc  = (const int32_t **) _lumSrc, \
1587
4.33k
                  **chrUSrc = (const int32_t **) _chrUSrc, \
1588
4.33k
                  **chrVSrc = (const int32_t **) _chrVSrc, \
1589
4.33k
                  **alpSrc  = (const int32_t **) _alpSrc; \
1590
4.33k
    uint16_t *dest = (uint16_t *) _dest; \
1591
4.33k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1592
4.33k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1593
4.33k
                          alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1594
4.33k
} \
output.c:yuv2rgbx64le_X_c
Line
Count
Source
1584
26.7k
                        int y) \
1585
26.7k
{ \
1586
26.7k
    const int32_t **lumSrc  = (const int32_t **) _lumSrc, \
1587
26.7k
                  **chrUSrc = (const int32_t **) _chrUSrc, \
1588
26.7k
                  **chrVSrc = (const int32_t **) _chrVSrc, \
1589
26.7k
                  **alpSrc  = (const int32_t **) _alpSrc; \
1590
26.7k
    uint16_t *dest = (uint16_t *) _dest; \
1591
26.7k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1592
26.7k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1593
26.7k
                          alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1594
26.7k
} \
output.c:yuv2rgba64be_X_c
Line
Count
Source
1584
11.8k
                        int y) \
1585
11.8k
{ \
1586
11.8k
    const int32_t **lumSrc  = (const int32_t **) _lumSrc, \
1587
11.8k
                  **chrUSrc = (const int32_t **) _chrUSrc, \
1588
11.8k
                  **chrVSrc = (const int32_t **) _chrVSrc, \
1589
11.8k
                  **alpSrc  = (const int32_t **) _alpSrc; \
1590
11.8k
    uint16_t *dest = (uint16_t *) _dest; \
1591
11.8k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1592
11.8k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1593
11.8k
                          alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1594
11.8k
} \
output.c:yuv2rgbx64be_X_c
Line
Count
Source
1584
8.24k
                        int y) \
1585
8.24k
{ \
1586
8.24k
    const int32_t **lumSrc  = (const int32_t **) _lumSrc, \
1587
8.24k
                  **chrUSrc = (const int32_t **) _chrUSrc, \
1588
8.24k
                  **chrVSrc = (const int32_t **) _chrVSrc, \
1589
8.24k
                  **alpSrc  = (const int32_t **) _alpSrc; \
1590
8.24k
    uint16_t *dest = (uint16_t *) _dest; \
1591
8.24k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1592
8.24k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1593
8.24k
                          alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1594
8.24k
} \
output.c:yuv2bgra64le_X_c
Line
Count
Source
1584
6.49k
                        int y) \
1585
6.49k
{ \
1586
6.49k
    const int32_t **lumSrc  = (const int32_t **) _lumSrc, \
1587
6.49k
                  **chrUSrc = (const int32_t **) _chrUSrc, \
1588
6.49k
                  **chrVSrc = (const int32_t **) _chrVSrc, \
1589
6.49k
                  **alpSrc  = (const int32_t **) _alpSrc; \
1590
6.49k
    uint16_t *dest = (uint16_t *) _dest; \
1591
6.49k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1592
6.49k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1593
6.49k
                          alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1594
6.49k
} \
output.c:yuv2bgrx64le_X_c
Line
Count
Source
1584
9.05k
                        int y) \
1585
9.05k
{ \
1586
9.05k
    const int32_t **lumSrc  = (const int32_t **) _lumSrc, \
1587
9.05k
                  **chrUSrc = (const int32_t **) _chrUSrc, \
1588
9.05k
                  **chrVSrc = (const int32_t **) _chrVSrc, \
1589
9.05k
                  **alpSrc  = (const int32_t **) _alpSrc; \
1590
9.05k
    uint16_t *dest = (uint16_t *) _dest; \
1591
9.05k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1592
9.05k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1593
9.05k
                          alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1594
9.05k
} \
output.c:yuv2bgra64be_X_c
Line
Count
Source
1584
4.12k
                        int y) \
1585
4.12k
{ \
1586
4.12k
    const int32_t **lumSrc  = (const int32_t **) _lumSrc, \
1587
4.12k
                  **chrUSrc = (const int32_t **) _chrUSrc, \
1588
4.12k
                  **chrVSrc = (const int32_t **) _chrVSrc, \
1589
4.12k
                  **alpSrc  = (const int32_t **) _alpSrc; \
1590
4.12k
    uint16_t *dest = (uint16_t *) _dest; \
1591
4.12k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1592
4.12k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1593
4.12k
                          alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1594
4.12k
} \
output.c:yuv2bgrx64be_X_c
Line
Count
Source
1584
10.9k
                        int y) \
1585
10.9k
{ \
1586
10.9k
    const int32_t **lumSrc  = (const int32_t **) _lumSrc, \
1587
10.9k
                  **chrUSrc = (const int32_t **) _chrUSrc, \
1588
10.9k
                  **chrVSrc = (const int32_t **) _chrVSrc, \
1589
10.9k
                  **alpSrc  = (const int32_t **) _alpSrc; \
1590
10.9k
    uint16_t *dest = (uint16_t *) _dest; \
1591
10.9k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1592
10.9k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1593
10.9k
                          alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1594
10.9k
} \
output.c:yuv2rgb48le_X_c
Line
Count
Source
1584
11.4k
                        int y) \
1585
11.4k
{ \
1586
11.4k
    const int32_t **lumSrc  = (const int32_t **) _lumSrc, \
1587
11.4k
                  **chrUSrc = (const int32_t **) _chrUSrc, \
1588
11.4k
                  **chrVSrc = (const int32_t **) _chrVSrc, \
1589
11.4k
                  **alpSrc  = (const int32_t **) _alpSrc; \
1590
11.4k
    uint16_t *dest = (uint16_t *) _dest; \
1591
11.4k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1592
11.4k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1593
11.4k
                          alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1594
11.4k
} \
output.c:yuv2rgb48be_X_c
Line
Count
Source
1584
4.82k
                        int y) \
1585
4.82k
{ \
1586
4.82k
    const int32_t **lumSrc  = (const int32_t **) _lumSrc, \
1587
4.82k
                  **chrUSrc = (const int32_t **) _chrUSrc, \
1588
4.82k
                  **chrVSrc = (const int32_t **) _chrVSrc, \
1589
4.82k
                  **alpSrc  = (const int32_t **) _alpSrc; \
1590
4.82k
    uint16_t *dest = (uint16_t *) _dest; \
1591
4.82k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1592
4.82k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1593
4.82k
                          alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1594
4.82k
} \
output.c:yuv2bgr48le_X_c
Line
Count
Source
1584
7.96k
                        int y) \
1585
7.96k
{ \
1586
7.96k
    const int32_t **lumSrc  = (const int32_t **) _lumSrc, \
1587
7.96k
                  **chrUSrc = (const int32_t **) _chrUSrc, \
1588
7.96k
                  **chrVSrc = (const int32_t **) _chrVSrc, \
1589
7.96k
                  **alpSrc  = (const int32_t **) _alpSrc; \
1590
7.96k
    uint16_t *dest = (uint16_t *) _dest; \
1591
7.96k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1592
7.96k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1593
7.96k
                          alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1594
7.96k
} \
output.c:yuv2bgr48be_X_c
Line
Count
Source
1584
1.65k
                        int y) \
1585
1.65k
{ \
1586
1.65k
    const int32_t **lumSrc  = (const int32_t **) _lumSrc, \
1587
1.65k
                  **chrUSrc = (const int32_t **) _chrUSrc, \
1588
1.65k
                  **chrVSrc = (const int32_t **) _chrVSrc, \
1589
1.65k
                  **alpSrc  = (const int32_t **) _alpSrc; \
1590
1.65k
    uint16_t *dest = (uint16_t *) _dest; \
1591
1.65k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1592
1.65k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1593
1.65k
                          alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1594
1.65k
} \
output.c:yuv2ya16le_X_c
Line
Count
Source
1584
31.7k
                        int y) \
1585
31.7k
{ \
1586
31.7k
    const int32_t **lumSrc  = (const int32_t **) _lumSrc, \
1587
31.7k
                  **chrUSrc = (const int32_t **) _chrUSrc, \
1588
31.7k
                  **chrVSrc = (const int32_t **) _chrVSrc, \
1589
31.7k
                  **alpSrc  = (const int32_t **) _alpSrc; \
1590
31.7k
    uint16_t *dest = (uint16_t *) _dest; \
1591
31.7k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1592
31.7k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1593
31.7k
                          alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1594
31.7k
} \
output.c:yuv2ya16be_X_c
Line
Count
Source
1584
30.7k
                        int y) \
1585
30.7k
{ \
1586
30.7k
    const int32_t **lumSrc  = (const int32_t **) _lumSrc, \
1587
30.7k
                  **chrUSrc = (const int32_t **) _chrUSrc, \
1588
30.7k
                  **chrVSrc = (const int32_t **) _chrVSrc, \
1589
30.7k
                  **alpSrc  = (const int32_t **) _alpSrc; \
1590
30.7k
    uint16_t *dest = (uint16_t *) _dest; \
1591
30.7k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1592
30.7k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1593
30.7k
                          alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \
1594
30.7k
} \
1595
 \
1596
static void name ## ext ## _2_c(SwsInternal *c, const int16_t *_buf[2], \
1597
                        const int16_t *_ubuf[2], const int16_t *_vbuf[2], \
1598
                        const int16_t *_abuf[2], uint8_t *_dest, int dstW, \
1599
403k
                        int yalpha, int uvalpha, int y) \
1600
403k
{ \
1601
403k
    const int32_t **buf  = (const int32_t **) _buf, \
1602
403k
                  **ubuf = (const int32_t **) _ubuf, \
1603
403k
                  **vbuf = (const int32_t **) _vbuf, \
1604
403k
                  **abuf = (const int32_t **) _abuf; \
1605
403k
    uint16_t *dest = (uint16_t *) _dest; \
1606
403k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1607
403k
                          dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1608
403k
} \
output.c:yuv2rgba64le_full_2_c
Line
Count
Source
1599
19.3k
                        int yalpha, int uvalpha, int y) \
1600
19.3k
{ \
1601
19.3k
    const int32_t **buf  = (const int32_t **) _buf, \
1602
19.3k
                  **ubuf = (const int32_t **) _ubuf, \
1603
19.3k
                  **vbuf = (const int32_t **) _vbuf, \
1604
19.3k
                  **abuf = (const int32_t **) _abuf; \
1605
19.3k
    uint16_t *dest = (uint16_t *) _dest; \
1606
19.3k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1607
19.3k
                          dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1608
19.3k
} \
output.c:yuv2rgbx64le_full_2_c
Line
Count
Source
1599
7.10k
                        int yalpha, int uvalpha, int y) \
1600
7.10k
{ \
1601
7.10k
    const int32_t **buf  = (const int32_t **) _buf, \
1602
7.10k
                  **ubuf = (const int32_t **) _ubuf, \
1603
7.10k
                  **vbuf = (const int32_t **) _vbuf, \
1604
7.10k
                  **abuf = (const int32_t **) _abuf; \
1605
7.10k
    uint16_t *dest = (uint16_t *) _dest; \
1606
7.10k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1607
7.10k
                          dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1608
7.10k
} \
output.c:yuv2rgba64be_full_2_c
Line
Count
Source
1599
19.1k
                        int yalpha, int uvalpha, int y) \
1600
19.1k
{ \
1601
19.1k
    const int32_t **buf  = (const int32_t **) _buf, \
1602
19.1k
                  **ubuf = (const int32_t **) _ubuf, \
1603
19.1k
                  **vbuf = (const int32_t **) _vbuf, \
1604
19.1k
                  **abuf = (const int32_t **) _abuf; \
1605
19.1k
    uint16_t *dest = (uint16_t *) _dest; \
1606
19.1k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1607
19.1k
                          dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1608
19.1k
} \
output.c:yuv2rgbx64be_full_2_c
Line
Count
Source
1599
33.6k
                        int yalpha, int uvalpha, int y) \
1600
33.6k
{ \
1601
33.6k
    const int32_t **buf  = (const int32_t **) _buf, \
1602
33.6k
                  **ubuf = (const int32_t **) _ubuf, \
1603
33.6k
                  **vbuf = (const int32_t **) _vbuf, \
1604
33.6k
                  **abuf = (const int32_t **) _abuf; \
1605
33.6k
    uint16_t *dest = (uint16_t *) _dest; \
1606
33.6k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1607
33.6k
                          dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1608
33.6k
} \
output.c:yuv2bgra64le_full_2_c
Line
Count
Source
1599
33.8k
                        int yalpha, int uvalpha, int y) \
1600
33.8k
{ \
1601
33.8k
    const int32_t **buf  = (const int32_t **) _buf, \
1602
33.8k
                  **ubuf = (const int32_t **) _ubuf, \
1603
33.8k
                  **vbuf = (const int32_t **) _vbuf, \
1604
33.8k
                  **abuf = (const int32_t **) _abuf; \
1605
33.8k
    uint16_t *dest = (uint16_t *) _dest; \
1606
33.8k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1607
33.8k
                          dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1608
33.8k
} \
output.c:yuv2bgrx64le_full_2_c
Line
Count
Source
1599
7.27k
                        int yalpha, int uvalpha, int y) \
1600
7.27k
{ \
1601
7.27k
    const int32_t **buf  = (const int32_t **) _buf, \
1602
7.27k
                  **ubuf = (const int32_t **) _ubuf, \
1603
7.27k
                  **vbuf = (const int32_t **) _vbuf, \
1604
7.27k
                  **abuf = (const int32_t **) _abuf; \
1605
7.27k
    uint16_t *dest = (uint16_t *) _dest; \
1606
7.27k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1607
7.27k
                          dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1608
7.27k
} \
output.c:yuv2bgra64be_full_2_c
Line
Count
Source
1599
16.5k
                        int yalpha, int uvalpha, int y) \
1600
16.5k
{ \
1601
16.5k
    const int32_t **buf  = (const int32_t **) _buf, \
1602
16.5k
                  **ubuf = (const int32_t **) _ubuf, \
1603
16.5k
                  **vbuf = (const int32_t **) _vbuf, \
1604
16.5k
                  **abuf = (const int32_t **) _abuf; \
1605
16.5k
    uint16_t *dest = (uint16_t *) _dest; \
1606
16.5k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1607
16.5k
                          dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1608
16.5k
} \
output.c:yuv2bgrx64be_full_2_c
Line
Count
Source
1599
23.6k
                        int yalpha, int uvalpha, int y) \
1600
23.6k
{ \
1601
23.6k
    const int32_t **buf  = (const int32_t **) _buf, \
1602
23.6k
                  **ubuf = (const int32_t **) _ubuf, \
1603
23.6k
                  **vbuf = (const int32_t **) _vbuf, \
1604
23.6k
                  **abuf = (const int32_t **) _abuf; \
1605
23.6k
    uint16_t *dest = (uint16_t *) _dest; \
1606
23.6k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1607
23.6k
                          dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1608
23.6k
} \
output.c:yuv2rgb48le_full_2_c
Line
Count
Source
1599
15.8k
                        int yalpha, int uvalpha, int y) \
1600
15.8k
{ \
1601
15.8k
    const int32_t **buf  = (const int32_t **) _buf, \
1602
15.8k
                  **ubuf = (const int32_t **) _ubuf, \
1603
15.8k
                  **vbuf = (const int32_t **) _vbuf, \
1604
15.8k
                  **abuf = (const int32_t **) _abuf; \
1605
15.8k
    uint16_t *dest = (uint16_t *) _dest; \
1606
15.8k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1607
15.8k
                          dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1608
15.8k
} \
output.c:yuv2bgr48le_full_2_c
Line
Count
Source
1599
6.74k
                        int yalpha, int uvalpha, int y) \
1600
6.74k
{ \
1601
6.74k
    const int32_t **buf  = (const int32_t **) _buf, \
1602
6.74k
                  **ubuf = (const int32_t **) _ubuf, \
1603
6.74k
                  **vbuf = (const int32_t **) _vbuf, \
1604
6.74k
                  **abuf = (const int32_t **) _abuf; \
1605
6.74k
    uint16_t *dest = (uint16_t *) _dest; \
1606
6.74k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1607
6.74k
                          dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1608
6.74k
} \
output.c:yuv2rgb48be_full_2_c
Line
Count
Source
1599
40.0k
                        int yalpha, int uvalpha, int y) \
1600
40.0k
{ \
1601
40.0k
    const int32_t **buf  = (const int32_t **) _buf, \
1602
40.0k
                  **ubuf = (const int32_t **) _ubuf, \
1603
40.0k
                  **vbuf = (const int32_t **) _vbuf, \
1604
40.0k
                  **abuf = (const int32_t **) _abuf; \
1605
40.0k
    uint16_t *dest = (uint16_t *) _dest; \
1606
40.0k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1607
40.0k
                          dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1608
40.0k
} \
output.c:yuv2bgr48be_full_2_c
Line
Count
Source
1599
35.3k
                        int yalpha, int uvalpha, int y) \
1600
35.3k
{ \
1601
35.3k
    const int32_t **buf  = (const int32_t **) _buf, \
1602
35.3k
                  **ubuf = (const int32_t **) _ubuf, \
1603
35.3k
                  **vbuf = (const int32_t **) _vbuf, \
1604
35.3k
                  **abuf = (const int32_t **) _abuf; \
1605
35.3k
    uint16_t *dest = (uint16_t *) _dest; \
1606
35.3k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1607
35.3k
                          dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1608
35.3k
} \
output.c:yuv2rgba64le_2_c
Line
Count
Source
1599
16.1k
                        int yalpha, int uvalpha, int y) \
1600
16.1k
{ \
1601
16.1k
    const int32_t **buf  = (const int32_t **) _buf, \
1602
16.1k
                  **ubuf = (const int32_t **) _ubuf, \
1603
16.1k
                  **vbuf = (const int32_t **) _vbuf, \
1604
16.1k
                  **abuf = (const int32_t **) _abuf; \
1605
16.1k
    uint16_t *dest = (uint16_t *) _dest; \
1606
16.1k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1607
16.1k
                          dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1608
16.1k
} \
output.c:yuv2rgbx64le_2_c
Line
Count
Source
1599
17.6k
                        int yalpha, int uvalpha, int y) \
1600
17.6k
{ \
1601
17.6k
    const int32_t **buf  = (const int32_t **) _buf, \
1602
17.6k
                  **ubuf = (const int32_t **) _ubuf, \
1603
17.6k
                  **vbuf = (const int32_t **) _vbuf, \
1604
17.6k
                  **abuf = (const int32_t **) _abuf; \
1605
17.6k
    uint16_t *dest = (uint16_t *) _dest; \
1606
17.6k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1607
17.6k
                          dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1608
17.6k
} \
output.c:yuv2rgba64be_2_c
Line
Count
Source
1599
19.6k
                        int yalpha, int uvalpha, int y) \
1600
19.6k
{ \
1601
19.6k
    const int32_t **buf  = (const int32_t **) _buf, \
1602
19.6k
                  **ubuf = (const int32_t **) _ubuf, \
1603
19.6k
                  **vbuf = (const int32_t **) _vbuf, \
1604
19.6k
                  **abuf = (const int32_t **) _abuf; \
1605
19.6k
    uint16_t *dest = (uint16_t *) _dest; \
1606
19.6k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1607
19.6k
                          dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1608
19.6k
} \
output.c:yuv2rgbx64be_2_c
Line
Count
Source
1599
4.86k
                        int yalpha, int uvalpha, int y) \
1600
4.86k
{ \
1601
4.86k
    const int32_t **buf  = (const int32_t **) _buf, \
1602
4.86k
                  **ubuf = (const int32_t **) _ubuf, \
1603
4.86k
                  **vbuf = (const int32_t **) _vbuf, \
1604
4.86k
                  **abuf = (const int32_t **) _abuf; \
1605
4.86k
    uint16_t *dest = (uint16_t *) _dest; \
1606
4.86k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1607
4.86k
                          dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1608
4.86k
} \
output.c:yuv2bgra64le_2_c
Line
Count
Source
1599
7.40k
                        int yalpha, int uvalpha, int y) \
1600
7.40k
{ \
1601
7.40k
    const int32_t **buf  = (const int32_t **) _buf, \
1602
7.40k
                  **ubuf = (const int32_t **) _ubuf, \
1603
7.40k
                  **vbuf = (const int32_t **) _vbuf, \
1604
7.40k
                  **abuf = (const int32_t **) _abuf; \
1605
7.40k
    uint16_t *dest = (uint16_t *) _dest; \
1606
7.40k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1607
7.40k
                          dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1608
7.40k
} \
output.c:yuv2bgrx64le_2_c
Line
Count
Source
1599
8.79k
                        int yalpha, int uvalpha, int y) \
1600
8.79k
{ \
1601
8.79k
    const int32_t **buf  = (const int32_t **) _buf, \
1602
8.79k
                  **ubuf = (const int32_t **) _ubuf, \
1603
8.79k
                  **vbuf = (const int32_t **) _vbuf, \
1604
8.79k
                  **abuf = (const int32_t **) _abuf; \
1605
8.79k
    uint16_t *dest = (uint16_t *) _dest; \
1606
8.79k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1607
8.79k
                          dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1608
8.79k
} \
output.c:yuv2bgra64be_2_c
Line
Count
Source
1599
10.9k
                        int yalpha, int uvalpha, int y) \
1600
10.9k
{ \
1601
10.9k
    const int32_t **buf  = (const int32_t **) _buf, \
1602
10.9k
                  **ubuf = (const int32_t **) _ubuf, \
1603
10.9k
                  **vbuf = (const int32_t **) _vbuf, \
1604
10.9k
                  **abuf = (const int32_t **) _abuf; \
1605
10.9k
    uint16_t *dest = (uint16_t *) _dest; \
1606
10.9k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1607
10.9k
                          dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1608
10.9k
} \
output.c:yuv2bgrx64be_2_c
Line
Count
Source
1599
4.93k
                        int yalpha, int uvalpha, int y) \
1600
4.93k
{ \
1601
4.93k
    const int32_t **buf  = (const int32_t **) _buf, \
1602
4.93k
                  **ubuf = (const int32_t **) _ubuf, \
1603
4.93k
                  **vbuf = (const int32_t **) _vbuf, \
1604
4.93k
                  **abuf = (const int32_t **) _abuf; \
1605
4.93k
    uint16_t *dest = (uint16_t *) _dest; \
1606
4.93k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1607
4.93k
                          dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1608
4.93k
} \
output.c:yuv2rgb48le_2_c
Line
Count
Source
1599
14.3k
                        int yalpha, int uvalpha, int y) \
1600
14.3k
{ \
1601
14.3k
    const int32_t **buf  = (const int32_t **) _buf, \
1602
14.3k
                  **ubuf = (const int32_t **) _ubuf, \
1603
14.3k
                  **vbuf = (const int32_t **) _vbuf, \
1604
14.3k
                  **abuf = (const int32_t **) _abuf; \
1605
14.3k
    uint16_t *dest = (uint16_t *) _dest; \
1606
14.3k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1607
14.3k
                          dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1608
14.3k
} \
output.c:yuv2rgb48be_2_c
Line
Count
Source
1599
8.94k
                        int yalpha, int uvalpha, int y) \
1600
8.94k
{ \
1601
8.94k
    const int32_t **buf  = (const int32_t **) _buf, \
1602
8.94k
                  **ubuf = (const int32_t **) _ubuf, \
1603
8.94k
                  **vbuf = (const int32_t **) _vbuf, \
1604
8.94k
                  **abuf = (const int32_t **) _abuf; \
1605
8.94k
    uint16_t *dest = (uint16_t *) _dest; \
1606
8.94k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1607
8.94k
                          dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1608
8.94k
} \
output.c:yuv2bgr48le_2_c
Line
Count
Source
1599
4.37k
                        int yalpha, int uvalpha, int y) \
1600
4.37k
{ \
1601
4.37k
    const int32_t **buf  = (const int32_t **) _buf, \
1602
4.37k
                  **ubuf = (const int32_t **) _ubuf, \
1603
4.37k
                  **vbuf = (const int32_t **) _vbuf, \
1604
4.37k
                  **abuf = (const int32_t **) _abuf; \
1605
4.37k
    uint16_t *dest = (uint16_t *) _dest; \
1606
4.37k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1607
4.37k
                          dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1608
4.37k
} \
output.c:yuv2bgr48be_2_c
Line
Count
Source
1599
6.93k
                        int yalpha, int uvalpha, int y) \
1600
6.93k
{ \
1601
6.93k
    const int32_t **buf  = (const int32_t **) _buf, \
1602
6.93k
                  **ubuf = (const int32_t **) _ubuf, \
1603
6.93k
                  **vbuf = (const int32_t **) _vbuf, \
1604
6.93k
                  **abuf = (const int32_t **) _abuf; \
1605
6.93k
    uint16_t *dest = (uint16_t *) _dest; \
1606
6.93k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1607
6.93k
                          dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1608
6.93k
} \
output.c:yuv2ya16le_2_c
Line
Count
Source
1599
10.0k
                        int yalpha, int uvalpha, int y) \
1600
10.0k
{ \
1601
10.0k
    const int32_t **buf  = (const int32_t **) _buf, \
1602
10.0k
                  **ubuf = (const int32_t **) _ubuf, \
1603
10.0k
                  **vbuf = (const int32_t **) _vbuf, \
1604
10.0k
                  **abuf = (const int32_t **) _abuf; \
1605
10.0k
    uint16_t *dest = (uint16_t *) _dest; \
1606
10.0k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1607
10.0k
                          dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1608
10.0k
} \
output.c:yuv2ya16be_2_c
Line
Count
Source
1599
9.49k
                        int yalpha, int uvalpha, int y) \
1600
9.49k
{ \
1601
9.49k
    const int32_t **buf  = (const int32_t **) _buf, \
1602
9.49k
                  **ubuf = (const int32_t **) _ubuf, \
1603
9.49k
                  **vbuf = (const int32_t **) _vbuf, \
1604
9.49k
                  **abuf = (const int32_t **) _abuf; \
1605
9.49k
    uint16_t *dest = (uint16_t *) _dest; \
1606
9.49k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1607
9.49k
                          dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1608
9.49k
} \
1609
 \
1610
static void name ## ext ## _1_c(SwsInternal *c, const int16_t *_buf0, \
1611
                        const int16_t *_ubuf[2], const int16_t *_vbuf[2], \
1612
                        const int16_t *_abuf0, uint8_t *_dest, int dstW, \
1613
181k
                        int uvalpha, int y) \
1614
181k
{ \
1615
181k
    const int32_t *buf0  = (const int32_t *)  _buf0, \
1616
181k
                 **ubuf  = (const int32_t **) _ubuf, \
1617
181k
                 **vbuf  = (const int32_t **) _vbuf, \
1618
181k
                  *abuf0 = (const int32_t *)  _abuf0; \
1619
181k
    uint16_t *dest = (uint16_t *) _dest; \
1620
181k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1621
181k
                                  dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1622
181k
}
output.c:yuv2rgba64le_full_1_c
Line
Count
Source
1613
6.43k
                        int uvalpha, int y) \
1614
6.43k
{ \
1615
6.43k
    const int32_t *buf0  = (const int32_t *)  _buf0, \
1616
6.43k
                 **ubuf  = (const int32_t **) _ubuf, \
1617
6.43k
                 **vbuf  = (const int32_t **) _vbuf, \
1618
6.43k
                  *abuf0 = (const int32_t *)  _abuf0; \
1619
6.43k
    uint16_t *dest = (uint16_t *) _dest; \
1620
6.43k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1621
6.43k
                                  dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1622
6.43k
}
output.c:yuv2rgbx64le_full_1_c
Line
Count
Source
1613
3.13k
                        int uvalpha, int y) \
1614
3.13k
{ \
1615
3.13k
    const int32_t *buf0  = (const int32_t *)  _buf0, \
1616
3.13k
                 **ubuf  = (const int32_t **) _ubuf, \
1617
3.13k
                 **vbuf  = (const int32_t **) _vbuf, \
1618
3.13k
                  *abuf0 = (const int32_t *)  _abuf0; \
1619
3.13k
    uint16_t *dest = (uint16_t *) _dest; \
1620
3.13k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1621
3.13k
                                  dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1622
3.13k
}
output.c:yuv2rgba64be_full_1_c
Line
Count
Source
1613
24.6k
                        int uvalpha, int y) \
1614
24.6k
{ \
1615
24.6k
    const int32_t *buf0  = (const int32_t *)  _buf0, \
1616
24.6k
                 **ubuf  = (const int32_t **) _ubuf, \
1617
24.6k
                 **vbuf  = (const int32_t **) _vbuf, \
1618
24.6k
                  *abuf0 = (const int32_t *)  _abuf0; \
1619
24.6k
    uint16_t *dest = (uint16_t *) _dest; \
1620
24.6k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1621
24.6k
                                  dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1622
24.6k
}
output.c:yuv2rgbx64be_full_1_c
Line
Count
Source
1613
17.0k
                        int uvalpha, int y) \
1614
17.0k
{ \
1615
17.0k
    const int32_t *buf0  = (const int32_t *)  _buf0, \
1616
17.0k
                 **ubuf  = (const int32_t **) _ubuf, \
1617
17.0k
                 **vbuf  = (const int32_t **) _vbuf, \
1618
17.0k
                  *abuf0 = (const int32_t *)  _abuf0; \
1619
17.0k
    uint16_t *dest = (uint16_t *) _dest; \
1620
17.0k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1621
17.0k
                                  dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1622
17.0k
}
output.c:yuv2bgra64le_full_1_c
Line
Count
Source
1613
11.9k
                        int uvalpha, int y) \
1614
11.9k
{ \
1615
11.9k
    const int32_t *buf0  = (const int32_t *)  _buf0, \
1616
11.9k
                 **ubuf  = (const int32_t **) _ubuf, \
1617
11.9k
                 **vbuf  = (const int32_t **) _vbuf, \
1618
11.9k
                  *abuf0 = (const int32_t *)  _abuf0; \
1619
11.9k
    uint16_t *dest = (uint16_t *) _dest; \
1620
11.9k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1621
11.9k
                                  dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1622
11.9k
}
output.c:yuv2bgrx64le_full_1_c
Line
Count
Source
1613
8.18k
                        int uvalpha, int y) \
1614
8.18k
{ \
1615
8.18k
    const int32_t *buf0  = (const int32_t *)  _buf0, \
1616
8.18k
                 **ubuf  = (const int32_t **) _ubuf, \
1617
8.18k
                 **vbuf  = (const int32_t **) _vbuf, \
1618
8.18k
                  *abuf0 = (const int32_t *)  _abuf0; \
1619
8.18k
    uint16_t *dest = (uint16_t *) _dest; \
1620
8.18k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1621
8.18k
                                  dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1622
8.18k
}
output.c:yuv2bgra64be_full_1_c
Line
Count
Source
1613
6.76k
                        int uvalpha, int y) \
1614
6.76k
{ \
1615
6.76k
    const int32_t *buf0  = (const int32_t *)  _buf0, \
1616
6.76k
                 **ubuf  = (const int32_t **) _ubuf, \
1617
6.76k
                 **vbuf  = (const int32_t **) _vbuf, \
1618
6.76k
                  *abuf0 = (const int32_t *)  _abuf0; \
1619
6.76k
    uint16_t *dest = (uint16_t *) _dest; \
1620
6.76k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1621
6.76k
                                  dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1622
6.76k
}
output.c:yuv2bgrx64be_full_1_c
Line
Count
Source
1613
1.29k
                        int uvalpha, int y) \
1614
1.29k
{ \
1615
1.29k
    const int32_t *buf0  = (const int32_t *)  _buf0, \
1616
1.29k
                 **ubuf  = (const int32_t **) _ubuf, \
1617
1.29k
                 **vbuf  = (const int32_t **) _vbuf, \
1618
1.29k
                  *abuf0 = (const int32_t *)  _abuf0; \
1619
1.29k
    uint16_t *dest = (uint16_t *) _dest; \
1620
1.29k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1621
1.29k
                                  dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1622
1.29k
}
output.c:yuv2rgb48le_full_1_c
Line
Count
Source
1613
13.2k
                        int uvalpha, int y) \
1614
13.2k
{ \
1615
13.2k
    const int32_t *buf0  = (const int32_t *)  _buf0, \
1616
13.2k
                 **ubuf  = (const int32_t **) _ubuf, \
1617
13.2k
                 **vbuf  = (const int32_t **) _vbuf, \
1618
13.2k
                  *abuf0 = (const int32_t *)  _abuf0; \
1619
13.2k
    uint16_t *dest = (uint16_t *) _dest; \
1620
13.2k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1621
13.2k
                                  dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1622
13.2k
}
output.c:yuv2bgr48le_full_1_c
Line
Count
Source
1613
5.49k
                        int uvalpha, int y) \
1614
5.49k
{ \
1615
5.49k
    const int32_t *buf0  = (const int32_t *)  _buf0, \
1616
5.49k
                 **ubuf  = (const int32_t **) _ubuf, \
1617
5.49k
                 **vbuf  = (const int32_t **) _vbuf, \
1618
5.49k
                  *abuf0 = (const int32_t *)  _abuf0; \
1619
5.49k
    uint16_t *dest = (uint16_t *) _dest; \
1620
5.49k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1621
5.49k
                                  dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1622
5.49k
}
output.c:yuv2rgb48be_full_1_c
Line
Count
Source
1613
10.0k
                        int uvalpha, int y) \
1614
10.0k
{ \
1615
10.0k
    const int32_t *buf0  = (const int32_t *)  _buf0, \
1616
10.0k
                 **ubuf  = (const int32_t **) _ubuf, \
1617
10.0k
                 **vbuf  = (const int32_t **) _vbuf, \
1618
10.0k
                  *abuf0 = (const int32_t *)  _abuf0; \
1619
10.0k
    uint16_t *dest = (uint16_t *) _dest; \
1620
10.0k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1621
10.0k
                                  dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1622
10.0k
}
output.c:yuv2bgr48be_full_1_c
Line
Count
Source
1613
13.4k
                        int uvalpha, int y) \
1614
13.4k
{ \
1615
13.4k
    const int32_t *buf0  = (const int32_t *)  _buf0, \
1616
13.4k
                 **ubuf  = (const int32_t **) _ubuf, \
1617
13.4k
                 **vbuf  = (const int32_t **) _vbuf, \
1618
13.4k
                  *abuf0 = (const int32_t *)  _abuf0; \
1619
13.4k
    uint16_t *dest = (uint16_t *) _dest; \
1620
13.4k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1621
13.4k
                                  dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1622
13.4k
}
output.c:yuv2rgba64le_1_c
Line
Count
Source
1613
3.31k
                        int uvalpha, int y) \
1614
3.31k
{ \
1615
3.31k
    const int32_t *buf0  = (const int32_t *)  _buf0, \
1616
3.31k
                 **ubuf  = (const int32_t **) _ubuf, \
1617
3.31k
                 **vbuf  = (const int32_t **) _vbuf, \
1618
3.31k
                  *abuf0 = (const int32_t *)  _abuf0; \
1619
3.31k
    uint16_t *dest = (uint16_t *) _dest; \
1620
3.31k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1621
3.31k
                                  dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1622
3.31k
}
output.c:yuv2rgbx64le_1_c
Line
Count
Source
1613
5.16k
                        int uvalpha, int y) \
1614
5.16k
{ \
1615
5.16k
    const int32_t *buf0  = (const int32_t *)  _buf0, \
1616
5.16k
                 **ubuf  = (const int32_t **) _ubuf, \
1617
5.16k
                 **vbuf  = (const int32_t **) _vbuf, \
1618
5.16k
                  *abuf0 = (const int32_t *)  _abuf0; \
1619
5.16k
    uint16_t *dest = (uint16_t *) _dest; \
1620
5.16k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1621
5.16k
                                  dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1622
5.16k
}
output.c:yuv2rgba64be_1_c
Line
Count
Source
1613
3.23k
                        int uvalpha, int y) \
1614
3.23k
{ \
1615
3.23k
    const int32_t *buf0  = (const int32_t *)  _buf0, \
1616
3.23k
                 **ubuf  = (const int32_t **) _ubuf, \
1617
3.23k
                 **vbuf  = (const int32_t **) _vbuf, \
1618
3.23k
                  *abuf0 = (const int32_t *)  _abuf0; \
1619
3.23k
    uint16_t *dest = (uint16_t *) _dest; \
1620
3.23k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1621
3.23k
                                  dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1622
3.23k
}
output.c:yuv2rgbx64be_1_c
Line
Count
Source
1613
3.55k
                        int uvalpha, int y) \
1614
3.55k
{ \
1615
3.55k
    const int32_t *buf0  = (const int32_t *)  _buf0, \
1616
3.55k
                 **ubuf  = (const int32_t **) _ubuf, \
1617
3.55k
                 **vbuf  = (const int32_t **) _vbuf, \
1618
3.55k
                  *abuf0 = (const int32_t *)  _abuf0; \
1619
3.55k
    uint16_t *dest = (uint16_t *) _dest; \
1620
3.55k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1621
3.55k
                                  dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1622
3.55k
}
output.c:yuv2bgra64le_1_c
Line
Count
Source
1613
2.84k
                        int uvalpha, int y) \
1614
2.84k
{ \
1615
2.84k
    const int32_t *buf0  = (const int32_t *)  _buf0, \
1616
2.84k
                 **ubuf  = (const int32_t **) _ubuf, \
1617
2.84k
                 **vbuf  = (const int32_t **) _vbuf, \
1618
2.84k
                  *abuf0 = (const int32_t *)  _abuf0; \
1619
2.84k
    uint16_t *dest = (uint16_t *) _dest; \
1620
2.84k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1621
2.84k
                                  dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1622
2.84k
}
output.c:yuv2bgrx64le_1_c
Line
Count
Source
1613
2.77k
                        int uvalpha, int y) \
1614
2.77k
{ \
1615
2.77k
    const int32_t *buf0  = (const int32_t *)  _buf0, \
1616
2.77k
                 **ubuf  = (const int32_t **) _ubuf, \
1617
2.77k
                 **vbuf  = (const int32_t **) _vbuf, \
1618
2.77k
                  *abuf0 = (const int32_t *)  _abuf0; \
1619
2.77k
    uint16_t *dest = (uint16_t *) _dest; \
1620
2.77k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1621
2.77k
                                  dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1622
2.77k
}
output.c:yuv2bgra64be_1_c
Line
Count
Source
1613
9.50k
                        int uvalpha, int y) \
1614
9.50k
{ \
1615
9.50k
    const int32_t *buf0  = (const int32_t *)  _buf0, \
1616
9.50k
                 **ubuf  = (const int32_t **) _ubuf, \
1617
9.50k
                 **vbuf  = (const int32_t **) _vbuf, \
1618
9.50k
                  *abuf0 = (const int32_t *)  _abuf0; \
1619
9.50k
    uint16_t *dest = (uint16_t *) _dest; \
1620
9.50k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1621
9.50k
                                  dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1622
9.50k
}
output.c:yuv2bgrx64be_1_c
Line
Count
Source
1613
1.29k
                        int uvalpha, int y) \
1614
1.29k
{ \
1615
1.29k
    const int32_t *buf0  = (const int32_t *)  _buf0, \
1616
1.29k
                 **ubuf  = (const int32_t **) _ubuf, \
1617
1.29k
                 **vbuf  = (const int32_t **) _vbuf, \
1618
1.29k
                  *abuf0 = (const int32_t *)  _abuf0; \
1619
1.29k
    uint16_t *dest = (uint16_t *) _dest; \
1620
1.29k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1621
1.29k
                                  dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1622
1.29k
}
output.c:yuv2rgb48le_1_c
Line
Count
Source
1613
4.04k
                        int uvalpha, int y) \
1614
4.04k
{ \
1615
4.04k
    const int32_t *buf0  = (const int32_t *)  _buf0, \
1616
4.04k
                 **ubuf  = (const int32_t **) _ubuf, \
1617
4.04k
                 **vbuf  = (const int32_t **) _vbuf, \
1618
4.04k
                  *abuf0 = (const int32_t *)  _abuf0; \
1619
4.04k
    uint16_t *dest = (uint16_t *) _dest; \
1620
4.04k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1621
4.04k
                                  dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1622
4.04k
}
output.c:yuv2rgb48be_1_c
Line
Count
Source
1613
5.09k
                        int uvalpha, int y) \
1614
5.09k
{ \
1615
5.09k
    const int32_t *buf0  = (const int32_t *)  _buf0, \
1616
5.09k
                 **ubuf  = (const int32_t **) _ubuf, \
1617
5.09k
                 **vbuf  = (const int32_t **) _vbuf, \
1618
5.09k
                  *abuf0 = (const int32_t *)  _abuf0; \
1619
5.09k
    uint16_t *dest = (uint16_t *) _dest; \
1620
5.09k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1621
5.09k
                                  dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1622
5.09k
}
output.c:yuv2bgr48le_1_c
Line
Count
Source
1613
1.92k
                        int uvalpha, int y) \
1614
1.92k
{ \
1615
1.92k
    const int32_t *buf0  = (const int32_t *)  _buf0, \
1616
1.92k
                 **ubuf  = (const int32_t **) _ubuf, \
1617
1.92k
                 **vbuf  = (const int32_t **) _vbuf, \
1618
1.92k
                  *abuf0 = (const int32_t *)  _abuf0; \
1619
1.92k
    uint16_t *dest = (uint16_t *) _dest; \
1620
1.92k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1621
1.92k
                                  dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1622
1.92k
}
output.c:yuv2bgr48be_1_c
Line
Count
Source
1613
4.89k
                        int uvalpha, int y) \
1614
4.89k
{ \
1615
4.89k
    const int32_t *buf0  = (const int32_t *)  _buf0, \
1616
4.89k
                 **ubuf  = (const int32_t **) _ubuf, \
1617
4.89k
                 **vbuf  = (const int32_t **) _vbuf, \
1618
4.89k
                  *abuf0 = (const int32_t *)  _abuf0; \
1619
4.89k
    uint16_t *dest = (uint16_t *) _dest; \
1620
4.89k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1621
4.89k
                                  dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1622
4.89k
}
output.c:yuv2ya16le_1_c
Line
Count
Source
1613
4.20k
                        int uvalpha, int y) \
1614
4.20k
{ \
1615
4.20k
    const int32_t *buf0  = (const int32_t *)  _buf0, \
1616
4.20k
                 **ubuf  = (const int32_t **) _ubuf, \
1617
4.20k
                 **vbuf  = (const int32_t **) _vbuf, \
1618
4.20k
                  *abuf0 = (const int32_t *)  _abuf0; \
1619
4.20k
    uint16_t *dest = (uint16_t *) _dest; \
1620
4.20k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1621
4.20k
                                  dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1622
4.20k
}
output.c:yuv2ya16be_1_c
Line
Count
Source
1613
8.31k
                        int uvalpha, int y) \
1614
8.31k
{ \
1615
8.31k
    const int32_t *buf0  = (const int32_t *)  _buf0, \
1616
8.31k
                 **ubuf  = (const int32_t **) _ubuf, \
1617
8.31k
                 **vbuf  = (const int32_t **) _vbuf, \
1618
8.31k
                  *abuf0 = (const int32_t *)  _abuf0; \
1619
8.31k
    uint16_t *dest = (uint16_t *) _dest; \
1620
8.31k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1621
8.31k
                                  dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \
1622
8.31k
}
1623
#define YUV2PACKED16WRAPPER(name, base, ext, base_fmt, endianness, hasAlpha, eightbytes) \
1624
    YUV2PACKED16WRAPPER_EXT(name, base, ext, base_fmt ## endianness, IS_BE(endianness), hasAlpha, eightbytes)
1625
1626
YUV2PACKED16WRAPPER(yuv2, rgba64, rgb48be, AV_PIX_FMT_RGB48, BE, 0, 0)
1627
YUV2PACKED16WRAPPER(yuv2, rgba64, rgb48le, AV_PIX_FMT_RGB48, LE, 0, 0)
1628
YUV2PACKED16WRAPPER(yuv2, rgba64, bgr48be, AV_PIX_FMT_BGR48, BE, 0, 0)
1629
YUV2PACKED16WRAPPER(yuv2, rgba64, bgr48le, AV_PIX_FMT_BGR48, LE, 0, 0)
1630
YUV2PACKED16WRAPPER(yuv2, rgba64, rgba64be, AV_PIX_FMT_RGBA64, BE, 1, 1)
1631
YUV2PACKED16WRAPPER(yuv2, rgba64, rgba64le, AV_PIX_FMT_RGBA64, LE, 1, 1)
1632
YUV2PACKED16WRAPPER(yuv2, rgba64, rgbx64be, AV_PIX_FMT_RGBA64, BE, 0, 1)
1633
YUV2PACKED16WRAPPER(yuv2, rgba64, rgbx64le, AV_PIX_FMT_RGBA64, LE, 0, 1)
1634
YUV2PACKED16WRAPPER(yuv2, rgba64, bgra64be, AV_PIX_FMT_BGRA64, BE, 1, 1)
1635
YUV2PACKED16WRAPPER(yuv2, rgba64, bgra64le, AV_PIX_FMT_BGRA64, LE, 1, 1)
1636
YUV2PACKED16WRAPPER(yuv2, rgba64, bgrx64be, AV_PIX_FMT_BGRA64, BE, 0, 1)
1637
YUV2PACKED16WRAPPER(yuv2, rgba64, bgrx64le, AV_PIX_FMT_BGRA64, LE, 0, 1)
1638
YUV2PACKED16WRAPPER(yuv2, ya16, ya16be, AV_PIX_FMT_YA16, BE, 1, 0)
1639
YUV2PACKED16WRAPPER(yuv2, ya16, ya16le, AV_PIX_FMT_YA16, LE, 1, 0)
1640
1641
YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgb48be_full, AV_PIX_FMT_RGB48, BE, 0, 0)
1642
YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgb48le_full, AV_PIX_FMT_RGB48, LE, 0, 0)
1643
YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgr48be_full, AV_PIX_FMT_BGR48, BE, 0, 0)
1644
YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgr48le_full, AV_PIX_FMT_BGR48, LE, 0, 0)
1645
YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgba64be_full, AV_PIX_FMT_RGBA64, BE, 1, 1)
1646
YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgba64le_full, AV_PIX_FMT_RGBA64, LE, 1, 1)
1647
YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgbx64be_full, AV_PIX_FMT_RGBA64, BE, 0, 1)
1648
YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgbx64le_full, AV_PIX_FMT_RGBA64, LE, 0, 1)
1649
YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgra64be_full, AV_PIX_FMT_BGRA64, BE, 1, 1)
1650
YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgra64le_full, AV_PIX_FMT_BGRA64, LE, 1, 1)
1651
YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgrx64be_full, AV_PIX_FMT_BGRA64, BE, 0, 1)
1652
YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgrx64le_full, AV_PIX_FMT_BGRA64, LE, 0, 1)
1653
1654
/*
1655
 * Write out 2 RGB pixels in the target pixel format. This function takes a
1656
 * R/G/B LUT as generated by ff_yuv2rgb_c_init_tables(), which takes care of
1657
 * things like endianness conversion and shifting. The caller takes care of
1658
 * setting the correct offset in these tables from the chroma (U/V) values.
1659
 * This function then uses the luminance (Y1/Y2) values to write out the
1660
 * correct RGB values into the destination buffer.
1661
 */
1662
static av_always_inline void
1663
yuv2rgb_write(uint8_t *_dest, int i, int Y1, int Y2,
1664
              unsigned A1, unsigned A2,
1665
              const void *_r, const void *_g, const void *_b, int y,
1666
              enum AVPixelFormat target, int hasAlpha)
1667
1.28M
{
1668
1.28M
    if (target == AV_PIX_FMT_ARGB || target == AV_PIX_FMT_RGBA ||
1669
1.28M
        target == AV_PIX_FMT_ABGR || target == AV_PIX_FMT_BGRA) {
1670
489k
        uint32_t *dest = (uint32_t *) _dest;
1671
489k
        const uint32_t *r = (const uint32_t *) _r;
1672
489k
        const uint32_t *g = (const uint32_t *) _g;
1673
489k
        const uint32_t *b = (const uint32_t *) _b;
1674
1675
#if CONFIG_SMALL
1676
        int sh = hasAlpha ? ((target == AV_PIX_FMT_RGB32_1 || target == AV_PIX_FMT_BGR32_1) ? 0 : 24) : 0;
1677
1678
        dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (hasAlpha ? A1 << sh : 0);
1679
        dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (hasAlpha ? A2 << sh : 0);
1680
#else
1681
489k
        if (hasAlpha) {
1682
400k
            int sh = (target == AV_PIX_FMT_RGB32_1 || target == AV_PIX_FMT_BGR32_1) ? 0 : 24;
1683
1684
400k
            av_assert2((((r[Y1] + g[Y1] + b[Y1]) >> sh) & 0xFF) == 0);
1685
400k
            dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (A1 << sh);
1686
400k
            dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (A2 << sh);
1687
400k
        } else {
1688
#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1
1689
            int sh = (target == AV_PIX_FMT_RGB32_1 || target == AV_PIX_FMT_BGR32_1) ? 0 : 24;
1690
1691
            av_assert2((((r[Y1] + g[Y1] + b[Y1]) >> sh) & 0xFF) == 0xFF);
1692
#endif
1693
88.6k
            dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1];
1694
88.6k
            dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2];
1695
88.6k
        }
1696
489k
#endif
1697
792k
    } else if (target == AV_PIX_FMT_RGB24 || target == AV_PIX_FMT_BGR24) {
1698
149k
        uint8_t *dest = (uint8_t *) _dest;
1699
149k
        const uint8_t *r = (const uint8_t *) _r;
1700
149k
        const uint8_t *g = (const uint8_t *) _g;
1701
149k
        const uint8_t *b = (const uint8_t *) _b;
1702
1703
299k
#define r_b ((target == AV_PIX_FMT_RGB24) ? r : b)
1704
299k
#define b_r ((target == AV_PIX_FMT_RGB24) ? b : r)
1705
1706
149k
        dest[i * 6 + 0] = r_b[Y1];
1707
149k
        dest[i * 6 + 1] =   g[Y1];
1708
149k
        dest[i * 6 + 2] = b_r[Y1];
1709
149k
        dest[i * 6 + 3] = r_b[Y2];
1710
149k
        dest[i * 6 + 4] =   g[Y2];
1711
149k
        dest[i * 6 + 5] = b_r[Y2];
1712
149k
#undef r_b
1713
149k
#undef b_r
1714
643k
    } else if (target == AV_PIX_FMT_RGB565 || target == AV_PIX_FMT_BGR565 ||
1715
643k
               target == AV_PIX_FMT_RGB555 || target == AV_PIX_FMT_BGR555 ||
1716
643k
               target == AV_PIX_FMT_RGB444 || target == AV_PIX_FMT_BGR444) {
1717
290k
        uint16_t *dest = (uint16_t *) _dest;
1718
290k
        const uint16_t *r = (const uint16_t *) _r;
1719
290k
        const uint16_t *g = (const uint16_t *) _g;
1720
290k
        const uint16_t *b = (const uint16_t *) _b;
1721
290k
        int dr1, dg1, db1, dr2, dg2, db2;
1722
1723
290k
        if (target == AV_PIX_FMT_RGB565 || target == AV_PIX_FMT_BGR565) {
1724
110k
            dr1 = ff_dither_2x2_8[ y & 1     ][0];
1725
110k
            dg1 = ff_dither_2x2_4[ y & 1     ][0];
1726
110k
            db1 = ff_dither_2x2_8[(y & 1) ^ 1][0];
1727
110k
            dr2 = ff_dither_2x2_8[ y & 1     ][1];
1728
110k
            dg2 = ff_dither_2x2_4[ y & 1     ][1];
1729
110k
            db2 = ff_dither_2x2_8[(y & 1) ^ 1][1];
1730
180k
        } else if (target == AV_PIX_FMT_RGB555 || target == AV_PIX_FMT_BGR555) {
1731
93.4k
            dr1 = ff_dither_2x2_8[ y & 1     ][0];
1732
93.4k
            dg1 = ff_dither_2x2_8[ y & 1     ][1];
1733
93.4k
            db1 = ff_dither_2x2_8[(y & 1) ^ 1][0];
1734
93.4k
            dr2 = ff_dither_2x2_8[ y & 1     ][1];
1735
93.4k
            dg2 = ff_dither_2x2_8[ y & 1     ][0];
1736
93.4k
            db2 = ff_dither_2x2_8[(y & 1) ^ 1][1];
1737
93.4k
        } else {
1738
87.1k
            dr1 = ff_dither_4x4_16[ y & 3     ][0];
1739
87.1k
            dg1 = ff_dither_4x4_16[ y & 3     ][1];
1740
87.1k
            db1 = ff_dither_4x4_16[(y & 3) ^ 3][0];
1741
87.1k
            dr2 = ff_dither_4x4_16[ y & 3     ][1];
1742
87.1k
            dg2 = ff_dither_4x4_16[ y & 3     ][0];
1743
87.1k
            db2 = ff_dither_4x4_16[(y & 3) ^ 3][1];
1744
87.1k
        }
1745
1746
290k
        dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1];
1747
290k
        dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2];
1748
352k
    } else if (target == AV_PIX_FMT_X2RGB10 || target == AV_PIX_FMT_X2BGR10) {
1749
144k
        uint32_t *dest = (uint32_t *) _dest;
1750
144k
        const uint32_t *r = (const uint32_t *) _r;
1751
144k
        const uint32_t *g = (const uint32_t *) _g;
1752
144k
        const uint32_t *b = (const uint32_t *) _b;
1753
144k
        dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1];
1754
144k
        dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2];
1755
207k
    } else /* 8/4 bits */ {
1756
207k
        uint8_t *dest = (uint8_t *) _dest;
1757
207k
        const uint8_t *r = (const uint8_t *) _r;
1758
207k
        const uint8_t *g = (const uint8_t *) _g;
1759
207k
        const uint8_t *b = (const uint8_t *) _b;
1760
207k
        int dr1, dg1, db1, dr2, dg2, db2;
1761
1762
207k
        if (target == AV_PIX_FMT_RGB8 || target == AV_PIX_FMT_BGR8) {
1763
62.1k
            const uint8_t * const d64 = ff_dither_8x8_73[y & 7];
1764
62.1k
            const uint8_t * const d32 = ff_dither_8x8_32[y & 7];
1765
62.1k
            dr1 = dg1 = d32[(i * 2 + 0) & 7];
1766
62.1k
            db1 =       d64[(i * 2 + 0) & 7];
1767
62.1k
            dr2 = dg2 = d32[(i * 2 + 1) & 7];
1768
62.1k
            db2 =       d64[(i * 2 + 1) & 7];
1769
145k
        } else {
1770
145k
            const uint8_t * const d64  = ff_dither_8x8_73 [y & 7];
1771
145k
            const uint8_t * const d128 = ff_dither_8x8_220[y & 7];
1772
145k
            dr1 = db1 = d128[(i * 2 + 0) & 7];
1773
145k
            dg1 =        d64[(i * 2 + 0) & 7];
1774
145k
            dr2 = db2 = d128[(i * 2 + 1) & 7];
1775
145k
            dg2 =        d64[(i * 2 + 1) & 7];
1776
145k
        }
1777
1778
207k
        if (target == AV_PIX_FMT_RGB4 || target == AV_PIX_FMT_BGR4) {
1779
65.8k
            dest[i] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1] +
1780
65.8k
                    ((r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]) << 4);
1781
141k
        } else {
1782
141k
            dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1];
1783
141k
            dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2];
1784
141k
        }
1785
207k
    }
1786
1.28M
}
1787
1788
static av_always_inline void
1789
yuv2rgb_X_c_template(SwsInternal *c, const int16_t *lumFilter,
1790
                     const int16_t **lumSrc, int lumFilterSize,
1791
                     const int16_t *chrFilter, const int16_t **chrUSrc,
1792
                     const int16_t **chrVSrc, int chrFilterSize,
1793
                     const int16_t **alpSrc, uint8_t *dest, int dstW,
1794
                     int y, enum AVPixelFormat target, int hasAlpha)
1795
78.0k
{
1796
78.0k
    int i;
1797
1798
463k
    for (i = 0; i < ((dstW + 1) >> 1); i++) {
1799
385k
        int j, A1, A2;
1800
385k
        int Y1 = 1 << 18;
1801
385k
        int Y2 = 1 << 18;
1802
385k
        int U  = 1 << 18;
1803
385k
        int V  = 1 << 18;
1804
385k
        const void *r, *g, *b;
1805
1806
5.49M
        for (j = 0; j < lumFilterSize; j++) {
1807
5.10M
            Y1 += lumSrc[j][i * 2]     * (unsigned)lumFilter[j];
1808
5.10M
            Y2 += lumSrc[j][i * 2 + 1] * (unsigned)lumFilter[j];
1809
5.10M
        }
1810
3.84M
        for (j = 0; j < chrFilterSize; j++) {
1811
3.46M
            U += chrUSrc[j][i] * (unsigned)chrFilter[j];
1812
3.46M
            V += chrVSrc[j][i] * (unsigned)chrFilter[j];
1813
3.46M
        }
1814
385k
        Y1 >>= 19;
1815
385k
        Y2 >>= 19;
1816
385k
        U  >>= 19;
1817
385k
        V  >>= 19;
1818
385k
        if (hasAlpha) {
1819
181k
            A1 = 1 << 18;
1820
181k
            A2 = 1 << 18;
1821
1.41M
            for (j = 0; j < lumFilterSize; j++) {
1822
1.23M
                A1 += alpSrc[j][i * 2    ] * (unsigned)lumFilter[j];
1823
1.23M
                A2 += alpSrc[j][i * 2 + 1] * (unsigned)lumFilter[j];
1824
1.23M
            }
1825
181k
            A1 >>= 19;
1826
181k
            A2 >>= 19;
1827
181k
            if ((A1 | A2) & 0x100) {
1828
33.6k
                A1 = av_clip_uint8(A1);
1829
33.6k
                A2 = av_clip_uint8(A2);
1830
33.6k
            }
1831
181k
        }
1832
1833
385k
        r =  c->table_rV[V + YUVRGB_TABLE_HEADROOM];
1834
385k
        g = (c->table_gU[U + YUVRGB_TABLE_HEADROOM] + c->table_gV[V + YUVRGB_TABLE_HEADROOM]);
1835
385k
        b =  c->table_bU[U + YUVRGB_TABLE_HEADROOM];
1836
1837
385k
        yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0,
1838
385k
                      r, g, b, y, target, hasAlpha);
1839
385k
    }
1840
78.0k
}
1841
1842
static av_always_inline void
1843
yuv2rgb_2_c_template(SwsInternal *c, const int16_t *buf[2],
1844
                     const int16_t *ubuf[2], const int16_t *vbuf[2],
1845
                     const int16_t *abuf[2], uint8_t *dest, int dstW,
1846
                     int yalpha, int uvalpha, int y,
1847
                     enum AVPixelFormat target, int hasAlpha)
1848
56.5k
{
1849
56.5k
    const int16_t *buf0  = buf[0],  *buf1  = buf[1],
1850
56.5k
                  *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
1851
56.5k
                  *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
1852
56.5k
                  *abuf0 = hasAlpha ? abuf[0] : NULL,
1853
56.5k
                  *abuf1 = hasAlpha ? abuf[1] : NULL;
1854
56.5k
    int  yalpha1 = 4096 - yalpha;
1855
56.5k
    int uvalpha1 = 4096 - uvalpha;
1856
56.5k
    int i;
1857
56.5k
    av_assert2(yalpha  <= 4096U);
1858
56.5k
    av_assert2(uvalpha <= 4096U);
1859
1860
322k
    for (i = 0; i < ((dstW + 1) >> 1); i++) {
1861
265k
        int Y1 = (buf0[i * 2]     * yalpha1  + buf1[i * 2]     * yalpha)  >> 19;
1862
265k
        int Y2 = (buf0[i * 2 + 1] * yalpha1  + buf1[i * 2 + 1] * yalpha)  >> 19;
1863
265k
        int U  = (ubuf0[i]        * uvalpha1 + ubuf1[i]        * uvalpha) >> 19;
1864
265k
        int V  = (vbuf0[i]        * uvalpha1 + vbuf1[i]        * uvalpha) >> 19;
1865
265k
        int A1, A2;
1866
265k
        const void *r =  c->table_rV[V + YUVRGB_TABLE_HEADROOM],
1867
265k
                   *g = (c->table_gU[U + YUVRGB_TABLE_HEADROOM] + c->table_gV[V + YUVRGB_TABLE_HEADROOM]),
1868
265k
                   *b =  c->table_bU[U + YUVRGB_TABLE_HEADROOM];
1869
1870
265k
        if (hasAlpha) {
1871
67.3k
            A1 = (abuf0[i * 2    ] * yalpha1 + abuf1[i * 2    ] * yalpha) >> 19;
1872
67.3k
            A2 = (abuf0[i * 2 + 1] * yalpha1 + abuf1[i * 2 + 1] * yalpha) >> 19;
1873
67.3k
            A1 = av_clip_uint8(A1);
1874
67.3k
            A2 = av_clip_uint8(A2);
1875
67.3k
        }
1876
1877
265k
        yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0,
1878
265k
                      r, g, b, y, target, hasAlpha);
1879
265k
    }
1880
56.5k
}
1881
1882
static av_always_inline void
1883
yuv2rgb_1_c_template(SwsInternal *c, const int16_t *buf0,
1884
                     const int16_t *ubuf[2], const int16_t *vbuf[2],
1885
                     const int16_t *abuf0, uint8_t *dest, int dstW,
1886
                     int uvalpha, int y, enum AVPixelFormat target,
1887
                     int hasAlpha)
1888
69.6k
{
1889
69.6k
    const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
1890
69.6k
    int i;
1891
1892
69.6k
    if (uvalpha == 0) {
1893
316k
        for (i = 0; i < ((dstW + 1) >> 1); i++) {
1894
266k
            int Y1 = (buf0[i * 2    ] + 64) >> 7;
1895
266k
            int Y2 = (buf0[i * 2 + 1] + 64) >> 7;
1896
266k
            int U  = (ubuf0[i]        + 64) >> 7;
1897
266k
            int V  = (vbuf0[i]        + 64) >> 7;
1898
266k
            int A1, A2;
1899
266k
            const void *r =  c->table_rV[V + YUVRGB_TABLE_HEADROOM],
1900
266k
                       *g = (c->table_gU[U + YUVRGB_TABLE_HEADROOM] + c->table_gV[V + YUVRGB_TABLE_HEADROOM]),
1901
266k
                       *b =  c->table_bU[U + YUVRGB_TABLE_HEADROOM];
1902
1903
266k
            if (hasAlpha) {
1904
57.6k
                A1 = abuf0[i * 2    ] * 255 + 16384 >> 15;
1905
57.6k
                A2 = abuf0[i * 2 + 1] * 255 + 16384 >> 15;
1906
57.6k
                A1 = av_clip_uint8(A1);
1907
57.6k
                A2 = av_clip_uint8(A2);
1908
57.6k
            }
1909
1910
266k
            yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0,
1911
266k
                          r, g, b, y, target, hasAlpha);
1912
266k
        }
1913
50.3k
    } else {
1914
19.2k
        const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
1915
19.2k
        int uvalpha1 = 4096 - uvalpha;
1916
19.2k
        av_assert2(uvalpha <= 4096U);
1917
1918
383k
        for (i = 0; i < ((dstW + 1) >> 1); i++) {
1919
363k
            int Y1 = (buf0[i * 2    ]     +  64) >> 7;
1920
363k
            int Y2 = (buf0[i * 2 + 1]     +  64) >> 7;
1921
363k
            int U  = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha + (128 << 11)) >> 19;
1922
363k
            int V  = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha + (128 << 11)) >> 19;
1923
363k
            int A1, A2;
1924
363k
            const void *r =  c->table_rV[V + YUVRGB_TABLE_HEADROOM],
1925
363k
                       *g = (c->table_gU[U + YUVRGB_TABLE_HEADROOM] + c->table_gV[V + YUVRGB_TABLE_HEADROOM]),
1926
363k
                       *b =  c->table_bU[U + YUVRGB_TABLE_HEADROOM];
1927
1928
363k
            if (hasAlpha) {
1929
94.3k
                A1 = (abuf0[i * 2    ] + 64) >> 7;
1930
94.3k
                A2 = (abuf0[i * 2 + 1] + 64) >> 7;
1931
94.3k
                A1 = av_clip_uint8(A1);
1932
94.3k
                A2 = av_clip_uint8(A2);
1933
94.3k
            }
1934
1935
363k
            yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0,
1936
363k
                          r, g, b, y, target, hasAlpha);
1937
363k
        }
1938
19.2k
    }
1939
69.6k
}
1940
1941
#define YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \
1942
static void name ## ext ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
1943
                                const int16_t **lumSrc, int lumFilterSize, \
1944
                                const int16_t *chrFilter, const int16_t **chrUSrc, \
1945
                                const int16_t **chrVSrc, int chrFilterSize, \
1946
                                const int16_t **alpSrc, uint8_t *dest, int dstW, \
1947
993k
                                int y) \
1948
993k
{ \
1949
993k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
993k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
993k
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
993k
}
output.c:yuv2rgba32_full_X_c
Line
Count
Source
1947
44.7k
                                int y) \
1948
44.7k
{ \
1949
44.7k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
44.7k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
44.7k
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
44.7k
}
output.c:yuv2rgbx32_full_X_c
Line
Count
Source
1947
48.6k
                                int y) \
1948
48.6k
{ \
1949
48.6k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
48.6k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
48.6k
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
48.6k
}
output.c:yuv2argb32_full_X_c
Line
Count
Source
1947
74.2k
                                int y) \
1948
74.2k
{ \
1949
74.2k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
74.2k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
74.2k
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
74.2k
}
output.c:yuv2xrgb32_full_X_c
Line
Count
Source
1947
24.3k
                                int y) \
1948
24.3k
{ \
1949
24.3k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
24.3k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
24.3k
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
24.3k
}
output.c:yuv2bgra32_full_X_c
Line
Count
Source
1947
107k
                                int y) \
1948
107k
{ \
1949
107k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
107k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
107k
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
107k
}
output.c:yuv2bgrx32_full_X_c
Line
Count
Source
1947
50.8k
                                int y) \
1948
50.8k
{ \
1949
50.8k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
50.8k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
50.8k
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
50.8k
}
output.c:yuv2abgr32_full_X_c
Line
Count
Source
1947
69.8k
                                int y) \
1948
69.8k
{ \
1949
69.8k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
69.8k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
69.8k
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
69.8k
}
output.c:yuv2xbgr32_full_X_c
Line
Count
Source
1947
50.6k
                                int y) \
1948
50.6k
{ \
1949
50.6k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
50.6k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
50.6k
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
50.6k
}
output.c:yuv2rgb24_full_X_c
Line
Count
Source
1947
55.8k
                                int y) \
1948
55.8k
{ \
1949
55.8k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
55.8k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
55.8k
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
55.8k
}
output.c:yuv2bgr24_full_X_c
Line
Count
Source
1947
51.7k
                                int y) \
1948
51.7k
{ \
1949
51.7k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
51.7k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
51.7k
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
51.7k
}
output.c:yuv2bgr4_byte_full_X_c
Line
Count
Source
1947
48.5k
                                int y) \
1948
48.5k
{ \
1949
48.5k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
48.5k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
48.5k
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
48.5k
}
output.c:yuv2rgb4_byte_full_X_c
Line
Count
Source
1947
54.6k
                                int y) \
1948
54.6k
{ \
1949
54.6k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
54.6k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
54.6k
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
54.6k
}
output.c:yuv2bgr8_full_X_c
Line
Count
Source
1947
55.1k
                                int y) \
1948
55.1k
{ \
1949
55.1k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
55.1k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
55.1k
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
55.1k
}
output.c:yuv2rgb8_full_X_c
Line
Count
Source
1947
53.0k
                                int y) \
1948
53.0k
{ \
1949
53.0k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
53.0k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
53.0k
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
53.0k
}
output.c:yuv2x2rgb10_full_X_c
Line
Count
Source
1947
67.0k
                                int y) \
1948
67.0k
{ \
1949
67.0k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
67.0k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
67.0k
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
67.0k
}
output.c:yuv2x2bgr10_full_X_c
Line
Count
Source
1947
58.5k
                                int y) \
1948
58.5k
{ \
1949
58.5k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
58.5k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
58.5k
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
58.5k
}
output.c:yuv2rgba32_X_c
Line
Count
Source
1947
15.3k
                                int y) \
1948
15.3k
{ \
1949
15.3k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
15.3k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
15.3k
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
15.3k
}
output.c:yuv2rgbx32_X_c
Line
Count
Source
1947
334
                                int y) \
1948
334
{ \
1949
334
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
334
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
334
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
334
}
output.c:yuv2rgba32_1_X_c
Line
Count
Source
1947
4.84k
                                int y) \
1948
4.84k
{ \
1949
4.84k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
4.84k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
4.84k
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
4.84k
}
output.c:yuv2rgbx32_1_X_c
Line
Count
Source
1947
307
                                int y) \
1948
307
{ \
1949
307
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
307
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
307
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
307
}
output.c:yuv2rgb24_X_c
Line
Count
Source
1947
8.69k
                                int y) \
1948
8.69k
{ \
1949
8.69k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
8.69k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
8.69k
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
8.69k
}
output.c:yuv2bgr24_X_c
Line
Count
Source
1947
1.10k
                                int y) \
1948
1.10k
{ \
1949
1.10k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
1.10k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
1.10k
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
1.10k
}
output.c:yuv2rgb16_X_c
Line
Count
Source
1947
19.6k
                                int y) \
1948
19.6k
{ \
1949
19.6k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
19.6k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
19.6k
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
19.6k
}
output.c:yuv2rgb15_X_c
Line
Count
Source
1947
11.8k
                                int y) \
1948
11.8k
{ \
1949
11.8k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
11.8k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
11.8k
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
11.8k
}
output.c:yuv2rgb12_X_c
Line
Count
Source
1947
2.10k
                                int y) \
1948
2.10k
{ \
1949
2.10k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
2.10k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
2.10k
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
2.10k
}
output.c:yuv2rgb8_X_c
Line
Count
Source
1947
1.49k
                                int y) \
1948
1.49k
{ \
1949
1.49k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
1.49k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
1.49k
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
1.49k
}
output.c:yuv2rgb4_X_c
Line
Count
Source
1947
10.4k
                                int y) \
1948
10.4k
{ \
1949
10.4k
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
10.4k
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
10.4k
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
10.4k
}
output.c:yuv2rgb4b_X_c
Line
Count
Source
1947
505
                                int y) \
1948
505
{ \
1949
505
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
505
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
505
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
505
}
output.c:yuv2x2rgb10_X_c
Line
Count
Source
1947
351
                                int y) \
1948
351
{ \
1949
351
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
351
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
351
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
351
}
output.c:yuv2x2bgr10_X_c
Line
Count
Source
1947
995
                                int y) \
1948
995
{ \
1949
995
    name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
1950
995
                                  chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
1951
995
                                  alpSrc, dest, dstW, y, fmt, hasAlpha); \
1952
995
}
1953
1954
#define YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \
1955
YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \
1956
static void name ## ext ## _2_c(SwsInternal *c, const int16_t *buf[2], \
1957
                                const int16_t *ubuf[2], const int16_t *vbuf[2], \
1958
                                const int16_t *abuf[2], uint8_t *dest, int dstW, \
1959
714k
                                int yalpha, int uvalpha, int y) \
1960
714k
{ \
1961
714k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
714k
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
714k
}
output.c:yuv2rgba32_full_2_c
Line
Count
Source
1959
12.9k
                                int yalpha, int uvalpha, int y) \
1960
12.9k
{ \
1961
12.9k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
12.9k
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
12.9k
}
output.c:yuv2rgbx32_full_2_c
Line
Count
Source
1959
53.1k
                                int yalpha, int uvalpha, int y) \
1960
53.1k
{ \
1961
53.1k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
53.1k
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
53.1k
}
output.c:yuv2argb32_full_2_c
Line
Count
Source
1959
70.7k
                                int yalpha, int uvalpha, int y) \
1960
70.7k
{ \
1961
70.7k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
70.7k
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
70.7k
}
output.c:yuv2xrgb32_full_2_c
Line
Count
Source
1959
36.2k
                                int yalpha, int uvalpha, int y) \
1960
36.2k
{ \
1961
36.2k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
36.2k
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
36.2k
}
output.c:yuv2bgra32_full_2_c
Line
Count
Source
1959
52.4k
                                int yalpha, int uvalpha, int y) \
1960
52.4k
{ \
1961
52.4k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
52.4k
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
52.4k
}
output.c:yuv2bgrx32_full_2_c
Line
Count
Source
1959
60.7k
                                int yalpha, int uvalpha, int y) \
1960
60.7k
{ \
1961
60.7k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
60.7k
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
60.7k
}
output.c:yuv2abgr32_full_2_c
Line
Count
Source
1959
50.1k
                                int yalpha, int uvalpha, int y) \
1960
50.1k
{ \
1961
50.1k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
50.1k
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
50.1k
}
output.c:yuv2xbgr32_full_2_c
Line
Count
Source
1959
33.0k
                                int yalpha, int uvalpha, int y) \
1960
33.0k
{ \
1961
33.0k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
33.0k
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
33.0k
}
output.c:yuv2rgb24_full_2_c
Line
Count
Source
1959
59.4k
                                int yalpha, int uvalpha, int y) \
1960
59.4k
{ \
1961
59.4k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
59.4k
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
59.4k
}
output.c:yuv2bgr24_full_2_c
Line
Count
Source
1959
18.6k
                                int yalpha, int uvalpha, int y) \
1960
18.6k
{ \
1961
18.6k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
18.6k
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
18.6k
}
output.c:yuv2bgr4_byte_full_2_c
Line
Count
Source
1959
27.1k
                                int yalpha, int uvalpha, int y) \
1960
27.1k
{ \
1961
27.1k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
27.1k
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
27.1k
}
output.c:yuv2rgb4_byte_full_2_c
Line
Count
Source
1959
55.6k
                                int yalpha, int uvalpha, int y) \
1960
55.6k
{ \
1961
55.6k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
55.6k
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
55.6k
}
output.c:yuv2bgr8_full_2_c
Line
Count
Source
1959
29.7k
                                int yalpha, int uvalpha, int y) \
1960
29.7k
{ \
1961
29.7k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
29.7k
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
29.7k
}
output.c:yuv2rgb8_full_2_c
Line
Count
Source
1959
32.0k
                                int yalpha, int uvalpha, int y) \
1960
32.0k
{ \
1961
32.0k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
32.0k
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
32.0k
}
output.c:yuv2x2rgb10_full_2_c
Line
Count
Source
1959
30.1k
                                int yalpha, int uvalpha, int y) \
1960
30.1k
{ \
1961
30.1k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
30.1k
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
30.1k
}
output.c:yuv2x2bgr10_full_2_c
Line
Count
Source
1959
35.9k
                                int yalpha, int uvalpha, int y) \
1960
35.9k
{ \
1961
35.9k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
35.9k
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
35.9k
}
output.c:yuv2rgba32_2_c
Line
Count
Source
1959
4.87k
                                int yalpha, int uvalpha, int y) \
1960
4.87k
{ \
1961
4.87k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
4.87k
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
4.87k
}
output.c:yuv2rgbx32_2_c
Line
Count
Source
1959
459
                                int yalpha, int uvalpha, int y) \
1960
459
{ \
1961
459
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
459
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
459
}
output.c:yuv2rgba32_1_2_c
Line
Count
Source
1959
2.02k
                                int yalpha, int uvalpha, int y) \
1960
2.02k
{ \
1961
2.02k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
2.02k
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
2.02k
}
output.c:yuv2rgbx32_1_2_c
Line
Count
Source
1959
366
                                int yalpha, int uvalpha, int y) \
1960
366
{ \
1961
366
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
366
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
366
}
output.c:yuv2rgb24_2_c
Line
Count
Source
1959
9.49k
                                int yalpha, int uvalpha, int y) \
1960
9.49k
{ \
1961
9.49k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
9.49k
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
9.49k
}
output.c:yuv2bgr24_2_c
Line
Count
Source
1959
1.38k
                                int yalpha, int uvalpha, int y) \
1960
1.38k
{ \
1961
1.38k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
1.38k
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
1.38k
}
output.c:yuv2rgb16_2_c
Line
Count
Source
1959
16.3k
                                int yalpha, int uvalpha, int y) \
1960
16.3k
{ \
1961
16.3k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
16.3k
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
16.3k
}
output.c:yuv2rgb15_2_c
Line
Count
Source
1959
1.60k
                                int yalpha, int uvalpha, int y) \
1960
1.60k
{ \
1961
1.60k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
1.60k
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
1.60k
}
output.c:yuv2rgb12_2_c
Line
Count
Source
1959
6.82k
                                int yalpha, int uvalpha, int y) \
1960
6.82k
{ \
1961
6.82k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
6.82k
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
6.82k
}
output.c:yuv2rgb8_2_c
Line
Count
Source
1959
3.41k
                                int yalpha, int uvalpha, int y) \
1960
3.41k
{ \
1961
3.41k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
3.41k
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
3.41k
}
output.c:yuv2rgb4_2_c
Line
Count
Source
1959
3.92k
                                int yalpha, int uvalpha, int y) \
1960
3.92k
{ \
1961
3.92k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
3.92k
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
3.92k
}
output.c:yuv2rgb4b_2_c
Line
Count
Source
1959
1.89k
                                int yalpha, int uvalpha, int y) \
1960
1.89k
{ \
1961
1.89k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
1.89k
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
1.89k
}
output.c:yuv2x2rgb10_2_c
Line
Count
Source
1959
557
                                int yalpha, int uvalpha, int y) \
1960
557
{ \
1961
557
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
557
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
557
}
output.c:yuv2x2bgr10_2_c
Line
Count
Source
1959
3.45k
                                int yalpha, int uvalpha, int y) \
1960
3.45k
{ \
1961
3.45k
    name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
1962
3.45k
                                  dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
1963
3.45k
}
1964
1965
#define YUV2RGBWRAPPER(name, base, ext, fmt, hasAlpha) \
1966
YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \
1967
static void name ## ext ## _1_c(SwsInternal *c, const int16_t *buf0, \
1968
                                const int16_t *ubuf[2], const int16_t *vbuf[2], \
1969
                                const int16_t *abuf0, uint8_t *dest, int dstW, \
1970
323k
                                int uvalpha, int y) \
1971
323k
{ \
1972
323k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
323k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
323k
}
output.c:yuv2rgba32_full_1_c
Line
Count
Source
1970
11.3k
                                int uvalpha, int y) \
1971
11.3k
{ \
1972
11.3k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
11.3k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
11.3k
}
output.c:yuv2rgbx32_full_1_c
Line
Count
Source
1970
14.2k
                                int uvalpha, int y) \
1971
14.2k
{ \
1972
14.2k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
14.2k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
14.2k
}
output.c:yuv2argb32_full_1_c
Line
Count
Source
1970
25.6k
                                int uvalpha, int y) \
1971
25.6k
{ \
1972
25.6k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
25.6k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
25.6k
}
output.c:yuv2xrgb32_full_1_c
Line
Count
Source
1970
21.9k
                                int uvalpha, int y) \
1971
21.9k
{ \
1972
21.9k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
21.9k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
21.9k
}
output.c:yuv2bgra32_full_1_c
Line
Count
Source
1970
24.3k
                                int uvalpha, int y) \
1971
24.3k
{ \
1972
24.3k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
24.3k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
24.3k
}
output.c:yuv2bgrx32_full_1_c
Line
Count
Source
1970
22.9k
                                int uvalpha, int y) \
1971
22.9k
{ \
1972
22.9k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
22.9k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
22.9k
}
output.c:yuv2abgr32_full_1_c
Line
Count
Source
1970
3.60k
                                int uvalpha, int y) \
1971
3.60k
{ \
1972
3.60k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
3.60k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
3.60k
}
output.c:yuv2xbgr32_full_1_c
Line
Count
Source
1970
24.6k
                                int uvalpha, int y) \
1971
24.6k
{ \
1972
24.6k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
24.6k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
24.6k
}
output.c:yuv2rgb24_full_1_c
Line
Count
Source
1970
10.9k
                                int uvalpha, int y) \
1971
10.9k
{ \
1972
10.9k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
10.9k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
10.9k
}
output.c:yuv2bgr24_full_1_c
Line
Count
Source
1970
6.95k
                                int uvalpha, int y) \
1971
6.95k
{ \
1972
6.95k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
6.95k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
6.95k
}
output.c:yuv2bgr4_byte_full_1_c
Line
Count
Source
1970
15.6k
                                int uvalpha, int y) \
1971
15.6k
{ \
1972
15.6k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
15.6k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
15.6k
}
output.c:yuv2rgb4_byte_full_1_c
Line
Count
Source
1970
24.2k
                                int uvalpha, int y) \
1971
24.2k
{ \
1972
24.2k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
24.2k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
24.2k
}
output.c:yuv2bgr8_full_1_c
Line
Count
Source
1970
17.2k
                                int uvalpha, int y) \
1971
17.2k
{ \
1972
17.2k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
17.2k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
17.2k
}
output.c:yuv2rgb8_full_1_c
Line
Count
Source
1970
17.5k
                                int uvalpha, int y) \
1971
17.5k
{ \
1972
17.5k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
17.5k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
17.5k
}
output.c:yuv2x2rgb10_full_1_c
Line
Count
Source
1970
7.42k
                                int uvalpha, int y) \
1971
7.42k
{ \
1972
7.42k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
7.42k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
7.42k
}
output.c:yuv2x2bgr10_full_1_c
Line
Count
Source
1970
5.46k
                                int uvalpha, int y) \
1971
5.46k
{ \
1972
5.46k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
5.46k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
5.46k
}
output.c:yuv2rgba32_1_c
Line
Count
Source
1970
2.07k
                                int uvalpha, int y) \
1971
2.07k
{ \
1972
2.07k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
2.07k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
2.07k
}
output.c:yuv2rgbx32_1_c
Line
Count
Source
1970
2.85k
                                int uvalpha, int y) \
1971
2.85k
{ \
1972
2.85k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
2.85k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
2.85k
}
output.c:yuv2rgba32_1_1_c
Line
Count
Source
1970
5.72k
                                int uvalpha, int y) \
1971
5.72k
{ \
1972
5.72k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
5.72k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
5.72k
}
output.c:yuv2rgbx32_1_1_c
Line
Count
Source
1970
1.70k
                                int uvalpha, int y) \
1971
1.70k
{ \
1972
1.70k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
1.70k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
1.70k
}
output.c:yuv2rgb24_1_c
Line
Count
Source
1970
3.66k
                                int uvalpha, int y) \
1971
3.66k
{ \
1972
3.66k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
3.66k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
3.66k
}
output.c:yuv2bgr24_1_c
Line
Count
Source
1970
1.09k
                                int uvalpha, int y) \
1971
1.09k
{ \
1972
1.09k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
1.09k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
1.09k
}
output.c:yuv2rgb16_1_c
Line
Count
Source
1970
3.61k
                                int uvalpha, int y) \
1971
3.61k
{ \
1972
3.61k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
3.61k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
3.61k
}
output.c:yuv2rgb15_1_c
Line
Count
Source
1970
12.9k
                                int uvalpha, int y) \
1971
12.9k
{ \
1972
12.9k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
12.9k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
12.9k
}
output.c:yuv2rgb12_1_c
Line
Count
Source
1970
11.7k
                                int uvalpha, int y) \
1971
11.7k
{ \
1972
11.7k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
11.7k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
11.7k
}
output.c:yuv2rgb8_1_c
Line
Count
Source
1970
6.28k
                                int uvalpha, int y) \
1971
6.28k
{ \
1972
6.28k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
6.28k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
6.28k
}
output.c:yuv2rgb4_1_c
Line
Count
Source
1970
14.1k
                                int uvalpha, int y) \
1971
14.1k
{ \
1972
14.1k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
14.1k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
14.1k
}
output.c:yuv2rgb4b_1_c
Line
Count
Source
1970
1.17k
                                int uvalpha, int y) \
1971
1.17k
{ \
1972
1.17k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
1.17k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
1.17k
}
output.c:yuv2x2rgb10_1_c
Line
Count
Source
1970
1.16k
                                int uvalpha, int y) \
1971
1.16k
{ \
1972
1.16k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
1.16k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
1.16k
}
output.c:yuv2x2bgr10_1_c
Line
Count
Source
1970
1.36k
                                int uvalpha, int y) \
1971
1.36k
{ \
1972
1.36k
    name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
1973
1.36k
                                  dstW, uvalpha, y, fmt, hasAlpha); \
1974
1.36k
}
1975
1976
#if CONFIG_SMALL
1977
YUV2RGBWRAPPER(yuv2rgb,,  32_1,  AV_PIX_FMT_RGB32_1,   CONFIG_SWSCALE_ALPHA && c->needAlpha)
1978
YUV2RGBWRAPPER(yuv2rgb,,  32,    AV_PIX_FMT_RGB32,     CONFIG_SWSCALE_ALPHA && c->needAlpha)
1979
#else
1980
#if CONFIG_SWSCALE_ALPHA
1981
YUV2RGBWRAPPER(yuv2rgb,, a32_1,  AV_PIX_FMT_RGB32_1,   1)
1982
YUV2RGBWRAPPER(yuv2rgb,, a32,    AV_PIX_FMT_RGB32,     1)
1983
#endif
1984
YUV2RGBWRAPPER(yuv2rgb,, x32_1,  AV_PIX_FMT_RGB32_1,   0)
1985
YUV2RGBWRAPPER(yuv2rgb,, x32,    AV_PIX_FMT_RGB32,     0)
1986
#endif
1987
YUV2RGBWRAPPER(yuv2, rgb, rgb24, AV_PIX_FMT_RGB24,   0)
1988
YUV2RGBWRAPPER(yuv2, rgb, bgr24, AV_PIX_FMT_BGR24,   0)
1989
YUV2RGBWRAPPER(yuv2rgb,,  16,    AV_PIX_FMT_RGB565,    0)
1990
YUV2RGBWRAPPER(yuv2rgb,,  15,    AV_PIX_FMT_RGB555,    0)
1991
YUV2RGBWRAPPER(yuv2rgb,,  12,    AV_PIX_FMT_RGB444,    0)
1992
YUV2RGBWRAPPER(yuv2rgb,,   8,    AV_PIX_FMT_RGB8,      0)
1993
YUV2RGBWRAPPER(yuv2rgb,,   4,    AV_PIX_FMT_RGB4,      0)
1994
YUV2RGBWRAPPER(yuv2rgb,,   4b,   AV_PIX_FMT_RGB4_BYTE, 0)
1995
YUV2RGBWRAPPER(yuv2, rgb, x2rgb10, AV_PIX_FMT_X2RGB10, 0)
1996
YUV2RGBWRAPPER(yuv2, rgb, x2bgr10, AV_PIX_FMT_X2BGR10, 0)
1997
1998
static av_always_inline void yuv2rgb_write_full(SwsInternal *c,
1999
    uint8_t *dest, int i, int Y, int A, int U, int V,
2000
    int y, enum AVPixelFormat target, int hasAlpha, int err[4])
2001
14.9M
{
2002
14.9M
    int R, G, B;
2003
14.9M
    int isrgb8 = target == AV_PIX_FMT_BGR8 || target == AV_PIX_FMT_RGB8;
2004
2005
14.9M
    Y -= c->yuv2rgb_y_offset;
2006
14.9M
    Y *= c->yuv2rgb_y_coeff;
2007
14.9M
    Y += 1 << 21;
2008
14.9M
    R = (unsigned)Y + V*(unsigned)c->yuv2rgb_v2r_coeff;
2009
14.9M
    G = (unsigned)Y + V*(unsigned)c->yuv2rgb_v2g_coeff + U*(unsigned)c->yuv2rgb_u2g_coeff;
2010
14.9M
    B = (unsigned)Y +                                    U*(unsigned)c->yuv2rgb_u2b_coeff;
2011
14.9M
    if ((R | G | B) & 0xC0000000) {
2012
5.77M
        R = av_clip_uintp2(R, 30);
2013
5.77M
        G = av_clip_uintp2(G, 30);
2014
5.77M
        B = av_clip_uintp2(B, 30);
2015
5.77M
    }
2016
2017
14.9M
    switch(target) {
2018
1.47M
    case AV_PIX_FMT_ARGB:
2019
1.47M
        dest[0] = hasAlpha ? A : 255;
2020
1.47M
        dest[1] = R >> 22;
2021
1.47M
        dest[2] = G >> 22;
2022
1.47M
        dest[3] = B >> 22;
2023
1.47M
        break;
2024
878k
    case AV_PIX_FMT_RGB24:
2025
878k
        dest[0] = R >> 22;
2026
878k
        dest[1] = G >> 22;
2027
878k
        dest[2] = B >> 22;
2028
878k
        break;
2029
1.43M
    case AV_PIX_FMT_RGBA:
2030
1.43M
        dest[0] = R >> 22;
2031
1.43M
        dest[1] = G >> 22;
2032
1.43M
        dest[2] = B >> 22;
2033
1.43M
        dest[3] = hasAlpha ? A : 255;
2034
1.43M
        break;
2035
1.82M
    case AV_PIX_FMT_ABGR:
2036
1.82M
        dest[0] = hasAlpha ? A : 255;
2037
1.82M
        dest[1] = B >> 22;
2038
1.82M
        dest[2] = G >> 22;
2039
1.82M
        dest[3] = R >> 22;
2040
1.82M
        break;
2041
794k
    case AV_PIX_FMT_BGR24:
2042
794k
        dest[0] = B >> 22;
2043
794k
        dest[1] = G >> 22;
2044
794k
        dest[2] = R >> 22;
2045
794k
        break;
2046
1.68M
    case AV_PIX_FMT_BGRA:
2047
1.68M
        dest[0] = B >> 22;
2048
1.68M
        dest[1] = G >> 22;
2049
1.68M
        dest[2] = R >> 22;
2050
1.68M
        dest[3] = hasAlpha ? A : 255;
2051
1.68M
        break;
2052
617k
    case AV_PIX_FMT_X2RGB10LE:
2053
617k
        R >>= 20;
2054
617k
        G >>= 20;
2055
617k
        B >>= 20;
2056
617k
        AV_WL32(dest, (3U << 30) + (R << 20) + (G << 10) + B);
2057
617k
        break;
2058
535k
    case AV_PIX_FMT_X2BGR10LE:
2059
535k
        R >>= 20;
2060
535k
        G >>= 20;
2061
535k
        B >>= 20;
2062
535k
        AV_WL32(dest, (3U << 30) + (B << 20) + (G << 10) + R);
2063
535k
        break;
2064
1.39M
    case AV_PIX_FMT_BGR4_BYTE:
2065
3.04M
    case AV_PIX_FMT_RGB4_BYTE:
2066
4.34M
    case AV_PIX_FMT_BGR8:
2067
5.67M
    case AV_PIX_FMT_RGB8:
2068
5.67M
    {
2069
5.67M
        int r,g,b;
2070
2071
5.67M
        switch (c->opts.dither) {
2072
0
        case SWS_DITHER_NONE:
2073
0
            if (isrgb8) {
2074
0
                r = av_clip_uintp2(R >> 27, 3);
2075
0
                g = av_clip_uintp2(G >> 27, 3);
2076
0
                b = av_clip_uintp2(B >> 28, 2);
2077
0
            } else {
2078
0
                r = av_clip_uintp2(R >> 29, 1);
2079
0
                g = av_clip_uintp2(G >> 28, 2);
2080
0
                b = av_clip_uintp2(B >> 29, 1);
2081
0
            }
2082
0
            break;
2083
0
        default:
2084
0
        case SWS_DITHER_AUTO:
2085
5.67M
        case SWS_DITHER_ED:
2086
5.67M
            R >>= 22;
2087
5.67M
            G >>= 22;
2088
5.67M
            B >>= 22;
2089
5.67M
            R += (7*err[0] + 1*c->dither_error[0][i] + 5*c->dither_error[0][i+1] + 3*c->dither_error[0][i+2])>>4;
2090
5.67M
            G += (7*err[1] + 1*c->dither_error[1][i] + 5*c->dither_error[1][i+1] + 3*c->dither_error[1][i+2])>>4;
2091
5.67M
            B += (7*err[2] + 1*c->dither_error[2][i] + 5*c->dither_error[2][i+1] + 3*c->dither_error[2][i+2])>>4;
2092
5.67M
            c->dither_error[0][i] = err[0];
2093
5.67M
            c->dither_error[1][i] = err[1];
2094
5.67M
            c->dither_error[2][i] = err[2];
2095
5.67M
            r = R >> (isrgb8 ? 5 : 7);
2096
5.67M
            g = G >> (isrgb8 ? 5 : 6);
2097
5.67M
            b = B >> (isrgb8 ? 6 : 7);
2098
5.67M
            r = av_clip(r, 0, isrgb8 ? 7 : 1);
2099
5.67M
            g = av_clip(g, 0, isrgb8 ? 7 : 3);
2100
5.67M
            b = av_clip(b, 0, isrgb8 ? 3 : 1);
2101
5.67M
            err[0] = R - r*(isrgb8 ? 36 : 255);
2102
5.67M
            err[1] = G - g*(isrgb8 ? 36 : 85);
2103
5.67M
            err[2] = B - b*(isrgb8 ? 85 : 255);
2104
5.67M
            break;
2105
0
        case SWS_DITHER_A_DITHER:
2106
0
            if (isrgb8) {
2107
  /* see http://pippin.gimp.org/a_dither/ for details/origin */
2108
0
#define A_DITHER(u,v)   (((((u)+((v)*236))*119)&0xff))
2109
0
                r = (((R >> 19) + A_DITHER(i,y)  -96)>>8);
2110
0
                g = (((G >> 19) + A_DITHER(i + 17,y) - 96)>>8);
2111
0
                b = (((B >> 20) + A_DITHER(i + 17*2,y) -96)>>8);
2112
0
                r = av_clip_uintp2(r, 3);
2113
0
                g = av_clip_uintp2(g, 3);
2114
0
                b = av_clip_uintp2(b, 2);
2115
0
            } else {
2116
0
                r = (((R >> 21) + A_DITHER(i,y)-256)>>8);
2117
0
                g = (((G >> 19) + A_DITHER(i + 17,y)-256)>>8);
2118
0
                b = (((B >> 21) + A_DITHER(i + 17*2,y)-256)>>8);
2119
0
                r = av_clip_uintp2(r, 1);
2120
0
                g = av_clip_uintp2(g, 2);
2121
0
                b = av_clip_uintp2(b, 1);
2122
0
            }
2123
0
            break;
2124
0
        case SWS_DITHER_X_DITHER:
2125
0
            if (isrgb8) {
2126
  /* see http://pippin.gimp.org/a_dither/ for details/origin */
2127
0
#define X_DITHER(u,v)   (((((u)^((v)*237))*181)&0x1ff)/2)
2128
0
                r = (((R >> 19) + X_DITHER(i,y) - 96)>>8);
2129
0
                g = (((G >> 19) + X_DITHER(i + 17,y) - 96)>>8);
2130
0
                b = (((B >> 20) + X_DITHER(i + 17*2,y) - 96)>>8);
2131
0
                r = av_clip_uintp2(r, 3);
2132
0
                g = av_clip_uintp2(g, 3);
2133
0
                b = av_clip_uintp2(b, 2);
2134
0
            } else {
2135
0
                r = (((R >> 21) + X_DITHER(i,y)-256)>>8);
2136
0
                g = (((G >> 19) + X_DITHER(i + 17,y)-256)>>8);
2137
0
                b = (((B >> 21) + X_DITHER(i + 17*2,y)-256)>>8);
2138
0
                r = av_clip_uintp2(r, 1);
2139
0
                g = av_clip_uintp2(g, 2);
2140
0
                b = av_clip_uintp2(b, 1);
2141
0
            }
2142
2143
0
            break;
2144
5.67M
        }
2145
2146
5.67M
        if(target == AV_PIX_FMT_BGR4_BYTE) {
2147
1.39M
            dest[0] = r + 2*g + 8*b;
2148
4.27M
        } else if(target == AV_PIX_FMT_RGB4_BYTE) {
2149
1.64M
            dest[0] = b + 2*g + 8*r;
2150
2.63M
        } else if(target == AV_PIX_FMT_BGR8) {
2151
1.30M
            dest[0] = r + 8*g + 64*b;
2152
1.32M
        } else if(target == AV_PIX_FMT_RGB8) {
2153
1.32M
            dest[0] = b + 4*g + 32*r;
2154
1.32M
        } else
2155
0
            av_assert2(0);
2156
5.67M
        break;}
2157
14.9M
    }
2158
14.9M
}
2159
2160
static av_always_inline void
2161
yuv2rgb_full_X_c_template(SwsInternal *c, const int16_t *lumFilter,
2162
                          const int16_t **lumSrc, int lumFilterSize,
2163
                          const int16_t *chrFilter, const int16_t **chrUSrc,
2164
                          const int16_t **chrVSrc, int chrFilterSize,
2165
                          const int16_t **alpSrc, uint8_t *dest,
2166
                          int dstW, int y, enum AVPixelFormat target, int hasAlpha)
2167
915k
{
2168
915k
    int i;
2169
915k
    int step = (target == AV_PIX_FMT_RGB24 || target == AV_PIX_FMT_BGR24) ? 3 : 4;
2170
915k
    int err[4] = {0};
2171
915k
    int A = 0; //init to silence warning
2172
2173
915k
    if(   target == AV_PIX_FMT_BGR4_BYTE || target == AV_PIX_FMT_RGB4_BYTE
2174
812k
       || target == AV_PIX_FMT_BGR8      || target == AV_PIX_FMT_RGB8)
2175
211k
        step = 1;
2176
2177
4.12M
    for (i = 0; i < dstW; i++) {
2178
3.21M
        int j;
2179
3.21M
        int Y = 1<<9;
2180
3.21M
        int U = (1<<9)-(128 << 19);
2181
3.21M
        int V = (1<<9)-(128 << 19);
2182
2183
49.8M
        for (j = 0; j < lumFilterSize; j++) {
2184
46.6M
            Y += lumSrc[j][i] * (unsigned)lumFilter[j];
2185
46.6M
        }
2186
34.2M
        for (j = 0; j < chrFilterSize; j++) {
2187
30.9M
            U += chrUSrc[j][i] * (unsigned)chrFilter[j];
2188
30.9M
            V += chrVSrc[j][i] * (unsigned)chrFilter[j];
2189
30.9M
        }
2190
3.21M
        Y >>= 10;
2191
3.21M
        U >>= 10;
2192
3.21M
        V >>= 10;
2193
3.21M
        if (hasAlpha) {
2194
772k
            A = 1 << 18;
2195
12.3M
            for (j = 0; j < lumFilterSize; j++) {
2196
11.5M
                A += alpSrc[j][i] * (unsigned)lumFilter[j];
2197
11.5M
            }
2198
772k
            A >>= 19;
2199
772k
            if (A & 0x100)
2200
93.7k
                A = av_clip_uint8(A);
2201
772k
        }
2202
3.21M
        yuv2rgb_write_full(c, dest, i, Y, A, U, V, y, target, hasAlpha, err);
2203
3.21M
        dest += step;
2204
3.21M
    }
2205
915k
    c->dither_error[0][i] = err[0];
2206
915k
    c->dither_error[1][i] = err[1];
2207
915k
    c->dither_error[2][i] = err[2];
2208
915k
}
2209
2210
static av_always_inline void
2211
yuv2rgb_full_2_c_template(SwsInternal *c, const int16_t *buf[2],
2212
                     const int16_t *ubuf[2], const int16_t *vbuf[2],
2213
                     const int16_t *abuf[2], uint8_t *dest, int dstW,
2214
                     int yalpha, int uvalpha, int y,
2215
                     enum AVPixelFormat target, int hasAlpha)
2216
658k
{
2217
658k
    const int16_t *buf0  = buf[0],  *buf1  = buf[1],
2218
658k
                  *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
2219
658k
                  *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
2220
658k
                  *abuf0 = hasAlpha ? abuf[0] : NULL,
2221
658k
                  *abuf1 = hasAlpha ? abuf[1] : NULL;
2222
658k
    int  yalpha1 = 4096 - yalpha;
2223
658k
    int uvalpha1 = 4096 - uvalpha;
2224
658k
    int i;
2225
658k
    int step = (target == AV_PIX_FMT_RGB24 || target == AV_PIX_FMT_BGR24) ? 3 : 4;
2226
658k
    int err[4] = {0};
2227
658k
    int A = 0; // init to silcene warning
2228
2229
658k
    av_assert2(yalpha  <= 4096U);
2230
658k
    av_assert2(uvalpha <= 4096U);
2231
2232
658k
    if(   target == AV_PIX_FMT_BGR4_BYTE || target == AV_PIX_FMT_RGB4_BYTE
2233
575k
       || target == AV_PIX_FMT_BGR8      || target == AV_PIX_FMT_RGB8)
2234
144k
        step = 1;
2235
2236
4.70M
    for (i = 0; i < dstW; i++) {
2237
4.04M
        int Y = ( buf0[i] * yalpha1  +  buf1[i] * yalpha             ) >> 10; //FIXME rounding
2238
4.04M
        int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha-(128 << 19)) >> 10;
2239
4.04M
        int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha-(128 << 19)) >> 10;
2240
2241
4.04M
        if (hasAlpha) {
2242
957k
            A = (abuf0[i] * yalpha1 + abuf1[i] * yalpha + (1<<18)) >> 19;
2243
957k
            if (A & 0x100)
2244
198k
                A = av_clip_uint8(A);
2245
957k
        }
2246
2247
4.04M
        yuv2rgb_write_full(c, dest, i, Y, A, U, V, y, target, hasAlpha, err);
2248
4.04M
        dest += step;
2249
4.04M
    }
2250
658k
    c->dither_error[0][i] = err[0];
2251
658k
    c->dither_error[1][i] = err[1];
2252
658k
    c->dither_error[2][i] = err[2];
2253
658k
}
2254
2255
static av_always_inline void
2256
yuv2rgb_full_1_c_template(SwsInternal *c, const int16_t *buf0,
2257
                     const int16_t *ubuf[2], const int16_t *vbuf[2],
2258
                     const int16_t *abuf0, uint8_t *dest, int dstW,
2259
                     int uvalpha, int y, enum AVPixelFormat target,
2260
                     int hasAlpha)
2261
254k
{
2262
254k
    const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
2263
254k
    int i;
2264
254k
    int step = (target == AV_PIX_FMT_RGB24 || target == AV_PIX_FMT_BGR24) ? 3 : 4;
2265
254k
    int err[4] = {0};
2266
2267
254k
    if(   target == AV_PIX_FMT_BGR4_BYTE || target == AV_PIX_FMT_RGB4_BYTE
2268
214k
       || target == AV_PIX_FMT_BGR8      || target == AV_PIX_FMT_RGB8)
2269
74.6k
        step = 1;
2270
2271
254k
    if (uvalpha == 0) {
2272
171k
        int A = 0; //init to silence warning
2273
4.89M
        for (i = 0; i < dstW; i++) {
2274
4.72M
            int Y = buf0[i] * 4;
2275
4.72M
            int U = (ubuf0[i] - (128<<7)) * 4;
2276
4.72M
            int V = (vbuf0[i] - (128<<7)) * 4;
2277
2278
4.72M
            if (hasAlpha) {
2279
1.17M
                A = (abuf0[i] + 64) >> 7;
2280
1.17M
                if (A & 0x100)
2281
180k
                    A = av_clip_uint8(A);
2282
1.17M
            }
2283
2284
4.72M
            yuv2rgb_write_full(c, dest, i, Y, A, U, V, y, target, hasAlpha, err);
2285
4.72M
            dest += step;
2286
4.72M
        }
2287
171k
    } else {
2288
82.9k
        const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
2289
82.9k
        int A = 0; //init to silence warning
2290
82.9k
        int uvalpha1 = 4096 - uvalpha;
2291
82.9k
        av_assert2(uvalpha <= 4096U);
2292
2293
3.03M
        for (i = 0; i < dstW; i++) {
2294
2.95M
            int Y = buf0[i] * 4;
2295
2.95M
            int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha - (128 << 19)) >> 10;
2296
2.95M
            int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha - (128 << 19)) >> 10;
2297
2298
2.95M
            if (hasAlpha) {
2299
547k
                A = (abuf0[i] + 64) >> 7;
2300
547k
                if (A & 0x100)
2301
47.6k
                    A = av_clip_uint8(A);
2302
547k
            }
2303
2304
2.95M
            yuv2rgb_write_full(c, dest, i, Y, A, U, V, y, target, hasAlpha, err);
2305
2.95M
            dest += step;
2306
2.95M
        }
2307
82.9k
    }
2308
2309
254k
    c->dither_error[0][i] = err[0];
2310
254k
    c->dither_error[1][i] = err[1];
2311
254k
    c->dither_error[2][i] = err[2];
2312
254k
}
2313
2314
#if CONFIG_SMALL
2315
YUV2RGBWRAPPER(yuv2, rgb_full, bgra32_full, AV_PIX_FMT_BGRA,  CONFIG_SWSCALE_ALPHA && c->needAlpha)
2316
YUV2RGBWRAPPER(yuv2, rgb_full, abgr32_full, AV_PIX_FMT_ABGR,  CONFIG_SWSCALE_ALPHA && c->needAlpha)
2317
YUV2RGBWRAPPER(yuv2, rgb_full, rgba32_full, AV_PIX_FMT_RGBA,  CONFIG_SWSCALE_ALPHA && c->needAlpha)
2318
YUV2RGBWRAPPER(yuv2, rgb_full, argb32_full, AV_PIX_FMT_ARGB,  CONFIG_SWSCALE_ALPHA && c->needAlpha)
2319
#else
2320
#if CONFIG_SWSCALE_ALPHA
2321
YUV2RGBWRAPPER(yuv2, rgb_full, bgra32_full, AV_PIX_FMT_BGRA,  1)
2322
YUV2RGBWRAPPER(yuv2, rgb_full, abgr32_full, AV_PIX_FMT_ABGR,  1)
2323
YUV2RGBWRAPPER(yuv2, rgb_full, rgba32_full, AV_PIX_FMT_RGBA,  1)
2324
YUV2RGBWRAPPER(yuv2, rgb_full, argb32_full, AV_PIX_FMT_ARGB,  1)
2325
#endif
2326
YUV2RGBWRAPPER(yuv2, rgb_full, bgrx32_full, AV_PIX_FMT_BGRA,  0)
2327
YUV2RGBWRAPPER(yuv2, rgb_full, xbgr32_full, AV_PIX_FMT_ABGR,  0)
2328
YUV2RGBWRAPPER(yuv2, rgb_full, rgbx32_full, AV_PIX_FMT_RGBA,  0)
2329
YUV2RGBWRAPPER(yuv2, rgb_full, xrgb32_full, AV_PIX_FMT_ARGB,  0)
2330
#endif
2331
YUV2RGBWRAPPER(yuv2, rgb_full, bgr24_full,  AV_PIX_FMT_BGR24, 0)
2332
YUV2RGBWRAPPER(yuv2, rgb_full, rgb24_full,  AV_PIX_FMT_RGB24, 0)
2333
2334
YUV2RGBWRAPPER(yuv2, rgb_full, bgr4_byte_full,  AV_PIX_FMT_BGR4_BYTE, 0)
2335
YUV2RGBWRAPPER(yuv2, rgb_full, rgb4_byte_full,  AV_PIX_FMT_RGB4_BYTE, 0)
2336
YUV2RGBWRAPPER(yuv2, rgb_full, bgr8_full,   AV_PIX_FMT_BGR8,  0)
2337
YUV2RGBWRAPPER(yuv2, rgb_full, rgb8_full,   AV_PIX_FMT_RGB8,  0)
2338
2339
YUV2RGBWRAPPER(yuv2, rgb_full, x2rgb10_full, AV_PIX_FMT_X2RGB10LE,  0)
2340
YUV2RGBWRAPPER(yuv2, rgb_full, x2bgr10_full, AV_PIX_FMT_X2BGR10LE,  0)
2341
2342
static void
2343
yuv2gbrp_full_X_c(SwsInternal *c, const int16_t *lumFilter,
2344
                  const int16_t **lumSrc, int lumFilterSize,
2345
                  const int16_t *chrFilter, const int16_t **chrUSrc,
2346
                  const int16_t **chrVSrc, int chrFilterSize,
2347
                  const int16_t **alpSrc, uint8_t **dest,
2348
                  int dstW, int y)
2349
157k
{
2350
157k
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.dst_format);
2351
157k
    int i;
2352
157k
    int hasAlpha = (desc->flags & AV_PIX_FMT_FLAG_ALPHA) && alpSrc;
2353
157k
    uint16_t **dest16 = (uint16_t**)dest;
2354
157k
    int SH = 22 + 8 - desc->comp[0].depth;
2355
157k
    int A = 0; // init to silence warning
2356
2357
909k
    for (i = 0; i < dstW; i++) {
2358
752k
        int j;
2359
752k
        int Y = 1 << 9;
2360
752k
        int U = (1 << 9) - (128 << 19);
2361
752k
        int V = (1 << 9) - (128 << 19);
2362
752k
        int R, G, B;
2363
2364
5.27M
        for (j = 0; j < lumFilterSize; j++)
2365
4.52M
            Y += lumSrc[j][i] * (unsigned)lumFilter[j];
2366
2367
5.02M
        for (j = 0; j < chrFilterSize; j++) {
2368
4.27M
            U += chrUSrc[j][i] * (unsigned)chrFilter[j];
2369
4.27M
            V += chrVSrc[j][i] * (unsigned)chrFilter[j];
2370
4.27M
        }
2371
2372
752k
        Y >>= 10;
2373
752k
        U >>= 10;
2374
752k
        V >>= 10;
2375
2376
752k
        if (hasAlpha) {
2377
330k
            A = 1 << 18;
2378
2379
1.10M
            for (j = 0; j < lumFilterSize; j++)
2380
774k
                A += alpSrc[j][i] * (unsigned)lumFilter[j];
2381
2382
330k
            if (A & 0xF8000000)
2383
31.1k
                A =  av_clip_uintp2(A, 27);
2384
330k
        }
2385
2386
752k
        Y -= c->yuv2rgb_y_offset;
2387
752k
        Y *= c->yuv2rgb_y_coeff;
2388
752k
        Y += 1 << (SH-1);
2389
752k
        R = Y + V * (unsigned)c->yuv2rgb_v2r_coeff;
2390
752k
        G = Y + V * (unsigned)c->yuv2rgb_v2g_coeff + U * (unsigned)c->yuv2rgb_u2g_coeff;
2391
752k
        B = Y +                                      U * (unsigned)c->yuv2rgb_u2b_coeff;
2392
2393
752k
        if ((R | G | B) & 0xC0000000) {
2394
354k
            R = av_clip_uintp2(R, 30);
2395
354k
            G = av_clip_uintp2(G, 30);
2396
354k
            B = av_clip_uintp2(B, 30);
2397
354k
        }
2398
2399
752k
        if (SH != 22) {
2400
670k
            dest16[0][i] = G >> SH;
2401
670k
            dest16[1][i] = B >> SH;
2402
670k
            dest16[2][i] = R >> SH;
2403
670k
            if (hasAlpha)
2404
295k
                dest16[3][i] = A >> (SH - 3);
2405
670k
        } else {
2406
81.8k
            dest[0][i] = G >> 22;
2407
81.8k
            dest[1][i] = B >> 22;
2408
81.8k
            dest[2][i] = R >> 22;
2409
81.8k
            if (hasAlpha)
2410
34.8k
                dest[3][i] = A >> 19;
2411
81.8k
        }
2412
752k
    }
2413
157k
    if (SH != 22 && (!isBE(c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
2414
551k
        for (i = 0; i < dstW; i++) {
2415
473k
            dest16[0][i] = av_bswap16(dest16[0][i]);
2416
473k
            dest16[1][i] = av_bswap16(dest16[1][i]);
2417
473k
            dest16[2][i] = av_bswap16(dest16[2][i]);
2418
473k
            if (hasAlpha)
2419
260k
                dest16[3][i] = av_bswap16(dest16[3][i]);
2420
473k
        }
2421
77.4k
    }
2422
157k
}
2423
2424
static void
2425
yuv2gbrpmsb_full_X_c(SwsInternal *c, const int16_t *lumFilter,
2426
                     const int16_t **lumSrc, int lumFilterSize,
2427
                     const int16_t *chrFilter, const int16_t **chrUSrc,
2428
                     const int16_t **chrVSrc, int chrFilterSize,
2429
                     const int16_t **alpSrc, uint8_t **dest,
2430
                     int dstW, int y)
2431
12.6k
{
2432
12.6k
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.dst_format);
2433
12.6k
    int hasAlpha = (desc->flags & AV_PIX_FMT_FLAG_ALPHA) && alpSrc;
2434
12.6k
    uint16_t **dest16 = (uint16_t**)dest;
2435
12.6k
    int shift = 16 - desc->comp[0].depth;
2436
12.6k
    int i;
2437
2438
12.6k
    yuv2gbrp_full_X_c(c, lumFilter, lumSrc, lumFilterSize,
2439
12.6k
                      chrFilter, chrUSrc, chrVSrc, chrFilterSize,
2440
12.6k
                      alpSrc, dest, dstW, y);
2441
2442
12.6k
    if (desc->comp[0].depth <= 8)
2443
0
        return;
2444
2445
12.6k
    if ((!isBE(c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
2446
93.6k
        for (i = 0; i < dstW; i++) {
2447
90.0k
            dest16[0][i] = av_bswap16(av_bswap16(dest16[0][i]) << shift);
2448
90.0k
            dest16[1][i] = av_bswap16(av_bswap16(dest16[1][i]) << shift);
2449
90.0k
            dest16[2][i] = av_bswap16(av_bswap16(dest16[2][i]) << shift);
2450
90.0k
            if (hasAlpha)
2451
0
                dest16[3][i] = av_bswap16(av_bswap16(dest16[3][i]) << shift);
2452
90.0k
        }
2453
9.08k
    } else {
2454
73.5k
        for (i = 0; i < dstW; i++) {
2455
64.4k
            dest16[0][i] = dest16[0][i] << shift;
2456
64.4k
            dest16[1][i] = dest16[1][i] << shift;
2457
64.4k
            dest16[2][i] = dest16[2][i] << shift;
2458
64.4k
            if (hasAlpha)
2459
0
                dest16[3][i] = dest16[3][i] << shift;
2460
64.4k
        }
2461
9.08k
    }
2462
12.6k
}
2463
2464
static void
2465
yuv2gbrp16_full_X_c(SwsInternal *c, const int16_t *lumFilter,
2466
                    const int16_t **lumSrcx, int lumFilterSize,
2467
                    const int16_t *chrFilter, const int16_t **chrUSrcx,
2468
                    const int16_t **chrVSrcx, int chrFilterSize,
2469
                    const int16_t **alpSrcx, uint8_t **dest,
2470
                    int dstW, int y)
2471
39.9k
{
2472
39.9k
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.dst_format);
2473
39.9k
    int i;
2474
39.9k
    int hasAlpha = (desc->flags & AV_PIX_FMT_FLAG_ALPHA) && alpSrcx;
2475
39.9k
    uint16_t **dest16 = (uint16_t**)dest;
2476
39.9k
    const int32_t **lumSrc  = (const int32_t**)lumSrcx;
2477
39.9k
    const int32_t **chrUSrc = (const int32_t**)chrUSrcx;
2478
39.9k
    const int32_t **chrVSrc = (const int32_t**)chrVSrcx;
2479
39.9k
    const int32_t **alpSrc  = (const int32_t**)alpSrcx;
2480
2481
391k
    for (i = 0; i < dstW; i++) {
2482
351k
        int j;
2483
351k
        int Y = -0x40000000;
2484
351k
        int U = -(128 << 23);
2485
351k
        int V = -(128 << 23);
2486
351k
        int R, G, B, A;
2487
2488
1.80M
        for (j = 0; j < lumFilterSize; j++)
2489
1.45M
            Y += lumSrc[j][i] * (unsigned)lumFilter[j];
2490
2491
1.62M
        for (j = 0; j < chrFilterSize; j++) {
2492
1.27M
            U += chrUSrc[j][i] * (unsigned)chrFilter[j];
2493
1.27M
            V += chrVSrc[j][i] * (unsigned)chrFilter[j];
2494
1.27M
        }
2495
2496
351k
        Y >>= 14;
2497
351k
        Y += 0x10000;
2498
351k
        U >>= 14;
2499
351k
        V >>= 14;
2500
2501
351k
        if (hasAlpha) {
2502
113k
            A = -0x40000000;
2503
2504
578k
            for (j = 0; j < lumFilterSize; j++)
2505
464k
                A += alpSrc[j][i] * (unsigned)lumFilter[j];
2506
2507
113k
            A >>= 1;
2508
113k
            A += 0x20002000;
2509
113k
        }
2510
2511
351k
        Y -= c->yuv2rgb_y_offset;
2512
351k
        Y *= c->yuv2rgb_y_coeff;
2513
351k
        Y += (1 << 13) - (1 << 29);
2514
351k
        R = V * c->yuv2rgb_v2r_coeff;
2515
351k
        G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
2516
351k
        B =                            U * c->yuv2rgb_u2b_coeff;
2517
2518
351k
        dest16[2][i] = av_clip_uintp2(((Y + (int64_t)R) >> 14) + (1<<15), 16);
2519
351k
        dest16[0][i] = av_clip_uintp2(((Y + (int64_t)G) >> 14) + (1<<15), 16);
2520
351k
        dest16[1][i] = av_clip_uintp2(((Y + (int64_t)B) >> 14) + (1<<15), 16);
2521
2522
351k
        if (hasAlpha)
2523
113k
            dest16[3][i] = av_clip_uintp2(A, 30) >> 14;
2524
351k
    }
2525
39.9k
    if ((!isBE(c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
2526
128k
        for (i = 0; i < dstW; i++) {
2527
116k
            dest16[0][i] = av_bswap16(dest16[0][i]);
2528
116k
            dest16[1][i] = av_bswap16(dest16[1][i]);
2529
116k
            dest16[2][i] = av_bswap16(dest16[2][i]);
2530
116k
            if (hasAlpha)
2531
17.4k
                dest16[3][i] = av_bswap16(dest16[3][i]);
2532
116k
        }
2533
12.7k
    }
2534
39.9k
}
2535
2536
static void
2537
yuv2gbrpf32_full_X_c(SwsInternal *c, const int16_t *lumFilter,
2538
                    const int16_t **lumSrcx, int lumFilterSize,
2539
                    const int16_t *chrFilter, const int16_t **chrUSrcx,
2540
                    const int16_t **chrVSrcx, int chrFilterSize,
2541
                    const int16_t **alpSrcx, uint8_t **dest,
2542
                    int dstW, int y)
2543
78.3k
{
2544
78.3k
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.dst_format);
2545
78.3k
    int i;
2546
78.3k
    int hasAlpha = (desc->flags & AV_PIX_FMT_FLAG_ALPHA) && alpSrcx;
2547
78.3k
    uint32_t **dest32 = (uint32_t**)dest;
2548
78.3k
    const int32_t **lumSrc  = (const int32_t**)lumSrcx;
2549
78.3k
    const int32_t **chrUSrc = (const int32_t**)chrUSrcx;
2550
78.3k
    const int32_t **chrVSrc = (const int32_t**)chrVSrcx;
2551
78.3k
    const int32_t **alpSrc  = (const int32_t**)alpSrcx;
2552
78.3k
    static const float float_mult = 1.0f / 65535.0f;
2553
2554
387k
    for (i = 0; i < dstW; i++) {
2555
309k
        int j;
2556
309k
        int Y = -0x40000000;
2557
309k
        int U = -(128 << 23);
2558
309k
        int V = -(128 << 23);
2559
309k
        int R, G, B, A;
2560
2561
1.80M
        for (j = 0; j < lumFilterSize; j++)
2562
1.49M
            Y += lumSrc[j][i] * (unsigned)lumFilter[j];
2563
2564
1.40M
        for (j = 0; j < chrFilterSize; j++) {
2565
1.09M
            U += chrUSrc[j][i] * (unsigned)chrFilter[j];
2566
1.09M
            V += chrVSrc[j][i] * (unsigned)chrFilter[j];
2567
1.09M
        }
2568
2569
309k
        Y >>= 14;
2570
309k
        Y += 0x10000;
2571
309k
        U >>= 14;
2572
309k
        V >>= 14;
2573
2574
309k
        if (hasAlpha) {
2575
175k
            A = -0x40000000;
2576
2577
751k
            for (j = 0; j < lumFilterSize; j++)
2578
576k
                A += alpSrc[j][i] * (unsigned)lumFilter[j];
2579
2580
175k
            A >>= 1;
2581
175k
            A += 0x20002000;
2582
175k
        }
2583
2584
309k
        Y -= c->yuv2rgb_y_offset;
2585
309k
        Y *= c->yuv2rgb_y_coeff;
2586
309k
        Y += (1 << 13) - (1 << 29);
2587
309k
        R = V * c->yuv2rgb_v2r_coeff;
2588
309k
        G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
2589
309k
        B =                            U * c->yuv2rgb_u2b_coeff;
2590
2591
309k
        R = av_clip_uintp2(((Y + R) >> 14) + (1<<15), 16);
2592
309k
        G = av_clip_uintp2(((Y + G) >> 14) + (1<<15), 16);
2593
309k
        B = av_clip_uintp2(((Y + B) >> 14) + (1<<15), 16);
2594
2595
309k
        dest32[0][i] = av_float2int(float_mult * (float)G);
2596
309k
        dest32[1][i] = av_float2int(float_mult * (float)B);
2597
309k
        dest32[2][i] = av_float2int(float_mult * (float)R);
2598
309k
        if (hasAlpha)
2599
175k
            dest32[3][i] = av_float2int(float_mult * (float)(av_clip_uintp2(A, 30) >> 14));
2600
309k
    }
2601
78.3k
    if ((!isBE(c->opts.dst_format)) != (!HAVE_BIGENDIAN)) {
2602
202k
        for (i = 0; i < dstW; i++) {
2603
169k
            dest32[0][i] = av_bswap32(dest32[0][i]);
2604
169k
            dest32[1][i] = av_bswap32(dest32[1][i]);
2605
169k
            dest32[2][i] = av_bswap32(dest32[2][i]);
2606
169k
            if (hasAlpha)
2607
128k
                dest32[3][i] = av_bswap32(dest32[3][i]);
2608
169k
        }
2609
33.0k
    }
2610
78.3k
}
2611
2612
static void
2613
yuv2ya8_1_c(SwsInternal *c, const int16_t *buf0,
2614
            const int16_t *ubuf[2], const int16_t *vbuf[2],
2615
            const int16_t *abuf0, uint8_t *dest, int dstW,
2616
            int uvalpha, int y)
2617
1.85k
{
2618
1.85k
    int hasAlpha = !!abuf0;
2619
1.85k
    int i;
2620
2621
68.5k
    for (i = 0; i < dstW; i++) {
2622
66.6k
        int Y = (buf0[i] + 64) >> 7;
2623
66.6k
        int A;
2624
2625
66.6k
        Y = av_clip_uint8(Y);
2626
2627
66.6k
        if (hasAlpha) {
2628
21.0k
            A = (abuf0[i] + 64) >> 7;
2629
21.0k
            if (A & 0x100)
2630
522
                A = av_clip_uint8(A);
2631
21.0k
        }
2632
2633
66.6k
        dest[i * 2    ] = Y;
2634
66.6k
        dest[i * 2 + 1] = hasAlpha ? A : 255;
2635
66.6k
    }
2636
1.85k
}
2637
2638
static void
2639
yuv2ya8_2_c(SwsInternal *c, const int16_t *buf[2],
2640
            const int16_t *ubuf[2], const int16_t *vbuf[2],
2641
            const int16_t *abuf[2], uint8_t *dest, int dstW,
2642
            int yalpha, int uvalpha, int y)
2643
13.5k
{
2644
13.5k
    int hasAlpha = abuf && abuf[0] && abuf[1];
2645
13.5k
    const int16_t *buf0  = buf[0],  *buf1  = buf[1],
2646
13.5k
                  *abuf0 = hasAlpha ? abuf[0] : NULL,
2647
13.5k
                  *abuf1 = hasAlpha ? abuf[1] : NULL;
2648
13.5k
    int  yalpha1 = 4096 - yalpha;
2649
13.5k
    int i;
2650
2651
13.5k
    av_assert2(yalpha  <= 4096U);
2652
2653
100k
    for (i = 0; i < dstW; i++) {
2654
87.0k
        int Y = (buf0[i] * yalpha1 + buf1[i] * yalpha) >> 19;
2655
87.0k
        int A;
2656
2657
87.0k
        Y = av_clip_uint8(Y);
2658
2659
87.0k
        if (hasAlpha) {
2660
36.0k
            A = (abuf0[i] * yalpha1 + abuf1[i] * yalpha) >> 19;
2661
36.0k
            A = av_clip_uint8(A);
2662
36.0k
        }
2663
2664
87.0k
        dest[i * 2    ] = Y;
2665
87.0k
        dest[i * 2 + 1] = hasAlpha ? A : 255;
2666
87.0k
    }
2667
13.5k
}
2668
2669
static void
2670
yuv2ya8_X_c(SwsInternal *c, const int16_t *lumFilter,
2671
            const int16_t **lumSrc, int lumFilterSize,
2672
            const int16_t *chrFilter, const int16_t **chrUSrc,
2673
            const int16_t **chrVSrc, int chrFilterSize,
2674
            const int16_t **alpSrc, uint8_t *dest, int dstW, int y)
2675
5.68k
{
2676
5.68k
    int hasAlpha = !!alpSrc;
2677
5.68k
    int i;
2678
2679
48.4k
    for (i = 0; i < dstW; i++) {
2680
42.7k
        int j;
2681
42.7k
        int Y = 1 << 18, A = 1 << 18;
2682
2683
4.28M
        for (j = 0; j < lumFilterSize; j++)
2684
4.24M
            Y += lumSrc[j][i] * (unsigned)lumFilter[j];
2685
2686
42.7k
        Y >>= 19;
2687
42.7k
        if (Y  & 0x100)
2688
35.6k
            Y = av_clip_uint8(Y);
2689
2690
42.7k
        if (hasAlpha) {
2691
4.19M
            for (j = 0; j < lumFilterSize; j++)
2692
4.15M
                A += alpSrc[j][i] * (unsigned)lumFilter[j];
2693
2694
38.2k
            A >>= 19;
2695
2696
38.2k
            if (A & 0x100)
2697
2.84k
                A = av_clip_uint8(A);
2698
38.2k
        }
2699
2700
42.7k
        dest[2 * i    ] = Y;
2701
42.7k
        dest[2 * i + 1] = hasAlpha ? A : 255;
2702
42.7k
    }
2703
5.68k
}
2704
2705
#define output_pixels(pos, val) \
2706
2.65M
    if (is_be) { \
2707
1.53M
        AV_WB16(pos, val); \
2708
1.53M
    } else { \
2709
1.11M
        AV_WL16(pos, val); \
2710
1.11M
    }
2711
2712
static av_always_inline void
2713
yuv2ayuv64_X_c(SwsInternal *c, const int16_t *lumFilter,
2714
               const int16_t **_lumSrc, int lumFilterSize,
2715
               const int16_t *chrFilter, const int16_t **_chrUSrc,
2716
               const int16_t **_chrVSrc, int chrFilterSize,
2717
               const int16_t **_alpSrc, uint8_t *dest, int dstW, int y,
2718
               int A_offset, int Y_offset, int U_offset, int V_offset, int is_be)
2719
167k
{
2720
167k
    const int32_t **lumSrc  = (const int32_t **) _lumSrc,
2721
167k
                  **chrUSrc = (const int32_t **) _chrUSrc,
2722
167k
                  **chrVSrc = (const int32_t **) _chrVSrc,
2723
167k
                  **alpSrc  = (const int32_t **) _alpSrc;
2724
167k
    int hasAlpha = !!alpSrc;
2725
167k
    int i;
2726
2727
831k
    for (i = 0; i < dstW; i++) {
2728
663k
        int Y = 1 << 14, U = 1 << 14;
2729
663k
        int V = 1 << 14, A = 1 << 14;
2730
663k
        int j;
2731
2732
663k
        Y -= 0x40000000;
2733
663k
        U -= 0x40000000;
2734
663k
        V -= 0x40000000;
2735
663k
        A -= 0x40000000;
2736
2737
6.37M
        for (j = 0; j < lumFilterSize; j++)
2738
5.71M
            Y += lumSrc[j][i] * (unsigned)lumFilter[j];
2739
2740
4.68M
        for (j = 0; j < chrFilterSize; j++)
2741
4.02M
            U += chrUSrc[j][i] * (unsigned)chrFilter[j];
2742
2743
4.68M
        for (j = 0; j < chrFilterSize; j++)
2744
4.02M
            V += chrVSrc[j][i] * (unsigned)chrFilter[j];
2745
2746
663k
        if (hasAlpha)
2747
2.39M
            for (j = 0; j < lumFilterSize; j++)
2748
2.07M
                A += alpSrc[j][i] * (unsigned)lumFilter[j];
2749
2750
663k
        Y = 0x8000 + av_clip_int16(Y >> 15);
2751
663k
        U = 0x8000 + av_clip_int16(U >> 15);
2752
663k
        V = 0x8000 + av_clip_int16(V >> 15);
2753
663k
        if (hasAlpha)
2754
320k
            A = 0x8000 + av_clip_int16(A >> 15);
2755
2756
663k
        output_pixels(dest + 8 * i + A_offset, hasAlpha ? A : 65535);
2757
663k
        output_pixels(dest + 8 * i + Y_offset, Y);
2758
663k
        output_pixels(dest + 8 * i + U_offset, U);
2759
663k
        output_pixels(dest + 8 * i + V_offset, V);
2760
663k
    }
2761
167k
}
2762
2763
#define YUV2AYUV64(pixfmt, BE_LE, A, Y, U, V, is_be) \
2764
static void \
2765
yuv2 ## pixfmt ## BE_LE ##_X_c(SwsInternal *c, const int16_t *lumFilter, \
2766
               const int16_t **lumSrc, int lumFilterSize, \
2767
               const int16_t *chrFilter, const int16_t **chrUSrc, \
2768
               const int16_t **chrVSrc, int chrFilterSize, \
2769
167k
               const int16_t **alpSrc, uint8_t *dest, int dstW, int y) \
2770
167k
{ \
2771
167k
    yuv2ayuv64_X_c(c, lumFilter, lumSrc, lumFilterSize, \
2772
167k
                   chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2773
167k
                   alpSrc, dest, dstW, y, A, Y, U, V, is_be); \
2774
167k
}
output.c:yuv2ayuv64le_X_c
Line
Count
Source
2769
57.4k
               const int16_t **alpSrc, uint8_t *dest, int dstW, int y) \
2770
57.4k
{ \
2771
57.4k
    yuv2ayuv64_X_c(c, lumFilter, lumSrc, lumFilterSize, \
2772
57.4k
                   chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2773
57.4k
                   alpSrc, dest, dstW, y, A, Y, U, V, is_be); \
2774
57.4k
}
output.c:yuv2ayuv64be_X_c
Line
Count
Source
2769
57.0k
               const int16_t **alpSrc, uint8_t *dest, int dstW, int y) \
2770
57.0k
{ \
2771
57.0k
    yuv2ayuv64_X_c(c, lumFilter, lumSrc, lumFilterSize, \
2772
57.0k
                   chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2773
57.0k
                   alpSrc, dest, dstW, y, A, Y, U, V, is_be); \
2774
57.0k
}
output.c:yuv2xv48le_X_c
Line
Count
Source
2769
14.4k
               const int16_t **alpSrc, uint8_t *dest, int dstW, int y) \
2770
14.4k
{ \
2771
14.4k
    yuv2ayuv64_X_c(c, lumFilter, lumSrc, lumFilterSize, \
2772
14.4k
                   chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2773
14.4k
                   alpSrc, dest, dstW, y, A, Y, U, V, is_be); \
2774
14.4k
}
output.c:yuv2xv48be_X_c
Line
Count
Source
2769
38.9k
               const int16_t **alpSrc, uint8_t *dest, int dstW, int y) \
2770
38.9k
{ \
2771
38.9k
    yuv2ayuv64_X_c(c, lumFilter, lumSrc, lumFilterSize, \
2772
38.9k
                   chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2773
38.9k
                   alpSrc, dest, dstW, y, A, Y, U, V, is_be); \
2774
38.9k
}
2775
2776
YUV2AYUV64(ayuv64, le, 0, 2, 4, 6, 0)
2777
YUV2AYUV64(ayuv64, be, 0, 2, 4, 6, 1)
2778
2779
YUV2AYUV64(xv48, le, 6, 2, 0, 4, 0)
2780
YUV2AYUV64(xv48, be, 6, 2, 0, 4, 1)
2781
2782
#undef output_pixels
2783
2784
static av_always_inline void
2785
yuv2v30_X_c_template(SwsInternal *c, const int16_t *lumFilter,
2786
                     const int16_t **lumSrc, int lumFilterSize,
2787
                     const int16_t *chrFilter, const int16_t **chrUSrc,
2788
                     const int16_t **chrVSrc, int chrFilterSize,
2789
                     const int16_t **alpSrc, uint8_t *dest, int dstW, int y,
2790
                     int shift)
2791
86.5k
{
2792
86.5k
    int i;
2793
392k
    for (i = 0; i < dstW; i++) {
2794
305k
        int Y = 1 << 16, U = 1 << 16, V = 1 << 16, A = 0x3;
2795
305k
        int j;
2796
2797
4.29M
        for (j = 0; j < lumFilterSize; j++)
2798
3.99M
            Y += lumSrc[j][i] * (unsigned)lumFilter[j];
2799
2800
3.72M
        for (j = 0; j < chrFilterSize; j++) {
2801
3.42M
            U += chrUSrc[j][i] * (unsigned)chrFilter[j];
2802
3.42M
            V += chrVSrc[j][i] * (unsigned)chrFilter[j];
2803
3.42M
        }
2804
2805
305k
        Y = av_clip_uintp2(Y >> 17, 10);
2806
305k
        U = av_clip_uintp2(U >> 17, 10);
2807
305k
        V = av_clip_uintp2(V >> 17, 10);
2808
2809
305k
        AV_WL32(dest + 4 * i, U << (shift +  0)  |
2810
305k
                              Y << (shift + 10)  |
2811
305k
                    (unsigned)V << (shift + 20)  |
2812
305k
                    (unsigned)A << (shift ? 0 : 30 /* xv30le = 30, v30xle = 0 */));
2813
305k
    }
2814
86.5k
}
2815
2816
#define V30LE_WRAPPER(name, shift) \
2817
static void yuv2 ## name ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
2818
                                 const int16_t **lumSrc, int lumFilterSize, \
2819
                                 const int16_t *chrFilter, const int16_t **chrUSrc, \
2820
                                 const int16_t **chrVSrc, int chrFilterSize, \
2821
                                 const int16_t **alpSrc, uint8_t *dest, int dstW, \
2822
86.5k
                                 int y) \
2823
86.5k
{ \
2824
86.5k
    yuv2v30_X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
2825
86.5k
                         chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2826
86.5k
                         alpSrc, dest, dstW, y, shift); \
2827
86.5k
}
output.c:yuv2v30xle_X_c
Line
Count
Source
2822
28.1k
                                 int y) \
2823
28.1k
{ \
2824
28.1k
    yuv2v30_X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
2825
28.1k
                         chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2826
28.1k
                         alpSrc, dest, dstW, y, shift); \
2827
28.1k
}
output.c:yuv2xv30le_X_c
Line
Count
Source
2822
58.4k
                                 int y) \
2823
58.4k
{ \
2824
58.4k
    yuv2v30_X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
2825
58.4k
                         chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2826
58.4k
                         alpSrc, dest, dstW, y, shift); \
2827
58.4k
}
2828
2829
V30LE_WRAPPER(xv30le, 0)
2830
V30LE_WRAPPER(v30xle, 2)
2831
2832
#define output_pixels(pos, val, shift, bits, output_shift) \
2833
1.25M
    if (is_be) { \
2834
400k
        AV_WB16(pos, av_clip_uintp2(val >> shift, bits) << output_shift); \
2835
859k
    } else { \
2836
859k
        AV_WL16(pos, av_clip_uintp2(val >> shift, bits) << output_shift); \
2837
859k
    }
2838
2839
static void
2840
yuv2xv36_X_c(SwsInternal *c, const int16_t *lumFilter,
2841
             const int16_t **lumSrc, int lumFilterSize,
2842
             const int16_t *chrFilter, const int16_t **chrUSrc,
2843
             const int16_t **chrVSrc, int chrFilterSize,
2844
             const int16_t **alpSrc, uint8_t *dest, int dstW, int y, int is_be)
2845
27.8k
{
2846
27.8k
    int i;
2847
342k
    for (i = 0; i < dstW; i++) {
2848
314k
        int Y = 1 << 14, U = 1 << 14, V = 1 << 14, A = 65535;
2849
314k
        int j;
2850
2851
3.47M
        for (j = 0; j < lumFilterSize; j++)
2852
3.15M
            Y += lumSrc[j][i] * (unsigned)lumFilter[j];
2853
2854
2.24M
        for (j = 0; j < chrFilterSize; j++) {
2855
1.92M
            U += chrUSrc[j][i] * (unsigned)chrFilter[j];
2856
1.92M
            V += chrVSrc[j][i] * (unsigned)chrFilter[j];
2857
1.92M
        }
2858
2859
314k
        output_pixels(dest + 8 * i + 2, Y, 15, 12, 4)
2860
314k
        output_pixels(dest + 8 * i + 0, U, 15, 12, 4)
2861
314k
        output_pixels(dest + 8 * i + 4, V, 15, 12, 4)
2862
314k
        output_pixels(dest + 8 * i + 6, A,  0, 12, 4);
2863
314k
    }
2864
27.8k
}
2865
2866
#undef output_pixels
2867
2868
#define YUV2XV36(BE_LE, is_be) \
2869
static void \
2870
yuv2xv36 ## BE_LE ##_X_c(SwsInternal *c, const int16_t *lumFilter, \
2871
                         const int16_t **lumSrc, int lumFilterSize, \
2872
                         const int16_t *chrFilter, const int16_t **chrUSrc, \
2873
                         const int16_t **chrVSrc, int chrFilterSize, \
2874
27.8k
                         const int16_t **alpSrc, uint8_t *dest, int dstW, int y) \
2875
27.8k
{ \
2876
27.8k
    yuv2xv36_X_c(c, lumFilter, lumSrc, lumFilterSize, \
2877
27.8k
                 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2878
27.8k
                 alpSrc, dest, dstW, y, is_be); \
2879
27.8k
}
output.c:yuv2xv36le_X_c
Line
Count
Source
2874
14.6k
                         const int16_t **alpSrc, uint8_t *dest, int dstW, int y) \
2875
14.6k
{ \
2876
14.6k
    yuv2xv36_X_c(c, lumFilter, lumSrc, lumFilterSize, \
2877
14.6k
                 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2878
14.6k
                 alpSrc, dest, dstW, y, is_be); \
2879
14.6k
}
output.c:yuv2xv36be_X_c
Line
Count
Source
2874
13.2k
                         const int16_t **alpSrc, uint8_t *dest, int dstW, int y) \
2875
13.2k
{ \
2876
13.2k
    yuv2xv36_X_c(c, lumFilter, lumSrc, lumFilterSize, \
2877
13.2k
                 chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
2878
13.2k
                 alpSrc, dest, dstW, y, is_be); \
2879
13.2k
}
2880
2881
YUV2XV36(le, 0)
2882
YUV2XV36(be, 1)
2883
2884
#define output_pixels(pos, A, Y, U, V) \
2885
1.30M
    if (target == AV_PIX_FMT_AYUV) { \
2886
422k
        dest[pos + 0] = A; \
2887
422k
        dest[pos + 1] = Y;  \
2888
422k
        dest[pos + 2] = U; \
2889
422k
        dest[pos + 3] = V;  \
2890
883k
    } else if (target == AV_PIX_FMT_UYVA) { \
2891
500k
        dest[pos + 0] = U; \
2892
500k
        dest[pos + 1] = Y;  \
2893
500k
        dest[pos + 2] = V; \
2894
500k
        dest[pos + 3] = A;  \
2895
500k
    } else { /* AV_PIX_FMT_VUYA || AV_PIX_FMT_VUYX */ \
2896
383k
        dest[pos + 0] = V;  \
2897
383k
        dest[pos + 1] = U; \
2898
383k
        dest[pos + 2] = Y;  \
2899
383k
        dest[pos + 3] = A; \
2900
383k
    }
2901
2902
static av_always_inline void
2903
yuv2ayuv_1_c_template(SwsInternal *c, const int16_t *buf0,
2904
                      const int16_t *ubuf[2], const int16_t *vbuf[2],
2905
                      const int16_t *abuf0, uint8_t *dest, int dstW,
2906
                      int uvalpha, int y, enum AVPixelFormat target)
2907
21.6k
{
2908
21.6k
    int hasAlpha = !!abuf0;
2909
21.6k
    int i;
2910
2911
21.6k
    if (uvalpha < 2048) {
2912
399k
        for (i = 0; i < dstW; i++) {
2913
380k
            int Y = (buf0[i] + 64) >> 7;
2914
380k
            int U = (ubuf[0][i] + 64) >> 7;
2915
380k
            int V = (vbuf[0][i] + 64) >> 7;
2916
380k
            int A = 255;
2917
2918
380k
            if (Y & 0x100)
2919
33.6k
                Y = av_clip_uint8(Y);
2920
380k
            if (U & 0x100)
2921
26.7k
                U = av_clip_uint8(U);
2922
380k
            if (V & 0x100)
2923
12.2k
                V = av_clip_uint8(V);
2924
2925
380k
            if (hasAlpha) {
2926
205k
                A = (abuf0[i] + 64) >> 7;
2927
205k
                if (A & 0x100)
2928
11.9k
                    A = av_clip_uint8(A);
2929
205k
            }
2930
2931
380k
            output_pixels(i * 4, A, Y, U, V)
2932
380k
        }
2933
19.0k
    } else {
2934
269k
        for (i = 0; i < dstW; i++) {
2935
266k
            int Y = (buf0[i] + 64) >> 7;
2936
266k
            int U = (ubuf[0][i] + ubuf[1][i] + 128) >> 8;
2937
266k
            int V = (vbuf[0][i] + vbuf[1][i] + 128) >> 8;
2938
266k
            int A = 255;
2939
2940
266k
            if (Y & 0x100)
2941
15.3k
                Y = av_clip_uint8(Y);
2942
266k
            if (U & 0x100)
2943
3.30k
                U = av_clip_uint8(U);
2944
266k
            if (V & 0x100)
2945
1.47k
                V = av_clip_uint8(V);
2946
2947
266k
            if (hasAlpha) {
2948
131k
                A = (abuf0[i] + 64) >> 7;
2949
131k
                if (A & 0x100)
2950
8.24k
                    A = av_clip_uint8(A);
2951
131k
            }
2952
2953
266k
            output_pixels(i * 4, A, Y, U, V)
2954
266k
        }
2955
2.52k
    }
2956
21.6k
}
2957
2958
static av_always_inline void
2959
yuv2ayuv_2_c_template(SwsInternal *c, const int16_t *buf[2],
2960
                      const int16_t *ubuf[2], const int16_t *vbuf[2],
2961
                      const int16_t *abuf[2], uint8_t *dest, int dstW,
2962
                      int yalpha, int uvalpha, int y,
2963
                      enum AVPixelFormat target)
2964
49.0k
{
2965
49.0k
    int hasAlpha = abuf && abuf[0] && abuf[1];
2966
49.0k
    const int16_t *buf0  = buf[0],  *buf1  = buf[1],
2967
49.0k
                  *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
2968
49.0k
                  *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
2969
49.0k
                  *abuf0 = hasAlpha ? abuf[0] : NULL,
2970
49.0k
                  *abuf1 = hasAlpha ? abuf[1] : NULL;
2971
49.0k
    int yalpha1  = 4096 - yalpha;
2972
49.0k
    int uvalpha1 = 4096 - uvalpha;
2973
49.0k
    int i;
2974
2975
49.0k
    av_assert2(yalpha  <= 4096U);
2976
49.0k
    av_assert2(uvalpha <= 4096U);
2977
2978
346k
    for (i = 0; i < dstW; i++) {
2979
297k
        int Y = (buf0[i]  * yalpha1  + buf1[i]  * yalpha)  >> 19;
2980
297k
        int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha) >> 19;
2981
297k
        int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha) >> 19;
2982
297k
        int A = 255;
2983
2984
297k
        if (Y & 0x100)
2985
3.60k
            Y = av_clip_uint8(Y);
2986
297k
        if (U & 0x100)
2987
2.91k
            U = av_clip_uint8(U);
2988
297k
        if (V & 0x100)
2989
2.58k
            V = av_clip_uint8(V);
2990
2991
297k
        if (hasAlpha) {
2992
141k
            A = (abuf0[i] * yalpha1 + abuf1[i] * yalpha) >> 19;
2993
141k
            A = av_clip_uint8(A);
2994
141k
        }
2995
2996
297k
        output_pixels(i * 4, A, Y, U, V)
2997
297k
    }
2998
49.0k
}
2999
3000
static av_always_inline void
3001
yuv2ayuv_X_c_template(SwsInternal *c, const int16_t *lumFilter,
3002
                      const int16_t **lumSrc, int lumFilterSize,
3003
                      const int16_t *chrFilter, const int16_t **chrUSrc,
3004
                      const int16_t **chrVSrc, int chrFilterSize,
3005
                      const int16_t **alpSrc, uint8_t *dest, int dstW,
3006
                      int y, enum AVPixelFormat target)
3007
126k
{
3008
126k
    int i;
3009
3010
486k
    for (i = 0; i < dstW; i++) {
3011
360k
        int j;
3012
360k
        int Y = 1 << 18, U = 1 << 18;
3013
360k
        int V = 1 << 18, A = 255;
3014
3015
5.26M
        for (j = 0; j < lumFilterSize; j++)
3016
4.90M
            Y += lumSrc[j][i] * (unsigned)lumFilter[j];
3017
3018
4.02M
        for (j = 0; j < chrFilterSize; j++)
3019
3.66M
            U += chrUSrc[j][i] * (unsigned)chrFilter[j];
3020
3021
4.02M
        for (j = 0; j < chrFilterSize; j++)
3022
3.66M
            V += chrVSrc[j][i] * (unsigned)chrFilter[j];
3023
3024
360k
        Y >>= 19;
3025
360k
        U >>= 19;
3026
360k
        V >>= 19;
3027
3028
360k
        if (Y  & 0x100)
3029
12.8k
            Y = av_clip_uint8(Y);
3030
360k
        if (U  & 0x100)
3031
7.29k
            U = av_clip_uint8(U);
3032
360k
        if (V  & 0x100)
3033
6.05k
            V = av_clip_uint8(V);
3034
3035
360k
        if (alpSrc) {
3036
213k
            A = 1 << 18;
3037
3038
3.27M
            for (j = 0; j < lumFilterSize; j++)
3039
3.06M
                A += alpSrc[j][i] * (unsigned)lumFilter[j];
3040
3041
213k
            A >>= 19;
3042
3043
213k
            if (A & 0x100)
3044
37.1k
                A = av_clip_uint8(A);
3045
213k
        }
3046
3047
360k
        output_pixels(i * 4, A, Y, U, V)
3048
360k
    }
3049
126k
}
3050
3051
#undef output_pixels
3052
3053
#define AYUVPACKEDWRAPPER(name, fmt) \
3054
static void yuv2 ## name ## _X_c(SwsInternal *c, const int16_t *lumFilter, \
3055
                                 const int16_t **lumSrc, int lumFilterSize, \
3056
                                 const int16_t *chrFilter, const int16_t **chrUSrc, \
3057
                                 const int16_t **chrVSrc, int chrFilterSize, \
3058
                                 const int16_t **alpSrc, uint8_t *dest, int dstW, \
3059
126k
                                 int y) \
3060
126k
{ \
3061
126k
    yuv2ayuv_X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
3062
126k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
3063
126k
                          alpSrc, dest, dstW, y, fmt); \
3064
126k
} \
output.c:yuv2ayuv_X_c
Line
Count
Source
3059
25.3k
                                 int y) \
3060
25.3k
{ \
3061
25.3k
    yuv2ayuv_X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
3062
25.3k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
3063
25.3k
                          alpSrc, dest, dstW, y, fmt); \
3064
25.3k
} \
output.c:yuv2vuyX_X_c
Line
Count
Source
3059
45.8k
                                 int y) \
3060
45.8k
{ \
3061
45.8k
    yuv2ayuv_X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
3062
45.8k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
3063
45.8k
                          alpSrc, dest, dstW, y, fmt); \
3064
45.8k
} \
output.c:yuv2uyva_X_c
Line
Count
Source
3059
54.8k
                                 int y) \
3060
54.8k
{ \
3061
54.8k
    yuv2ayuv_X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
3062
54.8k
                          chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
3063
54.8k
                          alpSrc, dest, dstW, y, fmt); \
3064
54.8k
} \
3065
 \
3066
static void yuv2 ## name ## _2_c(SwsInternal *c, const int16_t *buf[2], \
3067
                                 const int16_t *ubuf[2], const int16_t *vbuf[2], \
3068
                                 const int16_t *abuf[2], uint8_t *dest, int dstW, \
3069
49.0k
                                 int yalpha, int uvalpha, int y) \
3070
49.0k
{ \
3071
49.0k
    yuv2ayuv_2_c_template(c, buf, ubuf, vbuf, abuf, \
3072
49.0k
                          dest, dstW, yalpha, uvalpha, y, fmt); \
3073
49.0k
} \
output.c:yuv2ayuv_2_c
Line
Count
Source
3069
17.9k
                                 int yalpha, int uvalpha, int y) \
3070
17.9k
{ \
3071
17.9k
    yuv2ayuv_2_c_template(c, buf, ubuf, vbuf, abuf, \
3072
17.9k
                          dest, dstW, yalpha, uvalpha, y, fmt); \
3073
17.9k
} \
output.c:yuv2vuyX_2_c
Line
Count
Source
3069
25.9k
                                 int yalpha, int uvalpha, int y) \
3070
25.9k
{ \
3071
25.9k
    yuv2ayuv_2_c_template(c, buf, ubuf, vbuf, abuf, \
3072
25.9k
                          dest, dstW, yalpha, uvalpha, y, fmt); \
3073
25.9k
} \
output.c:yuv2uyva_2_c
Line
Count
Source
3069
5.16k
                                 int yalpha, int uvalpha, int y) \
3070
5.16k
{ \
3071
5.16k
    yuv2ayuv_2_c_template(c, buf, ubuf, vbuf, abuf, \
3072
5.16k
                          dest, dstW, yalpha, uvalpha, y, fmt); \
3073
5.16k
} \
3074
 \
3075
static void yuv2 ## name ## _1_c(SwsInternal *c, const int16_t *buf0, \
3076
                                 const int16_t *ubuf[2], const int16_t *vbuf[2], \
3077
                                 const int16_t *abuf0, uint8_t *dest, int dstW, \
3078
21.6k
                                 int uvalpha, int y) \
3079
21.6k
{ \
3080
21.6k
    yuv2ayuv_1_c_template(c, buf0, ubuf, vbuf, \
3081
21.6k
                          abuf0, dest, dstW, uvalpha, \
3082
21.6k
                          y, fmt); \
3083
21.6k
}
output.c:yuv2ayuv_1_c
Line
Count
Source
3078
12.3k
                                 int uvalpha, int y) \
3079
12.3k
{ \
3080
12.3k
    yuv2ayuv_1_c_template(c, buf0, ubuf, vbuf, \
3081
12.3k
                          abuf0, dest, dstW, uvalpha, \
3082
12.3k
                          y, fmt); \
3083
12.3k
}
output.c:yuv2vuyX_1_c
Line
Count
Source
3078
2.50k
                                 int uvalpha, int y) \
3079
2.50k
{ \
3080
2.50k
    yuv2ayuv_1_c_template(c, buf0, ubuf, vbuf, \
3081
2.50k
                          abuf0, dest, dstW, uvalpha, \
3082
2.50k
                          y, fmt); \
3083
2.50k
}
output.c:yuv2uyva_1_c
Line
Count
Source
3078
6.74k
                                 int uvalpha, int y) \
3079
6.74k
{ \
3080
6.74k
    yuv2ayuv_1_c_template(c, buf0, ubuf, vbuf, \
3081
6.74k
                          abuf0, dest, dstW, uvalpha, \
3082
6.74k
                          y, fmt); \
3083
6.74k
}
3084
3085
AYUVPACKEDWRAPPER(vuyX, AV_PIX_FMT_VUYX)
3086
AYUVPACKEDWRAPPER(ayuv, AV_PIX_FMT_AYUV)
3087
AYUVPACKEDWRAPPER(uyva, AV_PIX_FMT_UYVA)
3088
3089
#define output_pixel(pos, val, bits) \
3090
903k
    AV_WL16(pos, av_clip_uintp2(val >> shift, bits) << output_shift);
3091
3092
#define yuv2y2xx_wrapper(bits)                                          \
3093
    static void                                                         \
3094
    yuv2y2 ## bits ## le_X_c(SwsInternal *c, const int16_t *lumFilter,  \
3095
                            const int16_t **lumSrc, int lumFilterSize,  \
3096
                            const int16_t *chrFilter,                   \
3097
                            const int16_t **chrUSrc,                    \
3098
                            const int16_t **chrVSrc, int chrFilterSize, \
3099
                            const int16_t **alpSrc,                     \
3100
                            uint8_t *dest, int dstW, int y)             \
3101
90.2k
    {                                                                   \
3102
90.2k
        int i, j;                                                       \
3103
90.2k
        int shift = 11 + 16 - bits;                                     \
3104
90.2k
        int output_shift = 16 - bits;                                   \
3105
315k
        for (i = 0; i < ((dstW + 1) >> 1); i++) {                       \
3106
225k
            int Y1 = 1 << (shift - 1), Y2 = 1 << (shift - 1);           \
3107
225k
            int U  = 1 << (shift - 1), V  = 1 << (shift - 1);           \
3108
225k
                                                                        \
3109
1.30M
            for (j = 0; j < lumFilterSize; j++) {                       \
3110
1.07M
                Y1 += lumSrc[j][i * 2]     * (unsigned)lumFilter[j];    \
3111
1.07M
                Y2 += lumSrc[j][i * 2 + 1] * (unsigned)lumFilter[j];    \
3112
1.07M
            }                                                           \
3113
225k
                                                                        \
3114
1.15M
            for (j = 0; j < chrFilterSize; j++) {                       \
3115
931k
                U += chrUSrc[j][i] * (unsigned)chrFilter[j];            \
3116
931k
                V += chrVSrc[j][i] * (unsigned)chrFilter[j];            \
3117
931k
            }                                                           \
3118
225k
                                                                        \
3119
225k
            output_pixel(dest + 8 * i + 0, Y1, bits);                   \
3120
225k
            output_pixel(dest + 8 * i + 2,  U, bits);                   \
3121
225k
            output_pixel(dest + 8 * i + 4, Y2, bits);                   \
3122
225k
            output_pixel(dest + 8 * i + 6,  V, bits);                   \
3123
225k
        }                                                               \
3124
90.2k
    }
output.c:yuv2y210le_X_c
Line
Count
Source
3101
34.0k
    {                                                                   \
3102
34.0k
        int i, j;                                                       \
3103
34.0k
        int shift = 11 + 16 - bits;                                     \
3104
34.0k
        int output_shift = 16 - bits;                                   \
3105
158k
        for (i = 0; i < ((dstW + 1) >> 1); i++) {                       \
3106
124k
            int Y1 = 1 << (shift - 1), Y2 = 1 << (shift - 1);           \
3107
124k
            int U  = 1 << (shift - 1), V  = 1 << (shift - 1);           \
3108
124k
                                                                        \
3109
480k
            for (j = 0; j < lumFilterSize; j++) {                       \
3110
356k
                Y1 += lumSrc[j][i * 2]     * (unsigned)lumFilter[j];    \
3111
356k
                Y2 += lumSrc[j][i * 2 + 1] * (unsigned)lumFilter[j];    \
3112
356k
            }                                                           \
3113
124k
                                                                        \
3114
415k
            for (j = 0; j < chrFilterSize; j++) {                       \
3115
290k
                U += chrUSrc[j][i] * (unsigned)chrFilter[j];            \
3116
290k
                V += chrVSrc[j][i] * (unsigned)chrFilter[j];            \
3117
290k
            }                                                           \
3118
124k
                                                                        \
3119
124k
            output_pixel(dest + 8 * i + 0, Y1, bits);                   \
3120
124k
            output_pixel(dest + 8 * i + 2,  U, bits);                   \
3121
124k
            output_pixel(dest + 8 * i + 4, Y2, bits);                   \
3122
124k
            output_pixel(dest + 8 * i + 6,  V, bits);                   \
3123
124k
        }                                                               \
3124
34.0k
    }
output.c:yuv2y212le_X_c
Line
Count
Source
3101
56.2k
    {                                                                   \
3102
56.2k
        int i, j;                                                       \
3103
56.2k
        int shift = 11 + 16 - bits;                                     \
3104
56.2k
        int output_shift = 16 - bits;                                   \
3105
157k
        for (i = 0; i < ((dstW + 1) >> 1); i++) {                       \
3106
101k
            int Y1 = 1 << (shift - 1), Y2 = 1 << (shift - 1);           \
3107
101k
            int U  = 1 << (shift - 1), V  = 1 << (shift - 1);           \
3108
101k
                                                                        \
3109
825k
            for (j = 0; j < lumFilterSize; j++) {                       \
3110
723k
                Y1 += lumSrc[j][i * 2]     * (unsigned)lumFilter[j];    \
3111
723k
                Y2 += lumSrc[j][i * 2 + 1] * (unsigned)lumFilter[j];    \
3112
723k
            }                                                           \
3113
101k
                                                                        \
3114
741k
            for (j = 0; j < chrFilterSize; j++) {                       \
3115
640k
                U += chrUSrc[j][i] * (unsigned)chrFilter[j];            \
3116
640k
                V += chrVSrc[j][i] * (unsigned)chrFilter[j];            \
3117
640k
            }                                                           \
3118
101k
                                                                        \
3119
101k
            output_pixel(dest + 8 * i + 0, Y1, bits);                   \
3120
101k
            output_pixel(dest + 8 * i + 2,  U, bits);                   \
3121
101k
            output_pixel(dest + 8 * i + 4, Y2, bits);                   \
3122
101k
            output_pixel(dest + 8 * i + 6,  V, bits);                   \
3123
101k
        }                                                               \
3124
56.2k
    }
3125
3126
yuv2y2xx_wrapper(10)
3127
yuv2y2xx_wrapper(12)
3128
3129
static void
3130
yuv2y216le_X_c(SwsInternal *c, const int16_t *lumFilter,
3131
               const int16_t **_lumSrc, int lumFilterSize,
3132
               const int16_t *chrFilter,
3133
               const int16_t **_chrUSrc,
3134
               const int16_t **_chrVSrc, int chrFilterSize,
3135
               const int16_t **_alpSrc,
3136
               uint8_t *dest, int dstW, int y)
3137
17.4k
{
3138
17.4k
    const int32_t **lumSrc  = (const int32_t **)_lumSrc;
3139
17.4k
    const int32_t **chrUSrc = (const int32_t **)_chrUSrc;
3140
17.4k
    const int32_t **chrVSrc = (const int32_t **)_chrVSrc;
3141
17.4k
    int shift = 15;
3142
3143
144k
    for (int i = 0; i < ((dstW + 1) >> 1); i++) {
3144
127k
        int Y1 = 1 << (shift - 1), Y2 = 1 << (shift - 1);
3145
127k
        int U  = 1 << (shift - 1), V  = 1 << (shift - 1);
3146
3147
        /* See yuv2planeX_16_c_template for details. */
3148
127k
        Y1 -= 0x40000000;
3149
127k
        U  -= 0x40000000;
3150
127k
        Y2 -= 0x40000000;
3151
127k
        V  -= 0x40000000;
3152
3153
1.63M
        for (int j = 0; j < lumFilterSize; j++) {
3154
1.50M
            Y1 += lumSrc[j][i * 2]     * (unsigned)lumFilter[j];
3155
1.50M
            Y2 += lumSrc[j][i * 2 + 1] * (unsigned)lumFilter[j];
3156
1.50M
        }
3157
3158
1.04M
        for (int j = 0; j < chrFilterSize; j++) {
3159
914k
            U += chrUSrc[j][i] * (unsigned)chrFilter[j];
3160
914k
            V += chrVSrc[j][i] * (unsigned)chrFilter[j];
3161
914k
        }
3162
3163
127k
        AV_WL16(dest + 8 * i + 0, 0x8000 + av_clip_int16(Y1 >> shift));
3164
127k
        AV_WL16(dest + 8 * i + 2, 0x8000 + av_clip_int16(U  >> shift));
3165
127k
        AV_WL16(dest + 8 * i + 4, 0x8000 + av_clip_int16(Y2 >> shift));
3166
127k
        AV_WL16(dest + 8 * i + 6, 0x8000 + av_clip_int16(V  >> shift));
3167
127k
    }
3168
17.4k
}
3169
3170
static void
3171
yuv2vyu444_1_c(SwsInternal *c, const int16_t *buf0,
3172
               const int16_t *ubuf[2], const int16_t *vbuf[2],
3173
               const int16_t *abuf0, uint8_t *dest, int dstW,
3174
               int uvalpha, int y)
3175
10.3k
{
3176
10.3k
    int i;
3177
3178
10.3k
    if (uvalpha < 2048) {
3179
114k
        for (i = 0; i < dstW; i++) {
3180
107k
            int Y = (buf0[i] + 64) >> 7;
3181
107k
            int U = (ubuf[0][i] + 64) >> 7;
3182
107k
            int V = (vbuf[0][i] + 64) >> 7;
3183
3184
107k
            if (Y & 0x100)
3185
4.44k
                Y = av_clip_uint8(Y);
3186
107k
            if (U & 0x100)
3187
4.74k
                U = av_clip_uint8(U);
3188
107k
            if (V & 0x100)
3189
5.03k
                V = av_clip_uint8(V);
3190
3191
107k
            dest[3 * i    ] = V;
3192
107k
            dest[3 * i + 1] = Y;
3193
107k
            dest[3 * i + 2] = U;
3194
107k
        }
3195
6.97k
    } else {
3196
100k
        for (i = 0; i < dstW; i++) {
3197
96.7k
            int Y = (buf0[i] + 64) >> 7;
3198
96.7k
            int U = (ubuf[0][i] + ubuf[1][i] + 128) >> 8;
3199
96.7k
            int V = (vbuf[0][i] + vbuf[1][i] + 128) >> 8;
3200
3201
96.7k
            if (Y & 0x100)
3202
538
                Y = av_clip_uint8(Y);
3203
96.7k
            if (U & 0x100)
3204
475
                U = av_clip_uint8(U);
3205
96.7k
            if (V & 0x100)
3206
540
                V = av_clip_uint8(V);
3207
3208
96.7k
            dest[3 * i    ] = V;
3209
96.7k
            dest[3 * i + 1] = Y;
3210
96.7k
            dest[3 * i + 2] = U;
3211
96.7k
        }
3212
3.39k
    }
3213
10.3k
}
3214
3215
static void
3216
yuv2vyu444_2_c(SwsInternal *c, const int16_t *buf[2],
3217
               const int16_t *ubuf[2], const int16_t *vbuf[2],
3218
               const int16_t *abuf[2], uint8_t *dest, int dstW,
3219
               int yalpha, int uvalpha, int y)
3220
5.35k
{
3221
5.35k
    const int16_t *buf0  = buf[0],  *buf1  = buf[1],
3222
5.35k
                  *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
3223
5.35k
                  *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];
3224
5.35k
    int yalpha1  = 4096 - yalpha;
3225
5.35k
    int uvalpha1 = 4096 - uvalpha;
3226
5.35k
    int i;
3227
3228
5.35k
    av_assert2(yalpha  <= 4096U);
3229
5.35k
    av_assert2(uvalpha <= 4096U);
3230
3231
60.4k
    for (i = 0; i < dstW; i++) {
3232
55.1k
        int Y = (buf0[i]  * yalpha1  + buf1[i]  * yalpha)  >> 19;
3233
55.1k
        int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha) >> 19;
3234
55.1k
        int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha) >> 19;
3235
3236
55.1k
        if (Y & 0x100)
3237
2.22k
            Y = av_clip_uint8(Y);
3238
55.1k
        if (U & 0x100)
3239
1.48k
            U = av_clip_uint8(U);
3240
55.1k
        if (V & 0x100)
3241
999
            V = av_clip_uint8(V);
3242
3243
55.1k
        dest[3 * i    ] = V;
3244
55.1k
        dest[3 * i + 1] = Y;
3245
55.1k
        dest[3 * i + 2] = U;
3246
55.1k
    }
3247
5.35k
}
3248
3249
static void
3250
yuv2vyu444_X_c(SwsInternal *c, const int16_t *lumFilter,
3251
               const int16_t **lumSrc, int lumFilterSize,
3252
               const int16_t *chrFilter, const int16_t **chrUSrc,
3253
               const int16_t **chrVSrc, int chrFilterSize,
3254
               const int16_t **alpSrc, uint8_t *dest, int dstW, int y)
3255
28.3k
{
3256
28.3k
    int i;
3257
3258
126k
    for (i = 0; i < dstW; i++) {
3259
98.2k
        int j;
3260
98.2k
        int Y = 1 << 18, U = 1 << 18;
3261
98.2k
        int V = 1 << 18;
3262
3263
923k
        for (j = 0; j < lumFilterSize; j++)
3264
825k
            Y += lumSrc[j][i] * (unsigned)lumFilter[j];
3265
3266
799k
        for (j = 0; j < chrFilterSize; j++)
3267
701k
            U += chrUSrc[j][i] * (unsigned)chrFilter[j];
3268
3269
799k
        for (j = 0; j < chrFilterSize; j++)
3270
701k
            V += chrVSrc[j][i] * (unsigned)chrFilter[j];
3271
3272
98.2k
        Y >>= 19;
3273
98.2k
        U >>= 19;
3274
98.2k
        V >>= 19;
3275
3276
98.2k
        if (Y  & 0x100)
3277
5.78k
            Y = av_clip_uint8(Y);
3278
98.2k
        if (U  & 0x100)
3279
4.99k
            U = av_clip_uint8(U);
3280
98.2k
        if (V  & 0x100)
3281
3.84k
            V = av_clip_uint8(V);
3282
3283
98.2k
        dest[3 * i    ] = V;
3284
98.2k
        dest[3 * i + 1] = Y;
3285
98.2k
        dest[3 * i + 2] = U;
3286
98.2k
    }
3287
28.3k
}
3288
3289
#undef output_pixel
3290
3291
av_cold void ff_sws_init_output_funcs(SwsInternal *c,
3292
                                      yuv2planar1_fn *yuv2plane1,
3293
                                      yuv2planarX_fn *yuv2planeX,
3294
                                      yuv2interleavedX_fn *yuv2nv12cX,
3295
                                      yuv2packed1_fn *yuv2packed1,
3296
                                      yuv2packed2_fn *yuv2packed2,
3297
                                      yuv2packedX_fn *yuv2packedX,
3298
                                      yuv2anyX_fn *yuv2anyX)
3299
35.8k
{
3300
35.8k
    enum AVPixelFormat dstFormat = c->opts.dst_format;
3301
35.8k
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(dstFormat);
3302
3303
35.8k
    if (isSemiPlanarYUV(dstFormat) && isDataInHighBits(dstFormat)) {
3304
852
        if (desc->comp[0].depth == 10) {
3305
375
            *yuv2plane1 = isBE(dstFormat) ? yuv2p010l1_BE_c : yuv2p010l1_LE_c;
3306
375
            *yuv2planeX = isBE(dstFormat) ? yuv2p010lX_BE_c : yuv2p010lX_LE_c;
3307
375
            *yuv2nv12cX = isBE(dstFormat) ? yuv2p010cX_BE_c : yuv2p010cX_LE_c;
3308
477
        } else if (desc->comp[0].depth == 12) {
3309
477
            *yuv2plane1 = isBE(dstFormat) ? yuv2p012l1_BE_c : yuv2p012l1_LE_c;
3310
477
            *yuv2planeX = isBE(dstFormat) ? yuv2p012lX_BE_c : yuv2p012lX_LE_c;
3311
477
            *yuv2nv12cX = isBE(dstFormat) ? yuv2p012cX_BE_c : yuv2p012cX_LE_c;
3312
477
        } else
3313
0
            av_assert0(0);
3314
35.0k
    } else if (isSemiPlanarYUV(dstFormat) && isNBPS(dstFormat)) {
3315
298
        if (desc->comp[0].depth == 10) {
3316
298
            *yuv2plane1 = isBE(dstFormat) ? yuv2nv20l1_BE_c : yuv2nv20l1_LE_c;
3317
298
            *yuv2planeX = isBE(dstFormat) ? yuv2nv20lX_BE_c : yuv2nv20lX_LE_c;
3318
298
            *yuv2nv12cX = isBE(dstFormat) ? yuv2nv20cX_BE_c : yuv2nv20cX_LE_c;
3319
298
        } else
3320
0
            av_assert0(0);
3321
34.7k
    } else if (is16BPS(dstFormat)) {
3322
11.0k
        *yuv2planeX = isBE(dstFormat) ? yuv2planeX_16BE_c  : yuv2planeX_16LE_c;
3323
11.0k
        *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_16BE_c  : yuv2plane1_16LE_c;
3324
11.0k
        if (isSemiPlanarYUV(dstFormat)) {
3325
237
          *yuv2nv12cX = isBE(dstFormat) ? yuv2nv12cX_16BE_c : yuv2nv12cX_16LE_c;
3326
237
        }
3327
23.7k
    } else if (isDataInHighBits(dstFormat) && isNBPS(dstFormat)) {
3328
1.06k
        if (desc->comp[0].depth == 10) {
3329
421
            *yuv2planeX = isBE(dstFormat) ? yuv2msbplaneX_10BE_c  : yuv2msbplaneX_10LE_c;
3330
421
            *yuv2plane1 = isBE(dstFormat) ? yuv2msbplane1_10BE_c  : yuv2msbplane1_10LE_c;
3331
643
        } else if (desc->comp[0].depth == 12) {
3332
643
            *yuv2planeX = isBE(dstFormat) ? yuv2msbplaneX_12BE_c  : yuv2msbplaneX_12LE_c;
3333
643
            *yuv2plane1 = isBE(dstFormat) ? yuv2msbplane1_12BE_c  : yuv2msbplane1_12LE_c;
3334
643
        } else
3335
0
            av_assert0(0);
3336
22.6k
    } else if (isNBPS(dstFormat)) {
3337
3.16k
        if (desc->comp[0].depth == 9) {
3338
441
            *yuv2planeX = isBE(dstFormat) ? yuv2planeX_9BE_c  : yuv2planeX_9LE_c;
3339
441
            *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_9BE_c  : yuv2plane1_9LE_c;
3340
2.72k
        } else if (desc->comp[0].depth == 10) {
3341
1.79k
            *yuv2planeX = isBE(dstFormat) ? yuv2planeX_10BE_c  : yuv2planeX_10LE_c;
3342
1.79k
            *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_10BE_c  : yuv2plane1_10LE_c;
3343
1.79k
        } else if (desc->comp[0].depth == 12) {
3344
508
            *yuv2planeX = isBE(dstFormat) ? yuv2planeX_12BE_c  : yuv2planeX_12LE_c;
3345
508
            *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_12BE_c  : yuv2plane1_12LE_c;
3346
508
        } else if (desc->comp[0].depth == 14) {
3347
422
            *yuv2planeX = isBE(dstFormat) ? yuv2planeX_14BE_c  : yuv2planeX_14LE_c;
3348
422
            *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_14BE_c  : yuv2plane1_14LE_c;
3349
422
        } else
3350
0
            av_assert0(0);
3351
19.5k
    } else if (dstFormat == AV_PIX_FMT_GRAYF32BE) {
3352
113
        *yuv2planeX = yuv2planeX_floatBE_c;
3353
113
        *yuv2plane1 = yuv2plane1_floatBE_c;
3354
19.3k
    } else if (dstFormat == AV_PIX_FMT_GRAYF32LE) {
3355
144
        *yuv2planeX = yuv2planeX_floatLE_c;
3356
144
        *yuv2plane1 = yuv2plane1_floatLE_c;
3357
19.2k
    } else {
3358
19.2k
        *yuv2plane1 = yuv2plane1_8_c;
3359
19.2k
        *yuv2planeX = yuv2planeX_8_c;
3360
19.2k
        if (isSemiPlanarYUV(dstFormat))
3361
185
            *yuv2nv12cX = yuv2nv12cX_c;
3362
19.2k
    }
3363
3364
35.8k
    if(c->opts.flags & SWS_FULL_CHR_H_INT) {
3365
17.5k
        switch (dstFormat) {
3366
908
            case AV_PIX_FMT_RGBA:
3367
#if CONFIG_SMALL
3368
                *yuv2packedX = yuv2rgba32_full_X_c;
3369
                *yuv2packed2 = yuv2rgba32_full_2_c;
3370
                *yuv2packed1 = yuv2rgba32_full_1_c;
3371
#else
3372
908
#if CONFIG_SWSCALE_ALPHA
3373
908
                if (c->needAlpha) {
3374
476
                    *yuv2packedX = yuv2rgba32_full_X_c;
3375
476
                    *yuv2packed2 = yuv2rgba32_full_2_c;
3376
476
                    *yuv2packed1 = yuv2rgba32_full_1_c;
3377
476
                } else
3378
432
#endif /* CONFIG_SWSCALE_ALPHA */
3379
432
                {
3380
432
                    *yuv2packedX = yuv2rgbx32_full_X_c;
3381
432
                    *yuv2packed2 = yuv2rgbx32_full_2_c;
3382
432
                    *yuv2packed1 = yuv2rgbx32_full_1_c;
3383
432
                }
3384
908
#endif /* !CONFIG_SMALL */
3385
908
                break;
3386
948
            case AV_PIX_FMT_ARGB:
3387
#if CONFIG_SMALL
3388
                *yuv2packedX = yuv2argb32_full_X_c;
3389
                *yuv2packed2 = yuv2argb32_full_2_c;
3390
                *yuv2packed1 = yuv2argb32_full_1_c;
3391
#else
3392
948
#if CONFIG_SWSCALE_ALPHA
3393
948
                if (c->needAlpha) {
3394
508
                    *yuv2packedX = yuv2argb32_full_X_c;
3395
508
                    *yuv2packed2 = yuv2argb32_full_2_c;
3396
508
                    *yuv2packed1 = yuv2argb32_full_1_c;
3397
508
                } else
3398
440
#endif /* CONFIG_SWSCALE_ALPHA */
3399
440
                {
3400
440
                    *yuv2packedX = yuv2xrgb32_full_X_c;
3401
440
                    *yuv2packed2 = yuv2xrgb32_full_2_c;
3402
440
                    *yuv2packed1 = yuv2xrgb32_full_1_c;
3403
440
                }
3404
948
#endif /* !CONFIG_SMALL */
3405
948
                break;
3406
955
            case AV_PIX_FMT_BGRA:
3407
#if CONFIG_SMALL
3408
                *yuv2packedX = yuv2bgra32_full_X_c;
3409
                *yuv2packed2 = yuv2bgra32_full_2_c;
3410
                *yuv2packed1 = yuv2bgra32_full_1_c;
3411
#else
3412
955
#if CONFIG_SWSCALE_ALPHA
3413
955
                if (c->needAlpha) {
3414
537
                    *yuv2packedX = yuv2bgra32_full_X_c;
3415
537
                    *yuv2packed2 = yuv2bgra32_full_2_c;
3416
537
                    *yuv2packed1 = yuv2bgra32_full_1_c;
3417
537
                } else
3418
418
#endif /* CONFIG_SWSCALE_ALPHA */
3419
418
                {
3420
418
                    *yuv2packedX = yuv2bgrx32_full_X_c;
3421
418
                    *yuv2packed2 = yuv2bgrx32_full_2_c;
3422
418
                    *yuv2packed1 = yuv2bgrx32_full_1_c;
3423
418
                }
3424
955
#endif /* !CONFIG_SMALL */
3425
955
                break;
3426
981
            case AV_PIX_FMT_ABGR:
3427
#if CONFIG_SMALL
3428
                *yuv2packedX = yuv2abgr32_full_X_c;
3429
                *yuv2packed2 = yuv2abgr32_full_2_c;
3430
                *yuv2packed1 = yuv2abgr32_full_1_c;
3431
#else
3432
981
#if CONFIG_SWSCALE_ALPHA
3433
981
                if (c->needAlpha) {
3434
538
                    *yuv2packedX = yuv2abgr32_full_X_c;
3435
538
                    *yuv2packed2 = yuv2abgr32_full_2_c;
3436
538
                    *yuv2packed1 = yuv2abgr32_full_1_c;
3437
538
                } else
3438
443
#endif /* CONFIG_SWSCALE_ALPHA */
3439
443
                {
3440
443
                    *yuv2packedX = yuv2xbgr32_full_X_c;
3441
443
                    *yuv2packed2 = yuv2xbgr32_full_2_c;
3442
443
                    *yuv2packed1 = yuv2xbgr32_full_1_c;
3443
443
                }
3444
981
#endif /* !CONFIG_SMALL */
3445
981
                break;
3446
686
        case AV_PIX_FMT_RGBA64LE:
3447
686
#if CONFIG_SWSCALE_ALPHA
3448
686
            if (c->needAlpha) {
3449
415
                *yuv2packedX = yuv2rgba64le_full_X_c;
3450
415
                *yuv2packed2 = yuv2rgba64le_full_2_c;
3451
415
                *yuv2packed1 = yuv2rgba64le_full_1_c;
3452
415
            } else
3453
271
#endif /* CONFIG_SWSCALE_ALPHA */
3454
271
            {
3455
271
                *yuv2packedX = yuv2rgbx64le_full_X_c;
3456
271
                *yuv2packed2 = yuv2rgbx64le_full_2_c;
3457
271
                *yuv2packed1 = yuv2rgbx64le_full_1_c;
3458
271
            }
3459
686
            break;
3460
757
        case AV_PIX_FMT_RGBA64BE:
3461
757
#if CONFIG_SWSCALE_ALPHA
3462
757
            if (c->needAlpha) {
3463
444
                *yuv2packedX = yuv2rgba64be_full_X_c;
3464
444
                *yuv2packed2 = yuv2rgba64be_full_2_c;
3465
444
                *yuv2packed1 = yuv2rgba64be_full_1_c;
3466
444
            } else
3467
313
#endif /* CONFIG_SWSCALE_ALPHA */
3468
313
            {
3469
313
                *yuv2packedX = yuv2rgbx64be_full_X_c;
3470
313
                *yuv2packed2 = yuv2rgbx64be_full_2_c;
3471
313
                *yuv2packed1 = yuv2rgbx64be_full_1_c;
3472
313
            }
3473
757
            break;
3474
691
        case AV_PIX_FMT_BGRA64LE:
3475
691
#if CONFIG_SWSCALE_ALPHA
3476
691
            if (c->needAlpha) {
3477
433
                *yuv2packedX = yuv2bgra64le_full_X_c;
3478
433
                *yuv2packed2 = yuv2bgra64le_full_2_c;
3479
433
                *yuv2packed1 = yuv2bgra64le_full_1_c;
3480
433
            } else
3481
258
#endif /* CONFIG_SWSCALE_ALPHA */
3482
258
            {
3483
258
                *yuv2packedX = yuv2bgrx64le_full_X_c;
3484
258
                *yuv2packed2 = yuv2bgrx64le_full_2_c;
3485
258
                *yuv2packed1 = yuv2bgrx64le_full_1_c;
3486
258
            }
3487
691
            break;
3488
700
        case AV_PIX_FMT_BGRA64BE:
3489
700
#if CONFIG_SWSCALE_ALPHA
3490
700
            if (c->needAlpha) {
3491
424
                *yuv2packedX = yuv2bgra64be_full_X_c;
3492
424
                *yuv2packed2 = yuv2bgra64be_full_2_c;
3493
424
                *yuv2packed1 = yuv2bgra64be_full_1_c;
3494
424
            } else
3495
276
#endif /* CONFIG_SWSCALE_ALPHA */
3496
276
            {
3497
276
                *yuv2packedX = yuv2bgrx64be_full_X_c;
3498
276
                *yuv2packed2 = yuv2bgrx64be_full_2_c;
3499
276
                *yuv2packed1 = yuv2bgrx64be_full_1_c;
3500
276
            }
3501
700
            break;
3502
3503
501
        case AV_PIX_FMT_RGB24:
3504
501
            *yuv2packedX = yuv2rgb24_full_X_c;
3505
501
            *yuv2packed2 = yuv2rgb24_full_2_c;
3506
501
            *yuv2packed1 = yuv2rgb24_full_1_c;
3507
501
            break;
3508
422
        case AV_PIX_FMT_BGR24:
3509
422
            *yuv2packedX = yuv2bgr24_full_X_c;
3510
422
            *yuv2packed2 = yuv2bgr24_full_2_c;
3511
422
            *yuv2packed1 = yuv2bgr24_full_1_c;
3512
422
            break;
3513
371
        case AV_PIX_FMT_RGB48LE:
3514
371
            *yuv2packedX = yuv2rgb48le_full_X_c;
3515
371
            *yuv2packed2 = yuv2rgb48le_full_2_c;
3516
371
            *yuv2packed1 = yuv2rgb48le_full_1_c;
3517
371
            break;
3518
307
        case AV_PIX_FMT_BGR48LE:
3519
307
            *yuv2packedX = yuv2bgr48le_full_X_c;
3520
307
            *yuv2packed2 = yuv2bgr48le_full_2_c;
3521
307
            *yuv2packed1 = yuv2bgr48le_full_1_c;
3522
307
            break;
3523
330
        case AV_PIX_FMT_RGB48BE:
3524
330
            *yuv2packedX = yuv2rgb48be_full_X_c;
3525
330
            *yuv2packed2 = yuv2rgb48be_full_2_c;
3526
330
            *yuv2packed1 = yuv2rgb48be_full_1_c;
3527
330
            break;
3528
295
        case AV_PIX_FMT_BGR48BE:
3529
295
            *yuv2packedX = yuv2bgr48be_full_X_c;
3530
295
            *yuv2packed2 = yuv2bgr48be_full_2_c;
3531
295
            *yuv2packed1 = yuv2bgr48be_full_1_c;
3532
295
            break;
3533
712
        case AV_PIX_FMT_BGR4_BYTE:
3534
712
            *yuv2packedX = yuv2bgr4_byte_full_X_c;
3535
712
            *yuv2packed2 = yuv2bgr4_byte_full_2_c;
3536
712
            *yuv2packed1 = yuv2bgr4_byte_full_1_c;
3537
712
            break;
3538
846
        case AV_PIX_FMT_RGB4_BYTE:
3539
846
            *yuv2packedX = yuv2rgb4_byte_full_X_c;
3540
846
            *yuv2packed2 = yuv2rgb4_byte_full_2_c;
3541
846
            *yuv2packed1 = yuv2rgb4_byte_full_1_c;
3542
846
            break;
3543
695
        case AV_PIX_FMT_BGR8:
3544
695
            *yuv2packedX = yuv2bgr8_full_X_c;
3545
695
            *yuv2packed2 = yuv2bgr8_full_2_c;
3546
695
            *yuv2packed1 = yuv2bgr8_full_1_c;
3547
695
            break;
3548
720
        case AV_PIX_FMT_RGB8:
3549
720
            *yuv2packedX = yuv2rgb8_full_X_c;
3550
720
            *yuv2packed2 = yuv2rgb8_full_2_c;
3551
720
            *yuv2packed1 = yuv2rgb8_full_1_c;
3552
720
            break;
3553
422
        case AV_PIX_FMT_X2RGB10LE:
3554
422
            *yuv2packedX = yuv2x2rgb10_full_X_c;
3555
422
            *yuv2packed2 = yuv2x2rgb10_full_2_c;
3556
422
            *yuv2packed1 = yuv2x2rgb10_full_1_c;
3557
422
            break;
3558
371
        case AV_PIX_FMT_X2BGR10LE:
3559
371
            *yuv2packedX = yuv2x2bgr10_full_X_c;
3560
371
            *yuv2packed2 = yuv2x2bgr10_full_2_c;
3561
371
            *yuv2packed1 = yuv2x2bgr10_full_1_c;
3562
371
            break;
3563
26
        case AV_PIX_FMT_GBRP:
3564
46
        case AV_PIX_FMT_GBRP9BE:
3565
63
        case AV_PIX_FMT_GBRP9LE:
3566
72
        case AV_PIX_FMT_GBRP10BE:
3567
86
        case AV_PIX_FMT_GBRP10LE:
3568
123
        case AV_PIX_FMT_GBRP12BE:
3569
138
        case AV_PIX_FMT_GBRP12LE:
3570
152
        case AV_PIX_FMT_GBRP14BE:
3571
158
        case AV_PIX_FMT_GBRP14LE:
3572
261
        case AV_PIX_FMT_GBRAP:
3573
298
        case AV_PIX_FMT_GBRAP10BE:
3574
323
        case AV_PIX_FMT_GBRAP10LE:
3575
363
        case AV_PIX_FMT_GBRAP12BE:
3576
403
        case AV_PIX_FMT_GBRAP12LE:
3577
462
        case AV_PIX_FMT_GBRAP14BE:
3578
500
        case AV_PIX_FMT_GBRAP14LE:
3579
500
            *yuv2anyX = yuv2gbrp_full_X_c;
3580
500
            break;
3581
28
        case AV_PIX_FMT_GBRP10MSBBE:
3582
49
        case AV_PIX_FMT_GBRP10MSBLE:
3583
87
        case AV_PIX_FMT_GBRP12MSBBE:
3584
118
        case AV_PIX_FMT_GBRP12MSBLE:
3585
118
            *yuv2anyX = yuv2gbrpmsb_full_X_c;
3586
118
            break;
3587
48
        case AV_PIX_FMT_GBRP16BE:
3588
79
        case AV_PIX_FMT_GBRP16LE:
3589
157
        case AV_PIX_FMT_GBRAP16BE:
3590
227
        case AV_PIX_FMT_GBRAP16LE:
3591
227
            *yuv2anyX = yuv2gbrp16_full_X_c;
3592
227
            break;
3593
27
        case AV_PIX_FMT_GBRPF32BE:
3594
75
        case AV_PIX_FMT_GBRPF32LE:
3595
165
        case AV_PIX_FMT_GBRAPF32BE:
3596
242
        case AV_PIX_FMT_GBRAPF32LE:
3597
242
            *yuv2anyX = yuv2gbrpf32_full_X_c;
3598
242
            break;
3599
17.5k
        }
3600
17.5k
        if (!*yuv2packedX && !*yuv2anyX)
3601
3.29k
            goto YUV_PACKED;
3602
18.3k
    } else {
3603
21.6k
        YUV_PACKED:
3604
21.6k
        switch (dstFormat) {
3605
925
        case AV_PIX_FMT_RGBA64LE:
3606
925
#if CONFIG_SWSCALE_ALPHA
3607
925
            if (c->needAlpha) {
3608
543
                *yuv2packed1 = yuv2rgba64le_1_c;
3609
543
                *yuv2packed2 = yuv2rgba64le_2_c;
3610
543
                *yuv2packedX = yuv2rgba64le_X_c;
3611
543
            } else
3612
382
#endif /* CONFIG_SWSCALE_ALPHA */
3613
382
            {
3614
382
                *yuv2packed1 = yuv2rgbx64le_1_c;
3615
382
                *yuv2packed2 = yuv2rgbx64le_2_c;
3616
382
                *yuv2packedX = yuv2rgbx64le_X_c;
3617
382
            }
3618
925
            break;
3619
933
        case AV_PIX_FMT_RGBA64BE:
3620
933
#if CONFIG_SWSCALE_ALPHA
3621
933
            if (c->needAlpha) {
3622
599
                *yuv2packed1 = yuv2rgba64be_1_c;
3623
599
                *yuv2packed2 = yuv2rgba64be_2_c;
3624
599
                *yuv2packedX = yuv2rgba64be_X_c;
3625
599
            } else
3626
334
#endif /* CONFIG_SWSCALE_ALPHA */
3627
334
            {
3628
334
                *yuv2packed1 = yuv2rgbx64be_1_c;
3629
334
                *yuv2packed2 = yuv2rgbx64be_2_c;
3630
334
                *yuv2packedX = yuv2rgbx64be_X_c;
3631
334
            }
3632
933
            break;
3633
871
        case AV_PIX_FMT_BGRA64LE:
3634
871
#if CONFIG_SWSCALE_ALPHA
3635
871
            if (c->needAlpha) {
3636
551
                *yuv2packed1 = yuv2bgra64le_1_c;
3637
551
                *yuv2packed2 = yuv2bgra64le_2_c;
3638
551
                *yuv2packedX = yuv2bgra64le_X_c;
3639
551
            } else
3640
320
#endif /* CONFIG_SWSCALE_ALPHA */
3641
320
            {
3642
320
                *yuv2packed1 = yuv2bgrx64le_1_c;
3643
320
                *yuv2packed2 = yuv2bgrx64le_2_c;
3644
320
                *yuv2packedX = yuv2bgrx64le_X_c;
3645
320
            }
3646
871
            break;
3647
886
        case AV_PIX_FMT_BGRA64BE:
3648
886
#if CONFIG_SWSCALE_ALPHA
3649
886
            if (c->needAlpha) {
3650
526
                *yuv2packed1 = yuv2bgra64be_1_c;
3651
526
                *yuv2packed2 = yuv2bgra64be_2_c;
3652
526
                *yuv2packedX = yuv2bgra64be_X_c;
3653
526
            } else
3654
360
#endif /* CONFIG_SWSCALE_ALPHA */
3655
360
            {
3656
360
                *yuv2packed1 = yuv2bgrx64be_1_c;
3657
360
                *yuv2packed2 = yuv2bgrx64be_2_c;
3658
360
                *yuv2packedX = yuv2bgrx64be_X_c;
3659
360
            }
3660
886
            break;
3661
318
        case AV_PIX_FMT_RGB48LE:
3662
318
            *yuv2packed1 = yuv2rgb48le_1_c;
3663
318
            *yuv2packed2 = yuv2rgb48le_2_c;
3664
318
            *yuv2packedX = yuv2rgb48le_X_c;
3665
318
            break;
3666
308
        case AV_PIX_FMT_RGB48BE:
3667
308
            *yuv2packed1 = yuv2rgb48be_1_c;
3668
308
            *yuv2packed2 = yuv2rgb48be_2_c;
3669
308
            *yuv2packedX = yuv2rgb48be_X_c;
3670
308
            break;
3671
290
        case AV_PIX_FMT_BGR48LE:
3672
290
            *yuv2packed1 = yuv2bgr48le_1_c;
3673
290
            *yuv2packed2 = yuv2bgr48le_2_c;
3674
290
            *yuv2packedX = yuv2bgr48le_X_c;
3675
290
            break;
3676
307
        case AV_PIX_FMT_BGR48BE:
3677
307
            *yuv2packed1 = yuv2bgr48be_1_c;
3678
307
            *yuv2packed2 = yuv2bgr48be_2_c;
3679
307
            *yuv2packedX = yuv2bgr48be_X_c;
3680
307
            break;
3681
163
        case AV_PIX_FMT_RGB32:
3682
420
        case AV_PIX_FMT_BGR32:
3683
#if CONFIG_SMALL
3684
            *yuv2packed1 = yuv2rgb32_1_c;
3685
            *yuv2packed2 = yuv2rgb32_2_c;
3686
            *yuv2packedX = yuv2rgb32_X_c;
3687
#else
3688
420
#if CONFIG_SWSCALE_ALPHA
3689
420
                if (c->needAlpha) {
3690
288
                    *yuv2packed1 = yuv2rgba32_1_c;
3691
288
                    *yuv2packed2 = yuv2rgba32_2_c;
3692
288
                    *yuv2packedX = yuv2rgba32_X_c;
3693
288
                } else
3694
132
#endif /* CONFIG_SWSCALE_ALPHA */
3695
132
                {
3696
132
                    *yuv2packed1 = yuv2rgbx32_1_c;
3697
132
                    *yuv2packed2 = yuv2rgbx32_2_c;
3698
132
                    *yuv2packedX = yuv2rgbx32_X_c;
3699
132
                }
3700
420
#endif /* !CONFIG_SMALL */
3701
420
            break;
3702
188
        case AV_PIX_FMT_RGB32_1:
3703
394
        case AV_PIX_FMT_BGR32_1:
3704
#if CONFIG_SMALL
3705
                *yuv2packed1 = yuv2rgb32_1_1_c;
3706
                *yuv2packed2 = yuv2rgb32_1_2_c;
3707
                *yuv2packedX = yuv2rgb32_1_X_c;
3708
#else
3709
394
#if CONFIG_SWSCALE_ALPHA
3710
394
                if (c->needAlpha) {
3711
276
                    *yuv2packed1 = yuv2rgba32_1_1_c;
3712
276
                    *yuv2packed2 = yuv2rgba32_1_2_c;
3713
276
                    *yuv2packedX = yuv2rgba32_1_X_c;
3714
276
                } else
3715
118
#endif /* CONFIG_SWSCALE_ALPHA */
3716
118
                {
3717
118
                    *yuv2packed1 = yuv2rgbx32_1_1_c;
3718
118
                    *yuv2packed2 = yuv2rgbx32_1_2_c;
3719
118
                    *yuv2packedX = yuv2rgbx32_1_X_c;
3720
118
                }
3721
394
#endif /* !CONFIG_SMALL */
3722
394
                break;
3723
137
        case AV_PIX_FMT_RGB24:
3724
137
            *yuv2packed1 = yuv2rgb24_1_c;
3725
137
            *yuv2packed2 = yuv2rgb24_2_c;
3726
137
            *yuv2packedX = yuv2rgb24_X_c;
3727
137
            break;
3728
124
        case AV_PIX_FMT_BGR24:
3729
124
            *yuv2packed1 = yuv2bgr24_1_c;
3730
124
            *yuv2packed2 = yuv2bgr24_2_c;
3731
124
            *yuv2packedX = yuv2bgr24_X_c;
3732
124
            break;
3733
52
        case AV_PIX_FMT_RGB565LE:
3734
106
        case AV_PIX_FMT_RGB565BE:
3735
143
        case AV_PIX_FMT_BGR565LE:
3736
223
        case AV_PIX_FMT_BGR565BE:
3737
223
            *yuv2packed1 = yuv2rgb16_1_c;
3738
223
            *yuv2packed2 = yuv2rgb16_2_c;
3739
223
            *yuv2packedX = yuv2rgb16_X_c;
3740
223
            break;
3741
71
        case AV_PIX_FMT_RGB555LE:
3742
119
        case AV_PIX_FMT_RGB555BE:
3743
169
        case AV_PIX_FMT_BGR555LE:
3744
215
        case AV_PIX_FMT_BGR555BE:
3745
215
            *yuv2packed1 = yuv2rgb15_1_c;
3746
215
            *yuv2packed2 = yuv2rgb15_2_c;
3747
215
            *yuv2packedX = yuv2rgb15_X_c;
3748
215
            break;
3749
37
        case AV_PIX_FMT_RGB444LE:
3750
85
        case AV_PIX_FMT_RGB444BE:
3751
143
        case AV_PIX_FMT_BGR444LE:
3752
190
        case AV_PIX_FMT_BGR444BE:
3753
190
            *yuv2packed1 = yuv2rgb12_1_c;
3754
190
            *yuv2packed2 = yuv2rgb12_2_c;
3755
190
            *yuv2packedX = yuv2rgb12_X_c;
3756
190
            break;
3757
50
        case AV_PIX_FMT_RGB8:
3758
116
        case AV_PIX_FMT_BGR8:
3759
116
            *yuv2packed1 = yuv2rgb8_1_c;
3760
116
            *yuv2packed2 = yuv2rgb8_2_c;
3761
116
            *yuv2packedX = yuv2rgb8_X_c;
3762
116
            break;
3763
65
        case AV_PIX_FMT_RGB4:
3764
155
        case AV_PIX_FMT_BGR4:
3765
155
            *yuv2packed1 = yuv2rgb4_1_c;
3766
155
            *yuv2packed2 = yuv2rgb4_2_c;
3767
155
            *yuv2packedX = yuv2rgb4_X_c;
3768
155
            break;
3769
74
        case AV_PIX_FMT_RGB4_BYTE:
3770
135
        case AV_PIX_FMT_BGR4_BYTE:
3771
135
            *yuv2packed1 = yuv2rgb4b_1_c;
3772
135
            *yuv2packed2 = yuv2rgb4b_2_c;
3773
135
            *yuv2packedX = yuv2rgb4b_X_c;
3774
135
            break;
3775
127
        case AV_PIX_FMT_X2RGB10LE:
3776
127
        case AV_PIX_FMT_X2RGB10BE:
3777
127
            *yuv2packed1 = yuv2x2rgb10_1_c;
3778
127
            *yuv2packed2 = yuv2x2rgb10_2_c;
3779
127
            *yuv2packedX = yuv2x2rgb10_X_c;
3780
127
            break;
3781
139
        case AV_PIX_FMT_X2BGR10LE:
3782
139
        case AV_PIX_FMT_X2BGR10BE:
3783
139
            *yuv2packed1 = yuv2x2bgr10_1_c;
3784
139
            *yuv2packed2 = yuv2x2bgr10_2_c;
3785
139
            *yuv2packedX = yuv2x2bgr10_X_c;
3786
139
            break;
3787
21.6k
        }
3788
21.6k
    }
3789
35.8k
    switch (dstFormat) {
3790
278
    case AV_PIX_FMT_MONOWHITE:
3791
278
        *yuv2packed1 = yuv2monowhite_1_c;
3792
278
        *yuv2packed2 = yuv2monowhite_2_c;
3793
278
        *yuv2packedX = yuv2monowhite_X_c;
3794
278
        break;
3795
300
    case AV_PIX_FMT_MONOBLACK:
3796
300
        *yuv2packed1 = yuv2monoblack_1_c;
3797
300
        *yuv2packed2 = yuv2monoblack_2_c;
3798
300
        *yuv2packedX = yuv2monoblack_X_c;
3799
300
        break;
3800
414
    case AV_PIX_FMT_YUYV422:
3801
414
        *yuv2packed1 = yuv2yuyv422_1_c;
3802
414
        *yuv2packed2 = yuv2yuyv422_2_c;
3803
414
        *yuv2packedX = yuv2yuyv422_X_c;
3804
414
        break;
3805
434
    case AV_PIX_FMT_YVYU422:
3806
434
        *yuv2packed1 = yuv2yvyu422_1_c;
3807
434
        *yuv2packed2 = yuv2yvyu422_2_c;
3808
434
        *yuv2packedX = yuv2yvyu422_X_c;
3809
434
        break;
3810
422
    case AV_PIX_FMT_UYVY422:
3811
422
        *yuv2packed1 = yuv2uyvy422_1_c;
3812
422
        *yuv2packed2 = yuv2uyvy422_2_c;
3813
422
        *yuv2packedX = yuv2uyvy422_X_c;
3814
422
        break;
3815
318
    case AV_PIX_FMT_VYU444:
3816
318
        *yuv2packed1 = yuv2vyu444_1_c;
3817
318
        *yuv2packed2 = yuv2vyu444_2_c;
3818
318
        *yuv2packedX = yuv2vyu444_X_c;
3819
318
        break;
3820
263
    case AV_PIX_FMT_YA8:
3821
263
        *yuv2packed1 = yuv2ya8_1_c;
3822
263
        *yuv2packed2 = yuv2ya8_2_c;
3823
263
        *yuv2packedX = yuv2ya8_X_c;
3824
263
        break;
3825
314
    case AV_PIX_FMT_YA16LE:
3826
314
        *yuv2packed1 = yuv2ya16le_1_c;
3827
314
        *yuv2packed2 = yuv2ya16le_2_c;
3828
314
        *yuv2packedX = yuv2ya16le_X_c;
3829
314
        break;
3830
316
    case AV_PIX_FMT_YA16BE:
3831
316
        *yuv2packed1 = yuv2ya16be_1_c;
3832
316
        *yuv2packed2 = yuv2ya16be_2_c;
3833
316
        *yuv2packedX = yuv2ya16be_X_c;
3834
316
        break;
3835
104
    case AV_PIX_FMT_V30XLE:
3836
104
        *yuv2packedX = yuv2v30xle_X_c;
3837
104
        break;
3838
138
    case AV_PIX_FMT_AYUV64LE:
3839
138
        *yuv2packedX = yuv2ayuv64le_X_c;
3840
138
        break;
3841
178
    case AV_PIX_FMT_AYUV64BE:
3842
178
        *yuv2packedX = yuv2ayuv64be_X_c;
3843
178
        break;
3844
441
    case AV_PIX_FMT_AYUV:
3845
441
        *yuv2packed1 = yuv2ayuv_1_c;
3846
441
        *yuv2packed2 = yuv2ayuv_2_c;
3847
441
        *yuv2packedX = yuv2ayuv_X_c;
3848
441
        break;
3849
357
    case AV_PIX_FMT_VUYA:
3850
501
    case AV_PIX_FMT_VUYX:
3851
501
        *yuv2packed1 = yuv2vuyX_1_c;
3852
501
        *yuv2packed2 = yuv2vuyX_2_c;
3853
501
        *yuv2packedX = yuv2vuyX_X_c;
3854
501
        break;
3855
443
    case AV_PIX_FMT_UYVA:
3856
443
        *yuv2packed1 = yuv2uyva_1_c;
3857
443
        *yuv2packed2 = yuv2uyva_2_c;
3858
443
        *yuv2packedX = yuv2uyva_X_c;
3859
443
        break;
3860
98
    case AV_PIX_FMT_XV30LE:
3861
98
        *yuv2packedX = yuv2xv30le_X_c;
3862
98
        break;
3863
131
    case AV_PIX_FMT_XV36LE:
3864
131
        *yuv2packedX = yuv2xv36le_X_c;
3865
131
        break;
3866
112
    case AV_PIX_FMT_XV36BE:
3867
112
        *yuv2packedX = yuv2xv36be_X_c;
3868
112
        break;
3869
93
    case AV_PIX_FMT_XV48LE:
3870
93
        *yuv2packedX = yuv2xv48le_X_c;
3871
93
        break;
3872
106
    case AV_PIX_FMT_XV48BE:
3873
106
        *yuv2packedX = yuv2xv48be_X_c;
3874
106
        break;
3875
127
    case AV_PIX_FMT_Y210LE:
3876
127
        *yuv2packedX = yuv2y210le_X_c;
3877
127
        break;
3878
109
    case AV_PIX_FMT_Y212LE:
3879
109
        *yuv2packedX = yuv2y212le_X_c;
3880
109
        break;
3881
108
    case AV_PIX_FMT_Y216LE:
3882
108
        *yuv2packedX = yuv2y216le_X_c;
3883
108
        break;
3884
35.8k
    }
3885
35.8k
}