DPReview.com is closing April 10th - Find out more


Started Dec 27, 2007 | Discussions thread
Gao Gao Contributing Member • Posts: 582
A closer look at sRaw inside dcraw

The sRAW data is coded in lossless JPEG format. After decoding, the data stream look like this in dcraw:

skip this part if you're not interested in details

o o o x o x x x .... (pattern repeats)
0 1 2 3 4 5 6 7 (index)
where 'o' is a valid number, 'x' is an unknown (not recorded in sRAW)

The procedure then goes on to estimate sample No.5 (interpolate) by taking the average of No.1 and No.9, and No.6 from No.2 and No.10. The resulting pattern becomes

o o o x o o o x ....
0 1 2 3 0 1 2 3

Then the coefficients 0,1,2 will be used to reconstruct R,G,B for each pixel as follows:
R' = C0 + C2
G' = C0 - 0.19 C1 - 0.5 C2
B' = C0 + C1

(letting C1 = 2Cb, C2 = 1.6Cr, it's clear that this is just a YCbCr to sRGB transform)

R = (R'-512) 0.497
G = (G'-512)
B = (B'-512) 0.828
(probably in camera RGB, didn't bother to check, unbalanced)

end of skip

In short, every 2 sRAW pixels contain: 2 Y, 1 Cb and 1Cr samples, while the corresponding RAW image area (8 pixels) contains 4 Green, 2 Blue and 2 Red samples. All samples are in 14bit. This explains why 1/4 the picture area carries 1/2 the data volume, and why sRAW has very high per-pixel sharpness. However, we still have no idea how this down-sampling is performed.

-- hide signature --

. 。o O o 。 . 。o O o 。 . 。o O o 。 .

Post (hide subjects) Posted by
Keyboard shortcuts:
FForum PPrevious NNext WNext unread UUpvote SSubscribe RReply QQuote BBookmark MMy threads
Color scheme? Blue / Yellow