Rewrite scaler_ctx_scale to make it more efficient

This commit is contained in:
twinaphex 2014-11-01 10:08:12 +01:00
parent 4c707e9e00
commit 011e7cf1f9
1 changed files with 11 additions and 9 deletions

View File

@ -271,6 +271,10 @@ void scaler_ctx_scale(struct scaler_ctx *ctx,
}
else
{
const void *input_frame = input;
int stride = ctx->in_stride;
bool out_fmt_is_not_argb8888 = (ctx->out_fmt != SCALER_FMT_ARGB8888);
/* Take generic filter path. */
if (ctx->in_fmt != SCALER_FMT_ARGB8888)
{
@ -278,21 +282,19 @@ void scaler_ctx_scale(struct scaler_ctx *ctx,
ctx->in_width, ctx->in_height,
ctx->input.stride, ctx->in_stride);
ctx->scaler_horiz(ctx, ctx->input.frame, ctx->input.stride);
input_frame = ctx->input.frame;
stride = ctx->input.stride;
}
else
ctx->scaler_horiz(ctx, input, ctx->in_stride);
ctx->scaler_horiz(ctx, input_frame, stride);
if (ctx->out_fmt != SCALER_FMT_ARGB8888)
{
ctx->scaler_vert(ctx, ctx->output.frame, ctx->output.stride);
ctx->scaler_vert(ctx,
out_fmt_is_not_argb8888 ? ctx->output.frame : output,
out_fmt_is_not_argb8888 ? ctx->output.stride : ctx->out_stride);
if (out_fmt_is_not_argb8888)
ctx->out_pixconv(output, ctx->output.frame,
ctx->out_width, ctx->out_height,
ctx->out_stride, ctx->output.stride);
}
else
ctx->scaler_vert(ctx, output, ctx->out_stride);
}
}