22#ifndef SWSCALE_SWSCALE_H
23#define SWSCALE_SWSCALE_H
38#ifndef HAVE_AV_CONFIG_H
243#define SWS_NUM_SCALER_PARAMS 2
447#define SWS_MAX_REDUCE_CUTOFF 0.002
453#define SWS_SRC_V_CHR_DROP_MASK 0x30000
454#define SWS_SRC_V_CHR_DROP_SHIFT 16
456#define SWS_PARAM_DEFAULT 123456
458#define SWS_CS_ITU709 1
460#define SWS_CS_ITU601 5
461#define SWS_CS_ITU624 5
462#define SWS_CS_SMPTE170M 5
463#define SWS_CS_SMPTE240M 7
464#define SWS_CS_DEFAULT 5
465#define SWS_CS_BT2020 9
554 SwsFilter *dstFilter,
const double *param);
584 const int srcStride[],
int srcSliceY,
int srcSliceH,
585 uint8_t *
const dst[],
const int dstStride[]);
638 unsigned int slice_height);
658 unsigned int slice_height);
685 int srcRange,
const int table[4],
int dstRange,
686 int brightness,
int contrast,
int saturation);
693 int *srcRange,
int **
table,
int *dstRange,
694 int *brightness,
int *contrast,
int *
saturation);
720 float lumaSharpen,
float chromaSharpen,
721 float chromaHShift,
float chromaVShift,
741 const double *param);
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static const char *const format[]
static AVFormatContext * ctx
Convenience header that includes libavutil's core.
#define flags(name, subs,...)
static IPT saturation(const CmsCtx *ctx, IPT ipt)
static enum AVPixelFormat pix_fmt
reference-counted frame API
int sws_test_transfer(enum AVColorTransferCharacteristic trc, int output)
Test if a given color transfer function is supported.
int sws_test_hw_format(enum AVPixelFormat format)
Test if a given hardware pixel format is supported by any backend, excluding unstable backends.
void sws_freeFilter(SwsFilter *filter)
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...
int sws_getColorspaceDetails(SwsContext *c, int **inv_table, int *srcRange, int **table, int *dstRange, int *brightness, int *contrast, int *saturation)
av_warn_unused_result int sws_init_context(SwsContext *sws_context, SwsFilter *srcFilter, SwsFilter *dstFilter)
Initialize the swscaler context sws_context.
int sws_test_colorspace(enum AVColorSpace colorspace, int output)
Test if a given color space is supported.
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.
int sws_scale_frame(SwsContext *c, AVFrame *dst, const AVFrame *src)
Scale source data from src and write the output to dst.
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...
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.
int sws_test_primaries(enum AVColorPrimaries primaries, int output)
Test if a given set of color primaries is supported.
int sws_is_noop(const AVFrame *dst, const AVFrame *src)
Check if a given conversion is a noop.
void sws_freeVec(SwsVector *a)
const char * swscale_license(void)
Return the libswscale license.
SwsFilter * sws_getDefaultFilter(float lumaGBlur, float chromaGBlur, float lumaSharpen, float chromaSharpen, float chromaHShift, float chromaVShift, int verbose)
int sws_isSupportedEndiannessConversion(enum AVPixelFormat pix_fmt)
SwsContext * sws_alloc_context(void)
Allocate an empty SwsContext and set its fields to default values.
unsigned int sws_receive_slice_alignment(const SwsContext *c)
Get the alignment required for slices.
void sws_free_context(SwsContext **ctx)
Free the context and everything associated with it, and write NULL to the provided pointer.
SwsVector * sws_allocVec(int length)
Allocate and return an uninitialized vector with length coefficients.
SwsVector * sws_getGaussianVec(double variance, double quality)
Return a normalized Gaussian curve used to filter stuff quality = 3 is high quality,...
const int * sws_getCoefficients(int colorspace)
Return a pointer to yuv<->rgb coefficients for the given colorspace suitable for sws_setColorspaceDet...
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.
const AVClass * sws_get_class(void)
Get the AVClass for SwsContext.
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.
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 ...
const char * swscale_configuration(void)
Return the libswscale build-time configuration.
void sws_normalizeVec(SwsVector *a, double height)
Scale all the coefficients of a so that their sum equals height.
int sws_test_format(enum AVPixelFormat format, int output)
Test if a given (software) pixel format is supported by any backend, excluding unstable backends.
int sws_frame_setup(SwsContext *ctx, const AVFrame *dst, const AVFrame *src)
Like sws_scale_frame, but without actually scaling.
unsigned swscale_version(void)
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.
void sws_frame_end(SwsContext *c)
Finish the scaling process for a pair of source/destination frames previously submitted with sws_fram...
void sws_freeContext(SwsContext *swsContext)
Free the swscaler context swsContext.
int sws_frame_start(SwsContext *c, AVFrame *dst, const AVFrame *src)
Initialize the scaling process for a given pair of source/destination frames.
void sws_scaleVec(SwsVector *a, double scalar)
Scale all the coefficients of a by the scalar value.
int sws_setColorspaceDetails(SwsContext *c, const int inv_table[4], int srcRange, const int table[4], int dstRange, int brightness, int contrast, int saturation)
@ SWS_INTENT_PERCEPTUAL
Perceptual tone mapping.
@ SWS_INTENT_ABSOLUTE_COLORIMETRIC
Absolute colorimetric clipping.
@ SWS_INTENT_RELATIVE_COLORIMETRIC
Relative colorimetric clipping.
@ SWS_INTENT_SATURATION
Saturation mapping.
@ SWS_INTENT_NB
not part of the ABI
@ SWS_ALPHA_BLEND_UNIFORM
@ SWS_ALPHA_BLEND_MAX_ENUM
@ SWS_ALPHA_BLEND_CHECKERBOARD
@ SWS_BACKEND_LEGACY
Legacy bespoke format-specific code.
@ SWS_BACKEND_MEMCPY
Fast path using libc memcpy() / memset()
@ SWS_BACKEND_AARCH64
Chained AArch64 NEON kernels.
@ SWS_BACKEND_X86
Chained x86 SIMD kernels.
@ SWS_BACKEND_C
Template-based C reference implementation.
@ SWS_BACKEND_MAX_ENUM
force size to 32 bits, not a valid backend
@ SWS_BACKEND_SPIRV
Vulkan SPIR-V backend.
@ SWS_SCALE_SPLINE
unwindowned natural cubic spline
@ SWS_SCALE_POINT
nearest neighbor (point sampling)
@ SWS_SCALE_NB
not part of the ABI
@ SWS_SCALE_LANCZOS
3-tap sinc/sinc
@ SWS_SCALE_BILINEAR
bilinear filtering
@ SWS_SCALE_GAUSSIAN
2-tap gaussian approximation
@ SWS_SCALE_BICUBIC
2-tap cubic BC-spline
@ SWS_SCALE_AREA
area averaging
@ SWS_SCALE_SINC
unwindowed sinc
@ SWS_SCALE_MAX_ENUM
force size to 32 bits, not a valid filter type
@ SWS_PRINT_INFO
Emit verbose log of scaling parameters.
@ SWS_SPLINE
unwindowed natural cubic spline
@ SWS_BICUBIC
2-tap cubic B-spline
@ SWS_STRICT
Return an error on underspecified conversions.
@ SWS_BICUBLIN
bicubic luma, bilinear chroma
@ SWS_ERROR_DIFFUSION
Set SwsContext.dither instead.
@ SWS_BILINEAR
bilinear filtering
@ SWS_UNSTABLE
Allow/prefer using experimental new code paths.
@ SWS_FULL_CHR_H_INP
Perform full chroma interpolation when downscaling RGB sources.
@ SWS_SINC
unwindowed sinc
@ SWS_LANCZOS
3-tap sinc/sinc
@ SWS_DIRECT_BGR
Deprecated flags.
@ SWS_GAUSS
gaussian approximation
@ SWS_FAST_BILINEAR
Scaler selection options.
@ SWS_ACCURATE_RND
Force bit-exact output.
@ SWS_POINT
nearest neighbor
@ SWS_FULL_CHR_H_INT
Perform full chroma upsampling when upscaling to RGB.
#define av_warn_unused_result
#define sws_isSupportedOutput(x)
#define sws_isSupportedInput(x)
AVPixelFormat
Pixel format.
AVColorPrimaries
Chromaticity coordinates of the source primaries.
AVColorTransferCharacteristic
Color Transfer Characteristic.
AVColorSpace
YUV colorspace type.
static const uint16_t table[]
Describe the class of an AVClass context structure.
This structure describes decoded (raw) audio or video data.
Main external API structure.
int src_h
Width and height of the source frame.
int dst_format
Destination pixel format.
int intent
Desired ICC intent for color space conversions.
int gamma_flag
Use gamma correct scaling.
int threads
How many threads to use for processing, or 0 for automatic selection.
SwsScaler scaler
Scaling filter.
int dst_h
Width and height of the destination frame.
SwsAlphaBlend alpha_blend
Alpha blending mode.
double scaler_params[SWS_NUM_SCALER_PARAMS]
SwsBackend backends
Bitmask of SWS_BACKEND_*.
int dst_h_chr_pos
Destination horizontal chroma position.
void * opaque
Private data of the user, can be used to carry app specific stuff.
SwsScaler scaler_sub
Scaler used specifically for up/downsampling subsampled (chroma) planes.
int src_w
Deprecated frame property overrides, for the legacy API only.
int src_format
Source pixel format.
int src_v_chr_pos
Source vertical chroma position in luma grid / 256.
int dst_v_chr_pos
Destination vertical chroma position.
SwsDither dither
Dither mode.
int dst_range
Destination is full range.
unsigned flags
Bitmask of SWS_*.
int src_range
Source is full range.
int src_h_chr_pos
Source horizontal chroma position.
double * coeff
pointer to the list of coefficients
int length
number of coefficients in the vector
#define SWS_NUM_SCALER_PARAMS
Extra parameters for fine-tuning certain scalers.
void(* filter)(uint8_t *src, ptrdiff_t stride, int qscale)
static const uint8_t quality[]
static int slice_start(SliceContext *sc, VVCContext *s, VVCFrameContext *fc, const CodedBitstreamUnit *unit, const int is_first_slice)