Re: [FFmpeg-devel] [PATCH] lavc/hevcdec: add ONLY_IF_THREADS_ENABLED where it is missing.

2018-08-09 Thread myp...@gmail.com
On Fri, Aug 10, 2018 at 3:06 AM James Almer  wrote:
>
> On 8/9/2018 4:06 AM, Jun Zhao wrote:
> > add add ONLY_IF_THREADS_ENABLED where it is missing.
> >
> > Signed-off-by: Jun Zhao 
> > ---
> >  libavcodec/hevcdec.c |8 ++--
> >  1 files changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
> > index 409e77f..a3b5c8c 100644
> > --- a/libavcodec/hevcdec.c
> > +++ b/libavcodec/hevcdec.c
> > @@ -3358,6 +3358,7 @@ fail:
> >  return AVERROR(ENOMEM);
> >  }
> >
> > +#if HAVE_THREADS
> >  static int hevc_update_thread_context(AVCodecContext *dst,
> >const AVCodecContext *src)
> >  {
> > @@ -3439,6 +3440,7 @@ static int hevc_update_thread_context(AVCodecContext 
> > *dst,
> >
> >  return 0;
> >  }
> > +#endif
> >
> >  static av_cold int hevc_decode_init(AVCodecContext *avctx)
> >  {
> > @@ -3478,6 +3480,7 @@ static av_cold int hevc_decode_init(AVCodecContext 
> > *avctx)
> >  return 0;
> >  }
> >
> > +#if HAVE_THREADS
> >  static av_cold int hevc_init_thread_copy(AVCodecContext *avctx)
> >  {
> >  HEVCContext *s = avctx->priv_data;
> > @@ -3491,6 +3494,7 @@ static av_cold int 
> > hevc_init_thread_copy(AVCodecContext *avctx)
> >
> >  return 0;
> >  }
> > +#endif
> >
> >  static void hevc_decode_flush(AVCodecContext *avctx)
> >  {
> > @@ -3529,8 +3533,8 @@ AVCodec ff_hevc_decoder = {
> >  .close = hevc_decode_free,
> >  .decode= hevc_decode_frame,
> >  .flush = hevc_decode_flush,
> > -.update_thread_context = hevc_update_thread_context,
> > -.init_thread_copy  = hevc_init_thread_copy,
> > +.update_thread_context = 
> > ONLY_IF_THREADS_ENABLED(hevc_update_thread_context),
> > +.init_thread_copy  = 
> > ONLY_IF_THREADS_ENABLED(hevc_init_thread_copy),
> >  .capabilities  = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
> >   AV_CODEC_CAP_SLICE_THREADS | 
> > AV_CODEC_CAP_FRAME_THREADS,
> >  .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | 
> > FF_CODEC_CAP_EXPORTS_CROPPING,
>
> Should be ok.
>
Will apply with commit message clean (remove the  unnecessary "add" in
commit message) , Thanks
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] avcodec/vp9: Check in decode_tiles() if there is data remaining

2018-08-09 Thread Michael Niedermayer
On Wed, Aug 08, 2018 at 10:00:42PM -0300, James Almer wrote:
> On 8/8/2018 9:30 PM, Michael Niedermayer wrote:
> > On Tue, Aug 07, 2018 at 09:07:11PM -0400, Ronald S. Bultje wrote:
> >> Hi,
> >>
> >> On Tue, Aug 7, 2018 at 7:15 PM, Michael Niedermayer 
> >> 
> >> wrote:
> >>
> >>> On Mon, Aug 06, 2018 at 09:50:57PM -0400, Ronald S. Bultje wrote:
>  Hi,
> 
>  On Mon, Aug 6, 2018 at 3:00 PM, Michael Niedermayer
> >>> 
>  wrote:
> 
> > On Tue, Aug 07, 2018 at 01:05:51AM +0800, Ronald S. Bultje wrote:
> >> Hi,
> >>
> >> On Sun, Aug 5, 2018, 9:17 AM Michael Niedermayer
> >>>  >>
> >> wrote:
> >>
> >>> Fixes: Timeout
> >>> Fixes:
> >>> 9330/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_
> > VP9_fuzzer-5707345857347584
> >>>
> >>> Found-by: continuous fuzzing process
> >>> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> >>> Signed-off-by
> >>>  > ffmpegSigned-off-by>:
> >>> Michael Niedermayer 
> >>> ---
> >>>  libavcodec/vp9.c | 3 +++
> >>>  1 file changed, 3 insertions(+)
> >>>
> >>> diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
> >>> index b1178c9c0c..4ca51ec108 100644
> >>> --- a/libavcodec/vp9.c
> >>> +++ b/libavcodec/vp9.c
> >>> @@ -1302,6 +1302,9 @@ static int decode_tiles(AVCodecContext
> >>> *avctx,
> >>>  memset(lflvl_ptr->mask, 0,
> >>> sizeof(lflvl_ptr->mask));
> >>>  }
> >>>
> >>> +if (td->c->end <= td->c->buffer &&
> >>> td->c->bits >=
> > 0) {
> >>> +return AVERROR_INVALIDDATA;
> >>> +}
> >>>  if (s->pass == 2) {
> >>>  decode_sb_mem(td, row, col, lflvl_ptr,
> >>>yoff2, uvoff2, BL_64X64);
> >>>
> >>
> >> I don't think this matches spec. Implementations could use this to
> >>> store
> >> auxiliary data.
> >
> > This checks, or rather is intended to check for a premature end of the
> > input.
> > Am i missing something? because a premature end of input seems not to
> >>> lead
> > to more (auxiliary or other) data in the input.
> 
> 
>  Hm, I misread it, sorry about that, my bad. Please ignore my first
> >>> review.
> 
> >>>
>  Is end == buffer && bits == 0 something that can happen on valid input if
>  things just align properly? Otherwise looks OK.
> >>>
> >>> The same condition is used in vp5/6/8.
> >>> I think this condition only occurs if the input ends. The part i do not
> >>> know
> >>> is if such premature ends might be a "valid compression"
> >>>
> >>> Either way, if this check misbehaves for a valid file then it should be
> >>> reverted/removed unless its improv-able and improved.
> >>
> >>
> > 
> >>  Yes, that's how production grade software works.  
> > 
> > yes ;)
> > but seriously, It only needs a single user hitting a bug and reporting it
> > for us to know its a issue and revert. This is not in a release just git
> > master.
> > Its my oppinion that this is wiser than to never attempt to fix the issue.
> > Which ultimatly is the alternative. That is unless you know that this is
> > correct or incorrect for all cases.
> > Maybe we have very differnt views of how to do software development.
> > My goal is to minimize the amount of issues in the code per developer time
> > spend. Time is a limited resource. Doing anything else simply leads to 
> > worse code.
> > If i spend a week testing code that i know is 99.8% right to make it
> > 99.9% right just to save a single user from once hitting and reporting a
> > non security bug. That is a loss as i could have spend that week fixing
> > many other issues.
> > Its even worse if the 99.9% still hits one user and gets reverted, in this
> > case there is no improvment in user experience at all for the time spend.
> > In either the 99.8 and 99.9% cases one user ultimatly hits a file that 
> > breaks
> > and teh change gets reverted. but in one case we would have spend alot more
> > time. 
> > 
> > So yes, it is my philosophy to use our users as beta testers. Not as a
> > default no absolutely not, but in the rare cases where the extra work
> > we cause our users is comparably tiny compared to how much work we would
> > have to do to avoid it. Or if we can never really match user testing anyway
> > And we also did and do this all over the place. For example, if we do not
> > know how to handle some case and have no sample, we print a message and ask
> > the user for a sample. 
> > This is comparable to the case here. "Is there a sample out there for which 
> > this
> > check misbehaves" vs. "Is there a file out there that uses a special 
> > feature"
> > Either is a question about global file existence and search
> 

> The end user is not a beta 

Re: [FFmpeg-devel] [PATCH] lavc/hevcdec: add ONLY_IF_THREADS_ENABLED where it is missing.

2018-08-09 Thread James Almer
On 8/9/2018 4:06 AM, Jun Zhao wrote:
> add add ONLY_IF_THREADS_ENABLED where it is missing.
> 
> Signed-off-by: Jun Zhao 
> ---
>  libavcodec/hevcdec.c |8 ++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
> index 409e77f..a3b5c8c 100644
> --- a/libavcodec/hevcdec.c
> +++ b/libavcodec/hevcdec.c
> @@ -3358,6 +3358,7 @@ fail:
>  return AVERROR(ENOMEM);
>  }
>  
> +#if HAVE_THREADS
>  static int hevc_update_thread_context(AVCodecContext *dst,
>const AVCodecContext *src)
>  {
> @@ -3439,6 +3440,7 @@ static int hevc_update_thread_context(AVCodecContext 
> *dst,
>  
>  return 0;
>  }
> +#endif
>  
>  static av_cold int hevc_decode_init(AVCodecContext *avctx)
>  {
> @@ -3478,6 +3480,7 @@ static av_cold int hevc_decode_init(AVCodecContext 
> *avctx)
>  return 0;
>  }
>  
> +#if HAVE_THREADS
>  static av_cold int hevc_init_thread_copy(AVCodecContext *avctx)
>  {
>  HEVCContext *s = avctx->priv_data;
> @@ -3491,6 +3494,7 @@ static av_cold int hevc_init_thread_copy(AVCodecContext 
> *avctx)
>  
>  return 0;
>  }
> +#endif
>  
>  static void hevc_decode_flush(AVCodecContext *avctx)
>  {
> @@ -3529,8 +3533,8 @@ AVCodec ff_hevc_decoder = {
>  .close = hevc_decode_free,
>  .decode= hevc_decode_frame,
>  .flush = hevc_decode_flush,
> -.update_thread_context = hevc_update_thread_context,
> -.init_thread_copy  = hevc_init_thread_copy,
> +.update_thread_context = 
> ONLY_IF_THREADS_ENABLED(hevc_update_thread_context),
> +.init_thread_copy  = ONLY_IF_THREADS_ENABLED(hevc_init_thread_copy),
>  .capabilities  = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
>   AV_CODEC_CAP_SLICE_THREADS | 
> AV_CODEC_CAP_FRAME_THREADS,
>  .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | 
> FF_CODEC_CAP_EXPORTS_CROPPING,

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


Re: [FFmpeg-devel] [PATCH] Documentation for sr filter

2018-08-09 Thread Sergey Lavrushkin
2018-08-07 13:14 GMT+03:00 Moritz Barsnick :

> On Tue, Aug 07, 2018 at 00:24:29 +0300, Sergey Lavrushkin wrote:
> > +@table @option
> > +@item model
> > +Specify what super-resolution model to use. This option accepts the
> following values:
>^ nit: which
>
> > +Specify what DNN backend to use for model loading and execution. This
> option accepts
> Ditto
>
> > +Allowed values are @code{2}, @code{3} and @code{4}. Scale factor is
> neccessary
>^
> necessary
>
> > +Note that different backends use different file format. If path to model
>^ formats
>

Here is updated patch.
From 1fed1ea07a5727d937228307bffbde13e6727669 Mon Sep 17 00:00:00 2001
From: Sergey Lavrushkin 
Date: Fri, 3 Aug 2018 17:24:00 +0300
Subject: [PATCH 9/9] doc/filters.texi: Adds documentation for sr filter.

---
 doc/filters.texi | 60 
 1 file changed, 60 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index 0b0903e5a7..e2436a24e7 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -15394,6 +15394,66 @@ option may cause flicker since the B-Frames have often larger QP. Default is
 @code{0} (not enabled).
 @end table
 
+@section sr
+
+Scale the input by applying one of the super-resolution methods based on
+convolutional neural networks.
+
+Training scripts as well as scripts for model generation are provided in
+the repository @url{https://github.com/HighVoltageRocknRoll/sr.git}.
+
+The filter accepts the following options:
+
+@table @option
+@item model
+Specify what super-resolution model to use. This option accepts the following values:
+
+@table @samp
+@item srcnn
+Super-Resolution Convolutional Neural Network model
+@url{https://arxiv.org/abs/1501.00092}.
+
+@item espcn
+Efficient Sub-Pixel Convolutional Neural Network model
+@url{https://arxiv.org/abs/1609.05158}.
+
+@end table
+
+Default value is @samp{srcnn}.
+
+@item dnn_backend
+Specify what DNN backend to use for model loading and execution. This option accepts
+the following values:
+
+@table @samp
+@item native
+Native implementation of DNN loading and execution.
+
+@item tensorflow
+TensorFlow backend @url{https://www.tensorflow.org/}. To enable this backend you
+need to install the TensorFlow for C library (see
+@url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
+@code{--enable-libtensorflow}
+
+@end table
+
+Default value is @samp{native}.
+
+@item scale_factor
+Set scale factor for SRCNN model, for which custom model file was provided.
+Allowed values are @code{2}, @code{3} and @code{4}. Scale factor is neccessary
+for SRCNN model, because it accepts input upscaled using bicubic upscaling with
+proper scale factor.
+
+Default value is @code{2}.
+
+@item model_filename
+Set path to model file specifying network architecture and its parameters.
+Note that different backends use different file format. If path to model
+file is not specified, built-in models for 2x upscaling are used.
+
+@end table
+
 @anchor{subtitles}
 @section subtitles
 
-- 
2.14.1

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


Re: [FFmpeg-devel] [PATCH] lavfi/vf_libvmaf: update to use libvmaf v1.3.9

2018-08-09 Thread Kyle Swanson
Hi,

On Tue, Aug 7, 2018 at 3:37 PM, Kyle Swanson  wrote:

> From: Kyle Swanson 
>
> Signed-off-by: Kyle Swanson 
> ---
>  configure| 2 +-
>  libavfilter/vf_libvmaf.c | 9 -
>  2 files changed, 9 insertions(+), 2 deletions(-)
>
>
I'll update docs and push this sometime in the next 24 hours unless anyone
has something.

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


Re: [FFmpeg-devel] [PATCH 4/7] Adds gray floating-point pixel formats.

2018-08-09 Thread Sergey Lavrushkin
Here are updated patches with fixes. I updated conversion functions, so
they should
properly work with format for different endianness.

2018-08-08 1:47 GMT+03:00 Michael Niedermayer :

> On Tue, Aug 07, 2018 at 12:17:58AM +0300, Sergey Lavrushkin wrote:
> > I split patch to one for libavutil and another for libswscale,
> > also added LUT for unscaled conversion, added
> > conversions for scaling and updated fate tests.
>
> >  libavutil/pixdesc.c  |   22 ++
> >  libavutil/pixfmt.h   |5 +
> >  libavutil/version.h  |2 +-
> >  tests/ref/fate/sws-pixdesc-query |3 +++
> >  4 files changed, 31 insertions(+), 1 deletion(-)
> > b58f328f5d90954c62957f127b1acbfad5795a4d  0004-libavutil-Adds-gray-
> floating-point-pixel-formats.patch
> > From 8bcc10b49c41612b4d6549e64d90acf3f0b3fc6a Mon Sep 17 00:00:00 2001
> > From: Sergey Lavrushkin 
> > Date: Fri, 3 Aug 2018 18:02:49 +0300
> > Subject: [PATCH 4/9] libavutil: Adds gray floating-point pixel formats.
> >
> > ---
> >  libavutil/pixdesc.c  | 22 ++
> >  libavutil/pixfmt.h   |  5 +
> >  libavutil/version.h  |  2 +-
> >  tests/ref/fate/sws-pixdesc-query |  3 +++
> >  4 files changed, 31 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
> > index 96e079584a..970a83214c 100644
> > --- a/libavutil/pixdesc.c
> > +++ b/libavutil/pixdesc.c
> > @@ -2206,6 +2206,28 @@ static const AVPixFmtDescriptor
> av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
> >  .name  = "opencl",
> >  .flags = AV_PIX_FMT_FLAG_HWACCEL,
> >  },
> > +[AV_PIX_FMT_GRAYF32BE] = {
> > +.name = "grayf32be",
> > +.nb_components = 1,
> > +.log2_chroma_w = 0,
> > +.log2_chroma_h = 0,
> > +.comp = {
> > +{ 0, 4, 0, 0, 32, 3, 31, 1 },   /* Y */
> > +},
> > +.flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_FLOAT,
> > +.alias = "yf32be",
> > +},
> > +[AV_PIX_FMT_GRAYF32LE] = {
> > +.name = "grayf32le",
> > +.nb_components = 1,
> > +.log2_chroma_w = 0,
> > +.log2_chroma_h = 0,
> > +.comp = {
> > +{ 0, 4, 0, 0, 32, 3, 31, 1 },   /* Y */
> > +},
> > +.flags = AV_PIX_FMT_FLAG_FLOAT,
> > +.alias = "yf32le",
> > +},
> >  };
> >  #if FF_API_PLUS1_MINUS1
> >  FF_ENABLE_DEPRECATION_WARNINGS
> > diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
> > index 2b3307845e..7b254732d8 100644
> > --- a/libavutil/pixfmt.h
> > +++ b/libavutil/pixfmt.h
> > @@ -337,6 +337,9 @@ enum AVPixelFormat {
> >  AV_PIX_FMT_GRAY14BE,   /// >  AV_PIX_FMT_GRAY14LE,   /// >
> > +AV_PIX_FMT_GRAYF32BE,  ///< IEEE-754 single precision Y, 32bpp,
> big-endian
> > +AV_PIX_FMT_GRAYF32LE,  ///< IEEE-754 single precision Y, 32bpp,
> little-endian
> > +
> >  AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS
> if you want to link with shared libav* because the number of formats might
> differ between versions
> >  };
> >
> > @@ -405,6 +408,8 @@ enum AVPixelFormat {
> >  #define AV_PIX_FMT_GBRPF32AV_PIX_FMT_NE(GBRPF32BE,  GBRPF32LE)
> >  #define AV_PIX_FMT_GBRAPF32   AV_PIX_FMT_NE(GBRAPF32BE, GBRAPF32LE)
> >
> > +#define AV_PIX_FMT_GRAYF32 AV_PIX_FMT_NE(GRAYF32BE, GRAYF32LE)
> > +
> >  #define AV_PIX_FMT_YUVA420P9  AV_PIX_FMT_NE(YUVA420P9BE , YUVA420P9LE)
> >  #define AV_PIX_FMT_YUVA422P9  AV_PIX_FMT_NE(YUVA422P9BE , YUVA422P9LE)
> >  #define AV_PIX_FMT_YUVA444P9  AV_PIX_FMT_NE(YUVA444P9BE , YUVA444P9LE)
> > diff --git a/libavutil/version.h b/libavutil/version.h
> > index 44bdebdc93..5205c5bc60 100644
> > --- a/libavutil/version.h
> > +++ b/libavutil/version.h
>
> > @@ -79,7 +79,7 @@
> >   */
> >
> >  #define LIBAVUTIL_VERSION_MAJOR  56
> > -#define LIBAVUTIL_VERSION_MINOR  18
> > +#define LIBAVUTIL_VERSION_MINOR  19
> >  #define LIBAVUTIL_VERSION_MICRO 102
>
> a bump to minor must reset micro to 100
>
> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> In a rich man's house there is no place to spit but his face.
> -- Diogenes of Sinope
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
From 724f34ef9c551e7ac5af6f26840c3f2d3396eebd Mon Sep 17 00:00:00 2001
From: Sergey Lavrushkin 
Date: Fri, 3 Aug 2018 18:02:49 +0300
Subject: [PATCH 4/9] libavutil: Adds gray floating-point pixel formats.

---
 libavutil/pixdesc.c  | 22 ++
 libavutil/pixfmt.h   |  5 +
 libavutil/version.h  |  4 ++--
 tests/ref/fate/sws-pixdesc-query |  3 +++
 4 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 96e079584a..970a83214c 100644
--- 

Re: [FFmpeg-devel] [PATCH] avformat/matroskadec: Parse encryption init info from streams.

2018-08-09 Thread Jacob Trimble
On Wed, Aug 1, 2018 at 1:46 PM Jacob Trimble  wrote:
>
> On Mon, Jul 23, 2018 at 2:01 PM Jacob Trimble  wrote:
> >
> > On Thu, Jul 12, 2018 at 5:05 PM Jacob Trimble  wrote:
> > >
> > > Signed-off-by: Jacob Trimble 
> > > ---
> > >  libavformat/matroskadec.c | 43 +--
> > >  1 file changed, 32 insertions(+), 11 deletions(-)
> > >
> > > diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> > > index 1ded431b80..bfef329e59 100644
> > > --- a/libavformat/matroskadec.c
> > > +++ b/libavformat/matroskadec.c
> > > @@ -2080,7 +2080,8 @@ static int matroska_parse_tracks(AVFormatContext *s)
> > >  int extradata_offset = 0;
> > >  uint32_t fourcc = 0;
> > >  AVIOContext b;
> > > -char* key_id_base64 = NULL;
> > > +char* key_id = NULL;
> > > +int key_id_size = 0;
> > >  int bit_depth = -1;
> > >
> > >  /* Apply some sanity checks. */
> > > @@ -2133,14 +2134,8 @@ static int matroska_parse_tracks(AVFormatContext 
> > > *s)
> > >  if (encodings[0].encryption.key_id.size > 0) {
> > >  /* Save the encryption key id to be stored later as a
> > > metadata tag. */
> > > -const int b64_size = 
> > > AV_BASE64_SIZE(encodings[0].encryption.key_id.size);
> > > -key_id_base64 = av_malloc(b64_size);
> > > -if (key_id_base64 == NULL)
> > > -return AVERROR(ENOMEM);
> > > -
> > > -av_base64_encode(key_id_base64, b64_size,
> > > - encodings[0].encryption.key_id.data,
> > > - 
> > > encodings[0].encryption.key_id.size);
> > > +key_id = encodings[0].encryption.key_id.data;
> > > +key_id_size = encodings[0].encryption.key_id.size;
> > >  } else {
> > >  encodings[0].scope = 0;
> > >  av_log(matroska->ctx, AV_LOG_ERROR,
> > > @@ -2198,14 +2193,40 @@ static int matroska_parse_tracks(AVFormatContext 
> > > *s)
> > >
> > >  st = track->stream = avformat_new_stream(s, NULL);
> > >  if (!st) {
> > > -av_free(key_id_base64);
> > >  return AVERROR(ENOMEM);
> > >  }
> > >
> > > -if (key_id_base64) {
> > > +if (key_id) {
> > > +AVEncryptionInitInfo *init_info;
> > > +uint8_t *side_data;
> > > +size_t side_data_size;
> > > +const int b64_size = AV_BASE64_SIZE(key_id_size);
> > > +char *key_id_base64 = av_malloc(b64_size);
> > > +if (!key_id_base64)
> > > +return AVERROR(ENOMEM);
> > > +av_base64_encode(key_id_base64, b64_size, key_id, 
> > > key_id_size);
> > > +
> > >  /* export encryption key id as base64 metadata tag */
> > >  av_dict_set(>metadata, "enc_key_id", key_id_base64, 0);
> > >  av_freep(_id_base64);
> > > +
> > > +
> > > +/* Convert the key ID to a generic encryption init info */
> > > +init_info = av_encryption_init_info_alloc(/* system_id_size 
> > > */ 0, /* num_key_ids */ 1,
> > > +  /* key_id_size */ 
> > > key_id_size, /* data_size */ 0);
> > > +if (!init_info)
> > > +return AVERROR(ENOMEM);
> > > +memcpy(init_info->key_ids[0], key_id, key_id_size);
> > > +side_data = av_encryption_init_info_add_side_data(init_info, 
> > > _data_size);
> > > +av_encryption_init_info_free(init_info);
> > > +if (!side_data)
> > > +return AVERROR(ENOMEM);
> > > +ret = av_stream_add_side_data(st, 
> > > AV_PKT_DATA_ENCRYPTION_INIT_INFO,
> > > +  side_data, side_data_size);
> > > +if (ret < 0) {
> > > +av_free(side_data);
> > > +return ret;
> > > +}
> > >  }
> > >
> > >  if (!strcmp(track->codec_id, "V_MS/VFW/FOURCC") &&
> > > --
> > > 2.18.0.203.gfac676dfb9-goog
> > >
> >
> > Ping.
>
> Ping.

Ping (only 43 lines changed, in "review" for 28 days...)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat/matroska: Parse generic encryption info from packets.

2018-08-09 Thread Jacob Trimble
On Wed, Aug 1, 2018 at 1:45 PM Jacob Trimble  wrote:
>
> On Mon, Jul 23, 2018 at 1:59 PM Jacob Trimble  wrote:
> >
> > On Thu, Jul 12, 2018 at 4:45 PM Jacob Trimble  wrote:
> > >
> > > The attached patch adds parsing for WebM encryption info into the
> > > AVEncryptionInfo side-data.  The AVEncryptionInitInfo will be handled
> > > in another patch.
> > >
> > > Spec: https://www.webmproject.org/docs/webm-encryption/
> > >
> > > I am currently seeing a problem with this when using Opus audio.  In
> > > read_frame_internal, it will try to parse the resulting packet.  For
> > > video, which uses subsample encryption, it is able to parse the
> > > headers; but for Opus, which uses full-sample encryption, it fails to
> > > parse the headers.  This causes the read_frame_internal to drop the
> > > packet.
> > >
> > > I have traced a workaround to opus_parse in opus_parser.c: instead of
> > > setting poutbuf to NULL, set it to the buffer and just pass the packet
> > > to the app to handle it.  The frame will be decrypted before passing
> > > to the decoder.  I can't just disable parsing in the demuxer because I
> > > want to parse the packets for clear content and when using subsample
> > > encryption.
> > >
> > > Does anyone have any other ideas to work around this?  Is there a way
> > > to allow parsing but ignore errors?
> >
> > Ping.
>
> Ping.

Ping (136 lindes changed, in "review" for 28 days...)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf/mov.c: Set start_time for all sterams (in case of edit lists).

2018-08-09 Thread Sasi Inguva
Thanks. Attaching the corrected patch


On Thu, Aug 9, 2018 at 5:59 AM Moritz Barsnick  wrote:

> > [PATCH] lavf/mov.c: Set start_time for all sterams (in case of edit
> lists).
>  ^ streams
>
> Moritz
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
From a0da82579a1c9ebb81bd029750fa718fa5f1c152 Mon Sep 17 00:00:00 2001
From: Sasi Inguva 
Date: Mon, 6 Aug 2018 16:28:50 -0700
Subject: [PATCH] lavf/mov.c: Set start_time for all streams (in case of edit
 lists).

Fixes vorbis mp4 audio files, with edit list specified. Since
st->skip_samples is not set in case of vorbis , ffmpeg computes the
start_time as negative.

Signed-off-by: Sasi Inguva 
---
 libavformat/mov.c  | 4 ++--
 tests/fate/mov.mak | 5 +
 tests/ref/fate/mov-neg-firstpts-discard-vorbis | 3 +++
 3 files changed, 10 insertions(+), 2 deletions(-)
 create mode 100644 tests/ref/fate/mov-neg-firstpts-discard-vorbis

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 82cd410a72..c0f90edef7 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3684,9 +3684,9 @@ static void mov_fix_index(MOVContext *mov, AVStream *st)
 st->index_entries[i].timestamp -= msc->min_corrected_pts;
 }
 }
-// Start time should be equal to zero or the duration of any empty edits.
-st->start_time = empty_edits_sum_duration;
 }
+// Start time should be equal to zero or the duration of any empty edits.
+st->start_time = empty_edits_sum_duration;
 
 // Update av stream length, if it ends up shorter than the track's media duration
 st->duration = FFMIN(st->duration, edit_list_dts_entry_end - start_dts);
diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
index 6f0e28d21e..3d9e4280bb 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -19,6 +19,7 @@ FATE_MOV = fate-mov-3elist \
fate-mov-stream-shorter-than-movie \
 
 FATE_MOV_FFPROBE = fate-mov-neg-firstpts-discard \
+   fate-mov-neg-firstpts-discard-vorbis \
fate-mov-aac-2048-priming \
fate-mov-zombie \
fate-mov-init-nonkeyframe \
@@ -89,6 +90,10 @@ fate-mov-bbi-elst-starts-b: CMD = framemd5 -flags +bitexact -acodec aac_fixed -i
 # Makes sure that the stream start_time is not negative when the first packet is a DISCARD packet with negative timestamp.
 fate-mov-neg-firstpts-discard: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entries stream=start_time -bitexact $(TARGET_SAMPLES)/mov/mov_neg_first_pts_discard.mov
 
+# Makes sure that the VORBIS audio stream start_time is not negative when the first few packets are DISCARD packets
+# with negative timestamps (skip_samples is not set for Vorbis, so ffmpeg computes start_time as negative if not specified by demuxer).
+fate-mov-neg-firstpts-discard-vorbis: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entries stream=start_time -bitexact $(TARGET_SAMPLES)/mov/mov_neg_first_pts_discard_vorbis.mp4
+
 # Makes sure that expected frames are generated for mov_neg_first_pts_discard.mov with -vsync 1
 fate-mov-neg-firstpts-discard-frames: CMD = framemd5 -flags +bitexact -i $(TARGET_SAMPLES)/mov/mov_neg_first_pts_discard.mov -vsync 1
 
diff --git a/tests/ref/fate/mov-neg-firstpts-discard-vorbis b/tests/ref/fate/mov-neg-firstpts-discard-vorbis
new file mode 100644
index 00..2e295e3b68
--- /dev/null
+++ b/tests/ref/fate/mov-neg-firstpts-discard-vorbis
@@ -0,0 +1,3 @@
+[STREAM]
+start_time=0.00
+[/STREAM]
-- 
2.18.0.597.ga71716f1ad-goog

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


Re: [FFmpeg-devel] [PATCH] lavf/mov.c: Set start_time for audio too (in case of edit lists).

2018-08-09 Thread Sasi Inguva
Pls find attached, the corrected patch.

On Wed, Aug 8, 2018 at 5:24 PM Sasi Inguva  wrote:

> Ok. i'll correct the commit message.
>
> On Wed, Aug 8, 2018 at 4:25 PM Michael Niedermayer 
> wrote:
>
>> On Wed, Aug 08, 2018 at 12:20:34PM -0700, Sasi Inguva wrote:
>> > i intended it only for audio, but i don't see any harm if it gets
>> applied
>> > to subtitle tracks also .
>>
>> if you want subs incldued then the commit message is wrong at least
>> if you dont want subs incldued the change is wrong
>>
>>
>> [...]
>> --
>> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>>
>> If you drop bombs on a foreign country and kill a hundred thousand
>> innocent people, expect your government to call the consequence
>> "unprovoked inhuman terrorist attacks" and use it to justify dropping
>> more bombs and killing more people. The technology changed, the idea is
>> old.
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>
From a0da82579a1c9ebb81bd029750fa718fa5f1c152 Mon Sep 17 00:00:00 2001
From: Sasi Inguva 
Date: Mon, 6 Aug 2018 16:28:50 -0700
Subject: [PATCH] lavf/mov.c: Set start_time for all streams (in case of edit
 lists).

Fixes vorbis mp4 audio files, with edit list specified. Since
st->skip_samples is not set in case of vorbis , ffmpeg computes the
start_time as negative.

Signed-off-by: Sasi Inguva 
---
 libavformat/mov.c  | 4 ++--
 tests/fate/mov.mak | 5 +
 tests/ref/fate/mov-neg-firstpts-discard-vorbis | 3 +++
 3 files changed, 10 insertions(+), 2 deletions(-)
 create mode 100644 tests/ref/fate/mov-neg-firstpts-discard-vorbis

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 82cd410a72..c0f90edef7 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3684,9 +3684,9 @@ static void mov_fix_index(MOVContext *mov, AVStream *st)
 st->index_entries[i].timestamp -= msc->min_corrected_pts;
 }
 }
-// Start time should be equal to zero or the duration of any empty edits.
-st->start_time = empty_edits_sum_duration;
 }
+// Start time should be equal to zero or the duration of any empty edits.
+st->start_time = empty_edits_sum_duration;
 
 // Update av stream length, if it ends up shorter than the track's media duration
 st->duration = FFMIN(st->duration, edit_list_dts_entry_end - start_dts);
diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
index 6f0e28d21e..3d9e4280bb 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -19,6 +19,7 @@ FATE_MOV = fate-mov-3elist \
fate-mov-stream-shorter-than-movie \
 
 FATE_MOV_FFPROBE = fate-mov-neg-firstpts-discard \
+   fate-mov-neg-firstpts-discard-vorbis \
fate-mov-aac-2048-priming \
fate-mov-zombie \
fate-mov-init-nonkeyframe \
@@ -89,6 +90,10 @@ fate-mov-bbi-elst-starts-b: CMD = framemd5 -flags +bitexact -acodec aac_fixed -i
 # Makes sure that the stream start_time is not negative when the first packet is a DISCARD packet with negative timestamp.
 fate-mov-neg-firstpts-discard: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entries stream=start_time -bitexact $(TARGET_SAMPLES)/mov/mov_neg_first_pts_discard.mov
 
+# Makes sure that the VORBIS audio stream start_time is not negative when the first few packets are DISCARD packets
+# with negative timestamps (skip_samples is not set for Vorbis, so ffmpeg computes start_time as negative if not specified by demuxer).
+fate-mov-neg-firstpts-discard-vorbis: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entries stream=start_time -bitexact $(TARGET_SAMPLES)/mov/mov_neg_first_pts_discard_vorbis.mp4
+
 # Makes sure that expected frames are generated for mov_neg_first_pts_discard.mov with -vsync 1
 fate-mov-neg-firstpts-discard-frames: CMD = framemd5 -flags +bitexact -i $(TARGET_SAMPLES)/mov/mov_neg_first_pts_discard.mov -vsync 1
 
diff --git a/tests/ref/fate/mov-neg-firstpts-discard-vorbis b/tests/ref/fate/mov-neg-firstpts-discard-vorbis
new file mode 100644
index 00..2e295e3b68
--- /dev/null
+++ b/tests/ref/fate/mov-neg-firstpts-discard-vorbis
@@ -0,0 +1,3 @@
+[STREAM]
+start_time=0.00
+[/STREAM]
-- 
2.18.0.597.ga71716f1ad-goog

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


Re: [FFmpeg-devel] [PATCH] lavf/mov.c: Set start_time for all sterams (in case of edit lists).

2018-08-09 Thread Moritz Barsnick
> [PATCH] lavf/mov.c: Set start_time for all sterams (in case of edit lists).
 ^ streams

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


Re: [FFmpeg-devel] [GSoC] FFserver libmicrohttpd interface

2018-08-09 Thread Stephan Holljes
On Thu, Aug 2, 2018 at 1:00 AM, Stephan Holljes
 wrote:
> After fighting for a bit too long, I am finally submitting this patch series
> that adds the more mature libmicrohttpd library. Client disconnect detection
> is not really taken care of as of now, clients will be disconnected once
> av_interleaved_write_frame() fails. This may be worth looking into more
> closely, see below.
>
> Other fixes and improvements are also contained, the most important ones:
>   - fix compilation (fileserver.c/.h's fileserver_schedule() was broken.
>   - properly handle file requests if no fileserver is running (prevents crash)
>
> At the moment there is a memory-leak I can't seem to fix. It is the 
> connection-
> closure (**con_cls) in lmhttpd.c:answer_to_connection(). In the libmicrohttpd
> examples a function to free it is passed to 
> MHD_create_response_from_callback(),
> however this leads to a heap-use-after-free bug. This happens when a client
> disconnects prematurely.
>
> Another but I could not reliably reproduce is the skipping of segments from 
> the
> server side. It occurs very rarely and as I said I could not reproduce it yet.
>
> There may even be more bugs I am currently unaware of, these just took the
> highest priority for fixing in my opinion.
>

Ping? Also I put everything up here for submission:
https://github.com/klaxa/ffserver

If you want me to submit something different, have suggestions for
changes or something else, please comment.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] lavc/videotoolboxenc: Fix compilation on osx 10.10.5 Yosemite

2018-08-09 Thread Thilo Borgmann
$Subject

-Thilo
From 07ad940ffe051319591a204463b44f29699a5a4b Mon Sep 17 00:00:00 2001
From: Thilo Borgmann 
Date: Thu, 9 Aug 2018 12:47:35 +0200
Subject: [PATCH] lavc/videotoolboxenc: Fix compilation on osx 10.10.5 Yosemite

---
 libavcodec/videotoolboxenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index f311149..50aba2d 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -41,7 +41,7 @@ enum { kCMVideoCodecType_HEVC = 'hvc1' };
 
 typedef OSStatus (*getParameterSetAtIndex)(CMFormatDescriptionRef videoDesc,
size_t parameterSetIndex,
-   const uint8_t * _Nullable 
*parameterSetPointerOut,
+   const uint8_t 
**parameterSetPointerOut,
size_t *parameterSetSizeOut,
size_t *parameterSetCountOut,
int *NALUnitHeaderLengthOut);
-- 
1.8.3.2

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


[FFmpeg-devel] [PATCH V3] lavc/hevcdec: add ONLY_IF_THREADS_ENABLED where it is missing.

2018-08-09 Thread Jun Zhao
add ONLY_IF_THREADS_ENABLED where it is missing.

Signed-off-by: Jun Zhao 
---
 libavcodec/hevcdec.c |8 ++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 409e77f..a3b5c8c 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -3358,6 +3358,7 @@ fail:
 return AVERROR(ENOMEM);
 }
 
+#if HAVE_THREADS
 static int hevc_update_thread_context(AVCodecContext *dst,
   const AVCodecContext *src)
 {
@@ -3439,6 +3440,7 @@ static int hevc_update_thread_context(AVCodecContext *dst,
 
 return 0;
 }
+#endif
 
 static av_cold int hevc_decode_init(AVCodecContext *avctx)
 {
@@ -3478,6 +3480,7 @@ static av_cold int hevc_decode_init(AVCodecContext *avctx)
 return 0;
 }
 
+#if HAVE_THREADS
 static av_cold int hevc_init_thread_copy(AVCodecContext *avctx)
 {
 HEVCContext *s = avctx->priv_data;
@@ -3491,6 +3494,7 @@ static av_cold int hevc_init_thread_copy(AVCodecContext 
*avctx)
 
 return 0;
 }
+#endif
 
 static void hevc_decode_flush(AVCodecContext *avctx)
 {
@@ -3529,8 +3533,8 @@ AVCodec ff_hevc_decoder = {
 .close = hevc_decode_free,
 .decode= hevc_decode_frame,
 .flush = hevc_decode_flush,
-.update_thread_context = hevc_update_thread_context,
-.init_thread_copy  = hevc_init_thread_copy,
+.update_thread_context = 
ONLY_IF_THREADS_ENABLED(hevc_update_thread_context),
+.init_thread_copy  = ONLY_IF_THREADS_ENABLED(hevc_init_thread_copy),
 .capabilities  = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
  AV_CODEC_CAP_SLICE_THREADS | 
AV_CODEC_CAP_FRAME_THREADS,
 .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | 
FF_CODEC_CAP_EXPORTS_CROPPING,
-- 
1.7.1

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


[FFmpeg-devel] [PATCH V3] add ONLY_IF_THREADS_ENABLED where it is missing in hevcdec

2018-08-09 Thread Jun Zhao
V3: - clean the commit message.
V2: - wrap the two functions with HAVE_THREADS as James Almer's review.

Jun Zhao (1):
  lavc/hevcdec: add ONLY_IF_THREADS_ENABLED where it is missing.

 libavcodec/hevcdec.c |8 ++--
 1 files changed, 6 insertions(+), 2 deletions(-)

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


[FFmpeg-devel] [PATCH] lavc/hevcdec: add ONLY_IF_THREADS_ENABLED where it is missing.

2018-08-09 Thread Jun Zhao
add add ONLY_IF_THREADS_ENABLED where it is missing.

Signed-off-by: Jun Zhao 
---
 libavcodec/hevcdec.c |8 ++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 409e77f..a3b5c8c 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -3358,6 +3358,7 @@ fail:
 return AVERROR(ENOMEM);
 }
 
+#if HAVE_THREADS
 static int hevc_update_thread_context(AVCodecContext *dst,
   const AVCodecContext *src)
 {
@@ -3439,6 +3440,7 @@ static int hevc_update_thread_context(AVCodecContext *dst,
 
 return 0;
 }
+#endif
 
 static av_cold int hevc_decode_init(AVCodecContext *avctx)
 {
@@ -3478,6 +3480,7 @@ static av_cold int hevc_decode_init(AVCodecContext *avctx)
 return 0;
 }
 
+#if HAVE_THREADS
 static av_cold int hevc_init_thread_copy(AVCodecContext *avctx)
 {
 HEVCContext *s = avctx->priv_data;
@@ -3491,6 +3494,7 @@ static av_cold int hevc_init_thread_copy(AVCodecContext 
*avctx)
 
 return 0;
 }
+#endif
 
 static void hevc_decode_flush(AVCodecContext *avctx)
 {
@@ -3529,8 +3533,8 @@ AVCodec ff_hevc_decoder = {
 .close = hevc_decode_free,
 .decode= hevc_decode_frame,
 .flush = hevc_decode_flush,
-.update_thread_context = hevc_update_thread_context,
-.init_thread_copy  = hevc_init_thread_copy,
+.update_thread_context = 
ONLY_IF_THREADS_ENABLED(hevc_update_thread_context),
+.init_thread_copy  = ONLY_IF_THREADS_ENABLED(hevc_init_thread_copy),
 .capabilities  = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
  AV_CODEC_CAP_SLICE_THREADS | 
AV_CODEC_CAP_FRAME_THREADS,
 .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | 
FF_CODEC_CAP_EXPORTS_CROPPING,
-- 
1.7.1

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


[FFmpeg-devel] [PATCH] libavcodec/vp8dec: fix the multi-thread HWAccel decode error

2018-08-09 Thread Jun Zhao
the root cause is update_dimentions call get_pixel_format will
trigger the hwaccel_uninit/hwaccel_init , in current context,
there are 3 situations in the update_dimentions():
1. First time calling. No matter single thread or multithread,
   get_pixel_format() should be called after dimentions were
   set;
2. Dimention changed at the runtime. Dimention need to be
   updated when macroblocks_base is already allocated,
   get_pixel_format() should be called to recreate new frames
   according to updated dimention;
3. Multithread first time calling. After decoder init, the
   other threads will call update_dimentions() at first time
   to allocate macroblocks_base and set dimentions.
   But get_pixel_format() is shouldn't be called due to low
   level frames and context are already created.
In this fix, we only call update_dimentions as need.

Signed-off-by: Wang, Shaofei 
Reviewed-by: Jun, Zhao 
---
 libavcodec/vp8.c |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index 3adfeac..18d1ada 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -187,7 +187,7 @@ static av_always_inline
 int update_dimensions(VP8Context *s, int width, int height, int is_vp7)
 {
 AVCodecContext *avctx = s->avctx;
-int i, ret;
+int i, ret, dim_reset = 0;
 
 if (width  != s->avctx->width || ((width+15)/16 != s->mb_width || 
(height+15)/16 != s->mb_height) && s->macroblocks_base ||
 height != s->avctx->height) {
@@ -196,9 +196,12 @@ int update_dimensions(VP8Context *s, int width, int 
height, int is_vp7)
 ret = ff_set_dimensions(s->avctx, width, height);
 if (ret < 0)
 return ret;
+
+dim_reset = (s->macroblocks_base != NULL);
 }
 
-if (!s->actually_webp && !is_vp7) {
+if ((s->pix_fmt == AV_PIX_FMT_NONE || dim_reset) &&
+ !s->actually_webp && !is_vp7) {
 s->pix_fmt = get_pixel_format(s);
 if (s->pix_fmt < 0)
 return AVERROR(EINVAL);
-- 
1.7.1

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