Re: [FFmpeg-devel] [PATCH v2] avformat/movenc: properly handle cover image codecs

2018-06-02 Thread Michael Niedermayer
On Sat, Jun 02, 2018 at 03:35:33AM +0300, Timo Teras wrote:
> On Sat, 2 Jun 2018 02:15:29 +0300
> Timo Teras  wrote:
> 
> > On Sat, 2 Jun 2018 00:46:30 +0200
> > Michael Niedermayer  wrote:
> > 
> > > input can be found here:
> > > https://guiltyfeminist.libsyn.com/97-repeal-the-eighth-with-helen-linehan 
> > >  
> > 
> > This has been broken all time, I think. It'll work correct with the
> > patch if you add "-c copy" to preserve the cover image codecs.
> 
> Actually this file is more complicated. Seems theres:
>  - video track which the chapter track refers, so they are in fact
>timed chapter marker images. mov demux gives them out as:
>AV_DISPOSITION_ATTACHED_PIC | AV_DISPOSITION_TIMED_THUMBNAILS
>  - cover image in the metadata given out as
>AV_DISPOSITION_ATTACHED_PIC
> 
> As the original cover image just checks for AV_DISPOSITION_ATTACHED_PIC
> bit, it broke this by treating the AV_DISPOSITION_ATTACHED_PIC |
> AV_DISPOSITION_TIMED_THUMBNAILS streams as cover image too. Seems
> closer scrutiny is needed to the disposition bits.
> 
> I wonder if we should test ==AV_DISPOSITION_ATTACHED_PIC or check that
> specific set of bits match?
> 
> Though, I believe with the problem with this input file go away if we
> treat attached_pic|timed_thumbnail combo as before. In fact, after
> testing, then the conversion will just turn it to regular video track,
> and without the -t 1 will FAIL for other reasons. This is how pre-4.0
> works too with this input file.
> 
> Basically we just don't support properly muxing the
> AV_DISPOSITION_TIMED_THUMBNAILS streams currently, and thus the input
> file in question is not really handled right at all.
> 
> > I wonder what the right thing to do would be?
> > a) not auto-map any attached_pic video streams
> > b) make ffmpeg by default just copy (not transcode) attached_pic
> > c) allow AVOutputFormat to communicate default codec based on
> >disposition
> > d) have movenc ignore/warn about cover images in incorrect format
> > e) something else?
> 
> This question is still valid.

well, ultimatly
ffmpeg should act close to what a inteligent user expects.
For example a simple ffmpeg -i inputfile outputfile
should produce a outputfile that results in similar presentation as the input
when played.
In respect to AV_DISPOSITION_TIMED_THUMBNAILS, one may expect that
concatenation of files each with a single AV_DISPOSITION_ATTACHED_PIC
would be converted to AV_DISPOSITION_TIMED_THUMBNAILS.

behavior should be logic, predictable, simple. A user should be
able to predict what ffmpeg will do so she can adjust parameters without
much trial and error.
It may be good to minimize the amount of exceptions for how streams are
handled.

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


[FFmpeg-devel] [PATCH] libavfilter/opencl.h: Add macro for setting opencl kernel arguments

2018-06-02 Thread Danil Iashchenko
---
 libavfilter/opencl.h| 13 +++
 libavfilter/vf_convolution_opencl.c | 43 ++---
 2 files changed, 19 insertions(+), 37 deletions(-)

diff --git a/libavfilter/opencl.h b/libavfilter/opencl.h
index c0a4519..16cdfbe 100644
--- a/libavfilter/opencl.h
+++ b/libavfilter/opencl.h
@@ -46,6 +46,19 @@ typedef struct OpenCLFilterContext {
 intoutput_height;
 } OpenCLFilterContext;
 
+
+/**
+ * set argument to specific Kernel.
+ * This macro relies on usage of local label "fail" and variable avctx.
+ */
+#define CL_SET_KERNEL_ARG(kernel, arg_num, type, arg)  \
+cle = clSetKernelArg(kernel, arg_num, sizeof(type), arg);  \
+if (cle != CL_SUCCESS) {   \
+av_log(avctx, AV_LOG_ERROR, "Failed to set kernel' "   \
+   "%d argument. Error code:%d.\n", arg_num, cle); \
+goto fail; \
+}  \
+
 /**
  * Return that all inputs and outputs support only AV_PIX_FMT_OPENCL.
  */
diff --git a/libavfilter/vf_convolution_opencl.c 
b/libavfilter/vf_convolution_opencl.c
index 2df51e0..4d0ecf8 100644
--- a/libavfilter/vf_convolution_opencl.c
+++ b/libavfilter/vf_convolution_opencl.c
@@ -204,43 +204,12 @@ static int convolution_opencl_filter_frame(AVFilterLink 
*inlink, AVFrame *input)
 if (!dst)
 break;
 
-cle = clSetKernelArg(ctx->kernel, 0, sizeof(cl_mem), );
-if (cle != CL_SUCCESS) {
-av_log(avctx, AV_LOG_ERROR, "Failed to set kernel "
-   "destination image argument: %d.\n", cle);
-goto fail;
-}
-cle = clSetKernelArg(ctx->kernel, 1, sizeof(cl_mem), );
-if (cle != CL_SUCCESS) {
-av_log(avctx, AV_LOG_ERROR, "Failed to set kernel "
-   "source image argument: %d.\n", cle);
-goto fail;
-}
-cle = clSetKernelArg(ctx->kernel, 2, sizeof(cl_int), >dims[p]);
-if (cle != CL_SUCCESS) {
-av_log(avctx, AV_LOG_ERROR, "Failed to set kernel "
-   "matrix size argument: %d.\n", cle);
-goto fail;
-}
-cle = clSetKernelArg(ctx->kernel, 3, sizeof(cl_mem), >matrix[p]);
-if (cle != CL_SUCCESS) {
-av_log(avctx, AV_LOG_ERROR, "Failed to set kernel "
-   "matrix argument: %d.\n", cle);
-goto fail;
-}
-cle = clSetKernelArg(ctx->kernel, 4, sizeof(cl_float), >rdivs[p]);
-if (cle != CL_SUCCESS) {
-av_log(avctx, AV_LOG_ERROR, "Failed to set kernel "
-   "rdiv argument: %d.\n", cle);
-goto fail;
-}
-cle = clSetKernelArg(ctx->kernel, 5, sizeof(cl_float), 
>biases[p]);
-if (cle != CL_SUCCESS) {
-av_log(avctx, AV_LOG_ERROR, "Failed to set kernel "
-   "bias argument: %d.\n", cle);
-goto fail;
-}
-
+CL_SET_KERNEL_ARG(ctx->kernel, 0, cl_mem,   );
+CL_SET_KERNEL_ARG(ctx->kernel, 1, cl_mem,   );
+CL_SET_KERNEL_ARG(ctx->kernel, 2, cl_int,   >dims[p]);
+CL_SET_KERNEL_ARG(ctx->kernel, 3, cl_mem,   >matrix[p]);
+CL_SET_KERNEL_ARG(ctx->kernel, 4, cl_float, >rdivs[p]);
+CL_SET_KERNEL_ARG(ctx->kernel, 5, cl_float, >biases[p]);
 
 err = ff_opencl_filter_work_size_from_image(avctx, global_work, 
output, p, 0);
 if (err < 0)
-- 
2.7.4

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


[FFmpeg-devel] [PATCH] lavfi/Makefile: move dnn_*.o under vf_srcnn

2018-06-02 Thread Jan Ekström
These files depend on libavformat, and the vf_srcnn filter
currently is the only thing utilizing these dnn_* files and
already happens to have a dependency on libavformat.

This fixes compilation in cases where libavformat is not a
dependency for libavfilter.

Reported by Kam_ on IRC.
---
 libavfilter/Makefile | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 5bacd5b621..4303e80097 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -12,8 +12,6 @@ OBJS = allfilters.o   
  \
avfiltergraph.o  \
buffersink.o \
buffersrc.o  \
-   dnn_interface.o  \
-   dnn_backend_native.o \
drawutils.o  \
fifo.o   \
formats.o\
@@ -338,7 +336,7 @@ OBJS-$(CONFIG_SMARTBLUR_FILTER)  += 
vf_smartblur.o
 OBJS-$(CONFIG_SOBEL_FILTER)  += vf_convolution.o
 OBJS-$(CONFIG_SPLIT_FILTER)  += split.o
 OBJS-$(CONFIG_SPP_FILTER)+= vf_spp.o
-OBJS-$(CONFIG_SRCNN_FILTER)  += vf_srcnn.o
+OBJS-$(CONFIG_SRCNN_FILTER)  += vf_srcnn.o dnn_interface.o 
dnn_backend_native.o
 OBJS-$(CONFIG_SSIM_FILTER)   += vf_ssim.o framesync.o
 OBJS-$(CONFIG_STEREO3D_FILTER)   += vf_stereo3d.o
 OBJS-$(CONFIG_STREAMSELECT_FILTER)   += f_streamselect.o framesync.o
-- 
2.17.1

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


Re: [FFmpeg-devel] [GSOC] [PATCH] TensorFlow backend introduction for DNN module

2018-06-02 Thread James Almer
On 5/31/2018 12:01 PM, Sergey Lavrushkin wrote:
> diff --git a/Changelog b/Changelog
> index df2024fb59..a667fd045d 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -11,6 +11,7 @@ version :
>  - support mbedTLS based TLS
>  - DNN inference interface
>  - Reimplemented SRCNN filter using DNN inference interface
> +- TensorFlow DNN backend

This and the two entries you added earlier don't really belong here.
It's enough with the line stating the filter was introduced back in
ffmpeg 4.0

>  
>  
>  version 4.0:
> diff --git a/configure b/configure
> index 09ff0c55e2..47e21fec39 100755
> --- a/configure
> +++ b/configure
> @@ -259,6 +259,7 @@ External library support:
>--enable-libspeexenable Speex de/encoding via libspeex [no]
>--enable-libsrt  enable Haivision SRT protocol via libsrt [no]
>--enable-libssh  enable SFTP protocol via libssh [no]
> +  --enable-libtensorflow   enable TensorFlow as a DNN module backend [no]

Maybe mention it's for the srcnn filter.

>--enable-libtesseractenable Tesseract, needed for ocr filter [no]
>--enable-libtheora   enable Theora encoding via libtheora [no]
>--enable-libtls  enable LibreSSL (via libtls), needed for https 
> support
> @@ -1713,6 +1714,7 @@ EXTERNAL_LIBRARY_LIST="
>  libspeex
>  libsrt
>  libssh
> +libtensorflow
>  libtesseract
>  libtheora
>  libtwolame
> @@ -3453,7 +3455,7 @@ avcodec_select="null_bsf"
>  avdevice_deps="avformat avcodec avutil"
>  avdevice_suggest="libm"
>  avfilter_deps="avutil"
> -avfilter_suggest="libm"
> +avfilter_suggest="libm libtensorflow"

Add instead

srcnn_filter_suggest="libtensorflow"

To the corresponding section.

>  avformat_deps="avcodec avutil"
>  avformat_suggest="libm network zlib"
>  avresample_deps="avutil"
> @@ -6055,6 +6057,7 @@ enabled libsoxr   && require libsoxr soxr.h 
> soxr_create -lsoxr
>  enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h 
> sftp_init
>  enabled libspeex  && require_pkg_config libspeex speex speex/speex.h 
> speex_decoder_init
>  enabled libsrt&& require_pkg_config libsrt "srt >= 1.2.0" 
> srt/srt.h srt_socket
> +enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h 
> TF_Version -ltensorflow && add_cflags -DTENSORFLOW_BACKEND

Superfluous define. Just check for CONFIG_LIBTENSORFLOW instead.

>  enabled libtesseract  && require_pkg_config libtesseract tesseract 
> tesseract/capi.h TessBaseAPICreate
>  enabled libtheora && require libtheora theora/theoraenc.h 
> th_info_init -ltheoraenc -ltheoradec -logg
>  enabled libtls&& require_pkg_config libtls libtls tls.h 
> tls_configure
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index 3201cbeacf..82915e2f75 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -14,6 +14,7 @@ OBJS = allfilters.o 
> \
> buffersrc.o  \
> dnn_interface.o  \
> dnn_backend_native.o \
> +   dnn_backend_tf.o \

See Jan Ekström's patch. Add this to the filter's entry as all these
source files should not be compiled unconditionally.

> drawutils.o  \
> fifo.o   \
> formats.o\


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


Re: [FFmpeg-devel] [PATCH] doc/ffmpeg - rewrite Stream Selection chapter

2018-06-02 Thread Gyan Doshi



On 01-06-2018 01:16 PM, Gyan Doshi wrote:

I'm fairly confident it will since @subheading also works online for 
developer.html, but not locally. However, this shouldn't be blocking 
your patch since it is an independent issue.


Ok. Will push in a day or so.

Thanks,
Gyan


Revised and pushed.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavfi/Makefile: move dnn_*.o under vf_srcnn

2018-06-02 Thread Jan Ekström
On Sat, Jun 2, 2018 at 7:07 PM, Jan Ekström  wrote:
> These files depend on libavformat, and the vf_srcnn filter
> currently is the only thing utilizing these dnn_* files and
> already happens to have a dependency on libavformat.
>
> This fixes compilation in cases where libavformat is not a
> dependency for libavfilter.
>
> Reported by Kam_ on IRC.
> ---

Got two LGTMs on IRC, pushed to master.

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


Re: [FFmpeg-devel] Evolution of lavfi's design and API

2018-06-02 Thread Paul B Mahol
On 5/2/18, Paul B Mahol  wrote:
> On 9/11/16, Paul B Mahol  wrote:
>> On 9/10/16, Nicolas George  wrote:
>>> Le quartidi 24 fructidor, an CCXXIV, Paul B Mahol a ecrit :
 So everybody agrees, we should proceed.
>>>
>>> I am proceeding, but as you can see in the patch, there is still a fair
>>> amount of work to be done. Still, people can help if they want to speed
>>> things up, especially since a significant part of the work is design
>>> decisions that I can not do alone and will need to be discussed.
>>>
>>> What needs to be done (using this mail as a notepad, but including the
>>> tasks
>>> where help is required):
>>>
>>> - Finish documenting the scheduling and make sure the implementation
>>> matches
>>>   the documentation.
>>>
>>> - Discuss if "private_fields.h" is acceptable or decide another
>>> solution.
>>>
>>> - Clearly identify and isolate the parts of the scheduling that are
>>> needed
>>>   only for request_frame()/request_frame() compatibility.
>>>
>>> - Decide exactly what parts of the scheduling are the responsibility of
>>>   filters (possibly in the compatibility activate function) and what
>>> parts
>>>   are handled by the framework.
>>>
>>> - Think ahead about threading and use wrapper to access fields that will
>>>   require locking or synchronization.
>>>
>>> - Think about features whose need I realized while trying to get it
>>> working:
>>>   distinguish productive / processing activation, synchronize several
>>> filter
>>>   graphs.
>>>
>>> Please feel free to ask details about any of these points: not only
>>> would
>>> getting interest help me stay motivated, but discussing implementation
>>> details and explaining the design would help me having a clear idea of
>>> the
>>> whole system.
>>
>> For start removal of recursiveness is mostly I'm interested in.
>> What needs to be done for that, can I help somehow?
>>
>
> Hi,
>
> So what's remain to be done to have frame threading in lavfi?
>

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


Re: [FFmpeg-devel] [GSOC] [PATCH] TensorFlow backend introduction for DNN module

2018-06-02 Thread James Almer
On 6/2/2018 3:45 PM, Sergey Lavrushkin wrote:
> 2018-06-02 19:45 GMT+03:00 James Almer  >:
> 
> On 5/31/2018 12:01 PM, Sergey Lavrushkin wrote:
> > diff --git a/Changelog b/Changelog
> > index df2024fb59..a667fd045d 100644
> > --- a/Changelog
> > +++ b/Changelog
> > @@ -11,6 +11,7 @@ version :
> >  - support mbedTLS based TLS
> >  - DNN inference interface
> >  - Reimplemented SRCNN filter using DNN inference interface
> > +- TensorFlow DNN backend
> 
> This and the two entries you added earlier don't really belong here.
> It's enough with the line stating the filter was introduced back in
> ffmpeg 4.0
> 
> 
> I should not add any line regarding introduced DNN inference module,
> that can be usefull for someone writing another filter based on DNN?

Changelog lists the newly added features of interest to users, not
developers. When the CBS framework was added it wasn't mentioned here
either, only the filters making use of it.

Users don't care that the scrnn filter was reimplemented using this new
framework, but are however interested to know that the filter was added,
or at most if its features were considerably expanded.
So based on that, I guess it's acceptable to add a line in this patch like

- libtensorflow backend for DNN based filters like srcnn.

Or similar. But the earlier two entries don't belong here.

>  
> 
> > 
> > 
> >  version 4.0:
> > diff --git a/configure b/configure
> > index 09ff0c55e2..47e21fec39 100755
> > --- a/configure
> > +++ b/configure
> > @@ -259,6 +259,7 @@ External library support:
> >    --enable-libspeex        enable Speex de/encoding via libspeex [no]
> >    --enable-libsrt          enable Haivision SRT protocol via
> libsrt [no]
> >    --enable-libssh          enable SFTP protocol via libssh [no]
> > +  --enable-libtensorflow   enable TensorFlow as a DNN module
> backend [no]
> 
> Maybe mention it's for the srcnn filter.
> 
> >    --enable-libtesseract    enable Tesseract, needed for ocr
> filter [no]
> >    --enable-libtheora       enable Theora encoding via libtheora [no]
> >    --enable-libtls          enable LibreSSL (via libtls), needed
> for https support
> > @@ -1713,6 +1714,7 @@ EXTERNAL_LIBRARY_LIST="
> >      libspeex
> >      libsrt
> >      libssh
> > +    libtensorflow
> >      libtesseract
> >      libtheora
> >      libtwolame
> > @@ -3453,7 +3455,7 @@ avcodec_select="null_bsf"
> >  avdevice_deps="avformat avcodec avutil"
> >  avdevice_suggest="libm"
> >  avfilter_deps="avutil"
> > -avfilter_suggest="libm"
> > +avfilter_suggest="libm libtensorflow"
> 
> Add instead
> 
> srcnn_filter_suggest="libtensorflow"
> 
> To the corresponding section.
> 
> 
> But this DNN inference module can be used for other filters.
> At least, I think, that after training more complicated models for super
> resolution I'll have to add them as separate filters.
> So, I thought, this module shouldn't be a part of srcnn filter from the
> begining.
> Or is it better to add  *_filter_suggest="libtensorflow" to the
> configure script and  
> dnn_*.o to the Makefile for every new filter based on this module? 

Yes. If it's a non public framework/API used by one or more modules that
can be disabled (as is the case with filters) then it should be added to
the list of object dependencies for each of those optional modules. See
framesync.o for another example of this.

That being said, another way to implement this is making DNN its own
independent module in configure, like for example cbs, fft and many
others. This way, configure would look something like

dnn_suggest="libtensorflow"
srcnn_filter_select="dnn"

With dnn being an entry added to the CONFIG_EXTRA list.

Then in libavfilter/Makefile you'd do

OBJS-$(CONFIG_DNN) += dnn_interface.o dnn_backend_native.o dnn_backend_tf.o

Or even better, something like

DNN-OBJS-$(CONFIG_LIBTENSORFLOW) += dnn_backend_tf.o
OBJS-$(CONFIG_DNN) += dnn_interface.o dnn_backend_native.o $(DNN-OBJS-yes)

Which would allow you to remove the #if preprocessor check in
dnn_backend_tf.c, as it will only be compiled when both libtensorflow
and at least one filter using dnn are enabled.

The reason for all this is to have everything as modular as possible,
reducing compiled objects and dependencies (like lavfi linking to lavf)
to exactly what's strictly needed.

>  
> 
> >  avformat_deps="avcodec avutil"
> >  avformat_suggest="libm network zlib"
> >  avresample_deps="avutil"
> > @@ -6055,6 +6057,7 @@ enabled libsoxr           && require libsoxr
> soxr.h soxr_create -lsoxr
> >  enabled libssh            && require_pkg_config libssh libssh
> libssh/sftp.h sftp_init
> >  enabled libspeex          && require_pkg_config libspeex speex
> speex/speex.h speex_decoder_init
> >  enabled libsrt            && 

Re: [FFmpeg-devel] [GSOC] [PATCH] TensorFlow backend introduction for DNN module

2018-06-02 Thread Sergey Lavrushkin
2018-06-02 19:45 GMT+03:00 James Almer :

> On 5/31/2018 12:01 PM, Sergey Lavrushkin wrote:
> > diff --git a/Changelog b/Changelog
> > index df2024fb59..a667fd045d 100644
> > --- a/Changelog
> > +++ b/Changelog
> > @@ -11,6 +11,7 @@ version :
> >  - support mbedTLS based TLS
> >  - DNN inference interface
> >  - Reimplemented SRCNN filter using DNN inference interface
> > +- TensorFlow DNN backend
>
> This and the two entries you added earlier don't really belong here.
> It's enough with the line stating the filter was introduced back in
> ffmpeg 4.0
>

I should not add any line regarding introduced DNN inference module,
that can be usefull for someone writing another filter based on DNN?


> >
> >
> >  version 4.0:
> > diff --git a/configure b/configure
> > index 09ff0c55e2..47e21fec39 100755
> > --- a/configure
> > +++ b/configure
> > @@ -259,6 +259,7 @@ External library support:
> >--enable-libspeexenable Speex de/encoding via libspeex [no]
> >--enable-libsrt  enable Haivision SRT protocol via libsrt [no]
> >--enable-libssh  enable SFTP protocol via libssh [no]
> > +  --enable-libtensorflow   enable TensorFlow as a DNN module backend
> [no]
>
> Maybe mention it's for the srcnn filter.
>
> >--enable-libtesseractenable Tesseract, needed for ocr filter [no]
> >--enable-libtheora   enable Theora encoding via libtheora [no]
> >--enable-libtls  enable LibreSSL (via libtls), needed for
> https support
> > @@ -1713,6 +1714,7 @@ EXTERNAL_LIBRARY_LIST="
> >  libspeex
> >  libsrt
> >  libssh
> > +libtensorflow
> >  libtesseract
> >  libtheora
> >  libtwolame
> > @@ -3453,7 +3455,7 @@ avcodec_select="null_bsf"
> >  avdevice_deps="avformat avcodec avutil"
> >  avdevice_suggest="libm"
> >  avfilter_deps="avutil"
> > -avfilter_suggest="libm"
> > +avfilter_suggest="libm libtensorflow"
>
> Add instead
>
> srcnn_filter_suggest="libtensorflow"
>
> To the corresponding section.
>

But this DNN inference module can be used for other filters.
At least, I think, that after training more complicated models for super
resolution I'll have to add them as separate filters.
So, I thought, this module shouldn't be a part of srcnn filter from the
begining.
Or is it better to add  *_filter_suggest="libtensorflow" to the configure
script and
dnn_*.o to the Makefile for every new filter based on this module?


> >  avformat_deps="avcodec avutil"
> >  avformat_suggest="libm network zlib"
> >  avresample_deps="avutil"
> > @@ -6055,6 +6057,7 @@ enabled libsoxr   && require libsoxr
> soxr.h soxr_create -lsoxr
> >  enabled libssh&& require_pkg_config libssh libssh
> libssh/sftp.h sftp_init
> >  enabled libspeex  && require_pkg_config libspeex speex
> speex/speex.h speex_decoder_init
> >  enabled libsrt&& require_pkg_config libsrt "srt >= 1.2.0"
> srt/srt.h srt_socket
> > +enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h
> TF_Version -ltensorflow && add_cflags -DTENSORFLOW_BACKEND
>
> Superfluous define. Just check for CONFIG_LIBTENSORFLOW instead.
>
> >  enabled libtesseract  && require_pkg_config libtesseract tesseract
> tesseract/capi.h TessBaseAPICreate
> >  enabled libtheora && require libtheora theora/theoraenc.h
> th_info_init -ltheoraenc -ltheoradec -logg
> >  enabled libtls&& require_pkg_config libtls libtls tls.h
> tls_configure
> > diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> > index 3201cbeacf..82915e2f75 100644
> > --- a/libavfilter/Makefile
> > +++ b/libavfilter/Makefile
> > @@ -14,6 +14,7 @@ OBJS = allfilters.o
>  \
> > buffersrc.o
> \
> > dnn_interface.o
> \
> > dnn_backend_native.o
>  \
> > +   dnn_backend_tf.o
>  \
>
> See Jan Ekström's patch. Add this to the filter's entry as all these
> source files should not be compiled unconditionally.
>
> > drawutils.o
> \
> > fifo.o
>  \
> > formats.o
> \
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v2 1/4] lavu/hwcontext_opecl: fix the build warning

2018-06-02 Thread Jun Zhao
fix the build warning when use Portable Computing Language (pocl).

Signed-off-by: Jun Zhao 
---
 libavutil/hwcontext_opencl.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c
index 43b5c5a..9ecc361 100644
--- a/libavutil/hwcontext_opencl.c
+++ b/libavutil/hwcontext_opencl.c
@@ -2809,7 +2809,11 @@ static int opencl_map_from(AVHWFramesContext *hwfc, 
AVFrame *dst,
 static int opencl_map_to(AVHWFramesContext *hwfc, AVFrame *dst,
  const AVFrame *src, int flags)
 {
+#if HAVE_OPENCL_DRM_BEIGNET || HAVE_OPENCL_VAAPI_BEIGNET || \
+HAVE_OPENCL_VAAPI_INTEL_MEDIA || HAVE_OPENCL_DXVA2 || \
+HAVE_OPENCL_D3D11 || HAVE_OPENCL_DRM_ARM
 OpenCLDeviceContext *priv = hwfc->device_ctx->internal->priv;
+#endif
 av_assert0(dst->format == AV_PIX_FMT_OPENCL);
 switch (src->format) {
 #if HAVE_OPENCL_DRM_BEIGNET
@@ -2850,7 +2854,11 @@ static int opencl_map_to(AVHWFramesContext *hwfc, 
AVFrame *dst,
 static int opencl_frames_derive_to(AVHWFramesContext *dst_fc,
AVHWFramesContext *src_fc, int flags)
 {
+#if HAVE_OPENCL_DRM_BEIGNET || HAVE_OPENCL_VAAPI_BEIGNET || \
+HAVE_OPENCL_VAAPI_INTEL_MEDIA || HAVE_OPENCL_DXVA2 || \
+HAVE_OPENCL_D3D11 || HAVE_OPENCL_DRM_ARM
 OpenCLDeviceContext *priv = dst_fc->device_ctx->internal->priv;
+#endif
 switch (src_fc->device_ctx->type) {
 #if HAVE_OPENCL_DRM_BEIGNET
 case AV_HWDEVICE_TYPE_DRM:
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v2 3/4] configure: fix check for opencl

2018-06-02 Thread Jun Zhao
add pkg-config support for opencl check.

Signed-off-by: Jun Zhao 
---
 configure | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure b/configure
index 22eeca2..69b8827 100755
--- a/configure
+++ b/configure
@@ -6130,6 +6130,7 @@ enabled openal&& { { for al_extralibs in 
"${OPENAL_LIBS}" "-lopenal"
die "ERROR: openal must be installed and 
version must be 1.1 or compatible"; }
 enabled opencl&& { check_lib opencl OpenCL/cl.h 
clEnqueueNDRangeKernel -Wl,-framework,OpenCL ||
check_lib opencl CL/cl.h clEnqueueNDRangeKernel 
-lOpenCL ||
+   check_pkg_config opencl OpenCL CL/cl.h 
clEnqueueNDRangeKernel -lOpenCL ||
die "ERROR: opencl not found"; } &&
  { test_cpp_condition "OpenCL/cl.h" 
"defined(CL_VERSION_1_2)" ||
test_cpp_condition "CL/cl.h" 
"defined(CL_VERSION_1_2)" ||
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v2 0/4] opencl misc clean

2018-06-02 Thread Jun Zhao
v2: - change the pkg-change support as James Almer's review.
- split libmfx and opencl_vaapi_intel_media.

Jun Zhao (4):
  lavu/hwcontext_opecl: fix the build warning
  lavfi/opencl: remove redundancy header.
  configure: fix check for opencl
  configure: fix check for opencl_vaapi_intel_media.

 configure| 7 +++
 libavfilter/opencl.c | 3 ---
 libavutil/hwcontext_opencl.c | 8 
 3 files changed, 11 insertions(+), 7 deletions(-)

-- 
2.7.4

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


[FFmpeg-devel] [PATCH v2 2/4] lavfi/opencl: remove redundancy header.

2018-06-02 Thread Jun Zhao
remove redundancy header

Signed-off-by: Jun Zhao 
---
 libavfilter/opencl.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/libavfilter/opencl.c b/libavfilter/opencl.c
index ae61667..ac5eec6 100644
--- a/libavfilter/opencl.c
+++ b/libavfilter/opencl.c
@@ -19,12 +19,9 @@
 #include 
 #include 
 
-#include "libavutil/hwcontext.h"
-#include "libavutil/hwcontext_opencl.h"
 #include "libavutil/mem.h"
 #include "libavutil/pixdesc.h"
 
-#include "avfilter.h"
 #include "formats.h"
 #include "opencl.h"
 
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v2 4/4] configure: fix check for opencl_vaapi_intel_media.

2018-06-02 Thread Jun Zhao
opencl_vaapi_intel_media doesn't depend on libmfx, OpenCL™ Drivers
and Runtimes for Intel® Architectureis is a standalone release, more
information can be found in the link:
https://software.intel.com/en-us/articles/opencl-drivers.

Signed-off-by: Jun Zhao 
---
 configure | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index 69b8827..b8b879c 100755
--- a/configure
+++ b/configure
@@ -6326,10 +6326,8 @@ fi
 
 if enabled_all opencl vaapi ; then
 enabled opencl_drm_beignet && enable opencl_vaapi_beignet
-if enabled libmfx ; then
-check_type "CL/cl.h CL/va_ext.h" 
"clCreateFromVA_APIMediaSurfaceINTEL_fn" &&
-enable opencl_vaapi_intel_media
-fi
+check_type "CL/cl.h CL/va_ext.h" "clCreateFromVA_APIMediaSurfaceINTEL_fn" 
&&
+enable opencl_vaapi_intel_media
 fi
 
 if enabled_all opencl dxva2 ; then
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v3 1/4] lavu/hwcontext_opecl: fix the build warning

2018-06-02 Thread Jun Zhao
fix the build warning when use Portable Computing Language (pocl).

Signed-off-by: Jun Zhao 
---
 libavutil/hwcontext_opencl.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c
index 43b5c5a..9ecc361 100644
--- a/libavutil/hwcontext_opencl.c
+++ b/libavutil/hwcontext_opencl.c
@@ -2809,7 +2809,11 @@ static int opencl_map_from(AVHWFramesContext *hwfc, 
AVFrame *dst,
 static int opencl_map_to(AVHWFramesContext *hwfc, AVFrame *dst,
  const AVFrame *src, int flags)
 {
+#if HAVE_OPENCL_DRM_BEIGNET || HAVE_OPENCL_VAAPI_BEIGNET || \
+HAVE_OPENCL_VAAPI_INTEL_MEDIA || HAVE_OPENCL_DXVA2 || \
+HAVE_OPENCL_D3D11 || HAVE_OPENCL_DRM_ARM
 OpenCLDeviceContext *priv = hwfc->device_ctx->internal->priv;
+#endif
 av_assert0(dst->format == AV_PIX_FMT_OPENCL);
 switch (src->format) {
 #if HAVE_OPENCL_DRM_BEIGNET
@@ -2850,7 +2854,11 @@ static int opencl_map_to(AVHWFramesContext *hwfc, 
AVFrame *dst,
 static int opencl_frames_derive_to(AVHWFramesContext *dst_fc,
AVHWFramesContext *src_fc, int flags)
 {
+#if HAVE_OPENCL_DRM_BEIGNET || HAVE_OPENCL_VAAPI_BEIGNET || \
+HAVE_OPENCL_VAAPI_INTEL_MEDIA || HAVE_OPENCL_DXVA2 || \
+HAVE_OPENCL_D3D11 || HAVE_OPENCL_DRM_ARM
 OpenCLDeviceContext *priv = dst_fc->device_ctx->internal->priv;
+#endif
 switch (src_fc->device_ctx->type) {
 #if HAVE_OPENCL_DRM_BEIGNET
 case AV_HWDEVICE_TYPE_DRM:
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v3 2/4] lavfi/opencl: remove redundancy header.

2018-06-02 Thread Jun Zhao
remove redundancy header

Signed-off-by: Jun Zhao 
---
 libavfilter/opencl.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/libavfilter/opencl.c b/libavfilter/opencl.c
index ae61667..ac5eec6 100644
--- a/libavfilter/opencl.c
+++ b/libavfilter/opencl.c
@@ -19,12 +19,9 @@
 #include 
 #include 
 
-#include "libavutil/hwcontext.h"
-#include "libavutil/hwcontext_opencl.h"
 #include "libavutil/mem.h"
 #include "libavutil/pixdesc.h"
 
-#include "avfilter.h"
 #include "formats.h"
 #include "opencl.h"
 
-- 
2.7.4

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


Re: [FFmpeg-devel] [PATCH v2 3/4] configure: fix check for opencl

2018-06-02 Thread James Almer
On 6/2/2018 11:58 PM, Jun Zhao wrote:
> add pkg-config support for opencl check.
> 
> Signed-off-by: Jun Zhao 
> ---
>  configure | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/configure b/configure
> index 22eeca2..69b8827 100755
> --- a/configure
> +++ b/configure
> @@ -6130,6 +6130,7 @@ enabled openal&& { { for al_extralibs in 
> "${OPENAL_LIBS}" "-lopenal"
> die "ERROR: openal must be installed and 
> version must be 1.1 or compatible"; }
>  enabled opencl&& { check_lib opencl OpenCL/cl.h 
> clEnqueueNDRangeKernel -Wl,-framework,OpenCL ||
> check_lib opencl CL/cl.h 
> clEnqueueNDRangeKernel -lOpenCL ||
> +   check_pkg_config opencl OpenCL CL/cl.h 
> clEnqueueNDRangeKernel -lOpenCL ||

Seeing this is exactly the same as last time and judging by your comment
in 0/4, I assume you sent the wrong patch.

> die "ERROR: opencl not found"; } &&
>   { test_cpp_condition "OpenCL/cl.h" 
> "defined(CL_VERSION_1_2)" ||
> test_cpp_condition "CL/cl.h" 
> "defined(CL_VERSION_1_2)" ||
> 

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


[FFmpeg-devel] [PATCH v3 3/4] configure: fix check for opencl

2018-06-02 Thread Jun Zhao
add pkg-config support for opencl check.

Signed-off-by: Jun Zhao 
---
 configure | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 22eeca2..ede32eb 100755
--- a/configure
+++ b/configure
@@ -6128,7 +6128,8 @@ enabled openal&& { { for al_extralibs in 
"${OPENAL_LIBS}" "-lopenal"
die "ERROR: openal not found"; } &&
  { test_cpp_condition "AL/al.h" 
"defined(AL_VERSION_1_1)" ||
die "ERROR: openal must be installed and 
version must be 1.1 or compatible"; }
-enabled opencl&& { check_lib opencl OpenCL/cl.h 
clEnqueueNDRangeKernel -Wl,-framework,OpenCL ||
+enabled opencl&& { check_pkg_config opencl OpenCL CL/cl.h 
clEnqueueNDRangeKernel ||
+   check_lib opencl OpenCL/cl.h 
clEnqueueNDRangeKernel -Wl,-framework,OpenCL ||
check_lib opencl CL/cl.h clEnqueueNDRangeKernel 
-lOpenCL ||
die "ERROR: opencl not found"; } &&
  { test_cpp_condition "OpenCL/cl.h" 
"defined(CL_VERSION_1_2)" ||
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v3 4/4] configure: fix check for opencl_vaapi_intel_media.

2018-06-02 Thread Jun Zhao
opencl_vaapi_intel_media doesn't depend on libmfx, OpenCL™ Drivers
and Runtimes for Intel® Architectureis is a standalone release, more
information can be found in the link:
https://software.intel.com/en-us/articles/opencl-drivers.

Signed-off-by: Jun Zhao 
---
 configure| 6 ++
 libavutil/hwcontext_opencl.c | 7 ++-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index ede32eb..aa17c13 100755
--- a/configure
+++ b/configure
@@ -6326,10 +6326,8 @@ fi
 
 if enabled_all opencl vaapi ; then
 enabled opencl_drm_beignet && enable opencl_vaapi_beignet
-if enabled libmfx ; then
-check_type "CL/cl.h CL/va_ext.h" 
"clCreateFromVA_APIMediaSurfaceINTEL_fn" &&
-enable opencl_vaapi_intel_media
-fi
+check_type "CL/cl.h CL/va_ext.h" "clCreateFromVA_APIMediaSurfaceINTEL_fn" 
&&
+enable opencl_vaapi_intel_media
 fi
 
 if enabled_all opencl dxva2 ; then
diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c
index 9ecc361..f9b5ccc 100644
--- a/libavutil/hwcontext_opencl.c
+++ b/libavutil/hwcontext_opencl.c
@@ -46,7 +46,9 @@
 #endif
 
 #if HAVE_OPENCL_VAAPI_INTEL_MEDIA
+#if CONFIG_LIBMFX
 #include 
+#endif
 #include 
 #include 
 #include "hwcontext_vaapi.h"
@@ -2248,10 +2250,13 @@ static int opencl_map_from_qsv(AVHWFramesContext 
*dst_fc, AVFrame *dst,
 cl_int cle;
 int err, p;
 
+#if CONFIG_LIBMFX
 if (src->format == AV_PIX_FMT_QSV) {
 mfxFrameSurface1 *mfx_surface = (mfxFrameSurface1*)src->data[3];
 va_surface = *(VASurfaceID*)mfx_surface->Data.MemId;
-} else if (src->format == AV_PIX_FMT_VAAPI) {
+} else
+#endif
+if (src->format == AV_PIX_FMT_VAAPI) {
 va_surface = (VASurfaceID)(uintptr_t)src->data[3];
 } else {
 return AVERROR(ENOSYS);
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v3 0/4] opencl misc clean

2018-06-02 Thread Jun Zhao
v3: - Abandoned v2 patchset.
- Change the pkg-config check as James Almer's comments.
- Splite libmfx and opencl_vaapi_intel_media.

Jun Zhao (4):
  lavu/hwcontext_opecl: fix the build warning
  lavfi/opencl: remove redundancy header.
  configure: fix check for opencl
  configure: fix check for opencl_vaapi_intel_media.

 configure|  9 -
 libavfilter/opencl.c |  3 ---
 libavutil/hwcontext_opencl.c | 15 ++-
 3 files changed, 18 insertions(+), 9 deletions(-)

-- 
2.7.4

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


[FFmpeg-devel] [PATCH 2/2] avcodec/opus_silk: Change silk_lsf2lpc() slightly toward silk/NLSF2A.c

2018-06-02 Thread Michael Niedermayer
Fixes: runtime error: signed integer overflow: -1440457022 - 785819492 cannot 
be represented in type 'int'
Fixes: 
7700/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OPUS_fuzzer-6595838684954624

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

diff --git a/libavcodec/opus_silk.c b/libavcodec/opus_silk.c
index 344333cc18..2fcbf3b9d3 100644
--- a/libavcodec/opus_silk.c
+++ b/libavcodec/opus_silk.c
@@ -239,8 +239,10 @@ static void silk_lsf2lpc(const int16_t nlsf[16], float 
lpcf[16], int order)
 
 /* reconstruct A(z) */
 for (k = 0; k < order>>1; k++) {
-lpc32[k] = -p[k + 1] - p[k] - q[k + 1] + q[k];
-lpc32[order-k-1] = -p[k + 1] - p[k] + q[k + 1] - q[k];
+int32_t p_tmp = p[k + 1] + p[k];
+int32_t q_tmp = q[k + 1] - q[k];
+lpc32[k] = -q_tmp - p_tmp;
+lpc32[order-k-1] =  q_tmp - p_tmp;
 }
 
 /* limit the range of the LPC coefficients to each fit within an int16_t */
-- 
2.17.1

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


[FFmpeg-devel] [PATCH 1/2] avcodec/amrwbdec: Fix division by 0 in find_hb_gain()

2018-06-02 Thread Michael Niedermayer
This restructures the code slightly toward D_UTIL_dec_synthesis()

Fixes: 
7420/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AMRWB_fuzzer-6577305112543232

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

diff --git a/libavcodec/amrwbdec.c b/libavcodec/amrwbdec.c
index 7f2874d35f..47fe7eb55e 100644
--- a/libavcodec/amrwbdec.c
+++ b/libavcodec/amrwbdec.c
@@ -862,15 +862,20 @@ static float find_hb_gain(AMRWBContext *ctx, const float 
*synth,
 {
 int wsp = (vad > 0);
 float tilt;
+float tmp;
 
 if (ctx->fr_cur_mode == MODE_23k85)
 return qua_hb_gain[hb_idx] * (1.0f / (1 << 14));
 
-tilt = ctx->celpm_ctx.dot_productf(synth, synth + 1, AMRWB_SFR_SIZE - 1) /
-   ctx->celpm_ctx.dot_productf(synth, synth, AMRWB_SFR_SIZE);
+tmp = ctx->celpm_ctx.dot_productf(synth, synth + 1, AMRWB_SFR_SIZE - 1);
+
+if (tmp > 0) {
+tilt = tmp / ctx->celpm_ctx.dot_productf(synth, synth, AMRWB_SFR_SIZE);
+} else
+tilt = 0;
 
 /* return gain bounded by [0.1, 1.0] */
-return av_clipf((1.0 - FFMAX(0.0, tilt)) * (1.25 - 0.25 * wsp), 0.1, 1.0);
+return av_clipf((1.0 - tilt) * (1.25 - 0.25 * wsp), 0.1, 1.0);
 }
 
 /**
-- 
2.17.1

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