Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: fix memleak in hlsenc
2017.01.05. 1:20 keltezéssel, Steven Liu írta: fix CID: 1398364 Resource leak refine the code of the new options Signed-off-by: Steven Liu--- libavformat/hlsenc.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 808a797..feeb853 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -446,11 +446,18 @@ static int hls_append_segment(struct AVFormatContext *s, HLSContext *hls, double if ((hls->flags & (HLS_SECOND_LEVEL_SEGMENT_SIZE | HLS_SECOND_LEVEL_SEGMENT_DURATION)) && strlen(hls->current_segment_final_filename_fmt)) { char * old_filename = av_strdup(hls->avf->filename); // %%s will be %s after strftime +if (!old_filename) { +av_free(en); +return AVERROR(ENOMEM); +} av_strlcpy(hls->avf->filename, hls->current_segment_final_filename_fmt, sizeof(hls->avf->filename)); +char * filename = av_strdup(hls->avf->filename); // %%s will be %s after strftime +if (!filename) { +av_free(old_filename); +av_free(en); +return AVERROR(ENOMEM); +} if (hls->flags & HLS_SECOND_LEVEL_SEGMENT_SIZE) { -char * filename = av_strdup(hls->avf->filename); // %%s will be %s after strftime -if (!filename) -return AVERROR(ENOMEM); if (replace_int_data_in_filename(hls->avf->filename, sizeof(hls->avf->filename), filename, 's', pos + size) < 1) { av_log(hls, AV_LOG_ERROR, @@ -459,14 +466,11 @@ static int hls_append_segment(struct AVFormatContext *s, HLSContext *hls, double filename); av_free(filename); av_free(old_filename); +av_free(en); return AVERROR(EINVAL); } -av_free(filename); } if (hls->flags & HLS_SECOND_LEVEL_SEGMENT_DURATION) { -char * filename = av_strdup(hls->avf->filename); // %%t will be %t after strftime -if (!filename) -return AVERROR(ENOMEM); if (replace_int_data_in_filename(hls->avf->filename, sizeof(hls->avf->filename), filename, 't', (int64_t)round(100 * duration)) < 1) { av_log(hls, AV_LOG_ERROR, @@ -475,10 +479,11 @@ static int hls_append_segment(struct AVFormatContext *s, HLSContext *hls, double filename); av_free(filename); av_free(old_filename); +av_free(en); return AVERROR(EINVAL); } -av_free(filename); } +av_free(filename); ff_rename(old_filename, hls->avf->filename, hls); av_free(old_filename); } if you remove av_strdup after if branch, this way if HLS_SECOND_LEVEL_SEGMENT_SIZE and HLS_SECOND_LEVEL_SEGMENT_DURATION also set, only later one will applied because filename will be the original one in second if branch. bb ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avformat/test/fifo_muxer: add check for FailingMuxerPacketData alloc
CID: 1396257 Signed-off-by: Steven Liu--- libavformat/tests/fifo_muxer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/tests/fifo_muxer.c b/libavformat/tests/fifo_muxer.c index dc62965..e20bd6e 100644 --- a/libavformat/tests/fifo_muxer.c +++ b/libavformat/tests/fifo_muxer.c @@ -151,6 +151,9 @@ static int prepare_packet(AVPacket *pkt,const FailingMuxerPacketData *pkt_data, { int ret; FailingMuxerPacketData *data = av_malloc(sizeof(*data)); +if (!data) { +return AVERROR(ENOMEM); +} memcpy(data, pkt_data, sizeof(FailingMuxerPacketData)); ret = av_packet_from_data(pkt, (uint8_t*) data, sizeof(*data)); -- 2.10.1.382.ga23ca1b.dirty ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCHv3] add signature filter for MPEG7 video signature
On Wed, Jan 04, 2017 at 05:05:41PM +0100, Gerion Entrup wrote: > On Dienstag, 3. Januar 2017 16:58:32 CET Moritz Barsnick wrote: > > > > The English opposite of "fine" is "coarse", not "course". :) > > > Oops. > > > > You still have a few "courses". (The actual variables, not the types. I > > don't care *too* much, but might be better for consistency.) > You're right. Fixed version attached. > > > > From my side - mostly style and docs - it looks fine. Technically, I > > can't judge too much. You went through a long review cycle already, so > > I assume it's fine for those previous reviewers. They have the last > > call anyway. > > What about FATE? I'm willing to write a test, but don't know the best way. > There are official conditions, whether the signature is standard compliant. > I've > written a python script to proof that (see previous emails). Nevertheless the > checks take relatively long and need 3GB inputvideo, so I assume this is not > usable for FATE. yes, a 3gb reference is not ok for fate > > One way would be, to take a short input video, take the calculated signature > and use this as reference, but the standard allow some bitflips and my code > has some of them in comparison to the reference signatures. then the fate test could/should compare and pass if its within what we expect of our code. (which may be stricter than the reference allowance) there are already tests that do similar for comparing PCM/RAW [...] > +#define OFFSET(x) offsetof(SignatureContext, x) > +#define FLAGS AV_OPT_FLAG_VIDEO_PARAM should contin also AV_OPT_FLAG_FILTERING_PARAM [...] > +static int export(AVFilterContext *ctx, StreamContext *sc, int input) > +{ > +SignatureContext* sic = ctx->priv; > +char filename[1024]; > + > +if (sic->nb_inputs > 1) { > +/* error already handled */ > +av_get_frame_filename(filename, sizeof(filename), sic->filename, > input); its more robust to use a av_assert*() on the return code if its assumed to be never failing than just a comment as a comment cannot be automatcially checked for validity currently. [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The real ebay dictionary, page 1 "Used only once"- "Some unspecified defect prevented a second use" "In good condition" - "Can be repaird by experienced expert" "As is" - "You wouldnt want it even if you were payed for it, if you knew ..." signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libavutil/hwcontext_qsv: Fix bug that the QSV encoded frames'width and height are 32-aligned
On 04/01/17 09:49, Huang, Zhengxu wrote: > 在 2017/1/3 20:40, Mark Thompson 写道: >> On 03/01/17 06:35, Huang, Zhengxu wrote: >>> From 8b1bcc0634f6ce36acfbd2bfdd26690a6323d09c Mon Sep 17 00:00:00 2001 >>> From: Zhengxu>>> Date: Fri, 16 Dec 2016 11:10:34 +0800 >>> Subject: [PATCH] libavutil/hwcontext_qsv: Fix bug that the QSV encoded >>> frames' >>> width and height are 32-aligned. >>> >>> Description: >>> If an input is of 1280x720, the encoded stream created by command below is >>> of 1280x736: >>> ffmpeg -hwaccel qsv -c:v h264_qsv -i test.h264 -c:v h264_qsv out.h264 >>> >>> Reason: >>> When creating a AVQSVFramesContext, width and height shouldn't be aligned, >>> or the mfxSurfaces' >>> cropW and cropH will be wrong. >>> >>> Fix: >>> User should configure AVQSVFramesContext with origin width and height and >>> AVFramesContext will >>> align the width and height when being initiallized. >>> >>> Signed-off-by: ChaoX A Liu >>> Signed-off-by: Huang, Zhengxu >>> Signed-off-by: Andrew, Zhang >>> --- >>> ffmpeg_qsv.c | 8 >>> libavutil/hwcontext_qsv.c | 8 ++-- >>> 2 files changed, 10 insertions(+), 6 deletions(-) >>> >>> diff --git a/ffmpeg_qsv.c b/ffmpeg_qsv.c >>> index 68ff5bd..aab7375 100644 >>> --- a/ffmpeg_qsv.c >>> +++ b/ffmpeg_qsv.c >>> @@ -76,8 +76,8 @@ int qsv_init(AVCodecContext *s) >>> frames_ctx = (AVHWFramesContext*)ist->hw_frames_ctx->data; >>> frames_hwctx = frames_ctx->hwctx; >>> -frames_ctx->width = FFALIGN(s->coded_width, 32); >>> -frames_ctx->height= FFALIGN(s->coded_height, 32); >>> +frames_ctx->width = s->coded_width; >>> +frames_ctx->height= s->coded_height; >>> frames_ctx->format= AV_PIX_FMT_QSV; >>> frames_ctx->sw_format = s->sw_pix_fmt; >>> frames_ctx->initial_pool_size = 64; >>> @@ -152,8 +152,8 @@ int qsv_transcode_init(OutputStream *ost) >>> encode_frames = (AVHWFramesContext*)encode_frames_ref->data; >>> qsv_frames = encode_frames->hwctx; >>> -encode_frames->width = FFALIGN(ist->resample_width, 32); >>> -encode_frames->height= FFALIGN(ist->resample_height, 32); >>> +encode_frames->width = ist->resample_width; >>> +encode_frames->height= ist->resample_height; >>> encode_frames->format= AV_PIX_FMT_QSV; >>> encode_frames->sw_format = AV_PIX_FMT_NV12; >>> encode_frames->initial_pool_size = 1; >>> diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c >>> index 03244a6..2dc9aca 100644 >>> --- a/libavutil/hwcontext_qsv.c >>> +++ b/libavutil/hwcontext_qsv.c >>> @@ -308,9 +308,13 @@ static int qsv_init_pool(AVHWFramesContext *ctx, >>> uint32_t fourcc) >>> surf->Info.ChromaFormat = MFX_CHROMAFORMAT_YUV444; >>> surf->Info.FourCC = fourcc; >>> -surf->Info.Width = ctx->width; >>> +/* >>> + * WxH being aligned with 32x32 is needed by MSDK. >>> + * CropW and CropH are the real size of the frame. >>> + */ >>> +surf->Info.Width = FFALIGN(ctx->width, 32); >>> surf->Info.CropW = ctx->width; >>> -surf->Info.Height = ctx->height; >>> +surf->Info.Height = FFALIGN(ctx->height, 32); >>> surf->Info.CropH = ctx->height; >>> surf->Info.FrameRateExtN = 25; >>> surf->Info.FrameRateExtD = 1; >>> -- >>> 1.8.3.1 >>> >> This seems wrong to me - the hwcontext code is only dealing in surfaces, and >> should not be interested in the actual dimensions of the frame on each >> surface (that is a per-frame property anyway, since it need not be the same >> for all frames in a context). >> >> Is it possible to instead fix this case by adjusting the cropping parameters >> after copying the FrameInfo at libavcodec/qsvenc.c:378? Maybe this (not >> tested at all): >> >> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c >> index ac443c1a26..32e2a4ed13 100644 >> --- a/libavcodec/qsvenc.c >> +++ b/libavcodec/qsvenc.c >> @@ -376,6 +376,8 @@ static int init_video_param(AVCodecContext *avctx, >> QSVEncContext *q) >> AVHWFramesContext *frames_ctx = >> (AVHWFramesContext*)avctx->hw_frames_ctx->data; >> AVQSVFramesContext *frames_hwctx = frames_ctx->hwctx; >> q->param.mfx.FrameInfo = frames_hwctx->surfaces[0].Info; >> +q->param.mfx.FrameInfo.CropW = avctx->width; >> +q->param.mfx.FrameInfo.CropH = avctx->height; >> } else { >> q->param.mfx.FrameInfo.FourCC = MFX_FOURCC_NV12; >> q->param.mfx.FrameInfo.Width = FFALIGN(avctx->width, >> q->width_align); >> > > Hi, > > > If fixing this issue by adjusting the cropping parameters after copying the > FrameInfo, maybe it will still have some problem. > > This
[FFmpeg-devel] [PATCH] avformat/hlsenc: fix Explicit null dereferenced
CID: 1323076 Passing null pointer loc to avformat_new_stream, which dereferences it fix: because the vtt_oc maybe have not value, so fix it. Signed-off-by: Steven Liu--- libavformat/hlsenc.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 808a797..2a53908 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -406,10 +406,16 @@ static int hls_mux_init(AVFormatContext *s) for (i = 0; i < s->nb_streams; i++) { AVStream *st; AVFormatContext *loc; -if (s->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) -loc = vtt_oc; -else +if (s->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) { +if (vtt_oc) { +loc = vtt_oc; +} else { +av_log(s, AV_LOG_WARNING, "No VTT file found, so just can not use it\n"); +loc = oc; +} +} else { loc = oc; +} if (!(st = avformat_new_stream(loc, NULL))) return AVERROR(ENOMEM); -- 2.10.1.382.ga23ca1b.dirty ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] doc/hlsenc: hls_segment_filename, use_localtime, , use_localtime_mkdir, hls_flags
On Thu, Jan 05, 2017 at 01:24:00AM +0100, Michael Niedermayer wrote: > On Mon, Jan 02, 2017 at 02:24:22PM +0100, Bodecs Bela wrote: > > > > > > 2017.01.02. 13:54 keltezéssel, Moritz Barsnick írta: > > >On Mon, Jan 02, 2017 at 12:49:50 +0100, Bodecs Bela wrote: > > >>Subject: [FFmpeg-devel] [PATCH] doc/hlsenc: hls_segment_filename, > > >>use_localtime, , use_localtime_mkdir, hls_flags > > > > > > ^^ > > >There's a ", " too much in that part of the commit message. > > > > > >>+@var{filename} may contain full path or relative path specification, but > > >>only the file name part without any path info will be contained in the > > >>m3u8 segment list. > > >You should break this line. > > > > > >>+Should relative path is specified, path of created segment files will be > > >>relative to the current working directory. > > >-> > > > Should a relative path be specified, the path of the created segment > > > files will be relative to the current working directory. > > > > > >>+When -use_localtime_mkdir is set, the whole expanded value of > > >>@var{filename} will be written into m3u8 segment list. > > > ^ I think you should omit the dashes, as these are primarily > > > library options, not command line options. > > > > > >And do add an article: "... will be written into the m3u8 segment > > >list." > > > > > >>-@file{file-20160215-1455569023.ts}, @file{file-20160215-1455569024.ts}, > > >>etc. > > >>+@file{file-20160215-1455569023.ts}, @file{file-20160215-1455569024.ts}, > > >>etc. (Notice: in some systems/environments %s specifier is not available. > > >>See strftime() documentation!) > > >-> > > > Note: On some systems/environments, the code{%s} specifier is not > > > available. See > > > code{strftime()} documentation. > > > > > >(Avoid exclamation marks.) > > > > > >>+This example will create a directory hierarchy 2016/02/15 (if any of > > >>them does not exist), and then > > > > > >^ do > > Thank you. I have made all suggested changes. > > >Moritz > > >___ > > >ffmpeg-devel mailing list > > >ffmpeg-devel@ffmpeg.org > > >http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > > > > muxers.texi | 47 +++ > > 1 file changed, 35 insertions(+), 12 deletions(-) > > c0e3481cbb64139648b9138baea7b18ce75c7de8 > > 0001-doc-muxers-hls_segment_filename-use_localtime-use_lo.patch > > From 2720f2410feb9c51a6d37477f432780dc2594c5d Mon Sep 17 00:00:00 2001 > > From: Bela Bodecs> > Date: Sun, 1 Jan 2017 22:48:27 +0100 > > Subject: [PATCH] doc/muxers: hls_segment_filename, use_localtime, > > use_localtime_mkdir, hls_flags > > seems this was already approved by steven and this fixes all issues > found by Moritz so applied this was already applied by steven :) [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I do not agree with what you have to say, but I'll defend to the death your right to say it. -- Voltaire signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avformat/hlsenc: fix Explicit null dereferenced in hlsenc
CID: 1398228 Passing null pointer dirname to strlen, which dereferences it. Signed-off-by: Steven Liu--- libavformat/hlsenc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 808a797..3c6490a 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -285,8 +285,8 @@ static int hls_delete_old_segments(HLSContext *hls) { path, strerror(errno)); } -if (segment->sub_filename[0] != '\0') { -sub_path_size = strlen(dirname) + strlen(segment->sub_filename) + 1; +if ((segment->sub_filename[0] != '\0')) { +sub_path_size = (!dirname) ? (strlen(segment->sub_filename) + 1) : (strlen(dirname) + strlen(segment->sub_filename) + 1); sub_path = av_malloc(sub_path_size); if (!sub_path) { ret = AVERROR(ENOMEM); -- 2.10.1.382.ga23ca1b.dirty ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] doc/hlsenc: hls_segment_filename, use_localtime, , use_localtime_mkdir, hls_flags
On Mon, Jan 02, 2017 at 02:24:22PM +0100, Bodecs Bela wrote: > > > 2017.01.02. 13:54 keltezéssel, Moritz Barsnick írta: > >On Mon, Jan 02, 2017 at 12:49:50 +0100, Bodecs Bela wrote: > >>Subject: [FFmpeg-devel] [PATCH] doc/hlsenc: hls_segment_filename, > >>use_localtime, , use_localtime_mkdir, hls_flags > > > >^^ > >There's a ", " too much in that part of the commit message. > > > >>+@var{filename} may contain full path or relative path specification, but > >>only the file name part without any path info will be contained in the m3u8 > >>segment list. > >You should break this line. > > > >>+Should relative path is specified, path of created segment files will be > >>relative to the current working directory. > >-> > > Should a relative path be specified, the path of the created segment > > files will be relative to the current working directory. > > > >>+When -use_localtime_mkdir is set, the whole expanded value of > >>@var{filename} will be written into m3u8 segment list. > > ^ I think you should omit the dashes, as these are primarily > > library options, not command line options. > > > >And do add an article: "... will be written into the m3u8 segment > >list." > > > >>-@file{file-20160215-1455569023.ts}, @file{file-20160215-1455569024.ts}, > >>etc. > >>+@file{file-20160215-1455569023.ts}, @file{file-20160215-1455569024.ts}, > >>etc. (Notice: in some systems/environments %s specifier is not available. > >>See strftime() documentation!) > >-> > > Note: On some systems/environments, the code{%s} specifier is not > > available. See > > code{strftime()} documentation. > > > >(Avoid exclamation marks.) > > > >>+This example will create a directory hierarchy 2016/02/15 (if any of them > >>does not exist), and then > > > > ^ do > Thank you. I have made all suggested changes. > >Moritz > >___ > >ffmpeg-devel mailing list > >ffmpeg-devel@ffmpeg.org > >http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > muxers.texi | 47 +++ > 1 file changed, 35 insertions(+), 12 deletions(-) > c0e3481cbb64139648b9138baea7b18ce75c7de8 > 0001-doc-muxers-hls_segment_filename-use_localtime-use_lo.patch > From 2720f2410feb9c51a6d37477f432780dc2594c5d Mon Sep 17 00:00:00 2001 > From: Bela Bodecs> Date: Sun, 1 Jan 2017 22:48:27 +0100 > Subject: [PATCH] doc/muxers: hls_segment_filename, use_localtime, > use_localtime_mkdir, hls_flags seems this was already approved by steven and this fixes all issues found by Moritz so applied thx [...] -- 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
[FFmpeg-devel] [PATCH] avformat/hlsenc: fix memleak in hlsenc
fix CID: 1398364 Resource leak refine the code of the new options Signed-off-by: Steven Liu--- libavformat/hlsenc.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 808a797..feeb853 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -446,11 +446,18 @@ static int hls_append_segment(struct AVFormatContext *s, HLSContext *hls, double if ((hls->flags & (HLS_SECOND_LEVEL_SEGMENT_SIZE | HLS_SECOND_LEVEL_SEGMENT_DURATION)) && strlen(hls->current_segment_final_filename_fmt)) { char * old_filename = av_strdup(hls->avf->filename); // %%s will be %s after strftime +if (!old_filename) { +av_free(en); +return AVERROR(ENOMEM); +} av_strlcpy(hls->avf->filename, hls->current_segment_final_filename_fmt, sizeof(hls->avf->filename)); +char * filename = av_strdup(hls->avf->filename); // %%s will be %s after strftime +if (!filename) { +av_free(old_filename); +av_free(en); +return AVERROR(ENOMEM); +} if (hls->flags & HLS_SECOND_LEVEL_SEGMENT_SIZE) { -char * filename = av_strdup(hls->avf->filename); // %%s will be %s after strftime -if (!filename) -return AVERROR(ENOMEM); if (replace_int_data_in_filename(hls->avf->filename, sizeof(hls->avf->filename), filename, 's', pos + size) < 1) { av_log(hls, AV_LOG_ERROR, @@ -459,14 +466,11 @@ static int hls_append_segment(struct AVFormatContext *s, HLSContext *hls, double filename); av_free(filename); av_free(old_filename); +av_free(en); return AVERROR(EINVAL); } -av_free(filename); } if (hls->flags & HLS_SECOND_LEVEL_SEGMENT_DURATION) { -char * filename = av_strdup(hls->avf->filename); // %%t will be %t after strftime -if (!filename) -return AVERROR(ENOMEM); if (replace_int_data_in_filename(hls->avf->filename, sizeof(hls->avf->filename), filename, 't', (int64_t)round(100 * duration)) < 1) { av_log(hls, AV_LOG_ERROR, @@ -475,10 +479,11 @@ static int hls_append_segment(struct AVFormatContext *s, HLSContext *hls, double filename); av_free(filename); av_free(old_filename); +av_free(en); return AVERROR(EINVAL); } -av_free(filename); } +av_free(filename); ff_rename(old_filename, hls->avf->filename, hls); av_free(old_filename); } -- 2.10.1.382.ga23ca1b.dirty ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: bugfix in duplicate filename detection
2017-01-05 3:17 GMT+08:00 Bodecs Bela: > Dear All, > > in hlsenc.c at detecting duplicate segment filenames a wrong, unitialized > variable is used for testing. This patch fixes this > typo. Please apply my patch. > applied! > > Thank you in advance. > > Bela Bodecs > > > ___ > 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] avcodec/texturedspenc: Fix indexing in color distribution determination
On Wed, Jan 4, 2017 at 1:06 AM, Michael Niedermayerwrote: > On Tue, Jan 03, 2017 at 02:15:20PM +0100, Vittorio Giovara wrote: >> On Mon, Jan 2, 2017 at 2:00 AM, James Almer wrote: >> > On 1/1/2017 8:28 PM, Michael Niedermayer wrote: >> >> Fixes CID1396405 >> >> What is the CID about? > > sorry for not quoting this prviously, it isnt very interresting. > my patch is based on just this and guesswork, which is why it should > be tested. > > 257for (y = 0; y < 4; y++) { >assignment: Assigning: x = 4. >const: At condition x < 4, the value of x must be equal to 4. >dead_error_condition: The condition x < 4 cannot be true. > 258for (x = 4; x < 4; x += 4) { >CID 1396405 (#1 of 1): Logically dead code (DEADCODE)dead_error_begin: > Execution cannot reach this statement: muv += bp[x * 4 + y * stride];. Ah, yes that seems wrong, probably a leftover of the code conversion (from https://github.com/nothings/stb/blob/master/stb_dxt.h#L293-L298) I believe it should be sufficient to do `for (x = 0; x < 4; x++)` but I won't be able to test that for a while I'm afraid -- Vittorio ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] imdct15: replace the FFT with a faster PFA FFT algorithm
On 4 January 2017 at 14:14, Peter Barfusswrote: > First off, many thanks. > > > +const int inv_1 = l_ptwo << ((4 - b_ptwo) & 3); > > +const int inv_2 = 0xeeef & ((1U << b_ptwo) - 1); > > It would be nice to add a comment here that the expression for inv_1 > is (2^b_ptwo)^-1 mod 15 and inv_2 is 15^-1 mod 2^b_ptwo. (A general > PFA FFT would need to use extended Euclidean algorithm here, but > because both cases are fixed, it simplifies to these expressions. I > have a sketch of a proof (basically solving the relevant diophantine > equation you get) in case anyone is nervous, though it's easy to > verify by hand for 1 < b_ptwo < 18, which are all the cases that > ffmpeg's power-of-two FFT currently supports). > > Rest of patch seems good. > > -Peter > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > Done Also I didn't like how s->exptab[20].re needed a negative sign so I removed it and moved the subtraction to the 5-point FFT, just so you know. I'll push both patches tomorrow evening if no one else has anything to say. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/matroskaenc: Regression fix for invalid MKV headers
==> Revised patch in plain text (the attachment from my previous reply wasn't recognized by patchwork) The following three commits created a regression by writing initially invalid mkv headers: 650e17d88b63b5aca6e0a43483e89e64b0f7d2dd avformat/matroskaenc: write a CRC32 element on Tags 3bcadf822711720ff0f8d14db71ae47cdf97e652 avformat/matroskaenc: write a CRC32 element on Info ee888cfbe777cd2916a3548c750e433ab8f8e6a5 avformat/matroskaenc: postpone writing the Tracks master Symptoms: - You can no longer playback a file that is still processed by ffmpeg, e.g. VLC fails playback - You can no longer stream a file to a client while if is still being processed - Various diagnosing tools show header errors or incomplete headers (e.g. ffprobe, mediainfo, mkvalidator) Note: The symptoms do not apply to completed files or ffmpeg runs that were interrupted with 'q' Cause: The mentioned commits made changes in a way that some header elements are only partially written in mkv_write_header, leaving the header in an invalid state. Only in mkv_write_trailer, these elements are finished correctly, but that does only occur at the end of the process. Regression: Before these commits were applied, mkv headers have always been valid, even before completion of ffmpeg. This has worked reliably over many versions of ffmpeg, to it was an obvious regression. Bugtracker: This issue has been recorded as #5977 which is resolved by this patch Patch: The patch adds a new function 'end_ebml_master_crc32_preliminary' that preliminarily finishes the ebl element without destroying the buffer. The buffer can be used to update the ebml element later during mkv_write_trailer. But most important: mkv_write_header finishes with a valid mkv header again. --- libavformat/avio.h| 12 libavformat/aviobuf.c | 17 + libavformat/matroskaenc.c | 28 +--- 3 files changed, 54 insertions(+), 3 deletions(-) diff --git a/libavformat/avio.h b/libavformat/avio.h index b1ce1d1..f2b9a6f 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -704,6 +704,18 @@ int avio_closep(AVIOContext **s); int avio_open_dyn_buf(AVIOContext **s); /** + * Return the written size and a pointer to the buffer. + * The AVIOContext stream is left intact. + * The buffer must NOT be freed. + * No padding is added to the buffer. + * + * @param s IO context + * @param pbuffer pointer to a byte buffer + * @return the length of the byte buffer + */ +int avio_get_dyn_buf(AVIOContext *s, uint8_t **pbuffer); + +/** * Return the written size and a pointer to the buffer. The buffer * must be freed with av_free(). * Padding of AV_INPUT_BUFFER_PADDING_SIZE is added to the buffer. diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 134d627..bf7e5f8 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -1277,6 +1277,23 @@ int ffio_open_dyn_packet_buf(AVIOContext **s, int max_packet_size) return url_open_dyn_buf_internal(s, max_packet_size); } +int avio_get_dyn_buf(AVIOContext *s, uint8_t **pbuffer) +{ +DynBuffer *d; + +if (!s) { +*pbuffer = NULL; +return 0; +} + +avio_flush(s); + +d = s->opaque; +*pbuffer = d->buffer; + +return d->size; +} + int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer) { DynBuffer *d; diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 827d755..27d83a6 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -367,6 +367,28 @@ static void end_ebml_master_crc32(AVIOContext *pb, AVIOContext **dyn_cp, Matrosk *dyn_cp = NULL; } +/** +* Complete ebml master whithout destroying the buffer, allowing for later updates +*/ +static void end_ebml_master_crc32_preliminary(AVIOContext *pb, AVIOContext **dyn_cp, MatroskaMuxContext *mkv, +ebml_master master) +{ +uint8_t *buf, crc[4]; +int size, skip = 0; + +if (pb->seekable) { + +size = avio_get_dyn_buf(*dyn_cp, ); +if (mkv->write_crc && mkv->mode != MODE_WEBM) { +skip = 6; /* Skip reserved 6-byte long void element from the dynamic buffer. */ +AV_WL32(crc, av_crc(av_crc_get_table(AV_CRC_32_IEEE_LE), UINT32_MAX, buf + skip, size - skip) ^ UINT32_MAX); +put_ebml_binary(pb, EBML_ID_CRC32, crc, sizeof(crc)); +} +avio_write(pb, buf + skip, size - skip); +end_ebml_master(pb, master); +} +} + static void put_xiph_size(AVIOContext *pb, int size) { ffio_fill(pb, 255, size / 255); @@ -1309,7 +1331,7 @@ static int mkv_write_tracks(AVFormatContext *s) } if (pb->seekable && !mkv->is_live) -put_ebml_void(pb, avio_tell(mkv->tracks_bc)); +end_ebml_master_crc32_preliminary(pb, >tracks_bc, mkv, mkv->tracks_master); else end_ebml_master_crc32(pb, >tracks_bc, mkv, mkv->tracks_master); @@ -1554,7 +1576,7 @@ static int mkv_write_tags(AVFormatContext *s) if (mkv->tags.pos) {
[FFmpeg-devel] [PATCH] avformat/hlsenc: bugfix in duplicate filename detection
Dear All, in hlsenc.c at detecting duplicate segment filenames a wrong, unitialized variable is used for testing. This patch fixes this typo. Please apply my patch. Thank you in advance. Bela Bodecs >From 2459227d3c304b9e45ae52071e8bcea36e287dac Mon Sep 17 00:00:00 2001 From: Bela BodecsDate: Wed, 4 Jan 2017 20:12:48 +0100 Subject: [PATCH] avformat/hlsenc: bugfix in duplicate filename detection A wrong, unitialized variable is used for testing. This patch fixes this typo. Signed-off-by: Bela Bodecs --- libavformat/hlsenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 4b1f12f..808a797 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -490,7 +490,7 @@ static int hls_append_segment(struct AVFormatContext *s, HLSContext *hls, double filename = hls->avf->filename; } if (find_segment_by_filename(hls->segments, filename) -|| find_segment_by_filename(hls->old_segments, en->filename)) { +|| find_segment_by_filename(hls->old_segments, filename)) { av_log(hls, AV_LOG_WARNING, "Duplicated segment filename detected: %s\n", filename); } av_strlcpy(en->filename, filename, sizeof(en->filename)); -- 2.5.3.windows.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/matroskaenc: Regression fix for invalid MKV headers
> From: ffmpeg-develon behalf of Michael > Niedermayer > > this patch breaks fate > make fate I apologize, I had run fate but for some reason I hadn't got an error. But now I ran again, found and fixed the error. Please find attached a revised patch (still single patch for now). > changes to avio* should be in a seperate patch No problem, I will split it. For the procedure: - Should I write individual patch descriptions? - Should I post both patches in this thread or create two new threads or only one new thread for avio? Thank you very much for your assistance, softworkz 0002-avformat-matroskaenc-Regression-fix-for-invalid-MKV-.patch Description: 0002-avformat-matroskaenc-Regression-fix-for-invalid-MKV-.patch ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] FATE Sub-CC Test
I submitted a patch that failed a FATE test a while back. The patch changed the time position of subtitles. I have finally been able to take a look at the test (fate-sub-cc), and I believe the test is incorrect. It is looking for the following cues: Dialogue: 0,0:00:12.36,0:00:40.83,Default,,0,0,0,,{\an7}{\pos(38,44)}({\i1} inaudible radio chatter{\i0} ) Dialogue: 0,0:00:40.83,0:00:59.07,Default,,0,0,0,,{\an7}{\pos(38,28)}({\i1} inaudible radio chatter{\i0} )\N{\an7}{\pos(38,44)}>> Safety remains our number one So the captions would be visible from 0:00:12.36 - 0:00:40.83 and 0:00:40.84 - 0:00:59.07. With my patch, these timings are significantly changed to 0:00:00.83 - 0:00:02.97 and 0:00:02.97 - 0:00:04.34. I ran the same video through ccextractor -- which produced correct captions on videos that produced incorrect timings on captions without my fix -- and the timings were not close to the ones we are currently testing for: 0:00:01.033 - 0:00:04.399 and 0:00:04.401 - 0:00:05.198. Before I update the test and resubmit my patch, I wanted to know if anyone had a reason for the difference here. I don't want to just assume the test is wrong when I might just have a misunderstanding. Chris. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]lavf/matroska: Fix the A_MPEG/L1 codec_id
On Tue, Jan 03, 2017 at 03:46:06AM +0100, Carl Eugen Hoyos wrote: > Hi! > > Attached patch fixes MP1 muxing in mkv. > > Please comment, Carl Eugen > matroska.c |2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > 9ed063b5f9851ad17c82eb4896d9731e59b04d26 > 0001-lavf-matroska-Fix-the-codec_id-for-mkv-tag-A_MPEG-L1.patch > From 649977cf7af3734ec81204514874e9d16fcb6b29 Mon Sep 17 00:00:00 2001 > From: Carl Eugen Hoyos> Date: Tue, 3 Jan 2017 03:43:34 +0100 > Subject: [PATCH] lavf/matroska: Fix the codec_id for mkv tag A_MPEG/L1. > > When the mapping was originally added AV_CODEC_ID_MP1 did not exist. > --- > libavformat/matroska.c |2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) should be ok thx PS: please add a fate test [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Dictatorship naturally arises out of democracy, and the most aggravated form of tyranny and slavery out of the most extreme liberty. -- Plato signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCHv3] add signature filter for MPEG7 video signature
On Dienstag, 3. Januar 2017 16:58:32 CET Moritz Barsnick wrote: > > > The English opposite of "fine" is "coarse", not "course". :) > > Oops. > > You still have a few "courses". (The actual variables, not the types. I > don't care *too* much, but might be better for consistency.) You're right. Fixed version attached. > From my side - mostly style and docs - it looks fine. Technically, I > can't judge too much. You went through a long review cycle already, so > I assume it's fine for those previous reviewers. They have the last > call anyway. What about FATE? I'm willing to write a test, but don't know the best way. There are official conditions, whether the signature is standard compliant. I've written a python script to proof that (see previous emails). Nevertheless the checks take relatively long and need 3GB inputvideo, so I assume this is not usable for FATE. One way would be, to take a short input video, take the calculated signature and use this as reference, but the standard allow some bitflips and my code has some of them in comparison to the reference signatures. Gerion diff --git a/libavfilter/signature.h b/libavfilter/signature.h index 4728606..2659c87 100644 --- a/libavfilter/signature.h +++ b/libavfilter/signature.h @@ -36,7 +36,7 @@ #define ELEMENT_COUNT 10 #define SIGELEM_SIZE 380 #define DIFFELEM_SIZE 348 /* SIGELEM_SIZE - elem_a1 - elem_a2 */ -#define COURSE_SIZE 90 +#define COARSE_SIZE 90 enum lookup_mode { MODE_OFF, @@ -111,14 +111,14 @@ typedef struct { FineSignature* finesiglist; FineSignature* curfinesig; -CoarseSignature* coursesiglist; -CoarseSignature* courseend; /* needed for xml export */ +CoarseSignature* coarsesiglist; +CoarseSignature* coarseend; /* needed for xml export */ /* helpers to store the alternating signatures */ -CoarseSignature* curcoursesig1; -CoarseSignature* curcoursesig2; +CoarseSignature* curcoarsesig1; +CoarseSignature* curcoarsesig2; -int coursecount; /* counter from 0 to 89 */ -int midcourse; /* whether it is a coursesignature beginning from 45 + i * 90 */ +int coarsecount; /* counter from 0 to 89 */ +int midcoarse; /* whether it is a coarsesignature beginning from 45 + i * 90 */ uint32_t lastindex; /* helper to store amount of frames */ int exported; /* boolean whether stream already exported */ diff --git a/libavfilter/signature_lookup.c b/libavfilter/signature_lookup.c index 23c0ff1..5bc2904 100644 --- a/libavfilter/signature_lookup.c +++ b/libavfilter/signature_lookup.c @@ -109,7 +109,7 @@ static unsigned int get_l1dist(AVFilterContext *ctx, SignatureContext *sc, const } /** - * calculates the jaccard distance and evaluates a pair of course signatures as good + * calculates the jaccard distance and evaluates a pair of coarse signatures as good * @return 0 if pair is bad, 1 otherwise */ static int get_jaccarddist(SignatureContext *sc, CoarseSignature *first, CoarseSignature *second) @@ -134,12 +134,12 @@ static int get_jaccarddist(SignatureContext *sc, CoarseSignature *first, CoarseS } /** - * step through the coursesignatures as long as a good candidate is found + * step through the coarsesignatures as long as a good candidate is found * @return 0 if no candidate is found, 1 otherwise */ -static int find_next_coursecandidate(SignatureContext *sc, CoarseSignature *secondstart, CoarseSignature **first, CoarseSignature **second, int start) +static int find_next_coarsecandidate(SignatureContext *sc, CoarseSignature *secondstart, CoarseSignature **first, CoarseSignature **second, int start) { -/* go one coursesignature foreword */ +/* go one coarsesignature foreword */ if (!start) { if ((*second)->next) { *second = (*second)->next; @@ -183,9 +183,9 @@ static MatchingInfo* get_matching_parameters(AVFilterContext *ctx, SignatureCont uint8_t size; unsigned int dist; FineSignature *a; -uint8_t b_pos[COURSE_SIZE]; -FineSignature *b[COURSE_SIZE]; -} pairs[COURSE_SIZE]; +uint8_t b_pos[COARSE_SIZE]; +FineSignature *b[COARSE_SIZE]; +} pairs[COARSE_SIZE]; typedef struct { int dist; @@ -207,11 +207,11 @@ static MatchingInfo* get_matching_parameters(AVFilterContext *ctx, SignatureCont } /* l1 distances */ -for (i = 0, f = first; i < COURSE_SIZE && f->next; i++, f = f->next) { +for (i = 0, f = first; i < COARSE_SIZE && f->next; i++, f = f->next) { pairs[i].size = 0; pairs[i].dist = 9; pairs[i].a = f; -for (j = 0, s = second; j < COURSE_SIZE && s->next; j++, s = s->next) { +for (j = 0, s = second; j < COARSE_SIZE && s->next; j++, s = s->next) { /* l1 distance of finesignature */ l1dist = get_l1dist(ctx, sc, f->framesig, s->framesig); if (l1dist < sc->thl1) { @@ -228,18 +228,18 @@ static MatchingInfo*
Re: [FFmpeg-devel] [PATCH] lavfi/af_ebur128: update filter to use new ebur128 API
On Thu, Nov 17, 2016 at 5:04 PM, Kyle Swansonwrote: > Hi, > > Here's a couple of patches which update the ebur128 filter to use the > recently added ebur128 API. This updated filter allows fine-tuned > control over which EBU R128 parameters are measured, and provides > modest speed increases over the previous ebur128 filter. Also > noteworthy: this removes the video output option of the ebur128 > filter. > ... > I also would prefer that the video output not be removed unless similar functionality replaces it without a break. It happens to be a feature I use in a script that enables us to quickly check incoming files in our facility. Nevertheless, we are grateful for all that the FFmpeg developers do to maintain this software. J ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Maintainer responsibilities
On 1/4/17, Nicholas Robbinswrote: > Hello, > > I am the maintainer of the dejudder filter. I haven't done anything to it > since it contributed it almost two years ago. I follow this list, never > seeing anything specifically mentioning it. Is there something else I should > be doing as the maintainer? Writing fate coverage tests. Making sure that filter still works. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Maintainer responsibilities
On 1/4/2017 11:13 AM, Nicholas Robbins wrote: > Hello, > > I am the maintainer of the dejudder filter. I haven't done anything to it > since it contributed it almost two years ago. I follow this list, never > seeing anything specifically mentioning it. Is there something else I should > be doing as the maintainer? > > -Nick It's essentially just about making sure it always compiles and works as intended, update it if some API is removed, changed or replaced, and review/approve changes other developers make to the code. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] imdct15: replace the FFT with a faster PFA FFT algorithm
First off, many thanks. > +const int inv_1 = l_ptwo << ((4 - b_ptwo) & 3); > +const int inv_2 = 0xeeef & ((1U << b_ptwo) - 1); It would be nice to add a comment here that the expression for inv_1 is (2^b_ptwo)^-1 mod 15 and inv_2 is 15^-1 mod 2^b_ptwo. (A general PFA FFT would need to use extended Euclidean algorithm here, but because both cases are fixed, it simplifies to these expressions. I have a sketch of a proof (basically solving the relevant diophantine equation you get) in case anyone is nervous, though it's easy to verify by hand for 1 < b_ptwo < 18, which are all the cases that ffmpeg's power-of-two FFT currently supports). Rest of patch seems good. -Peter ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] imdct15: replace the FFT with a faster PFA FFT algorithm
> +/* 15-point FFT exptab */ > +for (i = 0; i < 19; i++) { > +if (i < 15) { > +double theta = 2 * M_PI * i / 15; > +s->exptab[i].re = cos(theta); > +s->exptab[i].im = sin(theta); > +} else { /* Wrap around to simplify fft[1]5 */ > +s->exptab[i] = s->exptab[i - 15]; Slightly surprised that you don't just leave these pregenerated/hardcoded as it's just 24 float values. Is this for ease of making a fixed-point version later, or some other reason? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] Maintainer responsibilities
Hello, I am the maintainer of the dejudder filter. I haven't done anything to it since it contributed it almost two years ago. I follow this list, never seeing anything specifically mentioning it. Is there something else I should be doing as the maintainer? -Nick ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/6] ffmpeg: dxva2: move the DXVA GUID definitions outside of the template
--- Makefile | 2 +- ffmpeg_dxva2.c | 1 + ffmpeg_dxva_template.c | 7 ++- ffmpeg_guid.c | 20 4 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 ffmpeg_guid.c diff --git a/Makefile b/Makefile index 8aa72fd..25e1d54 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ ifndef CONFIG_VIDEOTOOLBOX OBJS-ffmpeg-$(CONFIG_VDA) += ffmpeg_videotoolbox.o endif OBJS-ffmpeg-$(CONFIG_CUVID) += ffmpeg_cuvid.o -OBJS-ffmpeg-$(HAVE_DXVA2_LIB) += ffmpeg_dxva2.o +OBJS-ffmpeg-$(HAVE_DXVA2_LIB) += ffmpeg_dxva2.o ffmpeg_guid.o OBJS-ffmpeg-$(HAVE_VDPAU_X11) += ffmpeg_vdpau.o OBJS-ffserver += ffserver_config.o diff --git a/ffmpeg_dxva2.c b/ffmpeg_dxva2.c index e07f2b8..dd19fec 100644 --- a/ffmpeg_dxva2.c +++ b/ffmpeg_dxva2.c @@ -63,6 +63,7 @@ typedef struct dxva_context DXVA_AV_CONTEXT; typedef IDirectXVideoDecoderService *DXVA_DECODER_SERVICE; #include "ffmpeg_dxva_template.c" +#include DEFINE_GUID(IID_IDirectXVideoDecoderService, 0xfc51a551,0xd5e7,0x11d9,0xaf,0x55,0x00,0x05,0x4e,0x43,0xff,0x02); static void dxva2_uninit(AVCodecContext *s) diff --git a/ffmpeg_dxva_template.c b/ffmpeg_dxva_template.c index 87d33f2..1a7d26e 100644 --- a/ffmpeg_dxva_template.c +++ b/ffmpeg_dxva_template.c @@ -16,9 +16,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifndef INITGUID +#include +#endif + /* define all the GUIDs used directly here, to avoid problems with inconsistent dxva2api.h versions in mingw-w64 and different MSVC version */ -#include DEFINE_GUID(DXVA2_ModeMPEG2_VLD, 0xee27417f, 0x5e28,0x4e65,0xbe,0xea,0x1d,0x26,0xb5,0x08,0xad,0xc9); DEFINE_GUID(DXVA2_ModeMPEG2and1_VLD, 0x86695f12, 0x340e,0x4f04,0x9f,0xd3,0x92,0x53,0xdd,0x32,0x74,0x60); DEFINE_GUID(DXVA2_ModeH264_E, 0x1b81be68, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5); @@ -32,6 +35,7 @@ DEFINE_GUID(DXVA2_NoEncrypt, 0x1b81beD0, 0xa0c7,0x11d3,0xb9,0x84,0x00,0 DEFINE_GUID(DXVA2_ModeVP9_VLD_Profile0, 0x463707f8, 0xa1d0,0x4585,0x87,0x6d,0x83,0xaa,0x6d,0x60,0xb8,0x9e); DEFINE_GUID(GUID_NULL,0x, 0x,0x,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00); +#ifndef INITGUID typedef struct dxva_mode { const GUID *guid; enum AVCodecID codec; @@ -293,3 +297,4 @@ fail: dxva_uninit(s); return AVERROR(EINVAL); } +#endif /* INITGUID */ diff --git a/ffmpeg_guid.c b/ffmpeg_guid.c new file mode 100644 index 000..4a12227 --- /dev/null +++ b/ffmpeg_guid.c @@ -0,0 +1,20 @@ +/* + * 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 +#include "ffmpeg_dxva_template.c" -- 2.10.1.windows.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 6/6] ffmpeg: dxva: use the typedefs more to make comparison between dxva2 and d3d11va
--- ffmpeg_d3d11va.c | 9 + ffmpeg_dxva2.c | 19 ++- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/ffmpeg_d3d11va.c b/ffmpeg_d3d11va.c index b8ca9d8..3fd12f2 100644 --- a/ffmpeg_d3d11va.c +++ b/ffmpeg_d3d11va.c @@ -58,8 +58,8 @@ typedef ID3D11VideoDevice *DXVA_DECODER_SERVICE; #include "ffmpeg_dxva_template.c" static int d3d11va_get_decoder_configuration(AVCodecContext *s, - const D3D11_VIDEO_DECODER_DESC *desc, - D3D11_VIDEO_DECODER_CONFIG *config) + const D3D11_VIDEO_DECODER_DESC *desc, + DXVA_DECODER_CONFIG *config) { InputStream *ist = s->opaque; int loglevel = (ist->hwaccel_id == HWACCEL_AUTO) ? AV_LOG_VERBOSE : AV_LOG_ERROR; @@ -112,9 +112,10 @@ static int d3d11va_create_decoder(AVCodecContext *s) GUID *guid_list; unsigned guid_count, i; GUID decoder_guid; -const DXGI_FORMAT surface_format = (s->sw_pix_fmt == AV_PIX_FMT_YUV420P10) ? DXGI_FORMAT_P010 : DXGI_FORMAT_NV12; +const DXVA_SURFACE_FORMAT surface_format = s->sw_pix_fmt == AV_PIX_FMT_YUV420P10 ? + DXGI_FORMAT_P010 : DXGI_FORMAT_NV12; D3D11_VIDEO_DECODER_DESC desc = { 0 }; -D3D11_VIDEO_DECODER_CONFIG config; +DXVA_DECODER_CONFIG config; HRESULT hr; int ret; diff --git a/ffmpeg_dxva2.c b/ffmpeg_dxva2.c index 68e0365..1497b76 100644 --- a/ffmpeg_dxva2.c +++ b/ffmpeg_dxva2.c @@ -69,7 +69,7 @@ DEFINE_GUID(IID_IDirectXVideoDecoderService, 0xfc51a551,0xd5e7,0x11d9,0xaf,0x55, static void dxva2_uninit(AVCodecContext *s) { InputStream *ist = s->opaque; -DXVA2Context *ctx = ist->hwaccel_ctx; +DXVA_CONTEXT *ctx = ist->hwaccel_ctx; if (ctx->decoder_service) IDirectXVideoDecoderService_Release(ctx->decoder_service); @@ -81,7 +81,7 @@ static int dxva2_alloc(AVCodecContext *s) { InputStream *ist = s->opaque; int loglevel = (ist->hwaccel_id == HWACCEL_AUTO) ? AV_LOG_VERBOSE : AV_LOG_ERROR; -DXVA2Context *ctx; +DXVA_CONTEXT *ctx; HANDLE device_handle; HRESULT hr; @@ -120,13 +120,13 @@ fail: static int dxva2_get_decoder_configuration(AVCodecContext *s, const GUID *device_guid, const DXVA2_VideoDesc *desc, - DXVA2_ConfigPictureDecode *config) + DXVA_DECODER_CONFIG *config) { InputStream *ist = s->opaque; int loglevel = (ist->hwaccel_id == HWACCEL_AUTO) ? AV_LOG_VERBOSE : AV_LOG_ERROR; -DXVA2Context *ctx = ist->hwaccel_ctx; +DXVA_CONTEXT *ctx = ist->hwaccel_ctx; unsigned cfg_count; -DXVA2_ConfigPictureDecode *cfg_list; +DXVA_DECODER_CONFIG *cfg_list; HRESULT hr; int ret; @@ -165,14 +165,15 @@ static int dxva2_create_decoder(AVCodecContext *s) { InputStream *ist = s->opaque; int loglevel = (ist->hwaccel_id == HWACCEL_AUTO) ? AV_LOG_VERBOSE : AV_LOG_ERROR; -DXVA2Context *ctx = ist->hwaccel_ctx; -struct dxva_context *dxva_ctx = s->hwaccel_context; +DXVA_CONTEXT *ctx = ist->hwaccel_ctx; +DXVA_AV_CONTEXT *dxva_ctx = s->hwaccel_context; GUID *guid_list; unsigned guid_count; GUID device_guid; -const D3DFORMAT surface_format = (s->sw_pix_fmt == AV_PIX_FMT_YUV420P10) ? MKTAG('P','0','1','0') : MKTAG('N','V','1','2'); +const DXVA_SURFACE_FORMAT surface_format = s->sw_pix_fmt == AV_PIX_FMT_YUV420P10 ? + MKTAG('P', '0', '1', '0') : MKTAG('N', 'V', '1', '2'); DXVA2_VideoDesc desc = { 0 }; -DXVA2_ConfigPictureDecode config; +DXVA_DECODER_CONFIG config; HRESULT hr; int ret; -- 2.10.1.windows.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/6] libavutil: add support for AV_HWDEVICE_TYPE_D3D11VA
--- doc/APIchanges | 3 + libavutil/Makefile | 3 + libavutil/hwcontext.c | 3 + libavutil/hwcontext.h | 1 + libavutil/hwcontext_d3d11va.c | 461 + libavutil/hwcontext_d3d11va.h | 70 +++ libavutil/hwcontext_internal.h | 1 + libavutil/version.h| 2 +- 8 files changed, 543 insertions(+), 1 deletion(-) create mode 100644 libavutil/hwcontext_d3d11va.c create mode 100644 libavutil/hwcontext_d3d11va.h diff --git a/doc/APIchanges b/doc/APIchanges index fbeae7a..76d1c8e 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,9 @@ libavutil: 2015-08-28 API changes, most recent first: ++2017-xx-xx - xxx - lavu 55.43.101 - hwcontext.h ++ Add AV_HWDEVICE_TYPE_D3D11VA to decode using Direct3D11. ++ 2016-12-10 - xxx - lavu xx.xx.100- imgutils.h Add av_image_check_size2() diff --git a/libavutil/Makefile b/libavutil/Makefile index 15d95de..376a11b 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -34,6 +34,7 @@ HEADERS = adler32.h \ hmac.h\ hwcontext.h \ hwcontext_cuda.h \ + hwcontext_d3d11va.h \ hwcontext_dxva2.h \ hwcontext_qsv.h \ hwcontext_vaapi.h \ @@ -156,6 +157,7 @@ OBJS = adler32.o \ OBJS-$(!HAVE_ATOMICS_NATIVE)+= atomic.o \ OBJS-$(CONFIG_CUDA) += hwcontext_cuda.o +OBJS-$(CONFIG_D3D11VA) += hwcontext_d3d11va.o OBJS-$(CONFIG_DXVA2)+= hwcontext_dxva2.o OBJS-$(CONFIG_QSV) += hwcontext_qsv.o OBJS-$(CONFIG_LZO) += lzo.o @@ -170,6 +172,7 @@ SLIBOBJS-$(HAVE_GNU_WINDRES)+= avutilres.o SKIPHEADERS-$(HAVE_CUDA_H) += hwcontext_cuda.h SKIPHEADERS-$(CONFIG_CUDA) += hwcontext_cuda_internal.h +SKIPHEADERS-$(CONFIG_D3D11VA) += hwcontext_d3d11va.h SKIPHEADERS-$(CONFIG_DXVA2)+= hwcontext_dxva2.h SKIPHEADERS-$(CONFIG_QSV) += hwcontext_qsv.h SKIPHEADERS-$(CONFIG_VAAPI)+= hwcontext_vaapi.h diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c index 615f1f7..a9db84b 100644 --- a/libavutil/hwcontext.c +++ b/libavutil/hwcontext.c @@ -32,6 +32,9 @@ static const HWContextType *hw_table[] = { #if CONFIG_CUDA _hwcontext_type_cuda, #endif +#if CONFIG_D3D11VA +_hwcontext_type_d3d11va, +#endif #if CONFIG_DXVA2 _hwcontext_type_dxva2, #endif diff --git a/libavutil/hwcontext.h b/libavutil/hwcontext.h index 785da09..1325917 100644 --- a/libavutil/hwcontext.h +++ b/libavutil/hwcontext.h @@ -30,6 +30,7 @@ enum AVHWDeviceType { AV_HWDEVICE_TYPE_VAAPI, AV_HWDEVICE_TYPE_DXVA2, AV_HWDEVICE_TYPE_QSV, +AV_HWDEVICE_TYPE_D3D11VA, }; typedef struct AVHWDeviceInternal AVHWDeviceInternal; diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c new file mode 100644 index 000..3d9a34a --- /dev/null +++ b/libavutil/hwcontext_d3d11va.c @@ -0,0 +1,461 @@ +/* + * 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 + +#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600 +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x0600 +#endif +#define COBJMACROS + +#include +#include +#include + +#include "avassert.h" +#include "common.h" +#include "hwcontext.h" +#include "hwcontext_d3d11va.h" +#include "hwcontext_internal.h" +#include "imgutils.h" +#include "pixdesc.h" +#include "pixfmt.h" +#include "compat/w32dlfcn.h" + +typedef HRESULT(WINAPI *PFN_CREATE_DXGI_FACTORY)(REFIID riid, void **ppFactory); + +typedef struct D3D11VAFramesContext { +ID3D11VideoDecoderOutputView **surfaces_internal; +int nb_surfaces_used; + +ID3D11DeviceContext *d3d11_context; + +DXGI_FORMAT format; + +
[FFmpeg-devel] [PATCH 5/6] ffmpeg: add ffmpeg_d3d11va
The code is similar to ffmpeg_dxva2. The decoded output needs to be copied into a staging texture that can be accessed by the CPU as the decoder texture can't be accessed by the CPU. --- Changelog| 1 + Makefile | 1 + configure| 14 ffmpeg.h | 2 + ffmpeg_d3d11va.c | 212 +++ ffmpeg_opt.c | 3 + 6 files changed, 233 insertions(+) create mode 100644 ffmpeg_d3d11va.c diff --git a/Changelog b/Changelog index aff9ab0..bd752ea 100644 --- a/Changelog +++ b/Changelog @@ -12,6 +12,7 @@ version : - 16.8 floating point pcm decoder - 24.0 floating point pcm decoder - Apple Pixlet decoder +- support for decoding through D3D11VA in ffmpeg version 3.2: - libopenmpt demuxer diff --git a/Makefile b/Makefile index 25e1d54..400bc98 100644 --- a/Makefile +++ b/Makefile @@ -37,6 +37,7 @@ ifndef CONFIG_VIDEOTOOLBOX OBJS-ffmpeg-$(CONFIG_VDA) += ffmpeg_videotoolbox.o endif OBJS-ffmpeg-$(CONFIG_CUVID) += ffmpeg_cuvid.o +OBJS-ffmpeg-$(HAVE_D3D11VA_LIB) += ffmpeg_d3d11va.o ffmpeg_guid.o OBJS-ffmpeg-$(HAVE_DXVA2_LIB) += ffmpeg_dxva2.o ffmpeg_guid.o OBJS-ffmpeg-$(HAVE_VDPAU_X11) += ffmpeg_vdpau.o OBJS-ffserver += ffserver_config.o diff --git a/configure b/configure index def530a..9fd1d9e 100755 --- a/configure +++ b/configure @@ -2052,6 +2052,8 @@ HAVE_LIST=" $TYPES_LIST atomics_native dos_paths +d3d11va_lib +d3d11vaapi_cobj dxva2_lib dxva2api_cobj libc_msvcrt @@ -6039,6 +6041,15 @@ enabled dxva2api_h && int main(void) { IDirectXVideoDecoder *o = NULL; IDirectXVideoDecoder_Release(o); return 0; } EOF +enabled d3d11_h && +check_cc < +#include +int main(void) { ID3D11VideoDevice *o = NULL; ID3D11VideoDevice_Release(o); return 0; } +EOF + enabled vaapi && check_lib va/va.h vaInitialize -lva || disable vaapi @@ -6370,6 +6381,9 @@ if test $target_os = "haiku"; then disable posix_memalign fi +enabled_all d3d11va d3d11vaapi_cobj && +enable d3d11va_lib + enabled_all dxva2 dxva2api_cobj CoTaskMemFree && prepend ffmpeg_libs $($ldflags_filter "-lole32") && enable dxva2_lib diff --git a/ffmpeg.h b/ffmpeg.h index ebe5bf0..5faf545 100644 --- a/ffmpeg.h +++ b/ffmpeg.h @@ -67,6 +67,7 @@ enum HWAccelID { HWACCEL_QSV, HWACCEL_VAAPI, HWACCEL_CUVID, +HWACCEL_D3D11VA, }; typedef struct HWAccel { @@ -633,6 +634,7 @@ int ifilter_parameters_from_decoder(InputFilter *ifilter, const AVCodecContext * int ffmpeg_parse_options(int argc, char **argv); int vdpau_init(AVCodecContext *s); +int d3d11va_init(AVCodecContext *s); int dxva2_init(AVCodecContext *s); int vda_init(AVCodecContext *s); int videotoolbox_init(AVCodecContext *s); diff --git a/ffmpeg_d3d11va.c b/ffmpeg_d3d11va.c new file mode 100644 index 000..b8ca9d8 --- /dev/null +++ b/ffmpeg_d3d11va.c @@ -0,0 +1,212 @@ +/* + * 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 + +#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600 +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x0600 +#endif +#define COBJMACROS + +#include + +#include + +#include "ffmpeg.h" + +#include "libavcodec/d3d11va.h" + +#include "libavutil/avassert.h" +#include "libavutil/buffer.h" +#include "libavutil/frame.h" +#include "libavutil/imgutils.h" +#include "libavutil/pixfmt.h" + +#include "libavutil/hwcontext.h" +#include "libavutil/hwcontext_d3d11va.h" + +typedef struct D3D11VAContext { +D3D11_VIDEO_DECODER_CONFIG decoder_config; + +AVFrame *tmp_frame; + +AVBufferRef *hw_device_ctx; +AVBufferRef *hw_frames_ctx; +} D3D11VAContext; + +typedef D3D11_VIDEO_DECODER_CONFIG DXVA_DECODER_CONFIG; +typedef DXGI_FORMATDXVA_SURFACE_FORMAT; +typedef D3D11VAContext DXVA_CONTEXT; +typedef AVD3D11VAContext DXVA_AV_CONTEXT; +typedef ID3D11VideoDevice *DXVA_DECODER_SERVICE; +#include "ffmpeg_dxva_template.c" + +static int d3d11va_get_decoder_configuration(AVCodecContext *s, + const D3D11_VIDEO_DECODER_DESC *desc, + D3D11_VIDEO_DECODER_CONFIG *config) +{ +InputStream *ist =
[FFmpeg-devel] [PATCH 2/6] ffmpeg: dxva2: factorize some code that can be common with d3d11va
ffmpeg_dxva_template.c has to be included and misc. typedefs have to be set to use the proper DXVA2 structures. initguid.h is included in ffmpeg_dxva.h so any includes after that will also define GUIDs locally. --- ffmpeg_dxva2.c | 282 -- ffmpeg_dxva_template.c | 295 + 2 files changed, 341 insertions(+), 236 deletions(-) create mode 100644 ffmpeg_dxva_template.c diff --git a/ffmpeg_dxva2.c b/ffmpeg_dxva2.c index 1a391f8..e07f2b8 100644 --- a/ffmpeg_dxva2.c +++ b/ffmpeg_dxva2.c @@ -43,56 +43,6 @@ #include "libavutil/hwcontext.h" #include "libavutil/hwcontext_dxva2.h" -/* define all the GUIDs used directly here, - to avoid problems with inconsistent dxva2api.h versions in mingw-w64 and different MSVC version */ -#include -DEFINE_GUID(IID_IDirectXVideoDecoderService, 0xfc51a551,0xd5e7,0x11d9,0xaf,0x55,0x00,0x05,0x4e,0x43,0xff,0x02); - -DEFINE_GUID(DXVA2_ModeMPEG2_VLD, 0xee27417f, 0x5e28,0x4e65,0xbe,0xea,0x1d,0x26,0xb5,0x08,0xad,0xc9); -DEFINE_GUID(DXVA2_ModeMPEG2and1_VLD, 0x86695f12, 0x340e,0x4f04,0x9f,0xd3,0x92,0x53,0xdd,0x32,0x74,0x60); -DEFINE_GUID(DXVA2_ModeH264_E, 0x1b81be68, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5); -DEFINE_GUID(DXVA2_ModeH264_F, 0x1b81be69, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5); -DEFINE_GUID(DXVADDI_Intel_ModeH264_E, 0x604F8E68, 0x4951,0x4C54,0x88,0xFE,0xAB,0xD2,0x5C,0x15,0xB3,0xD6); -DEFINE_GUID(DXVA2_ModeVC1_D, 0x1b81beA3, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5); -DEFINE_GUID(DXVA2_ModeVC1_D2010, 0x1b81beA4, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5); -DEFINE_GUID(DXVA2_ModeHEVC_VLD_Main, 0x5b11d51b, 0x2f4c,0x4452,0xbc,0xc3,0x09,0xf2,0xa1,0x16,0x0c,0xc0); -DEFINE_GUID(DXVA2_ModeHEVC_VLD_Main10,0x107af0e0, 0xef1a,0x4d19,0xab,0xa8,0x67,0xa1,0x63,0x07,0x3d,0x13); -DEFINE_GUID(DXVA2_ModeVP9_VLD_Profile0, 0x463707f8, 0xa1d0,0x4585,0x87,0x6d,0x83,0xaa,0x6d,0x60,0xb8,0x9e); -DEFINE_GUID(DXVA2_NoEncrypt, 0x1b81beD0, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5); -DEFINE_GUID(GUID_NULL,0x, 0x,0x,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00); - -typedef struct dxva2_mode { - const GUID *guid; - enum AVCodecID codec; -} dxva2_mode; - -static const dxva2_mode dxva2_modes[] = { -/* MPEG-2 */ -{ _ModeMPEG2_VLD, AV_CODEC_ID_MPEG2VIDEO }, -{ _ModeMPEG2and1_VLD, AV_CODEC_ID_MPEG2VIDEO }, - -/* H.264 */ -{ _ModeH264_F, AV_CODEC_ID_H264 }, -{ _ModeH264_E, AV_CODEC_ID_H264 }, -/* Intel specific H.264 mode */ -{ _Intel_ModeH264_E, AV_CODEC_ID_H264 }, - -/* VC-1 / WMV3 */ -{ _ModeVC1_D2010, AV_CODEC_ID_VC1 }, -{ _ModeVC1_D2010, AV_CODEC_ID_WMV3 }, -{ _ModeVC1_D, AV_CODEC_ID_VC1 }, -{ _ModeVC1_D, AV_CODEC_ID_WMV3 }, - -/* HEVC/H.265 */ -{ _ModeHEVC_VLD_Main, AV_CODEC_ID_HEVC }, -{ _ModeHEVC_VLD_Main10,AV_CODEC_ID_HEVC }, - -/* VP8/9 */ -{ _ModeVP9_VLD_Profile0, AV_CODEC_ID_VP9 }, - -{ NULL, 0 }, -}; - typedef struct DXVA2Context { IDirectXVideoDecoder*decoder; @@ -106,55 +56,24 @@ typedef struct DXVA2Context { AVBufferRef *hw_frames_ctx; } DXVA2Context; +typedef DXVA2_ConfigPictureDecode DXVA_DECODER_CONFIG; +typedef D3DFORMAT DXVA_SURFACE_FORMAT; +typedef DXVA2ContextDXVA_CONTEXT; +typedef struct dxva_context DXVA_AV_CONTEXT; +typedef IDirectXVideoDecoderService *DXVA_DECODER_SERVICE; +#include "ffmpeg_dxva_template.c" + +DEFINE_GUID(IID_IDirectXVideoDecoderService, 0xfc51a551,0xd5e7,0x11d9,0xaf,0x55,0x00,0x05,0x4e,0x43,0xff,0x02); + static void dxva2_uninit(AVCodecContext *s) { InputStream *ist = s->opaque; DXVA2Context *ctx = ist->hwaccel_ctx; -ist->hwaccel_uninit= NULL; -ist->hwaccel_get_buffer= NULL; -ist->hwaccel_retrieve_data = NULL; - if (ctx->decoder_service) IDirectXVideoDecoderService_Release(ctx->decoder_service); -av_buffer_unref(>hw_frames_ctx); -av_buffer_unref(>hw_device_ctx); - -av_frame_free(>tmp_frame); - -av_freep(>hwaccel_ctx); -av_freep(>hwaccel_context); -} - -static int dxva2_get_buffer(AVCodecContext *s, AVFrame *frame, int flags) -{ -InputStream *ist = s->opaque; -DXVA2Context *ctx = ist->hwaccel_ctx; - -return av_hwframe_get_buffer(ctx->hw_frames_ctx, frame, 0); -} - -static int dxva2_retrieve_data(AVCodecContext *s, AVFrame *frame) -{ -InputStream*ist = s->opaque; -DXVA2Context *ctx = ist->hwaccel_ctx; -intret; - -ret = av_hwframe_transfer_data(ctx->tmp_frame, frame, 0); -if (ret < 0) -return ret; - -ret = av_frame_copy_props(ctx->tmp_frame, frame); -if (ret < 0) { -av_frame_unref(ctx->tmp_frame); -return ret; -
[FFmpeg-devel] [PATCH 0/6] D3D11VA in ffmpeg
Update on this patchset with a lot of fixes that was discussed during the last weeks. The patches have been split more. The public structures in libavutil are more documented and require less things set by the caller. The GUIDs declared in the template are defined in a separate ffmpeg_guid.c file so that they are not twice in the same binary. Steve Lhomme (6): libavutil: add support for AV_HWDEVICE_TYPE_D3D11VA ffmpeg: dxva2: factorize some code that can be common with d3d11va ffmpeg: dxva2: move the DXVA GUID definitions outside of the template ffmpeg_dxva2: remove unused initial values ffmpeg: add ffmpeg_d3d11va ffmpeg: dxva: use the typedefs more to make comparison between dxva2 and d3d11va Changelog | 1 + Makefile | 3 +- configure | 14 ++ doc/APIchanges | 3 + ffmpeg.h | 2 + ffmpeg_d3d11va.c | 213 +++ ffmpeg_dxva2.c | 306 ++- ffmpeg_dxva_template.c | 300 +++ ffmpeg_guid.c | 20 ++ ffmpeg_opt.c | 3 + libavutil/Makefile | 3 + libavutil/hwcontext.c | 3 + libavutil/hwcontext.h | 1 + libavutil/hwcontext_d3d11va.c | 461 + libavutil/hwcontext_d3d11va.h | 70 +++ libavutil/hwcontext_internal.h | 1 + libavutil/version.h| 2 +- 17 files changed, 1157 insertions(+), 249 deletions(-) create mode 100644 ffmpeg_d3d11va.c create mode 100644 ffmpeg_dxva_template.c create mode 100644 ffmpeg_guid.c create mode 100644 libavutil/hwcontext_d3d11va.c create mode 100644 libavutil/hwcontext_d3d11va.h -- 2.10.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 4/6] ffmpeg_dxva2: remove unused initial values
--- ffmpeg_dxva2.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ffmpeg_dxva2.c b/ffmpeg_dxva2.c index dd19fec..68e0365 100644 --- a/ffmpeg_dxva2.c +++ b/ffmpeg_dxva2.c @@ -125,8 +125,8 @@ static int dxva2_get_decoder_configuration(AVCodecContext *s, const GUID *device InputStream *ist = s->opaque; int loglevel = (ist->hwaccel_id == HWACCEL_AUTO) ? AV_LOG_VERBOSE : AV_LOG_ERROR; DXVA2Context *ctx = ist->hwaccel_ctx; -unsigned cfg_count = 0; -DXVA2_ConfigPictureDecode *cfg_list = NULL; +unsigned cfg_count; +DXVA2_ConfigPictureDecode *cfg_list; HRESULT hr; int ret; @@ -145,7 +145,7 @@ static int dxva2_validate_output(DXVA_DECODER_SERVICE decoder_service, GUID guid { HRESULT hr; int ret = 0; -unsigned j, target_count = 0; +unsigned j, target_count; D3DFORMAT *target_list; hr = IDirectXVideoDecoderService_GetDecoderRenderTargets(decoder_service, , _count, _list); if (SUCCEEDED(hr)) { @@ -167,9 +167,9 @@ static int dxva2_create_decoder(AVCodecContext *s) int loglevel = (ist->hwaccel_id == HWACCEL_AUTO) ? AV_LOG_VERBOSE : AV_LOG_ERROR; DXVA2Context *ctx = ist->hwaccel_ctx; struct dxva_context *dxva_ctx = s->hwaccel_context; -GUID *guid_list = NULL; -unsigned guid_count = 0; -GUID device_guid = GUID_NULL; +GUID *guid_list; +unsigned guid_count; +GUID device_guid; const D3DFORMAT surface_format = (s->sw_pix_fmt == AV_PIX_FMT_YUV420P10) ? MKTAG('P','0','1','0') : MKTAG('N','V','1','2'); DXVA2_VideoDesc desc = { 0 }; DXVA2_ConfigPictureDecode config; -- 2.10.1.windows.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/4] dxva2: make ff_dxva2_get_surface() static and rename it
--- libavcodec/dxva2.c | 8 libavcodec/dxva2_internal.h | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c index 04a9c11..2ac3f3e 100644 --- a/libavcodec/dxva2.c +++ b/libavcodec/dxva2.c @@ -29,7 +29,7 @@ #include "avcodec.h" #include "dxva2_internal.h" -void *ff_dxva2_get_surface(const AVFrame *frame) +static void *get_surface(const AVFrame *frame) { return frame->data[3]; } @@ -38,7 +38,7 @@ unsigned ff_dxva2_get_surface_index(const AVCodecContext *avctx, const AVDXVAContext *ctx, const AVFrame *frame) { -void *surface = ff_dxva2_get_surface(frame); +void *surface = get_surface(frame); unsigned i; for (i = 0; i < DXVA_CONTEXT_COUNT(avctx, ctx); i++) { @@ -159,14 +159,14 @@ int ff_dxva2_common_end_frame(AVCodecContext *avctx, AVFrame *frame, if (D3D11VA_CONTEXT(ctx)->context_mutex != INVALID_HANDLE_VALUE) WaitForSingleObjectEx(D3D11VA_CONTEXT(ctx)->context_mutex, INFINITE, FALSE); hr = ID3D11VideoContext_DecoderBeginFrame(D3D11VA_CONTEXT(ctx)->video_context, D3D11VA_CONTEXT(ctx)->decoder, - ff_dxva2_get_surface(frame), + get_surface(frame), 0, NULL); } #endif #if CONFIG_DXVA2 if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD) hr = IDirectXVideoDecoder_BeginFrame(DXVA2_CONTEXT(ctx)->decoder, - ff_dxva2_get_surface(frame), + get_surface(frame), NULL); #endif if (hr != E_PENDING || ++runs > 50) diff --git a/libavcodec/dxva2_internal.h b/libavcodec/dxva2_internal.h index 24adb99..c962810 100644 --- a/libavcodec/dxva2_internal.h +++ b/libavcodec/dxva2_internal.h @@ -96,8 +96,6 @@ typedef union { #define DXVA_CONTEXT_CFG_RESIDACCEL(avctx, ctx) (ctx->d3d11va.cfg->ConfigResidDiffAccelerator) #endif -void *ff_dxva2_get_surface(const AVFrame *frame); - unsigned ff_dxva2_get_surface_index(const AVCodecContext *avctx, const AVDXVAContext *, const AVFrame *frame); -- 2.10.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 0/4] DXVA2 cleaning and D3D11VA simplification
This patchset was already sent but various cleaning has been done and it has been rebased to the latest master. The main goal is to have patch 3/4 that allows more flexibility on the decoder pool in D3D11VA, which we need in VLC for better efficiency. Patch 4/4 is the one that enables this flexibility. Steve Lhomme (4): dxva2: make ff_dxva2_get_surface() static and rename it dxva2: use a single macro to test if the DXVA context is valid dxva2: get the slice number directly from the surface in D3D11VA dxva2: allow an empty array of ID3D11VideoDecoderOutputView libavcodec/dxva2.c | 23 +++ libavcodec/dxva2_h264.c | 4 +--- libavcodec/dxva2_hevc.c | 4 +--- libavcodec/dxva2_internal.h | 7 +-- libavcodec/dxva2_mpeg2.c| 4 +--- libavcodec/dxva2_vc1.c | 4 +--- libavcodec/dxva2_vp9.c | 4 +--- libavcodec/version.h| 2 +- 8 files changed, 22 insertions(+), 30 deletions(-) -- 2.10.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/4] dxva2: use a single macro to test if the DXVA context is valid
--- libavcodec/dxva2_h264.c | 4 +--- libavcodec/dxva2_hevc.c | 4 +--- libavcodec/dxva2_internal.h | 5 + libavcodec/dxva2_mpeg2.c| 4 +--- libavcodec/dxva2_vc1.c | 4 +--- libavcodec/dxva2_vp9.c | 4 +--- 6 files changed, 10 insertions(+), 15 deletions(-) diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c index 82a772d..59fa5e3 100644 --- a/libavcodec/dxva2_h264.c +++ b/libavcodec/dxva2_h264.c @@ -450,9 +450,7 @@ static int dxva2_h264_start_frame(AVCodecContext *avctx, AVDXVAContext *ctx = avctx->hwaccel_context; struct dxva2_picture_context *ctx_pic = h->cur_pic_ptr->hwaccel_picture_private; -if (DXVA_CONTEXT_DECODER(avctx, ctx) == NULL || -DXVA_CONTEXT_CFG(avctx, ctx) == NULL || -DXVA_CONTEXT_COUNT(avctx, ctx) <= 0) +if (!DXVA_CONTEXT_VALID(avctx, ctx)) return -1; assert(ctx_pic); diff --git a/libavcodec/dxva2_hevc.c b/libavcodec/dxva2_hevc.c index 5a312ea..981c888 100644 --- a/libavcodec/dxva2_hevc.c +++ b/libavcodec/dxva2_hevc.c @@ -364,9 +364,7 @@ static int dxva2_hevc_start_frame(AVCodecContext *avctx, AVDXVAContext *ctx = avctx->hwaccel_context; struct hevc_dxva2_picture_context *ctx_pic = h->ref->hwaccel_picture_private; -if (DXVA_CONTEXT_DECODER(avctx, ctx) == NULL || -DXVA_CONTEXT_CFG(avctx, ctx) == NULL || -DXVA_CONTEXT_COUNT(avctx, ctx) <= 0) +if (!DXVA_CONTEXT_VALID(avctx, ctx)) return -1; av_assert0(ctx_pic); diff --git a/libavcodec/dxva2_internal.h b/libavcodec/dxva2_internal.h index c962810..e5322ef 100644 --- a/libavcodec/dxva2_internal.h +++ b/libavcodec/dxva2_internal.h @@ -76,6 +76,9 @@ typedef union { #define DXVA_CONTEXT_CFG_BITSTREAM(avctx, ctx) (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD ? ctx->d3d11va.cfg->ConfigBitstreamRaw : ctx->dxva2.cfg->ConfigBitstreamRaw) #define DXVA_CONTEXT_CFG_INTRARESID(avctx, ctx) (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD ? ctx->d3d11va.cfg->ConfigIntraResidUnsigned : ctx->dxva2.cfg->ConfigIntraResidUnsigned) #define DXVA_CONTEXT_CFG_RESIDACCEL(avctx, ctx) (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD ? ctx->d3d11va.cfg->ConfigResidDiffAccelerator : ctx->dxva2.cfg->ConfigResidDiffAccelerator) +#define DXVA_CONTEXT_VALID(avctx, ctx) (DXVA_CONTEXT_DECODER(avctx, ctx) && \ + DXVA_CONTEXT_CFG(avctx, ctx) && \ + DXVA_CONTEXT_COUNT(avctx, ctx)) #elif CONFIG_DXVA2 #define DXVA_CONTEXT_WORKAROUND(avctx, ctx) (ctx->dxva2.workaround) #define DXVA_CONTEXT_COUNT(avctx, ctx) (ctx->dxva2.surface_count) @@ -85,6 +88,7 @@ typedef union { #define DXVA_CONTEXT_CFG_BITSTREAM(avctx, ctx) (ctx->dxva2.cfg->ConfigBitstreamRaw) #define DXVA_CONTEXT_CFG_INTRARESID(avctx, ctx) (ctx->dxva2.cfg->ConfigIntraResidUnsigned) #define DXVA_CONTEXT_CFG_RESIDACCEL(avctx, ctx) (ctx->dxva2.cfg->ConfigResidDiffAccelerator) +#define DXVA_CONTEXT_VALID(avctx, ctx) (ctx->dxva2.decoder && ctx->dxva2.cfg && ctx->dxva2.surface_count) #elif CONFIG_D3D11VA #define DXVA_CONTEXT_WORKAROUND(avctx, ctx) (ctx->d3d11va.workaround) #define DXVA_CONTEXT_COUNT(avctx, ctx) (ctx->d3d11va.surface_count) @@ -94,6 +98,7 @@ typedef union { #define DXVA_CONTEXT_CFG_BITSTREAM(avctx, ctx) (ctx->d3d11va.cfg->ConfigBitstreamRaw) #define DXVA_CONTEXT_CFG_INTRARESID(avctx, ctx) (ctx->d3d11va.cfg->ConfigIntraResidUnsigned) #define DXVA_CONTEXT_CFG_RESIDACCEL(avctx, ctx) (ctx->d3d11va.cfg->ConfigResidDiffAccelerator) +#define DXVA_CONTEXT_VALID(avctx, ctx) (ctx->d3d11va.decoder && ctx->d3d11va.cfg && ctx->d3d11va.surface_count) #endif unsigned ff_dxva2_get_surface_index(const AVCodecContext *avctx, diff --git a/libavcodec/dxva2_mpeg2.c b/libavcodec/dxva2_mpeg2.c index c2f0b58..14ac48f 100644 --- a/libavcodec/dxva2_mpeg2.c +++ b/libavcodec/dxva2_mpeg2.c @@ -262,9 +262,7 @@ static int dxva2_mpeg2_start_frame(AVCodecContext *avctx, struct dxva2_picture_context *ctx_pic = s->current_picture_ptr->hwaccel_picture_private; -if (DXVA_CONTEXT_DECODER(avctx, ctx) == NULL || -DXVA_CONTEXT_CFG(avctx, ctx) == NULL || -DXVA_CONTEXT_COUNT(avctx, ctx) <= 0) +if (!DXVA_CONTEXT_VALID(avctx, ctx)) return -1; assert(ctx_pic); diff --git a/libavcodec/dxva2_vc1.c b/libavcodec/dxva2_vc1.c index 36bf1ba..cc97d7b 100644 --- a/libavcodec/dxva2_vc1.c +++ b/libavcodec/dxva2_vc1.c @@ -317,9 +317,7 @@ static int dxva2_vc1_start_frame(AVCodecContext *avctx, AVDXVAContext *ctx = avctx->hwaccel_context; struct dxva2_picture_context *ctx_pic = v->s.current_picture_ptr->hwaccel_picture_private; -if (DXVA_CONTEXT_DECODER(avctx, ctx) == NULL || -DXVA_CONTEXT_CFG(avctx, ctx) == NULL || -DXVA_CONTEXT_COUNT(avctx, ctx) <= 0) +if (!DXVA_CONTEXT_VALID(avctx, ctx)) return -1; assert(ctx_pic); diff --git a/libavcodec/dxva2_vp9.c
[FFmpeg-devel] [PATCH 4/4] dxva2: allow an empty array of ID3D11VideoDecoderOutputView
We can pick the correct slice index directly from the ID3D11VideoDecoderOutputView casted from data[3]. --- libavcodec/dxva2_internal.h | 4 ++-- libavcodec/version.h| 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/dxva2_internal.h b/libavcodec/dxva2_internal.h index e5322ef..dfff4d6 100644 --- a/libavcodec/dxva2_internal.h +++ b/libavcodec/dxva2_internal.h @@ -78,7 +78,7 @@ typedef union { #define DXVA_CONTEXT_CFG_RESIDACCEL(avctx, ctx) (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD ? ctx->d3d11va.cfg->ConfigResidDiffAccelerator : ctx->dxva2.cfg->ConfigResidDiffAccelerator) #define DXVA_CONTEXT_VALID(avctx, ctx) (DXVA_CONTEXT_DECODER(avctx, ctx) && \ DXVA_CONTEXT_CFG(avctx, ctx) && \ - DXVA_CONTEXT_COUNT(avctx, ctx)) + (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD || ctx->dxva2.surface_count)) #elif CONFIG_DXVA2 #define DXVA_CONTEXT_WORKAROUND(avctx, ctx) (ctx->dxva2.workaround) #define DXVA_CONTEXT_COUNT(avctx, ctx) (ctx->dxva2.surface_count) @@ -98,7 +98,7 @@ typedef union { #define DXVA_CONTEXT_CFG_BITSTREAM(avctx, ctx) (ctx->d3d11va.cfg->ConfigBitstreamRaw) #define DXVA_CONTEXT_CFG_INTRARESID(avctx, ctx) (ctx->d3d11va.cfg->ConfigIntraResidUnsigned) #define DXVA_CONTEXT_CFG_RESIDACCEL(avctx, ctx) (ctx->d3d11va.cfg->ConfigResidDiffAccelerator) -#define DXVA_CONTEXT_VALID(avctx, ctx) (ctx->d3d11va.decoder && ctx->d3d11va.cfg && ctx->d3d11va.surface_count) +#define DXVA_CONTEXT_VALID(avctx, ctx) (ctx->d3d11va.decoder && ctx->d3d11va.cfg) #endif unsigned ff_dxva2_get_surface_index(const AVCodecContext *avctx, diff --git a/libavcodec/version.h b/libavcodec/version.h index 8f37ebd..2e9594b 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #define LIBAVCODEC_VERSION_MAJOR 57 #define LIBAVCODEC_VERSION_MINOR 70 -#define LIBAVCODEC_VERSION_MICRO 101 +#define LIBAVCODEC_VERSION_MICRO 102 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ -- 2.10.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/4] dxva2: get the slice number directly from the surface in D3D11VA
No need to loop through the known surfaces, we'll use the requested surface anyway. The loop is only done for DXVA2. --- libavcodec/dxva2.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c index 2ac3f3e..c782f1c 100644 --- a/libavcodec/dxva2.c +++ b/libavcodec/dxva2.c @@ -41,20 +41,19 @@ unsigned ff_dxva2_get_surface_index(const AVCodecContext *avctx, void *surface = get_surface(frame); unsigned i; -for (i = 0; i < DXVA_CONTEXT_COUNT(avctx, ctx); i++) { #if CONFIG_D3D11VA -if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD && ctx->d3d11va.surface[i] == surface) -{ -D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC viewDesc; -ID3D11VideoDecoderOutputView_GetDesc(ctx->d3d11va.surface[i], ); -return viewDesc.Texture2D.ArraySlice; -} +if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD) { +D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC viewDesc; +ID3D11VideoDecoderOutputView_GetDesc((ID3D11VideoDecoderOutputView*) surface, ); +return viewDesc.Texture2D.ArraySlice; +} #endif #if CONFIG_DXVA2 +for (i = 0; i < DXVA_CONTEXT_COUNT(avctx, ctx); i++) { if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD && ctx->dxva2.surface[i] == surface) return i; -#endif } +#endif assert(0); return 0; -- 2.10.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] imdct15: replace the FFT with a faster PFA FFT algorithm
On 2017-01-04 13:17, Rostislav Pehlivanov wrote: > Forgot to check the return value here, changed locally to: > > if (ff_fft_init(>ptwo_fft, N - 1, 1) < 0); > goto fail; I hope you have not changed it to that, with that semicolon at the end of the line. signature.asc Description: OpenPGP digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/matroskaenc: Regression fix for invalid MKV headers
On Tue, Jan 03, 2017 at 11:49:07PM +, Soft Works wrote: > The following three commits created a regression by writing initially > invalid mkv headers: > > 650e17d88b63b5aca6e0a43483e89e64b0f7d2dd avformat/matroskaenc: write a > CRC32 element on Tags > 3bcadf822711720ff0f8d14db71ae47cdf97e652 avformat/matroskaenc: write a > CRC32 element on Info > ee888cfbe777cd2916a3548c750e433ab8f8e6a5 avformat/matroskaenc: postpone > writing the Tracks master > > Symptoms: > > - You can no longer playback a file that is still processed by ffmpeg, > e.g. VLC fails playback > - You can no longer stream a file to a client while if is still being > processed > - Various diagnosing tools show header errors or incomplete headers > (e.g. ffprobe, mediainfo, mkvalidator) > > Note: The symptoms do not apply to completed files or ffmpeg runs that > were interrupted with 'q' > > Cause: > > The mentioned commits made changes in a way that some header elements > are only partially written in > mkv_write_header, leaving the header in an invalid state. Only in > mkv_write_trailer, these elements > are finished correctly, but that does only occur at the end of the > process. > > Regression: > > Before these commits were applied, mkv headers have always been valid, > even before completion of ffmpeg. > This has worked reliably over many versions of ffmpeg, to it was an > obvious regression. > > Bugtracker: > > This issue has been recorded as #5977 which is resolved by this patch > > Patch: > > The patch adds a new function 'end_ebml_master_crc32_preliminary' that > preliminarily finishes the ebl > element without destroying the buffer. The buffer can be used to update > the ebml element later during > mkv_write_trailer. But most important: mkv_write_header finishes with a > valid mkv header again. > --- > libavformat/avio.h| 12 > libavformat/aviobuf.c | 17 + > libavformat/matroskaenc.c | 34 +++--- > 3 files changed, 60 insertions(+), 3 deletions(-) this patch breaks fate make fate ... --- ./tests/ref/fate/rgb24-mkv 2017-01-04 12:03:10.556691008 +0100 +++ tests/data/fate/rgb24-mkv 2017-01-04 13:45:50.260877087 +0100 @@ -1,5 +1,5 @@ -94cce0d7d5b14b4c86e74a1ca454c5aa *tests/data/fate/rgb24-mkv.matroska -58361 tests/data/fate/rgb24-mkv.matroska +4060a15b991c314120c51ae7e95958b9 *tests/data/fate/rgb24-mkv.matroska +58734 tests/data/fate/rgb24-mkv.matroska #tb 0: 1/10 #media_type 0: video #codec_id 0: rawvideo Test rgb24-mkv failed. Look at tests/data/fate/rgb24-mkv.err for details. make: *** [fate-rgb24-mkv] Error 1 > > diff --git a/libavformat/avio.h b/libavformat/avio.h > index b1ce1d1..f2b9a6f 100644 > --- a/libavformat/avio.h > +++ b/libavformat/avio.h changes to avio* should be in a seperate patch thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Freedom in capitalist society always remains about the same as it was in ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] imdct15: replace the FFT with a faster PFA FFT algorithm
On 4 January 2017 at 10:16, Rostislav Pehlivanovwrote: > > +ff_fft_init(>ptwo_fft, N - 1, 1); > > Forgot to check the return value here, changed locally to: if (ff_fft_init(>ptwo_fft, N - 1, 1) < 0); goto fail; ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] imdct15: remove the AArch64 assembly
Prep work for the next commit, which will add a new FFT algorithm which makes the iMDCT over 3x faster than it is currently (standalone, the FFT is with some framesizes over 10x faster). The new FFT algorithm uses the already thouroughly SIMD'd power of two FFT which already has SIMD for AArch64, so users of that platform will still see an improvement. The previous FFT+SIMD was barely 2.5x faster than the C versions on these platforms. Signed-off-by: Rostislav Pehlivanov--- libavcodec/aarch64/Makefile | 2 - libavcodec/aarch64/imdct15_init.c | 46 --- libavcodec/aarch64/imdct15_neon.S | 647 -- libavcodec/imdct15.c | 3 - libavcodec/imdct15.h | 3 - 5 files changed, 701 deletions(-) delete mode 100644 libavcodec/aarch64/imdct15_init.c delete mode 100644 libavcodec/aarch64/imdct15_neon.S diff --git a/libavcodec/aarch64/Makefile b/libavcodec/aarch64/Makefile index b7bb898713..5593863a75 100644 --- a/libavcodec/aarch64/Makefile +++ b/libavcodec/aarch64/Makefile @@ -6,7 +6,6 @@ OBJS-$(CONFIG_H264DSP) += aarch64/h264dsp_init_aarch64.o OBJS-$(CONFIG_H264PRED) += aarch64/h264pred_init.o OBJS-$(CONFIG_H264QPEL) += aarch64/h264qpel_init_aarch64.o OBJS-$(CONFIG_HPELDSP) += aarch64/hpeldsp_init_aarch64.o -OBJS-$(CONFIG_IMDCT15) += aarch64/imdct15_init.o OBJS-$(CONFIG_MPEGAUDIODSP) += aarch64/mpegaudiodsp_init.o OBJS-$(CONFIG_NEON_CLOBBER_TEST)+= aarch64/neontest.o OBJS-$(CONFIG_VIDEODSP) += aarch64/videodsp_init.o @@ -35,7 +34,6 @@ NEON-OBJS-$(CONFIG_H264PRED)+= aarch64/h264pred_neon.o NEON-OBJS-$(CONFIG_H264QPEL)+= aarch64/h264qpel_neon.o \ aarch64/hpeldsp_neon.o NEON-OBJS-$(CONFIG_HPELDSP) += aarch64/hpeldsp_neon.o -NEON-OBJS-$(CONFIG_IMDCT15) += aarch64/imdct15_neon.o NEON-OBJS-$(CONFIG_MDCT)+= aarch64/mdct_neon.o NEON-OBJS-$(CONFIG_MPEGAUDIODSP)+= aarch64/mpegaudiodsp_neon.o diff --git a/libavcodec/aarch64/imdct15_init.c b/libavcodec/aarch64/imdct15_init.c deleted file mode 100644 index 58af9f00c0..00 --- a/libavcodec/aarch64/imdct15_init.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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 - -#include "libavutil/cpu.h" -#include "libavutil/aarch64/cpu.h" -#include "libavutil/internal.h" - -#include "libavcodec/imdct15.h" - -#include "asm-offsets.h" - -AV_CHECK_OFFSET(IMDCT15Context, exptab, CELT_EXPTAB); -AV_CHECK_OFFSET(IMDCT15Context, fft_n, CELT_FFT_N); -AV_CHECK_OFFSET(IMDCT15Context, len2, CELT_LEN2); -AV_CHECK_OFFSET(IMDCT15Context, len4, CELT_LEN4); -AV_CHECK_OFFSET(IMDCT15Context, tmp,CELT_TMP); -AV_CHECK_OFFSET(IMDCT15Context, twiddle_exptab, CELT_TWIDDLE); - -void ff_celt_imdct_half_neon(IMDCT15Context *s, float *dst, const float *src, - ptrdiff_t stride, float scale); - -void ff_imdct15_init_aarch64(IMDCT15Context *s) -{ -int cpu_flags = av_get_cpu_flags(); - -if (have_neon(cpu_flags)) { -s->imdct_half = ff_celt_imdct_half_neon; -} -} diff --git a/libavcodec/aarch64/imdct15_neon.S b/libavcodec/aarch64/imdct15_neon.S deleted file mode 100644 index 97e1442ccc..00 --- a/libavcodec/aarch64/imdct15_neon.S +++ /dev/null @@ -1,647 +0,0 @@ -/* - * Copyright (c) 2014 Janne Grunau - * - * 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
[FFmpeg-devel] [PATCH 2/2] imdct15: replace the FFT with a faster PFA FFT algorithm
This commit replaces the current inefficient non-power-of-two FFT with a much faster FFT based on the Prime Factor Algorithm. Although it is already much faster than the old algorithm without SIMD, the new algorithm makes use of the already very throughouly SIMD'd power of two FFT, which improves performance even more across all platforms which we have SIMD support for. Most of the work was done by Peter Barfuss, who passed the code to me to implement into the iMDCT and the current codebase. The code for a 5-point and 15-point FFT was derived from the previous implementation, although it was optimized and simplified, which will make its future SIMD easier. The 15-point FFT is currently using 6% of the current overall decoder overhead. The FFT can now easily be used as a forward transform by simply not multiplying the 5-point FFT's imaginary component by -1 (which comes from the fact that changing the complex exponential's angle by -1 also changes the output by that) and by multiplying the "theta" angle of the main exptab by -1. Hence the deliberately left multiplication by -1 at the end. FATE passes, and performance reports on other platforms/CPUs are welcome. Performance comparisons: iMDCT, PFA: 101127 decicycles in speed, 32765 runs, 3 skips iMDCT, Old: 211022 decicycles in speed, 32768 runs, 0 skips Standalone FFT, 30 transforms of size 960: PFAOld FFT kiss_fftlibfftw3f 3.659695s, 15.726912s, 13.300789s, 1.18s Being only 3x slower than libfftw3f is a big achievement by itself. There appears to be something capping the performance in the iMDCT side of things, possibly during the pre-stage reindexing. However, it is certainly fast enough for now. Signed-off-by: Rostislav Pehlivanov--- libavcodec/imdct15.c | 299 ++- libavcodec/imdct15.h | 9 +- 2 files changed, 160 insertions(+), 148 deletions(-) diff --git a/libavcodec/imdct15.c b/libavcodec/imdct15.c index 7481c026cf..6d453d5cad 100644 --- a/libavcodec/imdct15.c +++ b/libavcodec/imdct15.c @@ -34,10 +34,6 @@ #include "avfft.h" #include "imdct15.h" -#include "opus.h" - -// minimal iMDCT size to make SIMD opts easier -#define CELT_MIN_IMDCT_SIZE 120 // complex c = a * b #define CMUL3(cre, cim, are, aim, bre, bim) \ @@ -48,37 +44,18 @@ do { \ #define CMUL(c, a, b) CMUL3((c).re, (c).im, (a).re, (a).im, (b).re, (b).im) -// complex c = a * b -// d = a * conjugate(b) -#define CMUL2(c, d, a, b)\ -do { \ -float are = (a).re; \ -float aim = (a).im; \ -float bre = (b).re; \ -float bim = (b).im; \ -float rr = are * bre; \ -float ri = are * bim; \ -float ir = aim * bre; \ -float ii = aim * bim; \ -(c).re = rr - ii; \ -(c).im = ri + ir; \ -(d).re = rr + ii; \ -(d).im = -ri + ir; \ -} while (0) - av_cold void ff_imdct15_uninit(IMDCT15Context **ps) { IMDCT15Context *s = *ps; -int i; if (!s) return; -for (i = 0; i < FF_ARRAY_ELEMS(s->exptab); i++) -av_freep(>exptab[i]); +ff_fft_end(>ptwo_fft); +av_freep(>pfa_prereindex); +av_freep(>pfa_postreindex); av_freep(>twiddle_exptab); - av_freep(>tmp); av_freep(ps); @@ -87,14 +64,46 @@ av_cold void ff_imdct15_uninit(IMDCT15Context **ps) static void imdct15_half(IMDCT15Context *s, float *dst, const float *src, ptrdiff_t stride, float scale); +static inline int init_pfa_reindex_tabs(IMDCT15Context *s) +{ +int i, j; +const int b_ptwo = s->ptwo_fft.nbits; /* Bits for the power of two FFTs */ +const int l_ptwo = 1 << b_ptwo; /* Total length for the power of two FFTs */ +const int inv_1 = l_ptwo << ((4 - b_ptwo) & 3); +const int inv_2 = 0xeeef & ((1U << b_ptwo) - 1); + +s->pfa_prereindex = av_malloc(15 * l_ptwo * sizeof(*s->pfa_prereindex)); +if (!s->pfa_prereindex) +return 1; + +s->pfa_postreindex = av_malloc(15 * l_ptwo * sizeof(*s->pfa_postreindex)); +if (!s->pfa_postreindex) +return 1; + +/* Pre/Post-reindex */ +for (i = 0; i < l_ptwo; i++) { +for (j = 0; j < 15; j++) { +const int q_pre = ((l_ptwo * j)/15 + i) >> b_ptwo; +const int q_post = (((j*inv_1)/15) + (i*inv_2)) >> b_ptwo; +const int k_pre = 15*i + ((j - q_pre*15) << b_ptwo); +const int k_post = i*inv_2*15 + j*inv_1 - 15*q_post*l_ptwo; +s->pfa_prereindex [i*15 + j] = k_pre; +
Re: [FFmpeg-devel] [PATCH] libavutil/hwcontext_qsv: Fix bug that the QSV encoded frames'width and height are 32-aligned
Hi, If fixing this issue by adjusting the cropping parameters after copying the FrameInfo, maybe it will still have some problem. This fix will only modify the encoder's surface information but other modules' surface information(CropW and CropH of the FrameInfo) also needs to be modified. So many more codes need to modify. In my opinion fixing this case in the hwcontext_qsv.c maybe much better . And the surface information do need align when doing allocator. What's your opinion, or some other better suggestion ,thanks. 在 2017/1/3 20:40, Mark Thompson 写道: On 03/01/17 06:35, Huang, Zhengxu wrote: From 8b1bcc0634f6ce36acfbd2bfdd26690a6323d09c Mon Sep 17 00:00:00 2001 From: ZhengxuDate: Fri, 16 Dec 2016 11:10:34 +0800 Subject: [PATCH] libavutil/hwcontext_qsv: Fix bug that the QSV encoded frames' width and height are 32-aligned. Description: If an input is of 1280x720, the encoded stream created by command below is of 1280x736: ffmpeg -hwaccel qsv -c:v h264_qsv -i test.h264 -c:v h264_qsv out.h264 Reason: When creating a AVQSVFramesContext, width and height shouldn't be aligned, or the mfxSurfaces' cropW and cropH will be wrong. Fix: User should configure AVQSVFramesContext with origin width and height and AVFramesContext will align the width and height when being initiallized. Signed-off-by: ChaoX A Liu Signed-off-by: Huang, Zhengxu Signed-off-by: Andrew, Zhang --- ffmpeg_qsv.c | 8 libavutil/hwcontext_qsv.c | 8 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ffmpeg_qsv.c b/ffmpeg_qsv.c index 68ff5bd..aab7375 100644 --- a/ffmpeg_qsv.c +++ b/ffmpeg_qsv.c @@ -76,8 +76,8 @@ int qsv_init(AVCodecContext *s) frames_ctx = (AVHWFramesContext*)ist->hw_frames_ctx->data; frames_hwctx = frames_ctx->hwctx; -frames_ctx->width = FFALIGN(s->coded_width, 32); -frames_ctx->height= FFALIGN(s->coded_height, 32); +frames_ctx->width = s->coded_width; +frames_ctx->height= s->coded_height; frames_ctx->format= AV_PIX_FMT_QSV; frames_ctx->sw_format = s->sw_pix_fmt; frames_ctx->initial_pool_size = 64; @@ -152,8 +152,8 @@ int qsv_transcode_init(OutputStream *ost) encode_frames = (AVHWFramesContext*)encode_frames_ref->data; qsv_frames = encode_frames->hwctx; -encode_frames->width = FFALIGN(ist->resample_width, 32); -encode_frames->height= FFALIGN(ist->resample_height, 32); +encode_frames->width = ist->resample_width; +encode_frames->height= ist->resample_height; encode_frames->format= AV_PIX_FMT_QSV; encode_frames->sw_format = AV_PIX_FMT_NV12; encode_frames->initial_pool_size = 1; diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index 03244a6..2dc9aca 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -308,9 +308,13 @@ static int qsv_init_pool(AVHWFramesContext *ctx, uint32_t fourcc) surf->Info.ChromaFormat = MFX_CHROMAFORMAT_YUV444; surf->Info.FourCC = fourcc; -surf->Info.Width = ctx->width; +/* + * WxH being aligned with 32x32 is needed by MSDK. + * CropW and CropH are the real size of the frame. + */ +surf->Info.Width = FFALIGN(ctx->width, 32); surf->Info.CropW = ctx->width; -surf->Info.Height = ctx->height; +surf->Info.Height = FFALIGN(ctx->height, 32); surf->Info.CropH = ctx->height; surf->Info.FrameRateExtN = 25; surf->Info.FrameRateExtD = 1; -- 1.8.3.1 This seems wrong to me - the hwcontext code is only dealing in surfaces, and should not be interested in the actual dimensions of the frame on each surface (that is a per-frame property anyway, since it need not be the same for all frames in a context). Is it possible to instead fix this case by adjusting the cropping parameters after copying the FrameInfo at libavcodec/qsvenc.c:378? Maybe this (not tested at all): diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index ac443c1a26..32e2a4ed13 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -376,6 +376,8 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) AVHWFramesContext *frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data; AVQSVFramesContext *frames_hwctx = frames_ctx->hwctx; q->param.mfx.FrameInfo = frames_hwctx->surfaces[0].Info; +q->param.mfx.FrameInfo.CropW = avctx->width; +q->param.mfx.FrameInfo.CropH = avctx->height; } else { q->param.mfx.FrameInfo.FourCC = MFX_FOURCC_NV12; q->param.mfx.FrameInfo.Width = FFALIGN(avctx->width, q->width_align); Thanks, - Mark
Re: [FFmpeg-devel] [PATCH] libavutil/hwcontext_qsv: Command line using hwaccel 'QSV' doesn't work
在 2017/1/3 21:14, Mark Thompson 写道: On 03/01/17 07:13, Huang, Zhengxu wrote: From 687ce9c804b2618f021100235c46a33b48fa522c Mon Sep 17 00:00:00 2001 From: ZhengxuDate: Wed, 14 Dec 2016 11:55:31 +0800 Subject: [PATCH] libavutil/hwcontext_qsv: Command line using hwaccel 'QSV' doesn't work. Command: ffmpeg -hwaccel qsv -c:v h264_qsv -i test.264 -c:v h264_qsv out.264 Reason: hwcontext_qsv will create a child hwcontext_vaapi. VAAPI will open X11 display ":0.0" defaultly. However, MSDK doesn't support X11 so far. This results in the failure of this command. Fix: When using VAAPI, let VAAPI try to create DRM display handle by scanning device nodes under '/dev/dri/'. We already default to attempting to open the first render node inside hwcontext_vaapi (if opening via X11 fails): http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavutil/hwcontext_vaapi.c;h=6176bdc880c81dec7cac0b214a8d55f3b1160abc;hb=HEAD#l936 I think if you want this behaviour it would be better to add code there rather than in hwcontext_qsv (which doesn't really care about this aspect at all, it just wants a usable subdevice for the platform). your concern makes sense and this fix does may introduce some other problem. Can you explain your case which hits this? Do you have some other external graphics card(s) along with the on-chip Intel graphics? For that case, I don't like the idea of scanning for a device node because it is perfectly possible to get a valid VADisplay handle for a non-QSV device (an AMD or Nvidia card with mesa, most obviously) which will then fail opaquely later when libmfx tries to use it because the Intel proprietary driver is required. This may even fail randomly, because device nodes associated with independent drivers are not ordered. The reason that we do like this is that we met some special case before. Under the /dev/dri node there is no dev/dri/renderD128 and only the card0 and card1. The card0 can't work and the card1 can work well. So we add the scanning device node code. Signed-off-by: ChaoX A Liu Signed-off-by: Huang, Zhengxu Signed-off-by: Andrew, Zhang --- libavutil/hwcontext_qsv.c | 44 +++- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index 2dc9aca..2701b5a 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -707,12 +707,41 @@ static mfxIMPL choose_implementation(const char *device) return impl; } +static int create_proper_child_device(AVBufferRef **ctx, const char *device, int flags) +{ +enum AVHWDeviceType child_device_type; +char adapter[256]; +int adapter_num; + +if (CONFIG_VAAPI) +child_device_type = AV_HWDEVICE_TYPE_VAAPI; +else if (CONFIG_DXVA2) +child_device_type = AV_HWDEVICE_TYPE_DXVA2; +else +return AVERROR(ENOSYS); + +if (device || CONFIG_DXVA2) +return av_hwdevice_ctx_create(ctx, child_device_type, device, NULL, flags); + +for (adapter_num = 0; adapter_num < 6; adapter_num++) { +if (adapter_num < 3) +snprintf(adapter,sizeof(adapter), +"/dev/dri/renderD%d", adapter_num+128); +else +snprintf(adapter,sizeof(adapter), +"/dev/dri/card%d", adapter_num-3); I would prefer not to open the DRM master device (/dev/dri/card*) by default - until very recent kernels it was exclusive-access-only, so nothing else can use the graphics at the same time (most obviously another ffmpeg instance). +if (av_hwdevice_ctx_create(ctx, child_device_type, adapter, NULL, flags) == 0) +return 0; +} + +return AVERROR(ENOSYS); +} + static int qsv_device_create(AVHWDeviceContext *ctx, const char *device, AVDictionary *opts, int flags) { AVQSVDeviceContext *hwctx = ctx->hwctx; QSVDevicePriv *priv; -enum AVHWDeviceType child_device_type; AVDictionaryEntry *e; mfxVersionver = { { 3, 1 } }; @@ -730,18 +759,7 @@ static int qsv_device_create(AVHWDeviceContext *ctx, const char *device, ctx->free= qsv_device_free; e = av_dict_get(opts, "child_device", NULL, 0); - -if (CONFIG_VAAPI) -child_device_type = AV_HWDEVICE_TYPE_VAAPI; -else if (CONFIG_DXVA2) -child_device_type = AV_HWDEVICE_TYPE_DXVA2; -else { -av_log(ctx, AV_LOG_ERROR, "No supported child device type is enabled\n"); -return AVERROR(ENOSYS); -} - -ret = av_hwdevice_ctx_create(>child_device_ctx, child_device_type, - e ? e->value : NULL, NULL, 0); +ret = create_proper_child_device(>child_device_ctx, e ? e->value : NULL, 0); if (ret < 0) return ret; -- 1.8.3.1 For your specific case in the ffmpeg utility it might be best to