libraw_rawdata_t not being populated with C API

While working with the C API, I found some behaviour that I think is probably user error (my error) but might be a bug, and if it is my error, I would like to know how to fix it.

Looking at the documentation, after calling libraw_unpack() I expect the libraw_rawdata_t structure to be populated with the raw data.

This is partially what is happening, libraw_rawdata_t.raw_image[] is populated with the raw bayer data, the data in the structure appears to be correct, and I can successfully demosaic it into a proper image.

However the documentation would lead me to believe that ONE OF color3_image, color4_image, float3_image, or float4_image should be populated with data, whereas I have observed them all to be NULL

Please let me know if this is the intended behaviour, or if there is a function I can call to populate one of those structures. I also supposed that this could be a C++ only feature, and not part of the C API

Of course I could always process the raw_image into separate channels myself, but I would prefer to use a function built into the API if available.

I have tried using version 0.20.2 and 0.21 RC2 compiled from source on windows msys2/mingw64 and using raw files from different manufacturers and cameras (Nikon d800, SONY ILCE-1)

 
int main(void)
{
 
    libraw_data_t* libRaw = libraw_init(0);
    libraw_open_file(libRaw, "../images/_DSC5864.ARW");
    libraw_unpack(libRaw);
 
    // libRaw->rawdata.
    // libRaw->rawdata.color3_image, (and color4, float etc.) are all NULL
 
}

thanks for the help

Forums: 

C-API is just a thin layer

C-API is just a thin layer over C++ API, so no difference here.

Based on your source code (w/ built-in filename) I assume you use normal/unaltered bayer-pattern Sony-produced image.
For such images, decoded data is in libRaw->rawdata.raw_image

-- Alex Tutubalin @LibRaw LLC

From the documentation (which

From the documentation (which can be sometimes confusing, I agree): "After call to unpack() only one of *_image fields is non-NULL."

Solved

Thank you for the clarification, I was confused by the documentation, but now I understand.