Coverage Report

Created: 2025-11-16 07:20

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