1

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?

Manish Kumar
  • 1,419
  • 3
  • 17
  • 36

1 Answers1

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)

sMiLo
  • 463
  • 6
  • 10