platform_camera.h doesn't define CAM_BLACK_LEVEL so that's a puzzle.
I think you are looking at trunk code, but running a 1.2 build.
Not quite but I think something like it. It was a 1.3 auto build but it was more than a month ago that I took the photo I inspected.
| 15) Software = CHDK ver. 1.3.0
| - Tag 0x0131 (16 bytes, string[16])
| 16) ModifyDate = 2014:07:06 16:31:02
| - Tag 0x0132 (20 bytes, string[20])
Since the 110 is no longer in the trunk it's fixed obviously.
SX110 and SX120 have something along the lines of
#define CAM_SENSOR_BITS_PER_PIXEL 12
#undef CAM_BLACK_LEVEL
#define CAM_BLACK_LEVEL 128 // black level set to 128 per reports on the forum
in platform_camera.h It doesn't seem to make much sense to replace the default 127 with 128. Especially the "per reports on the forum" is funny. I'd like to meet the person who can see a 1/4096 difference in it.
It's not quite that simple, because the black level setting affects how the raw processor interprets the data. If the real blacklevel is greater than the setting, then the raw processor could treat pixels that are just noise as having data, instead of being black.
Yes I am familliar with the details of the process.
The difference between 127/4096 and 128/4096 as the value to subtract remains arbitrary. Well, why not look at it for the SX110. I'll encode the sampe, image data to a Gamma of 2.2 so that the value range gets more evn in a histogram I'm going to show (opposed to linear sensor data). So we're interested in the following intensities:
127/4095=0.03101343101343101343101343101343
128/4095=0.03125763125763125763125763125763
Let's gamma encode them and put them in the 0 to 255 value range of an 8-bit histogram
(127/4095)^(1/2.2)*255=52.587
(128/4095)^(1/2.2)*255=52.775
Both round to histogram bin 53 in this form.
OK so let's get at some black data from the covered sensor bit.
exiftool -ActiveArea= -BlackLevel= image.dng will do to make it acessible and remove any BlackLevel subtraction. The data is RAW but I'll gamma encode it. I'll attach a screenshot for the SX100 and a Tiff of the crop.
Especially the "per reports on the forum" is funny. I'd like to meet the person who can see a 1/4096 difference in it.
Maybe it's clearer now why that was funny. The spread of the darkest pixels on the covered sensor (not afflicted by noise) to the brightest ones (afflicted by max noise there is at this ISO setting) is wider than the difference between the two values. I don't think a 128 exception makes sense to have.