Not all raw is created equal. Log may be better

This keeps cropping up time and time again.

Unfortunately every now and again a new term or buzzword comes along that gets taken as a holy grail term. Two that come to mind right now are log and raw. Neither log, nor raw, are magic bullet solutions that guarantee the best performance. Used incorrectly or inappropriately both can result in inferior results. In addition there are many flavours of log and raw each with very different performance ranges.

A particular point in case is the 12 bit raw available from several of Sony’s mid range large sensor cameras, the FS700, FS7 and FS5.

Raw can be either log or linear. This particular flavour of raw is encoded using linear data.  If it is linear then each successively brighter stop of exposure should be recorded with twice as many code values or shades as the previous stop. This accurately replicates the change in the light in the scene you are shooting.  If you make the scene twice as bright, you need to record it with twice as much data. Every time you go up a stop in exposure you are doubling the light in the scene. 12 bit linear raw is actually very rare, especially from a camera with a high dynamic range. To my knowledge, Sony are the only company that offer 14 stops of dynamic range using 12 bit linear data.

There’s actually a very good reason for this: Strictly speaking, it’s impossible! Here’s why: For each stop we go up in exposure we need twice as many code values. With 12 bit data there are a maximum of 4096 code values, this is not enough to record 14 stops.

If stop 1 uses 1 code value, stop 2 will use 2, stop 3 will use 4, stop 4 will use 8 and so on.

STOP:  CODE VALUES:  TOTAL CODE VALUES REQUIRED.

+1          1                                   1
+2          2                                   3
+3          4                                   8
+4          8                                   16
+5          16                                32
+6          32                                64
+7          64                                128
+8          128                             256 Middle Grey
+9          256                             512
+10       512                             1,024
+11       1,024                          2,048
+12       2,048                         4,096
+13       4,096                         8,192
+14       8,192                         16,384

As you can see from the above if we only have 12 bit data and as a result 4096 code values to play with, we can only record an absolute maximum of 12 stops of dynamic range using linear data. To get even 12 stops we must record the first couple of stops with an extremely small amount of tonal information. This is why most 14 stop raw cameras use 16 bit data for linear or use log encoded raw data for 12 bit, where each stop above middle grey (around stop +8) is recorded with the same amount of data.

So how are Sony doing it on the FS5, FS7 etc? I suspect (I’m pretty damn certain in fact) that Sony use something called floating point math. In essence what they do is take the linear data coming off the sensor and round the values recorded to the nearest 4 or 8. So, stop +14 is now only recorded with 2,048 values, stop +13 with 512 values etc. This is fine for the brighter stops where there are hundreds or even thousands of values, it has no significant impact on the brighter parts of the final image. But in the darker parts of the image it does have an impact as for example stop +5 which starts off with 16 values ends up only being recorded with 4 values and each stop below this only has 1 or two discreet levels. This results in blocky and often noisy looking shadow areas – a common complaint with 12 bit linear raw. I don’t know for a fact that this is what they are doing. But if you look at what they need to do, the options available and you look at the end results for 12 bit raw, this certainly appears to be the case.

Meanwhile a camera like the FS7 which can record 10 bit log will retain the full data range in the shadows because if you use log encoding, the brighter stops are each recorded with the same amount of data. With S-Log2 and 10 bit XAVC-I the FS7 uses approx 650 code values to record the 6 brightest stops in it’s capture range reserving approx 250 code values for the 8 darkest stops. Compare this to the linear example above and in fact what you will see is that 10 bit S-Log2 has as much data as you would expect to find in a straight 16 bit linear recording below middle grey (S-Log 3 actually reserves slightly more data for the shadows). BUT that’s for 16 bit. Sony’s 12 bit raw is squeezing 14 stops into what should be an impossibly small number of code values, so in practice what I have found  is that 10 bit S-log has noticeably more data in the shadows than 12 bit raw.

In the highlights 12 bit linear raw will have more data than 10 bit S-log2 and S-Log3 and this is borne out in practice where a brightly exposed raw image will give amazing results with beautiful highlights and mid range. But if your 12 bit raw is dark or underexposed it is not going to perform as well as you might expect. For dark and low key scenes 10 bit S-Log is most likely going to give a noticeably better image. (Note: 8 bit S-log2/3 as you would have from an FS5 in UHD only has a quarter of the data that 10 bit has. The FS5 records the first 8 stops in  8 bit S-log 2 with approx 64 code values, S-Log3 is only marginally better at approx 80 code values. 12 bit linear outperforms 8 bit log across the entire range).

300x250_xdcam_150dpi Not all raw is created equal. Log may be better

Sony’s F5 and F55 cameras record to the R5 and R7 recorders using 16 bit linear data. 16 bit data is enough for 14 stops. But I believe that Sony still use floating point math for 16 bit recording. This time instead of using the floating point math to make room for an otherwise impossible dynamic range they use it to take a little bit of data from the brightest stop to give extra code values in the shadows. When you have 16,384 code values to play with you can afford to do that. This then adds a lot of extra tonal values and shades to the shadows compared to 10 bit log and as a result 16 bit linear raw will outperform 10 bit log across the entire exposure range by a fairly large margin.

So there you have it.  I know it’s hugely confusing sometimes. Not all types of raw are created equal. It’s really important to understand this stuff if you’re buying a camera. Just because it has raw it doesn’t necessarily mean an automatic improvement in image quality in every shooting situation. Log can be just as good or possibly even better in some situations, raw better in others. There are reasons why cameras like the F5/R5 cost more than a FS5/Shogun/Odyssey.

460x150_xdcam_150dpi Not all raw is created equal. Log may be better

12 thoughts on “Not all raw is created equal. Log may be better”

  1. 1. Bit depth is very important when we talk about sensor’s ADC. There should be at least 16 bit ADC if it’s high-end cam.
    2. Raw can be logarithmically compressed so even it would be 10 bit, it still can contain all sensor’s DR and lots of gradations.
    3. We don’t know what Sony does in their cameras. But my research using RawDigger shows 12bit linear data in cDNG from FS700 (and probably FS5). It contain much less gradations in shadows than Ursa Mini 4.6, but to be fair my raw converters did a good job with this files.

    1. But I don’t understand why anyone would want 10 bit log raw if the camera can already record 10 bit component. Why – because the debayer, any noise reduction and all the image processing would be limited to the 10 bit log data, rather than the 12 to 16 bits from the cameras sensor. I’d rather do all the critical math with more than 10 bits and I can’t see 10 bit log raw having any real advantage over 10 bit log component where the de-bayer etc has been done at a greater bit depth from the source data. Seems to be more of a marketting exercise than anything else.

      Sony’s FS-raw is 12bit linear, which is well documented. It uses some form of floating point math.

      1. Raw usually don’t have all these ugly in-camera processing like noise reduction, simple-algorithm debayering, baked-in color transformations. Also it almost 4:4:4 (with natural restrictions of bayer pattern), less compressed than RGB video with same bit rate.
        And of course flexibility on post production like highlights recovery, exposure or WB change.

        1. But you can’t change the exposure of raw, nor can you change the captured white balance. You can use mathematics and post production gain changes to mimic changing the exposure or changing the white balance but you can do that with RGB just as well.

          Raw is nothing like 4:4:4, it can’t ever be. It’s a single bitmap image where only half the pixels are green, 1/4 red and 1/4 blue. How can that ever be anything like a 4:4:4 image where you have not just 1 bitmap but 3, one each for red, green and blue or Y, Cb and Cr, each fully populated with a unique value for every single pixel.

          Most log recordings don’t have any more NR than raw recordings (most raw also includes at least one stage of NR performed at the pixel level) nor is the colour any more baked in than it is with raw.

      1. Well, as far as I know, all Reds after old Red One Misterium (which was 12 bit) has 16bit ADC. F5/, F55, F65. New Sony A7S3 is declaring 16 bit linear.
        DGA Cameras. Alexas uses dual gain architecture: two separate 14 bit ADCs then combine it to 22 bit linear, and then compress it logarithmically to 12 bit. So as old BM 2.5K, Pocket and Ursa Minis (2×11 bit to 12bit log). And also Production 4K, but it’s sensor wasn’t be able to uncover potential of DGA.
        Also new C70 C300mk3 where DGA is declared feature.
        So, not so incredibly rare. Basically this is ALL true cinema cameras used in industry.

        1. Just because a camera has a 16 bit codec this is not proof that the sensor is also 16 bit. Most are not. 16 bit A2D’s would open up much larger dynamic ranges than we currently see. The main reason cameras are stuck at 14-15 stops of DR is because the A2D’s are at best 14 bit. Arri use parallel overlapping A2D’s to mimic 16 bit behaviour, it does not mimic 22 bit, that’s not how it works, 2x 14 bit = 16 bit and dual 14 bit A2D’s still cannot deliver the same precision for large values as a true 16 bit A2D.

          Once upon a time manufacturers used to include sensor and DSP bit depth in the camera specs. Now it is a closely guarded secret with only Arri actually publishing the sensor A2D bit depth – I wonder why that is? If you have a 16 bit A2D or the direct true equivalent, why not shout out about it?

          Sensors that have 16 bit A2D’s that can operate at the speeds needed for video are incredibly rare. The specs sheets for most sensors are available online and a cursory search will show that virtually all sensors A2D’s drop to 14 or 12 bit above around 12fps because it takes too long to count the electrons at 16 bits precision.

  2. hello Mr. Chapman, thanks for your sharing. it may be a little bit late for me to ask this since this was a post in 2017, but i’m still a bit puzzled as when you say raw can be log or linear.
    i know raw is linear for most of time, but as for raw can be log, does it mean that under the circumstance you just mentioned in this post when bitdepth can’t match the dynamic range(12 bit for 14 stops), the camera would offer an option that we could use log mode to record so we can get full DR and then what the camera output is still raw data.

    1. Many raw formats use log encoding, it is not rare or uncommon and it is used to reduce the bit depth needed to record a large dynamic range. But it is rare for uses to get a choice as the encoding is an integral part of the raw codec.

  3. thank you for your reply, so the only way we could know that wether the camera’s raw is linear or log is to check the mannual or ask the manufacturer, am i right? then we could know how to use the camera in a better way

    1. Yes, the only way to know for most people is by asking the manufacturer. But either way, log or linear it doesn’t really change anything about how you would use the camera.

Leave a Reply to Sam Yu Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.