summaryrefslogtreecommitdiff
path: root/libavutil/hwcontext_d3d11va.c
Commit message (Collapse)AuthorAgeFilesLines
* hwcontext_d3d11va: add mutiple supported DXGI formatsTong Wu2023-02-221-0/+7
| | | | | | | | | | | | Add support for VUYX, YUYV422, Y210, XV30, P012, Y212, XV36. The added formats work with qsv acceleration and will not have impact on d3d11va acceleration(-hwaccel d3d11va) since so far these formats are still not supported by using d3d11va acceleration. Hwupload and hwdownload can work with the added formats. Signed-off-by: Tong Wu <tong1.wu@intel.com>
* avutil/hwcontext_d3d11va: add support for rgbaf16 pixel formatTimo Rothenpieler2022-08-131-0/+1
|
* avutil/hwcontext_d3d11va: add BGRA/RGBA10 formats supportTimo Rothenpieler2022-07-181-0/+2
| | | | Desktop duplication outputs those
* avutil/hwcontext_d3d11va: update hwctx flags from input textureTimo Rothenpieler2022-07-181-0/+4
| | | | At least QSV relies on those being set correctly when deriving a hwctx.
* avutil/hwcontext_d3d11va: fix texture_infos writes on non-fixed-size poolsTimo Rothenpieler2022-07-181-1/+12
|
* avutil/hwcontext_d3d11va: fix mixed declaration and codeTimo Rothenpieler2022-07-181-1/+2
|
* avutil/hwcontext_d3d11va: pass the format value from outside for staging textureTong Wu2022-05-231-3/+4
| | | | | | | | | | | | | | | | In d3d11va_create_staging_texture(), during the hwmap process, the ctx->internal->priv is not initialized, resulting in the texDesc.Format not initialized. Now pass the format value from d3d11va_transfer_data() to fix it. $ ffmpeg.exe -y -hwaccel qsv -init_hw_device d3d11va=d3d11 \ -init_hw_device qsv=qsv@d3d11 -c:v h264_qsv \ -i input.h264 -vf "hwmap=derive_device=d3d11va,format=d3d11,hwdownload,format=nv12" \ -f null - Reviewed-by: Soft Works <softworkz@hotmail.com> Signed-off-by: Tong Wu <tong1.wu@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* Replace all occurences of av_mallocz_array() by av_calloc()Andreas Rheinhardt2021-09-201-1/+1
| | | | | | | They do the same. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* libavutil/hwcontext_d3d11va: adding more texture information to the D3D11 ↵Artem Galin2021-09-081-5/+19
| | | | | | | | | | | | hwcontext API Microsoft VideoProcessor requires texture with D3DUSAGE_RENDERTARGET flag as output. There is no way to allocate array of textures with D3D11_BIND_RENDER_TARGET flag and .ArraySize > 2 by ID3D11Device_CreateTexture2D due to the Microsoft limitation. Adding AVD3D11FrameDescriptors array to store array of single textures instead of texture with multiple slices resolves this. Signed-off-by: Artem Galin <artem.galin@intel.com>
* avutil/buffer: Switch AVBuffer API to size_tAndreas Rheinhardt2021-04-271-1/+1
| | | | | | | Announced in 14040a1d913794d9a3fd6406a6d8c2f0e37e0062. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avutil: use the buffer_size_t typedef where requiredJames Almer2021-03-101-1/+1
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/hwcontext_d3d11va: Use secure dlopen.Matt Oliver2020-02-151-2/+3
| | | | dlopen contains additional security to prevent dll hijacking compared to standard LoadLibrary.
* lavu/hwcontext_d3d: Cast src pointers calling av_image_copy*().Carl Eugen Hoyos2019-04-191-2/+2
| | | | | | | | Silences several warnings: libavutil/hwcontext_d3d11va.c:413:49: warning: passing argument 3 of ‘av_image_copy’ from incompatible pointer type libavutil/hwcontext_d3d11va.c:425:47: warning: passing argument 3 of ‘av_image_copy’ from incompatible pointer type libavutil/hwcontext_dxva2.c:351:45: warning: passing argument 3 of ‘av_image_copy’ from incompatible pointer type libavutil/hwcontext_dxva2.c:382:52: warning: passing argument 3 of ‘av_image_copy_uc_from’ from incompatible pointer type
* avutil/hwcontext_d3d11va: fix type arguments passed to IDXGIAdapter2_GetDesc()James Almer2018-07-251-1/+1
| | | | | | | | | | | libavutil/hwcontext_d3d11va.c: In function 'd3d11va_device_create': libavutil/hwcontext_d3d11va.c:554:46: warning: passing argument 2 of 'pAdapter->lpVtbl->GetDesc' from incompatible pointer type [-Wincompatible-pointer-types] hr = IDXGIAdapter2_GetDesc(pAdapter, &desc); ^ libavutil/hwcontext_d3d11va.c:554:46: note: expected 'DXGI_ADAPTER_DESC * {aka struct DXGI_ADAPTER_DESC *}' but argument is of type 'DXGI_ADAPTER_DESC2 * {aka struct DXGI_ADAPTER_DESC2 *}' Reviewed-by: Jean-Baptiste Kempf <jb@videolan.org> Signed-off-by: James Almer <jamrial@gmail.com>
* Merge commit '8f144d9e3d5cb2ca92e5bdf7cc9f72effa1bd2ce'James Almer2018-04-131-8/+1
|\ | | | | | | | | | | | | * commit '8f144d9e3d5cb2ca92e5bdf7cc9f72effa1bd2ce': Drop Windows XP support remnants Merged-by: James Almer <jamrial@gmail.com>
| * Drop Windows XP support remnantsDiego Biurrun2018-04-091-8/+1
| |
| * d3d11va: Check WINAPI_FAMILY instead of HAVE_LOADLIBRARYMartin Storsjö2017-07-051-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | If using the winstore compat library, a fallback LoadLibrary function does exist, that only calls LoadPackagedLibrary though (which doesn't work for dynamically loading d3d11 DLLs). Therefore explicitly check the targeted API family instead. Make this check a reusable HAVE_* component which other parts of the libraries can check when necessary as well. Signed-off-by: Martin Storsjö <martin@martin.st>
| * hwcontext_d3d11va: add option to enable debug modewm42017-06-271-0/+32
| | | | | | | | | | | | | | | | | | Basically copied from VLC (LGPL): http://git.videolan.org/?p=vlc.git;a=blob;f=modules/video_output/win32/direct3d11.c;h=e9fcb83dcabfe778f26e63d19f218caf06a7c3ae;hb=HEAD#l1482 http://git.videolan.org/?p=vlc.git;a=blob;f=modules/codec/avcodec/d3d11va.c;h=85e7d25caebc059a9770da2ef4bb8fe90816d76d;hb=HEAD#l599 Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
| * dxva: support DXGI_FORMAT_420_OPAQUE decodingwm42017-06-271-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | Some devices (some phones, apparently) will support only this opaque format. Of course this won't work with CLI, because copying data directly is not supported. Automatic frame allocation (setting AVCodecContext.hw_device_ctx) does not support this mode, even if it's the only supported mode. But since opaque surfaces are generally less useful, that's probably ok. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
| * hwcontext_d3d11va: allocate staging texture lazilywm42017-06-271-12/+34
| | | | | | | | | | | | | | | | Makes dealing with formats that can not be used for staging textures easier (DXGI_FORMAT_420_OPAQUE). It also saves memory if the staging texture is never needed, so this is a good thing. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
| * hwcontext_d3d11va: fix crash on frames_init failurewm42017-06-271-0/+2
| | | | | | | | | | | | | | It appears in this case, frames_ininit is called twice (once by av_hwframe_ctx_init(), and again by unreffing the frames ctx ref). Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
| * d3d11va: Link directly to dxgi.dll and d3d11.dll functions if LoadLibrary is ↵Martin Storsjö2017-06-181-33/+47
| | | | | | | | | | | | | | | | | | | | | | unavailable When targeting the UWP API subset, the LoadLibrary function is not available (and the fallback, LoadPackagedLibrary, can't be used to load system DLLs). In these cases, link directly to the functions in the DLLs instead of trying to load them dynamically at runtime. Signed-off-by: Martin Storsjö <martin@martin.st>
| * lavu: add new D3D11 pixfmt and hwcontextwm42017-06-081-0/+490
| | | | | | | | | | | | | | | | | | | | To be used with the new d3d11 hwaccel decode API. With the new hwaccel API, we don't want surfaces to depend on the decoder (other than the required dimension and format). The old D3D11VA pixfmt uses ID3D11VideoDecoderOutputView pointers, which include the decoder configuration, and thus is incompatible with the new hwaccel API. This patch introduces AV_PIX_FMT_D3D11, which uses ID3D11Texture2D and an index. It's simpler and compatible with the new hwaccel API. The introduced hwcontext supports only the new pixfmt. Frame upload code untested. Significantly based on work by Steve Lhomme <robux4@gmail.com>, but with heavy changes/rewrites. Signed-off-by: Diego Biurrun <diego@biurrun.de>
* hwcontext_d3d11: Fix crash with valid adapter but no deviceMark Thompson2018-03-281-3/+5
| | | | | | | | | | This crash was introduced by 8bbf2dacbfb4ead1535dea411035994f507f517d, which could incorrectly overwrite the failure result from creating the device. Fixes ticket #7108. Reviewed-by: wm4 <nfxjfg@googlemail.com>
* hwcontext_d3d11va: implement av_hwdevice_get_hwframe_constraints()wm42018-01-161-0/+33
| | | | | | | D3D11 has rather fine grained per format capabilities for different uses that can be queried at runtime. Since we don't know what the user wants to do with the formats when av_hwdevice_get_hwframe_constraints() is called, we simply return all formats that have the most basic support.
* hwcontext_d3d11va: properly reset values after release/closeJan Ekström2017-11-251-5/+16
| | | | | | | | Makes the uninit function re-entrable, which can be a common case when an API user first tries to initialize its context, fails, and then finally unrefs the AVHWDevice. Fixes a crash reported by sm2345 on IRC.
* hwcontext_d3d11: Log adapter details on device creationMark Thompson2017-11-251-1/+8
| | | | This is helpful to know what device has actually been used.
* avutil/hwcontext_d3d11va: Fix leak when wrapping texture in ↵Greg Wessels2017-11-071-0/+1
| | | | | | | AVD3D11FrameDescriptor Reviewed-by: Aaron Levinson <alevinsn_dev@levland.net> Signed-off-by: James Almer <jamrial@gmail.com>
* d3d11va: Check WINAPI_FAMILY instead of HAVE_LOADLIBRARYMartin Storsjö2017-08-101-3/+3
| | | | | | | | | | | | | | | If using the winstore compat library, a fallback LoadLibrary function does exist, that only calls LoadPackagedLibrary though (which doesn't work for dynamically loading d3d11 DLLs). Therefore explicitly check the targeted API family instead. Make this check a reusable HAVE_* component which other parts of the libraries can check when necessary as well. Signed-off-by: Martin Storsjö <martin@martin.st> Merged from Libav commit 4d330da006fe48178.
* hwcontext_d3d11va: use correct license headerHendrik Leppkes2017-06-281-4/+4
|
* hwcontext_d3d11va: add option to enable debug modewm42017-06-271-0/+32
| | | | | | | | | | | Basically copied from VLC (LGPL): http://git.videolan.org/?p=vlc.git;a=blob;f=modules/video_output/win32/direct3d11.c;h=e9fcb83dcabfe778f26e63d19f218caf06a7c3ae;hb=HEAD#l1482 http://git.videolan.org/?p=vlc.git;a=blob;f=modules/codec/avcodec/d3d11va.c;h=85e7d25caebc059a9770da2ef4bb8fe90816d76d;hb=HEAD#l599 Merges Libav commit cfc9e7c94eafa33e7f109099664ec4fb57ac5ca3. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* dxva: support DXGI_FORMAT_420_OPAQUE decodingwm42017-06-271-2/+10
| | | | | | | | | | | | | | Some devices (some phones, apparently) will support only this opaque format. Of course this won't work with CLI, because copying data directly is not supported. Automatic frame allocation (setting AVCodecContext.hw_device_ctx) does not support this mode, even if it's the only supported mode. But since opaque surfaces are generally less useful, that's probably ok. Merges Libav commit 5030e3856c2126fb829edb828f5aae011d178eb4. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* hwcontext_d3d11va: allocate staging texture lazilywm42017-06-271-12/+34
| | | | | | | | | | Makes dealing with formats that can not be used for staging textures easier (DXGI_FORMAT_420_OPAQUE). It also saves memory if the staging texture is never needed, so this is a good thing. Merges Libav commit 98d73e4174333b37d961b79e1182be5a02156c02. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* hwcontext_d3d11va: fix crash on frames_init failurewm42017-06-271-0/+2
| | | | | | | | | It appears in this case, frames_ininit is called twice (once by av_hwframe_ctx_init(), and again by unreffing the frames ctx ref). Merges Libav commit 086321c612185469ebb85a1887527c8915b488b7. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* d3d11va: Link directly to dxgi.dll and d3d11.dll functions if LoadLibrary is ↵Martin Storsjö2017-06-271-33/+47
| | | | | | | | | | | | | unavailable When targeting the UWP API subset, the LoadLibrary function is not available (and the fallback, LoadPackagedLibrary, can't be used to load system DLLs). In these cases, link directly to the functions in the DLLs instead of trying to load them dynamically at runtime. Merges Libav commit fd1ffa1f10e940165035ccb79d4a6523da196062. Signed-off-by: Martin Storsjö <martin@martin.st>
* lavu: add new D3D11 pixfmt and hwcontextwm42017-06-271-0/+490
To be used with the new d3d11 hwaccel decode API. With the new hwaccel API, we don't want surfaces to depend on the decoder (other than the required dimension and format). The old D3D11VA pixfmt uses ID3D11VideoDecoderOutputView pointers, which include the decoder configuration, and thus is incompatible with the new hwaccel API. This patch introduces AV_PIX_FMT_D3D11, which uses ID3D11Texture2D and an index. It's simpler and compatible with the new hwaccel API. The introduced hwcontext supports only the new pixfmt. Frame upload code untested. Significantly based on work by Steve Lhomme <robux4@gmail.com>, but with heavy changes/rewrites. Merges Libav commit fff90422d181744cd75dbf011687ee7095f02875. Signed-off-by: Diego Biurrun <diego@biurrun.de>