[FFmpeg-devel] [PATCH v2 5/8] avcodec/h26xenc: Add h264/hevc VPE HW encoder

2020-05-31 Thread Zhang, Guiyong
This encoder uses VPI(VPE Interface) API and library for h264 and hevc
encoding.

Signed-off-by: rxchen 
---
 configure|   2 +
 libavcodec/Makefile  |   2 +
 libavcodec/allcodecs.c   |   2 +
 libavcodec/vpe_h26xenc.c | 633 +++
 libavcodec/vpe_h26xenc.h |  83 +++
 5 files changed, 722 insertions(+)
 create mode 100644 libavcodec/vpe_h26xenc.c
 create mode 100755 libavcodec/vpe_h26xenc.h

diff --git a/configure b/configure
index f116c37..10d1322 100755
--- a/configure
+++ b/configure
@@ -3065,6 +3065,7 @@ h264_v4l2m2m_decoder_deps="v4l2_m2m h264_v4l2_m2m"
 h264_v4l2m2m_decoder_select="h264_mp4toannexb_bsf"
 h264_v4l2m2m_encoder_deps="v4l2_m2m h264_v4l2_m2m"
 h264_vpe_decoder_deps="vpe"
+h264_vpe_encoder_deps="vpe"
 hevc_amf_encoder_deps="amf"
 hevc_cuvid_decoder_deps="cuvid"
 hevc_cuvid_decoder_select="hevc_mp4toannexb_bsf"
@@ -3082,6 +3083,7 @@ hevc_v4l2m2m_decoder_deps="v4l2_m2m hevc_v4l2_m2m"
 hevc_v4l2m2m_decoder_select="hevc_mp4toannexb_bsf"
 hevc_v4l2m2m_encoder_deps="v4l2_m2m hevc_v4l2_m2m"
 hevc_vpe_decoder_deps="vpe"
+hevc_vpe_encoder_deps="vpe"
 mjpeg_cuvid_decoder_deps="cuvid"
 mjpeg_qsv_decoder_select="qsvdec"
 mjpeg_qsv_encoder_deps="libmfx"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 6b59ae7..ffdfae4 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -764,6 +764,8 @@ OBJS-$(CONFIG_ZMBV_ENCODER)+= zmbvenc.o
 OBJS-$(CONFIG_H264_VPE_DECODER)+= vpe_h264dec.o vpe_dec_common.o
 OBJS-$(CONFIG_HEVC_VPE_DECODER)+= vpe_hevcdec.o vpe_dec_common.o
 OBJS-$(CONFIG_VP9_VPE_DECODER) += vpe_vp9dec.o vpe_dec_common.o
+OBJS-$(CONFIG_H264_VPE_ENCODER)+= vpe_h26xenc.o
+OBJS-$(CONFIG_HEVC_VPE_ENCODER)+= vpe_h26xenc.o

 # (AD)PCM decoders/encoders
 OBJS-$(CONFIG_PCM_ALAW_DECODER)   += pcm.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 5c5c32e..91f4e61 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -811,6 +811,8 @@ extern AVCodec ff_vp9_qsv_encoder;
 extern AVCodec ff_h264_vpe_decoder;
 extern AVCodec ff_hevc_vpe_decoder;
 extern AVCodec ff_vp9_vpe_decoder;
+extern AVCodec ff_h264_vpe_encoder;
+extern AVCodec ff_hevc_vpe_encoder;

 // The iterate API is not usable with ossfuzz due to the excessive size of 
binaries created
 #if CONFIG_OSSFUZZ
diff --git a/libavcodec/vpe_h26xenc.c b/libavcodec/vpe_h26xenc.c
new file mode 100644
index 000..aff772e
--- /dev/null
+++ b/libavcodec/vpe_h26xenc.c
@@ -0,0 +1,633 @@
+/*
+ * Verisilicon VPE H264/HEVC Encoder
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#include 
+#include 
+#include 
+#include "libavutil/opt.h"
+#include "libavcodec/internal.h"
+#include "vpe_h26xenc.h"
+#include "libavutil/hwcontext_vpe.h"
+
+static av_cold int vpe_h26x_encode_close(AVCodecContext *avctx);
+
+/**
+ * Output the ES data in VpiPacket to AVPacket
+ */
+static int vpe_h26xe_output_es_to_avpacket(AVPacket *av_packet,
+   VpiPacket *vpi_packet)
+{
+int ret = 0;
+if (av_new_packet(av_packet, vpi_packet->size))
+return AVERROR(ENOMEM);
+
+memcpy(av_packet->data, (uint8_t *)vpi_packet->data, vpi_packet->size);
+av_packet->pts = vpi_packet->pts;
+av_packet->dts = vpi_packet->pkt_dts;
+
+return ret;
+}
+
+/**
+ * Output the ES data in VpiPacket to AVPacket and control the encoder to
+ * update the statistic
+ */
+static int vpe_h26xe_output_es_update_statis(AVCodecContext *avctx,
+ AVPacket *av_packet,
+ VpiPacket *vpi_packet)
+{
+int ret= 0;
+VpeH26xEncCtx *enc_ctx = NULL;
+int stream_size= vpi_packet->size;
+VpiCtrlCmdParam cmd;
+
+if ((ret = vpe_h26xe_output_es_to_avpacket(av_packet, vpi_packet)) < 0) {
+return ret;
+}
+
+enc_ctx  = (VpeH26xEncCtx *)avctx->priv_data;
+cmd.cmd  = VPI_CMD_H26xENC_UPDATE_STATISTIC;
+cmd.data = _size;
+ret  = enc_ctx->api->control(enc_ctx->ctx, (void *), NULL);
+if (ret != 0) {
+av_log(avctx, AV_LOG_ERROR, "H26x_enc control STATISTIC failed\n");
+return AVERROR_EXTERNAL;
+}
+
+return ret;
+}

[FFmpeg-devel] [PATCH v2 4/8] avcodec/vp9dec: Add vp9 VPE HW decoder

2020-05-31 Thread Zhang, Guiyong
This decoder uses VPI(VPE Interface) API and library for vp9 decoding.

Signed-off-by: Qin.Wang 
---
 configure   |  1 +
 libavcodec/Makefile |  1 +
 libavcodec/allcodecs.c  |  1 +
 libavcodec/vpe_vp9dec.c | 67 +
 4 files changed, 70 insertions(+)
 create mode 100755 libavcodec/vpe_vp9dec.c

diff --git a/configure b/configure
index 129a4ee..f116c37 100755
--- a/configure
+++ b/configure
@@ -3131,6 +3131,7 @@ vp9_vaapi_encoder_select="vaapi_encode"
 vp9_qsv_encoder_deps="libmfx MFX_CODEC_VP9"
 vp9_qsv_encoder_select="qsvenc"
 vp9_v4l2m2m_decoder_deps="v4l2_m2m vp9_v4l2_m2m"
+vp9_vpe_decoder_deps="vpe"
 wmv3_crystalhd_decoder_select="crystalhd"

 # parsers
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 3193b32..6b59ae7 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -763,6 +763,7 @@ OBJS-$(CONFIG_ZMBV_DECODER)+= zmbv.o
 OBJS-$(CONFIG_ZMBV_ENCODER)+= zmbvenc.o
 OBJS-$(CONFIG_H264_VPE_DECODER)+= vpe_h264dec.o vpe_dec_common.o
 OBJS-$(CONFIG_HEVC_VPE_DECODER)+= vpe_hevcdec.o vpe_dec_common.o
+OBJS-$(CONFIG_VP9_VPE_DECODER) += vpe_vp9dec.o vpe_dec_common.o

 # (AD)PCM decoders/encoders
 OBJS-$(CONFIG_PCM_ALAW_DECODER)   += pcm.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index ae5a791..5c5c32e 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -810,6 +810,7 @@ extern AVCodec ff_vp9_vaapi_encoder;
 extern AVCodec ff_vp9_qsv_encoder;
 extern AVCodec ff_h264_vpe_decoder;
 extern AVCodec ff_hevc_vpe_decoder;
+extern AVCodec ff_vp9_vpe_decoder;

 // The iterate API is not usable with ossfuzz due to the excessive size of 
binaries created
 #if CONFIG_OSSFUZZ
diff --git a/libavcodec/vpe_vp9dec.c b/libavcodec/vpe_vp9dec.c
new file mode 100755
index 000..9fd773d
--- /dev/null
+++ b/libavcodec/vpe_vp9dec.c
@@ -0,0 +1,67 @@
+/*
+ * Verisilicon VPE VP9 Decoder
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "hwconfig.h"
+#include "internal.h"
+#include "libavutil/pixfmt.h"
+
+#include "vpe_dec_common.h"
+
+static av_cold int vpe_vp9_decode_init(AVCodecContext *avctx)
+{
+return ff_vpe_decode_init(avctx, VP9DEC_VPE);
+}
+
+static const AVClass vpe_vp9_decode_class = {
+.class_name = "vp9d_vpe",
+.item_name  = av_default_item_name,
+.option = vpe_decode_options,
+.version= LIBAVUTIL_VERSION_INT,
+};
+
+static const AVCodecHWConfigInternal *vpe_hw_configs[] =
+{ &(const AVCodecHWConfigInternal){
+  .public =
+  {
+  .pix_fmt = AV_PIX_FMT_VPE,
+  .methods = AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX |
+ AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX,
+  .device_type = AV_HWDEVICE_TYPE_VPE,
+  },
+  .hwaccel = NULL,
+  },
+  NULL };
+
+AVCodec ff_vp9_vpe_decoder = {
+.name   = "vp9_vpe",
+.long_name  = NULL_IF_CONFIG_SMALL("VP9 (VPE VC8000D)"),
+.type   = AVMEDIA_TYPE_VIDEO,
+.id = AV_CODEC_ID_VP9,
+.priv_data_size = sizeof(VpeDecCtx),
+.init   = _vp9_decode_init,
+.receive_frame  = _vpe_decode_receive_frame,
+.close  = _vpe_decode_close,
+.priv_class = _vp9_decode_class,
+.capabilities =
+AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE | 
AV_CODEC_CAP_AVOID_PROBING,
+.caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
+.pix_fmts   = (const enum AVPixelFormat[]){ AV_PIX_FMT_VPE, 
AV_PIX_FMT_NONE },
+.hw_configs = vpe_hw_configs,
+};
--
1.8.3.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 v2 7/8] avfilter/spliter: Add VPE spliter filter

2020-05-31 Thread Zhang, Guiyong
This filter splite one input to multi output with different picture data.

Signed-off-by: Qin.Wang 
---
 configure|   1 +
 libavfilter/Makefile |   1 +
 libavfilter/allfilters.c |   1 +
 libavfilter/vf_spliter_vpe.c | 319 +++
 4 files changed, 322 insertions(+)
 create mode 100755 libavfilter/vf_spliter_vpe.c

diff --git a/configure b/configure
index 0522f21..6146954 100755
--- a/configure
+++ b/configure
@@ -3642,6 +3642,7 @@ vpp_qsv_filter_select="qsvvpp"
 xfade_opencl_filter_deps="opencl"
 yadif_cuda_filter_deps="ffnvcodec"
 yadif_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
+spliter_vpe_filter_deps="vpe"

 # examples
 avio_list_dir_deps="avformat avutil"
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 5123540..104ec0c 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -466,6 +466,7 @@ OBJS-$(CONFIG_YAEPBLUR_FILTER)   += 
vf_yaepblur.o
 OBJS-$(CONFIG_ZMQ_FILTER)+= f_zmq.o
 OBJS-$(CONFIG_ZOOMPAN_FILTER)+= vf_zoompan.o
 OBJS-$(CONFIG_ZSCALE_FILTER) += vf_zscale.o
+OBJS-$(CONFIG_SPLITER_VPE_FILTER)+= vf_spliter_vpe.o

 OBJS-$(CONFIG_ALLRGB_FILTER) += vsrc_testsrc.o
 OBJS-$(CONFIG_ALLYUV_FILTER) += vsrc_testsrc.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 1183e40..353a3ca 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -444,6 +444,7 @@ extern AVFilter ff_vf_yaepblur;
 extern AVFilter ff_vf_zmq;
 extern AVFilter ff_vf_zoompan;
 extern AVFilter ff_vf_zscale;
+extern AVFilter ff_vf_spliter_vpe;

 extern AVFilter ff_vsrc_allrgb;
 extern AVFilter ff_vsrc_allyuv;
diff --git a/libavfilter/vf_spliter_vpe.c b/libavfilter/vf_spliter_vpe.c
new file mode 100755
index 000..0be2b09
--- /dev/null
+++ b/libavfilter/vf_spliter_vpe.c
@@ -0,0 +1,319 @@
+/*
+ * Verisilicon VPE H264 Decoder
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+
+#include "avfilter.h"
+#include "filters.h"
+#include "internal.h"
+#include "libavutil/mem.h"
+#include "libavutil/opt.h"
+#include "libavutil/frame.h"
+#include "libavutil/buffer.h"
+#include "libavutil/internal.h"
+#include "libavutil/hwcontext.h"
+#include "libavutil/hwcontext_vpe.h"
+
+typedef struct SpliterVpeContext {
+const AVClass *class;
+int nb_outputs;
+struct {
+int enabled;
+int out_index;
+int flag;
+int width;
+int height;
+struct {
+int enabled;
+int x;
+int y;
+int w;
+int h;
+} crop;
+struct {
+int enabled;
+int w;
+int h;
+} scale;
+} pic_info[PIC_INDEX_MAX_NUMBER];
+} SpliterVpeContext;
+
+static int spliter_vpe_out_config_props(AVFilterLink *outlink);
+
+static av_cold int spliter_vpe_init(AVFilterContext *ctx)
+{
+SpliterVpeContext *s = ctx->priv;
+int i, ret;
+
+for (i = 0; i < s->nb_outputs; i++) {
+char name[32];
+AVFilterPad pad = { 0 };
+
+snprintf(name, sizeof(name), "output%d", i);
+pad.type = AVMEDIA_TYPE_VIDEO;
+pad.name = av_strdup(name);
+if (!pad.name) {
+return AVERROR(ENOMEM);
+}
+pad.config_props = spliter_vpe_out_config_props;
+
+if ((ret = ff_insert_outpad(ctx, i, )) < 0) {
+av_freep();
+return ret;
+}
+}
+
+for (i = 0; i < PIC_INDEX_MAX_NUMBER; i++) {
+s->pic_info[i].out_index = -1;
+}
+
+return 0;
+}
+
+static av_cold void spliter_vpe_uninit(AVFilterContext *ctx)
+{
+int i;
+
+for (i = 0; i < ctx->nb_outputs; i++) {
+av_freep(>output_pads[i].name);
+}
+}
+
+static int spliter_vpe_config_props(AVFilterLink *inlink)
+{
+AVHWFramesContext *hwframe_ctx;
+AVVpeFramesContext *vpeframe_ctx;
+VpiFrame *frame_hwctx;
+AVFilterContext *dst = inlink->dst;
+SpliterVpeContext *s = dst->priv;
+int i;
+
+hwframe_ctx = (AVHWFramesContext *)inlink->hw_frames_ctx->data;
+vpeframe_ctx = (AVVpeFramesContext *)hwframe_ctx->hwctx;
+frame_hwctx = vpeframe_ctx->frame;
+
+for (i = 0; i < 

[FFmpeg-devel] [PATCH v2 8/8] vfilter/pp: Add VPE post processing filter

2020-05-31 Thread Zhang, Guiyong
The input of this filter is raw video data, it supports most of the
popular raw data formats like NV12, YUV420P, YUV420P10BE etc.

Signed-off-by: Guiyong.zhang 
---
 configure|   1 +
 libavfilter/Makefile |   1 +
 libavfilter/allfilters.c |   1 +
 libavfilter/vf_pp_vpe.c  | 391 +++
 4 files changed, 394 insertions(+)
 create mode 100755 libavfilter/vf_pp_vpe.c

diff --git a/configure b/configure
index 6146954..78a3203 100755
--- a/configure
+++ b/configure
@@ -3643,6 +3643,7 @@ xfade_opencl_filter_deps="opencl"
 yadif_cuda_filter_deps="ffnvcodec"
 yadif_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
 spliter_vpe_filter_deps="vpe"
+pp_vpe_filter_deps="vpe"

 # examples
 avio_list_dir_deps="avformat avutil"
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 104ec0c..ba4fad8 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -467,6 +467,7 @@ OBJS-$(CONFIG_ZMQ_FILTER)+= f_zmq.o
 OBJS-$(CONFIG_ZOOMPAN_FILTER)+= vf_zoompan.o
 OBJS-$(CONFIG_ZSCALE_FILTER) += vf_zscale.o
 OBJS-$(CONFIG_SPLITER_VPE_FILTER)+= vf_spliter_vpe.o
+OBJS-$(CONFIG_PP_VPE_FILTER) += vf_pp_vpe.o

 OBJS-$(CONFIG_ALLRGB_FILTER) += vsrc_testsrc.o
 OBJS-$(CONFIG_ALLYUV_FILTER) += vsrc_testsrc.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 353a3ca..40c78f0 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -445,6 +445,7 @@ extern AVFilter ff_vf_zmq;
 extern AVFilter ff_vf_zoompan;
 extern AVFilter ff_vf_zscale;
 extern AVFilter ff_vf_spliter_vpe;
+extern AVFilter ff_vf_pp_vpe;

 extern AVFilter ff_vsrc_allrgb;
 extern AVFilter ff_vsrc_allyuv;
diff --git a/libavfilter/vf_pp_vpe.c b/libavfilter/vf_pp_vpe.c
new file mode 100755
index 000..ea718cc
--- /dev/null
+++ b/libavfilter/vf_pp_vpe.c
@@ -0,0 +1,391 @@
+/*
+ * Verisilicon VPE Post Processing Filter
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERC`ABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+
+#include 
+#include 
+
+#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "libavutil/pixfmt.h"
+#include "libavutil/buffer.h"
+#include "libavutil/hwcontext.h"
+#include "libavutil/opt.h"
+#include "libavutil/frame.h"
+#include "libavfilter/filters.h"
+#include "libavutil/hwcontext_vpe.h"
+
+typedef struct VpePPFilter {
+const AVClass *av_class;
+AVBufferRef *hw_device;
+AVBufferRef *hw_frame;
+
+VpiCtx ctx;
+VpiApi *vpi;
+
+int nb_outputs;
+int force_10bit;
+char *low_res;
+VpiPPOpition cfg;
+} VpePPFilter;
+
+static const enum AVPixelFormat input_pix_fmts[] = {
+AV_PIX_FMT_NV12,AV_PIX_FMT_P010LE,  AV_PIX_FMT_YUV420P,
+AV_PIX_FMT_YUV422P, AV_PIX_FMT_NV21,AV_PIX_FMT_YUV420P10LE,
+AV_PIX_FMT_YUV420P10BE, AV_PIX_FMT_YUV422P10LE, AV_PIX_FMT_YUV422P10BE,
+AV_PIX_FMT_P010BE,  AV_PIX_FMT_YUV444P, AV_PIX_FMT_RGB24,
+AV_PIX_FMT_BGR24,   AV_PIX_FMT_ARGB,AV_PIX_FMT_RGBA,
+AV_PIX_FMT_ABGR,AV_PIX_FMT_BGRA,AV_PIX_FMT_NONE,
+};
+
+typedef struct PixelMapTable {
+enum AVPixelFormat src;
+VpiPixsFmt des;
+} PixelMapTable;
+
+static PixelMapTable ptable[] = {
+{ AV_PIX_FMT_YUV420P, VPI_FMT_YUV420P },
+{ AV_PIX_FMT_YUV422P, VPI_FMT_YUV422P },
+{ AV_PIX_FMT_NV12, VPI_FMT_NV12 },
+{ AV_PIX_FMT_NV21, VPI_FMT_NV21 },
+{ AV_PIX_FMT_YUV420P10LE, VPI_FMT_YUV420P10LE },
+{ AV_PIX_FMT_YUV420P10BE, VPI_FMT_YUV420P10BE },
+{ AV_PIX_FMT_YUV422P10LE, VPI_FMT_YUV422P10LE },
+{ AV_PIX_FMT_YUV422P10BE, VPI_FMT_YUV422P10BE },
+{ AV_PIX_FMT_P010LE, VPI_FMT_P010LE },
+{ AV_PIX_FMT_P010BE, VPI_FMT_P010BE },
+{ AV_PIX_FMT_YUV444P, VPI_FMT_YUV444P },
+{ AV_PIX_FMT_RGB24, VPI_FMT_RGB24 },
+{ AV_PIX_FMT_BGR24, VPI_FMT_BGR24 },
+{ AV_PIX_FMT_ARGB, VPI_FMT_ARGB },
+{ AV_PIX_FMT_RGBA, VPI_FMT_RGBA },
+{ AV_PIX_FMT_ABGR, VPI_FMT_ABGR },
+{ AV_PIX_FMT_BGRA, VPI_FMT_BGRA },
+};
+
+static const enum AVPixelFormat output_pix_fmts[] = {
+AV_PIX_FMT_VPE,
+AV_PIX_FMT_NONE,
+};
+
+static av_cold int vpe_pp_init(AVFilterContext *avf_ctx)
+{
+VpePPFilter *ctx = avf_ctx->priv;
+int ret  = 0;

[FFmpeg-devel] [PATCH v2 6/8] vcodec/vp9enc: Add vp9 VPE HW encoder

2020-05-31 Thread Zhang, Guiyong
This encoder uses VPI(VPE Interface) API and library for vp9 encoding.

Signed-off-by: Guiyong.zhang 
---
 configure   |   1 +
 libavcodec/Makefile |   1 +
 libavcodec/allcodecs.c  |   1 +
 libavcodec/vpe_vp9enc.c | 536 
 libavcodec/vpe_vp9enc.h |  83 
 5 files changed, 622 insertions(+)
 create mode 100755 libavcodec/vpe_vp9enc.c
 create mode 100755 libavcodec/vpe_vp9enc.h

diff --git a/configure b/configure
index 10d1322..0522f21 100755
--- a/configure
+++ b/configure
@@ -3134,6 +3134,7 @@ vp9_qsv_encoder_deps="libmfx MFX_CODEC_VP9"
 vp9_qsv_encoder_select="qsvenc"
 vp9_v4l2m2m_decoder_deps="v4l2_m2m vp9_v4l2_m2m"
 vp9_vpe_decoder_deps="vpe"
+vp9_vpe_encoder_deps="vpe"
 wmv3_crystalhd_decoder_select="crystalhd"

 # parsers
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index ffdfae4..7cf1d4e 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -766,6 +766,7 @@ OBJS-$(CONFIG_HEVC_VPE_DECODER)+= vpe_hevcdec.o 
vpe_dec_common.o
 OBJS-$(CONFIG_VP9_VPE_DECODER) += vpe_vp9dec.o vpe_dec_common.o
 OBJS-$(CONFIG_H264_VPE_ENCODER)+= vpe_h26xenc.o
 OBJS-$(CONFIG_HEVC_VPE_ENCODER)+= vpe_h26xenc.o
+OBJS-$(CONFIG_VP9_VPE_ENCODER) += vpe_vp9enc.o

 # (AD)PCM decoders/encoders
 OBJS-$(CONFIG_PCM_ALAW_DECODER)   += pcm.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 91f4e61..cebfc56 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -813,6 +813,7 @@ extern AVCodec ff_hevc_vpe_decoder;
 extern AVCodec ff_vp9_vpe_decoder;
 extern AVCodec ff_h264_vpe_encoder;
 extern AVCodec ff_hevc_vpe_encoder;
+extern AVCodec ff_vp9_vpe_encoder;

 // The iterate API is not usable with ossfuzz due to the excessive size of 
binaries created
 #if CONFIG_OSSFUZZ
diff --git a/libavcodec/vpe_vp9enc.c b/libavcodec/vpe_vp9enc.c
new file mode 100755
index 000..087ddc5
--- /dev/null
+++ b/libavcodec/vpe_vp9enc.c
@@ -0,0 +1,536 @@
+/*
+ * Verisilicon VPE VP9 Encoder
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/pixfmt.h"
+#include "vpe_vp9enc.h"
+
+#define OFFSET(x) (offsetof(VpeEncVp9Ctx, x))
+#define FLAGS \
+(AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_EXPORT)
+
+const static AVOption vpe_enc_vp9_options[] = {
+{ "preset",
+  "Set the encoding preset, superfast/fast/medium/slow/superslow",
+  OFFSET(preset),
+  AV_OPT_TYPE_STRING,
+  { .str = "fast" },
+  0,
+  0,
+  FLAGS },
+{ "effort",
+  "Encoder effort level, 0=fastest, 5=best quality",
+  OFFSET(effort),
+  AV_OPT_TYPE_INT,
+  { .i64 = 0 },
+  0,
+  5,
+  FLAGS },
+{ "lag_in_frames",
+  "Number of frames to lag. Up to 25. [0]",
+  OFFSET(lag_in_frames),
+  AV_OPT_TYPE_INT,
+  { .i64 = 0 },
+  0,
+  25,
+  FLAGS },
+{ "passes",
+  "Number of passes (1/2). [1]",
+  OFFSET(passes),
+  AV_OPT_TYPE_INT,
+  { .i64 = 1 },
+  1,
+  2,
+  FLAGS },
+
+/*Detail parameters described in
+  https://github.com/VeriSilicon/VPE/blob/master/doc/enc_params_vp9.md */
+{ "enc_params",
+  "Override the enc configuration",
+  OFFSET(enc_params),
+  AV_OPT_TYPE_STRING,
+  { 0 },
+  0,
+  0,
+  FLAGS },
+{ NULL },
+};
+
+static int vpe_vp9enc_init_hwctx(AVCodecContext *avctx)
+{
+int ret = 0;
+AVHWFramesContext *hwframe_ctx;
+VpeEncVp9Ctx *ctx = avctx->priv_data;
+
+if (avctx->hw_frames_ctx) {
+ctx->hw_frame = av_buffer_ref(avctx->hw_frames_ctx);
+if (!ctx->hw_frame) {
+ret = AVERROR(ENOMEM);
+goto error;
+}
+
+hwframe_ctx= (AVHWFramesContext *)ctx->hw_frame->data;
+ctx->hw_device = av_buffer_ref(hwframe_ctx->device_ref);
+if (!ctx->hw_device) {
+ret = AVERROR(ENOMEM);
+goto error;
+}
+} else {
+if (avctx->hw_device_ctx) {
+ctx->hw_device = av_buffer_ref(avctx->hw_device_ctx);
+if (!ctx->hw_device) {
+ret = AVERROR(ENOMEM);
+goto error;
+}
+} else {
+ret = 

[FFmpeg-devel] [PATCH v2 1/8] avutil/hwcontext: Add VPE implementation

2020-05-31 Thread Zhang, Guiyong
VPE(VeriSilicon Paltform Engine) is VeriSilicon's hardware engine
for multi formats video encoding and decoding.

It is used with the VPE hwaccel codec API and library to initialize
and use a VPE device which is within the hwcontext libavutil framework.

Signed-off-by: Qin.Wang 
---
 configure  |   3 +
 libavutil/Makefile |   3 +
 libavutil/hwcontext.c  |   4 +
 libavutil/hwcontext.h  |   1 +
 libavutil/hwcontext_internal.h |   1 +
 libavutil/hwcontext_vpe.c  | 402 +
 libavutil/hwcontext_vpe.h  |  52 ++
 libavutil/pixdesc.c|   4 +
 libavutil/pixfmt.h |   7 +
 libavutil/version.h|   2 +-
 10 files changed, 478 insertions(+), 1 deletion(-)
 create mode 100644 libavutil/hwcontext_vpe.c
 create mode 100644 libavutil/hwcontext_vpe.h

diff --git a/configure b/configure
index 8569a60..7f0f843 100755
--- a/configure
+++ b/configure
@@ -322,6 +322,7 @@ External library support:
   --enable-vulkan  enable Vulkan code [no]
   --disable-xlib   disable xlib [autodetect]
   --disable-zlib   disable zlib [autodetect]
+  --enable-vpe enable vpe codec [no]
 
   The following libraries provide various hardware acceleration features:
   --disable-amfdisable AMF video encoding code [autodetect]
@@ -1822,6 +1823,7 @@ EXTERNAL_LIBRARY_LIST="
 opengl
 pocketsphinx
 vapoursynth
+vpe
 "
 
 HWACCEL_AUTODETECT_LIBRARY_LIST="
@@ -6476,6 +6478,7 @@ enabled rkmpp && { require_pkg_config rkmpp 
rockchip_mpp  rockchip/r
  die "ERROR: rkmpp requires --enable-libdrm"; }
  }
 enabled vapoursynth   && require_pkg_config vapoursynth 
"vapoursynth-script >= 42" VSScript.h vsscript_init
+enabled vpe   && require_pkg_config libvpi libvpi "vpe/vpi_types.h 
vpe/vpi_api.h" vpi_create
 
 
 if enabled gcrypt; then
diff --git a/libavutil/Makefile b/libavutil/Makefile
index 9b08372..5809b38 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -46,6 +46,7 @@ HEADERS = adler32.h   
  \
   hwcontext_videotoolbox.h  \
   hwcontext_vdpau.h \
   hwcontext_vulkan.h\
+  hwcontext_vpe.h   \
   imgutils.h\
   intfloat.h\
   intreadwrite.h\
@@ -184,6 +185,7 @@ OBJS-$(CONFIG_VAAPI)+= hwcontext_vaapi.o
 OBJS-$(CONFIG_VIDEOTOOLBOX) += hwcontext_videotoolbox.o
 OBJS-$(CONFIG_VDPAU)+= hwcontext_vdpau.o
 OBJS-$(CONFIG_VULKAN)   += hwcontext_vulkan.o
+OBJS-$(CONFIG_VPE)  += hwcontext_vpe.o
 
 OBJS += $(COMPAT_OBJS:%=../compat/%)
 
@@ -201,6 +203,7 @@ SKIPHEADERS-$(CONFIG_VAAPI)+= hwcontext_vaapi.h
 SKIPHEADERS-$(CONFIG_VIDEOTOOLBOX) += hwcontext_videotoolbox.h
 SKIPHEADERS-$(CONFIG_VDPAU)+= hwcontext_vdpau.h
 SKIPHEADERS-$(CONFIG_VULKAN)   += hwcontext_vulkan.h
+SKIPHEADERS-$(CONFIG_VPE)  += hwcontext_vpe.h
 
 TESTPROGS = adler32 \
 aes \
diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c
index d13d0f7..5b12013 100644
--- a/libavutil/hwcontext.c
+++ b/libavutil/hwcontext.c
@@ -62,6 +62,9 @@ static const HWContextType * const hw_table[] = {
 #if CONFIG_VULKAN
 _hwcontext_type_vulkan,
 #endif
+#if CONFIG_VPE
+_hwcontext_type_vpe,
+#endif
 NULL,
 };
 
@@ -77,6 +80,7 @@ static const char *const hw_type_names[] = {
 [AV_HWDEVICE_TYPE_VIDEOTOOLBOX] = "videotoolbox",
 [AV_HWDEVICE_TYPE_MEDIACODEC] = "mediacodec",
 [AV_HWDEVICE_TYPE_VULKAN] = "vulkan",
+[AV_HWDEVICE_TYPE_VPE] = "vpe",
 };
 
 enum AVHWDeviceType av_hwdevice_find_type_by_name(const char *name)
diff --git a/libavutil/hwcontext.h b/libavutil/hwcontext.h
index 04d19d8..62d948e 100644
--- a/libavutil/hwcontext.h
+++ b/libavutil/hwcontext.h
@@ -37,6 +37,7 @@ enum AVHWDeviceType {
 AV_HWDEVICE_TYPE_OPENCL,
 AV_HWDEVICE_TYPE_MEDIACODEC,
 AV_HWDEVICE_TYPE_VULKAN,
+AV_HWDEVICE_TYPE_VPE,
 };
 
 typedef struct AVHWDeviceInternal AVHWDeviceInternal;
diff --git a/libavutil/hwcontext_internal.h b/libavutil/hwcontext_internal.h
index e626649..3190a3a 100644
--- a/libavutil/hwcontext_internal.h
+++ b/libavutil/hwcontext_internal.h
@@ -174,5 +174,6 @@ extern const HWContextType ff_hwcontext_type_vdpau;
 extern const HWContextType ff_hwcontext_type_videotoolbox;
 extern const HWContextType ff_hwcontext_type_mediacodec;
 

[FFmpeg-devel] [PATCH v2 2/8] avcodec/h264dec: Add h264 VPE HW decoder

2020-05-31 Thread Zhang, Guiyong
This decoder uses VPI(VPE Interface) API and library for h264 decoding.

Signed-off-by: Qin.Wang 
---
 configure   |   1 +
 libavcodec/Makefile |   1 +
 libavcodec/allcodecs.c  |   1 +
 libavcodec/vpe_dec_common.c | 476 
 libavcodec/vpe_dec_common.h |  81 
 libavcodec/vpe_h264dec.c|  69 +++
 6 files changed, 629 insertions(+)
 create mode 100644 libavcodec/vpe_dec_common.c
 create mode 100644 libavcodec/vpe_dec_common.h
 create mode 100644 libavcodec/vpe_h264dec.c

diff --git a/configure b/configure
index 7f0f843..196842a 100755
--- a/configure
+++ b/configure
@@ -3064,6 +3064,7 @@ h264_vaapi_encoder_select="cbs_h264 vaapi_encode"
 h264_v4l2m2m_decoder_deps="v4l2_m2m h264_v4l2_m2m"
 h264_v4l2m2m_decoder_select="h264_mp4toannexb_bsf"
 h264_v4l2m2m_encoder_deps="v4l2_m2m h264_v4l2_m2m"
+h264_vpe_decoder_deps="vpe"
 hevc_amf_encoder_deps="amf"
 hevc_cuvid_decoder_deps="cuvid"
 hevc_cuvid_decoder_select="hevc_mp4toannexb_bsf"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 0a3bbc7..0c80880 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -761,6 +761,7 @@ OBJS-$(CONFIG_ZLIB_DECODER)+= lcldec.o
 OBJS-$(CONFIG_ZLIB_ENCODER)+= lclenc.o
 OBJS-$(CONFIG_ZMBV_DECODER)+= zmbv.o
 OBJS-$(CONFIG_ZMBV_ENCODER)+= zmbvenc.o
+OBJS-$(CONFIG_H264_VPE_DECODER)+= vpe_h264dec.o vpe_dec_common.o

 # (AD)PCM decoders/encoders
 OBJS-$(CONFIG_PCM_ALAW_DECODER)   += pcm.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 5240d0a..32f6fd6 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -808,6 +808,7 @@ extern AVCodec ff_vp9_mediacodec_decoder;
 extern AVCodec ff_vp9_qsv_decoder;
 extern AVCodec ff_vp9_vaapi_encoder;
 extern AVCodec ff_vp9_qsv_encoder;
+extern AVCodec ff_h264_vpe_decoder;

 // The iterate API is not usable with ossfuzz due to the excessive size of 
binaries created
 #if CONFIG_OSSFUZZ
diff --git a/libavcodec/vpe_dec_common.c b/libavcodec/vpe_dec_common.c
new file mode 100644
index 000..c4d9947
--- /dev/null
+++ b/libavcodec/vpe_dec_common.c
@@ -0,0 +1,476 @@
+/*
+ * Verisilicon VPE Video Decoder Common interface
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/pixfmt.h"
+#include "decode.h"
+#include "internal.h"
+
+#include "vpe_dec_common.h"
+
+/**
+ * Initialize hw frame and device
+ *
+ * The avctx->hw_frames_ctx is the reference to the AVHWFramesContext.
+ * If it exists, get its data, otherwise create the hw_frame_ctx
+ * then initialize hw_frame_ctx.
+ */
+static int vpe_dec_init_hwctx(AVCodecContext *avctx)
+{
+int ret = 0;
+AVHWFramesContext *hwframe_ctx;
+
+if (!avctx->hw_frames_ctx) {
+if (avctx->hw_device_ctx) {
+avctx->hw_frames_ctx = av_hwframe_ctx_alloc(avctx->hw_device_ctx);
+if (!avctx->hw_frames_ctx) {
+av_log(avctx, AV_LOG_ERROR, "av_hwframe_ctx_alloc failed\n");
+ret = AVERROR(ENOMEM);
+goto error;
+}
+} else {
+av_log(avctx, AV_LOG_ERROR, "No hw frame/device available\n");
+ret = AVERROR(EINVAL);
+goto error;
+}
+}
+
+hwframe_ctx = (AVHWFramesContext *)avctx->hw_frames_ctx->data;
+hwframe_ctx->format = AV_PIX_FMT_VPE;
+if (avctx->bits_per_raw_sample == 10) {
+hwframe_ctx->sw_format = AV_PIX_FMT_P010LE;
+} else {
+hwframe_ctx->sw_format = AV_PIX_FMT_NV12;
+}
+hwframe_ctx->width  = avctx->width;
+hwframe_ctx->height = avctx->height;
+if ((ret = av_hwframe_ctx_init(avctx->hw_frames_ctx)) < 0) {
+av_log(avctx, AV_LOG_ERROR, "av_hwframe_ctx_init failed\n");
+return ret;
+}
+return 0;
+
+error:
+av_log(avctx, AV_LOG_ERROR, "vpe_dec_init_hwctx failed\n");
+return ret;
+}
+
+/**
+ * Notify the external decoder to release frame buffer
+ */
+static void vpe_decode_picture_consume(VpeDecCtx *dec_ctx, VpiFrame *vpi_frame)
+{
+VpiCtrlCmdParam cmd_param;
+
+// make decoder release DPB
+cmd_param.cmd  = VPI_CMD_DEC_PIC_CONSUME;
+cmd_param.data = (void *)vpi_frame;
+dec_ctx->vpi->control(dec_ctx->ctx, 

[FFmpeg-devel] [PATCH v2 3/8] avcodec/hevcdec: Add hevc VPE HW decoder

2020-05-31 Thread Zhang, Guiyong
This decoder uses VPI(VPE Interface) API and library for hevc decoding.

Signed-off-by: Qin.Wang 
---
 configure|  1 +
 libavcodec/Makefile  |  1 +
 libavcodec/allcodecs.c   |  1 +
 libavcodec/vpe_hevcdec.c | 69 
 4 files changed, 72 insertions(+)
 create mode 100755 libavcodec/vpe_hevcdec.c

diff --git a/configure b/configure
index 196842a..129a4ee 100755
--- a/configure
+++ b/configure
@@ -3081,6 +3081,7 @@ hevc_vaapi_encoder_select="cbs_h265 vaapi_encode"
 hevc_v4l2m2m_decoder_deps="v4l2_m2m hevc_v4l2_m2m"
 hevc_v4l2m2m_decoder_select="hevc_mp4toannexb_bsf"
 hevc_v4l2m2m_encoder_deps="v4l2_m2m hevc_v4l2_m2m"
+hevc_vpe_decoder_deps="vpe"
 mjpeg_cuvid_decoder_deps="cuvid"
 mjpeg_qsv_decoder_select="qsvdec"
 mjpeg_qsv_encoder_deps="libmfx"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 0c80880..3193b32 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -762,6 +762,7 @@ OBJS-$(CONFIG_ZLIB_ENCODER)+= lclenc.o
 OBJS-$(CONFIG_ZMBV_DECODER)+= zmbv.o
 OBJS-$(CONFIG_ZMBV_ENCODER)+= zmbvenc.o
 OBJS-$(CONFIG_H264_VPE_DECODER)+= vpe_h264dec.o vpe_dec_common.o
+OBJS-$(CONFIG_HEVC_VPE_DECODER)+= vpe_hevcdec.o vpe_dec_common.o

 # (AD)PCM decoders/encoders
 OBJS-$(CONFIG_PCM_ALAW_DECODER)   += pcm.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 32f6fd6..ae5a791 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -809,6 +809,7 @@ extern AVCodec ff_vp9_qsv_decoder;
 extern AVCodec ff_vp9_vaapi_encoder;
 extern AVCodec ff_vp9_qsv_encoder;
 extern AVCodec ff_h264_vpe_decoder;
+extern AVCodec ff_hevc_vpe_decoder;

 // The iterate API is not usable with ossfuzz due to the excessive size of 
binaries created
 #if CONFIG_OSSFUZZ
diff --git a/libavcodec/vpe_hevcdec.c b/libavcodec/vpe_hevcdec.c
new file mode 100755
index 000..0c5a9df
--- /dev/null
+++ b/libavcodec/vpe_hevcdec.c
@@ -0,0 +1,69 @@
+/*
+ * Verisilicon VPE HEVC Decoder
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "hwconfig.h"
+#include "internal.h"
+#include "libavutil/pixfmt.h"
+
+#include "vpe_dec_common.h"
+
+static av_cold int vpe_hevc_decode_init(AVCodecContext *avctx)
+{
+return ff_vpe_decode_init(avctx, HEVCDEC_VPE);
+}
+
+static const AVClass vpe_hevc_decode_class = {
+.class_name = "hevcd_vpe",
+.item_name  = av_default_item_name,
+.option = vpe_decode_options,
+.version= LIBAVUTIL_VERSION_INT,
+};
+
+static const AVCodecHWConfigInternal *vpe_hw_configs[] =
+{ &(const AVCodecHWConfigInternal){
+  .public =
+  {
+  .pix_fmt = AV_PIX_FMT_VPE,
+  .methods = AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX |
+ AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX,
+  .device_type = AV_HWDEVICE_TYPE_VPE,
+  },
+  .hwaccel = NULL,
+  },
+  NULL };
+
+AVCodec ff_hevc_vpe_decoder = {
+.name   = "hevc_vpe",
+.long_name  = NULL_IF_CONFIG_SMALL("HEVC (VPE VC8000D)"),
+.type   = AVMEDIA_TYPE_VIDEO,
+.id = AV_CODEC_ID_HEVC,
+.priv_data_size = sizeof(VpeDecCtx),
+.init   = _hevc_decode_init,
+.receive_frame  = _vpe_decode_receive_frame,
+.close  = _vpe_decode_close,
+.priv_class = _hevc_decode_class,
+.capabilities =
+AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE | 
AV_CODEC_CAP_AVOID_PROBING,
+.caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
+.pix_fmts   = (const enum AVPixelFormat[]){ AV_PIX_FMT_VPE, 
AV_PIX_FMT_NONE },
+.hw_configs = vpe_hw_configs,
+.wrapper_name   = "vpe",
+.bsfs   = "hevc_mp4toannexb",
+};
--
1.8.3.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/3] ffbuild: Refine MIPS handling

2020-05-31 Thread Shiyou Yin
>-Original Message-
>From: ffmpeg-devel-boun...@ffmpeg.org [mailto:ffmpeg-devel-boun...@ffmpeg.org] 
>On Behalf Of
>Shiyou Yin
>Sent: Sunday, May 31, 2020 11:33 AM
>To: 'FFmpeg development discussions and patches'
>Cc: yinshi...@loongson.cn
>Subject: Re: [FFmpeg-devel] [PATCH 1/3] ffbuild: Refine MIPS handling
>
>>-Original Message-
>>From: ffmpeg-devel-boun...@ffmpeg.org 
>>[mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
>>Jiaxun Yang
>>Sent: Tuesday, May 26, 2020 5:48 PM
>>To: ffmpeg-devel@ffmpeg.org
>>Cc: yinshi...@loongson.cn; Jiaxun Yang
>>Subject: [FFmpeg-devel] [PATCH 1/3] ffbuild: Refine MIPS handling
>>
>>To enable runtime detection for MIPS, we need to refine ffbuild
>>part to support buildding these feature together.
>>
>>Firstly, we fixed configure, let it probe native ability of toolchain
>>to decide wether a feature can to be enabled, also clearly marked
>>the conflictions between loongson2 & loongson3 and Release 6 & rest.
>>
>>Secondly, we compile MMI and MSA C sources with their own flags to ensure
>>their flags won't pollute the whole program and generate illegal code.
>>
>>Signed-off-by: Jiaxun Yang 
>>---
>> configure| 179 +++
>> ffbuild/common.mak   |  10 ++-
>> libavcodec/mips/Makefile |   3 +-
>> 3 files changed, 117 insertions(+), 75 deletions(-)
>>
>>diff --git a/configure b/configure
>>index f97cad0298..8dc3874642 100755
>>--- a/configure
>>+++ b/configure
>>@@ -1113,6 +1113,26 @@ void foo(void){ __asm__ volatile($code); }
>> EOF
>> }
>>
>>+check_extra_inline_asm_flags(){
>>+log check_extra_inline_asm_flags "$@"
>>+name="$1"
>>+extra=$2
>>+code="$3"
>>+flags=''
>>+shift 3
>>+while [ "$1" != "" ]; do
>>+  append flags $1
>>+  shift
>>+done;
>>+disable $name
>>+cat > $TMPC <>+void foo(void){ __asm__ volatile($code); }
>>+EOF
>>+log_file $TMPC
>>+test_cmd $cc $CPPFLAGS $CFLAGS $flags "$@" $CC_C $(cc_o $TMPO) $TMPC &&
>>+enable $name && append $extra "$flags"
>>+}
>>+
>
>Use function check_inline_asm_flags is suggested.

To avoid adding '-mmsa' to the global CFLAGS, use check_inline_asm. e.g. 
enabled msa && check_inline_asm msa '"addvi.b $w0, $w1, 1"' '-mmsa'
enabled mmi && check_inline_asm mmi '"punpcklhw $f0, $f0, $f0"' "-mloongson-mmi"
enabled loongson3 && check_inline_asm loongson3 '"gsldxc1 $f0, 0($2, $3)"' 
'-mloongson-ext'

>
>> check_inline_asm_flags(){
>> log check_inline_asm_flags "$@"
>> name="$1"
>>@@ -2551,7 +2571,7 @@ mips64r6_deps="mips"
>> mipsfpu_deps="mips"
>> mipsdsp_deps="mips"
>> mipsdspr2_deps="mips"
>>-mmi_deps="mips"
>>+mmi_deps_any="loongson2 loongson3"
>> msa_deps="mipsfpu"
>> msa2_deps="msa"
>>
>>@@ -4999,29 +5019,57 @@ elif enabled bfin; then
>>
>> elif enabled mips; then
>>
>>-cpuflags="-march=$cpu"
>>-
>> if [ "$cpu" != "generic" ]; then
>>-disable mips32r2
>>-disable mips32r5
>>-disable mips64r2
>>-disable mips32r6
>>-disable mips64r6
>>-disable loongson2
>>-disable loongson3
>>+# DSP is disabled by deafult as they can't be detected at runtime
>>+disable mipsdsp
>>+disable mipsdspr2
>>+
>>+cpuflags="-march=$cpu"
>>
>> case $cpu in
>>-24kc|24kf*|24kec|34kc|1004kc|24kef*|34kf*|1004kf*|74kc|74kf)
>>+# General ISA levels
>>+mips1|mips3)
>>+disable msa
>>+;;
>>+mips32r2)
>> enable mips32r2
>>+;;
>>+mips32r5)
>>+enable mips32r5
>>+;;
>>+mips64r2|mips64r5)
>>+enable mips64r2
>>+;;
>>+# Cores from MIPS(MTI)
>>+24kc)
>>+disable mipsfpu
>>+;;
>>+24kf*|24kec|34kc|74Kc|1004kc)
>>+disable mmi
>> disable msa
>> ;;
>>-p5600|i6400|p6600)
>>-disable mipsdsp
>>-disable mipsdspr2
>>+24kef*|34kf*|1004kf*)
>>+disable mmi
>>+disable msa
>>+enable mipsdsp
>>+;;
>>+p5600)
>>+disable mmi
>>+enable mips32r5
>>+check_cflags "-mtune=p5600" && check_cflags "-msched-weight
>-mload-store-pairs
>>-funroll-loops"
>>+;;
>>+i6400)
>>+disable mmi
>>+enable mips64r6
>>+check_cflags "-mtune=i6400 -mabi=64" && check_cflags 
>>"-msched-weight
>>-mload-store-pairs -funroll-loops" && check_ldflags "-mabi=64"
>>+;;
>>+p6600)
>>+disable mmi
>>+enable mips64r6
>>+check_cflags "-mtune=p6600 -mabi=64" && check_cflags 
>>"-msched-weight
>>-mload-store-pairs -funroll-loops" && check_ldflags "-mabi=64"
>> ;;
>>+# Cores from Loongson

[FFmpeg-devel] [PATCH v2 3/3] lavc/qsv: fix make checkheaders warning

2020-05-31 Thread Jun Zhao
From: Jun Zhao 

make checkheaders will get warning as follow:

In file included from libavcodec/qsv_internal.h.c:1:
./libavcodec/qsv_internal.h:24:5: warning: "CONFIG_VAAPI" is not defined, 
evaluates to 0 [-Wundef]
   24 | #if CONFIG_VAAPI
  | ^~~~

include "config.h" to fix the warning

Signed-off-by: Jun Zhao 
---
 libavcodec/qsv_internal.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h
index 6489836..6b2fbbe 100644
--- a/libavcodec/qsv_internal.h
+++ b/libavcodec/qsv_internal.h
@@ -21,6 +21,8 @@
 #ifndef AVCODEC_QSV_INTERNAL_H
 #define AVCODEC_QSV_INTERNAL_H
 
+#include "config.h"
+
 #if CONFIG_VAAPI
 #define AVCODEC_QSV_LINUX_SESSION_HANDLE
 #endif //CONFIG_VAAPI
-- 
2.7.4

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

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

[FFmpeg-devel] [PATCH v2 2/3] hwcontext_vulkan: fix make checkheaders fail

2020-05-31 Thread Jun Zhao
From: Jun Zhao 

make checkheaders will get error as follow:
CC  libavutil/hwcontext_vulkan.h.o
In file included from libavutil/hwcontext_vulkan.h.c:1:
./libavutil/hwcontext_vulkan.h:130:23: error: ‘AV_NUM_DATA_POINTERS’ undeclared 
here (not in a function)
  130 | void *alloc_pnext[AV_NUM_DATA_POINTERS];
  |   ^~~~
./libavutil/hwcontext_vulkan.h:199:43: warning: ‘enum AVPixelFormat’ declared 
inside parameter list will not be visible outside of this definition or 
declaration

Signed-off-by: Jun Zhao 
---
 libavutil/hwcontext_vulkan.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavutil/hwcontext_vulkan.h b/libavutil/hwcontext_vulkan.h
index aba9833..5cbeb8e 100644
--- a/libavutil/hwcontext_vulkan.h
+++ b/libavutil/hwcontext_vulkan.h
@@ -21,6 +21,9 @@
 
 #include 
 
+#include "pixfmt.h"
+#include "frame.h"
+
 /**
  * @file
  * API-specific header for AV_HWDEVICE_TYPE_VULKAN.
-- 
2.7.4

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

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

[FFmpeg-devel] [PATCH v2 1/3] checkasm: sw_rgb: Fix mixed declaration and code

2020-05-31 Thread Jun Zhao
From: Jun Zhao 

Fix mixed declaration and code.

Signed-off-by: Jun Zhao 
---
 tests/checkasm/sw_rgb.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tests/checkasm/sw_rgb.c b/tests/checkasm/sw_rgb.c
index 1e8ea15..e5aad20 100644
--- a/tests/checkasm/sw_rgb.c
+++ b/tests/checkasm/sw_rgb.c
@@ -137,12 +137,13 @@ static void check_interleave_bytes(void)
 int w = i > 0 ? i : (1 + (rnd() % (MAX_STRIDE-2)));
 int h = 1 + (rnd() % (MAX_HEIGHT-2));
 
-memset(dst0, 0, 2 * MAX_STRIDE * MAX_HEIGHT);
-memset(dst1, 0, 2 * MAX_STRIDE * MAX_HEIGHT);
-
 int src0_offset = 0, src0_stride = MAX_STRIDE;
 int src1_offset = 0, src1_stride = MAX_STRIDE;
 int dst_offset  = 0, dst_stride  = 2 * MAX_STRIDE;
+
+memset(dst0, 0, 2 * MAX_STRIDE * MAX_HEIGHT);
+memset(dst1, 0, 2 * MAX_STRIDE * MAX_HEIGHT);
+
 // Try different combinations of negative strides
 if (i & 1) {
 src0_offset = (h-1)*src0_stride;
-- 
2.7.4

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

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

Re: [FFmpeg-devel] [PATCH v2 1/8] avutil/hwcontext: Add VPE implementation

2020-05-31 Thread Carl Eugen Hoyos


> Am 31.05.2020 um 08:24 schrieb Zhang, Guiyong :
> 
> @@ -1822,6 +1823,7 @@ EXTERNAL_LIBRARY_LIST="
> opengl
> pocketsphinx
> vapoursynth
> +vpe

If libvpe is a free library, please point to the repository, if not please move 
this to the non-free section.

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

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

[FFmpeg-devel] [PATCH 2/4] avformat/thp: Check compcount

2020-05-31 Thread Michael Niedermayer
Fixes: out of array access
Fixes: 
22520/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5100297658826752

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

diff --git a/libavformat/thp.c b/libavformat/thp.c
index d3ae86c645..4abff1313a 100644
--- a/libavformat/thp.c
+++ b/libavformat/thp.c
@@ -93,6 +93,9 @@ static int thp_read_header(AVFormatContext *s)
 avio_seek (pb, thp->compoff, SEEK_SET);
 thp->compcount   = avio_rb32(pb);
 
+if (thp->compcount > FF_ARRAY_ELEMS(thp->components))
+return AVERROR_INVALIDDATA;
+
 /* Read the list of component types.  */
 avio_read(pb, thp->components, 16);
 
-- 
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 3/4] avformat/mlvdec: fail reading a packet with 0 streams

2020-05-31 Thread Michael Niedermayer
Fixes: NULL pointer dereference
Fixes: 
22604/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5667739074297856.fuzz

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

diff --git a/libavformat/mlvdec.c b/libavformat/mlvdec.c
index dae13cae53..03aed71024 100644
--- a/libavformat/mlvdec.c
+++ b/libavformat/mlvdec.c
@@ -393,10 +393,14 @@ static int read_packet(AVFormatContext *avctx, AVPacket 
*pkt)
 {
 MlvContext *mlv = avctx->priv_data;
 AVIOContext *pb;
-AVStream *st = avctx->streams[mlv->stream_index];
+AVStream *st;
 int index, ret;
 unsigned int size, space;
 
+if (!avctx->nb_streams)
+return AVERROR_EOF;
+
+st = avctx->streams[mlv->stream_index];
 if (mlv->pts >= st->duration)
 return AVERROR_EOF;
 
-- 
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 4/4] avcodec/adpcm: XA: Check shift similar to filter

2020-05-31 Thread Michael Niedermayer
Fixes: negative shift
Fixes: 
22499/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_XA_fuzzer-5765452130418688

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

diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index dc4a9222af..79c5d625d1 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -559,6 +559,10 @@ static int xa_decode(AVCodecContext *avctx, int16_t *out0, 
int16_t *out1,
 avpriv_request_sample(avctx, "unknown XA-ADPCM filter %d", filter);
 filter=0;
 }
+if (shift < 0) {
+avpriv_request_sample(avctx, "unknown XA-ADPCM shift %d", shift);
+shift = 0;
+}
 f0 = xa_adpcm_table[filter][0];
 f1 = xa_adpcm_table[filter][1];
 
@@ -584,10 +588,14 @@ static int xa_decode(AVCodecContext *avctx, int16_t 
*out0, int16_t *out1,
 
 shift  = 12 - (in[5+i*2] & 15);
 filter = in[5+i*2] >> 4;
-if (filter >= FF_ARRAY_ELEMS(xa_adpcm_table)) {
+if (filter >= FF_ARRAY_ELEMS(xa_adpcm_table) || shift < 0) {
 avpriv_request_sample(avctx, "unknown XA-ADPCM filter %d", filter);
 filter=0;
 }
+if (shift < 0) {
+avpriv_request_sample(avctx, "unknown XA-ADPCM shift %d", shift);
+shift = 0;
+}
 
 f0 = xa_adpcm_table[filter][0];
 f1 = xa_adpcm_table[filter][1];
-- 
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 1/4] avcodec/jpeg2000dec: clear pointer which become stale in get_ppt()

2020-05-31 Thread Michael Niedermayer
Fixes: use after free
Fixes: 
22484/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-5671488765296640

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

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 6424ed..b7766459c4 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -928,6 +928,7 @@ static int get_ppt(Jpeg2000DecoderContext *s, int n)
 tile->packed_headers = new;
 } else
 return AVERROR(ENOMEM);
+memset(>packed_headers_stream, 0, 
sizeof(tile->packed_headers_stream));
 memcpy(tile->packed_headers + tile->packed_headers_size,
s->g.buffer, n - 3);
 tile->packed_headers_size += n - 3;
-- 
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] avutil/buffer: reject NULL as argument for the av_buffer_pool_init2() alloc callback

2020-05-31 Thread Nicolas George
James Almer (12020-05-30):
> This prevents NULL pointer dereference crashes when calling 
> av_buffer_pool_get()
> using the resulting pool.
> 
> Signed-off-by: James Almer 
> ---
>  libavutil/buffer.c | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/libavutil/buffer.c b/libavutil/buffer.c
> index 6d9cb7428e..6fe8f19c39 100644
> --- a/libavutil/buffer.c
> +++ b/libavutil/buffer.c
> @@ -220,7 +220,11 @@ AVBufferPool *av_buffer_pool_init2(int size, void 
> *opaque,
> AVBufferRef* (*alloc)(void *opaque, int 
> size),
> void (*pool_free)(void *opaque))
>  {
> -AVBufferPool *pool = av_mallocz(sizeof(*pool));
> +AVBufferPool *pool;
> +
> +if (!alloc)
> +return NULL;
> +pool = av_mallocz(sizeof(*pool));
>  if (!pool)
>  return NULL;

I do not like this: this function can return NULL for AVERROR(ENOMEM),
but now it also means "idiot programmer thought NULL was a valid
callback".

The error code to "idiot programmer did something stupid and should have
read the doc" should be SIGABORT. Proper error return should be reserved
for cases that cannot be tested statically.

So, in this case:

av_assert0(alloc);

If the code is tested, it is perfectly equivalent anyway, because alloc
will not be NULL.

Regards,

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

Re: [FFmpeg-devel] [PATCH 1/2] avcodec: Add AV_CODEC_FLAG2_FAST_UNSAFE, move unsafe uses of FAST to it

2020-05-31 Thread Derek Buitenhuis
On 28/05/2020 17:26, Lynne wrote:
> That's a bug. We should absolutely not have flags to enable bugs.
> The fast flag should be removed from h264 until that bug is fixed,
> or deprecated altogether.

100% agree. Hard NAK from me for the very little my opinion here
is still worth.

This is basically AV_CODEC_ENABLE_SECURITY_ISSUES.

- 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 3/4] avformat/mlvdec: fail reading a packet with 0 streams

2020-05-31 Thread James Almer
On 5/31/2020 10:50 AM, Michael Niedermayer wrote:
> Fixes: NULL pointer dereference
> Fixes: 
> 22604/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5667739074297856.fuzz
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/mlvdec.c | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/mlvdec.c b/libavformat/mlvdec.c
> index dae13cae53..03aed71024 100644
> --- a/libavformat/mlvdec.c
> +++ b/libavformat/mlvdec.c
> @@ -393,10 +393,14 @@ static int read_packet(AVFormatContext *avctx, AVPacket 
> *pkt)
>  {
>  MlvContext *mlv = avctx->priv_data;
>  AVIOContext *pb;
> -AVStream *st = avctx->streams[mlv->stream_index];
> +AVStream *st;
>  int index, ret;
>  unsigned int size, space;
>  
> +if (!avctx->nb_streams)
> +return AVERROR_EOF;

Shouldn't you abort during read_header() instead if no streams are ever
allocated?

> +
> +st = avctx->streams[mlv->stream_index];
>  if (mlv->pts >= st->duration)
>  return AVERROR_EOF;
>  
> 

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

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

Re: [FFmpeg-devel] [PATCH 3/3] avcodec/packet: change public function and struct size parameter types to size_t

2020-05-31 Thread Andreas Rheinhardt
James Almer:
> Signed-off-by: James Almer 
> ---
>  doc/APIchanges|  4 ++--
>  libavcodec/avpacket.c | 49 +++
>  libavcodec/packet.h   | 45 +++
>  libavutil/frame.h |  4 
>  4 files changed, 100 insertions(+), 2 deletions(-)
> 
> diff --git a/doc/APIchanges b/doc/APIchanges
> index 8d353fdcef..7f15090031 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -16,8 +16,8 @@ libavutil: 2017-10-21
>  API changes, most recent first:
>  
>  2020-06-xx - xx
> -  Change AVBufferRef and relevant AVFrame function and struct size
> -  parameter and fields type to size_t at next major bump.
> +  Change AVBufferRef and relevant AVFrame and AVPacket function and
> +  struct size parameter and fields type to size_t at next major bump.
>  
>  2020-xx-xx - xx - lavc 58.88.100 - avcodec.h codec.h
>Move AVCodec-related public API to new header codec.h.
> diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
> index 033f2d8f26..e43c584576 100644
> --- a/libavcodec/avpacket.c
> +++ b/libavcodec/avpacket.c
> @@ -69,7 +69,11 @@ void av_packet_free(AVPacket **pkt)
>  av_freep(pkt);
>  }
>  
> +#if FF_API_BUFFER_SIZE_T
>  static int packet_alloc(AVBufferRef **buf, int size)
> +#else
> +static int packet_alloc(AVBufferRef **buf, size_t size)
> +#endif
>  {
>  int ret;
>  if (size < 0 || size >= INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE)> @@ 
> -84,7 +88,11 @@ static int packet_alloc(AVBufferRef **buf, int size)
>  return 0;
>  }
>  
> +#if FF_API_BUFFER_SIZE_T
>  int av_new_packet(AVPacket *pkt, int size)
> +#else
> +int av_new_packet(AVPacket *pkt, size_t size)
> +#endif
>  {
>  AVBufferRef *buf = NULL;
>  int ret = packet_alloc(, size);
> @@ -99,7 +107,11 @@ int av_new_packet(AVPacket *pkt, int size)
>  return 0;
>  }
>  
> +#if FF_API_BUFFER_SIZE_T
>  void av_shrink_packet(AVPacket *pkt, int size)
> +#else
> +void av_shrink_packet(AVPacket *pkt, size_t size)
> +#endif
>  {
>  if (pkt->size <= size)
>  return;
> @@ -107,12 +119,21 @@ void av_shrink_packet(AVPacket *pkt, int size)
>  memset(pkt->data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
>  }
>  
> +#if FF_API_BUFFER_SIZE_T
>  int av_grow_packet(AVPacket *pkt, int grow_by)
>  {
>  int new_size;
>  av_assert0((unsigned)pkt->size <= INT_MAX - 
> AV_INPUT_BUFFER_PADDING_SIZE);
>  if ((unsigned)grow_by >
>  INT_MAX - (pkt->size + AV_INPUT_BUFFER_PADDING_SIZE))
> +#else
> +int av_grow_packet(AVPacket *pkt, size_t grow_by)
> +{
> +size_t new_size;
> +av_assert0(pkt->size <= SIZE_MAX - AV_INPUT_BUFFER_PADDING_SIZE);
> +if (grow_by >
> +SIZE_MAX - (pkt->size + AV_INPUT_BUFFER_PADDING_SIZE))
> +#endif
>  return AVERROR(ENOMEM);
>  
>  new_size = pkt->size + grow_by + AV_INPUT_BUFFER_PADDING_SIZE;
> @@ -124,7 +145,11 @@ int av_grow_packet(AVPacket *pkt, int grow_by)
>  pkt->data = pkt->buf->data;
>  } else {
>  data_offset = pkt->data - pkt->buf->data;
> +#if FF_API_BUFFER_SIZE_T
>  if (data_offset > INT_MAX - new_size)
> +#else
> +if (data_offset > SIZE_MAX - new_size)
> +#endif
>  return AVERROR(ENOMEM);
>  }
>  
> @@ -151,7 +176,11 @@ int av_grow_packet(AVPacket *pkt, int grow_by)
>  return 0;
>  }
>  
> +#if FF_API_BUFFER_SIZE_T
>  int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size)
> +#else
> +int av_packet_from_data(AVPacket *pkt, uint8_t *data, size_t size)
> +#endif
>  {
>  if (size >= INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
>  return AVERROR(EINVAL);
> @@ -329,7 +358,11 @@ int av_packet_add_side_data(AVPacket *pkt, enum 
> AVPacketSideDataType type,
>  
>  
>  uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType 
> type,
> +#if FF_API_BUFFER_SIZE_T
>   int size)
> +#else
> + size_t size)
> +#endif
>  {
>  int ret;
>  uint8_t *data;
> @@ -350,7 +383,11 @@ uint8_t *av_packet_new_side_data(AVPacket *pkt, enum 
> AVPacketSideDataType type,
>  }
>  
>  uint8_t *av_packet_get_side_data(const AVPacket *pkt, enum 
> AVPacketSideDataType type,
> +#if FF_API_BUFFER_SIZE_T
>   int *size)
> +#else
> + size_t *size)
> +#endif
>  {
>  int i;
>  
> @@ -490,7 +527,11 @@ int av_packet_split_side_data(AVPacket *pkt){
>  }
>  #endif
>  
> +#if FF_API_BUFFER_SIZE_T
>  uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size)
> +#else
> +uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size)
> +#endif
>  {
>  AVDictionaryEntry *t = NULL;
>  uint8_t *data = NULL;
> @@ -525,7 +566,11 @@ fail:
>  return NULL;
>  }
>  
> +#if FF_API_BUFFER_SIZE_T
>  int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary 
> **dict)
> +#else
> +int av_packet_unpack_dictionary(const 

Re: [FFmpeg-devel] [PATCH 1/4] avcodec/jpeg2000dec: clear pointer which become stale in get_ppt()

2020-05-31 Thread Gautam Ramakrishnan
On Sun, May 31, 2020 at 10:12 PM Michael Niedermayer
 wrote:
>
> On Sun, May 31, 2020 at 09:22:46PM +0530, Gautam Ramakrishnan wrote:
> > On Sun, May 31, 2020 at 7:21 PM Michael Niedermayer
> >  wrote:
> > >
> > > Fixes: use after free
> > > Fixes: 
> > > 22484/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-5671488765296640
> > >
> > > Found-by: continuous fuzzing process 
> > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > > Signed-off-by: Michael Niedermayer 
> > > ---
> > >  libavcodec/jpeg2000dec.c | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
> > > index 6424ed..b7766459c4 100644
> > > --- a/libavcodec/jpeg2000dec.c
> > > +++ b/libavcodec/jpeg2000dec.c
> > > @@ -928,6 +928,7 @@ static int get_ppt(Jpeg2000DecoderContext *s, int n)
> > >  tile->packed_headers = new;
> > >  } else
> > >  return AVERROR(ENOMEM);
> > > +memset(>packed_headers_stream, 0, 
> > > sizeof(tile->packed_headers_stream));
> > >  memcpy(tile->packed_headers + tile->packed_headers_size,
> > > s->g.buffer, n - 3);
> > >  tile->packed_headers_size += n - 3;
> > > --
> > > 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".
> >
> > I do not understand this. Wouldn't the memcpy overwrite the address anyway?
>
> The "GetByteContext  packed_headers_stream" can point to the stream prior
> to av_realloc(), and after realloc its no longer valid
> that needs to be cleared because if not, its possible this will be used and
> crash later.
Yep, got it.
>
> Note, this is not a valid jpeg2000 file, but some trash from the fuzzer.
> Its certainly possible to add a check elsewhere to avoid this.
> the memset was just the obvious solution that came to my mind.
>
> Also on this subject its quite possible that the jpeg2000 code is missing
> more such saftey checks
> Iam mentioning this as you are working on jpeg2000. its always a good
> idea to keep the question "can this be made to do something nasty from 
> crafted input"
> in mind when writing code.
I shall keep this in mind.
>
> thx
>
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> The educated differ from the uneducated as much as the living from the
> dead. -- Aristotle
> ___
> 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".



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

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

Re: [FFmpeg-devel] [PATCH 3/3] avcodec/packet: change public function and struct size parameter types to size_t

2020-05-31 Thread Andreas Rheinhardt
James Almer:
> On 5/31/2020 4:11 PM, Andreas Rheinhardt wrote:
>> James Almer:
>>> On 5/31/2020 2:58 PM, Andreas Rheinhardt wrote:>> (Anyway, when this 
>>> function is switched to size_t,
 the correct error would be AVERROR(ERANGE). It is actually already the
 correct error in case size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE.)
 3. That's unfortunately only a tiny fraction of the work to do before
 this switch can happen:
 a) libavcodec/mjpega_dump_header_bsf.c contains the following line:
  for (i = 0; i < in->size - 1; i++) {
 If in->size == 0, then this will not have the desired effect, because
 the subtraction now wraps around. There are probably more places like
 this (and overflow checks that don't work as expected any more). We
 would need to find them all and port them.
>>>
>>> Empty packets are considered flush packets, right? Guess we should be
>>> rejecting packets where pkt->size == 0 && pkt->data != NULL in
>>> av_bsf_send_packet(), same as we do in avcodec_send_packet(). I'll send
>>> a patch for that later.
>>>
>> The only way one can signal flushing to a bsf is by using av_bsf_flush.
>> Empty packets (data == NULL and no side_data) are considered eof.
> 
> Yes, that's what i meant. The entire codebase uses flush, drain and EOF
> interchangeably in some cases.
> 
>> Packets with data != NULL, size = 0 and no side data are currently
>> considered normal packets (a possible use-case would be to send some
>> timestamps to the bsf, although no bsf currently makes use of this; but
>> who knows what needs a future bsf has).
> 
> data != NULL && size == 0 should IMO not be accepted. If we want to
> signal that we're feeding the bsf something like timestamps only, we'd
> have to find a different way to do it than setting pkt->data to some
> bogus value that's not NULL in order to bypass the IS_EMPTY() check.
> 
Bogus value? You seem to believe that pkt->data just points to somewhere
in memory; in a valid packet it points to a buffer of size pkt->size +
AV_INPUT_BUFFER_PADDING_SIZE (even when pkt->size == 0).
av_packet_make_refcounted creates such packets if the input packet
doesn't have data (and the h264_mp4toannexb bsf currently relies on this).

- 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 3/3] avcodec/packet: change public function and struct size parameter types to size_t

2020-05-31 Thread Andreas Rheinhardt
James Almer:
> On 5/31/2020 4:34 PM, Andreas Rheinhardt wrote:
>> James Almer:
>>> On 5/31/2020 4:11 PM, Andreas Rheinhardt wrote:
 James Almer:
> On 5/31/2020 2:58 PM, Andreas Rheinhardt wrote:>> (Anyway, when this 
> function is switched to size_t,
>> the correct error would be AVERROR(ERANGE). It is actually already the
>> correct error in case size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE.)
>> 3. That's unfortunately only a tiny fraction of the work to do before
>> this switch can happen:
>> a) libavcodec/mjpega_dump_header_bsf.c contains the following line:
>>  for (i = 0; i < in->size - 1; i++) {
>> If in->size == 0, then this will not have the desired effect, because
>> the subtraction now wraps around. There are probably more places like
>> this (and overflow checks that don't work as expected any more). We
>> would need to find them all and port them.
>
> Empty packets are considered flush packets, right? Guess we should be
> rejecting packets where pkt->size == 0 && pkt->data != NULL in
> av_bsf_send_packet(), same as we do in avcodec_send_packet(). I'll send
> a patch for that later.
>
 The only way one can signal flushing to a bsf is by using av_bsf_flush.
 Empty packets (data == NULL and no side_data) are considered eof.
>>>
>>> Yes, that's what i meant. The entire codebase uses flush, drain and EOF
>>> interchangeably in some cases.
>>>
 Packets with data != NULL, size = 0 and no side data are currently
 considered normal packets (a possible use-case would be to send some
 timestamps to the bsf, although no bsf currently makes use of this; but
 who knows what needs a future bsf has).
>>>
>>> data != NULL && size == 0 should IMO not be accepted. If we want to
>>> signal that we're feeding the bsf something like timestamps only, we'd
>>> have to find a different way to do it than setting pkt->data to some
>>> bogus value that's not NULL in order to bypass the IS_EMPTY() check.
>>>
>> Bogus value? You seem to believe that pkt->data just points to somewhere
>> in memory; in a valid packet it points to a buffer of size pkt->size +
>> AV_INPUT_BUFFER_PADDING_SIZE (even when pkt->size == 0).
>> av_packet_make_refcounted creates such packets if the input packet
>> doesn't have data
> 
> By bogus i mean a value that has no meaning for the packet you'd be
> feeding the bsf with seeing it's "empty". It doesn't matter if it points
> to a real buffer of only input padding bytes size, it's still a pointer
> that will not be accessed because the packet size is reported as 0.
> If we want to signal a packet with something like metadata only, then
> IMO it should be done in a different manner.
> 
>> (and the h264_mp4toannexb bsf currently relies on this).
> 
> That bsf expects a packet with size 0? Why? Empty packets with no side
> data were not meant to be propagated.

It relies on pkt->data always pointing to a buffer that has at least
four bytes of padding at the end.

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

2020-05-31 Thread James Almer
On 5/31/2020 1:38 PM, James Almer wrote:
> Signed-off-by: James Almer 
> ---
> Aside from being more correct, it's also needed now that the video_enc_params
> API, which may allocate arrays > INT_MAX, is used as frame side data.
> 
>  doc/APIchanges  |  4 
>  libavutil/buffer.c  | 25 +
>  libavutil/buffer.h  | 31 +++
>  libavutil/buffer_internal.h | 13 +
>  libavutil/version.h |  3 +++
>  5 files changed, 76 insertions(+)

[...]

> +#if FF_API_BUFFER_SIZE_T
>  AVBufferPool *av_buffer_pool_init2(int size, void *opaque,
> AVBufferRef* (*alloc)(void *opaque, int 
> size),
> +#else
> +AVBufferPool *av_buffer_pool_init2(size_t size, void *opaque,
> +   AVBufferRef* (*alloc)(void *opaque, 
> size_t size),
> +#endif
> void (*pool_free)(void *opaque))
>  {
>  AVBufferPool *pool = av_mallocz(sizeof(*pool));
> @@ -236,7 +257,11 @@ AVBufferPool *av_buffer_pool_init2(int size, void 
> *opaque,
>  return pool;
>  }
>  
> +#if FF_API_BUFFER_SIZE_T
>  AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size))
> +#else
> +AVBufferPool *av_buffer_pool_init(size_t size, AVBufferRef* (*alloc)(size_t 
> size))

These two pool alloc functions are the ones that make me think we may
need to let two years pass before making the switch. Library users
implementing their own callbacks will need to adapt them.

I'll for that matter resend the AVPacket patch later, changing only the
side data parts.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 3/3] avcodec/packet: change public function and struct size parameter types to size_t

2020-05-31 Thread James Almer
On 5/31/2020 2:58 PM, Andreas Rheinhardt wrote:
> James Almer:
>> Signed-off-by: James Almer 
>> ---
>>  doc/APIchanges|  4 ++--
>>  libavcodec/avpacket.c | 49 +++
>>  libavcodec/packet.h   | 45 +++
>>  libavutil/frame.h |  4 
>>  4 files changed, 100 insertions(+), 2 deletions(-)
>>
>> diff --git a/doc/APIchanges b/doc/APIchanges
>> index 8d353fdcef..7f15090031 100644
>> --- a/doc/APIchanges
>> +++ b/doc/APIchanges
>> @@ -16,8 +16,8 @@ libavutil: 2017-10-21
>>  API changes, most recent first:
>>  
>>  2020-06-xx - xx
>> -  Change AVBufferRef and relevant AVFrame function and struct size
>> -  parameter and fields type to size_t at next major bump.
>> +  Change AVBufferRef and relevant AVFrame and AVPacket function and
>> +  struct size parameter and fields type to size_t at next major bump.
>>  
>>  2020-xx-xx - xx - lavc 58.88.100 - avcodec.h codec.h
>>Move AVCodec-related public API to new header codec.h.
>> diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
>> index 033f2d8f26..e43c584576 100644
>> --- a/libavcodec/avpacket.c
>> +++ b/libavcodec/avpacket.c
>> @@ -69,7 +69,11 @@ void av_packet_free(AVPacket **pkt)
>>  av_freep(pkt);
>>  }
>>  
>> +#if FF_API_BUFFER_SIZE_T
>>  static int packet_alloc(AVBufferRef **buf, int size)
>> +#else
>> +static int packet_alloc(AVBufferRef **buf, size_t size)
>> +#endif
>>  {
>>  int ret;
>>  if (size < 0 || size >= INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE)> @@ 
>> -84,7 +88,11 @@ static int packet_alloc(AVBufferRef **buf, int size)
>>  return 0;
>>  }
>>  
>> +#if FF_API_BUFFER_SIZE_T
>>  int av_new_packet(AVPacket *pkt, int size)
>> +#else
>> +int av_new_packet(AVPacket *pkt, size_t size)
>> +#endif
>>  {
>>  AVBufferRef *buf = NULL;
>>  int ret = packet_alloc(, size);
>> @@ -99,7 +107,11 @@ int av_new_packet(AVPacket *pkt, int size)
>>  return 0;
>>  }
>>  
>> +#if FF_API_BUFFER_SIZE_T
>>  void av_shrink_packet(AVPacket *pkt, int size)
>> +#else
>> +void av_shrink_packet(AVPacket *pkt, size_t size)
>> +#endif
>>  {
>>  if (pkt->size <= size)
>>  return;
>> @@ -107,12 +119,21 @@ void av_shrink_packet(AVPacket *pkt, int size)
>>  memset(pkt->data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
>>  }
>>  
>> +#if FF_API_BUFFER_SIZE_T
>>  int av_grow_packet(AVPacket *pkt, int grow_by)
>>  {
>>  int new_size;
>>  av_assert0((unsigned)pkt->size <= INT_MAX - 
>> AV_INPUT_BUFFER_PADDING_SIZE);
>>  if ((unsigned)grow_by >
>>  INT_MAX - (pkt->size + AV_INPUT_BUFFER_PADDING_SIZE))
>> +#else
>> +int av_grow_packet(AVPacket *pkt, size_t grow_by)
>> +{
>> +size_t new_size;
>> +av_assert0(pkt->size <= SIZE_MAX - AV_INPUT_BUFFER_PADDING_SIZE);
>> +if (grow_by >
>> +SIZE_MAX - (pkt->size + AV_INPUT_BUFFER_PADDING_SIZE))
>> +#endif
>>  return AVERROR(ENOMEM);
>>  
>>  new_size = pkt->size + grow_by + AV_INPUT_BUFFER_PADDING_SIZE;
>> @@ -124,7 +145,11 @@ int av_grow_packet(AVPacket *pkt, int grow_by)
>>  pkt->data = pkt->buf->data;
>>  } else {
>>  data_offset = pkt->data - pkt->buf->data;
>> +#if FF_API_BUFFER_SIZE_T
>>  if (data_offset > INT_MAX - new_size)
>> +#else
>> +if (data_offset > SIZE_MAX - new_size)
>> +#endif
>>  return AVERROR(ENOMEM);
>>  }
>>  
>> @@ -151,7 +176,11 @@ int av_grow_packet(AVPacket *pkt, int grow_by)
>>  return 0;
>>  }
>>  
>> +#if FF_API_BUFFER_SIZE_T
>>  int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size)
>> +#else
>> +int av_packet_from_data(AVPacket *pkt, uint8_t *data, size_t size)
>> +#endif
>>  {
>>  if (size >= INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
>>  return AVERROR(EINVAL);
>> @@ -329,7 +358,11 @@ int av_packet_add_side_data(AVPacket *pkt, enum 
>> AVPacketSideDataType type,
>>  
>>  
>>  uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType 
>> type,
>> +#if FF_API_BUFFER_SIZE_T
>>   int size)
>> +#else
>> + size_t size)
>> +#endif
>>  {
>>  int ret;
>>  uint8_t *data;
>> @@ -350,7 +383,11 @@ uint8_t *av_packet_new_side_data(AVPacket *pkt, enum 
>> AVPacketSideDataType type,
>>  }
>>  
>>  uint8_t *av_packet_get_side_data(const AVPacket *pkt, enum 
>> AVPacketSideDataType type,
>> +#if FF_API_BUFFER_SIZE_T
>>   int *size)
>> +#else
>> + size_t *size)
>> +#endif
>>  {
>>  int i;
>>  
>> @@ -490,7 +527,11 @@ int av_packet_split_side_data(AVPacket *pkt){
>>  }
>>  #endif
>>  
>> +#if FF_API_BUFFER_SIZE_T
>>  uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size)
>> +#else
>> +uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size)
>> +#endif
>>  {
>>  AVDictionaryEntry *t = NULL;
>>  uint8_t *data = NULL;
>> @@ -525,7 +566,11 @@ fail:
>>  

Re: [FFmpeg-devel] [PATCH 1/4] avcodec/jpeg2000dec: clear pointer which become stale in get_ppt()

2020-05-31 Thread Gautam Ramakrishnan
On Sun, May 31, 2020 at 7:21 PM Michael Niedermayer
 wrote:
>
> Fixes: use after free
> Fixes: 
> 22484/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-5671488765296640
>
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/jpeg2000dec.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
> index 6424ed..b7766459c4 100644
> --- a/libavcodec/jpeg2000dec.c
> +++ b/libavcodec/jpeg2000dec.c
> @@ -928,6 +928,7 @@ static int get_ppt(Jpeg2000DecoderContext *s, int n)
>  tile->packed_headers = new;
>  } else
>  return AVERROR(ENOMEM);
> +memset(>packed_headers_stream, 0, 
> sizeof(tile->packed_headers_stream));
>  memcpy(tile->packed_headers + tile->packed_headers_size,
> s->g.buffer, n - 3);
>  tile->packed_headers_size += n - 3;
> --
> 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".

Looks good to me

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

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

Re: [FFmpeg-devel] [PATCH 3/3] avcodec/packet: change public function and struct size parameter types to size_t

2020-05-31 Thread James Almer
On 5/31/2020 3:35 PM, James Almer wrote:
> On 5/31/2020 2:58 PM, Andreas Rheinhardt wrote:
>> James Almer:
>>> Signed-off-by: James Almer 
>>> ---
>>>  doc/APIchanges|  4 ++--
>>>  libavcodec/avpacket.c | 49 +++
>>>  libavcodec/packet.h   | 45 +++
>>>  libavutil/frame.h |  4 
>>>  4 files changed, 100 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/doc/APIchanges b/doc/APIchanges
>>> index 8d353fdcef..7f15090031 100644
>>> --- a/doc/APIchanges
>>> +++ b/doc/APIchanges
>>> @@ -16,8 +16,8 @@ libavutil: 2017-10-21
>>>  API changes, most recent first:
>>>  
>>>  2020-06-xx - xx
>>> -  Change AVBufferRef and relevant AVFrame function and struct size
>>> -  parameter and fields type to size_t at next major bump.
>>> +  Change AVBufferRef and relevant AVFrame and AVPacket function and
>>> +  struct size parameter and fields type to size_t at next major bump.
>>>  
>>>  2020-xx-xx - xx - lavc 58.88.100 - avcodec.h codec.h
>>>Move AVCodec-related public API to new header codec.h.
>>> diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
>>> index 033f2d8f26..e43c584576 100644
>>> --- a/libavcodec/avpacket.c
>>> +++ b/libavcodec/avpacket.c
>>> @@ -69,7 +69,11 @@ void av_packet_free(AVPacket **pkt)
>>>  av_freep(pkt);
>>>  }
>>>  
>>> +#if FF_API_BUFFER_SIZE_T
>>>  static int packet_alloc(AVBufferRef **buf, int size)
>>> +#else
>>> +static int packet_alloc(AVBufferRef **buf, size_t size)
>>> +#endif
>>>  {
>>>  int ret;
>>>  if (size < 0 || size >= INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE)> @@ 
>>> -84,7 +88,11 @@ static int packet_alloc(AVBufferRef **buf, int size)
>>>  return 0;
>>>  }
>>>  
>>> +#if FF_API_BUFFER_SIZE_T
>>>  int av_new_packet(AVPacket *pkt, int size)
>>> +#else
>>> +int av_new_packet(AVPacket *pkt, size_t size)
>>> +#endif
>>>  {
>>>  AVBufferRef *buf = NULL;
>>>  int ret = packet_alloc(, size);
>>> @@ -99,7 +107,11 @@ int av_new_packet(AVPacket *pkt, int size)
>>>  return 0;
>>>  }
>>>  
>>> +#if FF_API_BUFFER_SIZE_T
>>>  void av_shrink_packet(AVPacket *pkt, int size)
>>> +#else
>>> +void av_shrink_packet(AVPacket *pkt, size_t size)
>>> +#endif
>>>  {
>>>  if (pkt->size <= size)
>>>  return;
>>> @@ -107,12 +119,21 @@ void av_shrink_packet(AVPacket *pkt, int size)
>>>  memset(pkt->data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
>>>  }
>>>  
>>> +#if FF_API_BUFFER_SIZE_T
>>>  int av_grow_packet(AVPacket *pkt, int grow_by)
>>>  {
>>>  int new_size;
>>>  av_assert0((unsigned)pkt->size <= INT_MAX - 
>>> AV_INPUT_BUFFER_PADDING_SIZE);
>>>  if ((unsigned)grow_by >
>>>  INT_MAX - (pkt->size + AV_INPUT_BUFFER_PADDING_SIZE))
>>> +#else
>>> +int av_grow_packet(AVPacket *pkt, size_t grow_by)
>>> +{
>>> +size_t new_size;
>>> +av_assert0(pkt->size <= SIZE_MAX - AV_INPUT_BUFFER_PADDING_SIZE);
>>> +if (grow_by >
>>> +SIZE_MAX - (pkt->size + AV_INPUT_BUFFER_PADDING_SIZE))
>>> +#endif
>>>  return AVERROR(ENOMEM);
>>>  
>>>  new_size = pkt->size + grow_by + AV_INPUT_BUFFER_PADDING_SIZE;
>>> @@ -124,7 +145,11 @@ int av_grow_packet(AVPacket *pkt, int grow_by)
>>>  pkt->data = pkt->buf->data;
>>>  } else {
>>>  data_offset = pkt->data - pkt->buf->data;
>>> +#if FF_API_BUFFER_SIZE_T
>>>  if (data_offset > INT_MAX - new_size)
>>> +#else
>>> +if (data_offset > SIZE_MAX - new_size)
>>> +#endif
>>>  return AVERROR(ENOMEM);
>>>  }
>>>  
>>> @@ -151,7 +176,11 @@ int av_grow_packet(AVPacket *pkt, int grow_by)
>>>  return 0;
>>>  }
>>>  
>>> +#if FF_API_BUFFER_SIZE_T
>>>  int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size)
>>> +#else
>>> +int av_packet_from_data(AVPacket *pkt, uint8_t *data, size_t size)
>>> +#endif
>>>  {
>>>  if (size >= INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
>>>  return AVERROR(EINVAL);
>>> @@ -329,7 +358,11 @@ int av_packet_add_side_data(AVPacket *pkt, enum 
>>> AVPacketSideDataType type,
>>>  
>>>  
>>>  uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType 
>>> type,
>>> +#if FF_API_BUFFER_SIZE_T
>>>   int size)
>>> +#else
>>> + size_t size)
>>> +#endif
>>>  {
>>>  int ret;
>>>  uint8_t *data;
>>> @@ -350,7 +383,11 @@ uint8_t *av_packet_new_side_data(AVPacket *pkt, enum 
>>> AVPacketSideDataType type,
>>>  }
>>>  
>>>  uint8_t *av_packet_get_side_data(const AVPacket *pkt, enum 
>>> AVPacketSideDataType type,
>>> +#if FF_API_BUFFER_SIZE_T
>>>   int *size)
>>> +#else
>>> + size_t *size)
>>> +#endif
>>>  {
>>>  int i;
>>>  
>>> @@ -490,7 +527,11 @@ int av_packet_split_side_data(AVPacket *pkt){
>>>  }
>>>  #endif
>>>  
>>> +#if FF_API_BUFFER_SIZE_T
>>>  uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size)
>>> +#else

Re: [FFmpeg-devel] [PATCH 3/3] avcodec/packet: change public function and struct size parameter types to size_t

2020-05-31 Thread Andreas Rheinhardt
James Almer:
> On 5/31/2020 2:58 PM, Andreas Rheinhardt wrote:>> (Anyway, when this function 
> is switched to size_t,
>> the correct error would be AVERROR(ERANGE). It is actually already the
>> correct error in case size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE.)
>> 3. That's unfortunately only a tiny fraction of the work to do before
>> this switch can happen:
>> a) libavcodec/mjpega_dump_header_bsf.c contains the following line:
>>  for (i = 0; i < in->size - 1; i++) {
>> If in->size == 0, then this will not have the desired effect, because
>> the subtraction now wraps around. There are probably more places like
>> this (and overflow checks that don't work as expected any more). We
>> would need to find them all and port them.
> 
> Empty packets are considered flush packets, right? Guess we should be
> rejecting packets where pkt->size == 0 && pkt->data != NULL in
> av_bsf_send_packet(), same as we do in avcodec_send_packet(). I'll send
> a patch for that later.
> 
The only way one can signal flushing to a bsf is by using av_bsf_flush.
Empty packets (data == NULL and no side_data) are considered eof.
Packets with data != NULL, size = 0 and no side data are currently
considered normal packets (a possible use-case would be to send some
timestamps to the bsf, although no bsf currently makes use of this; but
who knows what needs a future bsf has).

Also even rejecting such empty packets in av_bsf_send_packet wouldn't
completely solve the problem because a user might send a side-data only
packet. So the check would either be switched to i + 1 < in->size (is
this really slower than i < in->size - 1?) or a check has to be added
before the loop. Also notice that the 1 should actually be 3, see
https://ffmpeg.org/pipermail/ffmpeg-devel/2020-May/263632.html.

- 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 3/3] avcodec/packet: change public function and struct size parameter types to size_t

2020-05-31 Thread James Almer
On 5/31/2020 4:11 PM, Andreas Rheinhardt wrote:
> James Almer:
>> On 5/31/2020 2:58 PM, Andreas Rheinhardt wrote:>> (Anyway, when this 
>> function is switched to size_t,
>>> the correct error would be AVERROR(ERANGE). It is actually already the
>>> correct error in case size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE.)
>>> 3. That's unfortunately only a tiny fraction of the work to do before
>>> this switch can happen:
>>> a) libavcodec/mjpega_dump_header_bsf.c contains the following line:
>>>  for (i = 0; i < in->size - 1; i++) {
>>> If in->size == 0, then this will not have the desired effect, because
>>> the subtraction now wraps around. There are probably more places like
>>> this (and overflow checks that don't work as expected any more). We
>>> would need to find them all and port them.
>>
>> Empty packets are considered flush packets, right? Guess we should be
>> rejecting packets where pkt->size == 0 && pkt->data != NULL in
>> av_bsf_send_packet(), same as we do in avcodec_send_packet(). I'll send
>> a patch for that later.
>>
> The only way one can signal flushing to a bsf is by using av_bsf_flush.
> Empty packets (data == NULL and no side_data) are considered eof.

Yes, that's what i meant. The entire codebase uses flush, drain and EOF
interchangeably in some cases.

> Packets with data != NULL, size = 0 and no side data are currently
> considered normal packets (a possible use-case would be to send some
> timestamps to the bsf, although no bsf currently makes use of this; but
> who knows what needs a future bsf has).

data != NULL && size == 0 should IMO not be accepted. If we want to
signal that we're feeding the bsf something like timestamps only, we'd
have to find a different way to do it than setting pkt->data to some
bogus value that's not NULL in order to bypass the IS_EMPTY() check.

> 
> Also even rejecting such empty packets in av_bsf_send_packet wouldn't
> completely solve the problem because a user might send a side-data only
> packet. So the check would either be switched to i + 1 < in->size (is
> this really slower than i < in->size - 1?) or a check has to be added
> before the loop. Also notice that the 1 should actually be 3, see
> https://ffmpeg.org/pipermail/ffmpeg-devel/2020-May/263632.html.
> 
> - 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 mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 3/3] avcodec/packet: change public function and struct size parameter types to size_t

2020-05-31 Thread James Almer
On 5/31/2020 4:34 PM, Andreas Rheinhardt wrote:
> James Almer:
>> On 5/31/2020 4:11 PM, Andreas Rheinhardt wrote:
>>> James Almer:
 On 5/31/2020 2:58 PM, Andreas Rheinhardt wrote:>> (Anyway, when this 
 function is switched to size_t,
> the correct error would be AVERROR(ERANGE). It is actually already the
> correct error in case size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE.)
> 3. That's unfortunately only a tiny fraction of the work to do before
> this switch can happen:
> a) libavcodec/mjpega_dump_header_bsf.c contains the following line:
>  for (i = 0; i < in->size - 1; i++) {
> If in->size == 0, then this will not have the desired effect, because
> the subtraction now wraps around. There are probably more places like
> this (and overflow checks that don't work as expected any more). We
> would need to find them all and port them.

 Empty packets are considered flush packets, right? Guess we should be
 rejecting packets where pkt->size == 0 && pkt->data != NULL in
 av_bsf_send_packet(), same as we do in avcodec_send_packet(). I'll send
 a patch for that later.

>>> The only way one can signal flushing to a bsf is by using av_bsf_flush.
>>> Empty packets (data == NULL and no side_data) are considered eof.
>>
>> Yes, that's what i meant. The entire codebase uses flush, drain and EOF
>> interchangeably in some cases.
>>
>>> Packets with data != NULL, size = 0 and no side data are currently
>>> considered normal packets (a possible use-case would be to send some
>>> timestamps to the bsf, although no bsf currently makes use of this; but
>>> who knows what needs a future bsf has).
>>
>> data != NULL && size == 0 should IMO not be accepted. If we want to
>> signal that we're feeding the bsf something like timestamps only, we'd
>> have to find a different way to do it than setting pkt->data to some
>> bogus value that's not NULL in order to bypass the IS_EMPTY() check.
>>
> Bogus value? You seem to believe that pkt->data just points to somewhere
> in memory; in a valid packet it points to a buffer of size pkt->size +
> AV_INPUT_BUFFER_PADDING_SIZE (even when pkt->size == 0).
> av_packet_make_refcounted creates such packets if the input packet
> doesn't have data

By bogus i mean a value that has no meaning for the packet you'd be
feeding the bsf with seeing it's "empty". It doesn't matter if it points
to a real buffer of only input padding bytes size, it's still a pointer
that will not be accessed because the packet size is reported as 0.
If we want to signal a packet with something like metadata only, then
IMO it should be done in a different manner.

> (and the h264_mp4toannexb bsf currently relies on this).

That bsf expects a packet with size 0? Why? Empty packets with no side
data were not meant to be propagated.
___
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: add afwtdn filter

2020-05-31 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavfilter/Makefile |   1 +
 libavfilter/af_afwtdn.c  | 619 +++
 libavfilter/allfilters.c |   1 +
 3 files changed, 621 insertions(+)
 create mode 100644 libavfilter/af_afwtdn.c

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 5123540653..191826a622 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -50,6 +50,7 @@ OBJS-$(CONFIG_AFFTDN_FILTER) += af_afftdn.o
 OBJS-$(CONFIG_AFFTFILT_FILTER)   += af_afftfilt.o
 OBJS-$(CONFIG_AFIR_FILTER)   += af_afir.o
 OBJS-$(CONFIG_AFORMAT_FILTER)+= af_aformat.o
+OBJS-$(CONFIG_AFWTDN_FILTER) += af_afwtdn.o
 OBJS-$(CONFIG_AGATE_FILTER)  += af_agate.o
 OBJS-$(CONFIG_AIIR_FILTER)   += af_aiir.o
 OBJS-$(CONFIG_AINTEGRAL_FILTER)  += af_aderivative.o
diff --git a/libavfilter/af_afwtdn.c b/libavfilter/af_afwtdn.c
new file mode 100644
index 00..00b93c29af
--- /dev/null
+++ b/libavfilter/af_afwtdn.c
@@ -0,0 +1,619 @@
+/*
+ * Copyright (c) 2020 Paul B Mahol
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+
+#include "libavutil/avassert.h"
+#include "libavutil/audio_fifo.h"
+#include "libavutil/avstring.h"
+#include "libavutil/opt.h"
+#include "avfilter.h"
+#include "audio.h"
+#include "filters.h"
+#include "formats.h"
+
+static const double coif5_lp[30] = {
+-9.517657273819165e-08, -1.6744288576823017e-07,
+2.0637618513646814e-06, 3.7346551751414047e-06,
+-2.1315026809955787e-05, -4.134043227251251e-05,
+0.00014054114970203437, 0.00030225958181306315,
+-0.0006381313430451114, -0.0016628637020130838,
+0.0024333732126576722, 0.006764185448053083,
+-0.009164231162481846, -0.01976177894257264,
+0.03268357426711183, 0.0412892087501817,
+-0.10557420870333893, -0.06203596396290357,
+0.4379916261718371, 0.7742896036529562,
+0.4215662066908515, -0.05204316317624377,
+-0.09192001055969624, 0.02816802897093635,
+0.023408156785839195, -0.010131117519849788,
+-0.004159358781386048, 0.0021782363581090178,
+0.00035858968789573785, -0.00021208083980379827,
+};
+
+static const double coif5_hp[30] = {
+0.00021208083980379827, 0.00035858968789573785,
+-0.0021782363581090178, -0.004159358781386048,
+0.010131117519849788, 0.023408156785839195,
+-0.02816802897093635, -0.09192001055969624,
+0.05204316317624377, 0.4215662066908515,
+-0.7742896036529562, 0.4379916261718371,
+0.06203596396290357, -0.10557420870333893,
+-0.0412892087501817, 0.03268357426711183,
+0.01976177894257264, -0.009164231162481846,
+-0.006764185448053083, 0.0024333732126576722,
+0.0016628637020130838, -0.0006381313430451114,
+-0.00030225958181306315, 0.00014054114970203437,
+4.134043227251251e-05, -2.1315026809955787e-05,
+-3.7346551751414047e-06, 2.0637618513646814e-06,
+1.6744288576823017e-07, -9.517657273819165e-08,
+};
+
+static const double coif5_ilp[30] = {
+-0.00021208083980379827, 0.00035858968789573785,
+0.0021782363581090178, -0.004159358781386048,
+-0.010131117519849788, 0.023408156785839195,
+0.02816802897093635, -0.09192001055969624,
+-0.05204316317624377, 0.4215662066908515,
+0.7742896036529562, 0.4379916261718371,
+-0.06203596396290357, -0.10557420870333893,
+0.0412892087501817, 0.03268357426711183,
+-0.01976177894257264, -0.009164231162481846,
+0.006764185448053083, 0.0024333732126576722,
+-0.0016628637020130838, -0.0006381313430451114,
+0.00030225958181306315, 0.00014054114970203437,
+-4.134043227251251e-05, -2.1315026809955787e-05,
+3.7346551751414047e-06, 2.0637618513646814e-06,
+-1.6744288576823017e-07, -9.517657273819165e-08,
+};
+
+static const double coif5_ihp[30] = {
+-9.517657273819165e-08, 1.6744288576823017e-07,
+2.0637618513646814e-06, -3.7346551751414047e-06,
+-2.1315026809955787e-05, 4.134043227251251e-05,
+0.00014054114970203437, -0.00030225958181306315,
+-0.0006381313430451114, 0.0016628637020130838,
+0.0024333732126576722, -0.006764185448053083,
+-0.009164231162481846, 0.01976177894257264,
+0.03268357426711183, -0.0412892087501817,
+

Re: [FFmpeg-devel] [PATCH] avfilter: add afwtdn filter

2020-05-31 Thread Nicolas George
Paul B Mahol (12020-05-31):
> Signed-off-by: Paul B Mahol 
> ---
>  libavfilter/Makefile |   1 +
>  libavfilter/af_afwtdn.c  | 619 +++
>  libavfilter/allfilters.c |   1 +
>  3 files changed, 621 insertions(+)
>  create mode 100644 libavfilter/af_afwtdn.c

No doc, name completely impossible to understand. Unacceptable.

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

Re: [FFmpeg-devel] [PATCH] avfilter: add afwtdn filter

2020-05-31 Thread Paul B Mahol
On 5/31/20, Nicolas George  wrote:
> Paul B Mahol (12020-05-31):
>> Signed-off-by: Paul B Mahol 
>> ---
>>  libavfilter/Makefile |   1 +
>>  libavfilter/af_afwtdn.c  | 619 +++
>>  libavfilter/allfilters.c |   1 +
>>  3 files changed, 621 insertions(+)
>>  create mode 100644 libavfilter/af_afwtdn.c
>
> No doc, name completely impossible to understand. Unacceptable.
>

Go away!
___
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: add afwtdn filter

2020-05-31 Thread Lou Logan
On Sun, May 31, 2020, at 12:35 PM, Nicolas George wrote:
>
> No doc

Yes, docs are needed, and an example would be nice. One complaint I
hear often is that many filters have no examples.

> name completely impossible to understand. Unacceptable.

Got any suggestions? We have 3 existing "audio-3 letter algorithm name-
denoise" filters so there is sort of a naming convention already.
___
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: add afwtdn filter

2020-05-31 Thread Reino Wijnsma
On 2020-05-31T22:37:20+0200, Paul B Mahol  wrote:
> On 5/31/20, Nicolas George  wrote:
>> Paul B Mahol (12020-05-31):
>>> Signed-off-by: Paul B Mahol 
>>> ---
>>>  libavfilter/Makefile |   1 +
>>>  libavfilter/af_afwtdn.c  | 619 +++
>>>  libavfilter/allfilters.c |   1 +
>>>  3 files changed, 621 insertions(+)
>>>  create mode 100644 libavfilter/af_afwtdn.c
>> No doc, name completely impossible to understand. Unacceptable.
> Go away!

Can you please act as a grown-up for once?!
Nicolas is right. How would anyone be able to understand what your patch does. 
No name, no discription, no documentation. Nothing!
I would immediately reject this patch if this would be my project.

Whatever issue you have with Nicolas, I suggest you two have a serious 
conversation about this, preferably face-to-face if possible, and talk this 
out! I've been around here long enough to see that it's polluting this 
mailinglist.

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

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

Re: [FFmpeg-devel] [PATCH 3/4] avformat/mlvdec: fail reading a packet with 0 streams

2020-05-31 Thread Michael Niedermayer
On Sun, May 31, 2020 at 10:58:16AM -0300, James Almer wrote:
> On 5/31/2020 10:50 AM, Michael Niedermayer wrote:
> > Fixes: NULL pointer dereference
> > Fixes: 
> > 22604/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5667739074297856.fuzz
> > 
> > Found-by: continuous fuzzing process 
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavformat/mlvdec.c | 6 +-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/libavformat/mlvdec.c b/libavformat/mlvdec.c
> > index dae13cae53..03aed71024 100644
> > --- a/libavformat/mlvdec.c
> > +++ b/libavformat/mlvdec.c
> > @@ -393,10 +393,14 @@ static int read_packet(AVFormatContext *avctx, 
> > AVPacket *pkt)
> >  {
> >  MlvContext *mlv = avctx->priv_data;
> >  AVIOContext *pb;
> > -AVStream *st = avctx->streams[mlv->stream_index];
> > +AVStream *st;
> >  int index, ret;
> >  unsigned int size, space;
> >  
> > +if (!avctx->nb_streams)
> > +return AVERROR_EOF;
> 
> Shouldn't you abort during read_header() instead if no streams are ever
> allocated?

read_header() should fail if the haeder is invalid.
is there something which says that "no streams" is invalid ?

As it is the read_header() code contains a if()  which only make
a difference for a "no stream" case. Which gave me the feeling that
it wasnt intended to fail in that case
but i can add the check for no streams in there where theres already
a check for that in read_header ...

thx

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

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


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

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

Re: [FFmpeg-devel] [PATCH 3/4] avformat/mlvdec: fail reading a packet with 0 streams

2020-05-31 Thread James Almer
On 5/31/2020 6:48 PM, Michael Niedermayer wrote:
> On Sun, May 31, 2020 at 10:58:16AM -0300, James Almer wrote:
>> On 5/31/2020 10:50 AM, Michael Niedermayer wrote:
>>> Fixes: NULL pointer dereference
>>> Fixes: 
>>> 22604/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5667739074297856.fuzz
>>>
>>> Found-by: continuous fuzzing process 
>>> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
>>> Signed-off-by: Michael Niedermayer 
>>> ---
>>>  libavformat/mlvdec.c | 6 +-
>>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/libavformat/mlvdec.c b/libavformat/mlvdec.c
>>> index dae13cae53..03aed71024 100644
>>> --- a/libavformat/mlvdec.c
>>> +++ b/libavformat/mlvdec.c
>>> @@ -393,10 +393,14 @@ static int read_packet(AVFormatContext *avctx, 
>>> AVPacket *pkt)
>>>  {
>>>  MlvContext *mlv = avctx->priv_data;
>>>  AVIOContext *pb;
>>> -AVStream *st = avctx->streams[mlv->stream_index];
>>> +AVStream *st;
>>>  int index, ret;
>>>  unsigned int size, space;
>>>  
>>> +if (!avctx->nb_streams)
>>> +return AVERROR_EOF;
>>
>> Shouldn't you abort during read_header() instead if no streams are ever
>> allocated?
> 
> read_header() should fail if the haeder is invalid.
> is there something which says that "no streams" is invalid ?
> 
> As it is the read_header() code contains a if()  which only make
> a difference for a "no stream" case. Which gave me the feeling that
> it wasnt intended to fail in that case

The checks i'm seeing are all considering video only, audio only, or
both, like the very last check in the function where there's no last
resort else that would cover a no streams case.

> but i can add the check for no streams in there where theres already
> a check for that in read_header ...

Unless there's something in a file that could be signaled without
streams (All the metadata strings in scan_file() look like they
definitely apply to some video or audio stream), such a file seems odd
to me, and if the end result will be just signaling EOF as soon as the
first attempt at fetching a packet, then might as well just abort in
read_header() and save the library caller further processing.

Maybe Peter Ross can comment. But in any case, no strong feelings about
it, so apply whatever you think is best.

> 
> thx
> 
> [...]
> 
> 
> ___
> 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/3] avutil/buffer: change public function and struct size parameter types to size_t

2020-05-31 Thread Hendrik Leppkes
On Sun, May 31, 2020 at 10:13 PM James Almer  wrote:
>
> On 5/31/2020 1:38 PM, James Almer wrote:
> > Signed-off-by: James Almer 
> > ---
> > Aside from being more correct, it's also needed now that the 
> > video_enc_params
> > API, which may allocate arrays > INT_MAX, is used as frame side data.
> >
> >  doc/APIchanges  |  4 
> >  libavutil/buffer.c  | 25 +
> >  libavutil/buffer.h  | 31 +++
> >  libavutil/buffer_internal.h | 13 +
> >  libavutil/version.h |  3 +++
> >  5 files changed, 76 insertions(+)
>
> [...]
>
> > +#if FF_API_BUFFER_SIZE_T
> >  AVBufferPool *av_buffer_pool_init2(int size, void *opaque,
> > AVBufferRef* (*alloc)(void *opaque, int 
> > size),
> > +#else
> > +AVBufferPool *av_buffer_pool_init2(size_t size, void *opaque,
> > +   AVBufferRef* (*alloc)(void *opaque, 
> > size_t size),
> > +#endif
> > void (*pool_free)(void *opaque))
> >  {
> >  AVBufferPool *pool = av_mallocz(sizeof(*pool));
> > @@ -236,7 +257,11 @@ AVBufferPool *av_buffer_pool_init2(int size, void 
> > *opaque,
> >  return pool;
> >  }
> >
> > +#if FF_API_BUFFER_SIZE_T
> >  AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int 
> > size))
> > +#else
> > +AVBufferPool *av_buffer_pool_init(size_t size, AVBufferRef* 
> > (*alloc)(size_t size))
>
> These two pool alloc functions are the ones that make me think we may
> need to let two years pass before making the switch. Library users
> implementing their own callbacks will need to adapt them.
>
> I'll for that matter resend the AVPacket patch later, changing only the
> side data parts.

A deprecation period only makes sense if you plan to offer the
alternate API under a new (permanent) name. The point of such a period
is to deprecate the old name and give people time to swap to the new
one.
Announcing a future change without any pro-active migration does not
help, and thus the two year period would do nothing but delay the
change.

- Hendrik
___
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 v6] avcodec/mpeg12enc: support mpeg2 encoder const profile

2020-05-31 Thread Limin Wang
On Sun, May 31, 2020 at 07:19:24PM +0200, Marton Balint wrote:
> 
> 
> On Sat, 30 May 2020, lance.lmw...@gmail.com wrote:
> 
> >From: Limin Wang 
> >
> >Signed-off-by: Limin Wang 
> >---
> >doc/encoders.texi  | 14 ++
> >libavcodec/mpeg12enc.c |  2 ++
> >libavcodec/profiles.h  |  8 
> >3 files changed, 24 insertions(+)
> >
> >diff --git a/doc/encoders.texi b/doc/encoders.texi
> >index 954f0f6..1331b79 100644
> >--- a/doc/encoders.texi
> >+++ b/doc/encoders.texi
> >@@ -2740,6 +2740,20 @@ MPEG-2 video encoder.
> >@subsection Options
> >
> >@table @option
> >+@item profile @var{integer}
> >+Select the mpeg2 profile to encode:
> >+
> >+@table @samp
> >+@item 422
> >+@item main
> >+@item ss
> >+Spatially Scalable
> >+@item snr
> >+SNR Scalable
> >+@item high
> >+@item simple
> >+@end table
> >+
> >@item seq_disp_ext @var{integer}
> >Specifies if the encoder should write a sequence_display_extension to the
> >output.
> >diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
> >index cab7076..9fbbcef 100644
> >--- a/libavcodec/mpeg12enc.c
> >+++ b/libavcodec/mpeg12enc.c
> >@@ -41,6 +41,7 @@
> >#include "mpeg12data.h"
> >#include "mpegutils.h"
> >#include "mpegvideo.h"
> >+#include "profiles.h"
> >
> >static const uint8_t svcd_scan_offset_placeholder[] = {
> >0x10, 0x0E, 0x00, 0x80, 0x81, 0x00, 0x80,
> >@@ -1167,6 +1168,7 @@ static const AVOption mpeg2_options[] = {
> >{ "mac",  NULL, 0, AV_OPT_TYPE_CONST,  {.i64 = 
> > VIDEO_FORMAT_MAC},  0, 0, VE, "video_format" },
> >{ "unspecified",  NULL, 0, AV_OPT_TYPE_CONST,  {.i64 = 
> > VIDEO_FORMAT_UNSPECIFIED},  0, 0, VE, "video_format" },
> >FF_MPV_COMMON_OPTS
> >+FF_MPEG2_PROFILE_OPTS
> >{ NULL },
> >};
> >
> >diff --git a/libavcodec/profiles.h b/libavcodec/profiles.h
> >index e414ea7..d241925 100644
> >--- a/libavcodec/profiles.h
> >+++ b/libavcodec/profiles.h
> >@@ -43,6 +43,14 @@
> >FF_AVCTX_PROFILE_OPTION("mpeg4_main",NULL, VIDEO, 
> > FF_PROFILE_MPEG4_MAIN)\
> >FF_AVCTX_PROFILE_OPTION("mpeg4_asp", NULL, VIDEO, 
> > FF_PROFILE_MPEG4_ADVANCED_SIMPLE)\
> >
> >+#define FF_MPEG2_PROFILE_OPTS \
> >+FF_AVCTX_PROFILE_OPTION("422",   NULL, VIDEO, 
> >FF_PROFILE_MPEG2_422)\
> >+FF_AVCTX_PROFILE_OPTION("high",  NULL, VIDEO, 
> >FF_PROFILE_MPEG2_HIGH)\
> >+FF_AVCTX_PROFILE_OPTION("ss",NULL, VIDEO, 
> >FF_PROFILE_MPEG2_SS)\
> >+FF_AVCTX_PROFILE_OPTION("snr",   NULL, VIDEO, 
> >FF_PROFILE_MPEG2_SNR_SCALABLE)\
> >+FF_AVCTX_PROFILE_OPTION("main",  NULL, VIDEO, 
> >FF_PROFILE_MPEG2_MAIN)\
> >+FF_AVCTX_PROFILE_OPTION("simple",NULL, VIDEO, 
> >FF_PROFILE_MPEG2_SIMPLE)\
> >+
> >extern const AVProfile ff_aac_profiles[];
> >extern const AVProfile ff_dca_profiles[];
> >extern const AVProfile ff_dnxhd_profiles[];
> >--
> 
> LGTM, thanks.

thanks, will apply.

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

-- 
Thanks,
Limin Wang
___
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] fate/vcodec: use the encoder private option for frame skip compare function

2020-05-31 Thread James Almer
On 5/27/2020 11:01 AM, James Almer wrote:
> Stop using the deprecated global option
> 
> Signed-off-by: James Almer 
> ---
>  tests/fate/vcodec.mak | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/fate/vcodec.mak b/tests/fate/vcodec.mak
> index ec2a9c339d..1e9c0d5647 100644
> --- a/tests/fate/vcodec.mak
> +++ b/tests/fate/vcodec.mak
> @@ -323,7 +323,7 @@ fate-vsynth%-mpeg4-nr:   ENCOPTS = -qscale 8 
> -flags +mv4 -mbd rd \
>  
>  fate-vsynth%-mpeg4-nsse: ENCOPTS = -qscale 7 -cmp nsse -subcmp nsse \
> -mbcmp nsse -precmp nsse \
> -   -skipcmp nsse
> +   -skip_cmp nsse
>  
>  fate-vsynth%-mpeg4-qpel: ENCOPTS = -qscale 7 -flags +mv4+qpel -mbd 2 
> \
> -bf 2 -cmp 1 -subcmp 2

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

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

Re: [FFmpeg-devel] [PATCH v2 1/3] checkasm: sw_rgb: Fix mixed declaration and code

2020-05-31 Thread Michael Niedermayer
On Sun, May 31, 2020 at 04:18:32PM +0800, Jun Zhao wrote:
> From: Jun Zhao 
> 
> Fix mixed declaration and code.
> 
> Signed-off-by: Jun Zhao 
> ---
>  tests/checkasm/sw_rgb.c | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)

LGTM

thx


-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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

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

Re: [FFmpeg-devel] [PATCH 1/4] avcodec/jpeg2000dec: clear pointer which become stale in get_ppt()

2020-05-31 Thread Gautam Ramakrishnan
On Sun, May 31, 2020 at 7:21 PM Michael Niedermayer
 wrote:
>
> Fixes: use after free
> Fixes: 
> 22484/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-5671488765296640
>
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/jpeg2000dec.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
> index 6424ed..b7766459c4 100644
> --- a/libavcodec/jpeg2000dec.c
> +++ b/libavcodec/jpeg2000dec.c
> @@ -928,6 +928,7 @@ static int get_ppt(Jpeg2000DecoderContext *s, int n)
>  tile->packed_headers = new;
>  } else
>  return AVERROR(ENOMEM);
> +memset(>packed_headers_stream, 0, 
> sizeof(tile->packed_headers_stream));
>  memcpy(tile->packed_headers + tile->packed_headers_size,
> s->g.buffer, n - 3);
>  tile->packed_headers_size += n - 3;
> --
> 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".

I do not understand this. Wouldn't the memcpy overwrite the address anyway?

-- 
-
Gautam |
___
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/4] avcodec/jpeg2000dec: clear pointer which become stale in get_ppt()

2020-05-31 Thread Michael Niedermayer
On Sun, May 31, 2020 at 09:22:46PM +0530, Gautam Ramakrishnan wrote:
> On Sun, May 31, 2020 at 7:21 PM Michael Niedermayer
>  wrote:
> >
> > Fixes: use after free
> > Fixes: 
> > 22484/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-5671488765296640
> >
> > Found-by: continuous fuzzing process 
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/jpeg2000dec.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
> > index 6424ed..b7766459c4 100644
> > --- a/libavcodec/jpeg2000dec.c
> > +++ b/libavcodec/jpeg2000dec.c
> > @@ -928,6 +928,7 @@ static int get_ppt(Jpeg2000DecoderContext *s, int n)
> >  tile->packed_headers = new;
> >  } else
> >  return AVERROR(ENOMEM);
> > +memset(>packed_headers_stream, 0, 
> > sizeof(tile->packed_headers_stream));
> >  memcpy(tile->packed_headers + tile->packed_headers_size,
> > s->g.buffer, n - 3);
> >  tile->packed_headers_size += n - 3;
> > --
> > 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".
> 
> I do not understand this. Wouldn't the memcpy overwrite the address anyway?

The "GetByteContext  packed_headers_stream" can point to the stream prior
to av_realloc(), and after realloc its no longer valid 
that needs to be cleared because if not, its possible this will be used and
crash later.

Note, this is not a valid jpeg2000 file, but some trash from the fuzzer.
Its certainly possible to add a check elsewhere to avoid this.
the memset was just the obvious solution that came to my mind.

Also on this subject its quite possible that the jpeg2000 code is missing
more such saftey checks 
Iam mentioning this as you are working on jpeg2000. its always a good 
idea to keep the question "can this be made to do something nasty from crafted 
input"
in mind when writing code. 

thx


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

The educated differ from the uneducated as much as the living from the
dead. -- 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 1/2] dnn: add openvino as one of dnn backend

2020-05-31 Thread Pedro Arthur
Hi,


Em seg., 25 de mai. de 2020 às 22:56, Guo, Yejun  escreveu:
>
> OpenVINO is a Deep Learning Deployment Toolkit at
> https://github.com/openvinotoolkit/openvino, it supports CPU, GPU
> and heterogeneous plugins to accelerate deep learning inferencing.
>
> Please refer to 
> https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md
> to build openvino (c library is built at the same time). Please add
> option -DENABLE_MKL_DNN=ON for cmake to enable CPU path. The header
> files and libraries are installed to 
> /usr/local/deployment_tools/inference_engine/
> with default options on my system.
>
> To build FFmpeg with openvion, take my system as an example, run with:
> $ ../ffmpeg/configure --enable-libopenvino 
> --extra-cflags=-I/usr/local/deployment_tools/inference_engine/include/ 
> --extra-ldflags=-L/usr/local/deployment_tools/inference_engine/lib/intel64
> $ make
>
> As dnn module maintainer, I do want to see it is utilized by customers,
> so the dnn module can be improved on the right direction with 
> developers/customers

I agree with you, yet it is not clear to me  what is the right direction.
Currently we have the native and tensorflow backends, does OpenVINO
brings something our current backends lacks?

Reading the docs I see a few points (and questions) that may be pro
openvino. If you can confirm them, I think it would be worth adding
another backend.
* It has a dedicated inference engine and it can optimize a model for
inference, thus speeding it up
* It can convert from various common models formats
* it supports CPU and GPU out of the box, TF also suports GPU but only
cuda capable ones and it needes different installations of the library
(one for cpu and another for gpu)
Does openvino CPU backend runs well on non-intel cpus? I mean it does
not need to be equally good but at least decent.
Does gpu support runs on non-intel gpus? I think it is a really
important point, it seems it is using opencl so if it can run on any
opencl capable gpu  it would be a great upgrade over TF


>
> collaboration, but I seldomly receive feedbacks.
>
> On the other hand, I know that there are video analytics projects
> accepted by customers based on FFmpeg + openvino, see more detail
Being used is a good point but I think there must be some improvements
over our current backends to justify it, otherwise one may ask why not
adding any other dnn library from the huge list of 'yet another dnn
library'.
In short I think it is a good adition if you can confirm the above points.

> at https://github.com/VCDP/FFmpeg-patch, but the code bypasses the
> dnn interface layer and could not be upstreamed directly.
>
> So, I introduce openvino as one of the dnn backend as a preparation
> for later usage.
>
> Signed-off-by: Guo, Yejun 
> ---
>  configure  |   6 +-
>  libavfilter/dnn/Makefile   |   1 +
>  libavfilter/dnn/dnn_backend_openvino.c | 261 
> +
>  libavfilter/dnn/dnn_backend_openvino.h |  38 +
>  libavfilter/dnn/dnn_interface.c|  11 ++
>  libavfilter/dnn_interface.h|   2 +-
>  6 files changed, 317 insertions(+), 2 deletions(-)
>  create mode 100644 libavfilter/dnn/dnn_backend_openvino.c
>  create mode 100644 libavfilter/dnn/dnn_backend_openvino.h
>
> diff --git a/configure b/configure
> index f97cad0..6a50351 100755
> --- a/configure
> +++ b/configure
> @@ -253,6 +253,8 @@ External library support:
>--enable-libopenh264 enable H.264 encoding via OpenH264 [no]
>--enable-libopenjpeg enable JPEG 2000 de/encoding via OpenJPEG [no]
>--enable-libopenmpt  enable decoding tracked files via libopenmpt [no]
> +  --enable-libopenvino enable OpenVINO as a DNN module backend
> +   for DNN based filters like dnn_processing [no]
>--enable-libopus enable Opus de/encoding via libopus [no]
>--enable-libpulseenable Pulseaudio input via libpulse [no]
>--enable-librabbitmq enable RabbitMQ library [no]
> @@ -1790,6 +1792,7 @@ EXTERNAL_LIBRARY_LIST="
>  libopenh264
>  libopenjpeg
>  libopenmpt
> +libopenvino
>  libopus
>  libpulse
>  librabbitmq
> @@ -2620,7 +2623,7 @@ cbs_mpeg2_select="cbs"
>  cbs_vp9_select="cbs"
>  dct_select="rdft"
>  dirac_parse_select="golomb"
> -dnn_suggest="libtensorflow"
> +dnn_suggest="libtensorflow libopenvino"
>  error_resilience_select="me_cmp"
>  faandct_deps="faan"
>  faandct_select="fdctdsp"
> @@ -6346,6 +6349,7 @@ enabled libopenh264   && require_pkg_config 
> libopenh264 openh264 wels/codec_
>  enabled libopenjpeg   && { check_pkg_config libopenjpeg "libopenjp2 >= 
> 2.1.0" openjpeg.h opj_version ||
> { require_pkg_config libopenjpeg "libopenjp2 
> >= 2.1.0" openjpeg.h opj_version -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } 
> }
>  enabled libopenmpt&& require_pkg_config libopenmpt "libopenmpt >= 
> 0.2.6557" libopenmpt/libopenmpt.h 

Re: [FFmpeg-devel] [PATCH 2/2] Set stream_id correctly based on KLV profile selected.

2020-05-31 Thread Marton Balint



On Sun, 31 May 2020, Brad Hards wrote:


I think I fixed these issues in V2
http://ffmpeg.org/pipermail/ffmpeg-devel/2020-May/263332.html
and
http://ffmpeg.org/pipermail/ffmpeg-devel/2020-May/26.html

Is anything more required?


No, I will apply your patches soon.

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] [PATCH v6] avcodec/mpeg12enc: support mpeg2 encoder const profile

2020-05-31 Thread Marton Balint



On Sat, 30 May 2020, lance.lmw...@gmail.com wrote:


From: Limin Wang 

Signed-off-by: Limin Wang 
---
doc/encoders.texi  | 14 ++
libavcodec/mpeg12enc.c |  2 ++
libavcodec/profiles.h  |  8 
3 files changed, 24 insertions(+)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 954f0f6..1331b79 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -2740,6 +2740,20 @@ MPEG-2 video encoder.
@subsection Options

@table @option
+@item profile @var{integer}
+Select the mpeg2 profile to encode:
+
+@table @samp
+@item 422
+@item main
+@item ss
+Spatially Scalable
+@item snr
+SNR Scalable
+@item high
+@item simple
+@end table
+
@item seq_disp_ext @var{integer}
Specifies if the encoder should write a sequence_display_extension to the
output.
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index cab7076..9fbbcef 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -41,6 +41,7 @@
#include "mpeg12data.h"
#include "mpegutils.h"
#include "mpegvideo.h"
+#include "profiles.h"

static const uint8_t svcd_scan_offset_placeholder[] = {
0x10, 0x0E, 0x00, 0x80, 0x81, 0x00, 0x80,
@@ -1167,6 +1168,7 @@ static const AVOption mpeg2_options[] = {
{ "mac",  NULL, 0, AV_OPT_TYPE_CONST,  {.i64 = VIDEO_FORMAT_MAC}, 
 0, 0, VE, "video_format" },
{ "unspecified",  NULL, 0, AV_OPT_TYPE_CONST,  {.i64 = VIDEO_FORMAT_UNSPECIFIED}, 
 0, 0, VE, "video_format" },
FF_MPV_COMMON_OPTS
+FF_MPEG2_PROFILE_OPTS
{ NULL },
};

diff --git a/libavcodec/profiles.h b/libavcodec/profiles.h
index e414ea7..d241925 100644
--- a/libavcodec/profiles.h
+++ b/libavcodec/profiles.h
@@ -43,6 +43,14 @@
FF_AVCTX_PROFILE_OPTION("mpeg4_main",NULL, VIDEO, 
FF_PROFILE_MPEG4_MAIN)\
FF_AVCTX_PROFILE_OPTION("mpeg4_asp", NULL, VIDEO, 
FF_PROFILE_MPEG4_ADVANCED_SIMPLE)\

+#define FF_MPEG2_PROFILE_OPTS \
+FF_AVCTX_PROFILE_OPTION("422",   NULL, VIDEO, 
FF_PROFILE_MPEG2_422)\
+FF_AVCTX_PROFILE_OPTION("high",  NULL, VIDEO, 
FF_PROFILE_MPEG2_HIGH)\
+FF_AVCTX_PROFILE_OPTION("ss",NULL, VIDEO, FF_PROFILE_MPEG2_SS)\
+FF_AVCTX_PROFILE_OPTION("snr",   NULL, VIDEO, 
FF_PROFILE_MPEG2_SNR_SCALABLE)\
+FF_AVCTX_PROFILE_OPTION("main",  NULL, VIDEO, 
FF_PROFILE_MPEG2_MAIN)\
+FF_AVCTX_PROFILE_OPTION("simple",NULL, VIDEO, 
FF_PROFILE_MPEG2_SIMPLE)\
+
extern const AVProfile ff_aac_profiles[];
extern const AVProfile ff_dca_profiles[];
extern const AVProfile ff_dnxhd_profiles[];
--


LGTM, 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] [PATCH] fftools/ffmpeg: update text requesting samples

2020-05-31 Thread Marton Balint



On Fri, 29 May 2020, Andriy Gelman wrote:


On Sun, 10. May 15:01, Andriy Gelman wrote:

From: Andriy Gelman 

Signed-off-by: Andriy Gelman 
---

Same as commit d1e52e396b8aa778bd8d12bf25864beca0937d0a

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

diff --git a/doc/developer.texi b/doc/developer.texi
index 51e7299b1d..b33cab0fc7 100644
--- a/doc/developer.texi
+++ b/doc/developer.texi
@@ -625,7 +625,7 @@ If the patch fixes a bug, did you provide a verbose 
analysis of the bug?
 If the patch fixes a bug, did you provide enough information, including
 a sample, so the bug can be reproduced and the fix can be verified?
 Note please do not attach samples >100k to mails but rather provide a
-URL, you can upload to ftp://upload.ffmpeg.org.
+URL, you can upload to @url{https://streams.videolan.org/upload/}.

 @item
 Did you provide a verbose summary about what the patch does change?
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 7f5a5ca664..072589e358 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -2217,7 +2217,7 @@ double get_rotation(AVStream *st)
 if (fabs(theta - 90*round(theta/90)) > 2)
 av_log(NULL, AV_LOG_WARNING, "Odd rotation angle.\n"
"If you want to help, upload a sample "
-   "of this file to ftp://upload.ffmpeg.org/incoming/ "
+   "of this file to https://streams.videolan.org/upload/ "
"and contact the ffmpeg-devel mailing list. 
(ffmpeg-devel@ffmpeg.org)");

 return theta;
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index f697460a30..c86b413f73 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2370,7 +2370,7 @@ static int decode_video(InputStream *ist, AVPacket *pkt, 
int *got_output, int64_
 av_log(ist->dec_ctx, AV_LOG_WARNING,
"video_delay is larger in decoder than demuxer %d > %d.\n"
"If you want to help, upload a sample "
-   "of this file to ftp://upload.ffmpeg.org/incoming/ "
+   "of this file to https://streams.videolan.org/upload/ "
"and contact the ffmpeg-devel mailing list. 
(ffmpeg-devel@ffmpeg.org)\n",
ist->dec_ctx->has_b_frames,
ist->st->codecpar->video_delay);


ping


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

[FFmpeg-devel] [PATCH 2/3] avutil/frame: change av_frame_new_side_data() size parameter type to size_t

2020-05-31 Thread James Almer
Signed-off-by: James Almer 
---
 doc/APIchanges| 4 ++--
 libavutil/frame.c | 4 
 libavutil/frame.h | 8 
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 9de23744c0..8d353fdcef 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -16,8 +16,8 @@ libavutil: 2017-10-21
 API changes, most recent first:
 
 2020-06-xx - xx
-  Change AVBufferRef related function and struct size parameter and fields
-  type to size_t at next major bump.
+  Change AVBufferRef and relevant AVFrame function and struct size
+  parameter and fields type to size_t at next major bump.
 
 2020-xx-xx - xx - lavc 58.88.100 - avcodec.h codec.h
   Move AVCodec-related public API to new header codec.h.
diff --git a/libavutil/frame.c b/libavutil/frame.c
index 2e952edd29..489e46dd93 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -726,7 +726,11 @@ AVFrameSideData *av_frame_new_side_data_from_buf(AVFrame 
*frame,
 
 AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
 enum AVFrameSideDataType type,
+#if FF_API_BUFFER_SIZE_T
 int size)
+#else
+size_t size)
+#endif
 {
 AVFrameSideData *ret;
 AVBufferRef *buf = av_buffer_alloc(size);
diff --git a/libavutil/frame.h b/libavutil/frame.h
index fc67db0f6c..fa4931edb8 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -206,7 +206,11 @@ enum AVActiveFormatDescription {
 typedef struct AVFrameSideData {
 enum AVFrameSideDataType type;
 uint8_t *data;
+#if FF_API_BUFFER_SIZE_T
 int  size;
+#else
+size_t   size;
+#endif
 AVDictionary *metadata;
 AVBufferRef *buf;
 } AVFrameSideData;
@@ -899,7 +903,11 @@ AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int 
plane);
  */
 AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
 enum AVFrameSideDataType type,
+#if FF_API_BUFFER_SIZE_T
 int size);
+#else
+size_t size);
+#endif
 
 /**
  * Add a new side data to a frame from an existing AVBufferRef
-- 
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] [PATCH 3/3] avcodec/packet: change public function and struct size parameter types to size_t

2020-05-31 Thread James Almer
Signed-off-by: James Almer 
---
 doc/APIchanges|  4 ++--
 libavcodec/avpacket.c | 49 +++
 libavcodec/packet.h   | 45 +++
 libavutil/frame.h |  4 
 4 files changed, 100 insertions(+), 2 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 8d353fdcef..7f15090031 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -16,8 +16,8 @@ libavutil: 2017-10-21
 API changes, most recent first:
 
 2020-06-xx - xx
-  Change AVBufferRef and relevant AVFrame function and struct size
-  parameter and fields type to size_t at next major bump.
+  Change AVBufferRef and relevant AVFrame and AVPacket function and
+  struct size parameter and fields type to size_t at next major bump.
 
 2020-xx-xx - xx - lavc 58.88.100 - avcodec.h codec.h
   Move AVCodec-related public API to new header codec.h.
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index 033f2d8f26..e43c584576 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -69,7 +69,11 @@ void av_packet_free(AVPacket **pkt)
 av_freep(pkt);
 }
 
+#if FF_API_BUFFER_SIZE_T
 static int packet_alloc(AVBufferRef **buf, int size)
+#else
+static int packet_alloc(AVBufferRef **buf, size_t size)
+#endif
 {
 int ret;
 if (size < 0 || size >= INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
@@ -84,7 +88,11 @@ static int packet_alloc(AVBufferRef **buf, int size)
 return 0;
 }
 
+#if FF_API_BUFFER_SIZE_T
 int av_new_packet(AVPacket *pkt, int size)
+#else
+int av_new_packet(AVPacket *pkt, size_t size)
+#endif
 {
 AVBufferRef *buf = NULL;
 int ret = packet_alloc(, size);
@@ -99,7 +107,11 @@ int av_new_packet(AVPacket *pkt, int size)
 return 0;
 }
 
+#if FF_API_BUFFER_SIZE_T
 void av_shrink_packet(AVPacket *pkt, int size)
+#else
+void av_shrink_packet(AVPacket *pkt, size_t size)
+#endif
 {
 if (pkt->size <= size)
 return;
@@ -107,12 +119,21 @@ void av_shrink_packet(AVPacket *pkt, int size)
 memset(pkt->data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
 }
 
+#if FF_API_BUFFER_SIZE_T
 int av_grow_packet(AVPacket *pkt, int grow_by)
 {
 int new_size;
 av_assert0((unsigned)pkt->size <= INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE);
 if ((unsigned)grow_by >
 INT_MAX - (pkt->size + AV_INPUT_BUFFER_PADDING_SIZE))
+#else
+int av_grow_packet(AVPacket *pkt, size_t grow_by)
+{
+size_t new_size;
+av_assert0(pkt->size <= SIZE_MAX - AV_INPUT_BUFFER_PADDING_SIZE);
+if (grow_by >
+SIZE_MAX - (pkt->size + AV_INPUT_BUFFER_PADDING_SIZE))
+#endif
 return AVERROR(ENOMEM);
 
 new_size = pkt->size + grow_by + AV_INPUT_BUFFER_PADDING_SIZE;
@@ -124,7 +145,11 @@ int av_grow_packet(AVPacket *pkt, int grow_by)
 pkt->data = pkt->buf->data;
 } else {
 data_offset = pkt->data - pkt->buf->data;
+#if FF_API_BUFFER_SIZE_T
 if (data_offset > INT_MAX - new_size)
+#else
+if (data_offset > SIZE_MAX - new_size)
+#endif
 return AVERROR(ENOMEM);
 }
 
@@ -151,7 +176,11 @@ int av_grow_packet(AVPacket *pkt, int grow_by)
 return 0;
 }
 
+#if FF_API_BUFFER_SIZE_T
 int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size)
+#else
+int av_packet_from_data(AVPacket *pkt, uint8_t *data, size_t size)
+#endif
 {
 if (size >= INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
 return AVERROR(EINVAL);
@@ -329,7 +358,11 @@ int av_packet_add_side_data(AVPacket *pkt, enum 
AVPacketSideDataType type,
 
 
 uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
+#if FF_API_BUFFER_SIZE_T
  int size)
+#else
+ size_t size)
+#endif
 {
 int ret;
 uint8_t *data;
@@ -350,7 +383,11 @@ uint8_t *av_packet_new_side_data(AVPacket *pkt, enum 
AVPacketSideDataType type,
 }
 
 uint8_t *av_packet_get_side_data(const AVPacket *pkt, enum 
AVPacketSideDataType type,
+#if FF_API_BUFFER_SIZE_T
  int *size)
+#else
+ size_t *size)
+#endif
 {
 int i;
 
@@ -490,7 +527,11 @@ int av_packet_split_side_data(AVPacket *pkt){
 }
 #endif
 
+#if FF_API_BUFFER_SIZE_T
 uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size)
+#else
+uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size)
+#endif
 {
 AVDictionaryEntry *t = NULL;
 uint8_t *data = NULL;
@@ -525,7 +566,11 @@ fail:
 return NULL;
 }
 
+#if FF_API_BUFFER_SIZE_T
 int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary 
**dict)
+#else
+int av_packet_unpack_dictionary(const uint8_t *data, size_t size, AVDictionary 
**dict)
+#endif
 {
 const uint8_t *end;
 int ret;
@@ -552,7 +597,11 @@ int av_packet_unpack_dictionary(const uint8_t *data, int 
size, AVDictionary **di
 }
 
 int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
+#if FF_API_BUFFER_SIZE_T
 

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

2020-05-31 Thread James Almer
Signed-off-by: James Almer 
---
Aside from being more correct, it's also needed now that the video_enc_params
API, which may allocate arrays > INT_MAX, is used as frame side data.

 doc/APIchanges  |  4 
 libavutil/buffer.c  | 25 +
 libavutil/buffer.h  | 31 +++
 libavutil/buffer_internal.h | 13 +
 libavutil/version.h |  3 +++
 5 files changed, 76 insertions(+)

diff --git a/doc/APIchanges b/doc/APIchanges
index fb5534b5f5..9de23744c0 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,10 @@ libavutil: 2017-10-21
 
 API changes, most recent first:
 
+2020-06-xx - xx
+  Change AVBufferRef related function and struct size parameter and fields
+  type to size_t at next major bump.
+
 2020-xx-xx - xx - lavc 58.88.100 - avcodec.h codec.h
   Move AVCodec-related public API to new header codec.h.
 
diff --git a/libavutil/buffer.c b/libavutil/buffer.c
index 6d9cb7428e..0a29430381 100644
--- a/libavutil/buffer.c
+++ b/libavutil/buffer.c
@@ -26,7 +26,11 @@
 #include "mem.h"
 #include "thread.h"
 
+#if FF_API_BUFFER_SIZE_T
 AVBufferRef *av_buffer_create(uint8_t *data, int size,
+#else
+AVBufferRef *av_buffer_create(uint8_t *data, size_t size,
+#endif
   void (*free)(void *opaque, uint8_t *data),
   void *opaque, int flags)
 {
@@ -65,7 +69,11 @@ void av_buffer_default_free(void *opaque, uint8_t *data)
 av_free(data);
 }
 
+#if FF_API_BUFFER_SIZE_T
 AVBufferRef *av_buffer_alloc(int size)
+#else
+AVBufferRef *av_buffer_alloc(size_t size)
+#endif
 {
 AVBufferRef *ret = NULL;
 uint8_t*data = NULL;
@@ -81,7 +89,11 @@ AVBufferRef *av_buffer_alloc(int size)
 return ret;
 }
 
+#if FF_API_BUFFER_SIZE_T
 AVBufferRef *av_buffer_allocz(int size)
+#else
+AVBufferRef *av_buffer_allocz(size_t size)
+#endif
 {
 AVBufferRef *ret = av_buffer_alloc(size);
 if (!ret)
@@ -167,7 +179,11 @@ int av_buffer_make_writable(AVBufferRef **pbuf)
 return 0;
 }
 
+#if FF_API_BUFFER_SIZE_T
 int av_buffer_realloc(AVBufferRef **pbuf, int size)
+#else
+int av_buffer_realloc(AVBufferRef **pbuf, size_t size)
+#endif
 {
 AVBufferRef *buf = *pbuf;
 uint8_t *tmp;
@@ -216,8 +232,13 @@ int av_buffer_realloc(AVBufferRef **pbuf, int size)
 return 0;
 }
 
+#if FF_API_BUFFER_SIZE_T
 AVBufferPool *av_buffer_pool_init2(int size, void *opaque,
AVBufferRef* (*alloc)(void *opaque, int 
size),
+#else
+AVBufferPool *av_buffer_pool_init2(size_t size, void *opaque,
+   AVBufferRef* (*alloc)(void *opaque, size_t 
size),
+#endif
void (*pool_free)(void *opaque))
 {
 AVBufferPool *pool = av_mallocz(sizeof(*pool));
@@ -236,7 +257,11 @@ AVBufferPool *av_buffer_pool_init2(int size, void *opaque,
 return pool;
 }
 
+#if FF_API_BUFFER_SIZE_T
 AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size))
+#else
+AVBufferPool *av_buffer_pool_init(size_t size, AVBufferRef* (*alloc)(size_t 
size))
+#endif
 {
 AVBufferPool *pool = av_mallocz(sizeof(*pool));
 if (!pool)
diff --git a/libavutil/buffer.h b/libavutil/buffer.h
index e0f94314f4..547c376439 100644
--- a/libavutil/buffer.h
+++ b/libavutil/buffer.h
@@ -27,6 +27,8 @@
 
 #include 
 
+#include "version.h"
+
 /**
  * @defgroup lavu_buffer AVBuffer
  * @ingroup lavu_data
@@ -90,7 +92,11 @@ typedef struct AVBufferRef {
 /**
  * Size of data in bytes.
  */
+#if FF_API_BUFFER_SIZE_T
 int  size;
+#else
+size_t   size;
+#endif
 } AVBufferRef;
 
 /**
@@ -98,13 +104,21 @@ typedef struct AVBufferRef {
  *
  * @return an AVBufferRef of given size or NULL when out of memory
  */
+#if FF_API_BUFFER_SIZE_T
 AVBufferRef *av_buffer_alloc(int size);
+#else
+AVBufferRef *av_buffer_alloc(size_t size);
+#endif
 
 /**
  * Same as av_buffer_alloc(), except the returned buffer will be initialized
  * to zero.
  */
+#if FF_API_BUFFER_SIZE_T
 AVBufferRef *av_buffer_allocz(int size);
+#else
+AVBufferRef *av_buffer_alloc(size_t size);
+#endif
 
 /**
  * Always treat the buffer as read-only, even when it has only one
@@ -127,7 +141,11 @@ AVBufferRef *av_buffer_allocz(int size);
  *
  * @return an AVBufferRef referring to data on success, NULL on failure.
  */
+#if FF_API_BUFFER_SIZE_T
 AVBufferRef *av_buffer_create(uint8_t *data, int size,
+#else
+AVBufferRef *av_buffer_create(uint8_t *data, size_t size,
+#endif
   void (*free)(void *opaque, uint8_t *data),
   void *opaque, int flags);
 
@@ -195,7 +213,11 @@ int av_buffer_make_writable(AVBufferRef **buf);
  * reference to it (i.e. the one passed to this function). In all other cases
  * a new buffer is allocated and the data is copied.
  */
+#if FF_API_BUFFER_SIZE_T
 int av_buffer_realloc(AVBufferRef **buf, int size);
+#else
+int av_buffer_realloc(AVBufferRef **buf, 

[FFmpeg-devel] [PATCH] dnn/native: fix typo for definition of DOT_INTERMEDIATE

2020-05-31 Thread Wu, Zhiwen
From: Wu Zhiwen 

---
 libavfilter/dnn/dnn_backend_native.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/dnn/dnn_backend_native.h 
b/libavfilter/dnn/dnn_backend_native.h
index 61f0cb202f..bec63be450 100644
--- a/libavfilter/dnn/dnn_backend_native.h
+++ b/libavfilter/dnn/dnn_backend_native.h
@@ -46,7 +46,7 @@ typedef enum {
 DLT_COUNT
 } DNNLayerType;
 
-typedef enum {DOT_INPUT = 1, DOT_OUTPUT = 2, DOT_INTERMEDIATE = DOT_INPUT | 
DOT_INPUT} DNNOperandType;
+typedef enum {DOT_INPUT = 1, DOT_OUTPUT = 2, DOT_INTERMEDIATE = DOT_INPUT | 
DOT_OUTPUT} DNNOperandType;
 
 typedef struct Layer{
 DNNLayerType type;
-- 
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] avutil/buffer: reject NULL as argument for the av_buffer_pool_init2() alloc callback

2020-05-31 Thread James Almer
On 5/31/2020 7:30 AM, Nicolas George wrote:
> James Almer (12020-05-30):
>> This prevents NULL pointer dereference crashes when calling 
>> av_buffer_pool_get()
>> using the resulting pool.
>>
>> Signed-off-by: James Almer 
>> ---
>>  libavutil/buffer.c | 6 +-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavutil/buffer.c b/libavutil/buffer.c
>> index 6d9cb7428e..6fe8f19c39 100644
>> --- a/libavutil/buffer.c
>> +++ b/libavutil/buffer.c
>> @@ -220,7 +220,11 @@ AVBufferPool *av_buffer_pool_init2(int size, void 
>> *opaque,
>> AVBufferRef* (*alloc)(void *opaque, int 
>> size),
>> void (*pool_free)(void *opaque))
>>  {
>> -AVBufferPool *pool = av_mallocz(sizeof(*pool));
>> +AVBufferPool *pool;
>> +
>> +if (!alloc)
>> +return NULL;
>> +pool = av_mallocz(sizeof(*pool));
>>  if (!pool)
>>  return NULL;
> 
> I do not like this: this function can return NULL for AVERROR(ENOMEM),
> but now it also means "idiot programmer thought NULL was a valid
> callback".
> 
> The error code to "idiot programmer did something stupid and should have
> read the doc" should be SIGABORT. Proper error return should be reserved
> for cases that cannot be tested statically.
> 
> So, in this case:
> 
>   av_assert0(alloc);
> 
> If the code is tested, it is perfectly equivalent anyway, because alloc
> will not be NULL.
> 
> Regards,

I guess replacing one crash with another earlier crash is not too bad
(Although i dislike asserts used to catch invalid arguments), but we
can't chalk it up to "idiot user that didn't read the docs" seeing how
in some functions certain parameters may be NULL and it's undocumented
(see patch 1/2 from this same set).

An alternative is doing the same as av_buffer_pool_init() and falling
back to using the default allocator if none is passed, but that's a
change in behavior (From not working to working, instead of from
crashing to crashing earlier).
___
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 v6] avcodec/mpeg12enc: support mpeg2 encoder const profile

2020-05-31 Thread myp...@gmail.com
On Sat, May 30, 2020 at 9:29 PM  wrote:
>
> From: Limin Wang 
>
> Signed-off-by: Limin Wang 
> ---
>  doc/encoders.texi  | 14 ++
>  libavcodec/mpeg12enc.c |  2 ++
>  libavcodec/profiles.h  |  8 
>  3 files changed, 24 insertions(+)
>
> diff --git a/doc/encoders.texi b/doc/encoders.texi
> index 954f0f6..1331b79 100644
> --- a/doc/encoders.texi
> +++ b/doc/encoders.texi
> @@ -2740,6 +2740,20 @@ MPEG-2 video encoder.
>  @subsection Options
>
>  @table @option
> +@item profile @var{integer}
> +Select the mpeg2 profile to encode:
> +
> +@table @samp
> +@item 422
> +@item main
> +@item ss
> +Spatially Scalable
> +@item snr
> +SNR Scalable
> +@item high
> +@item simple
> +@end table
> +
>  @item seq_disp_ext @var{integer}
>  Specifies if the encoder should write a sequence_display_extension to the
>  output.
> diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
> index cab7076..9fbbcef 100644
> --- a/libavcodec/mpeg12enc.c
> +++ b/libavcodec/mpeg12enc.c
> @@ -41,6 +41,7 @@
>  #include "mpeg12data.h"
>  #include "mpegutils.h"
>  #include "mpegvideo.h"
> +#include "profiles.h"
>
>  static const uint8_t svcd_scan_offset_placeholder[] = {
>  0x10, 0x0E, 0x00, 0x80, 0x81, 0x00, 0x80,
> @@ -1167,6 +1168,7 @@ static const AVOption mpeg2_options[] = {
>  { "mac",  NULL, 0, AV_OPT_TYPE_CONST,  {.i64 = 
> VIDEO_FORMAT_MAC},  0, 0, VE, "video_format" },
>  { "unspecified",  NULL, 0, AV_OPT_TYPE_CONST,  {.i64 = 
> VIDEO_FORMAT_UNSPECIFIED},  0, 0, VE, "video_format" },
>  FF_MPV_COMMON_OPTS
> +FF_MPEG2_PROFILE_OPTS
>  { NULL },
>  };
>
> diff --git a/libavcodec/profiles.h b/libavcodec/profiles.h
> index e414ea7..d241925 100644
> --- a/libavcodec/profiles.h
> +++ b/libavcodec/profiles.h
> @@ -43,6 +43,14 @@
>  FF_AVCTX_PROFILE_OPTION("mpeg4_main",NULL, VIDEO, 
> FF_PROFILE_MPEG4_MAIN)\
>  FF_AVCTX_PROFILE_OPTION("mpeg4_asp", NULL, VIDEO, 
> FF_PROFILE_MPEG4_ADVANCED_SIMPLE)\
>
> +#define FF_MPEG2_PROFILE_OPTS \
> +FF_AVCTX_PROFILE_OPTION("422",   NULL, VIDEO, 
> FF_PROFILE_MPEG2_422)\
> +FF_AVCTX_PROFILE_OPTION("high",  NULL, VIDEO, 
> FF_PROFILE_MPEG2_HIGH)\
> +FF_AVCTX_PROFILE_OPTION("ss",NULL, VIDEO, 
> FF_PROFILE_MPEG2_SS)\
> +FF_AVCTX_PROFILE_OPTION("snr",   NULL, VIDEO, 
> FF_PROFILE_MPEG2_SNR_SCALABLE)\
Same as the off-line discussion, is it mpeg2 encoder support
FF_PROFILE_MPEG2_SS and FF_PROFILE_MPEG2_SNR_SCALABLE profile ?

> +FF_AVCTX_PROFILE_OPTION("main",  NULL, VIDEO, 
> FF_PROFILE_MPEG2_MAIN)\
> +FF_AVCTX_PROFILE_OPTION("simple",NULL, VIDEO, 
> FF_PROFILE_MPEG2_SIMPLE)\
> +
>  extern const AVProfile ff_aac_profiles[];
>  extern const AVProfile ff_dca_profiles[];
>  extern const AVProfile ff_dnxhd_profiles[];
> --
> 1.8.3.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] hwcontext_vulkan: fix make checkheaders fail

2020-05-31 Thread myp...@gmail.com
On Sat, May 30, 2020 at 10:23 PM James Almer  wrote:
>
> On 5/30/2020 11:19 AM, James Almer wrote:
> > On 5/30/2020 10:16 AM, Jun Zhao wrote:
> >> From: Jun Zhao 
> >>
> >> make checkheaders will get error as follow:
> >> CC   libavutil/hwcontext_vulkan.h.o
> >> In file included from libavutil/hwcontext_vulkan.h.c:1:
> >> ./libavutil/hwcontext_vulkan.h:130:23: error: ‘AV_NUM_DATA_POINTERS’ 
> >> undeclared here (not in a function)
> >>   130 | void *alloc_pnext[AV_NUM_DATA_POINTERS];
> >>   |   ^~~~
> >> ./libavutil/hwcontext_vulkan.h:199:43: warning: ‘enum AVPixelFormat’ 
> >> declared inside parameter list will not be visible outside of this 
> >> definition or declaration
>
> Also include pixfmt.h while at it. Don't rely on frame.h including it.
>
> >>
> >> Signed-off-by: Jun Zhao 
> >> ---
> >>  libavutil/hwcontext_vulkan.h | 2 ++
> >>  1 file changed, 2 insertions(+)
> >>
> >> diff --git a/libavutil/hwcontext_vulkan.h b/libavutil/hwcontext_vulkan.h
> >> index aba9833..0f6a51f 100644
> >> --- a/libavutil/hwcontext_vulkan.h
> >> +++ b/libavutil/hwcontext_vulkan.h
> >> @@ -21,6 +21,8 @@
> >>
> >>  #include 
> >>
> >> +#include "libavutil/frame.h"
> >
> > #include "frame.h"
> >
> > This file is already inside libavutil.
> >
> >> +
> >>  /**
> >>   * @file
> >>   * API-specific header for AV_HWDEVICE_TYPE_VULKAN.
> >>
Include "pixfmt.h" and "frame.h" as the commets in patch v2, tks
___
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 v6] avcodec/mpeg12enc: support mpeg2 encoder const profile

2020-05-31 Thread lance . lmwang
On Mon, Jun 01, 2020 at 09:24:13AM +0800, myp...@gmail.com wrote:
> On Sat, May 30, 2020 at 9:29 PM  wrote:
> >
> > From: Limin Wang 
> >
> > Signed-off-by: Limin Wang 
> > ---
> >  doc/encoders.texi  | 14 ++
> >  libavcodec/mpeg12enc.c |  2 ++
> >  libavcodec/profiles.h  |  8 
> >  3 files changed, 24 insertions(+)
> >
> > diff --git a/doc/encoders.texi b/doc/encoders.texi
> > index 954f0f6..1331b79 100644
> > --- a/doc/encoders.texi
> > +++ b/doc/encoders.texi
> > @@ -2740,6 +2740,20 @@ MPEG-2 video encoder.
> >  @subsection Options
> >
> >  @table @option
> > +@item profile @var{integer}
> > +Select the mpeg2 profile to encode:
> > +
> > +@table @samp
> > +@item 422
> > +@item main
> > +@item ss
> > +Spatially Scalable
> > +@item snr
> > +SNR Scalable
> > +@item high
> > +@item simple
> > +@end table
> > +
> >  @item seq_disp_ext @var{integer}
> >  Specifies if the encoder should write a sequence_display_extension to the
> >  output.
> > diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
> > index cab7076..9fbbcef 100644
> > --- a/libavcodec/mpeg12enc.c
> > +++ b/libavcodec/mpeg12enc.c
> > @@ -41,6 +41,7 @@
> >  #include "mpeg12data.h"
> >  #include "mpegutils.h"
> >  #include "mpegvideo.h"
> > +#include "profiles.h"
> >
> >  static const uint8_t svcd_scan_offset_placeholder[] = {
> >  0x10, 0x0E, 0x00, 0x80, 0x81, 0x00, 0x80,
> > @@ -1167,6 +1168,7 @@ static const AVOption mpeg2_options[] = {
> >  { "mac",  NULL, 0, AV_OPT_TYPE_CONST,  {.i64 = 
> > VIDEO_FORMAT_MAC},  0, 0, VE, "video_format" },
> >  { "unspecified",  NULL, 0, AV_OPT_TYPE_CONST,  {.i64 = 
> > VIDEO_FORMAT_UNSPECIFIED},  0, 0, VE, "video_format" },
> >  FF_MPV_COMMON_OPTS
> > +FF_MPEG2_PROFILE_OPTS
> >  { NULL },
> >  };
> >
> > diff --git a/libavcodec/profiles.h b/libavcodec/profiles.h
> > index e414ea7..d241925 100644
> > --- a/libavcodec/profiles.h
> > +++ b/libavcodec/profiles.h
> > @@ -43,6 +43,14 @@
> >  FF_AVCTX_PROFILE_OPTION("mpeg4_main",NULL, VIDEO, 
> > FF_PROFILE_MPEG4_MAIN)\
> >  FF_AVCTX_PROFILE_OPTION("mpeg4_asp", NULL, VIDEO, 
> > FF_PROFILE_MPEG4_ADVANCED_SIMPLE)\
> >
> > +#define FF_MPEG2_PROFILE_OPTS \
> > +FF_AVCTX_PROFILE_OPTION("422",   NULL, VIDEO, 
> > FF_PROFILE_MPEG2_422)\
> > +FF_AVCTX_PROFILE_OPTION("high",  NULL, VIDEO, 
> > FF_PROFILE_MPEG2_HIGH)\
> > +FF_AVCTX_PROFILE_OPTION("ss",NULL, VIDEO, 
> > FF_PROFILE_MPEG2_SS)\
> > +FF_AVCTX_PROFILE_OPTION("snr",   NULL, VIDEO, 
> > FF_PROFILE_MPEG2_SNR_SCALABLE)\
> Same as the off-line discussion, is it mpeg2 encoder support
> FF_PROFILE_MPEG2_SS and FF_PROFILE_MPEG2_SNR_SCALABLE profile ?
I don't think so. As I said in another reply, user can set the ss and snr by 2
and 3 anyway, so I add then with const for consistent.

> 
> > +FF_AVCTX_PROFILE_OPTION("main",  NULL, VIDEO, 
> > FF_PROFILE_MPEG2_MAIN)\
> > +FF_AVCTX_PROFILE_OPTION("simple",NULL, VIDEO, 
> > FF_PROFILE_MPEG2_SIMPLE)\
> > +
> >  extern const AVProfile ff_aac_profiles[];
> >  extern const AVProfile ff_dca_profiles[];
> >  extern const AVProfile ff_dnxhd_profiles[];
> > --
> > 1.8.3.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".

-- 
Thanks,
Limin Wang
___
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] Here has a problem on doc/examples/filtering_audio.c

2020-05-31 Thread myp...@gmail.com
On Sat, May 30, 2020 at 11:21 AM JACKY_ZZ[猫猫爱吃鱼]  wrote:
>
> Hi, everyone,
> I do some tests with doc/examples/filtering_audio.c on audio formats like 
> mp3, m4a(aac), mpc, ogg, ape, flac, tta, wma and so on. The original 
> program(filtering_audio.c) always failed with audio format ape, and I do some 
> modifications on this program, and runs properly after test. I attached my 
> modification as attachment.
>
>
> regards,
> jackyxinli
Can you send a patch? More information, you can refer to:
https://ffmpeg.org/developer.html#Submitting-patches-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/2] dnn: add openvino as one of dnn backend

2020-05-31 Thread Guo, Yejun


> -Original Message-
> From: Pedro Arthur 
> Sent: 2020年6月1日 0:45
> To: FFmpeg development discussions and patches 
> Cc: Guo, Yejun 
> Subject: Re: [FFmpeg-devel] [PATCH 1/2] dnn: add openvino as one of dnn
> backend
> 
> Hi,
> 
> 
> Em seg., 25 de mai. de 2020 às 22:56, Guo, Yejun 
> escreveu:
> >
> > OpenVINO is a Deep Learning Deployment Toolkit at
> > https://github.com/openvinotoolkit/openvino, it supports CPU, GPU and
> > heterogeneous plugins to accelerate deep learning inferencing.
> >
> > Please refer to
> > https://github.com/openvinotoolkit/openvino/blob/master/build-instruct
> > ion.md to build openvino (c library is built at the same time). Please
> > add option -DENABLE_MKL_DNN=ON for cmake to enable CPU path. The
> > header files and libraries are installed to
> > /usr/local/deployment_tools/inference_engine/
> > with default options on my system.
> >
> > To build FFmpeg with openvion, take my system as an example, run with:
> > $ ../ffmpeg/configure --enable-libopenvino
> > --extra-cflags=-I/usr/local/deployment_tools/inference_engine/include/
> > --extra-ldflags=-L/usr/local/deployment_tools/inference_engine/lib/int
> > el64
> > $ make
> >
> > As dnn module maintainer, I do want to see it is utilized by
> > customers, so the dnn module can be improved on the right direction
> > with developers/customers
> 
> I agree with you, yet it is not clear to me  what is the right direction.
> Currently we have the native and tensorflow backends, does OpenVINO brings
> something our current backends lacks?

Yes, We've already in the right direction. What I mean is for the optimization. 
We can
first know which workloads customers care most, and then profile the bottle 
necks.

I'll remove these unclear words (from this paragraph to the end) and add the 
points below in V2.

> 
> Reading the docs I see a few points (and questions) that may be pro openvino. 
> If
> you can confirm them, I think it would be worth adding another backend.
> * It has a dedicated inference engine and it can optimize a model for 
> inference,
> thus speeding it up

yes.

> * It can convert from various common models formats

yes, it can convert models from TensorFlow, Caffe, ONNX, MXNet and Kaldi.
For pyTorth format, it is usually first converted into ONNX then to OpenVINO 
format.

> * it supports CPU and GPU out of the box, TF also suports GPU but only cuda
> capable ones and it needes different installations of the library (one for 
> cpu and
> another for gpu) Does openvino CPU backend runs well on non-intel cpus? I
> mean it does not need to be equally good but at least decent.
> Does gpu support runs on non-intel gpus? I think it is a really important 
> point, it
> seems it is using opencl so if it can run on any opencl capable gpu  it would 
> be a
> great upgrade over TF

Yes, they are supported. Anyway, I'll do some experiments to double confirm. 

> 
> 
> >
> > collaboration, but I seldomly receive feedbacks.
> >
> > On the other hand, I know that there are video analytics projects
> > accepted by customers based on FFmpeg + openvino, see more detail
> Being used is a good point but I think there must be some improvements over
> our current backends to justify it, otherwise one may ask why not adding any
> other dnn library from the huge list of 'yet another dnn library'.

agree, thanks.

> In short I think it is a good adition if you can confirm the above points.
> 
> > at https://github.com/VCDP/FFmpeg-patch, but the code bypasses the dnn
> > interface layer and could not be upstreamed directly.
> >
> > So, I introduce openvino as one of the dnn backend as a preparation
> > for later usage.
> >
___
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".