37static void error(
const char *err)
39 fprintf(stderr,
"%s", err);
80static 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);
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");
194 sws_scale(sws, (
const uint8_t *
const*)
src, srcStride, 0, srcH,
dst, dstStride);
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static const char *const format[]
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
#define flags(name, subs,...)
#define AV_CEIL_RSHIFT(a, b)
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...
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_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.
av_warn_unused_result int sws_init_context(SwsContext *sws_context, SwsFilter *srcFilter, SwsFilter *dstFilter)
Initialize the swscaler context sws_context.
SwsContext * sws_alloc_context(void)
Allocate an empty SwsContext and set its fields to default values.
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.
void sws_freeContext(SwsContext *swsContext)
Free the swscaler context swsContext.
@ SWS_SPLINE
unwindowed natural cubic spline
@ SWS_BICUBIC
2-tap cubic B-spline
@ SWS_BICUBLIN
bicubic luma, bilinear chroma
@ SWS_BILINEAR
bilinear filtering
@ SWS_SINC
unwindowed sinc
@ SWS_LANCZOS
3-tap sinc/sinc
@ SWS_GAUSS
gaussian approximation
@ SWS_FAST_BILINEAR
Scaler selection options.
@ SWS_POINT
nearest neighbor
int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags)
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
void av_force_cpu_flags(int arg)
Disables cpu detection and forces the specified flags.
static av_always_inline av_const double round(double x)
static const uint16_t mask[17]
Memory handling functions.
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.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AV_VIDEO_MAX_PLANES
Maximum number of planes in any pixel format.
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_NB
number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of...
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Main external API structure.
static void mapres(unsigned *r0, unsigned *r1)
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
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)
static void error(const char *err)
static void free_plane(uint8_t *data[AV_VIDEO_MAX_PLANES])