On Thu, Jan 16, 2025 at 12:33:20PM +0000, Murthy, Arun R wrote:
> > > > On Fri, Jan 10, 2025 at 01:15:29AM +0530, Arun R Murthy wrote:
> > > > > Display Histogram is an array of bins and can be generated in many
> > > > > ways referred to as modes.
> > > > > Ex: HSV max(RGB), Wighted RGB etc.
> > > > >
> > > > > Understanding the histogram data format(Ex: HSV max(RGB))
> > > > > Histogram is just the pixel count.
> > > > > For a maximum resolution of 10k (10240 x 4320 = 44236800)
> > > > > 25 bits should be sufficient to represent this along with a buffer
> > > > > of
> > > > > 7 bits(future use) u32 is being considered.
> > > > > max(RGB) can be 255 i.e 0xFF 8 bit, considering the most
> > > > > significant 5 bits, hence 32 bins.
> > > > > Below mentioned algorithm illustrates the histogram generation in
> > > > > hardware.
> > > > >
> > > > > hist[32] = {0};
> > > > > for (i = 0; i < resolution; i++) {
> > > > >     bin = max(RGB[i]);
> > > > >     bin = bin >> 3; /* consider the most significant bits */
> > > > >     hist[bin]++;
> > > > > }
> > > > > If the entire image is Red color then max(255,0,0) is 255 so the
> > > > > pixel count of each pixels will be placed in the last bin. Hence
> > > > > except hist[31] all other bins will have a value zero.
> > > > > Generated histogram in this case would be hist[32] =
> > > > > {0,0,....44236800}
> > > > >
> > > > > Description of the structures, properties defined are documented
> > > > > in the header file include/uapi/drm/drm_mode.h
> > > > >
> > > > > Signed-off-by: Arun R Murthy <arun.r.mur...@intel.com>
> > > > > ---
> > > > >  include/uapi/drm/drm_mode.h | 59
> > > > > +++++++++++++++++++++++++++++++++++++++++++++
> > > > >  1 file changed, 59 insertions(+)
> > > > >
> > > > > diff --git a/include/uapi/drm/drm_mode.h
> > > > > b/include/uapi/drm/drm_mode.h index
> > > > >
> > > >
> > c082810c08a8b234ef2672ecf54fc8c05ddc2bd3..7a7039381142bb5dba269bda
> > > > ec42
> > > > > c18be34e2d05 100644
> > > > > --- a/include/uapi/drm/drm_mode.h
> > > > > +++ b/include/uapi/drm/drm_mode.h
> > > > > @@ -1355,6 +1355,65 @@ struct drm_mode_closefb {
> > > > >     __u32 pad;
> > > > >  };
> > > > >
> > > > > +/*
> > > > > + * Maximum resolution at present 10k, 10240x4320 = 44236800
> > > > > + * can be denoted in 25bits. With an additional 7 bits in buffer
> > > > > +each bin
> > > > > + * can be a u32 value.
> > > > > + * Maximum value of max(RGB) is 255, so max 255 bins.
> > > >
> > > > HDR planes have higher max value for a component.
> > > > Likewise even in an RGB24 case there are 256 possible values. It's
> > > > not clear why
> > > > 0 gets excluded.
> > > >
> > > This applies to only SDR and excludes HDR.
> > 
> > Why?
> > 
> We are limiting to only SDR. HDR includes a broad range of color and finer 
> details,
> which essentially means its an enhanced image.
> We are trying to enhance the image quality of SDR with the support of 
> histogram.

You are defining generic API. It might be broader than your existing
usecase. Please consider supporting HDR too.

> > > RGB in hex can have a maximum value of 0xFF { RGB (255, 255, 255) }
> > >

-- 
With best wishes
Dmitry

Reply via email to