LibRaw::COLOR or LibRaw::fcol


What is recommended way to detect color component of the pixel? Documentation points to COLOR function for this purpose, but as far as I understand it does not always work (e.g. FUJI XTRANS sensors). There is fcol function that is used everywhere in LibRaw internally, but it has somewhat different implementation that COLOR for bayer case. What to use?


Fuji X-Trans is so special

Fuji X-Trans is so special and requires different processing in most cases, so COLOR() really used only in bayer processing code, but not in X-Trans.

BTW, this need to be fixed and COLOR() should return correct color even for X-Trans files too. I'll reply to this thread again after pushing fix to github repo.

-- Alex Tutubalin @LibRaw LLC

You may use fcol() instead of

You may use fcol() instead of FC() in COLOR() definition:

    int COLOR(int row, int col) { return libraw_internal_data.internal_output_params.fuji_width? FCF(row,col):fcol(row,col);}

This is not so efficient because fcol() is not inlined, but if you do not use COLOR() for all pixels of image, it will work.

-- Alex Tutubalin @LibRaw LLC

Thank you!

Thank you!