FFmpeg
Loading...
Searching...
No Matches
swscale_internal.h
Go to the documentation of this file.
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/framepool.h"
36#include "libavutil/log.h"
38#include "libavutil/pixfmt.h"
39#include "libavutil/pixdesc.h"
40#include "libavutil/refstruct.h"
43
44#if HAVE_ALTIVEC
45#define SWSINTERNAL_ADDITIONAL_ASM_SIZE (7*16 + /* alignment */ 16)
46#endif
47#ifndef SWSINTERNAL_ADDITIONAL_ASM_SIZE
48#define SWSINTERNAL_ADDITIONAL_ASM_SIZE 0
49#endif
50
51#define STR(s) AV_TOSTRING(s) // AV_STRINGIFY is too long
52
53#define YUVRGB_TABLE_HEADROOM 512
54#define YUVRGB_TABLE_LUMA_HEADROOM 512
55
56#define MAX_FILTER_SIZE SWS_MAX_FILTER_SIZE
57
58#define SWS_MAX_THREADS 8192 /* sanity clamp */
59
60#if HAVE_BIGENDIAN
61#define ALT32_CORR (-1)
62#else
63#define ALT32_CORR 1
64#endif
65
66#if ARCH_X86_64
67# define APCK_PTR2 8
68# define APCK_COEF 16
69# define APCK_SIZE 24
70#else
71# define APCK_PTR2 4
72# define APCK_COEF 8
73# define APCK_SIZE 16
74#endif
75
76#define RETCODE_USE_CASCADE -12345
77
78static inline void *ff_refstruct_calloc(size_t n, size_t size)
79{
80 if (size && n > SIZE_MAX / size)
81 return NULL;
82 return av_refstruct_allocz(n * size);
83}
84
85typedef struct SwsInternal SwsInternal;
86
87static inline SwsInternal *sws_internal(const SwsContext *sws)
88{
89 return (SwsInternal *) sws;
90}
91
93
94typedef struct Range {
95 unsigned int start;
96 unsigned int len;
97} Range;
98
99typedef struct RangeList {
101 unsigned int nb_ranges;
103} RangeList;
104
105int ff_range_add(RangeList *r, unsigned int start, unsigned int len);
106
107typedef int (*SwsFunc)(SwsInternal *c, const uint8_t *const src[],
108 const int srcStride[], int srcSliceY, int srcSliceH,
109 uint8_t *const dst[], const int dstStride[]);
110
111typedef void (*SwsColorFunc)(const SwsInternal *c, uint8_t *dst, int dst_stride,
112 const uint8_t *src, int src_stride, int w, int h);
113
114typedef struct SwsLuts {
115 uint16_t *in;
116 uint16_t *out;
117} SwsLuts;
118
119typedef struct SwsColorXform {
121 int16_t mat[3][3];
123
124/**
125 * Write one line of horizontally scaled data to planar output
126 * without any additional vertical scaling (or point-scaling).
127 *
128 * @param src scaled source data, 15 bits for 8-10-bit output,
129 * 19 bits for 16-bit output (in int32_t)
130 * @param dest pointer to the output plane. For >8-bit
131 * output, this is in uint16_t
132 * @param dstW width of destination in pixels
133 * @param dither ordered dither array of type int16_t and size 8
134 * @param offset Dither offset
135 */
136typedef void (*yuv2planar1_fn)(const int16_t *src, uint8_t *dest, int dstW,
137 const uint8_t *dither, int offset);
138
139/**
140 * Write one line of horizontally scaled data to planar output
141 * with multi-point vertical scaling between input pixels.
142 *
143 * @param filter vertical luma/alpha scaling coefficients, 12 bits [0,4096]
144 * @param src scaled luma (Y) or alpha (A) source data, 15 bits for
145 * 8-10-bit output, 19 bits for 16-bit output (in int32_t)
146 * @param filterSize number of vertical input lines to scale
147 * @param dest pointer to output plane. For >8-bit
148 * output, this is in uint16_t
149 * @param dstW width of destination pixels
150 * @param offset Dither offset
151 */
152typedef void (*yuv2planarX_fn)(const int16_t *filter, int filterSize,
153 const int16_t **src, uint8_t *dest, int dstW,
154 const uint8_t *dither, int offset);
155
156/**
157 * Write one line of horizontally scaled chroma to interleaved output
158 * with multi-point vertical scaling between input pixels.
159 *
160 * @param dstFormat destination pixel format
161 * @param chrDither ordered dither array of type uint8_t and size 8
162 * @param chrFilter vertical chroma scaling coefficients, 12 bits [0,4096]
163 * @param chrUSrc scaled chroma (U) source data, 15 bits for 8-10-bit
164 * output, 19 bits for 16-bit output (in int32_t)
165 * @param chrVSrc scaled chroma (V) source data, 15 bits for 8-10-bit
166 * output, 19 bits for 16-bit output (in int32_t)
167 * @param chrFilterSize number of vertical chroma input lines to scale
168 * @param dest pointer to the output plane. For >8-bit
169 * output, this is in uint16_t
170 * @param dstW width of chroma planes
171 */
172typedef void (*yuv2interleavedX_fn)(enum AVPixelFormat dstFormat,
173 const uint8_t *chrDither,
174 const int16_t *chrFilter,
175 int chrFilterSize,
176 const int16_t **chrUSrc,
177 const int16_t **chrVSrc,
178 uint8_t *dest, int dstW);
179
180/**
181 * Write one line of horizontally scaled Y/U/V/A to packed-pixel YUV/RGB
182 * output without any additional vertical scaling (or point-scaling). Note
183 * that this function may do chroma scaling, see the "uvalpha" argument.
184 *
185 * @param c SWS scaling context
186 * @param lumSrc scaled luma (Y) source data, 15 bits for 8-10-bit output,
187 * 19 bits for 16-bit output (in int32_t)
188 * @param chrUSrc scaled chroma (U) source data, 15 bits for 8-10-bit output,
189 * 19 bits for 16-bit output (in int32_t)
190 * @param chrVSrc scaled chroma (V) source data, 15 bits for 8-10-bit output,
191 * 19 bits for 16-bit output (in int32_t)
192 * @param alpSrc scaled alpha (A) source data, 15 bits for 8-10-bit output,
193 * 19 bits for 16-bit output (in int32_t)
194 * @param dest pointer to the output plane. For 16-bit output, this is
195 * uint16_t
196 * @param dstW width of lumSrc and alpSrc in pixels, number of pixels
197 * to write into dest[]
198 * @param uvalpha chroma scaling coefficient for the second line of chroma
199 * pixels, either 2048 or 0. If 0, one chroma input is used
200 * for 2 output pixels (or if the SWS_FULL_CHR_H_INT flag
201 * is set, it generates 1 output pixel). If 2048, two chroma
202 * input pixels should be averaged for 2 output pixels (this
203 * only happens if SWS_FULL_CHR_H_INT is not set)
204 * @param y vertical line number for this output. This does not need
205 * to be used to calculate the offset in the destination,
206 * but can be used to generate comfort noise using dithering
207 * for some output formats.
208 */
209typedef void (*yuv2packed1_fn)(SwsInternal *c, const int16_t *lumSrc,
210 const int16_t *chrUSrc[2],
211 const int16_t *chrVSrc[2],
212 const int16_t *alpSrc, uint8_t *dest,
213 int dstW, int uvalpha, int y);
214/**
215 * Write one line of horizontally scaled Y/U/V/A to packed-pixel YUV/RGB
216 * output by doing bilinear scaling between two input lines.
217 *
218 * @param c SWS scaling context
219 * @param lumSrc scaled luma (Y) source data, 15 bits for 8-10-bit output,
220 * 19 bits for 16-bit output (in int32_t)
221 * @param chrUSrc scaled chroma (U) source data, 15 bits for 8-10-bit output,
222 * 19 bits for 16-bit output (in int32_t)
223 * @param chrVSrc scaled chroma (V) source data, 15 bits for 8-10-bit output,
224 * 19 bits for 16-bit output (in int32_t)
225 * @param alpSrc scaled alpha (A) source data, 15 bits for 8-10-bit output,
226 * 19 bits for 16-bit output (in int32_t)
227 * @param dest pointer to the output plane. For 16-bit output, this is
228 * uint16_t
229 * @param dstW width of lumSrc and alpSrc in pixels, number of pixels
230 * to write into dest[]
231 * @param yalpha luma/alpha scaling coefficients for the second input line.
232 * The first line's coefficients can be calculated by using
233 * 4096 - yalpha
234 * @param uvalpha chroma scaling coefficient for the second input line. The
235 * first line's coefficients can be calculated by using
236 * 4096 - uvalpha
237 * @param y vertical line number for this output. This does not need
238 * to be used to calculate the offset in the destination,
239 * but can be used to generate comfort noise using dithering
240 * for some output formats.
241 */
242typedef void (*yuv2packed2_fn)(SwsInternal *c, const int16_t *lumSrc[2],
243 const int16_t *chrUSrc[2],
244 const int16_t *chrVSrc[2],
245 const int16_t *alpSrc[2],
246 uint8_t *dest,
247 int dstW, int yalpha, int uvalpha, int y);
248/**
249 * Write one line of horizontally scaled Y/U/V/A to packed-pixel YUV/RGB
250 * output by doing multi-point vertical scaling between input pixels.
251 *
252 * @param c SWS scaling context
253 * @param lumFilter vertical luma/alpha scaling coefficients, 12 bits [0,4096]
254 * @param lumSrc scaled luma (Y) source data, 15 bits for 8-10-bit output,
255 * 19 bits for 16-bit output (in int32_t)
256 * @param lumFilterSize number of vertical luma/alpha input lines to scale
257 * @param chrFilter vertical chroma scaling coefficients, 12 bits [0,4096]
258 * @param chrUSrc scaled chroma (U) source data, 15 bits for 8-10-bit output,
259 * 19 bits for 16-bit output (in int32_t)
260 * @param chrVSrc scaled chroma (V) source data, 15 bits for 8-10-bit output,
261 * 19 bits for 16-bit output (in int32_t)
262 * @param chrFilterSize number of vertical chroma input lines to scale
263 * @param alpSrc scaled alpha (A) source data, 15 bits for 8-10-bit output,
264 * 19 bits for 16-bit output (in int32_t)
265 * @param dest pointer to the output plane. For 16-bit output, this is
266 * uint16_t
267 * @param dstW width of lumSrc and alpSrc in pixels, number of pixels
268 * to write into dest[]
269 * @param y vertical line number for this output. This does not need
270 * to be used to calculate the offset in the destination,
271 * but can be used to generate comfort noise using dithering
272 * or some output formats.
273 */
274typedef void (*yuv2packedX_fn)(SwsInternal *c, const int16_t *lumFilter,
275 const int16_t **lumSrc, int lumFilterSize,
276 const int16_t *chrFilter,
277 const int16_t **chrUSrc,
278 const int16_t **chrVSrc, int chrFilterSize,
279 const int16_t **alpSrc, uint8_t *dest,
280 int dstW, int y);
281
282/**
283 * Write one line of horizontally scaled Y/U/V/A to YUV/RGB
284 * output by doing multi-point vertical scaling between input pixels.
285 *
286 * @param c SWS scaling context
287 * @param lumFilter vertical luma/alpha scaling coefficients, 12 bits [0,4096]
288 * @param lumSrc scaled luma (Y) source data, 15 bits for 8-10-bit output,
289 * 19 bits for 16-bit output (in int32_t)
290 * @param lumFilterSize number of vertical luma/alpha input lines to scale
291 * @param chrFilter vertical chroma scaling coefficients, 12 bits [0,4096]
292 * @param chrUSrc scaled chroma (U) source data, 15 bits for 8-10-bit output,
293 * 19 bits for 16-bit output (in int32_t)
294 * @param chrVSrc scaled chroma (V) source data, 15 bits for 8-10-bit output,
295 * 19 bits for 16-bit output (in int32_t)
296 * @param chrFilterSize number of vertical chroma input lines to scale
297 * @param alpSrc scaled alpha (A) source data, 15 bits for 8-10-bit output,
298 * 19 bits for 16-bit output (in int32_t)
299 * @param dest pointer to the output planes. For 16-bit output, this is
300 * uint16_t
301 * @param dstW width of lumSrc and alpSrc in pixels, number of pixels
302 * to write into dest[]
303 * @param y vertical line number for this output. This does not need
304 * to be used to calculate the offset in the destination,
305 * but can be used to generate comfort noise using dithering
306 * or some output formats.
307 */
308typedef void (*yuv2anyX_fn)(SwsInternal *c, const int16_t *lumFilter,
309 const int16_t **lumSrc, int lumFilterSize,
310 const int16_t *chrFilter,
311 const int16_t **chrUSrc,
312 const int16_t **chrVSrc, int chrFilterSize,
313 const int16_t **alpSrc, uint8_t **dest,
314 int dstW, int y);
315
316/**
317 * Unscaled conversion of luma/alpha plane to YV12 for horizontal scaler.
318 */
319typedef void (*planar1_YV12_fn)(uint8_t *dst, const uint8_t *src, const uint8_t *src2,
320 const uint8_t *src3, int width, uint32_t *pal,
321 void *opaque);
322
323/**
324 * Unscaled conversion of chroma plane to YV12 for horizontal scaler.
325 */
326typedef void (*planar2_YV12_fn)(uint8_t *dst, uint8_t *dst2, const uint8_t *src,
327 const uint8_t *src2, const uint8_t *src3,
328 int width, uint32_t *pal, void *opaque);
329
330/**
331 * Unscaled conversion of arbitrary planar data (e.g. RGBA) to YV12, through
332 * conversion using the given color matrix.
333 */
334typedef void (*planarX_YV12_fn)(uint8_t *dst, const uint8_t *src[4], int width,
335 int32_t *rgb2yuv, void *opaque);
336
337typedef void (*planarX2_YV12_fn)(uint8_t *dst, uint8_t *dst2,
338 const uint8_t *src[4], int width,
339 int32_t *rgb2yuv, void *opaque);
340
341struct SwsSlice;
343
344/* This struct should be aligned on at least a 32-byte boundary. */
346 /* Currently active user-facing options. Also contains AVClass */
348
349 /* Parent context (for slice contexts) */
351
355
356 /* Scaling graph, reinitialized dynamically as needed. */
357 SwsGraph *graph[2]; /* top, bottom fields */
358
359 // values passed to current sws_receive_slice() call
362
363 /**
364 * Note that src, dst, srcStride, dstStride will be copied in the
365 * sws_scale() wrapper so they can be freely modified here.
366 */
368 int chrSrcW; ///< Width of source chroma planes.
369 int chrSrcH; ///< Height of source chroma planes.
370 int chrDstW; ///< Width of destination chroma planes.
371 int chrDstH; ///< Height of destination chroma planes.
374 int dstFormatBpp; ///< Number of bits per pixel of the destination pixel format.
375 int srcFormatBpp; ///< Number of bits per pixel of the source pixel format.
377 int chrSrcHSubSample; ///< Binary logarithm of horizontal subsampling factor between luma/alpha and chroma planes in source image.
378 int chrSrcVSubSample; ///< Binary logarithm of vertical subsampling factor between luma/alpha and chroma planes in source image.
379 int chrDstHSubSample; ///< Binary logarithm of horizontal subsampling factor between luma/alpha and chroma planes in destination image.
380 int chrDstVSubSample; ///< Binary logarithm of vertical subsampling factor between luma/alpha and chroma planes in destination image.
381 int vChrDrop; ///< Binary logarithm of extra vertical subsampling factor in source image chroma planes specified by user.
382 int sliceDir; ///< Direction that slices are fed to the scaler (1 = top-to-bottom, -1 = bottom-to-top).
383
386
388
389 /* The cascaded_* fields allow splitting a scaler task into multiple
390 * sequential steps, this is for example used to limit the maximum
391 * downscaling factor that needs to be supported in one scaler.
392 */
395 uint8_t *cascaded_tmp[2][4];
397
400 uint16_t *gamma;
401 uint16_t *inv_gamma;
402
404 int descIndex[2];
408
409 uint32_t pal_yuv[256];
410 uint32_t pal_rgb[256];
411
412 float uint2float_lut[256];
413
414 /**
415 * @name Scaled horizontal lines ring buffer.
416 * The horizontal scaler keeps just enough scaled lines in a ring buffer
417 * so they may be passed to the vertical scaler. The pointers to the
418 * allocated buffers for each line are duplicated in sequence in the ring
419 * buffer to simplify indexing and avoid wrapping around between lines
420 * inside the vertical scaler code. The wrapping is done before the
421 * vertical scaler is called.
422 */
423 //@{
424 int lastInLumBuf; ///< Last scaled horizontal luma/alpha line from source in the ring buffer.
425 int lastInChrBuf; ///< Last scaled horizontal chroma line from source in the ring buffer.
426 //@}
427
430
431 /**
432 * @name Horizontal and vertical filters.
433 * To better understand the following fields, here is a pseudo-code of
434 * their usage in filtering a horizontal line:
435 * @code
436 * for (i = 0; i < width; i++) {
437 * dst[i] = 0;
438 * for (j = 0; j < filterSize; j++)
439 * dst[i] += src[ filterPos[i] + j ] * filter[ filterSize * i + j ];
440 * dst[i] >>= FRAC_BITS; // The actual implementation is fixed-point.
441 * }
442 * @endcode
443 */
444 //@{
445 int16_t *hLumFilter; ///< Array of horizontal filter coefficients for luma/alpha planes.
446 int16_t *hChrFilter; ///< Array of horizontal filter coefficients for chroma planes.
447 int16_t *vLumFilter; ///< Array of vertical filter coefficients for luma/alpha planes.
448 int16_t *vChrFilter; ///< Array of vertical filter coefficients for chroma planes.
449 int32_t *hLumFilterPos; ///< Array of horizontal filter starting positions for each dst[i] for luma/alpha planes.
450 int32_t *hChrFilterPos; ///< Array of horizontal filter starting positions for each dst[i] for chroma planes.
451 int32_t *vLumFilterPos; ///< Array of vertical filter starting positions for each dst[i] for luma/alpha planes.
452 int32_t *vChrFilterPos; ///< Array of vertical filter starting positions for each dst[i] for chroma planes.
453 int hLumFilterSize; ///< Horizontal filter size for luma/alpha pixels.
454 int hChrFilterSize; ///< Horizontal filter size for chroma pixels.
455 int vLumFilterSize; ///< Vertical filter size for luma/alpha pixels.
456 int vChrFilterSize; ///< Vertical filter size for chroma pixels.
457 //@}
458
459 int lumMmxextFilterCodeSize; ///< Runtime-generated MMXEXT horizontal fast bilinear scaler code size for luma/alpha planes.
460 int chrMmxextFilterCodeSize; ///< Runtime-generated MMXEXT horizontal fast bilinear scaler code size for chroma planes.
461 uint8_t *lumMmxextFilterCode; ///< Runtime-generated MMXEXT horizontal fast bilinear scaler code for luma/alpha planes.
462 uint8_t *chrMmxextFilterCode; ///< Runtime-generated MMXEXT horizontal fast bilinear scaler code for chroma planes.
463
466
467 int dstY; ///< Last destination vertical line output from last slice.
468 void *yuvTable; // pointer to the yuv->rgb table start so it can be freed()
469 // alignment ensures the offset can be added in a single
470 // instruction on e.g. ARM
475 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
476#define RY_IDX 0
477#define GY_IDX 1
478#define BY_IDX 2
479#define RU_IDX 3
480#define GU_IDX 4
481#define BU_IDX 5
482#define RV_IDX 6
483#define GV_IDX 7
484#define BV_IDX 8
485#define RGB2YUV_SHIFT 15
486
488
489 //Colorspace stuff
490 int contrast, brightness, saturation; // for sws_getColorspaceDetails
503
504#define RED_DITHER "0*8"
505#define GREEN_DITHER "1*8"
506#define BLUE_DITHER "2*8"
507#define Y_COEFF "3*8"
508#define VR_COEFF "4*8"
509#define UB_COEFF "5*8"
510#define VG_COEFF "6*8"
511#define UG_COEFF "7*8"
512#define Y_OFFSET "8*8"
513#define U_OFFSET "9*8"
514#define V_OFFSET "10*8"
515#define LUM_MMX_FILTER_OFFSET "11*8"
516#define CHR_MMX_FILTER_OFFSET "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)
517#define DSTW_OFFSET "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*2"
518#define ESP_OFFSET "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*2+8"
519#define VROUNDER_OFFSET "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*2+16"
520#define U_TEMP "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*2+24"
521#define V_TEMP "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*2+32"
522#define Y_TEMP "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*2+40"
523#define ALP_MMX_FILTER_OFFSET "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*2+48"
524#define UV_OFF_PX "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*3+48"
525#define UV_OFF_BYTE "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*3+56"
526#define DITHER16 "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*3+64"
527#define DITHER32 "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*3+80"
528#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
529
533
534 DECLARE_ALIGNED(8, uint64_t, yCoeff);
545 DECLARE_ALIGNED(8, uint64_t, esp);
547 DECLARE_ALIGNED(8, uint64_t, u_temp);
548 DECLARE_ALIGNED(8, uint64_t, v_temp);
549 DECLARE_ALIGNED(8, uint64_t, y_temp);
551 // alignment of these values is not necessary, but merely here
552 // to maintain the same offset across x8632 and x86-64. Once we
553 // use proper offset macros in the asm, they can be removed.
554 DECLARE_ALIGNED(8, ptrdiff_t, uv_off); ///< offset (in pixels) between u and v planes
555 DECLARE_ALIGNED(8, ptrdiff_t, uv_offx2); ///< offset (in bytes) between u and v planes
556 DECLARE_ALIGNED(8, uint16_t, dither16)[8];
557 DECLARE_ALIGNED(8, uint32_t, dither32)[8];
558
559 const uint8_t *chrDither8, *lumDither8;
560
561#if HAVE_ALTIVEC
562 int16_t (*vYCoeffsBank)[8], (*vCCoeffsBank)[8];
563#endif
564
566
571
572 /* function pointers for swscale() */
580
581 /// Opaque data pointer passed to all input functions.
583
587
588 /**
589 * Functions to read planar input, such as planar RGB, and convert
590 * internally to Y/UV/A.
591 */
592 /** @{ */
596 /** @} */
597
598 /**
599 * Scale one horizontal line of input data using a bilinear filter
600 * to produce one line of output data. Compared to SwsInternal->hScale(),
601 * please take note of the following caveats when using these:
602 * - Scaling is done using only 7 bits instead of 14-bit coefficients.
603 * - You can use no more than 5 input pixels to produce 4 output
604 * pixels. Therefore, this filter should not be used for downscaling
605 * by more than ~20% in width (because that equals more than 5/4th
606 * downscaling and thus more than 5 pixels input per 4 pixels output).
607 * - In general, bilinear filters create artifacts during downscaling
608 * (even when <20%), because one output pixel will span more than one
609 * input pixel, and thus some pixels will need edges of both neighbor
610 * pixels to interpolate the output pixel. Since you can use at most
611 * two input pixels per output pixel in bilinear scaling, this is
612 * impossible and thus downscaling by any size will create artifacts.
613 * To enable this type of scaling, set SWS_FAST_BILINEAR
614 * in SwsInternal->flags.
615 */
616 /** @{ */
618 int16_t *dst, int dstWidth,
619 const uint8_t *src, int srcW, int xInc);
621 int16_t *dst1, int16_t *dst2, int dstWidth,
622 const uint8_t *src1, const uint8_t *src2,
623 int srcW, int xInc);
624 /** @} */
625
626 /**
627 * Scale one horizontal line of input data using a filter over the input
628 * lines, to produce one (differently sized) line of output data.
629 *
630 * @param dst pointer to destination buffer for horizontally scaled
631 * data. If the number of bits per component of one
632 * destination pixel (SwsInternal->dstBpc) is <= 10, data
633 * will be 15 bpc in 16 bits (int16_t) width. Else (i.e.
634 * SwsInternal->dstBpc == 16), data will be 19bpc in
635 * 32 bits (int32_t) width.
636 * @param dstW width of destination image
637 * @param src pointer to source data to be scaled. If the number of
638 * bits per component of a source pixel (SwsInternal->srcBpc)
639 * is 8, this is 8bpc in 8 bits (uint8_t) width. Else
640 * (i.e. SwsInternal->dstBpc > 8), this is native depth
641 * in 16 bits (uint16_t) width. In other words, for 9-bit
642 * YUV input, this is 9bpc, for 10-bit YUV input, this is
643 * 10bpc, and for 16-bit RGB or YUV, this is 16bpc.
644 * @param filter filter coefficients to be used per output pixel for
645 * scaling. This contains 14bpp filtering coefficients.
646 * Guaranteed to contain dstW * filterSize entries.
647 * @param filterPos position of the first input pixel to be used for
648 * each output pixel during scaling. Guaranteed to
649 * contain dstW entries.
650 * @param filterSize the number of input coefficients to be used (and
651 * thus the number of input pixels to be used) for
652 * creating a single output pixel. Is aligned to 4
653 * (and input coefficients thus padded with zeroes)
654 * to simplify creating SIMD code.
655 */
656 /** @{ */
657 void (*hyScale)(SwsInternal *c, int16_t *dst, int dstW,
658 const uint8_t *src, const int16_t *filter,
659 const int32_t *filterPos, int filterSize);
660 void (*hcScale)(SwsInternal *c, int16_t *dst, int dstW,
661 const uint8_t *src, const int16_t *filter,
662 const int32_t *filterPos, int filterSize);
663 /** @} */
664
665 /**
666 * Color range conversion functions if needed.
667 * If SwsInternal->dstBpc is > 14:
668 * - int16_t *dst (data is 15 bpc)
669 * - uint16_t coeff
670 * - int32_t offset
671 * Otherwise (SwsInternal->dstBpc is <= 14):
672 * - int32_t *dst (data is 19 bpc)
673 * - uint32_t coeff
674 * - int64_t offset
675 */
676 /** @{ */
677 void (*lumConvertRange)(int16_t *dst, int width,
678 uint32_t coeff, int64_t offset);
679 void (*chrConvertRange)(int16_t *dst1, int16_t *dst2, int width,
680 uint32_t coeff, int64_t offset);
681 /** @} */
682
687
688 int needs_hcscale; ///< Set if there are chroma planes to be converted.
689
690 // scratch buffer for converting packed rgb0 sources
691 // filled with a copy of the input frame + fully opaque alpha,
692 // then passed as input to further conversion
693 uint8_t *rgb0_scratch;
695
696 // scratch buffer for converting XYZ sources
697 // filled with the input converted to rgb48
698 // then passed as input to further conversion
699 uint8_t *xyz_scratch;
701
702 unsigned int dst_slice_align;
706
708
709 // Hardware specific private data
710 void *hw_priv; /* refstruct */
711
713
714 FFFramePool frame_pool; /* for sws_scale_frame() data allocations */
715};
716//FIXME check init (where 0)
717
718static_assert(offsetof(SwsInternal, redDither) + DITHER32_INT == offsetof(SwsInternal, dither32),
719 "dither32 must be at the same offset as redDither + DITHER32_INT");
720
721#if ARCH_X86_64
722/* x86 yuv2gbrp uses the SwsInternal for yuv coefficients
723 if struct offsets change the asm needs to be updated too */
724static_assert(offsetof(SwsInternal, yuv2rgb_y_offset) == 40348,
725 "yuv2rgb_y_offset must be updated in x86 asm");
726#endif
727
729int ff_yuv2rgb_c_init_tables(SwsInternal *c, const int inv_table[4],
730 int fullRange, int brightness,
731 int contrast, int saturation);
732void ff_yuv2rgb_init_tables_ppc(SwsInternal *c, const int inv_table[4],
733 int brightness, int contrast, int saturation);
734void ff_yuv2rgb_init_tables_altivec(SwsInternal *c, const int inv_table[4],
735 int brightness, int contrast, int saturation);
736
737void ff_updateMMXDitherTables(SwsInternal *c, int dstY);
738
739void ff_update_palette(SwsInternal *c, const uint32_t *pal);
740
746
749
751
757
759{
762 return desc->comp[0].depth == 16;
763}
764
766{
769 return desc->comp[0].depth == 32;
770}
771
773{
776 return desc->comp[0].depth >= 9 && desc->comp[0].depth <= 14;
777}
778
785
787{
790 return !(desc->flags & AV_PIX_FMT_FLAG_RGB) && desc->nb_components >= 2;
791}
792
799
800/*
801 * Identity semi-planar YUV formats. Specifically, those are YUV formats
802 * where the second and third components (U & V) are on the same plane.
803 */
805{
808 return (isPlanarYUV(pix_fmt) && desc->comp[1].plane == desc->comp[2].plane);
809}
810
817
819{
822 return !(desc->flags & AV_PIX_FMT_FLAG_PAL) &&
823 !(desc->flags & AV_PIX_FMT_FLAG_HWACCEL) &&
824 desc->nb_components <= 2 &&
827}
828
850
872
879
881{
884 return desc->comp[1].depth == 8;
885}
886
894
901
903{
906 return (desc->flags & AV_PIX_FMT_FLAG_FLOAT) && desc->comp[0].depth == 16;
907}
908
910{
914 return 1;
915 return desc->flags & AV_PIX_FMT_FLAG_ALPHA;
916}
917
926
928{
931 return (desc->nb_components >= 2 && (desc->flags & AV_PIX_FMT_FLAG_PLANAR));
932}
933
940
948
950{
951 switch (pix_fmt) {
952 case AV_PIX_FMT_PAL8:
954 case AV_PIX_FMT_BGR8:
955 case AV_PIX_FMT_GRAY8:
957 case AV_PIX_FMT_RGB8:
958 return 1;
959 default:
960 return 0;
961 }
962}
963
964/*
965 * Identity formats where the data is in the high bits, and the low bits are shifted away.
966 */
968{
969 int i;
973 return 0;
974 for (i = 0; i < desc->nb_components; i++) {
975 if (!desc->comp[i].shift)
976 return 0;
977 if ((desc->comp[i].shift + desc->comp[i].depth) & 0x7)
978 return 0;
979 }
980 return 1;
981}
982
983/*
984 * Identity formats where the chroma planes are swapped (CrCb order).
985 */
987{
990 if (!isYUV(pix_fmt))
991 return 0;
992 if ((desc->flags & AV_PIX_FMT_FLAG_ALPHA) && desc->nb_components < 4)
993 return 0;
994 if (desc->nb_components < 3)
995 return 0;
997 return desc->comp[1].offset > desc->comp[2].offset;
998 else
999 return desc->comp[1].plane > desc->comp[2].plane;
1000}
1001
1002extern const uint64_t ff_dither4[2];
1003extern const uint64_t ff_dither8[2];
1004
1005extern const uint8_t ff_dither_2x2_4[3][8];
1006extern const uint8_t ff_dither_2x2_8[3][8];
1007extern const uint8_t ff_dither_4x4_16[5][8];
1008extern const uint8_t ff_dither_8x8_32[9][8];
1009extern const uint8_t ff_dither_8x8_73[9][8];
1010extern const uint8_t ff_dither_8x8_128[9][8];
1011extern const uint8_t ff_dither_8x8_220[9][8];
1012
1013extern const int32_t ff_yuv2rgb_coeffs[11][4];
1014
1015extern const AVClass ff_sws_context_class;
1016
1018 SwsFilter *dstFilter);
1019
1020/**
1021 * Set c->convert_unscaled to an unscaled converter if one exists for the
1022 * specific source and destination formats, bit depths, flags, etc.
1023 */
1030
1032
1034 planar1_YV12_fn *lumToYV12,
1035 planar1_YV12_fn *alpToYV12,
1036 planar2_YV12_fn *chrToYV12,
1037 planarX_YV12_fn *readLumPlanar,
1038 planarX_YV12_fn *readAlpPlanar,
1039 planarX2_YV12_fn *readChrPlanar);
1041 yuv2planar1_fn *yuv2plane1,
1043 yuv2interleavedX_fn *yuv2nv12cX,
1044 yuv2packed1_fn *yuv2packed1,
1045 yuv2packed2_fn *yuv2packed2,
1046 yuv2packedX_fn *yuv2packedX,
1047 yuv2anyX_fn *yuv2anyX);
1056
1059
1060void ff_hyscale_fast_c(SwsInternal *c, int16_t *dst, int dstWidth,
1061 const uint8_t *src, int srcW, int xInc);
1062void ff_hcscale_fast_c(SwsInternal *c, int16_t *dst1, int16_t *dst2,
1063 int dstWidth, const uint8_t *src1,
1064 const uint8_t *src2, int srcW, int xInc);
1065int ff_init_hscaler_mmxext(int dstW, int xInc, uint8_t *filterCode,
1066 int16_t *filter, int32_t *filterPos,
1067 int numSplits);
1068void ff_hyscale_fast_mmxext(SwsInternal *c, int16_t *dst,
1069 int dstWidth, const uint8_t *src,
1070 int srcW, int xInc);
1071void ff_hcscale_fast_mmxext(SwsInternal *c, int16_t *dst1, int16_t *dst2,
1072 int dstWidth, const uint8_t *src1,
1073 const uint8_t *src2, int srcW, int xInc);
1074
1075int ff_sws_alphablendaway(SwsInternal *c, const uint8_t *const src[],
1076 const int srcStride[], int srcSliceY, int srcSliceH,
1077 uint8_t *const dst[], const int dstStride[]);
1078
1079void ff_copyPlane(const uint8_t *src, int srcStride,
1080 int srcSliceY, int srcSliceH, int width,
1081 uint8_t *dst, int dstStride);
1082
1083static inline void fillPlane16(uint8_t *plane, int stride, int width, int height, int y,
1084 int alpha, int bits, const int big_endian)
1085{
1086 uint8_t *ptr = plane + stride * y;
1087 int v = alpha ? 0xFFFF>>(16-bits) : (1<<(bits-1));
1088 if (big_endian != HAVE_BIGENDIAN)
1089 v = av_bswap16(v);
1090 for (int i = 0; i < height; i++) {
1091 for (int j = 0; j < width; j++)
1092 AV_WN16(ptr + 2 * j, v);
1093 ptr += stride;
1094 }
1095}
1096
1097static inline void fillPlane32(uint8_t *plane, int stride, int width, int height, int y,
1098 int alpha, int bits, const int big_endian, int is_float)
1099{
1100 uint8_t *ptr = plane + stride * y;
1101 uint32_t v;
1102 uint32_t onef32 = 0x3f800000;
1103 if (is_float)
1104 v = alpha ? onef32 : 0;
1105 else
1106 v = alpha ? 0xFFFFFFFF>>(32-bits) : (1<<(bits-1));
1107 if (big_endian != HAVE_BIGENDIAN)
1108 v = av_bswap32(v);
1109
1110 for (int i = 0; i < height; i++) {
1111 for (int j = 0; j < width; j++)
1112 AV_WN32(ptr + 4 * j, v);
1113 ptr += stride;
1114 }
1115}
1116
1117
1118#define MAX_SLICE_PLANES 4
1119
1120/// Slice plane
1121typedef struct SwsPlane
1122{
1123 int available_lines; ///< max number of lines that can be hold by this plane
1124 int sliceY; ///< index of first line
1125 int sliceH; ///< number of lines
1126 uint8_t **line; ///< line buffer
1127 uint8_t **tmp; ///< Tmp line buffer used by mmx code
1128} SwsPlane;
1129
1130/**
1131 * Struct which defines a slice of an image to be scaled or an output for
1132 * a scaled slice.
1133 * A slice can also be used as intermediate ring buffer for scaling steps.
1134 */
1135typedef struct SwsSlice
1136{
1137 int width; ///< Slice line width
1138 int h_chr_sub_sample; ///< horizontal chroma subsampling factor
1139 int v_chr_sub_sample; ///< vertical chroma subsampling factor
1140 int is_ring; ///< flag to identify if this slice is a ring buffer
1141 int should_free_lines; ///< flag to identify if there are dynamic allocated lines
1142 enum AVPixelFormat fmt; ///< planes pixel format
1143 SwsPlane plane[MAX_SLICE_PLANES]; ///< color planes
1144} SwsSlice;
1145
1146/**
1147 * Struct which holds all necessary data for processing a slice.
1148 * A processing step can be a color conversion or horizontal/vertical scaling.
1149 */
1151{
1152 SwsSlice *src; ///< Source slice
1153 SwsSlice *dst; ///< Output slice
1154
1155 int alpha; ///< Flag for processing alpha channel
1156 void *instance; ///< Filter instance data
1157
1158 /// Function for processing input slice sliceH lines starting from line sliceY
1159 int (*process)(SwsInternal *c, struct SwsFilterDescriptor *desc, int sliceY, int sliceH);
1161
1162// warp input lines in the form (src + width*i + j) to slice format (line[i][j])
1163// relative=true means first line src[x][0] otherwise first line is src[x][lum/crh Y]
1164int ff_init_slice_from_src(SwsSlice * s, uint8_t *const src[4], const int stride[4],
1165 int srcW, int lumY, int lumH, int chrY, int chrH, int relative);
1166
1167// Initialize scaler filter descriptor chain
1169
1170// Free all filter data
1172
1173/*
1174 function for applying ring buffer logic into slice s
1175 It checks if the slice can hold more @lum lines, if yes
1176 do nothing otherwise remove @lum least used lines.
1177 It applies the same procedure for @chr lines.
1178*/
1179int ff_rotate_slice(SwsSlice *s, int lum, int chr);
1180
1181/// initializes gamma conversion descriptor
1183
1184/// initializes lum pixel format conversion descriptor
1186
1187/// initializes lum horizontal scaling descriptor
1188int ff_init_desc_hscale(SwsFilterDescriptor *desc, SwsSlice *src, SwsSlice *dst, uint16_t *filter, int * filter_pos, int filter_size, int xInc);
1189
1190/// initializes chr pixel format conversion descriptor
1192
1193/// initializes chr horizontal scaling descriptor
1194int ff_init_desc_chscale(SwsFilterDescriptor *desc, SwsSlice *src, SwsSlice *dst, uint16_t *filter, int * filter_pos, int filter_size, int xInc);
1195
1197
1198/// initializes vertical scaling descriptors
1200
1201/// setup vertical scaler functions
1203 yuv2interleavedX_fn yuv2nv12cX, yuv2packed1_fn yuv2packed1, yuv2packed2_fn yuv2packed2,
1204 yuv2packedX_fn yuv2packedX, yuv2anyX_fn yuv2anyX, int use_mmx);
1205
1206int ff_sws_slice_worker(void *priv, int jobnr, int threadnr,
1207 int nb_jobs, int nb_threads);
1208
1209int ff_swscale(SwsInternal *c, const uint8_t *const src[], const int srcStride[],
1210 int srcSliceY, int srcSliceH, uint8_t *const dst[],
1211 const int dstStride[], int dstSliceY, int dstSliceH);
1212
1213/**
1214 * Helper for dispatching a single function across multiple threads. This is
1215 * a wrapper around avpriv_slicethread_create2() + avpriv_slicethread_execute2(),
1216 * falling back to direct invocation if threading is not available.
1217 */
1218int ff_sws_thread_exec(void *priv,
1219 int (*func)(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads),
1220 int nb_threads, int nb_jobs);
1221
1222//number of extra lines to process
1223#define MAX_LINES_AHEAD 4
1224
1225//shuffle filter and filterPos for hyScale and hcScale filters in avx2
1226int ff_shuffle_filter_coefficients(SwsInternal *c, int* filterPos, int filterSize, int16_t *filter, int dstW);
1227#endif /* SWSCALE_SWSCALE_INTERNAL_H */
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:97
static AVFormatContext * ctx
int32_t
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition avassert.h:42
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define s(width, name)
Definition cbs_vp9.c:198
static IPT saturation(const CmsCtx *ctx, IPT ipt)
Definition cms.c:559
static void fn rgb2yuv(uint8_t *_yuv[3], const ptrdiff_t yuv_stride[3], int16_t *rgb[3], ptrdiff_t s, int w, int h, const int16_t rgb2yuv_coeffs[3][3][8], const int16_t yuv_offset[8])
common internal and external API header
#define NULL
Definition coverity.c:32
long long int64_t
Definition coverity.c:34
static enum AVPixelFormat pix_fmt
static const uint8_t bits[8]
Definition fastaudio.c:100
reference-counted frame API
SwsBackend
Definition swscale.h:110
const pixel * src2
static const int16_t alpha[]
Definition ilbcdata.h:55
#define r
Definition input.c:42
#define AV_WN32(p, v)
#define AV_WN16(p, v)
unsigned offset
Definition libaomenc.c:812
int relative
Definition trim.c:51
int(* func)(AVBPrint *dst, const char *in, const char *arg)
Definition jacosubdec.c:67
#define av_always_inline
Definition attributes.h:72
#define av_cold
Definition attributes.h:117
const char * desc
Definition libsvtav1.c:110
const AVClass ff_sws_context_class
Definition options.c:124
uint8_t w
Definition llvidencdsp.c:39
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
const uint8_t ff_dither_8x8_73[][8]
Definition output.c:72
const uint8_t ff_dither_2x2_4[][8]
Definition output.c:40
const uint8_t ff_dither_2x2_8[][8]
Definition output.c:46
const uint8_t ff_dither_4x4_16[][8]
Definition output.c:52
const uint8_t ff_dither_8x8_220[][8]
Definition output.c:85
const uint8_t ff_dither_8x8_32[][8]
Definition output.c:60
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition pixdesc.c:3484
#define AV_PIX_FMT_FLAG_ALPHA
The pixel format has an alpha channel.
Definition pixdesc.h:147
#define AV_PIX_FMT_FLAG_BITSTREAM
All values of a component are bit-wise packed end to end.
Definition pixdesc.h:124
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
Definition pixdesc.h:136
#define AV_PIX_FMT_FLAG_FLOAT
The pixel format contains IEEE-754 floating point values.
Definition pixdesc.h:158
#define AV_PIX_FMT_FLAG_HWACCEL
Pixel format is an HW accelerated format.
Definition pixdesc.h:128
#define AV_PIX_FMT_FLAG_PLANAR
At least one pixel component is not in the first data plane.
Definition pixdesc.h:132
#define AV_PIX_FMT_FLAG_BE
Pixel format is big-endian.
Definition pixdesc.h:116
#define AV_PIX_FMT_FLAG_BAYER
The pixel format is following a Bayer pattern.
Definition pixdesc.h:152
#define AV_PIX_FMT_FLAG_PAL
Pixel format has a palette in data[1], values are indexes in this palette.
Definition pixdesc.h:120
pixel format definitions
#define AV_PIX_FMT_BGR32
Definition pixfmt.h:522
AVPixelFormat
Pixel format.
Definition pixfmt.h:71
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition pixfmt.h:75
@ AV_PIX_FMT_MONOBLACK
Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb.
Definition pixfmt.h:83
@ AV_PIX_FMT_BGR565BE
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
Definition pixfmt.h:117
@ AV_PIX_FMT_RGB555BE
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), big-endian , X=unused/undefined
Definition pixfmt.h:114
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition pixfmt.h:81
@ AV_PIX_FMT_BGR48BE
packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big...
Definition pixfmt.h:145
@ AV_PIX_FMT_RGB48BE
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
Definition pixfmt.h:109
@ AV_PIX_FMT_RGBA64BE
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
Definition pixfmt.h:202
@ AV_PIX_FMT_RGB8
packed RGB 3:3:2, 8bpp, (msb)3R 3G 2B(lsb)
Definition pixfmt.h:93
@ AV_PIX_FMT_RGBA64LE
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
Definition pixfmt.h:203
@ AV_PIX_FMT_BGR8
packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
Definition pixfmt.h:90
@ AV_PIX_FMT_RGB444LE
packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), little-endian, X=unused/undefined
Definition pixfmt.h:136
@ AV_PIX_FMT_RGB4_BYTE
packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
Definition pixfmt.h:95
@ AV_PIX_FMT_BGR4_BYTE
packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
Definition pixfmt.h:92
@ AV_PIX_FMT_BGRA64BE
packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is st...
Definition pixfmt.h:204
@ AV_PIX_FMT_RGB565LE
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
Definition pixfmt.h:113
@ AV_PIX_FMT_RGB555LE
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined
Definition pixfmt.h:115
@ AV_PIX_FMT_BGR444BE
packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), big-endian, X=unused/undefined
Definition pixfmt.h:139
@ AV_PIX_FMT_RGB48LE
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as lit...
Definition pixfmt.h:110
@ AV_PIX_FMT_BGR555BE
packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), big-endian , X=unused/undefined
Definition pixfmt.h:119
@ AV_PIX_FMT_BGR444LE
packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), little-endian, X=unused/undefined
Definition pixfmt.h:138
@ AV_PIX_FMT_RGB444BE
packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), big-endian, X=unused/undefined
Definition pixfmt.h:137
@ AV_PIX_FMT_BGR48LE
packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as lit...
Definition pixfmt.h:146
@ AV_PIX_FMT_RGB565BE
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
Definition pixfmt.h:112
@ AV_PIX_FMT_BGR555LE
packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined
Definition pixfmt.h:120
@ AV_PIX_FMT_BGRA64LE
packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is st...
Definition pixfmt.h:205
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
Definition pixfmt.h:84
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition pixfmt.h:76
@ AV_PIX_FMT_BGR565LE
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
Definition pixfmt.h:118
@ AV_PIX_FMT_RGB4
packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in ...
Definition pixfmt.h:94
@ AV_PIX_FMT_MONOWHITE
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb.
Definition pixfmt.h:82
@ AV_PIX_FMT_BGR4
packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in ...
Definition pixfmt.h:91
#define AV_PIX_FMT_RGB32_1
Definition pixfmt.h:521
#define AV_PIX_FMT_BGR32_1
Definition pixfmt.h:523
#define AV_PIX_FMT_RGB32
Definition pixfmt.h:520
static const uint16_t table[]
Definition prosumer.c:203
static void * av_refstruct_allocz(size_t size)
Equivalent to av_refstruct_alloc_ext(size, 0, NULL, NULL)
Definition refstruct.h:105
#define av_bswap32
Definition bswap.h:47
#define av_bswap16
Definition bswap.h:28
struct AVSliceThread AVSliceThread
Definition slicethread.h:25
int atomic_int
Definition stdatomic.h:63
Describe the class of an AVClass context structure.
Definition log.h:76
This structure describes decoded (raw) audio or video data.
Definition frame.h:479
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition pixdesc.h:69
Frame pool.
Definition framepool.h:32
unsigned int nb_ranges
AVRational start
unsigned int len
int16_t mat[3][3]
Main external API structure.
Definition swscale.h:227
Struct which holds all necessary data for processing a slice.
SwsSlice * src
Source slice.
void * instance
Filter instance data.
int alpha
Flag for processing alpha channel.
SwsSlice * dst
Output slice.
int(* process)(SwsInternal *c, struct SwsFilterDescriptor *desc, int sliceY, int sliceH)
Function for processing input slice sliceH lines starting from line sliceY.
Filter graph, which represents a 'baked' pixel format conversion.
Definition graph.h:133
int * dither_error[4]
int16_t * hChrFilter
Array of horizontal filter coefficients for chroma planes.
unsigned int rgb0_scratch_allocated
yuv2planar1_fn yuv2plane1
int cascaded_tmpStride[2][4]
int warned_unuseable_bilinear
planar2_YV12_fn chrToYV12
int32_t lumMmxFilter[4 *MAX_FILTER_SIZE]
int lumMmxextFilterCodeSize
Runtime-generated MMXEXT horizontal fast bilinear scaler code size for luma/alpha planes.
uint32_t chrConvertRange_coeff
uint32_t dither32[8]
uint32_t pal_rgb[256]
uint8_t * formatConvBuffer
int chrMmxextFilterCodeSize
Runtime-generated MMXEXT horizontal fast bilinear scaler code size for chroma planes.
int lastInLumBuf
Last scaled horizontal luma/alpha line from source in the ring buffer.
planar1_YV12_fn lumToYV12
int32_t chrMmxFilter[4 *MAX_FILTER_SIZE]
int dstY
Last destination vertical line output from last slice.
int srcColorspaceTable[4]
int32_t * vLumFilterPos
Array of vertical filter starting positions for each dst[i] for luma/alpha planes.
int chrDstVSubSample
Binary logarithm of vertical subsampling factor between luma/alpha and chroma planes in destination i...
uint32_t pal_yuv[256]
SwsColorXform rgb2xyz
int chrSrcH
Height of source chroma planes.
void(* hyscale_fast)(SwsInternal *c, int16_t *dst, int dstWidth, const uint8_t *src, int srcW, int xInc)
Scale one horizontal line of input data using a bilinear filter to produce one line of output data.
SwsContext * cascaded_context[3]
int srcFormatBpp
Number of bits per pixel of the source pixel format.
SwsContext ** slice_ctx
SwsColorFunc xyz12Torgb48
ptrdiff_t uv_offx2
offset (in bytes) between u and v planes
int vChrDrop
Binary logarithm of extra vertical subsampling factor in source image chroma planes specified by user...
int hChrFilterSize
Horizontal filter size for chroma pixels.
const uint8_t * chrDither8
uint64_t greenDither
SwsColorFunc rgb48Toxyz12
struct SwsFilterDescriptor * desc
SwsFunc convert_unscaled
Note that src, dst, srcStride, dstStride will be copied in the sws_scale() wrapper so they can be fre...
uint8_t * table_bU[256+2 *YUVRGB_TABLE_HEADROOM]
int chrSrcHSubSample
Binary logarithm of horizontal subsampling factor between luma/alpha and chroma planes in source imag...
int64_t chrConvertRange_offset
int chrSrcW
Width of source chroma planes.
yuv2packedX_fn yuv2packedX
RangeList src_ranges
uint64_t blueDither
int chrDstH
Height of destination chroma planes.
uint8_t * table_rV[256+2 *YUVRGB_TABLE_HEADROOM]
int needs_hcscale
Set if there are chroma planes to be converted.
atomic_int stride_unaligned_warned
int32_t * hLumFilterPos
Array of horizontal filter starting positions for each dst[i] for luma/alpha planes.
SwsColorXform xyz2rgb
int chrSrcVSubSample
Binary logarithm of vertical subsampling factor between luma/alpha and chroma planes in source image.
uint8_t * cascaded_tmp[2][4]
void * input_opaque
Opaque data pointer passed to all input functions.
uint16_t * gamma
FFFramePool frame_pool
struct SwsSlice * slice
uint8_t * rgb0_scratch
planar1_YV12_fn alpToYV12
int16_t * vChrFilter
Array of vertical filter coefficients for chroma planes.
unsigned int xyz_scratch_allocated
ptrdiff_t uv_off
offset (in pixels) between u and v planes
int table_gV[256+2 *YUVRGB_TABLE_HEADROOM]
int vChrFilterSize
Vertical filter size for chroma pixels.
void(* hyScale)(SwsInternal *c, int16_t *dst, int dstW, const uint8_t *src, const int16_t *filter, const int32_t *filterPos, int filterSize)
Scale one horizontal line of input data using a filter over the input lines, to produce one (differen...
int lastInChrBuf
Last scaled horizontal chroma line from source in the ring buffer.
uint16_t * inv_gamma
uint8_t * lumMmxextFilterCode
Runtime-generated MMXEXT horizontal fast bilinear scaler code for luma/alpha planes.
int64_t lumConvertRange_offset
void(* hcScale)(SwsInternal *c, int16_t *dst, int dstW, const uint8_t *src, const int16_t *filter, const int32_t *filterPos, int filterSize)
void(* hcscale_fast)(SwsInternal *c, int16_t *dst1, int16_t *dst2, int dstWidth, const uint8_t *src1, const uint8_t *src2, int srcW, int xInc)
const uint8_t * lumDither8
int sliceDir
Direction that slices are fed to the scaler (1 = top-to-bottom, -1 = bottom-to-top).
Half2FloatTables * h2f_tables
int32_t * vChrFilterPos
Array of vertical filter starting positions for each dst[i] for chroma planes.
int hLumFilterSize
Horizontal filter size for luma/alpha pixels.
float uint2float_lut[256]
uint16_t dither16[8]
yuv2anyX_fn yuv2anyX
int vLumFilterSize
Vertical filter size for luma/alpha pixels.
atomic_int data_unaligned_warned
int dstFormatBpp
Number of bits per pixel of the destination pixel format.
int32_t * hChrFilterPos
Array of horizontal filter starting positions for each dst[i] for chroma planes.
yuv2packed2_fn yuv2packed2
unsigned int dst_slice_align
SwsContext * parent
uint32_t lumConvertRange_coeff
SwsGraph * graph[2]
int16_t * hLumFilter
Array of horizontal filter coefficients for luma/alpha planes.
SwsContext opts
yuv2packed1_fn yuv2packed1
int16_t * vLumFilter
Array of vertical filter coefficients for luma/alpha planes.
void(* lumConvertRange)(int16_t *dst, int width, uint32_t coeff, int64_t offset)
Color range conversion functions if needed.
AVFrame * frame_src
AVSliceThread * slicethread
int32_t alpMmxFilter[4 *MAX_FILTER_SIZE]
uint8_t * chrMmxextFilterCode
Runtime-generated MMXEXT horizontal fast bilinear scaler code for chroma planes.
uint8_t * table_gU[256+2 *YUVRGB_TABLE_HEADROOM]
yuv2planarX_fn yuv2planeX
int chrDstHSubSample
Binary logarithm of horizontal subsampling factor between luma/alpha and chroma planes in destination...
planarX2_YV12_fn readChrPlanar
planarX_YV12_fn readAlpPlanar
yuv2interleavedX_fn yuv2nv12cX
uint8_t * xyz_scratch
int32_t input_rgb2yuv_table[16+40 *4]
void(* chrConvertRange)(int16_t *dst1, int16_t *dst2, int width, uint32_t coeff, int64_t offset)
int dstColorspaceTable[4]
planarX_YV12_fn readLumPlanar
Functions to read planar input, such as planar RGB, and convert internally to Y/UV/A.
int chrDstW
Width of destination chroma planes.
AVFrame * frame_dst
uint16_t * in
uint16_t * out
Slice plane.
int available_lines
max number of lines that can be hold by this plane
uint8_t ** tmp
Tmp line buffer used by mmx code.
int sliceY
index of first line
int sliceH
number of lines
uint8_t ** line
line buffer
Struct which defines a slice of an image to be scaled or an output for a scaled slice.
int is_ring
flag to identify if this slice is a ring buffer
enum AVPixelFormat fmt
planes pixel format
SwsPlane plane[MAX_SLICE_PLANES]
color planes
int h_chr_sub_sample
horizontal chroma subsampling factor
int should_free_lines
flag to identify if there are dynamic allocated lines
int width
Slice line width.
int v_chr_sub_sample
vertical chroma subsampling factor
#define stride
const uint8_t ff_dither_8x8_128[9][8]
Definition swscale.c:42
external API header
#define YUVRGB_TABLE_HEADROOM
void ff_init_vscale_pfn(SwsInternal *c, yuv2planar1_fn yuv2plane1, yuv2planarX_fn yuv2planeX, yuv2interleavedX_fn yuv2nv12cX, yuv2packed1_fn yuv2packed1, yuv2packed2_fn yuv2packed2, yuv2packedX_fn yuv2packedX, yuv2anyX_fn yuv2anyX, int use_mmx)
setup vertical scaler functions
Definition vscale.c:258
static av_always_inline int isBGRinInt(enum AVPixelFormat pix_fmt)
void ff_updateMMXDitherTables(SwsInternal *c, int dstY)
Definition swscale.c:60
void(* yuv2packed1_fn)(SwsInternal *c, const int16_t *lumSrc, const int16_t *chrUSrc[2], const int16_t *chrVSrc[2], const int16_t *alpSrc, uint8_t *dest, int dstW, int uvalpha, int y)
Write one line of horizontally scaled Y/U/V/A to packed-pixel YUV/RGB output without any additional v...
void(* yuv2planarX_fn)(const int16_t *filter, int filterSize, const int16_t **src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
Write one line of horizontally scaled data to planar output with multi-point vertical scaling between...
SwsFunc ff_yuv2rgb_init_ppc(SwsInternal *c)
Definition yuv2rgb.c:29
void ff_get_unscaled_swscale_ppc(SwsInternal *c)
Definition yuv2yuv.c:25
int ff_range_add(RangeList *r, unsigned int start, unsigned int len)
Definition utils.c:2472
static av_always_inline int isBayer(enum AVPixelFormat pix_fmt)
int ff_init_desc_cfmt_convert(SwsFilterDescriptor *desc, SwsSlice *src, SwsSlice *dst, uint32_t *pal)
initializes chr pixel format conversion descriptor
Definition hscale.c:238
int ff_sws_alphablendaway(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[])
Definition alphablend.c:23
static void fillPlane16(uint8_t *plane, int stride, int width, int height, int y, int alpha, int bits, const int big_endian)
static void * ff_refstruct_calloc(size_t n, size_t size)
int ff_sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter, SwsFilter *dstFilter)
Definition utils.c:1187
void ff_get_unscaled_swscale_loongarch(SwsInternal *c)
const uint64_t ff_dither4[2]
Definition swscale.c:33
void ff_hcscale_fast_c(SwsInternal *c, int16_t *dst1, int16_t *dst2, int dstWidth, const uint8_t *src1, const uint8_t *src2, int srcW, int xInc)
static av_always_inline int isPlanar(enum AVPixelFormat pix_fmt)
void ff_sws_init_swscale_arm(SwsInternal *c)
Definition swscale.c:33
void(* planar2_YV12_fn)(uint8_t *dst, uint8_t *dst2, const uint8_t *src, const uint8_t *src2, const uint8_t *src3, int width, uint32_t *pal, void *opaque)
Unscaled conversion of chroma plane to YV12 for horizontal scaler.
av_cold void ff_sws_init_range_convert_riscv(SwsInternal *c)
Definition swscale.c:29
static av_always_inline int isSwappedChroma(enum AVPixelFormat pix_fmt)
int ff_init_hscaler_mmxext(int dstW, int xInc, uint8_t *filterCode, int16_t *filter, int32_t *filterPos, int numSplits)
int ff_shuffle_filter_coefficients(SwsInternal *c, int *filterPos, int filterSize, int16_t *filter, int dstW)
Definition utils.c:110
static av_always_inline int isFloat(enum AVPixelFormat pix_fmt)
void ff_sws_init_scale(SwsInternal *c)
Definition swscale.c:723
int ff_init_vscale(SwsInternal *c, SwsFilterDescriptor *desc, SwsSlice *src, SwsSlice *dst)
initializes vertical scaling descriptors
Definition vscale.c:214
static av_always_inline int isPlanarYUV(enum AVPixelFormat pix_fmt)
void ff_sws_init_swscale_altivec(SwsInternal *c)
void(* yuv2packedX_fn)(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, int dstW, int y)
Write one line of horizontally scaled Y/U/V/A to packed-pixel YUV/RGB output by doing multi-point ver...
void(* planar1_YV12_fn)(uint8_t *dst, const uint8_t *src, const uint8_t *src2, const uint8_t *src3, int width, uint32_t *pal, void *opaque)
Unscaled conversion of luma/alpha plane to YV12 for horizontal scaler.
int ff_sws_slice_worker(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads)
Definition swscale.c:1714
av_cold void ff_sws_init_xyzdsp_aarch64(SwsInternal *c)
Definition swscale.c:339
static av_always_inline int isDataInHighBits(enum AVPixelFormat pix_fmt)
SwsFunc ff_yuv2rgb_get_func_ptr(SwsInternal *c)
void ff_sws_init_swscale_aarch64(SwsInternal *c)
Definition swscale.c:350
int ff_init_desc_hscale(SwsFilterDescriptor *desc, SwsSlice *src, SwsSlice *dst, uint16_t *filter, int *filter_pos, int filter_size, int xInc)
initializes lum horizontal scaling descriptor
Definition hscale.c:146
#define MAX_SLICE_PLANES
int ff_rotate_slice(SwsSlice *s, int lum, int chr)
Definition slice.c:120
static av_always_inline int isAnyRGB(enum AVPixelFormat pix_fmt)
#define DITHER32_INT
void ff_sws_init_swscale_vsx(SwsInternal *c)
void ff_sws_init_swscale_ppc(SwsInternal *c)
Definition swscale.c:25
SwsFunc ff_yuv2rgb_init_x86(SwsInternal *c)
Definition yuv2rgb.c:262
int ff_swscale(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[], int dstSliceY, int dstSliceH)
Definition swscale.c:280
void ff_sws_init_swscale_x86(SwsInternal *c)
Definition swscale.c:485
int ff_init_gamma_convert(SwsFilterDescriptor *desc, SwsSlice *src, uint16_t *table)
initializes gamma conversion descriptor
Definition gamma.c:59
void ff_yuv2rgb_init_tables_altivec(SwsInternal *c, const int inv_table[4], int brightness, int contrast, int saturation)
SwsFunc ff_yuv2rgb_init_altivec(SwsInternal *c)
static av_always_inline int is16BPS(enum AVPixelFormat pix_fmt)
void ff_get_unscaled_swscale_arm(SwsInternal *c)
void ff_get_unscaled_swscale_altivec(SwsInternal *c)
int ff_init_slice_from_src(SwsSlice *s, uint8_t *const src[4], const int stride[4], int srcW, int lumY, int lumH, int chrY, int chrH, int relative)
Definition slice.c:148
static av_always_inline int usePal(enum AVPixelFormat pix_fmt)
SwsBackend ff_sws_enabled_backends(const SwsContext *ctx)
Definition utils.c:60
void ff_hyscale_fast_mmxext(SwsInternal *c, int16_t *dst, int dstWidth, const uint8_t *src, int srcW, int xInc)
void(* yuv2planar1_fn)(const int16_t *src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
Write one line of horizontally scaled data to planar output without any additional vertical scaling (...
int ff_sws_thread_exec(void *priv, int(*func)(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads), int nb_threads, int nb_jobs)
Helper for dispatching a single function across multiple threads.
Definition utils.c:2532
static av_always_inline int isGray(enum AVPixelFormat pix_fmt)
void(* planarX_YV12_fn)(uint8_t *dst, const uint8_t *src[4], int width, int32_t *rgb2yuv, void *opaque)
Unscaled conversion of arbitrary planar data (e.g.
void ff_sws_init_swscale_loongarch(SwsInternal *c)
int ff_init_desc_fmt_convert(SwsFilterDescriptor *desc, SwsSlice *src, SwsSlice *dst, uint32_t *pal)
initializes lum pixel format conversion descriptor
Definition hscale.c:129
static SwsInternal * sws_internal(const SwsContext *sws)
static av_always_inline int isRGB(enum AVPixelFormat pix_fmt)
void ff_get_unscaled_swscale(SwsInternal *c)
Set c->convert_unscaled to an unscaled converter if one exists for the specific source and destinatio...
const uint64_t ff_dither8[2]
Definition swscale.c:37
void ff_yuv2rgb_init_tables_ppc(SwsInternal *c, const int inv_table[4], int brightness, int contrast, int saturation)
Definition yuv2rgb.c:39
int ff_sws_init_altivec_bufs(SwsInternal *c)
void ff_sws_init_output_funcs(SwsInternal *c, yuv2planar1_fn *yuv2plane1, yuv2planarX_fn *yuv2planeX, yuv2interleavedX_fn *yuv2nv12cX, yuv2packed1_fn *yuv2packed1, yuv2packed2_fn *yuv2packed2, yuv2packedX_fn *yuv2packedX, yuv2anyX_fn *yuv2anyX)
Definition output.c:3305
static av_always_inline int isPacked(enum AVPixelFormat pix_fmt)
void ff_sws_init_swscale_riscv(SwsInternal *c)
Definition swscale.c:74
int(* SwsFunc)(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[])
void ff_copyPlane(const uint8_t *src, int srcStride, int srcSliceY, int srcSliceH, int width, uint8_t *dst, int dstStride)
static av_always_inline int isSemiPlanarYUV(enum AVPixelFormat pix_fmt)
int ff_init_desc_chscale(SwsFilterDescriptor *desc, SwsSlice *src, SwsSlice *dst, uint16_t *filter, int *filter_pos, int filter_size, int xInc)
initializes chr horizontal scaling descriptor
Definition hscale.c:253
void ff_hyscale_fast_c(SwsInternal *c, int16_t *dst, int dstWidth, const uint8_t *src, int srcW, int xInc)
SwsFunc ff_yuv2rgb_init_aarch64(SwsInternal *c)
static av_always_inline int isRGBinInt(enum AVPixelFormat pix_fmt)
static av_always_inline int isFloat16(enum AVPixelFormat pix_fmt)
av_cold void ff_sws_init_range_convert_x86(SwsInternal *c)
Definition swscale.c:469
void ff_sws_free_altivec_bufs(SwsInternal *c)
void(* yuv2anyX_fn)(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t **dest, int dstW, int y)
Write one line of horizontally scaled Y/U/V/A to YUV/RGB output by doing multi-point vertical scaling...
static void fillPlane32(uint8_t *plane, int stride, int width, int height, int y, int alpha, int bits, const int big_endian, int is_float)
int ff_init_desc_no_chr(SwsFilterDescriptor *desc, SwsSlice *src, SwsSlice *dst)
Definition hscale.c:284
static av_always_inline int isALPHA(enum AVPixelFormat pix_fmt)
void ff_sws_init_input_funcs(SwsInternal *c, planar1_YV12_fn *lumToYV12, planar1_YV12_fn *alpToYV12, planar2_YV12_fn *chrToYV12, planarX_YV12_fn *readLumPlanar, planarX_YV12_fn *readAlpPlanar, planarX2_YV12_fn *readChrPlanar)
#define MAX_FILTER_SIZE
void(* yuv2packed2_fn)(SwsInternal *c, const int16_t *lumSrc[2], const int16_t *chrUSrc[2], const int16_t *chrVSrc[2], const int16_t *alpSrc[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y)
Write one line of horizontally scaled Y/U/V/A to packed-pixel YUV/RGB output by doing bilinear scalin...
av_cold void ff_sws_init_range_convert(SwsInternal *c)
Definition swscale.c:652
void ff_get_unscaled_swscale_aarch64(SwsInternal *c)
int ff_free_filters(SwsInternal *c)
Definition slice.c:386
static av_always_inline int isPackedRGB(enum AVPixelFormat pix_fmt)
void(* SwsColorFunc)(const SwsInternal *c, uint8_t *dst, int dst_stride, const uint8_t *src, int src_stride, int w, int h)
void(* yuv2interleavedX_fn)(enum AVPixelFormat dstFormat, const uint8_t *chrDither, const int16_t *chrFilter, int chrFilterSize, const int16_t **chrUSrc, const int16_t **chrVSrc, uint8_t *dest, int dstW)
Write one line of horizontally scaled chroma to interleaved output with multi-point vertical scaling ...
av_cold void ff_sws_init_xyzdsp(SwsInternal *c)
Definition swscale.c:889
SwsFunc ff_yuv2rgb_init_loongarch(SwsInternal *c)
int ff_init_filters(SwsInternal *c)
Definition slice.c:246
static av_always_inline int isBE(enum AVPixelFormat pix_fmt)
static av_always_inline int isPlanarRGB(enum AVPixelFormat pix_fmt)
av_cold void ff_sws_init_range_convert_loongarch(SwsInternal *c)
av_cold int ff_sws_fill_st428_tables(SwsInternal *c)
Definition utils.c:773
int ff_yuv2rgb_c_init_tables(SwsInternal *c, const int inv_table[4], int fullRange, int brightness, int contrast, int saturation)
static av_always_inline int isBayer16BPS(enum AVPixelFormat pix_fmt)
static av_always_inline int is32BPS(enum AVPixelFormat pix_fmt)
void ff_update_palette(SwsInternal *c, const uint32_t *pal)
Definition swscale.c:899
void ff_hcscale_fast_mmxext(SwsInternal *c, int16_t *dst1, int16_t *dst2, int dstWidth, const uint8_t *src1, const uint8_t *src2, int srcW, int xInc)
static av_always_inline int isNBPS(enum AVPixelFormat pix_fmt)
av_cold void ff_sws_init_range_convert_aarch64(SwsInternal *c)
Definition swscale.c:314
void(* planarX2_YV12_fn)(uint8_t *dst, uint8_t *dst2, const uint8_t *src[4], int width, int32_t *rgb2yuv, void *opaque)
const int32_t ff_yuv2rgb_coeffs[11][4]
Definition yuv2rgb.c:47
static av_always_inline int isYUV(enum AVPixelFormat pix_fmt)
static void FUNC yuv2planeX(const int16_t *filter, int filterSize, const int16_t **src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
void(* filter)(uint8_t *src, ptrdiff_t stride, int qscale)
Definition h263dsp.c:29
#define src1
Definition h264pred.c:141
#define src
Definition vp8dsp.c:248
#define height
Definition dsp.h:99
#define width
Definition dsp.h:99
int size
static double lum(void *priv, double x, double y, int plane)
Definition vf_fftfilt.c:107
static const uint16_t dither[8][8]
Definition vf_gradfun.c:46
int len
static double c[64]