[FFmpeg-devel] [PATCH v3] GSoC: Add guided filter

2021-05-08 Thread Xuewei Meng
V3: Add examples on how to use this filter, and improve the code style.
V2: Implement the slice-level parallelism for guided filter.
V1: Add the basic version of guided filter.

Signed-off-by: Xuewei Meng 
---
 doc/filters.texi |  38 +
 libavfilter/Makefile |   1 +
 libavfilter/allfilters.c |   1 +
 libavfilter/vf_guided.c  | 429 +++
 4 files changed, 469 insertions(+)
 create mode 100644 libavfilter/vf_guided.c

diff --git a/doc/filters.texi b/doc/filters.texi
index 36e35a1..515c655 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -12918,6 +12918,44 @@ greyedge=difford=1:minknorm=0:sigma=2
 
 @end itemize
 
+@section guided filter
+Apply guided filter for edge-preserving smoothing, dehazing and so on.
+
+The filter accepts the following options:
+@table @option
+@item radius
+Set the radius in pixels.
+Allowed range is 1 to 20. Default is 3.
+
+@item eps
+Set regularization parameter.
+Allowed range is 0 to 1. Default is 0.1.
+
+@item planes
+Set planes to filter. Default is first only.
+@end table
+
+@subsection Commands
+This filter supports the all above options as @ref{commands}.
+
+@subsection Examples
+@itemize
+@item
+Edge-preserving smoothing with guided filter:
+@example
+ffmpeg -i in.png -i in.png -filter_complex guided out.png
+@end example
+
+@item
+Dehazing, structure-transferring filtering, detail enhancement with guided 
filter.
+For the generation of guidance image,
+see @url{http://kaiminghe.com/publications/pami12guidedfilter.pdf}.
+@example
+ffmpeg -i in.png -i guidance.png -filter_complex guided out.png
+@end example
+
+@end itemize
+
 @anchor{haldclut}
 @section haldclut
 
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 5a28736..60a97e1 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -285,6 +285,7 @@ OBJS-$(CONFIG_GEQ_FILTER)+= vf_geq.o
 OBJS-$(CONFIG_GRADFUN_FILTER)+= vf_gradfun.o
 OBJS-$(CONFIG_GRAPHMONITOR_FILTER)   += f_graphmonitor.o
 OBJS-$(CONFIG_GREYEDGE_FILTER)   += vf_colorconstancy.o
+OBJS-$(CONFIG_GUIDED_FILTER) += vf_guided.o
 OBJS-$(CONFIG_HALDCLUT_FILTER)   += vf_lut3d.o framesync.o
 OBJS-$(CONFIG_HFLIP_FILTER)  += vf_hflip.o
 OBJS-$(CONFIG_HISTEQ_FILTER) += vf_histeq.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 931d7db..962f656 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -270,6 +270,7 @@ extern const AVFilter ff_vf_geq;
 extern const AVFilter ff_vf_gradfun;
 extern const AVFilter ff_vf_graphmonitor;
 extern const AVFilter ff_vf_greyedge;
+extern const AVFilter ff_vf_guided;
 extern const AVFilter ff_vf_haldclut;
 extern const AVFilter ff_vf_hflip;
 extern const AVFilter ff_vf_histeq;
diff --git a/libavfilter/vf_guided.c b/libavfilter/vf_guided.c
new file mode 100644
index 000..bd706fb
--- /dev/null
+++ b/libavfilter/vf_guided.c
@@ -0,0 +1,429 @@
+/*
+ * Copyright (c) 2021 Xuewei Meng
+ *
+ * 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/imgutils.h"
+#include "libavutil/opt.h"
+#include "libavutil/pixdesc.h"
+#include "avfilter.h"
+#include "formats.h"
+#include "framesync.h"
+#include "internal.h"
+#include "video.h"
+
+typedef struct GuidedContext {
+const AVClass *class;
+FFFrameSync fs;
+
+int radius;
+float eps;
+
+int planes;
+
+int width;
+int height;
+
+int nb_planes;
+int depth;
+int planewidth[4];
+int planeheight[4];
+
+int (*box_slice)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
+} GuidedContext;
+
+#define OFFSET(x) offsetof(GuidedContext, x)
+#define FLAGS 
AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
+
+static const AVOption guided_options[] = {
+{ "radius", "set the box radius",   OFFSET(radius), 
AV_OPT_TYPE_INT,   {.i64=3},   1,  20, FLAGS },
+{ "eps","set the regularization parameter (with square)",  
OFFSET(eps),AV_OPT_TYPE_FLOAT, {.dbl=0.01  }, 0.0,   1, FLAGS },
+{ "planes", "set planes to filter", OFFSET(planes), AV_OPT_TYPE_INT,   
{.i64=1},   0, 0xF, FLAGS },
+{ NULL }
+};
+
+AVFILTER_DEFINE_CLASS(

Re: [FFmpeg-devel] [PATCH v3] GSoC: Add guided filter

2021-05-08 Thread Steven Liu


> 2021年5月8日 下午6:06,Xuewei Meng <928826...@qq.com> 写道:
> 
> V3: Add examples on how to use this filter, and improve the code style.
> V2: Implement the slice-level parallelism for guided filter.
> V1: Add the basic version of guided filter.
> 
> Signed-off-by: Xuewei Meng 
> ---
> doc/filters.texi |  38 +
> libavfilter/Makefile |   1 +
> libavfilter/allfilters.c |   1 +
> libavfilter/vf_guided.c  | 429 +++
> 4 files changed, 469 insertions(+)
> create mode 100644 libavfilter/vf_guided.c
> 
> diff --git a/doc/filters.texi b/doc/filters.texi
> index 36e35a1..515c655 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -12918,6 +12918,44 @@ greyedge=difford=1:minknorm=0:sigma=2
> 
> @end itemize
> 
> +@section guided filter
> +Apply guided filter for edge-preserving smoothing, dehazing and so on.
> +
> +The filter accepts the following options:
> +@table @option
> +@item radius
> +Set the radius in pixels.
> +Allowed range is 1 to 20. Default is 3.
> +
> +@item eps
> +Set regularization parameter.
> +Allowed range is 0 to 1. Default is 0.1.
> +
> +@item planes
> +Set planes to filter. Default is first only.
> +@end table
> +
> +@subsection Commands
> +This filter supports the all above options as @ref{commands}.
> +
> +@subsection Examples
> +@itemize
> +@item
> +Edge-preserving smoothing with guided filter:
> +@example
> +ffmpeg -i in.png -i in.png -filter_complex guided out.png
> +@end example
> +
> +@item
> +Dehazing, structure-transferring filtering, detail enhancement with guided 
> filter.
> +For the generation of guidance image,
> +see @url{http://kaiminghe.com/publications/pami12guidedfilter.pdf}.
> +@example
> +ffmpeg -i in.png -i guidance.png -filter_complex guided out.png
> +@end example
> +
> +@end itemize
> +
> @anchor{haldclut}
> @section haldclut
> 
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index 5a28736..60a97e1 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -285,6 +285,7 @@ OBJS-$(CONFIG_GEQ_FILTER)+= vf_geq.o
> OBJS-$(CONFIG_GRADFUN_FILTER)+= vf_gradfun.o
> OBJS-$(CONFIG_GRAPHMONITOR_FILTER)   += f_graphmonitor.o
> OBJS-$(CONFIG_GREYEDGE_FILTER)   += vf_colorconstancy.o
> +OBJS-$(CONFIG_GUIDED_FILTER) += vf_guided.o
> OBJS-$(CONFIG_HALDCLUT_FILTER)   += vf_lut3d.o framesync.o
> OBJS-$(CONFIG_HFLIP_FILTER)  += vf_hflip.o
> OBJS-$(CONFIG_HISTEQ_FILTER) += vf_histeq.o
> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> index 931d7db..962f656 100644
> --- a/libavfilter/allfilters.c
> +++ b/libavfilter/allfilters.c
> @@ -270,6 +270,7 @@ extern const AVFilter ff_vf_geq;
> extern const AVFilter ff_vf_gradfun;
> extern const AVFilter ff_vf_graphmonitor;
> extern const AVFilter ff_vf_greyedge;
> +extern const AVFilter ff_vf_guided;
> extern const AVFilter ff_vf_haldclut;
> extern const AVFilter ff_vf_hflip;
> extern const AVFilter ff_vf_histeq;
> diff --git a/libavfilter/vf_guided.c b/libavfilter/vf_guided.c
> new file mode 100644
> index 000..bd706fb
> --- /dev/null
> +++ b/libavfilter/vf_guided.c
> @@ -0,0 +1,429 @@
> +/*
> + * Copyright (c) 2021 Xuewei Meng
> + *
> + * 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/imgutils.h"
> +#include "libavutil/opt.h"
> +#include "libavutil/pixdesc.h"
> +#include "avfilter.h"
> +#include "formats.h"
> +#include "framesync.h"
> +#include "internal.h"
> +#include "video.h"
> +
> +typedef struct GuidedContext {
> +const AVClass *class;
> +FFFrameSync fs;
> +
> +int radius;
> +float eps;
> +
> +int planes;
> +
> +int width;
> +int height;
> +
> +int nb_planes;
> +int depth;
> +int planewidth[4];
> +int planeheight[4];
> +
> +int (*box_slice)(AVFilterContext *ctx, void *arg, int jobnr, int 
> nb_jobs);
> +} GuidedContext;
> +
> +#define OFFSET(x) offsetof(GuidedContext, x)
> +#define FLAGS 
> AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
> +
> +static const AVOption guided_options[] = {
> +{ "radius", "set the box radius",   OFFSET(radius), 
> AV_OPT_TYPE_INT,

Re: [FFmpeg-devel] [PATCH 1/2] avcodec: Implement Acorn Replay IMA ADPCM decoder

2021-05-08 Thread Zane van Iperen




On 8/5/21 2:50 am, Cameron Cawley wrote:

---
  Changelog |  1 +
  doc/general_contents.texi |  1 +
  libavcodec/Makefile   |  1 +
  libavcodec/adpcm.c| 19 +++
  libavcodec/allcodecs.c|  1 +
  libavcodec/codec_desc.c   |  7 +++
  libavcodec/codec_id.h |  1 +
  libavcodec/utils.c|  1 +
  libavcodec/version.h  |  2 +-
  9 files changed, 33 insertions(+), 1 deletion(-)



Both lgtm, will apply.

Zane

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

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


[FFmpeg-devel] [PATCH 1/2] lavc/pngdec: fix updating reference frames for APNG_DISPOSE_OP_BACKGROUND

2021-05-08 Thread Anton Khirnov
They should be treated the same as APNG_DISPOSE_OP_NONE.

Broken in 5663301560.

Fixes #9184.
---
 libavcodec/pngdec.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index f2e6f689b0..16c4c3a283 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -1622,7 +1622,7 @@ static int decode_frame_apng(AVCodecContext *avctx,
 if (!(avctx->active_thread_type & FF_THREAD_FRAME)) {
 if (s->dispose_op == APNG_DISPOSE_OP_PREVIOUS) {
 ff_thread_release_buffer(avctx, &s->picture);
-} else if (s->dispose_op == APNG_DISPOSE_OP_NONE) {
+} else {
 ff_thread_release_buffer(avctx, &s->last_picture);
 FFSWAP(ThreadFrame, s->picture, s->last_picture);
 }
@@ -1671,8 +1671,8 @@ static int update_thread_context(AVCodecContext *dst, 
const AVCodecContext *src)
 pdst->hdr_state |= psrc->hdr_state;
 }
 
-src_frame = psrc->dispose_op == APNG_DISPOSE_OP_NONE ?
-&psrc->picture : &psrc->last_picture;
+src_frame = psrc->dispose_op == APNG_DISPOSE_OP_PREVIOUS ?
+&psrc->last_picture : &psrc->picture;
 
 ff_thread_release_buffer(dst, &pdst->last_picture);
 if (src_frame && src_frame->f->data[0]) {
-- 
2.30.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 2/2] fate: add a more extensive test for APNG_DISPOSE_OP_BACKGROUND

2021-05-08 Thread Anton Khirnov
Uses the sample from #9184.
---
 tests/fate/apng.mak |  3 +++
 tests/ref/fate/apng-dispose-background2 | 25 +
 2 files changed, 28 insertions(+)
 create mode 100644 tests/ref/fate/apng-dispose-background2

diff --git a/tests/fate/apng.mak b/tests/fate/apng.mak
index 901fc0a10e..e9d3cf2a02 100644
--- a/tests/fate/apng.mak
+++ b/tests/fate/apng.mak
@@ -10,6 +10,9 @@ fate-apng-dispose-previous: CMD = framecrc -i 
$(TARGET_SAMPLES)/apng/apng_out_of
 FATE_APNG += fate-apng-dispose-background
 fate-apng-dispose-background: CMD = framecrc -i $(TARGET_SAMPLES)/apng/015.png
 
+FATE_APNG += fate-apng-dispose-background2
+fate-apng-dispose-background2: CMD = framecrc -i 
$(TARGET_SAMPLES)/apng/alogo.png
+
 FATE_APNG-$(call DEMDEC, APNG, APNG) += $(FATE_APNG)
 
 FATE_SAMPLES_FFMPEG += $(FATE_APNG-yes)
diff --git a/tests/ref/fate/apng-dispose-background2 
b/tests/ref/fate/apng-dispose-background2
new file mode 100644
index 00..db1216e836
--- /dev/null
+++ b/tests/ref/fate/apng-dispose-background2
@@ -0,0 +1,25 @@
+#tb 0: 3/40
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 100x100
+#sar 0: 0/1
+0,  0,  0,1,4, 0x15284fcd
+0,  1,  1,1,4, 0xc77f0451
+0,  2,  2,1,4, 0x895c4029
+0,  3,  3,1,4, 0x9474bd69
+0,  4,  4,1,4, 0xdd67407e
+0,  5,  5,1,4, 0x2ff049ee
+0,  6,  6,1,4, 0xd944c1bb
+0,  7,  7,1,4, 0x56850692
+0,  8,  8,1,4, 0x8816ce06
+0,  9,  9,1,4, 0x0d7170a8
+0, 10, 10,1,4, 0x85290373
+0, 11, 11,1,4, 0xd2899862
+0, 12, 12,1,4, 0x8730ed6d
+0, 13, 13,1,4, 0x914257ad
+0, 14, 14,1,4, 0x513b88a4
+0, 15, 15,1,4, 0x695a8ff0
+0, 16, 16,1,4, 0xec63be20
+0, 17, 17,1,4, 0x024a7b99
+0, 18, 18,1,4, 0x28b05fc4
+0, 19, 19,1,4, 0xcf1fceb2
-- 
2.30.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 2/5] lavfi/dnn_backend_native_layer_conv2d.h: Documentation

2021-05-08 Thread Shubhanshu Saxena
Add documentation for 2D Convolution Layer

Signed-off-by: Shubhanshu Saxena 
---
 .../dnn/dnn_backend_native_layer_conv2d.h | 26 +++
 1 file changed, 26 insertions(+)

diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.h 
b/libavfilter/dnn/dnn_backend_native_layer_conv2d.h
index 03ca795c61..6dce698dc7 100644
--- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.h
+++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.h
@@ -34,7 +34,33 @@ typedef struct ConvolutionalParams{
 float *biases;
 } ConvolutionalParams;
 
+/**
+ * @brief Load the 2D Convolution Layer.
+ *
+ * It assigns the layer parameters to the hyperparameters
+ * like dilation, padding method, activation, bias, and
+ * kernel size after parsing from the model file context.
+ *
+ * @param layer pointer to the DNN layer instance
+ * @param model_file_context pointer to model file context
+ * @param file_size model file size
+ * @param operands_num number of operands for the layer
+ * @return Size of DNN Layer
+ * @retval 0 if model file context contains invalid hyperparameters.
+ */
 int ff_dnn_load_layer_conv2d(Layer *layer, AVIOContext *model_file_context, 
int file_size, int operands_num);
+
+/**
+ * @brief Execute the 2D Convolution Layer.
+ *
+ * @param operands input operands
+ * @param input_operand_indexes input operand indexes
+ * @param output_operand_index output operand index
+ * @param parameters convolution parameters
+ * @param ctx pointer to Native model context
+ * @retval DNN_SUCCESS if the execution succeeds
+ * @retval DNN_ERROR if the execution fails
+ */
 int ff_dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t 
*input_operand_indexes,
 int32_t output_operand_index, const void 
*parameters, NativeContext *ctx);
 #endif
-- 
2.27.0

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

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


[FFmpeg-devel] [PATCH 4/5] lavfi/dnn_backend_native_layer_depth2space.h: Documentation

2021-05-08 Thread Shubhanshu Saxena
Add documentation for Depth to Space Layer

Signed-off-by: Shubhanshu Saxena 
---
 .../dnn_backend_native_layer_depth2space.h| 28 +++
 1 file changed, 28 insertions(+)

diff --git a/libavfilter/dnn/dnn_backend_native_layer_depth2space.h 
b/libavfilter/dnn/dnn_backend_native_layer_depth2space.h
index ef59394443..991f194e49 100644
--- a/libavfilter/dnn/dnn_backend_native_layer_depth2space.h
+++ b/libavfilter/dnn/dnn_backend_native_layer_depth2space.h
@@ -34,7 +34,35 @@ typedef struct DepthToSpaceParams{
 int block_size;
 } DepthToSpaceParams;
 
+/**
+ * @brief Load the Depth to Space Layer.
+ *
+ * It assigns the layer parameters to the block size
+ * hyperparameter from the model file context.
+ *
+ * @param layer pointer to the DNN layer instance
+ * @param model_file_context pointer to model file context
+ * @param file_size model file size
+ * @param operands_num number of operands for the layer
+ * @return Size of DNN Layer
+ * @retval 0 if model file context contains invalid hyperparameters.
+ */
 int ff_dnn_load_layer_depth2space(Layer *layer, AVIOContext 
*model_file_context, int file_size, int operands_num);
+
+/**
+ * @brief Execute the Depth to Space Layer.
+ *
+ * It rearranges the input data from depth into spatial
+ * form by applying Depth to Space transformation.
+ *
+ * @param operands input operands
+ * @param input_operand_indexes input operand indexes
+ * @param output_operand_index output operand index
+ * @param parameters layer parameters
+ * @param ctx pointer to Native model context
+ * @retval DNN_SUCCESS if the execution succeeds
+ * @retval DNN_ERROR if the execution fails
+ */
 int ff_dnn_execute_layer_depth2space(DnnOperand *operands, const int32_t 
*input_operand_indexes,
  int32_t output_operand_index, const void 
*parameters, NativeContext *ctx);
 
-- 
2.27.0

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

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


[FFmpeg-devel] [PATCH 5/5] lavfi/dnn_backend_native_layer_mathunary.h: Documentation

2021-05-08 Thread Shubhanshu Saxena
Add documentation for Unary Math Layer

Signed-off-by: Shubhanshu Saxena 
---
 .../dnn/dnn_backend_native_layer_mathunary.h  | 64 +--
 1 file changed, 46 insertions(+), 18 deletions(-)

diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathunary.h 
b/libavfilter/dnn/dnn_backend_native_layer_mathunary.h
index 151a73200a..869fdc16fd 100644
--- a/libavfilter/dnn/dnn_backend_native_layer_mathunary.h
+++ b/libavfilter/dnn/dnn_backend_native_layer_mathunary.h
@@ -30,31 +30,59 @@
 #include "dnn_backend_native.h"
 
 typedef enum {
-DMUO_ABS = 0,
-DMUO_SIN = 1,
-DMUO_COS = 2,
-DMUO_TAN = 3,
-DMUO_ASIN = 4,
-DMUO_ACOS = 5,
-DMUO_ATAN = 6,
-DMUO_SINH = 7,
-DMUO_COSH = 8,
-DMUO_TANH = 9,
-DMUO_ASINH = 10,
-DMUO_ACOSH = 11,
-DMUO_ATANH = 12,
-DMUO_CEIL = 13,
-DMUO_FLOOR = 14,
-DMUO_ROUND = 15,
-DMUO_EXP = 16,
-DMUO_COUNT
+DMUO_ABS = 0,// Absolute Value
+DMUO_SIN = 1,// Sine
+DMUO_COS = 2,// Cosine
+DMUO_TAN = 3,// Tangent
+DMUO_ASIN = 4,   // Inverse Sine
+DMUO_ACOS = 5,   // Inverse Cosine
+DMUO_ATAN = 6,   // Inverse Tangent
+DMUO_SINH = 7,   // Hyperbolic Sine
+DMUO_COSH = 8,   // Hyperbolic Cosine
+DMUO_TANH = 9,   // Hyperbolic Tangent
+DMUO_ASINH = 10, // Inverse Hyperbolic Sine
+DMUO_ACOSH = 11, // Inverse Hyperbolic Cosine
+DMUO_ATANH = 12, // Inverse Hyperbolic Tangent
+DMUO_CEIL = 13,  // Ceiling
+DMUO_FLOOR = 14, // Floor
+DMUO_ROUND = 15, // Round off to Nearest Integer
+DMUO_EXP = 16,   // Exponential
+DMUO_COUNT   // Total Number of Operators
 } DNNMathUnaryOperation;
 
 typedef struct DnnLayerMathUnaryParams{
 DNNMathUnaryOperation un_op;
 } DnnLayerMathUnaryParams;
 
+/**
+ * @brief Load the Unary Math Layer.
+ *
+ * It assigns the layer parameters to the unary operator
+ * hyperparameter from the model file context.
+ *
+ * @param layer pointer to the DNN layer instance
+ * @param model_file_context pointer to model file context
+ * @param file_size model file size
+ * @param operands_num number of operands for the layer
+ * @return Size of DNN Layer
+ * @retval 0 if model file context contains invalid hyperparameters.
+ */
 int ff_dnn_load_layer_math_unary(Layer *layer, AVIOContext 
*model_file_context, int file_size, int operands_num);
+
+/**
+ * @brief Execute the Unary Math Layer.
+ *
+ * It applies the unary operator parsed while
+ * loading to the given input operands.
+ *
+ * @param operands input operands
+ * @param input_operand_indexes input operand indexes
+ * @param output_operand_index output operand index
+ * @param parameters layer parameters
+ * @param ctx pointer to Native model context
+ * @retval DNN_SUCCESS if the execution succeeds
+ * @retval DNN_ERROR if the execution fails
+ */
 int ff_dnn_execute_layer_math_unary(DnnOperand *operands, const int32_t 
*input_operand_indexes,
 int32_t output_operand_index, const void 
*parameters, NativeContext *ctx);
 
-- 
2.27.0

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

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


[FFmpeg-devel] [PATCH 3/5] lavfi/dnn_backend_native_layer_dense.h: Documentation

2021-05-08 Thread Shubhanshu Saxena
Add documentation for Dense Layer

Signed-off-by: Shubhanshu Saxena 
---
 .../dnn/dnn_backend_native_layer_dense.h  | 26 +++
 1 file changed, 26 insertions(+)

diff --git a/libavfilter/dnn/dnn_backend_native_layer_dense.h 
b/libavfilter/dnn/dnn_backend_native_layer_dense.h
index 86248856ae..fc971cece2 100644
--- a/libavfilter/dnn/dnn_backend_native_layer_dense.h
+++ b/libavfilter/dnn/dnn_backend_native_layer_dense.h
@@ -31,7 +31,33 @@ typedef struct DenseParams{
 float *biases;
 } DenseParams;
 
+/**
+ * @brief Load the Densely-Connnected Layer.
+ *
+ * It assigns the layer parameters to the hyperparameters
+ * like activation, bias, and kernel size after parsing
+ * from the model file context.
+ *
+ * @param layer pointer to the DNN layer instance
+ * @param model_file_context pointer to model file context
+ * @param file_size model file size
+ * @param operands_num number of operands for the layer
+ * @return Size of DNN Layer
+ * @retval 0 if model file context contains invalid hyperparameters.
+ */
 int ff_dnn_load_layer_dense(Layer *layer, AVIOContext *model_file_context, int 
file_size, int operands_num);
+
+/**
+ * @brief Execute the Densely-Connnected Layer.
+ *
+ * @param operands input operands
+ * @param input_operand_indexes input operand indexes
+ * @param output_operand_index output operand index
+ * @param parameters layer parameters
+ * @param ctx pointer to Native model context
+ * @retval DNN_SUCCESS if the execution succeeds
+ * @retval DNN_ERROR if the execution fails
+ */
 int ff_dnn_execute_layer_dense(DnnOperand *operands, const int32_t 
*input_operand_indexes,
int32_t output_operand_index, const void 
*parameters, NativeContext *ctx);
 #endif
-- 
2.27.0

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

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


[FFmpeg-devel] [PATCH 1/5] lavfi/dnn_backend_native_layer_avgpool.h: Documentation

2021-05-08 Thread Shubhanshu Saxena
Add documentation for Average Pool Layer

Signed-off-by: Shubhanshu Saxena 
---
 .../dnn/dnn_backend_native_layer_avgpool.h| 27 +++
 1 file changed, 27 insertions(+)

diff --git a/libavfilter/dnn/dnn_backend_native_layer_avgpool.h 
b/libavfilter/dnn/dnn_backend_native_layer_avgpool.h
index 75d9eb187b..0f629b9165 100644
--- a/libavfilter/dnn/dnn_backend_native_layer_avgpool.h
+++ b/libavfilter/dnn/dnn_backend_native_layer_avgpool.h
@@ -33,7 +33,34 @@ typedef struct AvgPoolParams{
 DNNPaddingParam padding_method;
 } AvgPoolParams;
 
+/**
+ * @brief Load Average Pooling Layer.
+ *
+ * It assigns the layer parameters to the hyperparameters 
+ * like strides, padding method, and kernel size after 
+ * parsing from the model file context.
+ * 
+ * @param layer pointer to the DNN layer instance
+ * @param model_file_context pointer to model file context
+ * @param file_size model file size
+ * @param operands_num number of operands for the layer
+ * @return Size of DNN Layer
+ * @retval 0 if model file context contains invalid hyperparameters.
+ */
 int ff_dnn_load_layer_avg_pool(Layer *layer, AVIOContext *model_file_context, 
int file_size, int operands_num);
+
+/**
+ * @brief Execute the Average Pooling Layer.
+ * Padding in channel dimensions is currently not supported.
+ * 
+ * @param operands input operands
+ * @param input_operand_indexes input operand indexes
+ * @param output_operand_index output operand index
+ * @param parameters average pooling parameters
+ * @param ctx pointer to Native model context
+ * @retval 0 if the execution succeeds
+ * @retval DNN_ERROR if the execution fails
+ */
 int ff_dnn_execute_layer_avg_pool(DnnOperand *operands, const int32_t 
*input_operand_indexes,
   int32_t output_operand_index, const void 
*parameters, NativeContext *ctx);
 
-- 
2.27.0

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

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


[FFmpeg-devel] [PATCH 2/2] avformat/matroskadec: remove special handling of av1c extradata

2021-05-08 Thread Jan Ekström
Libavcodec can now handle the standard AV1CodecConfigurationRecord
extradata as-is.
---
 libavformat/matroskadec.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 8523261760..73e1ddb68d 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -2720,10 +2720,6 @@ static int matroska_parse_tracks(AVFormatContext *s)
 /* we don't need any value stored in CodecPrivate.
make sure that it's not exported as extradata. */
 track->codec_priv.size = 0;
-} else if (codec_id == AV_CODEC_ID_AV1 && track->codec_priv.size) {
-/* For now, propagate only the OBUs, if any. Once libavcodec is
-   updated to handle isobmff style extradata this can be removed. 
*/
-extradata_offset = 4;
 }
 track->codec_priv.size -= extradata_offset;
 
-- 
2.31.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/2] avformat/mov: remove special handling of av1c extradata

2021-05-08 Thread Jan Ekström
Libavcodec can now handle the AV1CodecConfigurationRecord structure
as-is when passed as extradata, so the standard behavior of
read-box-into-extradata should suffice, just like with AVC and HEVC.
---
 libavformat/mov.c | 30 +-
 1 file changed, 1 insertion(+), 29 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 295a8e2b99..f67bb2441f 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -5295,34 +5295,6 @@ static int mov_read_tmcd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 return 0;
 }
 
-static int mov_read_av1c(MOVContext *c, AVIOContext *pb, MOVAtom atom)
-{
-AVStream *st;
-int ret;
-
-if (c->fc->nb_streams < 1)
-return 0;
-st = c->fc->streams[c->fc->nb_streams - 1];
-
-if (atom.size < 4) {
-av_log(c->fc, AV_LOG_ERROR, "Empty AV1 Codec Configuration Box\n");
-return AVERROR_INVALIDDATA;
-}
-
-/* For now, propagate only the OBUs, if any. Once libavcodec is
-   updated to handle isobmff style extradata this can be removed. */
-avio_skip(pb, 4);
-
-if (atom.size == 4)
-return 0;
-
-ret = ff_get_extradata(c->fc, st->codecpar, pb, atom.size - 4);
-if (ret < 0)
-return ret;
-
-return 0;
-}
-
 static int mov_read_vpcc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
 AVStream *st;
@@ -6850,7 +6822,7 @@ static const MOVParseTableEntry mov_default_parse_table[] 
= {
 { MKTAG('A','A','L','P'), mov_read_avid },
 { MKTAG('A','R','E','S'), mov_read_ares },
 { MKTAG('a','v','s','s'), mov_read_avss },
-{ MKTAG('a','v','1','C'), mov_read_av1c },
+{ MKTAG('a','v','1','C'), mov_read_glbl },
 { MKTAG('c','h','p','l'), mov_read_chpl },
 { MKTAG('c','o','6','4'), mov_read_stco },
 { MKTAG('c','o','l','r'), mov_read_colr },
-- 
2.31.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] avformat/mov: remove special handling of av1c extradata

2021-05-08 Thread James Almer

On 5/8/2021 9:29 AM, Jan Ekström wrote:

Libavcodec can now handle the AV1CodecConfigurationRecord structure
as-is when passed as extradata, so the standard behavior of
read-box-into-extradata should suffice, just like with AVC and HEVC.
---
  libavformat/mov.c | 30 +-
  1 file changed, 1 insertion(+), 29 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 295a8e2b99..f67bb2441f 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -5295,34 +5295,6 @@ static int mov_read_tmcd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
  return 0;
  }
  
-static int mov_read_av1c(MOVContext *c, AVIOContext *pb, MOVAtom atom)

-{
-AVStream *st;
-int ret;
-
-if (c->fc->nb_streams < 1)
-return 0;
-st = c->fc->streams[c->fc->nb_streams - 1];
-
-if (atom.size < 4) {
-av_log(c->fc, AV_LOG_ERROR, "Empty AV1 Codec Configuration Box\n");
-return AVERROR_INVALIDDATA;
-}
-
-/* For now, propagate only the OBUs, if any. Once libavcodec is
-   updated to handle isobmff style extradata this can be removed. */
-avio_skip(pb, 4);
-
-if (atom.size == 4)
-return 0;
-
-ret = ff_get_extradata(c->fc, st->codecpar, pb, atom.size - 4);
-if (ret < 0)
-return ret;
-
-return 0;
-}
-
  static int mov_read_vpcc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
  {
  AVStream *st;
@@ -6850,7 +6822,7 @@ static const MOVParseTableEntry mov_default_parse_table[] 
= {
  { MKTAG('A','A','L','P'), mov_read_avid },
  { MKTAG('A','R','E','S'), mov_read_ares },
  { MKTAG('a','v','s','s'), mov_read_avss },
-{ MKTAG('a','v','1','C'), mov_read_av1c },
+{ MKTAG('a','v','1','C'), mov_read_glbl },
  { MKTAG('c','h','p','l'), mov_read_chpl },
  { MKTAG('c','o','6','4'), mov_read_stco },
  { MKTAG('c','o','l','r'), mov_read_colr },


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

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


Re: [FFmpeg-devel] [PATCH 2/2] avformat/matroskadec: remove special handling of av1c extradata

2021-05-08 Thread James Almer

On 5/8/2021 9:29 AM, Jan Ekström wrote:

Libavcodec can now handle the standard AV1CodecConfigurationRecord
extradata as-is.
---
  libavformat/matroskadec.c | 4 
  1 file changed, 4 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 8523261760..73e1ddb68d 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -2720,10 +2720,6 @@ static int matroska_parse_tracks(AVFormatContext *s)
  /* we don't need any value stored in CodecPrivate.
 make sure that it's not exported as extradata. */
  track->codec_priv.size = 0;
-} else if (codec_id == AV_CODEC_ID_AV1 && track->codec_priv.size) {
-/* For now, propagate only the OBUs, if any. Once libavcodec is
-   updated to handle isobmff style extradata this can be removed. 
*/
-extradata_offset = 4;
  }
  track->codec_priv.size -= extradata_offset;


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

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


[FFmpeg-devel] [PATCH] [GSOC] avfilter: added guided filter

2021-05-08 Thread Andrey Moskalenko

> Maybe not only use multithreading for speedup, also need some
> algorithms to improve it.
> What about the speedup compare data?
Additionally, a fast implementation of box filtering is used and 
sub-sampling as recommended in https://arxiv.org/abs/1505.00996. Current 
implementation outperforms the existing bilateral filter in terms of 
speed and quality on my 8-core CPU. The speed depends significantly on 
the sub-sampling parameter. With sub = 4, for example, the filter works 
110 FPS against 74 FPS for the bilateral one with the same spatial radius.


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

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


Re: [FFmpeg-devel] [PATCH] avcodec/avpacket: always initialize the new packet in avpriv_packet_list_put()

2021-05-08 Thread James Almer

On 5/7/2021 2:17 PM, James Almer wrote:

If a copy callback is provided by the caller, the packet passed to it
was zeroed instead of initialized with default values.

Signed-off-by: James Almer 
---
  libavcodec/avpacket.c | 5 -
  1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index e32c467586..1f20cd1e6b 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -519,13 +519,14 @@ int avpriv_packet_list_put(PacketList **packet_buffer,
 int (*copy)(AVPacket *dst, const AVPacket *src),
 int flags)
  {
-PacketList *pktl = av_mallocz(sizeof(PacketList));
+PacketList *pktl = av_malloc(sizeof(PacketList));
  int ret;
  
  if (!pktl)

  return AVERROR(ENOMEM);
  
  if (copy) {

+get_packet_defaults(&pktl->pkt);
  ret = copy(&pktl->pkt, pkt);
  if (ret < 0) {
  av_free(pktl);
@@ -540,6 +541,8 @@ int avpriv_packet_list_put(PacketList **packet_buffer,
  av_packet_move_ref(&pktl->pkt, pkt);
  }
  
+pktl->next = NULL;

+
  if (*packet_buffer)
  (*plast_pktl)->next = pktl;
  else


Will apply.
___
ffmpeg-devel mailing list
ffmpeg-devel@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] avformat/mov: remove special handling of av1c extradata

2021-05-08 Thread Jan Ekström
On Sat, May 8, 2021 at 3:46 PM James Almer  wrote:
>
> On 5/8/2021 9:29 AM, Jan Ekström wrote:
> > Libavcodec can now handle the AV1CodecConfigurationRecord structure
> > as-is when passed as extradata, so the standard behavior of
> > read-box-into-extradata should suffice, just like with AVC and HEVC.
> > ---
> >   libavformat/mov.c | 30 +-
> >   1 file changed, 1 insertion(+), 29 deletions(-)
> >
> > diff --git a/libavformat/mov.c b/libavformat/mov.c
> > index 295a8e2b99..f67bb2441f 100644
> > --- a/libavformat/mov.c
> > +++ b/libavformat/mov.c
> > @@ -5295,34 +5295,6 @@ static int mov_read_tmcd(MOVContext *c, AVIOContext 
> > *pb, MOVAtom atom)
> >   return 0;
> >   }
> >
> > -static int mov_read_av1c(MOVContext *c, AVIOContext *pb, MOVAtom atom)
> > -{
> > -AVStream *st;
> > -int ret;
> > -
> > -if (c->fc->nb_streams < 1)
> > -return 0;
> > -st = c->fc->streams[c->fc->nb_streams - 1];
> > -
> > -if (atom.size < 4) {
> > -av_log(c->fc, AV_LOG_ERROR, "Empty AV1 Codec Configuration Box\n");
> > -return AVERROR_INVALIDDATA;
> > -}
> > -
> > -/* For now, propagate only the OBUs, if any. Once libavcodec is
> > -   updated to handle isobmff style extradata this can be removed. */
> > -avio_skip(pb, 4);
> > -
> > -if (atom.size == 4)
> > -return 0;
> > -
> > -ret = ff_get_extradata(c->fc, st->codecpar, pb, atom.size - 4);
> > -if (ret < 0)
> > -return ret;
> > -
> > -return 0;
> > -}
> > -
> >   static int mov_read_vpcc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
> >   {
> >   AVStream *st;
> > @@ -6850,7 +6822,7 @@ static const MOVParseTableEntry 
> > mov_default_parse_table[] = {
> >   { MKTAG('A','A','L','P'), mov_read_avid },
> >   { MKTAG('A','R','E','S'), mov_read_ares },
> >   { MKTAG('a','v','s','s'), mov_read_avss },
> > -{ MKTAG('a','v','1','C'), mov_read_av1c },
> > +{ MKTAG('a','v','1','C'), mov_read_glbl },
> >   { MKTAG('c','h','p','l'), mov_read_chpl },
> >   { MKTAG('c','o','6','4'), mov_read_stco },
> >   { MKTAG('c','o','l','r'), mov_read_colr },
>
> LGTM

Thanks, applied as 45e3b6a68b61114bbb24083dcb71a5991efa4fb0 .

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 2/2] avformat/matroskadec: remove special handling of av1c extradata

2021-05-08 Thread Jan Ekström
On Sat, May 8, 2021 at 3:46 PM James Almer  wrote:
>
> On 5/8/2021 9:29 AM, Jan Ekström wrote:
> > Libavcodec can now handle the standard AV1CodecConfigurationRecord
> > extradata as-is.
> > ---
> >   libavformat/matroskadec.c | 4 
> >   1 file changed, 4 deletions(-)
> >
> > diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> > index 8523261760..73e1ddb68d 100644
> > --- a/libavformat/matroskadec.c
> > +++ b/libavformat/matroskadec.c
> > @@ -2720,10 +2720,6 @@ static int matroska_parse_tracks(AVFormatContext *s)
> >   /* we don't need any value stored in CodecPrivate.
> >  make sure that it's not exported as extradata. */
> >   track->codec_priv.size = 0;
> > -} else if (codec_id == AV_CODEC_ID_AV1 && track->codec_priv.size) {
> > -/* For now, propagate only the OBUs, if any. Once libavcodec is
> > -   updated to handle isobmff style extradata this can be 
> > removed. */
> > -extradata_offset = 4;
> >   }
> >   track->codec_priv.size -= extradata_offset;
>
> LGTM

Thanks, applied as ffd1316e441a8310cf1746d86fed165e17e10018 .

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/4] avcodec/vp3: Don't try to decode VP4 when VP4 decoder is disabled

2021-05-08 Thread Peter Ross
On Sat, May 08, 2021 at 03:25:06AM +0200, Andreas Rheinhardt wrote:
> Otherwise decoding will crash lateron; e.g. because dct_tokens
> is never set or because a VLC that has not been allocated is used.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/vp3.c | 8 ++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
> index 0cae075452..9aa84e83b7 100644
> --- a/libavcodec/vp3.c
> +++ b/libavcodec/vp3.c
> @@ -2335,9 +2335,13 @@ static av_cold int vp3_decode_init(AVCodecContext 
> *avctx)
>  if (ret < 0)
>  return ret;
>  
> -if (avctx->codec_tag == MKTAG('V', 'P', '4', '0'))
> +if (avctx->codec_tag == MKTAG('V', 'P', '4', '0')) {
>  s->version = 3;
> -else if (avctx->codec_tag == MKTAG('V', 'P', '3', '0'))
> +#if !CONFIG_VP4_DECODER
> +av_log(avctx, AV_LOG_ERROR, "This build does not support decoding 
> VP4.\n");
> +return AVERROR_DECODER_NOT_FOUND;
> +#endif
> +} else if (avctx->codec_tag == MKTAG('V', 'P', '3', '0'))
>  s->version = 0;
>  else
>  s->version = 1;
> -- 
> 2.27.0

This patchset 1-4 all looks good to me.

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)


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

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


[FFmpeg-devel] [PATCH] filters: Add an OpenCL filter for filtering GoPro Max native .360 files into standard equirectangular (default) or youtube equiangular cubemap (eac) projection

2021-05-08 Thread Ronan .
>From 47c39e21f81b6536c96b91aebfd755e3f8a39463 Mon Sep 17 00:00:00 2001
From: Ronan LE MEILLAT 
Date: Sun, 9 May 2021 08:42:58 +0200
Subject: [PATCH] filters: Add an OpenCL filter for filtering GoPro Max native 
.360 files into standard equirectangular (default) or youtube equiangular 
cubemap (eac) projection

Signed-off-by: Ronan LE MEILLAT 
---
 doc/filters.texi |  26 +++
 libavfilter/Makefile |   2 +
 libavfilter/allfilters.c |   1 +
 libavfilter/opencl/gopromax.cl   | 305 
 libavfilter/opencl_source.h  |   2 +-
 libavfilter/vf_gopromax_opencl.c | 330 +++
 6 files changed, 665 insertions(+), 1 deletion(-)
 create mode 100644 libavfilter/opencl/gopromax.cl
 create mode 100644 libavfilter/vf_gopromax_opencl.c

diff --git a/doc/filters.texi b/doc/filters.texi
index b405cc5dfb..0f92163f0e 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -23041,6 +23041,32 @@ Apply dilation filter with threshold0 set to 30, 
threshold1 set 40, threshold2 s
 @end example
 @end itemize
 
+@section gopromax_opencl
+
+Apply transformation of the two GoPro Max video streams to equirectangular or 
equiangular-cubemap projection.
+
+This filter is designed to use directly GoPro .360 files.
+
+It accepts the following options:
+
+@table @option
+
+@item eac
+If @code{1} the ouptut is EAC. If @code{0} (default) the ouptut is 
equirectangular. Native .360 files are sort of EAC files, in fact the front and 
rear lenses streams are the top and the bottom of the EAC projection. The .360 
contains also 2x64 bits of overlapped area. The filter removes these two areas.
+If eac option is not specified, the output is equirectangular.
+
+@end table
+
+@subsection Example
+
+@itemize
+@item
+Convert .360 to equirectangular with OpenCL 0:1 device.
+@example
+-i INPUT -hwaccel auto -hwaccel auto -init_hw_device opencl:0.1 
-filter_hw_device opencl0 -v verbose  -filter_complex 
'[0:0]format=yuv420p,hwupload[a] , [0:4]format=yuv420p,hwupload[b], 
[a][b]gopromax_opencl, hwdownload,format=yuv420p' OUTPUT
+@end example
+@end itemize
+
 @section nlmeans_opencl
 
 Non-local Means denoise filter through OpenCL, this filter accepts same 
options as @ref{nlmeans}.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 6c22d0404e..a3ca814c14 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -477,6 +477,8 @@ OBJS-$(CONFIG_VIGNETTE_FILTER)   += 
vf_vignette.o
 OBJS-$(CONFIG_VMAFMOTION_FILTER) += vf_vmafmotion.o framesync.o
 OBJS-$(CONFIG_VPP_QSV_FILTER)+= vf_vpp_qsv.o
 OBJS-$(CONFIG_VSTACK_FILTER) += vf_stack.o framesync.o
+OBJS-$(CONFIG_GOPROMAX_OPENCL_FILTER) += vf_gopromax_opencl.o opencl.o 
\
+opencl/gopromax.o framesync.o
 OBJS-$(CONFIG_W3FDIF_FILTER) += vf_w3fdif.o
 OBJS-$(CONFIG_WAVEFORM_FILTER)   += vf_waveform.o
 OBJS-$(CONFIG_WEAVE_FILTER)  += vf_weave.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 87c3661cf4..5a0d10fcd0 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -456,6 +456,7 @@ extern const AVFilter ff_vf_vignette;
 extern const AVFilter ff_vf_vmafmotion;
 extern const AVFilter ff_vf_vpp_qsv;
 extern const AVFilter ff_vf_vstack;
+extern const AVFilter ff_vf_gopromax_opencl;
 extern const AVFilter ff_vf_w3fdif;
 extern const AVFilter ff_vf_waveform;
 extern const AVFilter ff_vf_weave;
diff --git a/libavfilter/opencl/gopromax.cl b/libavfilter/opencl/gopromax.cl
new file mode 100644
index 00..adea5d8677
--- /dev/null
+++ b/libavfilter/opencl/gopromax.cl
@@ -0,0 +1,305 @@
+/*
+ * Copyright (c) 2021 Ronan LE MEILLAT
+ *
+ * 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
+ */
+
+#define OVERLAP 64
+#define CUT 688
+#define BASESIZE 4096 //OVERLAP and CUT are based on this size
+
+
+#define FOV 360.0f
+enum Faces {
+TOP_LEFT,
+TOP_MIDDLE,
+TOP_RIGHT,
+BOTTOM_LEFT,
+BOTTOM_MIDDLE,
+BOTTOM_RIGHT,
+NB_FACES,
+};
+
+enum Direction {
+RIGHT,
+LEFT,
+UP,
+DOWN,
+FRONT,
+BACK,
+NB_DIRECTIONS,
+};
+
+enum Rotation {
+ROT_0,
+ROT_90,
+ROT_180,
+ROT