DNG colors etc (was: Adding new cameras, applying patches into trunk (with source code prepared - General Discussion and Assistance - CHDK Forum

DNG colors etc (was: Adding new cameras, applying patches into trunk (with source code prepared

  • 12 Replies
  • 13257 Views
*

Offline quid

  • **
  • 67
  • SX130IS
Advertisements
Moderator edit: this was split from this thread: http://chdk.setepontos.com/index.php?topic=650.msg60887#msg60887

@Lebeau:
I've applied your patch on my SX130 port, and there is a problem with DNG files. Preview image is totally unreadable, and DNG image has a strong yellow/green tint (even more than in standard RAW file). Example in attached file.

Also, I've tried to measure effects of speed optimization in RAW and DNG processing, and I don't see any improvements in this area. Average saving time is same as before.
« Last Edit: 12 / February / 2011, 05:29:28 by fudgey »

*

Offline Lebeau

  • ***
  • 187
Bonjour quid,

Concerning the thumbnail, I correct it, I am sorry and I thank you.

Concerning the DNG coloration, I would be please to better understand what is wrong with it. On my Powershots (A480, A590 and A650),  I never used dng, nor raw through dng4ps2, since I had coloration problem. The only time I have fewer was after I calibrate through dng4ps2, not perfect but better.

My coloration problem tends toward greenich. It depends of some matrixes (AB, CC, CM and FM). DNG4PS2 work hard to fix it and CHDK dng would be fix someday. For now I use Adobe Camera Profile for G9 since it's equivalent to my A650 but would find an aesthetic solution !)

*

Offline quid

  • **
  • 67
  • SX130IS
I think I've found a bug: For some reason, white balance (Exif field "AsShotNeutral") is not updated with correct value. If you want, I can send you two similar pictures, so you can compare Exif values.

// edit: AsShotBalance -> AsShotNeutral
« Last Edit: 08 / February / 2011, 17:22:58 by quid »

*

Offline Lebeau

  • ***
  • 187
Bonjour quid,

In dng code, we have:
Code: [Select]
const int cam_AnalogBalance [ ] = { 1, 1, 1, 1, 1, 1 };
int cam_AsShotNeutral [ ] = { 1000, 1000, 1000, 1000, 1000, 1000 };
AsShotNeutral is updated with:
Code: [Select]
get_property_case ( PROPCASE_WB_ADJ, &wb, sizeof ( wb ) );
cam_AsShotNeutral [ 1 ] = wb [ 1 ];
cam_AsShotNeutral [ 3 ] = wb [ 0 ];
cam_AsShotNeutral [ 5 ] = wb [ 2 ];
As per original DNG code ... ?

*

Offline quid

  • **
  • 67
  • SX130IS
I don't know why, but it is working on old code, and on yours it's always 1 1 1. Also, I've just noticed that Model and UniqueCameraModel fields are empty.

*

Offline Lebeau

  • ***
  • 187
Wonderfull !!! I am so happy ! Quid, you make my day !!!

I fix the bug you underlined. Now, AsShotNeutral and Model, ... are well updated and my final result (on my A650) are fantastic  ::) Thanks to you !

I also correct the absence of "case" in motion_detector.c to switch between UVRGB sensing.
I also add a provision with CAM_NAME_EMULATION in camera.h with cam_name labeling in dng.c to rename the powershot when it is identical to an already-known-raw powershot (in my case I rename my A650 as per G9). Then I am able to use adobe camera and lens standard profiles.

Now my photos have a great good looking. I use Autopano Pro, feeded with dng file, and I had coloration problems. Now, it's solved. Thanks again to you, quid.

Here is the last rar file: (sorry, not really fast but ...)
lebeau_1054_change_2011_02_11.rar - 0.29MB
« Last Edit: 11 / February / 2011, 16:14:16 by Lebeau »

*

Offline quid

  • **
  • 67
  • SX130IS
Thanks for the fix, DNG colors are good now. Unfortunately thumbnail colors are still wrong. I've uploaded example picture. Please tell me if there is something I can help with.

http://www.megaupload.com/?d=TR9ZG82O

*

Offline Lebeau

  • ***
  • 187
Bonjour quid,

I just used MEGUI, that use dcraw, with one of my dng file and extract the embedded thumbnail and everything seams OK.  8)
In Lightroom, the thumbnail seams OK too. 8)

I don't know what you are using to read the thumbnail but, after analysing you picture, I would seriously suspect that your dng reader don't support correctly "PhotometricInterpretation=6" in uncompressed format, or uncompressed YCbcr. Your thumbnail seams to directly interpret Y, Cb and CR as R, G and B. That's why, based on histogram of your original photo, red is like Y, green like Cb (populated near 0) and blue like Cr (populated near 255 [negative near zero]).

Am I right?

P.S.: I just try Ardfry DNG Codec for Win 7 64b and I got the same miss-color interpretation. I begin to suspect that dng thumbnail decoder don't support correctly YCbCR.

Will modify my source to convert YCbCr to RGB  >:(
« Last Edit: 10 / February / 2011, 12:05:23 by Lebeau »

*

Offline quid

  • **
  • 67
  • SX130IS
Yes, I've just checked in Lightroom, and thumbnails look good, but does it really use embedded thumbnail? I have some test pictures, where in this code fragment:
Code: [Select]
* buf++ = img [ triplets_in_bytes + 1 ]; // Y values
* buf++ = img [ triplets_in_bytes ]; // Cb value
* buf++ = img [ triplets_in_bytes + 2 ]; // Cr value
I changed Cb and Cr to 0, and in Lightroom thumbnail still looks good.

Tested programs where thumbnails are wrong:
- RawTherapee
- FastPictureViewer Codec Pack 1.66
- IrfanView (colors different from the first two)

Also FastStone Image Viewer does not read your thumbnails at all.

*

Offline Lebeau

  • ***
  • 187
I convert YCbCr into RGB thumbnail since it's given trouble and got a surprise since the motion detector convertion way didn't give a better thumbnail. Coloration was fu....up but I got it. Never quit !

For those who would like to better understand YCbCr -> RGB convertion, here is the transformation
Code: [Select]
yc = img [ triplets_in_bytes + 1 ] << 12; // Y value
cb = img [ triplets_in_bytes ]; // Cb value
cr = img [ triplets_in_bytes + 2 ]; // Cr value
cb = ( cb > 127 ? cb - 256 : cb ); // Cb value
cr = ( cr > 127 ? cr - 256 : cr ); // Cr value
* buf++ = clip ( ( yc + ( 5742 * cr ) + 2048 ) >> 12 );
* buf++ = clip ( ( yc - ( 1410 * cb + 2925 * cr ) + 2048 ) >> 12 );
* buf++ = clip ( ( yc + ( 7258 * cb ) + 2048 ) >> 12 );

I update the rar file in my previous post :)

 

Related Topics


SimplePortal © 2008-2014, SimplePortal