[FFmpeg-devel] Proposed vf_decimate enhancement

Michael Niedermayer michaelni at gmx.at
Mon Dec 14 22:19:55 CET 2015


On Tue, Sep 29, 2015 at 11:02:33AM -0500, Ray Cole wrote:
> Here is an updated patch. I cleaned the code up to hopefully be closer to standards. It works well for me, but your mileage may vary...
> 

> --- vf_decimate.c	2015-09-29 10:56:46.171698492 -0500
> +++ vf_decimatex.c	2015-09-29 10:59:50.679695685 -0500

a git patch with a commit message would be better
see:
git commit -a
git format-patch -1


[...]

> @@ -51,6 +52,10 @@
>      int bdiffsize;
>      int64_t *bdiffs;
>  
> +    /* Ray */

git keeps track of who changed what



> +    int lastdrop;

> +    int64_t drop_count[25]; // drop counts

The purpose of comments is to provide additional information not
already in the field name


> +
>      /* options */
>      int cycle;
>      double dupthresh_flt;
> @@ -60,6 +65,9 @@
>      int blockx, blocky;
>      int ppsrc;
>      int chroma;
> +    int force_drop;
> +    int lock_on;
> +
>  } DecimateContext;
>  
>  #define OFFSET(x) offsetof(DecimateContext, x)
> @@ -71,9 +79,13 @@
>      { "scthresh",  "set scene change threshold", OFFSET(scthresh_flt),  AV_OPT_TYPE_DOUBLE, {.dbl = 15.0}, 0, 100, FLAGS },
>      { "blockx",    "set the size of the x-axis blocks used during metric calculations", OFFSET(blockx), AV_OPT_TYPE_INT, {.i64 = 32}, 4, 1<<9, FLAGS },
>      { "blocky",    "set the size of the y-axis blocks used during metric calculations", OFFSET(blocky), AV_OPT_TYPE_INT, {.i64 = 32}, 4, 1<<9, FLAGS },

> -    { "ppsrc",     "mark main input as a pre-processed input and activate clean source input stream", OFFSET(ppsrc), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
> +    { "ppsrc",     "mark main input as a pre-processed input and activate clean source input stream", OFFSET(ppsrc), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS },
> -    { "chroma",    "set whether or not chroma is considered in the metric calculations", OFFSET(chroma), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, FLAGS },
> +    { "chroma",    "set whether or not chroma is considered in the metric calculations", OFFSET(chroma), AV_OPT_TYPE_INT, {.i64=1}, 0, 1, FLAGS },

this looks like a unintended mistake


> +    { "force_drop",    "set to forcefully drop frame X in cycle", OFFSET(force_drop), AV_OPT_TYPE_INT, {.i64=-1}, -1, 4, FLAGS },
> +    { "lock_on",    "set to lock on to a cycle", OFFSET(lock_on), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS },



> +
>      { NULL }
> +
>  };
>  
>  AVFILTER_DEFINE_CLASS(decimate);
> @@ -140,13 +152,15 @@
>      q->totdiff = 0;
>      for (i = 0; i < dm->bdiffsize; i++)
>          q->totdiff += bdiffs[i];
> +
>      q->maxbdiff = maxdiff;
> +
>  }

stray changes
please read your patch before submitting



>  
>  static int filter_frame(AVFilterLink *inlink, AVFrame *in)
>  {
> -    int scpos = -1, duppos = -1;
> -    int drop = INT_MIN, i, lowest = 0, ret;
> +    int scpos = -1, duppos = -1, common = 0, start = 0;
> +    int drop = INT_MIN, i, lowest = 0, lowest_tot = 0, ret =0;
>      AVFilterContext *ctx  = inlink->dst;
>      AVFilterLink *outlink = ctx->outputs[0];
>      DecimateContext *dm   = ctx->priv;

> @@ -176,17 +190,128 @@
>          dm->last = av_frame_clone(in);
>          dm->fid = 0;
>  
> +
> +// The major change starts here

git keeps track of changes, theres no need to put such notes in
the source


[...]
> @@ -372,6 +499,7 @@
>      fps = av_mul_q(fps, (AVRational){dm->cycle - 1, dm->cycle});
>      av_log(ctx, AV_LOG_VERBOSE, "FPS: %d/%d -> %d/%d\n",
>             inlink->frame_rate.num, inlink->frame_rate.den, fps.num, fps.den);
> +    outlink->flags |= FF_LINK_FLAG_REQUEST_LOOP;

this flag no longer exists

and please provide a commit message for the change which describes
what is changed, how and why


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151214/1cb50579/attachment.sig>


More information about the ffmpeg-devel mailing list