[FFmpeg-devel] [PATCH V2] dnn/native: add native support for dense

2020-09-22 Thread Mingyu Yin
Signed-off-by: Mingyu Yin 
---
 libavfilter/dnn/Makefile  |   1 +
 libavfilter/dnn/dnn_backend_native.h  |   2 +
 .../dnn/dnn_backend_native_layer_conv2d.h |   1 -
 .../dnn/dnn_backend_native_layer_dense.c  | 151 ++
 .../dnn/dnn_backend_native_layer_dense.h  |  37 +
 libavfilter/dnn/dnn_backend_native_layers.c   |   2 +
 tests/dnn/dnn-layer-dense-test.c  | 131 +++
 tools/python/convert_from_tensorflow.py   | 126 ++-
 8 files changed, 442 insertions(+), 9 deletions(-)
 create mode 100644 libavfilter/dnn/dnn_backend_native_layer_dense.c
 create mode 100644 libavfilter/dnn/dnn_backend_native_layer_dense.h
 create mode 100644 tests/dnn/dnn-layer-dense-test.c

diff --git a/libavfilter/dnn/Makefile b/libavfilter/dnn/Makefile
index e0957073ee..3681801892 100644
--- a/libavfilter/dnn/Makefile
+++ b/libavfilter/dnn/Makefile
@@ -2,6 +2,7 @@ OBJS-$(CONFIG_DNN)   += 
dnn/dnn_interface.o
 OBJS-$(CONFIG_DNN)   += dnn/dnn_backend_native.o
 OBJS-$(CONFIG_DNN)   += dnn/dnn_backend_native_layers.o
 OBJS-$(CONFIG_DNN)   += 
dnn/dnn_backend_native_layer_avgpool.o
+OBJS-$(CONFIG_DNN)   += 
dnn/dnn_backend_native_layer_dense.o
 OBJS-$(CONFIG_DNN)   += 
dnn/dnn_backend_native_layer_pad.o
 OBJS-$(CONFIG_DNN)   += 
dnn/dnn_backend_native_layer_conv2d.o
 OBJS-$(CONFIG_DNN)   += 
dnn/dnn_backend_native_layer_depth2space.o
diff --git a/libavfilter/dnn/dnn_backend_native.h 
b/libavfilter/dnn/dnn_backend_native.h
index b1f8f3d6bf..0c98fd1a0c 100644
--- a/libavfilter/dnn/dnn_backend_native.h
+++ b/libavfilter/dnn/dnn_backend_native.h
@@ -45,11 +45,13 @@ typedef enum {
 DLT_MATH_BINARY = 5,
 DLT_MATH_UNARY = 6,
 DLT_AVG_POOL = 7,
+DLT_DENSE = 8,
 DLT_COUNT
 } DNNLayerType;
 
 typedef enum {DOT_INPUT = 1, DOT_OUTPUT = 2, DOT_INTERMEDIATE = DOT_INPUT | 
DOT_OUTPUT} DNNOperandType;
 typedef enum {VALID, SAME, SAME_CLAMP_TO_EDGE} DNNPaddingParam;
+typedef enum {RELU, TANH, SIGMOID, NONE, LEAKY_RELU} DNNActivationFunc;
 
 typedef struct Layer{
 DNNLayerType type;
diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.h 
b/libavfilter/dnn/dnn_backend_native_layer_conv2d.h
index 72319f2ebe..1295028c46 100644
--- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.h
+++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.h
@@ -23,7 +23,6 @@
 
 #include "dnn_backend_native.h"
 
-typedef enum {RELU, TANH, SIGMOID, NONE, LEAKY_RELU} DNNActivationFunc;
 
 typedef struct ConvolutionalParams{
 int32_t input_num, output_num, kernel_size;
diff --git a/libavfilter/dnn/dnn_backend_native_layer_dense.c 
b/libavfilter/dnn/dnn_backend_native_layer_dense.c
new file mode 100644
index 00..1029137792
--- /dev/null
+++ b/libavfilter/dnn/dnn_backend_native_layer_dense.c
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2020
+ *
+ * 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/avassert.h"
+#include "dnn_backend_native_layer_dense.h"
+
+int dnn_load_layer_dense(Layer *layer, AVIOContext *model_file_context, int 
file_size, int operands_num)
+{
+DenseParams *dense_params;
+int kernel_size;
+int dnn_size = 0;
+dense_params = av_malloc(sizeof(*dense_params));
+if (!dense_params)
+return 0;
+
+dense_params->activation = (int32_t)avio_rl32(model_file_context);
+dense_params->input_num = (int32_t)avio_rl32(model_file_context);
+dense_params->output_num = (int32_t)avio_rl32(model_file_context);
+dense_params->has_bias = (int32_t)avio_rl32(model_file_context);
+dnn_size += 16;
+
+kernel_size = dense_params->input_num * dense_params->output_num;
+dnn_size += kernel_size * 4;
+if (dense_params->has_bias)
+dnn_size += dense_params->output_num * 4;
+
+if (dnn_size > file_size || dense_params->input_num <= 0 ||
+dense_params->output_num <= 0){
+av_freep(&dense_params);
+return 0;
+}
+
+dense_params->kernel = av_malloc(kernel_size * sizeof(float));
+if (!dense_params->kernel) {
+av_freep(&dense_params);
+retu

[FFmpeg-devel] [PATCH] avcodec/mpeg12dec: Limit maximum A53 CC size

2020-09-22 Thread Michael Niedermayer
This is more than 10 times the size of the largest i found. And also alot more
than our encoder could handle (our encoder is limited to max 31)
Without any limit megabyte+ sized blocks can be reallocated millions of times.
Sadly the SCTE-20 spec does not seem to contain any hard limit directly, so 
this limit here
is arbitrary

Fixes: Timeout (25sec -> 152ms)
Fixes: 
25714/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG2VIDEO_fuzzer-571366885248

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

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index ab470187a1..5884c6fd17 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -50,6 +50,8 @@
 #include "version.h"
 #include "xvmc_internal.h"
 
+#define A53_MAX_CC_COUNT 2000
+
 typedef struct Mpeg1Context {
 MpegEncContext mpeg_enc_ctx;
 int mpeg_enc_ctx_allocated; /* true if decoding context allocated */
@@ -2246,7 +2248,7 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx,
 * UINT64_C(3));
 int ret;
 
-if (new_size > INT_MAX)
+if (new_size > 3*A53_MAX_CC_COUNT)
 return AVERROR(EINVAL);
 
 ret = av_buffer_realloc(&s1->a53_buf_ref, new_size);
@@ -2269,7 +2271,7 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx,
 int old_size = s1->a53_buf_ref ? s1->a53_buf_ref->size : 0;
 const uint64_t new_size = (old_size + cc_count
 * UINT64_C(3));
-if (new_size > INT_MAX)
+if (new_size > 3*A53_MAX_CC_COUNT)
 return AVERROR(EINVAL);
 
 ret = av_buffer_realloc(&s1->a53_buf_ref, new_size);
@@ -2339,7 +2341,7 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx,
 int old_size = s1->a53_buf_ref ? s1->a53_buf_ref->size : 0;
 const uint64_t new_size = (old_size + cc_count
 * UINT64_C(6));
-if (new_size > INT_MAX)
+if (new_size > 3*A53_MAX_CC_COUNT)
 return AVERROR(EINVAL);
 
 ret = av_buffer_realloc(&s1->a53_buf_ref, new_size);
-- 
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 v2 3/5] avformat/movenc: implement writing of the btrt box

2020-09-22 Thread Martin Storsjö

On Mon, 21 Sep 2020, Jan Ekström wrote:


This is utilized by various media ingests to figure out the bit
rate of the content you are pushing towards it, so write it by
default for video, audio and subtitle tracks. It is only mentioned
for timed metadata sample descriptions in QTFF, so limit it only to
ISOBMFF (MODE_MP4).

Updates the FATE tests which have their results changed due to the
20 extra bytes being written per track.
---


Maybe mention in the commit message, that the box is only written if 
there's any sensible information to write into it?


Other than that, the updated patchset looks good to me - thanks!

// Martin
___
ffmpeg-devel mailing list
ffmpeg-devel@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] Request for immediate take of action

2020-09-22 Thread Nicolas George
Paul B Mahol (12020-09-20):
> If I not receive reply within 96h I will push revert.

You had no right to push in the first place. You have no right to push
again now.
___
ffmpeg-devel mailing list
ffmpeg-devel@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 3/5] avformat/movenc: implement writing of the btrt box

2020-09-22 Thread Jan Ekström
On Tue, Sep 22, 2020 at 12:42 PM Martin Storsjö  wrote:
>
> On Mon, 21 Sep 2020, Jan Ekström wrote:
>
> > This is utilized by various media ingests to figure out the bit
> > rate of the content you are pushing towards it, so write it by
> > default for video, audio and subtitle tracks. It is only mentioned
> > for timed metadata sample descriptions in QTFF, so limit it only to
> > ISOBMFF (MODE_MP4).
> >
> > Updates the FATE tests which have their results changed due to the
> > 20 extra bytes being written per track.
> > ---
>
> Maybe mention in the commit message, that the box is only written if
> there's any sensible information to write into it?
>
> Other than that, the updated patchset looks good to me - thanks!

Ah yes, forgot to update the commit message in this specific case :)

Thanks for taking a look, I will update the commit message, re-run
FATE (since patchwork seems to have missed various patches in the
series - I'm never sure how I should post updated series with
send-email) and push it in the evening after $dayjob then unless there
are any other comments.

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

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

Re: [FFmpeg-devel] Request for immediate take of action

2020-09-22 Thread Paul B Mahol
On Tue, Sep 22, 2020 at 11:48:45AM +0200, Nicolas George wrote:
> Paul B Mahol (12020-09-20):
> > If I not receive reply within 96h I will push revert.
> 
> You had no right to push in the first place. You have no right to push
> again now.

Show the filtergraph that have issues with my patch.

Otherwise I will revert your commit.
I have right to do it.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] Request for immediate take of action

2020-09-22 Thread Nicolas George
Paul B Mahol (12020-09-22):
> Show the filtergraph that have issues with my patch.
> 
> Otherwise I will revert your commit.
> I have right to do it.

You had no right to push in the first place. You have no right to push
again now.


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] avformat/argo_asf: implement seeking

2020-09-22 Thread Zane van Iperen
On Mon, 21 Sep 2020 11:21:47 +
"Zane van Iperen"  wrote:

> 
> Causes some error as the ADPCM predictors aren't known, but
> the difference is negligible and not audible.
> 

Ping. Will merge tomorrow if no objections.


___
ffmpeg-devel mailing list
ffmpeg-devel@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] Request for immediate take of action

2020-09-22 Thread Paul B Mahol
On Tue, Sep 22, 2020 at 12:46:49PM +0200, Nicolas George wrote:
> Paul B Mahol (12020-09-22):
> > Show the filtergraph that have issues with my patch.
> > 
> > Otherwise I will revert your commit.
> > I have right to do it.
> 
> You had no right to push in the first place. You have no right to push
> again now.

You have not shown the filtergraph that have issues with my patch.
And upon constant request to show it, you just ignore such polite
requests.

I have right to immediatelly revert your revert.
___
ffmpeg-devel mailing list
ffmpeg-devel@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] Request for immediate take of action

2020-09-22 Thread Nicolas George
Paul B Mahol (12020-09-22):
> You have not shown the filtergraph that have issues with my patch.
> And upon constant request to show it, you just ignore such polite
> requests.
> 
> I have right to immediatelly revert your revert.

You had no right to push in the first place.


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] Request for immediate take of action

2020-09-22 Thread Paul B Mahol
On Tue, Sep 22, 2020 at 03:53:43PM +0200, Nicolas George wrote:
> Paul B Mahol (12020-09-22):
> > You have not shown the filtergraph that have issues with my patch.
> > And upon constant request to show it, you just ignore such polite
> > requests.
> > 
> > I have right to immediatelly revert your revert.
> 
> You had no right to push in the first place.

Please provide filtergraph that shows my patch is bad.

If there is no such filtergraph then I will be forced to take further actions.
___
ffmpeg-devel mailing list
ffmpeg-devel@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 3/5] avformat/movenc: implement writing of the btrt box

2020-09-22 Thread Jan Ekström
On Tue, Sep 22, 2020 at 12:58 PM Jan Ekström  wrote:
>
> On Tue, Sep 22, 2020 at 12:42 PM Martin Storsjö  wrote:
> >
> > On Mon, 21 Sep 2020, Jan Ekström wrote:
> >
> > > This is utilized by various media ingests to figure out the bit
> > > rate of the content you are pushing towards it, so write it by
> > > default for video, audio and subtitle tracks. It is only mentioned
> > > for timed metadata sample descriptions in QTFF, so limit it only to
> > > ISOBMFF (MODE_MP4).
> > >
> > > Updates the FATE tests which have their results changed due to the
> > > 20 extra bytes being written per track.
> > > ---
> >
> > Maybe mention in the commit message, that the box is only written if
> > there's any sensible information to write into it?
> >
> > Other than that, the updated patchset looks good to me - thanks!
>
> Ah yes, forgot to update the commit message in this specific case :)
>
> Thanks for taking a look, I will update the commit message, re-run
> FATE (since patchwork seems to have missed various patches in the
> series - I'm never sure how I should post updated series with
> send-email) and push it in the evening after $dayjob then unless there
> are any other comments.
>
> Jan

Reworded, checked that FATE passes and applied the set.

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

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

Re: [FFmpeg-devel] [PATCH 1/2] avcodec: add IPU Video decoder and parser

2020-09-22 Thread Paul B Mahol
On Mon, Sep 14, 2020 at 05:24:26PM +0200, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol 
> ---
>  libavcodec/Makefile |   2 +
>  libavcodec/allcodecs.c  |   1 +
>  libavcodec/codec_desc.c |   7 ++
>  libavcodec/codec_id.h   |   1 +
>  libavcodec/ipu_parser.c |  78 
>  libavcodec/ipudec.c |   0
>  libavcodec/mpeg12dec.c  | 155 
>  libavcodec/parsers.c|   1 +
>  8 files changed, 245 insertions(+)
>  create mode 100644 libavcodec/ipu_parser.c
>  create mode 100644 libavcodec/ipudec.c
> 

Will apply this patch set 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".

[FFmpeg-devel] [PATCH] avcodec/cfhd: check that lowpass_height is >= 3 when used in vertical filter

2020-09-22 Thread Paul B Mahol
Also check for out of buffer access.
Also return early when encountering fatal error.

Signed-off-by: Paul B Mahol 
---
 libavcodec/cfhd.c | 89 +--
 1 file changed, 56 insertions(+), 33 deletions(-)

diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
index ea35f03869..a2b9c7c76a 100644
--- a/libavcodec/cfhd.c
+++ b/libavcodec/cfhd.c
@@ -100,6 +100,8 @@ static void init_frame_defaults(CFHDContext *s)
 s->difference_coding = 0;
 s->frame_type= 0;
 s->sample_type   = 0;
+if (s->transform_type != 2)
+s->transform_type = -1;
 init_plane_defaults(s);
 init_peak_table_defaults(s);
 }
@@ -415,14 +417,14 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, 
int *got_frame,
 if (data > 4) {
 av_log(avctx, AV_LOG_ERROR, "Channel Count of %"PRIu16" is 
unsupported\n", data);
 ret = AVERROR_PATCHWELCOME;
-break;
+goto end;
 }
 } else if (tag == SubbandCount) {
 av_log(avctx, AV_LOG_DEBUG, "Subband Count: %"PRIu16"\n", data);
 if (data != SUBBAND_COUNT && data != SUBBAND_COUNT_3D) {
 av_log(avctx, AV_LOG_ERROR, "Subband Count of %"PRIu16" is 
unsupported\n", data);
 ret = AVERROR_PATCHWELCOME;
-break;
+goto end;
 }
 } else if (tag == ChannelNumber) {
 s->channel_num = data;
@@ -430,7 +432,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, 
int *got_frame,
 if (s->channel_num >= s->planes) {
 av_log(avctx, AV_LOG_ERROR, "Invalid channel number\n");
 ret = AVERROR(EINVAL);
-break;
+goto end;
 }
 init_plane_defaults(s);
 } else if (tag == SubbandNumber) {
@@ -442,22 +444,25 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, 
int *got_frame,
 (s->transform_type == 2 && s->level >= DWT_LEVELS_3D)) {
 av_log(avctx, AV_LOG_ERROR, "Invalid level\n");
 ret = AVERROR(EINVAL);
-break;
+goto end;
 }
 if (s->subband_num > 3) {
 av_log(avctx, AV_LOG_ERROR, "Invalid subband number\n");
 ret = AVERROR(EINVAL);
-break;
+goto end;
 }
 } else if (tag == SubbandBand) {
 av_log(avctx, AV_LOG_DEBUG, "Subband number actual %"PRIu16"\n", 
data);
-s->subband_num_actual = data;
-if ((s->transform_type == 0 && s->subband_num_actual >= 
SUBBAND_COUNT) ||
-(s->transform_type == 2 && s->subband_num_actual >= 
SUBBAND_COUNT_3D && s->subband_num_actual != 255)) {
+if ((s->transform_type == 0 && data >= SUBBAND_COUNT) ||
+(s->transform_type == 2 && data >= SUBBAND_COUNT_3D && data != 
255)) {
 av_log(avctx, AV_LOG_ERROR, "Invalid subband number actual\n");
 ret = AVERROR(EINVAL);
-break;
+goto end;
 }
+if (s->transform_type == 0 || s->transform_type == 2)
+s->subband_num_actual = data;
+else
+av_log(avctx, AV_LOG_WARNING, "Ignoring subband num actual 
%"PRIu16"\n", data);
 } else if (tag == LowpassPrecision)
 av_log(avctx, AV_LOG_DEBUG, "Lowpass precision bits: %"PRIu16"\n", 
data);
 else if (tag == Quantization) {
@@ -471,7 +476,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, 
int *got_frame,
 if (!data || data > 5) {
 av_log(avctx, AV_LOG_ERROR, "Invalid band encoding\n");
 ret = AVERROR(EINVAL);
-break;
+goto end;
 }
 s->band_encoding = data;
 av_log(avctx, AV_LOG_DEBUG, "Encode Method for Subband %d : %x\n", 
s->subband_num_actual, data);
@@ -489,14 +494,18 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, 
int *got_frame,
 if (data > 2) {
 av_log(avctx, AV_LOG_ERROR, "Invalid transform type\n");
 ret = AVERROR(EINVAL);
-break;
+goto end;
 } else if (data == 1) {
 av_log(avctx, AV_LOG_ERROR, "unsupported transform type\n");
 ret = AVERROR_PATCHWELCOME;
-break;
+goto end;
+}
+if (s->transform_type == -1) {
+s->transform_type = data;
+av_log(avctx, AV_LOG_DEBUG, "Transform type %"PRIu16"\n", 
data);
+} else {
+av_log(avctx, AV_LOG_DEBUG, "Ignoring additional transform 
type %"PRIu16"\n", data);
 }
-s->transform_type = data;
-av_log(avctx, AV_LOG_DEBUG, "Transform type %"PRIu16"\n", data);
  

Re: [FFmpeg-devel] [PATCH] lavc/qsvdec: Add QSV AV1 decoder

2020-09-22 Thread Xiang, Haihao

Hi Mark, Zhong,

Could you please review this patch when you get a chance?

Thanks very much
Haihao


> AV1 decoder is supported on Tiger Lake+ platforms since libmfx 1.34
> 
> Signed-off-by: Haihao Xiang 
> ---
>  Changelog |  1 +
>  configure |  1 +
>  libavcodec/allcodecs.c|  1 +
>  libavcodec/qsv.c  |  4 
>  libavcodec/qsvdec_other.c | 31 ++-
>  5 files changed, 37 insertions(+), 1 deletion(-)
> 
> diff --git a/Changelog b/Changelog
> index 261b6b261a..1f93d6dd14 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -25,6 +25,7 @@ version :
>  - AV1 decoder (Hardware acceleration used only)
>  - SVS demuxer
>  - Argonaut Games BRP demuxer
> +- Intel QSV-accelerated AV1 decoding
>  
>  
>  version 4.3:
> diff --git a/configure b/configure
> index 5d68695192..591067a7a8 100755
> --- a/configure
> +++ b/configure
> @@ -3139,6 +3139,7 @@ vp9_qsv_encoder_deps="libmfx MFX_CODEC_VP9"
>  vp9_qsv_encoder_select="qsvenc"
>  vp9_v4l2m2m_decoder_deps="v4l2_m2m vp9_v4l2_m2m"
>  wmv3_crystalhd_decoder_select="crystalhd"
> +av1_qsv_decoder_select="qsvdec"
>  
>  # parsers
>  aac_parser_select="adts_header"
> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> index 713c5686a4..ae5642829e 100644
> --- a/libavcodec/allcodecs.c
> +++ b/libavcodec/allcodecs.c
> @@ -820,6 +820,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_av1_qsv_decoder;
>  
>  // The iterate API is not usable with ossfuzz due to the excessive size of
> binaries created
>  #if CONFIG_OSSFUZZ
> diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
> index 17720070f1..7816d2f93c 100644
> --- a/libavcodec/qsv.c
> +++ b/libavcodec/qsv.c
> @@ -64,6 +64,10 @@ int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id)
>  case AV_CODEC_ID_VP9:
>  return MFX_CODEC_VP9;
>  #endif
> +#if QSV_VERSION_ATLEAST(1, 34)
> +case AV_CODEC_ID_AV1:
> +return MFX_CODEC_AV1;
> +#endif
>  
>  default:
>  break;
> diff --git a/libavcodec/qsvdec_other.c b/libavcodec/qsvdec_other.c
> index b4df76739c..2775e07955 100644
> --- a/libavcodec/qsvdec_other.c
> +++ b/libavcodec/qsvdec_other.c
> @@ -1,5 +1,5 @@
>  /*
> - * Intel MediaSDK QSV based MPEG-2, VC-1, VP8, MJPEG and VP9 decoders
> + * Intel MediaSDK QSV based MPEG-2, VC-1, VP8, MJPEG, VP9 and AV1 decoders
>   *
>   * copyright (c) 2015 Anton Khirnov
>   *
> @@ -327,3 +327,32 @@ AVCodec ff_vp9_qsv_decoder = {
>  .wrapper_name   = "qsv",
>  };
>  #endif
> +
> +#if CONFIG_AV1_QSV_DECODER
> +static const AVClass av1_qsv_class = {
> +.class_name = "av1_qsv",
> +.item_name  = av_default_item_name,
> +.option = options,
> +.version= LIBAVUTIL_VERSION_INT,
> +};
> +
> +AVCodec ff_av1_qsv_decoder = {
> +.name   = "av1_qsv",
> +.long_name  = NULL_IF_CONFIG_SMALL("AV1 video (Intel Quick Sync Video
> acceleration)"),
> +.priv_data_size = sizeof(QSVOtherContext),
> +.type   = AVMEDIA_TYPE_VIDEO,
> +.id = AV_CODEC_ID_AV1,
> +.init   = qsv_decode_init,
> +.decode = qsv_decode_frame,
> +.flush  = qsv_decode_flush,
> +.close  = qsv_decode_close,
> +.capabilities   = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1 |
> AV_CODEC_CAP_AVOID_PROBING | AV_CODEC_CAP_HYBRID,
> +.priv_class = &av1_qsv_class,
> +.pix_fmts   = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12,
> +AV_PIX_FMT_P010,
> +AV_PIX_FMT_QSV,
> +AV_PIX_FMT_NONE },
> +.hw_configs = ff_qsv_hw_configs,
> +.wrapper_name   = "qsv",
> +};
> +#endif
___
ffmpeg-devel mailing list
ffmpeg-devel@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] [GASPP PATCH] Handle a trailing flags field for .rodata, like '.section .rodata, "r"'

2020-09-22 Thread Martin Storsjö
---
 gas-preprocessor.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl
index e51849b..bc36300 100755
--- a/gas-preprocessor.pl
+++ b/gas-preprocessor.pl
@@ -1204,7 +1204,7 @@ sub handle_serialized_line {
 $line =~ s/\.arm/ARM/x;
 # The alignment in AREA is the power of two, just as .align in gas
 $line =~ s/\.text/AREA |.text|, CODE, READONLY, ALIGN=4, CODEALIGN/;
-$line =~ s/(\s*)(.*)\.ro?data/$1AREA |.rdata|, DATA, READONLY, 
ALIGN=5/;
+$line =~ s/(\s*)(.*)\.ro?data(\s*,\s*"\w+")?/$1AREA |.rdata|, DATA, 
READONLY, ALIGN=5/;
 $line =~ s/\.data/AREA |.data|, DATA, ALIGN=5/;
 }
 if ($as_type eq "armasm" and $arch eq "arm") {
-- 
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] [GASPP PATCH 1/2] Handle line continuations within gas-preprocessor

2020-09-22 Thread Martin Storsjö
If preprocessing with cl.exe, the preprocessor doesn't take care of
concatenating continued lines.
---
 gas-preprocessor.pl | 19 ---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl
index 126ee50..e9baeba 100755
--- a/gas-preprocessor.pl
+++ b/gas-preprocessor.pl
@@ -295,12 +295,11 @@ while () {
 s/\r$//;
 
 foreach my $subline (split(";", $_)) {
-# Add newlines at the end of lines that don't already have one
 chomp $subline;
-$subline .= "\n";
-parse_line($subline);
+parse_line_continued($subline);
 }
 }
+parse_line_continued("");
 
 sub eval_expr {
 my $expr = $_[0];
@@ -383,6 +382,20 @@ sub parse_if_line {
 return 0;
 }
 
+my $last_line = "";
+sub parse_line_continued {
+my $line = $_[0];
+$last_line .= $line;
+if ($last_line =~ /\\$/) {
+$last_line =~ s/\\$//;
+} else {
+# Add newlines at the end of lines after concatenation.
+$last_line .= "\n";
+parse_line($last_line);
+$last_line = "";
+}
+}
+
 sub parse_line {
 my $line = $_[0];
 
-- 
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".