Skip to content
Snippets Groups Projects
Commit a70519aa authored by Anton Khirnov's avatar Anton Khirnov
Browse files

vf_overlay: use the name 's' for the pointer to the private context

This is shorter and consistent across filters.
parent 8d2565c2
No related branches found
No related tags found
No related merge requests found
...@@ -101,12 +101,12 @@ static int query_formats(AVFilterContext *ctx) ...@@ -101,12 +101,12 @@ static int query_formats(AVFilterContext *ctx)
static int config_input_main(AVFilterLink *inlink) static int config_input_main(AVFilterLink *inlink)
{ {
OverlayContext *over = inlink->dst->priv; OverlayContext *s = inlink->dst->priv;
const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(inlink->format); const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(inlink->format);
av_image_fill_max_pixsteps(over->max_plane_step, NULL, pix_desc); av_image_fill_max_pixsteps(s->max_plane_step, NULL, pix_desc);
over->hsub = pix_desc->log2_chroma_w; s->hsub = pix_desc->log2_chroma_w;
over->vsub = pix_desc->log2_chroma_h; s->vsub = pix_desc->log2_chroma_h;
return 0; return 0;
} }
...@@ -114,7 +114,7 @@ static int config_input_main(AVFilterLink *inlink) ...@@ -114,7 +114,7 @@ static int config_input_main(AVFilterLink *inlink)
static int config_input_overlay(AVFilterLink *inlink) static int config_input_overlay(AVFilterLink *inlink)
{ {
AVFilterContext *ctx = inlink->dst; AVFilterContext *ctx = inlink->dst;
OverlayContext *over = inlink->dst->priv; OverlayContext *s = inlink->dst->priv;
char *expr; char *expr;
double var_values[VAR_VARS_NB], res; double var_values[VAR_VARS_NB], res;
int ret; int ret;
...@@ -130,36 +130,36 @@ static int config_input_overlay(AVFilterLink *inlink) ...@@ -130,36 +130,36 @@ static int config_input_overlay(AVFilterLink *inlink)
var_values[VAR_OVERLAY_W] = var_values[VAR_OW] = ctx->inputs[OVERLAY]->w; var_values[VAR_OVERLAY_W] = var_values[VAR_OW] = ctx->inputs[OVERLAY]->w;
var_values[VAR_OVERLAY_H] = var_values[VAR_OH] = ctx->inputs[OVERLAY]->h; var_values[VAR_OVERLAY_H] = var_values[VAR_OH] = ctx->inputs[OVERLAY]->h;
if ((ret = av_expr_parse_and_eval(&res, (expr = over->x_expr), var_names, var_values, if ((ret = av_expr_parse_and_eval(&res, (expr = s->x_expr), var_names, var_values,
NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0) NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0)
goto fail; goto fail;
over->x = res; s->x = res;
if ((ret = av_expr_parse_and_eval(&res, (expr = over->y_expr), var_names, var_values, if ((ret = av_expr_parse_and_eval(&res, (expr = s->y_expr), var_names, var_values,
NULL, NULL, NULL, NULL, NULL, 0, ctx))) NULL, NULL, NULL, NULL, NULL, 0, ctx)))
goto fail; goto fail;
over->y = res; s->y = res;
/* x may depend on y */ /* x may depend on y */
if ((ret = av_expr_parse_and_eval(&res, (expr = over->x_expr), var_names, var_values, if ((ret = av_expr_parse_and_eval(&res, (expr = s->x_expr), var_names, var_values,
NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0) NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0)
goto fail; goto fail;
over->x = res; s->x = res;
av_log(ctx, AV_LOG_VERBOSE, av_log(ctx, AV_LOG_VERBOSE,
"main w:%d h:%d fmt:%s overlay x:%d y:%d w:%d h:%d fmt:%s\n", "main w:%d h:%d fmt:%s overlay x:%d y:%d w:%d h:%d fmt:%s\n",
ctx->inputs[MAIN]->w, ctx->inputs[MAIN]->h, ctx->inputs[MAIN]->w, ctx->inputs[MAIN]->h,
av_get_pix_fmt_name(ctx->inputs[MAIN]->format), av_get_pix_fmt_name(ctx->inputs[MAIN]->format),
over->x, over->y, s->x, s->y,
ctx->inputs[OVERLAY]->w, ctx->inputs[OVERLAY]->h, ctx->inputs[OVERLAY]->w, ctx->inputs[OVERLAY]->h,
av_get_pix_fmt_name(ctx->inputs[OVERLAY]->format)); av_get_pix_fmt_name(ctx->inputs[OVERLAY]->format));
if (over->x < 0 || over->y < 0 || if (s->x < 0 || s->y < 0 ||
over->x + var_values[VAR_OVERLAY_W] > var_values[VAR_MAIN_W] || s->x + var_values[VAR_OVERLAY_W] > var_values[VAR_MAIN_W] ||
over->y + var_values[VAR_OVERLAY_H] > var_values[VAR_MAIN_H]) { s->y + var_values[VAR_OVERLAY_H] > var_values[VAR_MAIN_H]) {
av_log(ctx, AV_LOG_ERROR, av_log(ctx, AV_LOG_ERROR,
"Overlay area (%d,%d)<->(%d,%d) not within the main area (0,0)<->(%d,%d) or zero-sized\n", "Overlay area (%d,%d)<->(%d,%d) not within the main area (0,0)<->(%d,%d) or zero-sized\n",
over->x, over->y, s->x, s->y,
(int)(over->x + var_values[VAR_OVERLAY_W]), (int)(s->x + var_values[VAR_OVERLAY_W]),
(int)(over->y + var_values[VAR_OVERLAY_H]), (int)(s->y + var_values[VAR_OVERLAY_H]),
(int)var_values[VAR_MAIN_W], (int)var_values[VAR_MAIN_H]); (int)var_values[VAR_MAIN_W], (int)var_values[VAR_MAIN_H]);
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
...@@ -186,7 +186,7 @@ static void blend_frame(AVFilterContext *ctx, ...@@ -186,7 +186,7 @@ static void blend_frame(AVFilterContext *ctx,
AVFrame *dst, AVFrame *src, AVFrame *dst, AVFrame *src,
int x, int y) int x, int y)
{ {
OverlayContext *over = ctx->priv; OverlayContext *s = ctx->priv;
int i, j, k; int i, j, k;
int width, height; int width, height;
int overlay_end_y = y + src->height; int overlay_end_y = y + src->height;
...@@ -218,8 +218,8 @@ static void blend_frame(AVFilterContext *ctx, ...@@ -218,8 +218,8 @@ static void blend_frame(AVFilterContext *ctx,
} }
} else { } else {
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
int hsub = i ? over->hsub : 0; int hsub = i ? s->hsub : 0;
int vsub = i ? over->vsub : 0; int vsub = i ? s->vsub : 0;
uint8_t *dp = dst->data[i] + (x >> hsub) + uint8_t *dp = dst->data[i] + (x >> hsub) +
(start_y >> vsub) * dst->linesize[i]; (start_y >> vsub) * dst->linesize[i];
uint8_t *sp = src->data[i]; uint8_t *sp = src->data[i];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment