PowerShot SX220 HS - Porting Thread - page 5 - General Discussion and Assistance - CHDK Forum supplierdeeply

PowerShot SX220 HS - Porting Thread

  • 563 Replies
  • 152569 Views
*

Offline funnel

  • ****
  • 349
Re: PowerShot SX220 & SX230 HS - Porting Thread
« Reply #40 on: 04 / May / 2011, 03:07:53 »
Advertisements
Hi.
I'm trying to figure out the DNG creation problem I'm having. Can somebody give me a hint for what should I look for to solve this. Is this a cfapattern issue, colormatrix or something else? When I convert the raw crw file from the camera with rawconvert.c 12to8 I get a nice grayscale picture.

Thank you.

*

Online philmoz

  • *****
  • 3325
    • Photos
Re: PowerShot SX220 & SX230 HS - Porting Thread
« Reply #41 on: 04 / May / 2011, 06:27:13 »
Hi.
I'm trying to figure out the DNG creation problem I'm having. Can somebody give me a hint for what should I look for to solve this. Is this a cfapattern issue, colormatrix or something else? When I convert the raw crw file from the camera with rawconvert.c 12to8 I get a nice grayscale picture.

Thank you.

That looks like what you get if the RAW buffer address is wrong.

Given the newness of the camera and the fact that it has 128MB of RAM I'd guess it has two (or more) RAW buffers.

You will need to find the other buffer(s) and the switch to determine the active one - see the G12 & SX30 ports of lib.c for examples.

If this is the case it will also allow you to implement 'hook_alt_raw_image_addr' to make use of the double buffer when saving DNG images to speed things up.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

*

Offline funnel

  • ****
  • 349
Re: PowerShot SX220 & SX230 HS - Porting Thread
« Reply #42 on: 04 / May / 2011, 07:44:27 »
« Last Edit: 04 / May / 2011, 07:59:41 by funnel »

*

Offline funnel

  • ****
  • 349
Re: PowerShot SX220 & SX230 HS - Porting Thread
« Reply #43 on: 04 / May / 2011, 08:23:49 »
I uploaded the latest source here:
http://www.zshare.net/download/89768742e4dcb349/

and the binary with FI2 with some new fixes.
http://www.zshare.net/download/89768895bc3f4912/


*

Online philmoz

  • *****
  • 3325
    • Photos
Re: PowerShot SX220 & SX230 HS - Porting Thread
« Reply #44 on: 04 / May / 2011, 09:17:12 »
I uploaded the latest source here:
http://www.zshare.net/download/89768742e4dcb349/

and the binary with FI2 with some new fixes.
http://www.zshare.net/download/89768895bc3f4912/


One possible issue is that the DNG active area width is smaller than the CAM_JPEG_WIDTH value.
Your active area width is CAM_ACTIVE_AREA_X2 - CAM_ACTIVE_AREA_X1 = 3872; but your CAM_JPEG_WIDTH is 4000.

I don't know if this would cause the problem you are seeing; but it will probably result in a 'corrupt' DNG file. What software are you using to display the DNG files?

Try setting CAM_ACTIVE_AREA_X1 and Y1 to 0 and then set X2 and Y2 to the raw image dimensions. This way when you do get a DNG file loaded you can examine it to determine the correct values to define the active area.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

*

Offline funnel

  • ****
  • 349
Re: PowerShot SX220 & SX230 HS - Porting Thread
« Reply #45 on: 04 / May / 2011, 10:33:41 »
Thank you. I didn't even notice that error. But fixing that still didn't solve the problem. Any other idea?

The software is Photoshop, IrfanView, UfRaw and Raw Therapee. 

*

Offline funnel

  • ****
  • 349
Re: PowerShot SX220 & SX230 HS - Porting Thread
« Reply #46 on: 04 / May / 2011, 11:04:52 »
Now I tried to delete the header from the DNG (38400 bytes) and then converted the file with rawconvert from 12 to 8 bits and I get an ugly grayscale picture which is good. At least I know now that the problem is somewhere in the header data.
Is it normal to be so much data in the header?

*

Online philmoz

  • *****
  • 3325
    • Photos
Re: PowerShot SX220 & SX230 HS - Porting Thread
« Reply #47 on: 04 / May / 2011, 16:03:47 »
Now I tried to delete the header from the DNG (38400 bytes) and then converted the file with rawconvert from 12 to 8 bits and I get an ugly grayscale picture which is good. At least I know now that the problem is somewhere in the header data.
Is it normal to be so much data in the header?

Yes, the thumbnail image in the DNG header is 128x96x3 bytes (36,864).
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)


*

Offline funnel

  • ****
  • 349
Re: PowerShot SX220 & SX230 HS - Porting Thread
« Reply #48 on: 06 / May / 2011, 08:52:35 »
Hi. I found the reason why the DNGs aren't displayed correctly but I don't have a complete solution yet.

The problem is in this line in dng.c

Quote

struct dir_entry IFD1[]={
 {0xFE,   T_LONG,      1,  0},       // NewSubFileType: Main Image
 {0x100,  T_LONG,      1,  CAM_RAW_ROWPIX},   // ImageWidth
 {0x101,  T_LONG,      1,  CAM_RAW_ROWS},   // ImageLength
 {0x102,  T_SHORT,     1,  CAM_SENSOR_BITS_PER_PIXEL},   // BitsPerSample
 {0x103,  T_SHORT,     1,  1},   // Compression: Uncompressed
 {0x106,  T_SHORT,     1,  0x8023}, //PhotometricInterpretation: CFA
 {0x111,  T_LONG,      1,  0}, //StripOffsets: Offset
 {0x115,  T_SHORT,     1,  1}, // SamplesPerPixel: 1
 {0x116,  T_SHORT,     1,  CAM_RAW_ROWS}, //RowsPerStrip
 {0x117,  T_LONG,      1,  CAM_RAW_ROWPIX*CAM_RAW_ROWS*CAM_SENSOR_BITS_PER_PIXEL/8}, // StripByteCounts = CHDK RAW size
 {0x11A,  T_RATIONAL,  1,  (int)cam_Resolution}, // XResolution
 {0x11B,  T_RATIONAL,  1,  (int)cam_Resolution}, // YResolution
 {0x11C,  T_SHORT,     1,  1}, // PlanarConfiguration: 1
 {0x128,  T_SHORT,     1,  2}, // ResolutionUnit: inch


 {0x828D, T_SHORT,     2,  0x00020002},  <-----here     CFARepeatPatternDim: Rows = 2, Cols = 2


 {0x828E, T_BYTE,      4,  cam_CFAPattern},
 {0xC61A, T_LONG,      1,  CAM_BLACK_LEVEL}, // BlackLevel
 {0xC61D, T_LONG,      1,  CAM_WHITE_LEVEL}, // WhiteLevel
 {0xC61F, T_LONG,      2,  (int)cam_DefaultCropOrigin},
 {0xC620, T_LONG,      2,  (int)cam_DefaultCropSize},
 {0xC68D, T_LONG,      4,  (int)cam_ActiveArea},
 {0}
};


If I change 0x00020002 to cam_CFAPattern I get the picure but for now is all in violet colors.

What is that value used for? Can I change it?

If I open the thumbnail alone it has the right colors with the same cfapattern.

*

Offline funnel

  • ****
  • 349
Re: PowerShot SX220 & SX230 HS - Porting Thread
« Reply #49 on: 06 / May / 2011, 11:31:09 »
Yes. I found that the value 0x00030003 gives me a perfect picture. This means 3 rows 3 cols I guess. Photoshop doesn't want to open it but Raw Therapee and IrfanView open them without problem.

 

Related Topics