On Sun, Nov 02, 2014 at 06:20:06PM -0800, Kevin Mitchell wrote: > I made the decay multiplication fixed point. I moved all the fixed > point logic to macros which hopefully makes it easier to read. > > I also removed the total_frames count since it is now likely to become > inconsistent with the actual classification totals anyway. > > I've gone back to just outputting rounded integers to av_log so as not > to break scripts of people who are insane enough to try and parse it > (bash can't handle float). > > I used your suggestion for formatting fixed point decimal values for > the metadata tags. > doc/filters.texi | 5 +++ > libavfilter/version.h | 2 - > libavfilter/vf_idet.c | 79 > ++++++++++++++++++++++++++++++++++---------------- > libavfilter/vf_idet.h | 15 ++++++++- > 4 files changed, 74 insertions(+), 27 deletions(-) > 48d7ffa6bec7940ae0c348fd09308364a69e7cdc > 0001-avfilter-vf_idet-add-a-half_life-option-for-statisti.patch > From 7171918c2f34118679412da72add7b9056e04209 Mon Sep 17 00:00:00 2001 > From: Kevin Mitchell <kevmi...@gmail.com> > Date: Sun, 2 Nov 2014 04:37:13 -0800 > Subject: [PATCH 1/2] avfilter/vf_idet: add a "half_life" option for statistics > > This can be useful for videos in which the interlacing pattern changes. > --- > doc/filters.texi | 5 ++++ > libavfilter/version.h | 2 +- > libavfilter/vf_idet.c | 79 > +++++++++++++++++++++++++++++++++++---------------- > libavfilter/vf_idet.h | 15 ++++++++-- > 4 files changed, 74 insertions(+), 27 deletions(-) > > diff --git a/doc/filters.texi b/doc/filters.texi > index 33f842b..ae08f32 100644 > --- a/doc/filters.texi > +++ b/doc/filters.texi > @@ -5625,6 +5625,11 @@ The filter accepts the following options: > Set interlacing threshold. > @item prog_thres > Set progressive threshold. > +@item half_life > +Number of frames after which a given frame's contribution to the > +statistics is halved (i.e., it contributes only 0.5 to it's > +classification). The default of 0 means that all frames seen are given > +full weight of 1.0 forever. > @end table > > @section il > diff --git a/libavfilter/version.h b/libavfilter/version.h > index 440c587..dab9b45 100644 > --- a/libavfilter/version.h > +++ b/libavfilter/version.h > @@ -31,7 +31,7 @@ > > #define LIBAVFILTER_VERSION_MAJOR 5 > #define LIBAVFILTER_VERSION_MINOR 2 > -#define LIBAVFILTER_VERSION_MICRO 101 > +#define LIBAVFILTER_VERSION_MICRO 102 > > #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ > LIBAVFILTER_VERSION_MINOR, \ > diff --git a/libavfilter/vf_idet.c b/libavfilter/vf_idet.c > index 6f99f39..d0b3aa2 100644 > --- a/libavfilter/vf_idet.c > +++ b/libavfilter/vf_idet.c > @@ -32,6 +32,7 @@ > static const AVOption idet_options[] = { > { "intl_thres", "set interlacing threshold", > OFFSET(interlace_threshold), AV_OPT_TYPE_FLOAT, {.dbl = 1.04}, -1, FLT_MAX, > FLAGS }, > { "prog_thres", "set progressive threshold", > OFFSET(progressive_threshold), AV_OPT_TYPE_FLOAT, {.dbl = 1.5}, -1, FLT_MAX, > FLAGS }, > + { "half_life", "half life of cumulative statistics", OFFSET(half_life), > AV_OPT_TYPE_FLOAT, {.dbl = 0.0}, -1, INT_MAX, FLAGS }, > { NULL } > }; > > @@ -48,6 +49,14 @@ static const char *type2str(Type type) > return NULL; > } > > +static int av_dict_set_fxp(AVDictionary **pm, const char *key, uint64_t > value, int decimal_digits, > + int flags) > +{ > + char valuestr[44]; > + snprintf(valuestr, sizeof(valuestr), "%"PRId64".%0*"PRId64, > FXP_TO_DECIMAL(value, decimal_digits)); ... > +#define FXP_TO_DECIMAL(value,digits) (value) / PRECISION, (digits), > (uint64_t) round(( (value) % PRECISION) / (double) (PRECISION / pow(10.0, > (digits) )))
thats still using floating point calculations round(), pow(), and double are not integer based also it will give incorrect results i think 0.99999 could get printed as 0.100 when the remainder is rounded up [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User questions about the command line tools should be sent to the ffmpeg-user ML. And questions about how to use libav* should be sent to the libav-user ML.
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel