Processing Fuji raw_image

By code to process the raw_image array looks like this:

#define RAW(row,col) \
	RawData.raw_image[(row)*S.raw_width+(col)]
 
for (row = 0; row < S.height; row++)
{
	for (col = 0; col < S.width; col++)
	{
           unsigned short val = 
              RAW(row + S.top_margin, col + S.left_margin);
           // etc ...
        }
}

This works very well for Canon raw images, but totally falls apart when processing a Fuji RAF file from an S5-Pro.

Loioking at the values in rawdata.sizes I see:

  raw_height   1444
  raw_width    4352
  height       3583
  width        3584
  top_margin      2
  left_margin    32
  iheight      3583
  iwidth       3584
  raw_pitch    8704

How should I check if this for a Fuji raw, and how should I iterate and process this data to end up with the 3583/3584 image with the actual image diagonally across it?

Thanks

Forums: 

Yes, Fuji Super-CCD is

Yes, Fuji Super-CCD is completely different.
Look into raw2image_ex() source for details.

BTW, today, in 2019, it is good enough idea to drop Super-CCD support.

-- Alex Tutubalin @LibRaw LLC

Please don't drop Fujitsu

Please don't drop Fujitsu Super-CCD support, if that's done, people who use my software won't be able to reprocess old images (which the astrophotography folks often do).

I'll take a look at raw2image_ex() to see I can understand it.

Dave

David Partridge

Just to be sure, can you

Just to be sure, can you confirm that the code at line 2783 in libraw_cxx.cpp is the relevant code?

Thanks

David Partridge

I do not know what exact

I do not know what exact version you use. Could you please use github URLs with #l[lineno] markers in URL to point to exact version/exact line.

-- Alex Tutubalin @LibRaw LLC

I couldn't locate the exact

I couldn't locate the exact version I'm using in github (I'm using version 18.8) The code in question reads as follows:

    // Move saved bitmap to imgdata.image
    if( imgdata.idata.filters || P1.colors == 1)
      {
        if (IO.fuji_width) {
          unsigned r,c;
          int row,col;
          for (row=0; row < S.raw_height-S.top_margin*2; row++) {
            for (col=0; col < IO.fuji_width << !libraw_internal_data.unpacker_data.fuji_layout; col++) {
              if (libraw_internal_data.unpacker_data.fuji_layout) {
                r = IO.fuji_width - 1 - col + (row >> 1);
                c = col + ((row+1) >> 1);
              } else {
                r = IO.fuji_width - 1 + row - (col >> 1);
                c = row + ((col+1) >> 1);
              }
              if (r < S.height && c < S.width)
                imgdata.image[((r)>>IO.shrink)*S.iwidth+((c)>>IO.shrink)][FC(r,c)]
                  = imgdata.rawdata.raw_image[(row+S.top_margin)*S.raw_pitch/2+(col+S.left_margin)];
            }
          }
        }

David Partridge

Is there a getter for libraw

Is there a getter for libraw_internal_data.unpacker_data.fuji_layout or will I need to sub-class to get at that?

I found is_fuji_rotated() which returns libraw_internal_data.internal_output_params.fuji_width

Thanks

David Partridge

We do not have any plans to

We do not have any plans to drop SuperCCD support:
- raw data is extracted as is (in two subframes), keeping sensor aspect ratio
- processing is adopted from dcraw

Also, we do not have any plans to improve processing part, our goal is raw data and metadata extraction.

-- Alex Tutubalin @LibRaw LLC