User Tools

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Last revisionBoth sides next revision
isp:brightness [2023/09/10 20:56] – [Algorithm] Igor Yefmovisp:brightness [2023/09/10 21:01] – [Calculation reference] Igor Yefmov
Line 20: Line 20:
 To calculate luminosity we just find the max and min of the triplet and get a simple average: To calculate luminosity we just find the max and min of the triplet and get a simple average:
 \[L = \frac{min(R, G, B)+max(R, G, B)}{2}\] \[L = \frac{min(R, G, B)+max(R, G, B)}{2}\]
 +
 +Brightness adjustment is a trivial addition, clamping the value to its proper limits:
 +
 +\[
 +L` = L + br \\
 +L` \in [0..4095]
 +\]
  
 The slope \(k_R\) for the red component calculation depends on whether \(L\) is above or below the middle: The slope \(k_R\) for the red component calculation depends on whether \(L\) is above or below the middle:
Line 30: Line 37:
 \] \]
  
-Brightness adjustment is a trivial addition, clamping the value to its proper limits:+Finding the "middle point" value also depends on whether the \(L\) is above or below the middle: 
 +\[ 
 +R = 
 +\begin{cases} 
 +k_R * 2047 & \text{if} \; L \leq 2047 \\ 
 +255 - k_R * 2047 & \text{if} \; L > 2047 
 +\end{cases} 
 +\]
  
 +If we are crossing the middle luma boundary as the result of this adjustment - flip the slope:
 \[ \[
-L` L + br \\ +k_R 2 - k_R
-L` \in [0..4095]+
 \] \]
  

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also, you acknowledge that you have read and understand our Privacy Policy. If you do not agree, please leave the website.

More information