FFmpeg
swscale.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2024 Niklas Haas
3  * Copyright (C) 2001-2011 Michael Niedermayer <michaelni@gmx.at>
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef SWSCALE_SWSCALE_H
23 #define SWSCALE_SWSCALE_H
24 
25 /**
26  * @file
27  * @ingroup libsws
28  * external API header
29  */
30 
31 #include <stdint.h>
32 
33 #include "libavutil/avutil.h"
34 #include "libavutil/frame.h"
35 #include "libavutil/log.h"
36 #include "libavutil/pixfmt.h"
37 #include "version_major.h"
38 #ifndef HAVE_AV_CONFIG_H
39 /* When included as part of the ffmpeg build, only include the major version
40  * to avoid unnecessary rebuilds. When included externally, keep including
41  * the full version information. */
42 #include "version.h"
43 #endif
44 
45 /**
46  * @defgroup libsws libswscale
47  * Color conversion and scaling library.
48  *
49  * @{
50  *
51  * Return the LIBSWSCALE_VERSION_INT constant.
52  */
53 unsigned swscale_version(void);
54 
55 /**
56  * Return the libswscale build-time configuration.
57  */
58 const char *swscale_configuration(void);
59 
60 /**
61  * Return the libswscale license.
62  */
63 const char *swscale_license(void);
64 
65 /**
66  * Get the AVClass for SwsContext. It can be used in combination with
67  * AV_OPT_SEARCH_FAKE_OBJ for examining options.
68  *
69  * @see av_opt_find().
70  */
71 const AVClass *sws_get_class(void);
72 
73 /******************************
74  * Flags and quality settings *
75  ******************************/
76 
77 typedef enum SwsDither {
78  SWS_DITHER_NONE = 0, /* disable dithering */
79  SWS_DITHER_AUTO, /* auto-select from preset */
80  SWS_DITHER_BAYER, /* ordered dither matrix */
81  SWS_DITHER_ED, /* error diffusion */
82  SWS_DITHER_A_DITHER, /* arithmetic addition */
83  SWS_DITHER_X_DITHER, /* arithmetic xor */
84  SWS_DITHER_NB, /* not part of the ABI */
85  SWS_DITHER_MAX_ENUM = 0x7FFFFFFF, /* force size to 32 bits, not a valid dither type */
87 
88 typedef enum SwsAlphaBlend {
92  SWS_ALPHA_BLEND_NB, /* not part of the ABI */
93  SWS_ALPHA_BLEND_MAX_ENUM = 0x7FFFFFFF, /* force size to 32 bits, not a valid blend mode */
95 
96 typedef enum SwsScaler {
98  SWS_SCALE_BILINEAR, ///< bilinear filtering
99  SWS_SCALE_BICUBIC, ///< 2-tap cubic BC-spline
100  SWS_SCALE_POINT, ///< nearest neighbor (point sampling)
101  SWS_SCALE_AREA, ///< area averaging
102  SWS_SCALE_GAUSSIAN, ///< 2-tap gaussian approximation
103  SWS_SCALE_SINC, ///< unwindowed sinc
104  SWS_SCALE_LANCZOS, ///< 3-tap sinc/sinc
105  SWS_SCALE_SPLINE, ///< unwindowned natural cubic spline
106  SWS_SCALE_NB, ///< not part of the ABI
107  SWS_SCALE_MAX_ENUM = 0x7FFFFFFF, ///< force size to 32 bits, not a valid filter type
108 } SwsScaler;
109 
110 typedef enum SwsBackend {
111  /* Stable backends */
112  SWS_BACKEND_LEGACY = (1 << 0), ///< Legacy bespoke format-specific code
114 
115  /* Unstable backends (auto-selected only if SWS_UNSTABLE is enabled) */
116  SWS_BACKEND_C = (1 << 1), ///< Template-based C reference implementation
117  SWS_BACKEND_MEMCPY = (1 << 2), ///< Fast path using libc memcpy() / memset()
118  SWS_BACKEND_X86 = (1 << 3), ///< Chained x86 SIMD kernels
119  SWS_BACKEND_AARCH64 = (1 << 4), ///< Chained AArch64 NEON kernels
120  SWS_BACKEND_SPIRV = (1 << 5), ///< Vulkan SPIR-V backend
121  SWS_BACKEND_GLSL = (1 << 6), ///< Vulkan GLSL backend
128 
130  SWS_BACKEND_MAX_ENUM = 0x7FFFFFFF, ///< force size to 32 bits, not a valid backend
131 } SwsBackend;
132 
133 typedef enum SwsFlags {
134  /**
135  * Return an error on underspecified conversions. Without this flag,
136  * unspecified fields are defaulted to sensible values.
137  */
138  SWS_STRICT = 1 << 11,
139 
140  /**
141  * Emit verbose log of scaling parameters.
142  */
143  SWS_PRINT_INFO = 1 << 12,
144 
145  /**
146  * Perform full chroma upsampling when upscaling to RGB.
147  *
148  * For example, when converting 50x50 yuv420p to 100x100 rgba, setting this flag
149  * will scale the chroma plane from 25x25 to 100x100 (4:4:4), and then convert
150  * the 100x100 yuv444p image to rgba in the final output step.
151  *
152  * Without this flag, the chroma plane is instead scaled to 50x100 (4:2:2),
153  * with a single chroma sample being reused for both of the horizontally
154  * adjacent RGBA output pixels.
155  */
157 
158  /**
159  * Perform full chroma interpolation when downscaling RGB sources.
160  *
161  * For example, when converting a 100x100 rgba source to 50x50 yuv444p, setting
162  * this flag will generate a 100x100 (4:4:4) chroma plane, which is then
163  * downscaled to the required 50x50.
164  *
165  * Without this flag, the chroma plane is instead generated at 50x100 (dropping
166  * every other pixel), before then being downscaled to the required 50x50
167  * resolution.
168  */
170 
171  /**
172  * Force bit-exact output. This will prevent the use of platform-specific
173  * optimizations that may lead to slight difference in rounding, in favor
174  * of always maintaining exact bit output compatibility with the reference
175  * C code.
176  *
177  * Note: It is recommended to set both of these flags simultaneously.
178  */
179  SWS_ACCURATE_RND = 1 << 18,
180  SWS_BITEXACT = 1 << 19,
181 
182  /**
183  * Allow/prefer using experimental new code paths. This may be faster,
184  * slower, or produce different output, with semantics subject to change
185  * at any point in time. For testing and debugging purposes only.
186  */
187  SWS_UNSTABLE = 1 << 20,
188 
189  /**
190  * Deprecated flags.
191  */
192  SWS_DIRECT_BGR = 1 << 15, ///< This flag has no effect
193  SWS_ERROR_DIFFUSION = 1 << 23, ///< Set `SwsContext.dither` instead
194 
195  /**
196  * Scaler selection options. Only one may be active at a time.
197  * Deprecated in favor of `SwsContext.scaler`.
198  */
199  SWS_FAST_BILINEAR = 1 << 0, ///< fast bilinear filtering
200  SWS_BILINEAR = 1 << 1, ///< bilinear filtering
201  SWS_BICUBIC = 1 << 2, ///< 2-tap cubic B-spline
202  SWS_X = 1 << 3, ///< experimental
203  SWS_POINT = 1 << 4, ///< nearest neighbor
204  SWS_AREA = 1 << 5, ///< area averaging
205  SWS_BICUBLIN = 1 << 6, ///< bicubic luma, bilinear chroma
206  SWS_GAUSS = 1 << 7, ///< gaussian approximation
207  SWS_SINC = 1 << 8, ///< unwindowed sinc
208  SWS_LANCZOS = 1 << 9, ///< 3-tap sinc/sinc
209  SWS_SPLINE = 1 << 10, ///< unwindowed natural cubic spline
210 } SwsFlags;
211 
212 typedef enum SwsIntent {
213  SWS_INTENT_PERCEPTUAL = 0, ///< Perceptual tone mapping
214  SWS_INTENT_RELATIVE_COLORIMETRIC = 1, ///< Relative colorimetric clipping
215  SWS_INTENT_SATURATION = 2, ///< Saturation mapping
216  SWS_INTENT_ABSOLUTE_COLORIMETRIC = 3, ///< Absolute colorimetric clipping
217  SWS_INTENT_NB, ///< not part of the ABI
218 } SwsIntent;
219 
220 /***********************************
221  * Context creation and management *
222  ***********************************/
223 
224 /**
225  * Main external API structure. New fields can be added to the end with
226  * minor version bumps. Removal, reordering and changes to existing fields
227  * require a major version bump. sizeof(SwsContext) is not part of the ABI.
228  */
229 typedef struct SwsContext {
230  const AVClass *av_class;
231 
232  /**
233  * Private data of the user, can be used to carry app specific stuff.
234  */
235  void *opaque;
236 
237  /**
238  * Bitmask of SWS_*. See `SwsFlags` for details.
239  */
240  unsigned flags;
241 
242  /**
243  * Extra parameters for fine-tuning certain scalers.
244  */
245 #define SWS_NUM_SCALER_PARAMS 2
247 
248  /**
249  * How many threads to use for processing, or 0 for automatic selection.
250  */
251  int threads;
252 
253  /**
254  * Dither mode.
255  */
257 
258  /**
259  * Alpha blending mode. See `SwsAlphaBlend` for details.
260  */
262 
263  /**
264  * Use gamma correct scaling.
265  */
266  int gamma_flag;
267 
268  /**
269  * Deprecated frame property overrides, for the legacy API only.
270  *
271  * Ignored by sws_scale_frame() when used in dynamic mode, in which
272  * case all properties are instead taken from the frame directly.
273  */
274  int src_w, src_h; ///< Width and height of the source frame
275  int dst_w, dst_h; ///< Width and height of the destination frame
276  int src_format; ///< Source pixel format
277  int dst_format; ///< Destination pixel format
278  int src_range; ///< Source is full range
279  int dst_range; ///< Destination is full range
280  int src_v_chr_pos; ///< Source vertical chroma position in luma grid / 256
281  int src_h_chr_pos; ///< Source horizontal chroma position
282  int dst_v_chr_pos; ///< Destination vertical chroma position
283  int dst_h_chr_pos; ///< Destination horizontal chroma position
284 
285  /**
286  * Desired ICC intent for color space conversions.
287  */
288  int intent;
289 
290  /**
291  * Scaling filter. If set to something other than SWS_SCALE_AUTO, this will
292  * override the filter implied by `SwsContext.flags`.
293  *
294  * Note: Does not affect the legacy (stateful) API.
295  */
297 
298  /**
299  * Scaler used specifically for up/downsampling subsampled (chroma) planes.
300  * If set to something other than SWS_SCALE_AUTO, this will override the
301  * filter implied by `SwsContext.scaler`. Otherwise, the same filter
302  * will be used for both main scaling and chroma subsampling.
303  */
305 
306  /**
307  * Bitmask of SWS_BACKEND_*. If non-zero, this will restrict the available
308  * backends to the specified set. If left as zero, a default set of
309  * backends will be selected automatically (based on SWS_UNSTABLE).
310  *
311  * Note: This is only relevant for the new API (sws_scale_frame()). The
312  * stateful legacy API always implies SWS_BACKEND_LEGACY.
313  */
315 
316  /* Remember to add new fields to graph.c:opts_equal() */
317 } SwsContext;
318 
319 /**
320  * Allocate an empty SwsContext and set its fields to default values.
321  */
323 
324 /**
325  * Free the context and everything associated with it, and write NULL
326  * to the provided pointer.
327  */
329 
330 /***************************
331  * Supported frame formats *
332  ***************************/
333 
334 /**
335  * Test if a given (software) pixel format is supported by any backend,
336  * excluding unstable backends.
337  *
338  * @param output If 0, test if compatible with the source/input frame;
339  * otherwise, with the destination/output frame.
340  * @param format The format to check.
341  *
342  * @return A positive integer if supported, 0 otherwise.
343  */
345 
346 /**
347  * Test if a given hardware pixel format is supported by any backend,
348  * excluding unstable backends.
349  *
350  * @param format The hardware format to check, or AV_PIX_FMT_NONE.
351  *
352  * @return A positive integer if supported or AV_PIX_FMT_NONE, 0 otherwise.
353  */
355 
356 /**
357  * Test if a given color space is supported.
358  *
359  * @param output If 0, test if compatible with the source/input frame;
360  * otherwise, with the destination/output frame.
361  * @param colorspace The colorspace to check.
362  *
363  * @return A positive integer if supported, 0 otherwise.
364  */
365 int sws_test_colorspace(enum AVColorSpace colorspace, int output);
366 
367 /**
368  * Test if a given set of color primaries is supported.
369  *
370  * @param output If 0, test if compatible with the source/input frame;
371  * otherwise, with the destination/output frame.
372  * @param primaries The color primaries to check.
373  *
374  * @return A positive integer if supported, 0 otherwise.
375  */
377 
378 /**
379  * Test if a given color transfer function is supported.
380  *
381  * @param output If 0, test if compatible with the source/input frame;
382  * otherwise, with the destination/output frame.
383  * @param trc The color transfer function to check.
384  *
385  * @return A positive integer if supported, 0 otherwise.
386  */
388 
389 /**
390  * Helper function to run all sws_test_* against a frame, as well as testing
391  * the basic frame properties for sanity. Ignores irrelevant properties - for
392  * example, AVColorSpace is not checked for RGB frames.
393  */
394 int sws_test_frame(const AVFrame *frame, int output);
395 
396 /**
397  * Like `sws_scale_frame`, but without actually scaling. It will instead
398  * merely initialize internal state that *would* be required to perform the
399  * operation, as well as returning the correct error code for unsupported
400  * frame combinations.
401  *
402  * @param ctx The scaling context.
403  * @param dst The destination frame to consider.
404  * @param src The source frame to consider.
405  * @return 0 on success, a negative AVERROR code on failure.
406  */
407 int sws_frame_setup(SwsContext *ctx, const AVFrame *dst, const AVFrame *src);
408 
409 /********************
410  * Main scaling API *
411  ********************/
412 
413 /**
414  * Check if a given conversion is a noop. Returns a positive integer if
415  * no operation needs to be performed, 0 otherwise.
416  */
417 int sws_is_noop(const AVFrame *dst, const AVFrame *src);
418 
419 /**
420  * Scale source data from `src` and write the output to `dst`.
421  *
422  * This function can be used directly on an allocated context, without setting
423  * up any frame properties or calling `sws_init_context()`. Such usage is fully
424  * dynamic and does not require reallocation if the frame properties change.
425  *
426  * Alternatively, this function can be called on a context that has been
427  * explicitly initialized. However, this is provided only for backwards
428  * compatibility. In this usage mode, all frame properties must be correctly
429  * set at init time, and may no longer change after initialization.
430  *
431  * @param ctx The scaling context.
432  * @param dst The destination frame. The data buffers may either be already
433  * allocated by the caller or left clear, in which case they will
434  * be allocated by the scaler. The latter may have performance
435  * advantages - e.g. in certain cases some (or all) output planes
436  * may be references to input planes, rather than copies.
437  * @param src The source frame. If the data buffers are set to NULL, then
438  * this function behaves identically to `sws_frame_setup`.
439  * @return >= 0 on success, a negative AVERROR code on failure.
440  */
442 
443 /**
444  * Filter kernel cut-off value. Values below this (absolute) magnitude
445  * are cut off from the main filter kernel. Note that the window is
446  * always adjusted to the new filter radius, so there will never be
447  * any spectral leakage (for suitably windowed filters).
448  */
449 #define SWS_MAX_REDUCE_CUTOFF 0.002
450 
451 /*************************
452  * Legacy (stateful) API *
453  *************************/
454 
455 #define SWS_SRC_V_CHR_DROP_MASK 0x30000
456 #define SWS_SRC_V_CHR_DROP_SHIFT 16
457 
458 #define SWS_PARAM_DEFAULT 123456
459 
460 #define SWS_CS_ITU709 1
461 #define SWS_CS_FCC 4
462 #define SWS_CS_ITU601 5
463 #define SWS_CS_ITU624 5
464 #define SWS_CS_SMPTE170M 5
465 #define SWS_CS_SMPTE240M 7
466 #define SWS_CS_DEFAULT 5
467 #define SWS_CS_BT2020 9
468 
469 /**
470  * Return a pointer to yuv<->rgb coefficients for the given colorspace
471  * suitable for sws_setColorspaceDetails().
472  *
473  * @param colorspace One of the SWS_CS_* macros. If invalid,
474  * SWS_CS_DEFAULT is used.
475  */
476 const int *sws_getCoefficients(int colorspace);
477 
478 // when used for filters they must have an odd number of elements
479 // coeffs cannot be shared between vectors
480 typedef struct SwsVector {
481  double *coeff; ///< pointer to the list of coefficients
482  int length; ///< number of coefficients in the vector
483 } SwsVector;
484 
485 // vectors can be shared
486 typedef struct SwsFilter {
491 } SwsFilter;
492 
493 /**
494  * Return a positive value if pix_fmt is a supported input format, 0
495  * otherwise.
496  */
498 
499 /**
500  * Return a positive value if pix_fmt is a supported output format, 0
501  * otherwise.
502  */
504 
505 /**
506  * @param[in] pix_fmt the pixel format
507  * @return a positive value if an endianness conversion for pix_fmt is
508  * supported, 0 otherwise.
509  */
511 
512 /**
513  * Initialize the swscaler context sws_context.
514  *
515  * This function is considered deprecated, and provided only for backwards
516  * compatibility with sws_scale() and sws_frame_start(). The preferred way to
517  * use libswscale is to set all frame properties correctly and call
518  * sws_scale_frame() directly, without explicitly initializing the context.
519  *
520  * @return zero or positive value on success, a negative value on
521  * error
522  */
524 int sws_init_context(SwsContext *sws_context, SwsFilter *srcFilter, SwsFilter *dstFilter);
525 
526 /**
527  * Free the swscaler context swsContext.
528  * If swsContext is NULL, then does nothing.
529  */
530 void sws_freeContext(SwsContext *swsContext);
531 
532 /**
533  * Allocate and return an SwsContext. You need it to perform
534  * scaling/conversion operations using sws_scale().
535  *
536  * @param srcW the width of the source image
537  * @param srcH the height of the source image
538  * @param srcFormat the source image format
539  * @param dstW the width of the destination image
540  * @param dstH the height of the destination image
541  * @param dstFormat the destination image format
542  * @param flags specify which algorithm and options to use for rescaling
543  * @param param extra parameters to tune the used scaler
544  * For SWS_BICUBIC param[0] and [1] tune the shape of the basis
545  * function, param[0] tunes f(1) and param[1] f´(1)
546  * For SWS_GAUSS param[0] tunes the exponent and thus cutoff
547  * frequency
548  * For SWS_LANCZOS param[0] tunes the width of the window function
549  * @return a pointer to an allocated context, or NULL in case of error
550  * @note this function is to be removed after a saner alternative is
551  * written
552  */
553 SwsContext *sws_getContext(int srcW, int srcH, enum AVPixelFormat srcFormat,
554  int dstW, int dstH, enum AVPixelFormat dstFormat,
555  int flags, SwsFilter *srcFilter,
556  SwsFilter *dstFilter, const double *param);
557 
558 /**
559  * Scale the image slice in srcSlice and put the resulting scaled
560  * slice in the image in dst. A slice is a sequence of consecutive
561  * rows in an image. Requires a context that has previously been
562  * initialized with sws_init_context().
563  *
564  * Slices have to be provided in sequential order, either in
565  * top-bottom or bottom-top order. If slices are provided in
566  * non-sequential order the behavior of the function is undefined.
567  *
568  * @param c the scaling context previously created with
569  * sws_getContext()
570  * @param srcSlice the array containing the pointers to the planes of
571  * the source slice
572  * @param srcStride the array containing the strides for each plane of
573  * the source image
574  * @param srcSliceY the position in the source image of the slice to
575  * process, that is the number (counted starting from
576  * zero) in the image of the first row of the slice
577  * @param srcSliceH the height of the source slice, that is the number
578  * of rows in the slice
579  * @param dst the array containing the pointers to the planes of
580  * the destination image
581  * @param dstStride the array containing the strides for each plane of
582  * the destination image
583  * @return the height of the output slice
584  */
585 int sws_scale(SwsContext *c, const uint8_t *const srcSlice[],
586  const int srcStride[], int srcSliceY, int srcSliceH,
587  uint8_t *const dst[], const int dstStride[]);
588 
589 /**
590  * Initialize the scaling process for a given pair of source/destination frames.
591  * Must be called before any calls to sws_send_slice() and sws_receive_slice().
592  * Requires a context that has previously been initialized with sws_init_context().
593  *
594  * This function will retain references to src and dst, so they must both use
595  * refcounted buffers (if allocated by the caller, in case of dst).
596  *
597  * @param c The scaling context
598  * @param dst The destination frame.
599  *
600  * The data buffers may either be already allocated by the caller or
601  * left clear, in which case they will be allocated by the scaler.
602  * The latter may have performance advantages - e.g. in certain cases
603  * some output planes may be references to input planes, rather than
604  * copies.
605  *
606  * Output data will be written into this frame in successful
607  * sws_receive_slice() calls.
608  * @param src The source frame. The data buffers must be allocated, but the
609  * frame data does not have to be ready at this point. Data
610  * availability is then signalled by sws_send_slice().
611  * @return 0 on success, a negative AVERROR code on failure
612  *
613  * @see sws_frame_end()
614  */
616 
617 /**
618  * Finish the scaling process for a pair of source/destination frames previously
619  * submitted with sws_frame_start(). Must be called after all sws_send_slice()
620  * and sws_receive_slice() calls are done, before any new sws_frame_start()
621  * calls.
622  *
623  * @param c The scaling context
624  */
625 void sws_frame_end(SwsContext *c);
626 
627 /**
628  * Indicate that a horizontal slice of input data is available in the source
629  * frame previously provided to sws_frame_start(). The slices may be provided in
630  * any order, but may not overlap. For vertically subsampled pixel formats, the
631  * slices must be aligned according to subsampling.
632  *
633  * @param c The scaling context
634  * @param slice_start first row of the slice
635  * @param slice_height number of rows in the slice
636  *
637  * @return a non-negative number on success, a negative AVERROR code on failure.
638  */
639 int sws_send_slice(SwsContext *c, unsigned int slice_start,
640  unsigned int slice_height);
641 
642 /**
643  * Request a horizontal slice of the output data to be written into the frame
644  * previously provided to sws_frame_start().
645  *
646  * @param c The scaling context
647  * @param slice_start first row of the slice; must be a multiple of
648  * sws_receive_slice_alignment()
649  * @param slice_height number of rows in the slice; must be a multiple of
650  * sws_receive_slice_alignment(), except for the last slice
651  * (i.e. when slice_start+slice_height is equal to output
652  * frame height)
653  *
654  * @return a non-negative number if the data was successfully written into the output
655  * AVERROR(EAGAIN) if more input data needs to be provided before the
656  * output can be produced
657  * another negative AVERROR code on other kinds of scaling failure
658  */
659 int sws_receive_slice(SwsContext *c, unsigned int slice_start,
660  unsigned int slice_height);
661 
662 /**
663  * Get the alignment required for slices. Requires a context that has
664  * previously been initialized with sws_init_context().
665  *
666  * @param c The scaling context
667  * @return alignment required for output slices requested with sws_receive_slice().
668  * Slice offsets and sizes passed to sws_receive_slice() must be
669  * multiples of the value returned from this function.
670  */
671 unsigned int sws_receive_slice_alignment(const SwsContext *c);
672 
673 /**
674  * @param c the scaling context
675  * @param dstRange flag indicating the white-black range of the output (1=jpeg / 0=mpeg)
676  * @param srcRange flag indicating the white-black range of the input (1=jpeg / 0=mpeg)
677  * @param table the yuv2rgb coefficients describing the output yuv space, normally ff_yuv2rgb_coeffs[x]
678  * @param inv_table the yuv2rgb coefficients describing the input yuv space, normally ff_yuv2rgb_coeffs[x]
679  * @param brightness 16.16 fixed point brightness correction
680  * @param contrast 16.16 fixed point contrast correction
681  * @param saturation 16.16 fixed point saturation correction
682  *
683  * @return A negative error code on error, non negative otherwise.
684  * If `LIBSWSCALE_VERSION_MAJOR < 7`, returns -1 if not supported.
685  */
686 int sws_setColorspaceDetails(SwsContext *c, const int inv_table[4],
687  int srcRange, const int table[4], int dstRange,
688  int brightness, int contrast, int saturation);
689 
690 /**
691  * @return A negative error code on error, non negative otherwise.
692  * If `LIBSWSCALE_VERSION_MAJOR < 7`, returns -1 if not supported.
693  */
694 int sws_getColorspaceDetails(SwsContext *c, int **inv_table,
695  int *srcRange, int **table, int *dstRange,
696  int *brightness, int *contrast, int *saturation);
697 
698 /**
699  * Allocate and return an uninitialized vector with length coefficients.
700  */
701 SwsVector *sws_allocVec(int length);
702 
703 /**
704  * Return a normalized Gaussian curve used to filter stuff
705  * quality = 3 is high quality, lower is lower quality.
706  */
707 SwsVector *sws_getGaussianVec(double variance, double quality);
708 
709 /**
710  * Scale all the coefficients of a by the scalar value.
711  */
712 void sws_scaleVec(SwsVector *a, double scalar);
713 
714 /**
715  * Scale all the coefficients of a so that their sum equals height.
716  */
717 void sws_normalizeVec(SwsVector *a, double height);
718 
719 void sws_freeVec(SwsVector *a);
720 
721 SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
722  float lumaSharpen, float chromaSharpen,
723  float chromaHShift, float chromaVShift,
724  int verbose);
726 
727 /**
728  * Check if context can be reused, otherwise reallocate a new one.
729  *
730  * If context is NULL, just calls sws_getContext() to get a new
731  * context. Otherwise, checks if the parameters are the ones already
732  * saved in context. If that is the case, returns the current
733  * context. Otherwise, frees context and gets a new context with
734  * the new parameters.
735  *
736  * Be warned that srcFilter and dstFilter are not checked, they
737  * are assumed to remain the same.
738  */
739 SwsContext *sws_getCachedContext(SwsContext *context, int srcW, int srcH,
740  enum AVPixelFormat srcFormat, int dstW, int dstH,
741  enum AVPixelFormat dstFormat, int flags,
742  SwsFilter *srcFilter, SwsFilter *dstFilter,
743  const double *param);
744 
745 /**
746  * Convert an 8-bit paletted frame into a frame with a color depth of 32 bits.
747  *
748  * The output frame will have the same packed format as the palette.
749  *
750  * @param src source frame buffer
751  * @param dst destination frame buffer
752  * @param num_pixels number of pixels to convert
753  * @param palette array with [256] entries, which must match color arrangement (RGB or BGR) of src
754  */
755 void sws_convertPalette8ToPacked32(const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette);
756 
757 /**
758  * Convert an 8-bit paletted frame into a frame with a color depth of 24 bits.
759  *
760  * With the palette format "ABCD", the destination frame ends up with the format "ABC".
761  *
762  * @param src source frame buffer
763  * @param dst destination frame buffer
764  * @param num_pixels number of pixels to convert
765  * @param palette array with [256] entries, which must match color arrangement (RGB or BGR) of src
766  */
767 void sws_convertPalette8ToPacked24(const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette);
768 
769 /**
770  * @}
771  */
772 
773 #endif /* SWSCALE_SWSCALE_H */
flags
const SwsFlags flags[]
Definition: swscale.c:85
sws_setColorspaceDetails
int sws_setColorspaceDetails(SwsContext *c, const int inv_table[4], int srcRange, const int table[4], int dstRange, int brightness, int contrast, int saturation)
Definition: utils.c:860
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
SWS_DITHER_AUTO
@ SWS_DITHER_AUTO
Definition: swscale.h:81
SWS_SCALE_AUTO
@ SWS_SCALE_AUTO
Definition: swscale.h:97
version_major.h
AVColorTransferCharacteristic
AVColorTransferCharacteristic
Color Transfer Characteristic.
Definition: pixfmt.h:666
SWS_INTENT_SATURATION
@ SWS_INTENT_SATURATION
Saturation mapping.
Definition: swscale.h:215
SwsContext::src_w
int src_w
Deprecated frame property overrides, for the legacy API only.
Definition: swscale.h:276
SWS_SCALE_BILINEAR
@ SWS_SCALE_BILINEAR
bilinear filtering
Definition: swscale.h:98
saturation
static IPT saturation(const CmsCtx *ctx, IPT ipt)
Definition: cms.c:559
SWS_ALPHA_BLEND_CHECKERBOARD
@ SWS_ALPHA_BLEND_CHECKERBOARD
Definition: swscale.h:91
output
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce output
Definition: filter_design.txt:226
SWS_BACKEND_SPIRV
@ SWS_BACKEND_SPIRV
Vulkan SPIR-V backend.
Definition: swscale.h:120
sws_freeContext
void sws_freeContext(SwsContext *swsContext)
Free the swscaler context swsContext.
Definition: utils.c:2297
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:466
SWS_DITHER_NONE
@ SWS_DITHER_NONE
Definition: swscale.h:80
SWS_BILINEAR
@ SWS_BILINEAR
bilinear filtering
Definition: swscale.h:200
sws_test_primaries
int sws_test_primaries(enum AVColorPrimaries primaries, int output)
Test if a given set of color primaries is supported.
Definition: format.c:607
SWS_BITEXACT
@ SWS_BITEXACT
Definition: swscale.h:180
table
static const uint16_t table[]
Definition: prosumer.c:203
SwsContext::av_class
const AVClass * av_class
Definition: swscale.h:232
SwsContext::flags
unsigned flags
Bitmask of SWS_*.
Definition: swscale.h:242
filter
void(* filter)(uint8_t *src, int stride, int qscale)
Definition: h263dsp.c:29
sws_receive_slice
int sws_receive_slice(SwsContext *c, unsigned int slice_start, unsigned int slice_height)
Request a horizontal slice of the output data to be written into the frame previously provided to sws...
Definition: swscale.c:1306
AVColorPrimaries
AVColorPrimaries
Chromaticity coordinates of the source primaries.
Definition: pixfmt.h:636
sws_convertPalette8ToPacked24
void sws_convertPalette8ToPacked24(const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette)
Convert an 8-bit paletted frame into a frame with a color depth of 24 bits.
Definition: swscale_unscaled.c:2719
SWS_BICUBLIN
@ SWS_BICUBLIN
bicubic luma, bilinear chroma
Definition: swscale.h:205
SWS_ALPHA_BLEND_NONE
@ SWS_ALPHA_BLEND_NONE
Definition: swscale.h:89
sws_test_hw_format
int sws_test_hw_format(enum AVPixelFormat format)
Test if a given hardware pixel format is supported by any backend, excluding unstable backends.
Definition: format.c:579
quality
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about quality
Definition: rate_distortion.txt:12
sws_freeVec
void sws_freeVec(SwsVector *a)
Definition: utils.c:2193
SWS_BACKEND_X86
@ SWS_BACKEND_X86
Chained x86 SIMD kernels.
Definition: swscale.h:118
SWS_FAST_BILINEAR
@ SWS_FAST_BILINEAR
Scaler selection options.
Definition: swscale.h:199
primaries
enum AVColorPrimaries primaries
Definition: mediacodec_wrapper.c:2612
SWS_FULL_CHR_H_INP
@ SWS_FULL_CHR_H_INP
Perform full chroma interpolation when downscaling RGB sources.
Definition: swscale.h:169
SwsContext::src_v_chr_pos
int src_v_chr_pos
Source vertical chroma position in luma grid / 256.
Definition: swscale.h:282
SwsDither
SwsDither
Definition: swscale.h:77
sws_getCachedContext
SwsContext * sws_getCachedContext(SwsContext *context, int srcW, int srcH, enum AVPixelFormat srcFormat, int dstW, int dstH, enum AVPixelFormat dstFormat, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter, const double *param)
Check if context can be reused, otherwise reallocate a new one.
Definition: utils.c:2391
swscale_license
const char * swscale_license(void)
Return the libswscale license.
Definition: version.c:38
sws_init_context
av_warn_unused_result int sws_init_context(SwsContext *sws_context, SwsFilter *srcFilter, SwsFilter *dstFilter)
Initialize the swscaler context sws_context.
Definition: utils.c:1931
sws_frame_setup
int sws_frame_setup(SwsContext *ctx, const AVFrame *dst, const AVFrame *src)
Like sws_scale_frame, but without actually scaling.
Definition: swscale.c:1460
SWS_ALPHA_BLEND_NB
@ SWS_ALPHA_BLEND_NB
Definition: swscale.h:92
sws_get_class
const AVClass * sws_get_class(void)
Get the AVClass for SwsContext.
Definition: options.c:134
SWS_DITHER_X_DITHER
@ SWS_DITHER_X_DITHER
Definition: swscale.h:85
SWS_BACKEND_LEGACY
@ SWS_BACKEND_LEGACY
Legacy bespoke format-specific code.
Definition: swscale.h:112
SwsBackend
SwsBackend
Definition: swscale.h:110
SWS_SCALE_BICUBIC
@ SWS_SCALE_BICUBIC
2-tap cubic BC-spline
Definition: swscale.h:99
SWS_AREA
@ SWS_AREA
area averaging
Definition: swscale.h:204
SWS_ALPHA_BLEND_MAX_ENUM
@ SWS_ALPHA_BLEND_MAX_ENUM
Definition: swscale.h:93
SwsContext::dither
SwsDither dither
Dither mode.
Definition: swscale.h:258
SwsFlags
SwsFlags
Definition: swscale.h:133
SwsContext::threads
int threads
How many threads to use for processing, or 0 for automatic selection.
Definition: swscale.h:253
SWS_SCALE_LANCZOS
@ SWS_SCALE_LANCZOS
3-tap sinc/sinc
Definition: swscale.h:104
pix_fmt
static enum AVPixelFormat pix_fmt
Definition: demux_decode.c:41
SwsVector::length
int length
number of coefficients in the vector
Definition: swscale.h:482
sws_allocVec
SwsVector * sws_allocVec(int length)
Allocate and return an uninitialized vector with length coefficients.
Definition: utils.c:2003
SWS_DITHER_BAYER
@ SWS_DITHER_BAYER
Definition: swscale.h:82
SwsContext::intent
int intent
Desired ICC intent for color space conversions.
Definition: swscale.h:290
sws_test_colorspace
int sws_test_colorspace(enum AVColorSpace colorspace, int output)
Test if a given color space is supported.
Definition: format.c:590
ctx
static AVFormatContext * ctx
Definition: movenc.c:49
SWS_BACKEND_ALL
@ SWS_BACKEND_ALL
Definition: swscale.h:129
sws_getGaussianVec
SwsVector * sws_getGaussianVec(double variance, double quality)
Return a normalized Gaussian curve used to filter stuff quality = 3 is high quality,...
Definition: utils.c:2020
sws_frame_end
void sws_frame_end(SwsContext *c)
Finish the scaling process for a pair of source/destination frames previously submitted with sws_fram...
Definition: swscale.c:1219
SWS_BACKEND_MAX_ENUM
@ SWS_BACKEND_MAX_ENUM
force size to 32 bits, not a valid backend
Definition: swscale.h:130
context
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option keep it simple and lowercase description are in without and describe what they for example set the foo of the bar offset is the offset of the field in your context
Definition: writing_filters.txt:91
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:76
SWS_DIRECT_BGR
@ SWS_DIRECT_BGR
Deprecated flags.
Definition: swscale.h:192
SWS_BACKEND_STABLE
@ SWS_BACKEND_STABLE
Definition: swscale.h:113
format
New swscale design to change SwsGraph is what coordinates multiple passes These can include cascaded scaling error diffusion and so on Or we could have separate passes for the vertical and horizontal scaling In between each SwsPass lies a fully allocated image buffer Graph passes may have different levels of e g we can have a single threaded error diffusion pass following a multi threaded scaling pass SwsGraph is internally recreated whenever the image format
Definition: swscale-v2.txt:14
SWS_BICUBIC
@ SWS_BICUBIC
2-tap cubic B-spline
Definition: swscale.h:201
SwsContext::gamma_flag
int gamma_flag
Use gamma correct scaling.
Definition: swscale.h:268
sws_is_noop
int sws_is_noop(const AVFrame *dst, const AVFrame *src)
Check if a given conversion is a noop.
Definition: format.c:656
sws_getDefaultFilter
SwsFilter * sws_getDefaultFilter(float lumaGBlur, float chromaGBlur, float lumaSharpen, float chromaSharpen, float chromaHShift, float chromaVShift, int verbose)
Definition: utils.c:2214
SWS_INTENT_PERCEPTUAL
@ SWS_INTENT_PERCEPTUAL
Perceptual tone mapping.
Definition: swscale.h:213
sws_test_format
int sws_test_format(enum AVPixelFormat format, int output)
Test if a given (software) pixel format is supported by any backend, excluding unstable backends.
Definition: format.c:574
SwsContext::src_range
int src_range
Source is full range.
Definition: swscale.h:280
SwsScaler
SwsScaler
Definition: swscale.h:96
SwsVector::coeff
double * coeff
pointer to the list of coefficients
Definition: swscale.h:481
SWS_INTENT_ABSOLUTE_COLORIMETRIC
@ SWS_INTENT_ABSOLUTE_COLORIMETRIC
Absolute colorimetric clipping.
Definition: swscale.h:216
SwsContext::dst_h_chr_pos
int dst_h_chr_pos
Destination horizontal chroma position.
Definition: swscale.h:285
sws_scaleVec
void sws_scaleVec(SwsVector *a, double scalar)
Scale all the coefficients of a by the scalar value.
Definition: utils.c:2086
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
SWS_SCALE_SINC
@ SWS_SCALE_SINC
unwindowed sinc
Definition: swscale.h:103
SwsFilter::chrV
SwsVector * chrV
Definition: swscale.h:490
height
#define height
Definition: dsp.h:89
sws_alloc_context
SwsContext * sws_alloc_context(void)
Allocate an empty SwsContext and set its fields to default values.
Definition: utils.c:1043
SwsVector
Definition: swscale.h:480
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:87
SwsContext::opaque
void * opaque
Private data of the user, can be used to carry app specific stuff.
Definition: swscale.h:237
SWS_POINT
@ SWS_POINT
nearest neighbor
Definition: swscale.h:203
SWS_ALPHA_BLEND_UNIFORM
@ SWS_ALPHA_BLEND_UNIFORM
Definition: swscale.h:90
SwsContext::alpha_blend
SwsAlphaBlend alpha_blend
Alpha blending mode.
Definition: swscale.h:263
SWS_SPLINE
@ SWS_SPLINE
unwindowed natural cubic spline
Definition: swscale.h:209
SwsContext::src_h
int src_h
Width and height of the source frame.
Definition: swscale.h:276
frame.h
sws_getColorspaceDetails
int sws_getColorspaceDetails(SwsContext *c, int **inv_table, int *srcRange, int **table, int *dstRange, int *brightness, int *contrast, int *saturation)
Definition: utils.c:1018
SwsFilter
Definition: swscale.h:486
a
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
Definition: undefined.txt:41
SwsFilter::lumV
SwsVector * lumV
Definition: swscale.h:488
sws_test_transfer
int sws_test_transfer(enum AVColorTransferCharacteristic trc, int output)
Test if a given color transfer function is supported.
Definition: format.c:614
SWS_DITHER_NB
@ SWS_DITHER_NB
Definition: swscale.h:86
swscale_configuration
const char * swscale_configuration(void)
Return the libswscale build-time configuration.
Definition: version.c:33
SwsContext::backends
SwsBackend backends
Bitmask of SWS_BACKEND_*.
Definition: swscale.h:316
sws_isSupportedInput
int sws_isSupportedInput(enum AVPixelFormat pix_fmt)
Return a positive value if pix_fmt is a supported input format, 0 otherwise.
Definition: format.c:291
SwsContext::dst_format
int dst_format
Destination pixel format.
Definition: swscale.h:279
SWS_SCALE_POINT
@ SWS_SCALE_POINT
nearest neighbor (point sampling)
Definition: swscale.h:100
sws_isSupportedEndiannessConversion
int sws_isSupportedEndiannessConversion(enum AVPixelFormat pix_fmt)
Definition: format.c:303
sws_send_slice
int sws_send_slice(SwsContext *c, unsigned int slice_start, unsigned int slice_height)
Indicate that a horizontal slice of input data is available in the source frame previously provided t...
Definition: swscale.c:1282
log.h
SWS_X
@ SWS_X
experimental
Definition: swscale.h:202
SWS_SCALE_MAX_ENUM
@ SWS_SCALE_MAX_ENUM
force size to 32 bits, not a valid filter type
Definition: swscale.h:107
AVColorSpace
AVColorSpace
YUV colorspace type.
Definition: pixfmt.h:700
SWS_BACKEND_MEMCPY
@ SWS_BACKEND_MEMCPY
Fast path using libc memcpy() / memset()
Definition: swscale.h:117
SwsContext::scaler
SwsScaler scaler
Scaling filter.
Definition: swscale.h:298
sws_isSupportedOutput
int sws_isSupportedOutput(enum AVPixelFormat pix_fmt)
Return a positive value if pix_fmt is a supported output format, 0 otherwise.
Definition: format.c:297
SWS_INTENT_NB
@ SWS_INTENT_NB
not part of the ABI
Definition: swscale.h:217
SwsContext::scaler_sub
SwsScaler scaler_sub
Scaler used specifically for up/downsampling subsampled (chroma) planes.
Definition: swscale.h:306
sws_test_frame
int sws_test_frame(const AVFrame *frame, int output)
Helper function to run all sws_test_* against a frame, as well as testing the basic frame properties ...
Definition: format.c:643
SwsContext::dst_h
int dst_h
Width and height of the destination frame.
Definition: swscale.h:277
sws_freeFilter
void sws_freeFilter(SwsFilter *filter)
Definition: utils.c:2202
slice_start
static int slice_start(SliceContext *sc, VVCContext *s, VVCFrameContext *fc, const CodedBitstreamUnit *unit, const int is_first_slice)
Definition: dec.c:844
SWS_SCALE_GAUSSIAN
@ SWS_SCALE_GAUSSIAN
2-tap gaussian approximation
Definition: swscale.h:102
SWS_DITHER_ED
@ SWS_DITHER_ED
Definition: swscale.h:83
sws_receive_slice_alignment
unsigned int sws_receive_slice_alignment(const SwsContext *c)
Get the alignment required for slices.
Definition: swscale.c:1297
pixfmt.h
sws_frame_start
int sws_frame_start(SwsContext *c, AVFrame *dst, const AVFrame *src)
Initialize the scaling process for a given pair of source/destination frames.
Definition: swscale.c:1249
frame
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
Definition: filter_design.txt:265
SWS_BACKEND_C
@ SWS_BACKEND_C
Template-based C reference implementation.
Definition: swscale.h:116
SWS_FULL_CHR_H_INT
@ SWS_FULL_CHR_H_INT
Perform full chroma upsampling when upscaling to RGB.
Definition: swscale.h:156
sws_getContext
SwsContext * sws_getContext(int srcW, int srcH, enum AVPixelFormat srcFormat, int dstW, int dstH, enum AVPixelFormat dstFormat, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter, const double *param)
Allocate and return an SwsContext.
Definition: utils.c:1966
SWS_INTENT_RELATIVE_COLORIMETRIC
@ SWS_INTENT_RELATIVE_COLORIMETRIC
Relative colorimetric clipping.
Definition: swscale.h:214
SWS_DITHER_MAX_ENUM
@ SWS_DITHER_MAX_ENUM
Definition: swscale.h:87
SWS_DITHER_A_DITHER
@ SWS_DITHER_A_DITHER
Definition: swscale.h:84
SwsAlphaBlend
SwsAlphaBlend
Definition: swscale.h:88
sws_scale
int sws_scale(SwsContext *c, const uint8_t *const srcSlice[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[])
Scale the image slice in srcSlice and put the resulting scaled slice in the image in dst.
Definition: swscale.c:1586
SWS_NUM_SCALER_PARAMS
#define SWS_NUM_SCALER_PARAMS
Extra parameters for fine-tuning certain scalers.
Definition: swscale.h:247
SWS_PRINT_INFO
@ SWS_PRINT_INFO
Emit verbose log of scaling parameters.
Definition: swscale.h:143
SWS_SCALE_NB
@ SWS_SCALE_NB
not part of the ABI
Definition: swscale.h:106
SWS_BACKEND_UNSTABLE
@ SWS_BACKEND_UNSTABLE
Definition: swscale.h:122
SWS_SCALE_SPLINE
@ SWS_SCALE_SPLINE
unwindowned natural cubic spline
Definition: swscale.h:105
SWS_ERROR_DIFFUSION
@ SWS_ERROR_DIFFUSION
Set SwsContext.dither instead.
Definition: swscale.h:193
SWS_GAUSS
@ SWS_GAUSS
gaussian approximation
Definition: swscale.h:206
SWS_STRICT
@ SWS_STRICT
Return an error on underspecified conversions.
Definition: swscale.h:138
SwsIntent
SwsIntent
Definition: swscale.h:212
avutil.h
sws_getCoefficients
const int * sws_getCoefficients(int colorspace)
Return a pointer to yuv<->rgb coefficients for the given colorspace suitable for sws_setColorspaceDet...
Definition: yuv2rgb.c:61
SwsContext::dst_w
int dst_w
Definition: swscale.h:277
SwsContext::src_format
int src_format
Source pixel format.
Definition: swscale.h:278
swscale_version
unsigned swscale_version(void)
Definition: version.c:27
SwsContext::dst_range
int dst_range
Destination is full range.
Definition: swscale.h:281
SwsFilter::lumH
SwsVector * lumH
Definition: swscale.h:487
sws_free_context
void sws_free_context(SwsContext **ctx)
Free the context and everything associated with it, and write NULL to the provided pointer.
Definition: utils.c:2381
SwsContext::src_h_chr_pos
int src_h_chr_pos
Source horizontal chroma position.
Definition: swscale.h:283
SWS_SCALE_AREA
@ SWS_SCALE_AREA
area averaging
Definition: swscale.h:101
sws_scale_frame
int sws_scale_frame(SwsContext *c, AVFrame *dst, const AVFrame *src)
Scale source data from src and write the output to dst.
Definition: swscale.c:1380
SWS_ACCURATE_RND
@ SWS_ACCURATE_RND
Force bit-exact output.
Definition: swscale.h:179
SWS_LANCZOS
@ SWS_LANCZOS
3-tap sinc/sinc
Definition: swscale.h:208
sws_convertPalette8ToPacked32
void sws_convertPalette8ToPacked32(const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette)
Convert an 8-bit paletted frame into a frame with a color depth of 32 bits.
Definition: swscale_unscaled.c:2709
SwsContext::dst_v_chr_pos
int dst_v_chr_pos
Destination vertical chroma position.
Definition: swscale.h:284
SWS_SINC
@ SWS_SINC
unwindowed sinc
Definition: swscale.h:207
SwsContext
Main external API structure.
Definition: swscale.h:229
SwsFilter::chrH
SwsVector * chrH
Definition: swscale.h:489
av_warn_unused_result
#define av_warn_unused_result
Definition: attributes.h:93
sws_normalizeVec
void sws_normalizeVec(SwsVector *a, double height)
Scale all the coefficients of a so that their sum equals height.
Definition: utils.c:2094
SWS_UNSTABLE
@ SWS_UNSTABLE
Allow/prefer using experimental new code paths.
Definition: swscale.h:187
SwsContext::scaler_params
double scaler_params[SWS_NUM_SCALER_PARAMS]
Definition: swscale.h:248
src
#define src
Definition: vp8dsp.c:248
SWS_BACKEND_AARCH64
@ SWS_BACKEND_AARCH64
Chained AArch64 NEON kernels.
Definition: swscale.h:119
SWS_BACKEND_GLSL
@ SWS_BACKEND_GLSL
Vulkan GLSL backend.
Definition: swscale.h:121