dwSoftISP - Is 16bit RGB(A) Tonemapping possible?

I’m trying to dwSoftISP_bindTonemapOutput to produce 16bit RGB outputs. I’m getting DW_INVALID_ARGUMENT

Is it supported? I’m moderately confident of my inputs to the bind function. 8bit seems fine to RGBA or RGB.

rgbaImageProperties.pxlFormat         = DW_IMAGE_RGB;
rgbaImageProperties.pxlType           = DW_TYPE_UINT16;

dwImageCUDA rgbaImage;

... setup memory...

dwSoftISP_bindTonemapOutput(&rgbaImage, pipelineRCCB);

Dear garyxiaopeng,
Can you please share more code snippet to figure out the issue.

Hi garyxiaopeng,

because demosaic images are of type FLOAT16, after being tonemapped, if UINT8 is not selected, then they will remain FLOAT16, so if you replace UINT16 with FLOA16 it should work, unless the INVALID_ARGUMENT comes from somewhere else. Please try and let us know. If it still fails, please provide more code

@mxhani, Thanks FLOAT16 works. However, this is not what I’d prefer because it is not supported by ROS or OPENCV so I’d need to convert it manually to UINT16. But if this needs to be done, your tip puts me closer. Thanks.

@SivaRamaKrishna - a minimal test case can be build by starting with the sample_camera_gmsl_raw main.cpp (v0.67) and applying the following 4 line change:

@@ -380,16 +381,17 @@ void runNvMedia_pipeline(WindowBase *window, dwRendererHandle_t renderer, dwSens
 
     //RGBA image to display
     rgbaImageProperties.pxlFormat         = DW_IMAGE_RGBA;
-    rgbaImageProperties.pxlType           = DW_TYPE_UINT8;
+    rgbaImageProperties.pxlType           = DW_TYPE_UINT16;
     rgbaImageProperties.planeCount        = 1;
     dwImageCUDA rgbaImage;
     rgbaImage.prop = rgbaImageProperties,
     rgbaImage.layout = DW_IMAGE_CUDA_PITCH;
 
     cudaMallocPitch(&rgbaImage.dptr[0], &rgbaImage.pitch[0],
-                    rgbaImageProperties.width * dwSizeOf(DW_TYPE_UINT8) * 4, rgbaImageProperties.height);
+                    rgbaImageProperties.width * dwSizeOf(DW_TYPE_UINT16) * 4, rgbaImageProperties.height);
 
-    dwSoftISP_bindTonemapOutput(&rgbaImage, pipelineRCCB);
+    result = dwSoftISP_bindTonemapOutput(&rgbaImage, pipelineRCCB);
+    std::cerr << "dwSoftISP_bindTonemapOutput: " << dwGetStatusName(result) << std::endl;
 
     dwImageFormatConverterHandle_t convert2RGBA = DW_NULL_HANDLE;
     // for RCCB to format converter converts from already Debayered RCB to RGBA

This gives DW_INVALID_ARGUMENT

It seems according to @mxhani that the simple answer is that UINT16 is not currently supported as an dwSoftISP output type but his suggestion may be a workaround.