+\paragraph{Theory:}
+
+A digital image is a matrix of ($N x N$) pixels. Each pixel can have a (integer) luminance or luma ($x_i$) value ranging from $0$ to $L-1$. Generally we have $L = 2^{m}$ values of x, with m = depth of color bit. $0 = x_{0}$ is the black point. $L-1 = x_{L-1}$ is the white point. Mathematically we can act on the values of x with various transformation functions. The generic formula is:
+
+\qquad \( y = T(x) \)
+
+with:
+
+y = luma value after transformation
+x = initial luma value
+T = transformation operator
+
+The T function in the case of a histogram is:
+
+\qquad \( y = \dfrac{p(x_{i})}{width} = \dfrac{max_i}{a} \)
+
+$p(x_{i}$ is the transformation that expresses the probability of an image pixel to have a given luma value $x_{i}$. This is referred to as the frequency of the value or the number of occurrences of the value (count = $max_i = bin_{i}$ area $A_i$); y is the height of the bin. The total probability of all pixels in the image is 1 (100\%):
+
+\qquad \( \sum_{i=0}^{L-1}{p(x_{i})} = 1 \)
+
+Trivially, the function $p(x_{i})$ can be thought of as counting the recurrences of the value $x_{i}$ in the $bin_i$.
+The histogram is similar to a bar graph (not the same: the histogram uses continuous data, the bar graph uses discrete data) and on the abscissa it shows $x_{i}$ values and on the ordinate $y_{i}$. Each x in a range value is treated as independent of neighboring values so it is considered as an isolated unit called an "accumulator" or "bin." It is on the bins that we count the occurrence of the $x_{i}$ value ($max_i$), which gives us precisely the value $p(x_{i})$. The Histogram is called a bar graph because a value of x is actually an interval between $x_{i}$ and the next value $(x_{i+\varepsilon})$. Because x has continuous values computed in floating point and normalized interval $0 - 1.0$ is used, there is no solution of continuity between one bin and another and the boundaries are decided a priori, usually based on bit depth color. The bin concept is fundamental because it is the basis on which we can do mathematical calculations. In fact, the area of the bin is the frequency (count or $max_i$) in which that value occurs; the width of the bin is the different values within the range we consider. With 8 bits of depth color we have 256 bins; then we collect the values of x from the initial value 0 up to and including 1; then from 1 up to and including 2; and so on up to the last bin, which ranges from 254 to and including 255. It is clear, then, that the continuous luma values are bounded in a range and made to become discrete values on which it is easier to perform calculations. The width of a bin is given by the formula:
+
+$width = a_i = x_{max_i} - x_{min_i}$
+
+Having established the depth color, the bin width is always the same (a) for every $bin_i$:
+
+$a_i = a = \dfrac{range}{\# bins}$
+
+For a depth color of 8 bits we have (normalized range $0 - 1.0$):
+
+$a_{8bit} = \dfrac{(1.0-0)}{256} = 1/256$
+
+For a depth color of 10 bits or more we have:
+
+$a_{10bit} = \dfrac{(1.0-0)}{65536} = 1/65536$
+
+Wider bins have a higher count (because they gather more $x_{i}$). Narrower bins have a lower $max_i$ (because they contain less $x_{i}$; neighboring values ($x_{i+\varepsilon}$) are distributed in neighboring bins).
+To recap: in \CGG{} histogram is a bunch of \textit{bins} (accumulators) that count the number of times a particular pixel channel intensity (luma, $x_{i}$) occurs in an image. The plugin scans all the pixels in the frame, counting the frequencies in each given bin ($max_i$). Knowing the width of the bins (a) then it is easy to get the height of $bin_i$ (y). In fact, the bins are rectangles, and you can apply the area formula from which to derive the height:
+
+$A_i = max_i = Base \times High = a \times y_i$
+
+Hence:
+
+$y_i = \dfrac{max_i}{a}$
+
+Dim bins are on the left, bright bins on the right.
+You can have discordance of results, looking in the scopes, either by switching from Histogram to Histogram Bezier or after a conversion between color spaces (with associated change in depth color). The number of bins used depends on the color model bit depth:
+
+\begin{description}
+ \item[Histogram:] 256 for rgb8 and 65536 for all others
+ \item[Bezier:] 256 for rgb8/yuv8 and 65536 for all others
+ \item[Scopes:] always uses 65536
+\end{description}
+
+All of the bins are scanned when the graph is plotted. What is shown on the graph, in the Compositor window, and finally on the scopes, depends on which plugin is used:
+
+\begin{description}
+ \item[Histogram:] was max of the bins in the pixel range, now is the sum (to make it congruent with Bezier and the Scopes)
+ \item[Bezier:] is the max of the bins in the pixel range
+ \item[Scopes:] is the max of the bins in the pixel range
+\end{description}
+
+Another difference in behavior is regarding the type of curve, whether Linear or Log:
+
+\begin{description}
+ \item[Histogram:] the curve is Linear, but it is editable with the Linear/Log slider
+ \item[Bezier:] the curve is Log
+ \item[Scopes:] the curve is Log
+\end{description}
+
+This diversity also leads to different visual results from Histogram Bezier.
+
+When the color space and the bin size are the same, all of the values increment the indexed bins. But if we start from YUV type edits, the plugin will automatically do the conversion to RGB. When the color is the result of yuv $\rightarrow$ rgb float conversion, we go from 256 bins of YUV to 65536 bins of RGB Float and the results \textit{spread} if there are more bins than colors. This is the same effect you see when you turn on \textit{smoothing} in the vectorscope histogram.
+
+The \textit{total} pixels for each value is approximately the same, but the \textit{max} value depends on the color quantization. More colors increment more bins. Fewer colors increment fewer bins. In both cases, the image size has the same number of pixels. So the pixels will distribute into more bins if you go to a higher depth color; those bins will have a lower count. The fewer color case increments the used bins, and skips the unused bins. This sums all of the pixels into fewer bins, and the bins have higher values. That is the \textit{rgb} vs \textit{yuv} case, fewer vs more bins are used. To get more consistent visual feedback (and on scopes), the concept of sum was used instead of the maximum number of occurrences (max).
+
+To report something more consistent, the reported value has been changed from the original code to be the \textit{sum} of the accumulated counts for the bins reporting a pixel bar on the
+
+\begin{center}
+ \begin{tabular}{clccr}
+ \hline
+ 1 & & & & \\
+ 1 & & & 1 & \\
+ 000100 & 3 pixels & vs & 0011000& 3 pixels \\
+ \hline
+ \end{tabular}
+\end{center}
+
+On the left, the course color model piles all 3 pixels into one bin, max
+value 3.
+On the right, the fine color model puts the counts into 2 bins, max 2, sum 3.
+
+So, by reporting the sum the shape of the results are more similar to graph.
+
+\begin{figure}[htpb]
+ \centering
+ \includegraphics[width=0.5\linewidth]{sum.png}
+ \caption{Sum count Vs max count}
+ \label{fig:sum}
+\end{figure}
+