ENCODE -> DECODE with CUDA

Hi,

I’m new on the Video Codec SDK, and I need some help for porting an C++ - Application
which works on OpenCL with AMD-GPU to NVidia.

I have an image already in a cuda memory (buffer A) and I need to encode and decode it with HEVC.
At the end I need the compressed data as I-frame and the decoded image in the same cuda memory (buffer A).

The Image is organized with first the entire R-Layer, followed by the data of the G-Layer, and than the B-Layer, and every layer has a size of 4912x4912 (8-bit).

I think I must do the following steps:

  • allocate a buffer B for BGRA representation

  • allocate a buffer C for the compressed data

  • Convert R-G-B Layers in buffer A to BGRA with a cuda kernel to buffer B

  • encode the buffer B to buffer C

  • decode the buffer C to buffer B

  • Convert BGRA-Image in buffer B to R-G-B Layers with a cuda kernel to the buffer A

  • download Buffer C from device memory and save it on disk

  • execute some kernel on the Buffer C

A dynamic memory managment isn’t needed, but it would be fine, if I can run 20 jobs in parallel.

Can everyone help me, or has a sample that I can use for starting ?