* Re: [FFmpeg-devel] [PATCH V3 2/2] libavutil/hwcontext_opencl: fix a bug for mapping qsv frame to opencl [not found] ` <20211210053818.3815652-2-wenbin.chen@intel.com> @ 2021-12-24 6:02 ` Xiang, Haihao 2021-12-27 3:13 ` Chen, Wenbin 0 siblings, 1 reply; 3+ messages in thread From: Xiang, Haihao @ 2021-12-24 6:02 UTC (permalink / raw) To: ffmpeg-devel On Fri, 2021-12-10 at 13:38 +0800, Wenbin Chen wrote: > From: nyanmisaka <nst799610810@gmail.com> > > mfxHDLPair was added to qsv, so modify qsv->opencl map function as well. > Now the following commandline works: > > ffmpeg -v verbose -init_hw_device vaapi=va:/dev/dri/renderD128 \ > -init_hw_device qsv=qs@va -init_hw_device opencl=ocl@va -filter_hw_device ocl > \ > -hwaccel qsv -hwaccel_output_format qsv -hwaccel_device qs -c:v h264_qsv \ > -i input.264 -vf "hwmap=derive_device=opencl,format=opencl,avgblur_opencl, \ > hwmap=derive_device=qsv:reverse=1:extra_hw_frames=32,format=qsv" \ > -c:v h264_qsv output.264 > > Signed-off-by: nyanmisaka <nst799610810@gmail.com> > Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> > --- > libavutil/hwcontext_opencl.c | 3 ++- > libavutil/hwcontext_qsv.h | 5 +++++ > 2 files changed, 7 insertions(+), 1 deletion(-) > > diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c > index 26a3a24593..ab812999cd 100644 > --- a/libavutil/hwcontext_opencl.c > +++ b/libavutil/hwcontext_opencl.c > @@ -48,6 +48,7 @@ > #if HAVE_OPENCL_VAAPI_INTEL_MEDIA > #if CONFIG_LIBMFX > #include <mfx/mfxstructures.h> > +#include "hwcontext_qsv.h" > #endif > #include <va/va.h> > #include <CL/cl_va_api_media_sharing_intel.h> > @@ -2249,7 +2250,7 @@ static int opencl_map_from_qsv(AVHWFramesContext > *dst_fc, AVFrame *dst, > #if CONFIG_LIBMFX > if (src->format == AV_PIX_FMT_QSV) { > mfxFrameSurface1 *mfx_surface = (mfxFrameSurface1*)src->data[3]; > - va_surface = *(VASurfaceID*)mfx_surface->Data.MemId; > + va_surface = *MFXSURFACEP_TO_VASURFACEP(mfx_surface); > } else > #endif > if (src->format == AV_PIX_FMT_VAAPI) { > diff --git a/libavutil/hwcontext_qsv.h b/libavutil/hwcontext_qsv.h > index b98d611cfc..957df01ef1 100644 > --- a/libavutil/hwcontext_qsv.h > +++ b/libavutil/hwcontext_qsv.h > @@ -29,6 +29,11 @@ > * contain AVBufferRefs whose data pointer points to an mfxFrameSurface1 > struct. > */ > > +#if CONFIG_VAAPI > +#define MFXSURFACEP_TO_VASURFACEP(surf) \ > + (VASurfaceID*)(((mfxHDLPair*)surf->Data.MemId)->first) > +#endif > + Is it possible to remove the dependency on VAAPI in a public qsv header file ? Thanks Haihao > /** > * This struct is allocated as AVHWDeviceContext.hwctx > */ _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH V3 2/2] libavutil/hwcontext_opencl: fix a bug for mapping qsv frame to opencl 2021-12-24 6:02 ` [FFmpeg-devel] [PATCH V3 2/2] libavutil/hwcontext_opencl: fix a bug for mapping qsv frame to opencl Xiang, Haihao @ 2021-12-27 3:13 ` Chen, Wenbin 2021-12-27 5:46 ` Xiang, Haihao 0 siblings, 1 reply; 3+ messages in thread From: Chen, Wenbin @ 2021-12-27 3:13 UTC (permalink / raw) To: FFmpeg development discussions and patches > On Fri, 2021-12-10 at 13:38 +0800, Wenbin Chen wrote: > > From: nyanmisaka <nst799610810@gmail.com> > > > > mfxHDLPair was added to qsv, so modify qsv->opencl map function as well. > > Now the following commandline works: > > > > ffmpeg -v verbose -init_hw_device vaapi=va:/dev/dri/renderD128 \ > > -init_hw_device qsv=qs@va -init_hw_device opencl=ocl@va - > filter_hw_device ocl > > \ > > -hwaccel qsv -hwaccel_output_format qsv -hwaccel_device qs -c:v > h264_qsv \ > > -i input.264 -vf > "hwmap=derive_device=opencl,format=opencl,avgblur_opencl, \ > > hwmap=derive_device=qsv:reverse=1:extra_hw_frames=32,format=qsv" \ > > -c:v h264_qsv output.264 > > > > Signed-off-by: nyanmisaka <nst799610810@gmail.com> > > Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> > > --- > > libavutil/hwcontext_opencl.c | 3 ++- > > libavutil/hwcontext_qsv.h | 5 +++++ > > 2 files changed, 7 insertions(+), 1 deletion(-) > > > > diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c > > index 26a3a24593..ab812999cd 100644 > > --- a/libavutil/hwcontext_opencl.c > > +++ b/libavutil/hwcontext_opencl.c > > @@ -48,6 +48,7 @@ > > #if HAVE_OPENCL_VAAPI_INTEL_MEDIA > > #if CONFIG_LIBMFX > > #include <mfx/mfxstructures.h> > > +#include "hwcontext_qsv.h" > > #endif > > #include <va/va.h> > > #include <CL/cl_va_api_media_sharing_intel.h> > > @@ -2249,7 +2250,7 @@ static int > opencl_map_from_qsv(AVHWFramesContext > > *dst_fc, AVFrame *dst, > > #if CONFIG_LIBMFX > > if (src->format == AV_PIX_FMT_QSV) { > > mfxFrameSurface1 *mfx_surface = (mfxFrameSurface1*)src->data[3]; > > - va_surface = *(VASurfaceID*)mfx_surface->Data.MemId; > > + va_surface = *MFXSURFACEP_TO_VASURFACEP(mfx_surface); > > } else > > #endif > > if (src->format == AV_PIX_FMT_VAAPI) { > > diff --git a/libavutil/hwcontext_qsv.h b/libavutil/hwcontext_qsv.h > > index b98d611cfc..957df01ef1 100644 > > --- a/libavutil/hwcontext_qsv.h > > +++ b/libavutil/hwcontext_qsv.h > > @@ -29,6 +29,11 @@ > > * contain AVBufferRefs whose data pointer points to an > mfxFrameSurface1 > > struct. > > */ > > > > +#if CONFIG_VAAPI > > +#define MFXSURFACEP_TO_VASURFACEP(surf) \ > > + (VASurfaceID*)(((mfxHDLPair*)surf->Data.MemId)->first) > > +#endif > > + > > Is it possible to remove the dependency on VAAPI in a public qsv header file ? > > Thanks > Haihao How about moving this to qsv_internal.h? > > > /** > > * This struct is allocated as AVHWDeviceContext.hwctx > > */ > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH V3 2/2] libavutil/hwcontext_opencl: fix a bug for mapping qsv frame to opencl 2021-12-27 3:13 ` Chen, Wenbin @ 2021-12-27 5:46 ` Xiang, Haihao 0 siblings, 0 replies; 3+ messages in thread From: Xiang, Haihao @ 2021-12-27 5:46 UTC (permalink / raw) To: ffmpeg-devel On Mon, 2021-12-27 at 03:13 +0000, Chen, Wenbin wrote: > > On Fri, 2021-12-10 at 13:38 +0800, Wenbin Chen wrote: > > > From: nyanmisaka <nst799610810@gmail.com> > > > > > > mfxHDLPair was added to qsv, so modify qsv->opencl map function as well. > > > Now the following commandline works: > > > > > > ffmpeg -v verbose -init_hw_device vaapi=va:/dev/dri/renderD128 \ > > > -init_hw_device qsv=qs@va -init_hw_device opencl=ocl@va - > > > > filter_hw_device ocl > > > \ > > > -hwaccel qsv -hwaccel_output_format qsv -hwaccel_device qs -c:v > > > > h264_qsv \ > > > -i input.264 -vf > > > > "hwmap=derive_device=opencl,format=opencl,avgblur_opencl, \ > > > hwmap=derive_device=qsv:reverse=1:extra_hw_frames=32,format=qsv" \ > > > -c:v h264_qsv output.264 > > > > > > Signed-off-by: nyanmisaka <nst799610810@gmail.com> > > > Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> > > > --- > > > libavutil/hwcontext_opencl.c | 3 ++- > > > libavutil/hwcontext_qsv.h | 5 +++++ > > > 2 files changed, 7 insertions(+), 1 deletion(-) > > > > > > diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c > > > index 26a3a24593..ab812999cd 100644 > > > --- a/libavutil/hwcontext_opencl.c > > > +++ b/libavutil/hwcontext_opencl.c > > > @@ -48,6 +48,7 @@ > > > #if HAVE_OPENCL_VAAPI_INTEL_MEDIA > > > #if CONFIG_LIBMFX > > > #include <mfx/mfxstructures.h> > > > +#include "hwcontext_qsv.h" > > > #endif > > > #include <va/va.h> > > > #include <CL/cl_va_api_media_sharing_intel.h> > > > @@ -2249,7 +2250,7 @@ static int > > > > opencl_map_from_qsv(AVHWFramesContext > > > *dst_fc, AVFrame *dst, > > > #if CONFIG_LIBMFX > > > if (src->format == AV_PIX_FMT_QSV) { > > > mfxFrameSurface1 *mfx_surface = (mfxFrameSurface1*)src->data[3]; > > > - va_surface = *(VASurfaceID*)mfx_surface->Data.MemId; > > > + va_surface = *MFXSURFACEP_TO_VASURFACEP(mfx_surface); > > > } else > > > #endif > > > if (src->format == AV_PIX_FMT_VAAPI) { > > > diff --git a/libavutil/hwcontext_qsv.h b/libavutil/hwcontext_qsv.h > > > index b98d611cfc..957df01ef1 100644 > > > --- a/libavutil/hwcontext_qsv.h > > > +++ b/libavutil/hwcontext_qsv.h > > > @@ -29,6 +29,11 @@ > > > * contain AVBufferRefs whose data pointer points to an > > > > mfxFrameSurface1 > > > struct. > > > */ > > > > > > +#if CONFIG_VAAPI > > > +#define MFXSURFACEP_TO_VASURFACEP(surf) \ > > > + (VASurfaceID*)(((mfxHDLPair*)surf->Data.MemId)->first) > > > +#endif > > > + > > > > Is it possible to remove the dependency on VAAPI in a public qsv header file > > ? > > > > Thanks > > Haihao > > How about moving this to qsv_internal.h? > There is no qsv_internal.h in libavutils. I think we may provide a function using ff_ as prefix to get the internal vaapi/dxva2/d3d11va handle, user may call this function and cast the returned handle to the right type in other hwcontext. If so, we needn't add the dependency on VAAPI in this public header file. Thanks Haihao _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-12-27 5:46 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <20211210053818.3815652-1-wenbin.chen@intel.com> [not found] ` <20211210053818.3815652-2-wenbin.chen@intel.com> 2021-12-24 6:02 ` [FFmpeg-devel] [PATCH V3 2/2] libavutil/hwcontext_opencl: fix a bug for mapping qsv frame to opencl Xiang, Haihao 2021-12-27 3:13 ` Chen, Wenbin 2021-12-27 5:46 ` Xiang, Haihao
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git