2 Star 1 Fork 3

sandman / d3d11_ocl_sharing

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

d3d11_ocl_sharing

Description

用Intel mediasdk2020的sample_decode验证通过ocl扩展cl_khr_d3d11_sharing让opencl和d3d11 texture2D共享frame buffer的方法

Software Architecture

  • VS项目为sample_decode\sample_decode.sln
  • 编译需要用VS2017,并且先安装好Intel MediaSDK, 可以在Intel官网免费下载 还需要安装Intel OpenCL SDK, 可以在Intel官网免费下载
  • 目前编译只设置了x64 debug/Release, 所以只能在x64模式下编译运行(Win32模式需要自己照着x64的项目配置编译和链接参数)
  • 硬件解码方面因为使用了Intel显卡硬解码,所以必须使用有Intel集成显卡的CPU

原演示代码使用Intel QSV硬件解码,解码器输出为DirectX11 NV12 Texture2D,然后将输出的Texture2D转换为RGBA格式并显示在一个窗口里。增加的OpenCL代码修改了一下CD3D11Device::RenderFrame()函数,输出到屏幕流程,在调用VideoProcessorBlt()前,调用SimulateCL(); 通过OpenCL直接修改D3D11 Texture2D的frame buffer(这个buffer是不能通过CPU直接写入的,但是通过ocl kernel可以在GPU侧直接读写)。在屏幕左上角坐标(y=16, x=32)的地方,画一个4848的方块区域,此区域亮度做0~255间的明暗变化;同时在左上角坐标(y=16, x=32), 画一个9696的方块区域,此区域呈灰度显示

Instructions

  1. VS2017 Debug X64调试

    项目选项 Debugging的Command Arguments里设置

    h264 -i test.h264 -hw -d3d11 -r

    项目选项 Debugging的Working Directory里设置

    $(TargetDir)

    将项目里的OpenCLRGBAFile.cl, test.h264 拷贝到VS编译器输出的目录build\win_x64\Debug\bin\下

  2. 在命令行里使用参数运行

    sample_decode.exe h264 -d3d11 -hw -i C:\work\qsv_dec\x64\Debug\jellyfish-120-mbps-4k-uhd-h264.h264 -r

    注意要把OpenCLRGBAFile.cl和要播放的视频文件放在sample_decode.exe相同的目录下,并根据视频文件的编码格式修改参数

MIT License Copyright (c) 2022 sandman Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

用Intel mediasdk2020的sample_decode验证通过ocl扩展cl_khr_d3d11_sharing让opencl和d3d11 texture2D共享frame buffer的方法 展开 收起
C++ 等 2 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
C++
1
https://gitee.com/tisandman/d3d11_ocl_sharing.git
git@gitee.com:tisandman/d3d11_ocl_sharing.git
tisandman
d3d11_ocl_sharing
d3d11_ocl_sharing
master

搜索帮助