Go to the documentation of this file.
22 #ifndef SWSCALE_SWSCALE_H
23 #define SWSCALE_SWSCALE_H
38 #ifndef HAVE_AV_CONFIG_H
150 #define SWS_FAST_BILINEAR 1
151 #define SWS_BILINEAR 2
152 #define SWS_BICUBIC 4
154 #define SWS_POINT 0x10
155 #define SWS_AREA 0x20
156 #define SWS_BICUBLIN 0x40
157 #define SWS_GAUSS 0x80
158 #define SWS_SINC 0x100
159 #define SWS_LANCZOS 0x200
160 #define SWS_SPLINE 0x400
162 #define SWS_SRC_V_CHR_DROP_MASK 0x30000
163 #define SWS_SRC_V_CHR_DROP_SHIFT 16
165 #define SWS_PARAM_DEFAULT 123456
167 #define SWS_PRINT_INFO 0x1000
182 #define SWS_FULL_CHR_H_INT 0x2000
195 #define SWS_FULL_CHR_H_INP 0x4000
197 #define SWS_DIRECT_BGR 0x8000
199 #define SWS_ACCURATE_RND 0x40000
200 #define SWS_BITEXACT 0x80000
201 #define SWS_ERROR_DIFFUSION 0x800000
203 #define SWS_MAX_REDUCE_CUTOFF 0.002
205 #define SWS_CS_ITU709 1
207 #define SWS_CS_ITU601 5
208 #define SWS_CS_ITU624 5
209 #define SWS_CS_SMPTE170M 5
210 #define SWS_CS_SMPTE240M 7
211 #define SWS_CS_DEFAULT 5
212 #define SWS_CS_BT2020 9
296 SwsFilter *dstFilter,
const double *param);
325 const int srcStride[],
int srcSliceY,
int srcSliceH,
326 uint8_t *
const dst[],
const int dstStride[]);
396 unsigned int slice_height);
416 unsigned int slice_height);
442 int srcRange,
const int table[4],
int dstRange,
443 int brightness,
int contrast,
int saturation);
450 int *srcRange,
int **
table,
int *dstRange,
451 int *brightness,
int *contrast,
int *saturation);
477 float lumaSharpen,
float chromaSharpen,
478 float chromaHShift,
float chromaVShift,
498 const double *param);
int sws_setColorspaceDetails(SwsContext *c, const int inv_table[4], int srcRange, const int table[4], int dstRange, int brightness, int contrast, int saturation)
AVPixelFormat
Pixel format.
AVColorTransferCharacteristic
Color Transfer Characteristic.
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
void sws_freeContext(SwsContext *swsContext)
Free the swscaler context swsContext.
This structure describes decoded (raw) audio or video data.
int sws_test_primaries(enum AVColorPrimaries primaries, int output)
Test if a given set of color primaries is supported.
static const uint16_t table[]
void(* filter)(uint8_t *src, int stride, int qscale)
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...
AVColorPrimaries
Chromaticity coordinates of the source primaries.
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.
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about quality
void sws_freeVec(SwsVector *a)
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 char * swscale_license(void)
Return the libswscale license.
av_warn_unused_result int sws_init_context(SwsContext *sws_context, SwsFilter *srcFilter, SwsFilter *dstFilter)
Initialize the swscaler context sws_context.
const AVClass * sws_get_class(void)
Get the AVClass for swsContext.
struct SwsContext SwsContext
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample format(the sample packing is implied by the sample format) and sample rate. The lists are not just lists
static enum AVPixelFormat pix_fmt
int length
number of coefficients in the vector
SwsVector * sws_allocVec(int length)
Allocate and return an uninitialized vector with length coefficients.
int sws_test_colorspace(enum AVColorSpace colorspace, int output)
Test if a given color space is supported.
SwsVector * sws_getGaussianVec(double variance, double quality)
Return a normalized Gaussian curve used to filter stuff quality = 3 is high quality,...
void sws_frame_end(SwsContext *c)
Finish the scaling process for a pair of source/destination frames previously submitted with sws_fram...
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
Describe the class of an AVClass context structure.
int sws_is_noop(const AVFrame *dst, const AVFrame *src)
Check if a given conversion is a noop.
SwsFilter * sws_getDefaultFilter(float lumaGBlur, float chromaGBlur, float lumaSharpen, float chromaSharpen, float chromaHShift, float chromaVShift, int verbose)
int sws_test_format(enum AVPixelFormat format, int output)
Test if a given pixel format is supported.
double * coeff
pointer to the list of coefficients
void sws_scaleVec(SwsVector *a, double scalar)
Scale all the coefficients of a by the scalar value.
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
SwsContext * sws_alloc_context(void)
Allocate an empty SwsContext.
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
int sws_getColorspaceDetails(SwsContext *c, int **inv_table, int *srcRange, int **table, int *dstRange, int *brightness, int *contrast, int *saturation)
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
int sws_test_transfer(enum AVColorTransferCharacteristic trc, int output)
Test if a given color transfer function is supported.
const char * swscale_configuration(void)
Return the libswscale build-time configuration.
int sws_isSupportedInput(enum AVPixelFormat pix_fmt)
Return a positive value if pix_fmt is a supported input format, 0 otherwise.
#define av_warn_unused_result
int sws_isSupportedEndiannessConversion(enum AVPixelFormat pix_fmt)
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...
AVColorSpace
YUV colorspace type.
int sws_isSupportedOutput(enum AVPixelFormat pix_fmt)
Return a positive value if pix_fmt is a supported output format, 0 otherwise.
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 ...
void sws_freeFilter(SwsFilter *filter)
static int slice_start(SliceContext *sc, VVCContext *s, VVCFrameContext *fc, const CodedBitstreamUnit *unit, const int is_first_slice)
unsigned int sws_receive_slice_alignment(const SwsContext *c)
Get the alignment required for slices.
int sws_frame_start(SwsContext *c, AVFrame *dst, const AVFrame *src)
Initialize the scaling process for a given pair of source/destination frames.
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
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.
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.
const int * sws_getCoefficients(int colorspace)
Return a pointer to yuv<->rgb coefficients for the given colorspace suitable for sws_setColorspaceDet...
unsigned swscale_version(void)
void sws_free_context(SwsContext **ctx)
Free the context and everything associated with it, and write NULL to the provided pointer.
#define flags(name, subs,...)
int sws_scale_frame(SwsContext *c, AVFrame *dst, const AVFrame *src)
Scale source data from src and write the output to dst.
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.
void sws_normalizeVec(SwsVector *a, double height)
Scale all the coefficients of a so that their sum equals height.