1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

sws: separate the calls to scaled vs unscaled conversion

Call the scaler function directly rather than through a function
pointer. Drop the now-unused return value from ff_getSwsFunc() and
rename the function to reflect its new role.

This will be useful in the following commits, where it will become
important that the amount of output is different for scaled vs unscaled
case.
This commit is contained in:
Anton Khirnov 2021-05-20 13:37:06 +02:00
parent 0f8e0957d2
commit fe490ec165
4 changed files with 11 additions and 12 deletions

View File

@ -579,7 +579,7 @@ static av_cold void sws_init_swscale(SwsContext *c)
c->needs_hcscale = 1;
}
SwsFunc ff_getSwsFunc(SwsContext *c)
void ff_sws_init_scale(SwsContext *c)
{
sws_init_swscale(c);
@ -591,8 +591,6 @@ SwsFunc ff_getSwsFunc(SwsContext *c)
ff_sws_init_swscale_aarch64(c);
if (ARCH_ARM)
ff_sws_init_swscale_arm(c);
return swscale;
}
static void reset_ptr(const uint8_t *src[], enum AVPixelFormat format)
@ -988,7 +986,11 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
/* reset slice direction at end of frame */
if (srcSliceY_internal + srcSliceH == c->srcH)
c->sliceDir = 0;
ret = c->swscale(c, src2, srcStride2, srcSliceY_internal, srcSliceH, dst2, dstStride2);
if (c->swscale)
ret = c->swscale(c, src2, srcStride2, srcSliceY_internal, srcSliceH, dst2, dstStride2);
else
ret = swscale(c, src2, srcStride2, srcSliceY_internal, srcSliceH, dst2, dstStride2);
if (c->dstXYZ && !(c->srcXYZ && c->srcW==c->dstW && c->srcH==c->dstH)) {
int dstY = c->dstY ? c->dstY : srcSliceY + srcSliceH;

View File

@ -878,11 +878,7 @@ void ff_get_unscaled_swscale_ppc(SwsContext *c);
void ff_get_unscaled_swscale_arm(SwsContext *c);
void ff_get_unscaled_swscale_aarch64(SwsContext *c);
/**
* Return function pointer to fastest main scaler path function depending
* on architecture and available optimizations.
*/
SwsFunc ff_getSwsFunc(SwsContext *c);
void ff_sws_init_scale(SwsContext *c);
void ff_sws_init_input_funcs(SwsContext *c);
void ff_sws_init_output_funcs(SwsContext *c,

View File

@ -1847,7 +1847,8 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
}
}
c->swscale = ff_getSwsFunc(c);
ff_sws_init_scale(c);
return ff_init_filters(c);
nomem:
ret = AVERROR(ENOMEM);

View File

@ -93,7 +93,7 @@ static void check_yuv2yuvX(void)
if (sws_init_context(ctx, NULL, NULL) < 0)
fail();
ff_getSwsFunc(ctx);
ff_sws_init_scale(ctx);
for(isi = 0; isi < INPUT_SIZES; ++isi){
dstW = input_sizes[isi];
for(osi = 0; osi < 64; osi += 16){
@ -210,7 +210,7 @@ static void check_hscale(void)
filter[SRC_PIXELS * width + i] = rnd();
}
ff_getSwsFunc(ctx);
ff_sws_init_scale(ctx);
if (check_func(ctx->hcScale, "hscale_%d_to_%d_width%d", ctx->srcBpc, ctx->dstBpc + 1, width)) {
memset(dst0, 0, SRC_PIXELS * sizeof(dst0[0]));