# A Display-Adaptive Pipeline for Dynamic Range Expansion of Standard Dynamic Range Video Content
## 3 Materials and Methods: A Pipeline for Dynamic Range Expansion of Video Sequences
### Dynamic Range Expansion  
The core of our proposed inverse tone mapping pipeline is the dynamic range expansion step. For this, we use our fully automatic inverse tone mapping method based on the dynamic mid-level tone mapping proposed in [13; 32]. Our dynamic range expansion method employs a global function initially devised for adjusting game display settings and optimizing tone-mapping for HDR content. This function, proposed in the context of enhancing gaming visuals, effectively maintains peak brightness while adjusting middle-gray value in-game luminance, the overall perceived brightness, to comfortable levels [43]. The middle-gray value, often referred to simply as \"middle gray\", represents a tone that sits perceptually midway between the extremes of black and white on a lightness scale. The expansion function based on middle-gray mapping is expressed as follows:  
\[f(L(x,y))=L_{\text{w}}(x,y)=\frac{L(x,y)^{a}}{L(x,y)^{ad}b+c}\quad\text{s.t.} \quad L(x,y)\in[0,1], \tag{1}\]  
where \(L(x,y)\) and \(L_{\text{w}}(x,y)\) represent the luminance of the filtered input LDR frame and the corresponding luminance in the HDR output, respectively, at a given pixel (\(x\), \(y\)). \(L_{\text{w}}(x,y)\in[0,L_{\text{w,max}}]\), where \(L_{\text{w,max}}\) is the maximum luminance in \(L_{\text{w}}\). This maximum luminance value is determined based on either the desired peak brightness for the output HDR video sequences or the peak brightness capability of the HDR display screen. The shape of the curve is controlled by parameters \(a\) and \(d\), which allow for contrast adjustment and highlight expansion, respectively. If we define the following two conditions: (i) for any value \(m_{\text{i}}\), \(f(m_{\text{i}})=m_{\text{o}}\) and (ii) \(f(1)=L_{\text{w,max}}\), and substitute the specific values provided by the conditions into the expansion function defined in Equation (1), parameters \(b\) and \(c\) that satisfy both conditions simultaneously can be computed by solving the following equations:  
\[\frac{m_{\text{i}}^{a}}{m_{\text{i}}^{ad}b+c}=m_{\text{o}}, \tag{2}\]  
\[\frac{1}{b+c}=L_{\text{w,max}}, \tag{3}\]where the solutions for parameters \(b\) and \(c\) are as follows:  
\[b=\frac{{{m_{\rm i}}^{a}{L_{\rm w,max}}-{m_{\rm o}}}}{{{m_{\rm o}}({m_{\rm i}}^{ad} -1){L_{\rm w,max}}}},\qquad c=\frac{{{m_{\rm i}}^{ad}{m_{\rm o}}-{m_{\rm i}}^{a}{ L_{\rm w,max}}}}{{{m_{\rm o}}({m_{\rm i}}^{ad}-1){L_{\rm w,max}}}},\]  
\[\text{s.t.}\quad{m_{\rm i}},{m_{\rm o}}\in(0,1)\qquad{L_{\rm w,max}},a,d>0.\]  
Figure 4 illustrates the shape of our proposed expansion function. Parameter \(a\) determines the lower end of the curve, influencing the output's contrast. On the other hand, parameter \(d\) defines the curve's upper shape, influencing the expansion of highlights. Typically, a \(d\) value greater than 1 is necessary in inverse tone mapping to adequately stretch the highlights. Similarly, a \(a\) value close to 1 maintains the shadows, while a significantly  
Figure 3: Example of artifact suppression using the fast-guided filter on an image with visible artifacts. The parameters used were \(r=32\), \(\epsilon=0.1^{2}\), and \(s=4\). In the zoomed region, artifacts in the lapel are suppressed while fine details such as seams and wrinkles in the actor’s face are largely preserved. (Image from the movie trailer “Dawn of the Planet of the Apes”: WETA/Twentieth Century Fox Film Corporation). larger \(a\) (\(a>>1\)) compresses them in the output. We recommend a slightly higher value of \(a\) to strike a balance between enhancing and preserving the shadows from the input LDR frame in the resulting HDR output. Parameters \(m_{\rm i}\) (mid-level in) and \(m_{\rm o}\) (mid-level out) define the anchor point of the expansion curve and represent the middle-gray value defined for \(L\) and the expected middle-gray value in the output \(L_{\rm w}\), respectively. In our approach, parameter \(m_{\rm i}\) is set to the middle-gray value for the specific LDR content under processing.