如何使用硬件视频缩放器? [英] How to use hardware video scalers?

查看:451
本文介绍了如何使用硬件视频缩放器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现代显卡拥有硬件视频缩放器,例如AMD Avivo,NVIDIA PureVideo或Intel ClearVideo的一部分。例如,AMD的 Avivo白皮书说:

Modern graphics cards have hardware video scalers, for example as part of AMD Avivo, NVIDIA PureVideo or Intel ClearVideo. For example, AMD's Avivo whitepaper says:


图像输出缩放器支持最多6个垂直滤波器抽头,最多支持10 b $ b到10个水平滤波器抽头。这些缩放器是高精度
多相高度可编程的缩放器;它们适用于几乎任何比例的
升级,或者适用于最多4:1的降尺寸。

"The image output scalers support up to 6 vertical filter taps and up to 10 horizontal filter taps. These scalers are high-precision polyphase scalers that are highly programmable; they are suitable for upscaling by practically any ratio, or for downscaling by up to 4:1."

问题:如何从Windows程序中使用视频缩放器硬件?

假设已存在已解码的视频帧例如,在 IDirect3DSurface9 中,目标是使用硬件缩放器在屏幕上显示该视频帧。我想使用像Media Foundation或DirectShow这样的Windows API,而不是使用特定于供应商的API。我主要感兴趣的是升级一个相当大的因素大约1.5-3x。

Assume there already exists a decoded video frame, for example in a IDirect3DSurface9, and the goal is to display that video frame on screen using the hardware scaler. I would like to use a Windows API like Media Foundation or DirectShow, rather than vendor-specific APIs if possible. I am mainly interested in upscaling by a fairly large factor around 1.5-3x.

第二个问题是,视频缩放器硬件参数怎么样?被控制? (例如,上面提到的多相滤波器中的滤波器系数)

A secondary question is, how can the video scaler hardware parameters be controlled? (For example, the filter coefficients in the polyphase filters mentioned above)

编辑: Bounty开始了。请提供在视频卡中使用视频缩放器硬件的任何方式的示例(这可能是特定于供应商的,或使用任何版本的DirectX / DirectShow / Media Foundation API)。

Bounty started. Please provide an example of any way to use video scaler hardware in video card (this may be vendor specific, or use any version of DirectX/DirectShow/Media Foundation API).

编辑:更新:使用视频缩放器硬件的程序的一些示例:WinDVD,PowerDVD,madVR。我想知道如何完成他们的工作,即使用GPU的内置视频硬件缩放器,使用D3D着色器和纹理采样器实现的缩放器。

Update: Some examples of programs that do use the video scaler hardware: WinDVD, PowerDVD, madVR. I want to know how to accomplish what they do, which is to use the GPU's builtin video hardware scaler, not a scaler implemented using D3D shaders and texture samplers.

推荐答案

一些可能的方法是:


  1. 使用 MFCreateVideoRenderer 创建EVR媒体接收器,并调用 IMFVideoDisplayControl :: SetRenderingPrefs MFVideoRenderPrefs_AllowScaling 标志设置(或使用 IMFAttributes 并设置 EVRConfig_AllowScaling 属性),然后调用 IMFVideoDisplayControl :: SetVideoPosition 定义结果的缩放方式。这是增强型视频渲染器(EVR)的一部分。

  1. Use MFCreateVideoRenderer to create an EVR media sink, and call IMFVideoDisplayControl::SetRenderingPrefs with MFVideoRenderPrefs_AllowScaling flag set (or use IMFAttributes and set the EVRConfig_AllowScaling attribute) and then call IMFVideoDisplayControl::SetVideoPosition to define how the result is scaled. This is part of the Enhanced Video Renderer (EVR).

使用 IDirectXVideoProcessor :: VideoProcessBlt 并设置 DXVA2_VideoProcessBltParams :: ConstrictionSize 定义结果的缩放方式。这也基于EVR​​ / DXVA。

Use IDirectXVideoProcessor::VideoProcessBlt and set DXVA2_VideoProcessBltParams::ConstrictionSize to define how the result is scaled. This is also based on EVR/DXVA.

(由ananthonline建议)使用 Video Resizer DSP 并使用 IWMResizerProps :: SetFullCropRegion (或 MFPKEY_RESIZE_DST_WIDTH MFPKEY_RESIZE_DST_HEIGHT )以缩放结果。这是DirectX媒体对象(DMO)和媒体基础转换(MFT)。注意:视频MFT的属性为 MF_SA_D3D_AWARE ,可以用来查询它是否支持DirectX 3D硬件加速,这可以通过发送 MFT_MESSAGE_SET_D3D_MANAGER 消息来启用。

(suggested by ananthonline) Use Video Resizer DSP and use IWMResizerProps::SetFullCropRegion (or MFPKEY_RESIZE_DST_WIDTH and MFPKEY_RESIZE_DST_HEIGHT) to scale the result. This is both a DirectX Media Object (DMO) and Media Foundation Transform (MFT). Note: A video MFT has the attribute MF_SA_D3D_AWARE which can be used to query whether it supports DirectX 3D hardware acceleration, and this can be enabled by sending it the MFT_MESSAGE_SET_D3D_MANAGER message.

使用视频处理器MFT 并设置 IMFVideoProcessorControl :: SetConstrictionSize 以缩放结果。这是一个MFT。

Use Video Processor MFT and set IMFVideoProcessorControl::SetConstrictionSize to scale the result. This is a MFT.

使用DirectX 3D设备并调用 StretchRect 来缩放曲面。注意:这显然不使用视频缩放器硬件,它使用纹理采样器硬件。纹理可以在具有类似效果的四边形上呈现。

Use a DirectX 3D device and call StretchRect to scale a surface. Note: this pretty obviously does not use the video scaler hardware, it uses texture sampler hardware. A texture can be rendered on a quad with similar effect.

我仍然不确定哪个(如果有的话)这些方法使用视频缩放器硬件。至少接近1和2可能是因为它们直接与EVR / DXVA联系在一起;方法3和4也可能由DXVA加速。仍然需要一个明确的答案,理想情况下需要参考文档和/或代码示例。

I am still not sure which, if any, of these approaches uses the video scaler hardware. It is likely that at least approaches 1 and 2 would, because they are tied directly to EVR/DXVA; approaches 3 and 4 also might if they are accelerated by DXVA. A definitive answer is still needed, ideally with a reference to documentation and/or a code sample.

这篇关于如何使用硬件视频缩放器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆