On Tue, May 17, 2011 at 12:05:34PM +0800, Can Wu wrote:
>
> From 256eaff7d1df6cdd8a6df21ea836242e5ebc7194 Mon Sep 17 00:00:00 2001
> From: Can Wu <[email protected]>
> Date: Tue, 17 May 2011 11:38:25 +0800
> Subject: libavfilter: add blackmargin filter
>
> Used to detect black margin around video content.
a black margin
> --- /dev/null
> +++ b/libavfilter/vf_blackmargin.c
> @@ -0,0 +1,196 @@
> +/*
> + * Copyright (c) 2011 Can Wu
> + * Copyright (c) 2010 Stefano Sabatini
> + * Copyright (c) 2006 Ivo van Poorten
> + * Copyright (c) 2006 Julian Hall
> + * Copyright (c) 2002-2003 Brian J. Murrell
> + *
> + * This file is part of Libav.
> + *
> + * Libav is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
I assume this is GPL because it is based on code originating in MPlayer?
> +/**
> + * @file
> + * Search for black margin around video content
> + * based on vf_blackframe.c
Say "blackframe filter" or similar, filenames tend to be unstable.
Also, end sentences in periods.
> +static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
> +{
> + BlackMarginContext *blackmargin = ctx->priv;
> +
> + blackmargin->bamount = 98;
> + blackmargin->bthresh = 32;
> + blackmargin->frame = 0;
nit: align the '='
> + /* up */
> + p = picref->data[0];
Indentation is off, more instances below.
> + for (y = 0; y < (inlink->h >> 2); y++) {
> + p += picref->linesize[0];
> + nblack = 0;
> + for (x = 0; x < inlink->w; x++) {
> + nblack += p[x] < blackmargin->bthresh;
> + }
nit: Please drop unnecessary {}, more below.
> + if (margin_top + margin_bottom >= inlink->h) {
> + margin_left = 0;
> + margin_right = 0;
nit: align the '='
> +done:
> + av_log(ctx, AV_LOG_INFO, "frame:%u pos:%"PRId64" pts:%"PRId64" t:%f"
> + " %d %d %d %d\n",
> + blackmargin->frame, picref->pos, picref->pts,
> + picref->pts == AV_NOPTS_VALUE ?
> + -1 : picref->pts * av_q2d(inlink->time_base),
> + margin_top, margin_bottom, margin_left, margin_right);
Indentation is off.
> + blackmargin->margin_top = margin_top;
> + blackmargin->margin_bottom = margin_bottom;
> + blackmargin->margin_left = margin_left;
> + blackmargin->margin_right = margin_right;
nit: align the '='
Don't you have to bump the library minor number if you add a filter?
Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel