26 for (i = 0; i < 2; ++
i) {
29 for (j = 0; j < n; ++j) {
36 for (i = 0; i < 4; ++
i)
53 for (i = 0; i < 2; ++
i) {
59 for (j = 0; j < n; ++j) {
81 int size[4] = { lumLines,
92 for (i = 0; i < 4; ++
i) {
93 int n = size[
i] * ( ring == 0 ? 1 : 3);
112 for (i = 0; i < 4; ++
i) {
123 for (i = 0; i < 4; i+=3) {
134 for (i = 1; i < 3; ++
i) {
151 const int start[4] = {lumY,
156 const int end[4] = {lumY +lumH,
163 for (i = 0; i < 4 && src[
i] !=
NULL; ++
i) {
164 uint8_t *
const src_i = src[
i] + (relative ? 0 : start[
i]) * stride[i];
168 int lines = end[
i] - start[
i];
169 int tot_lines = end[
i] -
first;
171 if (start[i] >= first && n >= tot_lines) {
173 for (j = 0; j < lines; j+= 1)
174 s->
plane[i].
line[start[i] - first + j] = src_i + j * stride[i];
177 lines = lines > n ? n : lines;
179 for (j = 0; j < lines; j+= 1)
180 s->
plane[i].
line[j] = src_i + j * stride[i];
190 int i, j, k,
size, end;
192 for (i = 0; i < 4; ++
i) {
194 for (j = 0; j <
size; ++j) {
197 for (k = 0; k < end; ++k)
199 }
else if (bpc == 32) {
201 for (k = 0; k < end; ++k)
202 ((int64_t*)(s->
plane[
i].
line[j]))[k] = 1LL<<34;
205 for (k = 0; k < end; ++k)
230 *out_lum_size = lumFilterSize;
231 *out_chr_size = chrFilterSize;
233 for (lumY = 0; lumY < dstH; lumY++) {
234 int chrY = (int64_t)lumY * chrDstH / dstH;
235 int nextSlice =
FFMAX(lumFilterPos[lumY] + lumFilterSize - 1,
236 ((chrFilterPos[chrY] + chrFilterSize - 1)
239 nextSlice >>= chrSubSample;
240 nextSlice <<= chrSubSample;
241 (*out_lum_size) =
FFMAX((*out_lum_size), nextSlice - lumFilterPos[lumY]);
242 (*out_chr_size) =
FFMAX((*out_chr_size), (nextSlice >> chrSubSample) - chrFilterPos[chrY]);
259 int dst_stride =
FFALIGN(c->
dstW *
sizeof(int16_t) + 66, 16);
277 num_ydesc = need_lum_conv ? 2 : 1;
278 num_cdesc = need_chr_conv ? 2 : 1;
281 c->
numDesc = num_ydesc + num_cdesc + num_vdesc + (need_gamma ? 2 : 0);
282 c->
descIndex[0] = num_ydesc + (need_gamma ? 1 : 0);
283 c->
descIndex[1] = num_ydesc + num_cdesc + (need_gamma ? 1 : 0);
333 dstIdx =
FFMAX(num_ydesc, num_cdesc);
350 dstIdx =
FFMAX(num_ydesc, num_cdesc);
int ff_init_gamma_convert(SwsFilterDescriptor *desc, SwsSlice *src, uint16_t *table)
initializes gamma conversion descriptor
int ff_init_desc_fmt_convert(SwsFilterDescriptor *desc, SwsSlice *src, SwsSlice *dst, uint32_t *pal)
initializes lum pixel format conversion descriptor
int chrSrcH
Height of source chroma planes.
int ff_free_filters(SwsContext *c)
int ff_init_slice_from_src(SwsSlice *s, uint8_t *src[4], int stride[4], int srcW, int lumY, int lumH, int chrY, int chrH, int relative)
int h_chr_sub_sample
horizontal chroma subsampling factor
Struct which holds all necessary data for processing a slice.
void(* chrToYV12)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, int width, uint32_t *pal)
Unscaled conversion of chroma planes to YV12 for horizontal scaler.
void(* alpToYV12)(uint8_t *dst, const uint8_t *src, const uint8_t *src2, const uint8_t *src3, int width, uint32_t *pal)
Unscaled conversion of alpha plane to YV12 for horizontal scaler.
static void free_lines(SwsSlice *s)
int srcH
Height of source luma/alpha planes.
int ff_rotate_slice(SwsSlice *s, int lum, int chr)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static void get_min_buffer_size(SwsContext *c, int *out_lum_size, int *out_chr_size)
int chrDstVSubSample
Binary logarithm of vertical subsampling factor between luma/alpha and chroma planes in destination i...
uint8_t ** line
line buffer
int alpha
Flag for processing alpha channel.
int vChrFilterSize
Vertical filter size for chroma pixels.
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
int v_chr_sub_sample
vertical chroma subsampling factor
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But first
enum AVPixelFormat dstFormat
Destination pixel format.
int ff_init_desc_no_chr(SwsFilterDescriptor *desc, SwsSlice *src, SwsSlice *dst)
int chrSrcHSubSample
Binary logarithm of horizontal subsampling factor between luma/alpha and chroma planes in source imag...
int32_t * vChrFilterPos
Array of vertical filter starting positions for each dst[i] for chroma planes.
int dstH
Height of destination luma/alpha planes.
int ff_init_desc_cfmt_convert(SwsFilterDescriptor *desc, SwsSlice *src, SwsSlice *dst, uint32_t *pal)
initializes chr pixel format conversion descriptor
int32_t * hChrFilterPos
Array of horizontal filter starting positions for each dst[i] for chroma planes.
int hLumFilterSize
Horizontal filter size for luma/alpha pixels.
static int alloc_lines(SwsSlice *s, int size, int width)
int ff_init_vscale(SwsContext *c, SwsFilterDescriptor *desc, SwsSlice *src, SwsSlice *dst)
initializes vertical scaling descriptors
SwsPlane plane[MAX_SLICE_PLANES]
color planes
static int alloc_slice(SwsSlice *s, enum AVPixelFormat fmt, int lumLines, int chrLines, int h_sub_sample, int v_sub_sample, int ring)
int32_t * hLumFilterPos
Array of horizontal filter starting positions for each dst[i] for luma/alpha planes.
int hChrFilterSize
Horizontal filter size for chroma pixels.
int sliceH
number of lines
int ff_init_desc_hscale(SwsFilterDescriptor *desc, SwsSlice *src, SwsSlice *dst, uint16_t *filter, int *filter_pos, int filter_size, int xInc)
initializes lum horizontal scaling descriptor
static double lum(void *priv, double x, double y, int plane)
void(* readChrPlanar)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src[4], int width, int32_t *rgb2yuv)
static void fill_ones(SwsSlice *s, int n, int bpc)
int ff_init_desc_chscale(SwsFilterDescriptor *desc, SwsSlice *src, SwsSlice *dst, uint16_t *filter, int *filter_pos, int filter_size, int xInc)
initializes chr horizontal scaling descriptor
int available_lines
max number of lines that can be hold by this plane
struct SwsFilterDescriptor * desc
int dstW
Width of destination luma/alpha planes.
int needs_hcscale
Set if there are chroma planes to be converted.
int32_t * vLumFilterPos
Array of vertical filter starting positions for each dst[i] for luma/alpha planes.
int should_free_lines
flag to identify if there are dynamic allocated lines
int is_ring
flag to identify if this slice is a ring buffer
void(* readAlpPlanar)(uint8_t *dst, const uint8_t *src[4], int width, int32_t *rgb2yuv)
int width
Slice line width.
int chrDstH
Height of destination chroma planes.
Struct which defines a slice of an image to be scaled or an output for a scaled slice.
int vLumFilterSize
Vertical filter size for luma/alpha pixels.
static av_always_inline int isPlanarYUV(enum AVPixelFormat pix_fmt)
static void free_slice(SwsSlice *s)
void * instance
Filter instance data.
int ff_init_filters(SwsContext *c)
int16_t * hLumFilter
Array of horizontal filter coefficients for luma/alpha planes.
GLint GLenum GLboolean GLsizei stride
enum AVPixelFormat srcFormat
Source pixel format.
enum AVPixelFormat fmt
planes pixel format
void(* readLumPlanar)(uint8_t *dst, const uint8_t *src[4], int width, int32_t *rgb2yuv)
Functions to read planar input, such as planar RGB, and convert internally to Y/UV/A.
uint8_t ** tmp
Tmp line buffer used by mmx code.
void(* lumToYV12)(uint8_t *dst, const uint8_t *src, const uint8_t *src2, const uint8_t *src3, int width, uint32_t *pal)
Unscaled conversion of luma plane to YV12 for horizontal scaler.
int32_t input_rgb2yuv_table[16+40 *4]
static av_always_inline int usePal(enum AVPixelFormat pix_fmt)
int16_t * hChrFilter
Array of horizontal filter coefficients for chroma planes.
int sliceY
index of first line
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 they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Frame references ownership and permissions
int chrDstHSubSample
Binary logarithm of horizontal subsampling factor between luma/alpha and chroma planes in destination...
int srcW
Width of source luma/alpha planes.
int chrSrcVSubSample
Binary logarithm of vertical subsampling factor between luma/alpha and chroma planes in source image...
AVPixelFormat
Pixel format.
static av_cold void cleanup(FlashSV2Context *s)
void * av_mallocz_array(size_t nmemb, size_t size)