Author Topic: 12 -> 8 bit conversion?  (Read 18614 times)

Tuomas

  • Newbie
  • *
  • Posts: 1
    • View Profile
12 -> 8 bit conversion?
« on: March 22, 2021, 08:21:15 AM »
I just got the HD 2.1 camera few months ago and it seems like a very nice camera for the money!

A small question. When saving videos in H.264 format the output is 8-bits. According to the manual sensor is 12 bits. How is the conversion done? The whole 10^12 range is resampled for the 8-bit. I have been using a camera from another manufacturer where you can select lower, middle or upper range. Having a histogram with min-max limits would be really nice for adjusting the contrast. Or is everybody just using DNGs.

Nikon1

  • Hero Member
  • *****
  • Posts: 985
    • View Profile
Re: 12 -> 8 bit conversion?
« Reply #1 on: March 22, 2021, 08:28:48 AM »
Or is everybody just using DNGs.

 Yes, basically. The Full Sensor Dynamic range is just compressed to whatever h.264 Can handle at set bitrate, if you want the full 10/12 Bit and uncompressed /lower Compressed Footage, use one of the RAW formats or DNG (External eSATA Drive reccomended for about 5x Faster Save times compared to SD-Cards!). Histogram is so far not added to the Cameras interface, best you can do right now is to get an external Monitor which has an HDMI IN and Has Histogram Overlay buildt in. External Monitor helps a ton in correctly exposing your Shots, and has overally improoved my Footage a lot.

tesla500

  • Krontech
  • Full Member
  • *****
  • Posts: 218
    • View Profile
    • krontech.ca
Re: 12 -> 8 bit conversion?
« Reply #2 on: March 24, 2021, 05:05:27 PM »
I just got the HD 2.1 camera few months ago and it seems like a very nice camera for the money!

A small question. When saving videos in H.264 format the output is 8-bits. According to the manual sensor is 12 bits. How is the conversion done? The whole 10^12 range is resampled for the 8-bit. I have been using a camera from another manufacturer where you can select lower, middle or upper range. Having a histogram with min-max limits would be really nice for adjusting the contrast. Or is everybody just using DNGs.

The conversion from raw sensor data to a finished RGB image is quite complex. The most relevant portion here is the color space conversion, specifically linear to sRGB conversion

The data that comes off the image sensor is 12-bit, but it's a linear representation, where the pixel value is directly proportionally to the amount of light hitting that pixel. Normal images on your PC (such as your H264 video, or a jpeg image) use a non-linear color space, sRGB is a typical one. This non-linear conversion stretches the dynamic range of the image sensor out near the black side of the image's dynamic range, and compresses it near highlight side, to better emulate how the human visual system has better sensitivity to changes in brightness at lower levels of intensity.

You can see more here:
https://en.wikipedia.org/wiki/SRGB#The_sRGB_transfer_function_(%22gamma%22)

Ultimately, what comes out of this is a lookup table that converts the 12-bit (0-4095) output from the image sensor to 8-bit (0-255) sRGB. The full table is attached, but the start and end are shown below. Note how that near the low end, the 8-bit sRGB output increases nearly as fast as the 12-bit linear input increases. Therefor, the full ADC range of the image sensor is utilized, albeit only near black. This is the most important part, near highlights, the effective "gain" of the linear to sRGB transfer function is low, so the loss of a lot of ADC range doesn't effect the image quality that much.


Input linear 0-4095   Output srgb 0-255
0   0
1   0
2   1
3   2
4   3
5   4
6   4
7   5
8   6
9   7
10   8
11   8
12   9
13   10
14   11
15   11
16   12
...
...
...
4039   253
4040   253
4041   253
4042   254
4043   254
4044   254
4045   254
4046   254
4047   254
4048   254
4049   254
4050   254
4051   254
4052   254
4053   254
4054   254
4055   254
4056   254
4057   254
4058   254
4059   254
4060   254
4061   254
4062   254
4063   254
4064   254
4065   254
4066   254
4067   254
4068   254
4069   254
4070   254
4071   254
4072   254
4073   254
4074   254
4075   254
4076   254
4077   254
4078   255
4079   255
4080   255
4081   255
4082   255
4083   255
4084   255
4085   255
4086   255
4087   255
4088   255
4089   255
4090   255
4091   255
4092   255
4093   255
4094   255
4095   255