RESHAPING FUNCTIONS FOR HDR IMAGING WITH CONTINUITY AND REVERSIBILITY CONSTRAINTS

Information

  • Patent Application
  • 20230300381
  • Publication Number
    20230300381
  • Date Filed
    April 20, 2021
    3 years ago
  • Date Published
    September 21, 2023
    a year ago
Abstract
Methods and systems for generating a set of forward and backward reshaping functions for the efficient coding of high-dynamic range (HDR) images are provided. Given an initial set of forward reshaping functions, output forward reshaping functions are constructed by a) using the forward reshaping functions to generate a first set of corresponding backward reshaping functions b) generating a second set of backward reshaping functions using a multi-segment polynomial representation with a common set of pivot points c) generating an output set of backward reshaping functions by optimizing the polynomial representation of the second set of backward reshaping functions to minimize gap values between consecutive segments and d) using the output set of backward reshaping functions to generate the output set of forward reshaping functions by minimizing the distance between original input HDR codewords and reconstructed HDR codewords.
Description
TECHNOLOGY

The present invention relates generally to images. More particularly, an embodiment of the present invention relates to generating a family of reshaping functions for HDR imaging which satisfy both continuity and reversibility constraints.


BACKGROUND

As used herein, the term ‘dynamic range’ (DR) may relate to a capability of the human visual system (HVS) to perceive a range of intensity (e.g., luminance, luma) in an image, e.g., from darkest grays (blacks) to brightest whites (highlights). In this sense, DR relates to a ‘scene-referred’ intensity. DR may also relate to the ability of a display device to adequately or approximately render an intensity range of a particular breadth. In this sense, DR relates to a ‘display-referred’ intensity. Unless a particular sense is explicitly specified to have particular significance at any point in the description herein, it should be inferred that the term may be used in either sense, e.g. interchangeably.


As used herein, the term high dynamic range (HDR) relates to a DR breadth that spans the 14-15 orders of magnitude of the human visual system (HVS). In practice, the DR over which a human may simultaneously perceive an extensive breadth in intensity range may be somewhat truncated, in relation to HDR.


In practice, images comprise one or more color components (e.g., luma Y and chroma Cb and Cr) wherein each color component is represented by a precision of n-bits per pixel (e.g., n=8). Using linear or gamma luminance coding, images where n ≤ 8 (e.g., color 24-bit JPEG images) are considered images of standard dynamic range, while images where n > 8 may be considered images of enhanced or high dynamic range. HDR images may also be stored and distributed using high-precision (e.g., 16-bit) floating-point formats, such as the OpenEXR file format developed by Industrial Light and Magic.


Most consumer desktop displays currently support luminance of 200 to 300 cd/m2 or nits. Most consumer HDTVs range from 300 to 500 nits with new models reaching 1000 nits (cd/m2). Such conventional displays thus typify a lower dynamic range (LDR), also referred to as a standard dynamic range (SDR), in relation to HDR. As the availability of HDR content grows due to advances in both capture equipment (e.g., cameras) and HDR displays (e.g., the PRM-4200 professional reference monitor from Dolby Laboratories), HDR content may be color graded and displayed on HDR displays that support higher dynamic ranges (e.g., from 1,000 nits to 5,000 nits or more).


In a traditional image pipeline, captured images are quantized using a non-linear opto-electronic function (OETF), which converts linear scene light into a non-linear video signal (e.g., gamma-coded RGB or YCbCr). Then, on the receiver, before being displayed on the display, the signal is processed by an electro-optical transfer function (EOTF) which translates video signal values to output screen color values. Such non-linear functions include the traditional “gamma” curve, documented in ITU-R Rec. BT0.709 and BT. 2020, the “PQ” (perceptual quantization) curve described in SMPTE ST 2084, and the “HybridLog-gamma” or “HLG” curve described in and Rec. ITU-R BT. 2100.


As used herein, the term “reshaping” or “remapping” denotes a process of sample-to-sample or codeword-to-codeword mapping of a digital image from its original bit depth and original codewords distribution or representation (e.g., gamma, PQ, or HLG and the like) to an image of the same or different bit depth and a different codewords distribution or representation. Reshaping allows for improved compressibility or improved image quality at a fixed bit rate. For example, without limitation, forward reshaping may be applied to 10-bit or 12-bit PQ-coded HDR video to improve coding efficiency in a 10-bit video coding architecture. In a receiver, after decompressing the received signal (which may or may not be reshaped), the receiver may apply an inverse (or backward) reshaping function to restore the signal to its original codeword distribution and/or to achieve a higher dynamic range.


Reshaping can be static or dynamic. In static reshaping, a single reshaping function is generated and is being used for a single stream or across multiple streams. In dynamic reshaping, the reshaping function may be customized based on the input video stream characteristics, which can change at the stream level, the scene level, or even at the frame level. Dynamic reshaping is preferable; however, certain devices may not have enough computational power to support it. As appreciated by the inventor here, improved techniques for efficient image reshaping when displaying video content, especially HDR content, are desired.


The approaches described in this section are approaches that could be pursued, but not necessarily approaches that have been previously conceived or pursued. Therefore, unless otherwise indicated, it should not be assumed that any of the approaches described in this section qualify as prior art merely by virtue of their inclusion in this section. Similarly, issues identified with respect to one or more approaches should not assume to have been recognized in any prior art on the basis of this section, unless otherwise indicated.





BRIEF DESCRIPTION OF THE DRAWINGS

An embodiment of the present invention is illustrated by way of example, and not in way by limitation, in the figures of the accompanying drawings and in which like reference numerals refer to similar elements and in which:



FIG. 1A depicts an example single-layer encoder for HDR data using a reshaping function according to prior art;



FIG. 1B depicts an example HDR decoder corresponding to the encoder of FIG. 1A according to prior art;



FIG. 2 depicts an example process for designing reshaping functions according to an embodiment of this invention;



FIG. 3 depicts an example process for reducing the gap between two second-order polynomial segments in a multi-segment representation of a backwards reshaping function according to an embodiment of this invention; and



FIG. 4 depicts an example encoder using reshaping functions accord to an embodiment.





DESCRIPTION OF EXAMPLE EMBODIMENTS

Image reshaping techniques for the efficient coding of images are described herein. In the following description, for the purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the present invention. It will be apparent, however, that the present invention may be practiced without these specific details. In other instances, well-known structures and devices are not described in exhaustive detail, in order to avoid unnecessarily occluding, obscuring, or obfuscating the present invention.


SUMMARY

Example embodiments described herein relate to image reshaping. In an embodiment, in an apparatus comprising one or more processors, a processor receives input pairs of reference images in HDR and SDR. Given an initial set of forward reshaping functions generated using the reference HDR and SDR images, sets of output forward and backward reshaping functions are constructed by a) using the initial set of the forward reshaping functions to generate a first set of corresponding backward reshaping functions b) generating a second set of backward reshaping functions, wherein each backward reshaping function is represented using a multi-segment polynomial representation with a common set of pivot points c) generating the output set of backward reshaping functions by optimizing the polynomial representation of the second set of backward reshaping functions to minimize the gap output values between consecutive segments and d) using the output set of backward reshaping functions to generate the output set of forward reshaping functions by minimizing the distance between the reference HDR values and reconstructed HDR values.


In an embodiment to generate an output backward reshaping function wherein gap values between segments are minimized, a processor receives a first set of input images in a first dynamic range (e.g., SDR) and a second set of input images in a second dynamic range (e.g., HDR), wherein corresponding pairs between the first set and the second set of input images represent an identical scene. The processor:

  • accesses a first set of backward reshaping functions generated based on the first set of input images and the second set of input images, wherein a backward reshaping function maps pixel codewords from a first codeword representation in the first dynamic range to a second codeword representation in the second dynamic range, and each backward reshaping function is characterized by a reshaping-index parameter and segment parameters for a segment-based representation of the backward reshaping functions with a set of common pivots;
  • adjusts the segment parameters in the first set of backward reshaping functions to generate an output set of backward reshaping functions with the set of common pivots as the first set of backward reshaping functions but with adjusted segment-based polynomial representation, wherein adjusting the segment parameters in a backward reshaping function to generate updated polynomial coefficients comprises:
    • for a segment of a backward reshaping function between a first pivot and a second pivot, wherein the segment is represented in an original polynomial representation by three original polynomial coefficients:
      • accesses the three original polynomial coefficients of the segment; and
      • for one or more new values for a first updated polynomial coefficient for the segment;
        • solves for a second and a third updated polynomial coefficient for the segment based on the first pivot and the second pivot, the new value for the first updated polynomial coefficient, and corresponding outputs for the first pivot and the second pivot according to the original polynomial representation of the segment; and
        • upon satisfying a distortion criterion, updates an optimum set of polynomial coefficients for the segment with the updated polynomial coefficients.


According to some embodiments, there is provided a method for generating a reshaping function with a processor, the method comprising:

  • accessing a first set of input images in a first dynamic range and a second set of input images in a second dynamic range, wherein corresponding pairs between the first set and the second set of input images represent an identical scene;
  • accessing a first set of backward reshaping functions generated based on the first set of input images and the second set of input images, wherein a backward reshaping function maps pixel codewords from a first codeword representation in the first dynamic range to a second codeword representation in the second dynamic range, and each backward reshaping function is characterized by a reshaping-index parameter and segment parameters for a segment-based representation of the backward reshaping functions with a set of common pivots (e.g. the set of common pivots may be common among the backward reshaping functions of the first set of backward reshaping functions); and
  • adjusting the segment parameters in the first set of backward reshaping functions to generate an output set of backward reshaping functions with the set of common pivots as the first set of backward reshaping functions but with adjusted segment-based polynomial representation, wherein adjusting the segment parameters in a backward reshaping function to generate updated polynomial coefficients comprises:
    • for a segment of a backward reshaping function between a first pivot and a second pivot, wherein the segment is represented in an original polynomial representation by three original polynomial coefficients:
      • accessing the three original polynomial coefficients of the segment;
      • initializing a distortion parameter to a first distortion value; and
      • for one or more new values for a first updated polynomial coefficient for the segment:
        • solving for a second and a third updated polynomial coefficient for the segment based on the first pivot and the second pivot, the new value for the first updated polynomial coefficient, and corresponding outputs for the first pivot and the second pivot according to the original polynomial representation of the segment; and
        • upon satisfying a distortion criterion, updating an optimum set of polynomial coefficients for the segment with the updated polynomial coefficients.


The first set of backward reshaping functions may be generated from an initial set of the forward reshaping functions generated using the first set of input images and the second set of input images.


Each backward reshaping function (e.g. of the first set of backward reshaping functions) may be characterized by a reshaping-index parameter and segment parameters in the sense of being defined by a reshaping-index parameter and segment parameters.


Each backward reshaping function may be characterized by a different reshaping-index parameter.


Each backward reshaping function and/or forward reshaping function may be computed for characteristics being different among the input images of the second set of input images. The characteristics may comprise a measure or metric of an average luminance of an input image in the second dynamic range. For example, each backward reshaping function (and forward reshaping function) may be computed for a different average luminance of an input image in the second dynamic range.


According to some embodiments, the method may further comprise generating a set of output forward reshaping functions based on the set of output backward reshaping functions, wherein a forward reshaping function maps pixel codewords from the second codeword representation in the second dynamic range to the first codeword representation in the first dynamic range. Each output forward reshaping function of the set of output forward reshaping functions may be characterized by a reshaping-index parameter (e.g. a different reshaping-index parameter) and segment parameters for a segment-based representation of the output forward reshaping functions with a set of common pivots. Generating an output forward reshaping function corresponding to an output backward reshaping function may comprise: for each input codeword in the second dynamic range identifying a codeword index for the output backward reshaping function which minimizes a difference between codewords generated by the backward reshaping function and the input codeword.


According to some embodiments, the method may further comprise generating a new forward reshaping function by interpolating between two forward reshaping functions of the set of output forward reshaping functions. Thereby, a new forward reshaping function may be generated based on two forward reshaping functions characterized by different reshaping-index parameters.


According to some embodiments, the method may further (or alternatively) comprise generating a new backward reshaping function by interpolating between two backward reshaping functions of the output set of backward reshaping functions. Thereby, a new backward reshaping function may be generated based on two backward reshaping functions characterized by different reshaping-index parameters.


Interpolating between the two backward reshaping functions or the two forward reshaping functions may comprise generating an interpolated set of polynomial coefficients for each segment of the new backward or forward reshaping function, based on a respective set of polynomial coefficients of the two backward or forward reshaping functions. The interpolated set of polynomial coefficients may be generated using linear interpolation, e.g. between corresponding polynomial coefficients of the set of polynomial coefficients of the two backward or forward reshaping functions.


The method may further comprise selecting the two backward reshaping functions or forward reshaping functions based on a measure of an average luminance of an input HDR image (e.g. in the second dynamic range) to be encoded. Each output backward reshaping function and/or each output forward reshaping function may be computed for a different average luminance of an input image in the second dynamic range. The two backward reshaping functions or forward reshaping functions may be selected such that the average luminance of the input HDR image to be encoded lies between the respective measures of average luminance for which the selected two backward or forward reshaping functions are computed. The method may further comprise encoding the input HDR image using the new forward reshaping function.


Example Hdr Coding System

As described in Ref. [1] and Ref. [2], FIG. 1A and FIG. 1B illustrate an example single-layer backward-compatible codec framework using image reshaping. More specifically, FIG. 1A illustrates an example encoder-side codec architecture, which may be implemented with one or more computing processors in an upstream video encoder. FIG. 1B illustrates an example decoder-side codec architecture, which may also be implemented with one or more computing processors in one or more downstream video decoders.


Under this framework, given reference HDR content (120), corresponding SDR content (134) (also to be referred as reshaped content) is encoded and transmitted in a single layer of a coded video signal (144) by an upstream encoding device that implements the encoder-side codec architecture. The SDR content is received and decoded, in the single layer of the video signal, by a downstream decoding device that implements the decoder-side codec architecture. Backward reshaping metadata (152) is also encoded and transmitted in the video signal with the SDR content so that HDR display devices can reconstruct HDR content based on the SDR content and the backward reshaping metadata.


As illustrated in FIG. 1A, the backward compatible SDR images, such as the SDR images (134), are generated using a forward reshaping mapping (132). Here, “backward-compatible SDR images” may refer to SDR images that are specifically optimized or color graded for SDR displays. A compression block 142 (e.g., an encoder implemented according to any known video coding algorithms, like AVC, HEVC, AV1, and the like) compresses/encodes the SDR images (134) in a single layer 144 of a video signal.


The forward reshaping function in 132 is generated using a forward reshaping function generator 130 based on the reference HDR images (120). Given the forward reshaping function, forward reshaping mapping (132) is applied to the HDR images (120) to generate reshaped SDR base layer 134. In addition, a backward reshaping function generator 150 may generate a backward reshaping function which may be transmitted to a decoder as metadata 152.


Examples of backward reshaping metadata representing/specifying the optimal backward reshaping functions may include, but are not necessarily limited to only, any of: inverse tone mapping function, inverse luma mapping functions, inverse chroma mapping functions, lookup tables (LUTs), polynomials, inverse display management coefficients or parameters, etc. In various embodiments, luma backward reshaping functions and chroma backward reshaping functions may be derived/optimized jointly or separately, may be derived using a variety of techniques as described in Ref. [2].


The backward reshaping metadata (152), as generated by the backward reshaping function generator (150) based on the SDR images (134) and the target HDR images (120), may be multiplexed as part of the video signal 144, for example, as supplemental enhancement information (SEI) messaging.


In some embodiments, backward reshaping metadata (152) is carried in the video signal as a part of overall image metadata, which is separately carried in the video signal from the single layer in which the SDR images are encoded in the video signal. For example, the backward reshaping metadata (152) may be encoded in a component stream in the coded bitstream, which component stream may or may not be separate from the single layer (of the coded bitstream) in which the SDR images (134) are encoded.


Thus, the backward reshaping metadata (152) can be generated or pregenerated on the encoder side to take advantage of powerful computing resources and offline encoding flows (including but not limited to content adaptive multiple passes, look ahead operations, inverse luma mapping, inverse chroma mapping, CDF-based histogram approximation and/or transfer, etc.) available on the encoder side.


The encoder-side architecture of FIG. 1A can be used to avoid directly encoding the target HDR images (120) into coded/compressed HDR images in the video signal; instead, the backward reshaping metadata (152) in the video signal can be used to enable downstream decoding devices to backward reshape the SDR images (134) (which are encoded in the video signal) into reconstructed images that are identical to or closely/optimally approximate the reference HDR images (120).


In some embodiments, as illustrated in FIG. 1B, the video signal encoded with the SDR images in the single layer (144) and the backward reshaping metadata (152) as a part of the overall image metadata are received as input on the decoder side of the codec framework. A decompression block 154 decompresses/decodes compressed video data in the single layer (144) of the video signal into the decoded SDR images (156). Decompression 154 typically corresponds to the inverse of compression 142. The decoded SDR images (156) may be the same as the SDR images (134), subject to quantization errors in the compression block (142) and in the decompression block (154), which may have been optimized for SDR display devices. The decoded SDR images (156) may be outputted in an output SDR video signal (e.g., over an HDMI interface, over a video link, etc.) to be rendered on an SDR display device.


In addition, a backward reshaping block 158 extracts the backward reshaping metadata (152) from the input video signal, constructs the optimal backward reshaping functions based on the backward reshaping metadata (152), and performs backward reshaping operations on the decoded SDR images (156) based on the optimal backward reshaping functions to generate the backward reshaped images (160) (or reconstructed HDR images). In some embodiments, the backward reshaped images represent production-quality or near-production-quality HDR images that are identical to or closely/optimally approximating the reference HDR images (120). The backward reshaped images (160) may be outputted in an output HDR video signal (e.g., over an HDMI interface, over a video link, etc.) to be rendered on an HDR display device.


In some embodiments, display management operations specific to the HDR display device may be performed on the backward reshaped images (160) as a part of HDR image rendering operations that render the backward reshaped images (160) on the HDR display device.


Example System for Adaptive Reshaping
Introduction

Reshaping can be static or dynamic. In static reshaping, a single reshaping function is generated and is being used for a single stream or across multiple streams. In dynamic reshaping, the reshaping function may be customized based on the input video stream characteristics, which can change at the stream level, the scene level, or even at the frame level. For example, in an embodiment, without limitation, one may generate reshaping functions according to a metric of the average luminance value in a frame or a scene, to be referred as L1-mid. For example, without limitation, in an embodiment with PQ-coded, RGB data, L1-mid may represent the average of max(R,G,B) values among all RGB pixels in a region of interest in a frame. In another embodiment, for YCbCr or ICtCp coded data, L1-mid may represent the average of all Y or I values in a region of interest in a frame (e.g., computing the average may exclude letterbox or sidebar areas in a frame).


Thus, for a 12-bit system, one may pre-construct all 4,096 possible functions; however, such an approach is time consuming and also rather impractical due to the huge memory requirements in a real system. In an embodiment, one may select to build a smaller set of L (L < 2bitdepth) curves as basis reshaping functions, store them in memory, and then generate additional functions for missing mid-luminance values by interpolating between the available L functions during run-time. This may be referred to as “Scalable-Static mode,” since it combines a small set of statically-generated reshaping curves to generate the full set. For example, in an embodiment, for 10-bit signals, one may generate 13 basis forward functions for average luminance values in the set comprising {768 1024 1280 1536 1792 2048 2304 2560 2816 3072 3328 3584 3840}.


In an embodiment, to save bandwidth, a backwards reshaping function may be approximated using piece-wise linear or non-linear polynomials, where in such representation, polynomial segments are separated by pivot points. To facilitate the interpolation of polynomial coefficients (and avoid extra computation), in an embodiment, the pivot points in all precomputed reshaping functions should be aligned (e.g., common). This allows for much simpler interpolation among polynomials without concern about their pivot points.


Nomenclature

Consider a database containing a reference (or “master”) HDR set and multiple SDR sets of images or video clips generated for different L1-mid values, that is, for each HDR image there is a set of corresponding SDR images using YcOc1 color data (e.g., YCbCr data, with y=Y, c0 = Cb, and c1 = Cr). The SDR images can be generated from the HDR images either manually, with the help of a color grader, automatically, using automatic color mapping algorithms, or by using a combination of computer tools and human interaction.


Let







s

j
i


y
,

l



,

s

j
i


c
0

l



,
and


s

j
i


c
1
,

l







denote the data values of the i-th pixel at the j-th frame or picture in the SDR database set which is generated from the l-th L1-mid mapping. Denote the number of pixels in each frame as P. Let the bit depth be denoted as HDR_bitdepth for HDR images and as SDR_bitdepth in the SDR images, then the number of possible codeword values in the HDR and SDR signals is given by NV= 2HDR_bitdepth and NS= 2SDR-bitdepth, respectively.


As used herein, the term “unnormalized pixel value” denotes a value in [0, 2B-1], where B denotes the bit depth of the pixel values (e.g., B = 8, 10, or 12 bits). As used herein, the term “normalized pixel value” denotes a pixel value in [0, 1).


In some embodiments, instead of operating at the pixel level, one may operate with average pixel values. For example, one may divide the input signal codewords into M non-overlapping bins (e.g., M = 16, 32, or 64) with equal interval wb (e.g., for 16-bit input data, wb = 65,536/M) to cover the whole normalized dynamic range (e.g., (0,1]). Then, instead of operating with pixel values one may operate with the average pixel values within each such bin. Denote the number of bins in the SDR and the HDR signal as MS and MV, respectively, and denote their corresponding intervals as wbs and wbV. When operating at the pixel level, then, MS = NS, and/or MV = NV.


Denote the minimal and maximal luma values within the j-th frame or picture in the HDR database as







v
j

y
,
L


and


v
j

y
,
H


.




Denote the minimal and maximal luma values within the j-th frame in the SDR database as







s
j

y
,

l

,
L


and


s
j

y
,

l

,
H


.




Constructing Individual Forward Reshaping Functions

Before building the family of basis reshaping functions, say, with common pivot points, one needs to build individual reshaping functions. In an embodiment and without limitation, such functions are built using the histogram- or cumulative density function- (CDF) matching approach used in Ref. [1-3]. For completeness, the algorithm is also described herein. The key steps include: a) collecting statistics (histograms) for the images in the database, b) generating a cumulative density function (CDF) for each set, c) applying CDF matching (Ref. [3]) to generate a reshaping function and d) clipping and smoothing the reshaping function. These steps are depicted in pseudocode in Tables 1 and 2.





TABLE 1





Example step for collecting statistics




// STEP 1: histogram initialization


// F denotes the number of SDR/HDR image pairs in the database


// F can vary in each database


// P denotes the number of pixels in an image









h
b

s
,

l



=
0


for

b
=
0
,

,

M
S



1





h
b
v

=
0


for

b
=
0
,

,

M
V



1









// STEP 2: scan for each pixel in the HDR and the l-th SDR database to build histograms


for( j = 0; j < F; j ++){


 for (i = 0 ; i < P ; i ++ ){









b
S

=





s

j
i


y
,

l






w

b
S











b
V

=





v

j
i

y




w

b
V











h


b
S



s
,

l



+
+
;















//histogram from l-th SDR database





h


b
V


v

+
+
;















//histogram from HDR database









 }


}









TABLE 2




Example construction of a forward reshaping function with CDF matching




// STEP 1: initialization







c
b

s
,

l



=
0


for b = -1, ..., MS - 1








c
b
v

=
0


for b = MV -1






// STEP 2: build CDF


for( b = 0: b < MS; b ++ ){


  cbs,l=cb1s,l+hbs,l


}


for ( b = 0: b < MV; b ++ ){


  cbv=cb1v+hbv


}





// STEP 3: normalized CDF to be between [0 1]


for(b = 0; b < MS; b ++ ){


  cbs,l=cbs,lP


}


for(b = 0; b < MV; b ++ ){


  cbv=cbvP


}





// STEP 4: histogram transfer


for(b = 0; b < MS; b ++ ){


  // for each sample point in the first domain, find the corresponding CDF value


  // find the 2nd signal whose CDF cover the 1st domain’s CDF.


  find k such that ck1s,lcbvcks,l


  // find the 2nd domain sample points


  perform interpolation based onck1s,l and cks,l


    T˜bF,l=k1+cbvck1s,lcks,lck1s,l


}





// STEP 5: curve clipping


// search flat areas at dark area


for( b= 1: b < MV: b++)f


  ifT˜bF,l-T˜b1F,l>Δ{


    vL,l=clip3b-2,0,MS-1;


    break;


  }


}


// search flat areas at bright area


for( b= NV -1; b > 0; b--) {


  ifT˜bF,lT˜b1F,l>Δ{


    vH,l=clip3b+1,0,MV-1;


    break;


  }


}





// STEP 6: curve smoothing using varying window size


// ( can be speed up by using cumulative sum)


// lower end


for( b= 0; b ≤ vL,(l); b++){


  TbF,l=T˜bF,l


}





// higher end


forb=vH,l;b<MV-1; b++{


  TbF,l=T˜bF,l


}





// mid-tone smoothing


for( b = vL,(l)+1 ; b < vH,(l) ; b++){


  Wb=minbvL,l+2,vH,lb+2,W2Wb=clip3bWb,0,MS1Wb+=clip3b+Wb,0,MS1TbF,l=1Wb+Wb+1k=WbWb+T˜kF,l


}


// STEP 7:rounding and clipping







T
b

F
,

l



=
c
l
i
p
3


r
o
u
n
d



T
b

F
,

l





,
0
,

N
S


1


;










In Table 2, the function y = clip3(x, Min, Max) is defined as:






y
=






M
i
n

i
f

x





M
i
n






M
a
x

i
f

x




M
a
x
.






x

o
t
h
e
r
w
i
s
e










In Table 2, the CDF-matching step (STEP 4) can be simply explained as follows. Consider that an SDR codeword xs corresponds to a specific CDF value c in the CDF Cs,(l) and that an HDR codeword xv also corresponds to the same specific CDF value c in the CDF cv,(l), it is then determined that SDR value s = xs should be mapped to HDR value xv. Alternatively, in STEP 4, for each SDR value (xs), one computes the corresponding SDR CDF value (say, c), and then tries to identify via simple linear interpolation from existing HDR CDF values the HDR value (xv) for which cv,(l) = c.


By repeating the steps in Table 1 and 2 for each L1-mid value of interest one can generate the first set of forward reshaping functions,







T
b

F
,

l



,




mapping an HDR input image (or frame) to a corresponding SDR output according to its L1-mid value or any other characteristics that was used to generate the l-th SDR database.


Constructing Individual Backward Reshaping Functions

Given the original set of individual forward reshaping functions,







T
b

F
,

l



,




one may now generate corresponding individual backward reshaping functions







T
b

B
,

l







where SDR codewords are mapped to reconstructed HDR codewords. An example process is depicted in Table 3.





TABLE 3




Example process to generate a backward reshaping function




// find inverse mapping


for( b= 0; b < MS -1; /++){


  Φb=kTkF,l==b


  if(||Φb|| > 0 )


    TbB,l=1ΦbkΦbk


  end


}





// fill up missing data


for ( b= 0; b < MS -1; b++){


  Φb=kTkF,l==b


  if(||Φb||== 0 )


    TbB,lis interpolated from nearest two available BLUT.


  end


end






Constructing a Family of Backward Reshaping Functions with Common Pivot Points

At this stage, there exist a set of backward reshaping functions









T
b

B
,

l









and a set of forward reshaping functions









T
b

F
,

l





.




In an embodiment, the luma backward reshaping function may be represented/approximated by a multi-piece polynomial approximation (e.g., using eight second-order polynomials), where polynomial segments are separated by pivot points. To enable the interpolation among the existing L1-mid functions, it is desirable to have common pivot points for all









T
b

B
,

l









functions. In an embodiment, the set of common pivots is generated based on the techniques described in Ref. [6], which is summarized below.


For each SDR codeword b, compute its normalized value










s
b
Y

=

b


N
S



.




­­­(1)







Denote the pivot points as {λm}, m = 0, 1, ..., K, where K denotes the total number of segments. For example, [λmm+1), denotes the m-th polynomial segment. The m-th polynomial is selected when the input value, b, is within λm and λm+1. In an embodiment, both b and λm values are integers in [0, 2B ), where B denotes the SDR bit depth. The m-th second-order polynomial of the l-th L1-mid reshaping function is used to approximate the input backward reshaping function, generated earlier, as:










T
b

B
,

l








k
=
0

2



a

m
k



l









s
b
Y




k

,

when




λ
m


b
<

λ

m
+
1



.




­­­(2)







To reduce the gap between two nearby polynomials, an overlapped constraint may be applied to smooth the transition around the pivot points. The overlapped window size is denoted as Wm. To achieve a minimal gap, the design optimization goal can be formulated as









J
=
m
i
n



m
a
x





a

m
k



l













k
=
0

2



a

m
k



l









s
b
Y




k






k
=
0

2



a

m
k



l









s

b

1

Y




k







,




­­­(3)







for






m
a
x



λ
m



W
m

,

λ
m
s




b

m
i
n



λ

m
+
1


+

W
m


1
,

λ
m
e



and
0

l

L

1.




In equation (3), the pivot points may be bounded by specific communication constraints (e.g., a valid range of SMPTE 274M codeword values) which can be expressed as a lowerbound,







λ
m
s

,




and as upper bound,







λ
m
e

,




where values below







λ
m
s





and above







λ
m
e





will be clipped. For example, for 8-bit signals, the broadcast-safe area is [16, 235] instead of [0, 255].


Using an overlapped window, denote the extended points as







λ
m
L

=
m
a
x



λ
m



W
m

,

λ
m
s












λ
m
R

=
m
i
n



λ

m
+
1


+

W
m


1
,

λ
m
e



.




then, in a matrix representation,







s
m

=





1




s


λ
m
L


Y










s


λ
m
L


Y




2






1




s


λ
m
L

+
1

Y










s


λ
m
L

+
1

Y




2

















1




s


λ
m
R


1

Y










s


λ
m
R


1

Y




2






1




s


λ
m
R


Y










s


λ
m
R


Y




2



















t
m


l



=







T


λ
m
L



B
,

l










T


λ
m
L

+
1


B
,

l















T


λ
m
R


1


B
,

l










T


λ
m
R



B
,

l









,




­­­(4)












a
m


l



=







a

m
0



l










a

m
1



l










a

m
2



l













and equation (3) can be expressed as










J
m


l



=


m
i
n



a
m


l










t
m


l





S
m


a
m


l






2

.




­­­(5)







Under a least square optimization, a solution is given by










a
m


l

,
o
p
t


=





S
m
T


S
m






1





S
m
T


t
m


l





.




­­­(6)







Then, the overall problem to solve is given by:

  • Solve for
  • aml
  • for all m and for all l
  • Solve for
  • λm
  • for all m using a set of {Wm} windowing parameters,

under a combination of optimization criteria. The set of overlapping window sizes {Wm} can vary to assist in searching for the best result. An example process to solve for the set of multi-segment polynomials with a set of common pivots is depicted in Table 4, where one may apply a Monte Carlo simulation by randomizing the pivot points and overlapping windows for U iterations (e.g., U = 10,000)





TABLE 4




Example process to identify common pivots and polynomial segments in a set of backward reshaping functions








Initialize




a

m


l

,
o
p
t




and




λ
m

o
p
t










Jopt = inf





for( u = 0; u < U; u ++ ){ // U denotes the upper number of iteration searches


  // STEP 1: set pivot points


  valid_pivot_flag = 0;


  while(valid_pivot_flag == 0 ) {


   Randomize {λm} within range λms,λmefor all m


   Randomize {Wm} for all m


   Obtain λmL=maxλmWm,λms and λmR=minλm+1+Wm1,λme


   if (λm < λm+1 for all m ){


     valid_pivot_flag = 1


   }


  }





  // STEP 2: compute the polynomial coefficients for each piece in each basis


  for( m =0 ; m < K; m++ ) { // number of segments


    compute Sm


    for( l = 0; l < L; l++) { // number of basis functions


      obtain response vector tml


      compute least squared solution aml=SmTSm1SmTtml


      (Optional) Check for implementation constraints. If there is a violation, skip and move to next iteration


      compute predicted value T^bB,l=k=02amklsbYkfor bλm,λm+11


    }


  }





  // STEP 3: compute the objective function


  Ju=maxT^bB,lT^b1B,lb0,Ms1,l0,L1





  // update the optimal solution


  If(Ju < Jopt){


  Jopt = Ju


  aml,opt=amlλmopt=λm


  }


}






In Step 2, in regard to checking for implementation constraints, some embodiments may restrict the accuracy of the polynomial coefficients (e.g., to signed 7-bit or 8-bit integer values, and the like).


As discussed, the above joint optimization might not output a smooth backward reshaping function, without jumps near the pivot points. In an embodiment, another round of optimization to minimize the gaps may needs to be performed as follows.


Consider the pivot point λm+1, where the ending points of two polynomials (the m-th and m+1 polynomials) are supposed to connect together. When predicting HDR values using the received SDR codewords, at location at λm, using a second-order polynomial, the equation of applying the m-th polynomial is:











v
^


m
,

λ
m


Y

=

a

m
,
0



l



+

a

m
,
1



l







λ
m



+

a

m
,
2



l









λ
m




2

.




­­­(7)







For the rest of the codewords in the m-th segment, predicted HDR values are computed as:











v
^


m
,
b

Y

=

a

m
,
0



l



+

a

m
,
1



l







s
b
Y



+

a

m
,
2



l









s
b
Y




2

,


when


λ
m

<
b
<

λ

m
+
1


.




­­­(8)







To reduce the gap between pivots, in an embodiment, the goal is to adjust the polynomial coefficients of the m-th segment so that the revised m-th polynomial satisfies output values at both









λ
m

,


v
^


m
,

λ
m


Y



and



λ

m
+
1


,


v
^


m
+
1
,

λ

m
+
1



Y







for the original polynomials, that is, equation (7) and











v
^


m
+
1
,

λ

m
+
1



Y

=

a

m
+
1
,
0



l



+

a

m
+
1
,
1



l







λ

m
+
1




+

a

m
+
1
,
2



l









λ

m
+
1





2

.




­­­(9)







A second-order polynomial is fully defined by three coefficients, thus, given only the two equations (7) and (9), solving for three unknowns is an under-determined problem. Assuming one of the revised polynomial coefficients









a





m
,
0



l



,

a





m
,
1



l



,

a





m
,
2



l









is known








e
.g
.,


a





m
,
0



l





,




the remaining ones








e
.g
.,


a





m
,
1



l



and

a





m
,
2



l









can be obtained fromequations (7) and (9) as a closed-form solution of a system with two equations and two unknowns. For example, with







a





m
,
0



l







presumed known, the solution for the other two is given by










a





m
,
1



l



=







λ

m
+
1





2





v
^


m
,

λ
m


Y



a





m
,
0



l











λ
m




2





v
^


m
+
1
,

λ

m
+
1



Y



a





m
,
0



l








λ
m


λ

m
+
1





λ

m
+
1




λ
m





,




­­­(10)












a





m
,
2



l



=



λ

m
+
1






v
^


m
,

λ
m


Y



a





m
,
0



l







λ
m





v
^


m
+
1
,

λ

m
+
1



Y



a





m
,
0



l








λ
m


λ

m
+
1





λ
m



λ

m
+
1






.




Since







a





m
,
0



l







is actually unknown, one can formulate this problem as an optimization problem to find the optimal coefficients









a

m
,
0



l

,
*


,

a

m
,
2



l

,
*


,

a

m
,
2



l

,
*




,




such that the sum of differences between the original HDR value and the new HDR value using the new polynomial coefficients is minimized, that is:












a

m
,
0



l

,
*


,

a

m
,
2



l

,
*


,

a

m
,
2



l

,
*




=
a
r
g
m
i
n




b
=

λ
m

+
1



λ

m
+
1











k
=
0

2



a





m
k



l









b
b
Y




k




v
^


m
,
b

Y








.






­­­(11)







There is no need to include point λmin the optimization since the equations have already passed this point. In an embodiment, without limitation, the optimal solution can be searched among a range of values for







a





m
,
0



l



.




For the last segment, the (m+1)-th segment is outside the last pivot point. In an embodiment, the curve after the last point may be a constant, extending from the last output value from the previous polynomial. Therefore, for m = K, one can set












a

K
+
1
,
0



l



=

a

K
,
0



l



+

a

K
,
1



l







λ

K
+
1



1


+

a

K
,
2



l








λ

K
+
1



1


2

,





a

K
+
1
,
1



l



=
0




























,





a

K
+
1
,
2



l



=
0
,






­­­(12)







For the first segment (e.g., m = 0), if the video signal range is in full range (that is, in [0, 1]), the pivot point λ0 will be 0. In this case,







a

0
,
0



l

,
*






must be equal to the original coefficient. That is, for






m
=
0
:




a

0
,
0



l

,
*


=

a

0
,
0



l





.




Assuming








a




0
,
1



l







is known,








a




0
,
2



l







can be obtained from equation (9) as











a




0
,
2



l



=






v
^


1
,

λ
1


Y



a

0
,
0



l

,
*





a




0
,
1



l




λ
1










λ
1




2



.




­­­(13)







An example implementation of the gap-reducing algorithm is depicted in Tables 5 (for m=0) and Table 6 (for m > 0). When m = K, the constraints of equation (12) also apply.





TABLE 5




Example process to reduce the gap among pivot points for m = 0 (first segment)




// For the first segment (m = 0)


// STEP 1: compute values from original polynomial in lower range and upper rangev^0,bY=a0,0l+a0,1lsbY+a0,2lsbY2when λ0b<λ1v^1,λ1Y=a1,0l+a1,1lλ1+a1,2lλ12





// STEP 2: vary first coefficient and search minimal difference between values from new coefficients and old coefficients.


D = inf;


initial a0,0l,*,a0,2l,*,a0,2l,*









a

0
,
0



l

,
*


=

a

0
,
0



l








a

0
,
1



l

,
*


=

a

0
,
1



l








a

0
,
2



l

,
*


=

a

0
,
2



l


















for





a




0
,
1



l



=
-

a

0
,
1



l



;


a




0
,
1



l



<
=
3


a

0
,
1



l



;


a




0
,
1



l



+

=
0.001


a

0
,
1



l











  // compute coefficients








a




0
,
2



l



=






v
^


1
,

λ
1


Y



a

0
,
0



l

,
*





a




0
,
1



l




λ
1










λ
1




2












  if (a0,0,l,a01,l,a0,2,lsatisfies resolution constraint (e.g., 8 bits)


    / compute distortion


    D=b=λ0+1λ1k=02a0klsbYkv^0,bY


    if( D′ < D )


      D = D′;


      a0,1l,*=a0,1la0,2l,*=a0,2l


    end


  end









TABLE 6




Example process to reduce the gap among pivot points for m > 0




// For the remaining segments, (i.e. 0 < m <= K)





// STEP 1: compute values from original polynomial in lower range and upper range










v
^


m
,
b

Y

=

a

m
,
0



l



+

a

m
,
1



l







s
b
Y



+

a

m
,
2



l








s
b
Y



2


when


λ
m


b
<

λ

m
+
1








v
^


m
+
1
,

λ

m
+
1



Y

=

a

m
+
1
,
0



l



+

a

m
+
1
,
1



l







λ

m
+
1




+

a

m
+
1
,
2



l








λ

m
+
1




2












// STEP 2: vary first coefficients and search minimal difference between values from new coefficients and old coefficients.


D = inf; // inf denotes a very large number






initial



a

m
,
0



l

,
*


,

a

m
,
2



l

,
*


,

a

m
,
2



l

,
*

















a

m
,
0



l

,
*


=

a

m
,
0



l








a

m
,
1



l

,
*


=

a

m
,
1



l








a

m
,
2



l

,
*


=

a

m
,
2



l


















for





a




m
,
0



l



=
-

a

m
,
0



l



;


a




m
,
0



l



<
=
3


a

m
,
0



l



;


a




m
,
0



l



+

=
0.001


a

m
,
0



l











  // compute coefficients


  am,1l=λm+12v^m,λmYam,0lλm2v^m+1,λm+1Yam,0lλmλm+1λm+1λm


  am,2l=λm+1v^m,λmYam,0lλmv^m+1,λm+1Yam,0lλmλm+1λmλm+1


  if am,0l,am1l,am,2lsatisfy resolution constraint) // (e.g., 8 bits)


    // comnute distortion


    D=b=λm+1λm+1k=02amklsbYkv^m,bY


    if( D′ < D )


      D = D′:


      am,0l,*=am,0lam,1l,*=am,1lam,2l,*=am,2l


    end


  end


end






Adjusting the forward reshaping functions for reversibility


After reducing the gap between all consecutive segments, the set of final backward reshaping functions is determined. Since the gap-reduction algorithm changes the backward reshaping functions, one needs to re-build the forward reshaping functions, guaranteeing proper reversibility. This can be accomplished by reverse tracing of the backward reshaping functions.


For the l-th polynomial, one can reconstruct the output backward reshaping function







T
b

B
,

l

,







using, the computed polynomial coefficients









a

m
,
0



l

,
*


,

a

m
,
2



l

,
*


,

a

m
,
2



l

,
*




,




for all m:










T
b

B
,

l

,



=




k
=
0

2



a

m
k



l

,
*








s
b
Y




k



when


λ
m


b
<

λ

m
+
1


.






­­­(14)







The corresponding updated forward reshaping function,







T
b

F
,

l

,



,




can be built by searching the codeword index which minimizes the difference between codewords generated by the backward reshaping function and the original HDR codeword. For each input HDR codeword b, to get optimal reconstruction, the ideal backward reshaping output should be as close to b as possible. Given a b value, one assumes its mapped value from forward reshaping will be k, where k can be within the entire valid SDR codeword range. By taking each valid SDR codeword through backward reshaping







T
k

B
,

l

,







one can find the corresponding backward mapped HDR value b. Among all those backward mapped HDR values,







T
k

B
,

l

,



,




one can find the one,







T

k
*


B
,

l

,



,




having minimal difference from the original input HDR codeword b. In other words, for an input b, the forward reshaping mapping should map b to







T
b

F
,

l

,



=

k
*

.




An example process is depicted in Table 7.





TABLE 7




Example process to reconstruct forward reshaping functions based on the optimized backward reshaping functions




for( b = 0; b < NV; b++)


  // compute ideal reconstructed HDR value (through forward and backward)


  v˜b=bNV


// find the index having minimal difference between ideal case and from the backward reshaping function


  k*=argminkv˜bTkB,l,*


  TbF,l,=k*


end







FIG. 2 depicts an example process pipeline which summarizes the process described earlier to generate forward and backward reshaping functions according to constrains of continuity between pivots and reversibility. Given reference HDR and SDR images, in step 205, a first set of forward reshaping functions is constructed, wherein, each one is optimized for a specific characteristic of input HDR images, e.g., a metric of the average luminance of each frame. For example, in an embodiment, without limitation, one may generate such reshaping functions using the CDF matching criterion as described in Tables 1 and 2.


In step 210, using the first set of forward reshaping functions, one constructs a first set of backward reshaping functions, e.g., using the process depicted in Table 3. Next, in step 215, one builds a second set of backward reshaping shaping functions by a) applying a piece-wise approximation to the first set of backward reshaping shaping functions under the constrain that all functions in this set share a common set of pivots. An example process is provided in Table 4.


To improve image quality and reduce visual artifacts, in step 220, the polynomial representation of the second set of forward reshaping functions is further optimized to reduce the distance between values in neighboring pivot points, thus generating an output set of backward reshaping functions. An example process is provided in Tables 5 and 6.


Given this set of output forward reshaping functions (with optimized gap), step 225 generates an output set of forward reshaping functions under the constrain that the distance between codewords of the reference HDR input and a reconstructed HDR input (using an output backward reshaping function) is minimized. An example process is described in Table 7.


Returning back to processing block 220, FIG. 3 depicts an example process for reducing the gap between two second-order polynomial segments in a multi-segment representation of a backwards reshaping function according to an embodiment. As described in Table 6, for segment m > 0, reducing the gap between two segments includes the following steps:


Step 305: Initialization. This step initializes the distortion (D) to a large number, and given the original polynomial coefficients for the m-th and m+1-th segments in the l-th reshaping function, it setups how the HDR prediction values are to be computed for codewords within the m-th segment and the λm+1 pivot point, e.g.:











v
^


m
,
b

Y

=

a

m
,
0



l



+

a

m
,
1



l







s
b
Y



+

a

m
,
2



l









s
b
Y




2

when


λ
m


b
<

λ

m
+
1






­­­(15)













v
^


m
+
1
,

λ

m
+
1



Y

=

a

m
+
1
,
0



l



+

a

m
+
1
,
1



l







λ

m
+
1




+

a

m
+
1
,
2



l









λ

m
+
1





2





Step 310 starts an iterative process, which for a range of values for







a





m
,
0



l







in [A, B], with an increment C (e.g., without limitation,






A
=
-

a

m
,
0



l



,
B
=
3


a

m
,
0



l



,




and C = 0.001.

  • in step 315, it computes the other two coefficients
  • am,1l and am,2l
  • (see equation (10))
  • in step 320, it computes the total distortion (see Table 6)
  • D=b=λm+1λm+1k=02amklsbYkv^m,bY­­­(16)
  • in step 325, if D′ < D, then the computed set of updated polynomial coefficients replaces the previous one as the new set of optimal polynomial coefficients The iterative process repeats until all values of
  • am,0l
  • within [A, B] are processed.
  • In step 340, at the end of the iteration process, the final set of optimal polynomial coefficients
  • am,jl,*,j=0,1,and2
  • is outputted.


The process in FIG. 3 is repeated for all segments and for all the L functions in the set of backward reshaping functions.


For the first segment (e.g., m = 0), one may still apply the same iterative process, but with small variations. After initialization (see equation (15), but with m = 0), because







a

0
,
0



l

,
*






must be equal to the original coefficient, the iteration process in step 310 now varies







a





0
,
1



l







in a range [A0, B0] with step C0, where, in an embodiment (see Table 5),






A
0
=


a

0
,
1



l



,


B
0
=
3


a

0
,
1




l



,




and






C
0
=
0.001


a

0
,
1



l



.




Given







a

0
,
0



l

,
*






and







a

0
,
1




l



,




one may apply equations (11) and (16) to compute







a





0
,
2



l







and distortion D′ in steps 315 and 320.


For the last segment








m
=
K


,

a

K
+
1
,
j



l







values for j=0, 1, and 2 (see equation (15)), are computed using equation (12).


Reshaping Function Interpolation

Given a set of L pre-computed forward reshaping functions, each one computed for a value in a set of different adaptive control signals {r(0), r(1), ⋯ r(L-1)}, for example r may denote the average luminance value, then, the corresponding forward reshaping functions for the three color planes (e.g., YCbCr) may be expressed as













s
^


t
,
i


y
,

l



=
F

R
j


r


l



,
y





v

j
,
i

y









s
^


j
,
i


c
0
,

l



=
F

R
j


r


l



,
c
0





v

j
,
i

y

,

v

j
,
i


c
0


,

v

j
,
i


c
1




,





s

j
,
i


c
1
,

l



=
F

R
j


r


l



,
c
1





v

j
,
i

y

,

v

j
,
i


c
0


,

v

j
,
i


c
1










­­­(17)







Given a new control signal value (r) between two pre-computed values, that is, r(l) ≤ r < r(l+1), one would like to derive a new forward reshaping function from the existing pre-computed functions. Assuming the new reconstructed HDR samples can be interpolated from two near samples, let






α
=



r



l
+
1





r



r



l
+
r






r


l





,




then, using linear interpolation, the HDR interpolated values can be expressed as













s
^


j
,
i

y

=
α



s
^


j
,
i


y
,

l



+


1

α





s
^


j
,
i


y
,


l
+
1




,






s
^


j
,
i


c
0


=
α



s
^


j
,
i


c
0
,

l



+


1

α





s
^


j
,
i


c
0
,


l
+
1







,






s
^


j
,
i


c
1


=
α



s
^


j
,
i


c
1
,

l



+


1

α





s
^


j
,
i


c
1
,


l
+
1




.






­­­(18)







The interpolation of luma and chroma reshaping functions is examined next.


Interpolation of Luma Interpolation Functions

From equations (15) and (16)











s
^


j
,
i

y

=
α

F

R
j


r


l



,
y





v

j
,
i

y



+


1

α



F

R
j


r



l
+
1




,
y





v

j
,
i

y



.




­­­(19)







Alternatively, the function form can be expressed as









F

R
j

r
,
y





=
α

F

R
j


r


l



,
y





+


1

α



F

R
j


r



l
+
1




,
y





.




­­­(20)







Given that all pivot points are aligned, in an embodiment, one may generate the interpolated function by directly generating an interpolated set of polynomial coefficients for each segment. For example, and without limitation, consider a multi-segment polynomial format with second-order polynomials. Assume the considered HDR range is within the m-th piece/segment, then the corresponding SDR reshaped value using the l-th and l+1-th forward reshaping functions can be expressed as:











F

R
j


r


l



,
y





v

j
,
i

y



=




k
=
0

2



a

m
k



l

,
y









v

j
,
i

y



k







,




F

R
j


r



l
+
1




,
y





v

j
,
i

y



=




k
=
0

2



a

m
k




l
+
1


,
y









v

j
,
i

y



k

.






­­­(21)







After the polynomial interpolation, denote the new polynomial coefficients as










a

m
k



r

,
F


=
α


a

m
k



l

,
F


+


1

α




a

m
k




l
+
1


,
F


,




­­­(22)







then, the interpolated reshaped SDR value can be expressed as









F

R
j

r
,
y





v

j
,
i

y



=




k
=
0

2



a

m
k



r

,
F










v

j
,
i

y




k

.




­­­(23)







The backward reshaping function,






B

R
j

r
,
y





,




can be built in the same way.


Interpolation of Chroma Reshaping Functions

In an embodiment, and without loss of generality, instead of expressing reshaping functions as a multi-segment polynomial (e.g., as discussed before for the luma component), one may express reshaping using alternative schemes, such as multiple color channel, multiple regression prediction discussed in Ref. [4] and Ref.[6], where a chroma value is predicted based on a combination of both luma and chroma values.


In Ref. [6], it was shown that given r(l) ≤ r < r(l+1), MMR coefficients can be a linear combination of two nearby MMR coefficients as well, or:










M
t


r



=
α

M
t


l



+


1

α



M
t



l
+
1




,




­­­(24)







where







M
t


l







denotes the set of MMR coefficients for the l-th reshaping function. Alternatively,











F

R
j

r
,
C





=
α

F

R
j


r


l



,
C





+


1

α



F

R
j


r



l
+
1




,
c





,




B

R
j

r
,
C





=
α

B

R
j


r


l



,
C





+


1

α



B

R
j


r



l
+
1




,
C











­­­(25)







where C can be color component c0 or c1 (e.g., Cb or Cr).



FIG. 4 depicts an example of reshaping in an encoder according to an embodiment based on the interpolation of basis forward and backward reshaping functions. As depicted in FIG. 4, the forward reshaping stage may include: a set of basis forward reshaping functions (405), a function interpolation unit (410), which can generate a new forward reshaping function (412) by interpolating from two basis forward reshaping functions, and a forward reshaping unit (415) which will apply the generated forward function (412) to generate the reshaped signal (417), e.g., an SDR signal.


Given the forward reshaping function (412), an encoder could generate the parameters of the reverse or backward reshaping function (e.g., 150) (e.g., see Ref. [5]), which could be transmitted to the decoder as was shown in FIG. 1. Alternatively, as shown in FIG. 4, the encoder may include a separate backward reshaping stage which may include: a set of basis backward reshaping functions (420), and a second function interpolation unit (425), which can generate a new backward reshaping function (427) by interpolating from two basis backward reshaping functions. The parameters of the backward reshaping function may be communicated as metadata. As discussed before, the reshaping functions may be selected based on a metric of the average luminance of the input HDR signal.


For decoding, a decoder may employ the system functionality of FIG. 1B. In another embodiment, to reduce the amount of metadata being communicated, given the L1-mid value being used by the encoder, function interpolation may also be performed at the decoder site (e.g. see Ref. [6]).


REFERENCES

Each of these references is incorporated by reference in its entirety.


1. G-M, Su et al., “Encoding and decoding reversible, production-quality single-layer video signals,” PCT Application, Ser. No. PCT/US2017/023543, filed on Mar. 22, 2017, WIPO Publication WO 2017/165494.


2. Q. Song et al., “High-fidelity full-reference and high-efficiency reduced reference encoding in end-to-end single-layer backward compatible encoding pipeline,” PCT Application, Ser. No. PCT/US2019/031620, filed on May 9, 2019, WIPO Publications, WO 2019/217751.


3. B. Wen et al., “Inverse luma/chroma mappings with histogram transfer and approximation,” U.S. Pat. 10,264,287, issued on Apr. 16, 2019.


4. G-M. Su et al., “Multiple color channel multiple regression predictor,” U.S. Pat. 8,811,490.


5. A. Kheradmand et al., “Block-based content-adaptive reshaping for high-dynamic range,” U.S. Pat. 10,032,262.


6. H. Kadu et al., “Interpolation of reshaping functions, “ PCT Application, Ser. No. PCT/US2019/063796, filed on Nov. 27, 2019.


Example Computer System Implementation

Embodiments of the present invention may be implemented with a computer system, systems configured in electronic circuitry and components, an integrated circuit (IC) device such as a microcontroller, a field programmable gate array (FPGA), or another configurable or programmable logic device (PLD), a discrete time or digital signal processor (DSP), an application specific IC (ASIC), and/or apparatus that includes one or more of such systems, devices or components. The computer and/or IC may perform, control or execute instructions relating to the generation of reshaping functions, such as those described herein. The computer and/or IC may compute, any of a variety of parameters or values that relate to the generation of reshaping functions as described herein. The image and video dynamic range extension embodiments may be implemented in hardware, software, firmware and various combinations thereof.


Certain implementations of the invention comprise computer processors which execute software instructions which cause the processors to perform a method of the invention. For example, one or more processors in a display, an encoder, a set top box, a transcoder or the like may implement methods for the generation of reshaping functions as described above by executing software instructions in a program memory accessible to the processors. The invention may also be provided in the form of a program product. The program product may comprise any non-transitory and tangible medium which carries a set of computer-readable signals comprising instructions which, when executed by a data processor, cause the data processor to execute a method of the invention. Program products according to the invention may be in any of a wide variety of non-transitory and tangible forms. The program product may comprise, for example, physical media such as magnetic data storage media including floppy diskettes, hard disk drives, optical data storage media including CD ROMs, DVDs, electronic data storage media including ROMs, flash RAM, or the like. The computer-readable signals on the program product may optionally be compressed or encrypted.


Where a component (e.g. a software module, processor, assembly, device, circuit, etc.) is referred to above, unless otherwise indicated, reference to that component (including a reference to a “means”) should be interpreted as including as equivalents of that component any component which performs the function of the described component (e.g., that is functionally equivalent), including components which are not structurally equivalent to the disclosed structure which performs the function in the illustrated example embodiments of the invention.


Equivalents, Extensions, Alternatives and Miscellaneous

Example embodiments that relate to the generation of reshaping functions for HDR images are thus described. In the foregoing specification, embodiments of the present invention have been described with reference to numerous specific details that may vary from implementation to implementation. Thus, the sole and exclusive indicator of what is the invention and what is intended by the applicants to be the invention, is the set of claims that issue from this application, in the specific form in which such claims issue, including any subsequent correction. Any definitions expressly set forth herein for terms contained in such claims shall govern the meaning of such terms as used in the claims. Hence, no limitation, element, property, feature, advantage or attribute that is not expressly recited in a claim should limit the scope of such claim in any way. The specification and drawings are, accordingly, to be regarded in an illustrative rather than a restrictive sense.

Claims
  • 1. A method for generating a reshaping function with a processor, the method comprising: accessing a first set of input images in a first dynamic range and a second set of input images in a second dynamic range, wherein corresponding pairs between the first set and the second set of input images represent an identical scene;accessing a first set of backward reshaping functions generated based on the first set of input images and the second set of input images, wherein each backward reshaping function of the first set of backward reshaping functions maps pixel codewords from a first codeword representation in the first dynamic range to a second codeword representation in the second dynamic range, and each backward reshaping function is characterized by a reshaping-index parameter and segment parameters for a segment-based representation of the backward reshaping functions with a set of common pivots; andadjusting the segment parameters in the first set of backward reshaping functions to generate an output set of backward reshaping functions with the same set of common pivots as the first set of backward reshaping functions but with adjusted segment-based polynomial representation, wherein adjusting the segment parameters in a backward reshaping function to generate updated polynomial coefficients comprises: for a segment of a backward reshaping function between a first pivot and a second pivot, wherein the segment is represented in an original polynomial representation by three original polynomial coefficients: i. accessing the three original polynomial coefficients of the segment;ii. initializing a distortion parameter to a first distortion value; andiii. for one or more new values for a first updated polynomial coefficient for the segment:a solving for a second and a third updated polynomial coefficient for the segment based on the first pivot and the second pivot, the new value for the first updated polynomial coefficient, and corresponding outputs for the first pivot and the second pivot according to the original polynomial representation of the segment; andb upon satisfying a distortion criterion, updating an optimum set of polynomial coefficients for the segment with the updated polynomial coefficients.
  • 2. The method of claim 1, wherein solving for the second and the third updated polynomial coefficient for the segment comprises solving for the second and the third updated polynomial coefficient for the segment a system of equations based on the first pivot and the second pivot, the new value for the first updated polynomial coefficient, and corresponding outputs for the first pivot and the second pivot according to the original polynomial representation of the segment.
  • 3. The method of claim 1, wherein satisfying the distortion criterion comprises: after solving for the updated polynomial coefficients, computing a new distortion parameter value based on the updated polynomial coefficients and the original polynomial coefficients;comparing the first distortion value with the new distortion parameter value, and if the new distortion parameter value is smaller than the first distortion value, then satisfying the distortion criterion and updating the first distortion value with the new distortion parameter value.
  • 4. The method of claim 3, wherein computing the new distortion parameter value comprises computing for all codewords within the segment a cumulative error between outputs generated using the original polynomial representation and the updated polynomial representation.
  • 5. The method of claim 1, further comprising, generating a set of output forward reshaping functions based on the set of output backward reshaping functions, wherein a forward reshaping function maps pixel codewords from the second codeword representation in the second dynamic range to the first codeword representation in the first dynamic range.
  • 6. The method of claim 5, wherein generating an output forward reshaping function corresponding to an output backward reshaping function comprises: for each input codeword in the second dynamic range identifying a codeword index for the output backward reshaping function which minimizes a difference between codewords generated by the backward reshaping function and the input codeword.
  • 7. The method of claim 1, wherein the reshaping-index parameter comprises a measure of average luminance in an input image in the second dynamic range.
  • 8. The method of claim 1, wherein the first dynamic range comprises a standard dynamic range and the second dynamic range comprises a high dynamic range.
  • 9. The method of claim 3, wherein for the first segment m = 0 in a segment-based representation of the backward reshaping function comprising two or more segments, the original polynomial representation comprises v^0,bY=a0,0l+a0,1l⋅sbY+a0,2l⋅sbY2 ,whereina0,0l,a0,0l,anda0,2ldenote the original polynomial coefficients, l denotes the reshaping-index parameter of the backward reshaping function in the first set of backward reshaping functions, andsbYdenotes an input codeword in the first dynamic range between the first pivot (λ0) and the second pivot (λ1), and given a first updated polynomial coefficient a′0,1l,solving for the second and the third updated polynomial coefficients comprises computing:a0,0l,∗=a0,0l,a′0,2l=v^1,λ1Y−a0,0l,∗−a′0,1lλ1λ12,whereina0,0l,∗denotes the optimum updated coefficient fora0,0l,a′0,2ldenotes the updated coefficient fora0,2landv^1,λ1Y=a1,0l+a1,1l⋅λ1+a1,2l⋅λ12denotes an output of the original polynomial representation of the second segment in the backward reshaping function for the second pivot.
  • 10. The method of claim 9, wherein the first updated polynomial coefficient iterates in a range of values -a0,1l,n⋅a0,1l,where n is an integer value smaller than 5.
  • 11. The method of claim 9, wherein computing the new distortion parameter value (D′) comprises computing D′=∑b=λ0+1λ1∑k=02a′0kl⋅sbYk−v^0,bY  ..
  • 12. The method of claim 3, wherein for segment m, m > 0, in the segment-based representation of the backward reshaping function, the original polynomial representation comprises v^m,bY=am,0l+am,1l⋅sbY+am,2l⋅sbY2 ,wheream,0l, am,0l,andam,2ldenote the original polynomial coefficients, l denotes the reshaping-index parameter of the backward reshaping function in the set of backward reshaping functions, andsbYdenotes an input codeword in the first dynamic range between the first pivot (λm) and the second pivot (λm+1), and given the first updated polynomial coefficient a′m,0l, solving for the seconda′m,1land the third updated polynomiala′m,2lcoefficients comprises computing:a′m,1l=λm+12v^m,λmY−a′m,0l−λm2v^m+1,λm+1Y−a′m,0lλmλm+1λm+1−λm ,a′m,2l=λm+1v^m,λmY−a′m,0l−λmv^m+1,λm+1Y−a′m,0lλmλm+1λm−λm+1 ,whereinv^m+1,λm+1Y=am+1,0l+am+1,1l⋅λm+1+am+1,21⋅λm+12denotes an output of the original polynomial representation of segment m+1 in the backward reshaping function for the second pivot.
  • 13. The method of claim 12, wherein the first updated coefficient iterates in a range of values −am,0l, n⋅am,0l ,where n is an integer value smaller than 5.
  • 14. The method of claim 12, wherein computing the new distortion parameter value (D′) comprises computing D′=∑b=λm+1λm+1∑k=02a′mkl⋅sbYk−v^m,bY ..
  • 15. The method according to claim 1, further comprising generating a new backward reshaping function by interpolating between two backward reshaping functions of the output set of backward reshaping functions, the two backward reshaping functions being characterized by different reshaping-index parameters.
  • 16. The method according to claim 5, further comprising generating a new forward reshaping function by interpolating between two forward reshaping functions of the set of output forward reshaping functions, the two forward reshaping functions being characterized by different reshaping-index parameters.
  • 17. The method according to claim 15, wherein interpolating between two backward or forward reshaping functions comprises generating an interpolated set of polynomial coefficients for each segment of the new backward or forward reshaping function, based on a set of polynomial coefficients of the two backward or forward reshaping functions.
  • 18. The method according to claim 15, further comprising selecting said two backward or forward reshaping functions based on a measure of an average luminance of an input HDR image to be encoded.
  • 19. A non-transitory computer-readable storage medium having stored thereon computer-executable instructions for executing with one or more processors a method in accordance with claim 1.
  • 20. An apparatus comprising a processor and configured to perform the method recited in claim 1.
Priority Claims (1)
Number Date Country Kind
20170567.0 Apr 2020 EP regional
CROSS-REFERENCE TO RELATED APPLICATIONS

This application claims priority to U.S. Provisional Application No. 63/013,063 and European Patent Application No. 20170567.0, both filed on Apr. 21, 2020, each of which is incorporated by reference in its entirety.

PCT Information
Filing Document Filing Date Country Kind
PCT/US2021/028237 4/20/2021 WO
Provisional Applications (1)
Number Date Country
63013063 Apr 2020 US