[FFmpeg-devel] [PATCH] libavcodec/libopenjpegenc: don't define OPJ_STATIC with openjpeg 2.1.1
This fixes bug #5694 and builds with libopenjpeg 2.1.1. openjpeg commit 3ed5858902055d3500a6ab183f1395686921d026 hides all symbols with __attribute__ ((visibility ("hidden"))) if OPJ_STATIC is defined Signed-off-by: Kia--- libavcodec/libopenjpegdec.c | 1 + libavcodec/libopenjpegenc.c | 1 + 2 files changed, 2 insertions(+) diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c index 65167e6..efc0648 100644 --- a/libavcodec/libopenjpegdec.c +++ b/libavcodec/libopenjpegdec.c @@ -37,6 +37,7 @@ #include "thread.h" #if HAVE_OPENJPEG_2_1_OPENJPEG_H +#undef OPJ_STATIC # include #elif HAVE_OPENJPEG_2_0_OPENJPEG_H # include diff --git a/libavcodec/libopenjpegenc.c b/libavcodec/libopenjpegenc.c index 1443551..2bc75e2 100644 --- a/libavcodec/libopenjpegenc.c +++ b/libavcodec/libopenjpegenc.c @@ -35,6 +35,7 @@ #include "internal.h" #if HAVE_OPENJPEG_2_1_OPENJPEG_H +#undef OPJ_STATIC # include #elif HAVE_OPENJPEG_2_0_OPENJPEG_H # include -- 2.9.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [GSoC] Motion Interpolation
https://github.com/dsmudhar/FFmpeg/commits/dev The Paper 2 algorithm is complete. It seems good. If I compare Paper 2 (which uses bilateral motion estimation) v/s motion vectors exported by mEstimate filter: $ tiny_psnr 60_source_2.yuv 60_mest-esa+obmc.yuv stddev:1.43 PSNR: 45.02 MAXDIFF: 174 bytes:476928000/474163200 $ tiny_psnr 60_source_2.yuv 60_paper2_aobmc+cls.yuv stddev:1.25 PSNR: 46.18 MAXDIFF: 187 bytes:476928000/474163200 Frame comparison: http://www.mediafire.com/?qe7sc4o0s4hgug5 Compared to simple OBMC which over-smooth edges, Objects clustering and Adaptive OBMC makes the edges crisp but also introduce blocking artifacts where MVs are bad (with default search window = 7). But I think it’s ESA’s fault. The paper doesn’t specify which motion estimation method they used; I have been using ESA. I think quality can be further improved with EPZS, which I'm going to implement. I also tried to tweak VS-BMC (Variable size block motion compensation) which reduced the blocking artifacts in VS-BMC area. Had to do experiments a lot, more to be done. mEstimate filter (ESA) + Simple OBMC: http://www.mediafire.com/?3b8j1zj1lsuw979 Paper 2 (full): http://www.mediafire.com/?npbw1iv6tmxwvyu Regards, DSM_ ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/fivdec: cached keyframes before video or audio stream was created
2016-07-25 10:29 GMT+08:00 XinZheng Zhang: > Ping. > > On Thu, Jul 21, 2016 at 11:59 AM, XinZheng Zhang > wrote: > > On Thu, Jul 21, 2016 at 5:03 AM, Moritz Barsnick > wrote: > >> On Thu, Jul 21, 2016 at 00:06:44 +0800, zhangxinzheng wrote: > >> > >>> Subject: [FFmpeg-devel] [PATCH] avformat/fivdec: cached keyframes > before video or audio stream was created > >>^^^ flv > >> > >>> There has an error when seeking in a flv file, which key frames was > >>> sorted before video frame. > >>> This ensures that all the key frames was cached, and add to > >>> corresponding stream when it was created. > >> > >> Thanks to the grammar, I don't understand the intent of the patch. > >> (Don't get me wrong, I'm not scorning your English, but it needs to be > >> improved.) > >> > > > > In flvdec.c 420 > > case AMF_DATA_TYPE_OBJECT: > > if ((vstream || astream) && key && > > ioc->seekable && > > !strcmp(KEYFRAMES_TAG, key) && depth == 1) > > if (parse_keyframes_index(s, ioc, vstream ? vstream : astream, > > max_pos) < 0) > > > > If the first packet we got is object, both vstream and astream are NULL, > > that may prevent keyframe index being parsed. > > > > This patch saves keyframe index before A/V streams are created. > > > > The issue was introduced since 09ae7b81ea. > > > > I have created a ticket #5729 with a sample attatched. > > > >>> #define RESYNC_BUFFER_SIZE (1<<20) > >>> > >>> + > >>> +typedef struct FLVKeyFrame { > >> > >> Why the extra newline? > >> > > > https://trac.ffmpeg.org/ticket/5729#comment:1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc: always build dnxhddata
On 7/24/2016 8:13 PM, Michael Niedermayer wrote: > On Sun, Jul 24, 2016 at 06:52:50PM -0300, James Almer wrote: >> On 7/24/2016 6:14 PM, Michael Niedermayer wrote: >>> On Sun, Jul 24, 2016 at 06:04:18PM -0300, James Almer wrote: On 7/24/2016 5:59 PM, Matthieu Bouron wrote: > On Sun, Jul 24, 2016 at 10:53:51PM +0200, Michael Niedermayer wrote: >> On Sun, Jul 24, 2016 at 10:40:58PM +0200, Michael Niedermayer wrote: >>> On Sun, Jul 24, 2016 at 10:30:35PM +0200, Matthieu Bouron wrote: From: Matthieu Bouronlavc/movenc rely on avpriv_dnxhd_parse_header_prefix declared by dnxhddata.h since e47981dab7fb7c9499b959cb0125b7281301969a. Fixes a missing symbol error in lavc/movenc if the dnxhd encoder is not enabled. --- libavcodec/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index abef19e..4fc4b09 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -32,6 +32,7 @@ OBJS = allcodecs.o \ codec_desc.o \ d3d11va.o \ dirac.o \ + dnxhddata.o \ dv_profile.o \ imgconvert.o \ jni.o \ @@ -241,8 +242,8 @@ OBJS-$(CONFIG_DIRAC_DECODER) += diracdec.o dirac.o diracdsp.o diractab dirac_arith.o mpeg12data.o dirac_dwt.o \ dirac_vlc.o OBJS-$(CONFIG_DFA_DECODER) += dfa.o -OBJS-$(CONFIG_DNXHD_DECODER) += dnxhddec.o dnxhddata.o -OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o dnxhddata.o +OBJS-$(CONFIG_DNXHD_DECODER) += dnxhddec.o +OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o >>> >>> why dont you add dnxhddata.o to the demuxer needing it ? >> >> patch ok, i missed that this was a dependancy between the 2 libs >> thought it was within a lib > > Pushed. Thanks. > > Matthieu Please revert this change and instead add a "OBJS-$(CONFIG_MOV_MUXER) += dnxhddata.o" line to the libavformat dependencies section. >>> >>> doesnt this break the ABI of libavcodec ? >> >> No more than it already is, assuming this can be considered a >> mistake in how avpriv functions are made available. > > yes > > >> >> dnxhddata.c contains like three avpriv functions, the oldest >> from 2013, and the file has never been built unconditionally. >> Any ffmpeg build without dnxhd de/encoder, mxf muxer or dnxhd >> demuxer from the past few years hasn't built it. >> There are other files, like mpeg4audio.c, that are also not >> built unconditionally and also have avpriv functions. > > yes > but tradition doesnt make it correct > i think this hasnt hit anyone because its a problem for mainstream > distros that care about ABI and they dont disable alot of stuff > People disabling alot of stuff are probably building for a > specifici use case, some embeded system some debuging case whatever > they likely arent affected or concerned by the build libs all > changing ABI together > > >> >>> either avpriv_dnxhd_parse_header_prefix is part of the ABI of >>> libavcodec or its not >> > >> If avpriv functions are meant to be part of the ABI and their >> presence not depend on configure time options, then that's >> something that will have to be changed across the codebase >> in general. > > yes > > They have to be part of the ABI though because only the ABI can be > used from outside and they are used from outside the lib > > if you want an hypothetical example where the current code breaks > 1. a distro maintainer rebuilding the libs with some things disabled > 2. a user installing a new package that pulls in a new libavcodec >(could be a video player) but not libavformat > 3. everything using libavformat breaks due to missing symbbols > > removing a function from the ABI requires a major version and soname > bump > > we could document that changing the configure options affect the ABI > but that would be very unfriendly to distro maintainers A change in configure options can affect even public API right now. See avutil's opencl and lzo modules. We should probably change them to behave like
Re: [FFmpeg-devel] [PATCH] avformat/fivdec: cached keyframes before video or audio stream was created
Ping. On Thu, Jul 21, 2016 at 11:59 AM, XinZheng Zhangwrote: > On Thu, Jul 21, 2016 at 5:03 AM, Moritz Barsnick wrote: >> On Thu, Jul 21, 2016 at 00:06:44 +0800, zhangxinzheng wrote: >> >>> Subject: [FFmpeg-devel] [PATCH] avformat/fivdec: cached keyframes before >>> video or audio stream was created >>^^^ flv >> >>> There has an error when seeking in a flv file, which key frames was >>> sorted before video frame. >>> This ensures that all the key frames was cached, and add to >>> corresponding stream when it was created. >> >> Thanks to the grammar, I don't understand the intent of the patch. >> (Don't get me wrong, I'm not scorning your English, but it needs to be >> improved.) >> > > In flvdec.c 420 > case AMF_DATA_TYPE_OBJECT: > if ((vstream || astream) && key && > ioc->seekable && > !strcmp(KEYFRAMES_TAG, key) && depth == 1) > if (parse_keyframes_index(s, ioc, vstream ? vstream : astream, > max_pos) < 0) > > If the first packet we got is object, both vstream and astream are NULL, > that may prevent keyframe index being parsed. > > This patch saves keyframe index before A/V streams are created. > > The issue was introduced since 09ae7b81ea. > > I have created a ticket #5729 with a sample attatched. > >>> #define RESYNC_BUFFER_SIZE (1<<20) >>> >>> + >>> +typedef struct FLVKeyFrame { >> >> Why the extra newline? >> > > The extra newline has been removed in new patch. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Outreachy 2016 december
Hi On Sat, Jul 23, 2016 at 03:36:53PM -0700, Yayoi Ukai wrote: > On Jul 22, 2016 10:18 AM, "Michael Niedermayer"> wrote: > > > > On Wed, Jul 06, 2016 at 11:25:21PM +0200, Michael Niedermayer wrote: > > > Hi all > > > > > > The next Outreachy round starts soon > > > FFmpeg has till august 22 IIUC (https://www.gnome.org/outreachy/) > > > to express interrest to participate. > > > > > > We need an admin and backup admins. > > > > ping! > > Hi everyone! > > I'm happy to help with the administrative tasks of this project. As far as > Outreachy goes, I will not be able to fully commit as a participant. I can > help with fundraising, recruitment, and any administrarative tasks that you > would like me to assist with. I would be happy to contribute code, but I > would be limited to 10 hours per week working on small coding projects. I > attempted to familiarise myself with Trac, but there are still some aspects > of it I need guidance with. If there are any documentation available that I > am not aware of, I would be happy to review it. about trac in general there is: https://trac.ffmpeg.org/wiki/TracGuide but simply looking at some existing trac wiki page (by clicking on "Edit this page" but not changing it just looking at whats there for various constructs) should explain the trac wiki well enough to create new pages ... you can also use the text from "Edit this page" to copy wiki text to a new page like copying parts of the last outreachy page to a new If you like you surely can create the next outreachy page from the previous Outreachy and GSoC page It would be needed to check that the mentors and admins listed previously are still able to spend te time & available and that their projects are still available too. Also people should be suggested to help improve the page. add projects, volunteer as mentors, and so on ... [...] thanks -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Awnsering whenever a program halts or runs forever is On a turing machine, in general impossible (turings halting problem). On any real computer, always possible as a real computer has a finite number of states N, and will either halt in less than N cycles or never halt. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc: always build dnxhddata
On Sun, Jul 24, 2016 at 06:52:50PM -0300, James Almer wrote: > On 7/24/2016 6:14 PM, Michael Niedermayer wrote: > > On Sun, Jul 24, 2016 at 06:04:18PM -0300, James Almer wrote: > >> On 7/24/2016 5:59 PM, Matthieu Bouron wrote: > >>> On Sun, Jul 24, 2016 at 10:53:51PM +0200, Michael Niedermayer wrote: > On Sun, Jul 24, 2016 at 10:40:58PM +0200, Michael Niedermayer wrote: > > On Sun, Jul 24, 2016 at 10:30:35PM +0200, Matthieu Bouron wrote: > >> From: Matthieu Bouron> >> > >> lavc/movenc rely on avpriv_dnxhd_parse_header_prefix declared by > >> dnxhddata.h since e47981dab7fb7c9499b959cb0125b7281301969a. > >> > >> Fixes a missing symbol error in lavc/movenc if the dnxhd encoder is not > >> enabled. > >> --- > >> libavcodec/Makefile | 5 +++-- > >> 1 file changed, 3 insertions(+), 2 deletions(-) > >> > >> diff --git a/libavcodec/Makefile b/libavcodec/Makefile > >> index abef19e..4fc4b09 100644 > >> --- a/libavcodec/Makefile > >> +++ b/libavcodec/Makefile > >> @@ -32,6 +32,7 @@ OBJS = allcodecs.o > >>\ > >> codec_desc.o > >> \ > >> d3d11va.o > >> \ > >> dirac.o > >> \ > >> + dnxhddata.o > >> \ > >> dv_profile.o > >> \ > >> imgconvert.o > >> \ > >> jni.o > >> \ > >> @@ -241,8 +242,8 @@ OBJS-$(CONFIG_DIRAC_DECODER) += > >> diracdec.o dirac.o diracdsp.o diractab > >>dirac_arith.o mpeg12data.o > >> dirac_dwt.o \ > >>dirac_vlc.o > >> OBJS-$(CONFIG_DFA_DECODER) += dfa.o > >> -OBJS-$(CONFIG_DNXHD_DECODER) += dnxhddec.o dnxhddata.o > >> -OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o dnxhddata.o > >> +OBJS-$(CONFIG_DNXHD_DECODER) += dnxhddec.o > >> +OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o > > > > why dont you add dnxhddata.o to the demuxer needing it ? > > patch ok, i missed that this was a dependancy between the 2 libs > thought it was within a lib > >>> > >>> Pushed. Thanks. > >>> > >>> Matthieu > >> > >> Please revert this change and instead add a > >> "OBJS-$(CONFIG_MOV_MUXER) += dnxhddata.o" line to the libavformat > >> dependencies section. > > > > doesnt this break the ABI of libavcodec ? > > No more than it already is, assuming this can be considered a > mistake in how avpriv functions are made available. yes > > dnxhddata.c contains like three avpriv functions, the oldest > from 2013, and the file has never been built unconditionally. > Any ffmpeg build without dnxhd de/encoder, mxf muxer or dnxhd > demuxer from the past few years hasn't built it. > There are other files, like mpeg4audio.c, that are also not > built unconditionally and also have avpriv functions. yes but tradition doesnt make it correct i think this hasnt hit anyone because its a problem for mainstream distros that care about ABI and they dont disable alot of stuff People disabling alot of stuff are probably building for a specifici use case, some embeded system some debuging case whatever they likely arent affected or concerned by the build libs all changing ABI together > > > either avpriv_dnxhd_parse_header_prefix is part of the ABI of > > libavcodec or its not > > If avpriv functions are meant to be part of the ABI and their > presence not depend on configure time options, then that's > something that will have to be changed across the codebase > in general. yes They have to be part of the ABI though because only the ABI can be used from outside and they are used from outside the lib if you want an hypothetical example where the current code breaks 1. a distro maintainer rebuilding the libs with some things disabled 2. a user installing a new package that pulls in a new libavcodec (could be a video player) but not libavformat 3. everything using libavformat breaks due to missing symbbols removing a function from the ABI requires a major version and soname bump we could document that changing the configure options affect the ABI but that would be very unfriendly to distro maintainers maybe we can just enable the conditional parts when shared libs are enabled. This without much thinking seems a possible solution that would if its enough be better than fully unconditional. But if we go this way someone should think about if this is really enough first ... >
Re: [FFmpeg-devel] [PATCH] lavc: always build dnxhddata
On 7/24/2016 6:14 PM, Michael Niedermayer wrote: > On Sun, Jul 24, 2016 at 06:04:18PM -0300, James Almer wrote: >> On 7/24/2016 5:59 PM, Matthieu Bouron wrote: >>> On Sun, Jul 24, 2016 at 10:53:51PM +0200, Michael Niedermayer wrote: On Sun, Jul 24, 2016 at 10:40:58PM +0200, Michael Niedermayer wrote: > On Sun, Jul 24, 2016 at 10:30:35PM +0200, Matthieu Bouron wrote: >> From: Matthieu Bouron>> >> lavc/movenc rely on avpriv_dnxhd_parse_header_prefix declared by >> dnxhddata.h since e47981dab7fb7c9499b959cb0125b7281301969a. >> >> Fixes a missing symbol error in lavc/movenc if the dnxhd encoder is not >> enabled. >> --- >> libavcodec/Makefile | 5 +++-- >> 1 file changed, 3 insertions(+), 2 deletions(-) >> >> diff --git a/libavcodec/Makefile b/libavcodec/Makefile >> index abef19e..4fc4b09 100644 >> --- a/libavcodec/Makefile >> +++ b/libavcodec/Makefile >> @@ -32,6 +32,7 @@ OBJS = allcodecs.o >> \ >> codec_desc.o >> \ >> d3d11va.o >> \ >> dirac.o >> \ >> + dnxhddata.o >> \ >> dv_profile.o >> \ >> imgconvert.o >> \ >> jni.o >> \ >> @@ -241,8 +242,8 @@ OBJS-$(CONFIG_DIRAC_DECODER) += diracdec.o >> dirac.o diracdsp.o diractab >>dirac_arith.o mpeg12data.o >> dirac_dwt.o \ >>dirac_vlc.o >> OBJS-$(CONFIG_DFA_DECODER) += dfa.o >> -OBJS-$(CONFIG_DNXHD_DECODER) += dnxhddec.o dnxhddata.o >> -OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o dnxhddata.o >> +OBJS-$(CONFIG_DNXHD_DECODER) += dnxhddec.o >> +OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o > > why dont you add dnxhddata.o to the demuxer needing it ? patch ok, i missed that this was a dependancy between the 2 libs thought it was within a lib >>> >>> Pushed. Thanks. >>> >>> Matthieu >> >> Please revert this change and instead add a >> "OBJS-$(CONFIG_MOV_MUXER) += dnxhddata.o" line to the libavformat >> dependencies section. > > doesnt this break the ABI of libavcodec ? No more than it already is, assuming this can be considered a mistake in how avpriv functions are made available. dnxhddata.c contains like three avpriv functions, the oldest from 2013, and the file has never been built unconditionally. Any ffmpeg build without dnxhd de/encoder, mxf muxer or dnxhd demuxer from the past few years hasn't built it. There are other files, like mpeg4audio.c, that are also not built unconditionally and also have avpriv functions. > either avpriv_dnxhd_parse_header_prefix is part of the ABI of > libavcodec or its not If avpriv functions are meant to be part of the ABI and their presence not depend on configure time options, then that's something that will have to be changed across the codebase in general. Looking at this function closely now, it could have been added to dnxhddata.h instead. No need for avpriv_ prefix and to forcefully build an object file full of data tables that it doesn't need. > > [...] > > > > ___ > 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
[FFmpeg-devel] [PATCH] lavf/movenc: add missing dependency on dnxhddata
From: Matthieu BouronFixes a missing symbol error in lavc/movenc if the dnxhd encoder is not enabled. --- New patch attached. If it's accepted, I'll revert the previous one and push the new one. --- libavcodec/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index abef19e..2c26b77 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -809,6 +809,7 @@ OBJS-$(CONFIG_MATROSKA_AUDIO_MUXER)+= mpeg4audio.o vorbis_data.o\ flac.o flacdata.o OBJS-$(CONFIG_MATROSKA_MUXER) += flac.o flacdata.o vorbis_data.o OBJS-$(CONFIG_MOV_DEMUXER) += ac3tab.o +OBJS-$(CONFIG_MOV_MUXER) += dnxhddata.o OBJS-$(CONFIG_MP2_MUXER) += mpegaudiodata.o mpegaudiodecheader.o OBJS-$(CONFIG_MP3_MUXER) += mpegaudiodata.o mpegaudiodecheader.o OBJS-$(CONFIG_MPEGTS_MUXER)+= mpeg4audio.o -- 2.9.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc: always build dnxhddata
On Sun, Jul 24, 2016 at 06:04:18PM -0300, James Almer wrote: > On 7/24/2016 5:59 PM, Matthieu Bouron wrote: > > On Sun, Jul 24, 2016 at 10:53:51PM +0200, Michael Niedermayer wrote: > >> On Sun, Jul 24, 2016 at 10:40:58PM +0200, Michael Niedermayer wrote: > >>> On Sun, Jul 24, 2016 at 10:30:35PM +0200, Matthieu Bouron wrote: > From: Matthieu Bouron> > lavc/movenc rely on avpriv_dnxhd_parse_header_prefix declared by > dnxhddata.h since e47981dab7fb7c9499b959cb0125b7281301969a. > > Fixes a missing symbol error in lavc/movenc if the dnxhd encoder is not > enabled. > --- > libavcodec/Makefile | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/Makefile b/libavcodec/Makefile > index abef19e..4fc4b09 100644 > --- a/libavcodec/Makefile > +++ b/libavcodec/Makefile > @@ -32,6 +32,7 @@ OBJS = allcodecs.o > \ > codec_desc.o > \ > d3d11va.o > \ > dirac.o > \ > + dnxhddata.o > \ > dv_profile.o > \ > imgconvert.o > \ > jni.o > \ > @@ -241,8 +242,8 @@ OBJS-$(CONFIG_DIRAC_DECODER) += diracdec.o > dirac.o diracdsp.o diractab > dirac_arith.o mpeg12data.o > dirac_dwt.o \ > dirac_vlc.o > OBJS-$(CONFIG_DFA_DECODER) += dfa.o > -OBJS-$(CONFIG_DNXHD_DECODER) += dnxhddec.o dnxhddata.o > -OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o dnxhddata.o > +OBJS-$(CONFIG_DNXHD_DECODER) += dnxhddec.o > +OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o > >>> > >>> why dont you add dnxhddata.o to the demuxer needing it ? > >> > >> patch ok, i missed that this was a dependancy between the 2 libs > >> thought it was within a lib > > > > Pushed. Thanks. > > > > Matthieu > > Please revert this change and instead add a > "OBJS-$(CONFIG_MOV_MUXER) += dnxhddata.o" line to the libavformat > dependencies section. doesnt this break the ABI of libavcodec ? either avpriv_dnxhd_parse_header_prefix is part of the ABI of libavcodec or its not [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Never trust a computer, one day, it may think you are the virus. -- Compn signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavc/ffjni: replace ff_jni_{attach, detach} with ff_jni_get_env
From: Matthieu BouronIf a JNI environment is not already attached to the thread where the MediaCodec calls are made the current implementation will attach / detach an environment for each MediaCodec call wasting some CPU time. ff_jni_get_env replaces ff_jni_{attach,detach} by permanently attaching an environment (if it is not already the case) to the current thread. The environment will be automatically detached at the thread destruction using a pthread_key callback. Saves around 5% of CPU time (out of 20%) while decoding a stream with MediaCodec. --- libavcodec/ffjni.c | 43 + libavcodec/ffjni.h | 15 +-- libavcodec/mediacodec.c | 14 +-- libavcodec/mediacodec_surface.c | 14 +-- libavcodec/mediacodec_wrapper.c | 200 5 files changed, 74 insertions(+), 212 deletions(-) diff --git a/libavcodec/ffjni.c b/libavcodec/ffjni.c index 82ee5d3..13eabb0 100644 --- a/libavcodec/ffjni.c +++ b/libavcodec/ffjni.c @@ -31,25 +31,42 @@ #include "jni.h" #include "ffjni.h" -static JavaVM *java_vm = NULL; +static JavaVM *java_vm; +static pthread_key_t current_env; +static pthread_once_t once = PTHREAD_ONCE_INIT; static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; -JNIEnv *ff_jni_attach_env(int *attached, void *log_ctx) +static void jni_detach_env(void *data) +{ +if (java_vm) { +(*java_vm)->DetachCurrentThread(java_vm); +} +} + +static void jni_create_pthread_key(void) +{ +pthread_key_create(_env, jni_detach_env); +} + +JNIEnv *ff_jni_get_env(void *log_ctx) { int ret = 0; JNIEnv *env = NULL; -*attached = 0; - pthread_mutex_lock(); if (java_vm == NULL) { java_vm = av_jni_get_java_vm(log_ctx); } -pthread_mutex_unlock(); if (!java_vm) { av_log(log_ctx, AV_LOG_ERROR, "No Java virtual machine has been registered\n"); -return NULL; +goto done; +} + +pthread_once(, jni_create_pthread_key); + +if ((env = pthread_getspecific(current_env)) != NULL) { +goto done; } ret = (*java_vm)->GetEnv(java_vm, (void **), JNI_VERSION_1_6); @@ -59,7 +76,7 @@ JNIEnv *ff_jni_attach_env(int *attached, void *log_ctx) av_log(log_ctx, AV_LOG_ERROR, "Failed to attach the JNI environment to the current thread\n"); env = NULL; } else { -*attached = 1; +pthread_setspecific(current_env, env); } break; case JNI_OK: @@ -72,19 +89,11 @@ JNIEnv *ff_jni_attach_env(int *attached, void *log_ctx) break; } +done: +pthread_mutex_unlock(); return env; } -int ff_jni_detach_env(void *log_ctx) -{ -if (java_vm == NULL) { -av_log(log_ctx, AV_LOG_ERROR, "No Java virtual machine has been registered\n"); -return AVERROR(EINVAL); -} - -return (*java_vm)->DetachCurrentThread(java_vm); -} - char *ff_jni_jstring_to_utf_chars(JNIEnv *env, jstring string, void *log_ctx) { char *ret = NULL; diff --git a/libavcodec/ffjni.h b/libavcodec/ffjni.h index 990c7b9..721a246 100644 --- a/libavcodec/ffjni.h +++ b/libavcodec/ffjni.h @@ -26,7 +26,10 @@ #include /* - * Attach a JNI environment to the current thread. + * Attach permanently a JNI environment to the current thread and retrieve it. + * + * If successfully attached, the JNI environment will be automatically detached + * at thread destruction. * * @param attached pointer to an integer that will be set to 1 if the * environment has been attached to the current thread or 0 if it is @@ -34,15 +37,7 @@ * @param log_ctx context used for logging, can be NULL * @return the JNI environment on success, NULL otherwise */ -JNIEnv *ff_jni_attach_env(int *attached, void *log_ctx); - -/* - * Detach the JNI environment from the current thread. - * - * @param log_ctx context used for logging, can be NULL - * @return 0 on success, < 0 otherwise - */ -int ff_jni_detach_env(void *log_ctx); +JNIEnv *ff_jni_get_env(void *log_ctx); /* * Convert a jstring to its utf characters equivalent. diff --git a/libavcodec/mediacodec.c b/libavcodec/mediacodec.c index 5b79798..cd8766f 100644 --- a/libavcodec/mediacodec.c +++ b/libavcodec/mediacodec.c @@ -43,9 +43,8 @@ int av_mediacodec_default_init(AVCodecContext *avctx, AVMediaCodecContext *ctx, { int ret = 0; JNIEnv *env = NULL; -int attached = 0; -env = ff_jni_attach_env(, avctx); +env = ff_jni_get_env(avctx); if (!env) { return AVERROR_EXTERNAL; } @@ -58,17 +57,12 @@ int av_mediacodec_default_init(AVCodecContext *avctx, AVMediaCodecContext *ctx, ret = AVERROR_EXTERNAL; } -if (attached) { -ff_jni_detach_env(avctx); -} - return ret; } void av_mediacodec_default_free(AVCodecContext *avctx) { JNIEnv *env = NULL; -int attached = 0; AVMediaCodecContext *ctx = avctx->hwaccel_context; @@ -76,7
Re: [FFmpeg-devel] [PATCH] lavc: always build dnxhddata
On 7/24/2016 5:59 PM, Matthieu Bouron wrote: > On Sun, Jul 24, 2016 at 10:53:51PM +0200, Michael Niedermayer wrote: >> On Sun, Jul 24, 2016 at 10:40:58PM +0200, Michael Niedermayer wrote: >>> On Sun, Jul 24, 2016 at 10:30:35PM +0200, Matthieu Bouron wrote: From: Matthieu Bouronlavc/movenc rely on avpriv_dnxhd_parse_header_prefix declared by dnxhddata.h since e47981dab7fb7c9499b959cb0125b7281301969a. Fixes a missing symbol error in lavc/movenc if the dnxhd encoder is not enabled. --- libavcodec/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index abef19e..4fc4b09 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -32,6 +32,7 @@ OBJS = allcodecs.o \ codec_desc.o \ d3d11va.o\ dirac.o \ + dnxhddata.o \ dv_profile.o \ imgconvert.o \ jni.o\ @@ -241,8 +242,8 @@ OBJS-$(CONFIG_DIRAC_DECODER) += diracdec.o dirac.o diracdsp.o diractab dirac_arith.o mpeg12data.o dirac_dwt.o \ dirac_vlc.o OBJS-$(CONFIG_DFA_DECODER) += dfa.o -OBJS-$(CONFIG_DNXHD_DECODER) += dnxhddec.o dnxhddata.o -OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o dnxhddata.o +OBJS-$(CONFIG_DNXHD_DECODER) += dnxhddec.o +OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o >>> >>> why dont you add dnxhddata.o to the demuxer needing it ? >> >> patch ok, i missed that this was a dependancy between the 2 libs >> thought it was within a lib > > Pushed. Thanks. > > Matthieu Please revert this change and instead add a "OBJS-$(CONFIG_MOV_MUXER) += dnxhddata.o" line to the libavformat dependencies section. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc: always build dnxhddata
On 7/24/2016 5:53 PM, Michael Niedermayer wrote: > On Sun, Jul 24, 2016 at 10:40:58PM +0200, Michael Niedermayer wrote: >> On Sun, Jul 24, 2016 at 10:30:35PM +0200, Matthieu Bouron wrote: >>> From: Matthieu Bouron>>> >>> lavc/movenc rely on avpriv_dnxhd_parse_header_prefix declared by >>> dnxhddata.h since e47981dab7fb7c9499b959cb0125b7281301969a. >>> >>> Fixes a missing symbol error in lavc/movenc if the dnxhd encoder is not >>> enabled. >>> --- >>> libavcodec/Makefile | 5 +++-- >>> 1 file changed, 3 insertions(+), 2 deletions(-) >>> >>> diff --git a/libavcodec/Makefile b/libavcodec/Makefile >>> index abef19e..4fc4b09 100644 >>> --- a/libavcodec/Makefile >>> +++ b/libavcodec/Makefile >>> @@ -32,6 +32,7 @@ OBJS = allcodecs.o >>> \ >>> codec_desc.o \ >>> d3d11va.o\ >>> dirac.o \ >>> + dnxhddata.o \ >>> dv_profile.o \ >>> imgconvert.o \ >>> jni.o\ >>> @@ -241,8 +242,8 @@ OBJS-$(CONFIG_DIRAC_DECODER) += diracdec.o >>> dirac.o diracdsp.o diractab >>>dirac_arith.o mpeg12data.o >>> dirac_dwt.o \ >>>dirac_vlc.o >>> OBJS-$(CONFIG_DFA_DECODER) += dfa.o >>> -OBJS-$(CONFIG_DNXHD_DECODER) += dnxhddec.o dnxhddata.o >>> -OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o dnxhddata.o >>> +OBJS-$(CONFIG_DNXHD_DECODER) += dnxhddec.o >>> +OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o >> >> why dont you add dnxhddata.o to the demuxer needing it ? > > patch ok, i missed that this was a dependancy between the 2 libs > thought it was within a lib It can be done as you originally said. See the line for mfx muxer under the "libavformat dependencies" section. Just add one for mov muxer. > > [...] > > > > ___ > 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
Re: [FFmpeg-devel] [PATCH] lavc: always build dnxhddata
On Sun, Jul 24, 2016 at 10:40:58PM +0200, Michael Niedermayer wrote: > On Sun, Jul 24, 2016 at 10:30:35PM +0200, Matthieu Bouron wrote: > > From: Matthieu Bouron> > > > lavc/movenc rely on avpriv_dnxhd_parse_header_prefix declared by > > dnxhddata.h since e47981dab7fb7c9499b959cb0125b7281301969a. > > > > Fixes a missing symbol error in lavc/movenc if the dnxhd encoder is not > > enabled. > > --- > > libavcodec/Makefile | 5 +++-- > > 1 file changed, 3 insertions(+), 2 deletions(-) > > > > diff --git a/libavcodec/Makefile b/libavcodec/Makefile > > index abef19e..4fc4b09 100644 > > --- a/libavcodec/Makefile > > +++ b/libavcodec/Makefile > > @@ -32,6 +32,7 @@ OBJS = allcodecs.o > > \ > > codec_desc.o \ > > d3d11va.o\ > > dirac.o \ > > + dnxhddata.o \ > > dv_profile.o \ > > imgconvert.o \ > > jni.o\ > > @@ -241,8 +242,8 @@ OBJS-$(CONFIG_DIRAC_DECODER) += diracdec.o > > dirac.o diracdsp.o diractab > >dirac_arith.o mpeg12data.o > > dirac_dwt.o \ > >dirac_vlc.o > > OBJS-$(CONFIG_DFA_DECODER) += dfa.o > > -OBJS-$(CONFIG_DNXHD_DECODER) += dnxhddec.o dnxhddata.o > > -OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o dnxhddata.o > > +OBJS-$(CONFIG_DNXHD_DECODER) += dnxhddec.o > > +OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o > > why dont you add dnxhddata.o to the demuxer needing it ? patch ok, i missed that this was a dependancy between the 2 libs thought it was within a lib [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Concerning the gods, I have no means of knowing whether they exist or not or of what sort they may be, because of the obscurity of the subject, and the brevity of human life -- Protagoras signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc: always build dnxhddata
On Sun, Jul 24, 2016 at 10:30:35PM +0200, Matthieu Bouron wrote: > From: Matthieu Bouron> > lavc/movenc rely on avpriv_dnxhd_parse_header_prefix declared by > dnxhddata.h since e47981dab7fb7c9499b959cb0125b7281301969a. > > Fixes a missing symbol error in lavc/movenc if the dnxhd encoder is not > enabled. > --- > libavcodec/Makefile | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/Makefile b/libavcodec/Makefile > index abef19e..4fc4b09 100644 > --- a/libavcodec/Makefile > +++ b/libavcodec/Makefile > @@ -32,6 +32,7 @@ OBJS = allcodecs.o > \ > codec_desc.o \ > d3d11va.o\ > dirac.o \ > + dnxhddata.o \ > dv_profile.o \ > imgconvert.o \ > jni.o\ > @@ -241,8 +242,8 @@ OBJS-$(CONFIG_DIRAC_DECODER) += diracdec.o > dirac.o diracdsp.o diractab >dirac_arith.o mpeg12data.o > dirac_dwt.o \ >dirac_vlc.o > OBJS-$(CONFIG_DFA_DECODER) += dfa.o > -OBJS-$(CONFIG_DNXHD_DECODER) += dnxhddec.o dnxhddata.o > -OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o dnxhddata.o > +OBJS-$(CONFIG_DNXHD_DECODER) += dnxhddec.o > +OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o why dont you add dnxhddata.o to the demuxer needing it ? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Opposition brings concord. Out of discord comes the fairest harmony. -- Heraclitus signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] A question regarding dangerous call inside libavformat\utils.c::has_decode_delay_been_guessed()
Hello Michael, Sunday, July 24, 2016, 11:25:29 PM, you wrote: MN> On Sun, Jul 24, 2016 at 11:18:38PM +0300, Ivan Uskov wrote: >> Hello Michael, >> >> Sunday, July 24, 2016, 11:11:32 PM, you wrote: >> >> MN> On Sun, Jul 24, 2016 at 09:55:21PM +0300, Ivan Uskov wrote: >> >> Hello All, >> >> >> >> I have discovered the following issue: >> >> Latest builds of ffmpeg crashes into the h264.c when *hardware* qsv-based >> >> h264 decoder uses. >> >> The crash does appear inside the >> >> >> >> int avpriv_h264_has_num_reorder_frames(AVCodecContext *avctx) >> >> { >> >> H264Context *h = avctx->priv_data; >> >> return h && h->ps.sps ? h->ps.sps->num_reorder_frames : 0; >> >> } >> >> >> >> It is obvious, that casting to H264Context cannot be used for qsv decoder >> >> because there is QSVH2645Context. Similar issue will appear for CUVID >> >> decoder case (CuvidContext uses), Android MediaCodec H.264 decoder >> >> (MediaCodecH264DecContext uses), possible another cases existing. >> >> >> >> The caller function is >> >> >> >> static int has_decode_delay_been_guessed(AVStream *st) >> >> { >> >> if (st->codecpar->codec_id != AV_CODEC_ID_H264) return 1; >> >> if (!st->info) // if we have left find_stream_info then >> >> nb_decoded_frames won't increase anymore for stream copy >> >> return 1; >> >> #if CONFIG_H264_DECODER >> >> if (st->internal->avctx->has_b_frames && >> >>avpriv_h264_has_num_reorder_frames(st->internal->avctx) == >> >> st->internal->avctx->has_b_frames) >> >> return 1; >> >> #endif >> >> if (st->internal->avctx->has_b_frames<3) >> >> return st->nb_decoded_frames >= 7; >> >> else if (st->internal->avctx->has_b_frames<4) >> >> return st->nb_decoded_frames >= 18; >> >> else >> >> return st->nb_decoded_frames >= 20; >> >> } >> >> ...which called by update_initial_timestamps() >> >> >> >> Have anybody the idea how it can be correctly fixed? >> >> Looks like has_decode_delay_been_guessed() should be corrected. >> >> MN> this code is not new, this is in git since 4 years >> MN> commit bafa1c7f383d6c1c0f3d207395fe6a574092b7ac >> MN> Date: Mon Jul 2 23:16:59 2012 +020 >> >> MN> why does it cause a problem now ? >> >> MN> why does libavformat use hw h264 decoding ? >> I do not know that is reason why I'm asking. >> I just run ffmpeg like >> ffmpeg -c:v h264_qsv -i ./Ducks.Take.Off.720p.QHD.CRF24.x264-CtrlHD.mkv >> -vcodec h264_qsv -y ./result.mp4 >> ..and it crashes inside avpriv_h264_has_num_reorder_frames(AVCodecContext >> *avctx) >> >> When I replace >> #if CONFIG_H264_DECODER >> to >> #if 0 >> ...all working fine. >> >> I can not say when exactly the issue appeared, about several weeks ago all >> worked correct. But current build is broken at this place. MN> can you use git bisect to figure out when this issue appeared? Ok, I'll try, it will take some time. MN> was the decoder used in libavformat previously also the hw instead of MN> sw decoder ? There are no appropriate methods in hw decoder to be called from libavformat. So hw decoder exactly was never used. MN> [...] -- Best regards, Ivanmailto:ivan.us...@nablet.com ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavc: always build dnxhddata
From: Matthieu Bouronlavc/movenc rely on avpriv_dnxhd_parse_header_prefix declared by dnxhddata.h since e47981dab7fb7c9499b959cb0125b7281301969a. Fixes a missing symbol error in lavc/movenc if the dnxhd encoder is not enabled. --- libavcodec/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index abef19e..4fc4b09 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -32,6 +32,7 @@ OBJS = allcodecs.o \ codec_desc.o \ d3d11va.o\ dirac.o \ + dnxhddata.o \ dv_profile.o \ imgconvert.o \ jni.o\ @@ -241,8 +242,8 @@ OBJS-$(CONFIG_DIRAC_DECODER) += diracdec.o dirac.o diracdsp.o diractab dirac_arith.o mpeg12data.o dirac_dwt.o \ dirac_vlc.o OBJS-$(CONFIG_DFA_DECODER) += dfa.o -OBJS-$(CONFIG_DNXHD_DECODER) += dnxhddec.o dnxhddata.o -OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o dnxhddata.o +OBJS-$(CONFIG_DNXHD_DECODER) += dnxhddec.o +OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o OBJS-$(CONFIG_DPX_DECODER) += dpx.o OBJS-$(CONFIG_DPX_ENCODER) += dpxenc.o OBJS-$(CONFIG_DSD_LSBF_DECODER)+= dsddec.o dsd.o -- 2.9.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] A question regarding dangerous call inside libavformat\utils.c::has_decode_delay_been_guessed()
On Sun, Jul 24, 2016 at 11:18:38PM +0300, Ivan Uskov wrote: > Hello Michael, > > Sunday, July 24, 2016, 11:11:32 PM, you wrote: > > MN> On Sun, Jul 24, 2016 at 09:55:21PM +0300, Ivan Uskov wrote: > >> Hello All, > >> > >> I have discovered the following issue: > >> Latest builds of ffmpeg crashes into the h264.c when *hardware* qsv-based > >> h264 decoder uses. > >> The crash does appear inside the > >> > >> int avpriv_h264_has_num_reorder_frames(AVCodecContext *avctx) > >> { > >> H264Context *h = avctx->priv_data; > >> return h && h->ps.sps ? h->ps.sps->num_reorder_frames : 0; > >> } > >> > >> It is obvious, that casting to H264Context cannot be used for qsv decoder > >> because there is QSVH2645Context. Similar issue will appear for CUVID > >> decoder case (CuvidContext uses), Android MediaCodec H.264 decoder > >> (MediaCodecH264DecContext uses), possible another cases existing. > >> > >> The caller function is > >> > >> static int has_decode_delay_been_guessed(AVStream *st) > >> { > >> if (st->codecpar->codec_id != AV_CODEC_ID_H264) return 1; > >> if (!st->info) // if we have left find_stream_info then > >> nb_decoded_frames won't increase anymore for stream copy > >> return 1; > >> #if CONFIG_H264_DECODER > >> if (st->internal->avctx->has_b_frames && > >>avpriv_h264_has_num_reorder_frames(st->internal->avctx) == > >> st->internal->avctx->has_b_frames) > >> return 1; > >> #endif > >> if (st->internal->avctx->has_b_frames<3) > >> return st->nb_decoded_frames >= 7; > >> else if (st->internal->avctx->has_b_frames<4) > >> return st->nb_decoded_frames >= 18; > >> else > >> return st->nb_decoded_frames >= 20; > >> } > >> ...which called by update_initial_timestamps() > >> > >> Have anybody the idea how it can be correctly fixed? > >> Looks like has_decode_delay_been_guessed() should be corrected. > > MN> this code is not new, this is in git since 4 years > MN> commit bafa1c7f383d6c1c0f3d207395fe6a574092b7ac > MN> Date: Mon Jul 2 23:16:59 2012 +020 > > MN> why does it cause a problem now ? > > MN> why does libavformat use hw h264 decoding ? > I do not know that is reason why I'm asking. > I just run ffmpeg like > ffmpeg -c:v h264_qsv -i ./Ducks.Take.Off.720p.QHD.CRF24.x264-CtrlHD.mkv > -vcodec h264_qsv -y ./result.mp4 > ..and it crashes inside avpriv_h264_has_num_reorder_frames(AVCodecContext > *avctx) > > When I replace > #if CONFIG_H264_DECODER > to > #if 0 > ...all working fine. > > I can not say when exactly the issue appeared, about several weeks ago all > worked correct. But current build is broken at this place. can you use git bisect to figure out when this issue appeared? was the decoder used in libavformat previously also the hw instead of sw decoder ? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Dictatorship: All citizens are under surveillance, all their steps and actions recorded, for the politicians to enforce control. Democracy: All politicians are under surveillance, all their steps and actions recorded, for the citizens to enforce control. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] A question regarding dangerous call inside libavformat\utils.c::has_decode_delay_been_guessed()
Hello Michael, Sunday, July 24, 2016, 11:11:32 PM, you wrote: MN> On Sun, Jul 24, 2016 at 09:55:21PM +0300, Ivan Uskov wrote: >> Hello All, >> >> I have discovered the following issue: >> Latest builds of ffmpeg crashes into the h264.c when *hardware* qsv-based >> h264 decoder uses. >> The crash does appear inside the >> >> int avpriv_h264_has_num_reorder_frames(AVCodecContext *avctx) >> { >> H264Context *h = avctx->priv_data; >> return h && h->ps.sps ? h->ps.sps->num_reorder_frames : 0; >> } >> >> It is obvious, that casting to H264Context cannot be used for qsv decoder >> because there is QSVH2645Context. Similar issue will appear for CUVID >> decoder case (CuvidContext uses), Android MediaCodec H.264 decoder >> (MediaCodecH264DecContext uses), possible another cases existing. >> >> The caller function is >> >> static int has_decode_delay_been_guessed(AVStream *st) >> { >> if (st->codecpar->codec_id != AV_CODEC_ID_H264) return 1; >> if (!st->info) // if we have left find_stream_info then >> nb_decoded_frames won't increase anymore for stream copy >> return 1; >> #if CONFIG_H264_DECODER >> if (st->internal->avctx->has_b_frames && >>avpriv_h264_has_num_reorder_frames(st->internal->avctx) == >> st->internal->avctx->has_b_frames) >> return 1; >> #endif >> if (st->internal->avctx->has_b_frames<3) >> return st->nb_decoded_frames >= 7; >> else if (st->internal->avctx->has_b_frames<4) >> return st->nb_decoded_frames >= 18; >> else >> return st->nb_decoded_frames >= 20; >> } >> ...which called by update_initial_timestamps() >> >> Have anybody the idea how it can be correctly fixed? >> Looks like has_decode_delay_been_guessed() should be corrected. MN> this code is not new, this is in git since 4 years MN> commit bafa1c7f383d6c1c0f3d207395fe6a574092b7ac MN> Date: Mon Jul 2 23:16:59 2012 +020 MN> why does it cause a problem now ? MN> why does libavformat use hw h264 decoding ? I do not know that is reason why I'm asking. I just run ffmpeg like ffmpeg -c:v h264_qsv -i ./Ducks.Take.Off.720p.QHD.CRF24.x264-CtrlHD.mkv -vcodec h264_qsv -y ./result.mp4 ..and it crashes inside avpriv_h264_has_num_reorder_frames(AVCodecContext *avctx) When I replace #if CONFIG_H264_DECODER to #if 0 ...all working fine. I can not say when exactly the issue appeared, about several weeks ago all worked correct. But current build is broken at this place. MN> this seems like a bad idea to me, as libavcodec would use MN> hw decoding too potentially resulting in multiple hw decoders MN> running at the same time for no good reason. MN> the one in libavformat is just used to parse a few header values MN> ideally that should be done in the AVParser for h264 ... MN> [...] -- Best regards, Ivanmailto:ivan.us...@nablet.com ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] A question regarding dangerous call inside libavformat\utils.c::has_decode_delay_been_guessed()
On Sun, Jul 24, 2016 at 09:55:21PM +0300, Ivan Uskov wrote: > Hello All, > > I have discovered the following issue: > Latest builds of ffmpeg crashes into the h264.c when *hardware* qsv-based > h264 decoder uses. > The crash does appear inside the > > int avpriv_h264_has_num_reorder_frames(AVCodecContext *avctx) > { > H264Context *h = avctx->priv_data; > return h && h->ps.sps ? h->ps.sps->num_reorder_frames : 0; > } > > It is obvious, that casting to H264Context cannot be used for qsv decoder > because there is QSVH2645Context. Similar issue will appear for CUVID > decoder case (CuvidContext uses), Android MediaCodec H.264 decoder > (MediaCodecH264DecContext uses), possible another cases existing. > > The caller function is > > static int has_decode_delay_been_guessed(AVStream *st) > { > if (st->codecpar->codec_id != AV_CODEC_ID_H264) return 1; > if (!st->info) // if we have left find_stream_info then nb_decoded_frames > won't increase anymore for stream copy > return 1; > #if CONFIG_H264_DECODER > if (st->internal->avctx->has_b_frames && >avpriv_h264_has_num_reorder_frames(st->internal->avctx) == > st->internal->avctx->has_b_frames) > return 1; > #endif > if (st->internal->avctx->has_b_frames<3) > return st->nb_decoded_frames >= 7; > else if (st->internal->avctx->has_b_frames<4) > return st->nb_decoded_frames >= 18; > else > return st->nb_decoded_frames >= 20; > } > ...which called by update_initial_timestamps() > > Have anybody the idea how it can be correctly fixed? > Looks like has_decode_delay_been_guessed() should be corrected. this code is not new, this is in git since 4 years commit bafa1c7f383d6c1c0f3d207395fe6a574092b7ac Date: Mon Jul 2 23:16:59 2012 +020 why does it cause a problem now ? why does libavformat use hw h264 decoding ? this seems like a bad idea to me, as libavcodec would use hw decoding too potentially resulting in multiple hw decoders running at the same time for no good reason. the one in libavformat is just used to parse a few header values ideally that should be done in the AVParser for h264 ... [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2] avcodec/bsf: Set EOF flag only if pkt == NULL
On 07/22/2016 10:14 PM, Nicolas George wrote: Le quintidi 5 thermidor, an CCXXIV, sebechlebsky...@gmail.com a écrit : From: Jan SebechlebskySet BSF EOF flag only if pkt == NULL in av_bsf_send_packet(). Signed-off-by: Jan Sebechlebsky --- I agree, it seems cleaner that way. Thanks, please apply this version of patch then and ignore the patch changing the comment. Regards, Jan libavcodec/bsf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c index 88b7f29..9b9ada7 100644 --- a/libavcodec/bsf.c +++ b/libavcodec/bsf.c @@ -172,7 +172,7 @@ int av_bsf_init(AVBSFContext *ctx) int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt) { -if (!pkt || !pkt->data) { +if (!pkt) { It we make the case where pkt != NULL but no data nor side data forbidden, I would suggest to detect it. I know that others disagree, but I think an assert is the best solution for that: if the caller pass a forbidden value, it can expect an undefined behaviour, and an assert failure is the most sympathetic undefined behaviours for developers. I gave this a second thought, wouldn't it be better to simply ignore pkt without payload? So after caller would send empty packet using av_bsf_send_packet, he would get AVERROR(EAGAIN) from the next av_bsf_receive_packet call (from the definition in documentation AVERROR(EAGAIN) means "more data needed" when returned by av_bsf_receive_packet). However, if you think it is better to reserve packet without payload for some future use, I won't object. Regards, Jan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] ffbox0 server hosting
On Sat, Jul 23, 2016 at 11:12:40AM +0200, Michael Niedermayer wrote: > On Tue, Jul 19, 2016 at 07:32:01PM +0200, Clément Bœsch wrote: > > Hi, > > > > As stated in previous meeting¹ I'd like to stop paying for ffbox0. This is > > not exactly an issue today for me, but I feel like it could be avoided. > > There was a need for a fast solution a while ago, but it's now long past > > that time (it was about one year ago), and I'd like to be discharged from > > this. > > > > So on 19th October 2016 (3 months from now), I will close the ffbox0 > > subscription. > > > > Note that this is not only a money problem, it comes with a hosting > > responsibility I'd like to get rid of; I'm thinking notably about the > > abuse complaints I got wrt rtmpdump (because yes, this box is not only for > > the FFmpeg project, but also all kind of other projects I have absolutely > > 0 interest in funding, hosting and taking responsibility for myself). > > raz (and me but really raz did 99% of the work) has moved things from > ffbox0 to ffbox0-bg. > Thank you very much to you and Nikolay. > About monthly ffbox0 fees, if you want them refunded please submit > a refund request to the ffmpeg-devel ML (see similar ones on the ML > about refunding of travell costs). All refund requests should be easy > search, detect and discussable on the ML ... > It's about 50€/months, for one year. I'm fine with that, I don't need a refund. Thank you. > If you wish to shutdown ffbox0 in 3 months, would you have time to > go over the other free server & hosting offers we had? It would make > sense for us probably to keep the number of servers we have available > non decreasing so we can move things "easily" in case future need > arises ... I haven't followed at all the different offers, I don't feel like poking random people, sorry. > Thanks alot for providing ffbox0 to FFmpeg, MPlayer, rtmpdump, ... > when it was needed Sure, you're welcome -- Clément B. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] A question regarding dangerous call inside libavformat\utils.c::has_decode_delay_been_guessed()
Hello All, I have discovered the following issue: Latest builds of ffmpeg crashes into the h264.c when *hardware* qsv-based h264 decoder uses. The crash does appear inside the int avpriv_h264_has_num_reorder_frames(AVCodecContext *avctx) { H264Context *h = avctx->priv_data; return h && h->ps.sps ? h->ps.sps->num_reorder_frames : 0; } It is obvious, that casting to H264Context cannot be used for qsv decoder because there is QSVH2645Context. Similar issue will appear for CUVID decoder case (CuvidContext uses), Android MediaCodec H.264 decoder (MediaCodecH264DecContext uses), possible another cases existing. The caller function is static int has_decode_delay_been_guessed(AVStream *st) { if (st->codecpar->codec_id != AV_CODEC_ID_H264) return 1; if (!st->info) // if we have left find_stream_info then nb_decoded_frames won't increase anymore for stream copy return 1; #if CONFIG_H264_DECODER if (st->internal->avctx->has_b_frames && avpriv_h264_has_num_reorder_frames(st->internal->avctx) == st->internal->avctx->has_b_frames) return 1; #endif if (st->internal->avctx->has_b_frames<3) return st->nb_decoded_frames >= 7; else if (st->internal->avctx->has_b_frames<4) return st->nb_decoded_frames >= 18; else return st->nb_decoded_frames >= 20; } ...which called by update_initial_timestamps() Have anybody the idea how it can be correctly fixed? Looks like has_decode_delay_been_guessed() should be corrected. -- Best regards, Ivan mailto:ivan.us...@nablet.com ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]lavc/h264_ps: Be more verbose when truncating likely oversized pps.
Michael Niedermayer niedermayer.cc> writes: > > Subject: [PATCH] lavc/h264_ps: Be more verbose when truncating likely > > oversized PPS. > > should be ok Patch applied. Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc: add mpeg4 mediacodec decoder
On Sun, Jul 24, 2016 at 11:37:08AM +0200, Thomas Volkert wrote: > From: Thomas Volkert> > --- > configure| 1 + > libavcodec/Makefile | 1 + > libavcodec/allcodecs.c | 1 + > libavcodec/mediacodecdec_mpeg4.c | 239 > +++ > 4 files changed, 242 insertions(+) > create mode 100644 libavcodec/mediacodecdec_mpeg4.c Hi, Thanks for the patchset, I will review it and test it during the upcoming days. Matthieu [...] ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libavcodec/qsvdec.c: Restoring decoding functionality after unsuccessful merge from libav.
On Sun, Jul 24, 2016 at 3:43 PM, Ivan Uskovwrote: > Hello Mark, > > Saturday, July 23, 2016, 11:42:46 PM, you wrote: > > MT> On 23/07/16 20:33, Ivan Uskov wrote: >>> If you are use qsv, I would like to recommend to roll-back to version >>> before >>> d30cf57a7b2097b565db02ecfffbdc9c16423d0e >>> Really the d30cf57a7b2097b565db02ecfffbdc9c16423d0e is useless and only >>> makes code complex and work slow, the sync variable is not mandatory to be >>> allocated on heap at all. libav guys did a big mistake when have >>> added >>> such "feature". > > MT> Are you sure that works correctly with all streams, maybe one with some > MT> sort of delay? It looks like you can add multiple things to the fifo in > MT> one call and but then only ever remove one, so using the stack to hold > MT> them across invocations is not appropriate (though failure may be very > subtle). > Yes, I'm sure. > There are following arguments: > 1. Intel's samples by itself use general variable for the 'sync' arg, not > heap allocated. > 2. Intel documentation says nothing special for this arg. > 3. I did several qsv-based transcoders for windows and linux no any issues > without this questionable trick. > 4. A fifo object used previously to keep 'sync' handles already keeps data on > heap :-) > > There only one known issue into initial implementation, the fifo size may be > not > enough an there is no check for overflow. So at some cases wrapper may > overwrite sync entries in fifo and some decoded frames may be lost. But it is > not related with discussed problem. > > MT> (Note that I'm not sufficiently familiar with Media SDK to confidently > MT> assert anything about how this code should behave, so please don't read > too much into what I say.) > > MT> In general I think if you are happy that the previous implementation in > MT> ffmpeg was correct then please do revert, because the code as it is now > is completely broken. > Ok, will do. > OT: Ivan, can you *please* fix your quoting style to use standard quotes as everyone else (ie. single > for every level)? Reading your replies is practically impossible. - Hendrik ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] qsvdec.c: Revert "Merge commit '3c53627ac17fc6bdea5029be57da1e03b32d265d'"
On Sun, Jul 24, 2016 at 06:47:37PM +0300, Ivan Uskov wrote: > Hello All, > > This reverts commit d30cf57a7b2097b565db02ecfffbdc9c16423d0e, reversing > changes made to acc155ac55baa95d1c16c0364b02244bc04d83a8. > The commit d30cf57a7b2097b565db02ecfffbdc9c16423d0e provided irrelevant > code complexity and decoding slowdown. But main disadvantage of this commit > is decoder crash. > So it should be reverted. > Please review. > > -- > Best regards, > Ivan mailto:ivan.us...@nablet.com > qsvdec.c | 34 ++ > 1 file changed, 6 insertions(+), 28 deletions(-) > 2dafbabfa4e364cb9fdd39d2e85eb89108a2710b > 0001-Revert-Merge-commit-3c53627ac17fc6bdea5029be57da1e03.patch > From 1e2ba6de0095e63c7f6ef66b5516c3e4789af7f3 Mon Sep 17 00:00:00 2001 > From: Ivan Uskov> Date: Sun, 24 Jul 2016 09:59:42 -0400 > Subject: [PATCH] Revert "Merge commit > '3c53627ac17fc6bdea5029be57da1e03b32d265d'" This reverts commit > d30cf57a7b2097b565db02ecfffbdc9c16423d0e, reversing changes made to > acc155ac55baa95d1c16c0364b02244bc04d83a8. The commit > d30cf57a7b2097b565db02ecfffbdc9c16423d0e provided irrelevant code complexity > and decoding slowdown. But main disadvantage of this commit is decoder crash. > So it should be reverted. applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Dictatorship: All citizens are under surveillance, all their steps and actions recorded, for the politicians to enforce control. Democracy: All politicians are under surveillance, all their steps and actions recorded, for the citizens to enforce control. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] af_hdcd: Add counter for cdt expirations
Adds a counter for when the "code detect timer" expired without finding a valid packet. Signed-off-by: Burt P--- libavfilter/af_hdcd.c | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/libavfilter/af_hdcd.c b/libavfilter/af_hdcd.c index 72560db..f265ed9 100644 --- a/libavfilter/af_hdcd.c +++ b/libavfilter/af_hdcd.c @@ -846,6 +846,7 @@ typedef struct { * steps of 0.5, but no value below -6.0 dB should appear. */ int gain_counts[16]; /* for cursiosity, mostly */ int max_gain; +int count_sustain_expired;/* occurences of code detect timer expiring without detecting a code */ AVFilterContext *fctx; /* filter context for logging errors */ } hdcd_state_t; @@ -895,6 +896,8 @@ static void hdcd_reset(hdcd_state_t *state, unsigned rate) state->count_transient_filter = 0; for(i = 0; i < 16; i++) state->gain_counts[i] = 0; state->max_gain = 0; + +state->count_sustain_expired = 0; } /* update the user info/counters */ @@ -978,8 +981,11 @@ static int hdcd_integrate(hdcd_state_t *state, int *flag, const int32_t *samples static int hdcd_scan(hdcd_state_t *state, const int32_t *samples, int max, int stride) { +int cdt_active = 0; +/* code detect timer */ int result; if (state->sustain > 0) { +cdt_active = 1; if (state->sustain <= max) { state->control = 0; max = state->sustain; @@ -992,11 +998,15 @@ static int hdcd_scan(hdcd_state_t *state, const int32_t *samples, int max, int s int consumed = hdcd_integrate(state, , samples, max - result, stride); result += consumed; if (flag > 0) { +/* reset timer if code detected in channel */ state->sustain = state->sustain_reset; break; } samples += consumed * stride; } +/* code detect timer expired */ +if (cdt_active && state->sustain == 0) +state->count_sustain_expired++; return result; } @@ -1198,12 +1208,13 @@ static av_cold void uninit(AVFilterContext *ctx) hdcd_state_t *state = >state[i]; av_log(ctx, AV_LOG_VERBOSE, "Channel %d: counter A: %d, B: %d, C: %d\n", i, state->code_counterA, state->code_counterB, state->code_counterC); -av_log(ctx, AV_LOG_VERBOSE, "Channel %d: pe: %d, tf: %d, almost_A: %d, checkfail_B: %d, unmatched_C: %d\n", i, +av_log(ctx, AV_LOG_VERBOSE, "Channel %d: pe: %d, tf: %d, almost_A: %d, checkfail_B: %d, unmatched_C: %d, cdt_expired: %d\n", i, state->count_peak_extend, state->count_transient_filter, state->code_counterA_almost, state->code_counterB_checkfails, -state->code_counterC_unmatched); +state->code_counterC_unmatched, +state->count_sustain_expired); for (j = 0; j <= state->max_gain; j++) { av_log(ctx, AV_LOG_VERBOSE, "Channel %d: tg %0.1f: %d\n", i, GAINTOFLOAT(j), state->gain_counts[j]); } -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/qsv: remove MFX_EXTBUFF_CODING_OPTION3
Hello Zeranoe, Saturday, June 18, 2016, 7:33:12 AM, you wrote: zgc> From: Kyle Schwarzzgc> 4th generation Intel CPUs don't support MFX_EXTBUFF_CODING_OPTION3. zgc> This patch fixes bug #5324. zgc> --- zgc> libavcodec/qsvenc.c | 18 -- zgc> 1 file changed, 18 deletions(-) zgc> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c zgc> index 132cf47..a561df8 100644 zgc> --- a/libavcodec/qsvenc.c zgc> +++ b/libavcodec/qsvenc.c zgc> @@ -132,9 +132,6 @@ static void dump_video_param(AVCodecContext *avctx, QSVEncContext *q, zgc> #if QSV_HAVE_CO2 zgc> mfxExtCodingOption2 *co2 = (mfxExtCodingOption2*)coding_opts[1]; zgc> #endif zgc> -#if QSV_HAVE_CO3 zgc> -mfxExtCodingOption3 *co3 = (mfxExtCodingOption3*)coding_opts[2]; zgc> -#endif zgc> zgc> av_log(avctx, AV_LOG_VERBOSE, "profile: %s; level: %"PRIu16"\n", zgc> print_profile(info->CodecProfile), info->CodecLevel); zgc> @@ -186,12 +183,6 @@ static void dump_video_param(AVCodecContext *avctx, QSVEncContext *q, zgc> info->ICQQuality, co2->LookAheadDepth); zgc> } zgc> #endif zgc> -#if QSV_HAVE_QVBR -else if (info->>RateControlMethod == MFX_RATECONTROL_QVBR) { zgc> -av_log(avctx, AV_LOG_VERBOSE, "QVBRQuality: %"PRIu16"\n", zgc> - co3->QVBRQuality); zgc> -} zgc> -#endif zgc> zgc> av_log(avctx, AV_LOG_VERBOSE, "NumSlice: %"PRIu16"; NumRefFrame: %"PRIu16"\n", zgc> info->NumSlice, info->NumRefFrame); zgc> @@ -577,12 +568,6 @@ static int qsv_retrieve_enc_params(AVCodecContext *avctx, QSVEncContext *q) zgc> .Header.BufferSz = sizeof(co2), zgc> }; zgc> #endif zgc> -#if QSV_HAVE_CO3 zgc> -mfxExtCodingOption3 co3 = { zgc> -.Header.BufferId = MFX_EXTBUFF_CODING_OPTION3, zgc> -.Header.BufferSz = sizeof(co3), zgc> -}; zgc> -#endif zgc> zgc> mfxExtBuffer *ext_buffers[] = { zgc> (mfxExtBuffer*), zgc> @@ -590,9 +575,6 @@ static int qsv_retrieve_enc_params(AVCodecContext *avctx, QSVEncContext *q) zgc> #if QSV_HAVE_CO2 zgc> (mfxExtBuffer*), zgc> #endif zgc> -#if QSV_HAVE_CO3 zgc> -(mfxExtBuffer*), zgc> -#endif zgc> }; zgc> zgc> int need_pps = avctx->codec_id != AV_CODEC_ID_MPEG2VIDEO; First, I'm not sure that "4th generation Intel CPUs don't support MFX_EXTBUFF_CODING_OPTION3". Do you have any reference which says it? The documentation says: "This structure is available since SDK API 1.11.", i.e. it depended by API level but not by CPU generation. For any case I believe it is wrong to remove code if some issues are appearing on old CPUs. Especially if we already have got a pre-processor condition to disable MFX_EXTBUFF_CODING_OPTION3 by correct way. If you have got some constructive suggestions to improve disabling MFX_EXTBUFF_CODING_OPTION3 by condition (possible in real-time code, not by preprocessor) please provide. But stupid disabling of a feature is not the good solution. -- Best regards, Ivanmailto:ivan.us...@nablet.com ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] qsvdec.c: Revert "Merge commit '3c53627ac17fc6bdea5029be57da1e03b32d265d'"
Hello All, This reverts commit d30cf57a7b2097b565db02ecfffbdc9c16423d0e, reversing changes made to acc155ac55baa95d1c16c0364b02244bc04d83a8. The commit d30cf57a7b2097b565db02ecfffbdc9c16423d0e provided irrelevant code complexity and decoding slowdown. But main disadvantage of this commit is decoder crash. So it should be reverted. Please review. -- Best regards, Ivan mailto:ivan.us...@nablet.com 0001-Revert-Merge-commit-3c53627ac17fc6bdea5029be57da1e03.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] libavcodec : add psd image file decoder
2016-07-24 16:36 GMT+02:00 Moritz Barsnick: > On Sun, Jul 24, 2016 at 15:21:00 +0200, Martin Vignali wrote: > > Subject: [PATCH] libavcodec : add decoder for .psd image file. > [...] > > +- Psd Decoder > [...] > > +@item PSD @tab @tab X > > +@tab Photoshop > [...] > > +.long_name = NULL_IF_CONFIG_SMALL("Photoshop file"), > > ".psd", "psd", "Psd", "Photoshop file". I think some consistency would > be nice. E.g. use "Photoshop PSD file" as long name, "PSD" in the > descriptions (and not the name of the extension with dot). > > But that's just cosmetics... > > > +if ((s->channel_count < 1)||(s->channel_count > 56)) { > [...] > > +if ((s->height < 1)||(s->height > 3)) { > [...] > > +if ((s->width < 1)||(s->width > 3)) { > > You could leave whitespace around the operators, for readability. > > > +avpriv_report_missing_feature(avctx, "channel depth > unsupported for rgb %d", s->channel_depth); > > For the sake of "grammar", I would say: > avpriv_report_missing_feature(avctx, "channel depth %d > unsupported for rgb", s->channel_depth); > (Same with channel_count and with grayscale below.) > > > +/* reorganize uncompress data. each channel is store one after the > other */ > ^E ^stored > > > +if ((b[4] == 0)&&(b[5] == 1)) {/* version 1 is PSD, version 2 is > PSB */ > [...] > > +if ((AV_RL32(b+6) == 0)&&(AV_RL16(b+10) == 0))/* reserved must be 0 > */ > [...] > > +if ((color_mode <= 9)&&(color_mode != 5)&&(color_mode != 6)) > Whitespace, as mentioned above. > > > Correct locally. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] libavcodec : add psd image file decoder
On Sun, Jul 24, 2016 at 15:21:00 +0200, Martin Vignali wrote: > Subject: [PATCH] libavcodec : add decoder for .psd image file. [...] > +- Psd Decoder [...] > +@item PSD @tab @tab X > +@tab Photoshop [...] > +.long_name = NULL_IF_CONFIG_SMALL("Photoshop file"), ".psd", "psd", "Psd", "Photoshop file". I think some consistency would be nice. E.g. use "Photoshop PSD file" as long name, "PSD" in the descriptions (and not the name of the extension with dot). But that's just cosmetics... > +if ((s->channel_count < 1)||(s->channel_count > 56)) { [...] > +if ((s->height < 1)||(s->height > 3)) { [...] > +if ((s->width < 1)||(s->width > 3)) { You could leave whitespace around the operators, for readability. > +avpriv_report_missing_feature(avctx, "channel depth > unsupported for rgb %d", s->channel_depth); For the sake of "grammar", I would say: avpriv_report_missing_feature(avctx, "channel depth %d unsupported for rgb", s->channel_depth); (Same with channel_count and with grayscale below.) > +/* reorganize uncompress data. each channel is store one after the other > */ ^E ^stored > +if ((b[4] == 0)&&(b[5] == 1)) {/* version 1 is PSD, version 2 is PSB */ [...] > +if ((AV_RL32(b+6) == 0)&&(AV_RL16(b+10) == 0))/* reserved must be 0 */ [...] > +if ((color_mode <= 9)&&(color_mode != 5)&&(color_mode != 6)) Whitespace, as mentioned above. Moritz ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Questions about Video Memory in qsv decoders
Hello Michael, Sunday, July 24, 2016, 12:16:59 AM, you wrote: MN> On Sat, Jul 23, 2016 at 11:19:59PM +0300, Ivan Uskov wrote: >> Hello 张玉晓, >> >> Friday, July 22, 2016, 4:10:36 AM, you wrote: >> >> 张> I have a question when learning ffmpeg qsv decoder and Intel media sdk. >> >> 张> The intel media sdk suggest to use Video Memory while doing Hardware >> 张> decoding, use System Memory while doing Software decoding. >> >> 张> FFmpeg only used System Memory to decode with qsv (Intel msdk) in file >> 张> libavcodec/qsvdec.c. Is there any problem when use Video Memory? >> >> As qsv modules maintainer I can confirm, yes, there are problems. >> >> First (objective) problem that in common case there are 3 qsv components >> should be linked by a pipeline through GPU memory: >> *qsv video decoder >> *qsv vpp filter >> *qsv video encoder >> But current ffmpeg architecture have restrictions to share one common qsv >> session between libavcodec and libavfilter. >> >> Second (subjective) problem that nobody in ffmpeg community is interested to >> advance QSV codecs. Most of patches at this year provided by me or by my >> colleagues (including tries to solve issue with GPU memory) were rejected or >> ignored silently. Moreover, if you will try to clone a latest ffmpeg you >> found qsv >> decoder broken, it crashes at any try of use. The patch to fix it was posted >> by me at April 25 but was ignored. MN> which patches should be applied to fix the issues ? MN> can you repost them ? Currently I believe that broken merge from libav should be not improved/fixed by some way but just reverted because it provides nothing helpful, only complexity. I will provide new patch soon. MN> [...] -- Best regards, Ivanmailto:ivan.us...@nablet.com ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libavcodec/qsvdec.c: Restoring decoding functionality after unsuccessful merge from libav.
Hello Mark, Saturday, July 23, 2016, 11:42:46 PM, you wrote: MT> On 23/07/16 20:33, Ivan Uskov wrote: >> If you are use qsv, I would like to recommend to roll-back to version before >> d30cf57a7b2097b565db02ecfffbdc9c16423d0e >> Really the d30cf57a7b2097b565db02ecfffbdc9c16423d0e is useless and only >> makes code complex and work slow, the sync variable is not mandatory to be >> allocated on heap at all. libav guys did a big mistake when have added >> such "feature". MT> Are you sure that works correctly with all streams, maybe one with some MT> sort of delay? It looks like you can add multiple things to the fifo in MT> one call and but then only ever remove one, so using the stack to hold MT> them across invocations is not appropriate (though failure may be very subtle). Yes, I'm sure. There are following arguments: 1. Intel's samples by itself use general variable for the 'sync' arg, not heap allocated. 2. Intel documentation says nothing special for this arg. 3. I did several qsv-based transcoders for windows and linux no any issues without this questionable trick. 4. A fifo object used previously to keep 'sync' handles already keeps data on heap :-) There only one known issue into initial implementation, the fifo size may be not enough an there is no check for overflow. So at some cases wrapper may overwrite sync entries in fifo and some decoded frames may be lost. But it is not related with discussed problem. MT> (Note that I'm not sufficiently familiar with Media SDK to confidently MT> assert anything about how this code should behave, so please don't read too much into what I say.) MT> In general I think if you are happy that the previous implementation in MT> ffmpeg was correct then please do revert, because the code as it is now is completely broken. Ok, will do. -- Best regards, Ivanmailto:ivan.us...@nablet.com ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] libavcodec : add psd image file decoder
> breaks fate > > make: *** [fate-filter-metadata-ebur128] Error 1 > --- - 2016-07-23 18:50:11.633752058 +0200 > +++ tests/data/fate/probe-format-roundup14142016-07-23 > 18:50:10.913635588 +0200 > @@ -1 +1 @@ > -mpeg > +psd_pipe > Test probe-format-roundup1414 failed. Look at > tests/data/fate/probe-format-roundup1414.err for details. > make: *** [fate-probe-format-roundup1414] Error 1 > --- - 2016-07-23 18:50:11.657384876 +0200 > +++ tests/data/fate/probe-format-roundup997 2016-07-23 > 18:50:10.917635588 +0200 > @@ -1 +1 @@ > -mpeg > +psd_pipe > Test probe-format-roundup997 failed. Look at > tests/data/fate/probe-format-roundup997.err for details. > make: *** [fate-probe-format-roundup997] Error 1 > --- - 2016-07-23 18:50:11.667958765 +0200 > +++ tests/data/fate/probe-format-roundup13832016-07-23 > 18:50:10.917635588 +0200 > @@ -1 +1 @@ > -mp3 > +psd_pipe > Test probe-format-roundup1383 failed. Look at > tests/data/fate/probe-format-roundup1383.err for details. > make: *** [fate-probe-format-roundup1383] Error 1 > make: Target `fate' not remade because of errors. > > Hello, Corrected patch in attach who fix the psd_probe function. Comments welcome Martin From 2b368b8592cf0c278da0954e41705ddfc0f342b6 Mon Sep 17 00:00:00 2001 From: Martin VignaliDate: Sun, 24 Jul 2016 15:17:18 +0200 Subject: [PATCH] libavcodec : add decoder for .psd image file. Decode the Image Data Section (who contain merge picture). Support RGB/A and Grayscale/A in 8bits and 16 bits by channel. Support uncompress and rle compression in Image Data Section --- Changelog| 1 + doc/general.texi | 2 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/avcodec.h | 1 + libavcodec/codec_desc.c | 7 + libavcodec/psd.c | 395 +++ libavformat/Makefile | 1 + libavformat/allformats.c | 1 + libavformat/img2.c | 1 + libavformat/img2dec.c| 35 + 11 files changed, 446 insertions(+) create mode 100644 libavcodec/psd.c diff --git a/Changelog b/Changelog index 99cdb80..97b11f1 100644 --- a/Changelog +++ b/Changelog @@ -3,6 +3,7 @@ releases are sorted from youngest to oldest. version : +- Psd Decoder version 3.1: - DXVA2-accelerated HEVC Main10 decoding diff --git a/doc/general.texi b/doc/general.texi index 4db209f..06775f4 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -577,6 +577,8 @@ following image formats are supported: @item PNG @tab X @tab X @item PPM @tab X @tab X @tab Portable PixelMap image +@item PSD @tab @tab X +@tab Photoshop @item PTX @tab @tab X @tab V.Flash PTX format @item SGI @tab X @tab X diff --git a/libavcodec/Makefile b/libavcodec/Makefile index fd0d1f0..913b4a8 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -456,6 +456,7 @@ OBJS-$(CONFIG_PRORES_LGPL_DECODER) += proresdec_lgpl.o proresdsp.o proresdat OBJS-$(CONFIG_PRORES_ENCODER) += proresenc_anatoliy.o OBJS-$(CONFIG_PRORES_AW_ENCODER) += proresenc_anatoliy.o OBJS-$(CONFIG_PRORES_KS_ENCODER) += proresenc_kostya.o proresdata.o +OBJS-$(CONFIG_PSD_DECODER) += psd.o OBJS-$(CONFIG_PTX_DECODER) += ptx.o OBJS-$(CONFIG_QCELP_DECODER) += qcelpdec.o \ celp_filters.o acelp_vectors.o \ diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 54efaad..458f603 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -278,6 +278,7 @@ void avcodec_register_all(void) REGISTER_ENCODER(PRORES_AW, prores_aw); REGISTER_ENCODER(PRORES_KS, prores_ks); REGISTER_DECODER(PRORES_LGPL, prores_lgpl); +REGISTER_DECODER(PSD, psd); REGISTER_DECODER(PTX, ptx); REGISTER_DECODER(QDRAW, qdraw); REGISTER_DECODER(QPEG, qpeg); diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 39713ed..75a9970 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -409,6 +409,7 @@ enum AVCodecID { AV_CODEC_ID_MAGICYUV, AV_CODEC_ID_SHEERVIDEO, AV_CODEC_ID_YLC, +AV_CODEC_ID_PSD, /* various PCM "codecs" */ AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the start of audio codecs diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index 9d94b72..427553c 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -1425,6 +1425,13 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { +.id= AV_CODEC_ID_PSD, +.type = AVMEDIA_TYPE_VIDEO, +.name = "psd", +.long_name = NULL_IF_CONFIG_SMALL("Photoshop file"), +.props = AV_CODEC_PROP_INTRA_ONLY |
[FFmpeg-devel] [PATCH 4/4] lavc: add vp8 mediacodec decoder
From: Thomas Volkert--- Changelog | 1 + configure | 1 + libavcodec/Makefile| 1 + libavcodec/allcodecs.c | 1 + libavcodec/mediacodecdec_vp8.c | 89 ++ libavcodec/version.h | 2 +- 6 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 libavcodec/mediacodecdec_vp8.c diff --git a/Changelog b/Changelog index e35224c..6eaec1b 100644 --- a/Changelog +++ b/Changelog @@ -9,6 +9,7 @@ version : - VP8 in Ogg muxing - MediaCodec MPEG-4 decoding - MediaCodec H.263 decoding +- MediaCodec VP8 decoding version 3.1: diff --git a/configure b/configure index 18cc5f2..445d975 100755 --- a/configure +++ b/configure @@ -2655,6 +2655,7 @@ vc1_vdpau_hwaccel_deps="vdpau" vc1_vdpau_hwaccel_select="vc1_decoder" vp8_cuvid_hwaccel_deps="cuda cuvid CUVIDVP9PICPARAMS" vp9_cuvid_hwaccel_deps="cuda cuvid CUVIDVP9PICPARAMS" +vp8_mediacodec_decoder_deps="mediacodec" vp9_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_VP9" vp9_d3d11va_hwaccel_select="vp9_decoder" vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 0bc0211..466c5a4 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -593,6 +593,7 @@ 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_vp8.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 diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index db2f25d..b750c0e 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -353,6 +353,7 @@ void avcodec_register_all(void) REGISTER_DECODER(VP6F, vp6f); REGISTER_DECODER(VP7, vp7); REGISTER_DECODER(VP8, vp8); +REGISTER_DECODER(VP8_MEDIACODEC,vp8_mediacodec); REGISTER_DECODER(VP9, vp9); REGISTER_DECODER(VQA, vqa); REGISTER_DECODER(WEBP, webp); diff --git a/libavcodec/mediacodecdec_vp8.c b/libavcodec/mediacodecdec_vp8.c new file mode 100644 index 000..6beac70 --- /dev/null +++ b/libavcodec/mediacodecdec_vp8.c @@ -0,0 +1,89 @@ +/* + * Android MediaCodec VP8 decoder + * + * Copyright (c) 2016 Thomas Volkert + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/avassert.h" +#include "libavutil/common.h" +#include "libavutil/fifo.h" + +#include "avcodec.h" +#include "internal.h" +#include "mediacodecdec.h" +#include "mediacodec_wrapper.h" + +#define CODEC_MIME "video/x-vnd.on2.vp8" + +static av_cold int mediacodec_decoder_init_vp8(AVCodecContext *avctx) +{ +int ret; + +FFAMediaFormat *format = NULL; +MediaCodecDecContext *s = avctx->priv_data; + +format = ff_AMediaFormat_new(); +if (!format) { +av_log(avctx, AV_LOG_ERROR, "Failed to create media format\n"); +ret = AVERROR_EXTERNAL; +goto done; +} + +ff_AMediaFormat_setString(format, "mime", CODEC_MIME); +ff_AMediaFormat_setInt32(format, "width", avctx->width); +ff_AMediaFormat_setInt32(format, "height", avctx->height); + +if ((ret = ff_mediacodec_dec_init(avctx, s, CODEC_MIME, format)) < 0) { +goto done; +} + +av_log(avctx, AV_LOG_INFO, "MediaCodec started successfully, ret = %d\n", ret); + +s->fifo = av_fifo_alloc(sizeof(AVPacket)); +if (!s->fifo) { +ret = AVERROR(ENOMEM); +goto done; +} + +av_init_packet(>output_pkt); + +done: +if (format) { +ff_AMediaFormat_delete(format); +} + +if (ret < 0) { + ff_mediacodec_decoder_close(avctx); +} + +return ret; +} + +AVCodec ff_vp8_mediacodec_decoder = { +.name = "vp8_mediacodec", +.long_name = NULL_IF_CONFIG_SMALL("VP8 Android MediaCodec decoder"), +.type = AVMEDIA_TYPE_VIDEO, +.id
[FFmpeg-devel] [PATCH 1/4] lavc: add mpeg4 mediacodec decoder
From: Thomas Volkert--- Changelog| 1 + configure| 1 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/mediacodecdec_mpeg4.c | 239 +++ libavcodec/version.h | 2 +- 6 files changed, 244 insertions(+), 1 deletion(-) create mode 100644 libavcodec/mediacodecdec_mpeg4.c diff --git a/Changelog b/Changelog index 2bd18ec..b8bbdb9 100644 --- a/Changelog +++ b/Changelog @@ -7,6 +7,7 @@ version : - Changed metadata print option to accept general urls - Alias muxer for Ogg Video (.ogv) - VP8 in Ogg muxing +- MediaCodec MPEG-4 decoding version 3.1: diff --git a/configure b/configure index 1b41303..9004b06 100755 --- a/configure +++ b/configure @@ -2621,6 +2621,7 @@ mpeg2_videotoolbox_hwaccel_select="mpeg2video_decoder" mpeg2_xvmc_hwaccel_deps="xvmc" mpeg2_xvmc_hwaccel_select="mpeg2video_decoder" mpeg4_crystalhd_decoder_select="crystalhd" +mpeg4_mediacodec_decoder_deps="mediacodec" mpeg4_mmal_decoder_deps="mmal" mpeg4_mmal_decoder_select="mmal" mpeg4_mmal_hwaccel_deps="mmal" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index abef19e..642cf2a 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -317,6 +317,7 @@ OBJS-$(CONFIG_H264_DECODER)+= h264.o h264_cabac.o h264_cavlc.o \ h2645_parse.o OBJS-$(CONFIG_H264_CUVID_DECODER) += cuvid.o OBJS-$(CONFIG_H264_MEDIACODEC_DECODER) += mediacodecdec_h264.o +OBJS-$(CONFIG_MPEG4_MEDIACODEC_DECODER) += mediacodecdec_mpeg4.o OBJS-$(CONFIG_H264_MMAL_DECODER) += mmaldec.o OBJS-$(CONFIG_H264_NVENC_ENCODER) += nvenc_h264.o OBJS-$(CONFIG_NVENC_ENCODER) += nvenc_h264.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 951e199..2d98694 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -239,6 +239,7 @@ void avcodec_register_all(void) REGISTER_ENCDEC (MPEG2VIDEO,mpeg2video); REGISTER_ENCDEC (MPEG4, mpeg4); REGISTER_DECODER(MPEG4_CRYSTALHD, mpeg4_crystalhd); +REGISTER_DECODER(MPEG4_MEDIACODEC, mpeg4_mediacodec); REGISTER_DECODER(MPEG4_MMAL,mpeg4_mmal); #if FF_API_VDPAU REGISTER_DECODER(MPEG4_VDPAU, mpeg4_vdpau); diff --git a/libavcodec/mediacodecdec_mpeg4.c b/libavcodec/mediacodecdec_mpeg4.c new file mode 100644 index 000..7c4559b --- /dev/null +++ b/libavcodec/mediacodecdec_mpeg4.c @@ -0,0 +1,239 @@ +/* + * Android MediaCodec MPEG 4 decoder + * + * Copyright (c) 2016 Thomas Volkert + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/avassert.h" +#include "libavutil/common.h" +#include "libavutil/fifo.h" + +#include "avcodec.h" +#include "internal.h" +#include "mediacodecdec.h" +#include "mediacodec_wrapper.h" + +#define CODEC_MIME "video/mp4v-es" + +typedef struct MediaCodecMPEG4DecContext { + +MediaCodecDecContext *ctx; + +AVBSFContext *bsf; + +AVFifoBuffer *fifo; + +AVPacket filtered_pkt; + +} MediaCodecMPEG4DecContext; + +static av_cold int mediacodec_decode_close(AVCodecContext *avctx) +{ +MediaCodecMPEG4DecContext *s = avctx->priv_data; + +ff_mediacodec_dec_close(avctx, s->ctx); +s->ctx = NULL; + +av_fifo_free(s->fifo); + +av_bsf_free(>bsf); +av_packet_unref(>filtered_pkt); + +return 0; +} + +static av_cold int mediacodec_decode_init(AVCodecContext *avctx) +{ +int ret; + +FFAMediaFormat *format = NULL; +MediaCodecMPEG4DecContext *s = avctx->priv_data; + +format = ff_AMediaFormat_new(); +if (!format) { +av_log(avctx, AV_LOG_ERROR, "Failed to create media format\n"); +ret = AVERROR_EXTERNAL; +goto done; +} + +ff_AMediaFormat_setString(format, "mime", CODEC_MIME); +ff_AMediaFormat_setInt32(format, "width", avctx->width); +ff_AMediaFormat_setInt32(format, "height", avctx->height); + +s->ctx = av_mallocz(sizeof(*s->ctx)); +if (!s->ctx) { +av_log(avctx, AV_LOG_ERROR, "Failed to allocate MediaCodecDecContext\n"); +ret = AVERROR(ENOMEM); +goto done; +} + +if ((ret = ff_mediacodec_dec_init(avctx, s->ctx,
[FFmpeg-devel] [PATCH 3/4] lavc: add h.263 mediacodec decoder
From: Thomas Volkert--- Changelog | 1 + configure | 1 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/mediacodecdec_h263.c | 90 + libavcodec/version.h| 2 +- 6 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 libavcodec/mediacodecdec_h263.c diff --git a/Changelog b/Changelog index b8bbdb9..e35224c 100644 --- a/Changelog +++ b/Changelog @@ -8,6 +8,7 @@ version : - Alias muxer for Ogg Video (.ogv) - VP8 in Ogg muxing - MediaCodec MPEG-4 decoding +- MediaCodec H.263 decoding version 3.1: diff --git a/configure b/configure index 9004b06..18cc5f2 100755 --- a/configure +++ b/configure @@ -2548,6 +2548,7 @@ videotoolbox_hwaccel_deps="videotoolbox pthreads" videotoolbox_hwaccel_extralibs="-framework QuartzCore" xvmc_deps="X11_extensions_XvMClib_h" +h263_mediacodec_decoder_deps="mediacodec" h263_vaapi_hwaccel_deps="vaapi" h263_vaapi_hwaccel_select="h263_decoder" h263_videotoolbox_hwaccel_deps="videotoolbox" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 642cf2a..0bc0211 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -309,6 +309,7 @@ OBJS-$(CONFIG_H263_DECODER)+= h263dec.o h263.o ituh263dec.o\ intelh263dec.o h263data.o OBJS-$(CONFIG_H263_ENCODER)+= mpeg4videoenc.o mpeg4video.o \ h263.o ituh263enc.o flvenc.o h263data.o +OBJS-$(CONFIG_H263_MEDIACODEC_DECODER) += mediacodecdec_h263.o OBJS-$(CONFIG_H264_DECODER)+= h264.o h264_cabac.o h264_cavlc.o \ h264_direct.o h264_loopfilter.o \ h264_mb.o h264_picture.o h264_ps.o \ diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 2d98694..db2f25d 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -193,6 +193,7 @@ void avcodec_register_all(void) REGISTER_ENCDEC (H263, h263); REGISTER_DECODER(H263I, h263i); REGISTER_ENCDEC (H263P, h263p); +REGISTER_DECODER(H263_MEDIACODEC, h263_mediacodec); REGISTER_DECODER(H264, h264); REGISTER_DECODER(H264_CRYSTALHD,h264_crystalhd); REGISTER_DECODER(H264_MEDIACODEC, h264_mediacodec); diff --git a/libavcodec/mediacodecdec_h263.c b/libavcodec/mediacodecdec_h263.c new file mode 100644 index 000..5f2c412 --- /dev/null +++ b/libavcodec/mediacodecdec_h263.c @@ -0,0 +1,90 @@ +/* + * Android MediaCodec H.263 decoder + * + * Copyright (c) 2016 Thomas Volkert + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/avassert.h" +#include "libavutil/common.h" +#include "libavutil/fifo.h" + +#include "avcodec.h" +#include "internal.h" +#include "mediacodecdec.h" +#include "mediacodec_wrapper.h" + +#define CODEC_MIME "video/3gpp" + +static av_cold int mediacodec_decoder_init_h263(AVCodecContext *avctx) +{ +int ret; + +FFAMediaFormat *format = NULL; +MediaCodecDecContext *s = avctx->priv_data; + +format = ff_AMediaFormat_new(); +if (!format) { +av_log(avctx, AV_LOG_ERROR, "Failed to create media format\n"); +ret = AVERROR_EXTERNAL; +goto done; +} + +ff_AMediaFormat_setString(format, "mime", CODEC_MIME); +ff_AMediaFormat_setInt32(format, "width", avctx->width); +ff_AMediaFormat_setInt32(format, "height", avctx->height); + +if ((ret = ff_mediacodec_dec_init(avctx, s, CODEC_MIME, format)) < 0) { +goto done; +} + +av_log(avctx, AV_LOG_INFO, "MediaCodec started successfully, ret = %d\n", ret); + +s->fifo = av_fifo_alloc(sizeof(AVPacket)); +if (!s->fifo) { +ret = AVERROR(ENOMEM); +goto done; +} + +av_init_packet(>output_pkt); + +done: +if (format) { +ff_AMediaFormat_delete(format); +} + +if (ret < 0) { + ff_mediacodec_decoder_close(avctx); +} + +return ret; +} + +AVCodec ff_h263_mediacodec_decoder = { +.name = "h263_mediacodec", +.long_name = NULL_IF_CONFIG_SMALL("H.263
[FFmpeg-devel] [PATCH 2/4] lavc: share more code between h.264 and mpeg4 decoder
From: Thomas Volkert--- libavcodec/mediacodecdec.c | 140 ++- libavcodec/mediacodecdec.h | 12 +++ libavcodec/mediacodecdec_h264.c | 175 +++ libavcodec/mediacodecdec_mpeg4.c | 154 +++--- 4 files changed, 170 insertions(+), 311 deletions(-) diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c index df60104..d780ca4 100644 --- a/libavcodec/mediacodecdec.c +++ b/libavcodec/mediacodecdec.c @@ -23,6 +23,7 @@ #include #include +#include "libavutil/avassert.h" #include "libavutil/atomic.h" #include "libavutil/common.h" #include "libavutil/mem.h" @@ -152,6 +153,8 @@ static void ff_mediacodec_dec_unref(MediaCodecDecContext *s) return; if (!avpriv_atomic_int_add_and_fetch(>refcount, -1)) { +av_freep(>codec_name); + if (s->codec) { ff_AMediaCodec_delete(s->codec); s->codec = NULL; @@ -167,8 +170,17 @@ static void ff_mediacodec_dec_unref(MediaCodecDecContext *s) s->surface = NULL; } -av_freep(>codec_name); -av_freep(); +if (s->bsf) { +av_bsf_free(>bsf); + s->bsf = NULL; +} + +if (s->fifo) { + av_fifo_free(s->fifo); + s->fifo = NULL; +} + +av_packet_unref(>output_pkt); } } @@ -752,6 +764,130 @@ int ff_mediacodec_dec_is_flushing(AVCodecContext *avctx, MediaCodecDecContext *s return s->flushing; } +void ff_mediacodec_decoder_flush(AVCodecContext *avctx) +{ + MediaCodecDecContext *s = avctx->priv_data; + +while (av_fifo_size(s->fifo)) { +AVPacket pkt; +av_fifo_generic_read(s->fifo, , sizeof(pkt), NULL); +av_packet_unref(); +} +av_fifo_reset(s->fifo); + +av_packet_unref(>output_pkt); + +ff_mediacodec_dec_flush(avctx, s); +} + +int ff_mediacodec_decoder_decode(AVCodecContext *avctx, void *data, + int *got_frame, AVPacket *avpkt) +{ + MediaCodecDecContext *s = avctx->priv_data; +AVFrame *frame= data; +int ret; + +/* buffer the input packet */ +if (avpkt->size) { +AVPacket input_pkt = { 0 }; + +if (av_fifo_space(s->fifo) < sizeof(input_pkt)) { +ret = av_fifo_realloc2(s->fifo, + av_fifo_size(s->fifo) + sizeof(input_pkt)); +if (ret < 0) +return ret; +} + +ret = av_packet_ref(_pkt, avpkt); +if (ret < 0) +return ret; +av_fifo_generic_write(s->fifo, _pkt, sizeof(input_pkt), NULL); +} + +/* + * MediaCodec.flush() discards both input and output buffers, thus we + * need to delay the call to this function until the user has released or + * renderered the frames he retains. + * + * After we have buffered an input packet, check if the codec is in the + * flushing state. If it is, we need to call ff_mediacodec_dec_flush. + * + * ff_mediacodec_dec_flush returns 0 if the flush cannot be performed on + * the codec (because the user retains frames). The codec stays in the + * flushing state. + * + * ff_mediacodec_dec_flush returns 1 if the flush can actually be + * performed on the codec. The codec leaves the flushing state and can + * process again packets. + * + * ff_mediacodec_dec_flush returns a negative value if an error has + * occurred. + * + */ +if (ff_mediacodec_dec_is_flushing(avctx, s)) { +if (!ff_mediacodec_dec_flush(avctx, s)) { +return avpkt->size; +} +} + +/* process buffered data */ +while (!*got_frame) { +/* prepare the input data -- execute BSF if needed */ +if (s->output_pkt.size <= 0) { +av_packet_unref(>output_pkt); + +/* no more data */ +if (av_fifo_size(s->fifo) < sizeof(AVPacket)) { +return avpkt->size ? avpkt->size : +ff_mediacodec_dec_decode(avctx, s, frame, got_frame, avpkt); +} + +if (s->bsf) { +AVPacket unfiltered_pkt = { 0 }; + +av_fifo_generic_read(s->fifo, _pkt, sizeof(unfiltered_pkt), NULL); + +ret = av_bsf_send_packet(s->bsf, _pkt); + if (ret < 0) { + return ret; + } + + ret = av_bsf_receive_packet(s->bsf, >output_pkt); + if (ret == AVERROR(EAGAIN)) { + goto done; + } + + /* h264_mp4toannexb is used here and does not requires flushing */ + av_assert0(ret != AVERROR_EOF); + + if (ret < 0) { +
Re: [FFmpeg-devel] [PATCH 3/4] af_hdcd: Add counter for cdt expirations
Nitpicking: > Adds a counter for when the code detect timer expired without ^ detects > +int count_sustain_expired;/* occurances of code detect timer > expiring without detecting a code */ ^ occurrences > +if (cdt_active && state->sustain == 0) state->count_sustain_expired++; I think, according to ffmpeg style, you're supposed to put the instructions on a separate line. Moritz ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc: add mpeg4 mediacodec decoder
On Sun, Jul 24, 2016 at 11:37:08AM +0200, Thomas Volkert wrote: > From: Thomas Volkert> > --- > configure| 1 + > libavcodec/Makefile | 1 + > libavcodec/allcodecs.c | 1 + > libavcodec/mediacodecdec_mpeg4.c | 239 > +++ > 4 files changed, 242 insertions(+) > create mode 100644 libavcodec/mediacodecdec_mpeg4.c confirmed that this fixes the build issue if it works its probably ok, but maybye wait a bit so others have a chance to comment thx [..] thanks -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User questions about the command line tools should be sent to the ffmpeg-user ML. And questions about how to use libav* should be sent to the libav-user ML. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2] tests/fate: add dnxhr encoding tests
On Sat, Jul 23, 2016 at 06:10:33PM -0700, Mark Reid wrote: > added sws_flags flags and tested against x86_32 > > --- > tests/fate/seek.mak | 2 ++ > tests/fate/vcodec.mak | 26 - > tests/ref/seek/vsynth_lena-dnxhd-4k-hr-lb | 40 > +++ > tests/ref/vsynth/vsynth1-dnxhd-2k-hr-hq | 4 +++ > tests/ref/vsynth/vsynth1-dnxhd-4k-hr-lb | 4 +++ > tests/ref/vsynth/vsynth1-dnxhd-720p-hr-lb | 4 +++ > tests/ref/vsynth/vsynth1-dnxhd-uhd-hr-sq | 4 +++ > tests/ref/vsynth/vsynth2-dnxhd-2k-hr-hq | 4 +++ > tests/ref/vsynth/vsynth2-dnxhd-4k-hr-lb | 4 +++ > tests/ref/vsynth/vsynth2-dnxhd-720p-hr-lb | 4 +++ > tests/ref/vsynth/vsynth2-dnxhd-uhd-hr-sq | 4 +++ > tests/ref/vsynth/vsynth3-dnxhd-2k-hr-hq | 4 +++ > tests/ref/vsynth/vsynth3-dnxhd-4k-hr-lb | 4 +++ > tests/ref/vsynth/vsynth3-dnxhd-720p-hr-lb | 4 +++ > tests/ref/vsynth/vsynth3-dnxhd-uhd-hr-sq | 4 +++ > tests/ref/vsynth/vsynth_lena-dnxhd-2k-hr-hq | 4 +++ > tests/ref/vsynth/vsynth_lena-dnxhd-4k-hr-lb | 4 +++ > tests/ref/vsynth/vsynth_lena-dnxhd-720p-hr-lb | 4 +++ > tests/ref/vsynth/vsynth_lena-dnxhd-uhd-hr-sq | 4 +++ > 19 files changed, 131 insertions(+), 1 deletion(-) > create mode 100644 tests/ref/seek/vsynth_lena-dnxhd-4k-hr-lb > create mode 100644 tests/ref/vsynth/vsynth1-dnxhd-2k-hr-hq > create mode 100644 tests/ref/vsynth/vsynth1-dnxhd-4k-hr-lb > create mode 100644 tests/ref/vsynth/vsynth1-dnxhd-720p-hr-lb > create mode 100644 tests/ref/vsynth/vsynth1-dnxhd-uhd-hr-sq > create mode 100644 tests/ref/vsynth/vsynth2-dnxhd-2k-hr-hq > create mode 100644 tests/ref/vsynth/vsynth2-dnxhd-4k-hr-lb > create mode 100644 tests/ref/vsynth/vsynth2-dnxhd-720p-hr-lb > create mode 100644 tests/ref/vsynth/vsynth2-dnxhd-uhd-hr-sq > create mode 100644 tests/ref/vsynth/vsynth3-dnxhd-2k-hr-hq > create mode 100644 tests/ref/vsynth/vsynth3-dnxhd-4k-hr-lb > create mode 100644 tests/ref/vsynth/vsynth3-dnxhd-720p-hr-lb > create mode 100644 tests/ref/vsynth/vsynth3-dnxhd-uhd-hr-sq > create mode 100644 tests/ref/vsynth/vsynth_lena-dnxhd-2k-hr-hq > create mode 100644 tests/ref/vsynth/vsynth_lena-dnxhd-4k-hr-lb > create mode 100644 tests/ref/vsynth/vsynth_lena-dnxhd-720p-hr-lb > create mode 100644 tests/ref/vsynth/vsynth_lena-dnxhd-uhd-hr-sq applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Everything should be made as simple as possible, but not simpler. -- Albert Einstein signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavfi/curves: do not automatically insert points at x=0 and x=1
On Sun, Jul 17, 2016 at 05:03:35PM +0200, Clément Bœsch wrote: > There is actually a need for the origin and end point not to be defined. > We can not automatically insert them with the y value of the first and > last point as it will influence the curves in a wrong way. > > Fixes #5397 > --- > Changelog | 1 + > doc/filters.texi| 10 ++ > libavfilter/version.h | 2 +- > libavfilter/vf_curves.c | 85 > - > 4 files changed, 47 insertions(+), 51 deletions(-) > Applied. ...with a few more bonus (curves plotting and 10-bits support) -- Clément B. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavc: add mpeg4 mediacodec decoder
From: Thomas Volkert--- configure| 1 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/mediacodecdec_mpeg4.c | 239 +++ 4 files changed, 242 insertions(+) create mode 100644 libavcodec/mediacodecdec_mpeg4.c diff --git a/configure b/configure index 1b41303..9004b06 100755 --- a/configure +++ b/configure @@ -2621,6 +2621,7 @@ mpeg2_videotoolbox_hwaccel_select="mpeg2video_decoder" mpeg2_xvmc_hwaccel_deps="xvmc" mpeg2_xvmc_hwaccel_select="mpeg2video_decoder" mpeg4_crystalhd_decoder_select="crystalhd" +mpeg4_mediacodec_decoder_deps="mediacodec" mpeg4_mmal_decoder_deps="mmal" mpeg4_mmal_decoder_select="mmal" mpeg4_mmal_hwaccel_deps="mmal" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index abef19e..642cf2a 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -317,6 +317,7 @@ OBJS-$(CONFIG_H264_DECODER)+= h264.o h264_cabac.o h264_cavlc.o \ h2645_parse.o OBJS-$(CONFIG_H264_CUVID_DECODER) += cuvid.o OBJS-$(CONFIG_H264_MEDIACODEC_DECODER) += mediacodecdec_h264.o +OBJS-$(CONFIG_MPEG4_MEDIACODEC_DECODER) += mediacodecdec_mpeg4.o OBJS-$(CONFIG_H264_MMAL_DECODER) += mmaldec.o OBJS-$(CONFIG_H264_NVENC_ENCODER) += nvenc_h264.o OBJS-$(CONFIG_NVENC_ENCODER) += nvenc_h264.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 951e199..2d98694 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -239,6 +239,7 @@ void avcodec_register_all(void) REGISTER_ENCDEC (MPEG2VIDEO,mpeg2video); REGISTER_ENCDEC (MPEG4, mpeg4); REGISTER_DECODER(MPEG4_CRYSTALHD, mpeg4_crystalhd); +REGISTER_DECODER(MPEG4_MEDIACODEC, mpeg4_mediacodec); REGISTER_DECODER(MPEG4_MMAL,mpeg4_mmal); #if FF_API_VDPAU REGISTER_DECODER(MPEG4_VDPAU, mpeg4_vdpau); diff --git a/libavcodec/mediacodecdec_mpeg4.c b/libavcodec/mediacodecdec_mpeg4.c new file mode 100644 index 000..7c4559b --- /dev/null +++ b/libavcodec/mediacodecdec_mpeg4.c @@ -0,0 +1,239 @@ +/* + * Android MediaCodec MPEG 4 decoder + * + * Copyright (c) 2016 Thomas Volkert + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/avassert.h" +#include "libavutil/common.h" +#include "libavutil/fifo.h" + +#include "avcodec.h" +#include "internal.h" +#include "mediacodecdec.h" +#include "mediacodec_wrapper.h" + +#define CODEC_MIME "video/mp4v-es" + +typedef struct MediaCodecMPEG4DecContext { + +MediaCodecDecContext *ctx; + +AVBSFContext *bsf; + +AVFifoBuffer *fifo; + +AVPacket filtered_pkt; + +} MediaCodecMPEG4DecContext; + +static av_cold int mediacodec_decode_close(AVCodecContext *avctx) +{ +MediaCodecMPEG4DecContext *s = avctx->priv_data; + +ff_mediacodec_dec_close(avctx, s->ctx); +s->ctx = NULL; + +av_fifo_free(s->fifo); + +av_bsf_free(>bsf); +av_packet_unref(>filtered_pkt); + +return 0; +} + +static av_cold int mediacodec_decode_init(AVCodecContext *avctx) +{ +int ret; + +FFAMediaFormat *format = NULL; +MediaCodecMPEG4DecContext *s = avctx->priv_data; + +format = ff_AMediaFormat_new(); +if (!format) { +av_log(avctx, AV_LOG_ERROR, "Failed to create media format\n"); +ret = AVERROR_EXTERNAL; +goto done; +} + +ff_AMediaFormat_setString(format, "mime", CODEC_MIME); +ff_AMediaFormat_setInt32(format, "width", avctx->width); +ff_AMediaFormat_setInt32(format, "height", avctx->height); + +s->ctx = av_mallocz(sizeof(*s->ctx)); +if (!s->ctx) { +av_log(avctx, AV_LOG_ERROR, "Failed to allocate MediaCodecDecContext\n"); +ret = AVERROR(ENOMEM); +goto done; +} + +if ((ret = ff_mediacodec_dec_init(avctx, s->ctx, CODEC_MIME, format)) < 0) { +s->ctx = NULL; +goto done; +} + +av_log(avctx, AV_LOG_INFO, "MediaCodec started successfully, ret = %d\n", ret); + +s->fifo = av_fifo_alloc(sizeof(AVPacket)); +if (!s->fifo) { +ret = AVERROR(ENOMEM); +goto done; +} + +const AVBitStreamFilter *bsf = av_bsf_get_by_name("mpeg4_unpack_bframes"); +