aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClément Bœsch <ubitux@gmail.com>2013-05-16 17:53:39 +0200
committerPaul B Mahol <onemda@gmail.com>2013-10-02 10:54:11 +0000
commite31a239fea6576a22f59a028d826d95ff2c72c39 (patch)
tree5fa29c558bb2b21d8f7540a1b4ed771bc6621da1
parent7d0ce1e59df8dec454f2d3015cd8e8fc376d3424 (diff)
downloadffmpeg-e31a239fea6576a22f59a028d826d95ff2c72c39.tar.gz
avfilter/vf_removelogo: use the name 's' for the pointer to the private context
-rw-r--r--libavfilter/vf_removelogo.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/libavfilter/vf_removelogo.c b/libavfilter/vf_removelogo.c
index e586486ee1..2044739797 100644
--- a/libavfilter/vf_removelogo.c
+++ b/libavfilter/vf_removelogo.c
@@ -279,44 +279,44 @@ static void generate_half_size_image(const uint8_t *src_data, int src_linesize,
static av_cold int init(AVFilterContext *ctx)
{
- RemovelogoContext *removelogo = ctx->priv;
+ RemovelogoContext *s = ctx->priv;
int ***mask;
int ret = 0;
int a, b, c, w, h;
int full_max_mask_size, half_max_mask_size;
- if (!removelogo->filename) {
+ if (!s->filename) {
av_log(ctx, AV_LOG_ERROR, "The bitmap file name is mandatory\n");
return AVERROR(EINVAL);
}
/* Load our mask image. */
- if ((ret = load_mask(&removelogo->full_mask_data, &w, &h, removelogo->filename, ctx)) < 0)
+ if ((ret = load_mask(&s->full_mask_data, &w, &h, s->filename, ctx)) < 0)
return ret;
- removelogo->mask_w = w;
- removelogo->mask_h = h;
+ s->mask_w = w;
+ s->mask_h = h;
- convert_mask_to_strength_mask(removelogo->full_mask_data, w, w, h,
+ convert_mask_to_strength_mask(s->full_mask_data, w, w, h,
16, &full_max_mask_size);
/* Create the scaled down mask image for the chroma planes. */
- if (!(removelogo->half_mask_data = av_mallocz(w/2 * h/2)))
+ if (!(s->half_mask_data = av_mallocz(w/2 * h/2)))
return AVERROR(ENOMEM);
- generate_half_size_image(removelogo->full_mask_data, w,
- removelogo->half_mask_data, w/2,
+ generate_half_size_image(s->full_mask_data, w,
+ s->half_mask_data, w/2,
w, h, &half_max_mask_size);
- removelogo->max_mask_size = FFMAX(full_max_mask_size, half_max_mask_size);
+ s->max_mask_size = FFMAX(full_max_mask_size, half_max_mask_size);
/* Create a circular mask for each size up to max_mask_size. When
the filter is applied, the mask size is determined on a pixel
by pixel basis, with pixels nearer the edge of the logo getting
smaller mask sizes. */
- mask = (int ***)av_malloc(sizeof(int **) * (removelogo->max_mask_size + 1));
+ mask = (int ***)av_malloc(sizeof(int **) * (s->max_mask_size + 1));
if (!mask)
return AVERROR(ENOMEM);
- for (a = 0; a <= removelogo->max_mask_size; a++) {
+ for (a = 0; a <= s->max_mask_size; a++) {
mask[a] = (int **)av_malloc(sizeof(int *) * ((a * 2) + 1));
if (!mask[a])
return AVERROR(ENOMEM);
@@ -332,17 +332,17 @@ static av_cold int init(AVFilterContext *ctx)
}
}
}
- removelogo->mask = mask;
+ s->mask = mask;
/* Calculate our bounding rectangles, which determine in what
* region the logo resides for faster processing. */
- ff_calculate_bounding_box(&removelogo->full_mask_bbox, removelogo->full_mask_data, w, w, h, 0);
- ff_calculate_bounding_box(&removelogo->half_mask_bbox, removelogo->half_mask_data, w/2, w/2, h/2, 0);
+ ff_calculate_bounding_box(&s->full_mask_bbox, s->full_mask_data, w, w, h, 0);
+ ff_calculate_bounding_box(&s->half_mask_bbox, s->half_mask_data, w/2, w/2, h/2, 0);
#define SHOW_LOGO_INFO(mask_type) \
av_log(ctx, AV_LOG_VERBOSE, #mask_type " x1:%d x2:%d y1:%d y2:%d max_mask_size:%d\n", \
- removelogo->mask_type##_mask_bbox.x1, removelogo->mask_type##_mask_bbox.x2, \
- removelogo->mask_type##_mask_bbox.y1, removelogo->mask_type##_mask_bbox.y2, \
+ s->mask_type##_mask_bbox.x1, s->mask_type##_mask_bbox.x2, \
+ s->mask_type##_mask_bbox.y1, s->mask_type##_mask_bbox.y2, \
mask_type##_max_mask_size);
SHOW_LOGO_INFO(full);
SHOW_LOGO_INFO(half);
@@ -353,12 +353,12 @@ static av_cold int init(AVFilterContext *ctx)
static int config_props_input(AVFilterLink *inlink)
{
AVFilterContext *ctx = inlink->dst;
- RemovelogoContext *removelogo = ctx->priv;
+ RemovelogoContext *s = ctx->priv;
- if (inlink->w != removelogo->mask_w || inlink->h != removelogo->mask_h) {
+ if (inlink->w != s->mask_w || inlink->h != s->mask_h) {
av_log(ctx, AV_LOG_INFO,
"Mask image size %dx%d does not match with the input video size %dx%d\n",
- removelogo->mask_w, removelogo->mask_h, inlink->w, inlink->h);
+ s->mask_w, s->mask_h, inlink->w, inlink->h);
return AVERROR(EINVAL);
}
@@ -488,7 +488,7 @@ static void blur_image(int ***mask,
static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
{
- RemovelogoContext *removelogo = inlink->dst->priv;
+ RemovelogoContext *s = inlink->dst->priv;
AVFilterLink *outlink = inlink->dst->outputs[0];
AVFrame *outpicref;
int direct = 0;
@@ -505,21 +505,21 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
av_frame_copy_props(outpicref, inpicref);
}
- blur_image(removelogo->mask,
+ blur_image(s->mask,
inpicref ->data[0], inpicref ->linesize[0],
outpicref->data[0], outpicref->linesize[0],
- removelogo->full_mask_data, inlink->w,
- inlink->w, inlink->h, direct, &removelogo->full_mask_bbox);
- blur_image(removelogo->mask,
+ s->full_mask_data, inlink->w,
+ inlink->w, inlink->h, direct, &s->full_mask_bbox);
+ blur_image(s->mask,
inpicref ->data[1], inpicref ->linesize[1],
outpicref->data[1], outpicref->linesize[1],
- removelogo->half_mask_data, inlink->w/2,
- inlink->w/2, inlink->h/2, direct, &removelogo->half_mask_bbox);
- blur_image(removelogo->mask,
+ s->half_mask_data, inlink->w/2,
+ inlink->w/2, inlink->h/2, direct, &s->half_mask_bbox);
+ blur_image(s->mask,
inpicref ->data[2], inpicref ->linesize[2],
outpicref->data[2], outpicref->linesize[2],
- removelogo->half_mask_data, inlink->w/2,
- inlink->w/2, inlink->h/2, direct, &removelogo->half_mask_bbox);
+ s->half_mask_data, inlink->w/2,
+ inlink->w/2, inlink->h/2, direct, &s->half_mask_bbox);
if (!direct)
av_frame_free(&inpicref);
@@ -529,23 +529,23 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
static av_cold void uninit(AVFilterContext *ctx)
{
- RemovelogoContext *removelogo = ctx->priv;
+ RemovelogoContext *s = ctx->priv;
int a, b;
- av_freep(&removelogo->full_mask_data);
- av_freep(&removelogo->half_mask_data);
+ av_freep(&s->full_mask_data);
+ av_freep(&s->half_mask_data);
- if (removelogo->mask) {
+ if (s->mask) {
/* Loop through each mask. */
- for (a = 0; a <= removelogo->max_mask_size; a++) {
+ for (a = 0; a <= s->max_mask_size; a++) {
/* Loop through each scanline in a mask. */
for (b = -a; b <= a; b++) {
- av_free(removelogo->mask[a][b + a]); /* Free a scanline. */
+ av_free(s->mask[a][b + a]); /* Free a scanline. */
}
- av_free(removelogo->mask[a]);
+ av_free(s->mask[a]);
}
/* Free the array of pointers pointing to the masks. */
- av_freep(&removelogo->mask);
+ av_freep(&s->mask);
}
}