Re: [FFmpeg-devel] [PATCH] hwcontext: add a QSV implementation
On 9/28/2016 3:18 PM, James Almer wrote: > On 9/19/2016 7:00 AM, Ivan Uskov wrote: >> This should be a good step to make qsv branches of ffmpeg and libav >> closer. >> LGTM. > > This has now been merged. > > Could i ask you or Nablet to look at commits > a0524d9b1e1bb0012207584f067096df7792df6c and > ad9c9440d592e4d53d6bec9961b4b22e25387d70 from libav and see if you can > implement then in our tree? They are next in the merge queue and there > have been some changes in our tree that make merging both of them not > trivial, and i have no way to test. > > Thanks! Ping. These two commits are required to continue with the merges, so please see if you can implement them as soon as possible. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] hwcontext: add a QSV implementation
On 9/19/2016 7:00 AM, Ivan Uskov wrote: > This should be a good step to make qsv branches of ffmpeg and libav > closer. > LGTM. This has now been merged. Could i ask you or Nablet to look at commits a0524d9b1e1bb0012207584f067096df7792df6c and ad9c9440d592e4d53d6bec9961b4b22e25387d70 from libav and see if you can implement then in our tree? They are next in the merge queue and there have been some changes in our tree that make merging both of them not trivial, and i have no way to test. Thanks! ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] hwcontext: add a QSV implementation
On Mon, Sep 19, 2016 at 12:00 PM, Ivan Uskov wrote: > > Hello nablet, > > Saturday, September 17, 2016, 11:32:26 AM, you wrote: > >> From: Anton Khirnov > >> Signed-off-by: nablet developer >> --- >> libavutil/Makefile | 3 + >> libavutil/hwcontext.c | 3 + >> libavutil/hwcontext.h | 1 + >> libavutil/hwcontext_internal.h | 1 + >> libavutil/hwcontext_qsv.c | 791 >> + >> libavutil/hwcontext_qsv.h | 52 +++ >> 6 files changed, 851 insertions(+) >> create mode 100644 libavutil/hwcontext_qsv.c >> create mode 100644 libavutil/hwcontext_qsv.h > >> diff --git a/libavutil/Makefile b/libavutil/Makefile >> index 1e06176..76da7d4 100644 >> --- a/libavutil/Makefile >> +++ b/libavutil/Makefile >> @@ -35,6 +35,7 @@ HEADERS = adler32.h >>hwcontext.h \ >>hwcontext_cuda.h \ >>hwcontext_dxva2.h \ >> + hwcontext_qsv.h \ >>hwcontext_vaapi.h \ >>hwcontext_vdpau.h \ >>imgutils.h\ >> @@ -154,6 +155,7 @@ OBJS-$(!HAVE_ATOMICS_NATIVE)+= atomic.o >> >> OBJS-$(CONFIG_CUDA) += hwcontext_cuda.o >> OBJS-$(CONFIG_DXVA2)+= hwcontext_dxva2.o >> +OBJS-$(CONFIG_QSV) += hwcontext_qsv.o >> OBJS-$(CONFIG_LZO) += lzo.o >> OBJS-$(CONFIG_OPENCL) += opencl.o opencl_internal.o >> OBJS-$(CONFIG_VAAPI)+= hwcontext_vaapi.o >> @@ -166,6 +168,7 @@ SLIBOBJS-$(HAVE_GNU_WINDRES)+= avutilres.o >> >> SKIPHEADERS-$(CONFIG_CUDA) += hwcontext_cuda.h >> SKIPHEADERS-$(CONFIG_DXVA2)+= hwcontext_dxva2.h >> +SKIPHEADERS-$(CONFIG_QSV) += hwcontext_qsv.h >> SKIPHEADERS-$(CONFIG_VAAPI)+= hwcontext_vaapi.h >> SKIPHEADERS-$(CONFIG_VDPAU)+= hwcontext_vdpau.h >> SKIPHEADERS-$(HAVE_ATOMICS_GCC)+= atomic_gcc.h >> diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c >> index 1e9e913..be1d73e 100644 >> --- a/libavutil/hwcontext.c >> +++ b/libavutil/hwcontext.c >> @@ -35,6 +35,9 @@ static const HWContextType *hw_table[] = { >> #if CONFIG_DXVA2 >> &ff_hwcontext_type_dxva2, >> #endif >> +#if CONFIG_QSV >> +&ff_hwcontext_type_qsv, >> +#endif >> #if CONFIG_VAAPI >> &ff_hwcontext_type_vaapi, >> #endif >> diff --git a/libavutil/hwcontext.h b/libavutil/hwcontext.h >> index 4e9da02..5e2af09 100644 >> --- a/libavutil/hwcontext.h >> +++ b/libavutil/hwcontext.h >> @@ -29,6 +29,7 @@ enum AVHWDeviceType { >> AV_HWDEVICE_TYPE_CUDA, >> AV_HWDEVICE_TYPE_VAAPI, >> AV_HWDEVICE_TYPE_DXVA2, >> +AV_HWDEVICE_TYPE_QSV, >> }; >> >> typedef struct AVHWDeviceInternal AVHWDeviceInternal; >> diff --git a/libavutil/hwcontext_internal.h b/libavutil/hwcontext_internal.h >> index cf832fe..079e42b 100644 >> --- a/libavutil/hwcontext_internal.h >> +++ b/libavutil/hwcontext_internal.h >> @@ -101,6 +101,7 @@ struct AVHWFramesInternal { >> >> extern const HWContextType ff_hwcontext_type_cuda; >> extern const HWContextType ff_hwcontext_type_dxva2; >> +extern const HWContextType ff_hwcontext_type_qsv; >> extern const HWContextType ff_hwcontext_type_vaapi; >> extern const HWContextType ff_hwcontext_type_vdpau; >> >> diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c >> new file mode 100644 >> index 000..13be5b0 >> --- /dev/null >> +++ b/libavutil/hwcontext_qsv.c >> @@ -0,0 +1,791 @@ >> +/* >> + * 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 >> + >> +#include >> + >> +#include "config.h" >> + >> +#if CONFIG_VAAPI >> +#include "hwcontext_vaapi.h" >> +#endif >> +#if CONFIG_DXVA2 >> +#include "hwcontext_dxva2.h" >> +#endif >> + >> +#include "buffer.h" >> +#include "common.h" >> +#include "hwcontext.h" >> +#include "hwcontext_internal.h" >> +#includ
Re: [FFmpeg-devel] [PATCH] hwcontext: add a QSV implementation
Hello nablet, Saturday, September 17, 2016, 11:32:26 AM, you wrote: > From: Anton Khirnov > Signed-off-by: nablet developer > --- > libavutil/Makefile | 3 + > libavutil/hwcontext.c | 3 + > libavutil/hwcontext.h | 1 + > libavutil/hwcontext_internal.h | 1 + > libavutil/hwcontext_qsv.c | 791 > + > libavutil/hwcontext_qsv.h | 52 +++ > 6 files changed, 851 insertions(+) > create mode 100644 libavutil/hwcontext_qsv.c > create mode 100644 libavutil/hwcontext_qsv.h > diff --git a/libavutil/Makefile b/libavutil/Makefile > index 1e06176..76da7d4 100644 > --- a/libavutil/Makefile > +++ b/libavutil/Makefile > @@ -35,6 +35,7 @@ HEADERS = adler32.h >hwcontext.h \ >hwcontext_cuda.h \ >hwcontext_dxva2.h \ > + hwcontext_qsv.h \ >hwcontext_vaapi.h \ >hwcontext_vdpau.h \ >imgutils.h\ > @@ -154,6 +155,7 @@ OBJS-$(!HAVE_ATOMICS_NATIVE)+= atomic.o > > OBJS-$(CONFIG_CUDA) += hwcontext_cuda.o > OBJS-$(CONFIG_DXVA2)+= hwcontext_dxva2.o > +OBJS-$(CONFIG_QSV) += hwcontext_qsv.o > OBJS-$(CONFIG_LZO) += lzo.o > OBJS-$(CONFIG_OPENCL) += opencl.o opencl_internal.o > OBJS-$(CONFIG_VAAPI)+= hwcontext_vaapi.o > @@ -166,6 +168,7 @@ SLIBOBJS-$(HAVE_GNU_WINDRES)+= avutilres.o > > SKIPHEADERS-$(CONFIG_CUDA) += hwcontext_cuda.h > SKIPHEADERS-$(CONFIG_DXVA2)+= hwcontext_dxva2.h > +SKIPHEADERS-$(CONFIG_QSV) += hwcontext_qsv.h > SKIPHEADERS-$(CONFIG_VAAPI)+= hwcontext_vaapi.h > SKIPHEADERS-$(CONFIG_VDPAU)+= hwcontext_vdpau.h > SKIPHEADERS-$(HAVE_ATOMICS_GCC)+= atomic_gcc.h > diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c > index 1e9e913..be1d73e 100644 > --- a/libavutil/hwcontext.c > +++ b/libavutil/hwcontext.c > @@ -35,6 +35,9 @@ static const HWContextType *hw_table[] = { > #if CONFIG_DXVA2 > &ff_hwcontext_type_dxva2, > #endif > +#if CONFIG_QSV > +&ff_hwcontext_type_qsv, > +#endif > #if CONFIG_VAAPI > &ff_hwcontext_type_vaapi, > #endif > diff --git a/libavutil/hwcontext.h b/libavutil/hwcontext.h > index 4e9da02..5e2af09 100644 > --- a/libavutil/hwcontext.h > +++ b/libavutil/hwcontext.h > @@ -29,6 +29,7 @@ enum AVHWDeviceType { > AV_HWDEVICE_TYPE_CUDA, > AV_HWDEVICE_TYPE_VAAPI, > AV_HWDEVICE_TYPE_DXVA2, > +AV_HWDEVICE_TYPE_QSV, > }; > > typedef struct AVHWDeviceInternal AVHWDeviceInternal; > diff --git a/libavutil/hwcontext_internal.h b/libavutil/hwcontext_internal.h > index cf832fe..079e42b 100644 > --- a/libavutil/hwcontext_internal.h > +++ b/libavutil/hwcontext_internal.h > @@ -101,6 +101,7 @@ struct AVHWFramesInternal { > > extern const HWContextType ff_hwcontext_type_cuda; > extern const HWContextType ff_hwcontext_type_dxva2; > +extern const HWContextType ff_hwcontext_type_qsv; > extern const HWContextType ff_hwcontext_type_vaapi; > extern const HWContextType ff_hwcontext_type_vdpau; > > diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c > new file mode 100644 > index 000..13be5b0 > --- /dev/null > +++ b/libavutil/hwcontext_qsv.c > @@ -0,0 +1,791 @@ > +/* > + * 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 > + > +#include > + > +#include "config.h" > + > +#if CONFIG_VAAPI > +#include "hwcontext_vaapi.h" > +#endif > +#if CONFIG_DXVA2 > +#include "hwcontext_dxva2.h" > +#endif > + > +#include "buffer.h" > +#include "common.h" > +#include "hwcontext.h" > +#include "hwcontext_internal.h" > +#include "hwcontext_qsv.h" > +#include "mem.h" > +#include "pixfmt.h" > +#include "pixdesc.h" > +#include "time.h" > + > +typedef struct QSVDe
[FFmpeg-devel] [PATCH] hwcontext: add a QSV implementation
From: Anton Khirnov Signed-off-by: nablet developer --- libavutil/Makefile | 3 + libavutil/hwcontext.c | 3 + libavutil/hwcontext.h | 1 + libavutil/hwcontext_internal.h | 1 + libavutil/hwcontext_qsv.c | 791 + libavutil/hwcontext_qsv.h | 52 +++ 6 files changed, 851 insertions(+) create mode 100644 libavutil/hwcontext_qsv.c create mode 100644 libavutil/hwcontext_qsv.h diff --git a/libavutil/Makefile b/libavutil/Makefile index 1e06176..76da7d4 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -35,6 +35,7 @@ HEADERS = adler32.h \ hwcontext.h \ hwcontext_cuda.h \ hwcontext_dxva2.h \ + hwcontext_qsv.h \ hwcontext_vaapi.h \ hwcontext_vdpau.h \ imgutils.h\ @@ -154,6 +155,7 @@ OBJS-$(!HAVE_ATOMICS_NATIVE)+= atomic.o \ OBJS-$(CONFIG_CUDA) += hwcontext_cuda.o OBJS-$(CONFIG_DXVA2)+= hwcontext_dxva2.o +OBJS-$(CONFIG_QSV) += hwcontext_qsv.o OBJS-$(CONFIG_LZO) += lzo.o OBJS-$(CONFIG_OPENCL) += opencl.o opencl_internal.o OBJS-$(CONFIG_VAAPI)+= hwcontext_vaapi.o @@ -166,6 +168,7 @@ SLIBOBJS-$(HAVE_GNU_WINDRES)+= avutilres.o SKIPHEADERS-$(CONFIG_CUDA) += hwcontext_cuda.h SKIPHEADERS-$(CONFIG_DXVA2)+= hwcontext_dxva2.h +SKIPHEADERS-$(CONFIG_QSV) += hwcontext_qsv.h SKIPHEADERS-$(CONFIG_VAAPI)+= hwcontext_vaapi.h SKIPHEADERS-$(CONFIG_VDPAU)+= hwcontext_vdpau.h SKIPHEADERS-$(HAVE_ATOMICS_GCC)+= atomic_gcc.h diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c index 1e9e913..be1d73e 100644 --- a/libavutil/hwcontext.c +++ b/libavutil/hwcontext.c @@ -35,6 +35,9 @@ static const HWContextType *hw_table[] = { #if CONFIG_DXVA2 &ff_hwcontext_type_dxva2, #endif +#if CONFIG_QSV +&ff_hwcontext_type_qsv, +#endif #if CONFIG_VAAPI &ff_hwcontext_type_vaapi, #endif diff --git a/libavutil/hwcontext.h b/libavutil/hwcontext.h index 4e9da02..5e2af09 100644 --- a/libavutil/hwcontext.h +++ b/libavutil/hwcontext.h @@ -29,6 +29,7 @@ enum AVHWDeviceType { AV_HWDEVICE_TYPE_CUDA, AV_HWDEVICE_TYPE_VAAPI, AV_HWDEVICE_TYPE_DXVA2, +AV_HWDEVICE_TYPE_QSV, }; typedef struct AVHWDeviceInternal AVHWDeviceInternal; diff --git a/libavutil/hwcontext_internal.h b/libavutil/hwcontext_internal.h index cf832fe..079e42b 100644 --- a/libavutil/hwcontext_internal.h +++ b/libavutil/hwcontext_internal.h @@ -101,6 +101,7 @@ struct AVHWFramesInternal { extern const HWContextType ff_hwcontext_type_cuda; extern const HWContextType ff_hwcontext_type_dxva2; +extern const HWContextType ff_hwcontext_type_qsv; extern const HWContextType ff_hwcontext_type_vaapi; extern const HWContextType ff_hwcontext_type_vdpau; diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c new file mode 100644 index 000..13be5b0 --- /dev/null +++ b/libavutil/hwcontext_qsv.c @@ -0,0 +1,791 @@ +/* + * 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 + +#include + +#include "config.h" + +#if CONFIG_VAAPI +#include "hwcontext_vaapi.h" +#endif +#if CONFIG_DXVA2 +#include "hwcontext_dxva2.h" +#endif + +#include "buffer.h" +#include "common.h" +#include "hwcontext.h" +#include "hwcontext_internal.h" +#include "hwcontext_qsv.h" +#include "mem.h" +#include "pixfmt.h" +#include "pixdesc.h" +#include "time.h" + +typedef struct QSVDevicePriv { +AVBufferRef *child_device_ctx; +} QSVDevicePriv; + +typedef struct QSVDeviceContext { +mfxHDL handle; +mfxHandleType handle_type; +mfxVersion ver; +mfxIMPL impl; + +enum AVHWDeviceType child_device_type; +enum AV
[FFmpeg-devel] [PATCH] hwcontext: add a QSV implementation
patch is taken from libav project, authored by Anton Khirnov https://lists.libav.org/pipermail/libav-devel/2016-May/077126.html the only differences from original libav patch: 1) replaced CONFIG_LIBMXF with CONFIG_QSV to match the rest of ffmpeg sources 2) changed copyright headers to match ffmpeg standard this patch adds Intel QuickSync Video hardware context implementation to libavutil, in same manner as other hardware context implementations like CUDA, VAAPI, etc. this context will be used and shared by various Intel QuickSync Video decoders and encoders component (like qsv_h264), as well as VPP filter. Anton Khirnov (1): hwcontext: add a QSV implementation libavutil/Makefile | 3 + libavutil/hwcontext.c | 3 + libavutil/hwcontext.h | 1 + libavutil/hwcontext_internal.h | 1 + libavutil/hwcontext_qsv.c | 791 + libavutil/hwcontext_qsv.h | 52 +++ 6 files changed, 851 insertions(+) create mode 100644 libavutil/hwcontext_qsv.c create mode 100644 libavutil/hwcontext_qsv.h -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] hwcontext: add a QSV implementation
On Wed, Jul 06, 2016 at 03:51:12PM +0700, nablet developer wrote: > > > On 06 Jul 2016, at 15:48, Hendrik Leppkes wrote: > > > > On Wed, Jul 6, 2016 at 9:08 AM, nablet developer wrote: > >> add hwcontext_qsv (Intel QuickSync Video) implementation > >> basically it's adapted patch from libav > >> (https://lists.libav.org/pipermail/libav-devel/2016-May/077126.html) > > > > If you take a patch from libav, you need to maintain proper authorship > > information. > > how is it usually done? commit message, comment block or something else? git has a author field if more detals are needed, they can additionally be put in the commit message > > > Also please outline what has changed from the original, if anything. > > We try to keep all the hwcontext things as close to libav as possible > > to make future enhancements easier. > > patch is identical except copyright headers of hwcontext_qsv.c / > hwcontext_qsv.h (first 17 lines) which are changed to the typical ffmpeg > copyright. > > > > > - Hendrik > > ___ > > 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 -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The misfortune of the wise is better than the prosperity of the fool. -- Epicurus signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] hwcontext: add a QSV implementation
existing API functions like ff_qsv_init_internal_session / ff_qsv_close_internal_session are private to libavcodec and are not exported (since they are ff_ prefixed) first attempt was to move API functions from libavcodec to libavutil, but it was rejected and instead it was suggested to use existing generic hwcontext approach instead of adding QSV specific API > On 06 Jul 2016, at 15:40, Carl Eugen Hoyos wrote: > > nablet developer nablet.com> writes: > >> hwcontext_qsv is needed for VPP filter (which cannot use API >> functions from libavcodec) > > Why not? > > Carl Eugen > > ___ > 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] hwcontext: add a QSV implementation
> On 06 Jul 2016, at 15:48, Hendrik Leppkes wrote: > > On Wed, Jul 6, 2016 at 9:08 AM, nablet developer wrote: >> add hwcontext_qsv (Intel QuickSync Video) implementation >> basically it's adapted patch from libav >> (https://lists.libav.org/pipermail/libav-devel/2016-May/077126.html) > > If you take a patch from libav, you need to maintain proper authorship > information. how is it usually done? commit message, comment block or something else? > Also please outline what has changed from the original, if anything. > We try to keep all the hwcontext things as close to libav as possible > to make future enhancements easier. patch is identical except copyright headers of hwcontext_qsv.c / hwcontext_qsv.h (first 17 lines) which are changed to the typical ffmpeg copyright. > > - Hendrik > ___ > 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] hwcontext: add a QSV implementation
On Wed, Jul 6, 2016 at 9:08 AM, nablet developer wrote: > add hwcontext_qsv (Intel QuickSync Video) implementation > basically it's adapted patch from libav > (https://lists.libav.org/pipermail/libav-devel/2016-May/077126.html) If you take a patch from libav, you need to maintain proper authorship information. Also please outline what has changed from the original, if anything. We try to keep all the hwcontext things as close to libav as possible to make future enhancements easier. - Hendrik ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] hwcontext: add a QSV implementation
nablet developer nablet.com> writes: > hwcontext_qsv is needed for VPP filter (which cannot use API > functions from libavcodec) Why not? Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] hwcontext: add a QSV implementation
add hwcontext_qsv (Intel QuickSync Video) implementation basically it's adapted patch from libav (https://lists.libav.org/pipermail/libav-devel/2016-May/077126.html) hwcontext_qsv is needed for VPP filter (which cannot use API functions from libavcodec) nablet developer (1): hwcontext: add a QSV implementation libavutil/Makefile | 3 + libavutil/hwcontext.c | 3 + libavutil/hwcontext.h | 1 + libavutil/hwcontext_internal.h | 1 + libavutil/hwcontext_qsv.c | 791 + libavutil/hwcontext_qsv.h | 52 +++ 6 files changed, 851 insertions(+) create mode 100644 libavutil/hwcontext_qsv.c create mode 100644 libavutil/hwcontext_qsv.h -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] hwcontext: add a QSV implementation
Signed-off-by: nablet developer --- libavutil/Makefile | 3 + libavutil/hwcontext.c | 3 + libavutil/hwcontext.h | 1 + libavutil/hwcontext_internal.h | 1 + libavutil/hwcontext_qsv.c | 791 + libavutil/hwcontext_qsv.h | 52 +++ 6 files changed, 851 insertions(+) create mode 100644 libavutil/hwcontext_qsv.c create mode 100644 libavutil/hwcontext_qsv.h diff --git a/libavutil/Makefile b/libavutil/Makefile index 1e06176..7385ec2 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -35,6 +35,7 @@ HEADERS = adler32.h \ hwcontext.h \ hwcontext_cuda.h \ hwcontext_dxva2.h \ + hwcontext_qsv.h \ hwcontext_vaapi.h \ hwcontext_vdpau.h \ imgutils.h\ @@ -154,6 +155,7 @@ OBJS-$(!HAVE_ATOMICS_NATIVE)+= atomic.o \ OBJS-$(CONFIG_CUDA) += hwcontext_cuda.o OBJS-$(CONFIG_DXVA2)+= hwcontext_dxva2.o +OBJS-$(CONFIG_LIBMFX) += hwcontext_qsv.o OBJS-$(CONFIG_LZO) += lzo.o OBJS-$(CONFIG_OPENCL) += opencl.o opencl_internal.o OBJS-$(CONFIG_VAAPI)+= hwcontext_vaapi.o @@ -166,6 +168,7 @@ SLIBOBJS-$(HAVE_GNU_WINDRES)+= avutilres.o SKIPHEADERS-$(CONFIG_CUDA) += hwcontext_cuda.h SKIPHEADERS-$(CONFIG_DXVA2)+= hwcontext_dxva2.h +SKIPHEADERS-$(CONFIG_LIBMFX) += hwcontext_qsv.h SKIPHEADERS-$(CONFIG_VAAPI)+= hwcontext_vaapi.h SKIPHEADERS-$(CONFIG_VDPAU)+= hwcontext_vdpau.h SKIPHEADERS-$(HAVE_ATOMICS_GCC)+= atomic_gcc.h diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c index 1e9e913..81b6911 100644 --- a/libavutil/hwcontext.c +++ b/libavutil/hwcontext.c @@ -32,6 +32,9 @@ static const HWContextType *hw_table[] = { #if CONFIG_CUDA &ff_hwcontext_type_cuda, #endif +#if CONFIG_LIBMFX +&ff_hwcontext_type_qsv, +#endif #if CONFIG_DXVA2 &ff_hwcontext_type_dxva2, #endif diff --git a/libavutil/hwcontext.h b/libavutil/hwcontext.h index 4e9da02..5e2af09 100644 --- a/libavutil/hwcontext.h +++ b/libavutil/hwcontext.h @@ -29,6 +29,7 @@ enum AVHWDeviceType { AV_HWDEVICE_TYPE_CUDA, AV_HWDEVICE_TYPE_VAAPI, AV_HWDEVICE_TYPE_DXVA2, +AV_HWDEVICE_TYPE_QSV, }; typedef struct AVHWDeviceInternal AVHWDeviceInternal; diff --git a/libavutil/hwcontext_internal.h b/libavutil/hwcontext_internal.h index cf832fe..079e42b 100644 --- a/libavutil/hwcontext_internal.h +++ b/libavutil/hwcontext_internal.h @@ -101,6 +101,7 @@ struct AVHWFramesInternal { extern const HWContextType ff_hwcontext_type_cuda; extern const HWContextType ff_hwcontext_type_dxva2; +extern const HWContextType ff_hwcontext_type_qsv; extern const HWContextType ff_hwcontext_type_vaapi; extern const HWContextType ff_hwcontext_type_vdpau; diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c new file mode 100644 index 000..13be5b0 --- /dev/null +++ b/libavutil/hwcontext_qsv.c @@ -0,0 +1,791 @@ +/* + * 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 + +#include + +#include "config.h" + +#if CONFIG_VAAPI +#include "hwcontext_vaapi.h" +#endif +#if CONFIG_DXVA2 +#include "hwcontext_dxva2.h" +#endif + +#include "buffer.h" +#include "common.h" +#include "hwcontext.h" +#include "hwcontext_internal.h" +#include "hwcontext_qsv.h" +#include "mem.h" +#include "pixfmt.h" +#include "pixdesc.h" +#include "time.h" + +typedef struct QSVDevicePriv { +AVBufferRef *child_device_ctx; +} QSVDevicePriv; + +typedef struct QSVDeviceContext { +mfxHDL handle; +mfxHandleType handle_type; +mfxVersion ver; +mfxIMPL impl; + +enum AVHWDeviceType child_device_type; +enum AVPixelFormat child_pi