RE: [PATCH v7 01/14] drm: Define histogram structures exposed to user

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On Thu, Jan 16, 2025 at 01:33:43PM +0000, Murthy, Arun R wrote:
> > > 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.murthy@xxxxxxxxx>
> > > > > > > > ---
> > > > > > > >  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.
> > >
> > HDR image enhancement is very much complex including multiple stages such
> as image tone mapping and image denoising.
> > Here for SDR planes, image enhancement is done by playing around the
> contrast and color.
> > Maybe at this stage we can focus on SDR and can take this HDR at the next
> stage.
> 
> If you define max(colour) to be 255, then you can not expand it later.
> The API will have 8 bits for colour information everywhere.
> 
Ok will rework to consider the HDR planes as well.

Thanks and Regards,
Arun R Murthy
--------------------




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux