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