Viewport Histo - General Help and Assistance on using CHDK stable releases - CHDK Forum  

Viewport Histo

  • 7 Replies
  • 1334 Views
Viewport Histo
« on: 28 / April / 2022, 01:18:30 »
Advertisements
@reyalp

Could you confirm something for me.

The Canon histogram, as we know, is based on a small version of a jpeg of the image the sensor is ‘seeing’.

As I understand it, CHDK histogram functionality is based on assessing the ‘viewport’, but I’m not really clear what this actually means.

Is the viewport another name for the actual sensor? Or is it an abstraction of the sensor, but at a different bit depth, ie more than 8, but less than 12 or 14?

Any insight/education will be gratefully received.

Cheers

Garry

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Viewport Histo
« Reply #1 on: 28 / April / 2022, 01:50:20 »
The Canon live view histogram is not generated from a JPEG image - it may be generated from the same viewport data that CHDK uses; but the exact mechanism is not known.


The viewport is one of the memory buffers used to drive the display (LCD, EVF, HDMI etc).
It is created from the sensor readout; but again the mechanism used to do this is not known.


The viewport data is YUV encoded (https://en.wikipedia.org/wiki/YUV).


On pre-Digic6 cameras it is YUV 411 format.
On Digic6 cameras it is YUV 422 format.

CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: Viewport Histo
« Reply #2 on: 28 / April / 2022, 01:54:58 »
@philmoz

Thanks for the correction in my understanding and the insight.

I was trying to understand if a CHDK histogram was ‘better’ than a Canon live view histogram, and if a Canon LV histogram was derived differently to a Canon post capture review histogram.

Cheers

Garry

*

Offline reyalp

  • ******
  • 14082
Re: Viewport Histo
« Reply #3 on: 28 / April / 2022, 02:12:21 »
Phil beat me to it, but I already wrote it so here's my 2 cents
The Canon histogram, as we know, is based on a small version of a jpeg of the image the sensor is ‘seeing’.
Assuming you mean the live histogram, as opposed to the histogram shown when reviewing an already shot image, I definitely do not know that.
 
Quote
As I understand it, CHDK histogram functionality is based on assessing the ‘viewport’, but I’m not really clear what this actually means.

Is the viewport another name for the actual sensor? Or is it an abstraction of the sensor, but at a different bit depth, ie more than 8, but less than 12 or 14?
The viewport refers to the frame buffer that drives the display. It is 8 bit, YUV-ish, 411 (through digic 5) or 422, scaled to display resolution (typically not more than 720x480 for built in displays.)

It's certain (IMO) that most of the conversion from the full res bayer sensor data to viewport format is done in hardware as part of the readout process, before it's accessible to the main CPU, but I do not know the details.

I would expect the Canon live histogram is derived from the viewport or something close to it, but I don't know the specifics.
Don't forget what the H stands for.


Re: Viewport Histo
« Reply #4 on: 28 / April / 2022, 02:23:45 »
@reyalp

Many thanks, I appreciate both of your insights. It helps me understand more about CHDK and Canon nuances, including YUV ‘stuff’.

Cheers

Garry

Re: Viewport Histo
« Reply #5 on: 08 / May / 2022, 03:39:44 »
@reyalp @philmoz

I’m about to implement what I’m calling an “ETTR Meter”, that will provide the user exposure info for the top stop, ie the highlights.

I’m simply using the Lua get_live_histo() and extracting the data between 512 and 1023.

From what you both have said, I believe this will provide a ‘pretty good’ appreciation of the sensor/RAW data, ie after the Canon hard/soft-ware has converted from the Bayer level to the viewport.

My question is: other than using get_live_histo(), is there any other Lua approach I could use? I don’t think there is, but I thought I would do a final sanity check with you both ;-)

Also, I’ll be looking to get some fast coding in there, so I’ll be looking at imath vs fmath options, and looking at for loops vs ipairs etc. I would welcome any sagely advise for coding. I’m still a pretty basic Lua coder, ie when I compare my code against yours ;-)

Cheers

Garry

*

Offline reyalp

  • ******
  • 14082
Re: Viewport Histo
« Reply #6 on: 08 / May / 2022, 04:25:38 »
I’m simply using the Lua get_live_histo() and extracting the data between 512 and 1023.
I'm not sure what you mean. get_live_histo returns a histogram of viewport Y values. The viewport is 8 bit, so the range is 0-255 (in practice, some cameras only use a smaller range like 16–235). The histogram is a 0 based array of counts for each possible value.

Quote
From what you both have said, I believe this will provide a ‘pretty good’ appreciation of the sensor/RAW data, ie after the Canon hard/soft-ware has converted from the Bayer level to the viewport.
It provides the Y (luminance) values of the viewport. How that relates to raw data is not specified, but assuming the live view is previewing the exposure settings, it should give you are reasonable idea. You can get a feel for this visually using the CHDK histogram in Y mode, or the zebra, since they are both based on essentially the same data.

Quote
My question is: other than using get_live_histo(), is there any other Lua approach I could use? I don’t think there is, but I thought I would do a final sanity check with you both ;-)
For viewport data, get_live_histo is your only option, short of reading the framebuffer directly with peek. If you shoot images, you can query the raw data with rawop histo or shot_histogram.

Quote
Also, I’ll be looking to get some fast coding in there, so I’ll be looking at imath vs fmath options, and looking at for loops vs ipairs etc.
My advice is not worry about optimization unless it becomes a problem.
Don't forget what the H stands for.

Re: Viewport Histo
« Reply #7 on: 08 / May / 2022, 04:55:43 »
@reyalp

Sorry, from memory, I confused  shot_histo_enable with get_live_histo. That is 256 entries vs 1024: 8 vs 10 bit.

Sound advise regarding optimisation ;-)

Cheers

Garry
« Last Edit: 08 / May / 2022, 05:12:12 by pigeonhill »


 

Related Topics