Re: [FFmpeg-devel] [PATCH V2 2/4] lavc/vaapi_encode: Add max slices number query.

2017-08-09 Thread Jun Zhao


On 2017/8/10 5:29, Mark Thompson wrote:
> On 02/08/17 06:55, Jun Zhao wrote:
>> From 2a0bd4795fcf7d889c3c93b03e8698015a519260 Mon Sep 17 00:00:00 2001
>> From: Jun Zhao 
>> Date: Tue, 1 Aug 2017 04:16:30 -0400
>> Subject: [PATCH V2 2/4] lavc/vaapi_encode: Add max slices number query.
>>
>> Add max slices number query.
>>
>> Signed-off-by: Jun Zhao 
>> ---
>>  libavcodec/vaapi_encode.c | 4 
>>  libavcodec/vaapi_encode.h | 3 +++
>>  2 files changed, 7 insertions(+)
>>
>> diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
>> index 11d9803b5d..9fc70bdd55 100644
>> --- a/libavcodec/vaapi_encode.c
>> +++ b/libavcodec/vaapi_encode.c
>> @@ -972,6 +972,7 @@ static av_cold int 
>> vaapi_encode_config_attributes(AVCodecContext *avctx)
>>  { VAConfigAttribRTFormat },
>>  { VAConfigAttribRateControl  },
>>  { VAConfigAttribEncMaxRefFrames  },
>> +{ VAConfigAttribEncMaxSlices },
>>  { VAConfigAttribEncPackedHeaders },
>>  };
>>  
>> @@ -1102,6 +1103,9 @@ static av_cold int 
>> vaapi_encode_config_attributes(AVCodecContext *avctx)
>>  }
>>  }
>>  break;
>> +case VAConfigAttribEncMaxSlices:
>> +ctx->max_slices = attr[i].value;
>> +break;
>>  case VAConfigAttribEncPackedHeaders:
>>  if (ctx->va_packed_headers & ~attr[i].value) {
>>  // This isn't fatal, but packed headers are always
>> diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h
>> index b542772aed..fd55aa6cdc 100644
>> --- a/libavcodec/vaapi_encode.h
>> +++ b/libavcodec/vaapi_encode.h
>> @@ -103,6 +103,9 @@ typedef struct VAAPIEncodeContext {
>>  // Supported packed headers (initially the desired set, modified
>>  // later to what is actually supported).
>>  unsigned intva_packed_headers;
>> +// Supported max-slices number per frame. (0 means driver cannot
>> +// support max mutil-slices query)
>> +int max_slices;
>>  
>>  // The required size of surfaces.  This is probably the input
>>  // size (AVCodecContext.width|height) aligned up to whatever
> 
> A few lines further down:
> // Everything above this point must be set before calling
> // ff_vaapi_encode_init().
> 
> max_slices is not in this category, so it should be somewhere below.

Didn't get this comments in the code, with change the place.

> 
>> -- 
>> 2.11.0
>>
> 
> Probably fine?  Without too much thought I would probably write this the 
> other way around (check the value in vaapi_encode_config_attributes(), then 
> know it is correct thereafter, like max_b_frames), but maybe that causes more 
> problems with unexpected failure and needing to mess with MPEG-2.

double-check the i965 master branch source code, only AVC/HEVC support the 
VAConfigAttribEncMaxSlices query, MPEG2 will return VA_ATTRIB_NOT_SUPPORTED, and
I will double check the old i965 release.
 
> 
> - Mark
> ___
> 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


[FFmpeg-devel] [PATCH] ffmpeg: fix setting field_order during muxing

2017-08-09 Thread James Almer
AVFrame.top_field_first doxy states

"If the content is interlaced, is top field displayed first."

And AVFieldOrder doxy defines:
AV_FIELD_TB,  //< Top coded first, bottom displayed first
AV_FIELD_BT,  //< Bottom coded first, top displayed first

Fixes ticket #6577

Signed-off-by: James Almer 
---
 ffmpeg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 888d19a647..a08db61ea3 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1206,7 +1206,7 @@ static void do_video_out(OutputFile *of,
avoid any copies. We support temporarily the older
method. */
 if (in_picture->interlaced_frame)
-mux_par->field_order = in_picture->top_field_first ? 
AV_FIELD_TB:AV_FIELD_BT;
+mux_par->field_order = in_picture->top_field_first ? 
AV_FIELD_BT:AV_FIELD_TB;
 else
 mux_par->field_order = AV_FIELD_PROGRESSIVE;
 pkt.data   = (uint8_t *)in_picture;
@@ -1229,7 +1229,7 @@ static void do_video_out(OutputFile *of,
 if (enc->codec->id == AV_CODEC_ID_MJPEG)
 mux_par->field_order = in_picture->top_field_first ? 
AV_FIELD_TT:AV_FIELD_BB;
 else
-mux_par->field_order = in_picture->top_field_first ? 
AV_FIELD_TB:AV_FIELD_BT;
+mux_par->field_order = in_picture->top_field_first ? 
AV_FIELD_BT:AV_FIELD_TB;
 } else
 mux_par->field_order = AV_FIELD_PROGRESSIVE;
 
-- 
2.13.3

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


Re: [FFmpeg-devel] [PATCH V2 1/4] lavc/vaapi_encode: Change the slice/parameter buffers to dynamic alloc.

2017-08-09 Thread Jun Zhao


On 2017/8/10 5:11, Mark Thompson wrote:
> On 02/08/17 06:53, Jun Zhao wrote:
>> V2: Change the slice/parameter buffers to dynamic alloc and split
>> the mutil-slice support for AVC/HEVC.
>>
>> From 39fd7852df0c96217310c525107da06a7ec0a062 Mon Sep 17 00:00:00 2001
>> From: Jun Zhao 
>> Date: Mon, 31 Jul 2017 22:46:23 -0400
>> Subject: [PATCH V2 1/4] lavc/vaapi_encode: Change the slice/parameter buffers
>>  to dynamic alloc.
>>
>> Change the slice/parameter buffers to be allocated dynamically.
>>
>> Signed-off-by: Wang, Yi A 
>> Signed-off-by: Jun Zhao 
>> ---
>>  libavcodec/vaapi_encode.c | 27 ---
>>  libavcodec/vaapi_encode.h |  6 ++
>>  2 files changed, 26 insertions(+), 7 deletions(-)
>>
>> diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
>> index 2de5f76cab..11d9803b5d 100644
>> --- a/libavcodec/vaapi_encode.c
>> +++ b/libavcodec/vaapi_encode.c
>> @@ -36,13 +36,19 @@ static int 
>> vaapi_encode_make_packed_header(AVCodecContext *avctx,
>>  VAAPIEncodeContext *ctx = avctx->priv_data;
>>  VAStatus vas;
>>  VABufferID param_buffer, data_buffer;
>> +VABufferID *tmp;
>>  VAEncPackedHeaderParameterBuffer params = {
>>  .type = type,
>>  .bit_length = bit_len,
>>  .has_emulation_bytes = 1,
>>  };
>>  
>> -av_assert0(pic->nb_param_buffers + 2 <= MAX_PARAM_BUFFERS);
>> +tmp = av_realloc_array(pic->param_buffers, sizeof(*tmp), 
>> (pic->nb_param_buffers + 2));
> 
> Redundant parentheses?
Will remove redundant parentheses
> 
>> +if (!tmp) {
>> +av_freep(>param_buffers);
> 
> This leaks the actual buffers which were allocated 
> (pic->param_buffers[0..pic->nb_param_buffers-1]).
Will call vaDestroyBuffer free the va buffer in this case.
> 
>> +return AVERROR(ENOMEM);
>> +}
>> +pic->param_buffers = tmp;
>>  
>>  vas = vaCreateBuffer(ctx->hwctx->display, ctx->va_context,
>>   VAEncPackedHeaderParameterBufferType,
>> @@ -77,9 +83,15 @@ static int vaapi_encode_make_param_buffer(AVCodecContext 
>> *avctx,
>>  {
>>  VAAPIEncodeContext *ctx = avctx->priv_data;
>>  VAStatus vas;
>> +VABufferID *tmp;
>>  VABufferID buffer;
>>  
>> -av_assert0(pic->nb_param_buffers + 1 <= MAX_PARAM_BUFFERS);
>> +tmp = av_realloc_array(pic->param_buffers, sizeof(*tmp), 
>> (pic->nb_param_buffers + 1));
>> +if (!tmp) {
>> +av_freep(>param_buffers);
> 
> Same here.
Will remove redundant parentheses too and free va buffer in this.
> 
>> +return AVERROR(ENOMEM);
>> +}
>> +pic->param_buffers = tmp;
>>  
>>  vas = vaCreateBuffer(ctx->hwctx->display, ctx->va_context,
>>   type, len, 1, data, );
>> @@ -122,6 +134,8 @@ static int vaapi_encode_wait(AVCodecContext *avctx,
>>  // Input is definitely finished with now.
>>  av_frame_free(>input_image);
>>  
>> +av_freep(>param_buffers);
> 
> Maybe it would be cleaner to free param_buffers at the end of 
> vaapi_encode_issue() - the buffers themselves are no longer usable at that 
> point.
> 
Will double-check this part.
>> +
>>  pic->encode_complete = 1;
>>  return 0;
>>  }
>> @@ -313,7 +327,10 @@ static int vaapi_encode_issue(AVCodecContext *avctx,
>>  }
>>  }
>>  
>> -av_assert0(pic->nb_slices <= MAX_PICTURE_SLICES);
>> +pic->slices = (VAAPIEncodeSlice **)av_malloc(sizeof(VAAPIEncodeSlice *) 
>> * pic->nb_slices);
>> +if (pic->slices == NULL)
>> +goto fail;
>> +
>>  for (i = 0; i < pic->nb_slices; i++) {
>>  slice = av_mallocz(sizeof(*slice));
> 
> How about just making pic->slices be VAAPIEncodeSlice*, pointing to an array 
> of the structures?  This code is now allocating both an array of pointers and 
> then each element of that array individually.
> 
Will change with VAAPIEncodeSlice*  instead of VAAPIEncodeSlice**
>>  if (!slice) {
>> @@ -427,6 +444,8 @@ fail:
>>  vaDestroyBuffer(ctx->hwctx->display, pic->param_buffers[i]);
>>  fail_at_end:
>>  av_freep(>codec_picture_params);
>> +av_freep(>param_buffers);
>> +av_freep(>slices);
>>  av_frame_free(>recon_image);
>>  av_buffer_unref(>output_buffer_ref);
>>  pic->output_buffer = VA_INVALID_ID;
>> @@ -544,6 +563,8 @@ static int vaapi_encode_free(AVCodecContext *avctx,
>>  av_frame_free(>input_image);
>>  av_frame_free(>recon_image);
>>  
>> +av_freep(>param_buffers);
>> +av_freep(>slices);
>>  // Output buffer should already be destroyed.
>>  av_assert0(pic->output_buffer == VA_INVALID_ID);
>>  
>> diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h
>> index 0edf27e4cb..b542772aed 100644
>> --- a/libavcodec/vaapi_encode.h
>> +++ b/libavcodec/vaapi_encode.h
>> @@ -35,8 +35,6 @@ enum {
>>  MAX_CONFIG_ATTRIBUTES  = 4,
>>  MAX_GLOBAL_PARAMS  = 4,
>>  MAX_PICTURE_REFERENCES = 2,
>> -

Re: [FFmpeg-devel] [PATCH] avcodec/mjpegenc: disable unused code with AMV

2017-08-09 Thread Davinder Singh
On Thu, Aug 10, 2017 at 6:59 AM Michael Niedermayer 
wrote:

> On Wed, Aug 09, 2017 at 07:46:30AM +, Davinder Singh wrote:
> > hi,
> >
> > this disables unused function amv_encode_picture() when AMV encoder is
> > disabled (and mjpeg enabled).
> > silences this warning:
> > CC libavcodec/mjpegenc.o
> > libavcodec/mjpegenc.c:351:12: warning: unused function
> 'amv_encode_picture'
> > [-Wunused-function]
> > static int amv_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
> >^
> >
> > Patch attached.
> >
> > Regards.
> > --
> > Davinder Singh
>
> >  mjpegenc.c |   10 +-
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> > 0fe583bfdb304ce3d8881e9836cc1983c65e3a90
> 0001-avcodec-mjpegenc-disable-unused-code-with-AMV.patch
> > From cadf679bb0ad6d09d451512238e790645262f2f8 Mon Sep 17 00:00:00 2001
> > From: Davinder Singh 
> > Date: Wed, 9 Aug 2017 13:01:07 +0530
> > Subject: [PATCH] avcodec/mjpegenc: disable unused code with AMV
> >
> > disable unused amv_encode_picture() when AMV encoder is not configured.
> > minor formatting improvement.
> > ---
> >  libavcodec/mjpegenc.c | 10 +-
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c
> > index ee77cde8cb..e6cdaf6376 100644
> > --- a/libavcodec/mjpegenc.c
> > +++ b/libavcodec/mjpegenc.c
> > @@ -39,7 +39,6 @@
> >  #include "mjpeg.h"
> >  #include "mjpegenc.h"
> >
> > -
> >  static int alloc_huffman(MpegEncContext *s)
> >  {
> >  MJpegContext *m = s->mjpeg_ctx;
>
> please move  unrelated cosmetic chages into a seperate patch
>
> Patches attached.

[...]
-- 
Davinder Singh


0001-avcodec-mjpegenc-disable-unused-code-with-AMV.patch
Description: Binary data


0002-avcodec-mjpegenc-cosmetic-changes.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/mjpegenc: disable unused code with AMV

2017-08-09 Thread Michael Niedermayer
On Wed, Aug 09, 2017 at 07:46:30AM +, Davinder Singh wrote:
> hi,
> 
> this disables unused function amv_encode_picture() when AMV encoder is
> disabled (and mjpeg enabled).
> silences this warning:
> CC libavcodec/mjpegenc.o
> libavcodec/mjpegenc.c:351:12: warning: unused function 'amv_encode_picture'
> [-Wunused-function]
> static int amv_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
>^
> 
> Patch attached.
> 
> Regards.
> -- 
> Davinder Singh

>  mjpegenc.c |   10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 0fe583bfdb304ce3d8881e9836cc1983c65e3a90  
> 0001-avcodec-mjpegenc-disable-unused-code-with-AMV.patch
> From cadf679bb0ad6d09d451512238e790645262f2f8 Mon Sep 17 00:00:00 2001
> From: Davinder Singh 
> Date: Wed, 9 Aug 2017 13:01:07 +0530
> Subject: [PATCH] avcodec/mjpegenc: disable unused code with AMV
> 
> disable unused amv_encode_picture() when AMV encoder is not configured.
> minor formatting improvement.
> ---
>  libavcodec/mjpegenc.c | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c
> index ee77cde8cb..e6cdaf6376 100644
> --- a/libavcodec/mjpegenc.c
> +++ b/libavcodec/mjpegenc.c
> @@ -39,7 +39,6 @@
>  #include "mjpeg.h"
>  #include "mjpegenc.h"
>  
> -
>  static int alloc_huffman(MpegEncContext *s)
>  {
>  MJpegContext *m = s->mjpeg_ctx;

please move  unrelated cosmetic chages into a seperate patch

[...]

-- 
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] lavf/movenc.c: Set sgpd and sbgp atoms to represent decoder delay for AAC.

2017-08-09 Thread Michael Niedermayer
On Wed, Aug 09, 2017 at 10:41:27PM +0100, Derek Buitenhuis wrote:
> On 8/9/2017 1:00 AM, Sasi Inguva wrote:
> > According to 
> > https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFAppenG/QTFFAppenG.html
> >  and ISO-IEC-14496-12 Section 10.1.1.1 and 10.1.1.3
> > 
> > Signed-off-by: Sasi Inguva 
> > ---
> >  libavformat/movenc.c| 22 +++---
> >  tests/ref/fate/adtstoasc_ticket3715 |  4 ++--
> >  tests/ref/fate/copy-psp |  4 ++--
> >  tests/ref/fate/movenc   | 12 ++--
> >  4 files changed, 25 insertions(+), 17 deletions(-)
> 
> Probably fine to push.

will apply

thanks

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

Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway


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


Re: [FFmpeg-devel] [PATCH 11/14] lavfi/vf_paletteuse: convert to framesync2.

2017-08-09 Thread Clément Bœsch
On Mon, Jul 31, 2017 at 02:02:24PM +0200, Nicolas George wrote:
[...]
> @@ -1052,13 +1070,10 @@ static const AVFilterPad paletteuse_inputs[] = {
>  {
>  .name   = "default",
>  .type   = AVMEDIA_TYPE_VIDEO,
> -.filter_frame   = filter_frame,

> -.needs_writable = 1, // for error diffusal dithering

why?

[...]

-- 
Clément B.


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


Re: [FFmpeg-devel] lavc/vaapi_encode_h265: respect "slices" option in h265 vaapi encoder

2017-08-09 Thread Mark Thompson
On 02/08/17 06:57, Jun Zhao wrote:
> From 82eb7d1c3120081a7073cfb379802a28c769ae18 Mon Sep 17 00:00:00 2001
> From: Jun Zhao 
> Date: Tue, 1 Aug 2017 23:07:34 -0400
> Subject: [PATCH V2 4/4] lavc/vaapi_encode_h265: respect "slices" option in
>  h265 vaapi encoder
> 
> Enable multi-slice support in AVC/H.265 vaapi encoder.
> 
> Signed-off-by: Wang, Yi A 
> Signed-off-by: Jun Zhao 
> ---
>  libavcodec/vaapi_encode_h265.c | 42 
> --
>  1 file changed, 36 insertions(+), 6 deletions(-)
> 
> diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
> index cf6b9388d1..aa85331260 100644
> --- a/libavcodec/vaapi_encode_h265.c
> +++ b/libavcodec/vaapi_encode_h265.c
> @@ -176,6 +176,10 @@ typedef struct VAAPIEncodeH265Context {
>  unsigned int ctu_width;
>  unsigned int ctu_height;
>  
> +int slice_of_ctus;
> +int slice_mod_ctus;
> +int last_ctu_index;
> +
>  int fixed_qp_idr;
>  int fixed_qp_p;
>  int fixed_qp_b;
> @@ -962,6 +966,7 @@ static int 
> vaapi_encode_h265_init_picture_params(AVCodecContext *avctx,
>  VAEncPictureParameterBufferHEVC *vpic = pic->codec_picture_params;
>  VAAPIEncodeH265Context  *priv = ctx->priv_data;
>  int i;
> +int max_slices;
>  
>  if (pic->type == PICTURE_TYPE_IDR) {
>  av_assert0(pic->display_order == pic->encode_order);
> @@ -1024,7 +1029,22 @@ static int 
> vaapi_encode_h265_init_picture_params(AVCodecContext *avctx,
>  av_assert0(0 && "invalid picture type");
>  }
>  
> -pic->nb_slices = 1;
> +max_slices = 1;
> +if (ctx->max_slices) {
> +max_slices = FFMIN(priv->ctu_height, ctx->max_slices);
> +if (avctx->slices > max_slices) {
> +av_log(avctx, AV_LOG_WARNING, "The max slices number per frame "
> +   "cannot more than %d.\n", max_slices);
> +} else {
> +max_slices = avctx->slices;
> +}
> +}
> +
> +pic->nb_slices = max_slices;
> +
> +priv->slice_of_ctus  = (priv->ctu_width * priv->ctu_height) / 
> pic->nb_slices;
> +priv->slice_mod_ctus = (priv->ctu_width * priv->ctu_height) % 
> pic->nb_slices;
> +priv->last_ctu_index = 0;
>  
>  return 0;
>  }
> @@ -1047,9 +1067,11 @@ static int 
> vaapi_encode_h265_init_slice_params(AVCodecContext *avctx,
>  pslice = slice->priv_data;
>  mslice = >misc_slice_params;
>  
> -// Currently we only support one slice per frame.
> -vslice->slice_segment_address = 0;
> -vslice->num_ctu_in_slice = priv->ctu_width * priv->ctu_height;
> +vslice->slice_segment_address = priv->last_ctu_index;
> +vslice->num_ctu_in_slice = priv->slice_of_ctus + (priv->slice_mod_ctus > 
> 0 ? 1 : 0);
> +if (priv->slice_mod_ctus > 0)
> +priv->slice_mod_ctus--;
> +priv->last_ctu_index += vslice->num_ctu_in_slice;
>  
>  switch (pic->type) {
>  case PICTURE_TYPE_IDR:
> @@ -1103,9 +1125,13 @@ static int 
> vaapi_encode_h265_init_slice_params(AVCodecContext *avctx,
>  else
>  vslice->slice_qp_delta = priv->fixed_qp_idr - vpic->pic_init_qp;
>  
> -vslice->slice_fields.bits.last_slice_of_pic_flag = 1;
> +if (priv->last_ctu_index == priv->ctu_width * priv->ctu_height)
> +vslice->slice_fields.bits.last_slice_of_pic_flag = 1;
>  
> -mslice->first_slice_segment_in_pic_flag = 1;
> +if (vslice->slice_segment_address == 0)
> +mslice->first_slice_segment_in_pic_flag = 1;
> +else
> +mslice->first_slice_segment_in_pic_flag = 0;
>  
>  if (pic->type == PICTURE_TYPE_IDR) {
>  // No reference pictures.
> @@ -1198,6 +1224,10 @@ static av_cold int 
> vaapi_encode_h265_configure(AVCodecContext *avctx)
>  av_assert0(0 && "Invalid RC mode.");
>  }
>  
> +if (!ctx->max_slices && avctx->slices > 0)
> +av_log(avctx, AV_LOG_WARNING, "The encode slice option is not "
> +   "supported with this VAAPI version.\n");
> +
>  return 0;
>  }
>  
> -- 
> 2.11.0
> 

All the same comments as the H.264 patch.

Also, you might want to consider whether you can/should set 
pps_loop_filter_across_slices_enabled_flag.  (And disable_deblocking_filter_idc 
in H.264, which I didn't think of there.)

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


Re: [FFmpeg-devel] lavc/vaapi_encode_h264: respect "slices" option in h264 vaapi encoder

2017-08-09 Thread Mark Thompson
On 02/08/17 06:56, Jun Zhao wrote:
> From f9b42385faedd64dacf613785c393c7b025237c9 Mon Sep 17 00:00:00 2001
> From: Jun Zhao 
> Date: Tue, 1 Aug 2017 23:05:44 -0400
> Subject: [PATCH V2 3/4] lavc/vaapi_encode_h264: respect "slices" option in
>  h264 vaapi encoder
> 
> Enable multi-slice support in AVC/H.264 vaapi encoder.
> 
> Signed-off-by: Wang, Yi A 
> Signed-off-by: Jun Zhao 
> ---
>  libavcodec/vaapi_encode_h264.c | 38 +-
>  1 file changed, 33 insertions(+), 5 deletions(-)
> 
> diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c
> index f9fcd805a4..5dad6d10a5 100644
> --- a/libavcodec/vaapi_encode_h264.c
> +++ b/libavcodec/vaapi_encode_h264.c
> @@ -141,6 +141,10 @@ typedef struct VAAPIEncodeH264Context {
>  int mb_width;
>  int mb_height;
>  
> +int slice_of_mbs;
> +int slice_mod_mbs;
> +int last_mb_index;
> +
>  int fixed_qp_idr;
>  int fixed_qp_p;
>  int fixed_qp_b;
> @@ -957,6 +961,7 @@ static int 
> vaapi_encode_h264_init_picture_params(AVCodecContext *avctx,
>  VAEncPictureParameterBufferH264  *vpic = pic->codec_picture_params;
>  VAAPIEncodeH264Context   *priv = ctx->priv_data;
>  int i;
> +int max_slices;
>  
>  if (pic->type == PICTURE_TYPE_IDR) {
>  av_assert0(pic->display_order == pic->encode_order);
> @@ -1002,7 +1007,22 @@ static int 
> vaapi_encode_h264_init_picture_params(AVCodecContext *avctx,
>  vpic->pic_fields.bits.idr_pic_flag = (pic->type == PICTURE_TYPE_IDR);
>  vpic->pic_fields.bits.reference_pic_flag = (pic->type != PICTURE_TYPE_B);
>  
> -pic->nb_slices = 1;
> +max_slices = 1;
> +if (ctx->max_slices) {
> +max_slices = FFMIN(priv->mb_height, ctx->max_slices);

Where is this coming from?  You don't enforce anything about rows below.

> +if (avctx->slices > max_slices) {
> +av_log(avctx, AV_LOG_WARNING, "The max slices number per frame "
> +   "cannot more than %d.\n", max_slices);

So if you pass a value which is too high, you get some lower number instead?  
It should probably hard fail here - I'm not sure what your use case is for this 
option, but I imagine it being for conforming to the some specific stream 
requirements (like bluray or whatever), so just ignoring the option in that 
case is probably bad.

> +} else {
> +max_slices = avctx->slices;
> +}
> +}
> +
> +pic->nb_slices = max_slices;
> +
> +priv->slice_of_mbs  = (priv->mb_width * priv->mb_height) / 
> pic->nb_slices;
> +priv->slice_mod_mbs = (priv->mb_width * priv->mb_height) % 
> pic->nb_slices;
> +priv->last_mb_index = 0;
>  
>  return 0;
>  }
> @@ -1052,14 +1072,18 @@ static int 
> vaapi_encode_h264_init_slice_params(AVCodecContext *avctx,
>  av_assert0(0 && "invalid picture type");
>  }
>  
> -// Only one slice per frame.
> -vslice->macroblock_address = 0;
> -vslice->num_macroblocks = priv->mb_width * priv->mb_height;
> +vslice->macroblock_address = priv->last_mb_index;
> +vslice->num_macroblocks = priv->slice_of_mbs + (priv->slice_mod_mbs > 0 
> ? 1 : 0);
> +if (priv->slice_mod_mbs > 0)
> +priv->slice_mod_mbs--;
> +priv->last_mb_index += vslice->num_macroblocks;

I'm still unconfortable about this method of distributing the macroblocks 
equally to slices with rounding error at the top - slice boundaries are not 
invisible at low bitrates.  I don't have anything better to suggest, though.

>  
>  vslice->macroblock_info = VA_INVALID_ID;
>  
>  vslice->pic_parameter_set_id = vpic->pic_parameter_set_id;
> -vslice->idr_pic_id = priv->idr_pic_count++;
> +vslice->idr_pic_id = priv->idr_pic_count;
> +if (priv->last_mb_index == priv->mb_width * priv->mb_height)
> +priv->idr_pic_count++;
>  
>  vslice->pic_order_cnt_lsb = (pic->display_order - priv->last_idr_frame) &
>  ((1 << (4 + 
> vseq->seq_fields.bits.log2_max_pic_order_cnt_lsb_minus4)) - 1);
> @@ -1157,6 +1181,10 @@ static av_cold int 
> vaapi_encode_h264_configure(AVCodecContext *avctx)
>  #endif
>  }
>  
> +if (!ctx->max_slices && avctx->slices > 0)
> +av_log(avctx, AV_LOG_WARNING, "The encode slice option is not "
> +   "supported with this VAAPI version.\n");

It's a driver constraint, not a VAAPI version one.

> +
>  return 0;
>  }
>  
> -- 
> 2.11.0
> 
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf/movenc.c: Set sgpd and sbgp atoms to represent decoder delay for AAC.

2017-08-09 Thread Derek Buitenhuis
On 8/9/2017 1:00 AM, Sasi Inguva wrote:
> According to 
> https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFAppenG/QTFFAppenG.html
>  and ISO-IEC-14496-12 Section 10.1.1.1 and 10.1.1.3
> 
> Signed-off-by: Sasi Inguva 
> ---
>  libavformat/movenc.c| 22 +++---
>  tests/ref/fate/adtstoasc_ticket3715 |  4 ++--
>  tests/ref/fate/copy-psp |  4 ++--
>  tests/ref/fate/movenc   | 12 ++--
>  4 files changed, 25 insertions(+), 17 deletions(-)

Probably fine to push.

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


Re: [FFmpeg-devel] [PATCH V2 2/4] lavc/vaapi_encode: Add max slices number query.

2017-08-09 Thread Mark Thompson
On 02/08/17 06:55, Jun Zhao wrote:
> From 2a0bd4795fcf7d889c3c93b03e8698015a519260 Mon Sep 17 00:00:00 2001
> From: Jun Zhao 
> Date: Tue, 1 Aug 2017 04:16:30 -0400
> Subject: [PATCH V2 2/4] lavc/vaapi_encode: Add max slices number query.
> 
> Add max slices number query.
> 
> Signed-off-by: Jun Zhao 
> ---
>  libavcodec/vaapi_encode.c | 4 
>  libavcodec/vaapi_encode.h | 3 +++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
> index 11d9803b5d..9fc70bdd55 100644
> --- a/libavcodec/vaapi_encode.c
> +++ b/libavcodec/vaapi_encode.c
> @@ -972,6 +972,7 @@ static av_cold int 
> vaapi_encode_config_attributes(AVCodecContext *avctx)
>  { VAConfigAttribRTFormat },
>  { VAConfigAttribRateControl  },
>  { VAConfigAttribEncMaxRefFrames  },
> +{ VAConfigAttribEncMaxSlices },
>  { VAConfigAttribEncPackedHeaders },
>  };
>  
> @@ -1102,6 +1103,9 @@ static av_cold int 
> vaapi_encode_config_attributes(AVCodecContext *avctx)
>  }
>  }
>  break;
> +case VAConfigAttribEncMaxSlices:
> +ctx->max_slices = attr[i].value;
> +break;
>  case VAConfigAttribEncPackedHeaders:
>  if (ctx->va_packed_headers & ~attr[i].value) {
>  // This isn't fatal, but packed headers are always
> diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h
> index b542772aed..fd55aa6cdc 100644
> --- a/libavcodec/vaapi_encode.h
> +++ b/libavcodec/vaapi_encode.h
> @@ -103,6 +103,9 @@ typedef struct VAAPIEncodeContext {
>  // Supported packed headers (initially the desired set, modified
>  // later to what is actually supported).
>  unsigned intva_packed_headers;
> +// Supported max-slices number per frame. (0 means driver cannot
> +// support max mutil-slices query)
> +int max_slices;
>  
>  // The required size of surfaces.  This is probably the input
>  // size (AVCodecContext.width|height) aligned up to whatever

A few lines further down:
// Everything above this point must be set before calling
// ff_vaapi_encode_init().

max_slices is not in this category, so it should be somewhere below.

> -- 
> 2.11.0
> 

Probably fine?  Without too much thought I would probably write this the other 
way around (check the value in vaapi_encode_config_attributes(), then know it 
is correct thereafter, like max_b_frames), but maybe that causes more problems 
with unexpected failure and needing to mess with MPEG-2.

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


Re: [FFmpeg-devel] [PATCH] build: Allow libffmpeg to be built for Chromium-based browsers

2017-08-09 Thread James Le Cuirot
On Sat, 29 Jul 2017 11:40:30 +0200
Nicolas George  wrote:

> Le decadi 10 thermidor, an CCXXV, James Le Cuirot a écrit :
> > This Makefile snippet allows libffmpeg to be created without the help
> > of Chromium's build system. It uses the CONFIG_SHARED variable to
> > decide whether to link the FFmpeg libraries statically or
> > dynamically. In the latter case, libffmpeg is just a wrapper with no
> > symbols of its own.  
> 
> I concur with the other remarks: this is not the right approach, and it
> has many flaws.
> 
> But on the other hand, I strongly support the underlying idea: having
> many libraries causes no end of trouble, for users a little but for
> developers mostly. See for example the proliferation of avpriv symbols
> whenever code needs to be factored between libraries but too complex for
> a public API.
> 
> So if you were interested in making this right: make it the default and
> only library for the project, to be applied at / instead of the next
> major bump, I would strongly support it, and help to the extent of my
> ability.

I am merely an end user here so I'm afraid my interest in this only goes
as far as the Chromium use case.

I'm not sure whether it's the default but it actually can be built to
link directly against the individual libraries and this is exactly what
Gentoo's Chromium package does when the system-ffmpeg flag is enabled.

I don't know why Opera and Vivaldi build libffmpeg.so as a separate
component or why Chromium even makes this an option in the first place.
A distro may not have the same library versions available but that
doesn't stop these browsers bundling the individual libraries. Perhaps
it's to make swapping it out easier but then it's just one file instead
of three.

I wasn't too optimistic about this being accepted but the Gentoo FFmpeg
maintainer insisted that I put it forward anyway. Hopefully I can
still convince him to carry the patch, otherwise users like me will
lose out. Several others expressed interest.


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


Re: [FFmpeg-devel] [PATCH V2 1/4] lavc/vaapi_encode: Change the slice/parameter buffers to dynamic alloc.

2017-08-09 Thread Mark Thompson
On 02/08/17 06:53, Jun Zhao wrote:
> V2: Change the slice/parameter buffers to dynamic alloc and split
> the mutil-slice support for AVC/HEVC.
> 
> From 39fd7852df0c96217310c525107da06a7ec0a062 Mon Sep 17 00:00:00 2001
> From: Jun Zhao 
> Date: Mon, 31 Jul 2017 22:46:23 -0400
> Subject: [PATCH V2 1/4] lavc/vaapi_encode: Change the slice/parameter buffers
>  to dynamic alloc.
> 
> Change the slice/parameter buffers to be allocated dynamically.
> 
> Signed-off-by: Wang, Yi A 
> Signed-off-by: Jun Zhao 
> ---
>  libavcodec/vaapi_encode.c | 27 ---
>  libavcodec/vaapi_encode.h |  6 ++
>  2 files changed, 26 insertions(+), 7 deletions(-)
> 
> diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
> index 2de5f76cab..11d9803b5d 100644
> --- a/libavcodec/vaapi_encode.c
> +++ b/libavcodec/vaapi_encode.c
> @@ -36,13 +36,19 @@ static int vaapi_encode_make_packed_header(AVCodecContext 
> *avctx,
>  VAAPIEncodeContext *ctx = avctx->priv_data;
>  VAStatus vas;
>  VABufferID param_buffer, data_buffer;
> +VABufferID *tmp;
>  VAEncPackedHeaderParameterBuffer params = {
>  .type = type,
>  .bit_length = bit_len,
>  .has_emulation_bytes = 1,
>  };
>  
> -av_assert0(pic->nb_param_buffers + 2 <= MAX_PARAM_BUFFERS);
> +tmp = av_realloc_array(pic->param_buffers, sizeof(*tmp), 
> (pic->nb_param_buffers + 2));

Redundant parentheses?

> +if (!tmp) {
> +av_freep(>param_buffers);

This leaks the actual buffers which were allocated 
(pic->param_buffers[0..pic->nb_param_buffers-1]).

> +return AVERROR(ENOMEM);
> +}
> +pic->param_buffers = tmp;
>  
>  vas = vaCreateBuffer(ctx->hwctx->display, ctx->va_context,
>   VAEncPackedHeaderParameterBufferType,
> @@ -77,9 +83,15 @@ static int vaapi_encode_make_param_buffer(AVCodecContext 
> *avctx,
>  {
>  VAAPIEncodeContext *ctx = avctx->priv_data;
>  VAStatus vas;
> +VABufferID *tmp;
>  VABufferID buffer;
>  
> -av_assert0(pic->nb_param_buffers + 1 <= MAX_PARAM_BUFFERS);
> +tmp = av_realloc_array(pic->param_buffers, sizeof(*tmp), 
> (pic->nb_param_buffers + 1));
> +if (!tmp) {
> +av_freep(>param_buffers);

Same here.

> +return AVERROR(ENOMEM);
> +}
> +pic->param_buffers = tmp;
>  
>  vas = vaCreateBuffer(ctx->hwctx->display, ctx->va_context,
>   type, len, 1, data, );
> @@ -122,6 +134,8 @@ static int vaapi_encode_wait(AVCodecContext *avctx,
>  // Input is definitely finished with now.
>  av_frame_free(>input_image);
>  
> +av_freep(>param_buffers);

Maybe it would be cleaner to free param_buffers at the end of 
vaapi_encode_issue() - the buffers themselves are no longer usable at that 
point.

> +
>  pic->encode_complete = 1;
>  return 0;
>  }
> @@ -313,7 +327,10 @@ static int vaapi_encode_issue(AVCodecContext *avctx,
>  }
>  }
>  
> -av_assert0(pic->nb_slices <= MAX_PICTURE_SLICES);
> +pic->slices = (VAAPIEncodeSlice **)av_malloc(sizeof(VAAPIEncodeSlice *) 
> * pic->nb_slices);
> +if (pic->slices == NULL)
> +goto fail;
> +
>  for (i = 0; i < pic->nb_slices; i++) {
>  slice = av_mallocz(sizeof(*slice));

How about just making pic->slices be VAAPIEncodeSlice*, pointing to an array of 
the structures?  This code is now allocating both an array of pointers and then 
each element of that array individually.

>  if (!slice) {
> @@ -427,6 +444,8 @@ fail:
>  vaDestroyBuffer(ctx->hwctx->display, pic->param_buffers[i]);
>  fail_at_end:
>  av_freep(>codec_picture_params);
> +av_freep(>param_buffers);
> +av_freep(>slices);
>  av_frame_free(>recon_image);
>  av_buffer_unref(>output_buffer_ref);
>  pic->output_buffer = VA_INVALID_ID;
> @@ -544,6 +563,8 @@ static int vaapi_encode_free(AVCodecContext *avctx,
>  av_frame_free(>input_image);
>  av_frame_free(>recon_image);
>  
> +av_freep(>param_buffers);
> +av_freep(>slices);
>  // Output buffer should already be destroyed.
>  av_assert0(pic->output_buffer == VA_INVALID_ID);
>  
> diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h
> index 0edf27e4cb..b542772aed 100644
> --- a/libavcodec/vaapi_encode.h
> +++ b/libavcodec/vaapi_encode.h
> @@ -35,8 +35,6 @@ enum {
>  MAX_CONFIG_ATTRIBUTES  = 4,
>  MAX_GLOBAL_PARAMS  = 4,
>  MAX_PICTURE_REFERENCES = 2,
> -MAX_PICTURE_SLICES = 112,
> -MAX_PARAM_BUFFERS  = 128,
>  MAX_REORDER_DELAY  = 16,
>  MAX_PARAM_BUFFER_SIZE  = 1024,
>  };
> @@ -73,7 +71,7 @@ typedef struct VAAPIEncodePicture {
>  VASurfaceID recon_surface;
>  
>  int  nb_param_buffers;
> -VABufferID  param_buffers[MAX_PARAM_BUFFERS];
> +VABufferID  *param_buffers;
>  
>  AVBufferRef*output_buffer_ref;
>  VABufferID  output_buffer;

Re: [FFmpeg-devel] [PATCH] avcodec/aacdec: Fix PCE channel_layout verification

2017-08-09 Thread Michael Niedermayer
On Wed, Jul 26, 2017 at 03:29:02PM -0300, nsug...@3way.com.ar wrote:
> From: Nicolas Sugino 
> 
> ---
>  libavcodec/aacdec_template.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

applied

thanks

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

What does censorship reveal? It reveals fear. -- Julian Assange


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


Re: [FFmpeg-devel] [WIP] libcodec2 wrapper + de/muxer in FFmpeg

2017-08-09 Thread Michael Niedermayer
On Tue, Aug 08, 2017 at 11:49:45PM +0200, Tomas Härdin wrote:
 [...]

>  ffmpeg.c |3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 5bd20883fdc12aefa609fc803fe5709069b3e9a0  
> 0003-Don-t-complain-about-codec2-s-700-bit-s-modes-in-ffm.patch
> From b693b6175289e6ad0c643462d8f69f6830086099 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= 
> Date: Thu, 3 Aug 2017 17:33:04 +0200
> Subject: [PATCH 3/3] Don't complain about codec2's 700 bit/s modes in ffmpeg.c
> 
> ---
>  ffmpeg.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/ffmpeg.c b/ffmpeg.c
> index 888d19a647..09a5b541c0 100644
> --- a/ffmpeg.c
> +++ b/ffmpeg.c
> @@ -3480,7 +3480,8 @@ static int init_output_stream(OutputStream *ost, char 
> *error, int error_len)
>  av_buffersink_set_frame_size(ost->filter->filter,
>  ost->enc_ctx->frame_size);
>  assert_avoptions(ost->encoder_opts);
> -if (ost->enc_ctx->bit_rate && ost->enc_ctx->bit_rate < 1000)
> +if (ost->enc_ctx->bit_rate && ost->enc_ctx->bit_rate < 1000 &&
> +ost->enc_ctx->codec_id != AV_CODEC_ID_CODEC2 /* don't complain 
> about 700 bit/s modes */)
>  av_log(NULL, AV_LOG_WARNING, "The bitrate parameter is set too 
> low."
>   " It takes bits/s as argument, not 
> kbits/s\n");
>  

LGTM

alternatively you could add a minimum bitrate parameter to AVCodec
or AVCodecDescriptor

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you fake or manipulate statistics in a paper in physics you will never
get a job again.
If you fake or manipulate statistics in a paper in medicin you will get
a job for life at the pharma industry.


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


Re: [FFmpeg-devel] [PATCH] build: Allow libffmpeg to be built for Chromium-based browsers

2017-08-09 Thread James Le Cuirot
On Sat Jul 29 12:20:05 EEST 2017
Reimar Döffinger  wrote:

> On 28.07.2017, at 12:07, James Le Cuirot  wrote:
> > diff --git a/ffbuild/libffmpeg.mak b/ffbuild/libffmpeg.mak
> > new file mode 100644
> > index 000..992cf3c
> > --- /dev/null
> > +++ b/ffbuild/libffmpeg.mak
> > @@ -0,0 +1,21 @@
> > +LIBFFMPEG = $(SLIBPREF)ffmpeg$(SLIBSUF)
> > +LIBFFMPEG_LINK = $(LD) -shared -Wl,-soname,$(LIBFFMPEG) -Wl,-Bsymbolic 
> > -Wl,-z,now -Wl,-z,relro -Wl,-z,defs -Wl,--gc-sections $(LDFLAGS) 
> > $(LDLIBFLAGS) -o $(LIBFFMPEG)
> > +
> > +libffmpeg-: libavcodec/$(LIBPREF)avcodec$(LIBSUF) 
> > libavformat/$(LIBPREF)avformat$(LIBSUF) libavutil/$(LIBPREF)avutil$(LIBSUF) 
> > libswresample/$(LIBPREF)swresample$(LIBSUF)
> > +$(LIBFFMPEG_LINK) -Wl,--whole-archive $^ -Wl,--no-whole-archive 
> > $(FFEXTRALIBS)
> > +
> > +libffmpeg-yes: libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) 
> > libavformat/$(SLIBPREF)avformat$(SLIBSUF) 
> > libavutil/$(SLIBPREF)avutil$(SLIBSUF)
> > +$(LIBFFMPEG_LINK) -Wl,--no-as-needed -lavcodec -lavformat -lavutil
> 
> I don't see you using a version file to filter out the private
> symbols? That is a VERY dangerous thing to forget.
> Also I don't like that it doesn't reuse the standard linking options
> used for the main libraries.

If you mean LD_O and SHFLAGS, I didn't use them because -o $@ and
-Wl,-soname,$$(@F) were using "libffmpeg-" as the name. My Make-fu
isn't that great and I'd love to know if there is some way to do this
properly.

If you mean the additional linker flags, these are the same flags that
Chromium uses to create libffmpeg. Maybe they're not strictly required.

SHFLAGS also applies the version scripts. Chromium doesn't use one so I
didn't either. My knowledge here is sketchy so I'm not sure if it makes
any difference when this library won't be used at build time but I came
up with a new script anyway. It makes av* global, leaving everything
else local, and this seems to work. The version label doesn't matter
for this use case so I simply put LIBFFMPEG but I guess it could be
something like LIBFFMPEG_57.55.55.


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


[FFmpeg-devel] Mov/mp4 demuxer failing on mp4 file (Sample size is too large)

2017-08-09 Thread Robert Krüger
Hi,

can someone tell me what this hints at? Is this more likely a broken file
or a missing feature of the demuxer? Unfortunately I cannot make the file
available due to legal issues but if I know where to look, I could try to
find a sample with similar characteristics.

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb4b7002200] Sample size 2147484020 is too
large

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb4b7002200] Invalid sample_count=-2147483519

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb4b7002200] error reading header

Thanks in advance,

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


Re: [FFmpeg-devel] [PATCH] JPEG2000: SSE optimisation of DWT decoding

2017-08-09 Thread Michael Bradshaw
On Tue, Aug 8, 2017 at 2:09 AM, maxime taisant 
wrote:
>
> [...]
> +void (*dwt_decode)(DWTContext *s, void *t);


Why the global variable? It seems unnecessary, and as Clément pointed out,
is unsafe and should not be used in the FFmpeg code base (at least not
without a very good justification and synchronization).
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCHv5 3/4] libavcodec: v4l2: add codec formats

2017-08-09 Thread Jorge Ramirez-Ortiz
In addition, enable the multi planar raw formats.

Reviewed-by: Jorge Ramirez 
Tested-by: Jorge Ramirez 
---
 libavcodec/v4l2_fmt.c | 38 +-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/libavcodec/v4l2_fmt.c b/libavcodec/v4l2_fmt.c
index 855cc64..2cda6b2 100644
--- a/libavcodec/v4l2_fmt.c
+++ b/libavcodec/v4l2_fmt.c
@@ -58,7 +58,43 @@ const struct v4l_fmt_map avpriv_v4l_fmt_conversion_table[] = 
{
 { AV_PIX_FMT_BAYER_GRBG8, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_SGRBG8 , 
FF_V4L_PACK_AVPACKET | FF_V4L_PACK_AVFRAME },
 { AV_PIX_FMT_BAYER_RGGB8, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_SRGGB8 , 
FF_V4L_PACK_AVPACKET | FF_V4L_PACK_AVFRAME },
 #endif
-{ AV_PIX_FMT_NONE,AV_CODEC_ID_NONE, 0},
+#ifdef V4L2_PIX_FMT_NV12M
+{ AV_PIX_FMT_NV12,AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_NV12M  , 
FF_V4L_PACK_AVFRAME  },
+#endif
+#ifdef V4L2_PIX_FMT_NV21M
+{ AV_PIX_FMT_NV21,AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_NV21M  , 
FF_V4L_PACK_AVFRAME  },
+#endif
+#ifdef V4L2_PIX_FMT_YUV420M
+{ AV_PIX_FMT_YUV420P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV420M, 
FF_V4L_PACK_AVFRAME  },
+#endif
+#ifdef V4L2_PIX_FMT_NV16M
+{ AV_PIX_FMT_NV16,AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_NV16M  , 
FF_V4L_PACK_AVFRAME  },
+#endif
+#ifdef V4L2_PIX_FMT_DV
+{ AV_PIX_FMT_NONE,AV_CODEC_ID_DVVIDEO,  V4L2_PIX_FMT_DV , 
FF_V4L_PACK_AVPACKET },
+#endif
+#ifdef V4L2_PIX_FMT_H263
+{ AV_PIX_FMT_NONE,AV_CODEC_ID_H263, V4L2_PIX_FMT_H263   , 
FF_V4L_PACK_AVPACKET },
+#endif
+#ifdef V4L2_PIX_FMT_MPEG1
+{ AV_PIX_FMT_NONE,AV_CODEC_ID_MPEG1VIDEO, V4L2_PIX_FMT_MPEG1, 
FF_V4L_PACK_AVPACKET },
+#endif
+#ifdef V4L2_PIX_FMT_MPEG2
+{ AV_PIX_FMT_NONE,AV_CODEC_ID_MPEG2VIDEO, V4L2_PIX_FMT_MPEG2, 
FF_V4L_PACK_AVPACKET },
+#endif
+#ifdef V4L2_PIX_FMT_VC1_ANNEX_G
+{ AV_PIX_FMT_NONE,AV_CODEC_ID_VC1,  V4L2_PIX_FMT_VC1_ANNEX_G, 
FF_V4L_PACK_AVPACKET },
+#endif
+#ifdef V4L2_PIX_FMT_VP8
+{ AV_PIX_FMT_NONE,AV_CODEC_ID_VP8,  V4L2_PIX_FMT_VP8, 
FF_V4L_PACK_AVPACKET },
+#endif
+#ifdef V4L2_PIX_FMT_HEVC
+{ AV_PIX_FMT_NONE,AV_CODEC_ID_HEVC, V4L2_PIX_FMT_HEVC, 
FF_V4L_PACK_AVPACKET},
+#endif
+#ifdef V4L2_PIX_FMT_VP9
+{ AV_PIX_FMT_NONE,AV_CODEC_ID_VP9,  V4L2_PIX_FMT_VP9, 
FF_V4L_PACK_AVPACKET },
+#endif
+{ AV_PIX_FMT_NONE,AV_CODEC_ID_NONE, 0   , 
FF_V4L_PACK_AVPACKET | FF_V4L_PACK_AVFRAME },
 };
 
 uint32_t avpriv_v4l_fmt_ff2v4l(enum AVPixelFormat pix_fmt, enum AVCodecID 
codec_id, int pack_flags)
-- 
2.7.4

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


[FFmpeg-devel] [PATCHv5 4/4] libavcodec: v4l2: add support for v4l2 mem2mem codecs

2017-08-09 Thread Jorge Ramirez-Ortiz
This patchset enhances Alexis Ballier's original patch and validates
it using Qualcomm's Venus hardware (driver recently landed upstream
[1]).

This has been tested on Qualcomm's DragonBoard 410c and 820c
Configure/make scripts have been validated on Ubuntu 10.04 and
16.04.

Tested decoders:
   - h264
   - mpeg4
   - vp8
   - vp9
   - hevc

Tested encoders:
- h264
- h263
- mpeg4

Tested transcoding (concurrent encoding/decoding)

Some of the changes introduced:
- v4l2: code cleanup and abstractions added
- v4l2: follow the new encode/decode api.
- v4l2: fix display size for NV12 output pool.
- v4l2: handle EOS.
- v4l2: vp8 and mpeg4 decoding.
- v4l2: hevc and vp9 support.
- v4l2: generate EOF on dequeue errors.
- v4l2: h264_mp4toannexb filtering.
- v4l2: fixed make install and fate issues.
- v4l2: codecs enabled/disabled depending on pixfmt defined
- v4l2: pass timebase/framerate to the context

[1] https://lwn.net/Articles/697956/

Reviewed-by: Jorge Ramirez 
Reviewed-by: Alexis Ballier 
Tested-by: Jorge Ramirez 
---
 Changelog |   1 +
 configure |  30 ++-
 libavcodec/Makefile   |  18 +-
 libavcodec/allcodecs.c|   9 +
 libavcodec/v4l2_buffers.c | 585 ++
 libavcodec/v4l2_buffers.h | 249 ++
 libavcodec/v4l2_fmt.c |   9 +-
 libavcodec/v4l2_m2m.c | 381 +++
 libavcodec/v4l2_m2m.h |  52 
 libavcodec/v4l2_m2m_avcodec.h |  32 +++
 libavcodec/v4l2_m2m_dec.c | 239 +
 libavcodec/v4l2_m2m_enc.c | 290 +
 12 files changed, 1888 insertions(+), 7 deletions(-)
 create mode 100644 libavcodec/v4l2_buffers.c
 create mode 100644 libavcodec/v4l2_buffers.h
 create mode 100644 libavcodec/v4l2_m2m.c
 create mode 100644 libavcodec/v4l2_m2m.h
 create mode 100644 libavcodec/v4l2_m2m_avcodec.h
 create mode 100644 libavcodec/v4l2_m2m_dec.c
 create mode 100644 libavcodec/v4l2_m2m_enc.c

diff --git a/Changelog b/Changelog
index c797d68..1071e08 100644
--- a/Changelog
+++ b/Changelog
@@ -32,6 +32,7 @@ version :
 - unpremultiply video filter
 - tlut2 video filter
 - floodfill video filter
+- V4L2 mem2mem HW accelerated codecs support
 
 version 3.3:
 - CrystalHD decoder moved to new decode API
diff --git a/configure b/configure
index ed94de0..6040c6f 100755
--- a/configure
+++ b/configure
@@ -149,6 +149,7 @@ Component options:
   --disable-pixelutils disable pixel utils in libavutil
 
 Individual component options:
+  --disable-v4l2_m2m   disable V4L2 mem2mem code [autodetect]
   --disable-everything disable all components listed below
   --disable-encoder=NAME   disable encoder NAME
   --enable-encoder=NAMEenable encoder NAME
@@ -1432,6 +1433,7 @@ AVCODEC_COMPONENTS="
 
 AVDEVICE_COMPONENTS="
 indevs
+v4l2_m2m
 outdevs
 "
 AVFILTER_COMPONENTS="
@@ -2270,6 +2272,7 @@ map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM
 loongson2_deps="mips"
 loongson3_deps="mips"
 v4l2_deps_any="linux_videodev2_h sys_videoio_h"
+v4l2_m2m_select="v4l2"
 mipsfpu_deps="mips"
 mipsdsp_deps="mips"
 mipsdspr2_deps="mips"
@@ -2742,6 +2745,8 @@ nvenc_deps="cuda"
 nvenc_deps_any="dlopen LoadLibrary"
 nvenc_encoder_deps="nvenc"
 
+h263_v4l2m2m_decoder_deps="v4l2_m2m h263_v4l2_m2m"
+h263_v4l2m2m_encoder_deps="v4l2_m2m h263_v4l2_m2m"
 h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser"
 h264_cuvid_decoder_deps="cuda cuvid"
 h264_cuvid_decoder_select="h264_mp4toannexb_bsf"
@@ -2760,6 +2765,8 @@ h264_vda_decoder_deps="vda"
 h264_vda_decoder_select="h264_decoder"
 h264_vdpau_decoder_deps="vdpau"
 h264_vdpau_decoder_select="h264_decoder"
+h264_v4l2m2m_decoder_deps="v4l2_m2m h264_v4l2_m2m"
+h264_v4l2m2m_encoder_deps="v4l2_m2m h264_v4l2_m2m"
 hevc_cuvid_decoder_deps="cuda cuvid"
 hevc_cuvid_decoder_select="hevc_mp4toannexb_bsf"
 hevc_mediacodec_decoder_deps="mediacodec"
@@ -2771,12 +2778,15 @@ hevc_qsv_encoder_deps="libmfx"
 hevc_qsv_encoder_select="hevcparse qsvenc"
 hevc_vaapi_encoder_deps="VAEncPictureParameterBufferHEVC"
 hevc_vaapi_encoder_select="vaapi_encode golomb"
+hevc_v4l2m2m_decoder_deps="v4l2_m2m hevc_v4l2_m2m"
+hevc_v4l2m2m_encoder_deps="v4l2_m2m hevc_v4l2_m2m"
 mjpeg_cuvid_decoder_deps="cuda cuvid"
 mjpeg_vaapi_encoder_deps="VAEncPictureParameterBufferJPEG"
 mjpeg_vaapi_encoder_select="vaapi_encode jpegtables"
 mpeg1_cuvid_decoder_deps="cuda cuvid"
 mpeg1_vdpau_decoder_deps="vdpau"
 mpeg1_vdpau_decoder_select="mpeg1video_decoder"
+mpeg1_v4l2m2m_decoder_deps="v4l2_m2m mpeg1_v4l2_m2m"
 mpeg2_crystalhd_decoder_select="crystalhd"
 mpeg2_cuvid_decoder_deps="cuda cuvid"
 

[FFmpeg-devel] [PATCHv5 1/4] Move lavd/v4l2-common.* to lavc

2017-08-09 Thread Jorge Ramirez-Ortiz
From: Alexis Ballier 

In preparation to support the integation of the V4L2 API for encoding
and decoding, move v4l2 related files to libavcodec.

v4l2-common was renamed to v4l2_fmt for clarity (v4l2-common.h belongs
to the V4L2 API)

Signed-off-by: Alexis Ballier 
Reviewed-by: Jorge Ramirez-Ortiz 
---
 configure |   6 ++-
 libavcodec/Makefile   |   1 +
 libavcodec/v4l2_fmt.c | 105 ++
 libavcodec/v4l2_fmt.h |  57 +
 libavdevice/Makefile  |   6 +--
 libavdevice/v4l2-common.c | 105 --
 libavdevice/v4l2-common.h |  61 ---
 libavdevice/v4l2.c|  40 --
 libavdevice/v4l2enc.c |  12 +-
 9 files changed, 206 insertions(+), 187 deletions(-)
 create mode 100644 libavcodec/v4l2_fmt.c
 create mode 100644 libavcodec/v4l2_fmt.h
 delete mode 100644 libavdevice/v4l2-common.c
 delete mode 100644 libavdevice/v4l2-common.h

diff --git a/configure b/configure
index 66c7b94..ed94de0 100755
--- a/configure
+++ b/configure
@@ -1671,6 +1671,7 @@ SUBSYSTEM_LIST="
 pixelutils
 network
 rdft
+v4l2
 "
 
 # COMPONENT_LIST needs to come last to ensure correct dependency checking
@@ -2268,6 +2269,7 @@ map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM
 
 loongson2_deps="mips"
 loongson3_deps="mips"
+v4l2_deps_any="linux_videodev2_h sys_videoio_h"
 mipsfpu_deps="mips"
 mipsdsp_deps="mips"
 mipsdspr2_deps="mips"
@@ -3041,8 +3043,8 @@ sdl2_outdev_deps="sdl2"
 sndio_indev_deps="sndio"
 sndio_outdev_deps="sndio"
 v4l_indev_deps="linux_videodev_h"
-v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
-v4l2_outdev_deps_any="linux_videodev2_h sys_videoio_h"
+v4l2_indev_select="v4l2"
+v4l2_outdev_select="v4l2"
 vfwcap_indev_deps="vfw32 vfwcap_defines"
 xcbgrab_indev_deps="libxcb"
 xv_outdev_deps="X11_extensions_Xvlib_h XvGetPortAttribute"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index b0c39ac..6be1b4b 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -101,6 +101,7 @@ OBJS-$(CONFIG_LZF) += lzf.o
 OBJS-$(CONFIG_MDCT)+= mdct_fixed.o mdct_float.o 
mdct_fixed_32.o
 OBJS-$(CONFIG_ME_CMP)  += me_cmp.o
 OBJS-$(CONFIG_MEDIACODEC)  += mediacodecdec_common.o 
mediacodec_surface.o mediacodec_wrapper.o mediacodec_sw_buffer.o
+OBJS-$(CONFIG_V4L2)+= v4l2_fmt.o
 OBJS-$(CONFIG_MPEG_ER) += mpeg_er.o
 OBJS-$(CONFIG_MPEGAUDIO)   += mpegaudio.o
 OBJS-$(CONFIG_MPEGAUDIODSP)+= mpegaudiodsp.o\
diff --git a/libavcodec/v4l2_fmt.c b/libavcodec/v4l2_fmt.c
new file mode 100644
index 000..322f595
--- /dev/null
+++ b/libavcodec/v4l2_fmt.c
@@ -0,0 +1,105 @@
+/*
+ * 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 "v4l2_fmt.h"
+
+const struct v4l_fmt_map avpriv_v4l_fmt_conversion_table[] = {
+//ff_fmt  codec_id  v4l2_fmt
+{ AV_PIX_FMT_YUV420P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV420  },
+{ AV_PIX_FMT_YUV420P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YVU420  },
+{ AV_PIX_FMT_YUV422P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV422P },
+{ AV_PIX_FMT_YUYV422, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUYV},
+{ AV_PIX_FMT_UYVY422, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_UYVY},
+{ AV_PIX_FMT_YUV411P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV411P },
+{ AV_PIX_FMT_YUV410P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV410  },
+{ AV_PIX_FMT_YUV410P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YVU410  },
+{ AV_PIX_FMT_RGB555LE,AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB555  },
+{ AV_PIX_FMT_RGB555BE,AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB555X },
+{ AV_PIX_FMT_RGB565LE,AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB565  },
+{ AV_PIX_FMT_RGB565BE,AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB565X },
+{ AV_PIX_FMT_BGR24,   AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_BGR24   },
+{ AV_PIX_FMT_RGB24,   AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB24   },
+{ AV_PIX_FMT_BGR0,AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_BGR32   },
+{ AV_PIX_FMT_0RGB,AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB32   },

[FFmpeg-devel] [PATCHv5 2/4] libavcodec: v4l2: add pack_flags to the conversion tables

2017-08-09 Thread Jorge Ramirez-Ortiz
From: Alexis Ballier 

Extend the mapping function to use the v4l2 conversion tables.

Reviewed-by: Jorge Ramirez 
Tested-by: Jorge Ramirez 
---
 libavcodec/v4l2_fmt.c | 63 ++-
 libavcodec/v4l2_fmt.h | 17 +-
 libavdevice/v4l2.c|  2 +-
 libavdevice/v4l2enc.c |  2 +-
 4 files changed, 45 insertions(+), 39 deletions(-)

diff --git a/libavcodec/v4l2_fmt.c b/libavcodec/v4l2_fmt.c
index 322f595..855cc64 100644
--- a/libavcodec/v4l2_fmt.c
+++ b/libavcodec/v4l2_fmt.c
@@ -19,49 +19,49 @@
 #include "v4l2_fmt.h"
 
 const struct v4l_fmt_map avpriv_v4l_fmt_conversion_table[] = {
-//ff_fmt  codec_id  v4l2_fmt
-{ AV_PIX_FMT_YUV420P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV420  },
-{ AV_PIX_FMT_YUV420P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YVU420  },
-{ AV_PIX_FMT_YUV422P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV422P },
-{ AV_PIX_FMT_YUYV422, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUYV},
-{ AV_PIX_FMT_UYVY422, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_UYVY},
-{ AV_PIX_FMT_YUV411P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV411P },
-{ AV_PIX_FMT_YUV410P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV410  },
-{ AV_PIX_FMT_YUV410P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YVU410  },
-{ AV_PIX_FMT_RGB555LE,AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB555  },
-{ AV_PIX_FMT_RGB555BE,AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB555X },
-{ AV_PIX_FMT_RGB565LE,AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB565  },
-{ AV_PIX_FMT_RGB565BE,AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB565X },
-{ AV_PIX_FMT_BGR24,   AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_BGR24   },
-{ AV_PIX_FMT_RGB24,   AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB24   },
-{ AV_PIX_FMT_BGR0,AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_BGR32   },
-{ AV_PIX_FMT_0RGB,AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB32   },
-{ AV_PIX_FMT_GRAY8,   AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_GREY},
+/* ff_fmt  codec_id  v4l2_fmt  
pack_flags */
+{ AV_PIX_FMT_YUV420P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV420 , 
FF_V4L_PACK_AVPACKET },
+{ AV_PIX_FMT_YUV420P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YVU420 , 
FF_V4L_PACK_AVPACKET },
+{ AV_PIX_FMT_YUV422P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV422P, 
FF_V4L_PACK_AVPACKET },
+{ AV_PIX_FMT_YUYV422, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUYV   , 
FF_V4L_PACK_AVPACKET | FF_V4L_PACK_AVFRAME },
+{ AV_PIX_FMT_UYVY422, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_UYVY   , 
FF_V4L_PACK_AVPACKET | FF_V4L_PACK_AVFRAME },
+{ AV_PIX_FMT_YUV411P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV411P, 
FF_V4L_PACK_AVPACKET },
+{ AV_PIX_FMT_YUV410P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV410 , 
FF_V4L_PACK_AVPACKET },
+{ AV_PIX_FMT_YUV410P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YVU410 , 
FF_V4L_PACK_AVPACKET },
+{ AV_PIX_FMT_RGB555LE,AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB555 , 
FF_V4L_PACK_AVPACKET | FF_V4L_PACK_AVFRAME },
+{ AV_PIX_FMT_RGB555BE,AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB555X, 
FF_V4L_PACK_AVPACKET | FF_V4L_PACK_AVFRAME },
+{ AV_PIX_FMT_RGB565LE,AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB565 , 
FF_V4L_PACK_AVPACKET | FF_V4L_PACK_AVFRAME },
+{ AV_PIX_FMT_RGB565BE,AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB565X, 
FF_V4L_PACK_AVPACKET | FF_V4L_PACK_AVFRAME },
+{ AV_PIX_FMT_BGR24,   AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_BGR24  , 
FF_V4L_PACK_AVPACKET | FF_V4L_PACK_AVFRAME },
+{ AV_PIX_FMT_RGB24,   AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB24  , 
FF_V4L_PACK_AVPACKET | FF_V4L_PACK_AVFRAME },
+{ AV_PIX_FMT_BGR0,AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_BGR32  , 
FF_V4L_PACK_AVPACKET | FF_V4L_PACK_AVFRAME },
+{ AV_PIX_FMT_0RGB,AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB32  , 
FF_V4L_PACK_AVPACKET | FF_V4L_PACK_AVFRAME },
+{ AV_PIX_FMT_GRAY8,   AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_GREY   , 
FF_V4L_PACK_AVPACKET | FF_V4L_PACK_AVFRAME },
 #ifdef V4L2_PIX_FMT_Y16
-{ AV_PIX_FMT_GRAY16LE,AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_Y16 },
+{ AV_PIX_FMT_GRAY16LE,AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_Y16, 
FF_V4L_PACK_AVPACKET | FF_V4L_PACK_AVFRAME },
 #endif
-{ AV_PIX_FMT_NV12,AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_NV12},
-{ AV_PIX_FMT_NONE,AV_CODEC_ID_MJPEG,V4L2_PIX_FMT_MJPEG   },
-{ AV_PIX_FMT_NONE,AV_CODEC_ID_MJPEG,V4L2_PIX_FMT_JPEG},
+{ AV_PIX_FMT_NV12,AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_NV12   , 
FF_V4L_PACK_AVPACKET },
+{ AV_PIX_FMT_NONE,AV_CODEC_ID_MJPEG,V4L2_PIX_FMT_MJPEG  , 
FF_V4L_PACK_AVPACKET },
+{ AV_PIX_FMT_NONE,AV_CODEC_ID_MJPEG,V4L2_PIX_FMT_JPEG   , 
FF_V4L_PACK_AVPACKET },
 #ifdef V4L2_PIX_FMT_H264
-{ AV_PIX_FMT_NONE,AV_CODEC_ID_H264, V4L2_PIX_FMT_H264},
+{ AV_PIX_FMT_NONE,AV_CODEC_ID_H264, V4L2_PIX_FMT_H264   , 
FF_V4L_PACK_AVPACKET 

[FFmpeg-devel] V4L2 M2M version 5

2017-08-09 Thread Jorge Ramirez-Ortiz
This commit fixes the broken build on platforms not support v4l2_m2m
but supporting v4l - this has been tested on ubuntu 10.04, 2.6.xx
kernel.

It also fixes a regression introduced in libavcodec/Makefile with v4.

Fate suite and encoders/decoders tested as per the comments in the
main functional commit in the patchset (ie, 4/4) 

looking forward to more comments and thanks for your help.

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


Re: [FFmpeg-devel] [PATCHv4 3/4] libavcodec: v4l2: add codec formats

2017-08-09 Thread Jorge Ramirez

On 08/09/2017 09:39 AM, Jorge Ramirez wrote:


The previous version was missing the last field which would have left 
it un-initialized (so just added a null flag since I assume this was 
simply an error case that would not be processed?) I will fix it in 
v5 and enable the two flags for clarity then.


um, so sorry about the build.
what machine are you building on please? (ie, kernel? or maybe if you 
can its /usr/include/linux/videodev2.h API so I can try to reproduce?


um, I just tried v3.2.91 (oldest longterm I could find) and it builds 
fine (configure just disables the v4l2_m2m support); any data from 
your particular build will be very welcome.


again sorry about this.


ok I can reproduce on ubuntu 10.04.
will fix it and post v5 today

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


Re: [FFmpeg-devel] [PATCH] dynaudnorm: Increment input outside of the FFMIN macro so it doesn't get double incremented.

2017-08-09 Thread Paul B Mahol
On 8/9/17, andyndeanna  wrote:
> Greetings,
>
> Please find attached a patch for the dynaudnorm filter.  Under certain
> conditions, the output to the filter will clip at the beginning.  This can
> be demonstrated with the following:
>
> ffmpeg -filter_complex "aevalsrc=0:s=48000:d=0.6
> [a_in0];aevalsrc=0.1*sin(440*2*PI*t)*cos(0.5*2*PI*t):s=48000:d=20
> [a_in1];[a_in0] [a_in1] concat=n=2:v=0:a=1 [a_in];[a_in]
> dynaudnorm=b=1:m=100.0 [a_out]" -map "[a_out]" test.wav
>
>
> The root cause is that the FFMIN macro evaluates the minimum argument
> twice, resulting in the variable "input" getting incremented twice.
>

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


[FFmpeg-devel] [PATCH] avcodec/mjpegenc: disable unused code with AMV

2017-08-09 Thread Davinder Singh
hi,

this disables unused function amv_encode_picture() when AMV encoder is
disabled (and mjpeg enabled).
silences this warning:
CC libavcodec/mjpegenc.o
libavcodec/mjpegenc.c:351:12: warning: unused function 'amv_encode_picture'
[-Wunused-function]
static int amv_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
   ^

Patch attached.

Regards.
-- 
Davinder Singh


0001-avcodec-mjpegenc-disable-unused-code-with-AMV.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCHv4 3/4] libavcodec: v4l2: add codec formats

2017-08-09 Thread Jorge Ramirez

On 08/09/2017 07:51 AM, Jorge Ramirez wrote:

On 08/09/2017 03:37 AM, Michael Niedermayer wrote:

On Tue, Aug 08, 2017 at 06:07:07PM +0200, Jorge Ramirez-Ortiz wrote:

In addition, enable the multi planar raw formats.

Reviewed-by: Jorge Ramirez
Tested-by: Jorge Ramirez
---
  libavcodec/v4l2_fmt.c | 38 +-
  1 file changed, 37 insertions(+), 1 deletion(-)

[...]


+{ AV_PIX_FMT_NONE,AV_CODEC_ID_NONE, 0,  , 0
},

This looks odd and doesnt build


The previous version was missing the last field which would have left 
it un-initialized (so just added a null flag since I assume this was 
simply an error case that would not be processed?) I will fix it in v5 
and enable the two flags for clarity then.


um, so sorry about the build.
what machine are you building on please? (ie, kernel? or maybe if you 
can its /usr/include/linux/videodev2.h API so I can try to reproduce?


um, I just tried v3.2.91 (oldest longterm I could find) and it builds 
fine (configure just disables the v4l2_m2m support); any data from your 
particular build will be very welcome.


again sorry about this.




Things do obviously build on my end - fate tests pass and so does 
encoding/decoding so I think we are back to the issue that you 
originally flagged when building on relatively old kernels.


This addition to configure would have prevented the build error on 
your v3 kernel that you last shared with me in last time btw.
*check_code cc linux/videodev2.h "int i = V4L2_CAP_VIDEO_M2M_MPLANE | 
V4L2_CAP_VIDEO_M2M | V4L2_BUF_FLAG_LAST;" || disable v4l2_m2m*



These are v4l2 checks that allow enabling/disable codecs depending on 
them being present on the API.


# check V4L2 codecs available in the API
check_header linux/fb.h
check_header linux/videodev.h
check_header linux/videodev2.h
check_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; 
vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete
check_code cc linux/videodev2.h "int i = V4L2_CAP_VIDEO_M2M_MPLANE | 
V4L2_CAP_VIDEO_M2M | V4L2_BUF_FLAG_LAST;" || disable v4l2_m2m
check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_VC1_ANNEX_G;" && 
enable vc1_v4l2_m2m
check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG1;" && 
enable mpeg1_v4l2_m2m
check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG2;" && 
enable mpeg2_v4l2_m2m
check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG4;" && 
enable mpeg4_v4l2_m2m
check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_HEVC;" && enable 
hevc_v4l2_m2m
check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_H263;" && enable 
h263_v4l2_m2m
check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_H264;" && enable 
h264_v4l2_m2m
check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_VP8;" && enable 
vp8_v4l2_m2m
check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_VP9;" && enable 
vp9_v4l2_m2m




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