Changing image format of a Directx acquired surface in opencl

感情迁移 提交于 2019-12-13 02:15:00

问题


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);

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

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?


回答1:


You can convert from NV12 to RGBA using Intel OpenCL SDK. (https://software.intel.com/en-us/intel-opencl)

Sample code is here. (https://github.com/ChiahungTai/OpenCL-playgorund/tree/master/intel/ResourceSharing/DXVASurfaceSharing)



来源:https://stackoverflow.com/questions/32111760/changing-image-format-of-a-directx-acquired-surface-in-opencl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!