Re: [FFmpeg-devel] libavutil: added camellia block cipher

2015-01-24 Thread James Almer
On 02/01/15 6:34 PM, Michael Niedermayer wrote:
> On Fri, Jan 02, 2015 at 05:13:33PM +0100, Giorgio Vazzana wrote:
>> Hello,
>>
>> 2015-01-02 15:17 GMT+01:00 Michael Niedermayer :
>>> i assume giorgio is ok with the patch as he previously said "rest LGTM"
>>> so applied
>>
>> thank you Supraja for the good work and thanks Michael for applying the 
>> patch.
>>
>> I spotted only minor things, attached some patches from most important
>> to less important.
> 
> patches applied
> 
> thanks

lavu   CAMELLIA size: 1048576  runs:   1024  time:   28.677 +- 0.123
crypto CAMELLIA size: 1048576  runs:   1024  time:   16.523 +- 0.011
gcrypt CAMELLIA size: 1048576  runs:   1024  time:   17.632 +- 0.015

It could use some optimization.

I'll send a patch to add the above test to tools/crypto_bench later.

> 
> [...]
> 
> 
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Move stream_options to avformat

2015-01-24 Thread Michael Niedermayer
On Sun, Jan 25, 2015 at 02:31:33AM +0100, wm4 wrote:
> On Sun, 25 Jan 2015 02:28:01 +0100
> Michael Niedermayer  wrote:
> 
> > On Sun, Jan 25, 2015 at 02:16:58AM +0100, wm4 wrote:
> > > On Sun, 25 Jan 2015 01:56:30 +0100
> > > Michael Niedermayer  wrote:
> > > 
> > > > TODO: APIChanges/version bump
> > > > 
> > > > Signed-off-by: Michael Niedermayer 
> > > > ---
> > > >  ffmpeg.c   |   30 --
> > > >  libavformat/avformat.h |6 ++
> > > >  libavformat/options.c  |   30 ++
> > > >  3 files changed, 40 insertions(+), 26 deletions(-)
> > > > 
> > > > diff --git a/ffmpeg.c b/ffmpeg.c
> > > > index b836448..af576c7 100644
> > > > --- a/ffmpeg.c
> > > > +++ b/ffmpeg.c
> > > > @@ -2970,32 +2970,10 @@ static int transcode_init(void)
> > > >  }
> > > >  
> > > >  if (ost->disposition) {
> > > > -static const AVOption opts[] = {
> > > > -{ "disposition" , NULL, 0, AV_OPT_TYPE_FLAGS, 
> > > > { .i64 = 0 }, INT64_MIN, INT64_MAX, .unit = "flags" },
> > > > -{ "default" , NULL, 0, AV_OPT_TYPE_CONST, 
> > > > { .i64 = AV_DISPOSITION_DEFAULT   },.unit = "flags" },
> > > > -{ "dub" , NULL, 0, AV_OPT_TYPE_CONST, 
> > > > { .i64 = AV_DISPOSITION_DUB   },.unit = "flags" },
> > > > -{ "original", NULL, 0, AV_OPT_TYPE_CONST, 
> > > > { .i64 = AV_DISPOSITION_ORIGINAL  },.unit = "flags" },
> > > > -{ "comment" , NULL, 0, AV_OPT_TYPE_CONST, 
> > > > { .i64 = AV_DISPOSITION_COMMENT   },.unit = "flags" },
> > > > -{ "lyrics"  , NULL, 0, AV_OPT_TYPE_CONST, 
> > > > { .i64 = AV_DISPOSITION_LYRICS},.unit = "flags" },
> > > > -{ "karaoke" , NULL, 0, AV_OPT_TYPE_CONST, 
> > > > { .i64 = AV_DISPOSITION_KARAOKE   },.unit = "flags" },
> > > > -{ "forced"  , NULL, 0, AV_OPT_TYPE_CONST, 
> > > > { .i64 = AV_DISPOSITION_FORCED},.unit = "flags" },
> > > > -{ "hearing_impaired", NULL, 0, AV_OPT_TYPE_CONST, 
> > > > { .i64 = AV_DISPOSITION_HEARING_IMPAIRED  },.unit = "flags" },
> > > > -{ "visual_impaired" , NULL, 0, AV_OPT_TYPE_CONST, 
> > > > { .i64 = AV_DISPOSITION_VISUAL_IMPAIRED   },.unit = "flags" },
> > > > -{ "clean_effects"   , NULL, 0, AV_OPT_TYPE_CONST, 
> > > > { .i64 = AV_DISPOSITION_CLEAN_EFFECTS },.unit = "flags" },
> > > > -{ "captions", NULL, 0, AV_OPT_TYPE_CONST, 
> > > > { .i64 = AV_DISPOSITION_CAPTIONS  },.unit = "flags" },
> > > > -{ "descriptions", NULL, 0, AV_OPT_TYPE_CONST, 
> > > > { .i64 = AV_DISPOSITION_DESCRIPTIONS  },.unit = "flags" },
> > > > -{ "metadata", NULL, 0, AV_OPT_TYPE_CONST, 
> > > > { .i64 = AV_DISPOSITION_METADATA  },.unit = "flags" },
> > > > -{ NULL },
> > > > -};
> > > > -static const AVClass class = {
> > > > -.class_name = "",
> > > > -.item_name  = av_default_item_name,
> > > > -.option = opts,
> > > > -.version= LIBAVUTIL_VERSION_INT,
> > > > -};
> > > > -const AVClass *pclass = &class;
> > > > -
> > > > -ret = av_opt_eval_flags(&pclass, &opts[0], 
> > > > ost->disposition, &ost->st->disposition);
> > > > +const AVClass *pclass = avstream_get_class();
> > > > +const AVOption *o = av_opt_find(&pclass, "disposition", 
> > > > NULL, 0, 0);
> > > > +
> > > > +ret = av_opt_eval_flags(&pclass, o, ost->disposition, 
> > > > &ost->st->disposition);
> > > >  if (ret < 0)
> > > >  goto dump_format;
> > > >  }
> > > > diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> > > > index db72c18..e6cd301 100644
> > > > --- a/libavformat/avformat.h
> > > > +++ b/libavformat/avformat.h
> > > > @@ -1895,6 +1895,12 @@ void avformat_free_context(AVFormatContext *s);
> > > >  const AVClass *avformat_get_class(void);
> > > >  
> > > >  /**
> > > > + * Get the AVClass for AVStream. It can be used in combination with
> > > > + * AV_OPT_SEARCH_FAKE_OBJ for examining options.
> > > > + */
> > > > +const AVClass *avstream_get_class(void);
> > > > +
> > > > +/**
> > > >   * Add a new stream to a media file.
> > > >   *
> > > >   * When demuxing, it is called by the demuxer in read_header(). If the
> > > > diff --git a/libavformat/options.c b/libavformat/options.c
> > > > index 5044043..d10226d 100644
> > > > --- a/libavformat/options.c
> > > > +++ b/libavformat/options.c
> > > > @@ -130,3 +130,33 @@ const AVClass *avformat_get_class(void)
> > > >  {
> > > >  return &av_format_context_class;
> > > >  

Re: [FFmpeg-devel] [PATCH] Move stream_options to avformat

2015-01-24 Thread wm4
On Sun, 25 Jan 2015 02:28:01 +0100
Michael Niedermayer  wrote:

> On Sun, Jan 25, 2015 at 02:16:58AM +0100, wm4 wrote:
> > On Sun, 25 Jan 2015 01:56:30 +0100
> > Michael Niedermayer  wrote:
> > 
> > > TODO: APIChanges/version bump
> > > 
> > > Signed-off-by: Michael Niedermayer 
> > > ---
> > >  ffmpeg.c   |   30 --
> > >  libavformat/avformat.h |6 ++
> > >  libavformat/options.c  |   30 ++
> > >  3 files changed, 40 insertions(+), 26 deletions(-)
> > > 
> > > diff --git a/ffmpeg.c b/ffmpeg.c
> > > index b836448..af576c7 100644
> > > --- a/ffmpeg.c
> > > +++ b/ffmpeg.c
> > > @@ -2970,32 +2970,10 @@ static int transcode_init(void)
> > >  }
> > >  
> > >  if (ost->disposition) {
> > > -static const AVOption opts[] = {
> > > -{ "disposition" , NULL, 0, AV_OPT_TYPE_FLAGS, { 
> > > .i64 = 0 }, INT64_MIN, INT64_MAX, .unit = "flags" },
> > > -{ "default" , NULL, 0, AV_OPT_TYPE_CONST, { 
> > > .i64 = AV_DISPOSITION_DEFAULT   },.unit = "flags" },
> > > -{ "dub" , NULL, 0, AV_OPT_TYPE_CONST, { 
> > > .i64 = AV_DISPOSITION_DUB   },.unit = "flags" },
> > > -{ "original", NULL, 0, AV_OPT_TYPE_CONST, { 
> > > .i64 = AV_DISPOSITION_ORIGINAL  },.unit = "flags" },
> > > -{ "comment" , NULL, 0, AV_OPT_TYPE_CONST, { 
> > > .i64 = AV_DISPOSITION_COMMENT   },.unit = "flags" },
> > > -{ "lyrics"  , NULL, 0, AV_OPT_TYPE_CONST, { 
> > > .i64 = AV_DISPOSITION_LYRICS},.unit = "flags" },
> > > -{ "karaoke" , NULL, 0, AV_OPT_TYPE_CONST, { 
> > > .i64 = AV_DISPOSITION_KARAOKE   },.unit = "flags" },
> > > -{ "forced"  , NULL, 0, AV_OPT_TYPE_CONST, { 
> > > .i64 = AV_DISPOSITION_FORCED},.unit = "flags" },
> > > -{ "hearing_impaired", NULL, 0, AV_OPT_TYPE_CONST, { 
> > > .i64 = AV_DISPOSITION_HEARING_IMPAIRED  },.unit = "flags" },
> > > -{ "visual_impaired" , NULL, 0, AV_OPT_TYPE_CONST, { 
> > > .i64 = AV_DISPOSITION_VISUAL_IMPAIRED   },.unit = "flags" },
> > > -{ "clean_effects"   , NULL, 0, AV_OPT_TYPE_CONST, { 
> > > .i64 = AV_DISPOSITION_CLEAN_EFFECTS },.unit = "flags" },
> > > -{ "captions", NULL, 0, AV_OPT_TYPE_CONST, { 
> > > .i64 = AV_DISPOSITION_CAPTIONS  },.unit = "flags" },
> > > -{ "descriptions", NULL, 0, AV_OPT_TYPE_CONST, { 
> > > .i64 = AV_DISPOSITION_DESCRIPTIONS  },.unit = "flags" },
> > > -{ "metadata", NULL, 0, AV_OPT_TYPE_CONST, { 
> > > .i64 = AV_DISPOSITION_METADATA  },.unit = "flags" },
> > > -{ NULL },
> > > -};
> > > -static const AVClass class = {
> > > -.class_name = "",
> > > -.item_name  = av_default_item_name,
> > > -.option = opts,
> > > -.version= LIBAVUTIL_VERSION_INT,
> > > -};
> > > -const AVClass *pclass = &class;
> > > -
> > > -ret = av_opt_eval_flags(&pclass, &opts[0], ost->disposition, 
> > > &ost->st->disposition);
> > > +const AVClass *pclass = avstream_get_class();
> > > +const AVOption *o = av_opt_find(&pclass, "disposition", 
> > > NULL, 0, 0);
> > > +
> > > +ret = av_opt_eval_flags(&pclass, o, ost->disposition, 
> > > &ost->st->disposition);
> > >  if (ret < 0)
> > >  goto dump_format;
> > >  }
> > > diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> > > index db72c18..e6cd301 100644
> > > --- a/libavformat/avformat.h
> > > +++ b/libavformat/avformat.h
> > > @@ -1895,6 +1895,12 @@ void avformat_free_context(AVFormatContext *s);
> > >  const AVClass *avformat_get_class(void);
> > >  
> > >  /**
> > > + * Get the AVClass for AVStream. It can be used in combination with
> > > + * AV_OPT_SEARCH_FAKE_OBJ for examining options.
> > > + */
> > > +const AVClass *avstream_get_class(void);
> > > +
> > > +/**
> > >   * Add a new stream to a media file.
> > >   *
> > >   * When demuxing, it is called by the demuxer in read_header(). If the
> > > diff --git a/libavformat/options.c b/libavformat/options.c
> > > index 5044043..d10226d 100644
> > > --- a/libavformat/options.c
> > > +++ b/libavformat/options.c
> > > @@ -130,3 +130,33 @@ const AVClass *avformat_get_class(void)
> > >  {
> > >  return &av_format_context_class;
> > >  }
> > > +
> > > +static const AVOption stream_options[] = {
> > > +{ "disposition" , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 0 }, 
> > > INT64_MIN, INT64_MAX, .unit = "flags" },
> > > +{ "default" , NULL, 0, AV_OPT_TYPE_CONST,

Re: [FFmpeg-devel] [PATCH] Move stream_options to avformat

2015-01-24 Thread Michael Niedermayer
On Sun, Jan 25, 2015 at 02:16:58AM +0100, wm4 wrote:
> On Sun, 25 Jan 2015 01:56:30 +0100
> Michael Niedermayer  wrote:
> 
> > TODO: APIChanges/version bump
> > 
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  ffmpeg.c   |   30 --
> >  libavformat/avformat.h |6 ++
> >  libavformat/options.c  |   30 ++
> >  3 files changed, 40 insertions(+), 26 deletions(-)
> > 
> > diff --git a/ffmpeg.c b/ffmpeg.c
> > index b836448..af576c7 100644
> > --- a/ffmpeg.c
> > +++ b/ffmpeg.c
> > @@ -2970,32 +2970,10 @@ static int transcode_init(void)
> >  }
> >  
> >  if (ost->disposition) {
> > -static const AVOption opts[] = {
> > -{ "disposition" , NULL, 0, AV_OPT_TYPE_FLAGS, { 
> > .i64 = 0 }, INT64_MIN, INT64_MAX, .unit = "flags" },
> > -{ "default" , NULL, 0, AV_OPT_TYPE_CONST, { 
> > .i64 = AV_DISPOSITION_DEFAULT   },.unit = "flags" },
> > -{ "dub" , NULL, 0, AV_OPT_TYPE_CONST, { 
> > .i64 = AV_DISPOSITION_DUB   },.unit = "flags" },
> > -{ "original", NULL, 0, AV_OPT_TYPE_CONST, { 
> > .i64 = AV_DISPOSITION_ORIGINAL  },.unit = "flags" },
> > -{ "comment" , NULL, 0, AV_OPT_TYPE_CONST, { 
> > .i64 = AV_DISPOSITION_COMMENT   },.unit = "flags" },
> > -{ "lyrics"  , NULL, 0, AV_OPT_TYPE_CONST, { 
> > .i64 = AV_DISPOSITION_LYRICS},.unit = "flags" },
> > -{ "karaoke" , NULL, 0, AV_OPT_TYPE_CONST, { 
> > .i64 = AV_DISPOSITION_KARAOKE   },.unit = "flags" },
> > -{ "forced"  , NULL, 0, AV_OPT_TYPE_CONST, { 
> > .i64 = AV_DISPOSITION_FORCED},.unit = "flags" },
> > -{ "hearing_impaired", NULL, 0, AV_OPT_TYPE_CONST, { 
> > .i64 = AV_DISPOSITION_HEARING_IMPAIRED  },.unit = "flags" },
> > -{ "visual_impaired" , NULL, 0, AV_OPT_TYPE_CONST, { 
> > .i64 = AV_DISPOSITION_VISUAL_IMPAIRED   },.unit = "flags" },
> > -{ "clean_effects"   , NULL, 0, AV_OPT_TYPE_CONST, { 
> > .i64 = AV_DISPOSITION_CLEAN_EFFECTS },.unit = "flags" },
> > -{ "captions", NULL, 0, AV_OPT_TYPE_CONST, { 
> > .i64 = AV_DISPOSITION_CAPTIONS  },.unit = "flags" },
> > -{ "descriptions", NULL, 0, AV_OPT_TYPE_CONST, { 
> > .i64 = AV_DISPOSITION_DESCRIPTIONS  },.unit = "flags" },
> > -{ "metadata", NULL, 0, AV_OPT_TYPE_CONST, { 
> > .i64 = AV_DISPOSITION_METADATA  },.unit = "flags" },
> > -{ NULL },
> > -};
> > -static const AVClass class = {
> > -.class_name = "",
> > -.item_name  = av_default_item_name,
> > -.option = opts,
> > -.version= LIBAVUTIL_VERSION_INT,
> > -};
> > -const AVClass *pclass = &class;
> > -
> > -ret = av_opt_eval_flags(&pclass, &opts[0], ost->disposition, 
> > &ost->st->disposition);
> > +const AVClass *pclass = avstream_get_class();
> > +const AVOption *o = av_opt_find(&pclass, "disposition", NULL, 
> > 0, 0);
> > +
> > +ret = av_opt_eval_flags(&pclass, o, ost->disposition, 
> > &ost->st->disposition);
> >  if (ret < 0)
> >  goto dump_format;
> >  }
> > diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> > index db72c18..e6cd301 100644
> > --- a/libavformat/avformat.h
> > +++ b/libavformat/avformat.h
> > @@ -1895,6 +1895,12 @@ void avformat_free_context(AVFormatContext *s);
> >  const AVClass *avformat_get_class(void);
> >  
> >  /**
> > + * Get the AVClass for AVStream. It can be used in combination with
> > + * AV_OPT_SEARCH_FAKE_OBJ for examining options.
> > + */
> > +const AVClass *avstream_get_class(void);
> > +
> > +/**
> >   * Add a new stream to a media file.
> >   *
> >   * When demuxing, it is called by the demuxer in read_header(). If the
> > diff --git a/libavformat/options.c b/libavformat/options.c
> > index 5044043..d10226d 100644
> > --- a/libavformat/options.c
> > +++ b/libavformat/options.c
> > @@ -130,3 +130,33 @@ const AVClass *avformat_get_class(void)
> >  {
> >  return &av_format_context_class;
> >  }
> > +
> > +static const AVOption stream_options[] = {
> > +{ "disposition" , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 0 }, 
> > INT64_MIN, INT64_MAX, .unit = "flags" },
> > +{ "default" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
> > AV_DISPOSITION_DEFAULT   },.unit = "flags" },
> > +{ "dub" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
> > AV_DISPOSITION_DUB   },.unit = "flags" },
> > +{ "original", NULL, 0, AV_OPT_TYPE_CO

Re: [FFmpeg-devel] [PATCH] Move stream_options to avformat

2015-01-24 Thread wm4
On Sun, 25 Jan 2015 01:56:30 +0100
Michael Niedermayer  wrote:

> TODO: APIChanges/version bump
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  ffmpeg.c   |   30 --
>  libavformat/avformat.h |6 ++
>  libavformat/options.c  |   30 ++
>  3 files changed, 40 insertions(+), 26 deletions(-)
> 
> diff --git a/ffmpeg.c b/ffmpeg.c
> index b836448..af576c7 100644
> --- a/ffmpeg.c
> +++ b/ffmpeg.c
> @@ -2970,32 +2970,10 @@ static int transcode_init(void)
>  }
>  
>  if (ost->disposition) {
> -static const AVOption opts[] = {
> -{ "disposition" , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 
> = 0 }, INT64_MIN, INT64_MAX, .unit = "flags" },
> -{ "default" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 
> = AV_DISPOSITION_DEFAULT   },.unit = "flags" },
> -{ "dub" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 
> = AV_DISPOSITION_DUB   },.unit = "flags" },
> -{ "original", NULL, 0, AV_OPT_TYPE_CONST, { .i64 
> = AV_DISPOSITION_ORIGINAL  },.unit = "flags" },
> -{ "comment" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 
> = AV_DISPOSITION_COMMENT   },.unit = "flags" },
> -{ "lyrics"  , NULL, 0, AV_OPT_TYPE_CONST, { .i64 
> = AV_DISPOSITION_LYRICS},.unit = "flags" },
> -{ "karaoke" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 
> = AV_DISPOSITION_KARAOKE   },.unit = "flags" },
> -{ "forced"  , NULL, 0, AV_OPT_TYPE_CONST, { .i64 
> = AV_DISPOSITION_FORCED},.unit = "flags" },
> -{ "hearing_impaired", NULL, 0, AV_OPT_TYPE_CONST, { .i64 
> = AV_DISPOSITION_HEARING_IMPAIRED  },.unit = "flags" },
> -{ "visual_impaired" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 
> = AV_DISPOSITION_VISUAL_IMPAIRED   },.unit = "flags" },
> -{ "clean_effects"   , NULL, 0, AV_OPT_TYPE_CONST, { .i64 
> = AV_DISPOSITION_CLEAN_EFFECTS },.unit = "flags" },
> -{ "captions", NULL, 0, AV_OPT_TYPE_CONST, { .i64 
> = AV_DISPOSITION_CAPTIONS  },.unit = "flags" },
> -{ "descriptions", NULL, 0, AV_OPT_TYPE_CONST, { .i64 
> = AV_DISPOSITION_DESCRIPTIONS  },.unit = "flags" },
> -{ "metadata", NULL, 0, AV_OPT_TYPE_CONST, { .i64 
> = AV_DISPOSITION_METADATA  },.unit = "flags" },
> -{ NULL },
> -};
> -static const AVClass class = {
> -.class_name = "",
> -.item_name  = av_default_item_name,
> -.option = opts,
> -.version= LIBAVUTIL_VERSION_INT,
> -};
> -const AVClass *pclass = &class;
> -
> -ret = av_opt_eval_flags(&pclass, &opts[0], ost->disposition, 
> &ost->st->disposition);
> +const AVClass *pclass = avstream_get_class();
> +const AVOption *o = av_opt_find(&pclass, "disposition", NULL, 0, 
> 0);
> +
> +ret = av_opt_eval_flags(&pclass, o, ost->disposition, 
> &ost->st->disposition);
>  if (ret < 0)
>  goto dump_format;
>  }
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index db72c18..e6cd301 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -1895,6 +1895,12 @@ void avformat_free_context(AVFormatContext *s);
>  const AVClass *avformat_get_class(void);
>  
>  /**
> + * Get the AVClass for AVStream. It can be used in combination with
> + * AV_OPT_SEARCH_FAKE_OBJ for examining options.
> + */
> +const AVClass *avstream_get_class(void);
> +
> +/**
>   * Add a new stream to a media file.
>   *
>   * When demuxing, it is called by the demuxer in read_header(). If the
> diff --git a/libavformat/options.c b/libavformat/options.c
> index 5044043..d10226d 100644
> --- a/libavformat/options.c
> +++ b/libavformat/options.c
> @@ -130,3 +130,33 @@ const AVClass *avformat_get_class(void)
>  {
>  return &av_format_context_class;
>  }
> +
> +static const AVOption stream_options[] = {
> +{ "disposition" , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 0 }, 
> INT64_MIN, INT64_MAX, .unit = "flags" },
> +{ "default" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
> AV_DISPOSITION_DEFAULT   },.unit = "flags" },
> +{ "dub" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
> AV_DISPOSITION_DUB   },.unit = "flags" },
> +{ "original", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
> AV_DISPOSITION_ORIGINAL  },.unit = "flags" },
> +{ "comment" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
> AV_DISPOSITION_COMMENT   },.unit = "flags" },
> +{ "lyrics"  , NULL, 0, AV_OPT_TYPE_C

[FFmpeg-devel] [PATCH] x86/sbrdsp: add ff_sbr_autocorrelate_{sse, sse3}

2015-01-24 Thread James Almer
2 to 2.5 times faster.

Signed-off-by: James Almer 
---
 libavcodec/x86/sbrdsp.asm| 114 +++
 libavcodec/x86/sbrdsp_init.c |   8 +++
 2 files changed, 122 insertions(+)

diff --git a/libavcodec/x86/sbrdsp.asm b/libavcodec/x86/sbrdsp.asm
index 6f2e4f4..c9f2d88 100644
--- a/libavcodec/x86/sbrdsp.asm
+++ b/libavcodec/x86/sbrdsp.asm
@@ -25,6 +25,7 @@ SECTION_RODATA
 ; mask equivalent for multiply by -1.0 1.0
 ps_mask times 2 dd 1<<31, 0
 ps_mask2times 2 dd 0, 1<<31
+ps_mask3dd  0, 0, 0, 1<<31
 ps_noise0   times 2 dd  1.0,  0.0,
 ps_noise2   times 2 dd -1.0,  0.0
 ps_noise13  dd  0.0,  1.0, 0.0, -1.0
@@ -445,3 +446,116 @@ cglobal sbr_qmf_deint_neg, 2,4,4,v,src,vrev,c
 addcq, mmsize
 jl  .loop
 REP_RET
+
+%macro SBR_AUTOCORRELATE 0
+cglobal sbr_autocorrelate, 2,3,8,32, x, phi, cnt
+movcntq, 37*8
+addxq, cntq
+negcntq
+
+%if cpuflag(sse3)
+movddup m5, [xq+cntq]
+%else
+movlps  m5, [xq+cntq]
+movlhps m5, m5
+%endif
+movlps  m7, [xq+cntq+8 ]
+movlps  m1, [xq+cntq+16]
+shufps  m7, m7, q0110
+shufps  m1, m1, q0110
+mulps   m3, m5, m7   ;  x[0][0] * x[1][0], x[0][1] * x[1][1], 
x[0][0] * x[1][1], x[0][1] * x[1][0]
+mulps   m4, m5, m5   ;  x[0][0] * x[0][0], x[0][1] * x[0][1];
+mulps   m5, m1   ; real_sum2  = x[0][0] * x[2][0], x[0][1] * x[2][1], 
x[0][0] * x[2][1], x[0][1] * x[2][0]
+movaps  [rsp   ], m3
+movaps  [rsp+16], m4
+add cntq, 8
+
+movlps  m2, [xq+cntq+16]
+movlhps m7, m7
+shufps  m2, m2, q0110
+mulps   m6, m7, m1   ; real_sum1  = x[1][0] * x[2][0], x[1][1] * x[2][1], 
x[1][0] * x[2][1], x[1][1] * x[2][0]
+mulps   m4, m7, m2
+mulps   m7, m7   ; real_sum0  = x[1][0] * x[1][0], x[1][1] * x[1][1];
+addps   m5, m4   ; real_sum2 += x[1][0] * x[3][0], x[1][1] * x[3][1], 
x[1][0] * x[3][1], x[1][1] * x[3][0]
+
+align 16
+.loop:
+add cntq, 8
+movlps  m0, [xq+cntq+16]
+movlhps m1, m1
+shufps  m0, m0, q0110
+mulps   m3, m1, m2
+mulps   m4, m1, m0
+mulps   m1, m1
+addps   m6, m3   ; real_sum1 += x[i][0] * x[i + 1][0], x[i][1] * x[i + 
1][1], x[i][0] * x[i + 1][1], x[i][1] * x[i + 1][0];
+addps   m5, m4   ; real_sum2 += x[i][0] * x[i + 2][0], x[i][1] * x[i + 
2][1], x[i][0] * x[i + 2][1], x[i][1] * x[i + 2][0];
+addps   m7, m1   ; real_sum0 += x[i][0] * x[i][0], x[i][1] * 
x[i][1];
+add cntq, 8
+movlps  m1, [xq+cntq+16]
+movlhps m2, m2
+shufps  m1, m1, q0110
+mulps   m3, m2, m0
+mulps   m4, m2, m1
+mulps   m2, m2
+addps   m6, m3   ; real_sum1 += x[i][0] * x[i + 1][0], x[i][1] * x[i + 
1][1], x[i][0] * x[i + 1][1], x[i][1] * x[i + 1][0];
+addps   m5, m4   ; real_sum2 += x[i][0] * x[i + 2][0], x[i][1] * x[i + 
2][1], x[i][0] * x[i + 2][1], x[i][1] * x[i + 2][0];
+addps   m7, m2   ; real_sum0 += x[i][0] * x[i][0], x[i][1] * 
x[i][1];
+add cntq, 8
+movlps  m2, [xq+cntq+16]
+movlhps m0, m0
+shufps  m2, m2, q0110
+mulps   m3, m0, m1
+mulps   m4, m0, m2
+mulps   m0, m0
+addps   m6, m3   ; real_sum1 += x[i][0] * x[i + 1][0], x[i][1] * x[i + 
1][1], x[i][0] * x[i + 1][1], x[i][1] * x[i + 1][0];
+addps   m5, m4   ; real_sum2 += x[i][0] * x[i + 2][0], x[i][1] * x[i + 
2][1], x[i][0] * x[i + 2][1], x[i][1] * x[i + 2][0];
+addps   m7, m0   ; real_sum0 += x[i][0] * x[i][0], x[i][1] * 
x[i][1];
+jl .loop
+
+movlhps m1, m1
+mulps   m4, m1, m2
+mulps   m1, m1
+addps   m4, m6   ; real_sum1 + x[38][0] * x[39][0] + x[38][1] * 
x[39][1]; imag_sum1 + x[38][0] * x[39][1] - x[38][1] * x[39][0];
+addps   m1, m7   ; real_sum0 + x[38][0] * x[38][0] + x[38][1] * 
x[38][1];
+addps   m6, [rsp   ] ; real_sum1 + x[ 0][0] * x[ 1][0] + x[ 0][1] * x[ 
1][1]; imag_sum1 + x[ 0][0] * x[ 1][1] - x[ 0][1] * x[ 1][0];
+addps   m7, [rsp+16] ; real_sum0 + x[ 0][0] * x[ 0][0] + x[ 0][1] * x[ 
0][1];
+
+xorps   m4, [ps_mask3]
+xorps   m5, [ps_mask3]
+xorps   m6, [ps_mask3]
+%if cpuflag(sse3)
+movshdup m2, m1
+haddps  m4, m5
+haddps  m7, m6
+addss   m1, m2
+%else
+movaps  m3, m4
+movaps  m2, m5
+movaps  m0, m6
+shufps  m3, m3, q0301
+shufps  m2, m2, q0301
+shufps  m0, m0, q0301
+addps   m4, m3
+addps   m5, m2
+addps   m6, m0
+
+movss   m2, m7
+movss   m3, m1
+shufps  m7, m7, q0001
+shufps  m1, m1, q0001
+addss   m7, m2
+addss   m1, m3
+shufps  m4, m5, q2020
+shufps  m7, m6, q2020
+%endif
+movaps  [phiq ], m4
+movhps  [phiq+0x18], m7
+movss   [phiq+0x28], m7
+movss   [phiq+0x10], m1
+RET
+%endmacro
+
+INIT_XMM sse
+SBR_AUTOCORRELATE
+INIT_XMM sse3
+SBR_AUTOCORRELATE
diff --git a/libavcodec/x86/sbrdsp_init.c b/libavcodec/x86/sbrdsp_init.c
index a2aca74..6911a1a 100644
--- a/libavcodec/x86/sb

Re: [FFmpeg-devel] [PATCH] ffmpeg: allow overriding and amending AVStream->disposition

2015-01-24 Thread Michael Niedermayer
On Thu, Jan 08, 2015 at 11:23:57PM +0100, Michael Niedermayer wrote:
> On Thu, Jan 08, 2015 at 11:09:14PM +0100, Nicolas George wrote:
> > Le nonidi 19 nivôse, an CCXXIII, Michael Niedermayer a écrit :
> > > + { "default"   , ... { .i64 = AV_DISPOSITION_DEFAULT }, ...
> > > + { "dub"   , ... { .i64 = AV_DISPOSITION_DUB }, ...
> > > + { "original"  , ... { .i64 = AV_DISPOSITION_ORIGINAL}, ...
> > 
> > 
> > That makes the third copy of this flag↔string table in the code base: it is
> > probably time to make it available through the API. Something like:
> > 
> 
> > const char *av_disposition_get_name(unsigned disposition);
> > 
> > Then the option table in this patch can be built on the fly.
> 
> that would work for this usecase but the table really should be
> part of the AVOptions/AVClass of AVStream
> and that would have to be constant and not runtime generated
> the other uses could be changed to use that table though possibly
> 
> so i suggest to leave this table as is and eventually move it to
> some common place in lavf as part of a AVStream AVClass/AVOptions
> and then replace all uses by that table

patch applied

patch to do that move sent

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] Move stream_options to avformat

2015-01-24 Thread Michael Niedermayer
TODO: APIChanges/version bump

Signed-off-by: Michael Niedermayer 
---
 ffmpeg.c   |   30 --
 libavformat/avformat.h |6 ++
 libavformat/options.c  |   30 ++
 3 files changed, 40 insertions(+), 26 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index b836448..af576c7 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2970,32 +2970,10 @@ static int transcode_init(void)
 }
 
 if (ost->disposition) {
-static const AVOption opts[] = {
-{ "disposition" , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 
0 }, INT64_MIN, INT64_MAX, .unit = "flags" },
-{ "default" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
AV_DISPOSITION_DEFAULT   },.unit = "flags" },
-{ "dub" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
AV_DISPOSITION_DUB   },.unit = "flags" },
-{ "original", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
AV_DISPOSITION_ORIGINAL  },.unit = "flags" },
-{ "comment" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
AV_DISPOSITION_COMMENT   },.unit = "flags" },
-{ "lyrics"  , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
AV_DISPOSITION_LYRICS},.unit = "flags" },
-{ "karaoke" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
AV_DISPOSITION_KARAOKE   },.unit = "flags" },
-{ "forced"  , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
AV_DISPOSITION_FORCED},.unit = "flags" },
-{ "hearing_impaired", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
AV_DISPOSITION_HEARING_IMPAIRED  },.unit = "flags" },
-{ "visual_impaired" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
AV_DISPOSITION_VISUAL_IMPAIRED   },.unit = "flags" },
-{ "clean_effects"   , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
AV_DISPOSITION_CLEAN_EFFECTS },.unit = "flags" },
-{ "captions", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
AV_DISPOSITION_CAPTIONS  },.unit = "flags" },
-{ "descriptions", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
AV_DISPOSITION_DESCRIPTIONS  },.unit = "flags" },
-{ "metadata", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
AV_DISPOSITION_METADATA  },.unit = "flags" },
-{ NULL },
-};
-static const AVClass class = {
-.class_name = "",
-.item_name  = av_default_item_name,
-.option = opts,
-.version= LIBAVUTIL_VERSION_INT,
-};
-const AVClass *pclass = &class;
-
-ret = av_opt_eval_flags(&pclass, &opts[0], ost->disposition, 
&ost->st->disposition);
+const AVClass *pclass = avstream_get_class();
+const AVOption *o = av_opt_find(&pclass, "disposition", NULL, 0, 
0);
+
+ret = av_opt_eval_flags(&pclass, o, ost->disposition, 
&ost->st->disposition);
 if (ret < 0)
 goto dump_format;
 }
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index db72c18..e6cd301 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1895,6 +1895,12 @@ void avformat_free_context(AVFormatContext *s);
 const AVClass *avformat_get_class(void);
 
 /**
+ * Get the AVClass for AVStream. It can be used in combination with
+ * AV_OPT_SEARCH_FAKE_OBJ for examining options.
+ */
+const AVClass *avstream_get_class(void);
+
+/**
  * Add a new stream to a media file.
  *
  * When demuxing, it is called by the demuxer in read_header(). If the
diff --git a/libavformat/options.c b/libavformat/options.c
index 5044043..d10226d 100644
--- a/libavformat/options.c
+++ b/libavformat/options.c
@@ -130,3 +130,33 @@ const AVClass *avformat_get_class(void)
 {
 return &av_format_context_class;
 }
+
+static const AVOption stream_options[] = {
+{ "disposition" , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 0 }, 
INT64_MIN, INT64_MAX, .unit = "flags" },
+{ "default" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
AV_DISPOSITION_DEFAULT   },.unit = "flags" },
+{ "dub" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
AV_DISPOSITION_DUB   },.unit = "flags" },
+{ "original", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
AV_DISPOSITION_ORIGINAL  },.unit = "flags" },
+{ "comment" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
AV_DISPOSITION_COMMENT   },.unit = "flags" },
+{ "lyrics"  , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
AV_DISPOSITION_LYRICS},.unit = "flags" },
+{ "karaoke" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
AV_DISPOSITION_KARAOKE   },.unit = "flags" },
+{ "forced"  , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
AV_D

Re: [FFmpeg-devel] Question about supported_fps in libavutil/timecode.c::check_fps

2015-01-24 Thread Michael Niedermayer
On Sat, Jan 24, 2015 at 12:26:49PM -0800, jon morley wrote:
> Hi Clément,
> 
> I am sorry I was rude. That was not my intention. I was attempting
> to follow these directions from the ffmpeg.org page:
> 
> "You can use the FFmpeg libraries in your commercial program, but
> you are encouraged to publish any patch you make. In this case the
> best way to proceed is to send your patches to the ffmpeg-devel
> mailing list following the guidelines illustrated in the remainder
> of this document."
> 
> I will stick to mailing patches exclusively in the future.
> 
> Patches reflecting your suggestions attached.
> 
> Sincerely,
> Jon
> 
> On 1/24/15 8:21 AM, Clément Bœsch wrote:
> >On Sat, Jan 24, 2015 at 07:40:38AM -0800, jon morley wrote:
> >>Hi Clément,
> >>
> >
> >Hi,
> >
> >>That is a good point! I am attaching an additional patch to remove those
> >>cases even before entering the mod test loop.
> >>
> >>Now the logic should look like this:
> >>
> >>static int check_fps(int fps)
> >>{
> >
> >> if (fps <= 0) return -1;
> >>
> >> int i;
> >> static const int supported_fps_bases[] = {24, 25, 30};
> >
> >You can't put statements before declarations, some compilers will choke on
> >it.
> >
> >Also, please squash it with the previous patch since it wasn't applied
> >yet.
> >
> >>
> >> for (i = 0; i < FF_ARRAY_ELEMS(supported_fps_bases); i++)
> >> if (fps % supported_fps_bases[i] == 0)
> >> return 0;
> >> return -1;
> >>}
> >>
> >>I am still really curious to know if switching to this division (modulo)
> >>test breaks the "spirit" of check_fps. I could not find anywhere that
> >>benefited from the explicit list the method currently used, but that doesn't
> >>mean it isn't out there.
> >
> >I'm more concerned about how the rest of the code will behave. Typically,
> >av_timecode_adjust_ntsc_framenum2() could benefit from some improvements
> >(checking if fps % 30, and deducing drop_frames and frames_per_10mins
> >accordingly) if you allow such thing. Then you might need to adjust
> >check_timecode() as well to allow the drop frame for the other % 30.
> >
> >>
> >>Thanks,
> >>Jon
> >>
> >
> >[...]
> >
> >Note: please do not top post on this mailing list, it is considered rude.
> >
> >Regards,
> >
> >
> >
> >___
> >ffmpeg-devel mailing list
> >ffmpeg-devel@ffmpeg.org
> >http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >

>  timecode.c |   33 -
>  1 file changed, 16 insertions(+), 17 deletions(-)
> af5b5d09fd78bb929dc38e2cc11e562a281d5544  
> 0001-libavutil-timecode.c-Add-support-for-frame-rates-bey.patch
> From 95f1fb3695f086de1baa301015985742d688a159 Mon Sep 17 00:00:00 2001
> From: Jon Morley 
> Date: Sat, 24 Jan 2015 12:18:50 -0800
> Subject: [PATCH] libavutil/timecode.c: Add support for frame rates beyond 60
>  fps
> 
> Instead of looking for specifically supported frame rates this
> collection of changes checks to see if the given rates are evenly
> divisible by supported common factors.
> ---
>  libavutil/timecode.c | 33 -
>  1 file changed, 16 insertions(+), 17 deletions(-)
> 
> diff --git a/libavutil/timecode.c b/libavutil/timecode.c
> index 1dfd040..c2469c0 100644
> --- a/libavutil/timecode.c
> +++ b/libavutil/timecode.c
> @@ -33,18 +33,15 @@
>  
>  int av_timecode_adjust_ntsc_framenum2(int framenum, int fps)
>  {
> -/* only works for NTSC 29.97 and 59.94 */
> +int factor = 1;
>  int drop_frames = 0;
>  int d, m, frames_per_10mins;
>  
> -if (fps == 30) {
> -drop_frames = 2;
> -frames_per_10mins = 17982;
> -} else if (fps == 60) {
> -drop_frames = 4;
> -frames_per_10mins = 35964;
> -} else
> -return framenum;
> +if (fps < 30 || fps % 30 != 0) return framenum;
> +
> +factor = fps / 30;
> +drop_frames = factor * 2;
> +frames_per_10mins = factor * 17982;
>  
>  d = framenum / frames_per_10mins;
>  m = framenum % frames_per_10mins;
> @@ -141,10 +138,12 @@ char *av_timecode_make_mpeg_tc_string(char *buf, 
> uint32_t tc25bit)
>  static int check_fps(int fps)
>  {
>  int i;
> -static const int supported_fps[] = {24, 25, 30, 48, 50, 60};
> +static const int supported_fps_multiples[] = {24, 25, 30};
> +
> +if (fps <= 0) return -1;
>  
> -for (i = 0; i < FF_ARRAY_ELEMS(supported_fps); i++)
> -if (fps == supported_fps[i])
> +for (i = 0; i < FF_ARRAY_ELEMS(supported_fps_multiples); i++)
> +if (fps % supported_fps_multiples[i] == 0)
>  return 0;
>  return -1;
>  }
> @@ -155,8 +154,8 @@ static int check_timecode(void *log_ctx, AVTimecode *tc)
>  av_log(log_ctx, AV_LOG_ERROR, "Timecode frame rate must be 
> specified\n");
>  return AVERROR(EINVAL);
>  }
> -if ((tc->flags & AV_TIMECODE_FLAG_DROPFRAME) && tc->fps != 30 && tc->fps 
> != 60) {
> -av_log(log_ctx, AV_LOG_ERROR, "Drop frame is only allowed wit

Re: [FFmpeg-devel] [PATCH] nvenc: Propagate desired number of reference frames.

2015-01-24 Thread Michael Niedermayer
On Sat, Jan 24, 2015 at 12:52:58PM -0800, Philip Langdale wrote:
> ---
>  libavcodec/nvenc.c | 5 +
>  1 file changed, 5 insertions(+)

applied

thanks

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are best at talking, realize last or never when they are wrong.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Port mp=eq/eq2 to lavfi

2015-01-24 Thread Paul B Mahol
On 1/24/15, Paul B Mahol  wrote:
> From: Arwa Arif 
>
> Code adapted from James Darnley's port
>
> Signed-off-by: Paul B Mahol 
> ---
>  configure|   1 +
>  doc/filters.texi |  43 
>  libavfilter/Makefile |   1 +
>  libavfilter/allfilters.c |   1 +
>  libavfilter/version.h|   4 +-
>  libavfilter/vf_eq.c  | 273
> +++
>  libavfilter/vf_eq.h  |  60 +++
>  libavfilter/x86/Makefile |   1 +
>  libavfilter/x86/vf_eq.c  |  97 +
>  9 files changed, 479 insertions(+), 2 deletions(-)
>  create mode 100644 libavfilter/vf_eq.c
>  create mode 100644 libavfilter/vf_eq.h
>  create mode 100644 libavfilter/x86/vf_eq.c
>

Should be bit-exact with mp=eq2.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] Port mp=eq/eq2 to lavfi

2015-01-24 Thread Paul B Mahol
From: Arwa Arif 

Code adapted from James Darnley's port

Signed-off-by: Paul B Mahol 
---
 configure|   1 +
 doc/filters.texi |  43 
 libavfilter/Makefile |   1 +
 libavfilter/allfilters.c |   1 +
 libavfilter/version.h|   4 +-
 libavfilter/vf_eq.c  | 273 +++
 libavfilter/vf_eq.h  |  60 +++
 libavfilter/x86/Makefile |   1 +
 libavfilter/x86/vf_eq.c  |  97 +
 9 files changed, 479 insertions(+), 2 deletions(-)
 create mode 100644 libavfilter/vf_eq.c
 create mode 100644 libavfilter/vf_eq.h
 create mode 100644 libavfilter/x86/vf_eq.c

diff --git a/configure b/configure
index 0b6be39..9fcdaee 100755
--- a/configure
+++ b/configure
@@ -2581,6 +2581,7 @@ delogo_filter_deps="gpl"
 deshake_filter_select="pixelutils"
 drawtext_filter_deps="libfreetype"
 ebur128_filter_deps="gpl"
+eq_filter_deps="gpl"
 flite_filter_deps="libflite"
 frei0r_filter_deps="frei0r dlopen"
 frei0r_src_filter_deps="frei0r dlopen"
diff --git a/doc/filters.texi b/doc/filters.texi
index 64384d0..e88bbf7 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -4335,6 +4335,49 @@ edgedetect=mode=colormix:high=0
 @end example
 @end itemize
 
+@section eq
+Set brightness, contrast, saturation and gamma adjustment.
+
+The filter accepts the following options:
+
+@table @option
+@item brightness
+Set the brightness value. It accepts a float value in range @code{-1.0} to
+@code{1.0}. The default value is @code{0.0}.
+
+@item contrast
+Set the contrast value. It accepts a float value in range @code{-2.0} to
+@code{2.0}. The default value is @code{0.0}.
+
+@item gamma
+Set the gamma value. It accepts a float value in range @code{0.1} to 
@code{10.0}.
+The default value is @code{1.0}.
+
+@item gamma_y
+Set the gamma value for the luma plane. It accepts a float value in range
+@code{0.1} to @code{10.0}. The default value is @code{1.0}.
+
+@item gamma_u
+Set the gamma value for 1st chroma plane. It accepts a float value in range
+@code{0.1} to @code{10.0}. The default value is @code{1.0}.
+
+@item gamma_v
+Set the gamma value for 2nd chroma plane. It accepts a float value in range
+@code{0.1} to @code{10.0}. The default value is @code{1.0}.
+
+@item saturation
+Set the saturation value. It accepts a float value in range @code{0.0} to
+@code{3.0}. The default value is @code{1.0}.
+
+@item gamma_weight
+Can be used to reduce the effect of a high gamma value on bright image areas,
+e.g. keep them from getting overamplified and just plain white. It accepts a
+float value in range @code{0.0} to @code{1.0}.A value of @code{0.0} turns the
+gamma correction all the way down while @code{1.0} leaves it at its full 
strength.
+Default is @code{1.0}.
+
+@end table
+
 @section extractplanes
 
 Extract color channel components from input video stream into
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index f7285b3..d14418c 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -116,6 +116,7 @@ OBJS-$(CONFIG_DRAWGRID_FILTER)   += vf_drawbox.o
 OBJS-$(CONFIG_DRAWTEXT_FILTER)   += vf_drawtext.o
 OBJS-$(CONFIG_ELBG_FILTER)   += vf_elbg.o
 OBJS-$(CONFIG_EDGEDETECT_FILTER) += vf_edgedetect.o
+OBJS-$(CONFIG_EQ_FILTER) += vf_eq.o
 OBJS-$(CONFIG_EXTRACTPLANES_FILTER)  += vf_extractplanes.o
 OBJS-$(CONFIG_FADE_FILTER)   += vf_fade.o
 OBJS-$(CONFIG_FIELD_FILTER)  += vf_field.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 028e3ea..f4af8ec 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -132,6 +132,7 @@ void avfilter_register_all(void)
 REGISTER_FILTER(DRAWTEXT,   drawtext,   vf);
 REGISTER_FILTER(EDGEDETECT, edgedetect, vf);
 REGISTER_FILTER(ELBG,   elbg,   vf);
+REGISTER_FILTER(EQ, eq, vf);
 REGISTER_FILTER(EXTRACTPLANES,  extractplanes,  vf);
 REGISTER_FILTER(FADE,   fade,   vf);
 REGISTER_FILTER(FIELD,  field,  vf);
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 01a9348..e677289 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -30,8 +30,8 @@
 #include "libavutil/version.h"
 
 #define LIBAVFILTER_VERSION_MAJOR  5
-#define LIBAVFILTER_VERSION_MINOR  8
-#define LIBAVFILTER_VERSION_MICRO 101
+#define LIBAVFILTER_VERSION_MINOR  9
+#define LIBAVFILTER_VERSION_MICRO 100
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
diff --git a/libavfilter/vf_eq.c b/libavfilter/vf_eq.c
new file mode 100644
index 000..54550c9
--- /dev/null
+++ b/libavfilter/vf_eq.c
@@ -0,0 +1,273 @@
+/*
+ * Original MPlayer filters by Richard Felker, Hampa Hug, Daniel Moreno,
+ * and Michael Niedermeyer.
+ *
+ * Copyright (c) 2014 James Darnley 
+ * Copyright (c) 201

Re: [FFmpeg-devel] [PATCH] nvenc: Propagate desired number of reference frames.

2015-01-24 Thread Philip Langdale
On Sat, 24 Jan 2015 20:28:30 +0100
Michael Niedermayer  wrote:

> On Sat, Jan 24, 2015 at 10:11:21AM -0800, Philip Langdale wrote:
> > On Sat, 24 Jan 2015 13:02:01 +0100
> > Michael Niedermayer  wrote:
> > 
> > > On Fri, Jan 23, 2015 at 09:41:23PM -0800, Philip Langdale wrote:
> > 
> > Yeah, I've got Timo's b-frame patch in my tree. Don't you want to
> > apply that?
> 
> Iam not sure if that would break intra only encoding, so i wont
> apply this before timo or someone else who knows the code says i
> should apply it

Fair enough. I'm re-creating and re-sending the diff. As for the
b-frame patch, it will prevent requesting intra-only - that's true.
I'm not sure how you ask x264 for intra-only - I guess it would be
good to follow that as a pattern.

--phil
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] nvenc: Propagate desired number of reference frames.

2015-01-24 Thread Philip Langdale
---
 libavcodec/nvenc.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 7d82d58..16ef93f 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -590,6 +590,11 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx)
 memcpy(&ctx->encode_config, &preset_config.presetCfg, 
sizeof(ctx->encode_config));
 ctx->encode_config.version = NV_ENC_CONFIG_VER;
 
+if (avctx->refs >= 0) {
+/* 0 means "let the hardware decide" */
+ctx->encode_config.encodeCodecConfig.h264Config.maxNumRefFrames = 
avctx->refs;
+}
+
 if (avctx->gop_size >= 0) {
 ctx->encode_config.gopLength = avctx->gop_size;
 ctx->encode_config.encodeCodecConfig.h264Config.idrPeriod = 
avctx->gop_size;
-- 
2.1.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] libavutil: Added twofish block cipher

2015-01-24 Thread Giorgio Vazzana
Hello,

thanks for the new patch. As I said the code looks quite good, here's
what I spotted in my review:

> From b46d6a457aeee319fc6e56217a265c9881a34c2c Mon Sep 17 00:00:00 2001
> From: Supraja Meedinti 
> Date: Thu, 15 Jan 2015 21:35:16 +0530
> Subject: [PATCH] libavutil: Added Twofish block cipher
>
> Signed-off-by: Supraja Meedinti 
> ---
>  libavutil/Makefile  |   3 +
>  libavutil/twofish.c | 373 
> 
>  libavutil/twofish.h |  70 ++

Missing changelog entry.

>  3 files changed, 446 insertions(+)
>  create mode 100644 libavutil/twofish.c
>  create mode 100644 libavutil/twofish.h
>
> diff --git a/libavutil/Makefile b/libavutil/Makefile
> index 4db89b8..6caf896 100644
> --- a/libavutil/Makefile
> +++ b/libavutil/Makefile
> @@ -60,6 +60,7 @@ HEADERS = adler32.h 
> \
>time.h\
>timecode.h\
>timestamp.h   \
> +  twofish.h \
>version.h \
>xtea.h\
>
> @@ -129,6 +130,7 @@ OBJS = adler32.o  
>   \
> time.o   \
> timecode.o   \
> tree.o   \
> +   twofish.o\
> utils.o  \
> xga_font_data.o  \
> xtea.o   \
> @@ -184,6 +186,7 @@ TESTPROGS = adler32   
>   \
>  sha512  \
>  softfloat   \
>  tree\
> +twofish \
>  utf8\
>  xtea\
>
> diff --git a/libavutil/twofish.c b/libavutil/twofish.c
> new file mode 100644
> index 000..b57a48c
> --- /dev/null
> +++ b/libavutil/twofish.c
> @@ -0,0 +1,373 @@
> +/*
> + * An implementation of the TwoFish algorithm
> + * Copyright (c) 2015 Supraja Meedinti
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
> + */
> +#include "twofish.h"
> +#include "common.h"
> +#include "intreadwrite.h"
> +#include "attributes.h"
> +
> +#define LR(x, n) ((x) << (n) | (x) >> (32 - (n)))
> +#define RR(x, n) ((x) >> (n) | (x) << (32 - (n)))

> +#define R4(x) ((x) >> 1 | (x) << 3)

This macro is never used.

> +#define sk_inc 0x02020202
> +#define sk_nex 0x01010101

I believe these are not needed, see below.

> +
> +typedef struct AVTWOFISH {
> +uint32_t K[40];
> +uint32_t S[4];
> +int ksize;
> +} AVTWOFISH;
> +
> +static const uint8_t MD1[256] = {
> +0x00, 0x5b, 0xb6, 0xed, 0x05, 0x5e, 0xb3, 0xe8, 0x0a, 0x51, 0xbc, 0xe7, 
> 0x0f, 0x54, 0xb9, 0xe2,
> +0x14, 0x4f, 0xa2, 0xf9, 0x11, 0x4a, 0xa7, 0xfc, 0x1e, 0x45, 0xa8, 0xf3, 
> 0x1b, 0x40, 0xad, 0xf6,
> +0x28, 0x73, 0x9e, 0xc5, 0x2d, 0x76, 0x9b, 0xc0, 0x22, 0x79, 0x94, 0xcf, 
> 0x27, 0x7c, 0x91, 0xca,
> +0x3c, 0x67, 0x8a, 0xd1, 0x39, 0x62, 0x8f, 0xd4, 0x36, 0x6d, 0x80, 0xdb, 
> 0x33, 0x68, 0x85, 0xde,
> +0x50, 0x0b, 0xe6, 0xbd, 0x55, 0x0e, 0xe3, 0xb8, 0x5a, 0x01, 0xec, 0xb7, 
> 0x5f, 0x04, 0xe9, 0xb2,
> +0x44, 0x1f, 0xf2, 0xa9, 0x41, 0x1a, 0xf7, 0xac, 0x4e, 0x15, 0xf8, 0xa3, 
> 0x4b, 0x10, 0xfd, 0xa6,
> +0x78, 0x23, 0xce, 0x95, 0x7d, 0x26, 0xcb, 0x90, 0x72, 0x29, 0xc4, 0x9f, 
> 0x77, 0x2c, 0xc1, 0x9a,
> +0x6c, 0x37, 0xda, 0x81, 0x69, 0x32, 0xdf, 0x84, 0x66, 0x3d, 0xd0, 0x8b, 

Re: [FFmpeg-devel] Question about supported_fps in libavutil/timecode.c::check_fps

2015-01-24 Thread Clément Bœsch
On Sat, Jan 24, 2015 at 09:09:05PM +0100, wm4 wrote:
> On Sat, 24 Jan 2015 18:37:01 +
> Derek Buitenhuis  wrote:
> 
> > On 1/24/2015 4:33 PM, wm4 wrote:
> > > Which ones? We even expect C99 support from the compiler.
> > 
> > Doesn't matter. It's the project's policy to have decls at
> > block beginnings. Yes some of us think it's better.
> > 
> > We know you don't. Don't start an ideological troll war.
> 
> Having dumb policies is fine, but then don't use broken compilers as
> excuse. Just say it's your policy to do it this way, even if there's no
> technical necessity.

   -Wdeclaration-after-statement (C and Objective-C only)
   Warn when a declaration is found after a statement in a block.
   This construct, known from C++, was introduced with ISO C99 and
   is by default allowed in GCC.  It is not supported by ISO C90 and
   was not supported by GCC versions before GCC 3.0.

We used to support GCC < 3.0. I don't think we still have a FATE instance for
it. But it still generates a warning, so we can somehow consider modern
compilers don't "like it" either. If "choke" was not appropriate, sorry
about that.

-- 
Clément B.


pgpQI0Jb3Oju5.pgp
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Question about supported_fps in libavutil/timecode.c::check_fps

2015-01-24 Thread jon morley

Hi Clément,

I am sorry I was rude. That was not my intention. I was attempting to 
follow these directions from the ffmpeg.org page:


"You can use the FFmpeg libraries in your commercial program, but you 
are encouraged to publish any patch you make. In this case the best way 
to proceed is to send your patches to the ffmpeg-devel mailing list 
following the guidelines illustrated in the remainder of this document."


I will stick to mailing patches exclusively in the future.

Patches reflecting your suggestions attached.

Sincerely,
Jon

On 1/24/15 8:21 AM, Clément Bœsch wrote:

On Sat, Jan 24, 2015 at 07:40:38AM -0800, jon morley wrote:

Hi Clément,



Hi,


That is a good point! I am attaching an additional patch to remove those
cases even before entering the mod test loop.

Now the logic should look like this:

static int check_fps(int fps)
{



 if (fps <= 0) return -1;

 int i;
 static const int supported_fps_bases[] = {24, 25, 30};


You can't put statements before declarations, some compilers will choke on
it.

Also, please squash it with the previous patch since it wasn't applied
yet.



 for (i = 0; i < FF_ARRAY_ELEMS(supported_fps_bases); i++)
 if (fps % supported_fps_bases[i] == 0)
 return 0;
 return -1;
}

I am still really curious to know if switching to this division (modulo)
test breaks the "spirit" of check_fps. I could not find anywhere that
benefited from the explicit list the method currently used, but that doesn't
mean it isn't out there.


I'm more concerned about how the rest of the code will behave. Typically,
av_timecode_adjust_ntsc_framenum2() could benefit from some improvements
(checking if fps % 30, and deducing drop_frames and frames_per_10mins
accordingly) if you allow such thing. Then you might need to adjust
check_timecode() as well to allow the drop frame for the other % 30.



Thanks,
Jon



[...]

Note: please do not top post on this mailing list, it is considered rude.

Regards,



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

>From 95f1fb3695f086de1baa301015985742d688a159 Mon Sep 17 00:00:00 2001
From: Jon Morley 
Date: Sat, 24 Jan 2015 12:18:50 -0800
Subject: [PATCH] libavutil/timecode.c: Add support for frame rates beyond 60
 fps

Instead of looking for specifically supported frame rates this
collection of changes checks to see if the given rates are evenly
divisible by supported common factors.
---
 libavutil/timecode.c | 33 -
 1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/libavutil/timecode.c b/libavutil/timecode.c
index 1dfd040..c2469c0 100644
--- a/libavutil/timecode.c
+++ b/libavutil/timecode.c
@@ -33,18 +33,15 @@
 
 int av_timecode_adjust_ntsc_framenum2(int framenum, int fps)
 {
-/* only works for NTSC 29.97 and 59.94 */
+int factor = 1;
 int drop_frames = 0;
 int d, m, frames_per_10mins;
 
-if (fps == 30) {
-drop_frames = 2;
-frames_per_10mins = 17982;
-} else if (fps == 60) {
-drop_frames = 4;
-frames_per_10mins = 35964;
-} else
-return framenum;
+if (fps < 30 || fps % 30 != 0) return framenum;
+
+factor = fps / 30;
+drop_frames = factor * 2;
+frames_per_10mins = factor * 17982;
 
 d = framenum / frames_per_10mins;
 m = framenum % frames_per_10mins;
@@ -141,10 +138,12 @@ char *av_timecode_make_mpeg_tc_string(char *buf, uint32_t 
tc25bit)
 static int check_fps(int fps)
 {
 int i;
-static const int supported_fps[] = {24, 25, 30, 48, 50, 60};
+static const int supported_fps_multiples[] = {24, 25, 30};
+
+if (fps <= 0) return -1;
 
-for (i = 0; i < FF_ARRAY_ELEMS(supported_fps); i++)
-if (fps == supported_fps[i])
+for (i = 0; i < FF_ARRAY_ELEMS(supported_fps_multiples); i++)
+if (fps % supported_fps_multiples[i] == 0)
 return 0;
 return -1;
 }
@@ -155,8 +154,8 @@ static int check_timecode(void *log_ctx, AVTimecode *tc)
 av_log(log_ctx, AV_LOG_ERROR, "Timecode frame rate must be 
specified\n");
 return AVERROR(EINVAL);
 }
-if ((tc->flags & AV_TIMECODE_FLAG_DROPFRAME) && tc->fps != 30 && tc->fps 
!= 60) {
-av_log(log_ctx, AV_LOG_ERROR, "Drop frame is only allowed with 
3/1001 or 6/1001 FPS\n");
+if ((tc->flags & AV_TIMECODE_FLAG_DROPFRAME) && tc->fps % 30 != 0) {
+av_log(log_ctx, AV_LOG_ERROR, "Drop frame is only allowed in frame 
rates evenly divisible by 30 FPS\n");
 return AVERROR(EINVAL);
 }
 if (check_fps(tc->fps) < 0) {
@@ -201,9 +200,9 @@ int av_timecode_init_from_string(AVTimecode *tc, AVRational 
rate, const char *st
 }
 
 memset(tc, 0, sizeof(*tc));
-tc->flags = c != ':' ? AV_TIMECODE_FLAG_DROPFRAME : 0; // drop if ';', 
'.', ...
-tc->rate  = rate;
-tc->fps   = fps_from_frame_rate(rate);
+tc->flags  = c != ':' ? AV_TIMECODE_FLAG_

Re: [FFmpeg-devel] Question about supported_fps in libavutil/timecode.c::check_fps

2015-01-24 Thread wm4
On Sat, 24 Jan 2015 18:37:01 +
Derek Buitenhuis  wrote:

> On 1/24/2015 4:33 PM, wm4 wrote:
> > Which ones? We even expect C99 support from the compiler.
> 
> Doesn't matter. It's the project's policy to have decls at
> block beginnings. Yes some of us think it's better.
> 
> We know you don't. Don't start an ideological troll war.

Having dumb policies is fine, but then don't use broken compilers as
excuse. Just say it's your policy to do it this way, even if there's no
technical necessity.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Port mp=eq/eq2 to FFmpeg

2015-01-24 Thread Paul B Mahol
On 1/23/15, Stefano Sabatini  wrote:
> On date Friday 2015-01-23 20:44:01 +0530, Arwa Arif encoded:
> [...]
>> > Looks good otherwise, assuming it is bitexact with the mp=eq2.
>> >
>>
>> The default is bit-exact with mp=eq2, I can't check it with other values,
>> because the range of values in mp is different from the range of values
>> in
>> this code.
>
> What's wrong with testing with some random in-range values? Also why
> do they differ?
>

Ranges of values are same, but order is different.

I taken this code and fixed order and at least saturation does not work,
also it is not using same code as eq2.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] nvenc: Propagate desired number of reference frames.

2015-01-24 Thread Michael Niedermayer
On Sat, Jan 24, 2015 at 10:11:21AM -0800, Philip Langdale wrote:
> On Sat, 24 Jan 2015 13:02:01 +0100
> Michael Niedermayer  wrote:
> 
> > On Fri, Jan 23, 2015 at 09:41:23PM -0800, Philip Langdale wrote:
> > > Signed-off-by: Philip Langdale 
> > > ---
> > >  libavcodec/nvenc.c | 5 +
> > >  1 file changed, 5 insertions(+)
> > 
> > Applying: nvenc: Propagate desired number of reference frames.
> > fatal: sha1 information is lacking or useless (libavcodec/nvenc.c).
> > Repository lacks necessary blobs to fall back on 3-way merge.
> > Cannot fall back to three-way merge.
> > Patch failed at 0001 nvenc: Propagate desired number of reference
> > frames. When you have resolved this problem run "git am --resolved".
> > If you would prefer to skip this patch, instead run "git am --skip".
> > To restore the original branch and stop patching run "git am --abort".
> 
> Yeah, I've got Timo's b-frame patch in my tree. Don't you want to apply
> that?

Iam not sure if that would break intra only encoding, so i wont
apply this before timo or someone else who knows the code says i
should apply it


[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Question about supported_fps in libavutil/timecode.c::check_fps

2015-01-24 Thread Derek Buitenhuis
On 1/24/2015 4:33 PM, wm4 wrote:
> Which ones? We even expect C99 support from the compiler.

Doesn't matter. It's the project's policy to have decls at
block beginnings. Yes some of us think it's better.

We know you don't. Don't start an ideological troll war.

- Derek
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] nvenc: Propagate desired number of reference frames.

2015-01-24 Thread Philip Langdale
On Sat, 24 Jan 2015 13:02:01 +0100
Michael Niedermayer  wrote:

> On Fri, Jan 23, 2015 at 09:41:23PM -0800, Philip Langdale wrote:
> > Signed-off-by: Philip Langdale 
> > ---
> >  libavcodec/nvenc.c | 5 +
> >  1 file changed, 5 insertions(+)
> 
> Applying: nvenc: Propagate desired number of reference frames.
> fatal: sha1 information is lacking or useless (libavcodec/nvenc.c).
> Repository lacks necessary blobs to fall back on 3-way merge.
> Cannot fall back to three-way merge.
> Patch failed at 0001 nvenc: Propagate desired number of reference
> frames. When you have resolved this problem run "git am --resolved".
> If you would prefer to skip this patch, instead run "git am --skip".
> To restore the original branch and stop patching run "git am --abort".

Yeah, I've got Timo's b-frame patch in my tree. Don't you want to apply
that?

commit 1631b1e5e871fa0d9a49fbcfdee0d27d034af79b
Author: Timo Rothenpieler 
Date:   Fri Jan 16 01:02:38 2015 +0100

avcodec/nvenc: Fix b-frame parameter handling


--phil
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/7] hevc: pass the full HEVCNAL struct to decode_nal_unit

2015-01-24 Thread Michael Niedermayer
On Sat, Jan 24, 2015 at 03:26:15PM +0100, Hendrik Leppkes wrote:
> This enables decode_nal_unit to access additional fields added in
> subsequent commits.
> ---
>  libavcodec/hevc.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
> index 2bd89ec..8f60b3d 100644
> --- a/libavcodec/hevc.c
> +++ b/libavcodec/hevc.c

applied

thanks

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Question about supported_fps in libavutil/timecode.c::check_fps

2015-01-24 Thread wm4
On Sat, 24 Jan 2015 17:21:40 +0100
Clément Bœsch  wrote:

> On Sat, Jan 24, 2015 at 07:40:38AM -0800, jon morley wrote:
> > Hi Clément,
> > 
> 
> Hi,
> 
> > That is a good point! I am attaching an additional patch to remove those
> > cases even before entering the mod test loop.
> > 
> > Now the logic should look like this:
> > 
> > static int check_fps(int fps)
> > {
> 
> > if (fps <= 0) return -1;
> > 
> > int i;
> > static const int supported_fps_bases[] = {24, 25, 30};
> 
> You can't put statements before declarations, some compilers will choke on
> it.

Which ones? We even expect C99 support from the compiler.

> Also, please squash it with the previous patch since it wasn't applied
> yet.
> 
> > 
> > for (i = 0; i < FF_ARRAY_ELEMS(supported_fps_bases); i++)
> > if (fps % supported_fps_bases[i] == 0)
> > return 0;
> > return -1;
> > }
> > 
> > I am still really curious to know if switching to this division (modulo)
> > test breaks the "spirit" of check_fps. I could not find anywhere that
> > benefited from the explicit list the method currently used, but that doesn't
> > mean it isn't out there.
> 
> I'm more concerned about how the rest of the code will behave. Typically,
> av_timecode_adjust_ntsc_framenum2() could benefit from some improvements
> (checking if fps % 30, and deducing drop_frames and frames_per_10mins
> accordingly) if you allow such thing. Then you might need to adjust
> check_timecode() as well to allow the drop frame for the other % 30.
> 
> > 
> > Thanks,
> > Jon
> > 
> 
> [...]
> 
> Note: please do not top post on this mailing list, it is considered rude.

AFAIK only 1 person does.

> Regards,
> 

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Question about supported_fps in libavutil/timecode.c::check_fps

2015-01-24 Thread Clément Bœsch
On Sat, Jan 24, 2015 at 07:40:38AM -0800, jon morley wrote:
> Hi Clément,
> 

Hi,

> That is a good point! I am attaching an additional patch to remove those
> cases even before entering the mod test loop.
> 
> Now the logic should look like this:
> 
> static int check_fps(int fps)
> {

> if (fps <= 0) return -1;
> 
> int i;
> static const int supported_fps_bases[] = {24, 25, 30};

You can't put statements before declarations, some compilers will choke on
it.

Also, please squash it with the previous patch since it wasn't applied
yet.

> 
> for (i = 0; i < FF_ARRAY_ELEMS(supported_fps_bases); i++)
> if (fps % supported_fps_bases[i] == 0)
> return 0;
> return -1;
> }
> 
> I am still really curious to know if switching to this division (modulo)
> test breaks the "spirit" of check_fps. I could not find anywhere that
> benefited from the explicit list the method currently used, but that doesn't
> mean it isn't out there.

I'm more concerned about how the rest of the code will behave. Typically,
av_timecode_adjust_ntsc_framenum2() could benefit from some improvements
(checking if fps % 30, and deducing drop_frames and frames_per_10mins
accordingly) if you allow such thing. Then you might need to adjust
check_timecode() as well to allow the drop frame for the other % 30.

> 
> Thanks,
> Jon
> 

[...]

Note: please do not top post on this mailing list, it is considered rude.

Regards,

-- 
Clément B.


pgpyZ3EX7fhOg.pgp
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Question about supported_fps in libavutil/timecode.c::check_fps

2015-01-24 Thread jon morley

Hi Clément,

That is a good point! I am attaching an additional patch to remove those 
cases even before entering the mod test loop.


Now the logic should look like this:

static int check_fps(int fps)
{
if (fps <= 0) return -1;

int i;
static const int supported_fps_bases[] = {24, 25, 30};

for (i = 0; i < FF_ARRAY_ELEMS(supported_fps_bases); i++)
if (fps % supported_fps_bases[i] == 0)
return 0;
return -1;
}

I am still really curious to know if switching to this division (modulo) 
test breaks the "spirit" of check_fps. I could not find anywhere that 
benefited from the explicit list the method currently used, but that 
doesn't mean it isn't out there.


Thanks,
Jon

On 1/24/15 2:27 AM, Clément Bœsch wrote:

On Fri, Jan 23, 2015 at 08:48:37AM -0800, jon morley wrote:

Patch attached for consideration.

On 1/23/15 8:03 AM, jon morley wrote:

Currently check_fps has the following logic:

static int check_fps(int fps)
{
 int i;
 static const int supported_fps[] = {24, 25, 30, 48, 50, 60};

 for (i = 0; i < FF_ARRAY_ELEMS(supported_fps); i++)
 if (fps == supported_fps[i])
 return 0;
 return -1;
}

I am starting to see more and more movies with fps rates in excess of
this list from modified GoPro files and other raw camera sources.

I was originally adding more entries as the sources came rolling in
because I could not see any issue in how this was getting called later
with that approach.

I still don't see the drawback of adding more, but I am tired of adding
a new rate every time I encounter one in the wild. I was curious if it
wouldn't make more sense to change the logic to the following:

static int check_fps(int fps)
{
 int i;
 static const int supported_fps_bases[] = {24, 25, 30};

 for (i = 0; i < FF_ARRAY_ELEMS(supported_fps_bases); i++)
 if (fps % supported_fps_bases[i] == 0)
 return 0;
 return -1;
}

If that makes sense to you, then I will submit a patch. Please let me
know if I have overlooked some other usage/meaning of check_fps that I
am overlooking.

Thanks,
Jon
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel



 From 73e5339ec76305d34214b5e84dc5a38673f784b7 Mon Sep 17 00:00:00 2001
From: Jon Morley 
Date: Fri, 23 Jan 2015 08:43:33 -0800
Subject: [PATCH] libavutil/timecode.c: Extend check_fps logic to handle high
  frame rates

QuickTime sources continue to push higher and higher frame rates. This
change moves away from explictly testing incoming fps values towards
ensuring the incoming value is evenly divisable by 24, 25, or 30.
---
  libavutil/timecode.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavutil/timecode.c b/libavutil/timecode.c
index 1dfd040..c10895c 100644
--- a/libavutil/timecode.c
+++ b/libavutil/timecode.c
@@ -141,10 +141,10 @@ char *av_timecode_make_mpeg_tc_string(char *buf, uint32_t 
tc25bit)
  static int check_fps(int fps)
  {
  int i;
-static const int supported_fps[] = {24, 25, 30, 48, 50, 60};
+static const int supported_fps_bases[] = {24, 25, 30};

-for (i = 0; i < FF_ARRAY_ELEMS(supported_fps); i++)
-if (fps == supported_fps[i])
+for (i = 0; i < FF_ARRAY_ELEMS(supported_fps_bases); i++)
+if (fps % supported_fps_bases[i] == 0)
  return 0;
  return -1;


I don't think you want to accept fps ≤ 0

[...]



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

From 0a72d78992bbeb6c2536285397149cceb64b05d8 Mon Sep 17 00:00:00 2001
From: Jon Morley 
Date: Sat, 24 Jan 2015 07:28:40 -0800
Subject: [PATCH 2/2] libavutil/timecode.c: check_fps must reject rates at or
 below zero

An earlier change to check_fps's logic which now confirms that the
incoming evaluation fps is evenly divisable by a list of supported
rates leaves open the possibility of accepting zero and negative frame
rates. This change removes that posibility.
---
 libavutil/timecode.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavutil/timecode.c b/libavutil/timecode.c
index c10895c..446e2d5 100644
--- a/libavutil/timecode.c
+++ b/libavutil/timecode.c
@@ -140,6 +140,8 @@ char *av_timecode_make_mpeg_tc_string(char *buf, uint32_t 
tc25bit)
 
 static int check_fps(int fps)
 {
+if (fps <= 0) return -1;
+
 int i;
 static const int supported_fps_bases[] = {24, 25, 30};
 
-- 
1.8.5.2 (Apple Git-48)

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 7/7] ffmpeg_dxva2: add hevc support

2015-01-24 Thread Hendrik Leppkes
---
 ffmpeg_dxva2.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/ffmpeg_dxva2.c b/ffmpeg_dxva2.c
index 3c91d26..741c55b 100644
--- a/ffmpeg_dxva2.c
+++ b/ffmpeg_dxva2.c
@@ -52,6 +52,7 @@ DEFINE_GUID(DXVA2_ModeH264_F, 0x1b81be69, 
0xa0c7,0x11d3,0xb9,0x84,0x00,0
 DEFINE_GUID(DXVADDI_Intel_ModeH264_E, 0x604F8E68, 
0x4951,0x4C54,0x88,0xFE,0xAB,0xD2,0x5C,0x15,0xB3,0xD6);
 DEFINE_GUID(DXVA2_ModeVC1_D,  0x1b81beA3, 
0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
 DEFINE_GUID(DXVA2_ModeVC1_D2010,  0x1b81beA4, 
0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
+DEFINE_GUID(DXVA2_ModeHEVC_VLD_Main,  0x5b11d51b, 
0x2f4c,0x4452,0xbc,0xc3,0x09,0xf2,0xa1,0x16,0x0c,0xc0);
 DEFINE_GUID(DXVA2_NoEncrypt,  0x1b81beD0, 
0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
 DEFINE_GUID(GUID_NULL,0x, 
0x,0x,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00);
 
@@ -80,6 +81,9 @@ static const dxva2_mode dxva2_modes[] = {
 { &DXVA2_ModeVC1_D,  AV_CODEC_ID_VC1  },
 { &DXVA2_ModeVC1_D,  AV_CODEC_ID_WMV3 },
 
+/* HEVC/H.265 */
+{ &DXVA2_ModeHEVC_VLD_Main,  AV_CODEC_ID_HEVC },
+
 { NULL,  0 },
 };
 
@@ -526,6 +530,10 @@ static int dxva2_create_decoder(AVCodecContext *s)
but it causes issues for H.264 on certain AMD GPUs. */
 if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO)
 surface_alignment = 32;
+/* the HEVC DXVA2 spec asks for 128 pixel aligned surfaces to ensure
+   all coding features have enough room to work with */
+else if  (s->codec_id == AV_CODEC_ID_HEVC)
+surface_alignment = 128;
 else
 surface_alignment = 16;
 
@@ -533,7 +541,7 @@ static int dxva2_create_decoder(AVCodecContext *s)
 ctx->num_surfaces = 4;
 
 /* add surfaces based on number of possible refs */
-if (s->codec_id == AV_CODEC_ID_H264)
+if (s->codec_id == AV_CODEC_ID_H264 || s->codec_id == AV_CODEC_ID_HEVC)
 ctx->num_surfaces += 16;
 else
 ctx->num_surfaces += 2;
-- 
1.9.5.msysgit.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 6/7] Add DXVA2 HEVC HWAccel

2015-01-24 Thread Hendrik Leppkes
---
 configure   |   5 +
 libavcodec/Makefile |   1 +
 libavcodec/allcodecs.c  |   1 +
 libavcodec/dxva2_hevc.c | 375 
 libavcodec/hevc.c   |   8 +-
 5 files changed, 389 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/dxva2_hevc.c

diff --git a/configure b/configure
index 0b6be39..ba73a72 100755
--- a/configure
+++ b/configure
@@ -1801,6 +1801,7 @@ TYPES_LIST="
 struct_sockaddr_storage
 struct_stat_st_mtim_tv_nsec
 struct_v4l2_frmivalenum_discrete
+DXVA_PicParams_HEVC
 "
 
 HAVE_LIST="
@@ -2293,6 +2294,8 @@ h264_vdpau_decoder_deps="vdpau"
 h264_vdpau_decoder_select="h264_decoder"
 h264_vdpau_hwaccel_deps="vdpau"
 h264_vdpau_hwaccel_select="h264_decoder"
+hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
+hevc_dxva2_hwaccel_select="hevc_decoder"
 mpeg_vdpau_decoder_deps="vdpau"
 mpeg_vdpau_decoder_select="mpeg2video_decoder"
 mpeg_xvmc_hwaccel_deps="xvmc"
@@ -4845,6 +4848,8 @@ disabled  lzma || check_lib2  lzma.h lzma_version_number 
-llzma || disable lzma
 check_lib math.h sin -lm && LIBM="-lm"
 disabled crystalhd || check_lib libcrystalhd/libcrystalhd_if.h 
DtsCrystalHDVersion -lcrystalhd || disable crystalhd
 
+check_type "windows.h dxva.h" "DXVA_PicParams_HEVC"
+
 atan2f_args=2
 ldexpf_args=2
 powf_args=2
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 80ee389..db8d45a 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -665,6 +665,7 @@ OBJS-$(CONFIG_H264_DXVA2_HWACCEL) += dxva2_h264.o
 OBJS-$(CONFIG_H264_VAAPI_HWACCEL) += vaapi_h264.o
 OBJS-$(CONFIG_H264_VDA_HWACCEL)   += vda_h264.o
 OBJS-$(CONFIG_H264_VDPAU_HWACCEL) += vdpau_h264.o
+OBJS-$(CONFIG_HEVC_DXVA2_HWACCEL) += dxva2_hevc.o
 OBJS-$(CONFIG_MPEG1_VDPAU_HWACCEL)+= vdpau_mpeg12.o
 OBJS-$(CONFIG_MPEG1_XVMC_HWACCEL) += mpegvideo_xvmc.o
 OBJS-$(CONFIG_MPEG2_DXVA2_HWACCEL)+= dxva2_mpeg2.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 29b45f3..2fe3609 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -81,6 +81,7 @@ void avcodec_register_all(void)
 REGISTER_HWACCEL(H264_VDA,  h264_vda);
 REGISTER_HWACCEL(H264_VDA_OLD,  h264_vda_old);
 REGISTER_HWACCEL(H264_VDPAU,h264_vdpau);
+REGISTER_HWACCEL(HEVC_DXVA2,hevc_dxva2);
 REGISTER_HWACCEL(MPEG1_XVMC,mpeg1_xvmc);
 REGISTER_HWACCEL(MPEG1_VDPAU,   mpeg1_vdpau);
 REGISTER_HWACCEL(MPEG2_XVMC,mpeg2_xvmc);
diff --git a/libavcodec/dxva2_hevc.c b/libavcodec/dxva2_hevc.c
new file mode 100644
index 000..4b94d69
--- /dev/null
+++ b/libavcodec/dxva2_hevc.c
@@ -0,0 +1,375 @@
+/*
+ * DXVA2 HEVC HW acceleration.
+ *
+ * copyright (c) 2014 Hendrik Leppkes
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "dxva2_internal.h"
+#include "hevc.h"
+
+#define MAX_SLICES 256
+
+struct hevc_dxva2_picture_context {
+DXVA_PicParams_HEVC   pp;
+DXVA_Qmatrix_HEVC qm;
+unsigned  slice_count;
+DXVA_Slice_HEVC_Short slice_short[MAX_SLICES];
+const uint8_t *bitstream;
+unsigned  bitstream_size;
+};
+
+static void fill_picture_entry(DXVA_PicEntry_HEVC *pic,
+   unsigned index, unsigned flag)
+{
+assert((index&0x7f) == index && (flag&0x01) == flag);
+pic->bPicEntry = index | (flag << 7);
+}
+
+static int get_refpic_index(const DXVA_PicParams_HEVC *pp, int surface_index)
+{
+int i;
+for (i = 0; i < FF_ARRAY_ELEMS(pp->RefPicList); i++) {
+if ((pp->RefPicList[i].bPicEntry & 0x7f) == surface_index)
+  return i;
+}
+return 0xff;
+}
+
+static void fill_picture_parameters(struct dxva_context *ctx, const 
HEVCContext *h,
+DXVA_PicParams_HEVC *pp)
+{
+const HEVCFrame *current_picture = h->ref;
+int i, j, k;
+
+memset(pp, 0, sizeof(*pp));
+
+pp->PicWidthInMinCbsY  = h->sps->min_cb_width;
+pp->PicHeightInMinCbsY = h->sps->min_cb_height;
+
+pp->wFormatAndSequenceInfoFlags = (h->sps->chroma_format_idc  <<  
0) |
+  (h->sps->separate_colour_plane_flag <<  
2) |
+  ((h

[FFmpeg-devel] [PATCH 5/7] hevc: reindent after previous commit

2015-01-24 Thread Hendrik Leppkes
---
 libavcodec/hevc.c  | 38 +++---
 libavcodec/hevc_refs.c | 24 
 2 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 8e686c6..8bf9562 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -2703,18 +2703,18 @@ static int decode_nal_unit(HEVCContext *s, const 
HEVCNAL *nal)
 if (ret < 0)
 goto fail;
 } else {
-if (s->threads_number > 1 && s->sh.num_entry_point_offsets > 0)
-ctb_addr_ts = hls_slice_data_wpp(s, nal->data, nal->size);
-else
-ctb_addr_ts = hls_slice_data(s);
-if (ctb_addr_ts >= (s->sps->ctb_width * s->sps->ctb_height)) {
-s->is_decoded = 1;
-}
+if (s->threads_number > 1 && s->sh.num_entry_point_offsets > 0)
+ctb_addr_ts = hls_slice_data_wpp(s, nal->data, nal->size);
+else
+ctb_addr_ts = hls_slice_data(s);
+if (ctb_addr_ts >= (s->sps->ctb_width * s->sps->ctb_height)) {
+s->is_decoded = 1;
+}
 
-if (ctb_addr_ts < 0) {
-ret = ctb_addr_ts;
-goto fail;
-}
+if (ctb_addr_ts < 0) {
+ret = ctb_addr_ts;
+goto fail;
+}
 }
 break;
 case NAL_EOS_NUT:
@@ -3072,16 +3072,16 @@ static int hevc_decode_frame(AVCodecContext *avctx, 
void *data, int *got_output,
 av_log(avctx, AV_LOG_ERROR,
"hardware accelerator failed to decode picture\n");
 } else {
-/* verify the SEI checksum */
-if (avctx->err_recognition & AV_EF_CRCCHECK && s->is_decoded &&
-s->is_md5) {
-ret = verify_md5(s, s->ref->frame);
-if (ret < 0 && avctx->err_recognition & AV_EF_EXPLODE) {
-ff_hevc_unref_frame(s, s->ref, ~0);
-return ret;
+/* verify the SEI checksum */
+if (avctx->err_recognition & AV_EF_CRCCHECK && s->is_decoded &&
+s->is_md5) {
+ret = verify_md5(s, s->ref->frame);
+if (ret < 0 && avctx->err_recognition & AV_EF_EXPLODE) {
+ff_hevc_unref_frame(s, s->ref, ~0);
+return ret;
+}
 }
 }
-}
 s->is_md5 = 0;
 
 if (s->is_decoded) {
diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c
index 7c7798f..acf1d26 100644
--- a/libavcodec/hevc_refs.c
+++ b/libavcodec/hevc_refs.c
@@ -406,18 +406,18 @@ static HEVCFrame *generate_missing_ref(HEVCContext *s, 
int poc)
 return NULL;
 
 if (!s->avctx->hwaccel) {
-if (!s->sps->pixel_shift) {
-for (i = 0; frame->frame->buf[i]; i++)
-memset(frame->frame->buf[i]->data, 1 << (s->sps->bit_depth - 1),
-   frame->frame->buf[i]->size);
-} else {
-for (i = 0; frame->frame->data[i]; i++)
-for (y = 0; y < (s->sps->height >> s->sps->vshift[i]); y++)
-for (x = 0; x < (s->sps->width >> s->sps->hshift[i]); x++) {
-AV_WN16(frame->frame->data[i] + y * 
frame->frame->linesize[i] + 2 * x,
-1 << (s->sps->bit_depth - 1));
-}
-}
+if (!s->sps->pixel_shift) {
+for (i = 0; frame->frame->buf[i]; i++)
+memset(frame->frame->buf[i]->data, 1 << (s->sps->bit_depth - 
1),
+   frame->frame->buf[i]->size);
+} else {
+for (i = 0; frame->frame->data[i]; i++)
+for (y = 0; y < (s->sps->height >> s->sps->vshift[i]); y++)
+for (x = 0; x < (s->sps->width >> s->sps->hshift[i]); x++) 
{
+AV_WN16(frame->frame->data[i] + y * 
frame->frame->linesize[i] + 2 * x,
+1 << (s->sps->bit_depth - 1));
+}
+}
 }
 
 frame->poc  = poc;
-- 
1.9.5.msysgit.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 4/7] hevc: add hwaccel hooks

2015-01-24 Thread Hendrik Leppkes
---
 libavcodec/hevc.c  | 35 +--
 libavcodec/hevc.h  |  3 +++
 libavcodec/hevc_refs.c | 17 +
 3 files changed, 53 insertions(+), 2 deletions(-)

diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 36c7b47..8e686c6 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -300,6 +300,8 @@ static int get_buffer_sao(HEVCContext *s, AVFrame *frame, 
const HEVCSPS *sps)
 
 static int set_sps(HEVCContext *s, const HEVCSPS *sps)
 {
+#define HWACCEL_MAX (0)
+enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmt = pix_fmts;
 int ret;
 unsigned int num = 0, den = 0;
 
@@ -312,9 +314,13 @@ static int set_sps(HEVCContext *s, const HEVCSPS *sps)
 s->avctx->coded_height= sps->height;
 s->avctx->width   = sps->output_width;
 s->avctx->height  = sps->output_height;
-s->avctx->pix_fmt = sps->pix_fmt;
 s->avctx->has_b_frames= sps->temporal_layer[sps->max_sub_layers - 
1].num_reorder_pics;
 
+*fmt++ = sps->pix_fmt;
+*fmt = AV_PIX_FMT_NONE;
+
+s->avctx->pix_fmt = ff_thread_get_format(s->avctx, pix_fmts);
+
 ff_set_sar(s->avctx, sps->vui.sar);
 
 if (sps->vui.video_signal_type_present_flag)
@@ -337,7 +343,7 @@ static int set_sps(HEVCContext *s, const HEVCSPS *sps)
 ff_hevc_dsp_init (&s->hevcdsp, sps->bit_depth);
 ff_videodsp_init (&s->vdsp,sps->bit_depth);
 
-if (sps->sao_enabled) {
+if (sps->sao_enabled && !s->avctx->hwaccel) {
 av_frame_unref(s->tmp_frame);
 ret = get_buffer_sao(s, s->tmp_frame, sps);
 s->sao_frame = s->tmp_frame;
@@ -2686,6 +2692,17 @@ static int decode_nal_unit(HEVCContext *s, const HEVCNAL 
*nal)
 }
 }
 
+if (s->sh.first_slice_in_pic_flag && s->avctx->hwaccel) {
+ret = s->avctx->hwaccel->start_frame(s->avctx, NULL, 0);
+if (ret < 0)
+goto fail;
+}
+
+if (s->avctx->hwaccel) {
+ret = s->avctx->hwaccel->decode_slice(s->avctx, nal->raw_data, 
nal->raw_size);
+if (ret < 0)
+goto fail;
+} else {
 if (s->threads_number > 1 && s->sh.num_entry_point_offsets > 0)
 ctb_addr_ts = hls_slice_data_wpp(s, nal->data, nal->size);
 else
@@ -2698,6 +2715,7 @@ static int decode_nal_unit(HEVCContext *s, const HEVCNAL 
*nal)
 ret = ctb_addr_ts;
 goto fail;
 }
+}
 break;
 case NAL_EOS_NUT:
 case NAL_EOB_NUT:
@@ -3049,6 +3067,11 @@ static int hevc_decode_frame(AVCodecContext *avctx, void 
*data, int *got_output,
 if (ret < 0)
 return ret;
 
+if (avctx->hwaccel) {
+if (s->ref && avctx->hwaccel->end_frame(avctx) < 0)
+av_log(avctx, AV_LOG_ERROR,
+   "hardware accelerator failed to decode picture\n");
+} else {
 /* verify the SEI checksum */
 if (avctx->err_recognition & AV_EF_CRCCHECK && s->is_decoded &&
 s->is_md5) {
@@ -3058,6 +3081,7 @@ static int hevc_decode_frame(AVCodecContext *avctx, void 
*data, int *got_output,
 return ret;
 }
 }
+}
 s->is_md5 = 0;
 
 if (s->is_decoded) {
@@ -3101,6 +3125,13 @@ static int hevc_ref_frame(HEVCContext *s, HEVCFrame 
*dst, HEVCFrame *src)
 dst->flags  = src->flags;
 dst->sequence   = src->sequence;
 
+if (src->hwaccel_picture_private) {
+dst->hwaccel_priv_buf = av_buffer_ref(src->hwaccel_priv_buf);
+if (!dst->hwaccel_priv_buf)
+goto fail;
+dst->hwaccel_picture_private = dst->hwaccel_priv_buf->data;
+}
+
 return 0;
 fail:
 ff_hevc_unref_frame(s, dst, ~0);
diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h
index 8555d47..1727b60 100644
--- a/libavcodec/hevc.h
+++ b/libavcodec/hevc.h
@@ -718,6 +718,9 @@ typedef struct HEVCFrame {
 AVBufferRef *rpl_tab_buf;
 AVBufferRef *rpl_buf;
 
+AVBufferRef *hwaccel_priv_buf;
+void *hwaccel_picture_private;
+
 /**
  * A sequence counter, so that old frames are output first
  * after a POC reset
diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c
index 92196a1..7c7798f 100644
--- a/libavcodec/hevc_refs.c
+++ b/libavcodec/hevc_refs.c
@@ -46,6 +46,9 @@ void ff_hevc_unref_frame(HEVCContext *s, HEVCFrame *frame, 
int flags)
 frame->refPicList = NULL;
 
 frame->collocated_ref = NULL;
+
+av_buffer_unref(&frame->hwaccel_priv_buf);
+frame->hwaccel_picture_private = NULL;
 }
 }
 
@@ -106,6 +109,18 @@ static HEVCFrame *alloc_frame(HEVCContext *s)
 
 frame->frame->top_field_first  = s->picture_struct == 
AV_PICTURE_STRUCTURE_TOP_FIELD;
 frame->frame->interlaced_frame = (s->picture_struct == 
AV_PICTURE_STRUCTURE_TOP_FIELD) || (s->picture_struct == 
AV_PICTURE_STRUCTURE_BOTTOM_FIELD);
+
+if (s->avctx->hwaccel) {
+const AVHWAccel *hwaccel = s->avctx->hwaccel;
+av_asser

[FFmpeg-devel] [PATCH 1/7] hevc: pass the full HEVCNAL struct to decode_nal_unit

2015-01-24 Thread Hendrik Leppkes
This enables decode_nal_unit to access additional fields added in
subsequent commits.
---
 libavcodec/hevc.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 2bd89ec..8f60b3d 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -2580,13 +2580,13 @@ fail:
 return ret;
 }
 
-static int decode_nal_unit(HEVCContext *s, const uint8_t *nal, int length)
+static int decode_nal_unit(HEVCContext *s, const HEVCNAL *nal)
 {
 HEVCLocalContext *lc = s->HEVClc;
 GetBitContext *gb= &lc->gb;
 int ctb_addr_ts, ret;
 
-ret = init_get_bits8(gb, nal, length);
+ret = init_get_bits8(gb, nal->data, nal->size);
 if (ret < 0)
 return ret;
 
@@ -2685,7 +2685,7 @@ static int decode_nal_unit(HEVCContext *s, const uint8_t 
*nal, int length)
 }
 
 if (s->threads_number > 1 && s->sh.num_entry_point_offsets > 0)
-ctb_addr_ts = hls_slice_data_wpp(s, nal, length);
+ctb_addr_ts = hls_slice_data_wpp(s, nal->data, nal->size);
 else
 ctb_addr_ts = hls_slice_data(s);
 if (ctb_addr_ts >= (s->sps->ctb_width * s->sps->ctb_height)) {
@@ -2937,7 +2937,7 @@ static int decode_nal_units(HEVCContext *s, const uint8_t 
*buf, int length)
 s->skipped_bytes = s->skipped_bytes_nal[i];
 s->skipped_bytes_pos = s->skipped_bytes_pos_nal[i];
 
-ret = decode_nal_unit(s, s->nals[i].data, s->nals[i].size);
+ret = decode_nal_unit(s, &s->nals[i]);
 if (ret < 0) {
 av_log(s->avctx, AV_LOG_WARNING,
"Error parsing NAL unit #%d.\n", i);
-- 
1.9.5.msysgit.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 3/7] hevc: store the short term rps flag and size in the context

2015-01-24 Thread Hendrik Leppkes
For future use by hardware accelerators.
---
 libavcodec/hevc.c | 8 +---
 libavcodec/hevc.h | 2 ++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 778f39b..36c7b47 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -474,7 +474,7 @@ static int hls_slice_header(HEVCContext *s)
 sh->colour_plane_id = get_bits(gb, 2);
 
 if (!IS_IDR(s)) {
-int short_term_ref_pic_set_sps_flag, poc;
+int poc;
 
 sh->pic_order_cnt_lsb = get_bits(gb, s->sps->log2_max_poc_lsb);
 poc = ff_hevc_compute_poc(s, sh->pic_order_cnt_lsb);
@@ -487,12 +487,14 @@ static int hls_slice_header(HEVCContext *s)
 }
 s->poc = poc;
 
-short_term_ref_pic_set_sps_flag = get_bits1(gb);
-if (!short_term_ref_pic_set_sps_flag) {
+sh->short_term_ref_pic_set_sps_flag = get_bits1(gb);
+if (!sh->short_term_ref_pic_set_sps_flag) {
+int pos = get_bits_left(gb);
 ret = ff_hevc_decode_short_term_rps(s, &sh->slice_rps, s->sps, 
1);
 if (ret < 0)
 return ret;
 
+sh->short_term_ref_pic_set_size = pos - get_bits_left(gb);
 sh->short_term_rps = &sh->slice_rps;
 } else {
 int numbits, rps_idx;
diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h
index c0fad27..8555d47 100644
--- a/libavcodec/hevc.h
+++ b/libavcodec/hevc.h
@@ -575,6 +575,8 @@ typedef struct SliceHeader {
 uint8_t colour_plane_id;
 
 ///< RPS coded in the slice header itself is stored here
+int short_term_ref_pic_set_sps_flag;
+int short_term_ref_pic_set_size;
 ShortTermRPS slice_rps;
 const ShortTermRPS *short_term_rps;
 LongTermRPS long_term_rps;
-- 
1.9.5.msysgit.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/7] hevc: store the escaped/raw bitstream in HEVCNAL

2015-01-24 Thread Hendrik Leppkes
Hardware Accelerators require access to the escaped bitstream.
---
 libavcodec/hevc.c | 6 --
 libavcodec/hevc.h | 3 +++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 8f60b3d..778f39b 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -2772,8 +2772,8 @@ int ff_hevc_extract_rbsp(HEVCContext *s, const uint8_t 
*src, int length,
 #endif /* HAVE_FAST_UNALIGNED */
 
 if (i >= length - 1) { // no escaped 0
-nal->data = src;
-nal->size = length;
+nal->data = nal->raw_data = src;
+nal->size = nal->raw_size = length;
 return length;
 }
 
@@ -2823,6 +2823,8 @@ nsc:
 
 nal->data = dst;
 nal->size = di;
+nal->raw_data = src;
+nal->raw_size = si;
 return si;
 }
 
diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h
index 8fdefbb..c0fad27 100644
--- a/libavcodec/hevc.h
+++ b/libavcodec/hevc.h
@@ -734,6 +734,9 @@ typedef struct HEVCNAL {
 
 int size;
 const uint8_t *data;
+
+int raw_size;
+const uint8_t *raw_data;
 } HEVCNAL;
 
 typedef struct HEVCLocalContext {
-- 
1.9.5.msysgit.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avutil/pixdesc: rewrite AV_PIX_FMT_FLAG_PSEUDOPAL documentation

2015-01-24 Thread Michael Niedermayer
On Thu, Jan 15, 2015 at 08:57:47PM +0100, Michael Niedermayer wrote:
> It seems many people do not understand its current documentation
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  libavutil/pixdesc.h |   10 +++---
>  1 file changed, 7 insertions(+), 3 deletions(-)

applied

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No great genius has ever existed without some touch of madness. -- Aristotle


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] ffmpeg_opt: expand format for strftime

2015-01-24 Thread Michael Niedermayer
On Wed, Jan 21, 2015 at 08:10:40PM +0100, Christophe Gisquet wrote:
> Hi,
> 
> another warning under MinGW fixed, because the format specifiers are
> not supported, cf. for instance:
> https://msdn.microsoft.com/en-us/library/fe06s4ak.aspx
> 
> -- 
> Christophe

>  ffmpeg_opt.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 7d8c1b0d9a4ce169c2623e6a153adbcf41e6ef34  
> 0002-ffmpeg_opt-expand-format-for-strftime.patch
> From 6d3e4eb5df0eacf3df011dbe3e05a82f814f63b1 Mon Sep 17 00:00:00 2001
> From: Christophe Gisquet 
> Date: Tue, 20 Jan 2015 22:33:00 +0100
> Subject: [PATCH 2/2] ffmpeg_opt: expand format for strftime
> 
> While the shortened format specifiers are valid C99 ones, they are
> not supported by e.g. some Visual Studio runtimes (and thus mingw).

applied

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If a bugfix only changes things apparently unrelated to the bug with no
further explanation, that is a good sign that the bugfix is wrong.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] nvenc: Propagate desired number of reference frames.

2015-01-24 Thread Michael Niedermayer
On Fri, Jan 23, 2015 at 09:41:23PM -0800, Philip Langdale wrote:
> Signed-off-by: Philip Langdale 
> ---
>  libavcodec/nvenc.c | 5 +
>  1 file changed, 5 insertions(+)

Applying: nvenc: Propagate desired number of reference frames.
fatal: sha1 information is lacking or useless (libavcodec/nvenc.c).
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0001 nvenc: Propagate desired number of reference frames.
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] nvenc: Propagate desired number of reference frames.

2015-01-24 Thread Timo Rothenpieler
> Signed-off-by: Philip Langdale 
> ---
>  libavcodec/nvenc.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
> index c52beb7..e68bbe9 100644
> --- a/libavcodec/nvenc.c
> +++ b/libavcodec/nvenc.c
> @@ -614,6 +614,11 @@ static av_cold int nvenc_encode_init(AVCodecContext 
> *avctx)
>  memcpy(&ctx->encode_config, &preset_config.presetCfg, 
> sizeof(ctx->encode_config));
>  ctx->encode_config.version = NV_ENC_CONFIG_VER;
>  
> +if (avctx->refs >= 0) {
> +/* 0 means "let the hardware decide" */
> +ctx->encode_config.encodeCodecConfig.h264Config.maxNumRefFrames = 
> avctx->refs;
> +}
> +
>  /* 0 is intra-only, 1 is I/P only, 2 is one B Frame, 3 two B frames, and 
> so on. */
>  ctx->encode_config.frameIntervalP = avctx->max_b_frames + 1;
>  
> 

Looks good to merge.
The question if the ffmpeg default is good is a diffrent issue.



signature.asc
Description: OpenPGP digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Suggested Patch for timecode timebase calculation in mov.c

2015-01-24 Thread Clément Bœsch
On Fri, Jan 23, 2015 at 06:44:56AM -0800, jon wrote:
> Hi Michael,
> 
> That is great!
> 
> I see what you are referring to in mov_read_timecode_track(). However the
> text of that comment seems contradictory to me based on what I have read in
> the QuickTime reference I sited about the tmcd counter flag.
> 
> It seemed like prior to the patch I submitted mov_parse_stsd_data() was
> collecting the st->codec->time_base as if the counter flag was unset.
> 
> That comment text comes from commit:
> 
> 35da85562d2f731855b28d4ab3b9b0679730ebf7
> 
> Perhaps Clément Bœsch has a better understanding of the difference between
> timecode values when the counter flag is set and when it is not. My work was
> based on deciphering the samples I had at my disposal in conjunction with my
> interpretation of the reference pdf.
> 

From what I remember, all the samples I had were in "frame number format"
even though the flag was not set. I haven't look at this stuff for a very
long time though.

[...]

-- 
Clément B.


pgpG6B0E2elRv.pgp
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Question about supported_fps in libavutil/timecode.c::check_fps

2015-01-24 Thread Clément Bœsch
On Fri, Jan 23, 2015 at 08:48:37AM -0800, jon morley wrote:
> Patch attached for consideration.
> 
> On 1/23/15 8:03 AM, jon morley wrote:
> >Currently check_fps has the following logic:
> >
> >static int check_fps(int fps)
> >{
> > int i;
> > static const int supported_fps[] = {24, 25, 30, 48, 50, 60};
> >
> > for (i = 0; i < FF_ARRAY_ELEMS(supported_fps); i++)
> > if (fps == supported_fps[i])
> > return 0;
> > return -1;
> >}
> >
> >I am starting to see more and more movies with fps rates in excess of
> >this list from modified GoPro files and other raw camera sources.
> >
> >I was originally adding more entries as the sources came rolling in
> >because I could not see any issue in how this was getting called later
> >with that approach.
> >
> >I still don't see the drawback of adding more, but I am tired of adding
> >a new rate every time I encounter one in the wild. I was curious if it
> >wouldn't make more sense to change the logic to the following:
> >
> >static int check_fps(int fps)
> >{
> > int i;
> > static const int supported_fps_bases[] = {24, 25, 30};
> >
> > for (i = 0; i < FF_ARRAY_ELEMS(supported_fps_bases); i++)
> > if (fps % supported_fps_bases[i] == 0)
> > return 0;
> > return -1;
> >}
> >
> >If that makes sense to you, then I will submit a patch. Please let me
> >know if I have overlooked some other usage/meaning of check_fps that I
> >am overlooking.
> >
> >Thanks,
> >Jon
> >___
> >ffmpeg-devel mailing list
> >ffmpeg-devel@ffmpeg.org
> >http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

> From 73e5339ec76305d34214b5e84dc5a38673f784b7 Mon Sep 17 00:00:00 2001
> From: Jon Morley 
> Date: Fri, 23 Jan 2015 08:43:33 -0800
> Subject: [PATCH] libavutil/timecode.c: Extend check_fps logic to handle high
>  frame rates
> 
> QuickTime sources continue to push higher and higher frame rates. This
> change moves away from explictly testing incoming fps values towards
> ensuring the incoming value is evenly divisable by 24, 25, or 30.
> ---
>  libavutil/timecode.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libavutil/timecode.c b/libavutil/timecode.c
> index 1dfd040..c10895c 100644
> --- a/libavutil/timecode.c
> +++ b/libavutil/timecode.c
> @@ -141,10 +141,10 @@ char *av_timecode_make_mpeg_tc_string(char *buf, 
> uint32_t tc25bit)
>  static int check_fps(int fps)
>  {
>  int i;
> -static const int supported_fps[] = {24, 25, 30, 48, 50, 60};
> +static const int supported_fps_bases[] = {24, 25, 30};
>  
> -for (i = 0; i < FF_ARRAY_ELEMS(supported_fps); i++)
> -if (fps == supported_fps[i])
> +for (i = 0; i < FF_ARRAY_ELEMS(supported_fps_bases); i++)
> +if (fps % supported_fps_bases[i] == 0)
>  return 0;
>  return -1;

I don't think you want to accept fps ≤ 0

[...]

-- 
Clément B.


pgpgZoLG__S2C.pgp
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel