Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'libswscale/vscale.c')
-rw-r--r--libswscale/vscale.c51
1 files changed, 29 insertions, 22 deletions
diff --git a/libswscale/vscale.c b/libswscale/vscale.c
index 72352dedb3..9ed227e908 100644
--- a/libswscale/vscale.c
+++ b/libswscale/vscale.c
@@ -25,7 +25,14 @@ typedef struct VScalerContext
int32_t *filter_pos;
int filter_size;
int isMMX;
- void *pfn;
+ union {
+ yuv2planar1_fn yuv2planar1;
+ yuv2planarX_fn yuv2planarX;
+ yuv2interleavedX_fn yuv2interleavedX;
+ yuv2packed1_fn yuv2packed1;
+ yuv2packed2_fn yuv2packed2;
+ yuv2anyX_fn yuv2anyX;
+ } pfn;
yuv2packedX_fn yuv2packedX;
} VScalerContext;
@@ -43,9 +50,9 @@ static int lum_planar_vscale(SwsContext *c, SwsFilterDescriptor *desc, int slice
uint16_t *filter = inst->filter[0] + (inst->isMMX ? 0 : sliceY * inst->filter_size);
if (inst->filter_size == 1)
- ((yuv2planar1_fn)inst->pfn)((const int16_t*)src[0], dst[0], dstW, c->lumDither8, 0);
+ inst->pfn.yuv2planar1((const int16_t*)src[0], dst[0], dstW, c->lumDither8, 0);
else
- ((yuv2planarX_fn)inst->pfn)(filter, inst->filter_size, (const int16_t**)src, dst[0], dstW, c->lumDither8, 0);
+ inst->pfn.yuv2planarX(filter, inst->filter_size, (const int16_t**)src, dst[0], dstW, c->lumDither8, 0);
if (desc->alpha) {
int sp = first - desc->src->plane[3].sliceY;
@@ -55,9 +62,9 @@ static int lum_planar_vscale(SwsContext *c, SwsFilterDescriptor *desc, int slice
uint16_t *filter = inst->filter[1] + (inst->isMMX ? 0 : sliceY * inst->filter_size);
if (inst->filter_size == 1)
- ((yuv2planar1_fn)inst->pfn)((const int16_t*)src[0], dst[0], dstW, c->lumDither8, 0);
+ inst->pfn.yuv2planar1((const int16_t*)src[0], dst[0], dstW, c->lumDither8, 0);
else
- ((yuv2planarX_fn)inst->pfn)(filter, inst->filter_size, (const int16_t**)src, dst[0], dstW, c->lumDither8, 0);
+ inst->pfn.yuv2planarX(filter, inst->filter_size, (const int16_t**)src, dst[0], dstW, c->lumDither8, 0);
}
return 1;
@@ -85,13 +92,13 @@ static int chr_planar_vscale(SwsContext *c, SwsFilterDescriptor *desc, int slice
uint16_t *filter = inst->filter[0] + (inst->isMMX ? 0 : chrSliceY * inst->filter_size);
if (c->yuv2nv12cX) {
- ((yuv2interleavedX_fn)inst->pfn)(c, filter, inst->filter_size, (const int16_t**)src1, (const int16_t**)src2, dst1[0], dstW);
+ inst->pfn.yuv2interleavedX(c, filter, inst->filter_size, (const int16_t**)src1, (const int16_t**)src2, dst1[0], dstW);
} else if (inst->filter_size == 1) {
- ((yuv2planar1_fn)inst->pfn)((const int16_t*)src1[0], dst1[0], dstW, c->chrDither8, 0);
- ((yuv2planar1_fn)inst->pfn)((const int16_t*)src2[0], dst2[0], dstW, c->chrDither8, 3);
+ inst->pfn.yuv2planar1((const int16_t*)src1[0], dst1[0], dstW, c->chrDither8, 0);
+ inst->pfn.yuv2planar1((const int16_t*)src2[0], dst2[0], dstW, c->chrDither8, 3);
} else {
- ((yuv2planarX_fn)inst->pfn)(filter, inst->filter_size, (const int16_t**)src1, dst1[0], dstW, c->chrDither8, 0);
- ((yuv2planarX_fn)inst->pfn)(filter, inst->filter_size, (const int16_t**)src2, dst2[0], dstW, c->chrDither8, inst->isMMX ? (c->uv_offx2 >> 1) : 3);
+ inst->pfn.yuv2planarX(filter, inst->filter_size, (const int16_t**)src1, dst1[0], dstW, c->chrDither8, 0);
+ inst->pfn.yuv2planarX(filter, inst->filter_size, (const int16_t**)src2, dst2[0], dstW, c->chrDither8, inst->isMMX ? (c->uv_offx2 >> 1) : 3);
}
}
@@ -125,13 +132,13 @@ static int packed_vscale(SwsContext *c, SwsFilterDescriptor *desc, int sliceY, i
if (c->yuv2packed1 && lum_fsize == 1 && chr_fsize == 1) { // unscaled RGB
- ((yuv2packed1_fn)inst->pfn)(c, (const int16_t*)*src0, (const int16_t**)src1, (const int16_t**)src2,
+ inst->pfn.yuv2packed1(c, (const int16_t*)*src0, (const int16_t**)src1, (const int16_t**)src2,
(const int16_t*)(desc->alpha ? *src3 : NULL), *dst, dstW, 0, sliceY);
} else if (c->yuv2packed1 && lum_fsize == 1 && chr_fsize == 2 &&
chr_filter[2 * chrSliceY + 1] + chr_filter[2 * chrSliceY] == 4096 &&
chr_filter[2 * chrSliceY + 1] <= 4096U) { // unscaled RGB
int chrAlpha = chr_filter[2 * chrSliceY + 1];
- ((yuv2packed1_fn)inst->pfn)(c, (const int16_t*)*src0, (const int16_t**)src1, (const int16_t**)src2,
+ inst->pfn.yuv2packed1(c, (const int16_t*)*src0, (const int16_t**)src1, (const int16_t**)src2,
(const int16_t*)(desc->alpha ? *src3 : NULL), *dst, dstW, chrAlpha, sliceY);
} else if (c->yuv2packed2 && lum_fsize == 2 && chr_fsize == 2 &&
lum_filter[2 * sliceY + 1] + lum_filter[2 * sliceY] == 4096 &&
@@ -145,7 +152,7 @@ static int packed_vscale(SwsContext *c, SwsFilterDescriptor *desc, int sliceY, i
c->lumMmxFilter[3] = lum_filter[2 * sliceY] * 0x10001;
c->chrMmxFilter[2] =
c->chrMmxFilter[3] = chr_filter[2 * chrSliceY] * 0x10001;
- ((yuv2packed2_fn)inst->pfn)(c, (const int16_t**)src0, (const int16_t**)src1, (const int16_t**)src2, (const int16_t**)src3,
+ inst->pfn.yuv2packed2(c, (const int16_t**)src0, (const int16_t**)src1, (const int16_t**)src2, (const int16_t**)src3,
*dst, dstW, lumAlpha, chrAlpha, sliceY);
} else { // general RGB
if ((c->yuv2packed1 && lum_fsize == 1 && chr_fsize == 2) ||
@@ -195,7 +202,7 @@ static int any_vscale(SwsContext *c, SwsFilterDescriptor *desc, int sliceY, int
desc->alpha ? desc->dst->plane[3].line[dp3] : NULL };
av_assert1(!c->yuv2packed1 && !c->yuv2packed2);
- ((yuv2anyX_fn)inst->pfn)(c, lum_filter + sliceY * lum_fsize,
+ inst->pfn.yuv2anyX(c, lum_filter + sliceY * lum_fsize,
(const int16_t**)src0, lum_fsize, chr_filter + sliceY * chr_fsize,
(const int16_t**)src1, (const int16_t**)src2, chr_fsize, (const int16_t**)src3, dst, dstW, sliceY);
@@ -270,9 +277,9 @@ void ff_init_vscale_pfn(SwsContext *c,
chrCtx->isMMX = use_mmx;
--idx;
- if (yuv2nv12cX) chrCtx->pfn = yuv2nv12cX;
- else if (c->vChrFilterSize == 1) chrCtx->pfn = yuv2plane1;
- else chrCtx->pfn = yuv2planeX;
+ if (yuv2nv12cX) chrCtx->pfn.yuv2interleavedX = yuv2nv12cX;
+ else if (c->vChrFilterSize == 1) chrCtx->pfn.yuv2planar1 = yuv2plane1;
+ else chrCtx->pfn.yuv2planarX = yuv2planeX;
}
lumCtx = c->desc[idx].instance;
@@ -283,8 +290,8 @@ void ff_init_vscale_pfn(SwsContext *c,
lumCtx->filter_pos = c->vLumFilterPos;
lumCtx->isMMX = use_mmx;
- if (c->vLumFilterSize == 1) lumCtx->pfn = yuv2plane1;
- else lumCtx->pfn = yuv2planeX;
+ if (c->vLumFilterSize == 1) lumCtx->pfn.yuv2planar1 = yuv2plane1;
+ else lumCtx->pfn.yuv2planarX = yuv2planeX;
} else {
lumCtx = c->desc[idx].instance;
@@ -303,12 +310,12 @@ void ff_init_vscale_pfn(SwsContext *c,
if (yuv2packedX) {
if (c->yuv2packed1 && c->vLumFilterSize == 1 && c->vChrFilterSize <= 2)
- lumCtx->pfn = yuv2packed1;
+ lumCtx->pfn.yuv2packed1 = yuv2packed1;
else if (c->yuv2packed2 && c->vLumFilterSize == 2 && c->vChrFilterSize == 2)
- lumCtx->pfn = yuv2packed2;
+ lumCtx->pfn.yuv2packed2 = yuv2packed2;
lumCtx->yuv2packedX = yuv2packedX;
} else
- lumCtx->pfn = yuv2anyX;
+ lumCtx->pfn.yuv2anyX = yuv2anyX;
}
}