Wednesday, April 10, 2013

Nikon D5200 and D7100 Band-Aid: Solutions for Banding

I haven't posted in a while but only because I've been doing a lot of testing about the Nikon D7100 banding issue.  In this post, I will discuss ways to reduce the chance of banding, and what to do if it does show up.
First of all, the banding is real. It affects the Nikon D5200 and Nikon D7100, both of which share the same Toshiba sensor.  Although the D5200 / D7100 sensor outperforms the Nikon D7000, the D5200 / D7100 sensor can have horizontal line pattern noise in deep shadows in low ISOs if the exposure is pushed significantly.  Let's look at each of those factors one by one.

Deep shadows.  Banding will show up only in shadows, and only if the shadows are deep enough.  If the shadows are not very deep, there will be little or no banding.  Here is a test shot:
14bit raw

In post, I raised the exposure by +5EV, way past what is needed for recovering shadows in the image.  (For the argumentative ones among us, I'm obviously doing this for discussion purposes only.)
14bit raw

If you look at the result, even at 100% view, there is mostly no banding, except in the darkest parts of the shadows.  The thinner left branch has negligible banding while the part of the tree trunk in the middle has some banding visible.  

Most of the image has negligible banding, like the left branch, which shows that banding tends to appear only in the deepest shadows.

Low ISOs.
If the ISO is high enough, the banding will not be easily discernible because of the noise in the image.  Here is a test shot at 1000 ISO (cropped).

Even if the exposure is raised +5EV, the banding is hardly visible.

100% crop

Significant pushing
From testing several shots at 14-bit raw, it seems that the banding will show up if exposure is pushed by around +2.7 to +3EV. But see below re shadow recovery vs. exposure.

If you combine these three factors, it gives you an idea of the likelihood of the banding issue affecting your shots.  For most people, it is very unlikely.  For a few people, such as those who like to shoot sunsets, it is more likely to be observable (depending on other factors such as whether they like sunsets that show a lot of shadow detail or no detail like as a silhouette).  In my case, I like to shoot backlit shots and I often underexpose intentionally to preserve highlights, then push the exposure in post.  So I would say my risk is higher than average.  Nonetheless, I have not yet seen banding in my normal shots, except for that day when I shot with 12-bit lossy compression (see below).

Earlier I had wondered whether it was an issue affecting only some units (i.e. a manufacturing defect) because the DPReview and Imaging Resource samples seem to show very little banding.  However, I have gone back to the store where I purchased my camera and tried out another D7100.  It showed the same banding behavior as my camera.  A couple of folks on the Flickr D7100 Group and the DPReview forum have also tried more than one unit, and they also showed banding.  This suggests that the banding issue affects all units.

I had a chance to compare the D7000 and D7100.  Here are shots I took using the same exposure and same lens:



Using the in-camera raw processor, I pushed exposure by 2 stops.  Here are the results:



Here is a screenshot of a side-by-side comparison (note: there is a difference in magnification due to the difference in resolution):

I have looked at files from my older Nikons and I pushed the exposure +5EV in shots with deep shadow.  At +5EV, I did not find any banding in the Fuji S5, Nikon D300S, D300, D90, or even the 7-year old D80.  (Definitely no banding on the D3 or D600.)  I did see banding on the D70 when exposure was pushed significantly.  And y'all probably know banding also affects Canon cameras.

Given that the banding is a real phenomenon for the D5200 and D7100, what can we do to reduce the chance of banding (besides the factors already mentioned above)?

14-bit raw
The easiest way to reduce banding is to use 14-bit raw.  In a previous post I found that 14-bit raw has far less banding than 12-bit raw.  Go to the shooting menu on the camera, find the option for NEF (RAW) Recording and set it to 14-bit.  We may as well use lossless compression as well, just in case.

In some cases, using JPEG instead of raw shows less banding partly because the JPEG would clip shadow details that would otherwise be retained in the raw version, albeit with banding.  However, for me, using raw has too many advantages that I don't wish to forgo simply to avoid banding, so I can't really do much about this except perhaps to use JPEG + Raw for shots where I suspect I will get banding.  At least I will have the option to choose.

Shadow vs. Exposure
It appears that in Lightroom, using the shadow slider may show banding more readily than an adjustment with similar brightness that uses the exposure slider.  However, if the version with the exposure slider is adjusted in other ways to look the same as the one with the shadow slider, then the amount of banding is similar.

I tested other factors and did not see a significant effect on banding from the use of Active D-Lighting, Liveview vs. viewfinder, sRGB vs. Adobe RGB, high ISO NR, long exposure NR.

There may be other factors but these are the ones I am aware of.

In this part, we'll talk about what to do when banding appears.

If banding does show up in your shot, the good news is that it can be mitigated in RawTherapee (thanks to Markku for the tip!), at the expense of some shadow detail.  If you're not familiar with RawTherapee, hold off on googling it for a moment and check out the results first.

I used RawTherapee v4.0.  I exported the problematic shot as a DNG, which RawTherapee was able to open.

BTW this was one of those shots that I took using 12-bit lossy compression before I found out the problem with doing that.  Anyway, I noticed that the saturation and contrast were a little different (I suspect because LR uses custom profiles such as Adobe Standard, Camera Standard, etc. etc., which are not part of the metadata).  I increased the saturation and contrast to match the Lightroom version a little more closely.

I zoomed in an area that I knew had banding in LR.  Interestingly, in RT, the banding was much less noticeable.

Lightroom version (exported as a TIFF) with visible banding.

RawTherapee version with less visible banding.

Hold on, we're not done.  RT has a debanding tool called line noise filter.  Click on the Raw tab (it looks like a checkerboard) or use the keyboard shortcut Alt-R.  Under 'Preprocessing,' you'll find line noise filter.  What line noise filter does is disguise the banding by adding noise.  As far as I can tell, it affects only the areas with the banding noise, leaving the clean parts of the image alone, so in that sense it is better than simply applying the grain effect to the whole image in Lightroom.  Anyway, you should use as little of the filter as possible because the more of it you use, the more details you lose.  Plus, at stronger levels, it creates artifacts on the edge between the noisy areas and clean areas.

Anyway, I started out with 1, then tried 10 and went upwards in increments of 10.  When the banding was removed, I tried going down from that point by 5, etc. gradually identifying the minimum level.  In this case I applied a filter level of 15.  Here is the result:

And here are the complete images for comparison (click for full-resolution)

Lightroom version:

RawTherapee with line noise filter:

So there you have it.  On the hopefully uncommon occasions where you have banding on the D5200 or D7100, RawTherapee is available to mitigate the banding.  (Incidentally, I must say I really like the way RT rendered the highlights on the skin. I like it much better than how it was rendered in Lightroom.)  BTW did you take my request not to google RawTherapee?  That's because I wanted to save the best bit -- it's free! :D

Nikon D7100 Hands-On Real World User Review
Importing D7100 Raw Files Into Lightroom
Nikon D7100 Low Light Teaser
Nikon D7100 FAQ and Helpful Links

Nikon D7100 Shadow Recovery
Nikon D7100 Real World Dynamic Range
Nikon D5200 and D7100 Band-Aid: Solutions for Banding
Sample of D7100 banding in a real world shot