Re: [FFmpeg-devel] [PATCH] libavformat/flvdec: add HEVC demuxing support

2021-07-25 Thread Gyan Doshi



On 2021-07-25 19:07, James Almer wrote:

On 7/25/2021 10:04 AM, Xiaolei Yu wrote:

Explicitly supply an HEVC codec id to enable this feature.
---
  libavformat/flv.h    |  1 +
  libavformat/flvdec.c | 21 ++---
  2 files changed, 19 insertions(+), 3 deletions(-)


This has been rejected time and time again, last time not even a month 
ago.


We may not support muxing it, since that is apparently out of spec, but 
what's wrong with demuxing?


We support demuxing PCM in MP4 but not muxing it. There are a couple of 
other examples which I can't recall off hand. Isn't Postel's law 
accepted here?


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

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


[FFmpeg-devel] [PATCH] configure: add initial RISC-V support

2021-07-25 Thread Brad Smith
OpenBSD only supports riscv64 but this is an attempt at adding
some of the initial bits for RISC-V support.


diff --git a/configure b/configure
index b3b8065188..8b5edaa01e 100755
--- a/configure
+++ b/configure
@@ -2021,6 +2021,7 @@ ARCH_LIST="
 parisc
 ppc
 ppc64
+riscv
 s390
 sh4
 sparc
@@ -2630,7 +2631,7 @@ for ext in $(filter_out mmx $ARCH_EXT_LIST_X86_SIMD); do
 done
 
 aligned_stack_if_any="aarch64 ppc x86"
-fast_64bit_if_any="aarch64 alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
+fast_64bit_if_any="aarch64 alpha ia64 mips64 parisc64 ppc64 riscv64 sparc64 
x86_64"
 fast_clz_if_any="aarch64 alpha avr32 mips ppc x86"
 fast_unaligned_if_any="aarch64 ppc x86"
 simd_align_16_if_any="altivec neon sse"
@@ -4957,6 +4958,9 @@ case "$arch" in
 "Power Macintosh"|ppc*|powerpc*)
 arch="ppc"
 ;;
+riscv*)
+arch="riscv"
+;;
 s390|s390x)
 arch="s390"
 ;;
@@ -5348,6 +5352,10 @@ case "$arch" in
 check_64bit ppc ppc64
 enabled shared && enable_weak pic
 ;;
+riscv)
+check_64bit riscv32 riscv64
+enabled shared && enable_weak pic
+;;
 s390)
 check_64bit s390 s390x
 enabled shared && enable_weak pic
___
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] Fix build failure on macos 10.12

2021-07-25 Thread Pavel Koshevoy
---
 libavutil/hwcontext_videotoolbox.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavutil/hwcontext_videotoolbox.c 
b/libavutil/hwcontext_videotoolbox.c
index 58095a1fc9..99e117aca3 100644
--- a/libavutil/hwcontext_videotoolbox.c
+++ b/libavutil/hwcontext_videotoolbox.c
@@ -420,10 +420,11 @@ static int vt_pixbuf_set_colorspace(AVHWFramesContext 
*hwfc,
 
 switch (src->color_trc) {
 case AVCOL_TRC_SMPTE2084:
-if (__builtin_available(macOS 10.13, *))
+#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_SMPTE_ST_2084_PQ
 colortrc = kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ;
-else
+#else
 colortrc = CFSTR("SMPTE_ST_2084_PQ");
+#endif
 break;
 case AVCOL_TRC_BT2020_10:
 case AVCOL_TRC_BT2020_12:
@@ -445,10 +446,11 @@ static int vt_pixbuf_set_colorspace(AVHWFramesContext 
*hwfc,
 colortrc = CFSTR("SMPTE_ST_428_1");
 break;
 case AVCOL_TRC_ARIB_STD_B67:
-if (__builtin_available(macOS 10.13, *))
+#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_ITU_R_2100_HLG
 colortrc = kCVImageBufferTransferFunction_ITU_R_2100_HLG;
-else
+#else
 colortrc = CFSTR("ITU_R_2100_HLG");
+#endif
 break;
 case AVCOL_TRC_GAMMA22:
 gamma = 2.2;
-- 
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".


Re: [FFmpeg-devel] [PATCH] ffmpeg: fix order between field order autodetection and override

2021-07-25 Thread Jan Ekström
On Sun, Jul 25, 2021 at 10:38 PM Paul B Mahol  wrote:
>
> On Wed, Jul 21, 2021 at 7:29 PM Jan Ekström  wrote:
>
> > Somehow I missed this in fbb44bc51a647862eb05ae3f9d7d49a0be9bed57 ,
> > even though the lines were within the context. Probably the code
> > originally being after the this logic had something to do with it,
> > but previously it only touched the avformat context's codecpar,
> > which did not affect the encoder codec context whatsoever.
> >
> > Fixes #9320
> > Fixes #9339
> > ---
> >  fftools/ffmpeg.c | 14 --
> >  1 file changed, 8 insertions(+), 6 deletions(-)
> >
> > diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> > index 40e8010096..b0ce7c7c32 100644
> > --- a/fftools/ffmpeg.c
> > +++ b/fftools/ffmpeg.c
> > @@ -3483,12 +3483,7 @@ static int init_output_stream_encode(OutputStream
> > *ost, AVFrame *frame)
> >  enc_ctx->bits_per_raw_sample = frame_bits_per_raw_sample;
> >  }
> >
> > -if (ost->top_field_first == 0) {
> > -enc_ctx->field_order = AV_FIELD_BB;
> > -} else if (ost->top_field_first == 1) {
> > -enc_ctx->field_order = AV_FIELD_TT;
> > -}
> > -
> > +// Field order: autodetection
> >  if (frame) {
> >  if (enc_ctx->flags & (AV_CODEC_FLAG_INTERLACED_DCT |
> > AV_CODEC_FLAG_INTERLACED_ME) &&
> >  ost->top_field_first >= 0)
> > @@ -3503,6 +3498,13 @@ static int init_output_stream_encode(OutputStream
> > *ost, AVFrame *frame)
> >  enc_ctx->field_order = AV_FIELD_PROGRESSIVE;
> >  }
> >
> > +// Field order: override
> > +if (ost->top_field_first == 0) {
> > +enc_ctx->field_order = AV_FIELD_BB;
> > +} else if (ost->top_field_first == 1) {
> > +enc_ctx->field_order = AV_FIELD_TT;
> > +}
> > +
> >  if (ost->forced_keyframes) {
> >  if (!strncmp(ost->forced_keyframes, "expr:", 5)) {
> >  ret = av_expr_parse(>forced_keyframes_pexpr,
> > ost->forced_keyframes+5,
> > --
> > 2.31.1
> >
> >
> LGTM
>

Thanks, applied with the recommendations you made for the commit
message, as well as fixing a case of "the this logic".

Jan
___
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] ffmpeg: fix order between field order autodetection and override

2021-07-25 Thread Paul B Mahol
On Wed, Jul 21, 2021 at 7:29 PM Jan Ekström  wrote:

> Somehow I missed this in fbb44bc51a647862eb05ae3f9d7d49a0be9bed57 ,
> even though the lines were within the context. Probably the code
> originally being after the this logic had something to do with it,
> but previously it only touched the avformat context's codecpar,
> which did not affect the encoder codec context whatsoever.
>
> Fixes #9320
> Fixes #9339
> ---
>  fftools/ffmpeg.c | 14 --
>  1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> index 40e8010096..b0ce7c7c32 100644
> --- a/fftools/ffmpeg.c
> +++ b/fftools/ffmpeg.c
> @@ -3483,12 +3483,7 @@ static int init_output_stream_encode(OutputStream
> *ost, AVFrame *frame)
>  enc_ctx->bits_per_raw_sample = frame_bits_per_raw_sample;
>  }
>
> -if (ost->top_field_first == 0) {
> -enc_ctx->field_order = AV_FIELD_BB;
> -} else if (ost->top_field_first == 1) {
> -enc_ctx->field_order = AV_FIELD_TT;
> -}
> -
> +// Field order: autodetection
>  if (frame) {
>  if (enc_ctx->flags & (AV_CODEC_FLAG_INTERLACED_DCT |
> AV_CODEC_FLAG_INTERLACED_ME) &&
>  ost->top_field_first >= 0)
> @@ -3503,6 +3498,13 @@ static int init_output_stream_encode(OutputStream
> *ost, AVFrame *frame)
>  enc_ctx->field_order = AV_FIELD_PROGRESSIVE;
>  }
>
> +// Field order: override
> +if (ost->top_field_first == 0) {
> +enc_ctx->field_order = AV_FIELD_BB;
> +} else if (ost->top_field_first == 1) {
> +enc_ctx->field_order = AV_FIELD_TT;
> +}
> +
>  if (ost->forced_keyframes) {
>  if (!strncmp(ost->forced_keyframes, "expr:", 5)) {
>  ret = av_expr_parse(>forced_keyframes_pexpr,
> ost->forced_keyframes+5,
> --
> 2.31.1
>
>
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".
>
___
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] avfilter/dnn_processing: Add TensorRT backend

2021-07-25 Thread Xiaowei Wang
The original idea was to submit cpp code directly into ffmpeg, however, after 
the patch was ready, I was told that this was not a good idea, so I wrapped the 
TensorRT cpp implementations in c interfaces 
(https://github.com/DutchPiPi/nv-tensorrt-wrapper) and removed the cpp file.

Thanks,
Xiaowei Wang

-邮件原件-
发件人: Jean-Baptiste Kempf  
发送时间: 2021年7月25日 20:58
收件人: Xiaowei Wang ; FFmpeg development discussions and 
patches 
主题: Re: [FFmpeg-devel] [PATCH 2/2] avfilter/dnn_processing: Add TensorRT backend

External email: Use caution opening links or attachments


On Sun, 25 Jul 2021, at 13:58, Xiaowei Wang wrote:
>  libavfilter/dnn/trt_class_wrapper.cpp  | 731 -

So, you add files in the first patch, and then delete it on the second one???

--
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] avfilter/avf_concat: fix EOF timestamp

2021-07-25 Thread Nicolas George
Paul B Mahol (12021-07-25):
> Signed-off-by: Paul B Mahol 
> ---
>  libavfilter/avf_concat.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/libavfilter/avf_concat.c b/libavfilter/avf_concat.c
> index cb46f52a04..8bb5a5d618 100644
> --- a/libavfilter/avf_concat.c
> +++ b/libavfilter/avf_concat.c
> @@ -402,7 +402,10 @@ static int activate(AVFilterContext *ctx)
>  if (ret > 0) {
>  close_input(ctx, cat->cur_idx + i);
>  if (cat->cur_idx + ctx->nb_outputs >= ctx->nb_inputs) {

> -ff_outlink_set_status(ctx->outputs[i], status, pts);
> +ff_outlink_set_status(ctx->outputs[i], status,
> +  cat->delta_ts + av_rescale_q(pts,
> +   
> ctx->inputs[cat->cur_idx + i]->time_base,
> +   
> ctx->outputs[i]->time_base));

It looks valid, good catch, but ugly. Please add a local variable for
ctx->inputs[cat->cur_idx + i], which is now used twice, and re-affect pts
in the line before rather than inlining the computation.

>  }
>  if (!cat->nb_in_active) {
>  ret = flush_segment(ctx);

-- 
  Nicolas George


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] avfilter/avf_concat: fix EOF timestamp

2021-07-25 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavfilter/avf_concat.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavfilter/avf_concat.c b/libavfilter/avf_concat.c
index cb46f52a04..8bb5a5d618 100644
--- a/libavfilter/avf_concat.c
+++ b/libavfilter/avf_concat.c
@@ -402,7 +402,10 @@ static int activate(AVFilterContext *ctx)
 if (ret > 0) {
 close_input(ctx, cat->cur_idx + i);
 if (cat->cur_idx + ctx->nb_outputs >= ctx->nb_inputs) {
-ff_outlink_set_status(ctx->outputs[i], status, pts);
+ff_outlink_set_status(ctx->outputs[i], status,
+  cat->delta_ts + av_rescale_q(pts,
+   
ctx->inputs[cat->cur_idx + i]->time_base,
+   
ctx->outputs[i]->time_base));
 }
 if (!cat->nb_in_active) {
 ret = flush_segment(ctx);
-- 
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] [PATCH 2/2] avfilter/dnn_processing: Add TensorRT backend

2021-07-25 Thread Xiaowei Wang
The backend can be called as:
-vf dnn_processing=dnn_backend=tensorrt:model="model":input=:output=

As TensorRT provides C++ API rather than C, the TensorRT implementation is
separated into a wrapper.
The wrapper is placed in https://github.com/DutchPiPi/nv-tensorrt-wrapper
Please build & install the wrapper before compiling ffmpeg.
Please see https://github.com/DutchPiPi/FFmpeg-trt-backend-test for how to
configure ffmpeg and generate a TensorRT engine for tests.

Signed-off-by: Xiaowei Wang 
---
 libavfilter/dnn/Makefile   |   2 +-
 libavfilter/dnn/dnn_backend_tensorrt.c |  97 +++-
 libavfilter/dnn/dnn_backend_tensorrt.h |  40 +-
 libavfilter/dnn/dnn_io_proc_trt.cu |  55 --
 libavfilter/dnn/trt_class_wrapper.cpp  | 731 -
 libavfilter/dnn/trt_class_wrapper.h|  49 --
 6 files changed, 109 insertions(+), 865 deletions(-)
 delete mode 100644 libavfilter/dnn/dnn_io_proc_trt.cu
 delete mode 100644 libavfilter/dnn/trt_class_wrapper.cpp
 delete mode 100644 libavfilter/dnn/trt_class_wrapper.h

diff --git a/libavfilter/dnn/Makefile b/libavfilter/dnn/Makefile
index f9ea7ca386..4661d3b2cb 100644
--- a/libavfilter/dnn/Makefile
+++ b/libavfilter/dnn/Makefile
@@ -16,6 +16,6 @@ OBJS-$(CONFIG_DNN)   += 
dnn/dnn_backend_native_layer_mat
 
 DNN-OBJS-$(CONFIG_LIBTENSORFLOW) += dnn/dnn_backend_tf.o
 DNN-OBJS-$(CONFIG_LIBOPENVINO)   += dnn/dnn_backend_openvino.o
-DNN-OBJS-$(CONFIG_LIBTENSORRT)   += dnn/dnn_backend_tensorrt.o 
dnn/trt_class_wrapper.o dnn/dnn_io_proc_trt.ptx.o
+DNN-OBJS-$(CONFIG_LIBTENSORRT)   += dnn/dnn_backend_tensorrt.o
 
 OBJS-$(CONFIG_DNN)   += $(DNN-OBJS-yes)
diff --git a/libavfilter/dnn/dnn_backend_tensorrt.c 
b/libavfilter/dnn/dnn_backend_tensorrt.c
index b45b770a77..e50ebc6c99 100644
--- a/libavfilter/dnn/dnn_backend_tensorrt.c
+++ b/libavfilter/dnn/dnn_backend_tensorrt.c
@@ -25,45 +25,119 @@
  * DNN TensorRT backend implementation.
  */
 
-#include "trt_class_wrapper.h"
 #include "dnn_backend_tensorrt.h"
 
-#include "libavutil/mem.h"
 #include "libavformat/avio.h"
+#include "libavutil/mem.h"
 #include "libavutil/avassert.h"
 #include "libavutil/opt.h"
 #include "libavutil/avstring.h"
+#include "libavutil/buffer.h"
+#include "libavutil/pixfmt.h"
+#include "libavutil/pixdesc.h"
+
 #include "dnn_io_proc.h"
 #include "../internal.h"
-#include "libavutil/buffer.h"
+#include "trt_class_wrapper.h"
+
+#include 
+#include 
+#include 
 #include 
 
 #define OFFSET(x) offsetof(TRTContext, x)
 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM
 static const AVOption dnn_tensorrt_options[] = {
-{ "device", "index of the GPU to run model", OFFSET(options.device), 
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
+{ "device", "index of the GPU to run model", OFFSET(options.device),
AV_OPT_TYPE_INT,{ .i64 = 0 }, 0, INT_MAX, FLAGS },
+{ "plugin", "path to the plugin so", OFFSET(options.plugin_so), 
AV_OPT_TYPE_STRING, { .str = NULL}, 0, 0, FLAGS },
 { NULL }
 };
 AVFILTER_DEFINE_CLASS(dnn_tensorrt);
 
-DNNModel *ff_dnn_load_model_trt(const char *model_filename,DNNFunctionType 
func_type, 
+static TRTWrapper *wrapper = NULL;
+
+static int load_trt_backend_lib(TRTWrapper *w, const char *so_path, int mode)
+{
+w->so_handle = dlopen("libnvtensorrt.so", mode);
+if (!w->so_handle)
+{
+return AVERROR(EIO);
+}
+
+w->load_model_func = (tloadModelTrt*)dlsym(w->so_handle, "load_model_trt");
+w->execute_model_func = (texecuteModelTrt*)dlsym(w->so_handle, 
"execute_model_trt");
+w->free_model_func = (tfreeModelTrt*)dlsym(w->so_handle, "free_model_trt");
+if (!w->load_model_func || !w->execute_model_func || !w->free_model_func)
+{
+return AVERROR(EIO);
+}
+
+return 0;
+}
+
+DNNModel *ff_dnn_load_model_trt(const char *model_filename,DNNFunctionType 
func_type,
 const char *options, AVFilterContext 
*filter_ctx)
 {
+char id_buf[64];
+AVBufferRef *device_ref = NULL;
+TRTContext *ctx = (TRTContext*)av_mallocz(sizeof(TRTContext));
+
+int ret = 0;
+
 DNNModel *model = NULL;
 model = (DNNModel*)av_mallocz(sizeof(DNNModel));
 if (!model){
 return NULL;
 }
+wrapper = av_mallocz(sizeof(TRTWrapper));
+wrapper->ctx = ctx;
+if (load_trt_backend_lib(wrapper, "libnvtensorrt.so", RTLD_LAZY) != 0)
+{
+av_log(ctx, AV_LOG_ERROR, "Cannot load wrapper functions. Please check 
if libnvtensorrt.so is installed\n");
+return NULL;
+}
+ctx->av_class = _tensorrt_class;
+av_opt_set_defaults(ctx);
+if (av_opt_set_from_string(ctx, options, NULL, "=", "&") < 0)
+{
+av_log(ctx, AV_LOG_ERROR, "Failed to parse options \"%s\"\n", options);
+return NULL;
+}
+snprintf(id_buf, sizeof(id_buf), "%d", ctx->options.device);
+
+if (ctx->options.plugin_so)
+{
+if 

[FFmpeg-devel] [PATCH 1/2] avfilter/dnn/dnn_backend_trt: Update with master and sign-off

2021-07-25 Thread Xiaowei Wang
Signed-off-by: Xiaowei Wang 
---
 configure  |   6 +-
 libavfilter/dnn/Makefile   |   1 +
 libavfilter/dnn/dnn_backend_tensorrt.c |  77 +++
 libavfilter/dnn/dnn_backend_tensorrt.h |  72 +++
 libavfilter/dnn/dnn_interface.c|  10 +
 libavfilter/dnn/dnn_io_proc_trt.cu |  55 ++
 libavfilter/dnn/trt_class_wrapper.cpp  | 731 +
 libavfilter/dnn/trt_class_wrapper.h|  49 ++
 libavfilter/dnn_interface.h|   2 +-
 libavfilter/vf_dnn_processing.c|   3 +
 10 files changed, 1004 insertions(+), 2 deletions(-)
 create mode 100644 libavfilter/dnn/dnn_backend_tensorrt.c
 create mode 100644 libavfilter/dnn/dnn_backend_tensorrt.h
 create mode 100644 libavfilter/dnn/dnn_io_proc_trt.cu
 create mode 100644 libavfilter/dnn/trt_class_wrapper.cpp
 create mode 100644 libavfilter/dnn/trt_class_wrapper.h

diff --git a/configure b/configure
index b124411609..e496a66621 100755
--- a/configure
+++ b/configure
@@ -272,6 +272,8 @@ External library support:
   --enable-libsvtav1   enable AV1 encoding via SVT [no]
   --enable-libtensorflow   enable TensorFlow as a DNN module backend
for DNN based filters like sr [no]
+  --enable-libtensorrt enable TensorRT as a DNN module backend
+   for DNN based filters like sr [no]
   --enable-libtesseractenable Tesseract, needed for ocr filter [no]
   --enable-libtheora   enable Theora encoding via libtheora [no]
   --enable-libtls  enable LibreSSL (via libtls), needed for https 
support
@@ -1839,6 +1841,7 @@ EXTERNAL_LIBRARY_LIST="
 libssh
 libsvtav1
 libtensorflow
+libtensorrt
 libtesseract
 libtheora
 libtwolame
@@ -2660,7 +2663,7 @@ cbs_mpeg2_select="cbs"
 cbs_vp9_select="cbs"
 dct_select="rdft"
 dirac_parse_select="golomb"
-dnn_suggest="libtensorflow libopenvino"
+dnn_suggest="libtensorflow libopenvino libtensorrt"
 dnn_deps="avformat swscale"
 error_resilience_select="me_cmp"
 faandct_deps="faan"
@@ -6487,6 +6490,7 @@ enabled libspeex  && require_pkg_config libspeex 
speex speex/speex.h spe
 enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" 
srt/srt.h srt_socket
 enabled libsvtav1 && require_pkg_config libsvtav1 "SvtAv1Enc >= 0.8.4" 
EbSvtAv1Enc.h svt_av1_enc_init_handle
 enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h 
TF_Version -ltensorflow
+enabled libtensorrt   && require_cpp libtensorrt NvInfer.h nvinfer1::Dims2 
-lnvinfer -lcudart
 enabled libtesseract  && require_pkg_config libtesseract tesseract 
tesseract/capi.h TessBaseAPICreate
 enabled libtheora && require libtheora theora/theoraenc.h th_info_init 
-ltheoraenc -ltheoradec -logg
 enabled libtls&& require_pkg_config libtls libtls tls.h 
tls_configure
diff --git a/libavfilter/dnn/Makefile b/libavfilter/dnn/Makefile
index 4cfbce0efc..f9ea7ca386 100644
--- a/libavfilter/dnn/Makefile
+++ b/libavfilter/dnn/Makefile
@@ -16,5 +16,6 @@ OBJS-$(CONFIG_DNN)   += 
dnn/dnn_backend_native_layer_mat
 
 DNN-OBJS-$(CONFIG_LIBTENSORFLOW) += dnn/dnn_backend_tf.o
 DNN-OBJS-$(CONFIG_LIBOPENVINO)   += dnn/dnn_backend_openvino.o
+DNN-OBJS-$(CONFIG_LIBTENSORRT)   += dnn/dnn_backend_tensorrt.o 
dnn/trt_class_wrapper.o dnn/dnn_io_proc_trt.ptx.o
 
 OBJS-$(CONFIG_DNN)   += $(DNN-OBJS-yes)
diff --git a/libavfilter/dnn/dnn_backend_tensorrt.c 
b/libavfilter/dnn/dnn_backend_tensorrt.c
new file mode 100644
index 00..b45b770a77
--- /dev/null
+++ b/libavfilter/dnn/dnn_backend_tensorrt.c
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2021 NVIDIA CORPORATION. All rights reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+* DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * @file
+ * DNN TensorRT backend implementation.
+ */
+
+#include "trt_class_wrapper.h"
+#include "dnn_backend_tensorrt.h"
+
+#include "libavutil/mem.h"

[FFmpeg-devel] [PATCH 1/2] avfilter/dnn/dnn_backend_trt: Update with master and sign-off

2021-07-25 Thread Xiaowei Wang



0001-avfilter-dnn-dnn_backend_trt-Update-with-master-and-.patch
Description: 0001-avfilter-dnn-dnn_backend_trt-Update-with-master-and-.patch
___
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] tools/target_dec_fuzzer: Adjust threshold for VP6F

2021-07-25 Thread Michael Niedermayer
Fixes: Timeout
Fixes: 
34791/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP6F_fuzzer-4571038838030336

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

diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index 8bef96eb68..0195d8910e 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -205,6 +205,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 case AV_CODEC_ID_VP3: maxpixels  /= 4096;  break;
 case AV_CODEC_ID_VP4: maxpixels  /= 4096;  break;
 case AV_CODEC_ID_VP5: maxpixels  /= 256;   break;
+case AV_CODEC_ID_VP6F:maxpixels  /= 4096;  break;
 case AV_CODEC_ID_VP7: maxpixels  /= 256;   break;
 case AV_CODEC_ID_VP9: maxpixels  /= 4096;  break;
 case AV_CODEC_ID_WAVPACK: maxsamples /= 1024;  break;
-- 
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] [PATCH 2/2] avcodec/webp: Check available space in loop in decode_entropy_coded_image()

2021-07-25 Thread Michael Niedermayer
Fixes: Timeout
Fixes: 
35401/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WEBP_fuzzer-5714401821851648

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

diff --git a/libavcodec/webp.c b/libavcodec/webp.c
index 83371ef6fd..3efd4438d9 100644
--- a/libavcodec/webp.c
+++ b/libavcodec/webp.c
@@ -627,6 +627,9 @@ static int decode_entropy_coded_image(WebPContext *s, enum 
ImageRole role,
 while (y < img->frame->height) {
 int v;
 
+if (get_bits_left(>gb) < 0)
+return AVERROR_INVALIDDATA;
+
 hg = get_huffman_group(s, img, x, y);
 v = huff_reader_get_symbol([HUFF_IDX_GREEN], >gb);
 if (v < NUM_LITERAL_CODES) {
-- 
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 2/2] avfilter/dnn_processing: Add TensorRT backend

2021-07-25 Thread James Almer

On 7/25/2021 8:58 AM, Xiaowei Wang wrote:

The backend can be called as:
-vf dnn_processing=dnn_backend=tensorrt:model="model":input=:output=

As TensorRT provides C++ API rather than C, the TensorRT implementation is
separated into a wrapper.
The wrapper is placed inhttps://github.com/DutchPiPi/nv-tensorrt-wrapper
Please build & install the wrapper before compiling ffmpeg.
Please seehttps://github.com/DutchPiPi/FFmpeg-trt-backend-test  for how to
configure ffmpeg and generate a TensorRT engine for tests.

Signed-off-by: Xiaowei Wang
---
  libavfilter/dnn/Makefile   |   2 +-
  libavfilter/dnn/dnn_backend_tensorrt.c |  97 +++-
  libavfilter/dnn/dnn_backend_tensorrt.h |  40 +-
  libavfilter/dnn/dnn_io_proc_trt.cu |  55 --
  libavfilter/dnn/trt_class_wrapper.cpp  | 731 -
  libavfilter/dnn/trt_class_wrapper.h|  49 --
  6 files changed, 109 insertions(+), 865 deletions(-)
  delete mode 100644 libavfilter/dnn/dnn_io_proc_trt.cu
  delete mode 100644 libavfilter/dnn/trt_class_wrapper.cpp
  delete mode 100644 libavfilter/dnn/trt_class_wrapper.h

diff --git a/libavfilter/dnn/Makefile b/libavfilter/dnn/Makefile
index f9ea7ca386..4661d3b2cb 100644
--- a/libavfilter/dnn/Makefile
+++ b/libavfilter/dnn/Makefile
@@ -16,6 +16,6 @@ OBJS-$(CONFIG_DNN)   += 
dnn/dnn_backend_native_layer_mat
  
  DNN-OBJS-$(CONFIG_LIBTENSORFLOW) += dnn/dnn_backend_tf.o

  DNN-OBJS-$(CONFIG_LIBOPENVINO)   += dnn/dnn_backend_openvino.o
-DNN-OBJS-$(CONFIG_LIBTENSORRT)   += dnn/dnn_backend_tensorrt.o 
dnn/trt_class_wrapper.o dnn/dnn_io_proc_trt.ptx.o
+DNN-OBJS-$(CONFIG_LIBTENSORRT)   += dnn/dnn_backend_tensorrt.o
  
  OBJS-$(CONFIG_DNN)   += $(DNN-OBJS-yes)

diff --git a/libavfilter/dnn/dnn_backend_tensorrt.c 
b/libavfilter/dnn/dnn_backend_tensorrt.c
index b45b770a77..e50ebc6c99 100644
--- a/libavfilter/dnn/dnn_backend_tensorrt.c
+++ b/libavfilter/dnn/dnn_backend_tensorrt.c
@@ -25,45 +25,119 @@
   * DNN TensorRT backend implementation.
   */
  
-#include "trt_class_wrapper.h"

  #include "dnn_backend_tensorrt.h"
  
-#include "libavutil/mem.h"

  #include "libavformat/avio.h"
+#include "libavutil/mem.h"
  #include "libavutil/avassert.h"
  #include "libavutil/opt.h"
  #include "libavutil/avstring.h"
+#include "libavutil/buffer.h"
+#include "libavutil/pixfmt.h"
+#include "libavutil/pixdesc.h"
+
  #include "dnn_io_proc.h"
  #include "../internal.h"
-#include "libavutil/buffer.h"
+#include "trt_class_wrapper.h"
+
+#include 
+#include 
+#include 
  #include 
  
  #define OFFSET(x) offsetof(TRTContext, x)

  #define FLAGS AV_OPT_FLAG_FILTERING_PARAM
  static const AVOption dnn_tensorrt_options[] = {
-{ "device", "index of the GPU to run model", OFFSET(options.device), 
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
+{ "device", "index of the GPU to run model", OFFSET(options.device),
AV_OPT_TYPE_INT,{ .i64 = 0 }, 0, INT_MAX, FLAGS },
+{ "plugin", "path to the plugin so", OFFSET(options.plugin_so), 
AV_OPT_TYPE_STRING, { .str = NULL}, 0, 0, FLAGS },
  { NULL }
  };
  AVFILTER_DEFINE_CLASS(dnn_tensorrt);
  
-DNNModel *ff_dnn_load_model_trt(const char *model_filename,DNNFunctionType func_type,

+static TRTWrapper *wrapper = NULL;
+
+static int load_trt_backend_lib(TRTWrapper *w, const char *so_path, int mode)
+{
+w->so_handle = dlopen("libnvtensorrt.so", mode);


No, dlopen() is not allowed for this kind of thing. Linking must be 
added at build time.


You for that matter apparently add support for build time linking in 
patch 1, then attempt to remove it in this one, leaving cruft in the 
configure script. Why?



+if (!w->so_handle)
+{
+return AVERROR(EIO);
+}
+
+w->load_model_func = (tloadModelTrt*)dlsym(w->so_handle, "load_model_trt");
+w->execute_model_func = (texecuteModelTrt*)dlsym(w->so_handle, 
"execute_model_trt");
+w->free_model_func = (tfreeModelTrt*)dlsym(w->so_handle, "free_model_trt");
+if (!w->load_model_func || !w->execute_model_func || !w->free_model_func)
+{
+return AVERROR(EIO);
+}
+
+return 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] libavformat/flvdec: add HEVC demuxing support

2021-07-25 Thread James Almer

On 7/25/2021 10:04 AM, Xiaolei Yu wrote:

Explicitly supply an HEVC codec id to enable this feature.
---
  libavformat/flv.h|  1 +
  libavformat/flvdec.c | 21 ++---
  2 files changed, 19 insertions(+), 3 deletions(-)


This has been rejected time and time again, last time not even a month ago.
___
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] libavformat/flvdec: add HEVC demuxing support

2021-07-25 Thread Xiaolei Yu
Explicitly supply an HEVC codec id to enable this feature.
---
 libavformat/flv.h|  1 +
 libavformat/flvdec.c | 21 ++---
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/libavformat/flv.h b/libavformat/flv.h
index 3571b90279..7cb1b72b4c 100644
--- a/libavformat/flv.h
+++ b/libavformat/flv.h
@@ -42,6 +42,7 @@
 #define FLV_AUDIO_CODECID_MASK0xf0
 
 #define FLV_VIDEO_CODECID_MASK0x0f
+#define FLV_VIDEO_CODECID_MAX 0x0f
 #define FLV_VIDEO_FRAMETYPE_MASK  0xf0
 
 #define AMF_END_OF_OBJECT 0x09
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index b4a419177a..e44aa693b7 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -74,6 +74,7 @@ typedef struct FLVContext {
 int64_t *keyframe_times;
 int64_t *keyframe_filepositions;
 int missing_streams;
+int hevc_codec_id;
 AVRational framerate;
 int64_t last_ts;
 int64_t time_offset;
@@ -301,7 +302,7 @@ static void flv_set_audio_codec(AVFormatContext *s, 
AVStream *astream,
 }
 }
 
-static int flv_same_video_codec(AVCodecParameters *vpar, int flags)
+static int flv_same_video_codec(FLVContext *flv, AVCodecParameters *vpar, int 
flags)
 {
 int flv_codecid = flags & FLV_VIDEO_CODECID_MASK;
 
@@ -322,6 +323,8 @@ static int flv_same_video_codec(AVCodecParameters *vpar, 
int flags)
 case FLV_CODECID_H264:
 return vpar->codec_id == AV_CODEC_ID_H264;
 default:
+if (flv->hevc_codec_id && flv_codecid == flv->hevc_codec_id)
+return vpar->codec_id == AV_CODEC_ID_HEVC;
 return vpar->codec_tag == flv_codecid;
 }
 }
@@ -329,6 +332,7 @@ static int flv_same_video_codec(AVCodecParameters *vpar, 
int flags)
 static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream,
int flv_codecid, int read)
 {
+FLVContext *flv = s->priv_data;
 int ret = 0;
 AVCodecParameters *par = vstream->codecpar;
 enum AVCodecID old_codec_id = vstream->codecpar->codec_id;
@@ -371,6 +375,12 @@ static int flv_set_video_codec(AVFormatContext *s, 
AVStream *vstream,
 ret = 3;
 break;
 default:
+if (flv->hevc_codec_id && flv_codecid == flv->hevc_codec_id) {
+par->codec_id = AV_CODEC_ID_HEVC;
+vstream->internal->need_parsing = AVSTREAM_PARSE_HEADERS;
+ret = 3; // not 4, reading packet type will consume one byte
+break;
+}
 avpriv_request_sample(s, "Video codec (%x)", flv_codecid);
 par->codec_tag = flv_codecid;
 }
@@ -1126,7 +1136,7 @@ skip:
 break;
 } else if (stream_type == FLV_STREAM_TYPE_VIDEO) {
 if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
-(s->video_codec_id || flv_same_video_codec(st->codecpar, 
flags)))
+(s->video_codec_id || flv_same_video_codec(flv, st->codecpar, 
flags)))
 break;
 } else if (stream_type == FLV_STREAM_TYPE_SUBTITLE) {
 if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE)
@@ -1241,6 +1251,7 @@ retry_duration:
 
 if (st->codecpar->codec_id == AV_CODEC_ID_AAC ||
 st->codecpar->codec_id == AV_CODEC_ID_H264 ||
+st->codecpar->codec_id == AV_CODEC_ID_HEVC ||
 st->codecpar->codec_id == AV_CODEC_ID_MPEG4) {
 int type = avio_r8(s->pb);
 size--;
@@ -1250,7 +1261,9 @@ retry_duration:
 goto leave;
 }
 
-if (st->codecpar->codec_id == AV_CODEC_ID_H264 || 
st->codecpar->codec_id == AV_CODEC_ID_MPEG4) {
+if (st->codecpar->codec_id == AV_CODEC_ID_H264 ||
+st->codecpar->codec_id == AV_CODEC_ID_HEVC ||
+st->codecpar->codec_id == AV_CODEC_ID_MPEG4) {
 // sign extension
 int32_t cts = (avio_rb24(s->pb) + 0xff80) ^ 0xff80;
 pts = av_sat_add64(dts, cts);
@@ -1266,6 +1279,7 @@ retry_duration:
 }
 }
 if (type == 0 && (!st->codecpar->extradata || st->codecpar->codec_id 
== AV_CODEC_ID_AAC ||
+st->codecpar->codec_id == AV_CODEC_ID_HEVC ||
 st->codecpar->codec_id == AV_CODEC_ID_H264)) {
 AVDictionaryEntry *t;
 
@@ -1361,6 +1375,7 @@ static const AVOption options[] = {
 { "flv_metadata", "Allocate streams according to the onMetaData array", 
OFFSET(trust_metadata), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VD },
 { "flv_full_metadata", "Dump full metadata of the onMetadata", 
OFFSET(dump_full_metadata), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VD },
 { "flv_ignore_prevtag", "Ignore the Size of previous tag", 
OFFSET(trust_datasize), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VD },
+{ "flv_hevc_codec_id", "Assign HEVC stream codec ID", 
OFFSET(hevc_codec_id), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, FLV_VIDEO_CODECID_MAX, 
VD },
 { "missing_streams", "", OFFSET(missing_streams), AV_OPT_TYPE_INT, { .i64 
= 0 }, 0, 0xFF, VD | AV_OPT_FLAG_EXPORT | AV_OPT_FLAG_READONLY },
 { NULL 

Re: [FFmpeg-devel] [PATCH 1/2] avcodec/argo: use bits_per_coded_sample instead of bits_per_raw_sample

2021-07-25 Thread Michael Niedermayer
On Mon, Jul 19, 2021 at 10:53:40AM +1000, Zane van Iperen wrote:
> Will apply this and parts 3-8 of part 1 soon.

thanks for looking into this

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

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


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

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


Re: [FFmpeg-devel] [PATCH 2/2] avfilter/dnn_processing: Add TensorRT backend

2021-07-25 Thread Jean-Baptiste Kempf
On Sun, 25 Jul 2021, at 13:58, Xiaowei Wang wrote:
>  libavfilter/dnn/trt_class_wrapper.cpp  | 731 -

So, you add files in the first patch, and then delete it on the second one???

-- 
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] avformat/yuv4mpegenc: add support for yuva444p

2021-07-25 Thread Michael Niedermayer
On Sat, Jul 24, 2021 at 06:08:37PM +0200, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol 
> ---
>  libavformat/yuv4mpegenc.c | 13 +
>  1 file changed, 13 insertions(+)

LGTM

thx

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

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


signature.asc
Description: 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 JPEG2000 Parser: Fix parsing of tile-part header

2021-07-25 Thread Shaun Simpson
Hi Jan,

I am glad these patches help, thank you for  looking into this.

> It also seems like it would make sense to have a minimal sample of
> such bit stream type in our FATE test set so we can figure out if the
> parsing of such streams fails in the future.

Yes, I have been looking at samples for FATE as they are required, but the
size of these files is problematic.
If I try and use FFmpeg to sample the beginning of the Sol Levante, the
issue "goes away".
The best I could do was to use "dd" to truncate the file for my testing.

I will look at using Da Vinci Resolve to create a sample, what sample size
should I be considering for FATE?

> As someone who unfortunately lacks the context for JPEG2000 bit
> streams, can you give any pointers towards helping with review?

Yes, I would appreciate a second pair of eyes.
I used following document: T-REC-T.800-201511-S!!PDF-E.pdf
https://www.itu.int/rec/dologin_pub.asp?lang=e=T-REC-T.800-201511-S!!PDF-E=items

> Also others may consider this as a flag that if there is JPEG2000 bit
> stream knowledge about, you are free to poke at this one :) . It seems
> to fix decoding properly.

Yes, I am willing. I can't guarantee my response times but I would like to
get J2K playback working as robustly as possible.

> It seems to be set if the AVStream's internal->need_parsing is set to
> AVSTREAM_PARSE_HEADERS , which is the default behavior in
> avformat/mxfdec.

Thank you for this information.

Shaun

On Sat, Jul 24, 2021 at 7:01 PM Jan Ekström  wrote:

> On Wed, Jul 21, 2021 at 7:02 PM Shaun Simpson 
> wrote:
> >
> > Please find my patch attached.
> >
> > libavcodec/jpeg2000_parser: Fix parsing of tile-part header, and frames
> > where the end of frame marker is at the end of the buffer.
> >
> > Fixes playback of Sol Levante MXF JPEG2000 file:
> > VIDEO_e4da5fcd-5ffc-4713-bcdd-95ea579d790b.mxf
> >
> >
> http://download.opencontent.netflix.com.s3.amazonaws.com/SolLevante/imf/SolLevante_IMF_DolbyVision_PQP3D65_UHD_24fps.zip
> >
> > Bug Summary:
> > When playing back VIDEO_e4da5fcd-5ffc-4713-bcdd-95ea579d790b.mxf, I
> noticed
> > a regression between release 4.2.4 and release 4.3.2. Release 4.3.2 skips
> > some frames. This can be seen in the first 15 seconds of the video. The
> > Netflix logo should fade out.
> >
> > This regression is in the master branch and was introduced by commit
> > d09c356 which adds a JPEG2000 parser. I have also tested this patch
> against
> > my 3 other JPEG2000 samples.
> >
> > The patches are against master branch 13ec662 and fix playback of this
> file.
> >
>
> First of all, thank you for poking at the j2k parser. I have seen
> similar complaints from multiple people handling J2K in MXF, and after
> linking these patches to such people they seem to fix the issue.
>
> It also seems like it would make sense to have a minimal sample of
> such bit stream type in our FATE test set so we can figure out if the
> parsing of such streams fails in the future.
>
> > 1. Fixed a off by one error when calculating the number of bytes to skip.
> >
> > 2. Added a 'continue' to the Tile part header reading, to skip the
> reaming
> > paring code during a header read.
> >
> > 3. To deal with the end of frame tag being at the very end of the buffer,
> > return the frame size during the current loop iteration.
> >
>
> As someone who unfortunately lacks the context for JPEG2000 bit
> streams, can you give any pointers towards helping with review?
>
> Also others may consider this as a flag that if there is JPEG2000 bit
> stream knowledge about, you are free to poke at this one :) . It seems
> to fix decoding properly.
>
> > Is the PARSER_FLAG_COMPLETE_FRAMES flag supposed to be set for the
> Netflix
> > sample? The files playback correctly if the flag is set, as each buffer
> > contains a complete frame, but it is not set for the test case above.
> >
>
> It seems to be set if the AVStream's internal->need_parsing is set to
> AVSTREAM_PARSE_HEADERS , which is the default behavior in
> avformat/mxfdec.
>
> Jan
> ___
> 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] lavd/lavfi.c: Set time_base for 608 cc to container time_base.

2021-07-25 Thread Thilo Borgmann
Am 16.07.21 um 09:45 schrieb Thilo Borgmann:
> Hi,
> 
 when transcoding 608 cc, the cc stream frame pts is set to the same value 
 as its container frame's pts. However, the time_base is always set to 
 1/9 (default) in the initialization stage. Which causes timing issues 
 when the container time_base is actually not 1/9.
>>>
>>> identical v2 attached that also includes updates to the FATE references 
>>> affected by the patch (and failed with patchwork of course).
>>>
>>> -Thilo
>>>
>>> From 41b619e5d5083ca59a41cca9cb515190939d6573 Mon Sep 17 00:00:00 2001
>>> From: Yun Zhang 
>>> Date: Mon, 28 Jun 2021 15:09:42 +0200
>>> Subject: [PATCH] lavd/lavfi.c: Set time_base for 608 cc to container
>>>  time_base.
>>>
>>> Suggested-By: ffm...@fb.com
>>> ---
>>>  libavdevice/lavfi.c|  3 +++
>>>  tests/ref/fate/sub-cc  |  4 ++--
>>>  tests/ref/fate/sub-cc-realtime | 38 +++---
>>>  3 files changed, 13 insertions(+), 32 deletions(-)
>>>
>>> diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c
>>> index 57d977e7ce..e07f20c872 100644
>>> --- a/libavdevice/lavfi.c
>>> +++ b/libavdevice/lavfi.c
>>> @@ -100,6 +100,7 @@ static int create_subcc_streams(AVFormatContext *avctx)
>>>  LavfiContext *lavfi = avctx->priv_data;
>>>  AVStream *st;
>>>  int stream_idx, sink_idx;
>>> +AVRational *time_base;
>>>  
>>>  for (stream_idx = 0; stream_idx < lavfi->nb_sinks; stream_idx++) {
>>>  sink_idx = lavfi->stream_sink_map[stream_idx];
>>> @@ -109,6 +110,8 @@ static int create_subcc_streams(AVFormatContext *avctx)
>>>  return AVERROR(ENOMEM);
>>>  st->codecpar->codec_id = AV_CODEC_ID_EIA_608;
>>>  st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE;
>>> +time_base = >streams[stream_idx]->time_base;
>>> +avpriv_set_pts_info(st, 64, time_base->num, time_base->den);
>>
>> This look like an unnecessariily complicated way to write
>> st->time_base.{num,den}
> 
> Changed patch attached.

Will push soon (tm) if there are no further comments.

Thanks,
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".