Coverage Report

Created: 2026-02-14 06:59

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