Coverage Report

Created: 2026-07-15 07:31

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/ffmpeg/libswscale/swscale_internal.h
Line
Count
Source
1
/*
2
 * Copyright (C) 2001-2011 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
#ifndef SWSCALE_SWSCALE_INTERNAL_H
22
#define SWSCALE_SWSCALE_INTERNAL_H
23
24
#include <stdatomic.h>
25
#include <assert.h>
26
27
#include "config.h"
28
#include "swscale.h"
29
#include "graph.h"
30
31
#include "libavfilter/framepool.h"
32
#include "libavutil/avassert.h"
33
#include "libavutil/common.h"
34
#include "libavutil/frame.h"
35
#include "libavutil/intreadwrite.h"
36
#include "libavutil/log.h"
37
#include "libavutil/mem_internal.h"
38
#include "libavutil/pixfmt.h"
39
#include "libavutil/pixdesc.h"
40
#include "libavutil/slicethread.h"
41
#include "libavutil/half2float.h"
42
43
#if HAVE_ALTIVEC
44
#define SWSINTERNAL_ADDITIONAL_ASM_SIZE (7*16 + 2*8 + /* alignment */ 16)
45
#endif
46
#ifndef SWSINTERNAL_ADDITIONAL_ASM_SIZE
47
0
#define SWSINTERNAL_ADDITIONAL_ASM_SIZE 0
48
#endif
49
50
#define STR(s) AV_TOSTRING(s) // AV_STRINGIFY is too long
51
52
0
#define YUVRGB_TABLE_HEADROOM 512
53
0
#define YUVRGB_TABLE_LUMA_HEADROOM 512
54
55
0
#define MAX_FILTER_SIZE SWS_MAX_FILTER_SIZE
56
57
#define SWS_MAX_THREADS 8192 /* sanity clamp */
58
59
#if HAVE_BIGENDIAN
60
#define ALT32_CORR (-1)
61
#else
62
0
#define ALT32_CORR   1
63
#endif
64
65
#if ARCH_X86_64
66
#   define APCK_PTR2  8
67
#   define APCK_COEF 16
68
#   define APCK_SIZE 24
69
#else
70
#   define APCK_PTR2  4
71
#   define APCK_COEF  8
72
0
#   define APCK_SIZE 16
73
#endif
74
75
0
#define RETCODE_USE_CASCADE -12345
76
77
typedef struct SwsInternal SwsInternal;
78
79
static inline SwsInternal *sws_internal(const SwsContext *sws)
80
0
{
81
0
    return (SwsInternal *) sws;
82
0
}
Unexecuted instantiation: swscale.c:sws_internal
Unexecuted instantiation: utils.c:sws_internal
Unexecuted instantiation: vscale.c:sws_internal
Unexecuted instantiation: yuv2rgb.c:sws_internal
Unexecuted instantiation: alphablend.c:sws_internal
Unexecuted instantiation: graph.c:sws_internal
Unexecuted instantiation: hscale_fast_bilinear.c:sws_internal
Unexecuted instantiation: input.c:sws_internal
Unexecuted instantiation: ops_dispatch.c:sws_internal
Unexecuted instantiation: options.c:sws_internal
Unexecuted instantiation: output.c:sws_internal
Unexecuted instantiation: rgb2rgb.c:sws_internal
Unexecuted instantiation: slice.c:sws_internal
Unexecuted instantiation: swscale_unscaled.c:sws_internal
Unexecuted instantiation: gamma.c:sws_internal
Unexecuted instantiation: hscale.c:sws_internal
83
84
SwsBackend ff_sws_enabled_backends(const SwsContext *ctx);
85
86
typedef struct Range {
87
    unsigned int start;
88
    unsigned int len;
89
} Range;
90
91
typedef struct RangeList {
92
    Range          *ranges;
93
    unsigned int nb_ranges;
94
    int             ranges_allocated;
95
} RangeList;
96
97
int ff_range_add(RangeList *r, unsigned int start, unsigned int len);
98
99
typedef int (*SwsFunc)(SwsInternal *c, const uint8_t *const src[],
100
                       const int srcStride[], int srcSliceY, int srcSliceH,
101
                       uint8_t *const dst[], const int dstStride[]);
102
103
typedef void (*SwsColorFunc)(const SwsInternal *c, uint8_t *dst, int dst_stride,
104
                             const uint8_t *src, int src_stride, int w, int h);
105
106
typedef struct SwsLuts {
107
    uint16_t *in;
108
    uint16_t *out;
109
} SwsLuts;
110
111
typedef struct SwsColorXform {
112
    SwsLuts gamma;
113
    int16_t mat[3][3];
114
} SwsColorXform;
115
116
/**
117
 * Write one line of horizontally scaled data to planar output
118
 * without any additional vertical scaling (or point-scaling).
119
 *
120
 * @param src     scaled source data, 15 bits for 8-10-bit output,
121
 *                19 bits for 16-bit output (in int32_t)
122
 * @param dest    pointer to the output plane. For >8-bit
123
 *                output, this is in uint16_t
124
 * @param dstW    width of destination in pixels
125
 * @param dither  ordered dither array of type int16_t and size 8
126
 * @param offset  Dither offset
127
 */
128
typedef void (*yuv2planar1_fn)(const int16_t *src, uint8_t *dest, int dstW,
129
                               const uint8_t *dither, int offset);
130
131
/**
132
 * Write one line of horizontally scaled data to planar output
133
 * with multi-point vertical scaling between input pixels.
134
 *
135
 * @param filter        vertical luma/alpha scaling coefficients, 12 bits [0,4096]
136
 * @param src           scaled luma (Y) or alpha (A) source data, 15 bits for
137
 *                      8-10-bit output, 19 bits for 16-bit output (in int32_t)
138
 * @param filterSize    number of vertical input lines to scale
139
 * @param dest          pointer to output plane. For >8-bit
140
 *                      output, this is in uint16_t
141
 * @param dstW          width of destination pixels
142
 * @param offset        Dither offset
143
 */
144
typedef void (*yuv2planarX_fn)(const int16_t *filter, int filterSize,
145
                               const int16_t **src, uint8_t *dest, int dstW,
146
                               const uint8_t *dither, int offset);
147
148
/**
149
 * Write one line of horizontally scaled chroma to interleaved output
150
 * with multi-point vertical scaling between input pixels.
151
 *
152
 * @param dstFormat     destination pixel format
153
 * @param chrDither     ordered dither array of type uint8_t and size 8
154
 * @param chrFilter     vertical chroma scaling coefficients, 12 bits [0,4096]
155
 * @param chrUSrc       scaled chroma (U) source data, 15 bits for 8-10-bit
156
 *                      output, 19 bits for 16-bit output (in int32_t)
157
 * @param chrVSrc       scaled chroma (V) source data, 15 bits for 8-10-bit
158
 *                      output, 19 bits for 16-bit output (in int32_t)
159
 * @param chrFilterSize number of vertical chroma input lines to scale
160
 * @param dest          pointer to the output plane. For >8-bit
161
 *                      output, this is in uint16_t
162
 * @param dstW          width of chroma planes
163
 */
164
typedef void (*yuv2interleavedX_fn)(enum AVPixelFormat dstFormat,
165
                                    const uint8_t *chrDither,
166
                                    const int16_t *chrFilter,
167
                                    int chrFilterSize,
168
                                    const int16_t **chrUSrc,
169
                                    const int16_t **chrVSrc,
170
                                    uint8_t *dest, int dstW);
171
172
/**
173
 * Write one line of horizontally scaled Y/U/V/A to packed-pixel YUV/RGB
174
 * output without any additional vertical scaling (or point-scaling). Note
175
 * that this function may do chroma scaling, see the "uvalpha" argument.
176
 *
177
 * @param c       SWS scaling context
178
 * @param lumSrc  scaled luma (Y) source data, 15 bits for 8-10-bit output,
179
 *                19 bits for 16-bit output (in int32_t)
180
 * @param chrUSrc scaled chroma (U) source data, 15 bits for 8-10-bit output,
181
 *                19 bits for 16-bit output (in int32_t)
182
 * @param chrVSrc scaled chroma (V) source data, 15 bits for 8-10-bit output,
183
 *                19 bits for 16-bit output (in int32_t)
184
 * @param alpSrc  scaled alpha (A) source data, 15 bits for 8-10-bit output,
185
 *                19 bits for 16-bit output (in int32_t)
186
 * @param dest    pointer to the output plane. For 16-bit output, this is
187
 *                uint16_t
188
 * @param dstW    width of lumSrc and alpSrc in pixels, number of pixels
189
 *                to write into dest[]
190
 * @param uvalpha chroma scaling coefficient for the second line of chroma
191
 *                pixels, either 2048 or 0. If 0, one chroma input is used
192
 *                for 2 output pixels (or if the SWS_FULL_CHR_H_INT flag
193
 *                is set, it generates 1 output pixel). If 2048, two chroma
194
 *                input pixels should be averaged for 2 output pixels (this
195
 *                only happens if SWS_FULL_CHR_H_INT is not set)
196
 * @param y       vertical line number for this output. This does not need
197
 *                to be used to calculate the offset in the destination,
198
 *                but can be used to generate comfort noise using dithering
199
 *                for some output formats.
200
 */
201
typedef void (*yuv2packed1_fn)(SwsInternal *c, const int16_t *lumSrc,
202
                               const int16_t *chrUSrc[2],
203
                               const int16_t *chrVSrc[2],
204
                               const int16_t *alpSrc, uint8_t *dest,
205
                               int dstW, int uvalpha, int y);
206
/**
207
 * Write one line of horizontally scaled Y/U/V/A to packed-pixel YUV/RGB
208
 * output by doing bilinear scaling between two input lines.
209
 *
210
 * @param c       SWS scaling context
211
 * @param lumSrc  scaled luma (Y) source data, 15 bits for 8-10-bit output,
212
 *                19 bits for 16-bit output (in int32_t)
213
 * @param chrUSrc scaled chroma (U) source data, 15 bits for 8-10-bit output,
214
 *                19 bits for 16-bit output (in int32_t)
215
 * @param chrVSrc scaled chroma (V) source data, 15 bits for 8-10-bit output,
216
 *                19 bits for 16-bit output (in int32_t)
217
 * @param alpSrc  scaled alpha (A) source data, 15 bits for 8-10-bit output,
218
 *                19 bits for 16-bit output (in int32_t)
219
 * @param dest    pointer to the output plane. For 16-bit output, this is
220
 *                uint16_t
221
 * @param dstW    width of lumSrc and alpSrc in pixels, number of pixels
222
 *                to write into dest[]
223
 * @param yalpha  luma/alpha scaling coefficients for the second input line.
224
 *                The first line's coefficients can be calculated by using
225
 *                4096 - yalpha
226
 * @param uvalpha chroma scaling coefficient for the second input line. The
227
 *                first line's coefficients can be calculated by using
228
 *                4096 - uvalpha
229
 * @param y       vertical line number for this output. This does not need
230
 *                to be used to calculate the offset in the destination,
231
 *                but can be used to generate comfort noise using dithering
232
 *                for some output formats.
233
 */
234
typedef void (*yuv2packed2_fn)(SwsInternal *c, const int16_t *lumSrc[2],
235
                               const int16_t *chrUSrc[2],
236
                               const int16_t *chrVSrc[2],
237
                               const int16_t *alpSrc[2],
238
                               uint8_t *dest,
239
                               int dstW, int yalpha, int uvalpha, int y);
240
/**
241
 * Write one line of horizontally scaled Y/U/V/A to packed-pixel YUV/RGB
242
 * output by doing multi-point vertical scaling between input pixels.
243
 *
244
 * @param c             SWS scaling context
245
 * @param lumFilter     vertical luma/alpha scaling coefficients, 12 bits [0,4096]
246
 * @param lumSrc        scaled luma (Y) source data, 15 bits for 8-10-bit output,
247
 *                      19 bits for 16-bit output (in int32_t)
248
 * @param lumFilterSize number of vertical luma/alpha input lines to scale
249
 * @param chrFilter     vertical chroma scaling coefficients, 12 bits [0,4096]
250
 * @param chrUSrc       scaled chroma (U) source data, 15 bits for 8-10-bit output,
251
 *                      19 bits for 16-bit output (in int32_t)
252
 * @param chrVSrc       scaled chroma (V) source data, 15 bits for 8-10-bit output,
253
 *                      19 bits for 16-bit output (in int32_t)
254
 * @param chrFilterSize number of vertical chroma input lines to scale
255
 * @param alpSrc        scaled alpha (A) source data, 15 bits for 8-10-bit output,
256
 *                      19 bits for 16-bit output (in int32_t)
257
 * @param dest          pointer to the output plane. For 16-bit output, this is
258
 *                      uint16_t
259
 * @param dstW          width of lumSrc and alpSrc in pixels, number of pixels
260
 *                      to write into dest[]
261
 * @param y             vertical line number for this output. This does not need
262
 *                      to be used to calculate the offset in the destination,
263
 *                      but can be used to generate comfort noise using dithering
264
 *                      or some output formats.
265
 */
266
typedef void (*yuv2packedX_fn)(SwsInternal *c, const int16_t *lumFilter,
267
                               const int16_t **lumSrc, int lumFilterSize,
268
                               const int16_t *chrFilter,
269
                               const int16_t **chrUSrc,
270
                               const int16_t **chrVSrc, int chrFilterSize,
271
                               const int16_t **alpSrc, uint8_t *dest,
272
                               int dstW, int y);
273
274
/**
275
 * Write one line of horizontally scaled Y/U/V/A to YUV/RGB
276
 * output by doing multi-point vertical scaling between input pixels.
277
 *
278
 * @param c             SWS scaling context
279
 * @param lumFilter     vertical luma/alpha scaling coefficients, 12 bits [0,4096]
280
 * @param lumSrc        scaled luma (Y) source data, 15 bits for 8-10-bit output,
281
 *                      19 bits for 16-bit output (in int32_t)
282
 * @param lumFilterSize number of vertical luma/alpha input lines to scale
283
 * @param chrFilter     vertical chroma scaling coefficients, 12 bits [0,4096]
284
 * @param chrUSrc       scaled chroma (U) source data, 15 bits for 8-10-bit output,
285
 *                      19 bits for 16-bit output (in int32_t)
286
 * @param chrVSrc       scaled chroma (V) source data, 15 bits for 8-10-bit output,
287
 *                      19 bits for 16-bit output (in int32_t)
288
 * @param chrFilterSize number of vertical chroma input lines to scale
289
 * @param alpSrc        scaled alpha (A) source data, 15 bits for 8-10-bit output,
290
 *                      19 bits for 16-bit output (in int32_t)
291
 * @param dest          pointer to the output planes. For 16-bit output, this is
292
 *                      uint16_t
293
 * @param dstW          width of lumSrc and alpSrc in pixels, number of pixels
294
 *                      to write into dest[]
295
 * @param y             vertical line number for this output. This does not need
296
 *                      to be used to calculate the offset in the destination,
297
 *                      but can be used to generate comfort noise using dithering
298
 *                      or some output formats.
299
 */
300
typedef void (*yuv2anyX_fn)(SwsInternal *c, const int16_t *lumFilter,
301
                            const int16_t **lumSrc, int lumFilterSize,
302
                            const int16_t *chrFilter,
303
                            const int16_t **chrUSrc,
304
                            const int16_t **chrVSrc, int chrFilterSize,
305
                            const int16_t **alpSrc, uint8_t **dest,
306
                            int dstW, int y);
307
308
/**
309
 * Unscaled conversion of luma/alpha plane to YV12 for horizontal scaler.
310
 */
311
typedef void (*planar1_YV12_fn)(uint8_t *dst, const uint8_t *src, const uint8_t *src2,
312
                                const uint8_t *src3, int width, uint32_t *pal,
313
                                void *opaque);
314
315
/**
316
 * Unscaled conversion of chroma plane to YV12 for horizontal scaler.
317
 */
318
typedef void (*planar2_YV12_fn)(uint8_t *dst, uint8_t *dst2, const uint8_t *src,
319
                                const uint8_t *src2, const uint8_t *src3,
320
                                int width, uint32_t *pal, void *opaque);
321
322
/**
323
 * Unscaled conversion of arbitrary planar data (e.g. RGBA) to YV12, through
324
 * conversion using the given color matrix.
325
 */
326
typedef void (*planarX_YV12_fn)(uint8_t *dst, const uint8_t *src[4], int width,
327
                                int32_t *rgb2yuv, void *opaque);
328
329
typedef void (*planarX2_YV12_fn)(uint8_t *dst, uint8_t *dst2,
330
                                 const uint8_t *src[4], int width,
331
                                 int32_t *rgb2yuv, void *opaque);
332
333
struct SwsSlice;
334
struct SwsFilterDescriptor;
335
336
/* This struct should be aligned on at least a 32-byte boundary. */
337
struct SwsInternal {
338
    /* Currently active user-facing options. Also contains AVClass */
339
    SwsContext opts;
340
341
    /* Parent context (for slice contexts) */
342
    SwsContext *parent;
343
344
    AVSliceThread      *slicethread;
345
    SwsContext        **slice_ctx;
346
    int                *slice_err;
347
    int              nb_slice_ctx;
348
349
    /* Scaling graph, reinitialized dynamically as needed. */
350
    SwsGraph *graph[2]; /* top, bottom fields */
351
352
    // values passed to current sws_receive_slice() call
353
    int dst_slice_start;
354
    int dst_slice_height;
355
356
    /**
357
     * Note that src, dst, srcStride, dstStride will be copied in the
358
     * sws_scale() wrapper so they can be freely modified here.
359
     */
360
    SwsFunc convert_unscaled;
361
    int chrSrcW;                  ///< Width  of source      chroma     planes.
362
    int chrSrcH;                  ///< Height of source      chroma     planes.
363
    int chrDstW;                  ///< Width  of destination chroma     planes.
364
    int chrDstH;                  ///< Height of destination chroma     planes.
365
    int lumXInc, chrXInc;
366
    int lumYInc, chrYInc;
367
    int dstFormatBpp;             ///< Number of bits per pixel of the destination pixel format.
368
    int srcFormatBpp;             ///< Number of bits per pixel of the source      pixel format.
369
    int dstBpc, srcBpc;
370
    int chrSrcHSubSample;         ///< Binary logarithm of horizontal subsampling factor between luma/alpha and chroma planes in source      image.
371
    int chrSrcVSubSample;         ///< Binary logarithm of vertical   subsampling factor between luma/alpha and chroma planes in source      image.
372
    int chrDstHSubSample;         ///< Binary logarithm of horizontal subsampling factor between luma/alpha and chroma planes in destination image.
373
    int chrDstVSubSample;         ///< Binary logarithm of vertical   subsampling factor between luma/alpha and chroma planes in destination image.
374
    int vChrDrop;                 ///< Binary logarithm of extra vertical subsampling factor in source image chroma planes specified by user.
375
    int sliceDir;                 ///< Direction that slices are fed to the scaler (1 = top-to-bottom, -1 = bottom-to-top).
376
377
    AVFrame *frame_src;
378
    AVFrame *frame_dst;
379
380
    RangeList src_ranges;
381
382
    /* The cascaded_* fields allow splitting a scaler task into multiple
383
     * sequential steps, this is for example used to limit the maximum
384
     * downscaling factor that needs to be supported in one scaler.
385
     */
386
    SwsContext *cascaded_context[3];
387
    int cascaded_tmpStride[2][4];
388
    uint8_t *cascaded_tmp[2][4];
389
    int cascaded_mainindex;
390
391
    double gamma_value;
392
    int is_internal_gamma;
393
    uint16_t *gamma;
394
    uint16_t *inv_gamma;
395
396
    int numDesc;
397
    int descIndex[2];
398
    int numSlice;
399
    struct SwsSlice *slice;
400
    struct SwsFilterDescriptor *desc;
401
402
    uint32_t pal_yuv[256];
403
    uint32_t pal_rgb[256];
404
405
    float uint2float_lut[256];
406
407
    /**
408
     * @name Scaled horizontal lines ring buffer.
409
     * The horizontal scaler keeps just enough scaled lines in a ring buffer
410
     * so they may be passed to the vertical scaler. The pointers to the
411
     * allocated buffers for each line are duplicated in sequence in the ring
412
     * buffer to simplify indexing and avoid wrapping around between lines
413
     * inside the vertical scaler code. The wrapping is done before the
414
     * vertical scaler is called.
415
     */
416
    //@{
417
    int lastInLumBuf;             ///< Last scaled horizontal luma/alpha line from source in the ring buffer.
418
    int lastInChrBuf;             ///< Last scaled horizontal chroma     line from source in the ring buffer.
419
    //@}
420
421
    uint8_t *formatConvBuffer;
422
    int needAlpha;
423
424
    /**
425
     * @name Horizontal and vertical filters.
426
     * To better understand the following fields, here is a pseudo-code of
427
     * their usage in filtering a horizontal line:
428
     * @code
429
     * for (i = 0; i < width; i++) {
430
     *     dst[i] = 0;
431
     *     for (j = 0; j < filterSize; j++)
432
     *         dst[i] += src[ filterPos[i] + j ] * filter[ filterSize * i + j ];
433
     *     dst[i] >>= FRAC_BITS; // The actual implementation is fixed-point.
434
     * }
435
     * @endcode
436
     */
437
    //@{
438
    int16_t *hLumFilter;          ///< Array of horizontal filter coefficients for luma/alpha planes.
439
    int16_t *hChrFilter;          ///< Array of horizontal filter coefficients for chroma     planes.
440
    int16_t *vLumFilter;          ///< Array of vertical   filter coefficients for luma/alpha planes.
441
    int16_t *vChrFilter;          ///< Array of vertical   filter coefficients for chroma     planes.
442
    int32_t *hLumFilterPos;       ///< Array of horizontal filter starting positions for each dst[i] for luma/alpha planes.
443
    int32_t *hChrFilterPos;       ///< Array of horizontal filter starting positions for each dst[i] for chroma     planes.
444
    int32_t *vLumFilterPos;       ///< Array of vertical   filter starting positions for each dst[i] for luma/alpha planes.
445
    int32_t *vChrFilterPos;       ///< Array of vertical   filter starting positions for each dst[i] for chroma     planes.
446
    int hLumFilterSize;           ///< Horizontal filter size for luma/alpha pixels.
447
    int hChrFilterSize;           ///< Horizontal filter size for chroma     pixels.
448
    int vLumFilterSize;           ///< Vertical   filter size for luma/alpha pixels.
449
    int vChrFilterSize;           ///< Vertical   filter size for chroma     pixels.
450
    //@}
451
452
    int lumMmxextFilterCodeSize;  ///< Runtime-generated MMXEXT horizontal fast bilinear scaler code size for luma/alpha planes.
453
    int chrMmxextFilterCodeSize;  ///< Runtime-generated MMXEXT horizontal fast bilinear scaler code size for chroma planes.
454
    uint8_t *lumMmxextFilterCode; ///< Runtime-generated MMXEXT horizontal fast bilinear scaler code for luma/alpha planes.
455
    uint8_t *chrMmxextFilterCode; ///< Runtime-generated MMXEXT horizontal fast bilinear scaler code for chroma planes.
456
457
    int canMMXEXTBeUsed;
458
    int warned_unuseable_bilinear;
459
460
    int dstY;                     ///< Last destination vertical line output from last slice.
461
    void *yuvTable;             // pointer to the yuv->rgb table start so it can be freed()
462
    // alignment ensures the offset can be added in a single
463
    // instruction on e.g. ARM
464
    DECLARE_ALIGNED(16, int, table_gV)[256 + 2*YUVRGB_TABLE_HEADROOM];
465
    uint8_t *table_rV[256 + 2*YUVRGB_TABLE_HEADROOM];
466
    uint8_t *table_gU[256 + 2*YUVRGB_TABLE_HEADROOM];
467
    uint8_t *table_bU[256 + 2*YUVRGB_TABLE_HEADROOM];
468
    DECLARE_ALIGNED(16, int32_t, input_rgb2yuv_table)[16+40*4]; // This table can contain both C and SIMD formatted values, the C vales are always at the XY_IDX points
469
0
#define RY_IDX 0
470
0
#define GY_IDX 1
471
0
#define BY_IDX 2
472
0
#define RU_IDX 3
473
0
#define GU_IDX 4
474
0
#define BU_IDX 5
475
0
#define RV_IDX 6
476
0
#define GV_IDX 7
477
0
#define BV_IDX 8
478
0
#define RGB2YUV_SHIFT 15
479
480
    int *dither_error[4];
481
482
    //Colorspace stuff
483
    int contrast, brightness, saturation;    // for sws_getColorspaceDetails
484
    int srcColorspaceTable[4];
485
    int dstColorspaceTable[4];
486
    int src0Alpha;
487
    int dst0Alpha;
488
    int srcXYZ;
489
    int dstXYZ;
490
    int yuv2rgb_y_offset;
491
    int yuv2rgb_y_coeff;
492
    int yuv2rgb_v2r_coeff;
493
    int yuv2rgb_v2g_coeff;
494
    int yuv2rgb_u2g_coeff;
495
    int yuv2rgb_u2b_coeff;
496
497
#define RED_DITHER            "0*8"
498
#define GREEN_DITHER          "1*8"
499
#define BLUE_DITHER           "2*8"
500
#define Y_COEFF               "3*8"
501
#define VR_COEFF              "4*8"
502
#define UB_COEFF              "5*8"
503
#define VG_COEFF              "6*8"
504
#define UG_COEFF              "7*8"
505
#define Y_OFFSET              "8*8"
506
#define U_OFFSET              "9*8"
507
#define V_OFFSET              "10*8"
508
#define LUM_MMX_FILTER_OFFSET "11*8"
509
#define CHR_MMX_FILTER_OFFSET "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)
510
#define DSTW_OFFSET           "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*2"
511
#define ESP_OFFSET            "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*2+8"
512
#define VROUNDER_OFFSET       "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*2+16"
513
#define U_TEMP                "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*2+24"
514
#define V_TEMP                "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*2+32"
515
#define Y_TEMP                "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*2+40"
516
#define ALP_MMX_FILTER_OFFSET "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*2+48"
517
#define UV_OFF_PX             "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*3+48"
518
#define UV_OFF_BYTE           "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*3+56"
519
#define DITHER16              "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*3+64"
520
#define DITHER32              "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*3+80"
521
#define DITHER32_INT          (11*8+4*4*MAX_FILTER_SIZE*3+80) // value equal to above, used for checking that the struct hasn't been changed by mistake
522
523
    DECLARE_ALIGNED(8, uint64_t, redDither);
524
    DECLARE_ALIGNED(8, uint64_t, greenDither);
525
    DECLARE_ALIGNED(8, uint64_t, blueDither);
526
527
    DECLARE_ALIGNED(8, uint64_t, yCoeff);
528
    DECLARE_ALIGNED(8, uint64_t, vrCoeff);
529
    DECLARE_ALIGNED(8, uint64_t, ubCoeff);
530
    DECLARE_ALIGNED(8, uint64_t, vgCoeff);
531
    DECLARE_ALIGNED(8, uint64_t, ugCoeff);
532
    DECLARE_ALIGNED(8, uint64_t, yOffset);
533
    DECLARE_ALIGNED(8, uint64_t, uOffset);
534
    DECLARE_ALIGNED(8, uint64_t, vOffset);
535
    int32_t lumMmxFilter[4 * MAX_FILTER_SIZE];
536
    int32_t chrMmxFilter[4 * MAX_FILTER_SIZE];
537
    int dstW_mmx;
538
    DECLARE_ALIGNED(8, uint64_t, esp);
539
    DECLARE_ALIGNED(8, uint64_t, vRounder);
540
    DECLARE_ALIGNED(8, uint64_t, u_temp);
541
    DECLARE_ALIGNED(8, uint64_t, v_temp);
542
    DECLARE_ALIGNED(8, uint64_t, y_temp);
543
    int32_t alpMmxFilter[4 * MAX_FILTER_SIZE];
544
    // alignment of these values is not necessary, but merely here
545
    // to maintain the same offset across x8632 and x86-64. Once we
546
    // use proper offset macros in the asm, they can be removed.
547
    DECLARE_ALIGNED(8, ptrdiff_t, uv_off); ///< offset (in pixels) between u and v planes
548
    DECLARE_ALIGNED(8, ptrdiff_t, uv_offx2); ///< offset (in bytes) between u and v planes
549
    DECLARE_ALIGNED(8, uint16_t, dither16)[8];
550
    DECLARE_ALIGNED(8, uint32_t, dither32)[8];
551
552
    const uint8_t *chrDither8, *lumDither8;
553
554
    int use_mmx_vfilter;
555
556
/* pre defined color-spaces gamma */
557
0
#define XYZ_GAMMA (2.6)
558
0
#define RGB_GAMMA (2.2)
559
    SwsColorFunc  xyz12Torgb48;
560
    SwsColorFunc  rgb48Toxyz12;
561
    SwsColorXform xyz2rgb;
562
    SwsColorXform rgb2xyz;
563
564
    /* function pointers for swscale() */
565
    yuv2planar1_fn yuv2plane1;
566
    yuv2planarX_fn yuv2planeX;
567
    yuv2interleavedX_fn yuv2nv12cX;
568
    yuv2packed1_fn yuv2packed1;
569
    yuv2packed2_fn yuv2packed2;
570
    yuv2packedX_fn yuv2packedX;
571
    yuv2anyX_fn yuv2anyX;
572
573
    /// Opaque data pointer passed to all input functions.
574
    void *input_opaque;
575
576
    planar1_YV12_fn lumToYV12;
577
    planar1_YV12_fn alpToYV12;
578
    planar2_YV12_fn chrToYV12;
579
580
    /**
581
     * Functions to read planar input, such as planar RGB, and convert
582
     * internally to Y/UV/A.
583
     */
584
    /** @{ */
585
    planarX_YV12_fn  readLumPlanar;
586
    planarX_YV12_fn  readAlpPlanar;
587
    planarX2_YV12_fn readChrPlanar;
588
    /** @} */
589
590
    /**
591
     * Scale one horizontal line of input data using a bilinear filter
592
     * to produce one line of output data. Compared to SwsInternal->hScale(),
593
     * please take note of the following caveats when using these:
594
     * - Scaling is done using only 7 bits instead of 14-bit coefficients.
595
     * - You can use no more than 5 input pixels to produce 4 output
596
     *   pixels. Therefore, this filter should not be used for downscaling
597
     *   by more than ~20% in width (because that equals more than 5/4th
598
     *   downscaling and thus more than 5 pixels input per 4 pixels output).
599
     * - In general, bilinear filters create artifacts during downscaling
600
     *   (even when <20%), because one output pixel will span more than one
601
     *   input pixel, and thus some pixels will need edges of both neighbor
602
     *   pixels to interpolate the output pixel. Since you can use at most
603
     *   two input pixels per output pixel in bilinear scaling, this is
604
     *   impossible and thus downscaling by any size will create artifacts.
605
     * To enable this type of scaling, set SWS_FAST_BILINEAR
606
     * in SwsInternal->flags.
607
     */
608
    /** @{ */
609
    void (*hyscale_fast)(SwsInternal *c,
610
                         int16_t *dst, int dstWidth,
611
                         const uint8_t *src, int srcW, int xInc);
612
    void (*hcscale_fast)(SwsInternal *c,
613
                         int16_t *dst1, int16_t *dst2, int dstWidth,
614
                         const uint8_t *src1, const uint8_t *src2,
615
                         int srcW, int xInc);
616
    /** @} */
617
618
    /**
619
     * Scale one horizontal line of input data using a filter over the input
620
     * lines, to produce one (differently sized) line of output data.
621
     *
622
     * @param dst        pointer to destination buffer for horizontally scaled
623
     *                   data. If the number of bits per component of one
624
     *                   destination pixel (SwsInternal->dstBpc) is <= 10, data
625
     *                   will be 15 bpc in 16 bits (int16_t) width. Else (i.e.
626
     *                   SwsInternal->dstBpc == 16), data will be 19bpc in
627
     *                   32 bits (int32_t) width.
628
     * @param dstW       width of destination image
629
     * @param src        pointer to source data to be scaled. If the number of
630
     *                   bits per component of a source pixel (SwsInternal->srcBpc)
631
     *                   is 8, this is 8bpc in 8 bits (uint8_t) width. Else
632
     *                   (i.e. SwsInternal->dstBpc > 8), this is native depth
633
     *                   in 16 bits (uint16_t) width. In other words, for 9-bit
634
     *                   YUV input, this is 9bpc, for 10-bit YUV input, this is
635
     *                   10bpc, and for 16-bit RGB or YUV, this is 16bpc.
636
     * @param filter     filter coefficients to be used per output pixel for
637
     *                   scaling. This contains 14bpp filtering coefficients.
638
     *                   Guaranteed to contain dstW * filterSize entries.
639
     * @param filterPos  position of the first input pixel to be used for
640
     *                   each output pixel during scaling. Guaranteed to
641
     *                   contain dstW entries.
642
     * @param filterSize the number of input coefficients to be used (and
643
     *                   thus the number of input pixels to be used) for
644
     *                   creating a single output pixel. Is aligned to 4
645
     *                   (and input coefficients thus padded with zeroes)
646
     *                   to simplify creating SIMD code.
647
     */
648
    /** @{ */
649
    void (*hyScale)(SwsInternal *c, int16_t *dst, int dstW,
650
                    const uint8_t *src, const int16_t *filter,
651
                    const int32_t *filterPos, int filterSize);
652
    void (*hcScale)(SwsInternal *c, int16_t *dst, int dstW,
653
                    const uint8_t *src, const int16_t *filter,
654
                    const int32_t *filterPos, int filterSize);
655
    /** @} */
656
657
    /**
658
     * Color range conversion functions if needed.
659
     * If SwsInternal->dstBpc is > 14:
660
     * - int16_t *dst (data is 15 bpc)
661
     * - uint16_t coeff
662
     * - int32_t offset
663
     * Otherwise (SwsInternal->dstBpc is <= 14):
664
     * - int32_t *dst (data is 19 bpc)
665
     * - uint32_t coeff
666
     * - int64_t offset
667
     */
668
    /** @{ */
669
    void (*lumConvertRange)(int16_t *dst, int width,
670
                            uint32_t coeff, int64_t offset);
671
    void (*chrConvertRange)(int16_t *dst1, int16_t *dst2, int width,
672
                            uint32_t coeff, int64_t offset);
673
    /** @} */
674
675
    uint32_t lumConvertRange_coeff;
676
    uint32_t chrConvertRange_coeff;
677
    int64_t  lumConvertRange_offset;
678
    int64_t  chrConvertRange_offset;
679
680
    int needs_hcscale; ///< Set if there are chroma planes to be converted.
681
682
    // scratch buffer for converting packed rgb0 sources
683
    // filled with a copy of the input frame + fully opaque alpha,
684
    // then passed as input to further conversion
685
    uint8_t     *rgb0_scratch;
686
    unsigned int rgb0_scratch_allocated;
687
688
    // scratch buffer for converting XYZ sources
689
    // filled with the input converted to rgb48
690
    // then passed as input to further conversion
691
    uint8_t     *xyz_scratch;
692
    unsigned int xyz_scratch_allocated;
693
694
    unsigned int dst_slice_align;
695
    atomic_int   stride_unaligned_warned;
696
    atomic_int   data_unaligned_warned;
697
    int          color_conversion_warned;
698
699
    Half2FloatTables *h2f_tables;
700
701
    // Hardware specific private data
702
    void *hw_priv; /* refstruct */
703
704
    int is_legacy_init;
705
706
    FFFramePool frame_pool; /* for sws_scale_frame() data allocations */
707
};
708
//FIXME check init (where 0)
709
710
static_assert(offsetof(SwsInternal, redDither) + DITHER32_INT == offsetof(SwsInternal, dither32),
711
              "dither32 must be at the same offset as redDither + DITHER32_INT");
712
713
#if ARCH_X86_64
714
/* x86 yuv2gbrp uses the SwsInternal for yuv coefficients
715
   if struct offsets change the asm needs to be updated too */
716
static_assert(offsetof(SwsInternal, yuv2rgb_y_offset) == 40348,
717
              "yuv2rgb_y_offset must be updated in x86 asm");
718
#endif
719
720
SwsFunc ff_yuv2rgb_get_func_ptr(SwsInternal *c);
721
int ff_yuv2rgb_c_init_tables(SwsInternal *c, const int inv_table[4],
722
                             int fullRange, int brightness,
723
                             int contrast, int saturation);
724
void ff_yuv2rgb_init_tables_ppc(SwsInternal *c, const int inv_table[4],
725
                                int brightness, int contrast, int saturation);
726
727
void ff_updateMMXDitherTables(SwsInternal *c, int dstY);
728
729
void ff_update_palette(SwsInternal *c, const uint32_t *pal);
730
731
av_cold void ff_sws_init_range_convert(SwsInternal *c);
732
av_cold void ff_sws_init_range_convert_aarch64(SwsInternal *c);
733
av_cold void ff_sws_init_range_convert_loongarch(SwsInternal *c);
734
av_cold void ff_sws_init_range_convert_riscv(SwsInternal *c);
735
av_cold void ff_sws_init_range_convert_x86(SwsInternal *c);
736
737
av_cold void ff_sws_init_xyzdsp(SwsInternal *c);
738
av_cold void ff_sws_init_xyzdsp_aarch64(SwsInternal *c);
739
740
av_cold int ff_sws_fill_xyztables(SwsInternal *c);
741
742
SwsFunc ff_yuv2rgb_init_x86(SwsInternal *c);
743
SwsFunc ff_yuv2rgb_init_ppc(SwsInternal *c);
744
SwsFunc ff_yuv2rgb_init_loongarch(SwsInternal *c);
745
SwsFunc ff_yuv2rgb_init_aarch64(SwsInternal *c);
746
747
static av_always_inline int is16BPS(enum AVPixelFormat pix_fmt)
748
0
{
749
0
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
750
0
    av_assert0(desc);
751
0
    return desc->comp[0].depth == 16;
752
0
}
Unexecuted instantiation: swscale.c:is16BPS
Unexecuted instantiation: utils.c:is16BPS
Unexecuted instantiation: vscale.c:is16BPS
Unexecuted instantiation: yuv2rgb.c:is16BPS
Unexecuted instantiation: alphablend.c:is16BPS
Unexecuted instantiation: graph.c:is16BPS
Unexecuted instantiation: hscale_fast_bilinear.c:is16BPS
Unexecuted instantiation: input.c:is16BPS
Unexecuted instantiation: ops_dispatch.c:is16BPS
Unexecuted instantiation: options.c:is16BPS
Unexecuted instantiation: output.c:is16BPS
Unexecuted instantiation: rgb2rgb.c:is16BPS
Unexecuted instantiation: slice.c:is16BPS
Unexecuted instantiation: swscale_unscaled.c:is16BPS
Unexecuted instantiation: gamma.c:is16BPS
Unexecuted instantiation: hscale.c:is16BPS
753
754
static av_always_inline int is32BPS(enum AVPixelFormat pix_fmt)
755
0
{
756
0
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
757
0
    av_assert0(desc);
758
0
    return desc->comp[0].depth == 32;
759
0
}
Unexecuted instantiation: swscale.c:is32BPS
Unexecuted instantiation: utils.c:is32BPS
Unexecuted instantiation: vscale.c:is32BPS
Unexecuted instantiation: yuv2rgb.c:is32BPS
Unexecuted instantiation: alphablend.c:is32BPS
Unexecuted instantiation: graph.c:is32BPS
Unexecuted instantiation: hscale_fast_bilinear.c:is32BPS
Unexecuted instantiation: input.c:is32BPS
Unexecuted instantiation: ops_dispatch.c:is32BPS
Unexecuted instantiation: options.c:is32BPS
Unexecuted instantiation: output.c:is32BPS
Unexecuted instantiation: rgb2rgb.c:is32BPS
Unexecuted instantiation: slice.c:is32BPS
Unexecuted instantiation: swscale_unscaled.c:is32BPS
Unexecuted instantiation: gamma.c:is32BPS
Unexecuted instantiation: hscale.c:is32BPS
760
761
static av_always_inline int isNBPS(enum AVPixelFormat pix_fmt)
762
0
{
763
0
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
764
0
    av_assert0(desc);
765
0
    return desc->comp[0].depth >= 9 && desc->comp[0].depth <= 14;
766
0
}
Unexecuted instantiation: swscale.c:isNBPS
Unexecuted instantiation: utils.c:isNBPS
Unexecuted instantiation: vscale.c:isNBPS
Unexecuted instantiation: yuv2rgb.c:isNBPS
Unexecuted instantiation: alphablend.c:isNBPS
Unexecuted instantiation: graph.c:isNBPS
Unexecuted instantiation: hscale_fast_bilinear.c:isNBPS
Unexecuted instantiation: input.c:isNBPS
Unexecuted instantiation: ops_dispatch.c:isNBPS
Unexecuted instantiation: options.c:isNBPS
Unexecuted instantiation: output.c:isNBPS
Unexecuted instantiation: rgb2rgb.c:isNBPS
Unexecuted instantiation: slice.c:isNBPS
Unexecuted instantiation: swscale_unscaled.c:isNBPS
Unexecuted instantiation: gamma.c:isNBPS
Unexecuted instantiation: hscale.c:isNBPS
767
768
static av_always_inline int isBE(enum AVPixelFormat pix_fmt)
769
0
{
770
0
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
771
0
    av_assert0(desc);
772
0
    return desc->flags & AV_PIX_FMT_FLAG_BE;
773
0
}
Unexecuted instantiation: swscale.c:isBE
Unexecuted instantiation: utils.c:isBE
Unexecuted instantiation: vscale.c:isBE
Unexecuted instantiation: yuv2rgb.c:isBE
Unexecuted instantiation: alphablend.c:isBE
Unexecuted instantiation: graph.c:isBE
Unexecuted instantiation: hscale_fast_bilinear.c:isBE
Unexecuted instantiation: input.c:isBE
Unexecuted instantiation: ops_dispatch.c:isBE
Unexecuted instantiation: options.c:isBE
Unexecuted instantiation: output.c:isBE
Unexecuted instantiation: rgb2rgb.c:isBE
Unexecuted instantiation: slice.c:isBE
Unexecuted instantiation: swscale_unscaled.c:isBE
Unexecuted instantiation: gamma.c:isBE
Unexecuted instantiation: hscale.c:isBE
774
775
static av_always_inline int isYUV(enum AVPixelFormat pix_fmt)
776
0
{
777
0
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
778
0
    av_assert0(desc);
779
0
    return !(desc->flags & AV_PIX_FMT_FLAG_RGB) && desc->nb_components >= 2;
780
0
}
Unexecuted instantiation: swscale.c:isYUV
Unexecuted instantiation: utils.c:isYUV
Unexecuted instantiation: vscale.c:isYUV
Unexecuted instantiation: yuv2rgb.c:isYUV
Unexecuted instantiation: alphablend.c:isYUV
Unexecuted instantiation: graph.c:isYUV
Unexecuted instantiation: hscale_fast_bilinear.c:isYUV
Unexecuted instantiation: input.c:isYUV
Unexecuted instantiation: ops_dispatch.c:isYUV
Unexecuted instantiation: options.c:isYUV
Unexecuted instantiation: output.c:isYUV
Unexecuted instantiation: rgb2rgb.c:isYUV
Unexecuted instantiation: slice.c:isYUV
Unexecuted instantiation: swscale_unscaled.c:isYUV
Unexecuted instantiation: gamma.c:isYUV
Unexecuted instantiation: hscale.c:isYUV
781
782
static av_always_inline int isPlanarYUV(enum AVPixelFormat pix_fmt)
783
0
{
784
0
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
785
0
    av_assert0(desc);
786
0
    return ((desc->flags & AV_PIX_FMT_FLAG_PLANAR) && isYUV(pix_fmt));
787
0
}
Unexecuted instantiation: swscale.c:isPlanarYUV
Unexecuted instantiation: utils.c:isPlanarYUV
Unexecuted instantiation: vscale.c:isPlanarYUV
Unexecuted instantiation: yuv2rgb.c:isPlanarYUV
Unexecuted instantiation: alphablend.c:isPlanarYUV
Unexecuted instantiation: graph.c:isPlanarYUV
Unexecuted instantiation: hscale_fast_bilinear.c:isPlanarYUV
Unexecuted instantiation: input.c:isPlanarYUV
Unexecuted instantiation: ops_dispatch.c:isPlanarYUV
Unexecuted instantiation: options.c:isPlanarYUV
Unexecuted instantiation: output.c:isPlanarYUV
Unexecuted instantiation: rgb2rgb.c:isPlanarYUV
Unexecuted instantiation: slice.c:isPlanarYUV
Unexecuted instantiation: swscale_unscaled.c:isPlanarYUV
Unexecuted instantiation: gamma.c:isPlanarYUV
Unexecuted instantiation: hscale.c:isPlanarYUV
788
789
/*
790
 * Identity semi-planar YUV formats. Specifically, those are YUV formats
791
 * where the second and third components (U & V) are on the same plane.
792
 */
793
static av_always_inline int isSemiPlanarYUV(enum AVPixelFormat pix_fmt)
794
0
{
795
0
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
796
0
    av_assert0(desc);
797
0
    return (isPlanarYUV(pix_fmt) && desc->comp[1].plane == desc->comp[2].plane);
798
0
}
Unexecuted instantiation: swscale.c:isSemiPlanarYUV
Unexecuted instantiation: utils.c:isSemiPlanarYUV
Unexecuted instantiation: vscale.c:isSemiPlanarYUV
Unexecuted instantiation: yuv2rgb.c:isSemiPlanarYUV
Unexecuted instantiation: alphablend.c:isSemiPlanarYUV
Unexecuted instantiation: graph.c:isSemiPlanarYUV
Unexecuted instantiation: hscale_fast_bilinear.c:isSemiPlanarYUV
Unexecuted instantiation: input.c:isSemiPlanarYUV
Unexecuted instantiation: ops_dispatch.c:isSemiPlanarYUV
Unexecuted instantiation: options.c:isSemiPlanarYUV
Unexecuted instantiation: output.c:isSemiPlanarYUV
Unexecuted instantiation: rgb2rgb.c:isSemiPlanarYUV
Unexecuted instantiation: slice.c:isSemiPlanarYUV
Unexecuted instantiation: swscale_unscaled.c:isSemiPlanarYUV
Unexecuted instantiation: gamma.c:isSemiPlanarYUV
Unexecuted instantiation: hscale.c:isSemiPlanarYUV
799
800
static av_always_inline int isRGB(enum AVPixelFormat pix_fmt)
801
0
{
802
0
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
803
0
    av_assert0(desc);
804
0
    return (desc->flags & AV_PIX_FMT_FLAG_RGB);
805
0
}
Unexecuted instantiation: swscale.c:isRGB
Unexecuted instantiation: utils.c:isRGB
Unexecuted instantiation: vscale.c:isRGB
Unexecuted instantiation: yuv2rgb.c:isRGB
Unexecuted instantiation: alphablend.c:isRGB
Unexecuted instantiation: graph.c:isRGB
Unexecuted instantiation: hscale_fast_bilinear.c:isRGB
Unexecuted instantiation: input.c:isRGB
Unexecuted instantiation: ops_dispatch.c:isRGB
Unexecuted instantiation: options.c:isRGB
Unexecuted instantiation: output.c:isRGB
Unexecuted instantiation: rgb2rgb.c:isRGB
Unexecuted instantiation: slice.c:isRGB
Unexecuted instantiation: swscale_unscaled.c:isRGB
Unexecuted instantiation: gamma.c:isRGB
Unexecuted instantiation: hscale.c:isRGB
806
807
static av_always_inline int isGray(enum AVPixelFormat pix_fmt)
808
0
{
809
0
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
810
0
    av_assert0(desc);
811
0
    return !(desc->flags & AV_PIX_FMT_FLAG_PAL) &&
812
0
           !(desc->flags & AV_PIX_FMT_FLAG_HWACCEL) &&
813
0
           desc->nb_components <= 2 &&
814
0
           pix_fmt != AV_PIX_FMT_MONOBLACK &&
815
0
           pix_fmt != AV_PIX_FMT_MONOWHITE;
816
0
}
Unexecuted instantiation: swscale.c:isGray
Unexecuted instantiation: utils.c:isGray
Unexecuted instantiation: vscale.c:isGray
Unexecuted instantiation: yuv2rgb.c:isGray
Unexecuted instantiation: alphablend.c:isGray
Unexecuted instantiation: graph.c:isGray
Unexecuted instantiation: hscale_fast_bilinear.c:isGray
Unexecuted instantiation: input.c:isGray
Unexecuted instantiation: ops_dispatch.c:isGray
Unexecuted instantiation: options.c:isGray
Unexecuted instantiation: output.c:isGray
Unexecuted instantiation: rgb2rgb.c:isGray
Unexecuted instantiation: slice.c:isGray
Unexecuted instantiation: swscale_unscaled.c:isGray
Unexecuted instantiation: gamma.c:isGray
Unexecuted instantiation: hscale.c:isGray
817
818
static av_always_inline int isRGBinInt(enum AVPixelFormat pix_fmt)
819
0
{
820
0
    return pix_fmt == AV_PIX_FMT_RGB48BE     ||
821
0
           pix_fmt == AV_PIX_FMT_RGB48LE     ||
822
0
           pix_fmt == AV_PIX_FMT_RGB32       ||
823
0
           pix_fmt == AV_PIX_FMT_RGB32_1     ||
824
0
           pix_fmt == AV_PIX_FMT_RGB24       ||
825
0
           pix_fmt == AV_PIX_FMT_RGB565BE    ||
826
0
           pix_fmt == AV_PIX_FMT_RGB565LE    ||
827
0
           pix_fmt == AV_PIX_FMT_RGB555BE    ||
828
0
           pix_fmt == AV_PIX_FMT_RGB555LE    ||
829
0
           pix_fmt == AV_PIX_FMT_RGB444BE    ||
830
0
           pix_fmt == AV_PIX_FMT_RGB444LE    ||
831
0
           pix_fmt == AV_PIX_FMT_RGB8        ||
832
0
           pix_fmt == AV_PIX_FMT_RGB4        ||
833
0
           pix_fmt == AV_PIX_FMT_RGB4_BYTE   ||
834
0
           pix_fmt == AV_PIX_FMT_RGBA64BE    ||
835
0
           pix_fmt == AV_PIX_FMT_RGBA64LE    ||
836
0
           pix_fmt == AV_PIX_FMT_MONOBLACK   ||
837
0
           pix_fmt == AV_PIX_FMT_MONOWHITE;
838
0
}
Unexecuted instantiation: swscale.c:isRGBinInt
Unexecuted instantiation: utils.c:isRGBinInt
Unexecuted instantiation: vscale.c:isRGBinInt
Unexecuted instantiation: yuv2rgb.c:isRGBinInt
Unexecuted instantiation: alphablend.c:isRGBinInt
Unexecuted instantiation: graph.c:isRGBinInt
Unexecuted instantiation: hscale_fast_bilinear.c:isRGBinInt
Unexecuted instantiation: input.c:isRGBinInt
Unexecuted instantiation: ops_dispatch.c:isRGBinInt
Unexecuted instantiation: options.c:isRGBinInt
Unexecuted instantiation: output.c:isRGBinInt
Unexecuted instantiation: rgb2rgb.c:isRGBinInt
Unexecuted instantiation: slice.c:isRGBinInt
Unexecuted instantiation: swscale_unscaled.c:isRGBinInt
Unexecuted instantiation: gamma.c:isRGBinInt
Unexecuted instantiation: hscale.c:isRGBinInt
839
840
static av_always_inline int isBGRinInt(enum AVPixelFormat pix_fmt)
841
0
{
842
0
    return pix_fmt == AV_PIX_FMT_BGR48BE     ||
843
0
           pix_fmt == AV_PIX_FMT_BGR48LE     ||
844
0
           pix_fmt == AV_PIX_FMT_BGR32       ||
845
0
           pix_fmt == AV_PIX_FMT_BGR32_1     ||
846
0
           pix_fmt == AV_PIX_FMT_BGR24       ||
847
0
           pix_fmt == AV_PIX_FMT_BGR565BE    ||
848
0
           pix_fmt == AV_PIX_FMT_BGR565LE    ||
849
0
           pix_fmt == AV_PIX_FMT_BGR555BE    ||
850
0
           pix_fmt == AV_PIX_FMT_BGR555LE    ||
851
0
           pix_fmt == AV_PIX_FMT_BGR444BE    ||
852
0
           pix_fmt == AV_PIX_FMT_BGR444LE    ||
853
0
           pix_fmt == AV_PIX_FMT_BGR8        ||
854
0
           pix_fmt == AV_PIX_FMT_BGR4        ||
855
0
           pix_fmt == AV_PIX_FMT_BGR4_BYTE   ||
856
0
           pix_fmt == AV_PIX_FMT_BGRA64BE    ||
857
0
           pix_fmt == AV_PIX_FMT_BGRA64LE    ||
858
0
           pix_fmt == AV_PIX_FMT_MONOBLACK   ||
859
0
           pix_fmt == AV_PIX_FMT_MONOWHITE;
860
0
}
Unexecuted instantiation: swscale.c:isBGRinInt
Unexecuted instantiation: utils.c:isBGRinInt
Unexecuted instantiation: vscale.c:isBGRinInt
Unexecuted instantiation: yuv2rgb.c:isBGRinInt
Unexecuted instantiation: alphablend.c:isBGRinInt
Unexecuted instantiation: graph.c:isBGRinInt
Unexecuted instantiation: hscale_fast_bilinear.c:isBGRinInt
Unexecuted instantiation: input.c:isBGRinInt
Unexecuted instantiation: ops_dispatch.c:isBGRinInt
Unexecuted instantiation: options.c:isBGRinInt
Unexecuted instantiation: output.c:isBGRinInt
Unexecuted instantiation: rgb2rgb.c:isBGRinInt
Unexecuted instantiation: slice.c:isBGRinInt
Unexecuted instantiation: swscale_unscaled.c:isBGRinInt
Unexecuted instantiation: gamma.c:isBGRinInt
Unexecuted instantiation: hscale.c:isBGRinInt
861
862
static av_always_inline int isBayer(enum AVPixelFormat pix_fmt)
863
0
{
864
0
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
865
0
    av_assert0(desc);
866
0
    return !!(desc->flags & AV_PIX_FMT_FLAG_BAYER);
867
0
}
Unexecuted instantiation: swscale.c:isBayer
Unexecuted instantiation: utils.c:isBayer
Unexecuted instantiation: vscale.c:isBayer
Unexecuted instantiation: yuv2rgb.c:isBayer
Unexecuted instantiation: alphablend.c:isBayer
Unexecuted instantiation: graph.c:isBayer
Unexecuted instantiation: hscale_fast_bilinear.c:isBayer
Unexecuted instantiation: input.c:isBayer
Unexecuted instantiation: ops_dispatch.c:isBayer
Unexecuted instantiation: options.c:isBayer
Unexecuted instantiation: output.c:isBayer
Unexecuted instantiation: rgb2rgb.c:isBayer
Unexecuted instantiation: slice.c:isBayer
Unexecuted instantiation: swscale_unscaled.c:isBayer
Unexecuted instantiation: gamma.c:isBayer
Unexecuted instantiation: hscale.c:isBayer
868
869
static av_always_inline int isBayer16BPS(enum AVPixelFormat pix_fmt)
870
0
{
871
0
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
872
0
    av_assert0(desc);
873
0
    return desc->comp[1].depth == 8;
874
0
}
Unexecuted instantiation: swscale.c:isBayer16BPS
Unexecuted instantiation: utils.c:isBayer16BPS
Unexecuted instantiation: vscale.c:isBayer16BPS
Unexecuted instantiation: yuv2rgb.c:isBayer16BPS
Unexecuted instantiation: alphablend.c:isBayer16BPS
Unexecuted instantiation: graph.c:isBayer16BPS
Unexecuted instantiation: hscale_fast_bilinear.c:isBayer16BPS
Unexecuted instantiation: input.c:isBayer16BPS
Unexecuted instantiation: ops_dispatch.c:isBayer16BPS
Unexecuted instantiation: options.c:isBayer16BPS
Unexecuted instantiation: output.c:isBayer16BPS
Unexecuted instantiation: rgb2rgb.c:isBayer16BPS
Unexecuted instantiation: slice.c:isBayer16BPS
Unexecuted instantiation: swscale_unscaled.c:isBayer16BPS
Unexecuted instantiation: gamma.c:isBayer16BPS
Unexecuted instantiation: hscale.c:isBayer16BPS
875
876
static av_always_inline int isAnyRGB(enum AVPixelFormat pix_fmt)
877
0
{
878
0
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
879
0
    av_assert0(desc);
880
0
    return (desc->flags & AV_PIX_FMT_FLAG_RGB) ||
881
0
            pix_fmt == AV_PIX_FMT_MONOBLACK || pix_fmt == AV_PIX_FMT_MONOWHITE;
882
0
}
Unexecuted instantiation: swscale.c:isAnyRGB
Unexecuted instantiation: utils.c:isAnyRGB
Unexecuted instantiation: vscale.c:isAnyRGB
Unexecuted instantiation: yuv2rgb.c:isAnyRGB
Unexecuted instantiation: alphablend.c:isAnyRGB
Unexecuted instantiation: graph.c:isAnyRGB
Unexecuted instantiation: hscale_fast_bilinear.c:isAnyRGB
Unexecuted instantiation: input.c:isAnyRGB
Unexecuted instantiation: ops_dispatch.c:isAnyRGB
Unexecuted instantiation: options.c:isAnyRGB
Unexecuted instantiation: output.c:isAnyRGB
Unexecuted instantiation: rgb2rgb.c:isAnyRGB
Unexecuted instantiation: slice.c:isAnyRGB
Unexecuted instantiation: swscale_unscaled.c:isAnyRGB
Unexecuted instantiation: gamma.c:isAnyRGB
Unexecuted instantiation: hscale.c:isAnyRGB
883
884
static av_always_inline int isFloat(enum AVPixelFormat pix_fmt)
885
0
{
886
0
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
887
0
    av_assert0(desc);
888
0
    return desc->flags & AV_PIX_FMT_FLAG_FLOAT;
889
0
}
Unexecuted instantiation: swscale.c:isFloat
Unexecuted instantiation: utils.c:isFloat
Unexecuted instantiation: vscale.c:isFloat
Unexecuted instantiation: yuv2rgb.c:isFloat
Unexecuted instantiation: alphablend.c:isFloat
Unexecuted instantiation: graph.c:isFloat
Unexecuted instantiation: hscale_fast_bilinear.c:isFloat
Unexecuted instantiation: input.c:isFloat
Unexecuted instantiation: ops_dispatch.c:isFloat
Unexecuted instantiation: options.c:isFloat
Unexecuted instantiation: output.c:isFloat
Unexecuted instantiation: rgb2rgb.c:isFloat
Unexecuted instantiation: slice.c:isFloat
Unexecuted instantiation: swscale_unscaled.c:isFloat
Unexecuted instantiation: gamma.c:isFloat
Unexecuted instantiation: hscale.c:isFloat
890
891
static av_always_inline int isFloat16(enum AVPixelFormat pix_fmt)
892
0
{
893
0
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
894
0
    av_assert0(desc);
895
0
    return (desc->flags & AV_PIX_FMT_FLAG_FLOAT) && desc->comp[0].depth == 16;
896
0
}
Unexecuted instantiation: swscale.c:isFloat16
Unexecuted instantiation: utils.c:isFloat16
Unexecuted instantiation: vscale.c:isFloat16
Unexecuted instantiation: yuv2rgb.c:isFloat16
Unexecuted instantiation: alphablend.c:isFloat16
Unexecuted instantiation: graph.c:isFloat16
Unexecuted instantiation: hscale_fast_bilinear.c:isFloat16
Unexecuted instantiation: input.c:isFloat16
Unexecuted instantiation: ops_dispatch.c:isFloat16
Unexecuted instantiation: options.c:isFloat16
Unexecuted instantiation: output.c:isFloat16
Unexecuted instantiation: rgb2rgb.c:isFloat16
Unexecuted instantiation: slice.c:isFloat16
Unexecuted instantiation: swscale_unscaled.c:isFloat16
Unexecuted instantiation: gamma.c:isFloat16
Unexecuted instantiation: hscale.c:isFloat16
897
898
static av_always_inline int isALPHA(enum AVPixelFormat pix_fmt)
899
0
{
900
0
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
901
0
    av_assert0(desc);
902
0
    if (pix_fmt == AV_PIX_FMT_PAL8)
903
0
        return 1;
904
0
    return desc->flags & AV_PIX_FMT_FLAG_ALPHA;
905
0
}
Unexecuted instantiation: swscale.c:isALPHA
Unexecuted instantiation: utils.c:isALPHA
Unexecuted instantiation: vscale.c:isALPHA
Unexecuted instantiation: yuv2rgb.c:isALPHA
Unexecuted instantiation: alphablend.c:isALPHA
Unexecuted instantiation: graph.c:isALPHA
Unexecuted instantiation: hscale_fast_bilinear.c:isALPHA
Unexecuted instantiation: input.c:isALPHA
Unexecuted instantiation: ops_dispatch.c:isALPHA
Unexecuted instantiation: options.c:isALPHA
Unexecuted instantiation: output.c:isALPHA
Unexecuted instantiation: rgb2rgb.c:isALPHA
Unexecuted instantiation: slice.c:isALPHA
Unexecuted instantiation: swscale_unscaled.c:isALPHA
Unexecuted instantiation: gamma.c:isALPHA
Unexecuted instantiation: hscale.c:isALPHA
906
907
static av_always_inline int isPacked(enum AVPixelFormat pix_fmt)
908
0
{
909
0
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
910
0
    av_assert0(desc);
911
0
    return (desc->nb_components >= 2 && !(desc->flags & AV_PIX_FMT_FLAG_PLANAR)) ||
912
0
            pix_fmt == AV_PIX_FMT_PAL8 ||
913
0
            pix_fmt == AV_PIX_FMT_MONOBLACK || pix_fmt == AV_PIX_FMT_MONOWHITE;
914
0
}
Unexecuted instantiation: swscale.c:isPacked
Unexecuted instantiation: utils.c:isPacked
Unexecuted instantiation: vscale.c:isPacked
Unexecuted instantiation: yuv2rgb.c:isPacked
Unexecuted instantiation: alphablend.c:isPacked
Unexecuted instantiation: graph.c:isPacked
Unexecuted instantiation: hscale_fast_bilinear.c:isPacked
Unexecuted instantiation: input.c:isPacked
Unexecuted instantiation: ops_dispatch.c:isPacked
Unexecuted instantiation: options.c:isPacked
Unexecuted instantiation: output.c:isPacked
Unexecuted instantiation: rgb2rgb.c:isPacked
Unexecuted instantiation: slice.c:isPacked
Unexecuted instantiation: swscale_unscaled.c:isPacked
Unexecuted instantiation: gamma.c:isPacked
Unexecuted instantiation: hscale.c:isPacked
915
916
static av_always_inline int isPlanar(enum AVPixelFormat pix_fmt)
917
0
{
918
0
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
919
0
    av_assert0(desc);
920
0
    return (desc->nb_components >= 2 && (desc->flags & AV_PIX_FMT_FLAG_PLANAR));
921
0
}
Unexecuted instantiation: swscale.c:isPlanar
Unexecuted instantiation: utils.c:isPlanar
Unexecuted instantiation: vscale.c:isPlanar
Unexecuted instantiation: yuv2rgb.c:isPlanar
Unexecuted instantiation: alphablend.c:isPlanar
Unexecuted instantiation: graph.c:isPlanar
Unexecuted instantiation: hscale_fast_bilinear.c:isPlanar
Unexecuted instantiation: input.c:isPlanar
Unexecuted instantiation: ops_dispatch.c:isPlanar
Unexecuted instantiation: options.c:isPlanar
Unexecuted instantiation: output.c:isPlanar
Unexecuted instantiation: rgb2rgb.c:isPlanar
Unexecuted instantiation: slice.c:isPlanar
Unexecuted instantiation: swscale_unscaled.c:isPlanar
Unexecuted instantiation: gamma.c:isPlanar
Unexecuted instantiation: hscale.c:isPlanar
922
923
static av_always_inline int isPackedRGB(enum AVPixelFormat pix_fmt)
924
0
{
925
0
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
926
0
    av_assert0(desc);
927
0
    return ((desc->flags & (AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB)) == AV_PIX_FMT_FLAG_RGB);
928
0
}
Unexecuted instantiation: swscale.c:isPackedRGB
Unexecuted instantiation: utils.c:isPackedRGB
Unexecuted instantiation: vscale.c:isPackedRGB
Unexecuted instantiation: yuv2rgb.c:isPackedRGB
Unexecuted instantiation: alphablend.c:isPackedRGB
Unexecuted instantiation: graph.c:isPackedRGB
Unexecuted instantiation: hscale_fast_bilinear.c:isPackedRGB
Unexecuted instantiation: input.c:isPackedRGB
Unexecuted instantiation: ops_dispatch.c:isPackedRGB
Unexecuted instantiation: options.c:isPackedRGB
Unexecuted instantiation: output.c:isPackedRGB
Unexecuted instantiation: rgb2rgb.c:isPackedRGB
Unexecuted instantiation: slice.c:isPackedRGB
Unexecuted instantiation: swscale_unscaled.c:isPackedRGB
Unexecuted instantiation: gamma.c:isPackedRGB
Unexecuted instantiation: hscale.c:isPackedRGB
929
930
static av_always_inline int isPlanarRGB(enum AVPixelFormat pix_fmt)
931
0
{
932
0
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
933
0
    av_assert0(desc);
934
0
    return ((desc->flags & (AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB)) ==
935
0
            (AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB));
936
0
}
Unexecuted instantiation: swscale.c:isPlanarRGB
Unexecuted instantiation: utils.c:isPlanarRGB
Unexecuted instantiation: vscale.c:isPlanarRGB
Unexecuted instantiation: yuv2rgb.c:isPlanarRGB
Unexecuted instantiation: alphablend.c:isPlanarRGB
Unexecuted instantiation: graph.c:isPlanarRGB
Unexecuted instantiation: hscale_fast_bilinear.c:isPlanarRGB
Unexecuted instantiation: input.c:isPlanarRGB
Unexecuted instantiation: ops_dispatch.c:isPlanarRGB
Unexecuted instantiation: options.c:isPlanarRGB
Unexecuted instantiation: output.c:isPlanarRGB
Unexecuted instantiation: rgb2rgb.c:isPlanarRGB
Unexecuted instantiation: slice.c:isPlanarRGB
Unexecuted instantiation: swscale_unscaled.c:isPlanarRGB
Unexecuted instantiation: gamma.c:isPlanarRGB
Unexecuted instantiation: hscale.c:isPlanarRGB
937
938
static av_always_inline int usePal(enum AVPixelFormat pix_fmt)
939
0
{
940
0
    switch (pix_fmt) {
941
0
    case AV_PIX_FMT_PAL8:
942
0
    case AV_PIX_FMT_BGR4_BYTE:
943
0
    case AV_PIX_FMT_BGR8:
944
0
    case AV_PIX_FMT_GRAY8:
945
0
    case AV_PIX_FMT_RGB4_BYTE:
946
0
    case AV_PIX_FMT_RGB8:
947
0
        return 1;
948
0
    default:
949
0
        return 0;
950
0
    }
951
0
}
Unexecuted instantiation: swscale.c:usePal
Unexecuted instantiation: utils.c:usePal
Unexecuted instantiation: vscale.c:usePal
Unexecuted instantiation: yuv2rgb.c:usePal
Unexecuted instantiation: alphablend.c:usePal
Unexecuted instantiation: graph.c:usePal
Unexecuted instantiation: hscale_fast_bilinear.c:usePal
Unexecuted instantiation: input.c:usePal
Unexecuted instantiation: ops_dispatch.c:usePal
Unexecuted instantiation: options.c:usePal
Unexecuted instantiation: output.c:usePal
Unexecuted instantiation: rgb2rgb.c:usePal
Unexecuted instantiation: slice.c:usePal
Unexecuted instantiation: swscale_unscaled.c:usePal
Unexecuted instantiation: gamma.c:usePal
Unexecuted instantiation: hscale.c:usePal
952
953
/*
954
 * Identity formats where the data is in the high bits, and the low bits are shifted away.
955
 */
956
static av_always_inline int isDataInHighBits(enum AVPixelFormat pix_fmt)
957
0
{
958
0
    int i;
959
0
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
960
0
    av_assert0(desc);
961
0
    if (desc->flags & (AV_PIX_FMT_FLAG_BITSTREAM | AV_PIX_FMT_FLAG_HWACCEL))
962
0
        return 0;
963
0
    for (i = 0; i < desc->nb_components; i++) {
964
0
        if (!desc->comp[i].shift)
965
0
            return 0;
966
0
        if ((desc->comp[i].shift + desc->comp[i].depth) & 0x7)
967
0
            return 0;
968
0
    }
969
0
    return 1;
970
0
}
Unexecuted instantiation: swscale.c:isDataInHighBits
Unexecuted instantiation: utils.c:isDataInHighBits
Unexecuted instantiation: vscale.c:isDataInHighBits
Unexecuted instantiation: yuv2rgb.c:isDataInHighBits
Unexecuted instantiation: alphablend.c:isDataInHighBits
Unexecuted instantiation: graph.c:isDataInHighBits
Unexecuted instantiation: hscale_fast_bilinear.c:isDataInHighBits
Unexecuted instantiation: input.c:isDataInHighBits
Unexecuted instantiation: ops_dispatch.c:isDataInHighBits
Unexecuted instantiation: options.c:isDataInHighBits
Unexecuted instantiation: output.c:isDataInHighBits
Unexecuted instantiation: rgb2rgb.c:isDataInHighBits
Unexecuted instantiation: slice.c:isDataInHighBits
Unexecuted instantiation: swscale_unscaled.c:isDataInHighBits
Unexecuted instantiation: gamma.c:isDataInHighBits
Unexecuted instantiation: hscale.c:isDataInHighBits
971
972
/*
973
 * Identity formats where the chroma planes are swapped (CrCb order).
974
 */
975
static av_always_inline int isSwappedChroma(enum AVPixelFormat pix_fmt)
976
0
{
977
0
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
978
0
    av_assert0(desc);
979
0
    if (!isYUV(pix_fmt))
980
0
        return 0;
981
0
    if ((desc->flags & AV_PIX_FMT_FLAG_ALPHA) && desc->nb_components < 4)
982
0
        return 0;
983
0
    if (desc->nb_components < 3)
984
0
        return 0;
985
0
    if (!isPlanarYUV(pix_fmt) || isSemiPlanarYUV(pix_fmt))
986
0
        return desc->comp[1].offset > desc->comp[2].offset;
987
0
    else
988
0
        return desc->comp[1].plane > desc->comp[2].plane;
989
0
}
Unexecuted instantiation: swscale.c:isSwappedChroma
Unexecuted instantiation: utils.c:isSwappedChroma
Unexecuted instantiation: vscale.c:isSwappedChroma
Unexecuted instantiation: yuv2rgb.c:isSwappedChroma
Unexecuted instantiation: alphablend.c:isSwappedChroma
Unexecuted instantiation: graph.c:isSwappedChroma
Unexecuted instantiation: hscale_fast_bilinear.c:isSwappedChroma
Unexecuted instantiation: input.c:isSwappedChroma
Unexecuted instantiation: ops_dispatch.c:isSwappedChroma
Unexecuted instantiation: options.c:isSwappedChroma
Unexecuted instantiation: output.c:isSwappedChroma
Unexecuted instantiation: rgb2rgb.c:isSwappedChroma
Unexecuted instantiation: slice.c:isSwappedChroma
Unexecuted instantiation: swscale_unscaled.c:isSwappedChroma
Unexecuted instantiation: gamma.c:isSwappedChroma
Unexecuted instantiation: hscale.c:isSwappedChroma
990
991
extern const uint64_t ff_dither4[2];
992
extern const uint64_t ff_dither8[2];
993
994
extern const uint8_t ff_dither_2x2_4[3][8];
995
extern const uint8_t ff_dither_2x2_8[3][8];
996
extern const uint8_t ff_dither_4x4_16[5][8];
997
extern const uint8_t ff_dither_8x8_32[9][8];
998
extern const uint8_t ff_dither_8x8_73[9][8];
999
extern const uint8_t ff_dither_8x8_128[9][8];
1000
extern const uint8_t ff_dither_8x8_220[9][8];
1001
1002
extern const int32_t ff_yuv2rgb_coeffs[11][4];
1003
1004
extern const AVClass ff_sws_context_class;
1005
1006
int ff_sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter,
1007
                               SwsFilter *dstFilter);
1008
1009
/**
1010
 * Set c->convert_unscaled to an unscaled converter if one exists for the
1011
 * specific source and destination formats, bit depths, flags, etc.
1012
 */
1013
void ff_get_unscaled_swscale(SwsInternal *c);
1014
void ff_get_unscaled_swscale_ppc(SwsInternal *c);
1015
void ff_get_unscaled_swscale_arm(SwsInternal *c);
1016
void ff_get_unscaled_swscale_aarch64(SwsInternal *c);
1017
1018
void ff_sws_init_scale(SwsInternal *c);
1019
1020
void ff_sws_init_input_funcs(SwsInternal *c,
1021
                             planar1_YV12_fn *lumToYV12,
1022
                             planar1_YV12_fn *alpToYV12,
1023
                             planar2_YV12_fn *chrToYV12,
1024
                             planarX_YV12_fn *readLumPlanar,
1025
                             planarX_YV12_fn *readAlpPlanar,
1026
                             planarX2_YV12_fn *readChrPlanar);
1027
void ff_sws_init_output_funcs(SwsInternal *c,
1028
                              yuv2planar1_fn *yuv2plane1,
1029
                              yuv2planarX_fn *yuv2planeX,
1030
                              yuv2interleavedX_fn *yuv2nv12cX,
1031
                              yuv2packed1_fn *yuv2packed1,
1032
                              yuv2packed2_fn *yuv2packed2,
1033
                              yuv2packedX_fn *yuv2packedX,
1034
                              yuv2anyX_fn *yuv2anyX);
1035
void ff_sws_init_swscale_ppc(SwsInternal *c);
1036
void ff_sws_init_swscale_vsx(SwsInternal *c);
1037
void ff_sws_init_swscale_x86(SwsInternal *c);
1038
void ff_sws_init_swscale_aarch64(SwsInternal *c);
1039
void ff_sws_init_swscale_arm(SwsInternal *c);
1040
void ff_sws_init_swscale_loongarch(SwsInternal *c);
1041
void ff_sws_init_swscale_riscv(SwsInternal *c);
1042
1043
int ff_sws_init_altivec_bufs(SwsInternal *c);
1044
void ff_sws_free_altivec_bufs(SwsInternal *c);
1045
1046
void ff_hyscale_fast_c(SwsInternal *c, int16_t *dst, int dstWidth,
1047
                       const uint8_t *src, int srcW, int xInc);
1048
void ff_hcscale_fast_c(SwsInternal *c, int16_t *dst1, int16_t *dst2,
1049
                       int dstWidth, const uint8_t *src1,
1050
                       const uint8_t *src2, int srcW, int xInc);
1051
int ff_init_hscaler_mmxext(int dstW, int xInc, uint8_t *filterCode,
1052
                           int16_t *filter, int32_t *filterPos,
1053
                           int numSplits);
1054
void ff_hyscale_fast_mmxext(SwsInternal *c, int16_t *dst,
1055
                            int dstWidth, const uint8_t *src,
1056
                            int srcW, int xInc);
1057
void ff_hcscale_fast_mmxext(SwsInternal *c, int16_t *dst1, int16_t *dst2,
1058
                            int dstWidth, const uint8_t *src1,
1059
                            const uint8_t *src2, int srcW, int xInc);
1060
1061
int ff_sws_alphablendaway(SwsInternal *c, const uint8_t *const src[],
1062
                          const int srcStride[], int srcSliceY, int srcSliceH,
1063
                          uint8_t *const dst[], const int dstStride[]);
1064
1065
void ff_copyPlane(const uint8_t *src, int srcStride,
1066
                  int srcSliceY, int srcSliceH, int width,
1067
                  uint8_t *dst, int dstStride);
1068
1069
static inline void fillPlane16(uint8_t *plane, int stride, int width, int height, int y,
1070
                               int alpha, int bits, const int big_endian)
1071
0
{
1072
0
    uint8_t *ptr = plane + stride * y;
1073
0
    int v = alpha ? 0xFFFF>>(16-bits) : (1<<(bits-1));
1074
0
    if (big_endian != HAVE_BIGENDIAN)
1075
0
        v = av_bswap16(v);
1076
0
    for (int i = 0; i < height; i++) {
1077
0
        for (int j = 0; j < width; j++)
1078
0
            AV_WN16(ptr + 2 * j, v);
1079
0
        ptr += stride;
1080
0
    }
1081
0
}
Unexecuted instantiation: swscale.c:fillPlane16
Unexecuted instantiation: utils.c:fillPlane16
Unexecuted instantiation: vscale.c:fillPlane16
Unexecuted instantiation: yuv2rgb.c:fillPlane16
Unexecuted instantiation: alphablend.c:fillPlane16
Unexecuted instantiation: graph.c:fillPlane16
Unexecuted instantiation: hscale_fast_bilinear.c:fillPlane16
Unexecuted instantiation: input.c:fillPlane16
Unexecuted instantiation: ops_dispatch.c:fillPlane16
Unexecuted instantiation: options.c:fillPlane16
Unexecuted instantiation: output.c:fillPlane16
Unexecuted instantiation: rgb2rgb.c:fillPlane16
Unexecuted instantiation: slice.c:fillPlane16
Unexecuted instantiation: swscale_unscaled.c:fillPlane16
Unexecuted instantiation: gamma.c:fillPlane16
Unexecuted instantiation: hscale.c:fillPlane16
1082
1083
static inline void fillPlane32(uint8_t *plane, int stride, int width, int height, int y,
1084
                               int alpha, int bits, const int big_endian, int is_float)
1085
0
{
1086
0
    uint8_t *ptr = plane + stride * y;
1087
0
    uint32_t v;
1088
0
    uint32_t onef32 = 0x3f800000;
1089
0
    if (is_float)
1090
0
        v = alpha ? onef32 : 0;
1091
0
    else
1092
0
        v = alpha ? 0xFFFFFFFF>>(32-bits) : (1<<(bits-1));
1093
0
    if (big_endian != HAVE_BIGENDIAN)
1094
0
        v = av_bswap32(v);
1095
1096
0
    for (int i = 0; i < height; i++) {
1097
0
        for (int j = 0; j < width; j++)
1098
0
            AV_WN32(ptr + 4 * j, v);
1099
0
        ptr += stride;
1100
0
    }
1101
0
}
Unexecuted instantiation: swscale.c:fillPlane32
Unexecuted instantiation: utils.c:fillPlane32
Unexecuted instantiation: vscale.c:fillPlane32
Unexecuted instantiation: yuv2rgb.c:fillPlane32
Unexecuted instantiation: alphablend.c:fillPlane32
Unexecuted instantiation: graph.c:fillPlane32
Unexecuted instantiation: hscale_fast_bilinear.c:fillPlane32
Unexecuted instantiation: input.c:fillPlane32
Unexecuted instantiation: ops_dispatch.c:fillPlane32
Unexecuted instantiation: options.c:fillPlane32
Unexecuted instantiation: output.c:fillPlane32
Unexecuted instantiation: rgb2rgb.c:fillPlane32
Unexecuted instantiation: slice.c:fillPlane32
Unexecuted instantiation: swscale_unscaled.c:fillPlane32
Unexecuted instantiation: gamma.c:fillPlane32
Unexecuted instantiation: hscale.c:fillPlane32
1102
1103
1104
#define MAX_SLICE_PLANES 4
1105
1106
/// Slice plane
1107
typedef struct SwsPlane
1108
{
1109
    int available_lines;    ///< max number of lines that can be hold by this plane
1110
    int sliceY;             ///< index of first line
1111
    int sliceH;             ///< number of lines
1112
    uint8_t **line;         ///< line buffer
1113
    uint8_t **tmp;          ///< Tmp line buffer used by mmx code
1114
} SwsPlane;
1115
1116
/**
1117
 * Struct which defines a slice of an image to be scaled or an output for
1118
 * a scaled slice.
1119
 * A slice can also be used as intermediate ring buffer for scaling steps.
1120
 */
1121
typedef struct SwsSlice
1122
{
1123
    int width;              ///< Slice line width
1124
    int h_chr_sub_sample;   ///< horizontal chroma subsampling factor
1125
    int v_chr_sub_sample;   ///< vertical chroma subsampling factor
1126
    int is_ring;            ///< flag to identify if this slice is a ring buffer
1127
    int should_free_lines;  ///< flag to identify if there are dynamic allocated lines
1128
    enum AVPixelFormat fmt; ///< planes pixel format
1129
    SwsPlane plane[MAX_SLICE_PLANES];   ///< color planes
1130
} SwsSlice;
1131
1132
/**
1133
 * Struct which holds all necessary data for processing a slice.
1134
 * A processing step can be a color conversion or horizontal/vertical scaling.
1135
 */
1136
typedef struct SwsFilterDescriptor
1137
{
1138
    SwsSlice *src;  ///< Source slice
1139
    SwsSlice *dst;  ///< Output slice
1140
1141
    int alpha;      ///< Flag for processing alpha channel
1142
    void *instance; ///< Filter instance data
1143
1144
    /// Function for processing input slice sliceH lines starting from line sliceY
1145
    int (*process)(SwsInternal *c, struct SwsFilterDescriptor *desc, int sliceY, int sliceH);
1146
} SwsFilterDescriptor;
1147
1148
// warp input lines in the form (src + width*i + j) to slice format (line[i][j])
1149
// relative=true means first line src[x][0] otherwise first line is src[x][lum/crh Y]
1150
int ff_init_slice_from_src(SwsSlice * s, uint8_t *const src[4], const int stride[4],
1151
                           int srcW, int lumY, int lumH, int chrY, int chrH, int relative);
1152
1153
// Initialize scaler filter descriptor chain
1154
int ff_init_filters(SwsInternal *c);
1155
1156
// Free all filter data
1157
int ff_free_filters(SwsInternal *c);
1158
1159
/*
1160
 function for applying ring buffer logic into slice s
1161
 It checks if the slice can hold more @lum lines, if yes
1162
 do nothing otherwise remove @lum least used lines.
1163
 It applies the same procedure for @chr lines.
1164
*/
1165
int ff_rotate_slice(SwsSlice *s, int lum, int chr);
1166
1167
/// initializes gamma conversion descriptor
1168
int ff_init_gamma_convert(SwsFilterDescriptor *desc, SwsSlice * src, uint16_t *table);
1169
1170
/// initializes lum pixel format conversion descriptor
1171
int ff_init_desc_fmt_convert(SwsFilterDescriptor *desc, SwsSlice * src, SwsSlice *dst, uint32_t *pal);
1172
1173
/// initializes lum horizontal scaling descriptor
1174
int ff_init_desc_hscale(SwsFilterDescriptor *desc, SwsSlice *src, SwsSlice *dst, uint16_t *filter, int * filter_pos, int filter_size, int xInc);
1175
1176
/// initializes chr pixel format conversion descriptor
1177
int ff_init_desc_cfmt_convert(SwsFilterDescriptor *desc, SwsSlice * src, SwsSlice *dst, uint32_t *pal);
1178
1179
/// initializes chr horizontal scaling descriptor
1180
int ff_init_desc_chscale(SwsFilterDescriptor *desc, SwsSlice *src, SwsSlice *dst, uint16_t *filter, int * filter_pos, int filter_size, int xInc);
1181
1182
int ff_init_desc_no_chr(SwsFilterDescriptor *desc, SwsSlice * src, SwsSlice *dst);
1183
1184
/// initializes vertical scaling descriptors
1185
int ff_init_vscale(SwsInternal *c, SwsFilterDescriptor *desc, SwsSlice *src, SwsSlice *dst);
1186
1187
/// setup vertical scaler functions
1188
void ff_init_vscale_pfn(SwsInternal *c, yuv2planar1_fn yuv2plane1, yuv2planarX_fn yuv2planeX,
1189
    yuv2interleavedX_fn yuv2nv12cX, yuv2packed1_fn yuv2packed1, yuv2packed2_fn yuv2packed2,
1190
    yuv2packedX_fn yuv2packedX, yuv2anyX_fn yuv2anyX, int use_mmx);
1191
1192
void ff_sws_slice_worker(void *priv, int jobnr, int threadnr,
1193
                         int nb_jobs, int nb_threads);
1194
1195
int ff_swscale(SwsInternal *c, const uint8_t *const src[], const int srcStride[],
1196
               int srcSliceY, int srcSliceH, uint8_t *const dst[],
1197
               const int dstStride[], int dstSliceY, int dstSliceH);
1198
1199
1200
//number of extra lines to process
1201
#define MAX_LINES_AHEAD 4
1202
1203
//shuffle filter and filterPos for hyScale and hcScale filters in avx2
1204
int ff_shuffle_filter_coefficients(SwsInternal *c, int* filterPos, int filterSize, int16_t *filter, int dstW);
1205
#endif /* SWSCALE_SWSCALE_INTERNAL_H */