Re: [FFmpeg-devel] [PATCH V2 1/3] checkasm/vf_eq: add test for vf_eq

2019-09-26 Thread Fu, Ting


> -Original Message-
> From: ffmpeg-devel  On Behalf Of James
> Almer
> Sent: Friday, September 27, 2019 11:27 AM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH V2 1/3] checkasm/vf_eq: add test for vf_eq
> 
> On 9/27/2019 12:25 AM, Fu, Ting wrote:
> >
> >
> >> -Original Message-
> >> From: ffmpeg-devel  On Behalf Of
> >> James Almer
> >> Sent: Thursday, September 26, 2019 11:20 PM
> >> To: ffmpeg-devel@ffmpeg.org
> >> Subject: Re: [FFmpeg-devel] [PATCH V2 1/3] checkasm/vf_eq: add test
> >> for vf_eq
> >>
> >> On 9/26/2019 11:43 AM, Andreas Rheinhardt wrote:
> >>> Ting Fu:
>  Signed-off-by: Ting Fu 
>  ---
>   libavfilter/vf_eq.c   | 13 ---
>   libavfilter/vf_eq.h   |  1 +
>   tests/checkasm/Makefile   |  1 +
>   tests/checkasm/checkasm.c |  3 ++
>   tests/checkasm/checkasm.h |  1 +
>   tests/checkasm/vf_eq.c| 79
> >> +++
>   tests/fate/checkasm.mak   |  1 +
>   7 files changed, 94 insertions(+), 5 deletions(-)  create mode
>  100644 tests/checkasm/vf_eq.c
> 
>  diff --git a/libavfilter/vf_eq.c b/libavfilter/vf_eq.c index
>  2c4c7e4d54..0f9d129255 100644
>  --- a/libavfilter/vf_eq.c
>  +++ b/libavfilter/vf_eq.c
>  @@ -174,12 +174,18 @@ static int set_expr(AVExpr **pexpr, const
>  char
> >> *expr, const char *option, void *
>   return 0;
>   }
> 
>  +void ff_eq_init(EQContext *eq)
>  +{
>  +eq->process = process_c;
>  +if (ARCH_X86)
>  +ff_eq_init_x86(eq);
>  +}
>  +
>   static int initialize(AVFilterContext *ctx)  {
>   EQContext *eq = ctx->priv;
>   int ret;
>  -
>  -eq->process = process_c;
>  +ff_eq_init(eq);
> 
>   if ((ret = set_expr(&eq->contrast_pexpr, eq->contrast_expr,
> "contrast",
> >> ctx)) < 0 ||
>   (ret = set_expr(&eq->brightness_pexpr,   eq->brightness_expr,
> >> "brightness",   ctx)) < 0 ||
>  @@ -191,9 +197,6 @@ static int initialize(AVFilterContext *ctx)
>   (ret = set_expr(&eq->gamma_weight_pexpr,
>  eq->gamma_weight_expr,
> >> "gamma_weight", ctx)) < 0 )
>   return ret;
> 
>  -if (ARCH_X86)
>  -ff_eq_init_x86(eq);
>  -
>   if (eq->eval_mode == EVAL_MODE_INIT) {
>   set_gamma(eq);
>   set_contrast(eq);
>  diff --git a/libavfilter/vf_eq.h b/libavfilter/vf_eq.h index
>  fa49d46e5c..cd0cd75f08 100644
>  --- a/libavfilter/vf_eq.h
>  +++ b/libavfilter/vf_eq.h
>  @@ -100,6 +100,7 @@ typedef struct EQContext {
>   enum EvalMode { EVAL_MODE_INIT, EVAL_MODE_FRAME,
> >> EVAL_MODE_NB }
>  eval_mode;  } EQContext;
> 
>  +void ff_eq_init(EQContext *eq);
>   void ff_eq_init_x86(EQContext *eq);
> 
>   #endif /* AVFILTER_EQ_H */
>  diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
>  index 0112ff603e..de850c016e 100644
>  --- a/tests/checkasm/Makefile
>  +++ b/tests/checkasm/Makefile
>  @@ -36,6 +36,7 @@ CHECKASMOBJS-$(CONFIG_AVCODEC)  +=
> >> $(AVCODECOBJS-yes)
>   AVFILTEROBJS-$(CONFIG_AFIR_FILTER) += af_afir.o
>   AVFILTEROBJS-$(CONFIG_BLEND_FILTER) += vf_blend.o
>   AVFILTEROBJS-$(CONFIG_COLORSPACE_FILTER) += vf_colorspace.o
>  +AVFILTEROBJS-$(CONFIG_EQ_FILTER) += vf_eq.o
>   AVFILTEROBJS-$(CONFIG_GBLUR_FILTER)  += vf_gblur.o
>   AVFILTEROBJS-$(CONFIG_HFLIP_FILTER)  += vf_hflip.o
>   AVFILTEROBJS-$(CONFIG_THRESHOLD_FILTER)  += vf_threshold.o diff
>  --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index
>  d9a5c7f401..bcbe775510 100644
>  --- a/tests/checkasm/checkasm.c
>  +++ b/tests/checkasm/checkasm.c
>  @@ -165,6 +165,9 @@ static const struct {
>   #if CONFIG_COLORSPACE_FILTER
>   { "vf_colorspace", checkasm_check_colorspace },
>   #endif
>  +#if CONFIG_EQ_FILTER
>  +{ "vf_eq", checkasm_check_vf_eq },
>  +#endif
>   #if CONFIG_GBLUR_FILTER
>   { "vf_gblur", checkasm_check_vf_gblur },
>   #endif
>  diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
>  index fdf9eeb75d..0a7f9f25c4 100644
>  --- a/tests/checkasm/checkasm.h
>  +++ b/tests/checkasm/checkasm.h
>  @@ -72,6 +72,7 @@ void checkasm_check_sw_rgb(void);  void
>  checkasm_check_utvideodsp(void);  void
>  checkasm_check_v210dec(void); void checkasm_check_v210enc(void);
>  +void checkasm_check_vf_eq(void);
>   void checkasm_check_vf_gblur(void);  void
>  checkasm_check_vf_hflip(void);  void
>  checkasm_check_vf_threshold(void);
>  diff --git a/tests/checkasm/vf_eq.c b/tests/checkasm/vf_eq.c new
>  file mode 100644 index 00..684718f2cd
>  --- /dev/null
>  +++ b/tests/checkasm/vf_eq.c
>  @@ -0,0 +1,79 @@
>  +/*
>  + * This file

[FFmpeg-devel] [PATCH, v2] lavu/hwcontext_vaapi: add vaapi_format_map support for AYUV/Y210/Y410

2019-09-26 Thread Linjie Fu
VA_RT_FORMAT describes the desired sampling format for surface.

Add vaapi_format_map support for new pixel formats.

Signed-off-by: Linjie Fu 
---
This patch is part of the HEVC Rext support for
qsv and vaapi, refined and resent separately.

 libavutil/hwcontext_vaapi.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index cf11764..d972b4e 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -116,6 +116,13 @@ static const VAAPIFormatDescriptor vaapi_format_map[] = {
 #endif
 MAP(UYVY, YUV422,  UYVY422, 0),
 MAP(YUY2, YUV422,  YUYV422, 0),
+#ifdef VA_FOURCC_Y210
+MAP(Y210, YUV422_10,  Y210, 0),
+#endif
+MAP(AYUV, YUV444, AYUV, 0),
+#ifdef VA_FOURCC_Y410
+MAP(Y410, YUV444_10,  Y410, 0),
+#endif
 MAP(411P, YUV411,  YUV411P, 0),
 MAP(422V, YUV422,  YUV440P, 0),
 MAP(444P, YUV444,  YUV444P, 0),
-- 
2.7.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH, v2] lavc/qsvdec: Add GPU-accelerated memory copy support

2019-09-26 Thread Linjie Fu
GPU copy enables or disables GPU accelerated copying between video
and system memory. This may lead to a notable performance improvement.
Memory must be sequent and aligned with 128x64.
(first introduced in FFmpeg 3.3.1)

CMD:
ffmpeg -init_hw_device qsv=hw -filter_hw_device hw -c:v h264_qsv
-gpu_copy on -i input.h264 -f null -
or:
ffmpeg -c:v h264_qsv -gpu_copy on -i input.h264 -f null -

Signed-off-by: Linjie Fu 
Signed-off-by: ChaoX A Liu 
---
Rebased and send again.

 libavcodec/qsv.c  | 31 +---
 libavcodec/qsv_internal.h |  7 +++---
 libavcodec/qsvdec.c   | 50 ++-
 libavcodec/qsvdec.h   |  2 ++
 libavcodec/qsvdec_h2645.c | 10 
 libavcodec/qsvdec_other.c |  5 
 libavcodec/qsvenc.c   |  8 ---
 7 files changed, 92 insertions(+), 21 deletions(-)

diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index 994c9ebcb0..9e66fbc9da 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -412,15 +412,19 @@ static int ff_qsv_set_display_handle(AVCodecContext 
*avctx, QSVSession *qs)
 #endif //AVCODEC_QSV_LINUX_SESSION_HANDLE
 
 int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs,
- const char *load_plugins)
+ const char *load_plugins, int gpu_copy)
 {
-mfxIMPL impl   = MFX_IMPL_AUTO_ANY;
-mfxVersion ver = { { QSV_VERSION_MINOR, QSV_VERSION_MAJOR } };
+mfxIMPL  impl = MFX_IMPL_AUTO_ANY;
+mfxVersionver = { { QSV_VERSION_MINOR, QSV_VERSION_MAJOR } };
+mfxInitParam init_par = { MFX_IMPL_AUTO_ANY };
 
 const char *desc;
 int ret;
 
-ret = MFXInit(impl, &ver, &qs->session);
+init_par.GPUCopy= gpu_copy;
+init_par.Implementation = impl;
+init_par.Version= ver;
+ret = MFXInitEx(init_par, &qs->session);
 if (ret < 0)
 return ff_qsv_print_error(avctx, ret,
   "Error initializing an internal MFX 
session");
@@ -712,7 +716,8 @@ static mfxStatus qsv_frame_get_hdl(mfxHDL pthis, mfxMemId 
mid, mfxHDL *hdl)
 }
 
 int ff_qsv_init_session_device(AVCodecContext *avctx, mfxSession *psession,
-   AVBufferRef *device_ref, const char 
*load_plugins)
+   AVBufferRef *device_ref, const char 
*load_plugins,
+   int gpu_copy)
 {
 static const mfxHandleType handle_types[] = {
 MFX_HANDLE_VA_DISPLAY,
@@ -722,11 +727,12 @@ int ff_qsv_init_session_device(AVCodecContext *avctx, 
mfxSession *psession,
 AVHWDeviceContext*device_ctx = (AVHWDeviceContext*)device_ref->data;
 AVQSVDeviceContext *device_hwctx = device_ctx->hwctx;
 mfxSessionparent_session = device_hwctx->session;
+mfxInitParaminit_par = { MFX_IMPL_AUTO_ANY };
+mfxHDLhandle = NULL;
 
 mfxSessionsession;
 mfxVersionver;
 mfxIMPL   impl;
-mfxHDLhandle = NULL;
 mfxHandleType handle_type;
 mfxStatus err;
 
@@ -752,7 +758,10 @@ int ff_qsv_init_session_device(AVCodecContext *avctx, 
mfxSession *psession,
"from the session\n");
 }
 
-err = MFXInit(impl, &ver, &session);
+init_par.GPUCopy= gpu_copy;
+init_par.Implementation = impl;
+init_par.Version= ver;
+err = MFXInitEx(init_par, &session);
 if (err != MFX_ERR_NONE)
 return ff_qsv_print_error(avctx, err,
   "Error initializing a child MFX session");
@@ -783,7 +792,7 @@ int ff_qsv_init_session_device(AVCodecContext *avctx, 
mfxSession *psession,
 
 int ff_qsv_init_session_frames(AVCodecContext *avctx, mfxSession *psession,
QSVFramesContext *qsv_frames_ctx,
-   const char *load_plugins, int opaque)
+   const char *load_plugins, int opaque, int 
gpu_copy)
 {
 mfxFrameAllocator frame_allocator = {
 .pthis  = qsv_frames_ctx,
@@ -802,8 +811,12 @@ int ff_qsv_init_session_frames(AVCodecContext *avctx, 
mfxSession *psession,
 
 int ret;
 
+if (gpu_copy == MFX_GPUCOPY_ON)
+av_log(avctx, AV_LOG_WARNING, "GPU-accelerated memory copy "
+"only works in 
MFX_IOPATTERN_OUT_SYSTEM_MEMORY.\n");
+
 ret = ff_qsv_init_session_device(avctx, &session,
- frames_ctx->device_ref, load_plugins);
+ frames_ctx->device_ref, load_plugins, 
gpu_copy);
 if (ret < 0)
 return ret;
 
diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h
index 8b44a9b6f4..37559270e5 100644
--- a/libavcodec/qsv_internal.h
+++ b/libavcodec/qsv_internal.h
@@ -127,16 +127,17 @@ enum AVPictureType ff_qsv_map_pictype(int mfx_pic_type);
 enum AVFieldOrder ff_qsv_map_picstruct(int mfx_pic_struct);
 
 int ff_qsv_init_internal_session(AVCodecContext 

Re: [FFmpeg-devel] [PATCH V2 1/3] checkasm/vf_eq: add test for vf_eq

2019-09-26 Thread James Almer
On 9/27/2019 12:25 AM, Fu, Ting wrote:
> 
> 
>> -Original Message-
>> From: ffmpeg-devel  On Behalf Of James
>> Almer
>> Sent: Thursday, September 26, 2019 11:20 PM
>> To: ffmpeg-devel@ffmpeg.org
>> Subject: Re: [FFmpeg-devel] [PATCH V2 1/3] checkasm/vf_eq: add test for vf_eq
>>
>> On 9/26/2019 11:43 AM, Andreas Rheinhardt wrote:
>>> Ting Fu:
 Signed-off-by: Ting Fu 
 ---
  libavfilter/vf_eq.c   | 13 ---
  libavfilter/vf_eq.h   |  1 +
  tests/checkasm/Makefile   |  1 +
  tests/checkasm/checkasm.c |  3 ++
  tests/checkasm/checkasm.h |  1 +
  tests/checkasm/vf_eq.c| 79
>> +++
  tests/fate/checkasm.mak   |  1 +
  7 files changed, 94 insertions(+), 5 deletions(-)  create mode
 100644 tests/checkasm/vf_eq.c

 diff --git a/libavfilter/vf_eq.c b/libavfilter/vf_eq.c index
 2c4c7e4d54..0f9d129255 100644
 --- a/libavfilter/vf_eq.c
 +++ b/libavfilter/vf_eq.c
 @@ -174,12 +174,18 @@ static int set_expr(AVExpr **pexpr, const char
>> *expr, const char *option, void *
  return 0;
  }

 +void ff_eq_init(EQContext *eq)
 +{
 +eq->process = process_c;
 +if (ARCH_X86)
 +ff_eq_init_x86(eq);
 +}
 +
  static int initialize(AVFilterContext *ctx)  {
  EQContext *eq = ctx->priv;
  int ret;
 -
 -eq->process = process_c;
 +ff_eq_init(eq);

  if ((ret = set_expr(&eq->contrast_pexpr, eq->contrast_expr, 
 "contrast",
>> ctx)) < 0 ||
  (ret = set_expr(&eq->brightness_pexpr,   eq->brightness_expr,
>> "brightness",   ctx)) < 0 ||
 @@ -191,9 +197,6 @@ static int initialize(AVFilterContext *ctx)
  (ret = set_expr(&eq->gamma_weight_pexpr, eq->gamma_weight_expr,
>> "gamma_weight", ctx)) < 0 )
  return ret;

 -if (ARCH_X86)
 -ff_eq_init_x86(eq);
 -
  if (eq->eval_mode == EVAL_MODE_INIT) {
  set_gamma(eq);
  set_contrast(eq);
 diff --git a/libavfilter/vf_eq.h b/libavfilter/vf_eq.h index
 fa49d46e5c..cd0cd75f08 100644
 --- a/libavfilter/vf_eq.h
 +++ b/libavfilter/vf_eq.h
 @@ -100,6 +100,7 @@ typedef struct EQContext {
  enum EvalMode { EVAL_MODE_INIT, EVAL_MODE_FRAME,
>> EVAL_MODE_NB }
 eval_mode;  } EQContext;

 +void ff_eq_init(EQContext *eq);
  void ff_eq_init_x86(EQContext *eq);

  #endif /* AVFILTER_EQ_H */
 diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile index
 0112ff603e..de850c016e 100644
 --- a/tests/checkasm/Makefile
 +++ b/tests/checkasm/Makefile
 @@ -36,6 +36,7 @@ CHECKASMOBJS-$(CONFIG_AVCODEC)  +=
>> $(AVCODECOBJS-yes)
  AVFILTEROBJS-$(CONFIG_AFIR_FILTER) += af_afir.o
  AVFILTEROBJS-$(CONFIG_BLEND_FILTER) += vf_blend.o
  AVFILTEROBJS-$(CONFIG_COLORSPACE_FILTER) += vf_colorspace.o
 +AVFILTEROBJS-$(CONFIG_EQ_FILTER) += vf_eq.o
  AVFILTEROBJS-$(CONFIG_GBLUR_FILTER)  += vf_gblur.o
  AVFILTEROBJS-$(CONFIG_HFLIP_FILTER)  += vf_hflip.o
  AVFILTEROBJS-$(CONFIG_THRESHOLD_FILTER)  += vf_threshold.o diff
 --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index
 d9a5c7f401..bcbe775510 100644
 --- a/tests/checkasm/checkasm.c
 +++ b/tests/checkasm/checkasm.c
 @@ -165,6 +165,9 @@ static const struct {
  #if CONFIG_COLORSPACE_FILTER
  { "vf_colorspace", checkasm_check_colorspace },
  #endif
 +#if CONFIG_EQ_FILTER
 +{ "vf_eq", checkasm_check_vf_eq },
 +#endif
  #if CONFIG_GBLUR_FILTER
  { "vf_gblur", checkasm_check_vf_gblur },
  #endif
 diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
 index fdf9eeb75d..0a7f9f25c4 100644
 --- a/tests/checkasm/checkasm.h
 +++ b/tests/checkasm/checkasm.h
 @@ -72,6 +72,7 @@ void checkasm_check_sw_rgb(void);  void
 checkasm_check_utvideodsp(void);  void checkasm_check_v210dec(void);
 void checkasm_check_v210enc(void);
 +void checkasm_check_vf_eq(void);
  void checkasm_check_vf_gblur(void);
  void checkasm_check_vf_hflip(void);
  void checkasm_check_vf_threshold(void);
 diff --git a/tests/checkasm/vf_eq.c b/tests/checkasm/vf_eq.c new file
 mode 100644 index 00..684718f2cd
 --- /dev/null
 +++ b/tests/checkasm/vf_eq.c
 @@ -0,0 +1,79 @@
 +/*
 + * This file is part of FFmpeg.
 + *
 + * FFmpeg is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published
 +by
 + * the Free Software Foundation; either version 2 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

Re: [FFmpeg-devel] [PATCH V2 1/3] checkasm/vf_eq: add test for vf_eq

2019-09-26 Thread Fu, Ting


> -Original Message-
> From: ffmpeg-devel  On Behalf Of James
> Almer
> Sent: Thursday, September 26, 2019 11:20 PM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH V2 1/3] checkasm/vf_eq: add test for vf_eq
> 
> On 9/26/2019 11:43 AM, Andreas Rheinhardt wrote:
> > Ting Fu:
> >> Signed-off-by: Ting Fu 
> >> ---
> >>  libavfilter/vf_eq.c   | 13 ---
> >>  libavfilter/vf_eq.h   |  1 +
> >>  tests/checkasm/Makefile   |  1 +
> >>  tests/checkasm/checkasm.c |  3 ++
> >>  tests/checkasm/checkasm.h |  1 +
> >>  tests/checkasm/vf_eq.c| 79
> +++
> >>  tests/fate/checkasm.mak   |  1 +
> >>  7 files changed, 94 insertions(+), 5 deletions(-)  create mode
> >> 100644 tests/checkasm/vf_eq.c
> >>
> >> diff --git a/libavfilter/vf_eq.c b/libavfilter/vf_eq.c index
> >> 2c4c7e4d54..0f9d129255 100644
> >> --- a/libavfilter/vf_eq.c
> >> +++ b/libavfilter/vf_eq.c
> >> @@ -174,12 +174,18 @@ static int set_expr(AVExpr **pexpr, const char
> *expr, const char *option, void *
> >>  return 0;
> >>  }
> >>
> >> +void ff_eq_init(EQContext *eq)
> >> +{
> >> +eq->process = process_c;
> >> +if (ARCH_X86)
> >> +ff_eq_init_x86(eq);
> >> +}
> >> +
> >>  static int initialize(AVFilterContext *ctx)  {
> >>  EQContext *eq = ctx->priv;
> >>  int ret;
> >> -
> >> -eq->process = process_c;
> >> +ff_eq_init(eq);
> >>
> >>  if ((ret = set_expr(&eq->contrast_pexpr, eq->contrast_expr, 
> >> "contrast",
> ctx)) < 0 ||
> >>  (ret = set_expr(&eq->brightness_pexpr,   eq->brightness_expr,
> "brightness",   ctx)) < 0 ||
> >> @@ -191,9 +197,6 @@ static int initialize(AVFilterContext *ctx)
> >>  (ret = set_expr(&eq->gamma_weight_pexpr, eq->gamma_weight_expr,
> "gamma_weight", ctx)) < 0 )
> >>  return ret;
> >>
> >> -if (ARCH_X86)
> >> -ff_eq_init_x86(eq);
> >> -
> >>  if (eq->eval_mode == EVAL_MODE_INIT) {
> >>  set_gamma(eq);
> >>  set_contrast(eq);
> >> diff --git a/libavfilter/vf_eq.h b/libavfilter/vf_eq.h index
> >> fa49d46e5c..cd0cd75f08 100644
> >> --- a/libavfilter/vf_eq.h
> >> +++ b/libavfilter/vf_eq.h
> >> @@ -100,6 +100,7 @@ typedef struct EQContext {
> >>  enum EvalMode { EVAL_MODE_INIT, EVAL_MODE_FRAME,
> EVAL_MODE_NB }
> >> eval_mode;  } EQContext;
> >>
> >> +void ff_eq_init(EQContext *eq);
> >>  void ff_eq_init_x86(EQContext *eq);
> >>
> >>  #endif /* AVFILTER_EQ_H */
> >> diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile index
> >> 0112ff603e..de850c016e 100644
> >> --- a/tests/checkasm/Makefile
> >> +++ b/tests/checkasm/Makefile
> >> @@ -36,6 +36,7 @@ CHECKASMOBJS-$(CONFIG_AVCODEC)  +=
> $(AVCODECOBJS-yes)
> >>  AVFILTEROBJS-$(CONFIG_AFIR_FILTER) += af_afir.o
> >>  AVFILTEROBJS-$(CONFIG_BLEND_FILTER) += vf_blend.o
> >>  AVFILTEROBJS-$(CONFIG_COLORSPACE_FILTER) += vf_colorspace.o
> >> +AVFILTEROBJS-$(CONFIG_EQ_FILTER) += vf_eq.o
> >>  AVFILTEROBJS-$(CONFIG_GBLUR_FILTER)  += vf_gblur.o
> >>  AVFILTEROBJS-$(CONFIG_HFLIP_FILTER)  += vf_hflip.o
> >>  AVFILTEROBJS-$(CONFIG_THRESHOLD_FILTER)  += vf_threshold.o diff
> >> --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index
> >> d9a5c7f401..bcbe775510 100644
> >> --- a/tests/checkasm/checkasm.c
> >> +++ b/tests/checkasm/checkasm.c
> >> @@ -165,6 +165,9 @@ static const struct {
> >>  #if CONFIG_COLORSPACE_FILTER
> >>  { "vf_colorspace", checkasm_check_colorspace },
> >>  #endif
> >> +#if CONFIG_EQ_FILTER
> >> +{ "vf_eq", checkasm_check_vf_eq },
> >> +#endif
> >>  #if CONFIG_GBLUR_FILTER
> >>  { "vf_gblur", checkasm_check_vf_gblur },
> >>  #endif
> >> diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
> >> index fdf9eeb75d..0a7f9f25c4 100644
> >> --- a/tests/checkasm/checkasm.h
> >> +++ b/tests/checkasm/checkasm.h
> >> @@ -72,6 +72,7 @@ void checkasm_check_sw_rgb(void);  void
> >> checkasm_check_utvideodsp(void);  void checkasm_check_v210dec(void);
> >> void checkasm_check_v210enc(void);
> >> +void checkasm_check_vf_eq(void);
> >>  void checkasm_check_vf_gblur(void);
> >>  void checkasm_check_vf_hflip(void);
> >>  void checkasm_check_vf_threshold(void);
> >> diff --git a/tests/checkasm/vf_eq.c b/tests/checkasm/vf_eq.c new file
> >> mode 100644 index 00..684718f2cd
> >> --- /dev/null
> >> +++ b/tests/checkasm/vf_eq.c
> >> @@ -0,0 +1,79 @@
> >> +/*
> >> + * This file is part of FFmpeg.
> >> + *
> >> + * FFmpeg is free software; you can redistribute it and/or modify
> >> + * it under the terms of the GNU General Public License as published
> >> +by
> >> + * the Free Software Foundation; either version 2 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 General 

Re: [FFmpeg-devel] [PATCH v3] avformat/movenc: split empty text sample when duration overflow

2019-09-26 Thread Jun Li
On Fri, Sep 20, 2019 at 9:46 PM Jun Li  wrote:

>
> On Sat, Sep 14, 2019 at 2:06 PM Jun Li  wrote:
>
>>
>>
>> On Tue, Sep 10, 2019 at 12:16 PM Jun Li  wrote:
>>
>>>
>>>
>>> On Tue, Sep 10, 2019 at 12:12 PM Jun Li  wrote:
>>>
 Fix #7637
 One empty/end sample is created and inserted between two caption lines
 when there is a gap.
 This patch is to split the sample into multiple ones when its duration
 is too long (>= INT_MAX).
 ---
  libavformat/movenc.c  | 24 ++-
  tests/fate/subtitles.mak  |  6 +
  tests/ref/fate/binsub-movtextenc-long-dur |  1 +
  .../fate/binsub-movtextenc-long-dur-timebase  |  1 +
  4 files changed, 26 insertions(+), 6 deletions(-)
  create mode 100644 tests/ref/fate/binsub-movtextenc-long-dur
  create mode 100644 tests/ref/fate/binsub-movtextenc-long-dur-timebase

 diff --git a/libavformat/movenc.c b/libavformat/movenc.c
 index edddfeeb00..aeb7de351f 100644
 --- a/libavformat/movenc.c
 +++ b/libavformat/movenc.c
 @@ -5746,7 +5746,8 @@ static int mov_write_packet(AVFormatContext *s,
 AVPacket *pkt)
   *
   * 2) For each subtitle track, check if the current packet's
   * dts is past the duration of the last subtitle sample. If
 - * so, we now need to write an end sample for that subtitle.
 + * so, we now need to write one or multiple end samples for
 + * that subtitle.
   *
   * This must be done conditionally to allow for subtitles that
   * immediately replace each other, in which case an end sample
 @@ -5760,11 +5761,22 @@ static int mov_write_packet(AVFormatContext *s,
 AVPacket *pkt)
  int ret;

  if (trk->par->codec_id == AV_CODEC_ID_MOV_TEXT &&
 -trk->track_duration < pkt->dts &&
 -(trk->entry == 0 ||
 !trk->last_sample_is_subtitle_end)) {
 -ret = mov_write_subtitle_end_packet(s, i,
 trk->track_duration);
 -if (ret < 0) return ret;
 -trk->last_sample_is_subtitle_end = 1;
 +trk->track_duration < pkt->dts) {
 +int max_duration = INT_MAX - 1;
 +if (trk->entry == 0 ||
 !trk->last_sample_is_subtitle_end) {
 +ret = mov_write_subtitle_end_packet(s, i,
 trk->track_duration);
 +if (ret < 0) return ret;
 +trk->last_sample_is_subtitle_end = 1;
 +}
 +if (trk->last_sample_is_subtitle_end &&
 +pkt->dts - trk->track_duration > max_duration) {
 +int64_t dts = trk->track_duration;
 +while(pkt->dts - dts > max_duration) {
 +dts += max_duration;
 +ret = mov_write_subtitle_end_packet(s, i, dts);
 +if (ret < 0) return ret;
 +}
 +}
  }
  }

 diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak
 index 0042902161..4c2b34c431 100644
 --- a/tests/fate/subtitles.mak
 +++ b/tests/fate/subtitles.mak
 @@ -34,6 +34,12 @@ fate-sub-movtext: CMD = fmtstdout ass -i
 $(TARGET_SAMPLES)/sub/MovText_capabilit
  FATE_SUBTITLES-$(call ENCDEC, MOVTEXT, MOV) += fate-binsub-movtextenc
  fate-binsub-movtextenc: CMD = md5 -i
 $(TARGET_SAMPLES)/sub/MovText_capability_tester.mp4 -map 0 -scodec mov_text
 -f mp4 -flags +bitexact -fflags +bitexact -movflags 
 frag_keyframe+empty_moov

 +FATE_SUBTITLES-$(call ENCDEC, MOVTEXT, MOV) +=
 fate-binsub-movtextenc-long-dur
 +fate-binsub-movtextenc-long-dur: CMD = md5 -i
 $(TARGET_SAMPLES)/sub/WebVTT_movtext_long_dur.vtt -map 0 -scodec mov_text
 -f mp4 -flags +bitexact -fflags +bitexact -movflags 
 frag_keyframe+empty_moov
 +
 +FATE_SUBTITLES-$(call ENCDEC, MOVTEXT, MOV) +=
 fate-binsub-movtextenc-long-dur-timebase
 +fate-binsub-movtextenc-long-dur-timebase: CMD = md5 -i
 $(TARGET_SAMPLES)/sub/WebVTT_movtext_long_dur.vtt -map 0 -scodec mov_text
 -time_base 1000 -f mp4 -flags +bitexact -fflags +bitexact -movflags
 frag_keyframe+empty_moov
 +
  FATE_SUBTITLES_ASS-$(call DEMDEC, MPL2, MPL2) += fate-sub-mpl2
  fate-sub-mpl2: CMD = fmtstdout ass -i
 $(TARGET_SAMPLES)/sub/MPL2_capability_tester.txt

 diff --git a/tests/ref/fate/binsub-movtextenc-long-dur
 b/tests/ref/fate/binsub-movtextenc-long-dur
 new file mode 100644
 index 00..eb8a3f8fc7
 --- /dev/null
 +++ b/tests/ref/fate/binsub-movtextenc-long-dur
 @@ -0,0 +1 @@
 +7f78c11bb4a6b16335540ef31ba10219
 diff --git a/tests/ref/fate/binsub-movtextenc-long-dur-timebase
>

Re: [FFmpeg-devel] [PATCH] DVB EPG decoder

2019-09-26 Thread Aman Gupta
On Sat, Sep 7, 2019 at 11:39 AM Marton Balint  wrote:

>
>
> On Wed, 4 Sep 2019, Anthony Delannoy wrote:
>
> > Hi
> >
> > I'm still interested to have those three commits merged (update in
> attachments).
>
> Ok, below are some more comments.
>
> >
> > But I'd like to see data decoder in the future to use more easily
> > EPG/NIT/BAT etc tables.
> > Will it be possible? With modifications if it needs to be?
>
> I don't see how, as it does not fit into the concept of the libav*
> libraries. I feel this belongs to a separate library.
>
> > From 335b0bf377c1e5cfc5207561adc9621b113759b0 Mon Sep 17 00:00:00 2001
> > From: Anthony Delannoy 
> > Date: Wed, 21 Aug 2019 11:46:56 +0200
> > Subject: [PATCH 3/3] lavf/mpegts: EPG extraction from mpegts
> >
> > ---
> >  libavformat/mpegts.c | 71 ++--
> >  1 file changed, 69 insertions(+), 2 deletions(-)
> >
> > diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
> > index 0415ceea02..9bb6b6add8 100644
> > --- a/libavformat/mpegts.c
> > +++ b/libavformat/mpegts.c
> > @@ -168,6 +168,8 @@ struct MpegTSContext {
> >  /** filters for various streams specified by PMT + for the PAT and
> PMT */
> >  MpegTSFilter *pids[NB_PID_MAX];
> >  int current_pid;
> > +
> > +AVStream *epg_stream;
> >  };
> >
> >  #define MPEGTS_OPTIONS \
> > @@ -2498,13 +2500,68 @@ static void pat_cb(MpegTSFilter *filter, const
> uint8_t *section, int section_len
> >  }
> >  }
> >
> > +static void eit_cb(MpegTSFilter *filter, const uint8_t *section, int
> section_len)
> > +{
> > +MpegTSContext *ts = filter->u.section_filter.opaque;
> > +const uint8_t *p, *p_end;
> > +SectionHeader h1, *h = &h1;
> > +
> > +/*
> > + * Sometimes we receive EPG packets but SDT table do not have
> > + * eit_pres_following or eit_sched turned on, so we open EPG
> > + * stream directly here.
> > + */
> > +if (!ts->epg_stream) {
> > +ts->epg_stream = avformat_new_stream(ts->stream, NULL);
> > +if (!ts->epg_stream)
> > +return;
> > +ts->epg_stream->id = EIT_PID;
> > +ts->epg_stream->codecpar->codec_type = AVMEDIA_TYPE_DATA;
> > +ts->epg_stream->codecpar->codec_id = AV_CODEC_ID_EPG;
> > +}
> > +
> > +if (ts->epg_stream->discard == AVDISCARD_ALL)
> > +return;
> > +
> > +p_end = section + section_len - 4;
> > +p = section;
> > +
> > +if (parse_section_header(h, &p, p_end) < 0)
> > +return;
> > +if (h->tid < EIT_TID || h->tid > OEITS_END_TID)
> > +return;
> > +
> > +av_log(ts->stream, AV_LOG_TRACE, "EIT: tid received = %.02x\n",
> h->tid);
> > +
> > +/**
> > + * Service_id 0x is reserved, it indicates that the current EIT
> table
> > + * is scrambled.
> > + */
> > +if (h->id == 0x) {
> > +av_log(ts->stream, AV_LOG_WARNING, "Scrambled EIT table
> received.\n");
> > +return;
> > +}
>
> In case of a scrambled EIT (which I have never seen myself in the wild)
> you'd
> print this at every packet. You should either remove the warning, or check
> if
> this is the first time (e.g. by checking if the EPG stream was just
> created).
>

I have a sample if anyone is interested. AFAIK it is only used by HD BBC
broadcasts in the UK.

https://tmm1.s3.amazonaws.com/dvb-eit/uk-eit-hd.ts

https://stackoverflow.com/questions/37765956/linux-dvb-v5-library-example-code-for-eit-grabbing#comment66609009_37765956


>
> > +
> > +/**
> > + * In case we receive an EPG packet before mpegts context is fully
> > + * initialized.
> > + */
> > +if (!ts->pkt)
> > +return;
> > +
> > +new_data_packet(section, section_len, ts->pkt);
> > +ts->pkt->stream_index = ts->epg_stream->index;
> > +ts->stop_parse = 1;
> > +}
> > +
> >  static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int
> section_len)
> >  {
> >  MpegTSContext *ts = filter->u.section_filter.opaque;
> >  MpegTSSectionFilter *tssf = &filter->u.section_filter;
> >  SectionHeader h1, *h = &h1;
> >  const uint8_t *p, *p_end, *desc_list_end, *desc_end;
> > -int onid, val, sid, desc_list_len, desc_tag, desc_len, service_type;
> > +int onid, val, sid, desc_list_len, desc_tag, desc_len, service_type,
> > +eit_sched, eit_pres_following;
> >  char *name, *provider_name;
> >
> >  av_log(ts->stream, AV_LOG_TRACE, "SDT:\n");
> > @@ -2534,6 +2591,13 @@ static void sdt_cb(MpegTSFilter *filter, const
> uint8_t *section, int section_len
> >  val = get8(&p, p_end);
> >  if (val < 0)
> >  break;
> > +eit_sched = (val >> 1) & 0x1;
> > +eit_pres_following = val & 0x1;
> > +
> > +if ((eit_sched | eit_pres_following) && !ts->epg_stream)
> > +av_log(ts->stream, AV_LOG_WARNING, "SDT table advertise EIT
> but no"
> > +   " packets were received yet.\n");
> > +
>
> You should remove this, there are tons of captures 

Re: [FFmpeg-devel] [PATCH] Adding a flag to give user the option to have ffmpeg fail instead of warn when mismatches are found in rtmp url stream or application names.

2019-09-26 Thread William Martin
I don't think so. The existing 'strict' option is more general and touches
lots of things in encoding/decoding. The new option is very narrow in
scope. The existing 'strict' and the new 'rtmp_strict_paths` don't have
anything to do with each other - in fact it would be quite possible that a
user might want one off and the other on.

On Wed, Sep 25, 2019 at 3:14 PM Carl Eugen Hoyos  wrote:

> Am Mi., 25. Sept. 2019 um 21:04 Uhr schrieb William Martin
> :
> >
> > From: Will Martin 
> >
> > Motivation: When running multiple rtmp ingest on the same machine on the
> same port, users may want to explicitly forbid mismatched rtmp streams from
> successfully completing handshakes. This patch allows for such enforcement
>
> There already is a "strict" option, can't it be used here instead
> of adding a new option?
>
> Carl Eugen
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 09/12] avcodec/pafvideo: Only clear frame when it was written to

2019-09-26 Thread Michael Niedermayer
On Thu, Sep 26, 2019 at 10:04:44AM +0200, Paul B Mahol wrote:
> Why this does not set dirty for all decoding cases?

dirty is set for c->current_frame, so cases which write only
into that do not need an explicit case.

But maybe i forgot something ?

Thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 4/5] avcodec/smacker: cleanup on errors in smka_decode_frame()

2019-09-26 Thread Michael Niedermayer
Fixes: multiple memleaks
Fixes: 
17660/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMACKAUD_fuzzer-5689769928949760

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/smacker.c | 30 --
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
index a2950c455b..901cdb1fb1 100644
--- a/libavcodec/smacker.c
+++ b/libavcodec/smacker.c
@@ -721,8 +721,10 @@ static int smka_decode_frame(AVCodecContext *avctx, void 
*data,
 for(i = 0; i <= stereo; i++)
 *samples++ = pred[i];
 for(; i < unp_size / 2; i++) {
-if(get_bits_left(&gb)<0)
-return AVERROR_INVALIDDATA;
+if(get_bits_left(&gb)<0) {
+ret = AVERROR_INVALIDDATA;
+goto error;
+}
 if(i & stereo) {
 if(vlc[2].table)
 res = get_vlc2(&gb, vlc[2].table, SMKTREE_BITS, 3);
@@ -730,7 +732,8 @@ static int smka_decode_frame(AVCodecContext *avctx, void 
*data,
 res = 0;
 if (res < 0) {
 av_log(avctx, AV_LOG_ERROR, "invalid vlc\n");
-return AVERROR_INVALIDDATA;
+ret = AVERROR_INVALIDDATA;
+goto error;
 }
 val  = h[2].values[res];
 if(vlc[3].table)
@@ -739,7 +742,8 @@ static int smka_decode_frame(AVCodecContext *avctx, void 
*data,
 res = 0;
 if (res < 0) {
 av_log(avctx, AV_LOG_ERROR, "invalid vlc\n");
-return AVERROR_INVALIDDATA;
+ret = AVERROR_INVALIDDATA;
+goto error;
 }
 val |= h[3].values[res] << 8;
 pred[1] += sign_extend(val, 16);
@@ -751,7 +755,8 @@ static int smka_decode_frame(AVCodecContext *avctx, void 
*data,
 res = 0;
 if (res < 0) {
 av_log(avctx, AV_LOG_ERROR, "invalid vlc\n");
-return AVERROR_INVALIDDATA;
+ret = AVERROR_INVALIDDATA;
+goto error;
 }
 val  = h[0].values[res];
 if(vlc[1].table)
@@ -760,7 +765,8 @@ static int smka_decode_frame(AVCodecContext *avctx, void 
*data,
 res = 0;
 if (res < 0) {
 av_log(avctx, AV_LOG_ERROR, "invalid vlc\n");
-return AVERROR_INVALIDDATA;
+ret = AVERROR_INVALIDDATA;
+goto error;
 }
 val |= h[1].values[res] << 8;
 pred[0] += sign_extend(val, 16);
@@ -773,8 +779,10 @@ static int smka_decode_frame(AVCodecContext *avctx, void 
*data,
 for(i = 0; i <= stereo; i++)
 *samples8++ = pred[i];
 for(; i < unp_size; i++) {
-if(get_bits_left(&gb)<0)
-return AVERROR_INVALIDDATA;
+if(get_bits_left(&gb)<0) {
+ret = AVERROR_INVALIDDATA;
+goto error;
+}
 if(i & stereo){
 if(vlc[1].table)
 res = get_vlc2(&gb, vlc[1].table, SMKTREE_BITS, 3);
@@ -782,7 +790,8 @@ static int smka_decode_frame(AVCodecContext *avctx, void 
*data,
 res = 0;
 if (res < 0) {
 av_log(avctx, AV_LOG_ERROR, "invalid vlc\n");
-return AVERROR_INVALIDDATA;
+ret = AVERROR_INVALIDDATA;
+goto error;
 }
 pred[1] += sign_extend(h[1].values[res], 8);
 *samples8++ = pred[1];
@@ -793,7 +802,8 @@ static int smka_decode_frame(AVCodecContext *avctx, void 
*data,
 res = 0;
 if (res < 0) {
 av_log(avctx, AV_LOG_ERROR, "invalid vlc\n");
-return AVERROR_INVALIDDATA;
+ret = AVERROR_INVALIDDATA;
+goto error;
 }
 pred[0] += sign_extend(h[0].values[res], 8);
 *samples8++ = pred[0];
-- 
2.23.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 5/5] avcodec/flicvideo: Use bytestream2_get_buffer() in flic_decode_frame_15_16BPP() for FLI_COPY

2019-09-26 Thread Michael Niedermayer
Fixes: Timeout(103sec -> 3sec)
Fixes: 
17678/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLIC_fuzzer-5715436989054976

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/flicvideo.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/flicvideo.c b/libavcodec/flicvideo.c
index 276c2ff2a6..e559f3d449 100644
--- a/libavcodec/flicvideo.c
+++ b/libavcodec/flicvideo.c
@@ -738,6 +738,7 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx,
 for (y_ptr = 0; y_ptr < s->frame->linesize[0] * 
s->avctx->height;
  y_ptr += s->frame->linesize[0]) {
 
+#if HAVE_BIGENDIAN
 pixel_countdown = s->avctx->width;
 pixel_ptr = 0;
 while (pixel_countdown > 0) {
@@ -745,6 +746,9 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx,
   pixel_ptr += 2;
   pixel_countdown--;
 }
+#else
+bytestream2_get_buffer(&g2, pixels + y_ptr, 
2*s->avctx->width);
+#endif
 if (s->avctx->width & 1)
 bytestream2_skip(&g2, 2);
 }
-- 
2.23.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 3/5] tools/target_dec_fuzzer: Adjust threshold for EATGV

2019-09-26 Thread Michael Niedermayer
Fixes: Timeout (26sec -> 9sec)
Fixes: 
17645/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EATGV_fuzzer-5717065922510848

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 tools/target_dec_fuzzer.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index bb981eefd9..1f9176ee74 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -138,6 +138,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 // Allows a small input to generate gigantic output
 case AV_CODEC_ID_BINKVIDEO: maxpixels /= 32; break;
 case AV_CODEC_ID_DIRAC: maxpixels /= 8192; break;
+case AV_CODEC_ID_TGV:   maxpixels /= 32;  break;
 case AV_CODEC_ID_MSRLE: maxpixels /= 16;  break;
 case AV_CODEC_ID_QTRLE: maxpixels /= 16;  break;
 case AV_CODEC_ID_SANM:  maxpixels /= 16;  break;
-- 
2.23.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 1/5] avcodec/scpr: Check minimum size of type 17

2019-09-26 Thread Michael Niedermayer
Improves: Timeout (85sec -> 46sec)
Improves: 
17644/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-5715704283660288

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/scpr.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/scpr.c b/libavcodec/scpr.c
index ab4d5b57df..2a0ebcecfc 100644
--- a/libavcodec/scpr.c
+++ b/libavcodec/scpr.c
@@ -534,6 +534,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, 
int *got_frame,
 uint32_t clr, *dst = (uint32_t *)s->current_frame->data[0];
 int y;
 
+if (bytestream2_get_bytes_left(gb) < 3)
+return AVERROR_INVALIDDATA;
+
 frame->key_frame = 1;
 bytestream2_skip(gb, 1);
 if (avctx->bits_per_coded_sample == 16) {
-- 
2.23.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 2/5] tools/target_dec_fuzzer: Adjust threshold for SCPR

2019-09-26 Thread Michael Niedermayer
Fixes: Timeout (46sec -> 7sec)
Fixes: 
17644/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-5715704283660288

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 tools/target_dec_fuzzer.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index 4af7b26e54..bb981eefd9 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -151,6 +151,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 case AV_CODEC_ID_LSCR:maxpixels /= 16; break;
 case AV_CODEC_ID_MOTIONPIXELS:maxpixels /= 256; break;
 case AV_CODEC_ID_MSS2:maxpixels /= 16384; break;
+case AV_CODEC_ID_SCPR:maxpixels /= 32;break;
 case AV_CODEC_ID_SNOW:maxpixels /= 128; break;
 case AV_CODEC_ID_TRUEMOTION2: maxpixels /= 1024; break;
 }
-- 
2.23.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 12/15] avcodec/exr: Fix undefined left shifts of negative numbers

2019-09-26 Thread Michael Niedermayer
On Wed, Sep 25, 2019 at 12:03:07AM +0200, Andreas Rheinhardt wrote:
> Affected the FATE-tests exr-rgb-scanline-pxr24-half-uint32-13x9 and
> exr-rgb-scanline-pxr24-uint32.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/exr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

thx

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

Modern terrorism, a quick summary: Need oil, start war with country that
has oil, kill hundread thousand in war. Let country fall into chaos,
be surprised about raise of fundamantalists. Drop more bombs, kill more
people, be surprised about them taking revenge and drop even more bombs
and strip your own citizens of their rights and freedoms. to be continued


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 04/12] avcodec/hcom: Check that there are dictionary entries

2019-09-26 Thread Michael Niedermayer
On Thu, Sep 26, 2019 at 09:55:12AM +0200, Paul B Mahol wrote:
> lgtm

will apply

thx

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

It is what and why we do it that matters, not just one of them.


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 12/12] avcodec/4xm: Check index in decode_i_block() also in the path where its not used.

2019-09-26 Thread Michael Niedermayer
On Thu, Sep 26, 2019 at 10:07:29AM +0200, Paul B Mahol wrote:
> lgtm

will apply

thx

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

If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 11/12] avcodec/loco: Check for end of input in the first line

2019-09-26 Thread Michael Niedermayer
On Thu, Sep 26, 2019 at 10:05:38AM +0200, Paul B Mahol wrote:
> lgtm

will apply

thx

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

If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 08/12] avcodec/atrac3: Check block_align

2019-09-26 Thread Michael Niedermayer
On Thu, Sep 26, 2019 at 09:56:51AM +0200, Paul B Mahol wrote:
> lgtm

will apply

thx

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

Dictatorship: All citizens are under surveillance, all their steps and
actions recorded, for the politicians to enforce control.
Democracy: All politicians are under surveillance, all their steps and
actions recorded, for the citizens to enforce control.


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 07/12] tools/target_dec_fuzzer: Print samples decoded like pixels

2019-09-26 Thread Michael Niedermayer
On Thu, Sep 26, 2019 at 09:53:19AM +0200, Paul B Mahol wrote:
> lgtm

will apply

thx

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

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


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 06/12] tools/target_dec_fuzzer: Check number of all samples decoded too, like max pixels

2019-09-26 Thread Michael Niedermayer
On Thu, Sep 26, 2019 at 09:56:26AM +0200, Paul B Mahol wrote:
> lgtm

will apply

thx

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

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 05/12] avcodec/alsdec: Avoid dereferencing context pointer in inner interleave loop

2019-09-26 Thread Michael Niedermayer
On Thu, Sep 26, 2019 at 09:55:59AM +0200, Paul B Mahol wrote:
> lgtm

will apply

thx

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

You can kill me, but you cannot change the truth.


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 03/12] avcodec/fitsdec: Prevent division by 0 with huge data_max

2019-09-26 Thread Michael Niedermayer
On Thu, Sep 26, 2019 at 09:52:48AM +0200, Paul B Mahol wrote:
> lgtm

will apply

thx

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

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 02/12] avcodec/dstdec: Fix integer overflow in samples_per_frame computation

2019-09-26 Thread Michael Niedermayer
On Thu, Sep 26, 2019 at 09:45:52AM +0200, Paul B Mahol wrote:
> lgtm

will apply

thx

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

Dictatorship: All citizens are under surveillance, all their steps and
actions recorded, for the politicians to enforce control.
Democracy: All politicians are under surveillance, all their steps and
actions recorded, for the citizens to enforce control.


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 4/4] avcodec/g729_parser: Check block_size

2019-09-26 Thread Michael Niedermayer
On Wed, Sep 25, 2019 at 12:39:10PM +0200, Paul B Mahol wrote:
> lgtm

will apply

thx

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

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 3/4] avcodec/sbcdec: Initilaize nubmer of channels

2019-09-26 Thread Michael Niedermayer
On Thu, Sep 26, 2019 at 03:08:59PM +0200, Moritz Barsnick wrote:
> > please fix typo in commit message, nubmer

will do

> 
> and "Initilaize" -> "Initialize".

will do too

thanks

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

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] doc/ffmpeg: -timelimit is in user time

2019-09-26 Thread Lou Logan
Signed-off-by: Lou Logan 
---
Some users were expecting real/wall-clock time.

 doc/ffmpeg.texi  | 2 +-
 fftools/ffmpeg_opt.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 1da18d9d0b..92337d 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -1383,7 +1383,7 @@ it will usually display as 0 if not supported.
 Show benchmarking information during the encode.
 Shows real, system and user time used in various steps (audio/video 
encode/decode).
 @item -timelimit @var{duration} (@emph{global})
-Exit after ffmpeg has been running for @var{duration} seconds.
+Exit after ffmpeg has been running for @var{duration} seconds in CPU user time.
 @item -dump (@emph{global})
 Dump each input packet to stderr.
 @item -hex (@emph{global})
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index b2aa63e7ee..661441c161 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -3443,7 +3443,7 @@ const OptionDef options[] = {
 { "stdin",  OPT_BOOL | OPT_EXPERT,   { 
&stdin_interaction },
   "enable or disable interaction on standard input" },
 { "timelimit",  HAS_ARG | OPT_EXPERT,{ 
.func_arg = opt_timelimit },
-"set max runtime in seconds", "limit" },
+"set max runtime in seconds in CPU user time", "limit" },
 { "dump",   OPT_BOOL | OPT_EXPERT,   { 
&do_pkt_dump },
 "dump each input packet" },
 { "hex",OPT_BOOL | OPT_EXPERT,   { 
&do_hex_dump },
-- 
2.23.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] aformat/movenc: add missing padding to output track extradata

2019-09-26 Thread James Almer
On 9/26/2019 3:04 PM, Thierry Foucu wrote:
> On Wed, Sep 25, 2019 at 10:30 AM James Almer  wrote:
> 
>> Fixes ticket #8183.
>>
>> Signed-off-by: James Almer 
>> ---
>>  libavformat/movenc.c | 15 ++-
>>  1 file changed, 10 insertions(+), 5 deletions(-)
>>
>> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
>> index c824ff5ba1..e3283871d0 100644
>> --- a/libavformat/movenc.c
>> +++ b/libavformat/movenc.c
>> @@ -5377,12 +5377,13 @@ int ff_mov_write_packet(AVFormatContext *s,
>> AVPacket *pkt)
>>  !TAG_IS_AVCI(trk->tag) &&
>>  (par->codec_id != AV_CODEC_ID_DNXHD)) {
>>  trk->vos_len  = par->extradata_size;
>> -trk->vos_data = av_malloc(trk->vos_len);
>> +trk->vos_data = av_malloc(trk->vos_len +
>> AV_INPUT_BUFFER_PADDING_SIZE);
>>  if (!trk->vos_data) {
>>  ret = AVERROR(ENOMEM);
>>  goto err;
>>  }
>>  memcpy(trk->vos_data, par->extradata, trk->vos_len);
>> +memset(trk->vos_data + trk->vos_len, 0,
>> AV_INPUT_BUFFER_PADDING_SIZE);
>>  }
>>
>>  if (par->codec_id == AV_CODEC_ID_AAC && pkt->size > 2 &&
>> @@ -5460,12 +5461,13 @@ int ff_mov_write_packet(AVFormatContext *s,
>> AVPacket *pkt)
>>   par->codec_id == AV_CODEC_ID_AC3) && !trk->vos_len) {
>>  /* copy frame to create needed atoms */
>>  trk->vos_len  = size;
>> -trk->vos_data = av_malloc(size);
>> +trk->vos_data = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE);
>>  if (!trk->vos_data) {
>>  ret = AVERROR(ENOMEM);
>>  goto err;
>>  }
>>  memcpy(trk->vos_data, pkt->data, size);
>> +memset(trk->vos_data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
>>  }
>>
>>  if (trk->entry >= trk->cluster_capacity) {
>> @@ -6090,12 +6092,13 @@ static int
>> mov_create_dvd_sub_decoder_specific_info(MOVTrack *track,
>>  cur += strspn(cur, "\n\r");
>>  }
>>  if (have_palette) {
>> -track->vos_data = av_malloc(16*4);
>> +track->vos_data = av_malloc(16*4 + AV_INPUT_BUFFER_PADDING_SIZE);
>>  if (!track->vos_data)
>>  return AVERROR(ENOMEM);
>>  for (i = 0; i < 16; i++) {
>>  AV_WB32(track->vos_data + i * 4, palette[i]);
>>  }
>> +memset(track->vos_data + 16*4, 0, AV_INPUT_BUFFER_PADDING_SIZE);
>>  track->vos_len = 16 * 4;
>>  }
>>  st->codecpar->width = width;
>> @@ -6453,11 +6456,12 @@ static int mov_write_header(AVFormatContext *s)
>>  mov_create_dvd_sub_decoder_specific_info(track, st);
>>  else if (!TAG_IS_AVCI(track->tag) && st->codecpar->codec_id
>> != AV_CODEC_ID_DNXHD) {
>>  track->vos_len  = st->codecpar->extradata_size;
>> -track->vos_data = av_malloc(track->vos_len);
>> +track->vos_data = av_malloc(track->vos_len +
>> AV_INPUT_BUFFER_PADDING_SIZE);
>>  if (!track->vos_data) {
>>  return AVERROR(ENOMEM);
>>  }
>>  memcpy(track->vos_data, st->codecpar->extradata,
>> track->vos_len);
>> +memset(track->vos_data + track->vos_len, 0,
>> AV_INPUT_BUFFER_PADDING_SIZE);
>>  }
>>  }
>>
>> @@ -6713,10 +6717,11 @@ static int mov_write_trailer(AVFormatContext *s)
>>  AVCodecParameters *par = track->par;
>>
>>  track->vos_len  = par->extradata_size;
>> -track->vos_data = av_malloc(track->vos_len);
>> +track->vos_data = av_malloc(track->vos_len +
>> AV_INPUT_BUFFER_PADDING_SIZE);
>>  if (!track->vos_data)
>>  return AVERROR(ENOMEM);
>>  memcpy(track->vos_data, par->extradata, track->vos_len);
>> +memset(track->vos_data + track->vos_len, 0,
>> AV_INPUT_BUFFER_PADDING_SIZE);
>>  }
>>  mov->need_rewrite_extradata = 0;
>>  }
>> --
>> 2.22.0
>>
>>
> I confirm that this patch fixes the issue i have here as well.

Applied, thanks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v5 0/3] hevc_mp4toannexb: Insert correct parameter sets

2019-09-26 Thread Andriy Gelman
Changes to v5: 
- Remove -y from new fate tests so that they are in the same format as other
  md5 tests. And removed proposed change to existing fate test.

--
Andriy


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v5 2/3] fate: Add tests for hevc_mp4annexb bsf

2019-09-26 Thread Andriy Gelman
From: Andriy Gelman 

Test hevc-mp4annexb-pps:
Test contains 64 PPS that are signalled in extradata.
Different PPS are referenced by the VCL nal units during the mp4 to
annexb conversion.

Test hevc-mp4annexb-sps:
Access units contain PPS that reference different cached SPS nal
units.
---
 tests/fate/hevc.mak | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/tests/fate/hevc.mak b/tests/fate/hevc.mak
index 4f812b0834..3209d581cd 100644
--- a/tests/fate/hevc.mak
+++ b/tests/fate/hevc.mak
@@ -240,6 +240,28 @@ fate-hevc-bsf-mp4toannexb: CMD = md5 -i 
$(TARGET_PATH)/tests/data/hevc-mp4.mov -
 fate-hevc-bsf-mp4toannexb: CMP = oneline
 fate-hevc-bsf-mp4toannexb: REF = 3c9d998a3aa2b9e0fb1c1f434952bf8b
 
+tests/data/hevc-pps-mp4.mov: TAG = GEN
+tests/data/hevc-pps-mp4.mov: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
+   $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \
+   -i $(TARGET_SAMPLES)/hevc-conformance/PPS_A_qualcomm_7.bit -c copy 
-flags +bitexact $(TARGET_PATH)/$@ -y 2>/dev/null
+
+FATE_HEVC-$(call ALLYES, HEVC_DEMUXER MOV_DEMUXER HEVC_MP4TOANNEXB_BSF 
MOV_MUXER HEVC_MUXER) += fate-hevc-bsf-mp4toannexb-pps
+fate-hevc-bsf-mp4toannexb-pps: tests/data/hevc-pps-mp4.mov
+fate-hevc-bsf-mp4toannexb-pps: CMD = md5 -i 
$(TARGET_PATH)/tests/data/hevc-pps-mp4.mov -c:v copy -fflags +bitexact -f hevc
+fate-hevc-bsf-mp4toannexb-pps: CMP = oneline
+fate-hevc-bsf-mp4toannexb-pps: REF = 28ad5b4fdcb8c35ba2b1b740c761bae3
+
+tests/data/hevc-sps-mp4.mov: TAG = GEN
+tests/data/hevc-sps-mp4.mov: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
+   $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \
+   -i $(TARGET_SAMPLES)/hevc-conformance/SLIST_B_Sony_8.bit -c copy -flags 
+bitexact $(TARGET_PATH)/$@ -y 2>/dev/null
+
+FATE_HEVC-$(call ALLYES, HEVC_DEMUXER MOV_DEMUXER HEVC_MP4TOANNEXB_BSF 
MOV_MUXER HEVC_MUXER) += fate-hevc-bsf-mp4toannexb-sps
+fate-hevc-bsf-mp4toannexb-sps: tests/data/hevc-sps-mp4.mov
+fate-hevc-bsf-mp4toannexb-sps: CMD = md5 -i 
$(TARGET_PATH)/tests/data/hevc-sps-mp4.mov -c:v copy -fflags +bitexact -f hevc
+fate-hevc-bsf-mp4toannexb-sps: CMP = oneline
+fate-hevc-bsf-mp4toannexb-sps: REF = 762147b37b393620eb30af7809f34bb2
+
 fate-hevc-skiploopfilter: CMD = framemd5 -skip_loop_filter nokey -i 
$(TARGET_SAMPLES)/hevc-conformance/SAO_D_Samsung_5.bit -sws_flags bitexact
 FATE_HEVC += fate-hevc-skiploopfilter
 
-- 
2.23.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v5 1/3] hevc_mp4toannexb: Insert correct parameter sets before IRAP

2019-09-26 Thread Andriy Gelman
From: Andriy Gelman 

Fixes #7799

Currently, the mp4toannexb filter always inserts the same extradata at
the start of the first IRAP unit. As in ticket #7799, this can lead to
decoding errors if modified parameter sets are signalled in-band.

This commit keeps track of the VPS/SPS/PPS parameter sets during the
conversion. The correct combination is inserted at the start of the
first IRAP. SEIs from extradata are inserted before each IRAP.

This commit also makes an update to the hevc-bsf-mp4toannexb fate test
since the result before this patch contained duplicate parameter sets
in-band.
---
 libavcodec/hevc_mp4toannexb_bsf.c | 488 --
 tests/fate/hevc.mak   |   2 +-
 2 files changed, 456 insertions(+), 34 deletions(-)

diff --git a/libavcodec/hevc_mp4toannexb_bsf.c 
b/libavcodec/hevc_mp4toannexb_bsf.c
index 09bce5b34c..90a4d17d25 100644
--- a/libavcodec/hevc_mp4toannexb_bsf.c
+++ b/libavcodec/hevc_mp4toannexb_bsf.c
@@ -23,19 +23,209 @@
 
 #include "libavutil/intreadwrite.h"
 #include "libavutil/mem.h"
+#include "libavutil/avassert.h"
 
 #include "avcodec.h"
 #include "bsf.h"
 #include "bytestream.h"
 #include "hevc.h"
+#include "h2645_parse.h"
+#include "hevc_ps.h"
+#include "golomb.h"
 
 #define MIN_HEVCC_LENGTH 23
+#define PROFILE_WITHOUT_IDC_BITS88
+#define IS_IRAP(s)  ((s)->type >= 16 && (s)->type <= 23)
+#define IS_PARAMSET(s)  ((s)->type >= 32 && (s)->type <= 34)
+
+/*reserved VCLs not included*/
+#define IS_VCL(s)   ((s)->type <= 9 || ((s)->type >= 16 && 
(s)->type <= 21))
+#define HEVC_NAL_HEADER_BITS16
+
+/*
+ *Copies data from input buffer to output buffer. Appends annexb startcode.
+ *out must be allocated at least out_len + in_len + 4.
+ */
+#define WRITE_NAL(out, out_len, in, in_len) do {\
+AV_WB32((out) + (out_len), 1);  \
+(out_len) += 4; \
+memcpy((out) + (out_len), (in), (in_len));  \
+(out_len) += (in_len);  \
+} while (0)
+
+typedef struct Param {
+uint8_t *raw_data;  /*raw data to store param set payload*/
+int  raw_size;  /*size of raw_data*/
+size_t   allocated_size;/*allocated size of raw_data*/
+int  ref;   /*stores the ref of the higher level parameter 
set*/
+int  is_signalled;  /*indicates whether this param has already 
been signalled in the cvs*/
+} Param;
+
+/*modified version of HEVCParamSets to store bytestream and reference to 
previous level*/
+typedef struct ParamSets {
+Param vps_list[HEVC_MAX_VPS_COUNT];
+Param sps_list[HEVC_MAX_SPS_COUNT];
+Param pps_list[HEVC_MAX_PPS_COUNT];
+
+Param sei; /*cached SEIs from extradata in annexb format*/
+} ParamSets;
 
 typedef struct HEVCBSFContext {
 uint8_t  length_size;
 int  extradata_parsed;
+ParamSets ps; /*cached VPS/SPS/PPS parameter sets + SEI from extradata*/
 } HEVCBSFContext;
 
+static int update_cached_paramset(AVBSFContext *ctx, Param *cached_param,
+  H2645NAL *nal, int ref)
+{
+int ret;
+
+if (cached_param->raw_data && cached_param->raw_size == nal->raw_size &&
+!memcmp(cached_param->raw_data, nal->raw_data, nal->raw_size)) {
+av_log(ctx, AV_LOG_DEBUG, "NAL unit: %d. Copy already exists in 
parameter set.\n", nal->type);
+} else {
+if (nal->raw_size > cached_param->allocated_size) {
+ret = av_reallocp(&cached_param->raw_data, nal->raw_size);
+if (ret < 0)
+return ret;
+cached_param->allocated_size = nal->raw_size;
+}
+memcpy(cached_param->raw_data, nal->raw_data, nal->raw_size);
+cached_param->raw_size = nal->raw_size;
+cached_param->ref  = ref;
+cached_param->is_signalled = 0;
+}
+return 0;
+}
+
+static int parse_vps(AVBSFContext *ctx, H2645NAL *nal)
+{
+int vps_id, ret;
+
+HEVCBSFContext *s = ctx->priv_data;
+ParamSets *ps = &s->ps;
+
+GetBitContext *gb = &nal->gb;
+gb->index = HEVC_NAL_HEADER_BITS;
+
+vps_id = get_bits(gb, 4);
+
+av_log(ctx, AV_LOG_TRACE, "Updating VPS id: %d\n", vps_id);
+ret = update_cached_paramset(ctx, &ps->vps_list[vps_id], nal, 0);
+return ret;
+}
+
+static int parse_sps(AVBSFContext *ctx, H2645NAL *nal)
+{
+int i, ret;
+int sps_id, vps_ref, max_sub_layers_minus1;
+
+HEVCBSFContext *s = ctx->priv_data;
+ParamSets *ps = &s->ps;
+
+uint8_t sub_layer_profile_present_flag[HEVC_MAX_SUB_LAYERS];
+uint8_t sub_layer_level_present_flag[HEVC_MAX_SUB_LAYERS];
+
+GetBitContext *gb = &nal->gb;
+gb->index = HEVC_NAL_HEADER_BITS;
+
+vps_ref = get_bits(gb, 4);
+
+max_sub_layers_minus1 = get_bits(gb, 3);
+skip_b

Re: [FFmpeg-devel] [PATCH 2/2] [monvenc] Add extra padding when allocating trk->vos_data

2019-09-26 Thread Thierry Foucu
On Thu, Sep 26, 2019 at 11:00 AM James Almer  wrote:

> On 9/26/2019 2:58 PM, Thierry Foucu wrote:
> > trk->vos_data is mostly used to store the extradata from the codec.
> > Most encoder when storing their extradata, are allocating with padding.
> > But the current code was ignoring the padding, which could causes
> > heap-buffer-overflow
> > ---
> >  libavformat/movenc.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> > index e095af0972..11cf1a13a9 100644
> > --- a/libavformat/movenc.c
> > +++ b/libavformat/movenc.c
> > @@ -5378,7 +5378,7 @@ int ff_mov_write_packet(AVFormatContext *s,
> AVPacket *pkt)
> >  !TAG_IS_AVCI(trk->tag) &&
> >  (par->codec_id != AV_CODEC_ID_DNXHD)) {
> >  trk->vos_len  = par->extradata_size;
> > -trk->vos_data = av_malloc(trk->vos_len);
> > +trk->vos_data = av_mallocz(trk->vos_len +
> AV_INPUT_BUFFER_PADDING_SIZE);
> >  if (!trk->vos_data) {
> >  ret = AVERROR(ENOMEM);
> >  goto err;
>
> See
> http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2019-September/250522.html



Thanks James.
ignore this patch then..


>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v5 3/3] hevc_mp4toannexb: Parse extradata directly from HVCC format

2019-09-26 Thread Andriy Gelman
From: Andriy Gelman 

Since the original extradata is in HVCC format, there is no need to
segment the output extradata into nal units.
---
 libavcodec/hevc_mp4toannexb_bsf.c | 66 ---
 1 file changed, 34 insertions(+), 32 deletions(-)

diff --git a/libavcodec/hevc_mp4toannexb_bsf.c 
b/libavcodec/hevc_mp4toannexb_bsf.c
index 90a4d17d25..78176290d8 100644
--- a/libavcodec/hevc_mp4toannexb_bsf.c
+++ b/libavcodec/hevc_mp4toannexb_bsf.c
@@ -228,12 +228,17 @@ static int update_paramset(AVBSFContext *ctx, H2645NAL 
*nal)
 
 static int hevc_extradata_to_annexb(AVBSFContext *ctx)
 {
+HEVCBSFContext *s = ctx->priv_data;
 GetByteContext gb;
 int length_size, num_arrays, i, j;
 int ret = 0;
 
 uint8_t *new_extradata = NULL;
 size_t   new_extradata_size = 0;
+size_t   start, end;
+
+H2645Packet pkt;
+memset(&pkt, 0, sizeof(H2645Packet)); /*in case goto fail is called before 
pkt is initialized*/
 
 bytestream2_init(&gb, ctx->par_in->extradata, ctx->par_in->extradata_size);
 
@@ -253,6 +258,7 @@ static int hevc_extradata_to_annexb(AVBSFContext *ctx)
 goto fail;
 }
 
+start = bytestream2_tell(&gb);
 for (j = 0; j < cnt; j++) {
 int nalu_len = bytestream2_get_be16(&gb);
 
@@ -269,6 +275,32 @@ static int hevc_extradata_to_annexb(AVBSFContext *ctx)
 new_extradata_size += 4 + nalu_len;
 memset(new_extradata + new_extradata_size, 0, 
AV_INPUT_BUFFER_PADDING_SIZE);
 }
+end = bytestream2_tell(&gb);
+
+/*split extradata into nalu packets*/
+ret = ff_h2645_packet_split(&pkt, ctx->par_in->extradata + start,
+end - start, ctx, 1, 2, AV_CODEC_ID_HEVC, 
1, 0);
+if (ret < 0)
+goto fail;
+
+/*parse the segmented nals*/
+for (j = 0; j < pkt.nb_nals; j++) {
+H2645NAL *nal = &pkt.nals[j];
+
+if (IS_PARAMSET(nal)) {
+ret = update_paramset(ctx, nal);
+if (ret < 0)
+goto fail;
+continue;
+}
+
+if (nal->type == HEVC_NAL_SEI_PREFIX || nal->type == 
HEVC_NAL_SEI_SUFFIX) {
+ret = append_sei_annexb(&s->ps.sei, nal);
+if (ret < 0)
+goto fail;
+}
+}
+ff_h2645_packet_uninit(&pkt);
 }
 
 av_freep(&ctx->par_out->extradata);
@@ -280,6 +312,7 @@ static int hevc_extradata_to_annexb(AVBSFContext *ctx)
 
 return length_size;
 fail:
+ff_h2645_packet_uninit(&pkt);
 av_freep(&new_extradata);
 return ret;
 }
@@ -287,51 +320,20 @@ fail:
 static int hevc_mp4toannexb_init(AVBSFContext *ctx)
 {
 HEVCBSFContext *s = ctx->priv_data;
-H2645Packet pkt;
-int i, ret;
+int ret = 0;
 
 if (ctx->par_in->extradata_size < MIN_HEVCC_LENGTH ||
 AV_RB24(ctx->par_in->extradata) == 1   ||
 AV_RB32(ctx->par_in->extradata) == 1) {
 av_log(ctx, AV_LOG_VERBOSE,
"The input looks like it is Annex B already\n");
-return 0;
 } else {
 ret = hevc_extradata_to_annexb(ctx);
 if (ret < 0)
 return ret;
 s->length_size  = ret;
 s->extradata_parsed = 1;
-
-memset(&pkt, 0, sizeof(H2645Packet));
-ret = ff_h2645_packet_split(&pkt, ctx->par_out->extradata, 
ctx->par_out->extradata_size,
- ctx, 0, 0, AV_CODEC_ID_HEVC, 1, 0);
-if (ret < 0)
-goto done;
-
-for (i = 0; i < pkt.nb_nals; ++i) {
-H2645NAL *nal = &pkt.nals[i];
-
-/*current segmentation algorithm includes next 0x00 from next nal 
unit*/
-if (nal->raw_data[nal->raw_size - 1] == 0x00)
-nal->raw_size--;
-
-if (IS_PARAMSET(nal)) {
-ret = update_paramset(ctx, nal);
-if (ret < 0)
-goto done;
-continue;
-}
-
-if (nal->type == HEVC_NAL_SEI_PREFIX || nal->type == 
HEVC_NAL_SEI_SUFFIX) {
-ret = append_sei_annexb(&s->ps.sei, nal);
-if (ret < 0)
-goto done;
-}
-}
 }
-done:
-ff_h2645_packet_uninit(&pkt);
 return ret;
 }
 
-- 
2.23.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] aformat/movenc: add missing padding to output track extradata

2019-09-26 Thread Thierry Foucu
On Wed, Sep 25, 2019 at 10:30 AM James Almer  wrote:

> Fixes ticket #8183.
>
> Signed-off-by: James Almer 
> ---
>  libavformat/movenc.c | 15 ++-
>  1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index c824ff5ba1..e3283871d0 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -5377,12 +5377,13 @@ int ff_mov_write_packet(AVFormatContext *s,
> AVPacket *pkt)
>  !TAG_IS_AVCI(trk->tag) &&
>  (par->codec_id != AV_CODEC_ID_DNXHD)) {
>  trk->vos_len  = par->extradata_size;
> -trk->vos_data = av_malloc(trk->vos_len);
> +trk->vos_data = av_malloc(trk->vos_len +
> AV_INPUT_BUFFER_PADDING_SIZE);
>  if (!trk->vos_data) {
>  ret = AVERROR(ENOMEM);
>  goto err;
>  }
>  memcpy(trk->vos_data, par->extradata, trk->vos_len);
> +memset(trk->vos_data + trk->vos_len, 0,
> AV_INPUT_BUFFER_PADDING_SIZE);
>  }
>
>  if (par->codec_id == AV_CODEC_ID_AAC && pkt->size > 2 &&
> @@ -5460,12 +5461,13 @@ int ff_mov_write_packet(AVFormatContext *s,
> AVPacket *pkt)
>   par->codec_id == AV_CODEC_ID_AC3) && !trk->vos_len) {
>  /* copy frame to create needed atoms */
>  trk->vos_len  = size;
> -trk->vos_data = av_malloc(size);
> +trk->vos_data = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE);
>  if (!trk->vos_data) {
>  ret = AVERROR(ENOMEM);
>  goto err;
>  }
>  memcpy(trk->vos_data, pkt->data, size);
> +memset(trk->vos_data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
>  }
>
>  if (trk->entry >= trk->cluster_capacity) {
> @@ -6090,12 +6092,13 @@ static int
> mov_create_dvd_sub_decoder_specific_info(MOVTrack *track,
>  cur += strspn(cur, "\n\r");
>  }
>  if (have_palette) {
> -track->vos_data = av_malloc(16*4);
> +track->vos_data = av_malloc(16*4 + AV_INPUT_BUFFER_PADDING_SIZE);
>  if (!track->vos_data)
>  return AVERROR(ENOMEM);
>  for (i = 0; i < 16; i++) {
>  AV_WB32(track->vos_data + i * 4, palette[i]);
>  }
> +memset(track->vos_data + 16*4, 0, AV_INPUT_BUFFER_PADDING_SIZE);
>  track->vos_len = 16 * 4;
>  }
>  st->codecpar->width = width;
> @@ -6453,11 +6456,12 @@ static int mov_write_header(AVFormatContext *s)
>  mov_create_dvd_sub_decoder_specific_info(track, st);
>  else if (!TAG_IS_AVCI(track->tag) && st->codecpar->codec_id
> != AV_CODEC_ID_DNXHD) {
>  track->vos_len  = st->codecpar->extradata_size;
> -track->vos_data = av_malloc(track->vos_len);
> +track->vos_data = av_malloc(track->vos_len +
> AV_INPUT_BUFFER_PADDING_SIZE);
>  if (!track->vos_data) {
>  return AVERROR(ENOMEM);
>  }
>  memcpy(track->vos_data, st->codecpar->extradata,
> track->vos_len);
> +memset(track->vos_data + track->vos_len, 0,
> AV_INPUT_BUFFER_PADDING_SIZE);
>  }
>  }
>
> @@ -6713,10 +6717,11 @@ static int mov_write_trailer(AVFormatContext *s)
>  AVCodecParameters *par = track->par;
>
>  track->vos_len  = par->extradata_size;
> -track->vos_data = av_malloc(track->vos_len);
> +track->vos_data = av_malloc(track->vos_len +
> AV_INPUT_BUFFER_PADDING_SIZE);
>  if (!track->vos_data)
>  return AVERROR(ENOMEM);
>  memcpy(track->vos_data, par->extradata, track->vos_len);
> +memset(track->vos_data + track->vos_len, 0,
> AV_INPUT_BUFFER_PADDING_SIZE);
>  }
>  mov->need_rewrite_extradata = 0;
>  }
> --
> 2.22.0
>
>
I confirm that this patch fixes the issue i have here as well.


> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 2/2] [monvenc] Add extra padding when allocating trk->vos_data

2019-09-26 Thread James Almer
On 9/26/2019 2:58 PM, Thierry Foucu wrote:
> trk->vos_data is mostly used to store the extradata from the codec.
> Most encoder when storing their extradata, are allocating with padding.
> But the current code was ignoring the padding, which could causes
> heap-buffer-overflow
> ---
>  libavformat/movenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index e095af0972..11cf1a13a9 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -5378,7 +5378,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket 
> *pkt)
>  !TAG_IS_AVCI(trk->tag) &&
>  (par->codec_id != AV_CODEC_ID_DNXHD)) {
>  trk->vos_len  = par->extradata_size;
> -trk->vos_data = av_malloc(trk->vos_len);
> +trk->vos_data = av_mallocz(trk->vos_len + 
> AV_INPUT_BUFFER_PADDING_SIZE);
>  if (!trk->vos_data) {
>  ret = AVERROR(ENOMEM);
>  goto err;

See
http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2019-September/250522.html
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 2/2] [monvenc] Add extra padding when allocating trk->vos_data

2019-09-26 Thread Thierry Foucu
trk->vos_data is mostly used to store the extradata from the codec.
Most encoder when storing their extradata, are allocating with padding.
But the current code was ignoring the padding, which could causes
heap-buffer-overflow
---
 libavformat/movenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index e095af0972..11cf1a13a9 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -5378,7 +5378,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
 !TAG_IS_AVCI(trk->tag) &&
 (par->codec_id != AV_CODEC_ID_DNXHD)) {
 trk->vos_len  = par->extradata_size;
-trk->vos_data = av_malloc(trk->vos_len);
+trk->vos_data = av_mallocz(trk->vos_len + 
AV_INPUT_BUFFER_PADDING_SIZE);
 if (!trk->vos_data) {
 ret = AVERROR(ENOMEM);
 goto err;
-- 
2.23.0.444.g18eeb5a265-goog

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v4 7/9] avformat/utils: Avoid copying packets unnecessarily

2019-09-26 Thread James Almer
On 9/20/2019 5:39 PM, Andreas Rheinhardt wrote:
> Up until now, read_frame_internal in avformat/utils.c uses a spare
> packet on the stack that serves no real purpose: At no point in this
> function is there a need for another packet besides the packet destined
> for output:
> 1. If the packet doesn't need a parser, but is output as is, the content
> of the spare packet (that at this point contains a freshly read packet)
> is simply copied into the output packet (via simple assignment, not
> av_packet_move_ref, thereby confusing ownership).
> 2. If the packet needs parsing, the spare packet will be reset after
> parsing and any packets resulting from the packet read will be put into
> a packet list; the output packet is not used here at all.
> 3. If the stream should be discarded, the spare packet will be
> unreferenced; the output packet is not used here at all either.
> 
> Therefore the spare packet and the copies can be removed in principle.
> In practice, one more thing needs to be taken care of: If ff_read_packet
> failed, the output packet was not affected, now it is. But given that
> ff_read_packet returns a blank (as if reset via av_packet_unref) packet
> on failure, there is no problem from this side either.

There's still the "if (!pktl && st->request_probe <= 0)" check in
ff_read_packet(), which returns without unreferencing the packet.

> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavformat/utils.c | 41 ++---
>  1 file changed, 18 insertions(+), 23 deletions(-)
> 
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 4eb063c54a..291084f6de 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -1583,10 +1583,9 @@ static int read_frame_internal(AVFormatContext *s, 
> AVPacket *pkt)
>  
>  while (!got_packet && !s->internal->parse_queue) {
>  AVStream *st;
> -AVPacket cur_pkt;
>  
>  /* read next packet */
> -ret = ff_read_packet(s, &cur_pkt);
> +ret = ff_read_packet(s, pkt);
>  if (ret < 0) {
>  if (ret == AVERROR(EAGAIN))
>  return ret;
> @@ -1601,7 +1600,7 @@ static int read_frame_internal(AVFormatContext *s, 
> AVPacket *pkt)
>  break;
>  }
>  ret = 0;
> -st  = s->streams[cur_pkt.stream_index];
> +st  = s->streams[pkt->stream_index];
>  
>  /* update context if required */
>  if (st->internal->need_context_update) {
> @@ -1619,7 +1618,7 @@ static int read_frame_internal(AVFormatContext *s, 
> AVPacket *pkt)
>  
>  ret = avcodec_parameters_to_context(st->internal->avctx, 
> st->codecpar);
>  if (ret < 0) {
> -av_packet_unref(&cur_pkt);
> +av_packet_unref(pkt);
>  return ret;
>  }
>  
> @@ -1628,7 +1627,7 @@ FF_DISABLE_DEPRECATION_WARNINGS
>  /* update deprecated public codec context */
>  ret = avcodec_parameters_to_context(st->codec, st->codecpar);
>  if (ret < 0) {
> -av_packet_unref(&cur_pkt);
> +av_packet_unref(pkt);
>  return ret;
>  }
>  FF_ENABLE_DEPRECATION_WARNINGS
> @@ -1637,23 +1636,23 @@ FF_ENABLE_DEPRECATION_WARNINGS
>  st->internal->need_context_update = 0;
>  }
>  
> -if (cur_pkt.pts != AV_NOPTS_VALUE &&
> -cur_pkt.dts != AV_NOPTS_VALUE &&
> -cur_pkt.pts < cur_pkt.dts) {
> +if (pkt->pts != AV_NOPTS_VALUE &&
> +pkt->dts != AV_NOPTS_VALUE &&
> +pkt->pts < pkt->dts) {
>  av_log(s, AV_LOG_WARNING,
> "Invalid timestamps stream=%d, pts=%s, dts=%s, size=%d\n",
> -   cur_pkt.stream_index,
> -   av_ts2str(cur_pkt.pts),
> -   av_ts2str(cur_pkt.dts),
> -   cur_pkt.size);
> +   pkt->stream_index,
> +   av_ts2str(pkt->pts),
> +   av_ts2str(pkt->dts),
> +   pkt->size);
>  }
>  if (s->debug & FF_FDEBUG_TS)
>  av_log(s, AV_LOG_DEBUG,
> "ff_read_packet stream=%d, pts=%s, dts=%s, size=%d, 
> duration=%"PRId64", flags=%d\n",
> -   cur_pkt.stream_index,
> -   av_ts2str(cur_pkt.pts),
> -   av_ts2str(cur_pkt.dts),
> -   cur_pkt.size, cur_pkt.duration, cur_pkt.flags);
> +   pkt->stream_index,
> +   av_ts2str(pkt->pts),
> +   av_ts2str(pkt->dts),
> +   pkt->size, pkt->duration, pkt->flags);
>  
>  if (st->need_parsing && !st->parser && !(s->flags & 
> AVFMT_FLAG_NOPARSE)) {
>  st->parser = av_parser_init(st->codecpar->codec_id);
> @@ -1673,7 +1672,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
>  
>  if (!st->need_parsing || !st->parser) {
>  /* no parsing needed: we just output the 

Re: [FFmpeg-devel] [PATCH v6] doc/filters: add 4x4 layout example for xstack filter

2019-09-26 Thread Gyan



On 26-09-2019 08:27 PM, lance.lmw...@gmail.com wrote:

From: Limin Wang 

Reviewed-by: Gyan 
Signed-off-by: Limin Wang 
---
  doc/filters.texi | 55 ---
  1 file changed, 52 insertions(+), 3 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index e6f8bf0..581a96b 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -19060,6 +19060,13 @@ terminates. Default value is 0.
  @itemize
  @item
  Display 4 inputs into 2x2 grid.
+
+Below is the 4 inputs position:
+@example
+input1(0, 0)  | input3(w0, 0)
+input2(0, h0) | input4(w0, h0)
+@end example
+
  Note that if inputs are of different sizes unused gaps might appear,
  as not all of output video is used.
  @example
@@ -19068,6 +19075,15 @@ xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  
  @item

  Display 4 inputs into 1x4 grid.
+
+Below is the 4 inputs position:
+@example
+input1(0, 0)
+input2(0, h0)
+input3(0, h0+h1)
+input4(0, h0+h1+h2)
+@end example
+
  Note that if inputs are of different sizes unused gaps might appear,
  as not all of output video is used.
  @example
@@ -19076,11 +19092,44 @@ xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  
  @item

  Display 9 inputs into 3x3 grid.
-Note that if inputs are of different sizes unused gaps might appear,
-as not all of output video is used.
+
+Below is the 9 inputs position:
  @example
-xstack=inputs=9:layout=w3_0|w3_h0+h2|w3_h0|0_h4|0_0|w3+w1_0|0_h1+h2|w3+w1_h0|w3+w1_h1+h2
+input1(0, 0)   | input4(w0, 0)  | input7(w0+w3, 0)
+input2(0, h0)  | input5(w0, h0) | input8(w0+w3, h0)
+input3(0, h0+h1)   | input6(w0, h0+h1)  | input9(w0+w3, h0+h1)
  @end example
+
+Note that if the input size is different, there may be unused gaps or
+overlaps.  For example, if the height of input4 is greater than input1,
+input5 will overlaid the top of input4, if the width of input5 is less
+than input4, then input5 will have unused gaps.
+
+@example
+xstack=inputs=9:layout=0_0|0_h0|0_h0+h1|w0_0|w0_h0|w0_h0+h1|w0+w3_0|w0+w3_h0|w0+w3_h0+h1
+@end example
+
+@item
+Display 16 inputs into 4x4 grid.
+
+Below is the 16 inputs position:
+@example
+input1(0, 0)   | input5(w0, 0)   | input9 (w0+w4, 0)   | 
input13(w0+w4+w8, 0)
+input2(0, h0)  | input6(w0, h0)  | input10(w0+w4, h0)  | 
input14(w0+w4+w8, h0)
+input3(0, h0+h1)   | input7(w0, h0+h1)   | input11(w0+w4, h0+h1)   | 
input15(w0+w4+w8, h0+h1)
+input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| 
input16(w0+w4+w8, h0+h1+h2)
+@end example
+
+Note that if the input size is different, there may be unused gaps or
+overlaps. For example, if the height of input5 is greater than input1,
+input6 will overlaid the top of input5, if the width of input6 is less
+than input5, then input6 will have unused gaps.
+
+@example
+xstack=inputs=16:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2|w0_0|w0_h0|w0_h0+h1|w0_h0+h1+h2|w0+w4_0|
+w0+w4_h0|w0+w4_h0+h1|w0+w4_h0+h1+h2|w0+w4+w8_0|w0+w4+w8_h0|w0+w4+w8_h0+h1|w0+w4+w8_h0+h1+h2
+@end example
+
  @end itemize
  
  @anchor{yadif}


Pushed with minor changes as af007e36d1590d431282fd760175d92f631dc48f

Thanks,
Gyan
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 09/15] avcodec/ffv1enc: Fix out-of-bounds-array access

2019-09-26 Thread Michael Niedermayer
On Wed, Sep 25, 2019 at 12:03:04AM +0200, Andreas Rheinhardt wrote:
> libavcodec/ffv1enc.c accessed an array of uint8_t [32] via array[0][j]
> in order to loop over all the uint8_t in this array of arrays. Of course
> this implied an out-of-bounds access for array[0] and UBSan complained
> about this. So perform the access via an ordinary pointer to uint8_t.
> 
> This affected the FATE-tests vsynth1-ffv1, vsynth1-ffv1-v3-yuv420p,
> vsynth1-ffv1-v3-yuv422p10, vsynth1-ffv1-v3-yuv444p16,
> vsynth1-ffv1-v3-bgr0, vsynth1-ffv1-ffv1-v3-rgb48 as well as the
> corresponding vsynth2-*, vsynth3-* and the vsynth_lena-* tests.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/ffv1enc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
> index 1bf9663053..5eb439135c 100644
> --- a/libavcodec/ffv1enc.c
> +++ b/libavcodec/ffv1enc.c
> @@ -429,8 +429,9 @@ static int write_extradata(FFV1Context *f)
>  
>  for (i = 0; i < f->quant_table_count; i++) {
>  if (f->initial_states[i]) {
> +uint8_t *initial_state = &f->initial_states[i][0][0];
>  for (j = 0; j < f->context_count[i] * CONTEXT_SIZE; j++)
> -if (f->initial_states[i][0][j] != 128)
> +if (initial_state[j] != 128)

I think if the code is changed, it might make sense to access
the array through the correct indexes. Not so much for C
compliance as for ease of understanding of whoever looks at this

thx

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

Any man who breaks a law that conscience tells him is unjust and willingly 
accepts the penalty by staying in jail in order to arouse the conscience of 
the community on the injustice of the law is at that moment expressing the 
very highest respect for law. - Martin Luther King Jr


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 2/3] swscale/output: Correct Alpha in yuv2ya16_X_c_template()

2019-09-26 Thread Michael Niedermayer
Untested, no testcase

Signed-off-by: Michael Niedermayer 
---
 libswscale/output.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libswscale/output.c b/libswscale/output.c
index 60a9bdfe82..ed8a69287c 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -905,7 +905,7 @@ yuv2ya16_X_c_template(SwsContext *c, const int16_t 
*lumFilter,
 for (i = 0; i < dstW; i++) {
 int j;
 int Y = -0x4000;
-int64_t A = 0x<<14;
+int64_t A = 0x;
 
 for (j = 0; j < lumFilterSize; j++)
 Y += lumSrc[j][i] * lumFilter[j];
@@ -915,6 +915,7 @@ yuv2ya16_X_c_template(SwsContext *c, const int16_t 
*lumFilter,
 Y = av_clip_uint16(Y);
 
 if (hasAlpha) {
+A = 1<<14;
 for (j = 0; j < lumFilterSize; j++)
 A += alpSrc[j][i] * lumFilter[j];
 
@@ -923,7 +924,7 @@ yuv2ya16_X_c_template(SwsContext *c, const int16_t 
*lumFilter,
 }
 
 output_pixel(&dest[2 * i], Y);
-output_pixel(&dest[2 * i + 1], hasAlpha ? A : 65535);
+output_pixel(&dest[2 * i + 1], A);
 }
 }
 
-- 
2.23.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 3/3] swscale/output: Avoid 64bit in Alpha in yuv2ya16_X_c_template()

2019-09-26 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 libswscale/output.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libswscale/output.c b/libswscale/output.c
index ed8a69287c..d192ea854b 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -905,7 +905,7 @@ yuv2ya16_X_c_template(SwsContext *c, const int16_t 
*lumFilter,
 for (i = 0; i < dstW; i++) {
 int j;
 int Y = -0x4000;
-int64_t A = 0x;
+int A = 0x;
 
 for (j = 0; j < lumFilterSize; j++)
 Y += lumSrc[j][i] * lumFilter[j];
@@ -915,11 +915,12 @@ yuv2ya16_X_c_template(SwsContext *c, const int16_t 
*lumFilter,
 Y = av_clip_uint16(Y);
 
 if (hasAlpha) {
-A = 1<<14;
+A = -0x4000 + (1<<14);
 for (j = 0; j < lumFilterSize; j++)
 A += alpSrc[j][i] * lumFilter[j];
 
 A >>= 15;
+A += 0x8000;
 A = av_clip_uint16(A);
 }
 
-- 
2.23.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 1/3] swscale/output: Implement Luma computation from yuv2ya16_X_c_template() without 64bit

2019-09-26 Thread Michael Niedermayer
This also reverts 21838cad2fc44023ad85e35d5c677e2f8d29a0ef
The revert is in this commit to avoid 2 fate updates

Signed-off-by: Michael Niedermayer 
---
 libswscale/output.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libswscale/output.c b/libswscale/output.c
index 0e20a0a6b8..60a9bdfe82 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -904,13 +904,14 @@ yuv2ya16_X_c_template(SwsContext *c, const int16_t 
*lumFilter,
 
 for (i = 0; i < dstW; i++) {
 int j;
-int64_t Y = 1 << 18;
+int Y = -0x4000;
 int64_t A = 0x<<14;
 
 for (j = 0; j < lumFilterSize; j++)
 Y += lumSrc[j][i] * lumFilter[j];
 
 Y >>= 15;
+Y += (1<<3) + 0x8000;
 Y = av_clip_uint16(Y);
 
 if (hasAlpha) {
-- 
2.23.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v4] swscale/swscale: cosmetics

2019-09-26 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libswscale/swscale.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index b4f958a..4ecfa88 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -271,7 +271,6 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 int lastInLumBuf = c->lastInLumBuf;
 int lastInChrBuf = c->lastInChrBuf;
 
-
 int lumStart = 0;
 int lumEnd = c->descIndex[0];
 int chrStart = lumEnd;
@@ -283,13 +282,11 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 SwsSlice *vout_slice = &c->slice[c->numSlice-1];
 SwsFilterDescriptor *desc = c->desc;
 
-
 int needAlpha = c->needAlpha;
 
 int hasLumHoles = 1;
 int hasChrHoles = 1;
 
-
 if (isPacked(c->srcFormat)) {
 src[1] =
 src[2] =
@@ -570,7 +567,6 @@ static av_cold void sws_init_swscale(SwsContext *c)
 
 ff_sws_init_input_funcs(c);
 
-
 if (c->srcBpc == 8) {
 if (c->dstBpc <= 14) {
 c->hyScale = c->hcScale = hScale8To15_c;
@@ -788,8 +784,6 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
 }
 
 if (c->gamma_flag && c->cascaded_context[0]) {
-
-
 ret = sws_scale(c->cascaded_context[0],
 srcSlice, srcStride, srcSliceY, srcSliceH,
 c->cascaded_tmp, c->cascaded_tmpStride);
@@ -983,7 +977,6 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
 c->sliceDir = 0;
 ret = c->swscale(c, src2, srcStride2, srcSliceY_internal, srcSliceH, dst2, 
dstStride2);
 
-
 if (c->dstXYZ && !(c->srcXYZ && c->srcW==c->dstW && c->srcH==c->dstH)) {
 int dstY = c->dstY ? c->dstY : srcSliceY + srcSliceH;
 uint16_t *dst16 = (uint16_t*)(dst2[0] + (dstY - ret) * dstStride2[0]);
-- 
2.6.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v1] avfilter/vf_scale: cosmetics

2019-09-26 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavfilter/vf_scale.c | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index cb42794..41ddec7 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -396,16 +396,16 @@ static int scale_slice(AVFilterLink *link, AVFrame 
*out_buf, AVFrame *cur_pic, s
 int in_stride[4],out_stride[4];
 int i;
 
-for(i=0; i<4; i++){
+for (i=0; i<4; i++) {
 int vsub= ((i+1)&2) ? scale->vsub : 0;
  in_stride[i] = cur_pic->linesize[i] * mul;
 out_stride[i] = out_buf->linesize[i] * mul;
  in[i] = cur_pic->data[i] + ((y>>vsub)+field) * cur_pic->linesize[i];
 out[i] = out_buf->data[i] +field  * out_buf->linesize[i];
 }
-if(scale->input_is_pal)
+if (scale->input_is_pal)
  in[1] = cur_pic->data[1];
-if(scale->output_is_pal)
+if (scale->output_is_pal)
 out[1] = out_buf->data[1];
 
 return sws_scale(sws, in, in_stride, y/mul, h,
@@ -425,7 +425,7 @@ static int scale_frame(AVFilterLink *link, AVFrame *in, 
AVFrame **frame_out)
 if (in->colorspace == AVCOL_SPC_YCGCO)
 av_log(link->dst, AV_LOG_WARNING, "Detected unsupported YCgCo 
colorspace.\n");
 
-if(   in->width  != link->w
+if (  in->width  != link->w
|| in->height != link->h
|| in->format != link->format
|| in->sample_aspect_ratio.den != link->sample_aspect_ratio.den || 
in->sample_aspect_ratio.num != link->sample_aspect_ratio.num) {
@@ -445,7 +445,6 @@ static int scale_frame(AVFilterLink *link, AVFrame *in, 
AVFrame **frame_out)
 link->dst->inputs[0]->sample_aspect_ratio.den = 
in->sample_aspect_ratio.den;
 link->dst->inputs[0]->sample_aspect_ratio.num = 
in->sample_aspect_ratio.num;
 
-
 if ((ret = config_props(outlink)) < 0)
 return ret;
 }
@@ -469,7 +468,7 @@ static int scale_frame(AVFilterLink *link, AVFrame *in, 
AVFrame **frame_out)
 out->width  = outlink->w;
 out->height = outlink->h;
 
-if(scale->output_is_pal)
+if (scale->output_is_pal)
 avpriv_set_systematic_pal2((uint32_t*)out->data[1], outlink->format == 
AV_PIX_FMT_PAL8 ? AV_PIX_FMT_BGR8 : outlink->format);
 
 in_range = in->color_range;
@@ -520,10 +519,10 @@ static int scale_frame(AVFilterLink *link, AVFrame *in, 
AVFrame **frame_out)
   (int64_t)in->sample_aspect_ratio.den * outlink->w * link->h,
   INT_MAX);
 
-if(scale->interlaced>0 || (scale->interlaced<0 && in->interlaced_frame)){
+if (scale->interlaced>0 || (scale->interlaced<0 && in->interlaced_frame)) {
 scale_slice(link, out, in, scale->isws[0], 0, (link->h+1)/2, 2, 0);
 scale_slice(link, out, in, scale->isws[1], 0,  link->h   /2, 2, 1);
-}else if (scale->nb_slices) {
+} else if (scale->nb_slices) {
 int i, slice_h, slice_start, slice_end = 0;
 const int nb_slices = FFMIN(scale->nb_slices, link->h);
 for (i = 0; i < nb_slices; i++) {
@@ -532,7 +531,7 @@ static int scale_frame(AVFilterLink *link, AVFrame *in, 
AVFrame **frame_out)
 slice_h = slice_end - slice_start;
 scale_slice(link, out, in, scale->sws, slice_start, slice_h, 1, 0);
 }
-}else{
+} else {
 scale_slice(link, out, in, scale->sws, 0, link->h, 1, 0);
 }
 
-- 
2.6.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [FFmpeg-cvslog] swscale/output: fix signed integer overflow for ya16

2019-09-26 Thread Michael Niedermayer
On Thu, Sep 26, 2019 at 01:57:52PM +, Paul B Mahol wrote:
> ffmpeg | branch: master | Paul B Mahol  | Thu Sep 26 
> 15:55:03 2019 +0200| [21838cad2fc44023ad85e35d5c677e2f8d29a0ef] | committer: 
> Paul B Mahol
> 
> swscale/output: fix signed integer overflow for ya16
> 
> Fixes #7666.
> 
> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=21838cad2fc44023ad85e35d5c677e2f8d29a0ef
> ---
> 
>  libswscale/output.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libswscale/output.c b/libswscale/output.c
> index 7eb4644ce6..0e20a0a6b8 100644
> --- a/libswscale/output.c
> +++ b/libswscale/output.c
> @@ -904,7 +904,7 @@ yuv2ya16_X_c_template(SwsContext *c, const int16_t 
> *lumFilter,
>  
>  for (i = 0; i < dstW; i++) {
>  int j;
> -int Y = 1 << 18;
> +int64_t Y = 1 << 18;
>  int64_t A = 0x<<14;

This fix is not optimal, 64bit intermediates should not be needed

Ill post a patch which does this without the 64bit

also the alpha code looks somewhat wrong, ive a fix but no testcase
will post that too

Thanks

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

Elect your leaders based on what they did after the last election, not
based on what they say before an election.



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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH V2 1/3] checkasm/vf_eq: add test for vf_eq

2019-09-26 Thread James Almer
On 9/26/2019 11:43 AM, Andreas Rheinhardt wrote:
> Ting Fu:
>> Signed-off-by: Ting Fu 
>> ---
>>  libavfilter/vf_eq.c   | 13 ---
>>  libavfilter/vf_eq.h   |  1 +
>>  tests/checkasm/Makefile   |  1 +
>>  tests/checkasm/checkasm.c |  3 ++
>>  tests/checkasm/checkasm.h |  1 +
>>  tests/checkasm/vf_eq.c| 79 +++
>>  tests/fate/checkasm.mak   |  1 +
>>  7 files changed, 94 insertions(+), 5 deletions(-)
>>  create mode 100644 tests/checkasm/vf_eq.c
>>
>> diff --git a/libavfilter/vf_eq.c b/libavfilter/vf_eq.c
>> index 2c4c7e4d54..0f9d129255 100644
>> --- a/libavfilter/vf_eq.c
>> +++ b/libavfilter/vf_eq.c
>> @@ -174,12 +174,18 @@ static int set_expr(AVExpr **pexpr, const char *expr, 
>> const char *option, void *
>>  return 0;
>>  }
>>  
>> +void ff_eq_init(EQContext *eq)
>> +{
>> +eq->process = process_c;
>> +if (ARCH_X86)
>> +ff_eq_init_x86(eq);
>> +}
>> +
>>  static int initialize(AVFilterContext *ctx)
>>  {
>>  EQContext *eq = ctx->priv;
>>  int ret;
>> -
>> -eq->process = process_c;
>> +ff_eq_init(eq);
>>  
>>  if ((ret = set_expr(&eq->contrast_pexpr, eq->contrast_expr, 
>> "contrast", ctx)) < 0 ||
>>  (ret = set_expr(&eq->brightness_pexpr,   eq->brightness_expr,   
>> "brightness",   ctx)) < 0 ||
>> @@ -191,9 +197,6 @@ static int initialize(AVFilterContext *ctx)
>>  (ret = set_expr(&eq->gamma_weight_pexpr, eq->gamma_weight_expr, 
>> "gamma_weight", ctx)) < 0 )
>>  return ret;
>>  
>> -if (ARCH_X86)
>> -ff_eq_init_x86(eq);
>> -
>>  if (eq->eval_mode == EVAL_MODE_INIT) {
>>  set_gamma(eq);
>>  set_contrast(eq);
>> diff --git a/libavfilter/vf_eq.h b/libavfilter/vf_eq.h
>> index fa49d46e5c..cd0cd75f08 100644
>> --- a/libavfilter/vf_eq.h
>> +++ b/libavfilter/vf_eq.h
>> @@ -100,6 +100,7 @@ typedef struct EQContext {
>>  enum EvalMode { EVAL_MODE_INIT, EVAL_MODE_FRAME, EVAL_MODE_NB } 
>> eval_mode;
>>  } EQContext;
>>  
>> +void ff_eq_init(EQContext *eq);
>>  void ff_eq_init_x86(EQContext *eq);
>>  
>>  #endif /* AVFILTER_EQ_H */
>> diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
>> index 0112ff603e..de850c016e 100644
>> --- a/tests/checkasm/Makefile
>> +++ b/tests/checkasm/Makefile
>> @@ -36,6 +36,7 @@ CHECKASMOBJS-$(CONFIG_AVCODEC)  += 
>> $(AVCODECOBJS-yes)
>>  AVFILTEROBJS-$(CONFIG_AFIR_FILTER) += af_afir.o
>>  AVFILTEROBJS-$(CONFIG_BLEND_FILTER) += vf_blend.o
>>  AVFILTEROBJS-$(CONFIG_COLORSPACE_FILTER) += vf_colorspace.o
>> +AVFILTEROBJS-$(CONFIG_EQ_FILTER) += vf_eq.o
>>  AVFILTEROBJS-$(CONFIG_GBLUR_FILTER)  += vf_gblur.o
>>  AVFILTEROBJS-$(CONFIG_HFLIP_FILTER)  += vf_hflip.o
>>  AVFILTEROBJS-$(CONFIG_THRESHOLD_FILTER)  += vf_threshold.o
>> diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
>> index d9a5c7f401..bcbe775510 100644
>> --- a/tests/checkasm/checkasm.c
>> +++ b/tests/checkasm/checkasm.c
>> @@ -165,6 +165,9 @@ static const struct {
>>  #if CONFIG_COLORSPACE_FILTER
>>  { "vf_colorspace", checkasm_check_colorspace },
>>  #endif
>> +#if CONFIG_EQ_FILTER
>> +{ "vf_eq", checkasm_check_vf_eq },
>> +#endif
>>  #if CONFIG_GBLUR_FILTER
>>  { "vf_gblur", checkasm_check_vf_gblur },
>>  #endif
>> diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
>> index fdf9eeb75d..0a7f9f25c4 100644
>> --- a/tests/checkasm/checkasm.h
>> +++ b/tests/checkasm/checkasm.h
>> @@ -72,6 +72,7 @@ void checkasm_check_sw_rgb(void);
>>  void checkasm_check_utvideodsp(void);
>>  void checkasm_check_v210dec(void);
>>  void checkasm_check_v210enc(void);
>> +void checkasm_check_vf_eq(void);
>>  void checkasm_check_vf_gblur(void);
>>  void checkasm_check_vf_hflip(void);
>>  void checkasm_check_vf_threshold(void);
>> diff --git a/tests/checkasm/vf_eq.c b/tests/checkasm/vf_eq.c
>> new file mode 100644
>> index 00..684718f2cd
>> --- /dev/null
>> +++ b/tests/checkasm/vf_eq.c
>> @@ -0,0 +1,79 @@
>> +/*
>> + * This file is part of FFmpeg.
>> + *
>> + * FFmpeg is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License as published by
>> + * the Free Software Foundation; either version 2 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 General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU 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 
>> +#include "checkasm.h"
>> +#include "libavfilter/avfilter.h"
>> +#include "libavfilter/vf_eq.h"
>> +#include "libavutil/intreadwrite.h"
>> +
>> +#define W

[FFmpeg-devel] [PATCH v6] doc/filters: add 4x4 layout example for xstack filter

2019-09-26 Thread lance . lmwang
From: Limin Wang 

Reviewed-by: Gyan 
Signed-off-by: Limin Wang 
---
 doc/filters.texi | 55 ---
 1 file changed, 52 insertions(+), 3 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index e6f8bf0..581a96b 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -19060,6 +19060,13 @@ terminates. Default value is 0.
 @itemize
 @item
 Display 4 inputs into 2x2 grid.
+
+Below is the 4 inputs position:
+@example
+input1(0, 0)  | input3(w0, 0)
+input2(0, h0) | input4(w0, h0)
+@end example
+
 Note that if inputs are of different sizes unused gaps might appear,
 as not all of output video is used.
 @example
@@ -19068,6 +19075,15 @@ xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
 
 @item
 Display 4 inputs into 1x4 grid.
+
+Below is the 4 inputs position:
+@example
+input1(0, 0)
+input2(0, h0)
+input3(0, h0+h1)
+input4(0, h0+h1+h2)
+@end example
+
 Note that if inputs are of different sizes unused gaps might appear,
 as not all of output video is used.
 @example
@@ -19076,11 +19092,44 @@ xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
 
 @item
 Display 9 inputs into 3x3 grid.
-Note that if inputs are of different sizes unused gaps might appear,
-as not all of output video is used.
+
+Below is the 9 inputs position:
 @example
-xstack=inputs=9:layout=w3_0|w3_h0+h2|w3_h0|0_h4|0_0|w3+w1_0|0_h1+h2|w3+w1_h0|w3+w1_h1+h2
+input1(0, 0)   | input4(w0, 0)  | input7(w0+w3, 0)
+input2(0, h0)  | input5(w0, h0) | input8(w0+w3, h0)
+input3(0, h0+h1)   | input6(w0, h0+h1)  | input9(w0+w3, h0+h1)
 @end example
+
+Note that if the input size is different, there may be unused gaps or
+overlaps.  For example, if the height of input4 is greater than input1,
+input5 will overlaid the top of input4, if the width of input5 is less
+than input4, then input5 will have unused gaps.
+
+@example
+xstack=inputs=9:layout=0_0|0_h0|0_h0+h1|w0_0|w0_h0|w0_h0+h1|w0+w3_0|w0+w3_h0|w0+w3_h0+h1
+@end example
+
+@item
+Display 16 inputs into 4x4 grid.
+
+Below is the 16 inputs position:
+@example
+input1(0, 0)   | input5(w0, 0)   | input9 (w0+w4, 0)   | 
input13(w0+w4+w8, 0)
+input2(0, h0)  | input6(w0, h0)  | input10(w0+w4, h0)  | 
input14(w0+w4+w8, h0)
+input3(0, h0+h1)   | input7(w0, h0+h1)   | input11(w0+w4, h0+h1)   | 
input15(w0+w4+w8, h0+h1)
+input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| 
input16(w0+w4+w8, h0+h1+h2)
+@end example
+
+Note that if the input size is different, there may be unused gaps or
+overlaps. For example, if the height of input5 is greater than input1,
+input6 will overlaid the top of input5, if the width of input6 is less
+than input5, then input6 will have unused gaps.
+
+@example
+xstack=inputs=16:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2|w0_0|w0_h0|w0_h0+h1|w0_h0+h1+h2|w0+w4_0|
+w0+w4_h0|w0+w4_h0+h1|w0+w4_h0+h1+h2|w0+w4+w8_0|w0+w4+w8_h0|w0+w4+w8_h0+h1|w0+w4+w8_h0+h1+h2
+@end example
+
 @end itemize
 
 @anchor{yadif}
-- 
2.6.4

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH V2 1/3] checkasm/vf_eq: add test for vf_eq

2019-09-26 Thread Andreas Rheinhardt
Ting Fu:
> Signed-off-by: Ting Fu 
> ---
>  libavfilter/vf_eq.c   | 13 ---
>  libavfilter/vf_eq.h   |  1 +
>  tests/checkasm/Makefile   |  1 +
>  tests/checkasm/checkasm.c |  3 ++
>  tests/checkasm/checkasm.h |  1 +
>  tests/checkasm/vf_eq.c| 79 +++
>  tests/fate/checkasm.mak   |  1 +
>  7 files changed, 94 insertions(+), 5 deletions(-)
>  create mode 100644 tests/checkasm/vf_eq.c
> 
> diff --git a/libavfilter/vf_eq.c b/libavfilter/vf_eq.c
> index 2c4c7e4d54..0f9d129255 100644
> --- a/libavfilter/vf_eq.c
> +++ b/libavfilter/vf_eq.c
> @@ -174,12 +174,18 @@ static int set_expr(AVExpr **pexpr, const char *expr, 
> const char *option, void *
>  return 0;
>  }
>  
> +void ff_eq_init(EQContext *eq)
> +{
> +eq->process = process_c;
> +if (ARCH_X86)
> +ff_eq_init_x86(eq);
> +}
> +
>  static int initialize(AVFilterContext *ctx)
>  {
>  EQContext *eq = ctx->priv;
>  int ret;
> -
> -eq->process = process_c;
> +ff_eq_init(eq);
>  
>  if ((ret = set_expr(&eq->contrast_pexpr, eq->contrast_expr, 
> "contrast", ctx)) < 0 ||
>  (ret = set_expr(&eq->brightness_pexpr,   eq->brightness_expr,   
> "brightness",   ctx)) < 0 ||
> @@ -191,9 +197,6 @@ static int initialize(AVFilterContext *ctx)
>  (ret = set_expr(&eq->gamma_weight_pexpr, eq->gamma_weight_expr, 
> "gamma_weight", ctx)) < 0 )
>  return ret;
>  
> -if (ARCH_X86)
> -ff_eq_init_x86(eq);
> -
>  if (eq->eval_mode == EVAL_MODE_INIT) {
>  set_gamma(eq);
>  set_contrast(eq);
> diff --git a/libavfilter/vf_eq.h b/libavfilter/vf_eq.h
> index fa49d46e5c..cd0cd75f08 100644
> --- a/libavfilter/vf_eq.h
> +++ b/libavfilter/vf_eq.h
> @@ -100,6 +100,7 @@ typedef struct EQContext {
>  enum EvalMode { EVAL_MODE_INIT, EVAL_MODE_FRAME, EVAL_MODE_NB } 
> eval_mode;
>  } EQContext;
>  
> +void ff_eq_init(EQContext *eq);
>  void ff_eq_init_x86(EQContext *eq);
>  
>  #endif /* AVFILTER_EQ_H */
> diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
> index 0112ff603e..de850c016e 100644
> --- a/tests/checkasm/Makefile
> +++ b/tests/checkasm/Makefile
> @@ -36,6 +36,7 @@ CHECKASMOBJS-$(CONFIG_AVCODEC)  += 
> $(AVCODECOBJS-yes)
>  AVFILTEROBJS-$(CONFIG_AFIR_FILTER) += af_afir.o
>  AVFILTEROBJS-$(CONFIG_BLEND_FILTER) += vf_blend.o
>  AVFILTEROBJS-$(CONFIG_COLORSPACE_FILTER) += vf_colorspace.o
> +AVFILTEROBJS-$(CONFIG_EQ_FILTER) += vf_eq.o
>  AVFILTEROBJS-$(CONFIG_GBLUR_FILTER)  += vf_gblur.o
>  AVFILTEROBJS-$(CONFIG_HFLIP_FILTER)  += vf_hflip.o
>  AVFILTEROBJS-$(CONFIG_THRESHOLD_FILTER)  += vf_threshold.o
> diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
> index d9a5c7f401..bcbe775510 100644
> --- a/tests/checkasm/checkasm.c
> +++ b/tests/checkasm/checkasm.c
> @@ -165,6 +165,9 @@ static const struct {
>  #if CONFIG_COLORSPACE_FILTER
>  { "vf_colorspace", checkasm_check_colorspace },
>  #endif
> +#if CONFIG_EQ_FILTER
> +{ "vf_eq", checkasm_check_vf_eq },
> +#endif
>  #if CONFIG_GBLUR_FILTER
>  { "vf_gblur", checkasm_check_vf_gblur },
>  #endif
> diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
> index fdf9eeb75d..0a7f9f25c4 100644
> --- a/tests/checkasm/checkasm.h
> +++ b/tests/checkasm/checkasm.h
> @@ -72,6 +72,7 @@ void checkasm_check_sw_rgb(void);
>  void checkasm_check_utvideodsp(void);
>  void checkasm_check_v210dec(void);
>  void checkasm_check_v210enc(void);
> +void checkasm_check_vf_eq(void);
>  void checkasm_check_vf_gblur(void);
>  void checkasm_check_vf_hflip(void);
>  void checkasm_check_vf_threshold(void);
> diff --git a/tests/checkasm/vf_eq.c b/tests/checkasm/vf_eq.c
> new file mode 100644
> index 00..684718f2cd
> --- /dev/null
> +++ b/tests/checkasm/vf_eq.c
> @@ -0,0 +1,79 @@
> +/*
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 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 General Public License for more details.
> + *
> + * You should have received a copy of the GNU 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 
> +#include "checkasm.h"
> +#include "libavfilter/avfilter.h"
> +#include "libavfilter/vf_eq.h"
> +#include "libavutil/intreadwrite.h"
> +
> +#define WIDTH 256
> +#define HEIGHT 256
> +#define SRC_STRIDE 256
> +#define PIXELS (WIDTH * HEIGHT)
> +#define RANDOM_RANGE 8
> +#define SCALE 1
> +
> +#define randomize_buffers(buf, s

Re: [FFmpeg-devel] [PATCH v4] doc/filters: add 4x4 layout example for xstack filter

2019-09-26 Thread Limin Wang
On Thu, Sep 26, 2019 at 04:07:14PM +0530, Gyan wrote:
> 
> 
> On 26-09-2019 12:22 PM, Limin Wang wrote:
> >On Wed, Sep 25, 2019 at 09:26:58PM +0530, Gyan wrote:
> >>Ok, the formatting is fine except for one. See below.
> >>
> >>On 25-09-2019 03:56 AM, lance.lmw...@gmail.com wrote:
> >>>From: Limin Wang 
> >>>
> >>>Reviewed-by: Gyan 
> >>>Signed-off-by: Limin Wang 
> >>>---
> >>>  doc/filters.texi | 42 +-
> >>>  1 file changed, 41 insertions(+), 1 deletion(-)
> >>>
> >>>diff --git a/doc/filters.texi b/doc/filters.texi
> >>>index e41384a..a8342c0 100644
> >>>--- a/doc/filters.texi
> >>>+++ b/doc/filters.texi
> >>>@@ -19057,6 +19057,13 @@ terminates. Default value is 0.
> >>>  @itemize
> >>>  @item
> >>>  Display 4 inputs into 2x2 grid.
> >>>+
> >>>+Below is the 4 inputs position:
> >>>+@example
> >>>+input1(0, 0)  | input3(w0, 0)
> >>>+input2(0, h0) | input4(w0, h0)
> >>>+@end example
> >>>+
> >>>  Note that if inputs are of different sizes unused gaps might appear,
> >>>  as not all of output video is used.
> >>>  @example
> >>>@@ -19065,6 +19072,12 @@ xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
> >>>  @item
> >>>  Display 4 inputs into 1x4 grid.
> >>>+
> >>>+Below is the 4 inputs position:
> >>>+@example
> >>>+input1(0, 0) | input2(0, h0) | input3(0, h0+h1) | input4(0, h0+h1+h2)
> >>Since this is 1 column x 4 rows, these should be different lines
> >>without the separator.
> >>
> >>>+@end example
> >>>+
> >>>  Note that if inputs are of different sizes unused gaps might appear,
> >>>  as not all of output video is used.
> >>>  @example
> >>>@@ -19073,11 +19086,38 @@ 
> >>>xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
> >>>  @item
> >>>  Display 9 inputs into 3x3 grid.
> >>>+
> >>>+Below is the 9 inputs position:
> >>>+@example
> >>>+input1(0, 0)   | input4(w0, 0)  | input7(w0+w1, 0)
> >>>+input2(0, h0)  | input5(w0, h0) | input8(w0+w1, h0)
> >>>+input3(0, h0+h1)   | input6(w0, h0+h1)  | input9(w0+w1, h0+h1)
> >>Shouldn't the third column be at x = w0+w3? w1 is width of input2, right?
> >>
> >>>+@end example
> >>>+
> >>>  Note that if inputs are of different sizes unused gaps might appear,
> >>>  as not all of output video is used.
> >>>  @example
> >>>-xstack=inputs=9:layout=w3_0|w3_h0+h2|w3_h0|0_h4|0_0|w3+w1_0|0_h1+h2|w3+w1_h0|w3+w1_h1+h2
> >>>+xstack=inputs=9:layout=0_0|0_h0|0_h0+h1|w0_0|w0_h0|w0_h0+h1|w0+w1_0|w0+w1_h0|w0+w1_h0+h1
> >>>  @end example
> >>>+
> >>>+@item
> >>>+Display 16 inputs into 4x4 grid.
> >>>+
> >>>+Below is the 16 inputs position:
> >>>+@example
> >>>+input1(0, 0)   | input5(w0, 0)   | input9 (w0+w1, 0)   | 
> >>>input13(w0+w1+w2, 0)
> >>>+input2(0, h0)  | input6(w0, h0)  | input10(w0+w1, h0)  | 
> >>>input14(w0+w1+w2, h0)
> >>>+input3(0, h0+h1)   | input7(w0, h0+h1)   | input11(w0+w1, h0+h1)   | 
> >>>input15(w0+w1+w2, h0+h1)
> >>>+input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w1, h0+h1+h2)| 
> >>>input16(w0+w1+w2, h0+h1+h2)
> >>Same as above.
> >>
> >>You should also note that when videos are of different sizes, the
> >>videos may overlap e.g. if height of input5 is greater than input1,
> >>then input6 will be overlaid on top of part of input5.
> >I have tested with different width videos, it's better to same width for 
> >every column.
> >Please check my last update version, please ignore the first one, it's wrong 
> >version.
> That's a user's choice but warn about the possibility of overlapping
> as well.
OK, so it's better to add the note to the document also. I'll try to
update the old note section, please help to check if it's accuate.

> 
> Gyan
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] avcodec/exr: Allow duplicate use of channel indexes

2019-09-26 Thread Michael Niedermayer
Fixes: Ticket #8203

Reported-by: durandal_1707
Signed-off-by: Michael Niedermayer 
---
 libavcodec/exr.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index c12469cc28..29dab36409 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -1307,6 +1307,7 @@ static int decode_header(EXRContext *s, AVFrame *frame)
 int magic_number, version, i, flags, sar = 0;
 int layer_match = 0;
 int ret;
+int dup_channels = 0;
 
 s->current_channel_offset = 0;
 s->xmin   = ~0;
@@ -1465,10 +1466,12 @@ static int decode_header(EXRContext *s, AVFrame *frame)
 s->pixel_type = current_pixel_type;
 s->channel_offsets[channel_index] = 
s->current_channel_offset;
 } else if (channel_index >= 0) {
-av_log(s->avctx, AV_LOG_ERROR,
+av_log(s->avctx, AV_LOG_WARNING,
 "Multiple channels with index %d.\n", 
channel_index);
-ret = AVERROR_INVALIDDATA;
-goto fail;
+if (++dup_channels > 10) {
+ret = AVERROR_INVALIDDATA;
+goto fail;
+}
 }
 
 s->channels = av_realloc(s->channels,
-- 
2.23.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v2] avcodec/hevc_ps: Remove dead code in vps_id check

2019-09-26 Thread James Almer
On 9/26/2019 8:48 AM, Andriy Gelman wrote:
> On Sun, 22. Sep 00:17, Andriy Gelman wrote:
>> From: Andriy Gelman 
>>
>> Since reading 4 bits always returns a value in the range [0, 15], the
>> check for vps_id >= HEVC_MAX_VPS_COUNT, where HEVC_MAX_VPS_COUNT = 16, is 
>> redundant.
>>
>> Signed-off-by: Andriy Gelman 
>> ---
>>  libavcodec/hevc_ps.c | 8 
>>  1 file changed, 8 deletions(-)
>>
>> diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
>> index abf08b919b..a30b8b8022 100644
>> --- a/libavcodec/hevc_ps.c
>> +++ b/libavcodec/hevc_ps.c
>> @@ -448,10 +448,6 @@ int ff_hevc_decode_nal_vps(GetBitContext *gb, 
>> AVCodecContext *avctx,
>>  memcpy(vps->data, gb->buffer, vps->data_size);
>>  
>>  vps_id = get_bits(gb, 4);
>> -if (vps_id >= HEVC_MAX_VPS_COUNT) {
>> -av_log(avctx, AV_LOG_ERROR, "VPS id out of range: %d\n", vps_id);
>> -goto err;
>> -}
>>  
>>  if (get_bits(gb, 2) != 3) { // vps_reserved_three_2bits
>>  av_log(avctx, AV_LOG_ERROR, "vps_reserved_three_2bits is not 
>> three\n");
>> @@ -883,10 +879,6 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, 
>> unsigned int *sps_id,
>>  // Coded parameters
>>  
>>  sps->vps_id = get_bits(gb, 4);
>> -if (sps->vps_id >= HEVC_MAX_VPS_COUNT) {
>> -av_log(avctx, AV_LOG_ERROR, "VPS id out of range: %d\n", 
>> sps->vps_id);
>> -return AVERROR_INVALIDDATA;
>> -}
>>  
>>  if (vps_list && !vps_list[sps->vps_id]) {
>>  av_log(avctx, AV_LOG_ERROR, "VPS %d does not exist\n",
>> -- 
>> 2.23.0
>>
> 
> ping

Applied, thanks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 3/4] avcodec/sbcdec: Initilaize nubmer of channels

2019-09-26 Thread Moritz Barsnick
> please fix typo in commit message, nubmer

and "Initilaize" -> "Initialize".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v7] avfilter/avf_aphasemeter: Add out-of-phase and mono detection

2019-09-26 Thread Paul B Mahol
On 8/19/19, Romane Lafon  wrote:
> This patch extends aphasemeter to detect out of phase or mono sequences in
> stereo streams, with its associated documentation.
>

Sorry, can not apply this. It crashed on uninit() here.

Inlink is not longer valid during uninit(), also get_index() function
is bad and incorrect, atof() cant parse time string.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 08/11] avformat/movenc: Fix undefined shift

2019-09-26 Thread Paul B Mahol
applied

On 9/20/19, Andreas Rheinhardt  wrote:
> Fixes the movenc FATE-test.
>
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavformat/movenc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index edddfeeb00..ce9fc8c5aa 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -1,3 +1,4 @@
> +
>  /*
>   * MOV, 3GP, MP4 muxer
>   * Copyright (c) 2003 Thomas Raivio
> @@ -4511,7 +4512,8 @@ static int mov_write_sidx_tag(AVIOContext *pb,
>  {
>  int64_t pos = avio_tell(pb), offset_pos, end_pos;
>  int64_t presentation_time, duration, offset;
> -int starts_with_SAP, i, entries;
> +unsigned starts_with_SAP;
> +int i, entries;
>
>  if (track->entry) {
>  entries = 1;
> --
> 2.20.1
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 06/11] avcodec/pcm: Fix undefined shifts

2019-09-26 Thread Paul B Mahol
applied

On 9/20/19, Andreas Rheinhardt  wrote:
> Fixes the acodec-pcm-u16[lb]e FATE-tests.
>
> Signed-off-by: Andreas Rheinhardt 
> ---
> Changing the macro for planar decoding is actually unnecessary, as none
> of the currently used users of this macro need it. I have nevertheless
> done so to minimise the changes between the macros.
>
>  libavcodec/pcm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c
> index ffcbccc77d..d9176732d9 100644
> --- a/libavcodec/pcm.c
> +++ b/libavcodec/pcm.c
> @@ -303,7 +303,7 @@ static av_cold int pcm_decode_close(AVCodecContext
> *avctx)
>  #define DECODE(size, endian, src, dst, n, shift, offset)\
>  for (; n > 0; n--) {\
>  uint ## size ## _t v = bytestream_get_ ## endian(&src); \
> -AV_WN ## size ## A(dst, (v - offset) << shift); \
> +AV_WN ## size ## A(dst, (uint ## size ## _t)(v - offset) << shift);
> \
>  dst += size / 8;\
>  }
>
> @@ -314,7 +314,7 @@ static av_cold int pcm_decode_close(AVCodecContext
> *avctx)
>  dst = frame->extended_data[c];\
>  for (i = n; i > 0; i--) {   \
>  uint ## size ## _t v = bytestream_get_ ## endian(&src); \
> -AV_WN ## size ## A(dst, (v - offset) << shift); \
> +AV_WN ## size ## A(dst, (uint ## size ##_t)(v - offset) <<
> shift); \
>  dst += size / 8;\
>  }   \
>  }
> --
> 2.20.1
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 02/11] avcodec/mpeg12dec: Sanitize start codes earlier

2019-09-26 Thread Paul B Mahol
applied

On 9/20/19, Andreas Rheinhardt  wrote:
> The MPEG-1/2 decoder uses avpriv_find_start_code to search for start
> codes and worked with the resulting start code before checking that it
> is really a start code of a slice. In particular, if the picture is so
> big that a slice_vertical_position_extension is present, it added the
> slice_vertical_position_extension as if it had a slice. Then a left
> shift is performed, without making sure that the value to be shifted is
> nonnegative.
> Afterwards the end result is checked, but even if a start code of a
> non-slice has been found, it might pass these checks: If
> slice_vertical_position_extension is present a start code <
> SLICE_MIN_START_CODE can lead to a macroblock-row index that appears
> valid. Furthermore, the left shift might make an invalid start code
> appear valid by discarding the highest bit.
> This has been fixed by checking directly after avpriv_find_start_code
> has returned.
>
> Fixes ticket #8162 (which is about the undefined left shifts).
>
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/mpeg12dec.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
> index 83e537884b..1904b75213 100644
> --- a/libavcodec/mpeg12dec.c
> +++ b/libavcodec/mpeg12dec.c
> @@ -2011,13 +2011,15 @@ static int slice_decode_thread(AVCodecContext *c,
> void *arg)
>
>  start_code = -1;
>  buf= avpriv_find_start_code(buf, s->gb.buffer_end,
> &start_code);
> +if (start_code < SLICE_MIN_START_CODE || start_code >
> SLICE_MAX_START_CODE)
> +return AVERROR_INVALIDDATA;
>  mb_y   = start_code - SLICE_MIN_START_CODE;
>  if (s->codec_id != AV_CODEC_ID_MPEG1VIDEO && s->mb_height >
> 2800/16)
>  mb_y += (*buf&0xE0)<<2;
>  mb_y <<= field_pic;
>  if (s->picture_structure == PICT_BOTTOM_FIELD)
>  mb_y++;
> -if (mb_y < 0 || mb_y >= s->end_mb_y)
> +if (mb_y >= s->end_mb_y)
>  return AVERROR_INVALIDDATA;
>  }
>  }
> --
> 2.20.1
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 07/11] avcodec/pcm: Cosmetics

2019-09-26 Thread Paul B Mahol
applied

On 9/20/19, Andreas Rheinhardt  wrote:
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/pcm.c | 28 ++--
>  1 file changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c
> index d9176732d9..83850cc793 100644
> --- a/libavcodec/pcm.c
> +++ b/libavcodec/pcm.c
> @@ -300,23 +300,23 @@ static av_cold int pcm_decode_close(AVCodecContext
> *avctx)
>   * @param shift  Bitshift (bits)
>   * @param offset Sample value offset
>   */
> -#define DECODE(size, endian, src, dst, n, shift, offset)\
> -for (; n > 0; n--) {\
> -uint ## size ## _t v = bytestream_get_ ## endian(&src); \
> -AV_WN ## size ## A(dst, (uint ## size ## _t)(v - offset) << shift);
> \
> -dst += size / 8;\
> +#define DECODE(size, endian, src, dst, n, shift, offset)
>\
> +for (; n > 0; n--) {
>\
> +uint ## size ## _t v = bytestream_get_ ## endian(&src);
>\
> +AV_WN ## size ## A(dst, (uint ## size ## _t)(v - offset) << shift);
>\
> +dst += size / 8;
>\
>  }
>
> -#define DECODE_PLANAR(size, endian, src, dst, n, shift, offset) \
> -n /= avctx->channels;   \
> -for (c = 0; c < avctx->channels; c++) { \
> -int i;  \
> -dst = frame->extended_data[c];\
> -for (i = n; i > 0; i--) {   \
> -uint ## size ## _t v = bytestream_get_ ## endian(&src); \
> +#define DECODE_PLANAR(size, endian, src, dst, n, shift, offset)
>\
> +n /= avctx->channels;
>\
> +for (c = 0; c < avctx->channels; c++) {
>\
> +int i;
>\
> +dst = frame->extended_data[c];
>\
> +for (i = n; i > 0; i--) {
>\
> +uint ## size ## _t v = bytestream_get_ ## endian(&src);
>\
>  AV_WN ## size ## A(dst, (uint ## size ##_t)(v - offset) <<
> shift); \
> -dst += size / 8;\
> -}   \
> +dst += size / 8;
>\
> +}
>\
>  }
>
>  static int pcm_decode_frame(AVCodecContext *avctx, void *data,
> --
> 2.20.1
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v2] avcodec/hevc_ps: Remove dead code in vps_id check

2019-09-26 Thread Andriy Gelman
On Sun, 22. Sep 00:17, Andriy Gelman wrote:
> From: Andriy Gelman 
> 
> Since reading 4 bits always returns a value in the range [0, 15], the
> check for vps_id >= HEVC_MAX_VPS_COUNT, where HEVC_MAX_VPS_COUNT = 16, is 
> redundant.
> 
> Signed-off-by: Andriy Gelman 
> ---
>  libavcodec/hevc_ps.c | 8 
>  1 file changed, 8 deletions(-)
> 
> diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
> index abf08b919b..a30b8b8022 100644
> --- a/libavcodec/hevc_ps.c
> +++ b/libavcodec/hevc_ps.c
> @@ -448,10 +448,6 @@ int ff_hevc_decode_nal_vps(GetBitContext *gb, 
> AVCodecContext *avctx,
>  memcpy(vps->data, gb->buffer, vps->data_size);
>  
>  vps_id = get_bits(gb, 4);
> -if (vps_id >= HEVC_MAX_VPS_COUNT) {
> -av_log(avctx, AV_LOG_ERROR, "VPS id out of range: %d\n", vps_id);
> -goto err;
> -}
>  
>  if (get_bits(gb, 2) != 3) { // vps_reserved_three_2bits
>  av_log(avctx, AV_LOG_ERROR, "vps_reserved_three_2bits is not 
> three\n");
> @@ -883,10 +879,6 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, 
> unsigned int *sps_id,
>  // Coded parameters
>  
>  sps->vps_id = get_bits(gb, 4);
> -if (sps->vps_id >= HEVC_MAX_VPS_COUNT) {
> -av_log(avctx, AV_LOG_ERROR, "VPS id out of range: %d\n", 
> sps->vps_id);
> -return AVERROR_INVALIDDATA;
> -}
>  
>  if (vps_list && !vps_list[sps->vps_id]) {
>  av_log(avctx, AV_LOG_ERROR, "VPS %d does not exist\n",
> -- 
> 2.23.0
> 

ping

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 3/4] avcodec/sbcdec: Initilaize nubmer of channels

2019-09-26 Thread Paul B Mahol
lgtm

On 9/25/19, Michael Niedermayer  wrote:
> Fixes: out of array access
> Fixes:
> 17609/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SBC_fuzzer-5758729319874560
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/sbcdec.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/libavcodec/sbcdec.c b/libavcodec/sbcdec.c
> index 546b38c106..937946e2d2 100644
> --- a/libavcodec/sbcdec.c
> +++ b/libavcodec/sbcdec.c
> @@ -348,6 +348,7 @@ static int sbc_decode_frame(AVCodecContext *avctx,
>  if (frame_length <= 0)
>  return frame_length;
>
> +avctx->channels =
>  frame->channels = sbc->frame.channels;
>  frame->format = AV_SAMPLE_FMT_S16P;
>  frame->nb_samples = sbc->frame.blocks * sbc->frame.subbands;
> --
> 2.23.0
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 3/4] avcodec/sbcdec: Initilaize nubmer of channels

2019-09-26 Thread Paul B Mahol
please fix typo in commit message, nubmer

On 9/26/19, Paul B Mahol  wrote:
> lgtm
>
> On 9/25/19, Michael Niedermayer  wrote:
>> Fixes: out of array access
>> Fixes:
>> 17609/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SBC_fuzzer-5758729319874560
>>
>> Found-by: continuous fuzzing process
>> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
>> Signed-off-by: Michael Niedermayer 
>> ---
>>  libavcodec/sbcdec.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/libavcodec/sbcdec.c b/libavcodec/sbcdec.c
>> index 546b38c106..937946e2d2 100644
>> --- a/libavcodec/sbcdec.c
>> +++ b/libavcodec/sbcdec.c
>> @@ -348,6 +348,7 @@ static int sbc_decode_frame(AVCodecContext *avctx,
>>  if (frame_length <= 0)
>>  return frame_length;
>>
>> +avctx->channels =
>>  frame->channels = sbc->frame.channels;
>>  frame->format = AV_SAMPLE_FMT_S16P;
>>  frame->nb_samples = sbc->frame.blocks * sbc->frame.subbands;
>> --
>> 2.23.0
>>
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v4] doc/filters: add 4x4 layout example for xstack filter

2019-09-26 Thread Gyan



On 26-09-2019 12:22 PM, Limin Wang wrote:

On Wed, Sep 25, 2019 at 09:26:58PM +0530, Gyan wrote:

Ok, the formatting is fine except for one. See below.

On 25-09-2019 03:56 AM, lance.lmw...@gmail.com wrote:

From: Limin Wang 

Reviewed-by: Gyan 
Signed-off-by: Limin Wang 
---
  doc/filters.texi | 42 +-
  1 file changed, 41 insertions(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index e41384a..a8342c0 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -19057,6 +19057,13 @@ terminates. Default value is 0.
  @itemize
  @item
  Display 4 inputs into 2x2 grid.
+
+Below is the 4 inputs position:
+@example
+input1(0, 0)  | input3(w0, 0)
+input2(0, h0) | input4(w0, h0)
+@end example
+
  Note that if inputs are of different sizes unused gaps might appear,
  as not all of output video is used.
  @example
@@ -19065,6 +19072,12 @@ xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  @item
  Display 4 inputs into 1x4 grid.
+
+Below is the 4 inputs position:
+@example
+input1(0, 0) | input2(0, h0) | input3(0, h0+h1) | input4(0, h0+h1+h2)

Since this is 1 column x 4 rows, these should be different lines
without the separator.


+@end example
+
  Note that if inputs are of different sizes unused gaps might appear,
  as not all of output video is used.
  @example
@@ -19073,11 +19086,38 @@ xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  @item
  Display 9 inputs into 3x3 grid.
+
+Below is the 9 inputs position:
+@example
+input1(0, 0)   | input4(w0, 0)  | input7(w0+w1, 0)
+input2(0, h0)  | input5(w0, h0) | input8(w0+w1, h0)
+input3(0, h0+h1)   | input6(w0, h0+h1)  | input9(w0+w1, h0+h1)

Shouldn't the third column be at x = w0+w3? w1 is width of input2, right?


+@end example
+
  Note that if inputs are of different sizes unused gaps might appear,
  as not all of output video is used.
  @example
-xstack=inputs=9:layout=w3_0|w3_h0+h2|w3_h0|0_h4|0_0|w3+w1_0|0_h1+h2|w3+w1_h0|w3+w1_h1+h2
+xstack=inputs=9:layout=0_0|0_h0|0_h0+h1|w0_0|w0_h0|w0_h0+h1|w0+w1_0|w0+w1_h0|w0+w1_h0+h1
  @end example
+
+@item
+Display 16 inputs into 4x4 grid.
+
+Below is the 16 inputs position:
+@example
+input1(0, 0)   | input5(w0, 0)   | input9 (w0+w1, 0)   | 
input13(w0+w1+w2, 0)
+input2(0, h0)  | input6(w0, h0)  | input10(w0+w1, h0)  | 
input14(w0+w1+w2, h0)
+input3(0, h0+h1)   | input7(w0, h0+h1)   | input11(w0+w1, h0+h1)   | 
input15(w0+w1+w2, h0+h1)
+input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w1, h0+h1+h2)| 
input16(w0+w1+w2, h0+h1+h2)

Same as above.

You should also note that when videos are of different sizes, the
videos may overlap e.g. if height of input5 is greater than input1,
then input6 will be overlaid on top of part of input5.

I have tested with different width videos, it's better to same width for every 
column.
Please check my last update version, please ignore the first one, it's wrong 
version.
That's a user's choice but warn about the possibility of overlapping as 
well.


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] Ableton live aiff file

2019-09-26 Thread Adam Johnson
Carl pointed me at an 'abledecoder' repository he found on GitHub. I forked
it and added a very basic compile script that works on my machine (I'm not
a C(++) developer by day): https://github.com/adamchainz/abledecoder . The
decryption there works. It seems there's a key in one of the AIFF chunks
that can be used to decrypt the sound chunks. The key itself is encrypted
with another hardcoded key. The current code depends on OpenSSL's blowfish
implementation.

Not sure if this would be easy to merge into ffmpeg's AIFF decoder. But at
least I can solve my immediate problem.

On Thu, 26 Sep 2019 at 11:08, Paul B Mahol  wrote:

> On 9/20/19, Adam Johnson  wrote:
> > I have some aiff files in my music production library that I'd like to
> > convert to flac. However they aren't recognized by ffmpeg:
> >
> > $ ffmpeg -i Raylon-190-Full.aif
> > ...
> > [aiff @ 0x7fc3ce80] unknown or unsupported codec tag: able is not
> > implemented. Update your FFmpeg version to the newest one from Git. If
> the
> > problem still occurs, it means that your file has a feature which has not
> > been implemented.
> > [aiff @ 0x7fc3ce80] If you want to help, upload a sample of this file
> > to ftp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel
> mailing
> > list. (ffmpeg-devel@ffmpeg.org)
> > [aiff @ 0x7fc3ce80] could not find COMM tag or invalid block_align
> value
> > Raylon-190-Full.aif: Operation not permitted
> >
> > These files can only be decoded by Ableton Live. Quicktime, VLC, MPlayer,
> > and ffmpeg can't read them. I believe the 'able' tag is Ableton's
> > proprietary format. I know it's 24 bit but no more.
> >
> > I exported one through Ableton to a 44.1khz 24 bit wav and the filesize
> > comes out exactly the same so I know the format is not compressed. Also
> the
> > exported wav matches the waveform precisely since if I add it back  with
> > inverted phase I hear nothing.
> >
> > Here is a sample file, in aif format and wav format:
> >
> > https://files-adamj-eu.s3.amazonaws.com/ffmpeg-devel/Raylon-190-Full.aif
> > https://files-adamj-eu.s3.amazonaws.com/ffmpeg-devel/Raylon-190-Full.wav
> >
> > (I tried uploading to the ftp server as per debug message but couldn't
> > connect.)
> >
> > Thanks for any help reverse engineering this format!
>
> Looks like encrypted, need binary responsible for encryption.
>
> >
> > --
> > Adam
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".



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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] Ableton live aiff file

2019-09-26 Thread Paul B Mahol
On 9/20/19, Adam Johnson  wrote:
> I have some aiff files in my music production library that I'd like to
> convert to flac. However they aren't recognized by ffmpeg:
>
> $ ffmpeg -i Raylon-190-Full.aif
> ...
> [aiff @ 0x7fc3ce80] unknown or unsupported codec tag: able is not
> implemented. Update your FFmpeg version to the newest one from Git. If the
> problem still occurs, it means that your file has a feature which has not
> been implemented.
> [aiff @ 0x7fc3ce80] If you want to help, upload a sample of this file
> to ftp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing
> list. (ffmpeg-devel@ffmpeg.org)
> [aiff @ 0x7fc3ce80] could not find COMM tag or invalid block_align value
> Raylon-190-Full.aif: Operation not permitted
>
> These files can only be decoded by Ableton Live. Quicktime, VLC, MPlayer,
> and ffmpeg can't read them. I believe the 'able' tag is Ableton's
> proprietary format. I know it's 24 bit but no more.
>
> I exported one through Ableton to a 44.1khz 24 bit wav and the filesize
> comes out exactly the same so I know the format is not compressed. Also the
> exported wav matches the waveform precisely since if I add it back  with
> inverted phase I hear nothing.
>
> Here is a sample file, in aif format and wav format:
>
> https://files-adamj-eu.s3.amazonaws.com/ffmpeg-devel/Raylon-190-Full.aif
> https://files-adamj-eu.s3.amazonaws.com/ffmpeg-devel/Raylon-190-Full.wav
>
> (I tried uploading to the ftp server as per debug message but couldn't
> connect.)
>
> Thanks for any help reverse engineering this format!

Looks like encrypted, need binary responsible for encryption.

>
> --
> Adam
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 11/12] avcodec/loco: Check for end of input in the first line

2019-09-26 Thread Paul B Mahol
lgtm

On 9/25/19, Michael Niedermayer  wrote:
> Fixes: Timeout (85sec -> 0.1sec)
> Fixes:
> 17634/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LOCO_fuzzer-5666410809786368
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/loco.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/libavcodec/loco.c b/libavcodec/loco.c
> index d8bf68a100..e891d83ece 100644
> --- a/libavcodec/loco.c
> +++ b/libavcodec/loco.c
> @@ -155,6 +155,8 @@ static int loco_decode_plane(LOCOContext *l, uint8_t
> *data, int width, int heigh
>  /* restore top line */
>  for (i = 1; i < width; i++) {
>  val = loco_get_rice(&rc);
> +if (val == INT_MIN)
> +   return AVERROR_INVALIDDATA;
>  data[i] = data[i - 1] + val;
>  }
>  data += stride;
> --
> 2.23.0
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 12/12] avcodec/4xm: Check index in decode_i_block() also in the path where its not used.

2019-09-26 Thread Paul B Mahol
lgtm

On 9/25/19, Michael Niedermayer  wrote:
> Fixes: Infinite loop
> Fixes: signed integer overflow: 2147483644 + 16 cannot be represented in
> type 'int'
> Fixes:
> 16169/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FOURXM_fuzzer-5662570416963584
> Fixes:
> 16782/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FOURXM_fuzzer-5743163859271680
> Fixes:
> 17641/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FOURXM_fuzzer-5711603562971136
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/4xm.c | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c
> index 1f4e2aee24..336c651d31 100644
> --- a/libavcodec/4xm.c
> +++ b/libavcodec/4xm.c
> @@ -525,6 +525,10 @@ static int decode_i_block(FourXContext *f, int16_t
> *block)
>  break;
>  if (code == 0xf0) {
>  i += 16;
> +if (i >= 64) {
> +av_log(f->avctx, AV_LOG_ERROR, "run %d overflow\n", i);
> +return 0;
> +}
>  } else {
>  if (code & 0xf) {
>  level = get_xbits(&f->gb, code & 0xf);
> --
> 2.23.0
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 09/12] avcodec/pafvideo: Only clear frame when it was written to

2019-09-26 Thread Paul B Mahol
Why this does not set dirty for all decoding cases?

On 9/25/19, Michael Niedermayer  wrote:
> This avoids unneeded operations and makes the code faster.
>
> Fixes: Timeout
> Fixes:
> 15724/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PAF_VIDEO_fuzzer-5750842205929472
> (12sec -> 9sec)
> Fixes:
> 17625/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PAF_VIDEO_fuzzer-5640515311108096
> (16sec -> 4sec)
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/pafvideo.c | 10 --
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/pafvideo.c b/libavcodec/pafvideo.c
> index 6b4771cbce..07fa05caf8 100644
> --- a/libavcodec/pafvideo.c
> +++ b/libavcodec/pafvideo.c
> @@ -55,6 +55,7 @@ typedef struct PAFVideoDecContext {
>
>  int current_frame;
>  uint8_t *frame[4];
> +int dirty[4];
>  int frame_size;
>  int video_size;
>
> @@ -187,6 +188,7 @@ static int decode_0(PAFVideoDecContext *c, uint8_t *pkt,
> uint8_t code)
>  j  = bytestream2_get_le16(&c->gb) + offset;
>  if (bytestream2_get_bytes_left(&c->gb) < (j - offset) * 16)
>  return AVERROR_INVALIDDATA;
> +c->dirty[page] = 1;
>  do {
>  offset++;
>  if (dst + 3 * c->width + 4 > dend)
> @@ -329,9 +331,13 @@ static int paf_video_decode(AVCodecContext *avctx, void
> *data,
>  c->pic->palette_has_changed = 1;
>  }
>
> +c->dirty[c->current_frame] = 1;
>  if (code & 0x20)
> -for (i = 0; i < 4; i++)
> -memset(c->frame[i], 0, c->frame_size);
> +for (i = 0; i < 4; i++) {
> +if (c->dirty[i])
> +memset(c->frame[i], 0, c->frame_size);
> +c->dirty[i] = 0;
> +}
>
>  switch (code & 0x0F) {
>  case 0:
> --
> 2.23.0
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 01/12] avcodec/wmaprodec: get frame during frame decode

2019-09-26 Thread Paul B Mahol
bettter add init cleanup?

On 9/25/19, Michael Niedermayer  wrote:
> Fixes: memleak
> Fixes:
> 17615/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XMA2_fuzzer-5681306024804352
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/wmaprodec.c | 10 ++
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
> index d0fa974c80..5ff26e907d 100644
> --- a/libavcodec/wmaprodec.c
> +++ b/libavcodec/wmaprodec.c
> @@ -1793,6 +1793,12 @@ static int xma_decode_packet(AVCodecContext *avctx,
> void *data,
>  AVFrame *frame = data;
>  int i, ret, offset = INT_MAX;
>
> +if (!s->frames[s->current_stream]->data[0]) {
> +s->frames[s->current_stream]->nb_samples = 512;
> +if ((ret = ff_get_buffer(avctx, s->frames[s->current_stream], 0)) <
> 0) {
> +return ret;
> +}
> +}
>  /* decode current stream packet */
>  ret = decode_packet(avctx, &s->xma[s->current_stream],
> s->frames[s->current_stream],
>  &got_stream_frame_ptr, avpkt);
> @@ -1915,10 +1921,6 @@ static av_cold int xma_decode_init(AVCodecContext
> *avctx)
>  s->frames[i] = av_frame_alloc();
>  if (!s->frames[i])
>  return AVERROR(ENOMEM);
> -s->frames[i]->nb_samples = 512;
> -if ((ret = ff_get_buffer(avctx, s->frames[i], 0)) < 0) {
> -return AVERROR(ENOMEM);
> -}
>
>  s->start_channel[i] = start_channels;
>  start_channels += s->xma[i].nb_channels;
> --
> 2.23.0
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 08/12] avcodec/atrac3: Check block_align

2019-09-26 Thread Paul B Mahol
lgtm

On 9/25/19, Michael Niedermayer  wrote:
> Fixes: Infinite loop
> Fixes:
> 17620/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ATRAC3_fuzzer-5086123012915200
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/atrac3.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c
> index 6cdcdf1964..dc19a3863e 100644
> --- a/libavcodec/atrac3.c
> +++ b/libavcodec/atrac3.c
> @@ -964,7 +964,7 @@ static av_cold int atrac3_decode_init(AVCodecContext
> *avctx)
>  return AVERROR_INVALIDDATA;
>  }
>
> -if (avctx->block_align >= UINT_MAX / 2)
> +if (avctx->block_align >= UINT_MAX / 2 || avctx->block_align <= 0)
>  return AVERROR(EINVAL);
>
>  q->decoded_bytes_buffer = av_mallocz(FFALIGN(avctx->block_align, 4) +
> --
> 2.23.0
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 05/12] avcodec/alsdec: Avoid dereferencing context pointer in inner interleave loop

2019-09-26 Thread Paul B Mahol
lgtm

On 9/25/19, Michael Niedermayer  wrote:
> This makes the decoder faster
>
> Improves/Fixes: Timeout (22sec -> 20sec)
> Testcase:
> 17619/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5078510820917248
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/alsdec.c | 10 ++
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
> index a53c170d18..56313d206c 100644
> --- a/libavcodec/alsdec.c
> +++ b/libavcodec/alsdec.c
> @@ -1815,15 +1815,17 @@ static int decode_frame(AVCodecContext *avctx, void
> *data, int *got_frame_ptr,
>  #define INTERLEAVE_OUTPUT(bps)
>  \
>  {
>  \
>  int##bps##_t *dest = (int##bps##_t*)frame->data[0];
>  \
> +int channels = avctx->channels;
>  \
> +int32_t **raw_samples = ctx->raw_samples;
>  \
>  shift = bps - ctx->avctx->bits_per_raw_sample;
>  \
>  if (!ctx->cs_switch) {
>  \
>  for (sample = 0; sample < ctx->cur_frame_length; sample++)
>  \
> -for (c = 0; c < avctx->channels; c++)
>  \
> -*dest++ = ctx->raw_samples[c][sample] * (1U << shift);
>   \
> +for (c = 0; c < channels; c++)
>  \
> +*dest++ = raw_samples[c][sample] * (1U << shift);
>  \
>  } else {
>  \
>  for (sample = 0; sample < ctx->cur_frame_length; sample++)
>  \
> -for (c = 0; c < avctx->channels; c++)
>  \
> -*dest++ = ctx->raw_samples[sconf->chan_pos[c]][sample]
> * (1U << shift); \
> +for (c = 0; c < channels; c++)
>  \
> +*dest++ = raw_samples[sconf->chan_pos[c]][sample] * (1U
> << shift);\
>  }
>  \
>  }
>
> --
> 2.23.0
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 06/12] tools/target_dec_fuzzer: Check number of all samples decoded too, like max pixels

2019-09-26 Thread Paul B Mahol
lgtm

On 9/25/19, Michael Niedermayer  wrote:
> Signed-off-by: Michael Niedermayer 
> ---
>  tools/target_dec_fuzzer.c | 7 +++
>  1 file changed, 7 insertions(+)
>
> diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
> index 0dc1854738..6c670d8eb9 100644
> --- a/tools/target_dec_fuzzer.c
> +++ b/tools/target_dec_fuzzer.c
> @@ -94,6 +94,7 @@ const uint64_t maxpixels_per_frame = 4096 * 4096;
>  uint64_t maxpixels;
>
>  const uint64_t maxsamples_per_frame = 256*1024*32;
> +uint64_t maxsamples;
>
>  static const uint64_t FUZZ_TAG = 0x4741542D5A5A5546ULL;
>
> @@ -103,6 +104,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t
> size) {
>  const uint8_t *end = data + size;
>  uint32_t it = 0;
>  uint64_t ec_pixels = 0;
> +uint64_t nb_samples = 0;
>  int (*decode_handler)(AVCodecContext *avctx, AVFrame *picture,
>int *got_picture_ptr,
>const AVPacket *avpkt) = NULL;
> @@ -131,6 +133,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t
> size) {
>  case AVMEDIA_TYPE_SUBTITLE: decode_handler = subtitle_handler ;
> break;
>  }
>  maxpixels = maxpixels_per_frame * maxiteration;
> +maxsamples = maxsamples_per_frame * maxiteration;
>  switch (c->id) {
>  // Allows a small input to generate gigantic output
>  case AV_CODEC_ID_BINKVIDEO: maxpixels /= 32; break;
> @@ -269,6 +272,10 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t
> size) {
>  if (ec_pixels > maxpixels)
>  goto maximums_reached;
>
> +nb_samples += frame->nb_samples;
> +if (nb_samples > maxsamples)
> +goto maximums_reached;
> +
>  if (ret <= 0 || ret > avpkt.size)
> break;
>  if (ctx->codec_type != AVMEDIA_TYPE_AUDIO)
> --
> 2.23.0
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 04/12] avcodec/hcom: Check that there are dictionary entries

2019-09-26 Thread Paul B Mahol
lgtm

On 9/25/19, Michael Niedermayer  wrote:
> Fixes: out of array read
> Fixes:
> 17617/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HCOM_fuzzer-5674970478280704
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/hcom.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/hcom.c b/libavcodec/hcom.c
> index bce9e80aa5..0559b050c3 100644
> --- a/libavcodec/hcom.c
> +++ b/libavcodec/hcom.c
> @@ -52,7 +52,8 @@ static av_cold int hcom_init(AVCodecContext *avctx)
>  if (avctx->extradata_size <= 7)
>  return AVERROR_INVALIDDATA;
>  s->dict_entries = AV_RB16(avctx->extradata);
> -if (avctx->extradata_size < s->dict_entries * 4 + 7)
> +if (avctx->extradata_size < s->dict_entries * 4 + 7 ||
> +s->dict_entries == 0)
>  return AVERROR_INVALIDDATA;
>  s->delta_compression = AV_RB32(avctx->extradata + 2);
>  s->sample = s->first_sample = avctx->extradata[avctx->extradata_size -
> 1];
> --
> 2.23.0
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 07/12] tools/target_dec_fuzzer: Print samples decoded like pixels

2019-09-26 Thread Paul B Mahol
lgtm

On 9/25/19, Michael Niedermayer  wrote:
> Signed-off-by: Michael Niedermayer 
> ---
>  tools/target_dec_fuzzer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
> index 6c670d8eb9..4af7b26e54 100644
> --- a/tools/target_dec_fuzzer.c
> +++ b/tools/target_dec_fuzzer.c
> @@ -297,7 +297,7 @@ maximums_reached:
>  decode_handler(ctx, frame, &got_frame, &avpkt);
>  } while (got_frame == 1 && it++ < maxiteration);
>
> -fprintf(stderr, "pixels decoded: %"PRId64", iterations: %d\n",
> ec_pixels, it);
> +fprintf(stderr, "pixels decoded: %"PRId64", samples decoded: %"PRId64",
> iterations: %d\n", ec_pixels, nb_samples, it);
>
>  av_frame_free(&frame);
>  avcodec_free_context(&ctx);
> --
> 2.23.0
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 03/12] avcodec/fitsdec: Prevent division by 0 with huge data_max

2019-09-26 Thread Paul B Mahol
lgtm

On 9/25/19, Michael Niedermayer  wrote:
> Fixes: division by 0
> Fixes:
> 15657/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FITS_fuzzer-5738154838982656
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/fitsdec.c | 9 -
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/fitsdec.c b/libavcodec/fitsdec.c
> index 4f452422ef..88b841a964 100644
> --- a/libavcodec/fitsdec.c
> +++ b/libavcodec/fitsdec.c
> @@ -195,6 +195,7 @@ static int fits_decode_frame(AVCodecContext *avctx, void
> *data, int *got_frame,
>  uint8_t *dst8;
>  uint16_t *dst16;
>  uint64_t t;
> +double scale;
>  FITSHeader header;
>  FITSContext * fitsctx = avctx->priv_data;
>
> @@ -204,6 +205,12 @@ static int fits_decode_frame(AVCodecContext *avctx,
> void *data, int *got_frame,
>  if (ret < 0)
>  return ret;
>
> +scale = header.data_max - header.data_min;
> +if (scale <= 0 || !isfinite(scale)) {
> +scale = 1;
> +}
> +scale = 1/scale;
> +
>  if (header.rgb) {
>  if (header.bitpix == 8) {
>  if (header.naxisn[2] == 3) {
> @@ -272,7 +279,7 @@ static int fits_decode_frame(AVCodecContext *avctx, void
> *data, int *got_frame,
>  for (j = 0; j < avctx->width; j++) { \
>  t = rd; \
>  if (!header.blank_found || t != header.blank) { \
> -*dst++ = ((t - header.data_min) * ((1 << (sizeof(type)
> * 8)) - 1)) / (header.data_max - header.data_min); \
> +*dst++ = ((t - header.data_min) * ((1 << (sizeof(type)
> * 8)) - 1)) * scale; \
>  } else { \
>  *dst++ = fitsctx->blank_val; \
>  } \
> --
> 2.23.0
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 02/12] avcodec/dstdec: Fix integer overflow in samples_per_frame computation

2019-09-26 Thread Paul B Mahol
lgtm

On 9/25/19, Michael Niedermayer  wrote:
> Fixes: Timeout (? -> 2ms)
> Fixes:
> 17616/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DST_fuzzer-5198057947267072
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/dstdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/dstdec.c b/libavcodec/dstdec.c
> index 0614c99c4b..8a1bc6a738 100644
> --- a/libavcodec/dstdec.c
> +++ b/libavcodec/dstdec.c
> @@ -37,7 +37,7 @@
>  #define DST_MAX_CHANNELS 6
>  #define DST_MAX_ELEMENTS (2 * DST_MAX_CHANNELS)
>
> -#define DSD_FS44(sample_rate) (sample_rate * 8 / 44100)
> +#define DSD_FS44(sample_rate) (sample_rate * 8LL / 44100)
>
>  #define DST_SAMPLES_PER_FRAME(sample_rate) (588 * DSD_FS44(sample_rate))
>
> --
> 2.23.0
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 01/15] avutil/common: Add macro for left-shifting

2019-09-26 Thread Michael Niedermayer
On Wed, Sep 25, 2019 at 12:02:56AM +0200, Andreas Rheinhardt wrote:
> Left shifting a negative integer is undefined, yet often needed.
> Therefore add a macro that internally uses multiplication by powers of
> two to make it clear that a shift is intended.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
> I don't insist on this macro. I only added it so that one can easily see
> that shifting was intended. I initially wanted to use "FFLS", but
> eventually chose FFLSHIFT because it is self-explanatory.
> 
>  libavutil/common.h | 8 
>  1 file changed, 8 insertions(+)
> 
> diff --git a/libavutil/common.h b/libavutil/common.h
> index af35397eb9..93c5dd0af7 100644
> --- a/libavutil/common.h
> +++ b/libavutil/common.h
> @@ -60,6 +60,14 @@
>  /* Backwards compat. */
>  #define FF_CEIL_RSHIFT AV_CEIL_RSHIFT
>  
> +/**
> + * Left shift macro designed to tackle the undefinedness
> + * of left-shifting negative numbers.
> + *
> + * Note: Still undefined if the multiplication overflows.
> + */
> +#define FFLSHIFT(a,b) ((a) * (1 << (b)))

with 
a * (1 << b)
everyone knows what it does even if one doesnt know why its done that way

with 
FFLSHIFT(a, b)
only people who looked up the macro know what it does and why.

so iam a bit sceptic that this is a good idea.

thx

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

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v5] doc/filters: add 4x4 layout example for xstack filter

2019-09-26 Thread lance . lmwang
From: Limin Wang 

Reviewed-by: Gyan 
Signed-off-by: Limin Wang 
---
 doc/filters.texi | 45 -
 1 file changed, 44 insertions(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index d0fdf957af..a53f572e10 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -19092,6 +19092,13 @@ terminates. Default value is 0.
 @itemize
 @item
 Display 4 inputs into 2x2 grid.
+
+Below is the 4 inputs position:
+@example
+input1(0, 0)  | input3(w0, 0)
+input2(0, h0) | input4(w0, h0)
+@end example
+
 Note that if inputs are of different sizes unused gaps might appear,
 as not all of output video is used.
 @example
@@ -19100,6 +19107,15 @@ xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
 
 @item
 Display 4 inputs into 1x4 grid.
+
+Below is the 4 inputs position:
+@example
+input1(0, 0)
+input2(0, h0)
+input3(0, h0+h1)
+input4(0, h0+h1+h2)
+@end example
+
 Note that if inputs are of different sizes unused gaps might appear,
 as not all of output video is used.
 @example
@@ -19108,11 +19124,38 @@ xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
 
 @item
 Display 9 inputs into 3x3 grid.
+
+Below is the 9 inputs position:
+@example
+input1(0, 0)   | input4(w0, 0)  | input7(w0+w3, 0)
+input2(0, h0)  | input5(w0, h0) | input8(w0+w3, h0)
+input3(0, h0+h1)   | input6(w0, h0+h1)  | input9(w0+w3, h0+h1)
+@end example
+
 Note that if inputs are of different sizes unused gaps might appear,
 as not all of output video is used.
 @example
-xstack=inputs=9:layout=w3_0|w3_h0+h2|w3_h0|0_h4|0_0|w3+w1_0|0_h1+h2|w3+w1_h0|w3+w1_h1+h2
+xstack=inputs=9:layout=0_0|0_h0|0_h0+h1|w0_0|w0_h0|w0_h0+h1|w0+w3_0|w0+w3_h0|w0+w3_h0+h1
 @end example
+
+@item
+Display 16 inputs into 4x4 grid.
+
+Below is the 16 inputs position:
+@example
+input1(0, 0)   | input5(w0, 0)   | input9 (w0+w4, 0)   | 
input13(w0+w4+w8, 0)
+input2(0, h0)  | input6(w0, h0)  | input10(w0+w4, h0)  | 
input14(w0+w4+w8, h0)
+input3(0, h0+h1)   | input7(w0, h0+h1)   | input11(w0+w4, h0+h1)   | 
input15(w0+w4+w8, h0+h1)
+input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| 
input16(w0+w4+w8, h0+h1+h2)
+@end example
+
+Note that if inputs are of different sizes unused gaps might appear,
+as not all of output video is used.
+@example
+xstack=inputs=16:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2|w0_0|w0_h0|w0_h0+h1|w0_h0+h1+h2|w0+w4_0|
+w0+w4_h0|w0+w4_h0+h1|w0+w4_h0+h1+h2|w0+w4+w8_0|w0+w4+w8_h0|w0+w4+w8_h0+h1|w0+w4+w8_h0+h1+h2
+@end example
+
 @end itemize
 
 @anchor{yadif}
-- 
2.21.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] avcodec/tiff: Try to fix subsampling default

2019-09-26 Thread Michael Niedermayer
This ensures the default ycbcr_subsampling is 2 while also
ensuring the subsampling values are correct for all pixel formats.
This solution while it takes a few lines more code should be more
robust

Found-by: Skakov Pavel 
Signed-off-by: Michael Niedermayer 
---
 libavcodec/tiff.c | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 9f24796a88..13a38bd64f 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -74,6 +74,7 @@ typedef struct TiffContext {
 enum TiffPhotometric photometric;
 int planar;
 int subsampling[2];
+int ycbcr_subsampling[2];
 int fax_opts;
 int predictor;
 int fill_order;
@@ -1101,6 +1102,8 @@ static int init_image(TiffContext *s, ThreadFrame *frame)
 break;
 case 243:
 if (s->photometric == TIFF_PHOTOMETRIC_YCBCR) {
+s->subsampling[0] = s->ycbcr_subsampling[0];
+s->subsampling[1] = s->ycbcr_subsampling[1];
 if (s->subsampling[0] == 1 && s->subsampling[1] == 1) {
 s->avctx->pix_fmt = AV_PIX_FMT_YUV444P;
 } else if (s->subsampling[0] == 2 && s->subsampling[1] == 1) {
@@ -1511,10 +1514,10 @@ static int tiff_decode_tag(TiffContext *s, AVFrame 
*frame)
 return AVERROR_INVALIDDATA;
 }
 for (i = 0; i < count; i++) {
-s->subsampling[i] = ff_tget(&s->gb, type, s->le);
-if (s->subsampling[i] <= 0) {
-av_log(s->avctx, AV_LOG_ERROR, "subsampling %d is invalid\n", 
s->subsampling[i]);
-s->subsampling[i] = 1;
+s->ycbcr_subsampling[i] = ff_tget(&s->gb, type, s->le);
+if (s->ycbcr_subsampling[i] <= 0) {
+av_log(s->avctx, AV_LOG_ERROR, "subsampling %d is invalid\n", 
s->ycbcr_subsampling[i]);
+s->ycbcr_subsampling[i] = 1;
 return AVERROR_INVALIDDATA;
 }
 }
@@ -2066,6 +2069,8 @@ static av_cold int tiff_init(AVCodecContext *avctx)
 s->height = 0;
 s->subsampling[0] =
 s->subsampling[1] = 1;
+s->ycbcr_subsampling[0] = 2;
+s->ycbcr_subsampling[1] = 2;
 s->avctx  = avctx;
 ff_lzw_decode_open(&s->lzw);
 if (!s->lzw)
-- 
2.23.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".