Re: [FFmpeg-devel] [PATCH] avfilter/firequalizer: add cubic_interpolate function on gain

2016-10-19 Thread Muhammad Faiz
On 10/18/16, Muhammad Faiz  wrote:
> smoother version of gain_interpolate
>
> Signed-off-by: Muhammad Faiz 
> ---
>  doc/filters.texi  |  2 ++
>  libavfilter/af_firequalizer.c | 49
> +--
>  2 files changed, 49 insertions(+), 2 deletions(-)
>

applied

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


Re: [FFmpeg-devel] [PATCH] lavf/mov: Add support for edit list parsing.

2016-10-19 Thread wm4
On Tue, 18 Oct 2016 13:08:07 -0700
Sasi Inguva  wrote:

> With the current state of code, we will only encounterdemuxer
> outputting non-monotonic DTS  when there are multiple edit lists . Avoiding
> non-monotonic DTS for mulitple edit lists will not be possible with how the
> edit list support is currently implemented. That would only be possible if
> the edit list support is implemented after the decode is done.
> 
> The only situation I see where things will break is if a file containing
> multiple edit lists is remuxed to another container , and we are not
> rewriting timestamps but passing through. In that case the av_write_frame
> will fail with non-monotonic DTS  provided.
> 
> However consider the alternative. We have demuxer giving monotonic DTS
> which does not at all correspond to the timeline that edit lists intend. We
> remux successfully, but we have generated a file with AVSync problems, and
> which plays wrong.
> 
> On Tue, Oct 18, 2016 at 7:31 AM, wm4  wrote:
> 
> > On Fri,  5 Aug 2016 17:18:39 -0700
> > Sasi Inguva  wrote:
> >  
> > > In YouTube we have long been receiving MOV files from users, which have  
> > non-trivial edit lists (Those edit lists which are not just used to offset
> > video start from audio start) and multiple edit lists. Recently the uploads
> > of such files has increased with the introduction of apps that allow video
> > editing and upload like Vine etc. mov.c in ffmpeg does not have edit list
> > parsing support i.e. the support for deciding what video/audio packets
> > should be output with what timestamps, based on edit lists. For this
> > reason, we had built a basic support for edit list parsing in our version
> > of ffmpeg, which fixes the AVIndexEntries built by mov_build_index by
> > looking at edit lists, and introduces new DISCARD flags in AVPacket and
> > AVFrame to signal to the decoder to discard certain packets.  
> > >
> > > For a while our edit list support was broken, as in it didn't properly  
> > work for multiple edit lists and it had problems with edit-lists ending on
> > B-frames. But we've fixed most of these issues in recent times, and we
> > think that now it is in a good enough condition so that it can be submitted
> > to HEAD. This will not only help the vast userbase of ffmepg, but will also
> > help us with staying up-to-date with ffmpeg and also by adding the power of
> > ffmpeg developer community to our MOV support. So here's a go at it.  
> > > What is supported:
> > >  - multiple edit lists
> > >  - edit lists ending on B-frames
> > >  - zero segment duration edit lists
> > >
> > > What is not supported:
> > >  - Changing the rate of playing with edit lists. We basically ignore  
> > MediaRate field of edit.  
> > >
> > > I have added fate tests too. Here is a no-sign-in required link to the  
> > test files https://drive.google.com/folderview?id=0Bz6XfEJZ-
> > 9N3R3o3QXNHUGRqbms&usp=sharing.
> >
> > This still makes demuxers output packets with _not_ strictly
> > monotonically increasing DTS timestamps. Please fix this - a demuxer
> > isn't supposed to do this, and it's completely broken.
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >  
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Certainly it could do something better than just returning e.g. the
same DTS for many packets.

I'm still amazed we merged this at all.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf/mov: Add support for edit list parsing.

2016-10-19 Thread Robert Krüger
On Tue, Oct 18, 2016 at 10:10 PM, Sasi Inguva <
isasi-at-google@ffmpeg.org> wrote:

> I am also happy to fix any breaking files, if they don't fall under the
> above category.
>
>
>
The change seems to have caused resulting files to have incorrect duration
in some cases (remuxing XDCAM material that typically starts with two
b-frames). Will provide more info after I've analyzed a bit more why our
internal regression tests failed after that change.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH]nvenc: Add capability check for Temporal AQ

2016-10-19 Thread Yogender Kumar Gupta
Added capability check for Temporal AQ

Thanks,
Yogender


0001-nvenc-Add-capability-check-for-Temporal-AQ.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]nvenc: Add capability check for Temporal AQ

2016-10-19 Thread Sven C. Dack

On 19/10/16 09:34, Yogender Kumar Gupta wrote:

Added capability check for Temporal AQ

Thanks,
Yogender
I've send in 3 patches regarding Nvidia stuff (1. check for temp aq, 2. option 
for temp aq in hevc, 3. limitation work-around for scale npp), but there seems 
to be no maintainer present at the moment to pick them up...



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


Re: [FFmpeg-devel] [PATCH] lavf/img2dec: disable parsing if frame_size is specified

2016-10-19 Thread Matthieu Bouron
On Mon, Mar 07, 2016 at 11:59:38AM +, Carl Eugen Hoyos wrote:
> Matthieu Bouron  gmail.com> writes:
> 
> >  else {
> >  s->is_pipe   = 1;
> > -st->need_parsing = AVSTREAM_PARSE_FULL;
> > +st->need_parsing = s->frame_size > 0 ? AVSTREAM_PARSE_NONE 
> > : AVSTREAM_PARSE_FULL;
> 
> Makes sense imo.

Sorry for the delay, are you still OK with the patch ?

Matthieu

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


Re: [FFmpeg-devel] [PATCH 4/4] lavc/mediacodec: use more meaningful filenames

2016-10-19 Thread Matthieu Bouron
On Tue, Oct 18, 2016 at 03:26:46PM +0200, Matthieu Bouron wrote:
> On Wed, Oct 12, 2016 at 03:22:42PM +0200, Matthieu Bouron wrote:
> > From: Matthieu Bouron 
> > 
> > Adds the following changes:
> >   * mediacodecdec.{c,h} -> mediacodecdec_common.{c,h}
> >   * mediacodecdec_h2645.c -> mediacodecdec.c
> > ---
> >  libavcodec/Makefile|   12 +-
> >  libavcodec/mediacodec.c|3 +-
> >  libavcodec/mediacodec_sw_buffer.c  |2 +-
> >  libavcodec/mediacodec_sw_buffer.h  |2 +-
> >  libavcodec/mediacodecdec.c | 1064 
> > +---
> >  libavcodec/mediacodecdec_common.c  |  789 +++
> >  .../{mediacodecdec.h => mediacodecdec_common.h}|6 +-
> >  libavcodec/mediacodecdec_h2645.c   |  623 
> >  8 files changed, 1251 insertions(+), 1250 deletions(-)
> >  create mode 100644 libavcodec/mediacodecdec_common.c
> >  rename libavcodec/{mediacodecdec.h => mediacodecdec_common.h} (95%)
> >  delete mode 100644 libavcodec/mediacodecdec_h2645.c
> > 
> > diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> > index e8b1b00..7b85378 100644
> > --- a/libavcodec/Makefile
> > +++ b/libavcodec/Makefile
> > @@ -94,7 +94,7 @@ OBJS-$(CONFIG_LSP) += lsp.o
> >  OBJS-$(CONFIG_LZF) += lzf.o
> >  OBJS-$(CONFIG_MDCT)+= mdct_fixed.o mdct_float.o 
> > mdct_fixed_32.o
> >  OBJS-$(CONFIG_ME_CMP)  += me_cmp.o
> > -OBJS-$(CONFIG_MEDIACODEC)  += mediacodecdec.o 
> > mediacodec_surface.o mediacodec_wrapper.o mediacodec_sw_buffer.o
> > +OBJS-$(CONFIG_MEDIACODEC)  += mediacodecdec_common.o 
> > mediacodec_surface.o mediacodec_wrapper.o mediacodec_sw_buffer.o
> >  OBJS-$(CONFIG_MPEG_ER) += mpeg_er.o
> >  OBJS-$(CONFIG_MPEGAUDIO)   += mpegaudio.o mpegaudiodata.o   \
> >mpegaudiodecheader.o
> > @@ -316,7 +316,7 @@ OBJS-$(CONFIG_H264_DECODER)+= h264dec.o 
> > h264_cabac.o h264_cavlc.o \
> >h264_slice.o h264data.o 
> > h264_parse.o \
> >h2645_parse.o
> >  OBJS-$(CONFIG_H264_CUVID_DECODER)  += cuvid.o
> > -OBJS-$(CONFIG_H264_MEDIACODEC_DECODER) += mediacodecdec_h2645.o
> > +OBJS-$(CONFIG_H264_MEDIACODEC_DECODER) += mediacodecdec.o
> >  OBJS-$(CONFIG_H264_MMAL_DECODER)   += mmaldec.o
> >  OBJS-$(CONFIG_H264_NVENC_ENCODER)  += nvenc_h264.o
> >  OBJS-$(CONFIG_NVENC_ENCODER)   += nvenc_h264.o
> > @@ -333,7 +333,7 @@ OBJS-$(CONFIG_HEVC_DECODER)+= hevc.o 
> > hevc_mvs.o hevc_ps.o hevc_sei.o
> >hevc_cabac.o hevc_refs.o 
> > hevcpred.o\
> >hevcdsp.o hevc_filter.o 
> > h2645_parse.o hevc_data.o
> >  OBJS-$(CONFIG_HEVC_CUVID_DECODER)  += cuvid.o
> > -OBJS-$(CONFIG_HEVC_MEDIACODEC_DECODER) += mediacodecdec_h2645.o 
> > hevc_parse.o
> > +OBJS-$(CONFIG_HEVC_MEDIACODEC_DECODER) += mediacodecdec.o hevc_parse.o
> >  OBJS-$(CONFIG_HEVC_NVENC_ENCODER)  += nvenc_hevc.o
> >  OBJS-$(CONFIG_NVENC_HEVC_ENCODER)  += nvenc_hevc.o
> >  OBJS-$(CONFIG_HEVC_QSV_DECODER)+= qsvdec_h2645.o
> > @@ -413,7 +413,7 @@ OBJS-$(CONFIG_MPEG2_QSV_ENCODER)   += qsvenc_mpeg2.o
> >  OBJS-$(CONFIG_MPEG2VIDEO_DECODER)  += mpeg12dec.o mpeg12.o mpeg12data.o
> >  OBJS-$(CONFIG_MPEG2VIDEO_ENCODER)  += mpeg12enc.o mpeg12.o
> >  OBJS-$(CONFIG_MPEG4_DECODER)   += xvididct.o
> > -OBJS-$(CONFIG_MPEG4_MEDIACODEC_DECODER) += mediacodecdec_h2645.o
> > +OBJS-$(CONFIG_MPEG4_MEDIACODEC_DECODER) += mediacodecdec.o
> >  OBJS-$(CONFIG_MPEG4_OMX_ENCODER)   += omx.o
> >  OBJS-$(CONFIG_MPL2_DECODER)+= mpl2dec.o ass.o
> >  OBJS-$(CONFIG_MSA1_DECODER)+= mss3.o
> > @@ -596,11 +596,11 @@ OBJS-$(CONFIG_VP6_DECODER) += vp6.o 
> > vp56.o vp56data.o \
> >  OBJS-$(CONFIG_VP7_DECODER) += vp8.o vp56rac.o
> >  OBJS-$(CONFIG_VP8_DECODER) += vp8.o vp56rac.o
> >  OBJS-$(CONFIG_VP8_CUVID_DECODER)   += cuvid.o
> > -OBJS-$(CONFIG_VP8_MEDIACODEC_DECODER)  += mediacodecdec_h2645.o
> > +OBJS-$(CONFIG_VP8_MEDIACODEC_DECODER)  += mediacodecdec.o
> >  OBJS-$(CONFIG_VP9_DECODER) += vp9.o vp9dsp.o vp56rac.o 
> > vp9dsp_8bpp.o \
> >vp9dsp_10bpp.o vp9dsp_12bpp.o
> >  OBJS-$(CONFIG_VP9_CUVID_DECODER)   += cuvid.o
> > -OBJS-$(CONFIG_VP9_MEDIACODEC_DECODER)  += mediacodecdec_h2645.o
> > +OBJS-$(CONFIG_VP9_MEDIACODEC_DECODER)  += mediacodecdec.o
> >  OBJS-$(CONFIG_VPLAYER_DECODER) += textdec.o ass.o
> >  OBJS-$(CONFIG_VQA_DECODER) += vqavideo.o
> >  OBJS-$(CONFIG_WAVPACK_DECODER) += wavpack.o
> > diff --git a/libavcodec/mediacodec.c b/libavcodec/mediacodec.c
> > index a658f0e..352

Re: [FFmpeg-devel] [PATCH]nvenc: Add capability check for Temporal AQ

2016-10-19 Thread Timo Rothenpieler
Am 19.10.2016 um 11:15 schrieb Sven C. Dack:
> On 19/10/16 09:34, Yogender Kumar Gupta wrote:
>> Added capability check for Temporal AQ
>>
>> Thanks,
>> Yogender
> I've send in 3 patches regarding Nvidia stuff (1. check for temp aq, 2.
> option for temp aq in hevc, 3. limitation work-around for scale npp),
> but there seems to be no maintainer present at the moment to pick them
> up...

I am present and I have not seen any patches come by.

This patch LGTM, minus the one spurious space at the end of the if.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]nvenc: Add capability check for Temporal AQ

2016-10-19 Thread Sven C. Dack

On 19/10/16 10:22, Timo Rothenpieler wrote:

Am 19.10.2016 um 11:15 schrieb Sven C. Dack:

On 19/10/16 09:34, Yogender Kumar Gupta wrote:

Added capability check for Temporal AQ

Thanks,
Yogender

I've send in 3 patches regarding Nvidia stuff (1. check for temp aq, 2.
option for temp aq in hevc, 3. limitation work-around for scale npp),
but there seems to be no maintainer present at the moment to pick them
up...

I am present and I have not seen any patches come by.

This patch LGTM, minus the one spurious space at the end of the if.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


11 Sep, 2016: https://www.mail-archive.com/ffmpeg-devel@ffmpeg.org/msg39303.html

13 Oct, 2016: https://www.mail-archive.com/ffmpeg-devel@ffmpeg.org/msg41005.html

14 Oct, 2016: https://www.mail-archive.com/ffmpeg-devel@ffmpeg.org/msg41057.html


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


[FFmpeg-devel] [PATCH]nvenc: Add capability check for Temporal AQ

2016-10-19 Thread Yogender Kumar Gupta
>> I've send in 3 patches regarding Nvidia stuff (1. check for temp aq, 2.
option for temp aq in hevc, 3. limitation work-around for scale npp), but
there seems to be no maintainer present at the moment to pick them up...

Tempoal AQ HEVC not supported yet.

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


Re: [FFmpeg-devel] [PATCH]nvenc: Add capability check for Temporal AQ

2016-10-19 Thread Yogender Kumar Gupta
>> This patch LGTM, minus the one spurious space at the end of the if.

What is the procedure to submit, do I do a git push

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


Re: [FFmpeg-devel] [PATCH]nvenc: Add capability check for Temporal AQ

2016-10-19 Thread Sven C. Dack

On 19/10/16 11:01, Yogender Kumar Gupta wrote:

I've send in 3 patches regarding Nvidia stuff (1. check for temp aq, 2.

option for temp aq in hevc, 3. limitation work-around for scale npp), but
there seems to be no maintainer present at the moment to pick them up...

Tempoal AQ HEVC not supported yet.

I cannot confirm. On some hardware it isn't, yes, but I don't own all Pascal 
cards. The API accepts it so I don't see why it should not be in there. The 
hardware test was also missing and will give final confirmation.


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


Re: [FFmpeg-devel] [PATCH]nvenc: Add capability check for Temporal AQ

2016-10-19 Thread Timo Rothenpieler
I'm not exactly maintaining libnpp, I think it was merged from libav,
but the patch looks fine regardless.
No idea why I never got these mails, must have mass-marked them as read
and then deleted all unread mails.

Will apply the old patches as this one does not show up on patchwork.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]nvenc: Add capability check for Temporal AQ

2016-10-19 Thread Hendrik Leppkes
On Wed, Oct 19, 2016 at 12:20 PM, Sven C. Dack  wrote:
> On 19/10/16 11:01, Yogender Kumar Gupta wrote:

 I've send in 3 patches regarding Nvidia stuff (1. check for temp aq, 2.
>>
>> option for temp aq in hevc, 3. limitation work-around for scale npp), but
>> there seems to be no maintainer present at the moment to pick them up...
>>
>> Tempoal AQ HEVC not supported yet.
>>
> I cannot confirm. On some hardware it isn't, yes, but I don't own all Pascal
> cards

All Pascal cards (releases so far) have the same hardware encoding block.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf/mov: support gopro hero moments udta tag

2016-10-19 Thread Michael Niedermayer
On Tue, Oct 18, 2016 at 03:47:55PM +0200, Jean Caillé wrote:
> From: Jean Caillé 
> 
> ---
>  libavformat/mov.c | 19 +++
>  1 file changed, 19 insertions(+)

applied

thx

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

Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety -- Benjamin Franklin


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


Re: [FFmpeg-devel] [PATCH] avformat/movenc: Skip duration check for discontinuous fragments

2016-10-19 Thread Michael Niedermayer
On Tue, Oct 18, 2016 at 06:33:59PM +0200, Michael Niedermayer wrote:
> Found-by: Daemon404
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/movenc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

applied


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

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato


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


Re: [FFmpeg-devel] [PATCH]nvenc: Add capability check for Temporal AQ

2016-10-19 Thread Sven C. Dack

On 19/10/16 12:00, Hendrik Leppkes wrote:

On Wed, Oct 19, 2016 at 12:20 PM, Sven C. Dack  wrote:

On 19/10/16 11:01, Yogender Kumar Gupta wrote:

I've send in 3 patches regarding Nvidia stuff (1. check for temp aq, 2.

option for temp aq in hevc, 3. limitation work-around for scale npp), but
there seems to be no maintainer present at the moment to pick them up...

Tempoal AQ HEVC not supported yet.


I cannot confirm. On some hardware it isn't, yes, but I don't own all Pascal
cards

All Pascal cards (releases so far) have the same hardware encoding block.


Temporal AQ is implemented in CUDA, not in silicon. So far does the API (Video 
SDK 7.0.1) accept the flag without giving any errors. The output however remains 
identical currently (tested on a GTX 960). You'll have to ask Nvidia why they 
haven't implemented it yet (i'ts probably too soon). I am expecting it to become 
available with a future driver (or SDK or CUDA). It's already available for 
NVENC when encoding H.264/AVC and it's not only a method used in H.264 encoding, 
but one which is used in H.265 encoding, too (for example does x265 call auto 
variance '--aq-mode 2').


Unless you can give good reasons why not to provide the flag do I not see why to 
hide it from users when it's already in the API and exists as a feature test.


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


Re: [FFmpeg-devel] [PATCH]nvenc: Add capability check for Temporal AQ

2016-10-19 Thread Yogender Kumar Gupta
>> Temporal AQ is implemented in CUDA, not in silicon. So far does the API
(Video SDK 7.0.1) accept the flag without giving any errors. The output
however remains identical currently (tested on a GTX 960). You'll have to
ask Nvidia why they haven't implemented it yet (i'ts probably too soon). I
am expecting it to become available with a future driver (or SDK or CUDA).
It's already available for NVENC when encoding H.264/AVC and it's not only
a method used in H.264 encoding, but one which is used in H.265 encoding,
too (for example does x265 call auto variance '--aq-mode 2').

I am from Nvidia Video Team, so can give a good answer. Currently it has
been implemented for H264 only. HEVC TAQ may be released in a future SDK
release.

All queries for NVENC/CUVID can also be directed to me.

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


[FFmpeg-devel] [PATCH 1/8] compat/cuda: add dynamic loader

2016-10-19 Thread Timo Rothenpieler
---
 compat/cuda/dynlink_cuda.h |  88 +
 compat/cuda/dynlink_cuviddec.h | 808 +
 compat/cuda/dynlink_loader.h   | 254 +
 compat/cuda/dynlink_nvcuvid.h  | 316 
 4 files changed, 1466 insertions(+)
 create mode 100644 compat/cuda/dynlink_cuda.h
 create mode 100644 compat/cuda/dynlink_cuviddec.h
 create mode 100644 compat/cuda/dynlink_loader.h
 create mode 100644 compat/cuda/dynlink_nvcuvid.h

diff --git a/compat/cuda/dynlink_cuda.h b/compat/cuda/dynlink_cuda.h
new file mode 100644
index 000..908f12d
--- /dev/null
+++ b/compat/cuda/dynlink_cuda.h
@@ -0,0 +1,88 @@
+/*
+ * 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
+ */
+
+#if !defined(AV_COMPAT_DYNLINK_CUDA_H) && !defined(CUDA_VERSION)
+#define AV_COMPAT_DYNLINK_CUDA_H
+
+#include 
+
+#define CUDA_VERSION 7050
+
+#if defined(_WIN32) || defined(__CYGWIN__)
+#define CUDAAPI __stdcall
+#else
+#define CUDAAPI
+#endif
+
+#define CU_CTX_SCHED_BLOCKING_SYNC 4
+
+typedef int CUdevice;
+typedef void* CUarray;
+typedef void* CUcontext;
+#if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64)
+typedef unsigned long long CUdeviceptr;
+#else
+typedef unsigned int CUdeviceptr;
+#endif
+
+typedef enum cudaError_enum {
+CUDA_SUCCESS = 0
+} CUresult;
+
+typedef enum CUmemorytype_enum {
+CU_MEMORYTYPE_HOST = 1,
+CU_MEMORYTYPE_DEVICE = 2
+} CUmemorytype;
+
+typedef struct CUDA_MEMCPY2D_st {
+size_t srcXInBytes;
+size_t srcY;
+CUmemorytype srcMemoryType;
+const void *srcHost;
+CUdeviceptr srcDevice;
+CUarray srcArray;
+size_t srcPitch;
+
+size_t dstXInBytes;
+size_t dstY;
+CUmemorytype dstMemoryType;
+void *dstHost;
+CUdeviceptr dstDevice;
+CUarray dstArray;
+size_t dstPitch;
+
+size_t WidthInBytes;
+size_t Height;
+} CUDA_MEMCPY2D;
+
+typedef CUresult CUDAAPI tcuInit(unsigned int Flags);
+typedef CUresult CUDAAPI tcuDeviceGetCount(int *count);
+typedef CUresult CUDAAPI tcuDeviceGet(CUdevice *device, int ordinal);
+typedef CUresult CUDAAPI tcuDeviceGetName(char *name, int len, CUdevice dev);
+typedef CUresult CUDAAPI tcuDeviceComputeCapability(int *major, int *minor, 
CUdevice dev);
+typedef CUresult CUDAAPI tcuCtxCreate_v2(CUcontext *pctx, unsigned int flags, 
CUdevice dev);
+typedef CUresult CUDAAPI tcuCtxPushCurrent_v2(CUcontext *pctx);
+typedef CUresult CUDAAPI tcuCtxPopCurrent_v2(CUcontext *pctx);
+typedef CUresult CUDAAPI tcuCtxDestroy_v2(CUcontext ctx);
+typedef CUresult CUDAAPI tcuMemAlloc_v2(CUdeviceptr *dptr, size_t bytesize);
+typedef CUresult CUDAAPI tcuMemFree_v2(CUdeviceptr dptr);
+typedef CUresult CUDAAPI tcuMemcpy2D_v2(const CUDA_MEMCPY2D *pcopy);
+typedef CUresult CUDAAPI tcuGetErrorName(CUresult error, const char** pstr);
+typedef CUresult CUDAAPI tcuGetErrorString(CUresult error, const char** pstr);
+
+#endif
diff --git a/compat/cuda/dynlink_cuviddec.h b/compat/cuda/dynlink_cuviddec.h
new file mode 100644
index 000..17207bc
--- /dev/null
+++ b/compat/cuda/dynlink_cuviddec.h
@@ -0,0 +1,808 @@
+/*
+ * This copyright notice applies to this header file only:
+ *
+ * Copyright (c) 2010-2016 NVIDIA Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the software, and to permit persons to whom the
+ * software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+

[FFmpeg-devel] [PATCH 4/8] avfilter/vf_scale_npp: use dynamically loaded CUDA

2016-10-19 Thread Timo Rothenpieler
---
 libavfilter/vf_scale_npp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavfilter/vf_scale_npp.c b/libavfilter/vf_scale_npp.c
index 35abe39..c84282f 100644
--- a/libavfilter/vf_scale_npp.c
+++ b/libavfilter/vf_scale_npp.c
@@ -29,7 +29,7 @@
 #include "libavutil/common.h"
 #include "libavutil/eval.h"
 #include "libavutil/hwcontext.h"
-#include "libavutil/hwcontext_cuda.h"
+#include "libavutil/hwcontext_cuda_internal.h"
 #include "libavutil/internal.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/opt.h"
@@ -591,7 +591,7 @@ static int nppscale_filter_frame(AVFilterLink *link, 
AVFrame *in)
   (int64_t)in->sample_aspect_ratio.den * outlink->w * link->h,
   INT_MAX);
 
-err = cuCtxPushCurrent(device_hwctx->cuda_ctx);
+err = 
device_hwctx->internal->cuda_dl->cuCtxPushCurrent(device_hwctx->cuda_ctx);
 if (err != CUDA_SUCCESS) {
 ret = AVERROR_UNKNOWN;
 goto fail;
@@ -599,7 +599,7 @@ static int nppscale_filter_frame(AVFilterLink *link, 
AVFrame *in)
 
 ret = nppscale_scale(ctx, out, in);
 
-cuCtxPopCurrent(&dummy);
+device_hwctx->internal->cuda_dl->cuCtxPopCurrent(&dummy);
 if (ret < 0)
 goto fail;
 
-- 
2.10.1

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


[FFmpeg-devel] [PATCH 2/8] avutil/hwcontext_cuda: use dynamically loaded CUDA

2016-10-19 Thread Timo Rothenpieler
---
 configure   |  2 +
 libavutil/hwcontext_cuda.c  | 99 -
 libavutil/hwcontext_cuda.h  |  5 ++
 libavutil/hwcontext_cuda_internal.h | 37 ++
 libavutil/version.h |  2 +-
 5 files changed, 120 insertions(+), 25 deletions(-)
 create mode 100644 libavutil/hwcontext_cuda_internal.h

diff --git a/configure b/configure
index 1e6834f..8c5742f 100755
--- a/configure
+++ b/configure
@@ -2536,6 +2536,7 @@ audiotoolbox_extralibs="-framework CoreFoundation 
-framework AudioToolbox -frame
 
 # hardware accelerators
 crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
+cuda_deps_any="dlopen LoadLibrary"
 cuvid_deps="cuda"
 d3d11va_deps="d3d11_h dxva_h ID3D11VideoDecoder ID3D11VideoContext"
 dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode"
@@ -5414,6 +5415,7 @@ elif check_func dlopen -ldl && check_func dlsym -ldl; then
 ldl=-ldl
 fi
 
+cuda_extralibs='$ldl'
 decklink_outdev_extralibs="$decklink_outdev_extralibs $ldl"
 decklink_indev_extralibs="$decklink_indev_extralibs $ldl"
 frei0r_filter_extralibs='$ldl'
diff --git a/libavutil/hwcontext_cuda.c b/libavutil/hwcontext_cuda.c
index e1dcab0..30de299 100644
--- a/libavutil/hwcontext_cuda.c
+++ b/libavutil/hwcontext_cuda.c
@@ -20,7 +20,7 @@
 #include "common.h"
 #include "hwcontext.h"
 #include "hwcontext_internal.h"
-#include "hwcontext_cuda.h"
+#include "hwcontext_cuda_internal.h"
 #include "mem.h"
 #include "pixdesc.h"
 #include "pixfmt.h"
@@ -41,44 +41,46 @@ static void cuda_buffer_free(void *opaque, uint8_t *data)
 {
 AVHWFramesContext *ctx = opaque;
 AVCUDADeviceContext *hwctx = ctx->device_ctx->hwctx;
+CudaFunctions *cu = hwctx->internal->cuda_dl;
 
 CUcontext dummy;
 
-cuCtxPushCurrent(hwctx->cuda_ctx);
+cu->cuCtxPushCurrent(hwctx->cuda_ctx);
 
-cuMemFree((CUdeviceptr)data);
+cu->cuMemFree((CUdeviceptr)data);
 
-cuCtxPopCurrent(&dummy);
+cu->cuCtxPopCurrent(&dummy);
 }
 
 static AVBufferRef *cuda_pool_alloc(void *opaque, int size)
 {
 AVHWFramesContext *ctx = opaque;
 AVCUDADeviceContext *hwctx = ctx->device_ctx->hwctx;
+CudaFunctions  *cu = hwctx->internal->cuda_dl;
 
 AVBufferRef *ret = NULL;
 CUcontext dummy = NULL;
 CUdeviceptr data;
 CUresult err;
 
-err = cuCtxPushCurrent(hwctx->cuda_ctx);
+err = cu->cuCtxPushCurrent(hwctx->cuda_ctx);
 if (err != CUDA_SUCCESS) {
 av_log(ctx, AV_LOG_ERROR, "Error setting current CUDA context\n");
 return NULL;
 }
 
-err = cuMemAlloc(&data, size);
+err = cu->cuMemAlloc(&data, size);
 if (err != CUDA_SUCCESS)
 goto fail;
 
 ret = av_buffer_create((uint8_t*)data, size, cuda_buffer_free, ctx, 0);
 if (!ret) {
-cuMemFree(data);
+cu->cuMemFree(data);
 goto fail;
 }
 
 fail:
-cuCtxPopCurrent(&dummy);
+cu->cuCtxPopCurrent(&dummy);
 return ret;
 }
 
@@ -187,12 +189,13 @@ static int cuda_transfer_data_from(AVHWFramesContext 
*ctx, AVFrame *dst,
 {
 CUDAFramesContext   *priv = ctx->internal->priv;
 AVCUDADeviceContext *device_hwctx = ctx->device_ctx->hwctx;
+CudaFunctions *cu = device_hwctx->internal->cuda_dl;
 
 CUcontext dummy;
 CUresult err;
 int i;
 
-err = cuCtxPushCurrent(device_hwctx->cuda_ctx);
+err = cu->cuCtxPushCurrent(device_hwctx->cuda_ctx);
 if (err != CUDA_SUCCESS)
 return AVERROR_UNKNOWN;
 
@@ -208,14 +211,14 @@ static int cuda_transfer_data_from(AVHWFramesContext 
*ctx, AVFrame *dst,
 .Height= src->height >> (i ? priv->shift_height : 0),
 };
 
-err = cuMemcpy2D(&cpy);
+err = cu->cuMemcpy2D(&cpy);
 if (err != CUDA_SUCCESS) {
 av_log(ctx, AV_LOG_ERROR, "Error transferring the data from the 
CUDA frame\n");
 return AVERROR_UNKNOWN;
 }
 }
 
-cuCtxPopCurrent(&dummy);
+cu->cuCtxPopCurrent(&dummy);
 
 return 0;
 }
@@ -225,12 +228,13 @@ static int cuda_transfer_data_to(AVHWFramesContext *ctx, 
AVFrame *dst,
 {
 CUDAFramesContext   *priv = ctx->internal->priv;
 AVCUDADeviceContext *device_hwctx = ctx->device_ctx->hwctx;
+CudaFunctions *cu = device_hwctx->internal->cuda_dl;
 
 CUcontext dummy;
 CUresult err;
 int i;
 
-err = cuCtxPushCurrent(device_hwctx->cuda_ctx);
+err = cu->cuCtxPushCurrent(device_hwctx->cuda_ctx);
 if (err != CUDA_SUCCESS)
 return AVERROR_UNKNOWN;
 
@@ -246,28 +250,64 @@ static int cuda_transfer_data_to(AVHWFramesContext *ctx, 
AVFrame *dst,
 .Height= src->height >> (i ? priv->shift_height : 0),
 };
 
-err = cuMemcpy2D(&cpy);
+err = cu->cuMemcpy2D(&cpy);
 if (err != CUDA_SUCCESS) {
 av_log(ctx, AV_LOG_ERROR, "Error transferring the data from the 
CUDA frame\n");
 return AVERROR_UNKNOWN;
 }
 }
 
-cuCtxPopCurrent

[FFmpeg-devel] [PATCH 3/8] avcodec/cuvid: use dynamically loaded CUDA/CUVID

2016-10-19 Thread Timo Rothenpieler
And remove the now obsolete compat headers.
---
 compat/cuda/cuviddec.h | 827 -
 compat/cuda/nvcuvid.h  | 321 ---
 libavcodec/cuvid.c |  78 +++--
 3 files changed, 47 insertions(+), 1179 deletions(-)
 delete mode 100644 compat/cuda/cuviddec.h
 delete mode 100644 compat/cuda/nvcuvid.h

diff --git a/compat/cuda/cuviddec.h b/compat/cuda/cuviddec.h
deleted file mode 100644
index f9257ea..000
--- a/compat/cuda/cuviddec.h
+++ /dev/null
@@ -1,827 +0,0 @@
-/*
- * This copyright notice applies to this header file only:
- *
- * Copyright (c) 2010-2016 NVIDIA Corporation
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the software, and to permit persons to whom the
- * software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * \file cuviddec.h
- * NvCuvid API provides Video Decoding interface to NVIDIA GPU devices.
- * \date 2015-2016
- * This file contains constants, structure definitions and function prototypes 
used for decoding.
- */
-
-#if !defined(__CUDA_VIDEO_H__)
-#define __CUDA_VIDEO_H__
-
-#ifndef __cuda_cuda_h__
-#include 
-#endif // __cuda_cuda_h__
-
-#if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64)
-#if (CUDA_VERSION >= 3020) && (!defined(CUDA_FORCE_API_VERSION) || 
(CUDA_FORCE_API_VERSION >= 3020))
-#define __CUVID_DEVPTR64
-#endif
-#endif
-
-#if defined(__cplusplus)
-extern "C" {
-#endif /* __cplusplus */
-
-typedef void *CUvideodecoder;
-typedef struct _CUcontextlock_st *CUvideoctxlock;
-
-/**
- * \addtogroup VIDEO_DECODER Video Decoder
- * @{
- */
-
-/*!
- * \enum cudaVideoCodec
- * Video Codec Enums
- */
-typedef enum cudaVideoCodec_enum {
-cudaVideoCodec_MPEG1=0, /**<  MPEG1   */
-cudaVideoCodec_MPEG2,   /**<  MPEG2  */
-cudaVideoCodec_MPEG4,   /**<  MPEG4   */
-cudaVideoCodec_VC1, /**<  VC1   */
-cudaVideoCodec_H264,/**<  H264   */
-cudaVideoCodec_JPEG,/**<  JPEG   */
-cudaVideoCodec_H264_SVC,/**<  H264-SVC   */
-cudaVideoCodec_H264_MVC,/**<  H264-MVC   */
-cudaVideoCodec_HEVC,/**<  HEVC   */
-cudaVideoCodec_VP8, /**<  VP8   */
-cudaVideoCodec_VP9, /**<  VP9   */
-cudaVideoCodec_NumCodecs,   /**<  Max COdecs   */
-// Uncompressed YUV
-cudaVideoCodec_YUV420 = (('I'<<24)|('Y'<<16)|('U'<<8)|('V')),   /**< Y,U,V 
(4:2:0)  */
-cudaVideoCodec_YV12   = (('Y'<<24)|('V'<<16)|('1'<<8)|('2')),   /**< Y,V,U 
(4:2:0)  */
-cudaVideoCodec_NV12   = (('N'<<24)|('V'<<16)|('1'<<8)|('2')),   /**< Y,UV  
(4:2:0)  */
-cudaVideoCodec_YUYV   = (('Y'<<24)|('U'<<16)|('Y'<<8)|('V')),   /**< 
YUYV/YUY2 (4:2:2)  */
-cudaVideoCodec_UYVY   = (('U'<<24)|('Y'<<16)|('V'<<8)|('Y'))/**< UYVY 
(4:2:2)  */
-} cudaVideoCodec;
-
-/*!
- * \enum cudaVideoSurfaceFormat
- * Video Surface Formats Enums
- */
-typedef enum cudaVideoSurfaceFormat_enum {
-cudaVideoSurfaceFormat_NV12=0   /**< NV12 (currently the only 
supported output format)  */
-} cudaVideoSurfaceFormat;
-
-/*!
- * \enum cudaVideoDeinterlaceMode
- * Deinterlacing Modes Enums
- */
-typedef enum cudaVideoDeinterlaceMode_enum {
-cudaVideoDeinterlaceMode_Weave=0,   /**< Weave both fields (no 
deinterlacing) */
-cudaVideoDeinterlaceMode_Bob,   /**< Drop one field  */
-cudaVideoDeinterlaceMode_Adaptive   /**< Adaptive deinterlacing  */
-} cudaVideoDeinterlaceMode;
-
-/*!
- * \enum cudaVideoChromaFormat
- * Chroma Formats Enums
- */
-typedef enum cudaVideoChromaFormat_enum {
-cudaVideoChromaFormat_Monochrome=0,  /**< MonoChrome */
-cudaVideoChromaFormat_420,   /**< 4:2:0 */
-cudaVideoChromaFormat_422,   /**< 4:2:2 */
-cudaVideoChromaFormat_444/**< 4:4:4 */
-} cudaVideoChromaFormat;
-
-/*!
- * \enum cudaVideoCreateFlags
- * Decoder Flags Enums
- */
-typedef enum cudaVideoCreateFlags_enum {
-cudaVideoCreate_

[FFmpeg-devel] [PATCH 6/8] avfilter/vf_hwupload_cuda: use new hwdevice allocation API

2016-10-19 Thread Timo Rothenpieler
---
 libavfilter/vf_hwupload_cuda.c | 57 --
 1 file changed, 5 insertions(+), 52 deletions(-)

diff --git a/libavfilter/vf_hwupload_cuda.c b/libavfilter/vf_hwupload_cuda.c
index c1c..dba496f 100644
--- a/libavfilter/vf_hwupload_cuda.c
+++ b/libavfilter/vf_hwupload_cuda.c
@@ -18,7 +18,6 @@
 
 #include "libavutil/buffer.h"
 #include "libavutil/hwcontext.h"
-#include "libavutil/hwcontext_cuda.h"
 #include "libavutil/log.h"
 #include "libavutil/opt.h"
 
@@ -35,60 +34,14 @@ typedef struct CudaUploadContext {
 AVBufferRef *hwframe;
 } CudaUploadContext;
 
-static void cudaupload_ctx_free(AVHWDeviceContext *ctx)
-{
-AVCUDADeviceContext *hwctx = ctx->hwctx;
-cuCtxDestroy(hwctx->cuda_ctx);
-}
-
 static av_cold int cudaupload_init(AVFilterContext *ctx)
 {
 CudaUploadContext *s = ctx->priv;
+char buf[64] = { 0 };
 
-AVHWDeviceContext   *device_ctx;
-AVCUDADeviceContext *device_hwctx;
-CUdevice device;
-CUcontext cuda_ctx = NULL, dummy;
-CUresult err;
-int ret;
-
-err = cuInit(0);
-if (err != CUDA_SUCCESS) {
-av_log(ctx, AV_LOG_ERROR, "Could not initialize the CUDA driver 
API\n");
-return AVERROR_UNKNOWN;
-}
-
-err = cuDeviceGet(&device, s->device_idx);
-if (err != CUDA_SUCCESS) {
-av_log(ctx, AV_LOG_ERROR, "Could not get the device number %d\n", 
s->device_idx);
-return AVERROR_UNKNOWN;
-}
-
-err = cuCtxCreate(&cuda_ctx, 0, device);
-if (err != CUDA_SUCCESS) {
-av_log(ctx, AV_LOG_ERROR, "Error creating a CUDA context\n");
-return AVERROR_UNKNOWN;
-}
-
-cuCtxPopCurrent(&dummy);
-
-s->hwdevice = av_hwdevice_ctx_alloc(AV_HWDEVICE_TYPE_CUDA);
-if (!s->hwdevice) {
-cuCtxDestroy(cuda_ctx);
-return AVERROR(ENOMEM);
-}
-
-device_ctx   = (AVHWDeviceContext*)s->hwdevice->data;
-device_ctx->free = cudaupload_ctx_free;
+snprintf(buf, sizeof(buf), "%d", s->device_idx);
 
-device_hwctx = device_ctx->hwctx;
-device_hwctx->cuda_ctx = cuda_ctx;
-
-ret = av_hwdevice_ctx_init(s->hwdevice);
-if (ret < 0)
-return ret;
-
-return 0;
+return av_hwdevice_ctx_create(&s->hwdevice, AV_HWDEVICE_TYPE_CUDA, buf, 
NULL, 0);
 }
 
 static av_cold void cudaupload_uninit(AVFilterContext *ctx)
@@ -134,8 +87,8 @@ static int cudaupload_config_output(AVFilterLink *outlink)
 hwframe_ctx= (AVHWFramesContext*)s->hwframe->data;
 hwframe_ctx->format= AV_PIX_FMT_CUDA;
 hwframe_ctx->sw_format = inlink->format;
-hwframe_ctx->width = FFALIGN(inlink->w, 16);
-hwframe_ctx->height= FFALIGN(inlink->h, 16);
+hwframe_ctx->width = inlink->w;
+hwframe_ctx->height= inlink->h;
 
 ret = av_hwframe_ctx_init(s->hwframe);
 if (ret < 0)
-- 
2.10.1

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


[FFmpeg-devel] [PATCH 7/8] avfilter/vf_hwupload_cuda: check ff_formats_ref for errors

2016-10-19 Thread Timo Rothenpieler
---
 libavfilter/vf_hwupload_cuda.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_hwupload_cuda.c b/libavfilter/vf_hwupload_cuda.c
index dba496f..14688df 100644
--- a/libavfilter/vf_hwupload_cuda.c
+++ b/libavfilter/vf_hwupload_cuda.c
@@ -54,6 +54,8 @@ static av_cold void cudaupload_uninit(AVFilterContext *ctx)
 
 static int cudaupload_query_formats(AVFilterContext *ctx)
 {
+int ret;
+
 static const enum AVPixelFormat input_pix_fmts[] = {
 AV_PIX_FMT_NV12, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV444P,
 AV_PIX_FMT_NONE,
@@ -64,8 +66,13 @@ static int cudaupload_query_formats(AVFilterContext *ctx)
 AVFilterFormats *in_fmts  = ff_make_format_list(input_pix_fmts);
 AVFilterFormats *out_fmts = ff_make_format_list(output_pix_fmts);
 
-ff_formats_ref(in_fmts,  &ctx->inputs[0]->out_formats);
-ff_formats_ref(out_fmts, &ctx->outputs[0]->in_formats);
+ret = ff_formats_ref(in_fmts, &ctx->inputs[0]->out_formats);
+if (ret < 0)
+return ret;
+
+ret = ff_formats_ref(out_fmts, &ctx->outputs[0]->in_formats);
+if (ret < 0)
+return ret;
 
 return 0;
 }
-- 
2.10.1

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


[FFmpeg-devel] [PATCH 5/8] avcodec/nvenc: use dynamically loaded CUDA

2016-10-19 Thread Timo Rothenpieler
---
 configure  |   1 +
 libavcodec/nvenc.c | 129 +
 libavcodec/nvenc.h |  46 ++-
 3 files changed, 26 insertions(+), 150 deletions(-)

diff --git a/configure b/configure
index 8c5742f..78113e2 100755
--- a/configure
+++ b/configure
@@ -2692,6 +2692,7 @@ vaapi_encode_deps="vaapi"
 hwupload_cuda_filter_deps="cuda"
 scale_npp_filter_deps="cuda libnpp"
 
+nvenc_deps="cuda"
 nvenc_deps_any="dlopen LoadLibrary"
 nvenc_encoder_deps="nvenc"
 h263_cuvid_decoder_deps="cuda cuvid"
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 2505c3d..d71a445 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -21,60 +21,20 @@
 
 #include "config.h"
 
-#if defined(_WIN32) || defined(__CYGWIN__)
-# define CUDA_LIBNAME "nvcuda.dll"
-# if ARCH_X86_64
-#  define NVENC_LIBNAME "nvEncodeAPI64.dll"
-# else
-#  define NVENC_LIBNAME "nvEncodeAPI.dll"
-# endif
-#else
-# define CUDA_LIBNAME "libcuda.so.1"
-# define NVENC_LIBNAME "libnvidia-encode.so.1"
-#endif
-
-#if defined(_WIN32)
-#include 
-
-#define dlopen(filename, flags) LoadLibrary(TEXT(filename))
-#define dlsym(handle, symbol)   GetProcAddress(handle, symbol)
-#define dlclose(handle) FreeLibrary(handle)
-#else
-#include 
-#endif
+#include "nvenc.h"
 
+#include "libavutil/hwcontext_cuda.h"
 #include "libavutil/hwcontext.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/avassert.h"
 #include "libavutil/mem.h"
 #include "internal.h"
-#include "nvenc.h"
 
 #define NVENC_CAP 0x30
 #define IS_CBR(rc) (rc == NV_ENC_PARAMS_RC_CBR ||   \
 rc == NV_ENC_PARAMS_RC_2_PASS_QUALITY ||\
 rc == NV_ENC_PARAMS_RC_2_PASS_FRAMESIZE_CAP)
 
-#define LOAD_LIBRARY(l, path)   \
-do {\
-if (!((l) = dlopen(path, RTLD_LAZY))) { \
-av_log(avctx, AV_LOG_ERROR, \
-   "Cannot load %s\n",  \
-   path);   \
-return AVERROR_UNKNOWN; \
-}   \
-} while (0)
-
-#define LOAD_SYMBOL(fun, lib, symbol)\
-do { \
-if (!((fun) = dlsym(lib, symbol))) { \
-av_log(avctx, AV_LOG_ERROR,  \
-   "Cannot load %s\n",   \
-   symbol);  \
-return AVERROR_UNKNOWN;  \
-}\
-} while (0)
-
 const enum AVPixelFormat ff_nvenc_pix_fmts[] = {
 AV_PIX_FMT_YUV420P,
 AV_PIX_FMT_NV12,
@@ -83,9 +43,7 @@ const enum AVPixelFormat ff_nvenc_pix_fmts[] = {
 AV_PIX_FMT_YUV444P16,
 AV_PIX_FMT_0RGB32,
 AV_PIX_FMT_0BGR32,
-#if CONFIG_CUDA
 AV_PIX_FMT_CUDA,
-#endif
 AV_PIX_FMT_NONE
 };
 
@@ -157,42 +115,19 @@ static av_cold int nvenc_load_libraries(AVCodecContext 
*avctx)
 {
 NvencContext *ctx = avctx->priv_data;
 NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs;
-PNVENCODEAPIGETMAXSUPPORTEDVERSION nvenc_get_max_ver;
-PNVENCODEAPICREATEINSTANCE nvenc_create_instance;
 NVENCSTATUS err;
 uint32_t nvenc_max_ver;
+int ret;
 
-#if CONFIG_CUDA
-dl_fn->cu_init  = cuInit;
-dl_fn->cu_device_get_count  = cuDeviceGetCount;
-dl_fn->cu_device_get= cuDeviceGet;
-dl_fn->cu_device_get_name   = cuDeviceGetName;
-dl_fn->cu_device_compute_capability = cuDeviceComputeCapability;
-dl_fn->cu_ctx_create= cuCtxCreate_v2;
-dl_fn->cu_ctx_pop_current   = cuCtxPopCurrent_v2;
-dl_fn->cu_ctx_destroy   = cuCtxDestroy_v2;
-#else
-LOAD_LIBRARY(dl_fn->cuda, CUDA_LIBNAME);
-
-LOAD_SYMBOL(dl_fn->cu_init, dl_fn->cuda, "cuInit");
-LOAD_SYMBOL(dl_fn->cu_device_get_count, dl_fn->cuda, "cuDeviceGetCount");
-LOAD_SYMBOL(dl_fn->cu_device_get, dl_fn->cuda, "cuDeviceGet");
-LOAD_SYMBOL(dl_fn->cu_device_get_name, dl_fn->cuda, "cuDeviceGetName");
-LOAD_SYMBOL(dl_fn->cu_device_compute_capability, dl_fn->cuda,
-"cuDeviceComputeCapability");
-LOAD_SYMBOL(dl_fn->cu_ctx_create, dl_fn->cuda, "cuCtxCreate_v2");
-LOAD_SYMBOL(dl_fn->cu_ctx_pop_current, dl_fn->cuda, "cuCtxPopCurrent_v2");
-LOAD_SYMBOL(dl_fn->cu_ctx_destroy, dl_fn->cuda, "cuCtxDestroy_v2");
-#endif
-
-LOAD_LIBRARY(dl_fn->nvenc, NVENC_LIBNAME);
+ret = cuda_load_functions(&dl_fn->cuda_dl);
+if (ret < 0)
+return ret;
 
-LOAD_SYMBOL(nvenc_get_max_ver, dl_fn->nvenc,
-"NvEncodeAPIGetMaxSupportedVersion");
-LOAD_SYMBOL(nvenc_create_instance, dl_fn->nvenc,
-"NvEncodeAPICreateInstance");
+ret = nvenc_load_functions(&dl_fn->nvenc_dl);
+if (ret < 0)
+return ret;
 
-err = nvenc_get_max_ver(&nvenc_max_ver);
+err = dl_fn->nvenc_dl->NvEncodeAPIGetMaxSupportedVersion(&nvenc_max_ver);
 i

[FFmpeg-devel] [PATCH 8/8] configure: cuda is no longer nonfree, enable and autodetect by default

2016-10-19 Thread Timo Rothenpieler
---
 configure | 24 ++--
 1 file changed, 6 insertions(+), 18 deletions(-)

diff --git a/configure b/configure
index 78113e2..b6a0276 100755
--- a/configure
+++ b/configure
@@ -299,8 +299,8 @@ External library support:
 
   The following libraries provide various hardware acceleration features:
   --disable-audiotoolbox   disable Apple AudioToolbox code [autodetect]
-  --enable-cudaenable dynamically linked Nvidia CUDA code [no]
-  --enable-cuvid   enable Nvidia CUVID support [autodetect]
+  --disable-cuda   disable dynamically linked Nvidia CUDA code 
[autodetect]
+  --disable-cuvid  disable Nvidia CUVID support [autodetect]
   --disable-d3d11vadisable Microsoft Direct3D 11 video acceleration 
code [autodetect]
   --disable-dxva2  disable Microsoft DirectX 9 video acceleration code 
[autodetect]
   --enable-libmfx  enable Intel MediaSDK (AKA Quick Sync Video) code 
via libmfx [no]
@@ -3231,7 +3231,7 @@ enable audiotoolbox
 enable d3d11va dxva2 vaapi vda vdpau videotoolbox_hwaccel xvmc
 enable xlib
 
-enable nvenc vda_framework videotoolbox videotoolbox_encoder
+enable cuda cuvid nvenc vda_framework videotoolbox videotoolbox_encoder
 
 # build settings
 SHFLAGS='-shared -Wl,-soname,$$(@F)'
@@ -5082,8 +5082,6 @@ die_license_disabled gpl libxavs
 die_license_disabled gpl libxvid
 die_license_disabled gpl x11grab
 
-die_license_disabled nonfree cuda
-die_license_disabled nonfree cuvid
 die_license_disabled nonfree libnpp
 enabled gpl && die_license_disabled_gpl nonfree libfdk_aac
 enabled gpl && die_license_disabled_gpl nonfree openssl
@@ -5655,11 +5653,6 @@ for func in $COMPLEX_FUNCS; do
 eval check_complexfunc $func \${${func}_args:-1}
 done
 
-# Enable CUVID by default if CUDA is enabled
-if enabled cuda && ! disabled cuvid; then
-enable cuvid
-fi
-
 # these are off by default, so fail if requested and not available
 enabled avfoundation_indev && { check_header_objcc AVFoundation/AVFoundation.h 
|| disable avfoundation_indev; }
 enabled avfoundation_indev && { check_lib2 CoreGraphics/CoreGraphics.h 
CGGetActiveDisplayList -framework CoreGraphics ||
@@ -5667,12 +5660,7 @@ enabled avfoundation_indev && { check_lib2 
CoreGraphics/CoreGraphics.h CGGetActi
 enabled avisynth  && { { check_lib2 "windows.h" LoadLibrary; } ||
{ check_lib2 "dlfcn.h" dlopen -ldl; } ||
die "ERROR: LoadLibrary/dlopen not found for 
avisynth"; }
-enabled cuda  && { check_lib cuda.h cuInit -lcuda ||
-   die "ERROR: CUDA not found"; }
-enabled cuvid && { add_cflags -I$source_path;
-   check_lib "compat/cuda/cuviddec.h" 
cuvidCreateDecoder -lnvcuvid ||
-   die "ERROR: CUVID not found"; } &&
- { enabled cuda ||
+enabled cuvid && { enabled cuda ||
die "ERROR: CUVID requires CUDA"; }
 enabled chromaprint   && require chromaprint chromaprint.h 
chromaprint_get_version -lchromaprint
 enabled coreimage_filter  && { check_header_objcc QuartzCore/CoreImage.h || 
disable coreimage_filter; }
@@ -6024,11 +6012,11 @@ if enabled x86; then
 mingw32*|mingw64*|win32|win64|linux|cygwin*)
 ;;
 *)
-disable nvenc
+disable cuda cuvid nvenc
 ;;
 esac
 else
-disable nvenc
+disable cuda cuvid nvenc
 fi
 
 enabled nvenc &&
-- 
2.10.1

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


[FFmpeg-devel] [PATCH 3/3] fate: Add MXF D10/DV25 probe tests

2016-10-19 Thread Tobias Rapp
Signed-off-by: Tobias Rapp 
---
 tests/fate/mxf.mak| 19 ++-
 tests/ref/fate/mxf-probe-d10  |  3 +++
 tests/ref/fate/mxf-probe-dv25 |  4 
 3 files changed, 25 insertions(+), 1 deletion(-)
 create mode 100644 tests/ref/fate/mxf-probe-d10
 create mode 100644 tests/ref/fate/mxf-probe-dv25

diff --git a/tests/fate/mxf.mak b/tests/fate/mxf.mak
index e95c0b5..27d30e5 100644
--- a/tests/fate/mxf.mak
+++ b/tests/fate/mxf.mak
@@ -8,7 +8,24 @@ fate-mxf-essencegroup-demux: CMD = framecrc -i 
$(TARGET_SAMPLES)/mxf/opatom_esse
 FATE_MXF += fate-mxf-multiple-components-demux
 fate-mxf-multiple-components-demux: CMD = framecrc -i 
$(TARGET_SAMPLES)/mxf/multiple_components.mxf -vcodec copy
 
+#
+# Tests probing MXF format and stream properties
+#
+PROBE_FORMAT_STREAMS_COMMAND = \
+ffprobe$(PROGSSUF)$(EXESUF) -show_entries 
format=format_name,duration,bit_rate:format_tags:streams:stream_tags \
+-print_format compact=p=0 -bitexact -v 0
+
+FATE_MXF_PROBE-$(call ENCDEC2, MPEG2VIDEO, PCM_S16LE, MXF) += 
fate-mxf-probe-d10
+fate-mxf-probe-d10: SRC = $(TARGET_SAMPLES)/mxf/Sony-1.mxf
+fate-mxf-probe-d10: CMD = run $(PROBE_FORMAT_STREAMS_COMMAND) -i "$(SRC)"
+
+FATE_MXF_PROBE-$(call ENCDEC2, DVVIDEO, PCM_S16LE, MXF) += fate-mxf-probe-dv25
+fate-mxf-probe-dv25: SRC = $(TARGET_SAMPLES)/mxf/Avid-5.mxf
+fate-mxf-probe-dv25: CMD = run $(PROBE_FORMAT_STREAMS_COMMAND) -i "$(SRC)"
+
 FATE_MXF-$(CONFIG_MXF_DEMUXER) += $(FATE_MXF)
 
 FATE_SAMPLES_AVCONV += $(FATE_MXF-yes)
-fate-mxf: $(FATE_MXF-yes)
+FATE_SAMPLES_FFPROBE += $(FATE_MXF_PROBE-yes)
+
+fate-mxf: $(FATE_MXF-yes) $(FATE_MXF_PROBE-yes)
diff --git a/tests/ref/fate/mxf-probe-d10 b/tests/ref/fate/mxf-probe-d10
new file mode 100644
index 000..2efdb9a
--- /dev/null
+++ b/tests/ref/fate/mxf-probe-d10
@@ -0,0 +1,3 @@
+index=0|codec_name=mpeg2video|profile=0|codec_type=video|codec_time_base=1/25|codec_tag_string=[0][0][0][0]|codec_tag=0x|width=720|height=608|coded_width=0|coded_height=0|has_b_frames=0|sample_aspect_ratio=152:135|display_aspect_ratio=4:3|pix_fmt=yuv422p|level=5|color_range=tv|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=topleft|field_order=tt|timecode=N/A|refs=1|id=N/A|r_frame_rate=25/1|avg_frame_rate=25/1|time_base=1/25|start_pts=0|start_time=0.00|duration_ts=4|duration=0.16|bit_rate=5000|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=N/A|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|tag:file_package_umid=0x060A2B340101010501010D131300AE86B20091310580080046A54011
+index=1|codec_name=pcm_s16le|profile=unknown|codec_type=audio|codec_time_base=1/48000|codec_tag_string=[0][0][0][0]|codec_tag=0x|sample_fmt=s16|sample_rate=48000|channels=8|channel_layout=unknown|bits_per_sample=16|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/48000|start_pts=0|start_time=0.00|duration_ts=8562|duration=0.178375|bit_rate=6144000|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=N/A|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|tag:file_package_umid=0x060A2B340101010501010D131300AE86B20091310580080046A54011
+format_name=mxf|duration=0.178375|bit_rate=56419744|tag:uid=0086b200-9131-0580--080046a54011|tag:generation_uid=b486b200-9131-0580--080046a54011|tag:company_name=SONY|tag:product_name=eVTR|tag:product_version=1.00|tag:product_uid=060e2b34-0401-0106-0e06-012001010100|tag:modification_date=2004-07-05T21:39:00.00Z|tag:material_package_umid=0x060A2B340101010501010D131300A886B20091310580080046A54011|tag:timecode=07:12:10:00
diff --git a/tests/ref/fate/mxf-probe-dv25 b/tests/ref/fate/mxf-probe-dv25
new file mode 100644
index 000..6ea541e
--- /dev/null
+++ b/tests/ref/fate/mxf-probe-dv25
@@ -0,0 +1,4 @@
+index=0|codec_name=dvvideo|profile=unknown|codec_type=video|codec_time_base=1/25|codec_tag_string=[0][0][0][0]|codec_tag=0x|width=720|height=576|coded_width=720|coded_height=576|has_b_frames=0|sample_aspect_ratio=16:15|display_aspect_ratio=4:3|pix_fmt=yuv420p|level=-99|color_range=N/A|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=topleft|field_order=bb|timecode=N/A|refs=1|id=N/A|r_frame_rate=25/1|avg_frame_rate=25/1|time_base=1/25|start_pts=0|start_time=0.00|duration_ts=25|duration=1.00|bit_rate=N/A|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=N/A|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposit

[FFmpeg-devel] [PATCH v2 0/3] Detect field_order based on video_line_map

2016-10-19 Thread Tobias Rapp
This patch series adds fate tests for probing MXF D10 (top field first) and
DV25 (bottom field first) file properties. Patch #2 is taken from
https://ffmpeg.org/pipermail/ffmpeg-devel/2016-October/200607.html
and has been augmented with the missing XSD update.

The fate samples can be downloaded at the following URLs wrapped into a ZIP
file and should be put into folder "$FATE_SAMPLES/mxf".

Avid-5.mxf:
http://mxf.irt.de/files/download.php?action=getFile&repository=manufacturers&id=85

Sony-1.mxf:
http://mxf.irt.de/files/download.php?action=getFile&repository=manufacturers&id=134

Rodger Combs (1):
  ffprobe: report field order for video streams

Tobias Rapp (2):
  avformat/mxfdec: Detect field_order based on video_line_map
  fate: Add MXF D10/DV25 probe tests

 doc/ffprobe.xsd|  1 +
 ffprobe.c  | 13 
 libavformat/mxfdec.c   | 75 +-
 tests/fate/mxf.mak | 19 +-
 tests/ref/fate/concat-demuxer-extended-lavf-mxf|  2 +-
 .../ref/fate/concat-demuxer-extended-lavf-mxf_d10  |  2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf |  2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10 |  2 +-
 tests/ref/fate/concat-demuxer-simple2-lavf-ts  |  2 +-
 tests/ref/fate/ffprobe_compact |  4 +-
 tests/ref/fate/ffprobe_csv |  4 +-
 tests/ref/fate/ffprobe_default |  2 +
 tests/ref/fate/ffprobe_flat|  2 +
 tests/ref/fate/ffprobe_ini |  2 +
 tests/ref/fate/mxf-probe-d10   |  3 +
 tests/ref/fate/mxf-probe-dv25  |  4 ++
 16 files changed, 114 insertions(+), 25 deletions(-)
 create mode 100644 tests/ref/fate/mxf-probe-d10
 create mode 100644 tests/ref/fate/mxf-probe-dv25

-- 
1.9.1


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


[FFmpeg-devel] [PATCH 1/3] avformat/mxfdec: Detect field_order based on video_line_map

2016-10-19 Thread Tobias Rapp
Read video_line_map from MXF generic picture essence descriptor and use
it to derive the coded field order. Use field_dominance to derive the
display field order from coded field order. If field_dominance is not
available the default value "1" is used as defined in SMPTE S377-1.

Fixes field_order detection for a bunch of DV/DVCPRO files. The heuristic
for deriving coded field order from video_line_map is inspired by
MediaInfo.

Signed-off-by: Tobias Rapp 
---
 libavformat/mxfdec.c | 75 +---
 1 file changed, 60 insertions(+), 15 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 1939761..8332362 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -173,8 +173,10 @@ typedef struct MXFDescriptor {
 int width;
 int height; /* Field height, not frame height */
 int frame_layout; /* See MXFFrameLayout enum */
-#define MXF_TFF 1
-#define MXF_BFF 2
+int video_line_map[2];
+#define MXF_FIELD_DOMINANCE_DEFAULT 0
+#define MXF_FIELD_DOMINANCE_FF 1 /* coded first, displayed first */
+#define MXF_FIELD_DOMINANCE_FL 2 /* coded first, displayed last */
 int field_dominance;
 int channels;
 int bits_per_sample;
@@ -968,6 +970,8 @@ static void mxf_read_pixel_layout(AVIOContext *pb, 
MXFDescriptor *descriptor)
 static int mxf_read_generic_descriptor(void *arg, AVIOContext *pb, int tag, 
int size, UID uid, int64_t klv_offset)
 {
 MXFDescriptor *descriptor = arg;
+int entry_count, entry_size;
+
 switch(tag) {
 case 0x3F01:
 return mxf_read_strong_ref_array(pb, &descriptor->sub_descriptors_refs,
@@ -996,6 +1000,21 @@ static int mxf_read_generic_descriptor(void *arg, 
AVIOContext *pb, int tag, int
 case 0x320C:
 descriptor->frame_layout = avio_r8(pb);
 break;
+case 0x320D:
+entry_count = avio_rb32(pb);
+entry_size = avio_rb32(pb);
+if (entry_size == 4) {
+if (entry_count > 0)
+descriptor->video_line_map[0] = avio_rb32(pb);
+else
+descriptor->video_line_map[0] = 0;
+if (entry_count > 1)
+descriptor->video_line_map[1] = avio_rb32(pb);
+else
+descriptor->video_line_map[1] = 0;
+} else
+av_log(NULL, AV_LOG_WARNING, "VideoLineMap element size %d 
currently not supported\n", entry_size);
+break;
 case 0x320E:
 descriptor->aspect_ratio.num = avio_rb32(pb);
 descriptor->aspect_ratio.den = avio_rb32(pb);
@@ -2044,19 +2063,45 @@ static int mxf_parse_structural_metadata(MXFContext 
*mxf)
 case SegmentedFrame:
 st->codecpar->field_order = AV_FIELD_PROGRESSIVE;
 case SeparateFields:
-switch (descriptor->field_dominance) {
-case MXF_TFF:
-st->codecpar->field_order = AV_FIELD_TT;
-break;
-case MXF_BFF:
-st->codecpar->field_order = AV_FIELD_BB;
-break;
-default:
-avpriv_request_sample(mxf->fc,
-  "Field dominance %d support",
-  descriptor->field_dominance);
-case 0: // we already have many samples with 
field_dominance == unknown
-break;
+av_log(mxf->fc, AV_LOG_DEBUG, "video_line_map: (%d, %d), 
field_dominance: %d\n",
+   descriptor->video_line_map[0], 
descriptor->video_line_map[1],
+   descriptor->field_dominance);
+if ((descriptor->video_line_map[0] > 0) && 
(descriptor->video_line_map[1] > 0)) {
+/* Detect coded field order from VideoLineMap:
+ *  (even, even) => bottom field coded first
+ *  (even, odd)  => top field coded first
+ *  (odd, even)  => top field coded first
+ *  (odd, odd)   => bottom field coded first
+ */
+if ((descriptor->video_line_map[0] + 
descriptor->video_line_map[1]) % 2) {
+switch (descriptor->field_dominance) {
+case MXF_FIELD_DOMINANCE_DEFAULT:
+case MXF_FIELD_DOMINANCE_FF:
+st->codecpar->field_order = AV_FIELD_TT;
+break;
+case MXF_FIELD_DOMINANCE_FL:
+st->codecpar->field_order = AV_FIELD_TB;
+break;
+default:
+avpriv_request_sample(mxf->fc,
+  "Field dominanc

[FFmpeg-devel] [PATCH 2/3] ffprobe: report field order for video streams

2016-10-19 Thread Tobias Rapp
From: Rodger Combs 

Reviewed-by: Tobias Rapp 
---
 doc/ffprobe.xsd |  1 +
 ffprobe.c   | 13 +
 tests/ref/fate/concat-demuxer-extended-lavf-mxf |  2 +-
 tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10 |  2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf  |  2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10  |  2 +-
 tests/ref/fate/concat-demuxer-simple2-lavf-ts   |  2 +-
 tests/ref/fate/ffprobe_compact  |  4 ++--
 tests/ref/fate/ffprobe_csv  |  4 ++--
 tests/ref/fate/ffprobe_default  |  2 ++
 tests/ref/fate/ffprobe_flat |  2 ++
 tests/ref/fate/ffprobe_ini  |  2 ++
 12 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/doc/ffprobe.xsd b/doc/ffprobe.xsd
index 757de12..ac0347f 100644
--- a/doc/ffprobe.xsd
+++ b/doc/ffprobe.xsd
@@ -201,6 +201,7 @@
   
   
   
+  
   
   
 
diff --git a/ffprobe.c b/ffprobe.c
index 662137c..7cd0034 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -2268,6 +2268,19 @@ static int show_stream(WriterContext *w, AVFormatContext 
*fmt_ctx, int stream_id
 else
 print_str_opt("chroma_location", 
av_chroma_location_name(par->chroma_location));
 
+if (par->field_order == AV_FIELD_PROGRESSIVE)
+print_str("field_order", "progressive");
+else if (par->field_order == AV_FIELD_TT)
+print_str("field_order", "tt");
+else if (par->field_order == AV_FIELD_BB)
+print_str("field_order", "bb");
+else if (par->field_order == AV_FIELD_TB)
+print_str("field_order", "tb");
+else if (par->field_order == AV_FIELD_BT)
+print_str("field_order", "bt");
+else
+print_str_opt("field_order", "unknown");
+
 #if FF_API_PRIVATE_OPT
 if (dec_ctx && dec_ctx->timecode_frame_start >= 0) {
 char tcbuf[AV_TIMECODE_STR_SIZE];
diff --git a/tests/ref/fate/concat-demuxer-extended-lavf-mxf 
b/tests/ref/fate/concat-demuxer-extended-lavf-mxf
index f7905aa..8bb2fb0 100644
--- a/tests/ref/fate/concat-demuxer-extended-lavf-mxf
+++ b/tests/ref/fate/concat-demuxer-extended-lavf-mxf
@@ -1 +1 @@
-21eb3a629ff504b55c93a66879a31362 
*tests/data/fate/concat-demuxer-extended-lavf-mxf.ffprobe
+a277e04c23cf764abe692ca07e87b82e 
*tests/data/fate/concat-demuxer-extended-lavf-mxf.ffprobe
diff --git a/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10 
b/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
index 0c49f1f..e294538 100644
--- a/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
+++ b/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
@@ -1 +1 @@
-67a03ad49f1bd17131f751313639b61e 
*tests/data/fate/concat-demuxer-extended-lavf-mxf_d10.ffprobe
+026045a43aa2dde1723d7331c2252b01 
*tests/data/fate/concat-demuxer-extended-lavf-mxf_d10.ffprobe
diff --git a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf 
b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
index 6bba76a..c899754 100644
--- a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
+++ b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
@@ -120,5 +120,5 @@ 
audio|1|65280|1.36|65280|1.36|1920|0.04|N/A|N/A|3840|206848|K_|1
 Strings Metadata|8
 video|0|37|1.48|34|1.36|1|0.04|N/A|N/A|24786|211456|K_|1
 Strings Metadata|8
-0|mpeg2video|4|video|1/25|[0][0][0][0]|0x|352|288|0|0|1|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|N/A|1|N/A|25/1|25/1|1/25|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|51|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
+0|mpeg2video|4|video|1/25|[0][0][0][0]|0x|352|288|0|0|1|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|progressive|N/A|1|N/A|25/1|25/1|1/25|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|51|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
 
1|pcm_s16le|unknown|audio|1/48000|[0][0][0][0]|0x|s16|48000|1|unknown|16|N/A|0/0|0/0|1/48000|0|0.00|N/A|N/A|768000|N/A|N/A|N/A|N/A|50|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
diff --git a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10 
b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10
index 75cac84..2ba3a2e 100644
--- a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10
+++ b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10
@@ -78,5 +78,5 @@ 
video|0|34|1.36|34|1.36|1|0.04|N/A|N/A|15|1923072|K_|1
 Strings Metadata|8
 audio|1|65280|1.36|65280|1.36|1920|0.04|N/A|N/A|7680|2073600|K_|1
 Strings Metadata|8
-0|mpeg2video|0|video|1/25|[0][0][0][0]|0x|720|608|0|0|0|1:1|45:38|yuv422p|5|tv|unknown|unknown|unknown|topleft|N/A|1|N/A|25/1|25/1|1/25|0|0.00|N/A|N/A|3000|N/A|N/A|N/A|N/A|35|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
+0|mpeg2video|0|video|1/25|[0][0][0][0]|0x|720|6

Re: [FFmpeg-devel] [PATCH 1/8] compat/cuda: add dynamic loader

2016-10-19 Thread Hendrik Leppkes
On Wed, Oct 19, 2016 at 2:00 PM, Timo Rothenpieler
 wrote:
> ---
>  compat/cuda/dynlink_cuda.h |  88 +
>  compat/cuda/dynlink_cuviddec.h | 808 
> +
>  compat/cuda/dynlink_loader.h   | 254 +
>  compat/cuda/dynlink_nvcuvid.h  | 316 
>  4 files changed, 1466 insertions(+)
>  create mode 100644 compat/cuda/dynlink_cuda.h
>  create mode 100644 compat/cuda/dynlink_cuviddec.h
>  create mode 100644 compat/cuda/dynlink_loader.h
>  create mode 100644 compat/cuda/dynlink_nvcuvid.h
>
> diff --git a/compat/cuda/dynlink_cuda.h b/compat/cuda/dynlink_cuda.h
> new file mode 100644
> index 000..908f12d
> --- /dev/null
> +++ b/compat/cuda/dynlink_cuda.h
> @@ -0,0 +1,88 @@
> +/*
> + * 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
> + */

So did you write this without once looking at the NVIDIA header file?
Because if you did even read it, then you can't realistically claim
this is LGPL.

> +
> +#if !defined(AV_COMPAT_DYNLINK_CUDA_H) && !defined(CUDA_VERSION)
> +#define AV_COMPAT_DYNLINK_CUDA_H
> +
> +#include 
> +
> +#define CUDA_VERSION 7050
> +
> +#if defined(_WIN32) || defined(__CYGWIN__)
> +#define CUDAAPI __stdcall
> +#else
> +#define CUDAAPI
> +#endif
> +
> +#define CU_CTX_SCHED_BLOCKING_SYNC 4
> +
> +typedef int CUdevice;
> +typedef void* CUarray;
> +typedef void* CUcontext;
> +#if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64)
> +typedef unsigned long long CUdeviceptr;
> +#else
> +typedef unsigned int CUdeviceptr;
> +#endif
> +
> +typedef enum cudaError_enum {
> +CUDA_SUCCESS = 0
> +} CUresult;
> +
> +typedef enum CUmemorytype_enum {
> +CU_MEMORYTYPE_HOST = 1,
> +CU_MEMORYTYPE_DEVICE = 2
> +} CUmemorytype;
> +
> +typedef struct CUDA_MEMCPY2D_st {
> +size_t srcXInBytes;
> +size_t srcY;
> +CUmemorytype srcMemoryType;
> +const void *srcHost;
> +CUdeviceptr srcDevice;
> +CUarray srcArray;
> +size_t srcPitch;
> +
> +size_t dstXInBytes;
> +size_t dstY;
> +CUmemorytype dstMemoryType;
> +void *dstHost;
> +CUdeviceptr dstDevice;
> +CUarray dstArray;
> +size_t dstPitch;
> +
> +size_t WidthInBytes;
> +size_t Height;
> +} CUDA_MEMCPY2D;
> +
> +typedef CUresult CUDAAPI tcuInit(unsigned int Flags);
> +typedef CUresult CUDAAPI tcuDeviceGetCount(int *count);
> +typedef CUresult CUDAAPI tcuDeviceGet(CUdevice *device, int ordinal);
> +typedef CUresult CUDAAPI tcuDeviceGetName(char *name, int len, CUdevice dev);
> +typedef CUresult CUDAAPI tcuDeviceComputeCapability(int *major, int *minor, 
> CUdevice dev);
> +typedef CUresult CUDAAPI tcuCtxCreate_v2(CUcontext *pctx, unsigned int 
> flags, CUdevice dev);
> +typedef CUresult CUDAAPI tcuCtxPushCurrent_v2(CUcontext *pctx);
> +typedef CUresult CUDAAPI tcuCtxPopCurrent_v2(CUcontext *pctx);
> +typedef CUresult CUDAAPI tcuCtxDestroy_v2(CUcontext ctx);
> +typedef CUresult CUDAAPI tcuMemAlloc_v2(CUdeviceptr *dptr, size_t bytesize);
> +typedef CUresult CUDAAPI tcuMemFree_v2(CUdeviceptr dptr);
> +typedef CUresult CUDAAPI tcuMemcpy2D_v2(const CUDA_MEMCPY2D *pcopy);
> +typedef CUresult CUDAAPI tcuGetErrorName(CUresult error, const char** pstr);
> +typedef CUresult CUDAAPI tcuGetErrorString(CUresult error, const char** 
> pstr);
> +
> +#endif
> diff --git a/compat/cuda/dynlink_cuviddec.h b/compat/cuda/dynlink_cuviddec.h
> new file mode 100644
> index 000..17207bc
> --- /dev/null
> +++ b/compat/cuda/dynlink_cuviddec.h
> @@ -0,0 +1,808 @@
> +/*
> + * This copyright notice applies to this header file only:
> + *
> + * Copyright (c) 2010-2016 NVIDIA Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person
> + * obtaining a copy of this software and associated documentation
> + * files (the "Software"), to deal in the Software without
> + * restriction, including without limitation the rights to use,
> + * copy, modify, merge, publish, distribute, sublicense, and/or sell
> + * copies of the software, and to permit persons to whom the
> + * software is furnished to do so, subject to the following
> + * conditions:
> + *
> + * The above copyright notice and this permission notice shall be
> + * included in all copies or substantial portions of the Software.
> + *
> + * THE SOF

Re: [FFmpeg-devel] [PATCH]nvenc: Add capability check for Temporal AQ

2016-10-19 Thread Hendrik Leppkes
On Wed, Oct 19, 2016 at 1:30 PM, Sven C. Dack  wrote:
> On 19/10/16 12:00, Hendrik Leppkes wrote:
>>
>> On Wed, Oct 19, 2016 at 12:20 PM, Sven C. Dack 
>> wrote:
>>>
>>> On 19/10/16 11:01, Yogender Kumar Gupta wrote:
>>
>> I've send in 3 patches regarding Nvidia stuff (1. check for temp aq,
>> 2.

 option for temp aq in hevc, 3. limitation work-around for scale npp),
 but
 there seems to be no maintainer present at the moment to pick them up...

 Tempoal AQ HEVC not supported yet.

>>> I cannot confirm. On some hardware it isn't, yes, but I don't own all
>>> Pascal
>>> cards
>>
>> All Pascal cards (releases so far) have the same hardware encoding block.
>
>
> Temporal AQ is implemented in CUDA, not in silicon.

Well you commented on hardware, so.

> Unless you can give good reasons why not to provide the flag do I not see
> why to hide it from users when it's already in the API and exists as a
> feature test.
>

If its entirely untested (due to being unsupported), it should not be
made available, and instead be added once it is supported and has been
confirmed to be working properly.
There is also no reason to add it if we know it doesn't work, it would
just be misleading to add an option, which then shows up in the help
output, if we already know it doesnt work anywhere (yet).

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


Re: [FFmpeg-devel] [PATCH 1/8] compat/cuda: add dynamic loader

2016-10-19 Thread Sven C. Dack

On 19/10/16 13:50, Hendrik Leppkes wrote:

On Wed, Oct 19, 2016 at 2:00 PM, Timo Rothenpieler
 wrote:

---
  compat/cuda/dynlink_cuda.h |  88 +
  compat/cuda/dynlink_cuviddec.h | 808 +
  compat/cuda/dynlink_loader.h   | 254 +
  compat/cuda/dynlink_nvcuvid.h  | 316 
  4 files changed, 1466 insertions(+)
  create mode 100644 compat/cuda/dynlink_cuda.h
  create mode 100644 compat/cuda/dynlink_cuviddec.h
  create mode 100644 compat/cuda/dynlink_loader.h
  create mode 100644 compat/cuda/dynlink_nvcuvid.h

diff --git a/compat/cuda/dynlink_cuda.h b/compat/cuda/dynlink_cuda.h
new file mode 100644
index 000..908f12d
--- /dev/null
+++ b/compat/cuda/dynlink_cuda.h
@@ -0,0 +1,88 @@
+/*
+ * 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
+ */

So did you write this without once looking at the NVIDIA header file?
Because if you did even read it, then you can't realistically claim
this is LGPL.


Nvidia's copyright notice seem pretty clear to me. It grants permission to 
sublicense it without limitation and without restriction. So which part exactly 
in Nvidia's copyright notice do you have a problem with?


PS: Try not to reply with the entire patch, but cut it off. It's not fun to 
scroll through the entire reply just to find it contains 2-3 lines of comment.



+/*
+ * This copyright notice applies to this header file only:
+ *
+ * Copyright (c) 2010-2016 NVIDIA Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the software, and to permit persons to whom the
+ * software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file cuviddec.h
+ * NvCuvid API provides Video Decoding interface to NVIDIA GPU devices.
+ * \date 2015-2016
+ * This file contains constants, structure definitions and function prototypes 
used for decoding.
+ */


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


Re: [FFmpeg-devel] [PATCH]nvenc: Add capability check for Temporal AQ

2016-10-19 Thread Sven C. Dack

On 19/10/16 14:24, Hendrik Leppkes wrote:

If its entirely untested (due to being unsupported), it should not be
made available, and instead be added once it is supported and has been
confirmed to be working properly.
There is also no reason to add it if we know it doesn't work, it would
just be misleading to add an option, which then shows up in the help
output, if we already know it doesnt work anywhere (yet).


No, it's not. It's been tested and working. It allows users to test it's 
availability in combination with hardware and libraries. It's even working when 
the capability test says it isn't supported, in which case the encoder continues 
to produce a valid output stream (this has been tested by me before I 
implemented the availability test).


What it may not do is to meet your expectations in the output. Yet, temporal aq 
can in fact produce an identical output in certain cases, which you shouldn't 
have a problem with. It's also not misleading when in the absence of an 
availability you then gets an error message informing you about the lack of support.


So I still don't see why you would want to object here. I personally see it as 
being on the same level with the latest developments by Nvidia.


May I ask, are you strongly against it?

Sven

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


Re: [FFmpeg-devel] [PATCH 1/8] compat/cuda: add dynamic loader

2016-10-19 Thread Timo Rothenpieler
>> +/*
>> + * 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
>> + */
> 
> So did you write this without once looking at the NVIDIA header file?
> Because if you did even read it, then you can't realistically claim
> this is LGPL.
> 

This file is entirely based on what was already in ffmpeg, or what was
available publicly via google search results.

I'm not sure if I ever opened and looked at cuda.h, but I definitely
avoided doing so when writing this header.

The only thing that was not obvious from already existing code in ffmpeg
was the CUDA_MEMCPY2D struct, which is conveniently documented by just
entering the struct name to Google:

https://www.cs.cmu.edu/afs/cs/academic/class/15668-s11/www/cuda-doc/html/group__CUDA__MEM_g27f885b30c34cc20a663a671dbf6fc27.html
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/8] compat/cuda: add dynamic loader

2016-10-19 Thread Hendrik Leppkes
On Wed, Oct 19, 2016 at 3:32 PM, Sven C. Dack  wrote:
> On 19/10/16 13:50, Hendrik Leppkes wrote:
>>
>> On Wed, Oct 19, 2016 at 2:00 PM, Timo Rothenpieler
>>  wrote:
>>>
>>> ---
>>>   compat/cuda/dynlink_cuda.h |  88 +
>>>   compat/cuda/dynlink_cuviddec.h | 808
>>> +
>>>   compat/cuda/dynlink_loader.h   | 254 +
>>>   compat/cuda/dynlink_nvcuvid.h  | 316 
>>>   4 files changed, 1466 insertions(+)
>>>   create mode 100644 compat/cuda/dynlink_cuda.h
>>>   create mode 100644 compat/cuda/dynlink_cuviddec.h
>>>   create mode 100644 compat/cuda/dynlink_loader.h
>>>   create mode 100644 compat/cuda/dynlink_nvcuvid.h
>>>
>>> diff --git a/compat/cuda/dynlink_cuda.h b/compat/cuda/dynlink_cuda.h
>>> new file mode 100644
>>> index 000..908f12d
>>> --- /dev/null
>>> +++ b/compat/cuda/dynlink_cuda.h
>>> @@ -0,0 +1,88 @@
>>> +/*
>>> + * 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
>>> + */
>>
>> So did you write this without once looking at the NVIDIA header file?
>> Because if you did even read it, then you can't realistically claim
>> this is LGPL.
>
>
> Nvidia's copyright notice seem pretty clear to me. It grants permission to
> sublicense it without limitation and without restriction. So which part
> exactly in Nvidia's copyright notice do you have a problem with?
>

You seem to be referring to the license of the cuvid files, which is
not the license actually used by the CUDA headers. The CUDA headers
are under a full proprietary license with no such permission.

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


[FFmpeg-devel] [PATCH] avfilter/showcqt: add cscheme option

2016-10-19 Thread Muhammad Faiz
Signed-off-by: Muhammad Faiz 
---
 doc/filters.texi  |  5 +
 libavfilter/avf_showcqt.c | 45 ++---
 libavfilter/avf_showcqt.h |  2 ++
 3 files changed, 41 insertions(+), 11 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 14c9b07..b470f40 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -16938,6 +16938,11 @@ BT.2020 with non-constant luminance
 
 @end table
 
+@item cscheme
+Set spectrogram color scheme. This is list of floating point values with format
+@code{left_r|left_g|left_b|right_r|right_g|right_b}.
+The default is @code{1|0.5|0|0|0.5|1}.
+
 @end table
 
 @subsection Examples
diff --git a/libavfilter/avf_showcqt.c b/libavfilter/avf_showcqt.c
index 37e20b4..49b950c 100644
--- a/libavfilter/avf_showcqt.c
+++ b/libavfilter/avf_showcqt.c
@@ -50,6 +50,7 @@
 #define FONTCOLOR   "st(0, (midi(f)-59.5)/12);" \
 "st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));" \
 "r(1-ld(1)) + b(ld(1))"
+#define CSCHEME "1|0.5|0|0|0.5|1"
 #define PTS_STEP 10
 #define PTS_TOLERANCE 1
 
@@ -96,6 +97,7 @@ static const AVOption showcqt_options[] = {
 { "smpte170m", "smpte170m", 0,  AV_OPT_TYPE_CONST, 
{ .i64 = AVCOL_SPC_SMPTE170M },   0, 0, FLAGS, "csp" },
 { "smpte240m", "smpte240m", 0,  AV_OPT_TYPE_CONST, 
{ .i64 = AVCOL_SPC_SMPTE240M },   0, 0, FLAGS, "csp" },
 { "bt2020ncl", "bt2020ncl", 0,  AV_OPT_TYPE_CONST, 
{ .i64 = AVCOL_SPC_BT2020_NCL },  0, 0, FLAGS, "csp" },
+{ "cscheme","set color scheme", OFFSET(cscheme),   AV_OPT_TYPE_STRING, 
{ .str = CSCHEME },   CHAR_MIN, CHAR_MAX, FLAGS },
 { NULL }
 };
 
@@ -725,24 +727,24 @@ static float calculate_gamma(float v, float g)
 return expf(logf(v) / g);
 }
 
-static void rgb_from_cqt(ColorFloat *c, const FFTComplex *v, float g, int len)
+static void rgb_from_cqt(ColorFloat *c, const FFTComplex *v, float g, int len, 
float cscheme[6])
 {
 int x;
 for (x = 0; x < len; x++) {
-c[x].rgb.r = 255.0f * calculate_gamma(FFMIN(1.0f, v[x].re), g);
-c[x].rgb.g = 255.0f * calculate_gamma(FFMIN(1.0f, 0.5f * (v[x].re + 
v[x].im)), g);
-c[x].rgb.b = 255.0f * calculate_gamma(FFMIN(1.0f, v[x].im), g);
+c[x].rgb.r = 255.0f * calculate_gamma(FFMIN(1.0f, cscheme[0] * v[x].re 
+ cscheme[3] * v[x].im), g);
+c[x].rgb.g = 255.0f * calculate_gamma(FFMIN(1.0f, cscheme[1] * v[x].re 
+ cscheme[4] * v[x].im), g);
+c[x].rgb.b = 255.0f * calculate_gamma(FFMIN(1.0f, cscheme[2] * v[x].re 
+ cscheme[5] * v[x].im), g);
 }
 }
 
-static void yuv_from_cqt(ColorFloat *c, const FFTComplex *v, float gamma, int 
len, float cm[3][3])
+static void yuv_from_cqt(ColorFloat *c, const FFTComplex *v, float gamma, int 
len, float cm[3][3], float cscheme[6])
 {
 int x;
 for (x = 0; x < len; x++) {
 float r, g, b;
-r = calculate_gamma(FFMIN(1.0f, v[x].re), gamma);
-g = calculate_gamma(FFMIN(1.0f, 0.5f * (v[x].re + v[x].im)), gamma);
-b = calculate_gamma(FFMIN(1.0f, v[x].im), gamma);
+r = calculate_gamma(FFMIN(1.0f, cscheme[0] * v[x].re + cscheme[3] * 
v[x].im), gamma);
+g = calculate_gamma(FFMIN(1.0f, cscheme[1] * v[x].re + cscheme[4] * 
v[x].im), gamma);
+b = calculate_gamma(FFMIN(1.0f, cscheme[2] * v[x].re + cscheme[5] * 
v[x].im), gamma);
 c[x].yuv.y = cm[0][0] * r + cm[0][1] * g + cm[0][2] * b;
 c[x].yuv.u = cm[1][0] * r + cm[1][1] * g + cm[1][2] * b;
 c[x].yuv.v = cm[2][0] * r + cm[2][1] * g + cm[2][2] * b;
@@ -1113,9 +1115,9 @@ static void process_cqt(ShowCQTContext *s)
 }
 
 if (s->format == AV_PIX_FMT_RGB24)
-rgb_from_cqt(s->c_buf, s->cqt_result, s->sono_g, s->width);
+rgb_from_cqt(s->c_buf, s->cqt_result, s->sono_g, s->width, 
s->cscheme_v);
 else
-yuv_from_cqt(s->c_buf, s->cqt_result, s->sono_g, s->width, s->cmatrix);
+yuv_from_cqt(s->c_buf, s->cqt_result, s->sono_g, s->width, s->cmatrix, 
s->cscheme_v);
 }
 
 static int plot_cqt(AVFilterContext *ctx, AVFrame **frameout)
@@ -1215,6 +1217,27 @@ static void init_colormatrix(ShowCQTContext *s)
 s->cmatrix[2][2] = -112.0 * kb / (1.0 - kr);
 }
 
+static int init_cscheme(ShowCQTContext *s)
+{
+char tail[2];
+int k;
+
+if (sscanf(s->cscheme, " %f | %f | %f | %f | %f | %f %1s", 
&s->cscheme_v[0],
+&s->cscheme_v[1], &s->cscheme_v[2], &s->cscheme_v[3], &s->cscheme_v[4],
+&s->cscheme_v[5], tail) != 6)
+goto fail;
+
+for (k = 0; k < 6; k++)
+if (isnan(s->cscheme_v[k]) || s->cscheme_v[k] < 0.0f || 
s->cscheme_v[k] > 1.0f)
+goto fail;
+
+return 0;
+
+fail:
+av_log(s->ctx, AV_LOG_ERROR, "invalid cscheme.\n");
+return AVERROR(EINVAL);
+}
+
 /* main filter control */
 static av_cold int init(AVFilterContext *ctx)
 {
@@ -1270,7 +1293,7 @@ static av_cold int init(AVFilterContext *ctx)
 
 init_colormatrix(s);
 
-retu

[FFmpeg-devel] [PATCH] avfilter/firequalizer: use zero phase kernel

2016-10-19 Thread Muhammad Faiz
this makes real-valued kernel

Signed-off-by: Muhammad Faiz 
---
 libavfilter/af_firequalizer.c | 26 +++---
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/libavfilter/af_firequalizer.c b/libavfilter/af_firequalizer.c
index e799e34..4988717 100644
--- a/libavfilter/af_firequalizer.c
+++ b/libavfilter/af_firequalizer.c
@@ -198,20 +198,19 @@ static void fast_convolute(FIREqualizerContext *s, const 
float *kernel_buf, floa
 if (nsamples <= s->nsamples_max) {
 float *buf = conv_buf + idx->buf_idx * s->rdft_len;
 float *obuf = conv_buf + !idx->buf_idx * s->rdft_len + 
idx->overlap_idx;
+int center = s->fir_len/2;
 int k;
 
-memcpy(buf, data, nsamples * sizeof(*data));
-memset(buf + nsamples, 0, (s->rdft_len - nsamples) * sizeof(*data));
+memset(buf, 0, center * sizeof(*data));
+memcpy(buf + center, data, nsamples * sizeof(*data));
+memset(buf + center + nsamples, 0, (s->rdft_len - nsamples - center) * 
sizeof(*data));
 av_rdft_calc(s->rdft, buf);
 
 buf[0] *= kernel_buf[0];
-buf[1] *= kernel_buf[1];
-for (k = 2; k < s->rdft_len; k += 2) {
-float re, im;
-re = buf[k] * kernel_buf[k] - buf[k+1] * kernel_buf[k+1];
-im = buf[k] * kernel_buf[k+1] + buf[k+1] * kernel_buf[k];
-buf[k] = re;
-buf[k+1] = im;
+buf[1] *= kernel_buf[s->rdft_len/2];
+for (k = 1; k < s->rdft_len/2; k++) {
+buf[2*k] *= kernel_buf[k];
+buf[2*k+1] *= kernel_buf[k];
 }
 
 av_rdft_calc(s->irdft, buf);
@@ -534,8 +533,8 @@ static int generate_kernel(AVFilterContext *ctx, const char 
*gain, const char *g
 }
 
 memset(s->analysis_buf + center + 1, 0, (s->analysis_rdft_len - 
s->fir_len) * sizeof(*s->analysis_buf));
-memcpy(rdft_buf, s->analysis_buf + s->analysis_rdft_len - center, 
center * sizeof(*s->analysis_buf));
-memcpy(rdft_buf + center, s->analysis_buf, (s->rdft_len - center) * 
sizeof(*s->analysis_buf));
+memcpy(rdft_buf, s->analysis_buf, s->rdft_len/2 * 
sizeof(*s->analysis_buf));
+memcpy(rdft_buf + s->rdft_len/2, s->analysis_buf + 
s->analysis_rdft_len - s->rdft_len/2, s->rdft_len/2 * sizeof(*s->analysis_buf));
 av_rdft_calc(s->rdft, rdft_buf);
 
 for (k = 0; k < s->rdft_len; k++) {
@@ -548,6 +547,11 @@ static int generate_kernel(AVFilterContext *ctx, const 
char *gain, const char *g
 }
 }
 
+rdft_buf[s->rdft_len-1] = rdft_buf[1];
+for (k = 0; k < s->rdft_len/2; k++)
+rdft_buf[k] = rdft_buf[2*k];
+rdft_buf[s->rdft_len/2] = rdft_buf[s->rdft_len-1];
+
 if (dump_fp)
 dump_fir(ctx, dump_fp, ch);
 
-- 
2.5.0

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


Re: [FFmpeg-devel] [PATCH] lavf: add ffprobe demuxer

2016-10-19 Thread Moritz Barsnick
On Tue, Oct 18, 2016 at 13:33:27 +0200, Stefano Sabatini wrote:
> > Latest patch in attachment with ffprobe demuxer disabled by default,
> > and extended documentation. (I'm also attaching the ff_get_line2 patch
> > which is used by this new patch).
> Updated, depends on the ff_get_line2() patch.
[...]
> +The ffprobe demuxer format is inspired by the output generated by the
> +ffprobe default format.

Unfortunately, you dropped the ffprobe command line which can be used
to create exactly that format. I found that quite practical.
(Presumably a mix of ffprobe "-show_format", "-show_streams",
"-show_packets -show_data"?) But I think it was incorrect anyway in the
previous patches. ;-)

> +A ffprobe demuxer file might look like this:
^ nit: An

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


Re: [FFmpeg-devel] [PATCH 1/8] compat/cuda: add dynamic loader

2016-10-19 Thread Sven C. Dack

On 19/10/16 15:25, Hendrik Leppkes wrote:

You seem to be referring to the license of the cuvid files, which is
not the license actually used by the CUDA headers. The CUDA headers
are under a full proprietary license with no such permission.


Are you saying the use of CUDA header files (with #include) during compilation 
makes ffmpeg itself non-free software?


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


Re: [FFmpeg-devel] [PATCH 1/8] compat/cuda: add dynamic loader

2016-10-19 Thread Hendrik Leppkes
On Wed, Oct 19, 2016 at 6:07 PM, Sven C. Dack  wrote:
> On 19/10/16 15:25, Hendrik Leppkes wrote:
>>
>> You seem to be referring to the license of the cuvid files, which is
>> not the license actually used by the CUDA headers. The CUDA headers
>> are under a full proprietary license with no such permission.
>
>
> Are you saying the use of CUDA header files (with #include) during
> compilation makes ffmpeg itself non-free software?
>

Thats the general interpretation of the license situation. If you
include non-free headers, your binary becomes non-free, hence why
building with cuda currently requires the --enable-nonfree option.

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


Re: [FFmpeg-devel] [PATCH 1/8] compat/cuda: add dynamic loader

2016-10-19 Thread Sven C. Dack

On 19/10/16 17:18, Hendrik Leppkes wrote:

Thats the general interpretation of the license situation. If you
include non-free headers, your binary becomes non-free, hence why
building with cuda currently requires the --enable-nonfree option.
No. This is a generalization and cannot make sense. At best does it ignore the 
individual licenses and their particular terms and discards them for a convenience.


From what I can tell does only one condition apply here, which is regarding the 
use of the header files. There is however no reproduction, disclosure, 
distribution or modification of these headers happening here, which is what is 
prohibited by Nvidia. The note about its use is then meant to free Nvidia itself 
from any warranty and liability claims and all they are asking is for users of 
their libraries and header files to include this note into their code. I find it 
absurd to claim this would make ffmpeg non-free software. Not to acknowledge 
Nvidia's wish for freedom is the same as trying to deny Nvidia their freedom. Or 
you could just absurdly claim that a license such as the GPL, requiring to be 
included at any time, would in itself be a limitation of your freedom and thus 
void the license and agreement. The last thing I want is for anyone to start 
wearing tin foil hats.


I believe a more sensible and reasonable view of the situation is needed here.

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


Re: [FFmpeg-devel] [PATCH 1/2] avformat/mov: zero initialize codec_name in mov_parse_stsd_video()

2016-10-19 Thread Andreas Cadhalpun
On 19.10.2016 04:15, James Almer wrote:
> On 10/17/2016 9:57 PM, Michael Niedermayer wrote:
>> On Sun, Oct 16, 2016 at 09:34:50PM -0300, James Almer wrote:
>>> Fixes valgrind warning about "Conditional jump or move depends on 
>>> uninitialised value(s)"
>>>
>>> Signed-off-by: James Almer 
>>> ---
>>>  libavformat/mov.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> This should be suppressable by adding it to
>> tests/fate-valgrind.supp
> 
> I'll leave that to someone else. No idea how to add stuff to that file.
> 
> Should i drop this patch? Zero initializing a buffer in stack wouldn't
> hurt IMO.

I prefer fixing such things in the code if it's reasonable possible, which
is the case here. In other words, the patch looks good to me.

Best regards,
Andreas

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


Re: [FFmpeg-devel] [PATCH] avformat: remove request_probe assert from ff_read_packet

2016-10-19 Thread Andreas Cadhalpun
On 19.10.2016 05:29, Michael Niedermayer wrote:
> hmm, i guess the patch is then ok
> alternatively you could use i think:
> @@ -803,7 +803,7 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
>  return ret;
>  for (i = 0; i < s->nb_streams; i++) {
>  st = s->streams[i];
> -if (st->probe_packets)
> +if (st->probe_packets || st->request_probe > 0)
>  if ((err = probe_codec(s, st, NULL)) < 0)
>  return err;
>  av_assert0(st->request_probe <= 0);

Yes, this works fine and should guarantee that the assert can't be triggered.
Patch doing it that way is attached.

Best regards,
Andreas

>From 7912c6f200a37130844221a73941a7971afa6455 Mon Sep 17 00:00:00 2001
From: Andreas Cadhalpun 
Date: Wed, 19 Oct 2016 19:23:49 +0200
Subject: [PATCH] avformat: prevent triggering request_probe assert in
 ff_read_packet

If probe_codec is called with pkt == NULL, it sets probe_packets to 0
and request_probe to -1.
However, request_probe can change when calling s->iformat->read_packet
and thus a probe_packets value of 0 doesn't guarantee a request_probe
value of -1.
In that case calling probe_codec again is necessary to prevent
triggering the assert.

Signed-off-by: Andreas Cadhalpun 
---
 libavformat/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 8a51aea..70dbfa1 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -803,7 +803,7 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
 return ret;
 for (i = 0; i < s->nb_streams; i++) {
 st = s->streams[i];
-if (st->probe_packets)
+if (st->probe_packets || st->request_probe > 0)
 if ((err = probe_codec(s, st, NULL)) < 0)
 return err;
 av_assert0(st->request_probe <= 0);
-- 
2.9.3

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


Re: [FFmpeg-devel] [PATCH 3/4] V13 - SCTE-35 support in hlsenc

2016-10-19 Thread Carlos Fernandez Sanz
On Sun, Oct 16, 2016 at 10:59 AM, Carlos Fernandez Sanz
 wrote:
>
> All other things corrected (I think) - will send a patch soon. Thanks!

I submitted V14 yesterday - can you take a look and comment and/or merge?

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


Re: [FFmpeg-devel] [PATCH 1/8] compat/cuda: add dynamic loader

2016-10-19 Thread Andreas Cadhalpun
On 19.10.2016 18:52, Sven C. Dack wrote:
> On 19/10/16 17:18, Hendrik Leppkes wrote:
>> Thats the general interpretation of the license situation. If you
>> include non-free headers, your binary becomes non-free, hence why
>> building with cuda currently requires the --enable-nonfree option.
> No. This is a generalization and cannot make sense. At best does it
> ignore the individual licenses and their particular terms and
> discards them for a convenience.
> 
> From what I can tell does only one condition apply here, which is
> regarding the use of the header files. There is however no
> reproduction, disclosure, distribution or modification of these
> headers happening here, which is what is prohibited by Nvidia.

I think you are missing the main problem here: FFmpeg is licensed
under the LGPL 2.1, which states [1]:
"  4. You may copy and distribute the Library [...] in object code
or executable form [...] provided that you accompany it with the
complete corresponding machine-readable source code"

If during compilation the cuda.h header is used, it is part of the
complete source code and thus the license requires it to be
distributed together with the object code. However, you say that
Nvidia prohibits re-distribution of this header and as a result
the compiled ffmpeg binaries cannot legally be distributed.

This is why it requires --enable-nonfree.

Best regards,
Andreas


1: https://www.gnu.org/licenses/lgpl-2.1.html
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/8] compat/cuda: add dynamic loader

2016-10-19 Thread Sven C. Dack

On 19/10/16 18:56, Andreas Cadhalpun wrote:

I think you are missing the main problem here: FFmpeg is licensed
under the LGPL 2.1, which states [1]:
"  4. You may copy and distribute the Library [...] in object code
or executable form [...] provided that you accompany it with the
complete corresponding machine-readable source code"

If during compilation the cuda.h header is used, it is part of the
complete source code and thus the license requires it to be
distributed together with the object code. However, you say that
Nvidia prohibits re-distribution of this header and as a result
the compiled ffmpeg binaries cannot legally be distributed.

This is why it requires --enable-nonfree.

Best regards,
Andreas

No. This is exactly what I meant with wearing tin foil hats. Just because a 
compiler includes information provided by header files into the compilation 
process does this not imply a transfer of ownership or copyright of this 
information. The header files do not become a part of the source code. You may 
find the ownership and copyright only no longer being easily distinguishable 
once it becomes a binary. The seperation is however still present and there is 
no magical transfer of ownership happening here. Even if there was, who is to 
say ffmpeg isn't becoming part of the header files and thus is now being owned 
by Nvidia?!? For this reason can such an interpretation of the GPL not make good 
sense. It's just absurd.


How is this with compiling under Windows or just using Intel's or Microsoft's 
compiler? Does this make ffmpeg non-free or does ffmpeg there claiming ownership 
over Intel's or Microsoft's header files?


Anyhow, I don't rally want to get too deep into this topic as this is just about 
configure options and I'm already using the --non-free option. I am merely 
curious about this interpretation of the GPL. I find the interpretation to be 
selfish and it's just asking to be challenged.


Sven

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


Re: [FFmpeg-devel] [PATCH] lavf/flvdec: init AVPacket::pos to FLVTAG offset

2016-10-19 Thread Michael Niedermayer
On Tue, Oct 18, 2016 at 03:13:23PM -0700, Suman- wrote:
> Current code doesn't initialize AVPacket::pos. Made it point to FLVTAG so 
> flv_read_packet can decode from pos
> ---
>  libavformat/flvdec.c|  1 +
>  tests/ref/seek/acodec-adpcm-swf | 46 
> -
>  tests/ref/seek/acodec-adpcm-swf-trellis | 46 
> -
>  tests/ref/seek/lavf-flv_fmt | 36 +-
>  tests/ref/seek/vsynth_lena-flashsv  | 40 ++--
>  tests/ref/seek/vsynth_lena-flv  | 40 ++--
>  6 files changed, 105 insertions(+), 104 deletions(-)

Is it intended that the author of this patch is set to "Suman-" ?

If its incomplete then please resubmit the patch with correctly set
author


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

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.


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


[FFmpeg-devel] [PATCH] aiffdec: fix division by zero

2016-10-19 Thread Andreas Cadhalpun
This is similar to commit c143a9c.

Signed-off-by: Andreas Cadhalpun 
---
 libavformat/aiffdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
index de82787..d96fc1d 100644
--- a/libavformat/aiffdec.c
+++ b/libavformat/aiffdec.c
@@ -391,7 +391,7 @@ static int aiff_read_packet(AVFormatContext *s,
 pkt->flags &= ~AV_PKT_FLAG_CORRUPT;
 /* Only one stream in an AIFF file */
 pkt->stream_index = 0;
-pkt->duration = (res / st->codecpar->block_align) * 
aiff->block_duration;
+pkt->duration = (res / (st->codecpar->block_align ? 
st->codecpar->block_align : 1)) * aiff->block_duration ;
 return 0;
 }
 
-- 
2.9.3
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf/flvdec: init AVPacket::pos to FLVTAG offset

2016-10-19 Thread సుమన్
Thanks for taking time to review my patch! I appreciate it very much!!

"Suman-" is my ID on github; Unless it is objectionable, I intend to use it
for code submissions.

Thanks!
Suman


On Wed, Oct 19, 2016 at 12:03 PM, Michael Niedermayer <
mich...@niedermayer.cc> wrote:

> On Tue, Oct 18, 2016 at 03:13:23PM -0700, Suman- wrote:
> > Current code doesn't initialize AVPacket::pos. Made it point to FLVTAG
> so flv_read_packet can decode from pos
> > ---
> >  libavformat/flvdec.c|  1 +
> >  tests/ref/seek/acodec-adpcm-swf | 46
> -
> >  tests/ref/seek/acodec-adpcm-swf-trellis | 46
> -
> >  tests/ref/seek/lavf-flv_fmt | 36 +-
> >  tests/ref/seek/vsynth_lena-flashsv  | 40
> ++--
> >  tests/ref/seek/vsynth_lena-flv  | 40
> ++--
> >  6 files changed, 105 insertions(+), 104 deletions(-)
>
> Is it intended that the author of this patch is set to "Suman-" ?
>
> If its incomplete then please resubmit the patch with correctly set
> author
>
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Many things microsoft did are stupid, but not doing something just because
> microsoft did it is even more stupid. If everything ms did were stupid they
> would be bankrupt already.
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>


-- 
Many thanks!
Suman
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/8] compat/cuda: add dynamic loader

2016-10-19 Thread Andreas Cadhalpun
On 19.10.2016 20:46, Sven C. Dack wrote:
> No. This is exactly what I meant with wearing tin foil hats.

Insults won't help you.

> Just because a compiler includes information provided by header
> files into the compilation process does this not imply a transfer
> of ownership or copyright of this information. The header files
> do not become a part of the source code. You may find the ownership
> and copyright only no longer being easily distinguishable once it
> becomes a binary. The seperation is however still present and there
> is no magical transfer of ownership happening here. Even if there
> was, who is to say ffmpeg isn't becoming part of the header files
> and thus is now being owned by Nvidia?!?

I wrote nothing about ownership.

> For this reason can such an interpretation of the GPL not make
> good sense. It's just absurd.

Have you actually read the license?

It clearly defines what complete source code means:
"For a library, complete source code means all the source code for
all modules it contains, plus any associated interface definition
files, plus the scripts used to control compilation and installation
of the library."

The FAQ explains this as [1]:
"For a typical C program, this translates into all the source code
(.c files) plus header files (.h files) plus the scripts used to control
compilation and installation."

> How is this with compiling under Windows or just using Intel's or
> Microsoft's compiler? Does this make ffmpeg non-free or does ffmpeg
> there claiming ownership over Intel's or Microsoft's header files?

Read the FAQ: "What about the compiler, the toolchain?"

Best regards,
Andreas


1: http://gpl-violations.org/faq/sourcecode-faq/

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


Re: [FFmpeg-devel] [PATCH 1/8] compat/cuda: add dynamic loader

2016-10-19 Thread Sven C. Dack

On 19/10/16 20:23, Andreas Cadhalpun wrote:

Read the FAQ: "What about the compiler, the toolchain?"

Best regards,
Andreas


1: http://gpl-violations.org/faq/sourcecode-faq/


You are misinterpreting it. The FAQ explicitly excludes external components such 
as compilers, kernels and libraries.


Anyhow, I don't want to challenge the interpretation. If this is what you want 
then I'm happy with the options as they are. I'm not bothered. :)


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


[FFmpeg-devel] [PATCH] dcstr: fix division by zero

2016-10-19 Thread Andreas Cadhalpun
Signed-off-by: Andreas Cadhalpun 
---
 libavformat/dcstr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/dcstr.c b/libavformat/dcstr.c
index 69fae41..d5d2281 100644
--- a/libavformat/dcstr.c
+++ b/libavformat/dcstr.c
@@ -47,7 +47,7 @@ static int dcstr_read_header(AVFormatContext *s)
 avio_skip(s->pb, 4);
 st->duration   = avio_rl32(s->pb);
 st->codecpar->channels   *= avio_rl32(s->pb);
-if (!align || align > INT_MAX / st->codecpar->channels)
+if (!align || !st->codecpar->channels || align > INT_MAX / 
st->codecpar->channels)
 return AVERROR_INVALIDDATA;
 st->codecpar->block_align = align * st->codecpar->channels;
 
-- 
2.9.3
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat: remove request_probe assert from ff_read_packet

2016-10-19 Thread Michael Niedermayer
On Wed, Oct 19, 2016 at 07:27:59PM +0200, Andreas Cadhalpun wrote:
> On 19.10.2016 05:29, Michael Niedermayer wrote:
> > hmm, i guess the patch is then ok
> > alternatively you could use i think:
> > @@ -803,7 +803,7 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
> >  return ret;
> >  for (i = 0; i < s->nb_streams; i++) {
> >  st = s->streams[i];
> > -if (st->probe_packets)
> > +if (st->probe_packets || st->request_probe > 0)
> >  if ((err = probe_codec(s, st, NULL)) < 0)
> >  return err;
> >  av_assert0(st->request_probe <= 0);
> 
> Yes, this works fine and should guarantee that the assert can't be triggered.
> Patch doing it that way is attached.
> 
> Best regards,
> Andreas
> 

>  utils.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> f1f2b8b10efdab27848eeb2e2bac646eda08a175  
> 0001-avformat-prevent-triggering-request_probe-assert-in-.patch
> From 7912c6f200a37130844221a73941a7971afa6455 Mon Sep 17 00:00:00 2001
> From: Andreas Cadhalpun 
> Date: Wed, 19 Oct 2016 19:23:49 +0200
> Subject: [PATCH] avformat: prevent triggering request_probe assert in
>  ff_read_packet
> 
> If probe_codec is called with pkt == NULL, it sets probe_packets to 0
> and request_probe to -1.
> However, request_probe can change when calling s->iformat->read_packet
> and thus a probe_packets value of 0 doesn't guarantee a request_probe
> value of -1.
> In that case calling probe_codec again is necessary to prevent
> triggering the assert.
> 
> Signed-off-by: Andreas Cadhalpun 
> ---
>  libavformat/utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

LGTM

thx

[...]


-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No great genius has ever existed without some touch of madness. -- Aristotle


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


Re: [FFmpeg-devel] [PATCH 1/8] compat/cuda: add dynamic loader

2016-10-19 Thread Andreas Cadhalpun
On 19.10.2016 21:41, Sven C. Dack wrote:
> You are misinterpreting it. The FAQ explicitly excludes external
> components such as compilers, kernels and libraries.

What is or is not a system component is quite debatable.
However, it always depends on the specific operating system under
consideration.
For example, my operating system doesn't (normally) come with the
cuda header.
However, a binary built with the header available could run on it.
This is problematic, because I couldn't rebuild the binary on the
system from the distributed source code.

> Anyhow, I don't want to challenge the interpretation. If this
> is what you want then I'm happy with the options as they are.
> I'm not bothered. :)

OK. :)

Best regards,
Andreas

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


Re: [FFmpeg-devel] [PATCH 3/3] fate: Add MXF D10/DV25 probe tests

2016-10-19 Thread Michael Niedermayer
On Wed, Oct 19, 2016 at 02:35:22PM +0200, Tobias Rapp wrote:
> Signed-off-by: Tobias Rapp 
> ---
>  tests/fate/mxf.mak| 19 ++-
>  tests/ref/fate/mxf-probe-d10  |  3 +++
>  tests/ref/fate/mxf-probe-dv25 |  4 
>  3 files changed, 25 insertions(+), 1 deletion(-)
>  create mode 100644 tests/ref/fate/mxf-probe-d10
>  create mode 100644 tests/ref/fate/mxf-probe-dv25

Applying: fate: Add MXF D10/DV25 probe tests
fatal: corrupt patch at line 60
didnt check deeply but some lines looks quite long, maybe something in
the mail chain didnt like that

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

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


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


[FFmpeg-devel] [PATCH] removing comma at final enumeration items to fix pedantic warnings

2016-10-19 Thread Michael Behrisch
Signed-off-by: Michael Behrisch 
---
 libavutil/log.h|  2 +-
 libavutil/pixfmt.h | 12 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavutil/log.h b/libavutil/log.h
index 0acc1b9..f0a5738 100644
--- a/libavutil/log.h
+++ b/libavutil/log.h
@@ -44,7 +44,7 @@ typedef enum {
 AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
 AV_CLASS_CATEGORY_DEVICE_OUTPUT,
 AV_CLASS_CATEGORY_DEVICE_INPUT,
-AV_CLASS_CATEGORY_NB, ///< not part of ABI/API
+AV_CLASS_CATEGORY_NB  ///< not part of ABI/API
 }AVClassCategory;

 #define AV_IS_INPUT_DEVICE(category) \
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index b15c0ef..7a3f68b 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -306,7 +306,7 @@ enum AVPixelFormat {

 AV_PIX_FMT_MEDIACODEC, ///< hardware decoding through MediaCodec

-AV_PIX_FMT_NB,///< number of pixel formats, DO NOT USE THIS
if you want to link with shared libav* because the number of formats
might differ between versions
+AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS
if you want to link with shared libav* because the number of formats
might differ between versions
 };

 #if AV_HAVE_BIGENDIAN
@@ -401,7 +401,7 @@ enum AVColorPrimaries {
 AVCOL_PRI_SMPTEST428_1 = 10, ///< SMPTE ST 428-1 (CIE 1931 XYZ)
 AVCOL_PRI_SMPTE431= 11, ///< SMPTE ST 431-2 (2011)
 AVCOL_PRI_SMPTE432= 12, ///< SMPTE ST 432-1 D65 (2010)
-AVCOL_PRI_NB,   ///< Not part of ABI
+AVCOL_PRI_NB///< Not part of ABI
 };

 /**
@@ -427,7 +427,7 @@ enum AVColorTransferCharacteristic {
 AVCOL_TRC_SMPTEST2084  = 16, ///< SMPTE ST 2084 for 10-, 12-, 14-
and 16-bit systems
 AVCOL_TRC_SMPTEST428_1 = 17, ///< SMPTE ST 428-1
 AVCOL_TRC_ARIB_STD_B67 = 18, ///< ARIB STD-B67, known as "Hybrid
log-gamma"
-AVCOL_TRC_NB,///< Not part of ABI
+AVCOL_TRC_NB ///< Not part of ABI
 };

 /**
@@ -446,7 +446,7 @@ enum AVColorSpace {
 AVCOL_SPC_BT2020_NCL  = 9,  ///< ITU-R BT2020 non-constant
luminance system
 AVCOL_SPC_BT2020_CL   = 10, ///< ITU-R BT2020 constant luminance system
 AVCOL_SPC_SMPTE2085   = 11, ///< SMPTE 2085, Y'D'zD'x
-AVCOL_SPC_NB,   ///< Not part of ABI
+AVCOL_SPC_NB///< Not part of ABI
 };
 #define AVCOL_SPC_YCGCO AVCOL_SPC_YCOCG

@@ -458,7 +458,7 @@ enum AVColorRange {
 AVCOL_RANGE_UNSPECIFIED = 0,
 AVCOL_RANGE_MPEG= 1, ///< the normal 219*2^(n-8) "MPEG" YUV
ranges
 AVCOL_RANGE_JPEG= 2, ///< the normal 2^n-1   "JPEG" YUV
ranges
-AVCOL_RANGE_NB,  ///< Not part of ABI
+AVCOL_RANGE_NB   ///< Not part of ABI
 };

 /**
@@ -484,7 +484,7 @@ enum AVChromaLocation {
 AVCHROMA_LOC_TOP = 4,
 AVCHROMA_LOC_BOTTOMLEFT  = 5,
 AVCHROMA_LOC_BOTTOM  = 6,
-AVCHROMA_LOC_NB,  ///< Not part of ABI
+AVCHROMA_LOC_NB   ///< Not part of ABI
 };

 #endif /* AVUTIL_PIXFMT_H */
-- 
2.6.6

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


Re: [FFmpeg-devel] [PATCH] avformat: remove request_probe assert from ff_read_packet

2016-10-19 Thread Andreas Cadhalpun
On 19.10.2016 22:45, Michael Niedermayer wrote:
> On Wed, Oct 19, 2016 at 07:27:59PM +0200, Andreas Cadhalpun wrote:
>> f1f2b8b10efdab27848eeb2e2bac646eda08a175  
>> 0001-avformat-prevent-triggering-request_probe-assert-in-.patch
>> From 7912c6f200a37130844221a73941a7971afa6455 Mon Sep 17 00:00:00 2001
>> From: Andreas Cadhalpun 
>> Date: Wed, 19 Oct 2016 19:23:49 +0200
>> Subject: [PATCH] avformat: prevent triggering request_probe assert in
>>  ff_read_packet
>>
>> If probe_codec is called with pkt == NULL, it sets probe_packets to 0
>> and request_probe to -1.
>> However, request_probe can change when calling s->iformat->read_packet
>> and thus a probe_packets value of 0 doesn't guarantee a request_probe
>> value of -1.
>> In that case calling probe_codec again is necessary to prevent
>> triggering the assert.
>>
>> Signed-off-by: Andreas Cadhalpun 
>> ---
>>  libavformat/utils.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> LGTM

Pushed.

Best regards,
Andreas

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


Re: [FFmpeg-devel] [PATCH 2/3] ffprobe: report field order for video streams

2016-10-19 Thread Michael Niedermayer
On Wed, Oct 19, 2016 at 02:35:21PM +0200, Tobias Rapp wrote:
> From: Rodger Combs 
> 
> Reviewed-by: Tobias Rapp 
> ---
>  doc/ffprobe.xsd |  1 +
>  ffprobe.c   | 13 +
>  tests/ref/fate/concat-demuxer-extended-lavf-mxf |  2 +-
>  tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10 |  2 +-
>  tests/ref/fate/concat-demuxer-simple1-lavf-mxf  |  2 +-
>  tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10  |  2 +-
>  tests/ref/fate/concat-demuxer-simple2-lavf-ts   |  2 +-
>  tests/ref/fate/ffprobe_compact  |  4 ++--
>  tests/ref/fate/ffprobe_csv  |  4 ++--
>  tests/ref/fate/ffprobe_default  |  2 ++
>  tests/ref/fate/ffprobe_flat |  2 ++
>  tests/ref/fate/ffprobe_ini  |  2 ++
>  12 files changed, 29 insertions(+), 9 deletions(-)

This too doesnt apply:

Applying: ffprobe: report field order for video streams
Using index info to reconstruct a base tree...
error: patch failed: tests/ref/fate/ffprobe_compact:27
error: tests/ref/fate/ffprobe_compact: patch does not apply
error: Did you hand edit your patch?
It does not apply to blobs recorded in its index.

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

Avoid a single point of failure, be that a person or equipment.


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


[FFmpeg-devel] [PATCH] rsd: limit number of channels

2016-10-19 Thread Andreas Cadhalpun
Negative values don't make sense and too large values can cause
overflows. For AV_CODEC_ID_ADPCM_THP this leads to a too small extradata
buffer being allocated, causing out-of-bounds writes.

Signed-off-by: Andreas Cadhalpun 
---
 libavformat/rsd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/rsd.c b/libavformat/rsd.c
index ee6fdfb..5a56e72 100644
--- a/libavformat/rsd.c
+++ b/libavformat/rsd.c
@@ -84,8 +84,10 @@ static int rsd_read_header(AVFormatContext *s)
 }
 
 par->channels = avio_rl32(pb);
-if (!par->channels)
+if (par->channels <= 0 || par->channels > INT_MAX / 36) {
+av_log(s, AV_LOG_ERROR, "Invalid number of channels: %d\n", 
par->channels);
 return AVERROR_INVALIDDATA;
+}
 
 avio_skip(pb, 4); // Bit depth
 par->sample_rate = avio_rl32(pb);
-- 
2.9.3
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] rsd: limit number of channels

2016-10-19 Thread Michael Niedermayer
On Wed, Oct 19, 2016 at 11:46:43PM +0200, Andreas Cadhalpun wrote:
> Negative values don't make sense and too large values can cause
> overflows. For AV_CODEC_ID_ADPCM_THP this leads to a too small extradata
> buffer being allocated, causing out-of-bounds writes.
> 
> Signed-off-by: Andreas Cadhalpun 
> ---
>  libavformat/rsd.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

LGTM

thx

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

Democracy is the form of government in which you can choose your dictator


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


Re: [FFmpeg-devel] [PATCH 1/8] compat/cuda: add dynamic loader

2016-10-19 Thread Philip Langdale
On Wed, 19 Oct 2016 14:00:29 +0200
Timo Rothenpieler  wrote:

> ---
>  compat/cuda/dynlink_cuda.h |  88 +
>  compat/cuda/dynlink_cuviddec.h | 808
> +
> compat/cuda/dynlink_loader.h   | 254 +
> compat/cuda/dynlink_nvcuvid.h  | 316  4 files
> changed, 1466 insertions(+) create mode 100644
> compat/cuda/dynlink_cuda.h create mode 100644
> compat/cuda/dynlink_cuviddec.h create mode 100644
> compat/cuda/dynlink_loader.h create mode 100644
> compat/cuda/dynlink_nvcuvid.h

I've been testing this patch test for Timo, and it's good by me.

Ship it.

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


[FFmpeg-devel] [PATCH] lavc/videotoolbox: fix avcc creation for h264 streams missing extradata

2016-10-19 Thread Aman Gupta
From: Aman Gupta 

ff_videotoolbox_avcc_extradata_create() was never being called if
avctx->extradata_size==0, even though the function does not need or use
the avctx->extradata.

This manifested itself only on h264 streams in specific containers, and
only on iOS. I guess the macOS version of VideoToolbox is more
forgiving, atleast on my specific combination of OS version and hardware.

I also added an error log message when VTDecompressionSessionCreate()
fails, to help the next poor soul who runs into a bug in this area of the
code. The native OSStatus error codes are much easier to google than
their AVERROR counterparts (especially in this case, with AVERROR_UNKNOWN).
---
 libavcodec/videotoolbox.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 1288aa5..b21eccb 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -413,7 +413,7 @@ static CFDictionaryRef 
videotoolbox_decoder_config_create(CMVideoCodecType codec
  
kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder,
  kCFBooleanTrue);
 
-if (avctx->extradata_size) {
+if (avctx->extradata_size || codec_type == kCMVideoCodecType_H264) {
 CFMutableDictionaryRef avc_info;
 CFDataRef data = NULL;
 
@@ -572,13 +572,16 @@ static int videotoolbox_default_init(AVCodecContext 
*avctx)
 if (buf_attr)
 CFRelease(buf_attr);
 
+if (status != 0)
+av_log(avctx, AV_LOG_ERROR, "Error creating videotoolbox decompression 
session: %d\n", status);
+
 switch (status) {
 case kVTVideoDecoderNotAvailableNowErr:
 case kVTVideoDecoderUnsupportedDataFormatErr:
 return AVERROR(ENOSYS);
 case kVTVideoDecoderMalfunctionErr:
 return AVERROR(EINVAL);
-case kVTVideoDecoderBadDataErr :
+case kVTVideoDecoderBadDataErr:
 return AVERROR_INVALIDDATA;
 case 0:
 return 0;
-- 
2.8.1

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


Re: [FFmpeg-devel] [PATCH] aiffdec: fix division by zero

2016-10-19 Thread Michael Niedermayer
On Wed, Oct 19, 2016 at 09:18:51PM +0200, Andreas Cadhalpun wrote:
> This is similar to commit c143a9c.
> 
> Signed-off-by: Andreas Cadhalpun 
> ---
>  libavformat/aiffdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

can aiff work without block_align ?

either way, block_duration is from the header reading
if its still accurate then using it together with 1 instead of the
matching block align is quite likely not correct
OTOH if block_duration does not represent the actual content then
the duration would only be correct by pure chance

Its a bit unfortunate that theres no usecase with an undamaged sample
which would have clear correct values

one has to work on the assumptation of a use case where the user needs
to override the codec and then ask "what is correct to do" that makes
this a bit tricky ...

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are best at talking, realize last or never when they are wrong.


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


Re: [FFmpeg-devel] [PATCH] dcstr: fix division by zero

2016-10-19 Thread Michael Niedermayer
On Wed, Oct 19, 2016 at 10:41:22PM +0200, Andreas Cadhalpun wrote:
> Signed-off-by: Andreas Cadhalpun 
> ---
>  libavformat/dcstr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/dcstr.c b/libavformat/dcstr.c
> index 69fae41..d5d2281 100644
> --- a/libavformat/dcstr.c
> +++ b/libavformat/dcstr.c
> @@ -47,7 +47,7 @@ static int dcstr_read_header(AVFormatContext *s)
>  avio_skip(s->pb, 4);
>  st->duration   = avio_rl32(s->pb);

>  st->codecpar->channels   *= avio_rl32(s->pb);

This here can overflow and needs a check


> -if (!align || align > INT_MAX / st->codecpar->channels)
> +if (!align || !st->codecpar->channels || align > INT_MAX / 
> st->codecpar->channels)
>  return AVERROR_INVALIDDATA;

might need a <0 check too should be ok otherwise

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

Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato 


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


Re: [FFmpeg-devel] [PATCH 1/2] avformat/mov: zero initialize codec_name in mov_parse_stsd_video()

2016-10-19 Thread Michael Niedermayer
On Wed, Oct 19, 2016 at 07:30:29PM +0200, Andreas Cadhalpun wrote:
> On 19.10.2016 04:15, James Almer wrote:
> > On 10/17/2016 9:57 PM, Michael Niedermayer wrote:
> >> On Sun, Oct 16, 2016 at 09:34:50PM -0300, James Almer wrote:
> >>> Fixes valgrind warning about "Conditional jump or move depends on 
> >>> uninitialised value(s)"
> >>>
> >>> Signed-off-by: James Almer 
> >>> ---
> >>>  libavformat/mov.c | 2 +-
> >>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> This should be suppressable by adding it to
> >> tests/fate-valgrind.supp
> > 
> > I'll leave that to someone else. No idea how to add stuff to that file.
> > 
> > Should i drop this patch? Zero initializing a buffer in stack wouldn't
> > hurt IMO.
> 
> I prefer fixing such things in the code if it's reasonable possible, which
> is the case here. In other words, the patch looks good to me.

I think the bug is that valgrind misinterprets highly optimized libc/gcc
code, i might be wrong though as i didnt disassemble and analyze this,
that was just my feeling ...
But if true a change to ffmpeg can only workaround but not fix this


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

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin


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


Re: [FFmpeg-devel] [PATCH] removing comma at final enumeration items to fix pedantic warnings

2016-10-19 Thread Michael Niedermayer
On Wed, Oct 19, 2016 at 11:11:21PM +0200, Michael Behrisch wrote:
> Signed-off-by: Michael Behrisch 
> ---
>  libavutil/log.h|  2 +-
>  libavutil/pixfmt.h | 12 ++--
>  2 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/libavutil/log.h b/libavutil/log.h
> index 0acc1b9..f0a5738 100644
> --- a/libavutil/log.h
> +++ b/libavutil/log.h
> @@ -44,7 +44,7 @@ typedef enum {
>  AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
>  AV_CLASS_CATEGORY_DEVICE_OUTPUT,
>  AV_CLASS_CATEGORY_DEVICE_INPUT,
> -AV_CLASS_CATEGORY_NB, ///< not part of ABI/API
> +AV_CLASS_CATEGORY_NB  ///< not part of ABI/API
>  }AVClassCategory;
> 
>  #define AV_IS_INPUT_DEVICE(category) \
> diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
> index b15c0ef..7a3f68b 100644
> --- a/libavutil/pixfmt.h
> +++ b/libavutil/pixfmt.h
> @@ -306,7 +306,7 @@ enum AVPixelFormat {
> 
>  AV_PIX_FMT_MEDIACODEC, ///< hardware decoding through MediaCodec
> 
> -AV_PIX_FMT_NB,///< number of pixel formats, DO NOT USE THIS
> if you want to link with shared libav* because the number of formats
> might differ between versions
> +AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS
> if you want to link with shared libav* because the number of formats
> might differ between versions
>  };

patch is corrupted by newlines / word wrap

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

The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"


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


Re: [FFmpeg-devel] [PATCH] removing comma at final enumeration items to fix pedantic warnings

2016-10-19 Thread Muhammad Faiz
On 10/20/16, Michael Behrisch  wrote:
> Signed-off-by: Michael Behrisch 
> ---
>  libavutil/log.h|  2 +-
>  libavutil/pixfmt.h | 12 ++--
>  2 files changed, 7 insertions(+), 7 deletions(-)

If you have difficulty to send your patch directly (you should use git
send-email, not just copy paste), you may send it as an attachment.

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


Re: [FFmpeg-devel] [PATCH] removing comma at final enumeration items to fix pedantic warnings

2016-10-19 Thread Ronald S. Bultje
Hi,

On Wed, Oct 19, 2016 at 5:11 PM, Michael Behrisch  wrote:

> Signed-off-by: Michael Behrisch 
> ---
>  libavutil/log.h|  2 +-
>  libavutil/pixfmt.h | 12 ++--
>  2 files changed, 7 insertions(+), 7 deletions(-)


FWIW I still have doubts about this.

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


Re: [FFmpeg-devel] [PATCH] removing comma at final enumeration items to fix pedantic warnings

2016-10-19 Thread Michael Behrisch
Am 20.10.2016 um 04:18 schrieb Muhammad Faiz:
> On 10/20/16, Michael Behrisch  wrote:
>> Signed-off-by: Michael Behrisch 
>> ---
>>  libavutil/log.h|  2 +-
>>  libavutil/pixfmt.h | 12 ++--
>>  2 files changed, 7 insertions(+), 7 deletions(-)
> 
> If you have difficulty to send your patch directly (you should use git
> send-email, not just copy paste), you may send it as an attachment.

Sorry about that, still struggling a little with git. I did not know how
to insert the signed off when using send-email.

I hope the new patch (in the separate mail) is fine.

Best regards,
Michael




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