VIDEO ENCODING METHOD, VIDEO DECODING METHOD, VIDEO ENCODING APPARATUS, VIDEO DECODING APPARATUS, AND COMPUTER PROGRAM

The method addresses poor HDR display effects and computational inefficiencies by mapping SDR bitstreams to HDR data, ensuring efficient transmission and compatible decoding, thus improving video coding efficiency and user experience.

JP2024531676AActive Publication Date: 2024-08-29HUAWEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
JP2024515704
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Priority Date
2021-09-15
Filing Date
2022-09-08
Publication Date
2024-08-29
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 and decoding that maps standard dynamic range (SDR) bitstreams to HDR data by determining a correspondence and adjusting residual values to fit within the bit width of SDR bitstreams, ensuring efficient data transmission and compatible decoding across devices.

Benefits of technology

Ensures efficient data transmission and compatible HDR display effects across devices, reducing the need for frame-level switching and high computational complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2024531676000001_ABST
    Figure 2024531676000001_ABST
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, entitled "VIDEO ENCODING METHOD, VIDEO DECODING METHOD AND APPARATUS", filed with the State Intellectual Property Office of China on September 15, 2021, which is incorporated herein by reference in its entirety.

[0002] TECHNICAL FIELD Embodiments of the present application relate to the field of image processing technology, in particular to a video encoding method, a video decoding method and an apparatus. [Background technology]

[0003] In a digital image, dynamic range refers to the ratio of the maximum grayscale value to the minimum grayscale value in the displayable range of the image. -3 From 10 6 The dynamic range of a photograph is called high dynamic range (HDR). The dynamic range of a typical image is called standard dynamic range (SDR). The imaging process of a digital camera is actually a mapping from the high dynamic range of a photograph to the standard dynamic range.

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

[0005] At present, many devices do not support HDR, and the display effect of HDR signals on those devices is poor. Therefore, in the prior art, scalable encoding is used for video processing, specifically, the same video is divided into multiple videos with different resolutions for separate encoding. However, many hardware devices do not support scalable encoding, and scalable encoding requires a large amount of data calculation. As a result, a large amount of processor resources is wasted. Summary of the Invention

[0006] The present application provides a video encoding method, a video decoding method and an apparatus for improving the efficiency of video encoding while ensuring HDR display effect.

[0007] According to a first aspect, the present application provides a video encoding method. The method can be performed 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 television. This is not specifically limited here in the present application.

[0008] The video encoding device may: obtain 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; 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, the first bit-width being 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 predetermined data; and transmit the first SDR bitstream with the predetermined data added.

[0009] It should be noted that the first HDR data in the source data may be received by the video encoding device from a device communicatively connected to the video encoding device, or may be obtained through data processing of the video encoding device for the same video data. This is not specifically limited here in the present application. Generally, video data is large and occupies a large amount of bandwidth resources. The 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 ensure data transmission efficiency. Therefore, the video encoding device does not directly transmit the video data, but 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, which needs to meet the data bitwidth requirement of the device or video data. A larger data bitwidth indicates a higher video data DR and a higher image pixel indicated by the video bitstream. A smaller data bit width indicates a lower video data DR and a lower image pixel presented by the video bitstream. In general, the data bit width for encoding SDR data to obtain an SDR bitstream is 8 bits, and the data bit width 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 this 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 aforementioned reconstructed data is SDR data obtained by decoding the first SDR bitstream. The reconstructed data is compared with the first HDR data to determine a correspondence between the reconstructed data and the first HDR data. In practical application, the correspondence can be determined by comparing grayscale values, RGB values, or YUV values ​​of the video image, which is not specifically limited here in the present application.

[0011] It should be noted that the data bit width corresponding to the HDR data and the data bit width corresponding to the SDR data are usually different in size. 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 apparatus may convert the target residual value between the first HDR data and the second HDR data to a data bit width that meets the transmission requirements of the first SDR bitstream by a subtraction operation or a 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, SDR video decoding devices and HDR video decoding devices are well supported based on preset data and 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 bitwidth coding is not supported by all encoding / decoding standards. For example, JPEG only supports 8bit, and both the target residual and SDR are 8bit. This can ensure that the video encoding device and the video decoding device can use the same level codec. Generally, the frame-level switching of the hardware encoder or the hardware decoder has high complexity and requires high device processing power. The target residual value is adjusted to be smaller than or equal to the bitwidth during encoding of the SDR bitstream. This can prevent the 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 may be determined in the following manners: 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 the first HDR data and a pixel at a first position of the reconstructed data; dividing 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 respectively the same as those of the first HDR data; 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.

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

[0015] In an optional implementation, the video encoding apparatus may perform subtraction on the second HDR data and the first HDR data to determine an initial residual value; determine a residual mapping scheme and a clamping scheme based on a distribution of a value range of the initial residual value; and map the initial residual value to the target residual value having a bit width less than or equal to the first bit width using the residual mapping scheme and the clamping scheme.

[0016] 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. A statistical analysis may be performed on the initial residual value to obtain a histogram, which indicates the distribution of the value range of the initial residual value. In practical application, a curve graph is obtained by plotting points without providing the initial residual value, which indicates 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 here in the present application.

[0017] In addition, when the initial residual value is transformed into 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 may be removed in a clamping manner. Then, the video encoding apparatus may map the initial residual value to the target residual value in a residual mapping manner and a clamping manner determined based on the distribution of the value range of the initial residual value.

[0018] In an optional implementation, the video encoding apparatus may perform the following steps: determine a histogram based on the initial residual values; determine a residual value corresponding to a 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 for initial residuals falling within the first value range based on the distribution of the value range of the initial residual values; and perform residual mapping on the initial residuals falling within the first value range to clamp initial residuals that are not falling within the first value range.

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

[0020] In an optional implementation, the video encoding apparatus may: determine 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 and 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 and 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 a sum of the first proportional value and the second proportional value is the target proportional value; and map an initial residual value that is between the first residual value and the second residual value to the target residual value, and clamp an initial residual value that is not 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 and 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 and 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] It should be noted that currently, large bit-width coding is not supported by all encoding / decoding standards. For example, JPEG only supports 8-bit, and both the target residual and SDR are 8-bit. This can ensure that the video encoding device and the video decoding device can use the same level codec. Generally, the frame-level switching of the hardware encoder or the hardware decoder has high complexity and requires high device processing power. The target residual value is adjusted to be smaller than or equal to the bit-width during encoding of the SDR bitstream. This can prevent the frame-level switching of the hardware encoder or the hardware decoder on the encoder side and the decoder side.

[0023] According to a second aspect, the present application provides a video decoding method. The method can be performed 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 here in the present application.

[0024] The video decoding device may perform the following operations: receiving the first SDR bitstream, where the first SDR bitstream comprises predetermined data, and the predetermined 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 the first HDR data based on the target residual value and the second HDR data.

[0025] In an optional implementation, the pre-defined data further comprises a residual mapping scheme and a clamping scheme.

[0026] In an optional implementation, the video decoding device may perform the following: determining a first residual value and a second residual value based on the residual mapping scheme, the clamping scheme, 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 scheme, where 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.

[0027] According to a third aspect, the present application provides a method for producing a method for manufacturing a semiconductor device comprising: a processing unit configured to: obtain 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; 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, the first bit-width being a 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 predetermined data; and transmit the first SDR bitstream supplemented with the predetermined data. The present invention provides a video encoding device comprising:

[0028] According to a fourth aspect, the present application provides a method for providing a first SDR bitstream comprising: an input / output unit configured to receive a first SDR bitstream, where the first SDR bitstream comprises predefined data, the predefined data being obtained by encoding a correspondence relationship and a target residual value; and a processing unit configured to map reconstructed data of the first SDR bitstream to second HDR data based on the correspondence relationship, and to determine the first HDR data based on the target residual value and the second HDR data. The present invention provides a video decoding device comprising:

[0029] According to a fifth aspect, an embodiment of the present application provides a video encoding apparatus comprising a non-volatile memory and a processor coupled to each other, wherein the processor is adapted to perform the method of the first aspect or any one of the designs of the first aspect by invoking program code stored in the memory.

[0030] According to a sixth aspect, an embodiment of the present application provides a video decoding device, comprising: a non-volatile memory and a processor coupled to each other, wherein the processor executes the method of the second aspect or any one of the designs of the second aspect by calling a program code stored in the memory. 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 including the video encoding apparatus according to the fifth aspect and the video decoding apparatus according to the sixth aspect.

[0032] According to an eighth aspect, an embodiment of the present application provides a computer readable storage medium storing program code, wherein the program code comprises instructions for performing some or all of the steps of any of the methods of the first or second aspect.

[0033] According to a ninth aspect, an embodiment of the present application provides a computer program product which, when run on a computer, enables the computer to perform some or all of the steps of any of the methods of the first or second aspect.

[0034] It should be understood that for the beneficial effects of the second to ninth aspects of the present application, please refer to the relevant description of the first aspect, and the details will not be described again. [Brief description of the drawings]

[0035] [Figure 1] 1 is a schematic diagram of an image processing system according to an embodiment of the present application;

[0036] [Diagram 2] 1 is a schematic flowchart of a video encoding method and a video decoding method according to an embodiment of the present application;

[0037] [Diagram 3] FIG. 2 is a schematic diagram of reconstructed data and first HDR data according to an embodiment of the present application.

[0038] [Figure 4] FIG. 13 is another schematic diagram of reconstructed data and first HDR data according to an embodiment of the present application.

[0039] [Diagram 5] 1 is a schematic diagram of the structure of an image processing device according to an embodiment of the present application;

[0040] [Figure 6] 1 is a schematic diagram of the structure of an image processing device according to an embodiment of the present application;

[0041] [Figure 7] 1 is a schematic diagram of the structure of an image processing device according to an embodiment of the present application; DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0042] In order 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 operation methods in the method embodiments may also be applied to the device embodiments or system embodiments. In the present description, unless otherwise specified, "multiple" means two or more than two. Therefore, the implementations of the device and method should be cross-referenced. No repeated description is provided.

[0043] In the present application, the term "and / or" describes a correspondence relationship between associated objects and may indicate that three relationships may exist. For example, A and / or B may indicate the following cases: only A is present, both A and B are present, and only B is present, where A and B may be singular or plural. In addition, unless otherwise stated, ordinals 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, chronology, priority, or importance of the multiple objects.

[0044] References to "one embodiment," "some embodiments," and the like described in the specification of this application mean that one or more embodiments of the application include the specific features, structures, or characteristics described with reference to the embodiment. Thus, statements such as "in one embodiment," "some embodiments," "some other embodiments," and "other embodiments" appearing in various places in this specification are not necessarily meant to refer to the same embodiment. Instead, such statements mean "one or more, but not all, of the embodiments," unless specifically emphasized otherwise in another manner. The terms "including," "including," "having," and variations thereof all mean "including, but not limited to," unless specifically emphasized otherwise in another manner.

[0045] FIG. 1 shows an image processing system to which the embodiments of the present application may be applied. The system includes a video encoding device, an HDR video decoding device, and an SDR video decoding device. There may be multiple video encoding devices and multiple 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. For the same image, the video encoding device may obtain images of different DRs by adjusting the image capture manner. For example, SDR image 1 (the DR of an SDR image is generally between 1 nit and 100 nit) may be determined based on shooting parameter 1 (exposure value (EV) 4 to 12EV), SDR image 2 may be determined based on shooting parameter 2 (8EV to 16EV), and HDR image (the DR of an HDR image is generally between 0.001 nit and 10000 nit) may be determined based on image 1 and image 2. The shooting parameter corresponding to the HDR image may be 4EV to 16EV. Similarly, since a video includes multiple frames of consecutive images, the video capture device may determine HDR video and SDR video for the same video.In addition, the video encoding device may further determine the HDR video and the SDR video in another manner, such as an artificial intelligence-based method, which is not specifically limited here in this application. In Figure 1, an example in which the video encoding device may obtain SDR data (video or image) and HDR data is used for explanation.

[0046] EV is a unit that indicates exposure. If the photosensitivity is 100, the F-number is F1, the exposure time is 1 second, and the exposure is defined as 0. Based on the exposure, the exposure is decreased by one level (the exposure time is reduced by half or the aperture is reduced by one level), and the EV value increases by one.

[0047] Exposure formula 1 is as follows:

number

[0048] A indicates the F-number of the lens, T indicates the shutter time (seconds), B indicates the scene brightness, and S indicates the light sensitivity of the film. In photography, EV indicates the sum of AV+TV or the sum of BV+SV. The EV value, i.e., "exposure value", is an abstract concept and indicates a combination of aperture and shutter. The aperture and 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 aperture and shutter meets specific conditions that ensure the EV value is constant, the final exposure is the same. For every 1.0 increase in the EV value, the amount of incoming light doubles.

[0049] It should be noted that in the H.265 standard, video encoding supports encoding and displaying HDR data with a bit width of 10 bits. However, many devices do not support HDR. Software applications cannot identify HDR data, and software application clients cannot show the good effect of HDR data. In addition, in standards MPEG-2, MPEG-4, H.264 and H.265, there is a solution for scalable encoding, specifically, the same video is split into multiple videos with different resolutions for separate encoding. However, many hardware devices do not support scalable encoding, and scalable encoding requires a large amount of data calculation. As a result, a large amount of processor resources is wasted.

[0050] Considering the above case, the present application provides a video encoding method and a video decoding method, so as to improve video coding efficiency and improve user experience. Please refer to Fig. 2. The method is implemented 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: A video encoding apparatus obtains source data, where the source data includes a first HDR data and a first SDR bitstream for the same video data.

[0052] It should be noted that the first HDR data in the source data may be received by the video encoding device from a device communicatively connected to the video encoding device, or may be obtained through data processing of the video encoding device for the same video data. This is not specifically limited here in the present application. Generally, video data is large and occupies a large amount of bandwidth resources. The 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 ensure data transmission efficiency. Therefore, the video encoding device does not directly transmit the video data, but 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, which needs to meet the data bitwidth requirement of the device or video data. A larger data bitwidth indicates a higher video data DR and a higher image pixel indicated by the video bitstream. A smaller data bit width indicates a lower video data DR and a lower image pixel presented by the video bitstream. In general, the data bit width for encoding SDR data to obtain an SDR bitstream is 8 bits, and the data bit width 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 this 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 apparatus maps the reconstructed data of the first SDR bitstream to the second HDR data based on a correspondence relationship 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. The reconstructed data is compared with the first HDR data to determine a correspondence between the reconstructed data and the first HDR data. In practical application, the correspondence can be determined by comparing grayscale values, RGB values, or YUV values ​​of the video image, which is not specifically limited here in the present application.

[0055] In an optional embodiment, the correspondence may be determined in the following manner.

[0056] The video encoding apparatus may determine 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 the first HDR data and the pixel at the first position of the reconstructed data. The video encoding apparatus may perform the following: 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 image blocks of the reconstructed data are the same as those of the first HDR data, respectively; determine a second average value corresponding to each image block of the reconstructed data and each image block of the first HDR data; and determine a 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.

[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 this application. The grayscale value is used as an example in this specification for illustration. During actual execution, the video encoding device may collect a statistical histogram His[i] of the grayscale values ​​of the pixels corresponding to the grayscale values ​​at the positions in the reconstructed data at the corresponding positions in the first HDR data, and statistics for the average value avg[i] and the variance var[i] of the grayscale values. In actual application, 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 the image element corresponding to the 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 the position A, i.e., the first average value, may be determined. For example, when grayscale value I appears at seven positions, such as positions 1, 2, 3, 4, 5, 6, and 7, in the reconstruction data, grayscale value 1, grayscale value 2, ...grayscale value 7 are searched for at positions 1, 2, 3, 4, 5, 6, and 7 in the first HDR data (or image block of the first HDR data). In this case, the average value of the grayscale values ​​corresponding to grayscale value I in the first HDR data (or 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 shadowed areas, and the SDR data is indicated by the unshadowed areas.

[0058] In addition, when the calculated variance for all positions is less than the total variance (i.e., the variance of the entire frame of the image) and the calculated variance for all positions is greater than the first preset value, the video encoding apparatus may divide the corresponding image of the reconstructed data into a plurality of image blocks and the corresponding image of the first HDR data into a plurality of image blocks, and calculate the statistical histogram subHis[i], and the average value subAvg[i] and variance subVar[i] of the grayscale values ​​of the image blocks. The first preset value may be set based on the actual application requirements, which are not specifically limited here in the present application. For example, since the bit width of the 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 two data are the same. As shown in Fig. 4, the image corresponding to the reconstructed data is divided into four image blocks, and the image corresponding to the first HDR data is also divided into four image blocks, and the image elements in the image block 1 of the reconstructed data and the image block 1 of the first HDR data are the same. In practical application, the image blocks may alternatively be allocated unevenly, specifically, the image block 1 of the reconstructed data may have a different size from the image block 1 of other reconstructed data, as long as it is guaranteed that the image block 1 of the reconstructed data and the image block 1 of the first HDR data have the same size and the image elements are the same.

[0060] In practical application, a local grayscale / tone mapping relationship is obtained based on avg[i] or subAvg[i], and then the local grayscale / tone mapping relationship can be processed according to a preset rule to obtain a nearly global grayscale / tone mapping relationship, i.e., a correspondence relationship. The preset rule may be to determine the correspondence relationship by performing a weighted calculation on the local mapping relationship, or may be another method, which is not specifically limited herein in this 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 a global grayscale / tone mapping value. In addition, the grayscale / tone mapping relationship can be indicated by any curve or matrix parameters, which is not specifically limited herein in this application.

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

[0062] It should be noted that the data bit width corresponding to the HDR data and the data bit width corresponding to the SDR data are usually different in size. 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 apparatus may 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 using a subtraction operation or a 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.

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

[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. A statistical analysis may be performed on the initial residual value to obtain a histogram, which indicates the distribution of the value range of the initial residual value. In practical application, a curve graph is obtained by plotting points without providing the initial residual value, which indicates 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 here in the present application.

[0065] In addition, while the initial residual value is transforming into 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 may be removed in a clamping manner. Then, the video encoding apparatus may map the initial residual value to the target residual value in a residual mapping manner and a clamping manner determined based on the distribution of the value range of the initial residual value.

[0066] In optional embodiments, the video encoding apparatus may perform the following steps: determine a histogram based on the initial residual values; determine a residual value corresponding to a 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 for initial residuals falling within the first value range based on the distribution of the value range of the initial residual values; and perform residual mapping on the initial residuals falling within the first value range to clamp initial residuals not falling within 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 apparatus may determine a first value range based on the value of the first bit width. The initial residual value in the first value range may be mapped to a target residual value whose bit width is less than or equal to the first bit width. In actual implementation, please refer to the following procedure.

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

[0069] B. Determine the residual value Y that corresponds to the center location of the histogram.

[0070] C. Determine a first value range. A critical value Ylow is identified 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 identified in the direction where the residual value is higher than Y. An initial residual value between the two critical values ​​may be mapped to a target residual value, and the two critical values ​​may be defined as a first value range. The first value range may be determined by subtracting a first bit-width shift value from the value Y or adding a first bit-width shift value to the value Y. For example, if the first bit-width is 8 bits and 2 8 (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, another 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 the percentage of the initial residual values ​​included in the first value range is determined to be 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 residual 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%, and the initial residual value corresponding to B% can be selected after the residual value A, where 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 here in the present application.

[0072] E. Map initial residual values ​​that fall within a first range of values ​​to target residual values.

[0073] In an optional embodiment, the video encoding apparatus may determine a first residual value and a second residual value (which may be understood as the two critical values ​​mentioned above) based on a target proportional value and a residual value corresponding to a center position of the histogram, map initial residual values ​​between the first residual value and the second residual value to the target residual value, and clamp initial residual values ​​that are 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 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. 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. It is assumed 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] The initial residual value within (Ylow, Yhigh) 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] Residuals within (Y-(1<<(Bitdepth-1)), Y+(1<<(Bitdepth-1))-1) are 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 in (Ylow, Yhigh) may be, for example, 90, and during mapping, 90+(1<<(Bitdepth-1))-0 may be performed to determine 218(90+128-0) as the target residual value to which 90 is mapped; the initial residual value in (Ylow, Yhigh) may be, for example, -100, and during mapping, -100+(1<<(Bitdepth-1))-0 may be performed to determine 28(-100+128-0) as the target residual value to which -100 is mapped. For example, when Ylow1 is -300, an initial residual value in (Ylow,Ylow1), e.g., (-300,-100), may be mapped to (0,28), and an initial residual value in (Yhigh,Yhigh1), e.g., (90,400), may 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, initial residual values ​​in (Y-128, Y+127) may be directly added with 128-Y to obtain the target residual value, and initial residual values ​​lower than Y-128 may be directly clamped to 0, and initial residual values ​​higher than Y+127 may be directly clamped to 255.

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

[0083] Step 204: The video encoding apparatus determines the pre-defined data by encoding the correspondence and the target residual value.

[0084] It should be noted that the preset data may be understood as user-defined data. After obtaining the preset data, the video decoding device may convert the SDR data into HDR data during decoding of the bitstream.

[0085] Step 205: The video encoding device transmits the first SDR bitstream to which the predefined data is added, and the video decoding device receives the first SDR bitstream in response.

[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 apparatus determines the first HDR data according to 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 apparatus 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 apparatus.

[0090] [Method 1]

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

[0092] [Method 2]

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

[0094] 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 target residual value in (0, 28) may be mapped to (-300, -100), the target residual value in (90+128, 255) may be mapped to (90, 400), and the initial residual value is determined by subtracting 128 from the target residual value in (-100+128, 90+128).

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

[0096] In this application, SDR video decoding devices and HDR video decoding devices are well supported based on preset data and SDR bitstreams. When a bitstream is an SDR bitstream, the bitstream is explicitly identified as an SDR bitstream by an SDR video decoding device to ensure the SDR effect. Both the preset data and the SDR bitstream are correctly identified and decoded by an HDR device to ensure the HDR effect.

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

[0098] When the image processing device is a video encoding device, the processing unit 502 is configured to: acquire 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; map 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; 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 smaller than or equal to a first bit-width, the first bit-width being a 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 predetermined data; and the input / output unit 501 is configured to transmit the first SDR bitstream to which the predetermined data has been added.

[0099] It should be noted that the first HDR data in the source data may be received by the video encoding device from a device communicatively connected to the video encoding device, or may be obtained through data processing of the video encoding device for the same video data. This is not specifically limited here in the present application. Generally, video data is large and occupies a large amount of bandwidth resources. The 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 ensure data transmission efficiency. Therefore, the video encoding device does not directly transmit the video data, but 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, which needs to meet the data bitwidth requirement of the device or video data. A larger data bitwidth indicates a higher video data DR and a higher image pixel indicated by the video bitstream. A smaller data bit width indicates a lower video data DR and a lower image pixel presented by the video bitstream. In general, the data bit width for encoding SDR data to obtain an SDR bitstream is 8 bits, and the data bit width 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 this 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 aforementioned reconstructed data is SDR data obtained by decoding the first SDR bitstream. The reconstructed data is compared with the first HDR data to determine a correspondence between the reconstructed data and the first HDR data. In practical application, the correspondence can be determined by comparing grayscale values, RGB values, or YUV values ​​of the video image, which is not specifically limited here in the present application.

[0101] It should be noted that the data bit width corresponding to the HDR data and the data bit width corresponding to the SDR data are usually different in size. 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 apparatus may 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 using a subtraction operation or a 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.

[0102] In this application, SDR video decoding devices and HDR video decoding devices are well supported based on preset data and 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 bitwidth coding is not supported by all encoding / decoding standards. For example, JPEG only supports 8bit, and both the target residual and SDR are 8bit. This can ensure that the video encoding device and the video decoding device can use the same level codec. Generally, the frame-level switching of the hardware encoder or the hardware decoder has high complexity and requires high device processing power. The target residual value is adjusted to be smaller than or equal to the bitwidth during encoding of the SDR bitstream. This can prevent the 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 correspondence is: The correspondence relationship may be determined in the following manners: 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 the first HDR data and a pixel at a first position of the reconstructed data; dividing 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; 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 correspondence relationship determined in this way is more accurate, and the determined second HDR data is more reliable.

[0104] In an optional implementation, the pre-set parameters are grayscale values, RGB values, or YUV values.

[0105] In an optional implementation, the processing unit 502: The method is specifically configured to: perform subtraction on the second HDR data and the first HDR data to determine an initial residual value; determine a residual mapping scheme and a clamping scheme based on a distribution of a value range of the initial residual value; and map the initial residual value to the target residual value having a bit width less than or equal to the first bit width in the residual mapping scheme and the clamping scheme.

[0106] 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. A statistical analysis may be performed on the initial residual value to obtain a histogram, which indicates the distribution of the value range of the initial residual value. In practical application, a curve graph is obtained by plotting points without providing the initial residual value, which indicates 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 here in the present application.

[0107] In addition, when the initial residual value is transformed into 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 may be removed in a clamping manner. Then, the video encoding apparatus may map the initial residual value to the target residual value in a residual mapping manner and a clamping manner determined based on the distribution of the value range of the initial residual value.

[0108] In an optional implementation, the processing unit 502: The method is specifically configured to: determine a histogram based on the initial residual values; determine a residual value corresponding to a 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 target proportional values ​​for initial residuals falling within the first value range based on the distribution of the value range of the initial residual values; and perform residual mapping on the initial residuals falling within the first value range to clamp initial residuals not falling within the first value range.

[0109] It should be noted that after the distribution of the value range of the initial residual values ​​is determined, the video encoding apparatus may determine a first value range based on the values ​​of the first bit width, and the initial residual values ​​within the first value range may be mapped to target residual values ​​whose bit width is less than or equal to the first bit width.

[0110] In an optional implementation, the processing unit 502: 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 and 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 and 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 a sum of the first proportional value and the second proportional value is the target proportional value; and mapping an initial residual value that is between the first residual value and the second residual value to the target residual value and clamping an initial residual value that is not between the first residual value and the second residual value to obtain a preset value.

[0111] The first residual value is less than the residual value corresponding to the central position of the histogram and 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 and 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] It should be noted that currently, large bit-width coding is not supported by all encoding / decoding standards. For example, JPEG only supports 8-bit, and both the target residual and SDR are 8-bit. This can ensure that the video encoding device and the video decoding device can use the same level codec. Generally, the frame-level switching of the hardware encoder or the hardware decoder has high complexity and requires high device processing power. The target residual value is adjusted to be smaller than or equal to the bit-width during encoding of the SDR bitstream. This can prevent the frame-level switching of the hardware encoder or the hardware decoder 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 comprises predetermined data, and the predetermined data is obtained by encoding a correspondence relationship and a target residual value; the processing unit 502 may be configured to map reconstructed data of the first SDR bitstream to second HDR data based on the correspondence relationship, and determine the first HDR data based on the target residual value and the second HDR data.

[0114] In an optional implementation, the pre-defined data further comprises a residual mapping scheme and a clamping scheme.

[0115] In an optional implementation, the processing unit 502 is specifically configured to: determine a first residual value and a second residual value based on the residual mapping scheme, the clamping scheme, the target residual value, and a first bit width; determine an initial residual value based on the first residual value, the second residual value, and the clamping scheme, where a 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.

[0116] In addition, the present application further provides an image processing device 600 as shown in Fig. 6. For example, the image processing device 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 device 600 may include at least one processor 610. The image processing device 600 may further include at least one memory 620 configured to store computer programs, program instructions and / or data. The memory 620 is coupled to the processor 610. The coupling in this embodiment of the present application may be an indirect coupling or communication connection between devices, units or modules, which may be in an electrical form, a mechanical form or another form, and is used for exchanging information between the devices, units or modules. The processor 610 may cooperate with the memory 620 to perform operations. The processor 610 may execute the computer programs stored in the memory 620. Optionally, the at least one memory 620 may alternatively be integrated into the processor 610.

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

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

[0120] The specific connection medium between the transceiver 630, the processor 610 and the memory 620 is not limited in the embodiment 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 by a thick line in FIG. 6. The connection manner between the other components is described only as an example, but is not limited thereto. The bus may be classified as an address bus, a data bus, or a control bus, etc. For ease of indication, the bus is indicated by only one thick line in FIG. 6. However, it does not indicate that there is only one bus or only one type of bus. In the embodiment of the present application, the processor may 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 transistor logic device, or a discrete hardware component, and may implement or execute the methods, steps and logic block diagrams disclosed in the embodiment of the present application. The general-purpose processor may be a microprocessor, or any conventional processor, etc. The steps of the methods disclosed with reference to the embodiments of the present application may be executed and completed by a hardware processor, or may be executed and completed directly by a combination of hardware and software modules in a processor.

[0121] In the present embodiment, the memory may be a non-volatile memory, such as 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 expected program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited thereto. Alternatively, the memory in the present embodiment may be a circuit or any other device that can implement a storage function and is configured to store computer programs, program instructions and / or data.

[0122] Based on the above-mentioned embodiment, as shown in Fig. 7, the embodiment of the present application further provides another image processing device 700 including an interface circuit 710 and a logic circuit 720. The interface circuit 710 may be understood as an input / output interface and may be configured to perform the same operation steps as those of the input / output unit shown in Fig. 5 or the transceiver shown in Fig. 6. Details will not be described again here in this application. The logic circuit 720 may be configured to operate code instructions to perform the method in any one of the above-mentioned embodiments and may be understood as a processing unit in Fig. 5 or a processor in Fig. 6 and may implement the same function as the processing unit or the processor. Details will not be described again here in this application.

[0123] Based on the above embodiment, the embodiment of the present application further provides a readable storage medium. The readable storage medium stores instructions. When the instructions are executed, the method performed by the video encoding method or the video decoding method in any one of the above embodiments is implemented. The readable storage medium may include any medium that can store 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] Those skilled in the art should understand that the embodiments of the present application may be provided as a method, a system, or a computer program product. Thus, the present application may be used in the form of a hardware-only embodiment, a software-only embodiment, or an embodiment with a combination of software and hardware. In addition, the present application may be used in the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk memory, compact optical disc read-only memory (CD-ROM), optical memory, etc.) containing computer-usable program code.

[0125] The present application is described with reference to flowcharts and / or block diagrams of the methods, apparatus (systems) and computer program products of the present application. It will be understood that computer program instructions may be used to implement each step and / or each block of the flowcharts and / or block diagrams, and combinations of steps and / or blocks in the flowcharts and / or block diagrams. These computer program instructions may be provided for a processor of a general purpose computer, a special purpose computer, an embedded processor, or another programmable data processing apparatus to generate a machine, such that the instructions executed by the processor of the computer or another programmable data processing apparatus may generate an apparatus for implementing a particular function in one or more steps in the flowcharts and / or one or more blocks in the block diagrams.

[0126] The computer program instructions may alternatively be stored in a computer-readable memory that may direct a computer or another programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory may generate an artifact that includes an instruction apparatus that implements a particular function in one or more procedures in one or more blocks in the flowcharts and / or block diagrams.

[0127] The computer program instructions may alternatively be loaded into a computer or other programmable data processing apparatus such that a sequence of operational steps are executed on the computer or other programmable apparatus to generate a computer-implemented process. Thus, the instructions executed on the computer or other programmable apparatus provide steps for implementing a particular function in one or more procedures in the flowcharts and / or in one or more blocks in the block diagrams.

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 a correspondence 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 a bit-width of the target residual value is less than or equal to a first bit-width, the first bit-width being a data bit-width for encoding a first SDR video into the first SDR bitstream; encoding the correspondence and the target residual values ​​to determine predefined data; and transmitting the first SDR bitstream to which the pre-defined data has been added; A video encoding method comprising:

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 a pixel at a first location of the first HDR data and the reconstructed data; splitting 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; 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 method of claim 1 , wherein the first and second inputs are determined in a manner such that the first and second inputs are equal to or greater than the first inputs.

3. The method of claim 2 , wherein the pre-set parameters are grayscale values, RGB values ​​or YUV values.

4. The step of determining a target residual value between the second HDR data and the first HDR data includes: performing a subtraction on the second HDR data and the first HDR data to determine an initial residual value; determining a residual mapping scheme and a clamping scheme based on a distribution of value ranges of the initial residual values; and mapping the initial residual value to the target residual value having a bit width less than or equal to the first bit width using the residual mapping scheme and the clamping scheme; 4. The method according to claim 1 , further comprising:

5. determining a residual mapping scheme and a clamping scheme based on a distribution of a value range of the initial residual values, determining a histogram based on the initial residual values; determining a residual value corresponding to a central location of said histogram; determining a first value range based on the first bit width and the residual value corresponding to the center location of the histogram; determining a target proportional value for the initial residuals that fall within the first value range based on the distribution of the value ranges of the initial residual values; and performing residual mapping on the initial residuals that fall within the first range of values ​​and clamping the initial residuals that do not fall within the first range of values.

5. The method of claim 4, comprising:

6. The step of mapping the initial residual value to the target residual value having a bit width less than or equal to the first bit width in the residual mapping manner and the clamping manner comprises: determining a first residual value and a second residual value based on the target proportional value and the residual value corresponding to the central location of the histogram, where the first residual value is less than the residual value corresponding to the central location of the histogram and the second residual value is greater than the residual value corresponding to the central location of the histogram, there is at least one first residual value and there is at least one second residual value, the first residual value and the residual value corresponding to the central location of the histogram correspond to a first proportional value, the second residual value and the residual value corresponding to the central location of the histogram correspond to a second proportional value, and a sum of the first proportional value and the second proportional value is the target proportional value; and obtaining a preset value by mapping initial residual values ​​between the first residual value and the second residual value to the target residual value and clamping initial residual values ​​not between the first residual value and the second residual value; 6. The method of claim 5, comprising:

7. receiving a first SDR bitstream, where the first SDR bitstream comprises predefined data, the predefined data being obtained by encoding a correspondence relationship and a target residual value; mapping the reconstructed data of the first SDR bitstream to second HDR data based on the correspondence; and determining first HDR data based on the target residual value and the second HDR data; A video decoding method comprising:

8. The method of claim 7 , wherein the pre-defined data further comprises a residual mapping scheme and a clamping scheme.

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 scheme, the clamping scheme, 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 scheme, where 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; 9. The method of claim 8, having the following structure:

10. a processing unit configured to: obtain 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; 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, the first bit-width being a 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 predefined data; and an input / output unit configured to transmit the first SDR bitstream with the pre-defined data added thereto; A video encoding device comprising:

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 a pixel at a first location of the first HDR data and the reconstructed data; splitting 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; 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 apparatus of claim 10, wherein the determination is made in the manner described above.

12. The apparatus of claim 11, wherein the pre-set parameters are grayscale values, RGB values ​​or YUV values.

13. The processing unit includes: performing a subtraction on the second HDR data and the first HDR data to determine an initial residual value; determining a residual mapping scheme and a clamping scheme based on a distribution of value ranges of the initial residual values; and Mapping the initial residual value to the target residual value having a bit width less than or equal to the first bit width in the residual mapping scheme and the clamping scheme.

13. An apparatus according to any one of claims 10 to 12, specifically adapted to:

14. The processing unit includes: determining a histogram based on the initial residual values; determining a residual value corresponding to a center location of said histogram; determining a first value range based on the first bit width and the residual value corresponding to the center location of the histogram; determining a target proportional value for initial residuals that fall within the first value range based on the distribution of the value ranges of the initial residual values; and performing residual mapping on the initial residuals that fall within the first range of values ​​and clamping the initial residuals that do not fall within the first range of values; 14. The apparatus of claim 13, specifically configured to:

15. The processing unit 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 and 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 and 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 a sum of the first proportional value and the second proportional value is the target proportional value; and obtaining a preset value by mapping an initial residual value that is between the first residual value and the second residual value to the target residual value and clamping an initial residual value that is not between the first residual value and the second residual value.

15. The apparatus of claim 14, specifically configured to:

16. an input / output unit configured to receive a first SDR bitstream, where the first SDR bitstream comprises predefined data, the predefined data being obtained by encoding a correspondence relationship and a target residual value; and a processing unit configured to: map reconstructed data of the first SDR bitstream to second HDR data based on the correspondence; and determine first HDR data based on the target residual value and the second HDR data. A video decoding device comprising:

17. The apparatus of claim 16 , wherein the pre-defined data further comprises a residual mapping scheme and a clamping scheme.

18. The processing unit includes: determining a first residual value and a second residual value based on the residual mapping scheme, the clamping scheme, the target residual value, and a first bitwidth; determining an initial residual value based on the first residual value, the second residual value, and the clamping scheme, where 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; 17. The apparatus of claim 16, specifically configured to:

19. 7. A video encoding device comprising a non-volatile memory and a processor coupled to each other, the processor executing the method according to claim 1 by calling program code stored in the memory.

20. A video decoding device comprising a non-volatile memory and a processor coupled to each other, the processor executing the method according to any one of claims 7 to 9 by calling a program code stored in the memory.

21. 10. A computer readable storage medium storing program code, the program code comprising instructions for use by a processor to perform the method of any one of claims 1 to 9.

Citation Information

Patent Citations

  • High Dynamic Range Codec

    JP2009524371A

  • Drift-Free, Backwards Compatible, Layered VDR Coding

    US20120314773A1