问题描述
我在opencl中工作,从Directx获取媒体表面
I am working in opencl gets a Media surface from Directx
/* Working on NV12 surfaces, associate the shared buffer with the kernel object*/
p->memobj[0] = clCreateFromDX9MediaSurfaceINTEL(p->context, CL_MEM_READ_ONLY, input_D3D_surf, input_D3D_surf_hdl, 0, &error);
p->memobj[1] = clCreateFromDX9MediaSurfaceINTEL(p->context, CL_MEM_READ_ONLY, input_D3D_surf, input_D3D_surf_hdl, 1, &error);
p->memobj[2] = clCreateFromDX9MediaSurfaceINTEL(p->context, CL_MEM_READ_ONLY, input_D3D_surf, input_D3D_surf_hdl, 0, &error);
p->memobj[3] = clCreateFromDX9MediaSurfaceINTEL(p->context, CL_MEM_READ_ONLY, input_D3D_surf, input_D3D_surf_hdl, 1, &error);
cl_mem surfaces[4];
surfaces[0] = p->memobj[0];
surfaces[1] = p->memobj[1];
surfaces[2] = p->memobj[2];
surfaces[3] = p->memobj[3];
error = clEnqueueAcquireDX9ObjectsINTEL(p->command_queue, 4, surfaces, 0, NULL, NULL);
媒体表面具有以下指定的NV12格式,并且此处
The media surface has NV12 format as specified below and here
MAKEFOURCC(?N?,?V?,?1?,?2?),Plane0 CL_R CL_UNORM_INT8
MAKEFOURCC(?N?,?V?,?1?,?2?),Plane1 CL_RG CL_UNORM_INT8
我想将opencl对象的平面0的图像格式(分别表示surface [0]和surface [2])更改为CL_RGBA.有什么办法吗?
I want to change the image format of plane 0 (means surface[0] and surface[2])of opencl object to CL_RGBA.Is there any way I can do this?
推荐答案
您可以使用Intel OpenCL SDK将NV12转换为RGBA. ( https://software.intel.com/en-us/intel-opencl)
You can convert from NV12 to RGBA using Intel OpenCL SDK. (https://software.intel.com/en-us/intel-opencl)
示例代码在这里. ( https://github.com/ChiahungTai/OpenCL-playgorund/树/master/intel/ResourceSharing/DXVASurfaceSharing )
Sample code is here. (https://github.com/ChiahungTai/OpenCL-playgorund/tree/master/intel/ResourceSharing/DXVASurfaceSharing)
这篇关于在opencl中更改Directx获取的曲面的图像格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!