Go to the documentation of this file.
37 static void error(
const char *err)
39 fprintf(stderr,
"%s", err);
80 static void mapres(
unsigned *r0,
unsigned *r1) {
81 double d = (
double)(*r0*10ll - 9ll*UINT32_MAX) / UINT32_MAX;
82 double a =
exp(d) * 16384 /
exp(1) ;
84 uint64_t maxb = 16384 / ai;
86 *r1 = 1 + (*r1 * maxb) / UINT32_MAX;
90 int srcW= 48, srcH = 48;
91 int dstW= 48, dstH = 48;
92 int srcHShift, srcVShift;
93 int dstHShift, dstVShift;
112 srcW = bytestream2_get_le32(&gbc);
113 srcH = bytestream2_get_le32(&gbc);
114 dstW = bytestream2_get_le32(&gbc);
115 dstH = bytestream2_get_le32(&gbc);
120 flags = bytestream2_get_le32(&gbc);
140 flags64 = bytestream2_get_le64(&gbc);
154 fprintf(stderr,
"%d x %d %s -> %d x %d %s\n", srcW, srcH, desc_src->
name, dstW, dstH, desc_dst->
name);
156 ret =
alloc_plane(
src, srcStride, srcW, srcH, srcFormat, &srcHShift, &srcVShift);
160 ret =
alloc_plane(
dst, dstStride, dstW, dstH, dstFormat, &dstHShift, &dstVShift);
166 int psize = srcStride[p] *
AV_CEIL_RSHIFT(srcH, (p == 1 || p == 2) ? srcVShift : 0);
178 error(
"Failed sws allocation");
void av_force_cpu_flags(int arg)
Disables cpu detection and forces the specified flags.
AVPixelFormat
Pixel format.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AV_VIDEO_MAX_PLANES
Maximum number of planes in any pixel format.
void sws_freeContext(SwsContext *swsContext)
Free the swscaler context swsContext.
static void free_plane(uint8_t *data[AV_VIDEO_MAX_PLANES])
@ SWS_BILINEAR
bilinear filtering
@ SWS_BICUBLIN
bicubic luma, bilinear chroma
@ AV_PIX_FMT_NB
number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of...
@ SWS_FAST_BILINEAR
Scaler selection options.
av_warn_unused_result int sws_init_context(SwsContext *sws_context, SwsFilter *srcFilter, SwsFilter *dstFilter)
Initialize the swscaler context sws_context.
int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift)
Utility function to access log2_chroma_w log2_chroma_h from the pixel format AVPixFmtDescriptor.
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width)
Fill plane linesizes for an image with pixel format pix_fmt and width width.
#define AV_CEIL_RSHIFT(a, b)
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
#define av_assert0(cond)
assert() equivalent, that is always enabled.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
static int alloc_plane(uint8_t *data[AV_VIDEO_MAX_PLANES], int stride[AV_VIDEO_MAX_PLANES], int w, int h, int format, int *hshift, int *vshift)
@ SWS_BICUBIC
2-tap cubic B-spline
int av_image_fill_plane_sizes(size_t sizes[4], enum AVPixelFormat pix_fmt, int height, const ptrdiff_t linesizes[4])
Fill plane sizes for an image with pixel format pix_fmt and height height.
int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags)
SwsContext * sws_alloc_context(void)
Allocate an empty SwsContext and set its fields to default values.
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
@ SWS_POINT
nearest neighbor
@ SWS_SPLINE
cubic Keys spline
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
static void error(const char *err)
static SwsContext * sws[3]
static av_always_inline av_const double round(double x)
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
static int vshift(enum AVPixelFormat fmt, int plane)
int attribute_align_arg sws_scale(SwsContext *sws, const uint8_t *const srcSlice[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[])
swscale wrapper, so we don't need to export the SwsContext.
@ SWS_GAUSS
gaussian approximation
static void mapres(unsigned *r0, unsigned *r1)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
#define flags(name, subs,...)
@ SWS_LANCZOS
3-tap sinc/sinc
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
@ SWS_SINC
unwindowed sinc
Main external API structure.