Video encoding method, video decoding method, video encoding apparatus, video decoding apparatus, and computer program

The method efficiently maps SDR to HDR data for video encoding, addressing poor HDR support and computational inefficiencies, ensuring effective transmission and decoding across devices.

JP7714859B2Active Publication Date: 2025-07-30HUAWEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
JP2024515704
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Priority Date
2021-09-15
Filing Date
2022-09-08
Publication Date
2025-07-30
Estimated Expiration
2042-09-08

AI Technical Summary

Technical Problem

Many devices do not support high dynamic range (HDR) video, leading to poor display effects, and scalable encoding methods require significant computational resources, wasting processor resources.

Method used

A method for video encoding that maps reconstructed standard dynamic range (SDR) data to HDR data, determining a target residual value with a bit width suitable for SDR bitstreams, and encoding this correspondence to ensure efficient transmission and decoding, using techniques like residual mapping and clamping to adjust bit widths.

Benefits of technology

Ensures efficient video encoding and decoding, reducing bandwidth usage and preventing frame-level switching, while maintaining HDR display quality across devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007714859000002
    Figure 0007714859000002
  • Figure 0007714859000003
    Figure 0007714859000003
  • Figure 0007714859000004
    Figure 0007714859000004
Patent Text Reader

Abstract

The embodiments of the present application provide a video encoding method, a video decoding method and an apparatus, which relate to the field of image processing technology. The video encoding apparatus may: obtain source data, where the source data comprises a first high dynamic range HDR data and a first standard dynamic range SDR bitstream for the same video data; map the reconstruction data of the first SDR bitstream to a second HDR data based on a correspondence relationship between the reconstruction data of the first SDR bitstream and the first HDR data; determine a target residual value between the second HDR data and the first HDR data, where a bit width of the target residual value is less than or equal to a first bit width, and the first bit width is a data bit width for encoding the first SDR video to the first SDR bitstream; encode the correspondence relationship and the target residual value to determine preset data; and transmit the first SDR bitstream to which the preset data is added. In the present application, good processing on the SDR video decoding device and the HDR video decoding device may be guaranteed based on the preset data and the SDR bitstream.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] [Cross - Reference to Related Applications] This application claims priority to Chinese Patent Application No. 202111082879.5, titled "Video Encoding Method, Video Decoding Method and Apparatus", filed with the China National Intellectual Property Administration on September 15, 2021, the entire disclosure of which is incorporated herein by reference.

[0002] Embodiments of this application relate to the field of image processing technology, and more particularly, to video encoding methods, video decoding methods and apparatuses.

Background Art

[0003] In digital images, the dynamic range indicates the ratio of the maximum gray - scale value to the minimum gray - scale value within the displayable range of the image. -3 From 10 6 to 10

[0004] Dynamic range mapping is mainly applied to the front-end HDR signal and the back-end HDR terminal display device. For example, the illumination signal captured by the front-end is 4000 nits (nit), and the HDR display capability of the back-end HDR terminal display device (TV) is only 500 nits. Therefore, mapping a 4000-nit signal to a 500-nit device is dynamic range mapping from high to low. In another example, the front-end captures a 100-nit SDR signal, and the display terminal displays a 2000-nit TV signal. Therefore, displaying a 100-nit signal on a 2000-nit device is dynamic range mapping from low to high.

[0005] Currently, many devices do not support HDR, and the display effect of HDR signals on these devices is low. Therefore, in the prior art, scalable encoding is used for video processing. Specifically, for separate encodings, the same video is split into multiple videos with different resolutions. However, multiple hardware devices do not support scalable encoding, and scalable encoding requires a large amount of data computation. As a result, a large number of processor resources are wasted. Summary of the Invention

[0006] This application provides a video encoding method, a video decoding method, and an apparatus to improve the efficiency of video encoding while guaranteeing the HDR display effect.

[0007] According to a first aspect, this application provides a video encoding method. This method can be executed by a video encoding device. Generally, the video encoding device can be a device that holds a camera lens or a processor, such as a video camera, a mobile phone, a tablet computer, a notebook computer, or a TV. This is not specifically limited here in this application.

[0008] A video encoding device may: obtain source data, where the source data includes first high dynamic range (HDR) data and a first standard dynamic range (SDR) bitstream for the same video data; map the reconstructed data of the first SDR bitstream to second HDR data based on a correspondence between the reconstructed data of the first SDR bitstream and the first HDR data; determine a target residual value between the second HDR data and the first HDR data, where a bit width of the target residual value is less than or equal to a first bit width, and the first bit width is a data bit width for encoding a first SDR video into the first SDR bitstream; encode the correspondence and the target residual value to determine preset data; and transmit the first SDR bitstream with the preset data added thereto.

[0009] The first HDR data in the source data may be received by the video encoding device from a device communicably connected to the video encoding device, or may be obtained through the data processing of the video encoding device for the same video data. It should be noted that this is not specifically limited here in the present application. Generally, video data is large and occupies a large amount of bandwidth resources. Video data is encoded to obtain a video bitstream. During transmission, the video bitstream does not occupy a large amount of bandwidth resources and can guarantee the data transmission efficiency. Therefore, the video encoding device does not directly transmit the video data and needs to encode the video data to obtain a video bitstream for transmission. In addition, the video encoding device usually obtains HDR data and SDR data and encodes the SDR data to obtain an SDR bitstream (i.e., the first SDR bitstream). During video encoding, the video data is usually converted into a video bitstream. This is necessary to meet the data bitwidth requirements of the device or the video data. A larger data bitwidth indicates a higher video data DR and higher image pixels indicated by the video bitstream. A smaller data bitwidth indicates a lower video data DR and lower image pixels indicated by the video bitstream. Generally, the data bitwidth for encoding SDR data to obtain an SDR bitstream is 8 bits, and the data bitwidth for encoding HDR data to obtain an HDR bitstream is 10 bits or 12 bits. In addition, the coding algorithm for SDR data is not limited in the present application and can be any encoding / decoding algorithm such as MPEG-1, MPEG-2, MPEG-4, H.263, H.264, H.265 or JPEG.

[0010] The foregoing reconstructed data is SDR data obtained by decoding the first SDR bitstream. To determine the correspondence between the reconstructed data and the first HDR data, the reconstructed data is compared with the first HDR data. In actual applications, the above correspondence can be determined by comparing the grayscale value, RGB value, or YUV value of the video image. This is not specifically limited herein in the present application.

[0011] It should be noted that the data bit widths corresponding to the HDR data and the data bit widths corresponding to the SDR data usually have different sizes. For example, the data bit width corresponding to the HDR data is 10 bits, and the data bit width corresponding to the SDR data is 8 bits. The video encoding device can convert the target residual value between the first HDR data and the second HDR data into a data bit width that meets the transmission requirements of the first SDR bitstream by means of subtraction operation or normalization operation, etc. Since the data bit width corresponding to the SDR data is 8 bits, the data bit width of the target residual value is also 8 bits or less than 8 bits.

[0012] In this application, the SDR video decoding device and the HDR video decoding device are well supported based on preset data and the SDR bitstream. When the bitstream is an SDR bitstream, the bitstream is explicitly identified as an SDR bitstream by the SDR video decoding device, ensuring the SDR effect. Both the preset data and the SDR bitstream are correctly identified and decoded by the HDR device, ensuring the HDR effect. It should be noted that currently, large bit-width coding is not supported by all encoding / decoding standards. For example, JPEG only supports 8 bits, and both the target residual and SDR are 8 bits. This can guarantee that the video encoding device and the video decoding device can use the same level of codec. Generally, frame-level switching of the hardware encoder or the hardware decoder has high complexity and requires high device processing capabilities. The target residual value is adjusted to be smaller than or equal to the bit width during the encoding of the SDR bitstream. This can prevent frame-level switching of the hardware encoder or the hardware decoder on the encoder side and the decoder side.

[0013] In an optional implementation, the correspondence relationship is to determine a first average value from the reconstructed data and the first HDR data, where the first average value is determined based on a preset parameter of the pixels at a first position of the first HDR data and the reconstructed data; to divide the reconstructed data into a plurality of image blocks and the first HDR data into a plurality of image blocks, where the number and positions of the plurality of image blocks of the reconstructed data are the same as those of the first HDR data respectively; to determine a second average value corresponding to each image block of the reconstructed data and each image block of the first HDR data; and to determine the correspondence relationship based on the first average value or the second average value. The correspondence relationship determined in this way is more accurate, and the determined second HDR data is more reliable.

[0014] In an optional implementation, the preset parameter is a grayscale value, an RGB value, or a YUV value. The preset parameter can alternatively be Y in YUV or L in Lab. This is not specifically limited in this application.

[0015] In an optional implementation, the video encoding device can perform subtraction on the second HDR data and the first HDR data to determine an initial residual value; determine a residual mapping method and a clamping method based on the distribution of the value range of the initial residual value; and map the initial residual value to the target residual value with a bit width smaller than or equal to the first bit width by using the residual mapping method and the clamping method.

[0016] It should be noted that the initial residual value is obtained through subtraction of grayscale values, RGB values, or YUV values at the same position in the second HDR data and the first HDR data. The values obtained through subtraction may be different. To obtain a histogram, statistical analysis can be performed on the initial residual value, and the histogram shows the distribution of the value range of the initial residual value. In actual applications, a curve graph is obtained by plotting points without providing the initial residual value, and shows the distribution of the value range of the initial residual value. The method of displaying the distribution of the value range of the initial residual value is not specifically limited herein in this application.

[0017] In addition, when the initial residual value is converted into a target residual value, some values with large errors in the intermediate calculation process may affect the calculation result, and the influence caused by the initial residual value with a large error during the calculation can be removed by a clamping method. Then, the video encoding device can map the initial residual value to the target residual value in the residual mapping method and the clamping method determined based on the distribution of the value range of the initial residual value.

[0018] In an optional implementation, the video encoding device may determine a histogram based on the initial residual value; determine a residual value corresponding to the central position of the histogram; determine a first value range based on the first bit width and the residual value corresponding to the central position of the histogram; determine a target proportional value of the initial residual included in the first value range based on the distribution of the value range of the initial residual value; and perform residual mapping on the initial residual included in the first value range to clamp the initial residual not included in the first value range.

[0019] It should be noted that after the distribution of the value range of the initial residual value is determined, the video encoding device may determine a first value range based on the value of the first bit width. The initial residual value within the first value range can be mapped to a target residual value whose bit width is smaller than or equal to the first bit width.

[0020] In an optional implementation, the video encoding device determines a first residual value and a second residual value based on the target proportional value and the residual value corresponding to the central position of the histogram, where the first residual value is less than the residual value corresponding to the central position of the histogram, the second residual value is greater than the residual value corresponding to the central position of the histogram, there is at least one first residual value, there is at least one second residual value, the first residual value and the residual value corresponding to the central position of the histogram correspond to a first proportional value, the second residual value and the residual value corresponding to the central position of the histogram correspond to a second proportional value, and the sum of the first proportional value and the second proportional value is the target proportional value; and may perform mapping the initial residual value included between the first residual value and the second residual value to the target residual value and clamping the initial residual value not included between the first residual value and the second residual value to obtain a preset value.

[0021] The first residual value is less than the residual value corresponding to the central position of the histogram, the second residual value is greater than the residual value corresponding to the central position of the histogram, there is at least one first residual value, there is at least one second residual value, the first residual value and the residual value corresponding to the central position of the histogram correspond to a first proportional value, the second residual value and the residual value corresponding to the central position of the histogram correspond to a second proportional value, and the sum of the first proportional value and the second proportional value is the target proportional value.

[0022] Note that currently, large bit-width coding is not supported by all encoding / decoding standards. For example, JPEG only supports 8 bits, and both the target residual and SDR are 8 bits. This can ensure that video encoding devices and video decoding devices can use the same level of codec. Generally, frame-level switching of hardware encoders or hardware decoders has high complexity and requires high device processing capabilities. The target residual value is adjusted to be smaller than or equal to the bit-width during the encoding of the SDR bitstream. This can prevent frame-level switching of hardware encoders or hardware decoders on the encoder side and the decoder side.

[0023] According to a second aspect, the present application provides a video decoding method. This method can be executed by using a video decoding device. Generally, the video decoding device can be a device that holds a display or a processor, such as a mobile phone, a tablet computer, a notebook computer, or a television. This is not specifically limited herein in the present application.

[0024] The video decoding device can receive the first SDR bitstream, where the first SDR bitstream includes preset data, and the preset data is obtained by encoding a correspondence relationship and a target residual value; map the reconstructed data of the first SDR bitstream to second HDR data based on the correspondence relationship; and determine first HDR data based on the target residual value and the second HDR data.

[0025] In an optional implementation, the preset data further includes a residual mapping method and a clamping method.

[0026] In an optional implementation, the video decoding device may determine a first residual value and a second residual value based on the residual mapping method, the clamping method, the target residual value, and the first bit width; determine an initial residual value based on the first residual value, the second residual value, and the clamping method, where the bit width of the initial residual value is greater than or equal to the first bit width; and determine the first HDR data based on the initial residual value and the second HDR data.

[0027] According to a third aspect, the present application obtaining source data, where the source data includes first high dynamic range HDR data and a first standard dynamic range SDR bitstream for the same video data; mapping the reconstructed data of the first SDR bitstream to second HDR data based on a correspondence relationship between the reconstructed data of the first SDR bitstream and the first HDR data; determining a target residual value between the second HDR data and the first HDR data, where the bit width of the target residual value is less than or equal to the first bit width, and the first bit width is a data bit width for encoding a first SDR video into the first SDR bitstream; and a processing unit configured to encode the correspondence relationship and the target residual value to determine preset data; and an input / output unit configured to transmit the first SDR bitstream with the preset data added A video encoding device is provided.

[0028] According to a fourth aspect, the present application is configured to receive a first SDR bitstream, where the first SDR bitstream includes preset data, and the preset data is obtained by encoding a correspondence relationship and a target residual value; and an input / output unit configured to map reconstructed data of the first SDR bitstream to second HDR data based on the correspondence relationship, and determine first HDR data based on the target residual value and the second HDR data A video decoding apparatus is provided that includes the above.

[0029] According to a fifth aspect, an embodiment of the present application provides a video encoding apparatus that includes a non-volatile memory and a processor connected to each other, where the processor calls program code stored in the memory to execute the method in any one of the first aspect or the designs of the first aspect

[0030] According to a sixth aspect, an embodiment of the present application provides a video decoding apparatus that includes a non-volatile memory and a processor connected to each other, where the processor calls program code stored in the memory to execute the method in any one of the second aspect or the designs of the second aspect. It should be noted that the processor does not execute an encoding operation.

[0031] According to a seventh aspect, an embodiment of the present application provides an image processing system that includes the video encoding apparatus in the fifth aspect and the video decoding apparatus in the sixth aspect.

[0032] According to an eighth aspect, an embodiment of the present application provides a computer-readable storage medium. The computer-readable storage medium stores program code, where the program code includes instructions for executing some or all of the steps in the method in either the first aspect or the second aspect.

[0033] According to the ninth aspect, an embodiment of the present application provides a computer program product. When the computer program product operates on a computer, the computer can execute some or all of the steps in the method according to any one of the first aspect or the second aspect.

[0034] For the beneficial effects of the second aspect to the ninth aspect of the present application, please refer to the relevant description of the first aspect. Details will not be described again.

Brief Description of the Drawings

[0035]

Figure 1

[0036]

Figure 2

[0037]

Figure 3

[0038]

Figure 4

[0039]

Figure 5

[0040]

Figure 6

[0041]

Figure 7

Modes for Carrying Out the Invention

[0042] To make the objectives, technical solutions and advantages of the present application clearer, the present application will be described in more detail below with reference to the accompanying drawings. The specific operating methods in the method embodiments may also be applicable to the device embodiments or system embodiments. In the description of the present application, unless otherwise specified, "a plurality of" means two or more. Therefore, for the implementation of the device and method, reference may be made to each other. Repeated descriptions will not be provided.

[0043] In the present application, the term "and / or" describes the corresponding relationship between related objects and may indicate that three relationships may exist. For example, A and / or B may represent the following cases: only A exists, both A and B exist, and only B exists, where A and B may be singular or plural. In addition, unless otherwise stated, ordinal numbers such as "first" and "second" in the embodiments of the present application are used to distinguish multiple objects, but are not intended to limit the order, time series, priority or importance of the multiple objects.

[0044] References to "one embodiment", "some embodiments", etc. described in the specification of the present application mean that one or more embodiments of the present application include the specific features, structures or features described with reference to the embodiments. Therefore, descriptions such as "in one embodiment", "in some embodiments", "in some other embodiments" and "in other embodiments" that appear in various places in this specification do not necessarily refer to the same embodiment. Instead, such descriptions mean "one or more, but not all" of the embodiments, unless otherwise specifically emphasized in another way. The terms "include", "comprise", "have" and their variants all mean "include but are not limited to" unless specifically emphasized otherwise in another way.

[0045] Figure 1 shows an image processing system to which an embodiment of the present application can be applied. The system includes a video encoding device, an HDR video decoding device, and an SDR video decoding device. There may be a plurality of video encoding devices and a plurality of video decoding devices. This is not specifically limited here in the present application. The video encoding device may be configured to capture video data and encode the video data to obtain an HDR video bitstream and an SDR video bitstream. The HDR video decoding device may receive an HDR video bitstream and / or an SDR video bitstream and decode the HDR video bitstream and / or the SDR video bitstream into video data. The SDR video decoding device may receive an SDR video bitstream and decode the SDR video bitstream into video data. The video encoding device may be a device that holds a camera lens or a processor, such as a video camera, a mobile phone, a tablet computer, a notebook computer, or a television. The video decoding device may be a device that holds a display or a processor, such as a mobile phone, a tablet computer, a notebook computer, or a television. In the case of the same image, the video encoding device may obtain images with different DRs by adjusting the image capture method. For example, SDR image 1 (the DR of the SDR image is generally between 1 nit and 100 nits) is determined based on shooting parameter 1 (from 4 exposure values (EV) to 12 EV), SDR image 2 is determined based on shooting parameter 2 (from 8 EV to 16 EV), and the HDR image (the DR of the HDR image is generally between 0.001 nit and 10,000 nits) may be determined based on image 1 and image 2. The shooting parameters corresponding to the HDR image may be from 4 EV to 16 EV. Similarly, since a video includes a plurality of frames of consecutive images, the video capture device may determine an HDR video and an SDR video for the same video.In addition, the video encoding device may further determine HDR video and SDR video in another manner, such as an artificial intelligence-based method. This is not specifically limited herein in the present application. In FIG. 1, an example where the video encoding device can acquire SDR data (video or image) and HDR data is used for explanation.

[0046] EV is a unit that indicates exposure. When the photosensitivity is 100, the F value is F1, the exposure time is 1 second, and the exposure amount is defined as 0. Based on the exposure amount, the exposure decreases by 1 level (the exposure time is reduced by half or the aperture becomes 1 level smaller), and the EV value increases by 1.

[0047] Exposure formula 1 is as follows.

Equation

[0048] A indicates the F value of the lens, T indicates the shutter time (seconds), B indicates the scene luminance, and S indicates the photosensitivity of the film. In photography, EV indicates the sum of AV + TV or the sum of BV + SV. The EV value, that is, the "exposure value", is an abstract concept and indicates the combination of the aperture and the shutter. The aperture and the shutter speed can be freely selected. When the aperture is large, the shutter time needs to be shorter; when the aperture is small, the shutter time needs to be longer. However, as long as the combination of the aperture and the shutter satisfies the specific conditions to ensure that the EV value remains constant, the final exposure amount is the same. Each time the EV value increases by 1.0, the amount of incident light doubles.

[0049] In the H.265 standard, it should be noted that video encoding supports the encoding and display of HDR data with a bit width of 10 bits (bits). However, many devices do not support HDR. Software applications cannot identify HDR data, and software application clients cannot show the good effects of HDR data. In addition, in the standards MPEG-2, MPEG-4, H.264, and H.265, there are solutions regarding scalable encoding. Specifically, the same video is split into multiple videos with different resolutions for separate encodings. However, many hardware devices do not support scalable encoding, and scalable encoding requires a large amount of data computation. As a result, a large number of processor resources are wasted.

[0050] Considering the above cases, the present application provides a video encoding method and a video decoding method to improve video coding efficiency and user experience. Please refer to Figure 2. This method is executed by using a video encoding device and a video decoding device. The video encoding device can execute the video encoding method, and the video decoding device can execute the video decoding method. The following steps are specifically executed.

[0051] Step 201: The video encoding device acquires source data, where the source data includes first HDR data and a first SDR bitstream for the same video data.

[0052] The first HDR data in the source data may be received by the video encoding device from a device communicably connected to the video encoding device, or may be obtained through data processing of the video encoding device for the same video data. It should be noted that this is not specifically limited here in the present application. Generally, video data is large and occupies a large amount of bandwidth resources. Video data is encoded to obtain a video bitstream. During transmission, the video bitstream does not occupy a large amount of bandwidth resources and can guarantee the data transmission efficiency. Therefore, the video encoding device does not directly transmit the video data and needs to encode the video data to obtain a video bitstream for transmission. In addition, the video encoding device usually obtains HDR data and SDR data and encodes the SDR data to obtain an SDR bitstream (i.e., the first SDR bitstream). During video encoding, the video data is usually converted into a video bitstream. This is necessary to meet the data bitwidth requirements of the device or the video data. A larger data bitwidth indicates a higher video data DR and higher image pixels indicated by the video bitstream. A smaller data bitwidth indicates a lower video data DR and lower image pixels indicated by the video bitstream. Generally, the data bitwidth for encoding SDR data to obtain an SDR bitstream is 8 bits, and the data bitwidth for encoding HDR data to obtain an HDR bitstream is 10 bits or 12 bits. In addition, the coding algorithm for SDR data is not limited in the present application and can be any encoding / decoding algorithm such as MPEG-1, MPEG-2, MPEG-4, H.263, H.264, H.265 or JPEG.

[0053] Step 202: The video encoding device maps the reconstructed data of the first SDR bitstream to the second HDR data based on the correspondence between the reconstructed data of the first SDR bitstream and the first HDR data.

[0054] The aforementioned reconstructed data is SDR data obtained by decoding the first SDR bitstream. To determine the correspondence between the reconstructed data and the first HDR data, the reconstructed data is compared with the first HDR data. In actual applications, the above correspondence can be determined by comparing the grayscale value, RGB value, or YUV value of the video image. This is not specifically limited herein in the present application.

[0055] In an optional embodiment, the correspondence can be determined by the following method.

[0056] The video encoding device can determine a first average value from the reconstructed data and the first HDR data, where the first average value is determined based on a preset parameter of the pixels at the first position of the first HDR data and the reconstructed data. The video encoding device divides the reconstructed data into a plurality of image blocks and divides the first HDR data into a plurality of image blocks, where the number and position of the image blocks of the reconstructed data are the same as those of the first HDR data respectively; determines a second average value corresponding to each image block of the reconstructed data and each image block of the first HDR data; and can determine the correspondence based on the first average value or the second average value. The correspondence determined in this way is more accurate, and the determined second HDR data is more reliable.

[0057] The preset parameter may be a grayscale value, an RGB value, Y in YUV, or L in Lab. This is not specifically limited in the present application. The grayscale value is used as an example in this specification for illustration purposes. During actual execution, the video encoding device may collect statistics on the statistical histogram His[i] of the grayscale values of the pixels corresponding to the grayscale values at the positions in the reconstructed data, and the average value avg[i] and variance var[i] of the grayscale values. In actual applications, the image elements at the corresponding positions in the reconstructed data and the first HDR data are the same, and only the pixels or DRs are different. As shown in FIG. 3, both of the image elements corresponding to position A in the reconstructed data and the first HDR data include the number 1. During the calculation, the average value of the grayscale values corresponding to position A, that is, the first average value, may be determined. For example, when the grayscale value I appears at seven positions such as positions 1, 2, 3, 4, 5, 6, and 7 in the reconstructed data, at positions 1, 2, 3, 4, 5, 6, and 7 in the first HDR data (or the image block of the first HDR data), the grayscale value 1, the grayscale value 2,... the grayscale value 7 are searched. In this case, the average value of the grayscale values corresponding to the grayscale value I in the first HDR data (or the image block of the first HDR data) is (grayscale value 1 + grayscale value 2 +... + grayscale value 7) / 7. In FIG. 3, the first HDR data is indicated by the shaded part, and the SDR data is indicated by the non-shaded part.

[0058] In addition, when the variance calculated for all positions is less than the total variance (i.e., the variance of the entire frame of the image) and the variance calculated for all positions is greater than a first preset value, the video encoding device divides the corresponding image of the reconstructed data into a plurality of image blocks, divides the corresponding image of the first HDR data into a plurality of image blocks, and can calculate the statistical histogram subHis[i] of the image blocks, and the average value subAvg[i] and variance subVar[i] of the grayscale values. The first preset value can be set based on actual application requirements. This is not specifically limited herein in the present application. For example, since the bit width of SDR data is 8 bits, the target residual should be limited to 8 bits, and the first preset value is 128.

[0059] For example, when the reconstructed data is divided into 4×4 image blocks, the first HDR data also needs to be divided into 4×4 image blocks, and the sizes of the corresponding image blocks of the above two data are the same. As shown in FIG. 4, the image corresponding to the reconstructed data is divided into four image blocks, the image corresponding to the first HDR data is also divided into four image blocks, and the image elements in image block 1 of the reconstructed data and image block 1 of the first HDR data are the same. In actual applications, the image blocks can alternatively be unevenly assigned. Specifically, as long as image block 1 of the reconstructed data and image block 1 of the first HDR data have the same size and the image elements are the same, image block 1 of the reconstructed data can have a different size from other image blocks 1 of the reconstructed data.

[0060] In actual applications, the local grayscale / tone mapping relationship is obtained based on avg[i] or subAvg[i], and then the local grayscale / tone mapping relationship is processed according to a preset rule, so as to obtain an almost global grayscale / tone mapping relationship, that is, a correspondence relationship. The preset rule may be to determine the correspondence relationship by performing a weighted calculation on the local mapping relationship, or it may be another method. This is not specifically limited herein in the present application. For example, the preset rule is that the local grayscale / tone mapping value is weighted by using the difference value between the local histogram and the global histogram as the weight to obtain the global grayscale / tone mapping value. In addition, the grayscale / tone mapping relationship can be indicated by any curve or matrix parameter. This is not specifically limited herein in the present application.

[0061] Step 203: The video encoding device determines a target residual value between the second HDR data and the first HDR data, where the bit width of the target residual value is smaller than or equal to the first bit width, and the first bit width is the data bit width for encoding the first SDR video into the first SDR bit stream.

[0062] It should be noted that the data bit widths corresponding to HDR data and SDR data usually have different sizes. For example, the data bit width corresponding to HDR data is 10 bits, and the data bit width corresponding to SDR data is 8 bits. The video encoding device can convert the target residual value between the first HDR data and the second HDR data into a data bit width that meets the transmission requirements of the first SDR bit stream by using subtraction operations or normalization operations, etc. Since the data bit width corresponding to SDR data is 8 bits, the data bit width of the target residual value is also 8 bits or less than 8 bits.

[0063] In an optional embodiment, the video encoding device may perform subtraction on the second HDR data and the first HDR data to determine an initial residual value; determine a residual mapping method and a clamping method based on the distribution of the value range of the initial residual value; and map the initial residual value to the target residual value with a bit width smaller than or equal to the first bit width by using the residual mapping method and the clamping method.

[0064] It should be noted that the above initial residual value is obtained through subtraction of grayscale values, RGB values or YUV values at the same position in the second HDR data and the first HDR data. The values obtained through subtraction may be different. To obtain a histogram, statistical analysis may be performed on the initial residual value, and the histogram shows the distribution of the value range of the initial residual value. In actual applications, a curve graph is obtained by plotting points without providing the initial residual value, and shows the distribution of the value range of the initial residual value. The manner of displaying the distribution of the value range of the initial residual value is not specifically limited herein in this application.

[0065] In addition, while the initial residual value is being converted to the target residual value, some values with large errors in the intermediate calculation process may affect the calculation result, and the influence caused by the initial residual value with large errors during the calculation can be removed by the clamping method. Then, the video encoding device may map the initial residual value to the target residual value in the residual mapping method and the clamping method determined based on the distribution of the value range of the initial residual value.

[0066] In an optional embodiment, the video encoding device may determine a histogram based on the initial residual value; determine a residual value corresponding to the center position of the histogram; determine a first value range based on the first bit width and the residual value corresponding to the center position of the histogram; determine a target proportional value of the initial residual included in the first value range based on the distribution of the value range of the initial residual value; and perform residual mapping on the initial residual included in the first value range to clamp the initial residual not included in the first value range.

[0067] It should be noted that after the distribution of the value range of the initial residual value is determined, the video encoding device may determine a first value range based on the value of the first bit width. The initial residual value within the first value range may be mapped to a target residual value whose bit width is smaller than or equal to the first bit width. During actual execution, please refer to the following procedure.

[0068] A. Collect statistics on the histogram of the initial residual value.

[0069] B. Determine the residual value Y corresponding to the center position of the histogram.

[0070] C. Determine the first value range. The critical value Ylow is confirmed based on the residual value Y at the center position in the direction where the residual value is lower than Y, and another critical value Yhigh is confirmed in the direction where the residual value is higher than Y. The initial residual value between the two critical values may be mapped to the target residual value, and the two critical values may be defined as the first value range. The first value range may be determined by subtracting the shift value of the first bit width from the value Y or adding the shift value of the first bit width to the value Y. For example, when the first bit width is 8 bits and corresponds to 2 8 (from 0 to 255), 1 is shifted left by 8 bits, and then 1 bit is subtracted to obtain 128, that is, the critical value of the first value range is Y - 128, and correspondingly, the other critical value is Y + 128 - 1.

[0071] D. Determine the proportional value of the initial residual included in the first value range. For example, when it is determined that the ratio of the initial residual values included in the first value range is 99%, it can be determined whether the initial residual value corresponding to 1% of the histogram is included in the first value range. If yes, it can be determined whether the initial residual corresponding to 100% of the histogram is included in the first value range, and the initial residuals corresponding to 1% to 100% can be mapped to the target residual value. Alternatively, the initial residual value corresponding to A% can be selected before the residual value Y when the proportional value is determined to be 99%, the initial residual value corresponding to B% can be selected after the residual value A, and A% to B% is equal to 99%. For example, A% is 0% and B% is 99%, A% is 0.5% and B is 99.5%, and so on. Both the initial residual value corresponding to A% and the initial residual value corresponding to B% are included in the first value range. This is not specifically limited herein in the present application.

[0072] E. Map the initial residual value included in the first value range to the target residual value.

[0073] In an optional embodiment, the video encoding device determines a first residual value and a second residual value (which can be understood as the above two critical values) based on the target proportional value and the residual value corresponding to the center position of the histogram, maps the initial residual values between the first residual value and the second residual value to the target residual value, and can clamp the initial residual values not included between the first residual value and the second residual value to a preset value.

[0074] The first residual value is less than the residual value corresponding to the central position of the histogram, the second residual value is greater than the residual value corresponding to the central position of the histogram, at least one first residual value exists, at least one second residual value exists, the first residual value and the residual value corresponding to the central position of the histogram correspond to a first proportional value, the second residual value and the residual value corresponding to the central position of the histogram correspond to a second proportional value, and the sum of the first proportional value and the second proportional value is the target proportional value. In the following, for the sake of explanation, a specific example is used. When there are two first residual values, there are also two second residual values. The first residual values are Ylow and Ylow1, and the second residual values are Yhigh and Yhigh1. Assuming that the target proportional value is 98%, the position of K% (for example, 1%) of the histogram distribution can be selected for Ylow1, and the position of N% (for example, 99%) of the histogram distribution can be selected for Yhigh1. When the target proportional value is greater than 90%, the position of L% (for example, 5%) of the histogram distribution can be selected for Ylow, and the position of M% (for example, 95%) of the histogram distribution can be selected for Yhigh.

[0075] For residual mapping, please refer to the following method.

[0076] [Method 1]

[0077] (Ylow, Yhigh) The initial residual value is equal to the original value + (1 << (Bitdepth - 1)) - Y. The residual within (Ylow1, Ylow) is mapped to (0, Ylow + (1 << (Bitdepth - 1)) - Y). The residual within (Yhigh, Yhigh1) is mapped to (Yhigh + (1 << (Bitdepth - 1)) - Y、 (1 << Bitdepth) - 1). Residual values lower than Ylow1 are clamped to 0, and residual values higher than Yhigh1 are clamped to (1 << Bitdepth) - 1.

[0078] [Method 2]

[0079] The residual within (Y - (1 << (Bitdepth - 1)), Y + (1 << (Bitdepth - 1)) - 1) is equal to the original value + (1 << (Bitdepth - 1)) - Y. Residuals less than Y - (1 << (Bitdepth - 1)) are clamped to 0. Residuals greater than Y + (1 << (Bitdepth - 1)) - 1 are clamped to (1 << Bitdepth) - 1.

[0080] Bitdepth indicates the value of the first bit width. For example, the first bit width is 8 bits, the corresponding Bitdepth is 8, the value of Y is 0, Ylow is -100, and Yhigh is 90. When Method 1 is used, the initial residual value within (Ylow, Yhigh) can be, for example, 90, and during mapping, it can be executed as 90 + (1 << (Bitdepth - 1)) - 0, and 218 (90 + 128 - 0) is determined as the target residual value to which 90 is mapped; the initial residual value within (Ylow, Yhigh) can be, for example, -100, and during mapping, it can be executed as -100 + (1 << (Bitdepth - 1)) - 0, and 28 (-100 + 128 - 0) is determined as the target residual value to which -100 is mapped. For example, when Ylow1 is -300, the initial residual value within (Ylow, Ylow1), for example (-300, -100), is mapped to (0, 28), and the initial residual value within (Yhigh, Yhigh1), for example (90, 400), can be mapped to (218, 255). Residual values lower than Ylow1 are clamped to 0, and residual values higher than Yhigh1 are clamped to 255.

[0081] When Method 2 is used, the target residual value can be obtained by directly adding 128 - Y to the initial residual value within (Y - 128, Y + 127), and the initial residual value lower than Y - 128 can be directly clamped to 0, and the initial residual value higher than Y + 127 can be directly clamped to 255.

[0082] Note that currently, large bit-width coding is not supported by all encoding / decoding standards. For example, JPEG only supports 8 bits, and both the target residual and SDR are 8 bits. This can ensure that video encoding devices and video decoding devices can use the same level of codec. Generally, frame-level switching of hardware encoders or hardware decoders has high complexity and requires high device processing capabilities. The target residual value is adjusted to be smaller than or equal to the bit-width during the encoding of the SDR bitstream. This can prevent frame-level switching of hardware encoders or hardware decoders on the encoder side and the decoder side.

[0083] Step 204: The video encoding device determines preset data by encoding the correspondence relationship and the target residual value.

[0084] Note that the preset data can be understood as user-defined data. After obtaining the preset data, the video decoding device can convert SDR data to HDR data during the decoding of the bitstream.

[0085] Step 205: The video encoding device transmits the first SDR bitstream with the preset data added. Accordingly, the video decoding device receives the first SDR bitstream.

[0086] Step 206: The video decoding device maps the reconstructed data of the first SDR bitstream to the second HDR data based on the correspondence relationship.

[0087] Step 207: The video decoding device determines the first HDR data based on the target residual value and the second HDR data.

[0088] In an optional embodiment, the preset data further includes a residual mapping method and a clamping method. The video decoding device may determine the first residual value and the second residual value based on the residual mapping method, the clamping method, the target residual value, and the first bit width; determine the initial residual value based on the first residual value, the second residual value, and the clamping method, where the bit width of the initial residual value is greater than or equal to the first bit width; and determine the first HDR data based on the initial residual value and the second HDR data.

[0089] During specific execution, the target residual value can be restored to the initial residual value according to the following method, that is, the inverse operation of the residual mapping of the aforementioned video encoding device.

[0090] [Method 1]

[0091] The residual value within (0, Ylow + (1 << (Bitdepth - 1)) - Y) is mapped to (Ylow1, Ylow), and the residual value within (Yhigh + (1 << (Bitdepth - 1)) - Y, (1 << Bitdepth) - 1) is mapped to (Yhigh, Yhigh1); Y - (1 << (Bitdepth - 1)) is added to the residual value within (Ylow + (1 << (Bitdepth - 1)) - Y, Yhigh + (1 << (Bitdepth - 1)) - Y) is added to the residual value within.

[0092] [Method 2]

[0093] Y - (1 << (Bitdepth - 1)) is added to each of all the target residual values.

[0094] The bit depth indicates the value of the first bit width. For example, the first bit width is 8 bits, the corresponding bit depth is 8, the value of Y is 0, Ylow is -100, and Yhigh is 90. When Method 1 is used, the target residual values within (0, 28) can be mapped to (-300, -100), the target residual values within (90 + 128, 255) can be mapped to (90, 400), and the initial residual value is determined by subtracting 128 from the target residual values within (-100 + 128, 90 + 128).

[0095] When Method 2 is used, the initial residual value, that is, the initial bit width of 10 bits, can be obtained by adding Y - 128 to the target residual value.

[0096] In the present application, the SDR video decoding device and the HDR video decoding device are well supported based on the preset data and the SDR bit stream. When the bit stream is an SDR bit stream, the bit stream is explicitly identified as an SDR bit stream by the SDR video decoding device to guarantee the SDR effect. Both the preset data and the SDR bit stream are correctly identified and decoded by the HDR device to guarantee the HDR effect.

[0097] In addition, FIG. 5 shows an image processing device further provided in the present application. The device can be a video encoding device or a video decoding device. This is not specifically limited here in the present application. The image processing device can include an input / output unit 501 and a processing unit 502.

[0098] When the image processing apparatus is a video encoding apparatus, the processing unit 502 is configured to: obtain source data, where the source data includes first high dynamic range HDR data and a first standard dynamic range SDR bitstream for the same video data; map the reconstructed data of the first SDR bitstream to second HDR data based on the correspondence between the reconstructed data of the first SDR bitstream and the first HDR data; determine a target residual value between the second HDR data and the first HDR data, where the bit width of the target residual value is less than or equal to a first bit width, and the first bit width is the data bit width for encoding a first SDR video into the first SDR bitstream; and encode the correspondence and the target residual value to determine preset data; and the input / output unit 501 is configured to transmit the first SDR bitstream with the preset data added thereto.

[0099] The first HDR data in the source data may be received by the video encoding device from a device communicably connected to the video encoding device, or may be obtained through data processing of the video encoding device for the same video data. It should be noted that this is not specifically limited herein in the present application. Generally, video data is large and occupies a large amount of bandwidth resources. Video data is encoded to obtain a video bitstream. During transmission, the video bitstream does not occupy a large amount of bandwidth resources and can guarantee the transmission efficiency of data. Therefore, the video encoding device does not directly transmit the video data and needs to encode the video data to obtain a video bitstream for transmission. In addition, the video encoding device usually obtains HDR data and SDR data and encodes the SDR data to obtain an SDR bitstream (i.e., the first SDR bitstream). During video encoding, the video data is usually converted into a video bitstream. This is necessary to meet the data bitwidth requirements of the device or the video data. A larger data bitwidth indicates a higher video data DR and higher image pixels indicated by the video bitstream. A smaller data bitwidth indicates a lower video data DR and lower image pixels indicated by the video bitstream. Generally, the data bitwidth for encoding SDR data to obtain an SDR bitstream is 8 bits, and the data bitwidth for encoding HDR data to obtain an HDR bitstream is 10 bits or 12 bits. In addition, the coding algorithm for SDR data is not limited in the present application and can be any encoding / decoding algorithm such as MPEG-1, MPEG-2, MPEG-4, H.263, H.264, H.265 or JPEG.

[0100] The foregoing reconstructed data is SDR data obtained by decoding the first SDR bitstream. To determine the correspondence between the reconstructed data and the first HDR data, the reconstructed data is compared with the first HDR data. In actual applications, the above correspondence can be determined by comparing the grayscale value, RGB value, or YUV value of the video image. This is not specifically limited herein in the present application.

[0101] It should be noted that the data bitwidth corresponding to the HDR data and the data bitwidth corresponding to the SDR data usually differ in size. For example, the data bitwidth corresponding to the HDR data is 10 bits, and the data bitwidth corresponding to the SDR data is 8 bits. The video encoding device can convert the target residual value between the first HDR data and the second HDR data to a data bitwidth that meets the transmission requirements of the first SDR bitstream by using subtraction operations, normalization operations, etc. Since the data bitwidth corresponding to the SDR data is 8 bits, the data bitwidth of the target residual value is also 8 bits or less than 8 bits.

[0102] In the present application, the SDR video decoding device and the HDR video decoding device are well supported based on preset data and the SDR bitstream. When the bitstream is an SDR bitstream, the bitstream is explicitly identified as an SDR bitstream by the SDR video decoding device, ensuring the SDR effect. Both the preset data and the SDR bitstream are correctly identified and decoded by the HDR device, ensuring the HDR effect. It should be noted that currently, coding with a large bit width is not supported by all encoding / decoding standards. For example, JPEG only supports 8 bits, and both the target residual and SDR are 8 bits. This can ensure that the video encoding device and the video decoding device can use the same level of codec. Generally, frame-level switching of a hardware encoder or a hardware decoder has high complexity and requires high device processing capabilities. The target residual value is adjusted to be smaller than or equal to the bit width during the encoding of the SDR bitstream. This can prevent frame-level switching of the hardware encoder or the hardware decoder on the encoder side and the decoder side.

[0103] In an optional implementation, the corresponding relationship is Determining a first average value from the reconstructed data and the first HDR data, where the first average value is determined based on a preset parameter of pixels at a first position of the first HDR data and the reconstructed data; dividing the reconstructed data into a plurality of image blocks and dividing the first HDR data into a plurality of image blocks, where the number and positions of the plurality of image blocks of the reconstructed data are the same as those of the first HDR data respectively; determining a second average value corresponding to each image block of the reconstructed data and each image block of the first HDR data; and determining the correspondence based on the first average value or the second average value. The correspondence determined in this way is more accurate, and the determined second HDR data is more reliable.

[0104] In an optional implementation, the preset parameter is a grayscale value, an RGB value or a YUV value.

[0105] In an optional implementation, the processing unit 502 performs subtraction on the second HDR data and the first HDR data to determine an initial residual value; determines a residual mapping method and a clamping method based on the distribution of the value range of the initial residual value; and is specifically configured to map the initial residual value to the target residual value with a bit width smaller than or equal to the first bit width by the residual mapping method and the clamping method.

[0106] It should be noted that the initial residual value is obtained through subtraction of grayscale values, RGB values, or YUV values at the same position in the second HDR data and the first HDR data. The values obtained through subtraction may be different. To obtain a histogram, statistical analysis may be performed on the initial residual value, and the histogram shows the distribution of the value range of the initial residual value. In actual applications, a curve graph is obtained by plotting points without providing the initial residual value, and shows the distribution of the value range of the initial residual value. The manner of displaying the distribution of the value range of the initial residual value is not specifically limited herein in this application.

[0107] In addition, when the initial residual value is converted into a target residual value, some values with large errors in the intermediate calculation process may affect the calculation result, and the influence caused by the initial residual value with a large error during calculation can be removed by a clamping method. Then, the video encoding device may map the initial residual value to the target residual value in the residual mapping method and the clamping method determined based on the distribution of the value range of the initial residual value.

[0108] In an optional implementation, the processing unit 502 is specifically configured to determine a histogram based on the initial residual value; determine a residual value corresponding to the center position of the histogram; determine a first value range based on the first bit width and the residual value corresponding to the center position of the histogram; determine a target proportional value of the initial residual included in the first value range based on the distribution of the value range of the initial residual value; and perform residual mapping on the initial residual included in the first value range to clamp the initial residual not included in the first value range.

[0109] It should be noted that after the distribution of the value range of the initial residual value is determined, the video encoding device may determine a first value range based on the value of the first bit width. The initial residual value within the first value range may be mapped to a target residual value with a bit width smaller than or equal to the first bit width.

[0110] In an optional implementation, the processing unit 502 determines a first residual value and a second residual value based on the target proportional value and the residual value corresponding to the central position of the histogram, where the first residual value is less than the residual value corresponding to the central position of the histogram, the second residual value is greater than the residual value corresponding to the central position of the histogram, there is at least one first residual value, there is at least one second residual value, the first residual value and the residual value corresponding to the central position of the histogram correspond to a first proportional value, the second residual value and the residual value corresponding to the central position of the histogram correspond to a second proportional value, and the sum of the first proportional value and the second proportional value is the target proportional value; and specifically configured to obtain a preset value by mapping an initial residual value included between the first residual value and the second residual value to the target residual value and clamping an initial residual value not included between the first residual value and the second residual value.

[0111] The first residual value is less than the residual value corresponding to the central position of the histogram, the second residual value is greater than the residual value corresponding to the central position of the histogram, there is at least one first residual value, there is at least one second residual value, the first residual value and the residual value corresponding to the central position of the histogram correspond to a first proportional value, the second residual value and the residual value corresponding to the central position of the histogram correspond to a second proportional value, and the sum of the first proportional value and the second proportional value is the target proportional value.

[0112] Note that currently, large bit-width coding is not supported by all encoding / decoding standards. For example, JPEG only supports 8 bits, and both the target residual and SDR are 8 bits. This can ensure that video encoding devices and video decoding devices can use the same level of codec. Generally, frame-level switching of hardware encoders or hardware decoders has high complexity and requires high device processing capabilities. The target residual value is adjusted to be smaller than or equal to the bit-width during the encoding of the SDR bitstream. This can prevent frame-level switching of hardware encoders or hardware decoders on the encoder side and the decoder side.

[0113] When the image processing device is a video decoding device, the input / output unit 501 may be configured to receive a first SDR bitstream, where the first SDR bitstream includes preset data, and the preset data is obtained by encoding a correspondence relationship and a target residual value; the processing unit 502 may be configured to map the reconstructed data of the first SDR bitstream to second HDR data based on the correspondence relationship, and determine first HDR data based on the target residual value and the second HDR data.

[0114] In an optional implementation, the preset data further includes a residual mapping method and a clamping method.

[0115] In an optional implementation, the processing unit 502 determines a first residual value and a second residual value based on the residual mapping method, the clamping method, the target residual value, and the first bit width; determines an initial residual value based on the first residual value, the second residual value, and the clamping method, where the bit width of the initial residual value is greater than or equal to the first bit width; and is specifically configured to determine the first HDR data based on the initial residual value and the second HDR data.

[0116] In addition, the present application further provides an image processing apparatus 600 as shown in FIG. 6. For example, the image processing apparatus 600 can be a chip or a chip system. Optionally, in this embodiment of the present application, the chip system may include a chip, or may include a chip and another discrete device.

[0117] The image processing apparatus 600 may include at least one processor 610. The image processing apparatus 600 may further include at least one memory 620 configured to store a computer program, program instructions, and / or data. The memory 620 is connected to the processor 610. The connection in this embodiment of the present application can be an indirect connection or a communication connection between devices, units, or modules, and can be in an electrical form, a mechanical form, or another form, and is used for the exchange of information between devices, units, or modules. The processor 610 can operate in cooperation with the memory 620. The processor 610 can execute the computer program stored in the memory 620. Optionally, at least one memory 620 can alternatively be integrated into the processor 610.

[0118] Optionally, in actual applications, the image processing apparatus 600 may or may not include the transceiver 630. The dashed box is used as an example in the drawing. The image processing apparatus 600 can exchange information with another device by using the transceiver 630. The transceiver 630 can be a circuit, a bus, a transceiver, or any other device configured to exchange information.

[0119] In a possible implementation, the image processing apparatus 600 can be used in the aforementioned video encoding apparatus or the aforementioned video decoding apparatus. The memory 620 stores computer programs, program instructions, and / or data necessary to implement the functions of the video encoding apparatus or the video decoding apparatus in any one of the aforementioned embodiments. The processor 610 can execute the computer program stored in the memory 620 to complete the method in any one of the aforementioned embodiments.

[0120] The specific connection medium between the transceiver 630, the processor 610, and the memory 620 is not limited in the embodiments of the present application. In this embodiment of the present application, in FIG. 6, the memory 620, the processor 610, and the transceiver 630 are connected to each other via a bus. The bus is shown as a thick line in FIG. 6. The connection method between other components is not limited to this, but is merely described as an example. The bus can be classified into an address bus, a data bus, a control bus, etc. For ease of indication, the bus is indicated by only one thick line in FIG. 6. However, this does not mean that only one bus or only one type of bus exists. In the embodiments of the present application, the processor can be a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array, or another programmable logic device, a discrete gate, or a transistor logic device, or a discrete hardware component, and can implement or execute the methods, steps, and logical block diagrams disclosed in the embodiments of the present application. The general-purpose processor can be a microprocessor, or any conventional processor, etc. The steps of the method disclosed with reference to the embodiments of the present application can be executed and completed by a hardware processor, or can be directly executed and completed by a combination of hardware and software modules within the processor.

[0121] In an embodiment of the present application, the memory may be a non-volatile memory, for example, a hard disk drive (HDD) or a solid-state drive (SSD), or may be a volatile memory such as a random access memory (RAM). Alternatively, the memory may be any other medium that can be configured to hold or store the expected program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. Alternatively, the memory in an embodiment of the present application may be a circuit or any other device capable of implementing a storage function and is configured to store a computer program, program instructions, and / or data.

[0122] Based on the foregoing embodiments, as shown in FIG. 7, an embodiment of the present application further provides another image processing apparatus 700 including an interface circuit 710 and a logic circuit 720. The interface circuit 710 can be understood as an input / output interface and can be configured to execute the same operation steps as those of the input / output unit shown in FIG. 5 or the transceiver shown in FIG. 6. Details are not described herein again in the present application. The logic circuit 720 can be configured to operate code instructions to execute the method in any one of the foregoing embodiments, can be understood as the processing unit in FIG. 5 or the processor in FIG. 6, and can implement the same functions as the processing unit or the processor. Details are not described herein again in the present application.

[0123] Based on the foregoing embodiments, embodiments of the present application further provide a readable storage medium. The readable storage medium stores instructions. When the instructions are executed, a method executed by the video encoding method or the video decoding method in any one of the foregoing embodiments is implemented. The readable storage medium may include any medium capable of storing program code, such as a USB flash drive, a removable hard disk drive, a read-only memory, a random access memory, a magnetic disk, or an optical disk.

[0124] A person skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can be used in the form of an embodiment implemented only by hardware, an embodiment implemented only by software, or an embodiment implemented by a combination of software and hardware. In addition, the present application can be used in the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk memory, compact optical disc read-only memory (CD-ROM), and optical memory, etc.) containing computer-usable program code.

[0125] This application is described with reference to flowcharts and / or block diagrams of methods, apparatus (systems) and computer program products according to the application. It should be understood that computer program instructions may be used to implement each procedure and / or each block in the flowchart and / or block diagram, as well as combinations of procedures and / or blocks in the flowchart and / or block diagram. These computer program instructions are provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or another programmable data processing device to generate a machine, so that the instructions executed by the computer or another programmable data processing device processor can generate an apparatus for implementing specific functions in one or more procedures in the flowchart and / or one or more blocks in the block diagram.

[0126] Alternatively, these computer program instructions may be stored in a computer-readable memory that can direct a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory can generate an artifact including an instruction device. The instruction device implements specific functions in one or more procedures in one or more blocks in the flowchart and / or block diagram.

[0127] Alternatively, these computer program instructions may be loaded into a computer or other programmable data processing device, so that a series of operational steps may be executed on the computer or other programmable device to generate a computer-implemented process. Therefore, the instructions executed on the computer or other programmable device provide steps for implementing specific functions in one or more procedures in the flowchart and / or one or more blocks in the block diagram. 。 [Item 1] A stage of acquiring source data, where the source data includes first high dynamic range HDR data and a first standard dynamic range SDR bitstream for the same video data; A stage of mapping the reconstructed data of the first SDR bitstream to second HDR data based on the correspondence between the reconstructed data of the first SDR bitstream and the first HDR data; A stage of determining a target residual value between the second HDR data and the first HDR data, where the bit width of the target residual value is smaller than or equal to a first bit width, and the first bit width is the data bit width for encoding a first SDR video into the first SDR bitstream; A stage of encoding the correspondence and the target residual value to determine preset data; and A stage of transmitting the first SDR bitstream with the preset data added A video encoding method comprising the above steps. [Item 2] The correspondence is Determining a first average value from the reconstructed data and the first HDR data, where the first average value is determined based on preset parameters of pixels at a first position of the first HDR data and the reconstructed data; Dividing the reconstructed data into a plurality of image blocks and dividing the first HDR data into a plurality of image blocks, where the number and positions of the plurality of image blocks of the reconstructed data are the same as those of the first HDR data respectively; Determining a second average value corresponding to each image block of the reconstructed data and each image block of the first HDR data; and Determining the correspondence based on the first average value or the second average value The method according to Item 1, determined in the above manner. [Item 3] The preset parameter according to the method of Item 2 is a grayscale value, an RGB value or a YUV value. [Item 4] The stage of determining the target residual value between the second HDR data and the first HDR data is A stage of performing subtraction on the second HDR data and the first HDR data to determine an initial residual value; A stage of determining a residual mapping method and a clamping method based on the distribution of the value range of the initial residual value; and Mapping the initial residual value to the target residual value with a bit width less than or equal to the first bit width by the residual mapping method and the clamping method The method according to any one of items 1 to 3, having this step. [Item 5] The step of determining the residual mapping method and the clamping method based on the distribution of the value range of the initial residual value includes: Determining a histogram based on the initial residual value; Determining a residual value corresponding to the central position of the histogram; Determining a first value range based on the first bit width and the residual value corresponding to the central position of the histogram; Determining a target proportional value of the initial residual included in the first value range based on the distribution of the value range of the initial residual value; and Performing residual mapping on the initial residual included in the first value range and clamping the initial residual not included in the first value range The method according to item 4, having this step. [Item 6] The step of mapping the initial residual value to the target residual value with a bit width less than or equal to the first bit width by the residual mapping method and the clamping method includes: Determining a first residual value and a second residual value based on the target proportional value and the residual value corresponding to the central position of the histogram, where the first residual value is less than the residual value corresponding to the central position of the histogram, the second residual value is greater than the residual value corresponding to the central position of the histogram, at least one first residual value exists, at least one second residual value exists, the first residual value and the residual value corresponding to the central position of the histogram correspond to a first proportional value, the second residual value and the residual value corresponding to the central position of the histogram correspond to a second proportional value, and the sum of the first proportional value and the second proportional value is the target proportional value; and Mapping the initial residual value included between the first residual value and the second residual value to the target residual value and obtaining a preset value by clamping the initial residual value not included between the first residual value and the second residual value The method according to item 5, having this step. [Item 7] Receiving a first SDR bitstream, where the first SDR bitstream comprises preset data, and the preset data is obtained by encoding a correspondence relationship and a target residual value; Mapping reconstructed data of the first SDR bitstream to second HDR data based on the correspondence relationship; and Determining first HDR data based on the target residual value and the second HDR data A video decoding method comprising: [Item 8] The method according to item 7, wherein the preset data further comprises a residual mapping method and a clamping method. [Item 9] The step of determining first HDR data based on the target residual value and the second HDR data comprises: Determining a first residual value and a second residual value based on the residual mapping method, the clamping method, the target residual value, and a first bit width; Determining an initial residual value based on the first residual value, the second residual value, and the clamping method, where the bit width of the initial residual value is greater than or equal to the first bit width; and Determining the first HDR data based on the initial residual value and the second HDR data The method according to item 8, comprising: [Item 10] Obtaining source data, where the source data comprises first high dynamic range HDR data and a first standard dynamic range SDR bitstream for the same video data; mapping the reconstructed data of the first SDR bitstream to second HDR data based on the correspondence relationship between the reconstructed data of the first SDR bitstream and the first HDR data; determining a target residual value between the second HDR data and the first HDR data, where the bit width of the target residual value is less than or equal to a first bit width, and the first bit width is the data bit width for encoding a first SDR video into the first SDR bitstream; and a processing unit configured to encode the correspondence relationship and the target residual value to determine preset data; and An input / output unit configured to transmit the first SDR bitstream with the preset data added A video encoding device comprising [Item 11] The correspondence relationship is Determining a first average value from the reconstructed data and the first HDR data, where the first average value is determined based on a preset parameter of pixels at a first position of the first HDR data and the reconstructed data; Dividing the reconstructed data into a plurality of image blocks and dividing the first HDR data into a plurality of image blocks, where the number and positions of the plurality of image blocks of the reconstructed data are the same as those of the first HDR data respectively; ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ Determining a first residual value and a second residual value based on the target proportional value and the residual value corresponding to the center position of the histogram, wherein the first residual value is less than the residual value corresponding to the center position of the histogram, the second residual value is greater than the residual value corresponding to the center position of the histogram, there is at least one first residual value, there is at least one second residual value, the first residual value and the residual value corresponding to the center position of the histogram correspond to a first proportional value, the second residual value and the residual value corresponding to the center position of the histogram correspond to a second proportional value, and the sum of the first proportional value and the second proportional value is the target proportional value; and mapping an initial residual value included between the first residual value and the second residual value to the target residual value, and clamping an initial residual value not included between the first residual value and the second residual value to obtain a preset value The apparatus according to item 14, which is specifically configured to perform the above operations [Item 16] An input / output unit configured to receive a first SDR bit stream, where the first SDR bit stream includes preset data, and the preset data is obtained by encoding a correspondence relationship and a target residual value A processing unit configured to map the reconstructed data of the first SDR bit stream to second HDR data based on the correspondence relationship, and determine first HDR data based on the target residual value and the second HDR data A video decoding apparatus comprising the above components [Item 17] The apparatus according to item 16, wherein the preset data further includes a residual mapping method and a clamping method [Item 18] The processing unit is Determining a first residual value and a second residual value based on the residual mapping method, the clamping method, the target residual value and the first bit width Determining an initial residual value based on the first residual value, the second residual value and the clamping method, where the bit width of the initial residual value is greater than or equal to the first bit width; and Determining the first HDR data based on the initial residual value and the second HDR data The apparatus according to item 16, which is specifically configured to perform the above operations [Item 19] A video encoding device comprising a non-volatile memory and a processor connected to each other, wherein the processor executes the method according to any one of Items 1 to 6 by calling program code stored in the memory. [Item 20] A video decoding device comprising a non-volatile memory and a processor connected to each other, wherein the processor executes the method according to any one of Items 7 to 9 by calling program code stored in the memory. [Item 21] A computer-readable storage medium that stores program code, the program code comprising instructions to be used by a processor to execute the method according to any one of Items 1 to 9.

Claims

1. Obtaining source data, where the source data comprises a first high dynamic range (HDR) data and a first standard dynamic range (SDR) bitstream for the same video data; Mapping the reconstructed data of the first SDR bitstream to second HDR data based on the correspondence relationship between the reconstructed data of the first SDR bitstream and the first HDR data; Determining a target residual value between the second HDR data and the first HDR data, where the bit width of the target residual value is smaller than or equal to a first bit width, and the first bit width is the data bit width for encoding a first SDR video into the first SDR bitstream; Encoding the correspondence relationship and the target residual value to determine preset data; and Transmitting the first SDR bitstream with the preset data added comprising, Before the step of determining the target residual value between the second HDR data and the first HDR data, Performing subtraction on the second HDR data and the first HDR data to determine an initial residual value; Determining a residual mapping method and a clamping method based on the distribution of the value range of the initial residual value; and Mapping the initial residual value to the target residual value with a bit width smaller than or equal to the first bit width by the residual mapping method and the clamping method A video encoding method having.

2. The correspondence relationship is, Determining a first average value from the reconstructed data and the first HDR data, where the first average value is determined based on a preset parameter of pixels at a first position of the first HDR data and the reconstructed data; Dividing the reconstructed data into a plurality of image blocks and dividing the first HDR data into a plurality of image blocks, where the number and positions of the plurality of image blocks of the reconstructed data are the same as those of the first HDR data respectively; Determining a second average value corresponding to each image block of the reconstructed data and each image block of the first HDR data; and Determining the correspondence relationship based on the first average value or the second average value The video encoding method according to claim 1, determined by the method with [reference].

3. The video encoding method according to claim 2, wherein the preset parameter is a grayscale value, an RGB value, or a YUV value.

4. The step of determining a residual mapping method and a clamping method based on the distribution of the value range of the initial residual value includes: Determining a histogram based on the initial residual value; Determining a residual value corresponding to the center position of the histogram; Determining a first value range based on the first bit width and the residual value corresponding to the center position of the histogram; Determining a target proportional value of the initial residual included in the first value range based on the distribution of the value range of the initial residual value; and Performing residual mapping on the initial residual included in the first value range and clamping the initial residual not included in the first value range. The video encoding method according to claim 1, comprising the above steps.

5. The step of mapping the initial residual value to a target residual value with a bit width smaller than or equal to the first bit width by the residual mapping method and the clamping method includes: Determining a first residual value and a second residual value based on the target proportional value and the residual value corresponding to the center position of the histogram, where the first residual value is less than the residual value corresponding to the center position of the histogram, the second residual value is greater than the residual value corresponding to the center position of the histogram, at least one first residual value exists, at least one second residual value exists, the first residual value and the residual value corresponding to the center position of the histogram correspond to a first proportional value, the second residual value and the residual value corresponding to the center position of the histogram correspond to a second proportional value, and the sum of the first proportional value and the second proportional value is the target proportional value; and Mapping the initial residual value included between the first residual value and the second residual value to the target residual value and clamping the initial residual value not included between the first residual value and the second residual value to obtain a preset value. The video encoding method according to claim 4, comprising the above steps.

6. Receiving a first standard dynamic range (SDR) bitstream, wherein the first SDR bitstream comprises preset data, and the preset data is obtained by encoding a correspondence relationship and a target residual value; Mapping reconstructed data of the first SDR bitstream to second high dynamic range (HDR) data based on the correspondence relationship; and Determining first HDR data based on the target residual value and the second HDR data comprising The preset data further comprises a residual mapping method and a clamping method, a video decoding method.

7. The step of determining first HDR data based on the target residual value and the second HDR data is Determining a first residual value and a second residual value based on the residual mapping method, the clamping method, the target residual value, and a first bit width; Determining an initial residual value based on the first residual value, the second residual value, and the clamping method, wherein a bit width of the initial residual value is greater than or equal to the first bit width; and Determining the first HDR data based on the initial residual value and the second HDR data The video decoding method according to claim 6, comprising.

8. Obtaining source data, wherein the source data comprises first high dynamic range (HDR) data and a first standard dynamic range (SDR) bitstream for the same video data; mapping the reconstructed data of the first SDR bitstream to second HDR data based on a correspondence relationship between the reconstructed data of the first SDR bitstream and the first HDR data; determining a target residual value between the second HDR data and the first HDR data, wherein a bit width of the target residual value is less than or equal to a first bit width, and the first bit width is a data bit width for encoding a first SDR video into the first SDR bitstream; and a processing unit configured to encode the correspondence relationship and the target residual value to determine preset data; and An input / output unit configured to transmit the first SDR bitstream with the pre-set data added thereto is provided, wherein the processing unit performs subtraction on the second HDR data and the first HDR data to determine an initial residual value; determines a residual mapping method and a clamping method based on the distribution of the value range of the initial residual value; and maps the initial residual value to the target residual value whose bit width is smaller than or equal to the first bit width by the residual mapping method and the clamping method is specifically configured to perform. A video encoding device.

9. The correspondence relationship is determining a first average value from the reconstructed data and the first HDR data, where the first average value is determined based on a pre-set parameter of pixels at a first position of the first HDR data and the reconstructed data; dividing the reconstructed data into a plurality of image blocks and dividing the first HDR data into a plurality of image blocks, where the number and positions of the plurality of image blocks of the reconstructed data are the same as those of the first HDR data respectively; determining a second average value corresponding to each image block of the reconstructed data and each image block of the first HDR data; and determining the correspondence relationship based on the first average value or the second average value is determined by the method of. The video encoding device according to claim 8.

10. The pre-set parameter is a grayscale value, an RGB value or a YUV value. The video encoding device according to claim 9.

11. The processing unit determines a histogram based on the initial residual value; determines a residual value corresponding to the center position of the histogram; determines a first value range based on the first bit width and the residual value corresponding to the center position of the histogram; determines a target proportional value of the initial residual included in the first value range based on the distribution of the value range of the initial residual value; and performs residual mapping on the initial residual included in the first value range and clamps the initial residual not included in the first value range is specifically configured to perform. The video encoding device according to claim 8.

12. The processing unit Determining a first residual value and a second residual value based on the target proportional value and the residual value corresponding to the center position of the histogram, where the first residual value is less than the residual value corresponding to the center position of the histogram, the second residual value is greater than the residual value corresponding to the center position of the histogram, there is at least one first residual value, there is at least one second residual value, the first residual value and the residual value corresponding to the center position of the histogram correspond to a first proportional value, the second residual value and the residual value corresponding to the center position of the histogram correspond to a second proportional value, and the sum of the first proportional value and the second proportional value is the target proportional value; and mapping an initial residual value included between the first residual value and the second residual value to the target residual value and clamping an initial residual value not included between the first residual value and the second residual value to obtain a preset value The video encoding apparatus according to claim 11, which is specifically configured to perform the above operations

13. Receiving a first standard dynamic range (SDR) bitstream, where the first SDR bitstream includes preset data, and the preset data is obtained by encoding a correspondence relationship and a target residual value, and an input / output unit configured to perform the above operations; and A processing unit configured to map the reconstructed data of the first SDR bitstream to second high dynamic range (HDR) data based on the correspondence relationship and to determine first HDR data based on the target residual value and the second HDR data Comprising The preset data further includes a residual mapping method and a clamping method, and a video decoding apparatus

14. The processing unit is Determining a first residual value and a second residual value based on the residual mapping method, the clamping method, the target residual value, and a first bit width; Determining an initial residual value based on the first residual value, the second residual value, and the clamping method, where the bit width of the initial residual value is greater than or equal to the first bit width; and Determining the first HDR data based on the initial residual value and the second HDR data The video decoding apparatus according to claim 13, which is specifically configured to perform

15. A video encoding apparatus comprising a non-volatile memory and a processor connected to each other, wherein the processor executes the video encoding method according to any one of claims 1 to 5 by calling program code stored in the non-volatile memory.

16. A video decoding apparatus comprising a non-volatile memory and a processor connected to each other, wherein the processor executes the video decoding method according to claim 6 or 7 by calling program code stored in the non-volatile memory.

17. A computer program for causing a processor to execute the video encoding method according to any one of claims 1 to 5.

18. A computer program for causing a processor to execute the video decoding method according to claim 6 or 7.

Citation Information

Patent Citations

  • High Dynamic Range Codec

    JP2009524371A

  • Drift-Free, Backwards Compatible, Layered VDR Coding

    US20120314773A1