Encoding and Decoding a single color channel that has 10-bit data

Hi,

I am trying to Encode and then Decode a texture that has 10-bit data in one of its channel. From the nVidia CUDA driver api docs, it seems like only the following DXGI formats are supported to be registered as a pCudaResource
> * DXGI_FORMAT_A8_UNORM
> * DXGI_FORMAT_B8G8R8A8_UNORM
> * DXGI_FORMAT_B8G8R8X8_UNORM
> * DXGI_FORMAT_R16_FLOAT
> * DXGI_FORMAT_R16G16B16A16_{FLOAT,SINT,SNORM,UINT,UNORM}
> * DXGI_FORMAT_R16G16_{FLOAT,SINT,SNORM,UINT,UNORM}
> * DXGI_FORMAT_R16_{SINT,SNORM,UINT,UNORM}
> * DXGI_FORMAT_R32_FLOAT
> * DXGI_FORMAT_R32G32B32A32_{FLOAT,SINT,UINT}
> * DXGI_FORMAT_R32G32_{FLOAT,SINT,UINT}
> * DXGI_FORMAT_R32_{SINT,UINT}
> * DXGI_FORMAT_R8G8B8A8_{SINT,SNORM,UINT,UNORM,UNORM_SRGB}
> * DXGI_FORMAT_R8G8_{SINT,SNORM,UINT,UNORM}
> * DXGI_FORMAT_R8_{SINT,SNORM,UINT,UNORM}

However, I am unable to find an appropriate NV_ENC_BUFFER_FORMAT for the same. (https://ffmpeg.org/doxygen/3.4/group__ENCODER__STRUCTURE.html#gga5296ed4856e3dc7591ab22e7ce74cef0a8c9054018127883914beb10888e2c760)

Any Ideas on how I can encode and decode the texture?

So, did you mean: How to convert from one bit packed format DXGI_FORMAT_ to another format NV_ENC_BUFFER_FORMAT_ ?
Write your own CUDA kernel or use prepared conversion kernels with NPP API - especially functions for converting bit depth without scaling.

1 Like

Thanks.! Writing a custom kernel for the conversion did the trick! :D