Re: [FFmpeg-devel] [PATCH 21/23] dnn/dnn_backend_native_layer_conv2d: Don't pretend convolution can fail

2021-03-10 Thread Guo, Yejun


> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Andreas Rheinhardt
> Sent: 2021年3月11日 5:55
> To: ffmpeg-devel@ffmpeg.org
> Cc: Andreas Rheinhardt 
> Subject: [FFmpeg-devel] [PATCH 21/23]
> dnn/dnn_backend_native_layer_conv2d: Don't pretend convolution can fail
> 
> It can't; these are just remnants of commit
> 3c7cad69f233252e5178f7732baa0da950d74bbd which let the worker threads
> do the reallocation.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavfilter/dnn/dnn_backend_native_layer_conv2d.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> index 44e5bdb5f7..f7f1ef9b6b 100644
> --- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> +++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> @@ -180,7 +180,7 @@ static void * dnn_execute_layer_conv2d_thread(void
> *threadarg)
>  output += conv_params->output_num;
>  }
>  }
> -return (void *)DNN_SUCCESS;
> +return NULL;
>  }
> 
> 
> @@ -244,7 +244,6 @@ int ff_dnn_execute_layer_conv2d(DnnOperand
> *operands, const int32_t *input_opera
>  }
>  }
> 
> -//join threads, res gets function return
>  for (int i = 0; i < thread_num; i++){
>  pthread_join(thread_param[i].thread, NULL);
>  }
> --


LGTM, 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 20/23] dnn/dnn_backend_native_layer_conv2d: Check thread creation for errors

2021-03-10 Thread Guo, Yejun


> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Andreas Rheinhardt
> Sent: 2021年3月11日 5:55
> To: ffmpeg-devel@ffmpeg.org
> Cc: Andreas Rheinhardt 
> Subject: [FFmpeg-devel] [PATCH 20/23]
> dnn/dnn_backend_native_layer_conv2d: Check thread creation for errors
> 
> Fixes Coverity issue #1473533.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavfilter/dnn/dnn_backend_native_layer_conv2d.c | 13 ++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> index 941330c895..44e5bdb5f7 100644
> --- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> +++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> @@ -190,7 +190,7 @@ int ff_dnn_execute_layer_conv2d(DnnOperand
> *operands, const int32_t *input_opera  #if HAVE_PTHREAD_CANCEL
>  int thread_num = (ctx->options.conv2d_threads <= 0 ||
> ctx->options.conv2d_threads > av_cpu_count())
>  ? (av_cpu_count() + 1) : (ctx->options.conv2d_threads);
> -int thread_stride;
> +int ret = DNN_SUCCESS, thread_stride;
>  ThreadParam *thread_param;
>  #else
>  ThreadParam thread_param = { 0 };
> @@ -236,7 +236,12 @@ int ff_dnn_execute_layer_conv2d(DnnOperand
> *operands, const int32_t *input_opera
>  thread_param[i].thread_common_param =
> _common_param;
>  thread_param[i].thread_start = thread_stride * i + pad_size;
>  thread_param[i].thread_end = (i == thread_num - 1) ? (height -
> pad_size) : (thread_param[i].thread_start + thread_stride);
> -pthread_create(_param[i].thread, NULL,
> dnn_execute_layer_conv2d_thread, _param[i]);
> +if (pthread_create(_param[i].thread, NULL,
> +   dnn_execute_layer_conv2d_thread,
> _param[i])) {
> +thread_num = i;
> +ret = DNN_ERROR;
> +break;
> +}
>  }
> 
>  //join threads, res gets function return @@ -246,12 +251,14 @@ int
> ff_dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t
> *input_opera
> 
>  //release memory
>  av_free(thread_param);
> +
> +return ret;
>  #else
>  thread_param.thread_common_param = _common_param;
>  thread_param.thread_start = pad_size;
>  thread_param.thread_end = height - pad_size;
>  dnn_execute_layer_conv2d_thread(_param);
> -#endif
> 
>  return DNN_SUCCESS;
> +#endif
>  }
> --
LGTM, 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] avcodec/h264_slice: don't copy frame data during error concealment

2021-03-10 Thread Xu, Guangxin
> -Original Message-
> From: ffmpeg-devel  On Behalf Of Xu,
> Guangxin
> Sent: Tuesday, March 9, 2021 5:13 PM
> To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH] avcodec/h264_slice: don't copy frame
> data during error concealment
> 
> We will test vaapi for this patch.
> 
> But I am more curious about the software decoder behaviors.
> This approach just ref the yuv. Not the intermedia data(like mv,  macroblock
> type) Will it have problem if missed frame selected as colPic (Figure 8-2 in
> spec).
> 
It's no regression for from ffmpeg vaapi. 
And it will fix following frame gap clips for vaapi
MR3_TANDBERG_B 
MR4_TANDBERG_C
MR5_TANDBERG_C
___
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 19/23] dnn/dnn_backend_native_layer_conv2d: Check allocation

2021-03-10 Thread Guo, Yejun


> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Andreas Rheinhardt
> Sent: 2021年3月11日 5:55
> To: ffmpeg-devel@ffmpeg.org
> Cc: Andreas Rheinhardt 
> Subject: [FFmpeg-devel] [PATCH 19/23]
> dnn/dnn_backend_native_layer_conv2d: Check allocation
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
> Why does DNN actually not use the ordinary error codes?

DNN_ERROR/DNN_SUCCESS is introduced at the very beginning,
@Pedro any comment if we need to revisit the error code? thanks.

> 
>  libavfilter/dnn/dnn_backend_native_layer_conv2d.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> index 94a07c1fdb..941330c895 100644
> --- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> +++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> @@ -228,6 +228,8 @@ int ff_dnn_execute_layer_conv2d(DnnOperand
> *operands, const int32_t *input_opera
> 
>  #if HAVE_PTHREAD_CANCEL
>  thread_param = av_calloc(thread_num, sizeof(*thread_param));
> +if (!thread_param)
> +return DNN_ERROR;

LGTM, 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 18/23] dnn/dnn_backend_native_layer_conv2d: Avoid separate, unchecked allocations

2021-03-10 Thread Guo, Yejun


> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Andreas Rheinhardt
> Sent: 2021年3月11日 5:55
> To: ffmpeg-devel@ffmpeg.org
> Cc: Andreas Rheinhardt 
> Subject: [FFmpeg-devel] [PATCH 18/23]
> dnn/dnn_backend_native_layer_conv2d: Avoid separate, unchecked
> allocations
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  .../dnn/dnn_backend_native_layer_conv2d.c| 16 ++--
>  1 file changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> index c2073a02de..94a07c1fdb 100644
> --- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> +++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> @@ -191,7 +191,7 @@ int ff_dnn_execute_layer_conv2d(DnnOperand
> *operands, const int32_t *input_opera
>  int thread_num = (ctx->options.conv2d_threads <= 0 ||
> ctx->options.conv2d_threads > av_cpu_count())
>  ? (av_cpu_count() + 1) : (ctx->options.conv2d_threads);
>  int thread_stride;
> -ThreadParam **thread_param;
> +ThreadParam *thread_param;
>  #else
>  ThreadParam thread_param = { 0 };
>  #endif
> @@ -231,22 +231,18 @@ int ff_dnn_execute_layer_conv2d(DnnOperand
> *operands, const int32_t *input_opera
>  thread_stride = (height - pad_size * 2) / thread_num;
>  //create threads
>  for (int i = 0; i < thread_num; i++){
> -thread_param[i] = av_malloc(sizeof(*thread_param[0]));
> -thread_param[i]->thread_common_param =
> _common_param;
> -thread_param[i]->thread_start = thread_stride * i + pad_size;
> -thread_param[i]->thread_end = (i == thread_num - 1) ? (height -
> pad_size) : (thread_param[i]->thread_start + thread_stride);
> -pthread_create(_param[i]->thread, NULL,
> dnn_execute_layer_conv2d_thread, (void *)thread_param[i]);
> +thread_param[i].thread_common_param =
> _common_param;
> +thread_param[i].thread_start = thread_stride * i + pad_size;
> +thread_param[i].thread_end = (i == thread_num - 1) ? (height -
> pad_size) : (thread_param[i].thread_start + thread_stride);
> +pthread_create(_param[i].thread, NULL,
> + dnn_execute_layer_conv2d_thread, _param[i]);
>  }
> 
>  //join threads, res gets function return
>  for (int i = 0; i < thread_num; i++){
> -pthread_join(thread_param[i]->thread, NULL);
> +pthread_join(thread_param[i].thread, NULL);
>  }
> 
>  //release memory
> -for (int i = 0; i < thread_num; i++){
> -av_freep(_param[i]);
> -}
>  av_free(thread_param);
>  #else
>  thread_param.thread_common_param = _common_param;
> --

LGTM, 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 17/23] dnn/dnn_backend_native_layer_conv2d: Fix memleak on error

2021-03-10 Thread Guo, Yejun


> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Andreas Rheinhardt
> Sent: 2021年3月11日 5:55
> To: ffmpeg-devel@ffmpeg.org
> Cc: Andreas Rheinhardt 
> Subject: [FFmpeg-devel] [PATCH 17/23]
> dnn/dnn_backend_native_layer_conv2d: Fix memleak on error
> 
> If an error happens when preparing the output data buffer, an already
> allocated array would leak. Fix this by postponing its allocation.
> Also zero-allocate the allocated array for safety.
> 
> Fixes Coverity issue #1473531.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavfilter/dnn/dnn_backend_native_layer_conv2d.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> index cdf65974b6..c2073a02de 100644
> --- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> +++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> @@ -191,7 +191,7 @@ int ff_dnn_execute_layer_conv2d(DnnOperand
> *operands, const int32_t *input_opera
>  int thread_num = (ctx->options.conv2d_threads <= 0 ||
> ctx->options.conv2d_threads > av_cpu_count())
>  ? (av_cpu_count() + 1) : (ctx->options.conv2d_threads);
>  int thread_stride;
> -ThreadParam **thread_param = av_malloc_array(thread_num,
> sizeof(*thread_param));
> +ThreadParam **thread_param;
>  #else
>  ThreadParam thread_param = { 0 };
>  #endif
> @@ -227,6 +227,7 @@ int ff_dnn_execute_layer_conv2d(DnnOperand
> *operands, const int32_t *input_opera
>  thread_common_param.ctx = ctx;
> 
>  #if HAVE_PTHREAD_CANCEL
> +thread_param = av_calloc(thread_num, sizeof(*thread_param));

Just think the zero-allocation is not needed, others LGTM.

Also notice that the original code does not check the return value, it is
handled by latter patches in the patch set.

>  thread_stride = (height - pad_size * 2) / thread_num;
>  //create threads
>  for (int i = 0; i < thread_num; i++){
> --
> 2.27.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 v7 3/8] libavutil/hwcontext_qsv: enabling d3d11va usage by default, add usage child_device_type argument

2021-03-10 Thread Soft Works


> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Soft Works
> Sent: Thursday, February 25, 2021 8:50 PM
> To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> Cc: Artem Galin 
> Subject: Re: [FFmpeg-devel] [PATCH v7 3/8] libavutil/hwcontext_qsv:
> enabling d3d11va usage by default, add usage child_device_type argument
> 
> 
> 
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of
> > Artem Galin
> > Sent: Tuesday, November 3, 2020 7:46 PM
> > To: ffmpeg-devel@ffmpeg.org
> > Cc: Artem Galin 
> > Subject: [FFmpeg-devel] [PATCH v7 3/8] libavutil/hwcontext_qsv:
> > enabling d3d11va usage by default, add usage child_device_type
> > argument
> >
> > Makes selection of d3d11va device type by default and over DirectX 9,
> > which might break users with older drivers/systems.
> > DCH driver with Gen6th support should be still fine.
> >
> > Decode, encode, transcode have been validated.
> >
> > child_device_type option is responsible for d3d11va/dxva2 device
> > selection
> >
> > Usage examples:
> >
> > DirectX 11
> > -init_hw_device qsv:hw,child_device_type=d3d11va
> >
> > DirectX 9 is still supported but requires explicit selection
> > -init_hw_device
> > qsv:hw,child_device_type=dxva2
> >
> 
> Hi Artem,
> 
> Could you please show a complete command line, demonstrating how to use
> a D3D9/DXVA2 hardware context with your patch?
> 
> Something like qsv decoder, scale_qsv and qsv encoder...
> 
> Thanks,
> Softworkz

Hello Artem,

I don't know whether you read my message above, but in case you did, I suppose 
that you have realized that this would be no longer possible with your patch.
The QSV decoders do not allow setting a hardware device, and that means that 
the command snippet in your commit message (-init_hw_device 
qsv:hw,child_device_type=dxva2) doesn't affect decoders, but only filters and 
encoders at best.

That's why I had that global parameter (qsv_use_dx11) in my original patch 
(that follows the existing implementation of the qsc_device parameter, which is 
global as well).

As long as the patch breaks usage of D3D9 (for QSV decoding), I don't think it 
will ever get merged.
(not insisting to change the default to DX11 might help as well)

Kind regards,
Softworkz




___
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 16/23] dnn/dnn_backend_native_layer_conv2d: Avoid allocation when single-threaded

2021-03-10 Thread Guo, Yejun


> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Andreas Rheinhardt
> Sent: 2021年3月11日 5:55
> To: ffmpeg-devel@ffmpeg.org
> Cc: Andreas Rheinhardt 
> Subject: [FFmpeg-devel] [PATCH 16/23]
> dnn/dnn_backend_native_layer_conv2d: Avoid allocation when
> single-threaded
> 
> Also fixes a memleak in single-threaded mode when an error happens in
> preparing the output data buffer; and also removes an unchecked allocation.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  .../dnn/dnn_backend_native_layer_conv2d.c  | 18 +-
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> index 2e5aacdc2b..cdf65974b6 100644
> --- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> +++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> @@ -187,12 +187,14 @@ static void *
> dnn_execute_layer_conv2d_thread(void *threadarg)  int
> ff_dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t
> *input_operand_indexes,
>  int32_t output_operand_index, const
> void *parameters, NativeContext *ctx)  {
> +#if HAVE_PTHREAD_CANCEL
>  int thread_num = (ctx->options.conv2d_threads <= 0 ||
> ctx->options.conv2d_threads > av_cpu_count())
>  ? (av_cpu_count() + 1) : (ctx->options.conv2d_threads); -#if
> HAVE_PTHREAD_CANCEL
>  int thread_stride;
> -#endif
>  ThreadParam **thread_param = av_malloc_array(thread_num,
> sizeof(*thread_param));
> +#else
> +ThreadParam thread_param = { 0 };
> +#endif
>  ThreadCommonParam thread_common_param;
>  const ConvolutionalParams *conv_params = parameters;
>  int height = operands[input_operand_indexes[0]].dims[1];
> @@ -244,15 +246,13 @@ int ff_dnn_execute_layer_conv2d(DnnOperand
> *operands, const int32_t *input_opera
>  for (int i = 0; i < thread_num; i++){
>  av_freep(_param[i]);
>  }
> +av_free(thread_param);

The habit is to use av_freep(_param), others LGTM.

>  #else
> -thread_param[0] = av_malloc(sizeof(*thread_param[0]));
> -thread_param[0]->thread_common_param = _common_param;
> -thread_param[0]->thread_start = pad_size;
> -thread_param[0]->thread_end = height - pad_size;
> -dnn_execute_layer_conv2d_thread((void *)thread_param[0]);
> -av_freep(_param[0]);
> +thread_param.thread_common_param = _common_param;
> +thread_param.thread_start = pad_size;
> +thread_param.thread_end = height - pad_size;
> +dnn_execute_layer_conv2d_thread(_param);
>  #endif
> 
> -av_freep(_param);
>  return DNN_SUCCESS;
>  }
> --
> 2.27.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".

[FFmpeg-devel] [PATCH] libavcodec/qsvdec.c: using queue count to unref frame

2021-03-10 Thread wenbin . chen
From: "Chen,Wenbin" 

MSDK vc1 and av1 sometimes output frame into the same suface, but
ffmpeg-qsv assume the surface will be used only once, so it will
unref the frame when it receives the outpur surface. Now change
it to unref frame according to queue count.

Signed-off-by Wenbin Chen 
---
 libavcodec/qsvdec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index d10f90a0db..e073e10699 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -470,7 +470,7 @@ static int qsv_decode(AVCodecContext *avctx, QSVContext *q,
 return AVERROR_BUG;
 }
 
-out_frame->queued = 1;
+out_frame->queued += 1;
 av_fifo_generic_write(q->async_fifo, _frame, sizeof(out_frame), 
NULL);
 av_fifo_generic_write(q->async_fifo, ,  sizeof(sync),  
NULL);
 } else {
@@ -483,7 +483,7 @@ static int qsv_decode(AVCodecContext *avctx, QSVContext *q,
 
 av_fifo_generic_read(q->async_fifo, _frame, sizeof(out_frame), 
NULL);
 av_fifo_generic_read(q->async_fifo, ,  sizeof(sync),  
NULL);
-out_frame->queued = 0;
+out_frame->queued -= 1;
 
 if (avctx->pix_fmt != AV_PIX_FMT_QSV) {
 do {
-- 
2.25.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".

Re: [FFmpeg-devel] [PATCH 15/23] dnn/dnn_backend_native_layer_conv2d: Join two arrays, avoid allocation

2021-03-10 Thread Guo, Yejun


> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Andreas Rheinhardt
> Sent: 2021年3月11日 5:55
> To: ffmpeg-devel@ffmpeg.org
> Cc: Andreas Rheinhardt 
> Subject: [FFmpeg-devel] [PATCH 15/23]
> dnn/dnn_backend_native_layer_conv2d: Join two arrays, avoid allocation
> 
> Fixes Coverity issue #1473507.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavfilter/dnn/dnn_backend_native_layer_conv2d.c | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> index 2b83896da9..2e5aacdc2b 100644
> --- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> +++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> @@ -38,6 +38,9 @@ typedef struct ThreadCommonParam{  typedef struct
> ThreadParam{
>  ThreadCommonParam *thread_common_param;
>  int thread_start, thread_end;
> +#if HAVE_PTHREAD_CANCEL
> +pthread_t thread;
> +#endif
>  } ThreadParam;
> 
>  int ff_dnn_load_layer_conv2d(Layer *layer, AVIOContext *model_file_context,
> int file_size, int operands_num) @@ -187,7 +190,6 @@ int
> ff_dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t
> *input_opera
>  int thread_num = (ctx->options.conv2d_threads <= 0 ||
> ctx->options.conv2d_threads > av_cpu_count())
>  ? (av_cpu_count() + 1) : (ctx->options.conv2d_threads);  #if
> HAVE_PTHREAD_CANCEL
> -pthread_t *thread_id = av_malloc_array(thread_num, sizeof(*thread_id));
>  int thread_stride;
>  #endif
>  ThreadParam **thread_param = av_malloc_array(thread_num,
> sizeof(*thread_param)); @@ -230,17 +232,15 @@ int
> ff_dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t
> *input_opera
>  thread_param[i]->thread_common_param =
> _common_param;
>  thread_param[i]->thread_start = thread_stride * i + pad_size;
>  thread_param[i]->thread_end = (i == thread_num - 1) ? (height -
> pad_size) : (thread_param[i]->thread_start + thread_stride);
> -pthread_create(_id[i], NULL,
> dnn_execute_layer_conv2d_thread, (void *)thread_param[i]);
> +pthread_create(_param[i]->thread, NULL,
> + dnn_execute_layer_conv2d_thread, (void *)thread_param[i]);
>  }
> 
>  //join threads, res gets function return
>  for (int i = 0; i < thread_num; i++){
> -pthread_join(thread_id[i], NULL);
> +pthread_join(thread_param[i]->thread, NULL);
>  }
> 
>  //release memory
> -av_freep(_id);
> -
>  for (int i = 0; i < thread_num; i++){
>  av_freep(_param[i]);
>  }

LGMT, and just one question: shall we reduce the allocation as less as 
possible? 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 1/1] libavformat/hls: Reset options after open_url_keepalive() fails

2021-03-10 Thread Steven Liu


> 2021年3月11日 上午5:43,li...@edman007.com 写道:
> 
> From: Ed Martin 
> 
> open_url_keepalive() unsets the options when it uses them, this
> includes the offsets for the Range: header. When using the HLS
> tag #EXT-X-BYTERANGE along with multiple files, the range options
> must be preserved after open_url_keepalive() returns EOF so that
> the new file can be opened. Failure to do this results in ignoring
> the #EXT-X-BYTERANGE tag and reading the wrong bytes of the file.
> 
> To fix it, reset the options before calling io_open() following
> open_url_keepalive() reaching EOF
> ---
> libavformat/hls.c | 2 ++
> 1 file changed, 2 insertions(+)
> 
> diff --git a/libavformat/hls.c b/libavformat/hls.c
> index af2468ad9b..d08d00cf24 100644
> --- a/libavformat/hls.c
> +++ b/libavformat/hls.c
> @@ -677,6 +677,8 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, 
> const char *url,
> av_log(s, AV_LOG_WARNING,
> "keepalive request failed for '%s' with error: '%s' when 
> opening url, retrying with new connection\n",
> url, av_err2str(ret));
> +av_dict_copy(, *opts, 0);
> +av_dict_copy(, opts2, 0);
> ret = s->io_open(s, pb, url, AVIO_FLAG_READ, );
> }
> } else {
> -- 
> 2.30.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".


LGTM

Thanks

Steven Liu



___
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 14/23] dnn/dnn_backend_native_layer_conv2d: Fix memleak on realloc failure

2021-03-10 Thread Guo, Yejun


> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Andreas Rheinhardt
> Sent: 2021年3月11日 5:55
> To: ffmpeg-devel@ffmpeg.org
> Cc: Andreas Rheinhardt 
> Subject: [FFmpeg-devel] [PATCH 14/23]
> dnn/dnn_backend_native_layer_conv2d: Fix memleak on realloc failure
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavfilter/dnn/dnn_backend_native_layer_conv2d.c | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> index b5c2c394ef..2b83896da9 100644
> --- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> +++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
> @@ -197,6 +197,7 @@ int ff_dnn_execute_layer_conv2d(DnnOperand
> *operands, const int32_t *input_opera
>  int width = operands[input_operand_indexes[0]].dims[2];
>  int pad_size = (conv_params->padding_method == VALID) ?
> (conv_params->kernel_size - 1) / 2 * conv_params->dilation : 0;
>  DnnOperand *output_operand = [output_operand_index];
> +void *tmp;
> 
>  output_operand->dims[0] =
> operands[input_operand_indexes[0]].dims[0];
>  output_operand->dims[1] = height - pad_size * 2; @@ -208,11 +209,12
> @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t
> *input_opera
>  av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n");
>  return DNN_ERROR;
>  }
> -output_operand->data = av_realloc(output_operand->data,
> output_operand->length);
> -if (!output_operand->data) {
> +tmp = av_realloc(output_operand->data, output_operand->length);
> +if (!tmp) {
>  av_log(ctx, AV_LOG_ERROR, "Failed to reallocate memory for
> output\n");
>  return DNN_ERROR;
>  }
> +output_operand->data = tmp;
LGTM, 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 13/23] dnn/dnn_backend_native: Fix typo in log message

2021-03-10 Thread Guo, Yejun


> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Andreas Rheinhardt
> Sent: 2021年3月11日 5:55
> To: ffmpeg-devel@ffmpeg.org
> Cc: Andreas Rheinhardt 
> Subject: [FFmpeg-devel] [PATCH 13/23] dnn/dnn_backend_native: Fix typo in
> log message
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavfilter/dnn/dnn_backend_native.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavfilter/dnn/dnn_backend_native.c
> b/libavfilter/dnn/dnn_backend_native.c
> index b3c41af94e..0f26febb5d 100644
> --- a/libavfilter/dnn/dnn_backend_native.c
> +++ b/libavfilter/dnn/dnn_backend_native.c
> @@ -330,7 +330,7 @@ static DNNReturnType execute_model_native(const
> DNNModel *model, const char *inp
> 
> native_model->layers[layer].output_operand_index,
> 
> native_model->layers[layer].params,
>  _model->ctx) ==
> DNN_ERROR) {
> -av_log(ctx, AV_LOG_ERROR, "Failed to execuet model\n");
> +av_log(ctx, AV_LOG_ERROR, "Failed to execute model\n");

LGTM, 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 12/23] dnn/dnn_backend_native: Don't use asserts for checks

2021-03-10 Thread Guo, Yejun


> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Andreas Rheinhardt
> Sent: 2021年3月11日 5:55
> To: ffmpeg-devel@ffmpeg.org
> Cc: Andreas Rheinhardt 
> Subject: [FFmpeg-devel] [PATCH 12/23] dnn/dnn_backend_native: Don't use
> asserts for checks
> 
> asserts should not be used instead of ordinary input checks.
> Yet the native DNN backend did it: get_input_native() asserted that
> the first dimension was one, despite this value coming directly from
> the input file without having been sanitized.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
> get_input_native() only asserts this for input operands; so it might be
> that the check below should also check for this (depending upon whether
> 1 is a valid value for output operands).
> 
>  libavfilter/dnn/dnn_backend_native.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavfilter/dnn/dnn_backend_native.c
> b/libavfilter/dnn/dnn_backend_native.c
> index fd1f9e299d..b3c41af94e 100644
> --- a/libavfilter/dnn/dnn_backend_native.c
> +++ b/libavfilter/dnn/dnn_backend_native.c
> @@ -231,6 +231,8 @@ DNNModel *ff_dnn_load_model_native(const char
> *model_filename, DNNFunctionType f
>  oprd->dims[dim] = (int32_t)avio_rl32(model_file_context);
>  dnn_size += 4;
>  }
> +if (oprd->dims[0] != 1)
> +goto fail;

Thanks, the operands here include input, output and intermediate whose dims[0]
could be any other values, so, the fix here can be:

if (oprd->dims[0] != 1 && oprd->type == DOT_INPUT)
goto fail;
___
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/23] dnn/dnn_backend_native: Fix leak in case parsing options fails

2021-03-10 Thread Guo, Yejun


> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Andreas Rheinhardt
> Sent: 2021年3月11日 5:55
> To: ffmpeg-devel@ffmpeg.org
> Cc: Andreas Rheinhardt 
> Subject: [FFmpeg-devel] [PATCH 11/23] dnn/dnn_backend_native: Fix leak in
> case parsing options fails
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavfilter/dnn/dnn_backend_native.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavfilter/dnn/dnn_backend_native.c
> b/libavfilter/dnn/dnn_backend_native.c
> index 5336cd765a..fd1f9e299d 100644
> --- a/libavfilter/dnn/dnn_backend_native.c
> +++ b/libavfilter/dnn/dnn_backend_native.c
> @@ -157,12 +157,12 @@ DNNModel *ff_dnn_load_model_native(const char
> *model_filename, DNNFunctionType f
>  if (!native_model){
>  goto fail;
>  }
> +model->model = native_model;
> 
>  native_model->ctx.class = _native_class;
>  model->options = options;
>  if (av_opt_set_from_string(_model->ctx, model->options, NULL,
> "=", "&") < 0)
>  goto fail;
> -model->model = (void *)native_model;

nice catch, thanks, LGTM.
___
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 10/23] dnn/dnn_backend_native: Avoid allocation for checking file magic

2021-03-10 Thread Guo, Yejun


> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Andreas Rheinhardt
> Sent: 2021年3月11日 5:55
> To: ffmpeg-devel@ffmpeg.org
> Cc: Andreas Rheinhardt 
> Subject: [FFmpeg-devel] [PATCH 10/23] dnn/dnn_backend_native: Avoid
> allocation for checking file magic
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavfilter/dnn/dnn_backend_native.c | 21 +
>  1 file changed, 5 insertions(+), 16 deletions(-)
> 
> diff --git a/libavfilter/dnn/dnn_backend_native.c
> b/libavfilter/dnn/dnn_backend_native.c
> index 3bc253c1ad..5336cd765a 100644
> --- a/libavfilter/dnn/dnn_backend_native.c
> +++ b/libavfilter/dnn/dnn_backend_native.c
> @@ -114,10 +114,9 @@ static DNNReturnType get_output_native(void
> *model, const char *input_name, int  // For DEPTH_TO_SPACE layer:
> block_size  DNNModel *ff_dnn_load_model_native(const char
> *model_filename, DNNFunctionType func_type, const char *options,
> AVFilterContext *filter_ctx)  {
> +#define DNN_NATIVE_MAGIC "FFMPEGDNNNATIVE"
>  DNNModel *model = NULL;
> -char header_expected[] = "FFMPEGDNNNATIVE";
> -char *buf;
> -size_t size;
> +char buf[sizeof(DNN_NATIVE_MAGIC) - 1];
>  int version, header_size, major_version_expected = 1;
>  NativeModel *native_model = NULL;
>  AVIOContext *model_file_context;
> @@ -138,20 +137,10 @@ DNNModel *ff_dnn_load_model_native(const char
> *model_filename, DNNFunctionType f
>  /**
>   * check file header with string and version
>   */
> -size = sizeof(header_expected);
> -buf = av_malloc(size);
> -if (!buf) {
> +if (avio_read(model_file_context, buf, sizeof(buf)) != sizeof(buf) ||
> +memcmp(buf, DNN_NATIVE_MAGIC, sizeof(buf)))
>  goto fail;
> -}
> -
> -// size - 1 to skip the ending '\0' which is not saved in file

LGTM, and nice to add similar comment for '-1' in
'char buf[sizeof(DNN_NATIVE_MAGIC) - 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".

Re: [FFmpeg-devel] [PATCH] avcodec/libilbc: Support newer libiLBC versions

2021-03-10 Thread Timothy Gu
On Wed, Mar 10, 2021 at 7:49 PM Andreas Rheinhardt
 wrote:
> Beginning with version 3.0, libiLBC switched the types of some parts
> of their public API to size_t and renamed some types; the old names
> continue to work as typedefs, but are deprecated. It furthermore
> added version macros.
>
> This commit uses said version macro to use the new types when using
> newer libiLBC versions.
>
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/libilbc.c | 17 +
>  1 file changed, 17 insertions(+)

LGTM. Thanks!

[...]

Best,
Timothy
___
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] libsvtav1: Add logical_processors option

2021-03-10 Thread Christopher Degawa
From: Christopher Degawa 

Used for limiting the size of memory buffers and threads for a target
logical processor count, but does not set thread affinity or the total
amount of threads used, although thread affinities can be controlled
with an additional parameters, it is prefered to add them until
a svtav1-params option or similar is added

Signed-off-by: Christopher Degawa 
---
 doc/encoders.texi  | 7 +++
 libavcodec/libsvtav1.c | 7 +++
 2 files changed, 14 insertions(+)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index c9c8785afb..96dd60a899 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1795,6 +1795,13 @@ Set log2 of the number of rows of tiles to use (0-6).
 @item tile_columns
 Set log2 of the number of columns of tiles to use (0-4).
 
+@item logical_processors
+Number of logical processors to run the encoder on, threads are managed by
+the OS scheduler. Used for limiting the size of memory buffers and threads
+for a target logical processor count. Does not set thread affinity or total
+threads, but instead sets t * logical_processors amount of threads with t
+being the amount of threads libsvtav1 sets per cpu (0 - ncpus).
+
 @end table
 
 @section libkvazaar
diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
index eb6043bcac..0f752dcdda 100644
--- a/libavcodec/libsvtav1.c
+++ b/libavcodec/libsvtav1.c
@@ -71,6 +71,8 @@ typedef struct SvtContext {
 
 int tile_columns;
 int tile_rows;
+
+uint32_t logical_processors;
 } SvtContext;
 
 static const struct {
@@ -218,6 +220,8 @@ static int config_enc_params(EbSvtAv1EncConfiguration 
*param,
 param->tile_columns = svt_enc->tile_columns;
 param->tile_rows= svt_enc->tile_rows;
 
+param->logical_processors = svt_enc->logical_processors;
+
 return 0;
 }
 
@@ -533,6 +537,9 @@ static const AVOption options[] = {
 { "tile_columns", "Log2 of number of tile columns to use", 
OFFSET(tile_columns), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 4, VE},
 { "tile_rows", "Log2 of number of tile rows to use", OFFSET(tile_rows), 
AV_OPT_TYPE_INT, {.i64 = 0}, 0, 6, VE},
 
+{ "logical_processors", "Number of logical processors to run the encoder 
on, used to limit the size of memory buffers and threads used", 
OFFSET(logical_processors),
+  AV_OPT_TYPE_INT, { .i64 = 0 }, 0,  UINT_MAX, VE },
+
 {NULL},
 };
 
-- 
2.25.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".

Re: [FFmpeg-devel] [PATCH 5/5] avformat/rawenc: Use init instead of write_header function

2021-03-10 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> force_one_stream() does not write anything.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
> Is it it actually intended that the mp2 muxer does not use
> force_one_stream at all? And is it intended that force_one_stream
> does only check codec_type and not the actual codec?
> And wouldn't it be better to inform the caller about the fact that
> the format supports only one stream by adding a new
> AVOutputFormat.flags?
> 
>  libavformat/rawenc.c | 60 ++--
>  1 file changed, 30 insertions(+), 30 deletions(-)
> 
> diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c
> index 32704f9bfd..caec297f4a 100644
> --- a/libavformat/rawenc.c
> +++ b/libavformat/rawenc.c
> @@ -64,7 +64,7 @@ AVOutputFormat ff_ac3_muxer = {
>  .extensions= "ac3",
>  .audio_codec   = AV_CODEC_ID_AC3,
>  .video_codec   = AV_CODEC_ID_NONE,
> -.write_header  = force_one_stream,
> +.init  = force_one_stream,
>  .write_packet  = ff_raw_write_packet,
>  .flags = AVFMT_NOTIMESTAMPS,
>  };
> @@ -96,7 +96,7 @@ AVOutputFormat ff_adx_muxer = {
>  .extensions= "adx",
>  .audio_codec   = AV_CODEC_ID_ADPCM_ADX,
>  .video_codec   = AV_CODEC_ID_NONE,
> -.write_header  = force_one_stream,
> +.init  = force_one_stream,
>  .write_packet  = ff_raw_write_packet,
>  .write_trailer = adx_write_trailer,
>  .flags = AVFMT_NOTIMESTAMPS,
> @@ -110,7 +110,7 @@ AVOutputFormat ff_aptx_muxer = {
>  .extensions= "aptx",
>  .audio_codec   = AV_CODEC_ID_APTX,
>  .video_codec   = AV_CODEC_ID_NONE,
> -.write_header  = force_one_stream,
> +.init  = force_one_stream,
>  .write_packet  = ff_raw_write_packet,
>  .flags = AVFMT_NOTIMESTAMPS,
>  };
> @@ -123,7 +123,7 @@ AVOutputFormat ff_aptx_hd_muxer = {
>  .extensions= "aptxhd",
>  .audio_codec   = AV_CODEC_ID_APTX_HD,
>  .video_codec   = AV_CODEC_ID_NONE,
> -.write_header  = force_one_stream,
> +.init  = force_one_stream,
>  .write_packet  = ff_raw_write_packet,
>  .flags = AVFMT_NOTIMESTAMPS,
>  };
> @@ -136,7 +136,7 @@ AVOutputFormat ff_avs2_muxer = {
>  .extensions= "avs,avs2",
>  .audio_codec   = AV_CODEC_ID_NONE,
>  .video_codec   = AV_CODEC_ID_AVS2,
> -.write_header  = force_one_stream,
> +.init  = force_one_stream,
>  .write_packet  = ff_raw_write_packet,
>  .flags = AVFMT_NOTIMESTAMPS,
>  };
> @@ -149,7 +149,7 @@ AVOutputFormat ff_cavsvideo_muxer = {
>  .extensions= "cavs",
>  .audio_codec   = AV_CODEC_ID_NONE,
>  .video_codec   = AV_CODEC_ID_CAVS,
> -.write_header  = force_one_stream,
> +.init  = force_one_stream,
>  .write_packet  = ff_raw_write_packet,
>  .flags = AVFMT_NOTIMESTAMPS,
>  };
> @@ -161,7 +161,7 @@ AVOutputFormat ff_codec2raw_muxer = {
>  .long_name = NULL_IF_CONFIG_SMALL("raw codec2 muxer"),
>  .audio_codec   = AV_CODEC_ID_CODEC2,
>  .video_codec   = AV_CODEC_ID_NONE,
> -.write_header  = force_one_stream,
> +.init  = force_one_stream,
>  .write_packet  = ff_raw_write_packet,
>  .flags = AVFMT_NOTIMESTAMPS,
>  };
> @@ -172,7 +172,7 @@ AVOutputFormat ff_codec2raw_muxer = {
>  AVOutputFormat ff_data_muxer = {
>  .name  = "data",
>  .long_name = NULL_IF_CONFIG_SMALL("raw data"),
> -.write_header  = force_one_stream,
> +.init  = force_one_stream,
>  .write_packet  = ff_raw_write_packet,
>  .flags = AVFMT_NOTIMESTAMPS,
>  };
> @@ -185,7 +185,7 @@ AVOutputFormat ff_dirac_muxer = {
>  .extensions= "drc,vc2",
>  .audio_codec   = AV_CODEC_ID_NONE,
>  .video_codec   = AV_CODEC_ID_DIRAC,
> -.write_header  = force_one_stream,
> +.init  = force_one_stream,
>  .write_packet  = ff_raw_write_packet,
>  .flags = AVFMT_NOTIMESTAMPS,
>  };
> @@ -198,7 +198,7 @@ AVOutputFormat ff_dnxhd_muxer = {
>  .extensions= "dnxhd,dnxhr",
>  .audio_codec   = AV_CODEC_ID_NONE,
>  .video_codec   = AV_CODEC_ID_DNXHD,
> -.write_header  = force_one_stream,
> +.init  = force_one_stream,
>  .write_packet  = ff_raw_write_packet,
>  .flags = AVFMT_NOTIMESTAMPS,
>  };
> @@ -212,7 +212,7 @@ AVOutputFormat ff_dts_muxer = {
>  .extensions= "dts",
>  .audio_codec   = AV_CODEC_ID_DTS,
>  .video_codec   = AV_CODEC_ID_NONE,
> -.write_header  = force_one_stream,
> +.init  = force_one_stream,
>  .write_packet  = ff_raw_write_packet,
>  .flags = 

[FFmpeg-devel] [PATCH] avcodec/libilbc: Support newer libiLBC versions

2021-03-10 Thread Andreas Rheinhardt
Beginning with version 3.0, libiLBC switched the types of some parts
of their public API to size_t and renamed some types; the old names
continue to work as typedefs, but are deprecated. It furthermore
added version macros.

This commit uses said version macro to use the new types when using
newer libiLBC versions.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/libilbc.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/libavcodec/libilbc.c b/libavcodec/libilbc.c
index 08f951ac2d..9c82589918 100644
--- a/libavcodec/libilbc.c
+++ b/libavcodec/libilbc.c
@@ -27,6 +27,10 @@
 #include "avcodec.h"
 #include "internal.h"
 
+#ifndef LIBILBC_VERSION_MAJOR
+#define LIBILBC_VERSION_MAJOR 2
+#endif
+
 static int get_mode(AVCodecContext *avctx)
 {
 if (avctx->block_align == 38)
@@ -41,7 +45,11 @@ static int get_mode(AVCodecContext *avctx)
 
 typedef struct ILBCDecContext {
 const AVClass *class;
+#if LIBILBC_VERSION_MAJOR < 3
 iLBC_Dec_Inst_t decoder;
+#else
+IlbcDecoder decoder;
+#endif
 int enhance;
 } ILBCDecContext;
 
@@ -87,7 +95,12 @@ static int ilbc_decode_frame(AVCodecContext *avctx, void 
*data,
 int ret;
 
 if (s->decoder.no_of_bytes > buf_size) {
+#if LIBILBC_VERSION_MAJOR < 3
 av_log(avctx, AV_LOG_ERROR, "iLBC frame too short (%u, should be 
%u)\n",
+#else
+av_log(avctx, AV_LOG_ERROR, "iLBC frame too short (%u, should be "
+"%"SIZE_SPECIFIER")\n",
+#endif
buf_size, s->decoder.no_of_bytes);
 return AVERROR_INVALIDDATA;
 }
@@ -117,7 +130,11 @@ AVCodec ff_libilbc_decoder = {
 
 typedef struct ILBCEncContext {
 const AVClass *class;
+#if LIBILBC_VERSION_MAJOR < 3
 iLBC_Enc_Inst_t encoder;
+#else
+IlbcEncoder encoder;
+#endif
 int mode;
 } ILBCEncContext;
 
-- 
2.27.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] libsvtav1: Add crf and enable_tpl_la options

2021-03-10 Thread Christopher Degawa
libsvtav1 internally changed cqp to be crf while enable-tp-la is on,
which is on by default, and uses the same variables as cqp

Signed-off-by: Christopher Degawa 
---
 doc/encoders.texi  | 14 +-
 libavcodec/libsvtav1.c | 15 +--
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index c9c8785afb..86b7d27aeb 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1759,9 +1759,13 @@ Set the rate control mode to use.
 
 Possible modes:
 @table @option
+@item crf
+Constant quality mode: used a fixed value for quality throughout the stream.
+This mode is the default.
+
 @item cqp
 Constant quantizer: use fixed values of qindex (dependent on the frame type)
-throughout the stream.  This mode is the default.
+throughout the stream. This mode is enabled if enable_tpl_la is disabled.
 
 @item vbr
 Variable bitrate: use a target bitrate for the whole stream.
@@ -1776,6 +1780,9 @@ Set the maximum quantizer to use when using a bitrate 
mode.
 @item qmin
 Set the minimum quantizer to use when using a bitrate mode.
 
+@item crf
+Set the factor to use for the constant quality rate control mode (0-63).
+
 @item qp
 Set the quantizer used in cqp rate control mode (0-63).
 
@@ -1789,6 +1796,11 @@ Set number of frames to look ahead (0-120).
 Set the quality-speed tradeoff, in the range 0 to 8.  Higher values are
 faster but lower quality.  Defaults to 8 (highest speed).
 
+@item enable_tpl_la
+Enables changing the quantizer on a block to block basis within a frame
+and only works if la_depth is set to greater than zero or is set to -1.
+Is enabled by default and changes the cqp mode to crf (0-1).
+
 @item tile_rows
 Set log2 of the number of rows of tiles to use (0-6).
 
diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
index eb6043bcac..17f69b005d 100644
--- a/libavcodec/libsvtav1.c
+++ b/libavcodec/libsvtav1.c
@@ -69,6 +69,8 @@ typedef struct SvtContext {
 
 int tier;
 
+uint8_t enable_tpl_la;
+
 int tile_columns;
 int tile_rows;
 } SvtContext;
@@ -215,6 +217,8 @@ static int config_enc_params(EbSvtAv1EncConfiguration 
*param,
 if (svt_enc->la_depth >= 0)
 param->look_ahead_distance  = svt_enc->la_depth;
 
+param->enable_tpl_la = svt_enc->enable_tpl_la;
+
 param->tile_columns = svt_enc->tile_columns;
 param->tile_rows= svt_enc->tile_rows;
 
@@ -520,16 +524,23 @@ static const AVOption options[] = {
 
 { "rc", "Bit rate control mode", OFFSET(rc_mode),
   AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 3, VE , "rc"},
-{ "cqp", "Constant quantizer", 0, AV_OPT_TYPE_CONST, { .i64 = 0 },  
INT_MIN, INT_MAX, VE, "rc" },
+{ "crf", "Constant quality mode, alias to cqp if enable_tpl_la is set 
to 0", 0, AV_OPT_TYPE_CONST, { .i64 = 0 },  INT_MIN, INT_MAX, VE, "rc" },
+{ "cqp", "Constant quantizer, alias to crf if enable_tpl_la is set to 
1", 0, AV_OPT_TYPE_CONST, { .i64 = 0 },  INT_MIN, INT_MAX, VE, "rc" },
 { "vbr", "Variable Bit Rate, use a target bitrate for the entire 
stream", 0, AV_OPT_TYPE_CONST, { .i64 = 1 },  INT_MIN, INT_MAX, VE, "rc" },
 { "cvbr", "Constrained Variable Bit Rate, use a target bitrate for 
each GOP", 0, AV_OPT_TYPE_CONST,{ .i64 = 2 },  INT_MIN, INT_MAX, VE, "rc" },
 
-{ "qp", "Quantizer to use with cqp rate control mode", OFFSET(qp),
+{ "crf", "Factor to use with for constant quality mode, alias to qp if 
enable_tpl_la is set to 0", OFFSET(qp),
+  AV_OPT_TYPE_INT, { .i64 = 50 }, 0, 63, VE },
+
+{ "qp", "Quantizer to use with cqp rate control mode, alias to crf if 
enable_tpl_la is set to 1", OFFSET(qp),
   AV_OPT_TYPE_INT, { .i64 = 50 }, 0, 63, VE },
 
 { "sc_detection", "Scene change detection", OFFSET(scd),
   AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
 
+{ "enable_tpl_la", "Enable changing qp on a block to block basis within a 
frame, only works if la_depth is greater than 0", OFFSET(enable_tpl_la),
+  AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, VE},
+
 { "tile_columns", "Log2 of number of tile columns to use", 
OFFSET(tile_columns), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 4, VE},
 { "tile_rows", "Log2 of number of tile rows to use", OFFSET(tile_rows), 
AV_OPT_TYPE_INT, {.i64 = 0}, 0, 6, VE},
 
-- 
2.25.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".

Re: [FFmpeg-devel] FFmpeg 4.4

2021-03-10 Thread Stephen Hutchinson



On 3/10/2021 2:48 PM, Marton Balint wrote:



On Tue, 9 Mar 2021, Stephen Hutchinson wrote:


On 3/9/2021 3:47 PM, Michael Niedermayer wrote:

Hi all

I will branch release/4.4 soon
then like always leave some time for testing, bugfixes, ... and then
make FFmeg 4.4 from release/4.4, its too long since 4.3


These three AviSynth demuxer patches should probably go in before 4.4:

http://ffmpeg.org/pipermail/ffmpeg-devel/2020-June/264269.html

http://ffmpeg.org/pipermail/ffmpeg-devel/2021-February/275893.html

http://ffmpeg.org/pipermail/ffmpeg-devel/2021-February/276389.html

That third one especially.


OK, I will apply these.



The fixed version of the first patch is here, as I mentioned in
the other email:

http://ffmpeg.org/pipermail/ffmpeg-devel/2021-March/277547.html

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 v2] avisynth: more intelligent RGB flipping

2021-03-10 Thread Stephen Hutchinson
avs_is_color_space provides a generic way of checking whether the
video is RGB, and has been available through AVSC_API since 2.6.
This means that GetProcAddress doesn't have to run on every frame.
---
 libavformat/avisynth.c | 27 +--
 1 file changed, 5 insertions(+), 22 deletions(-)

diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index 2c08ace8db..5756aea0b6 100644
--- a/libavformat/avisynth.c
+++ b/libavformat/avisynth.c
@@ -57,6 +57,7 @@ typedef struct AviSynthLibrary {
 AVSC_DECLARE_FUNC(avs_get_version);
 AVSC_DECLARE_FUNC(avs_get_video_info);
 AVSC_DECLARE_FUNC(avs_invoke);
+AVSC_DECLARE_FUNC(avs_is_color_space);
 AVSC_DECLARE_FUNC(avs_release_clip);
 AVSC_DECLARE_FUNC(avs_release_value);
 AVSC_DECLARE_FUNC(avs_release_video_frame);
@@ -133,6 +134,7 @@ static av_cold int avisynth_load_library(void)
 LOAD_AVS_FUNC(avs_get_version, 0);
 LOAD_AVS_FUNC(avs_get_video_info, 0);
 LOAD_AVS_FUNC(avs_invoke, 0);
+LOAD_AVS_FUNC(avs_is_color_space, 1);
 LOAD_AVS_FUNC(avs_release_clip, 0);
 LOAD_AVS_FUNC(avs_release_value, 0);
 LOAD_AVS_FUNC(avs_release_video_frame, 0);
@@ -628,7 +630,6 @@ static int avisynth_read_packet_video(AVFormatContext *s, 
AVPacket *pkt,
 const unsigned char *src_p;
 int n, i, plane, rowsize, planeheight, pitch, bits, ret;
 const char *error;
-int avsplus av_unused;
 
 if (avs->curr_frame >= avs->vi->num_frames)
 return AVERROR_EOF;
@@ -638,19 +639,6 @@ static int avisynth_read_packet_video(AVFormatContext *s, 
AVPacket *pkt,
 if (discard)
 return 0;
 
-#ifdef _WIN32
-/* Detect whether we're using AviSynth 2.6 or AviSynth+ by
- * looking for whether avs_is_planar_rgb exists. */
-if (GetProcAddress(avs_library.library, "avs_is_planar_rgb") == NULL)
-avsplus = 0;
-else
-avsplus = 1;
-#else
-/* AviSynth+ is now the only variant of AviSynth we support
- * on Linux and macOS. */
-avsplus = 1;
-#endif
-
 bits = avs_library.avs_bits_per_pixel(avs->vi);
 
 /* Without the cast to int64_t, calculation overflows at about 9k x 9k
@@ -687,14 +675,9 @@ static int avisynth_read_packet_video(AVFormatContext *s, 
AVPacket *pkt,
 planeheight = avs_library.avs_get_height_p(frame, plane);
 
 /* Flip RGB video. */
-if (avs_is_rgb24(avs->vi) || avs_is_rgb(avs->vi)) {
-src_p = src_p + (planeheight - 1) * pitch;
-pitch = -pitch;
-}
-
-/* Flip Planar RGB video */
-if (avsplus && (avs_library.avs_is_planar_rgb(avs->vi) ||
-avs_library.avs_is_planar_rgba(avs->vi))) {
+if (avs_library.avs_is_color_space(avs->vi, AVS_CS_BGR)   ||
+avs_library.avs_is_color_space(avs->vi, AVS_CS_BGR48) ||
+avs_library.avs_is_color_space(avs->vi, AVS_CS_BGR64)) {
 src_p = src_p + (planeheight - 1) * pitch;
 pitch = -pitch;
 }
-- 
2.27.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 21/23] dnn/dnn_backend_native_layer_conv2d: Don't pretend convolution can fail

2021-03-10 Thread Andreas Rheinhardt
It can't; these are just remnants of commit
3c7cad69f233252e5178f7732baa0da950d74bbd which let the worker threads
do the reallocation.

Signed-off-by: Andreas Rheinhardt 
---
 libavfilter/dnn/dnn_backend_native_layer_conv2d.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c 
b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
index 44e5bdb5f7..f7f1ef9b6b 100644
--- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
+++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
@@ -180,7 +180,7 @@ static void * dnn_execute_layer_conv2d_thread(void 
*threadarg)
 output += conv_params->output_num;
 }
 }
-return (void *)DNN_SUCCESS;
+return NULL;
 }
 
 
@@ -244,7 +244,6 @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const 
int32_t *input_opera
 }
 }
 
-//join threads, res gets function return
 for (int i = 0; i < thread_num; i++){
 pthread_join(thread_param[i].thread, NULL);
 }
-- 
2.27.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 19/23] dnn/dnn_backend_native_layer_conv2d: Check allocation

2021-03-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
Why does DNN actually not use the ordinary error codes?

 libavfilter/dnn/dnn_backend_native_layer_conv2d.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c 
b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
index 94a07c1fdb..941330c895 100644
--- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
+++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
@@ -228,6 +228,8 @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const 
int32_t *input_opera
 
 #if HAVE_PTHREAD_CANCEL
 thread_param = av_calloc(thread_num, sizeof(*thread_param));
+if (!thread_param)
+return DNN_ERROR;
 thread_stride = (height - pad_size * 2) / thread_num;
 //create threads
 for (int i = 0; i < thread_num; i++){
-- 
2.27.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 20/23] dnn/dnn_backend_native_layer_conv2d: Check thread creation for errors

2021-03-10 Thread Andreas Rheinhardt
Fixes Coverity issue #1473533.

Signed-off-by: Andreas Rheinhardt 
---
 libavfilter/dnn/dnn_backend_native_layer_conv2d.c | 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c 
b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
index 941330c895..44e5bdb5f7 100644
--- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
+++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
@@ -190,7 +190,7 @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const 
int32_t *input_opera
 #if HAVE_PTHREAD_CANCEL
 int thread_num = (ctx->options.conv2d_threads <= 0 || 
ctx->options.conv2d_threads > av_cpu_count())
 ? (av_cpu_count() + 1) : (ctx->options.conv2d_threads);
-int thread_stride;
+int ret = DNN_SUCCESS, thread_stride;
 ThreadParam *thread_param;
 #else
 ThreadParam thread_param = { 0 };
@@ -236,7 +236,12 @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, 
const int32_t *input_opera
 thread_param[i].thread_common_param = _common_param;
 thread_param[i].thread_start = thread_stride * i + pad_size;
 thread_param[i].thread_end = (i == thread_num - 1) ? (height - 
pad_size) : (thread_param[i].thread_start + thread_stride);
-pthread_create(_param[i].thread, NULL, 
dnn_execute_layer_conv2d_thread, _param[i]);
+if (pthread_create(_param[i].thread, NULL,
+   dnn_execute_layer_conv2d_thread, _param[i])) 
{
+thread_num = i;
+ret = DNN_ERROR;
+break;
+}
 }
 
 //join threads, res gets function return
@@ -246,12 +251,14 @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, 
const int32_t *input_opera
 
 //release memory
 av_free(thread_param);
+
+return ret;
 #else
 thread_param.thread_common_param = _common_param;
 thread_param.thread_start = pad_size;
 thread_param.thread_end = height - pad_size;
 dnn_execute_layer_conv2d_thread(_param);
-#endif
 
 return DNN_SUCCESS;
+#endif
 }
-- 
2.27.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 18/23] dnn/dnn_backend_native_layer_conv2d: Avoid separate, unchecked allocations

2021-03-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 .../dnn/dnn_backend_native_layer_conv2d.c| 16 ++--
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c 
b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
index c2073a02de..94a07c1fdb 100644
--- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
+++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
@@ -191,7 +191,7 @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const 
int32_t *input_opera
 int thread_num = (ctx->options.conv2d_threads <= 0 || 
ctx->options.conv2d_threads > av_cpu_count())
 ? (av_cpu_count() + 1) : (ctx->options.conv2d_threads);
 int thread_stride;
-ThreadParam **thread_param;
+ThreadParam *thread_param;
 #else
 ThreadParam thread_param = { 0 };
 #endif
@@ -231,22 +231,18 @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, 
const int32_t *input_opera
 thread_stride = (height - pad_size * 2) / thread_num;
 //create threads
 for (int i = 0; i < thread_num; i++){
-thread_param[i] = av_malloc(sizeof(*thread_param[0]));
-thread_param[i]->thread_common_param = _common_param;
-thread_param[i]->thread_start = thread_stride * i + pad_size;
-thread_param[i]->thread_end = (i == thread_num - 1) ? (height - 
pad_size) : (thread_param[i]->thread_start + thread_stride);
-pthread_create(_param[i]->thread, NULL, 
dnn_execute_layer_conv2d_thread, (void *)thread_param[i]);
+thread_param[i].thread_common_param = _common_param;
+thread_param[i].thread_start = thread_stride * i + pad_size;
+thread_param[i].thread_end = (i == thread_num - 1) ? (height - 
pad_size) : (thread_param[i].thread_start + thread_stride);
+pthread_create(_param[i].thread, NULL, 
dnn_execute_layer_conv2d_thread, _param[i]);
 }
 
 //join threads, res gets function return
 for (int i = 0; i < thread_num; i++){
-pthread_join(thread_param[i]->thread, NULL);
+pthread_join(thread_param[i].thread, NULL);
 }
 
 //release memory
-for (int i = 0; i < thread_num; i++){
-av_freep(_param[i]);
-}
 av_free(thread_param);
 #else
 thread_param.thread_common_param = _common_param;
-- 
2.27.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 17/23] dnn/dnn_backend_native_layer_conv2d: Fix memleak on error

2021-03-10 Thread Andreas Rheinhardt
If an error happens when preparing the output data buffer, an already
allocated array would leak. Fix this by postponing its allocation.
Also zero-allocate the allocated array for safety.

Fixes Coverity issue #1473531.

Signed-off-by: Andreas Rheinhardt 
---
 libavfilter/dnn/dnn_backend_native_layer_conv2d.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c 
b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
index cdf65974b6..c2073a02de 100644
--- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
+++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
@@ -191,7 +191,7 @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const 
int32_t *input_opera
 int thread_num = (ctx->options.conv2d_threads <= 0 || 
ctx->options.conv2d_threads > av_cpu_count())
 ? (av_cpu_count() + 1) : (ctx->options.conv2d_threads);
 int thread_stride;
-ThreadParam **thread_param = av_malloc_array(thread_num, 
sizeof(*thread_param));
+ThreadParam **thread_param;
 #else
 ThreadParam thread_param = { 0 };
 #endif
@@ -227,6 +227,7 @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const 
int32_t *input_opera
 thread_common_param.ctx = ctx;
 
 #if HAVE_PTHREAD_CANCEL
+thread_param = av_calloc(thread_num, sizeof(*thread_param));
 thread_stride = (height - pad_size * 2) / thread_num;
 //create threads
 for (int i = 0; i < thread_num; i++){
-- 
2.27.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 16/23] dnn/dnn_backend_native_layer_conv2d: Avoid allocation when single-threaded

2021-03-10 Thread Andreas Rheinhardt
Also fixes a memleak in single-threaded mode when an error happens
in preparing the output data buffer; and also removes an unchecked
allocation.

Signed-off-by: Andreas Rheinhardt 
---
 .../dnn/dnn_backend_native_layer_conv2d.c  | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c 
b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
index 2e5aacdc2b..cdf65974b6 100644
--- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
+++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
@@ -187,12 +187,14 @@ static void * dnn_execute_layer_conv2d_thread(void 
*threadarg)
 int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t 
*input_operand_indexes,
 int32_t output_operand_index, const void 
*parameters, NativeContext *ctx)
 {
+#if HAVE_PTHREAD_CANCEL
 int thread_num = (ctx->options.conv2d_threads <= 0 || 
ctx->options.conv2d_threads > av_cpu_count())
 ? (av_cpu_count() + 1) : (ctx->options.conv2d_threads);
-#if HAVE_PTHREAD_CANCEL
 int thread_stride;
-#endif
 ThreadParam **thread_param = av_malloc_array(thread_num, 
sizeof(*thread_param));
+#else
+ThreadParam thread_param = { 0 };
+#endif
 ThreadCommonParam thread_common_param;
 const ConvolutionalParams *conv_params = parameters;
 int height = operands[input_operand_indexes[0]].dims[1];
@@ -244,15 +246,13 @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, 
const int32_t *input_opera
 for (int i = 0; i < thread_num; i++){
 av_freep(_param[i]);
 }
+av_free(thread_param);
 #else
-thread_param[0] = av_malloc(sizeof(*thread_param[0]));
-thread_param[0]->thread_common_param = _common_param;
-thread_param[0]->thread_start = pad_size;
-thread_param[0]->thread_end = height - pad_size;
-dnn_execute_layer_conv2d_thread((void *)thread_param[0]);
-av_freep(_param[0]);
+thread_param.thread_common_param = _common_param;
+thread_param.thread_start = pad_size;
+thread_param.thread_end = height - pad_size;
+dnn_execute_layer_conv2d_thread(_param);
 #endif
 
-av_freep(_param);
 return DNN_SUCCESS;
 }
-- 
2.27.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 23/23] avcodec/pngdec: Fix memleak by postponing allocation

2021-03-10 Thread Andreas Rheinhardt
Fixes Coverity ticket #1322342.

Signed-off-by: Andreas Rheinhardt 
---
It seems to me that this temporary buffer is actually unneeded: One just
needs to use the new frame as destination for blending and then
overwrite the new frame's data outside the processed rectangle with the
data from the old frame. Or am I wrong about this?

 libavcodec/pngdec.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index a5a71ef161..63c22063d9 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -1080,10 +1080,6 @@ static int handle_p_frame_apng(AVCodecContext *avctx, 
PNGDecContext *s,
 return AVERROR_PATCHWELCOME;
 }
 
-buffer = av_malloc_array(s->image_linesize, s->height);
-if (!buffer)
-return AVERROR(ENOMEM);
-
 ff_thread_await_progress(>last_picture, INT_MAX, 0);
 
 // need to reset a rectangle to background:
@@ -1099,7 +1095,9 @@ static int handle_p_frame_apng(AVCodecContext *avctx, 
PNGDecContext *s,
 }
 }
 
-memcpy(buffer, s->last_picture.f->data[0], s->image_linesize * s->height);
+buffer = av_memdup(s->last_picture.f->data[0], s->image_linesize * 
s->height);
+if (!buffer)
+return AVERROR(ENOMEM);
 
 // Perform blending
 if (s->blend_op == APNG_BLEND_OP_SOURCE) {
-- 
2.27.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 15/23] dnn/dnn_backend_native_layer_conv2d: Join two arrays, avoid allocation

2021-03-10 Thread Andreas Rheinhardt
Fixes Coverity issue #1473507.

Signed-off-by: Andreas Rheinhardt 
---
 libavfilter/dnn/dnn_backend_native_layer_conv2d.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c 
b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
index 2b83896da9..2e5aacdc2b 100644
--- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
+++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
@@ -38,6 +38,9 @@ typedef struct ThreadCommonParam{
 typedef struct ThreadParam{
 ThreadCommonParam *thread_common_param;
 int thread_start, thread_end;
+#if HAVE_PTHREAD_CANCEL
+pthread_t thread;
+#endif
 } ThreadParam;
 
 int ff_dnn_load_layer_conv2d(Layer *layer, AVIOContext *model_file_context, 
int file_size, int operands_num)
@@ -187,7 +190,6 @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const 
int32_t *input_opera
 int thread_num = (ctx->options.conv2d_threads <= 0 || 
ctx->options.conv2d_threads > av_cpu_count())
 ? (av_cpu_count() + 1) : (ctx->options.conv2d_threads);
 #if HAVE_PTHREAD_CANCEL
-pthread_t *thread_id = av_malloc_array(thread_num, sizeof(*thread_id));
 int thread_stride;
 #endif
 ThreadParam **thread_param = av_malloc_array(thread_num, 
sizeof(*thread_param));
@@ -230,17 +232,15 @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, 
const int32_t *input_opera
 thread_param[i]->thread_common_param = _common_param;
 thread_param[i]->thread_start = thread_stride * i + pad_size;
 thread_param[i]->thread_end = (i == thread_num - 1) ? (height - 
pad_size) : (thread_param[i]->thread_start + thread_stride);
-pthread_create(_id[i], NULL, dnn_execute_layer_conv2d_thread, 
(void *)thread_param[i]);
+pthread_create(_param[i]->thread, NULL, 
dnn_execute_layer_conv2d_thread, (void *)thread_param[i]);
 }
 
 //join threads, res gets function return
 for (int i = 0; i < thread_num; i++){
-pthread_join(thread_id[i], NULL);
+pthread_join(thread_param[i]->thread, NULL);
 }
 
 //release memory
-av_freep(_id);
-
 for (int i = 0; i < thread_num; i++){
 av_freep(_param[i]);
 }
-- 
2.27.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 22/23] dnn/dnn_backend_native_layer_mathbinary: Fix leak upon error

2021-03-10 Thread Andreas Rheinhardt
Fixes Coverity issue #1473568.

Signed-off-by: Andreas Rheinhardt 
---
 .../dnn/dnn_backend_native_layer_mathbinary.c | 23 +--
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c 
b/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c
index c116188bab..1c33b4633d 100644
--- a/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c
+++ b/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c
@@ -100,20 +100,17 @@ static void math_binary_not_commutative(FunType pfun, 
const DnnLayerMathBinaryPa
 }
 int ff_dnn_load_layer_math_binary(Layer *layer, AVIOContext 
*model_file_context, int file_size, int operands_num)
 {
-DnnLayerMathBinaryParams *params;
+DnnLayerMathBinaryParams params = { 0 };
 int dnn_size = 0;
 int input_index = 0;
-params = av_malloc(sizeof(*params));
-if (!params)
-return 0;
 
-params->bin_op = (int32_t)avio_rl32(model_file_context);
+params.bin_op = (int32_t)avio_rl32(model_file_context);
 dnn_size += 4;
 
-params->input0_broadcast = (int32_t)avio_rl32(model_file_context);
+params.input0_broadcast = (int32_t)avio_rl32(model_file_context);
 dnn_size += 4;
-if (params->input0_broadcast) {
-params->v = av_int2float(avio_rl32(model_file_context));
+if (params.input0_broadcast) {
+params.v = av_int2float(avio_rl32(model_file_context));
 } else {
 layer->input_operand_indexes[input_index] = 
(int32_t)avio_rl32(model_file_context);
 if (layer->input_operand_indexes[input_index] >= operands_num) {
@@ -123,10 +120,10 @@ int ff_dnn_load_layer_math_binary(Layer *layer, 
AVIOContext *model_file_context,
 }
 dnn_size += 4;
 
-params->input1_broadcast = (int32_t)avio_rl32(model_file_context);
+params.input1_broadcast = (int32_t)avio_rl32(model_file_context);
 dnn_size += 4;
-if (params->input1_broadcast) {
-params->v = av_int2float(avio_rl32(model_file_context));
+if (params.input1_broadcast) {
+params.v = av_int2float(avio_rl32(model_file_context));
 } else {
 layer->input_operand_indexes[input_index] = 
(int32_t)avio_rl32(model_file_context);
 if (layer->input_operand_indexes[input_index] >= operands_num) {
@@ -138,11 +135,13 @@ int ff_dnn_load_layer_math_binary(Layer *layer, 
AVIOContext *model_file_context,
 
 layer->output_operand_index = (int32_t)avio_rl32(model_file_context);
 dnn_size += 4;
-layer->params = params;
 
 if (layer->output_operand_index >= operands_num) {
 return 0;
 }
+layer->params = av_memdup(, sizeof(params));
+if (!layer->params)
+return 0;
 
 return dnn_size;
 }
-- 
2.27.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 14/23] dnn/dnn_backend_native_layer_conv2d: Fix memleak on realloc failure

2021-03-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavfilter/dnn/dnn_backend_native_layer_conv2d.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c 
b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
index b5c2c394ef..2b83896da9 100644
--- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
+++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
@@ -197,6 +197,7 @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const 
int32_t *input_opera
 int width = operands[input_operand_indexes[0]].dims[2];
 int pad_size = (conv_params->padding_method == VALID) ? 
(conv_params->kernel_size - 1) / 2 * conv_params->dilation : 0;
 DnnOperand *output_operand = [output_operand_index];
+void *tmp;
 
 output_operand->dims[0] = operands[input_operand_indexes[0]].dims[0];
 output_operand->dims[1] = height - pad_size * 2;
@@ -208,11 +209,12 @@ int ff_dnn_execute_layer_conv2d(DnnOperand *operands, 
const int32_t *input_opera
 av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n");
 return DNN_ERROR;
 }
-output_operand->data = av_realloc(output_operand->data, 
output_operand->length);
-if (!output_operand->data) {
+tmp = av_realloc(output_operand->data, output_operand->length);
+if (!tmp) {
 av_log(ctx, AV_LOG_ERROR, "Failed to reallocate memory for output\n");
 return DNN_ERROR;
 }
+output_operand->data = tmp;
 thread_common_param.output_data = output_operand->data;
 thread_common_param.operands = operands;
 thread_common_param.input_operand_indexes = input_operand_indexes;
-- 
2.27.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 13/23] dnn/dnn_backend_native: Fix typo in log message

2021-03-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavfilter/dnn/dnn_backend_native.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/dnn/dnn_backend_native.c 
b/libavfilter/dnn/dnn_backend_native.c
index b3c41af94e..0f26febb5d 100644
--- a/libavfilter/dnn/dnn_backend_native.c
+++ b/libavfilter/dnn/dnn_backend_native.c
@@ -330,7 +330,7 @@ static DNNReturnType execute_model_native(const DNNModel 
*model, const char *inp
 
native_model->layers[layer].output_operand_index,
 native_model->layers[layer].params,
 _model->ctx) == DNN_ERROR) {
-av_log(ctx, AV_LOG_ERROR, "Failed to execuet model\n");
+av_log(ctx, AV_LOG_ERROR, "Failed to execute model\n");
 return DNN_ERROR;
 }
 }
-- 
2.27.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 12/23] dnn/dnn_backend_native: Don't use asserts for checks

2021-03-10 Thread Andreas Rheinhardt
asserts should not be used instead of ordinary input checks.
Yet the native DNN backend did it: get_input_native() asserted that
the first dimension was one, despite this value coming directly from
the input file without having been sanitized.

Signed-off-by: Andreas Rheinhardt 
---
get_input_native() only asserts this for input operands; so it might be
that the check below should also check for this (depending upon whether
1 is a valid value for output operands).

 libavfilter/dnn/dnn_backend_native.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavfilter/dnn/dnn_backend_native.c 
b/libavfilter/dnn/dnn_backend_native.c
index fd1f9e299d..b3c41af94e 100644
--- a/libavfilter/dnn/dnn_backend_native.c
+++ b/libavfilter/dnn/dnn_backend_native.c
@@ -231,6 +231,8 @@ DNNModel *ff_dnn_load_model_native(const char 
*model_filename, DNNFunctionType f
 oprd->dims[dim] = (int32_t)avio_rl32(model_file_context);
 dnn_size += 4;
 }
+if (oprd->dims[0] != 1)
+goto fail;
 
 oprd->isNHWC = 1;
 }
-- 
2.27.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 11/23] dnn/dnn_backend_native: Fix leak in case parsing options fails

2021-03-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavfilter/dnn/dnn_backend_native.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/dnn/dnn_backend_native.c 
b/libavfilter/dnn/dnn_backend_native.c
index 5336cd765a..fd1f9e299d 100644
--- a/libavfilter/dnn/dnn_backend_native.c
+++ b/libavfilter/dnn/dnn_backend_native.c
@@ -157,12 +157,12 @@ DNNModel *ff_dnn_load_model_native(const char 
*model_filename, DNNFunctionType f
 if (!native_model){
 goto fail;
 }
+model->model = native_model;
 
 native_model->ctx.class = _native_class;
 model->options = options;
 if (av_opt_set_from_string(_model->ctx, model->options, NULL, "=", 
"&") < 0)
 goto fail;
-model->model = (void *)native_model;
 native_model->model = model;
 
 #if !HAVE_PTHREAD_CANCEL
-- 
2.27.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 10/23] dnn/dnn_backend_native: Avoid allocation for checking file magic

2021-03-10 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavfilter/dnn/dnn_backend_native.c | 21 +
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/libavfilter/dnn/dnn_backend_native.c 
b/libavfilter/dnn/dnn_backend_native.c
index 3bc253c1ad..5336cd765a 100644
--- a/libavfilter/dnn/dnn_backend_native.c
+++ b/libavfilter/dnn/dnn_backend_native.c
@@ -114,10 +114,9 @@ static DNNReturnType get_output_native(void *model, const 
char *input_name, int
 // For DEPTH_TO_SPACE layer: block_size
 DNNModel *ff_dnn_load_model_native(const char *model_filename, DNNFunctionType 
func_type, const char *options, AVFilterContext *filter_ctx)
 {
+#define DNN_NATIVE_MAGIC "FFMPEGDNNNATIVE"
 DNNModel *model = NULL;
-char header_expected[] = "FFMPEGDNNNATIVE";
-char *buf;
-size_t size;
+char buf[sizeof(DNN_NATIVE_MAGIC) - 1];
 int version, header_size, major_version_expected = 1;
 NativeModel *native_model = NULL;
 AVIOContext *model_file_context;
@@ -138,20 +137,10 @@ DNNModel *ff_dnn_load_model_native(const char 
*model_filename, DNNFunctionType f
 /**
  * check file header with string and version
  */
-size = sizeof(header_expected);
-buf = av_malloc(size);
-if (!buf) {
+if (avio_read(model_file_context, buf, sizeof(buf)) != sizeof(buf) ||
+memcmp(buf, DNN_NATIVE_MAGIC, sizeof(buf)))
 goto fail;
-}
-
-// size - 1 to skip the ending '\0' which is not saved in file
-avio_get_str(model_file_context, size - 1, buf, size);
-dnn_size = size - 1;
-if (strncmp(buf, header_expected, size) != 0) {
-av_freep();
-goto fail;
-}
-av_freep();
+dnn_size = sizeof(buf);
 
 version = (int32_t)avio_rl32(model_file_context);
 dnn_size += 4;
-- 
2.27.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 0/1] libavformat/hls: Reset options after open_url_keepalive() fails

2021-03-10 Thread lists
From: Ed Martin 

Hey, I'm testing some HLS stuff, found a bug when using byteranges with
multiple files, it seems that the byteranges are ignored and this causes all
sorts of problems reading the wrong bytes from the files

For reference, this is the URL I've been testing with:
https://dev.edman007.com/~edman007/pub/hls-bug/vids/nosound2.m3u8

This is my first time contributing to FFMpeg, hopefully I'm doing it right :)

Ed Martin (1):
  libavformat/hls: Reset options after open_url_keepalive() fails

 libavformat/hls.c | 2 ++
 1 file changed, 2 insertions(+)

-- 
2.30.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] [PATCH 1/1] libavformat/hls: Reset options after open_url_keepalive() fails

2021-03-10 Thread lists
From: Ed Martin 

open_url_keepalive() unsets the options when it uses them, this
includes the offsets for the Range: header. When using the HLS
tag #EXT-X-BYTERANGE along with multiple files, the range options
must be preserved after open_url_keepalive() returns EOF so that
the new file can be opened. Failure to do this results in ignoring
the #EXT-X-BYTERANGE tag and reading the wrong bytes of the file.

To fix it, reset the options before calling io_open() following
open_url_keepalive() reaching EOF
---
 libavformat/hls.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index af2468ad9b..d08d00cf24 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -677,6 +677,8 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, 
const char *url,
 av_log(s, AV_LOG_WARNING,
 "keepalive request failed for '%s' with error: '%s' when 
opening url, retrying with new connection\n",
 url, av_err2str(ret));
+av_dict_copy(, *opts, 0);
+av_dict_copy(, opts2, 0);
 ret = s->io_open(s, pb, url, AVIO_FLAG_READ, );
 }
 } else {
-- 
2.30.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] [PATCH] Doc: Tech Resolution Process

2021-03-10 Thread Jean-Baptiste Kempf
---
 doc/dev_community/community.md  |  2 +-
 doc/dev_community/resolution_process.md | 91 +
 2 files changed, 92 insertions(+), 1 deletion(-)
 create mode 100644 doc/dev_community/resolution_process.md

diff --git a/doc/dev_community/community.md b/doc/dev_community/community.md
index 49d7f899aa..21e08e20e3 100644
--- a/doc/dev_community/community.md
+++ b/doc/dev_community/community.md
@@ -53,7 +53,7 @@ can trigger a new election of the TC.
 The members of the TC can be elected from outside of the GA.
 Candidates for election can either be suggested or self-nominated.
 
-The conflict resolution process is detailed in the [resolution process] 
document.
+The conflict resolution process is detailed in the [resolution 
process](resolution_process.md) document.
 
 ## Community committee
 
diff --git a/doc/dev_community/resolution_process.md 
b/doc/dev_community/resolution_process.md
new file mode 100644
index 00..4ed0b63c43
--- /dev/null
+++ b/doc/dev_community/resolution_process.md
@@ -0,0 +1,91 @@
+# Technical Committee
+
+_This document only makes sense with the rules from [the community 
document](community)_.
+
+The Technical Committee (**TC**) is here to arbitrate and make decisions when
+technical conflicts occur in the project.
+
+The TC main role is to resolve technical conflicts.
+It is therefore not a technical steering committee, but it is understood that
+some decisions might impact the future of the project.
+
+# Process
+
+## Seizing
+
+The TC can take possession of any technical matter that it sees fit.
+
+To involve the TC in a matter, email tc@ or CC them on an ongoing discussion.
+
+As members of TC are developers, they also can email tc@ to raise an issue.
+
+## Announcement
+
+The TC, once seized, must announce itself on the main mailing list, with a 
_[TC]_ tag.
+
+The TC has 2 modes of operation: a RFC one and an internal one.
+
+If the TC thinks it needs the input from the larger community, the TC can call
+for a RFC. Else, it can decide by itself.
+
+If the disagreement involves a member of the TC, that member should recuse
+themselves from the decision.
+
+The decision to use a RFC process or an internal discussion is a discretionary
+decision of the TC.
+
+The TC can also reject a seizure for a few reasons such as:
+the matter was not discussed enough previously; it lacks expertise to reach a
+beneficial decision on the matter; or the matter is too trivial.
+
+### RFC call
+
+In the RFC mode, one person from the TC posts on the mailing list the
+technical question and will request input from the community.
+
+The mail will have the following specification:
+* a precise title
+* a specific tag [TC RFC]
+* a top-level email
+* contain a precise question that does not exceed 100 words and that is 
answerable by developers
+* may have an extra description, or a link to a previous discussion, if deemed 
necessary,
+* contain a precise end date for the answers.
+
+The answers from the community must be on the main mailing list and must have
+the following specification:
+* keep the tag and the title unchanged
+* limited to 400 words
+* a first-level, answering directly to the main email
+* answering to the question.
+
+Further replies to answers are permitted, as long as they conform to the
+community standards of politeness, they are limited to 100 words, and are not
+nested more than once. (max-depth=2)
+
+After the end-date, mails on the thread will be ignored.
+
+Violations of those rules will be escalated through the Community Committee.
+
+After all the emails are in, the TC has 96 hours to give its final decision.
+Exceptionally, the TC can request an extra delay, that will be notified on the
+mailing list.
+
+### Within TC
+
+In the internal case, the TC has 96 hours to give its final decision.
+Exceptionally, the TC can request an extra delay.
+
+
+## Decisions
+
+The decisions from the TC will be sent on the mailing list, with the _[TC]_ 
tag.
+
+Internally, the TC should take decisions with a majority, or using
+ranked-choice voting.
+
+The decision from the TC should be published with a summary of the reasons that
+lead to this decision.
+
+The decisions from the TC are final, until the matters are reopened after
+no less than one year.
+
-- 
2.30.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".

Re: [FFmpeg-devel] [PATCH 1/9 v3] avutil/buffer: change public function and struct size parameter types to size_t

2021-03-10 Thread James Almer

On 3/10/2021 6:28 PM, Andreas Rheinhardt wrote:

James Almer:

On 3/10/2021 4:38 PM, Michael Niedermayer wrote:

On Sat, Mar 06, 2021 at 04:42:35PM -0300, James Almer wrote:

Signed-off-by: James Almer 
---
Changes since v2 is the addition of the buffer_size_t typedef to
reduce the
amount of ifdeffery required to adapt our code.

   doc/APIchanges  |  4 
   libavutil/buffer.c  | 14 +++---
   libavutil/buffer.h  | 32 
   libavutil/buffer_internal.h |  8 
   libavutil/internal.h    |  7 +++
   libavutil/version.h |  5 -
   6 files changed, 58 insertions(+), 12 deletions(-)


The patchset prior to the bump LGTM
the patchset after the bump (thus enabled size_t) is probably ok but
i did not review this for downstream effects which could introduce bugs
when theres any code that expected the variables to be int


That's what 2+ years of advanced warning are for. Same as we did with
the Crypto modules that will be switching to size_t in the upcoming bump.



What 2+ years of advanced warning are you talking about?


My bad, was thinking about the AVPacket set.

This patchset

as-is wants to switch the type at the next major bump, i.e. fairly soon.
(And fyi: Our crypto functions are not compatible with size_t right now;
see
https://github.com/mkver/FFmpeg/commit/1d830b0495399bb59a296d7bb3e2b2ab88a32fc1.)

- Andreas



code prior bump tested, code post bump not tested

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 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 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 1/9 v3] avutil/buffer: change public function and struct size parameter types to size_t

2021-03-10 Thread Andreas Rheinhardt
James Almer:
> On 3/10/2021 4:38 PM, Michael Niedermayer wrote:
>> On Sat, Mar 06, 2021 at 04:42:35PM -0300, James Almer wrote:
>>> Signed-off-by: James Almer 
>>> ---
>>> Changes since v2 is the addition of the buffer_size_t typedef to
>>> reduce the
>>> amount of ifdeffery required to adapt our code.
>>>
>>>   doc/APIchanges  |  4 
>>>   libavutil/buffer.c  | 14 +++---
>>>   libavutil/buffer.h  | 32 
>>>   libavutil/buffer_internal.h |  8 
>>>   libavutil/internal.h    |  7 +++
>>>   libavutil/version.h |  5 -
>>>   6 files changed, 58 insertions(+), 12 deletions(-)
>>
>> The patchset prior to the bump LGTM
>> the patchset after the bump (thus enabled size_t) is probably ok but
>> i did not review this for downstream effects which could introduce bugs
>> when theres any code that expected the variables to be int
> 
> That's what 2+ years of advanced warning are for. Same as we did with
> the Crypto modules that will be switching to size_t in the upcoming bump.
> 

What 2+ years of advanced warning are you talking about? This patchset
as-is wants to switch the type at the next major bump, i.e. fairly soon.
(And fyi: Our crypto functions are not compatible with size_t right now;
see
https://github.com/mkver/FFmpeg/commit/1d830b0495399bb59a296d7bb3e2b2ab88a32fc1.)

- Andreas

>>
>> code prior bump tested, code post bump not tested
>>
>> 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 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 45/48] doc/examples/vaapi_encode: use av_packet_alloc() to allocate packets

2021-03-10 Thread James Almer

On 3/10/2021 5:22 PM, Michael Niedermayer wrote:

On Sat, Mar 06, 2021 at 06:45:57PM -0300, James Almer wrote:

On 3/6/2021 6:35 PM, Michael Niedermayer wrote:

On Fri, Mar 05, 2021 at 01:33:36PM -0300, James Almer wrote:

Signed-off-by: James Almer 
---
   doc/examples/vaapi_encode.c | 16 
   1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/doc/examples/vaapi_encode.c b/doc/examples/vaapi_encode.c
index 707939db37..66cb949cdc 100644
--- a/doc/examples/vaapi_encode.c
+++ b/doc/examples/vaapi_encode.c
@@ -74,27 +74,27 @@ static int set_hwframe_ctx(AVCodecContext *ctx, AVBufferRef 
*hw_device_ctx)
   static int encode_write(AVCodecContext *avctx, AVFrame *frame, FILE *fout)
   {
   int ret = 0;
-AVPacket enc_pkt;
+AVPacket *enc_pkt;
-av_init_packet(_pkt);
-enc_pkt.data = NULL;
-enc_pkt.size = 0;
+if (!(enc_pkt = av_packet_alloc()))
+return AVERROR(ENOMEM);
   if ((ret = avcodec_send_frame(avctx, frame)) < 0) {
   fprintf(stderr, "Error code: %s\n", av_err2str(ret));
   goto end;
   }
   while (1) {
-ret = avcodec_receive_packet(avctx, _pkt);
+ret = avcodec_receive_packet(avctx, enc_pkt);
   if (ret)
   break;
-enc_pkt.stream_index = 0;
-ret = fwrite(enc_pkt.data, enc_pkt.size, 1, fout);
-av_packet_unref(_pkt);
+enc_pkt->stream_index = 0;
+ret = fwrite(enc_pkt.data, enc_pkt->size, 1, fout);
+av_packet_unref(enc_pkt);
   }
   end:
+av_packet_free(_pkt);
   ret = ((ret == AVERROR(EAGAIN)) ? 0 : -1);
   return ret;
   }


breaks:
doc/examples/vaapi_encode.c: In function ‘encode_write’:
doc/examples/vaapi_encode.c:92:29: error: ‘enc_pkt’ is a pointer; did you mean to 
use ‘->’?
   ret = fwrite(enc_pkt.data, enc_pkt->size, 1, fout);
   ^
   ->
ffbuild/common.mak:67: recipe for target 'doc/examples/vaapi_encode.o' failed
make: *** [doc/examples/vaapi_encode.o] Error 1
make: *** Waiting for unfinished jobs


Fixed locally. Thanks.


do you have a public git tree for testing such minor changes ?
so i can retest the update set easily

thanks


Yes, pushed it to

https://github.com/jamrial/FFmpeg/commits/avpacket
___
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 1/9 v3] avutil/buffer: change public function and struct size parameter types to size_t

2021-03-10 Thread James Almer

On 3/10/2021 4:38 PM, Michael Niedermayer wrote:

On Sat, Mar 06, 2021 at 04:42:35PM -0300, James Almer wrote:

Signed-off-by: James Almer 
---
Changes since v2 is the addition of the buffer_size_t typedef to reduce the
amount of ifdeffery required to adapt our code.

  doc/APIchanges  |  4 
  libavutil/buffer.c  | 14 +++---
  libavutil/buffer.h  | 32 
  libavutil/buffer_internal.h |  8 
  libavutil/internal.h|  7 +++
  libavutil/version.h |  5 -
  6 files changed, 58 insertions(+), 12 deletions(-)


The patchset prior to the bump LGTM
the patchset after the bump (thus enabled size_t) is probably ok but
i did not review this for downstream effects which could introduce bugs
when theres any code that expected the variables to be int


That's what 2+ years of advanced warning are for. Same as we did with 
the Crypto modules that will be switching to size_t in the upcoming bump.




code prior bump tested, code post bump not tested

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 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: add a get_encoder_buffer() callback to AVCodecContext

2021-03-10 Thread James Almer

On 3/10/2021 5:18 PM, Michael Niedermayer wrote:

On Mon, Feb 22, 2021 at 07:27:34PM -0300, James Almer wrote:

On 2/21/2021 6:04 PM, James Almer wrote:

On 2/21/2021 5:29 PM, Mark Thompson wrote:

On 21/02/2021 20:00, James Almer wrote:

On 2/21/2021 4:13 PM, Mark Thompson wrote:

On 21/02/2021 17:35, James Almer wrote:

This callback is functionally the same as get_buffer2()
is for decoders, and
implements for the new encode API the functionality of
the old encode API had
where the user could provide their own buffers.

Signed-off-by: James Almer 
---
Used the names Lynne suggested this time, plus a line
about how the callback
must be thread safe.

   libavcodec/avcodec.h | 45 
   libavcodec/codec.h   |  8 ---
   libavcodec/encode.c  | 54
+++-
   libavcodec/encode.h  |  8 +++
   libavcodec/options.c |  1 +
   5 files changed, 112 insertions(+), 4 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 7dbf083a24..e60eb16ce1 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -513,6 +513,11 @@ typedef struct AVProducerReferenceTime {
    */
   #define AV_GET_BUFFER_FLAG_REF (1 << 0)
+/**
+ * The encoder will keep a reference to the packet and
may reuse it later.
+ */
+#define AV_GET_ENCODER_BUFFER_FLAG_REF (1 << 0)
+
   struct AVCodecInternal;
   /**
@@ -2346,6 +2351,39 @@ typedef struct AVCodecContext {
    * - encoding: set by user
    */
   int export_side_data;
+
+    /**
+ * This callback is called at the beginning of each
packet to get a data
+ * buffer for it.
+ *
+ * The following field will be set in the packet
before this callback is
+ * called:
+ * - size
+ * This callback must use the above value to
calculate the required buffer size,
+ * which must padded by at least
AV_INPUT_BUFFER_PADDING_SIZE bytes.
+ *
+ * This callback must fill the following fields in the packet:
+ * - data


Is the data pointer allowed to be in write-only memory?


I'm not sure what the use case for this would be, so probably no?


The two use-cases I see for this API are:

* You want to avoid a copy when combining the output with something
else.  E.g. you pass a pointer to the block of memory following
where you are going to put your header data (for something you are
going to send over the network, say).

* You want to avoid a copy when passing the output directly to
something external.  E.g. you pass a pointer to a memory-mapped
device buffer (such as a V4L2 buffer, say).

In the second case, write-only memory on an external device seems
possible, as does memory which is, say, readable but uncached, so
reading it is a really bad idea.


Allowing the second case would depend on how encoders behave. Some may
attempt to read data already written to the output packet. It's not like
all of them allocate the packet, do a memcpy from an internal buffer,
then return.
There is also the flag meant to signal that the encoder will keep a
reference to the packet around, which more or less implies it will be
read later in the encoding process.

The doxy for avcodec_encode_video2(), which allowed the user to provide
their own buffers in the output packet, does not mention any kind of
requirement for the data pointer, so I don't think we can say it's an
allowed scenario here either.




Does it have any alignment requirements?


No, just padding. AVPacket doesn't require alignment for the payload.


I think say that explicitly.  avcodec_default_get_encoder_buffer()
does give you aligned memory, even though it isn't needed.


Would saying "There's no alignment requirement for the data pointer" add
anything of value to the doxy? If i don't mention any kind of alignment
requirement, it's because there isn't any, and it's implicit.
I listed the requirements the user needs to keep in mind, like the
padding and the need for an AVBufferRef. But if you think it's worth
adding, then sure.




+ * - buf must contain a pointer to an AVBufferRef
structure. The packet's
+ *   data pointer must be contained in it.
+ *   See: av_buffer_create(), av_buffer_alloc(),
and av_buffer_ref().
+ *
+ * If AV_CODEC_CAP_DR1 is not set then
get_encoder_buffer() must call
+ * avcodec_default_get_encoder_buffer() instead of
providing a buffer allocated by
+ * some other means.
+ *
+ * If AV_GET_ENCODER_BUFFER_FLAG_REF is set in
flags then the packet may be reused
+ * (read and/or written to if it is writable) later
by libavcodec.
+ *
+ * This callback must be thread-safe, as when frame
multithreading is used, it may
+ * be called from multiple threads simultaneously.


Allowing simulatenous calls feels unexpectedly tricky.  Is
it really necessary?


This was a suggestion by Lynne, i personally don't know. We
support frame threading encoding (For intra-only codecs), but
currently ff_alloc_packet2() does not seem to be thread safe,
seeing 

Re: [FFmpeg-devel] FFmpeg 4.4

2021-03-10 Thread Stephen Hutchinson

On 3/10/2021 2:48 PM, Marton Balint wrote:



On Tue, 9 Mar 2021, Stephen Hutchinson wrote:


On 3/9/2021 3:47 PM, Michael Niedermayer wrote:

Hi all

I will branch release/4.4 soon
then like always leave some time for testing, bugfixes, ... and then
make FFmeg 4.4 from release/4.4, its too long since 4.3


These three AviSynth demuxer patches should probably go in before 4.4:

http://ffmpeg.org/pipermail/ffmpeg-devel/2020-June/264269.html

http://ffmpeg.org/pipermail/ffmpeg-devel/2021-February/275893.html

http://ffmpeg.org/pipermail/ffmpeg-devel/2021-February/276389.html

That third one especially.


OK, I will apply these.

Regards,
Marton


There is one minor change to the RGB flipping patch that's needed
that I confirmed last night.

+LOAD_AVS_FUNC(avs_is_color_space, 0);

That actually needs to be 1, not 0.  Otherwise it breaks the
version check that tells people to upgrade if they're still
using 2.5.

I was going to send a fixed version of the patch later today.
___
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 4.4

2021-03-10 Thread Stephen Hutchinson

On 3/10/2021 2:48 PM, Marton Balint wrote:



On Tue, 9 Mar 2021, Stephen Hutchinson wrote:


On 3/9/2021 3:47 PM, Michael Niedermayer wrote:

Hi all

I will branch release/4.4 soon
then like always leave some time for testing, bugfixes, ... and then
make FFmeg 4.4 from release/4.4, its too long since 4.3


These three AviSynth demuxer patches should probably go in before 4.4:

http://ffmpeg.org/pipermail/ffmpeg-devel/2020-June/264269.html

http://ffmpeg.org/pipermail/ffmpeg-devel/2021-February/275893.html

http://ffmpeg.org/pipermail/ffmpeg-devel/2021-February/276389.html

That third one especially.


OK, I will apply these.

Regards,
Marton


There is one minor change to the RGB flipping patch that's needed
that I confirmed last night.

+LOAD_AVS_FUNC(avs_is_color_space, 0);

That actually needs to be 1, not 0.  Otherwise it breaks the
version check that tells people to upgrade if they're still
using 2.5.

I was going to send a fixed version of the patch later today.
___
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] TC rules results

2021-03-10 Thread Jean-Baptiste Kempf
Hello folks,

The results of the voting on the TC rules can be found here:
https://vote.ffmpeg.org/cgi-bin/civs/results.pl?id=E_f41036c4eb321ba1

The vote is positive one at 23 vs 1 on a 24-voting-population.
(The GA is composed of 40 persons.)

The rules mentioned here are therefore valid:
https://ffmpeg.org/pipermail/ffmpeg-devel/2021-February/276046.html 

Best,

-- 
Jean-Baptiste Kempf -  President
+33 672 704 734
___
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 v1] avformat/rtsp: RTP support buffer_size_size option

2021-03-10 Thread Marton Balint



On Tue, 9 Mar 2021, gaojiang...@live.com wrote:


From: Jiangjie Gao 

And forward it to udp.
issue: https://trac.ffmpeg.org/ticket/7517


Could you add the buffer_size option to the documentation of the 
RTP protocol?


Thanks,
Marton



Signed-off-by: Jiangjie Gao 
---
libavformat/rtsp.c | 5 -
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 9a2933346e..25bdf475b3 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -2506,12 +2506,15 @@ static int rtp_read_header(AVFormatContext *s)
RTSPState *rt = s->priv_data;
const char *p;
AVBPrint sdp;
+AVDictionary *opts = NULL;

if (!ff_network_init())
return AVERROR(EIO);

+opts = map_to_opts(rt);
ret = ffurl_open_whitelist(, s->url, AVIO_FLAG_READ,
- >interrupt_callback, NULL, s->protocol_whitelist, 
s->protocol_blacklist, NULL);
+ >interrupt_callback, , s->protocol_whitelist, 
s->protocol_blacklist, NULL);
+av_dict_free();
if (ret)
goto fail;

--
2.27.0.windows.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 45/48] doc/examples/vaapi_encode: use av_packet_alloc() to allocate packets

2021-03-10 Thread Michael Niedermayer
On Sat, Mar 06, 2021 at 06:45:57PM -0300, James Almer wrote:
> On 3/6/2021 6:35 PM, Michael Niedermayer wrote:
> > On Fri, Mar 05, 2021 at 01:33:36PM -0300, James Almer wrote:
> > > Signed-off-by: James Almer 
> > > ---
> > >   doc/examples/vaapi_encode.c | 16 
> > >   1 file changed, 8 insertions(+), 8 deletions(-)
> > > 
> > > diff --git a/doc/examples/vaapi_encode.c b/doc/examples/vaapi_encode.c
> > > index 707939db37..66cb949cdc 100644
> > > --- a/doc/examples/vaapi_encode.c
> > > +++ b/doc/examples/vaapi_encode.c
> > > @@ -74,27 +74,27 @@ static int set_hwframe_ctx(AVCodecContext *ctx, 
> > > AVBufferRef *hw_device_ctx)
> > >   static int encode_write(AVCodecContext *avctx, AVFrame *frame, FILE 
> > > *fout)
> > >   {
> > >   int ret = 0;
> > > -AVPacket enc_pkt;
> > > +AVPacket *enc_pkt;
> > > -av_init_packet(_pkt);
> > > -enc_pkt.data = NULL;
> > > -enc_pkt.size = 0;
> > > +if (!(enc_pkt = av_packet_alloc()))
> > > +return AVERROR(ENOMEM);
> > >   if ((ret = avcodec_send_frame(avctx, frame)) < 0) {
> > >   fprintf(stderr, "Error code: %s\n", av_err2str(ret));
> > >   goto end;
> > >   }
> > >   while (1) {
> > > -ret = avcodec_receive_packet(avctx, _pkt);
> > > +ret = avcodec_receive_packet(avctx, enc_pkt);
> > >   if (ret)
> > >   break;
> > > -enc_pkt.stream_index = 0;
> > > -ret = fwrite(enc_pkt.data, enc_pkt.size, 1, fout);
> > > -av_packet_unref(_pkt);
> > > +enc_pkt->stream_index = 0;
> > > +ret = fwrite(enc_pkt.data, enc_pkt->size, 1, fout);
> > > +av_packet_unref(enc_pkt);
> > >   }
> > >   end:
> > > +av_packet_free(_pkt);
> > >   ret = ((ret == AVERROR(EAGAIN)) ? 0 : -1);
> > >   return ret;
> > >   }
> > 
> > breaks:
> > doc/examples/vaapi_encode.c: In function ‘encode_write’:
> > doc/examples/vaapi_encode.c:92:29: error: ‘enc_pkt’ is a pointer; did you 
> > mean to use ‘->’?
> >   ret = fwrite(enc_pkt.data, enc_pkt->size, 1, fout);
> >   ^
> >   ->
> > ffbuild/common.mak:67: recipe for target 'doc/examples/vaapi_encode.o' 
> > failed
> > make: *** [doc/examples/vaapi_encode.o] Error 1
> > make: *** Waiting for unfinished jobs
> 
> Fixed locally. Thanks.

do you have a public git tree for testing such minor changes ?
so i can retest the update set easily 

thanks

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

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle


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] avcodec: add a get_encoder_buffer() callback to AVCodecContext

2021-03-10 Thread Michael Niedermayer
On Mon, Feb 22, 2021 at 07:27:34PM -0300, James Almer wrote:
> On 2/21/2021 6:04 PM, James Almer wrote:
> > On 2/21/2021 5:29 PM, Mark Thompson wrote:
> > > On 21/02/2021 20:00, James Almer wrote:
> > > > On 2/21/2021 4:13 PM, Mark Thompson wrote:
> > > > > On 21/02/2021 17:35, James Almer wrote:
> > > > > > This callback is functionally the same as get_buffer2()
> > > > > > is for decoders, and
> > > > > > implements for the new encode API the functionality of
> > > > > > the old encode API had
> > > > > > where the user could provide their own buffers.
> > > > > > 
> > > > > > Signed-off-by: James Almer 
> > > > > > ---
> > > > > > Used the names Lynne suggested this time, plus a line
> > > > > > about how the callback
> > > > > > must be thread safe.
> > > > > > 
> > > > > >   libavcodec/avcodec.h | 45 
> > > > > >   libavcodec/codec.h   |  8 ---
> > > > > >   libavcodec/encode.c  | 54
> > > > > > +++-
> > > > > >   libavcodec/encode.h  |  8 +++
> > > > > >   libavcodec/options.c |  1 +
> > > > > >   5 files changed, 112 insertions(+), 4 deletions(-)
> > > > > > 
> > > > > > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> > > > > > index 7dbf083a24..e60eb16ce1 100644
> > > > > > --- a/libavcodec/avcodec.h
> > > > > > +++ b/libavcodec/avcodec.h
> > > > > > @@ -513,6 +513,11 @@ typedef struct AVProducerReferenceTime {
> > > > > >    */
> > > > > >   #define AV_GET_BUFFER_FLAG_REF (1 << 0)
> > > > > > +/**
> > > > > > + * The encoder will keep a reference to the packet and
> > > > > > may reuse it later.
> > > > > > + */
> > > > > > +#define AV_GET_ENCODER_BUFFER_FLAG_REF (1 << 0)
> > > > > > +
> > > > > >   struct AVCodecInternal;
> > > > > >   /**
> > > > > > @@ -2346,6 +2351,39 @@ typedef struct AVCodecContext {
> > > > > >    * - encoding: set by user
> > > > > >    */
> > > > > >   int export_side_data;
> > > > > > +
> > > > > > +    /**
> > > > > > + * This callback is called at the beginning of each
> > > > > > packet to get a data
> > > > > > + * buffer for it.
> > > > > > + *
> > > > > > + * The following field will be set in the packet
> > > > > > before this callback is
> > > > > > + * called:
> > > > > > + * - size
> > > > > > + * This callback must use the above value to
> > > > > > calculate the required buffer size,
> > > > > > + * which must padded by at least
> > > > > > AV_INPUT_BUFFER_PADDING_SIZE bytes.
> > > > > > + *
> > > > > > + * This callback must fill the following fields in the packet:
> > > > > > + * - data
> > > > > 
> > > > > Is the data pointer allowed to be in write-only memory?
> > > > 
> > > > I'm not sure what the use case for this would be, so probably no?
> > > 
> > > The two use-cases I see for this API are:
> > > 
> > > * You want to avoid a copy when combining the output with something
> > > else.  E.g. you pass a pointer to the block of memory following
> > > where you are going to put your header data (for something you are
> > > going to send over the network, say).
> > > 
> > > * You want to avoid a copy when passing the output directly to
> > > something external.  E.g. you pass a pointer to a memory-mapped
> > > device buffer (such as a V4L2 buffer, say).
> > > 
> > > In the second case, write-only memory on an external device seems
> > > possible, as does memory which is, say, readable but uncached, so
> > > reading it is a really bad idea.
> > 
> > Allowing the second case would depend on how encoders behave. Some may
> > attempt to read data already written to the output packet. It's not like
> > all of them allocate the packet, do a memcpy from an internal buffer,
> > then return.
> > There is also the flag meant to signal that the encoder will keep a
> > reference to the packet around, which more or less implies it will be
> > read later in the encoding process.
> > 
> > The doxy for avcodec_encode_video2(), which allowed the user to provide
> > their own buffers in the output packet, does not mention any kind of
> > requirement for the data pointer, so I don't think we can say it's an
> > allowed scenario here either.
> > 
> > > 
> > > > > Does it have any alignment requirements?
> > > > 
> > > > No, just padding. AVPacket doesn't require alignment for the payload.
> > > 
> > > I think say that explicitly.  avcodec_default_get_encoder_buffer()
> > > does give you aligned memory, even though it isn't needed.
> > 
> > Would saying "There's no alignment requirement for the data pointer" add
> > anything of value to the doxy? If i don't mention any kind of alignment
> > requirement, it's because there isn't any, and it's implicit.
> > I listed the requirements the user needs to keep in mind, like the
> > padding and the need for an AVBufferRef. But if you think it's worth
> > adding, then sure.
> > 
> > > 
> > > > > > + * - buf must contain a pointer to an AVBufferRef
> > > > > > structure. The packet's
> 

Re: [FFmpeg-devel] [PATCH v4 2/2] avformat/gopher: Add support for Gopher over TLS.

2021-03-10 Thread Marton Balint



On Mon, 8 Mar 2021, Ivan J. wrote:


Bump for review.


Will apply the series.

Thanks,
Marton
___
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 4.4

2021-03-10 Thread Marton Balint



On Tue, 9 Mar 2021, Stephen Hutchinson wrote:


On 3/9/2021 3:47 PM, Michael Niedermayer wrote:

Hi all

I will branch release/4.4 soon
then like always leave some time for testing, bugfixes, ... and then
make FFmeg 4.4 from release/4.4, its too long since 4.3


These three AviSynth demuxer patches should probably go in before 4.4:

http://ffmpeg.org/pipermail/ffmpeg-devel/2020-June/264269.html

http://ffmpeg.org/pipermail/ffmpeg-devel/2021-February/275893.html

http://ffmpeg.org/pipermail/ffmpeg-devel/2021-February/276389.html

That third one especially.


OK, I will apply these.

Regards,
Marton
___
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 1/9 v3] avutil/buffer: change public function and struct size parameter types to size_t

2021-03-10 Thread Michael Niedermayer
On Sat, Mar 06, 2021 at 04:42:35PM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
> Changes since v2 is the addition of the buffer_size_t typedef to reduce the
> amount of ifdeffery required to adapt our code.
> 
>  doc/APIchanges  |  4 
>  libavutil/buffer.c  | 14 +++---
>  libavutil/buffer.h  | 32 
>  libavutil/buffer_internal.h |  8 
>  libavutil/internal.h|  7 +++
>  libavutil/version.h |  5 -
>  6 files changed, 58 insertions(+), 12 deletions(-)

The patchset prior to the bump LGTM
the patchset after the bump (thus enabled size_t) is probably ok but
i did not review this for downstream effects which could introduce bugs
when theres any code that expected the variables to be int

code prior bump tested, code post bump not tested

Thanks

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

The worst form of inequality is to try to make unequal things equal.
-- Aristotle


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 2/5] avdevice/alsa_dec: make sure we have enough data in non-blocking mode

2021-03-10 Thread Marton Balint



On Sat, 6 Mar 2021, Marton Balint wrote:




On Mon, 1 Mar 2021, Marton Balint wrote:

Otherwise we might return 1-2 samples per packet if av_read_frame() call 

rate is

only sligthly less than the stream sample rate.


Ping for this and the rest of the series. Note that the approach in 
this patch makes 1/5 unneeded because constant frame size is now indeed 
guaranteed.


Will apply the series soon.

Regards,
Marton



Signed-off-by: Marton Balint 
---
libavdevice/alsa.c |  5 +
libavdevice/alsa.h |  1 +
libavdevice/alsa_dec.c | 22 --
3 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/libavdevice/alsa.c b/libavdevice/alsa.c
index 117b2ea144..ee282fac16 100644
--- a/libavdevice/alsa.c
+++ b/libavdevice/alsa.c
@@ -286,6 +286,10 @@ av_cold int ff_alsa_open(AVFormatContext *ctx, 

snd_pcm_stream_t mode,

}
}

+s->pkt = av_packet_alloc();
+if (!s->pkt)
+goto fail1;
+
s->h = h;
return 0;

@@ -308,6 +312,7 @@ av_cold int ff_alsa_close(AVFormatContext *s1)
if (CONFIG_ALSA_INDEV)
ff_timefilter_destroy(s->timefilter);
snd_pcm_close(s->h);
+av_packet_free(>pkt);
return 0;
}

diff --git a/libavdevice/alsa.h b/libavdevice/alsa.h
index 1ed8c82199..07783c983a 100644
--- a/libavdevice/alsa.h
+++ b/libavdevice/alsa.h
@@ -58,6 +58,7 @@ typedef struct AlsaData {
void *reorder_buf;
int reorder_buf_size; ///< in frames
int64_t timestamp; ///< current timestamp, without latency applied.
+AVPacket *pkt;
} AlsaData;

/**
diff --git a/libavdevice/alsa_dec.c b/libavdevice/alsa_dec.c
index 6d568737b3..88bf32d25f 100644
--- a/libavdevice/alsa_dec.c
+++ b/libavdevice/alsa_dec.c
@@ -104,34 +104,36 @@ static int audio_read_packet(AVFormatContext *s1, 

AVPacket *pkt)

int64_t dts;
snd_pcm_sframes_t delay = 0;

-if (av_new_packet(pkt, s->period_size * s->frame_size) < 0) {
-return AVERROR(EIO);
+if (!s->pkt->data) {
+int ret = av_new_packet(s->pkt, s->period_size * s->frame_size);
+if (ret < 0)
+return ret;
+s->pkt->size = 0;
}

-while ((res = snd_pcm_readi(s->h, pkt->data, s->period_size)) < 0) {
+do {
+while ((res = snd_pcm_readi(s->h, s->pkt->data + s->pkt->size, 

s->period_size - s->pkt->size / s->frame_size)) < 0) {

if (res == -EAGAIN) {
-av_packet_unref(pkt);
-
return AVERROR(EAGAIN);
}
+s->pkt->size = 0;
if (ff_alsa_xrun_recover(s1, res) < 0) {
av_log(s1, AV_LOG_ERROR, "ALSA read error: %s\n",
   snd_strerror(res));
-av_packet_unref(pkt);
-
return AVERROR(EIO);
}
ff_timefilter_reset(s->timefilter);
-}
+}
+s->pkt->size += res * s->frame_size;
+} while (s->pkt->size < s->period_size * s->frame_size);

+av_packet_move_ref(pkt, s->pkt);
dts = av_gettime();
snd_pcm_delay(s->h, );
dts -= av_rescale(delay + res, 100, s->sample_rate);
pkt->pts = ff_timefilter_update(s->timefilter, dts, s->last_period);
s->last_period = res;

-pkt->size = res * s->frame_size;
-
return 0;
}

--
2.26.2

___
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 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/7] lavc: move decoder bsf init into decoder-specific code

2021-03-10 Thread James Almer

On 3/10/2021 10:52 AM, Andreas Rheinhardt wrote:

James Almer:

On 3/10/2021 9:03 AM, Anton Khirnov wrote:

---
   libavcodec/decode.c | 8 +++-
   libavcodec/decode.h | 6 --
   libavcodec/utils.c  | 6 --
   3 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index e5a301ec58..d25b15e95a 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -184,7 +184,7 @@ static int extract_packet_props(AVCodecInternal
*avci, const AVPacket *pkt)
   return 0;
   }
   -int ff_decode_bsfs_init(AVCodecContext *avctx)
+static int decode_bsfs_init(AVCodecContext *avctx)
   {
   AVCodecInternal *avci = avctx->internal;
   int ret;
@@ -2010,6 +2010,8 @@ int ff_reget_buffer(AVCodecContext *avctx,
AVFrame *frame, int flags)
     int ff_decode_preinit(AVCodecContext *avctx)
   {
+    int ret = 0;
+
   /* if the decoder init function was already called previously,
    * free the already allocated subtitle_header before overwriting
it */
   av_freep(>subtitle_header);
@@ -2046,5 +2048,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
   avctx->export_side_data |= AV_CODEC_EXPORT_DATA_MVS;
   }
   +    ret = decode_bsfs_init(avctx);


Did you try to run fate with THREADS set to something other than 1? This
moves the bsfs initialization after ff_thread_init(), so all the copies
of avctx in frame threading scenarios will be missing the bsfs requested
by the decoder.



For frame threaded decoders the codec's decode function is directly run
with the child AVCodecContext; they don't need the bsfs: The parent's
bsf has already been run on the packets before the frame threaded code
is reached.


Alright, should be ok, then.




fate-vp9 should be enough to confirm this, since afaik it's the only
frame threaded decoder that uses a bsf.


+    if (ret < 0)
+    return ret;
+
   return 0;
   }
diff --git a/libavcodec/decode.h b/libavcodec/decode.h
index a865fe954f..1467b1eb33 100644
--- a/libavcodec/decode.h
+++ b/libavcodec/decode.h
@@ -69,12 +69,6 @@ int ff_decode_get_packet(AVCodecContext *avctx,
AVPacket *pkt);
    */
   int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame);
   -/**
- * Called during avcodec_open2() to initialize avctx->internal->bsf.
- * The bsf should be freed with av_bsf_free().
- */
-int ff_decode_bsfs_init(AVCodecContext *avctx);
-
   /**
    * Make sure avctx.hw_frames_ctx is set. If it's not set, the
function will
    * try to allocate it from hw_device_ctx. If that is not possible,
an error
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 6d5aeb4eaf..918cb1b4d1 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -730,12 +730,6 @@ int attribute_align_arg
avcodec_open2(AVCodecContext *avctx, const AVCodec *code
   goto free_and_end;
   }
   -    if (av_codec_is_decoder(avctx->codec)) {
-    ret = ff_decode_bsfs_init(avctx);
-    if (ret < 0)
-    goto free_and_end;
-    }
-
   if (HAVE_THREADS
   && !(avci->frame_thread_encoder &&
(avctx->active_thread_type_THREAD_FRAME))) {
   ret = ff_thread_init(avctx);



___
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 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] fftools/ffplay: do not write out of rdft visualization texture

2021-03-10 Thread Marton Balint



On Mon, 8 Mar 2021, Michael Niedermayer wrote:


On Mon, Mar 08, 2021 at 09:56:38PM +0100, Marton Balint wrote:



On Sun, 7 Mar 2021, Michael Niedermayer wrote:


On Wed, Mar 03, 2021 at 11:27:22PM +0100, Marton Balint wrote:

If the window is resized it was possible that xpos pointed outside the
visualization texture. By rearranging the overflow check we make sure this (and
a crash) does not happen.




We also don't have to use xleft for start position, as that is 0 anyways, and
if we ever want to take into account xleft then the texture should be
positioned accordingly when rendering.


reading this, i wonder if a assertion with xleft == 0 would make sense


I don't really see the point.


It was just an idea that came to my mind without any deep thoughts



I'd rather add the xleft/ytop to the render if
you prefer, but overall I don't think it matters.


please do what you prefer!


Ok, thanks, pushed as is then.

Regards,
Marton
___
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] doc/APIchanges: Fill in some missing information

2021-03-10 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 doc/APIchanges | 48 
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 4027d599e7..eeecc102e8 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,87 +15,87 @@ libavutil: 2017-10-21
 
 API changes, most recent first:
 
-2021-03-04 - xx - lavc 58.128.101 - avcodec.h
+2021-03-04 - a0eec776b6 - lavc 58.128.101 - avcodec.h
   Enable err_recognition to be set for encoders.
 
-2021-03-03 - xx - lavf 58.70.100 - avformat.h
+2021-03-03 - 2ff40b98ec - lavf 58.70.100 - avformat.h
   Deprecate AVFMT_FLAG_PRIV_OPT. It will do nothing
   as soon as av_demuxer_open() is removed.
 
-2021-02-27 - xx - lavc 58.126.100 - avcodec.h
+2021-02-27 - dd9227e48f - lavc 58.126.100 - avcodec.h
   Deprecated avcodec_get_frame_class().
 
-2021-02-21 - xx - lavu 56.66.100 - tx.h
+2021-02-21 - 5ca40d6d94 - lavu 56.66.100 - tx.h
   Add enum AVTXFlags and AVTXFlags.AV_TX_INPLACE
 
-2021-02-14 - xx - lavd 58.12.100 - avdevice.h
+2021-02-14 - 4f49ca7bbc - lavd 58.12.100 - avdevice.h
   Deprecated avdevice_capabilities_create() and
   avdevice_capabilities_free().
 
-2021-02-xx - xx - lavu 56.xx.100 - common.h
+2021-02-10 - 1bda9bb68a - lavu 56.65.100 - common.h
   Add FFABS64U()
 
-2021-01-26 - xx - lavu 56.64.100 - common.h
+2021-01-26 - 5dd9567080 - lavu 56.64.100 - common.h
   Add FFABSU()
 
-2021-01-25 - xx - lavc 58.119.100 - avcodec.h
+2021-01-25 - 56709ca8aa - lavc 58.119.100 - avcodec.h
   Deprecate AVCodecContext.debug_mv, FF_DEBUG_VIS_MV_P_FOR, 
FF_DEBUG_VIS_MV_B_FOR,
   FF_DEBUG_VIS_MV_B_BACK
 
-2021-01-11 - xx - lavc 58.116.100 - avcodec.h
+2021-01-11 - ebdd33086a - lavc 58.116.100 - avcodec.h
   Add FF_PROFILE_VVC_MAIN_10 and FF_PROFILE_VVC_MAIN_10_444.
 
-2020-xx-xx - xx - lavu 56.63.100 - video_enc_params.h
+2020-01-01 - baecaa16c1 - lavu 56.63.100 - video_enc_params.h
   Add AV_VIDEO_ENC_PARAMS_MPEG2
 
-2020-12-03 - xx - lavu 56.62.100 - timecode.h
+2020-12-03 - eca12f4d5a - lavu 56.62.100 - timecode.h
   Add av_timecode_init_from_components.
 
-2020-xx-xx - xx - lavc 58.114.100 - avcodec.h
+2020-11-27 - a83098ab03 - lavc 58.114.100 - avcodec.h
   Deprecate AVCodecContext.thread_safe_callbacks. Starting with
   LIBAVCODEC_VERSION_MAJOR=60, user callbacks must always be
   thread-safe when frame threading is used.
 
-2020-11-25 - xx - lavc 58.113.100 - avcodec.h
+2020-11-25 - d243dd540a - lavc 58.113.100 - avcodec.h
   Adds a new flag AV_CODEC_EXPORT_DATA_FILM_GRAIN for export_side_data.
 
-2020-11-25 - xx - lavu 56.61.100 - film_grain_params.h
+2020-11-25 - 4f9ee87253 - lavu 56.61.100 - film_grain_params.h
   Adds a new API for extracting codec film grain parameters as side data.
   Adds a new AVFrameSideDataType entry AV_FRAME_DATA_FILM_GRAIN_PARAMS for it.
 
-2020-xx-xx - xx - lavf 58.64.100 - avformat.h
+2020-10-28 - f95d9510ff - lavf 58.64.100 - avformat.h
   Add AVSTREAM_EVENT_FLAG_NEW_PACKETS.
 
-2020-xx-xx - xx - lavu 56.60.100 - buffer.h
+2020-09-28 - 68918d3b7f - lavu 56.60.100 - buffer.h
   Add a av_buffer_replace() convenience function.
 
-2020-09-xx - xx - lavu 56.59.100 - timecode.h
+2020-09-13 - 837b6eb90e - lavu 56.59.100 - timecode.h
   Add av_timecode_make_smpte_tc_string2.
 
-2020-08-21 - xx - lavu 56.58.100 - avstring.h
+2020-08-21 - 06f2651204 - lavu 56.58.100 - avstring.h
   Deprecate av_d2str(). Use av_asprintf() instead.
 
-2020-08-04 - xx - lavu 56.58.100 - channel_layout.h
+2020-08-04 - 34de0abbe7 - lavu 56.58.100 - channel_layout.h
   Add AV_CH_LAYOUT_22POINT2 together with its newly required pieces:
   AV_CH_TOP_SIDE_LEFT, AV_CH_TOP_SIDE_RIGHT, AV_CH_BOTTOM_FRONT_CENTER,
   AV_CH_BOTTOM_FRONT_LEFT, AV_CH_BOTTOM_FRONT_RIGHT.
 
-2020-07-xx - xx - lavu 56.57.100 - cpu.h
+2020-07-23 - 84655b7101 - lavu 56.57.100 - cpu.h
   Add AV_CPU_FLAG_MMI and AV_CPU_FLAG_MSA.
 
-2020-07-xx - xx - lavu 56.56.100 - imgutils.h
+2020-07-22 - 3a8e927176 - lavu 56.56.100 - imgutils.h
   Add av_image_fill_plane_sizes().
 
-2020-07-xx - xx - lavc 58.96.100 - packet.h
+2020-07-15 - 448a9aaa78 - lavc 58.96.100 - packet.h
   Add AV_PKT_DATA_S12M_TIMECODE.
 
 2020-06-12 - b09fb030c1 - lavu 56.55.100 - pixdesc.h
   Add AV_PIX_FMT_X2RGB10.
 
-2020-06-xx - xx - lavu 56.54.100 - frame.h
+2020-06-11 - bc8ab084fb - lavu 56.54.100 - frame.h
   Add AV_FRAME_DATA_SEI_UNREGISTERED.
 
-2020-06-xx - xx - lavu 56.53.100 - log.h opt.h
+2020-06-10 - 1b4a98b029 - lavu 56.53.100 - log.h opt.h
   Add av_opt_child_class_iterate() and AVClass.child_class_iterate().
   Deprecate av_opt_child_class_next() and AVClass.child_class_next().
 
-- 
2.17.1

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

To unsubscribe, 

Re: [FFmpeg-devel] [PATCH 1/2] avcodec/4xm: Check pre_gb in decode_i_block()

2021-03-10 Thread Paul B Mahol
while there fix style issue

On Wed, Mar 10, 2021 at 7:30 PM Michael Niedermayer 
wrote:

> Fixes: Timeout
> Fixes:
> 31257/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FOURXM_fuzzer-5150866229297152
>
> 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, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c
> index 4d58b093f7..5e0f0c689c 100644
> --- a/libavcodec/4xm.c
> +++ b/libavcodec/4xm.c
> @@ -499,8 +499,8 @@ static int decode_i_block(FourXContext *f, int16_t
> *block)
>  {
>  int code, i, j, level, val;
>
> -if (get_bits_left(>gb) < 2){
> -av_log(f->avctx, AV_LOG_ERROR, "%d bits left before
> decode_i_block()\n", get_bits_left(>gb));
> +if (get_bits_left(>pre_gb) < 2){
> +av_log(f->avctx, AV_LOG_ERROR, "%d bits left before
> decode_i_block()\n", get_bits_left(>pre_gb));
>  return AVERROR_INVALIDDATA;
>  }
>
> --
> 2.17.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".

[FFmpeg-devel] [PATCH 1/2] avcodec/4xm: Check pre_gb in decode_i_block()

2021-03-10 Thread Michael Niedermayer
Fixes: Timeout
Fixes: 
31257/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FOURXM_fuzzer-5150866229297152

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, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c
index 4d58b093f7..5e0f0c689c 100644
--- a/libavcodec/4xm.c
+++ b/libavcodec/4xm.c
@@ -499,8 +499,8 @@ static int decode_i_block(FourXContext *f, int16_t *block)
 {
 int code, i, j, level, val;
 
-if (get_bits_left(>gb) < 2){
-av_log(f->avctx, AV_LOG_ERROR, "%d bits left before 
decode_i_block()\n", get_bits_left(>gb));
+if (get_bits_left(>pre_gb) < 2){
+av_log(f->avctx, AV_LOG_ERROR, "%d bits left before 
decode_i_block()\n", get_bits_left(>pre_gb));
 return AVERROR_INVALIDDATA;
 }
 
-- 
2.17.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".

Re: [FFmpeg-devel] [PATCH v4] libsvtav1: Add logical_processors option

2021-03-10 Thread Christopher Degawa
> You should restrict the line length here, just for consistency with the
> rest of this document. (It doesn't affect the formatting of the output
> documents, obviously.)
>
What would be a good line length for the docs to aim for? 75?


> > +unsigned logical_processors;
>
> The libsvtav1 API defines this as uint32_t, so I believe you should
> mirror that.
>
Changed locally, didn't see any other usage of stdint.h types in the file
so I just followed along



> > +  AV_OPT_TYPE_INT, { .i64 = 0 }, 0,  INT_MAX, VE },
>
> Probably UINT_MAX, though I doubt that such a number of processors will
> be reached. ;-) I don't know whether there's another natural limit
> within libsvtav1.
>
Changed locally, hopefully, one day this limit will actually have a use
(crossed fingers for AMD or some potentially arm or riscv).

The only internal limits I am aware of is the return type of sysconf being
shortened to uint32_t and windows' DWORD length

Thanks, Chris
___
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][RFC - DO NOT MERGE] Revert "mov: Discard invalid CTTS."

2021-03-10 Thread Derek Buitenhuis
On 10/03/2021 17:24, Michael Niedermayer wrote:
> what does the muxer exactly do ?

I provided an explanation of what is happening during the broken muxing 
in my original email, as well as a sample, and a text dump of the boxes.
Please see those.

Can you please actually fully read my emails and samples before going on
long tangents about theortical things or what could be?

> Let me give an example (totally made up but to explain my point)
> if each ctts value for example has its file position added to it
> that can be reverted and the original ctts fully recovered.
> (also a user app cannot do this, only the demuxer could as the user app
>  has no knowledge of the atoms file position)
> 
> Does it store uninintialized memory then it would not be revertable but
> it did not sound like thats whats happening.

This example is neither useful nor relevant to the case at hand. I described
what is happening, and provided a sample: mid-way through the CTTS box, the 
entry
durations start incrementing, i.e. growing, rather than matching the reordering.
Please see the sample I provided, and also the dump of the boxes as text I 
provided.

These theortical and vague replies are not actionable. They're bordering on 
philosophical
musings.

> about never modifying data, for that a system similar to workaround_bugs
> we have on the decoder side could be added. But its not really the users
> job to do this. The demuxer should already return as much recoverable
> data as possible.

But it's not. It's returning NO data rather than what is in the file. It
is completely dropping all timestamps and making them up, based on nothing.
There is *not* better. It's not fixing or salvaging anything. It's just making
it broken in a different way. And it is not even doing it consistently. It is
doing it only when an arbitrary number is reached, so as an API user, I can't
even consistently handle these.

I gave *exact* options to choose from in my original mail, as a well as a sample
and a description of the problem - I am asking which should be chosen, or to
suggest a different one in clear, actionable terms.

- Derek
___
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] libsvtav1: Add logical_processors option

2021-03-10 Thread Moritz Barsnick
On Wed, Mar 10, 2021 at 00:12:34 -0600, Christopher Degawa wrote:
> +@item logical_processors
> +Number of logical processors to run the encoder on, threads are managed by 
> the OS scheduler.
> +Used for limiting the size of memory buffers and threads for a target 
> logical processor count.
> +Does not set thread affinity or total threads, but instead sets t * 
> logical_processors amount of threads
> +with t being the amount of threads libsvtav1 sets per cpu (0 - ncpus).

You should restrict the line length here, just for consistency with the
rest of this document. (It doesn't affect the formatting of the output
documents, obviously.)

> +unsigned logical_processors;

The libsvtav1 API defines this as uint32_t, so I believe you should
mirror that.

> +  AV_OPT_TYPE_INT, { .i64 = 0 }, 0,  INT_MAX, VE },

Probably UINT_MAX, though I doubt that such a number of processors will
be reached. ;-) I don't know whether there's another natural limit
within libsvtav1.

Cheers,
Moritz
___
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][RFC - DO NOT MERGE] Revert "mov: Discard invalid CTTS."

2021-03-10 Thread Michael Niedermayer
On Wed, Mar 10, 2021 at 03:29:46PM +, Derek Buitenhuis wrote:
> On 08/03/2021 17:29, Michael Niedermayer wrote:
> > I would try to detect the specific abberant muxer based on the input. 
> > Then have custom code in the demuxer which is based on reverse engnenering 
> > the 
> > issue to do a best effort to recover as much as is possible. And also print 
> > a big 
> > warning about the broken input / muxer so the user doesnt stay unaware.
> 
> I mean, I already listed the options in my email. Best you can do is try and 
> check
> for insane PTS/DTS diff (I proposed 16 frames), and the 'fix' of dropping the 
> CTTS
> info just makes it broken in a different way.

> 
> > You can see this also in 2 ways
> > 1. It sucks its not our job to workaround someone elses bugs
> > 2. It cool, it gives FFmpegs demuxer a unique advantage over competing 
> > demuxers
> 
> As an API user, I do not see returning made up PTS/DTS rather than what is in 
> file
> as an advantage. At least if I have what is in the file, I can make my own 
> decisions
> in my program, on how to handle it.
> 
> As it stands right now, as detailed in my previous mail, I have no way to 
> even detect
> these files since avformat handles them differently depending on if the file 
> hits
> the arbitary number of 1<<28.
> 
> What I'm looking for here is something actionable: I know what the 
> possibilities are
> for changes/fixes. Which the community prefers are not clear. As it stands, 
> it is
> just broken.

what does the muxer exactly do ?

Let me give an example (totally made up but to explain my point)
if each ctts value for example has its file position added to it
that can be reverted and the original ctts fully recovered.
(also a user app cannot do this, only the demuxer could as the user app
 has no knowledge of the atoms file position)

Does it store uninintialized memory then it would not be revertable but
it did not sound like thats whats happening.

about never modifying data, for that a system similar to workaround_bugs
we have on the decoder side could be added. But its not really the users
job to do this. The demuxer should already return as much recoverable
data as possible.

thanks

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

I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- 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".

[FFmpeg-devel] [PATCH] avcodec/gifenc: Actually use the shrunk palette

2021-03-10 Thread Derek Buitenhuis
I have no idea how nobody, including myself, noticed this.

Signed-off-by: Derek Buitenhuis 
---
 libavcodec/gif.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavcodec/gif.c b/libavcodec/gif.c
index 938bc0e928..cafd93e190 100644
--- a/libavcodec/gif.c
+++ b/libavcodec/gif.c
@@ -383,13 +383,12 @@ static int gif_image_write_image(AVCodecContext *avctx,
 bytestream_put_le16(bytestream, height);
 
 if (palette || !s->use_global_palette) {
-const uint32_t *pal = palette ? palette : s->palette;
 unsigned pow2_count = av_log2(shrunk_palette_count - 1);
 unsigned i;
 
 bytestream_put_byte(bytestream, 1<<7 | pow2_count); /* flags */
 for (i = 0; i < 1 << (pow2_count + 1); i++) {
-const uint32_t v = pal[i];
+const uint32_t v = shrunk_palette[i];
 bytestream_put_be24(bytestream, v);
 }
 } else {
-- 
2.30.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] [FFmpeg-web][PATCH] web/download: add signing key and verification instructions

2021-03-10 Thread Thilo Borgmann
Am 10.03.21 um 09:25 schrieb Zane van Iperen:
> Before you do, just give it a crack locally.
> 
> I couldn't get the cloned version of the site to look identical to what's 
> already published (something to do with incorrect CSS symlinks iirc). It's 
> probably fine, but for something like this I'd rather err on the side of 
> caution.

I know this problem and I'm happily ignoring it - because the style thingys are 
living happily on the server and look like intended.

So I don't expect any problems. If so, its the website being a bit more ugly 
for maybe some short time...
Not doing it today anyway, so you can still test on if you feel the desire to 
get a 1:1 website locally.

-Thilo

> 
> On 8/3/21 11:24 pm, Thilo Borgmann wrote:
>> Am 24.02.21 um 17:53 schrieb Thilo Borgmann:
>>> Am 24.02.21 um 05:06 schrieb Zane van Iperen:
 As per discussion at [1]. Patches attached.

 Patch 1/3 adds /node_modules/ to .gitignore

 Patch 2/3 adds the actual key and verification instructions

 Patch 3/3 adds a prominent download link for the public key.
 This might be bit obnoxious, but it was suggested in the original 
 discussion.

 [1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2021-February/276752.html
>>>
>>> As in [1] above I like that idea. However, I can't really comment on the 
>>> technical side of keys and signatures. So proper someones opinion with 
>>> actual knowledge would be appreciated.
>>
>> If there are no complains, I'll push that soon (tm).
>>
>> -Thilo
>> ___
>> 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 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] avutil/frame: ensure the frame is writable in av_frame_copy()

2021-03-10 Thread James Almer
Signed-off-by: James Almer 
---
 libavutil/frame.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavutil/frame.c b/libavutil/frame.c
index eab51b6a32..ec79d053e1 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -800,6 +800,8 @@ int av_frame_copy(AVFrame *dst, const AVFrame *src)
 {
 if (dst->format != src->format || dst->format < 0)
 return AVERROR(EINVAL);
+if (!av_frame_is_writable(dst))
+return AVERROR(EINVAL);
 
 if (dst->width > 0 && dst->height > 0)
 return frame_copy_video(dst, src);
-- 
2.30.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] [PATCH] avformat/mov: Properly consider if the file is self-initializing when marking sidx reading complete

2021-03-10 Thread Derek Buitenhuis
Files with the "dash" major brand are guaranteed to only have a single
initialization range for the whole file. We can check this and stop
appropriately - which is useful, as the existing check to see if the
offset reaches the end of the file is not sufficient. For example,
YouTube creates valid self-initializing ISOBMFF files that contain
a single 'uuid' box appended at the end, after the last 'moof', and
this check does not catch that, which causes, for example, probing
to traverse the entire file (every single 'moof'), which is extremely
slow over a network, which is the main place these self-initializing
fragmented ISOBMFF files would be used. This is the same behavior that
was addressed in 2ff3c466eca66bb8eb32bb41a4ce70fe285e3ea0 for live-style
fragmented files.

Signed-off-by: Derek Buitenhuis 
---
 libavformat/mov.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 1c07cff6b5..67eae24e02 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -5052,6 +5052,7 @@ static int mov_read_sidx(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 AVStream *ref_st = NULL;
 MOVStreamContext *sc, *ref_sc = NULL;
 AVRational timescale;
+AVDictionaryEntry *major_brand = av_dict_get(c->fc->metadata, 
"major_brand", NULL, AV_DICT_MATCH_CASE);
 
 version = avio_r8(pb);
 if (version > 1) {
@@ -5120,7 +5121,11 @@ static int mov_read_sidx(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 sc->has_sidx = 1;
 
 // See if the remaining bytes are just an mfra which we can ignore.
-is_complete = offset == stream_size;
+//
+// Also check to see if the file is Self-initializing, which guarantees
+// only a single initialization range is present for the whole file.
+// See: ISO-IEC 23009-1 Section 6.3.5.
+is_complete = offset == stream_size || (major_brand && 
!strncmp(major_brand->value, "dash", 4));
 if (!is_complete && (pb->seekable & AVIO_SEEKABLE_NORMAL)) {
 int64_t ret;
 int64_t original_pos = avio_tell(pb);
-- 
2.30.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][RFC - DO NOT MERGE] Revert "mov: Discard invalid CTTS."

2021-03-10 Thread Derek Buitenhuis
On 08/03/2021 17:29, Michael Niedermayer wrote:
> I would try to detect the specific abberant muxer based on the input. 
> Then have custom code in the demuxer which is based on reverse engnenering 
> the 
> issue to do a best effort to recover as much as is possible. And also print a 
> big 
> warning about the broken input / muxer so the user doesnt stay unaware.

I mean, I already listed the options in my email. Best you can do is try and 
check
for insane PTS/DTS diff (I proposed 16 frames), and the 'fix' of dropping the 
CTTS
info just makes it broken in a different way.

> You can see this also in 2 ways
> 1. It sucks its not our job to workaround someone elses bugs
> 2. It cool, it gives FFmpegs demuxer a unique advantage over competing 
> demuxers

As an API user, I do not see returning made up PTS/DTS rather than what is in 
file
as an advantage. At least if I have what is in the file, I can make my own 
decisions
in my program, on how to handle it.

As it stands right now, as detailed in my previous mail, I have no way to even 
detect
these files since avformat handles them differently depending on if the file 
hits
the arbitary number of 1<<28.

What I'm looking for here is something actionable: I know what the 
possibilities are
for changes/fixes. Which the community prefers are not clear. As it stands, it 
is
just broken.

- Derek
___
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 1/7] lavc: factor out encoder init/validation from avcodec_open2()

2021-03-10 Thread James Almer

On 3/10/2021 9:03 AM, Anton Khirnov wrote:

avcodec_open2() is massive, splitting it makes it more readable.

Also, add a missing error code to ticks_per_frame sanity check.
---
  libavcodec/encode.c | 157 +
  libavcodec/encode.h |   6 ++
  libavcodec/utils.c  | 166 +---
  3 files changed, 166 insertions(+), 163 deletions(-)

diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index 282337e453..bbf03d62fc 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -462,3 +462,160 @@ int attribute_align_arg 
avcodec_encode_video2(AVCodecContext *avctx,
  return ret;
  }
  #endif
+
+int ff_encode_preinit(AVCodecContext *avctx)


nit: Would prefer if this and ff_decode_preinit() could stay in the same 
file as avcodec_open2() as static functions. This includes moving 
decode_bsfs_init() there, too.
decode.c and encode.c seem to me that they should contain functions used 
during decoding and encoding, and not initialization.


That being said, not related to this set and not really a priority, but 
avcodec_open2() is not a "utility" function as much as a core lavc 
function. av_get_bits_per_sample() for example is a util, as are 
av_get_audio_frame_duration() and avcodec_align_dimensions2(). So 
perhaps it, avcodec_alloc_context3() and avcodec_free_context() should 
be together (options.c is also not exactly the best name for the file 
currently hosting the latter two, so maybe it could be renamed to 
avcodec.c while at it).

___
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] avcodec/mediacodec_wrapper: use MediaCodecInfo.isSoftwareOnly() when available

2021-03-10 Thread Matthieu Bouron
On Mon, Mar 08, 2021 at 10:12:38AM +0100, Matthieu Bouron wrote:
> On Wed, Feb 17, 2021 at 04:51:09PM +0100, sfan5 wrote:
> > 
> 
> > From 22ebde779f61fb030633a881ef320264ea446b6b Mon Sep 17 00:00:00 2001
> > From: sfan5 
> > Date: Thu, 11 Feb 2021 20:48:54 +0100
> > Subject: [PATCH 2/2] avcodec/mediacodec_wrapper: use
> >  MediaCodecInfo.isSoftwareOnly() when available
> > 
> > Added in Android 10 it provides a reliable way of filtering out
> > software decoders, unlike existing string-based checks.
> > ---
> >  libavcodec/mediacodec_wrapper.c | 13 +
> >  1 file changed, 13 insertions(+)
> > 
> > diff --git a/libavcodec/mediacodec_wrapper.c 
> > b/libavcodec/mediacodec_wrapper.c
> > index f1945bcfc0..c829941d6b 100644
> > --- a/libavcodec/mediacodec_wrapper.c
> > +++ b/libavcodec/mediacodec_wrapper.c
> > @@ -45,6 +45,7 @@ struct JNIAMediaCodecListFields {
> >  jmethodID get_codec_capabilities_id;
> >  jmethodID get_supported_types_id;
> >  jmethodID is_encoder_id;
> > +jmethodID is_software_only_id;
> >  
> >  jclass codec_capabilities_class;
> >  jfieldID color_formats_id;
> > @@ -81,6 +82,7 @@ static const struct FFJniField 
> > jni_amediacodeclist_mapping[] = {
> >  { "android/media/MediaCodecInfo", "getCapabilitiesForType", 
> > "(Ljava/lang/String;)Landroid/media/MediaCodecInfo$CodecCapabilities;", 
> > FF_JNI_METHOD, offsetof(struct JNIAMediaCodecListFields, 
> > get_codec_capabilities_id), 1 },
> >  { "android/media/MediaCodecInfo", "getSupportedTypes", 
> > "()[Ljava/lang/String;", FF_JNI_METHOD, offsetof(struct 
> > JNIAMediaCodecListFields, get_supported_types_id), 1 },
> >  { "android/media/MediaCodecInfo", "isEncoder", "()Z", 
> > FF_JNI_METHOD, offsetof(struct JNIAMediaCodecListFields, is_encoder_id), 1 
> > },
> > +{ "android/media/MediaCodecInfo", "isSoftwareOnly", "()Z", 
> > FF_JNI_METHOD, offsetof(struct JNIAMediaCodecListFields, 
> > is_software_only_id), 0 },
> >  
> >  { "android/media/MediaCodecInfo$CodecCapabilities", NULL, NULL, 
> > FF_JNI_CLASS, offsetof(struct JNIAMediaCodecListFields, 
> > codec_capabilities_class), 1 },
> >  { "android/media/MediaCodecInfo$CodecCapabilities", 
> > "colorFormats", "[I", FF_JNI_FIELD, offsetof(struct 
> > JNIAMediaCodecListFields, color_formats_id), 1 },
> > @@ -441,6 +443,17 @@ char *ff_AMediaCodecList_getCodecNameByType(const char 
> > *mime, int profile, int e
> >  goto done_with_info;
> >  }
> >  
> > +if (jfields.is_software_only_id) {
> > +int is_software_only = (*env)->CallBooleanMethod(env, info, 
> > jfields.is_software_only_id);
> > +if (ff_jni_exception_check(env, 1, log_ctx) < 0) {
> > +goto done;
> > +}
> > +
> > +if (is_software_only) {
> > +goto done_with_info;
> > +}
> > +}
> > +
> >  codec_name = (*env)->CallObjectMethod(env, info, 
> > jfields.get_name_id);
> >  if (ff_jni_exception_check(env, 1, log_ctx) < 0) {
> >  goto done;
> > -- 
> > 2.30.1
> > 
> 
> LGTM, I'll push the patch in two days if there is no objection.
> Thanks,

Applied as a7425f712aeed6e18204a68810529895fdbdb1be.
Thanks.

-- 
Matthieu B.
___
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] avcodec/h264_slice: don't copy frame data during error concealment

2021-03-10 Thread Michael Niedermayer
On Mon, Mar 08, 2021 at 11:36:00PM -0300, James Almer wrote:
> In addition to the fact that av_image_copy() cannot handle hardware pixel
> formats, h->short_ref[0]->f may not even be writable at this point.
> 
> Based on a patch by Hendrik Leppkes.
> 
> Signed-off-by: James Almer 
> ---
> This is an alternative to "avcodec/h264_slice: properly handle missing
> reference frames with hwaccel", given that I noticed that the target frame is
> not writable for example when running fate-h264-missing-frame.
> 
> To keep the current behavior of copying the frame data instead of making a
> reference, I also tried to do ff_thread_release_buffer() ->
> ff_thread_get_buffer() -> av_frame_copy(), which worked with software 
> decoding,
> but when using the d3d11va hwaccel the av_frame_copy() call would fail.
> 
> There is a warning above this code that makes it sound like making references
> is not ideal, but considering h->short_ref[0] is not writable here it feels
> like it could be an outdated comment that someone forgot to remove.
> 
>  libavcodec/h264_slice.c | 12 +---
>  1 file changed, 5 insertions(+), 7 deletions(-)

This seems to produce infinite loops with some fuzzed samples
ill mail you one privatly

thx

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

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle


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/7] lavc: move decoder bsf init into decoder-specific code

2021-03-10 Thread Andreas Rheinhardt
James Almer:
> On 3/10/2021 9:03 AM, Anton Khirnov wrote:
>> ---
>>   libavcodec/decode.c | 8 +++-
>>   libavcodec/decode.h | 6 --
>>   libavcodec/utils.c  | 6 --
>>   3 files changed, 7 insertions(+), 13 deletions(-)
>>
>> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
>> index e5a301ec58..d25b15e95a 100644
>> --- a/libavcodec/decode.c
>> +++ b/libavcodec/decode.c
>> @@ -184,7 +184,7 @@ static int extract_packet_props(AVCodecInternal
>> *avci, const AVPacket *pkt)
>>   return 0;
>>   }
>>   -int ff_decode_bsfs_init(AVCodecContext *avctx)
>> +static int decode_bsfs_init(AVCodecContext *avctx)
>>   {
>>   AVCodecInternal *avci = avctx->internal;
>>   int ret;
>> @@ -2010,6 +2010,8 @@ int ff_reget_buffer(AVCodecContext *avctx,
>> AVFrame *frame, int flags)
>>     int ff_decode_preinit(AVCodecContext *avctx)
>>   {
>> +    int ret = 0;
>> +
>>   /* if the decoder init function was already called previously,
>>    * free the already allocated subtitle_header before overwriting
>> it */
>>   av_freep(>subtitle_header);
>> @@ -2046,5 +2048,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
>>   avctx->export_side_data |= AV_CODEC_EXPORT_DATA_MVS;
>>   }
>>   +    ret = decode_bsfs_init(avctx);
> 
> Did you try to run fate with THREADS set to something other than 1? This
> moves the bsfs initialization after ff_thread_init(), so all the copies
> of avctx in frame threading scenarios will be missing the bsfs requested
> by the decoder.
> 

For frame threaded decoders the codec's decode function is directly run
with the child AVCodecContext; they don't need the bsfs: The parent's
bsf has already been run on the packets before the frame threaded code
is reached.

> fate-vp9 should be enough to confirm this, since afaik it's the only
> frame threaded decoder that uses a bsf.
> 
>> +    if (ret < 0)
>> +    return ret;
>> +
>>   return 0;
>>   }
>> diff --git a/libavcodec/decode.h b/libavcodec/decode.h
>> index a865fe954f..1467b1eb33 100644
>> --- a/libavcodec/decode.h
>> +++ b/libavcodec/decode.h
>> @@ -69,12 +69,6 @@ int ff_decode_get_packet(AVCodecContext *avctx,
>> AVPacket *pkt);
>>    */
>>   int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame);
>>   -/**
>> - * Called during avcodec_open2() to initialize avctx->internal->bsf.
>> - * The bsf should be freed with av_bsf_free().
>> - */
>> -int ff_decode_bsfs_init(AVCodecContext *avctx);
>> -
>>   /**
>>    * Make sure avctx.hw_frames_ctx is set. If it's not set, the
>> function will
>>    * try to allocate it from hw_device_ctx. If that is not possible,
>> an error
>> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
>> index 6d5aeb4eaf..918cb1b4d1 100644
>> --- a/libavcodec/utils.c
>> +++ b/libavcodec/utils.c
>> @@ -730,12 +730,6 @@ int attribute_align_arg
>> avcodec_open2(AVCodecContext *avctx, const AVCodec *code
>>   goto free_and_end;
>>   }
>>   -    if (av_codec_is_decoder(avctx->codec)) {
>> -    ret = ff_decode_bsfs_init(avctx);
>> -    if (ret < 0)
>> -    goto free_and_end;
>> -    }
>> -
>>   if (HAVE_THREADS
>>   && !(avci->frame_thread_encoder &&
>> (avctx->active_thread_type_THREAD_FRAME))) {
>>   ret = ff_thread_init(avctx);
>>
> 
> ___
> 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 4/7] lavc: move decoder bsf init into decoder-specific code

2021-03-10 Thread James Almer

On 3/10/2021 9:03 AM, Anton Khirnov wrote:

---
  libavcodec/decode.c | 8 +++-
  libavcodec/decode.h | 6 --
  libavcodec/utils.c  | 6 --
  3 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index e5a301ec58..d25b15e95a 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -184,7 +184,7 @@ static int extract_packet_props(AVCodecInternal *avci, 
const AVPacket *pkt)
  return 0;
  }
  
-int ff_decode_bsfs_init(AVCodecContext *avctx)

+static int decode_bsfs_init(AVCodecContext *avctx)
  {
  AVCodecInternal *avci = avctx->internal;
  int ret;
@@ -2010,6 +2010,8 @@ int ff_reget_buffer(AVCodecContext *avctx, AVFrame 
*frame, int flags)
  
  int ff_decode_preinit(AVCodecContext *avctx)

  {
+int ret = 0;
+
  /* if the decoder init function was already called previously,
   * free the already allocated subtitle_header before overwriting it */
  av_freep(>subtitle_header);
@@ -2046,5 +2048,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
  avctx->export_side_data |= AV_CODEC_EXPORT_DATA_MVS;
  }
  
+ret = decode_bsfs_init(avctx);


Did you try to run fate with THREADS set to something other than 1? This 
moves the bsfs initialization after ff_thread_init(), so all the copies 
of avctx in frame threading scenarios will be missing the bsfs requested 
by the decoder.


fate-vp9 should be enough to confirm this, since afaik it's the only 
frame threaded decoder that uses a bsf.



+if (ret < 0)
+return ret;
+
  return 0;
  }
diff --git a/libavcodec/decode.h b/libavcodec/decode.h
index a865fe954f..1467b1eb33 100644
--- a/libavcodec/decode.h
+++ b/libavcodec/decode.h
@@ -69,12 +69,6 @@ int ff_decode_get_packet(AVCodecContext *avctx, AVPacket 
*pkt);
   */
  int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame);
  
-/**

- * Called during avcodec_open2() to initialize avctx->internal->bsf.
- * The bsf should be freed with av_bsf_free().
- */
-int ff_decode_bsfs_init(AVCodecContext *avctx);
-
  /**
   * Make sure avctx.hw_frames_ctx is set. If it's not set, the function will
   * try to allocate it from hw_device_ctx. If that is not possible, an error
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 6d5aeb4eaf..918cb1b4d1 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -730,12 +730,6 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
*avctx, const AVCodec *code
  goto free_and_end;
  }
  
-if (av_codec_is_decoder(avctx->codec)) {

-ret = ff_decode_bsfs_init(avctx);
-if (ret < 0)
-goto free_and_end;
-}
-
  if (HAVE_THREADS
  && !(avci->frame_thread_encoder && 
(avctx->active_thread_type_THREAD_FRAME))) {
  ret = ff_thread_init(avctx);



___
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 1/2] avcodec/mediacodec_wrapper: clean up ff_AMediaCodecList_getCodecNameByType a bit

2021-03-10 Thread Matthieu Bouron
On Mon, Mar 08, 2021 at 10:11:58AM +0100, Matthieu Bouron wrote:
> On Wed, Feb 17, 2021 at 04:50:00PM +0100, sfan5 wrote:
> > Hi,
> > 
> > while looking into mediacodec for unrelated reasons I saw some room for
> > improvement.
> > 
> > Therefore, here's a series with two small patches.
> > 
> 
> > From cadd2b2d4a5ffbb4dcc34faf2d3e139e1d4d608b Mon Sep 17 00:00:00 2001
> > From: sfan5 
> > Date: Thu, 11 Feb 2021 19:23:26 +0100
> > Subject: [PATCH 1/2] avcodec/mediacodec_wrapper: clean up
> >  ff_AMediaCodecList_getCodecNameByType a bit
> > 
> > We can skip software decoders before even looking at the mime types.
> > ---
> >  libavcodec/mediacodec_wrapper.c | 113 
> >  1 file changed, 57 insertions(+), 56 deletions(-)
> > 
> > diff --git a/libavcodec/mediacodec_wrapper.c 
> > b/libavcodec/mediacodec_wrapper.c
> > index 79abc8b6aa..f1945bcfc0 100644
> > --- a/libavcodec/mediacodec_wrapper.c
> > +++ b/libavcodec/mediacodec_wrapper.c
> > @@ -441,6 +441,30 @@ char *ff_AMediaCodecList_getCodecNameByType(const char 
> > *mime, int profile, int e
> >  goto done_with_info;
> >  }
> >  
> > +codec_name = (*env)->CallObjectMethod(env, info, 
> > jfields.get_name_id);
> > +if (ff_jni_exception_check(env, 1, log_ctx) < 0) {
> > +goto done;
> > +}
> > +
> > +name = ff_jni_jstring_to_utf_chars(env, codec_name, log_ctx);
> > +if (!name) {
> > +goto done;
> > +}
> > +
> > +if (codec_name) {
> > +(*env)->DeleteLocalRef(env, codec_name);
> > +codec_name = NULL;
> > +}
> > +
> > +/* Skip software decoders */
> > +if (
> > +strstr(name, "OMX.google") ||
> > +strstr(name, "OMX.ffmpeg") ||
> > +(strstr(name, "OMX.SEC") && strstr(name, ".sw.")) ||
> > +!strcmp(name, "OMX.qcom.video.decoder.hevcswvdec")) {
> > +goto done_with_info;
> > +}
> > +
> >  type_count = (*env)->GetArrayLength(env, types);
> >  for (j = 0; j < type_count; j++) {
> >  int k;
> > @@ -456,74 +480,51 @@ char *ff_AMediaCodecList_getCodecNameByType(const 
> > char *mime, int profile, int e
> >  goto done;
> >  }
> >  
> > -if (!av_strcasecmp(supported_type, mime)) {
> > -codec_name = (*env)->CallObjectMethod(env, info, 
> > jfields.get_name_id);
> > -if (ff_jni_exception_check(env, 1, log_ctx) < 0) {
> > -goto done;
> > -}
> > +if (av_strcasecmp(supported_type, mime)) {
> > +goto done_with_type;
> > +}
> >  
> > -name = ff_jni_jstring_to_utf_chars(env, codec_name, 
> > log_ctx);
> > -if (!name) {
> > -goto done;
> > -}
> > +capabilities = (*env)->CallObjectMethod(env, info, 
> > jfields.get_codec_capabilities_id, type);
> > +if (ff_jni_exception_check(env, 1, log_ctx) < 0) {
> > +goto done;
> > +}
> >  
> > -if (codec_name) {
> > -(*env)->DeleteLocalRef(env, codec_name);
> > -codec_name = NULL;
> > -}
> > +profile_levels = (*env)->GetObjectField(env, capabilities, 
> > jfields.profile_levels_id);
> > +if (ff_jni_exception_check(env, 1, log_ctx) < 0) {
> > +goto done;
> > +}
> >  
> > -/* Skip software decoders */
> > -if (
> > -strstr(name, "OMX.google") ||
> > -strstr(name, "OMX.ffmpeg") ||
> > -(strstr(name, "OMX.SEC") && strstr(name, ".sw.")) ||
> > -!strcmp(name, "OMX.qcom.video.decoder.hevcswvdec")) {
> > -av_freep();
> > -goto done_with_type;
> > +profile_count = (*env)->GetArrayLength(env, profile_levels);
> > +if (!profile_count) {
> > +found_codec = 1;
> > +}
> > +for (k = 0; k < profile_count; k++) {
> > +int supported_profile = 0;
> > +
> > +if (profile < 0) {
> > +found_codec = 1;
> > +break;
> >  }
> >  
> > -capabilities = (*env)->CallObjectMethod(env, info, 
> > jfields.get_codec_capabilities_id, type);
> > +profile_level = (*env)->GetObjectArrayElement(env, 
> > profile_levels, k);
> >  if (ff_jni_exception_check(env, 1, log_ctx) < 0) {
> >  goto done;
> >  }
> >  
> > -profile_levels = (*env)->GetObjectField(env, capabilities, 
> > jfields.profile_levels_id);
> > +supported_profile = (*env)->GetIntField(env, 
> > profile_level, jfields.profile_id);
> >  if 

Re: [FFmpeg-devel] FFmpeg 4.4

2021-03-10 Thread James Almer

On 3/10/2021 7:37 AM, Michael Niedermayer wrote:

On Tue, Mar 09, 2021 at 05:55:55PM -0300, James Almer wrote:

On 3/9/2021 5:47 PM, Michael Niedermayer wrote:

Hi all

I will branch release/4.4 soon
then like always leave some time for testing, bugfixes, ... and then
make FFmeg 4.4 from release/4.4, its too long since 4.3

Thanks


I have three API changes/additions/deprecations on the ml, some for months
now, that i want in 4.4 in order for them to be present in the last release
using the current major library versions. This is so users have a good
amount of time to notice them and adapt their code.
It's not be as nice if they start noticing any new deprecations introduced
today in a release made several months from now.

These are "deprecate av_init_packet() and sizeof(AVPacket) as part of the
ABI", "avutil/buffer: change public function and struct size parameter types
to size_t", and "avcodec: add a get_encoder_buffer() callback to
AVCodecContext".
The first two still need to be LGTM's. The latter was LGTM' by Lynne, but
I'm still waiting for Mark to give his.


sizeof(AVPacket) should not be part of the public API/ABI, well it should
never have been.
Do we maybe need a list of release blocking issues on trac or some tag or
something ? So issues like this are more vissible to everyone, its not
optimal to get a list of release blockers relatively late, then rush it
and then have a higher risk for regressions


I guess i was not insistent enough to get reviews for my patches.
You did look at some of them but only to find compilation issues and/or 
regressions, and without a LGTM i can't say it was approved.


The AVBufferRef change should generate no issues whatsoever since it 
just schedules a type change. No actual change will take place until the 
bump.
The get_encoder_buffer() one should also have no effect until encoders 
start being ported to it, and doing that in time for 4.4 is not 
important, only introducing the callback so users know it's there and 
can be ready for when the old encode API is gone after the bump if they 
still wish to provide their own buffers.
The AVPacket one could use some testing not for the actual scheduled 
change or the deprecation, which has no effect on library behavior, but 
because I'm also removing all instances of av_init_packet() to avoid a 
deprecation warning fest when compiling the libraries, and some of them 
i can't test.




anyway, tell me once the blockers are resolved, and please dont rush, its
better if we are a few days later than if there are some major bugs introduced

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 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 6/7] lavc: drop unused argument from lock_avcodec()

2021-03-10 Thread Andreas Rheinhardt
Anton Khirnov:
> ---
>  libavcodec/utils.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index 2545d9234c..e0f6234bd7 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -530,7 +530,7 @@ static int64_t get_bit_rate(AVCodecContext *ctx)
>  }
>  
>  
> -static void lock_avcodec(AVCodecContext *log_ctx, const AVCodec *codec)
> +static void lock_avcodec(const AVCodec *codec)
>  {
>  if (!(codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE) && 
> codec->init)
>  ff_mutex_lock(_mutex);
> @@ -570,7 +570,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
> *avctx, const AVCodec *code
>  if (options)
>  av_dict_copy(, *options, 0);
>  
> -lock_avcodec(avctx, codec);
> +lock_avcodec(codec);
>  
>  avci = av_mallocz(sizeof(*avci));
>  if (!avci) {
> @@ -725,7 +725,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
> *avctx, const AVCodec *code
>  if (CONFIG_FRAME_THREAD_ENCODER && av_codec_is_encoder(avctx->codec)) {
>  unlock_avcodec(codec); //we will instantiate a few encoders thus 
> kick the counter to prevent false detection of a problem
>  ret = ff_frame_thread_encoder_init(avctx, options ? *options : NULL);
> -lock_avcodec(avctx, codec);
> +lock_avcodec(codec);
>  if (ret < 0)
>  goto free_and_end;
>  }
> 
LGTM.

- Andreas
___
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 7/7] lavc: do not hold the codec init lock longer than necessary

2021-03-10 Thread Andreas Rheinhardt
Anton Khirnov:
> The only potentially unsafe operation is the codec-specific init
> function.
> ---
>  libavcodec/utils.c | 7 ++-
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index e0f6234bd7..952adb5277 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -570,8 +570,6 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
> *avctx, const AVCodec *code
>  if (options)
>  av_dict_copy(, *options, 0);
>  
> -lock_avcodec(codec);
> -
>  avci = av_mallocz(sizeof(*avci));
>  if (!avci) {
>  ret = AVERROR(ENOMEM);
> @@ -723,9 +721,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
> *avctx, const AVCodec *code
>  av_log(avctx, AV_LOG_WARNING, "Warning: not compiled with thread 
> support, using thread emulation\n");
>  
>  if (CONFIG_FRAME_THREAD_ENCODER && av_codec_is_encoder(avctx->codec)) {
> -unlock_avcodec(codec); //we will instantiate a few encoders thus 
> kick the counter to prevent false detection of a problem
>  ret = ff_frame_thread_encoder_init(avctx, options ? *options : NULL);
> -lock_avcodec(codec);
>  if (ret < 0)
>  goto free_and_end;
>  }
> @@ -749,7 +745,9 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
> *avctx, const AVCodec *code
>  
>  if (   avctx->codec->init && 
> (!(avctx->active_thread_type_THREAD_FRAME)
>  || avci->frame_thread_encoder)) {
> +lock_avcodec(codec);
>  ret = avctx->codec->init(avctx);
> +unlock_avcodec(codec);
>  if (ret < 0) {
>  codec_init_ok = -1;
>  goto free_and_end;
> @@ -834,7 +832,6 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
> *avctx, const AVCodec *code
>  }
>  
>  end:
> -unlock_avcodec(codec);
>  if (options) {
>  av_dict_free(options);
>  *options = tmp;
> 
ff_frame_thread_init also calls codec->init directly.

- Andreas
___
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 7/7] lavc: do not hold the codec init lock longer than necessary

2021-03-10 Thread Anton Khirnov
The only potentially unsafe operation is the codec-specific init
function.
---
 libavcodec/utils.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index e0f6234bd7..952adb5277 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -570,8 +570,6 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
*avctx, const AVCodec *code
 if (options)
 av_dict_copy(, *options, 0);
 
-lock_avcodec(codec);
-
 avci = av_mallocz(sizeof(*avci));
 if (!avci) {
 ret = AVERROR(ENOMEM);
@@ -723,9 +721,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
*avctx, const AVCodec *code
 av_log(avctx, AV_LOG_WARNING, "Warning: not compiled with thread 
support, using thread emulation\n");
 
 if (CONFIG_FRAME_THREAD_ENCODER && av_codec_is_encoder(avctx->codec)) {
-unlock_avcodec(codec); //we will instantiate a few encoders thus kick 
the counter to prevent false detection of a problem
 ret = ff_frame_thread_encoder_init(avctx, options ? *options : NULL);
-lock_avcodec(codec);
 if (ret < 0)
 goto free_and_end;
 }
@@ -749,7 +745,9 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
*avctx, const AVCodec *code
 
 if (   avctx->codec->init && (!(avctx->active_thread_type_THREAD_FRAME)
 || avci->frame_thread_encoder)) {
+lock_avcodec(codec);
 ret = avctx->codec->init(avctx);
+unlock_avcodec(codec);
 if (ret < 0) {
 codec_init_ok = -1;
 goto free_and_end;
@@ -834,7 +832,6 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
*avctx, const AVCodec *code
 }
 
 end:
-unlock_avcodec(codec);
 if (options) {
 av_dict_free(options);
 *options = tmp;
-- 
2.30.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] [PATCH 6/7] lavc: drop unused argument from lock_avcodec()

2021-03-10 Thread Anton Khirnov
---
 libavcodec/utils.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 2545d9234c..e0f6234bd7 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -530,7 +530,7 @@ static int64_t get_bit_rate(AVCodecContext *ctx)
 }
 
 
-static void lock_avcodec(AVCodecContext *log_ctx, const AVCodec *codec)
+static void lock_avcodec(const AVCodec *codec)
 {
 if (!(codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE) && codec->init)
 ff_mutex_lock(_mutex);
@@ -570,7 +570,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
*avctx, const AVCodec *code
 if (options)
 av_dict_copy(, *options, 0);
 
-lock_avcodec(avctx, codec);
+lock_avcodec(codec);
 
 avci = av_mallocz(sizeof(*avci));
 if (!avci) {
@@ -725,7 +725,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
*avctx, const AVCodec *code
 if (CONFIG_FRAME_THREAD_ENCODER && av_codec_is_encoder(avctx->codec)) {
 unlock_avcodec(codec); //we will instantiate a few encoders thus kick 
the counter to prevent false detection of a problem
 ret = ff_frame_thread_encoder_init(avctx, options ? *options : NULL);
-lock_avcodec(avctx, codec);
+lock_avcodec(codec);
 if (ret < 0)
 goto free_and_end;
 }
-- 
2.30.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] [PATCH 2/7] lavc/encode: reindent after previous commit

2021-03-10 Thread Anton Khirnov
---
 libavcodec/encode.c | 246 ++--
 1 file changed, 123 insertions(+), 123 deletions(-)

diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index bbf03d62fc..6c15f37806 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -465,157 +465,157 @@ int attribute_align_arg 
avcodec_encode_video2(AVCodecContext *avctx,
 
 int ff_encode_preinit(AVCodecContext *avctx)
 {
-int i;
+int i;
 #if FF_API_CODED_FRAME
 FF_DISABLE_DEPRECATION_WARNINGS
-avctx->coded_frame = av_frame_alloc();
-if (!avctx->coded_frame) {
-return AVERROR(ENOMEM);
-}
+avctx->coded_frame = av_frame_alloc();
+if (!avctx->coded_frame) {
+return AVERROR(ENOMEM);
+}
 FF_ENABLE_DEPRECATION_WARNINGS
 #endif
 
-if (avctx->time_base.num <= 0 || avctx->time_base.den <= 0) {
-av_log(avctx, AV_LOG_ERROR, "The encoder timebase is not set.\n");
-return AVERROR(EINVAL);
-}
+if (avctx->time_base.num <= 0 || avctx->time_base.den <= 0) {
+av_log(avctx, AV_LOG_ERROR, "The encoder timebase is not set.\n");
+return AVERROR(EINVAL);
+}
 
-if (avctx->codec->sample_fmts) {
-for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; 
i++) {
-if (avctx->sample_fmt == avctx->codec->sample_fmts[i])
-break;
-if (avctx->channels == 1 &&
-av_get_planar_sample_fmt(avctx->sample_fmt) ==
-av_get_planar_sample_fmt(avctx->codec->sample_fmts[i])) {
-avctx->sample_fmt = avctx->codec->sample_fmts[i];
-break;
-}
-}
-if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) {
-char buf[128];
-snprintf(buf, sizeof(buf), "%d", avctx->sample_fmt);
-av_log(avctx, AV_LOG_ERROR, "Specified sample format %s is 
invalid or not supported\n",
-   (char 
*)av_x_if_null(av_get_sample_fmt_name(avctx->sample_fmt), buf));
-return AVERROR(EINVAL);
+if (avctx->codec->sample_fmts) {
+for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) {
+if (avctx->sample_fmt == avctx->codec->sample_fmts[i])
+break;
+if (avctx->channels == 1 &&
+av_get_planar_sample_fmt(avctx->sample_fmt) ==
+av_get_planar_sample_fmt(avctx->codec->sample_fmts[i])) {
+avctx->sample_fmt = avctx->codec->sample_fmts[i];
+break;
 }
 }
-if (avctx->codec->pix_fmts) {
-for (i = 0; avctx->codec->pix_fmts[i] != AV_PIX_FMT_NONE; i++)
-if (avctx->pix_fmt == avctx->codec->pix_fmts[i])
-break;
-if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_NONE
-&& !((avctx->codec_id == AV_CODEC_ID_MJPEG || avctx->codec_id 
== AV_CODEC_ID_LJPEG)
- && avctx->strict_std_compliance <= 
FF_COMPLIANCE_UNOFFICIAL)) {
-char buf[128];
-snprintf(buf, sizeof(buf), "%d", avctx->pix_fmt);
-av_log(avctx, AV_LOG_ERROR, "Specified pixel format %s is 
invalid or not supported\n",
-   (char 
*)av_x_if_null(av_get_pix_fmt_name(avctx->pix_fmt), buf));
-return AVERROR(EINVAL);
-}
-if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ420P ||
-avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ411P ||
-avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ422P ||
-avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ440P ||
-avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ444P)
-avctx->color_range = AVCOL_RANGE_JPEG;
+if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) {
+char buf[128];
+snprintf(buf, sizeof(buf), "%d", avctx->sample_fmt);
+av_log(avctx, AV_LOG_ERROR, "Specified sample format %s is invalid 
or not supported\n",
+   (char 
*)av_x_if_null(av_get_sample_fmt_name(avctx->sample_fmt), buf));
+return AVERROR(EINVAL);
 }
-if (avctx->codec->supported_samplerates) {
-for (i = 0; avctx->codec->supported_samplerates[i] != 0; i++)
-if (avctx->sample_rate == 
avctx->codec->supported_samplerates[i])
-break;
-if (avctx->codec->supported_samplerates[i] == 0) {
-av_log(avctx, AV_LOG_ERROR, "Specified sample rate %d is not 
supported\n",
-   avctx->sample_rate);
-return AVERROR(EINVAL);
-}
+}
+if (avctx->codec->pix_fmts) {
+for (i = 0; avctx->codec->pix_fmts[i] != AV_PIX_FMT_NONE; i++)
+if (avctx->pix_fmt == avctx->codec->pix_fmts[i])
+break;
+if 

[FFmpeg-devel] [PATCH 5/7] lavc: drop ff_ prefix from ff_(un)lock_avcodec

2021-03-10 Thread Anton Khirnov
It is unnecessary and misleading, as those are static functions.
---
 libavcodec/utils.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 918cb1b4d1..2545d9234c 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -530,13 +530,13 @@ static int64_t get_bit_rate(AVCodecContext *ctx)
 }
 
 
-static void ff_lock_avcodec(AVCodecContext *log_ctx, const AVCodec *codec)
+static void lock_avcodec(AVCodecContext *log_ctx, const AVCodec *codec)
 {
 if (!(codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE) && codec->init)
 ff_mutex_lock(_mutex);
 }
 
-static void ff_unlock_avcodec(const AVCodec *codec)
+static void unlock_avcodec(const AVCodec *codec)
 {
 if (!(codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE) && codec->init)
 ff_mutex_unlock(_mutex);
@@ -570,7 +570,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
*avctx, const AVCodec *code
 if (options)
 av_dict_copy(, *options, 0);
 
-ff_lock_avcodec(avctx, codec);
+lock_avcodec(avctx, codec);
 
 avci = av_mallocz(sizeof(*avci));
 if (!avci) {
@@ -723,9 +723,9 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
*avctx, const AVCodec *code
 av_log(avctx, AV_LOG_WARNING, "Warning: not compiled with thread 
support, using thread emulation\n");
 
 if (CONFIG_FRAME_THREAD_ENCODER && av_codec_is_encoder(avctx->codec)) {
-ff_unlock_avcodec(codec); //we will instantiate a few encoders thus 
kick the counter to prevent false detection of a problem
+unlock_avcodec(codec); //we will instantiate a few encoders thus kick 
the counter to prevent false detection of a problem
 ret = ff_frame_thread_encoder_init(avctx, options ? *options : NULL);
-ff_lock_avcodec(avctx, codec);
+lock_avcodec(avctx, codec);
 if (ret < 0)
 goto free_and_end;
 }
@@ -834,7 +834,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
*avctx, const AVCodec *code
 }
 
 end:
-ff_unlock_avcodec(codec);
+unlock_avcodec(codec);
 if (options) {
 av_dict_free(options);
 *options = tmp;
-- 
2.30.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] [PATCH 4/7] lavc: move decoder bsf init into decoder-specific code

2021-03-10 Thread Anton Khirnov
---
 libavcodec/decode.c | 8 +++-
 libavcodec/decode.h | 6 --
 libavcodec/utils.c  | 6 --
 3 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index e5a301ec58..d25b15e95a 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -184,7 +184,7 @@ static int extract_packet_props(AVCodecInternal *avci, 
const AVPacket *pkt)
 return 0;
 }
 
-int ff_decode_bsfs_init(AVCodecContext *avctx)
+static int decode_bsfs_init(AVCodecContext *avctx)
 {
 AVCodecInternal *avci = avctx->internal;
 int ret;
@@ -2010,6 +2010,8 @@ int ff_reget_buffer(AVCodecContext *avctx, AVFrame 
*frame, int flags)
 
 int ff_decode_preinit(AVCodecContext *avctx)
 {
+int ret = 0;
+
 /* if the decoder init function was already called previously,
  * free the already allocated subtitle_header before overwriting it */
 av_freep(>subtitle_header);
@@ -2046,5 +2048,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
 avctx->export_side_data |= AV_CODEC_EXPORT_DATA_MVS;
 }
 
+ret = decode_bsfs_init(avctx);
+if (ret < 0)
+return ret;
+
 return 0;
 }
diff --git a/libavcodec/decode.h b/libavcodec/decode.h
index a865fe954f..1467b1eb33 100644
--- a/libavcodec/decode.h
+++ b/libavcodec/decode.h
@@ -69,12 +69,6 @@ int ff_decode_get_packet(AVCodecContext *avctx, AVPacket 
*pkt);
  */
 int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame);
 
-/**
- * Called during avcodec_open2() to initialize avctx->internal->bsf.
- * The bsf should be freed with av_bsf_free().
- */
-int ff_decode_bsfs_init(AVCodecContext *avctx);
-
 /**
  * Make sure avctx.hw_frames_ctx is set. If it's not set, the function will
  * try to allocate it from hw_device_ctx. If that is not possible, an error
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 6d5aeb4eaf..918cb1b4d1 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -730,12 +730,6 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
*avctx, const AVCodec *code
 goto free_and_end;
 }
 
-if (av_codec_is_decoder(avctx->codec)) {
-ret = ff_decode_bsfs_init(avctx);
-if (ret < 0)
-goto free_and_end;
-}
-
 if (HAVE_THREADS
 && !(avci->frame_thread_encoder && 
(avctx->active_thread_type_THREAD_FRAME))) {
 ret = ff_thread_init(avctx);
-- 
2.30.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] [PATCH 1/7] lavc: factor out encoder init/validation from avcodec_open2()

2021-03-10 Thread Anton Khirnov
avcodec_open2() is massive, splitting it makes it more readable.

Also, add a missing error code to ticks_per_frame sanity check.
---
 libavcodec/encode.c | 157 +
 libavcodec/encode.h |   6 ++
 libavcodec/utils.c  | 166 +---
 3 files changed, 166 insertions(+), 163 deletions(-)

diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index 282337e453..bbf03d62fc 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -462,3 +462,160 @@ int attribute_align_arg 
avcodec_encode_video2(AVCodecContext *avctx,
 return ret;
 }
 #endif
+
+int ff_encode_preinit(AVCodecContext *avctx)
+{
+int i;
+#if FF_API_CODED_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
+avctx->coded_frame = av_frame_alloc();
+if (!avctx->coded_frame) {
+return AVERROR(ENOMEM);
+}
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
+if (avctx->time_base.num <= 0 || avctx->time_base.den <= 0) {
+av_log(avctx, AV_LOG_ERROR, "The encoder timebase is not set.\n");
+return AVERROR(EINVAL);
+}
+
+if (avctx->codec->sample_fmts) {
+for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; 
i++) {
+if (avctx->sample_fmt == avctx->codec->sample_fmts[i])
+break;
+if (avctx->channels == 1 &&
+av_get_planar_sample_fmt(avctx->sample_fmt) ==
+av_get_planar_sample_fmt(avctx->codec->sample_fmts[i])) {
+avctx->sample_fmt = avctx->codec->sample_fmts[i];
+break;
+}
+}
+if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) {
+char buf[128];
+snprintf(buf, sizeof(buf), "%d", avctx->sample_fmt);
+av_log(avctx, AV_LOG_ERROR, "Specified sample format %s is 
invalid or not supported\n",
+   (char 
*)av_x_if_null(av_get_sample_fmt_name(avctx->sample_fmt), buf));
+return AVERROR(EINVAL);
+}
+}
+if (avctx->codec->pix_fmts) {
+for (i = 0; avctx->codec->pix_fmts[i] != AV_PIX_FMT_NONE; i++)
+if (avctx->pix_fmt == avctx->codec->pix_fmts[i])
+break;
+if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_NONE
+&& !((avctx->codec_id == AV_CODEC_ID_MJPEG || avctx->codec_id 
== AV_CODEC_ID_LJPEG)
+ && avctx->strict_std_compliance <= 
FF_COMPLIANCE_UNOFFICIAL)) {
+char buf[128];
+snprintf(buf, sizeof(buf), "%d", avctx->pix_fmt);
+av_log(avctx, AV_LOG_ERROR, "Specified pixel format %s is 
invalid or not supported\n",
+   (char 
*)av_x_if_null(av_get_pix_fmt_name(avctx->pix_fmt), buf));
+return AVERROR(EINVAL);
+}
+if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ420P ||
+avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ411P ||
+avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ422P ||
+avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ440P ||
+avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ444P)
+avctx->color_range = AVCOL_RANGE_JPEG;
+}
+if (avctx->codec->supported_samplerates) {
+for (i = 0; avctx->codec->supported_samplerates[i] != 0; i++)
+if (avctx->sample_rate == 
avctx->codec->supported_samplerates[i])
+break;
+if (avctx->codec->supported_samplerates[i] == 0) {
+av_log(avctx, AV_LOG_ERROR, "Specified sample rate %d is not 
supported\n",
+   avctx->sample_rate);
+return AVERROR(EINVAL);
+}
+}
+if (avctx->sample_rate < 0) {
+av_log(avctx, AV_LOG_ERROR, "Specified sample rate %d is not 
supported\n",
+avctx->sample_rate);
+return AVERROR(EINVAL);
+}
+if (avctx->codec->channel_layouts) {
+if (!avctx->channel_layout) {
+av_log(avctx, AV_LOG_WARNING, "Channel layout not 
specified\n");
+} else {
+for (i = 0; avctx->codec->channel_layouts[i] != 0; i++)
+if (avctx->channel_layout == 
avctx->codec->channel_layouts[i])
+break;
+if (avctx->codec->channel_layouts[i] == 0) {
+char buf[512];
+av_get_channel_layout_string(buf, sizeof(buf), -1, 
avctx->channel_layout);
+av_log(avctx, AV_LOG_ERROR, "Specified channel layout '%s' 
is not supported\n", buf);
+return AVERROR(EINVAL);
+}
+}
+}
+if (avctx->channel_layout && avctx->channels) {
+int channels = 
av_get_channel_layout_nb_channels(avctx->channel_layout);
+if 

[FFmpeg-devel] [PATCH 3/7] lavc: factor decoder validation/setup from avcodec_open2()

2021-03-10 Thread Anton Khirnov
---
 libavcodec/decode.c | 41 
 libavcodec/decode.h |  6 ++
 libavcodec/utils.c  | 46 +
 3 files changed, 52 insertions(+), 41 deletions(-)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 082188195c..e5a301ec58 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -2007,3 +2007,44 @@ int ff_reget_buffer(AVCodecContext *avctx, AVFrame 
*frame, int flags)
 av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
 return ret;
 }
+
+int ff_decode_preinit(AVCodecContext *avctx)
+{
+/* if the decoder init function was already called previously,
+ * free the already allocated subtitle_header before overwriting it */
+av_freep(>subtitle_header);
+
+#if FF_API_THREAD_SAFE_CALLBACKS
+FF_DISABLE_DEPRECATION_WARNINGS
+if ((avctx->thread_type & FF_THREAD_FRAME) &&
+avctx->get_buffer2 != avcodec_default_get_buffer2 &&
+!avctx->thread_safe_callbacks) {
+av_log(avctx, AV_LOG_WARNING, "Requested frame threading with a "
+   "custom get_buffer2() implementation which is not marked as "
+   "thread safe. This is not supported anymore, make your "
+   "callback thread-safe.\n");
+}
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
+if (avctx->codec->max_lowres < avctx->lowres || avctx->lowres < 0) {
+av_log(avctx, AV_LOG_WARNING, "The maximum value for lowres supported 
by the decoder is %d\n",
+   avctx->codec->max_lowres);
+avctx->lowres = avctx->codec->max_lowres;
+}
+
+avctx->pts_correction_num_faulty_pts =
+avctx->pts_correction_num_faulty_dts = 0;
+avctx->pts_correction_last_pts =
+avctx->pts_correction_last_dts = INT64_MIN;
+
+if (   !CONFIG_GRAY && avctx->flags & AV_CODEC_FLAG_GRAY
+&& avctx->codec_descriptor->type == AVMEDIA_TYPE_VIDEO)
+av_log(avctx, AV_LOG_WARNING,
+   "gray decoding requested but not enabled at configuration 
time\n");
+if (avctx->flags2 & AV_CODEC_FLAG2_EXPORT_MVS) {
+avctx->export_side_data |= AV_CODEC_EXPORT_DATA_MVS;
+}
+
+return 0;
+}
diff --git a/libavcodec/decode.h b/libavcodec/decode.h
index d4e3f5c5b5..a865fe954f 100644
--- a/libavcodec/decode.h
+++ b/libavcodec/decode.h
@@ -85,4 +85,10 @@ int ff_decode_get_hw_frames_ctx(AVCodecContext *avctx,
 
 int ff_attach_decode_data(AVFrame *frame);
 
+/**
+ * Perform decoder initialization and validation.
+ * Called when opening the decoder, before the AVCodec.init() call.
+ */
+int ff_decode_preinit(AVCodecContext *avctx);
+
 #endif /* AVCODEC_DECODE_H */
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 9ccafb9e77..6d5aeb4eaf 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -657,11 +657,6 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
*avctx, const AVCodec *code
 }
 }
 
-/* if the decoder init function was already called previously,
- * free the already allocated subtitle_header before overwriting it */
-if (av_codec_is_decoder(codec))
-av_freep(>subtitle_header);
-
 if (avctx->channels > FF_SANE_NB_CHANNELS || avctx->channels < 0) {
 av_log(avctx, AV_LOG_ERROR, "Too many or invalid channels: %d\n", 
avctx->channels);
 ret = AVERROR(EINVAL);
@@ -687,19 +682,6 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
*avctx, const AVCodec *code
 goto free_and_end;
 }
 
-#if FF_API_THREAD_SAFE_CALLBACKS
-FF_DISABLE_DEPRECATION_WARNINGS
-if ((avctx->thread_type & FF_THREAD_FRAME) &&
-avctx->get_buffer2 != avcodec_default_get_buffer2 &&
-!avctx->thread_safe_callbacks) {
-av_log(avctx, AV_LOG_WARNING, "Requested frame threading with a "
-   "custom get_buffer2() implementation which is not marked as "
-   "thread safe. This is not supported anymore, make your "
-   "callback thread-safe.\n");
-}
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
 avctx->codec = codec;
 if ((avctx->codec_type == AVMEDIA_TYPE_UNKNOWN || avctx->codec_type == 
codec->type) &&
 avctx->codec_id == AV_CODEC_ID_NONE) {
@@ -764,30 +746,12 @@ FF_ENABLE_DEPRECATION_WARNINGS
 if (!HAVE_THREADS && !(codec->caps_internal & FF_CODEC_CAP_AUTO_THREADS))
 avctx->thread_count = 1;
 
-if (avctx->codec->max_lowres < avctx->lowres || avctx->lowres < 0) {
-av_log(avctx, AV_LOG_WARNING, "The maximum value for lowres supported 
by the decoder is %d\n",
-   avctx->codec->max_lowres);
-avctx->lowres = avctx->codec->max_lowres;
-}
-
-if (av_codec_is_encoder(avctx->codec)) {
+if (av_codec_is_encoder(avctx->codec))
 ret = ff_encode_preinit(avctx);
-if (ret < 0)
-goto free_and_end;
-}
-
-avctx->pts_correction_num_faulty_pts =
-avctx->pts_correction_num_faulty_dts = 0;
-avctx->pts_correction_last_pts =
-avctx->pts_correction_last_dts = 

Re: [FFmpeg-devel] FFmpeg 4.4

2021-03-10 Thread Michael Niedermayer
On Tue, Mar 09, 2021 at 05:55:55PM -0300, James Almer wrote:
> On 3/9/2021 5:47 PM, Michael Niedermayer wrote:
> > Hi all
> > 
> > I will branch release/4.4 soon
> > then like always leave some time for testing, bugfixes, ... and then
> > make FFmeg 4.4 from release/4.4, its too long since 4.3
> > 
> > Thanks
> 
> I have three API changes/additions/deprecations on the ml, some for months
> now, that i want in 4.4 in order for them to be present in the last release
> using the current major library versions. This is so users have a good
> amount of time to notice them and adapt their code.
> It's not be as nice if they start noticing any new deprecations introduced
> today in a release made several months from now.
> 
> These are "deprecate av_init_packet() and sizeof(AVPacket) as part of the
> ABI", "avutil/buffer: change public function and struct size parameter types
> to size_t", and "avcodec: add a get_encoder_buffer() callback to
> AVCodecContext".
> The first two still need to be LGTM's. The latter was LGTM' by Lynne, but
> I'm still waiting for Mark to give his.

sizeof(AVPacket) should not be part of the public API/ABI, well it should
never have been.
Do we maybe need a list of release blocking issues on trac or some tag or
something ? So issues like this are more vissible to everyone, its not
optimal to get a list of release blockers relatively late, then rush it
and then have a higher risk for regressions

anyway, tell me once the blockers are resolved, and please dont rush, its
better if we are a few days later than if there are some major bugs introduced

Thanks

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

Avoid a single point of failure, be that a person or equipment.


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 8/8] avfilter/vf_nnedi: Fix use of uninitialized value

2021-03-10 Thread Paul B Mahol
lgtm

On Wed, Mar 10, 2021 at 2:06 AM Andreas Rheinhardt <
andreas.rheinha...@gmail.com> wrote:

> Fixes Coverity issue #1473546.
>
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavfilter/vf_nnedi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavfilter/vf_nnedi.c b/libavfilter/vf_nnedi.c
> index 4229150668..b273c13944 100644
> --- a/libavfilter/vf_nnedi.c
> +++ b/libavfilter/vf_nnedi.c
> @@ -903,7 +903,7 @@ static void
> subtract_mean_predictor(PredictorCoefficients *model)
>
>  double softmax_means[256]; // Average of individual softmax filters.
>  double elliott_means[256]; // Average of individual elliott filters.
> -double mean_filter[48 * 6]; // Pointwise average of all softmax
> filters.
> +double mean_filter[48 * 6] = { 0 }; // Pointwise average of all
> softmax filters.
>  double mean_bias;
>
>  // Quality 1.
> --
> 2.27.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".

[FFmpeg-devel] [PATCH 9/9] avcodec/cbs_h26[45]: Remove redundant enum constants

2021-03-10 Thread Andreas Rheinhardt
Unused since 8843607f495c95c1e67a3ce3d6f15dca6e252439.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/cbs_h264.h | 10 --
 libavcodec/cbs_h265.h |  9 -
 2 files changed, 19 deletions(-)

diff --git a/libavcodec/cbs_h264.h b/libavcodec/cbs_h264.h
index 9eb97eae24..5a8641a333 100644
--- a/libavcodec/cbs_h264.h
+++ b/libavcodec/cbs_h264.h
@@ -28,16 +28,6 @@
 #include "h264.h"
 
 
-enum {
-// This limit is arbitrary - it is sufficient for one message of each
-// type plus some repeats, and will therefore easily cover all sane
-// streams.  However, it is possible to make technically-valid streams
-// for which it will fail (for example, by including a large number of
-// user-data-unregistered messages).
-H264_MAX_SEI_PAYLOADS = 64,
-};
-
-
 typedef struct H264RawNALUnitHeader {
 uint8_t nal_ref_idc;
 uint8_t nal_unit_type;
diff --git a/libavcodec/cbs_h265.h b/libavcodec/cbs_h265.h
index 738cbeec2c..f7753f1206 100644
--- a/libavcodec/cbs_h265.h
+++ b/libavcodec/cbs_h265.h
@@ -26,15 +26,6 @@
 #include "cbs_sei.h"
 #include "hevc.h"
 
-enum {
-// This limit is arbitrary - it is sufficient for one message of each
-// type plus some repeats, and will therefore easily cover all sane
-// streams.  However, it is possible to make technically-valid streams
-// for which it will fail (for example, by including a large number of
-// user-data-unregistered messages).
-H265_MAX_SEI_PAYLOADS = 64,
-};
-
 typedef struct H265RawNALUnitHeader {
 uint8_t nal_unit_type;
 uint8_t nuh_layer_id;
-- 
2.27.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] Custom allocation functions

2021-03-10 Thread Martijn Otto
This seems all very reasonable.

Most of these suggestions are easily fixed, but I am struggling to find
the best approach to avoiding those global function pointers.

The approach of storing these in some kind of context, as mentioned in
the referenced message looks like the best solution. Am I right in
thinking that this has not been actually built yet? I couldn't find any
references in the code.

Assuming that I'm right and nothing of the sort exists yet, would it be
sensible to:

- create an AVUtilContext struct, which contains the
allocation/deallocation functions, as well as a "user data" pointer
- add those same members at the start of the relevant existing contexts
(i.e. AVCodecContext), so that we can cast those structs to
ACUtilContext.
- change the relevant buffer allocation funtions to take the structure
as pointer

Please let me know if I am missing anything here, i.e. a global context
which already exists, or an alternative strategy.

With regards,
Martijn Otto

On Sat, 2021-03-06 at 15:39 +0100, Nicolas George wrote:
> Martijn Otto (12021-03-05):
> > Hello all,
> > 
> > I have made some changes to get custom allocation functions in
> > ffmpeg.
> > This is useful to me, as the software I work with easily runs into
> > congestion on memory allocations in certain cases.
> > 
> > I hope it is useful to others as well. It would be nice if this
> > could
> > be part of ffmpeg proper. If you have specific issues with my
> > implementation, please let me know.
> 
> Thanks for the contribution. It may be useful, but it cannot be
> accepted
> as is for several reasons, see below.
> 
> > From 802b4aecb77c8a35eb6641aa8dd6d27bbcda1fe2 Mon Sep 17 00:00:00
> > 2001
> > From: Martijn Otto 
> > Date: Thu, 4 Mar 2021 17:30:15 +0100
> > Subject: [PATCH] Add custom memory allocation routines.
> > 
> > This feature is a useful optimization strategy. It allows the
> > implementation of working with a memory pool for better
> > performance.
> > ---
> >  libavformat/hlsenc.c |  1 +
> >  libavutil/buffer.c   | 41 +++-
> > -
> >  libavutil/buffer.h   | 23 +++
> >  3 files changed, 59 insertions(+), 6 deletions(-)
> > 
> > diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> > index 7d97ce1789..c8e4281e7b 100644
> > --- a/libavformat/hlsenc.c
> > +++ b/libavformat/hlsenc.c
> > @@ -927,6 +927,7 @@ static int hls_mux_init(AVFormatContext *s,
> > VariantStream *vs)
> >  } else {
> >  ret = hlsenc_io_open(s, >out, vs-
> > >base_output_dirname, );
> >  }
> > +avio_flush(oc->pb);
> 
> This is an unrelated change, it needs to be submitted separately.
> 
> >  av_dict_free();
> >  }
> >  if (ret < 0) {
> > diff --git a/libavutil/buffer.c b/libavutil/buffer.c
> > index 3204f11b68..bd86b38524 100644
> > --- a/libavutil/buffer.c
> > +++ b/libavutil/buffer.c
> > @@ -59,23 +59,52 @@ AVBufferRef *av_buffer_create(uint8_t *data,
> > int size,
> >  return ref;
> >  }
> >  
> > +PFNBufferAlloc externalAllocFunc = NULL;
> > +PFNBufferDealloc externalDeallocFunc = NULL;
> 
> We do not use camelCase for identifiers.
> 
> These variables are local to the file and should be declared as such.
> 
> More importantly: we are trying to get rid of mutable global state.
> This
> adds to it.
> 
> See this:
> https://ffmpeg.org/pipermail/ffmpeg-devel/2020-December/274168.html
> for my attempt at making global state local.
> 
> > +
> > +void av_set_buffer_alloc_free_funcs( PFNBufferAlloc externalAlloc,
> > PFNBufferDealloc externalDealloc )
> > +{
> > +externalAllocFunc = externalAlloc;
> > +externalDeallocFunc = externalDealloc;
> > +}
> > +
> >  void av_buffer_default_free(void *opaque, uint8_t *data)
> >  {
> >  av_free(data);
> >  }
> > +void av_buffer_external_free(void *opaque, uint8_t *data)
> 
> Missing new line.
> 
> This function is not declared. Does it even compile?
> 
> If it is not exported, it should be static and not in the av_
> namespace.
> 
> > +{
> > +if (externalDeallocFunc != NULL)
> > +externalDeallocFunc(data);
> > +}
> >  
> >  AVBufferRef *av_buffer_alloc(int size)
> >  {
> >  AVBufferRef *ret = NULL;
> >  uint8_t*data = NULL;
> >  
> > -data = av_malloc(size);
> > -if (!data)
> > -return NULL;
> > +//Give priority to the external allocation function to give
> > the application a chance to manage it's own buffer allocations.
> > +if (externalAllocFunc != NULL)
> > +data = externalAllocFunc(size);
> >  
> > -ret = av_buffer_create(data, size, av_buffer_default_free,
> > NULL, 0);
> > -if (!ret)
> > -av_freep();
> > +if (data) {
> > +//Create a buffer and tell it to free it's data using the
> > external free function. We've used the external
> > +//allocator for allocation, so we need to use external
> > deallocator for deallocation.
> > +ret = av_buffer_create(data, size,
> > 

Re: [FFmpeg-devel] FFmpeg 4.4

2021-03-10 Thread Reto Kromer
Michael Niedermayer wrote:

>I will branch release/4.4 soon
>then like always leave some time for testing, bugfixes, ... and then 
>make FFmeg 4.4 from release/4.4, its too long since 4.3

Good news! Thank you very much indeed! Reto

___
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-web][PATCH] web/download: add signing key and verification instructions

2021-03-10 Thread Zane van Iperen

Before you do, just give it a crack locally.

I couldn't get the cloned version of the site to look identical to what's already published (something to do with 
incorrect CSS symlinks iirc). It's probably fine, but for something like this I'd rather err on the side of caution.


Zane


On 8/3/21 11:24 pm, Thilo Borgmann wrote:

Am 24.02.21 um 17:53 schrieb Thilo Borgmann:

Am 24.02.21 um 05:06 schrieb Zane van Iperen:

As per discussion at [1]. Patches attached.

Patch 1/3 adds /node_modules/ to .gitignore

Patch 2/3 adds the actual key and verification instructions

Patch 3/3 adds a prominent download link for the public key.
This might be bit obnoxious, but it was suggested in the original discussion.

[1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2021-February/276752.html


As in [1] above I like that idea. However, I can't really comment on the 
technical side of keys and signatures. So proper someones opinion with actual 
knowledge would be appreciated.


If there are no complains, I'll push that soon (tm).

-Thilo
___
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".