Go to the documentation of this file.
44 int dstW =
desc->dst->width;
47 int sp =
first -
desc->src->plane[0].sliceY;
48 int dp = sliceY -
desc->dst->plane[0].sliceY;
49 uint8_t **
src =
desc->src->plane[0].line + sp;
50 uint8_t **
dst =
desc->dst->plane[0].line + dp;
59 int sp =
first -
desc->src->plane[3].sliceY;
60 int dp = sliceY -
desc->dst->plane[3].sliceY;
61 uint8_t **
src =
desc->src->plane[3].line + sp;
62 uint8_t **
dst =
desc->dst->plane[3].line + dp;
76 const int chrSkipMask = (1 <<
desc->dst->v_chr_sub_sample) - 1;
77 if (sliceY & chrSkipMask)
82 int chrSliceY = sliceY >>
desc->dst->v_chr_sub_sample;
85 int sp1 =
first -
desc->src->plane[1].sliceY;
86 int sp2 =
first -
desc->src->plane[2].sliceY;
87 int dp1 = chrSliceY -
desc->dst->plane[1].sliceY;
88 int dp2 = chrSliceY -
desc->dst->plane[2].sliceY;
89 uint8_t **
src1 =
desc->src->plane[1].line + sp1;
90 uint8_t **
src2 =
desc->src->plane[2].line + sp2;
91 uint8_t **dst1 =
desc->dst->plane[1].line + dp1;
92 uint8_t **dst2 =
desc->dst->plane[2].line + dp2;
112 int dstW =
desc->dst->width;
113 int chrSliceY = sliceY >>
desc->dst->v_chr_sub_sample;
117 uint16_t *lum_filter = inst[0].
filter[0];
118 uint16_t *chr_filter = inst[1].
filter[0];
120 int firstLum =
FFMAX(1-lum_fsize, inst[0].filter_pos[ sliceY]);
121 int firstChr =
FFMAX(1-chr_fsize, inst[1].filter_pos[chrSliceY]);
123 int sp0 = firstLum -
desc->src->plane[0].sliceY;
124 int sp1 = firstChr -
desc->src->plane[1].sliceY;
125 int sp2 = firstChr -
desc->src->plane[2].sliceY;
126 int sp3 = firstLum -
desc->src->plane[3].sliceY;
127 int dp = sliceY -
desc->dst->plane[0].sliceY;
128 uint8_t **
src0 =
desc->src->plane[0].line + sp0;
129 uint8_t **
src1 =
desc->src->plane[1].line + sp1;
130 uint8_t **
src2 =
desc->src->plane[2].line + sp2;
131 uint8_t **src3 =
desc->alpha ?
desc->src->plane[3].line + sp3 :
NULL;
132 uint8_t **
dst =
desc->dst->plane[0].line + dp;
135 if (
c->yuv2packed1 && lum_fsize == 1 && chr_fsize == 1) {
137 (
const int16_t*)(
desc->alpha ? *src3 :
NULL), *
dst, dstW, 0, sliceY);
138 }
else if (
c->yuv2packed1 && lum_fsize == 1 && chr_fsize == 2 &&
139 chr_filter[2 * chrSliceY + 1] + chr_filter[2 * chrSliceY] == 4096 &&
140 chr_filter[2 * chrSliceY + 1] <= 4096
U) {
141 int chrAlpha = chr_filter[2 * chrSliceY + 1];
143 (
const int16_t*)(
desc->alpha ? *src3 :
NULL), *
dst, dstW, chrAlpha, sliceY);
144 }
else if (
c->yuv2packed2 && lum_fsize == 2 && chr_fsize == 2 &&
145 lum_filter[2 * sliceY + 1] + lum_filter[2 * sliceY] == 4096 &&
146 lum_filter[2 * sliceY + 1] <= 4096
U &&
147 chr_filter[2 * chrSliceY + 1] + chr_filter[2 * chrSliceY] == 4096 &&
148 chr_filter[2 * chrSliceY + 1] <= 4096
U
150 int lumAlpha = lum_filter[2 * sliceY + 1];
151 int chrAlpha = chr_filter[2 * chrSliceY + 1];
153 c->lumMmxFilter[3] = lum_filter[2 * sliceY] * 0x10001;
155 c->chrMmxFilter[3] = chr_filter[2 * chrSliceY] * 0x10001;
157 *
dst, dstW, lumAlpha, chrAlpha, sliceY);
159 if ((
c->yuv2packed1 && lum_fsize == 1 && chr_fsize == 2) ||
160 (
c->yuv2packed2 && lum_fsize == 2 && chr_fsize == 2)) {
161 if (!
c->warned_unuseable_bilinear)
163 c->warned_unuseable_bilinear = 1;
167 (
const int16_t**)
src0, lum_fsize, chr_filter + chrSliceY * chr_fsize,
168 (
const int16_t**)
src1, (
const int16_t**)
src2, chr_fsize, (
const int16_t**)src3, *
dst, dstW, sliceY);
176 int dstW =
desc->dst->width;
177 int chrSliceY = sliceY >>
desc->dst->v_chr_sub_sample;
181 uint16_t *lum_filter = inst[0].
filter[0];
182 uint16_t *chr_filter = inst[1].
filter[0];
184 int firstLum =
FFMAX(1-lum_fsize, inst[0].filter_pos[ sliceY]);
185 int firstChr =
FFMAX(1-chr_fsize, inst[1].filter_pos[chrSliceY]);
187 int sp0 = firstLum -
desc->src->plane[0].sliceY;
188 int sp1 = firstChr -
desc->src->plane[1].sliceY;
189 int sp2 = firstChr -
desc->src->plane[2].sliceY;
190 int sp3 = firstLum -
desc->src->plane[3].sliceY;
191 int dp0 = sliceY -
desc->dst->plane[0].sliceY;
192 int dp1 = chrSliceY -
desc->dst->plane[1].sliceY;
193 int dp2 = chrSliceY -
desc->dst->plane[2].sliceY;
194 int dp3 = sliceY -
desc->dst->plane[3].sliceY;
196 uint8_t **
src0 =
desc->src->plane[0].line + sp0;
197 uint8_t **
src1 =
desc->src->plane[1].line + sp1;
198 uint8_t **
src2 =
desc->src->plane[2].line + sp2;
199 uint8_t **src3 =
desc->alpha ?
desc->src->plane[3].line + sp3 :
NULL;
200 uint8_t *
dst[4] = {
desc->dst->plane[0].line[dp0],
201 desc->dst->plane[1].line[dp1],
202 desc->dst->plane[2].line[dp2],
207 (
const int16_t**)
src0, lum_fsize, chr_filter + sliceY * chr_fsize,
208 (
const int16_t**)
src1, (
const int16_t**)
src2, chr_fsize, (
const int16_t**)src3,
dst, dstW, sliceY);
226 desc[0].instance = lumCtx;
229 desc[0].alpha =
c->needAlpha;
236 desc[1].instance = chrCtx;
247 desc[0].instance = lumCtx;
250 desc[0].alpha =
c->needAlpha;
254 c->yuv2packed1,
c->yuv2packed2,
c->yuv2packedX,
c->yuv2anyX,
c->use_mmx_vfilter);
269 int idx =
c->numDesc - (
c->is_internal_gamma ? 2 : 1);
273 chrCtx =
c->desc[idx].instance;
275 chrCtx->
filter[0] = use_mmx ? (int16_t*)
c->chrMmxFilter :
c->vChrFilter;
278 chrCtx->
isMMX = use_mmx;
286 lumCtx =
c->desc[idx].instance;
288 lumCtx->
filter[0] = use_mmx ? (int16_t*)
c->lumMmxFilter :
c->vLumFilter;
289 lumCtx->
filter[1] = use_mmx ? (int16_t*)
c->alpMmxFilter :
c->vLumFilter;
292 lumCtx->
isMMX = use_mmx;
298 lumCtx =
c->desc[idx].instance;
301 lumCtx->
filter[0] =
c->vLumFilter;
305 chrCtx->
filter[0] =
c->vChrFilter;
309 lumCtx->
isMMX = use_mmx;
310 chrCtx->
isMMX = use_mmx;
313 if (
c->yuv2packed1 &&
c->vLumFilterSize == 1 &&
c->vChrFilterSize <= 2)
315 else if (
c->yuv2packed2 &&
c->vLumFilterSize == 2 &&
c->vChrFilterSize == 2)
void(* yuv2planar1_fn)(const int16_t *src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
Write one line of horizontally scaled data to planar output without any additional vertical scaling (...
static int lum_planar_vscale(SwsInternal *c, SwsFilterDescriptor *desc, int sliceY, int sliceH)
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 ff_init_vscale(SwsInternal *c, SwsFilterDescriptor *desc, SwsSlice *src, SwsSlice *dst)
initializes vertical scaling descriptors
Struct which holds all necessary data for processing a slice.
static void FUNC() yuv2planeX(const int16_t *filter, int filterSize, const int16_t **src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
yuv2planar1_fn yuv2planar1
void(* filter)(uint8_t *src, int stride, int qscale)
static int any_vscale(SwsInternal *c, SwsFilterDescriptor *desc, int sliceY, int sliceH)
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But first
void ff_init_vscale_pfn(SwsInternal *c, yuv2planar1_fn yuv2plane1, yuv2planarX_fn yuv2planeX, yuv2interleavedX_fn yuv2nv12cX, yuv2packed1_fn yuv2packed1, yuv2packed2_fn yuv2packed2, yuv2packedX_fn yuv2packedX, yuv2anyX_fn yuv2anyX, int use_mmx)
setup vertical scaler functions
void(* yuv2packed2_fn)(SwsInternal *c, const int16_t *lumSrc[2], const int16_t *chrUSrc[2], const int16_t *chrVSrc[2], const int16_t *alpSrc[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y)
Write one line of horizontally scaled Y/U/V/A to packed-pixel YUV/RGB output by doing bilinear scalin...
union VScalerContext::@461 pfn
#define AV_CEIL_RSHIFT(a, b)
yuv2planarX_fn yuv2planarX
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
void(* yuv2packedX_fn)(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, int dstW, int y)
Write one line of horizontally scaled Y/U/V/A to packed-pixel YUV/RGB output by doing multi-point ver...
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
yuv2packedX_fn yuv2packedX
yuv2packed2_fn yuv2packed2
#define AV_LOG_INFO
Standard information.
void(* yuv2anyX_fn)(SwsInternal *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t **dest, int dstW, int y)
Write one line of horizontally scaled Y/U/V/A to YUV/RGB output by doing multi-point vertical scaling...
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
void(* yuv2interleavedX_fn)(enum AVPixelFormat dstFormat, const uint8_t *chrDither, const int16_t *chrFilter, int chrFilterSize, const int16_t **chrUSrc, const int16_t **chrVSrc, uint8_t *dest, int dstW)
Write one line of horizontally scaled chroma to interleaved output with multi-point vertical scaling ...
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Struct which defines a slice of an image to be scaled or an output for a scaled slice.
void * av_calloc(size_t nmemb, size_t size)
void(* yuv2packed1_fn)(SwsInternal *c, const int16_t *lumSrc, const int16_t *chrUSrc[2], const int16_t *chrVSrc[2], const int16_t *alpSrc, uint8_t *dest, int dstW, int uvalpha, int y)
Write one line of horizontally scaled Y/U/V/A to packed-pixel YUV/RGB output without any additional v...
static int packed_vscale(SwsInternal *c, SwsFilterDescriptor *desc, int sliceY, int sliceH)
void(* yuv2planarX_fn)(const int16_t *filter, int filterSize, const int16_t **src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
Write one line of horizontally scaled data to planar output with multi-point vertical scaling between...
static av_always_inline int isPlanarYUV(enum AVPixelFormat pix_fmt)
static int chr_planar_vscale(SwsInternal *c, SwsFilterDescriptor *desc, int sliceY, int sliceH)
yuv2interleavedX_fn yuv2interleavedX
yuv2packed1_fn yuv2packed1
static av_always_inline int isALPHA(enum AVPixelFormat pix_fmt)