Video compression method, apparatus, electronic device, and storage medium
By converting HDR video to SDR format, compressing it using a trained compression model, and then converting it back to HDR format, the problem of poor HDR video compression in existing technologies is solved, achieving high-quality HDR video compression.
Patent Information
- Application Number
- CN202210518452.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-12
- Publication Date
- 2026-01-16
- Estimated Expiration
- 2042-05-12
AI Technical Summary
Existing deep learning-based video compression methods cannot effectively handle the brightness information in high dynamic range (HDR) videos, resulting in poor compression performance that cannot reach the level of traditional compression algorithms.
HDR video frame images are converted to standard dynamic range (SDR) format, compressed, and then converted back to HDR format. A trained compression model is used to perform high-quality compression on SDR format video frame images, and perceptual unified coding and inverse mapping techniques are used to ensure the compression effect.
It achieves high-quality compression of HDR videos, improving the compression effect to approach or exceed the performance of traditional compression algorithms.
Smart Images

Figure CN115190313B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of video compression, and in particular to a video compression method and device, electronic equipment and storage medium. BACKGROUND
[0002] The existing deep learning-based video compression method is used for compressing standard dynamic range (SDR) videos, while high dynamic range (HDR) videos contain more bright information, which cannot be effectively processed by the existing deep learning-based video compression method. When using the existing deep learning-based video compression method to compress HDR videos, the compression effect is far from its performance in the SDR video compression task, and is also not as good as the compression performance of traditional compression algorithms for HDR videos. Therefore, the existing deep learning-based video compression method cannot effectively compress HDR videos. SUMMARY
[0003] The present application provides a video compression method and device, electronic equipment and storage medium to solve the defect that the existing technology cannot effectively compress HDR videos.
[0004] The present application provides a video compression method, comprising:
[0005] obtaining a video to be compressed, and converting each video frame image of the video to be compressed into an SDR format if the video to be compressed is in an HDR format;
[0006] compressing each video frame image in the SDR format, and converting each compressed video frame image into an HDR format;
[0007] obtaining an HDR compressed video based on each video frame image in the HDR format.
[0008] According to the video compression method provided by the present application, the compression of each video frame image in the SDR format comprises:
[0009] compressing each video frame image in the SDR format based on a compression model;
[0010] wherein the compression model is obtained by training based on sample HDR video frame images and sample SDR video frame images.
[0011] According to the video compression method provided by the present application, the compression model is obtained by training based on the following steps:
[0012] inputting the sample HDR video frame image and the sample SDR video frame image into an encoding layer of the compression model respectively to obtain sample HDR encoding data and sample SDR encoding data output by the encoding layer;
[0013] inputting the sample HDR encoding data and the sample SDR encoding data into a decoding layer of the compression model respectively to obtain sample HDR decoding data and sample SDR decoding data output by the decoding layer;
[0014] performing parameter iteration on an initial model of the compression model based on a difference between the sample HDR video frame image and the sample HDR decoding data and a difference between the sample SDR video frame image and the sample SDR decoding data to obtain the compression model.
[0015] According to the video compression method provided by the application, the initial model of the compression model is iterated based on the difference between the sample HDR video frame image and the sample HDR decoding data and the difference between the sample SDR video frame image and the sample SDR decoding data, and the compression model is obtained, which comprises:
[0016] determining an HDR loss value based on the difference between the sample HDR video frame image and the sample HDR decoding data;
[0017] determining an SDR loss value based on the difference between the sample SDR video frame image and the sample SDR decoding data;
[0018] performing parameter iteration on the initial model based on the HDR loss value and the SDR loss value to obtain the compression model.
[0019] According to the video compression method provided by the application, the video frame image of the video to be compressed is converted into an SDR format, which comprises:
[0020] performing perceptual uniform encoding on each video frame image to obtain a perceptual value of each video frame image;
[0021] performing forward mapping on the perceptual value of each video frame image to obtain a forward mapping value of each video frame image, and determining a video frame image in a corresponding SDR format based on the forward mapping value of each video frame image.
[0022] According to the video compression method provided by the application, the video frame image after compression is converted into an HDR format, which comprises:
[0023] performing inverse mapping on each video frame image after compression to obtain an inverse mapping value of each video frame image;
[0024] The inverse mapping values of each video frame image are perceptually uniform coded to obtain each video frame image in HDR format.
[0025] According to the video compression method provided by the application, the video to be compressed is obtained, and then the method further comprises:
[0026] In the case that the video to be compressed is in SDR format, each video frame image of the video to be compressed is compressed, and an SDR compressed video is obtained based on the compressed video frame images.
[0027] The application further provides a video compression device, comprising:
[0028] The acquisition unit is configured to acquire a video to be compressed, and convert each video frame image of the video to be compressed into SDR format in the case that the video to be compressed is in HDR format.
[0029] The conversion unit is configured to compress each video frame image in SDR format, and convert the compressed video frame images into HDR format.
[0030] The compression unit is configured to obtain an HDR compressed video based on each video frame image in HDR format.
[0031] The application further provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the video compression method according to any one of the above-mentioned methods when executing the program.
[0032] The application further provides a non-transitory computer readable storage medium having a computer program stored thereon, wherein the computer program is executable on a processor to implement the video compression method according to any one of the above-mentioned methods.
[0033] The application further provides a computer program product comprising a computer program, wherein the computer program is executable on a processor to implement the video compression method according to any one of the above-mentioned methods.
[0034] The video compression method, device, electronic device and storage medium provided by the application can convert each video frame image of the video to be compressed into SDR format in the case that the video to be compressed is in HDR format, thereby being capable of compressing each video frame image in SDR format with high quality, converting the compressed video frame images into HDR format, and obtaining an HDR compressed video with good effect based on each video frame image in HDR format. BRIEF DESCRIPTION OF DRAWINGS
[0035] In order to make the technical solutions in the present application or the prior art clearer, the accompanying drawings needed in the embodiments or prior art description will be briefly introduced. Obviously, the accompanying drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort.
[0036] Figure 1 is one of the flowcharts of the video compression method provided by the present application;
[0037] Figure 2 is another flowchart of the video compression method provided by the present application;
[0038] Figure 3 is a flowchart of the compression model training method provided by the present application;
[0039] Figure 4 is a structural schematic diagram of the video compression device provided by the present application;
[0040] Figure 5 is a structural schematic diagram of the electronic device provided by the present application. DETAILED DESCRIPTION
[0041] In order to make the technical solutions in the present application or the prior art clearer, the accompanying drawings needed in the embodiments or prior art description will be briefly introduced. Obviously, the accompanying drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort.
[0042] The existing deep learning-based video compression method is used for compressing SDR video, while HDR video contains more bright information, and this part of information cannot be effectively processed by the existing deep learning-based video compression method. When using the existing deep learning-based video compression method to compress HDR video, the compression effect is far from its performance in the SDR video compression task, and is also not as good as the compression performance of traditional compression algorithms for HDR video. Therefore, the existing deep learning-based video compression method cannot effectively compress HDR video.
[0043] In addition, traditional compression algorithms (High Efficiency Video Coding, HEVC) are also used to compress HDR video, but the compression effect is not as good as using deep learning to compress SDR video.
[0044] In view of this, the present application provides a video compression method. Figure 1is one of flowcharts of the video compression method provided by the present application, as shown in the figure, the method comprises the following steps: Figure 1
[0045] Step 110, acquire the video to be compressed, and convert each video frame image of the video to be compressed into SDR format in the case that the video to be compressed is in HDR format.
[0046] Here, the video to be compressed is the video that needs to be compressed, and the video to be compressed can be a video that is pre-shot and stored, or a video stream that is collected in real time, and the embodiments of the present application do not make specific limitation on this.
[0047] The video to be compressed can be an HDR video, i.e. a video in HDR format, or an SDR video, i.e. a video in SDR format. In the case that the video to be compressed is in HDR format, since the HDR video contains more light information, the existing deep learning video compression method cannot effectively compress the HDR video, that is, the existing video compression method obtains a compressed video with poor quality after compressing the HDR video.
[0048] To this end, the embodiments of the present application convert each video frame image with more light information in the video to be compressed from HDR format to SDR format, so that each SDR format video frame image obtained is filtered of light information, so as to subsequently compress each SDR format video frame image with high quality. Alternatively, each video frame image in the video to be compressed can be acquired by video frame extraction on the video to be compressed, and each video frame image can be tone mapped to convert each video frame image into SDR format.
[0049] Step 120, compress each SDR format video frame image, and convert each compressed video frame image into HDR format.
[0050] Specifically, after converting each video frame image into SDR format, each SDR format video frame image is filtered of light information compared with the HDR format video frame image, so as to avoid the influence of light information in the HDR format video frame image on video compression, and thus each SDR format video frame image can be compressed with high quality.
[0051] After compressing each SDR format video frame image, the format of the compressed video frame image obtained at this time is SDR format. Since the final goal is to obtain a compressed video corresponding to the HDR video, the embodiments of the present application convert each compressed video frame image into HDR format to obtain each compressed video frame image in HDR format. Alternatively, the compressed video frame image can be inverse tone mapped to convert the compressed video frame image into SDR format.
[0052] Step 130: Obtain HDR compressed video based on video frame images of various HDR formats.
[0053] Specifically, after obtaining the video frame images in each HDR format, since each HDR format video frame image is a compressed image, they can be merged in the order of the video frame images in each HDR format to obtain an HDR compressed video.
[0054] like Figure 2 As shown, for HDR video, frame extraction is performed to obtain multiple video frame images (e.g., frame i-1, frame i, and frame i+1). Each video frame image undergoes tone mapping to convert it to SDR format. Next, the SDR format video frame images are input into a neural network, which encodes and decodes them to obtain compressed video frame images. Finally, inverse tone mapping is performed on the compressed video frame images to obtain the HDR compressed video.
[0055] The video compression method provided in this embodiment of the invention converts each video frame image of the video to be compressed into SDR format when the video to be compressed is in HDR format, thereby enabling high-quality compression of each SDR format video frame image, and converting the compressed video frame images into HDR format, thereby obtaining a high-quality HDR compressed video based on each HDR format video frame image.
[0056] Based on the above embodiments, compression of video frame images in SDR format is performed, including:
[0057] Based on the compression model, video frame images of various SDR formats are compressed;
[0058] The compression model was trained based on sample HDR video frame images and sample SDR video frame images.
[0059] Specifically, the sample HDR video frame image is the image obtained by converting each video frame image in the sample HDR video into SDR format; the sample SDR video frame image is the image obtained by extracting frames from the sample SDR video.
[0060] The embodiments of the present invention train the compression model based on sample HDR video frame images and sample SDR polarization images, so that the obtained compression model can learn HDR data information and SDR data information at the same time, thereby enabling the compression model to have good generalization performance and obtain high-quality HDR compressed video and SDR compressed video.
[0061] Based on any of the above embodiments, the compression model is trained using the following steps:
[0062] input the sample HDR video frame image and the sample SDR video frame image into the encoding layer of the compression model respectively to obtain sample HDR encoding data and sample SDR encoding data output by the encoding layer;
[0063] input the sample HDR encoding data and the sample SDR encoding data into the decoding layer of the compression model respectively to obtain sample HDR decoding data and sample SDR decoding data output by the decoding layer;
[0064] based on the difference between the sample HDR video frame image and the sample HDR decoding data and the difference between the sample SDR video frame image and the sample SDR decoding data, perform parameter iteration on the initial model of the compression model to obtain the compression model.
[0065] Specifically, the compression model includes an encoding layer and a decoding layer, the encoding layer is used for encoding the input video frame image to obtain corresponding encoding data, and the decoding layer is used for decoding the encoding data to obtain decoding data, that is, the compressed video frame image.
[0066] The difference between the sample HDR video frame image and the sample HDR decoding data is used to represent the distortion degree when the compression model compresses the HDR video, the greater the difference, the greater the distortion degree, and the worse the effect of the compressed video frame image; the smaller the difference, the smaller the distortion degree, and the better the effect of the compressed video frame image.
[0067] Similarly, the difference between the sample SDR video frame image and the sample SDR decoding data is used to represent the distortion degree when the compression model compresses the SDR video, the greater the difference, the greater the distortion degree, and the worse the effect of the compressed video frame image; the smaller the difference, the smaller the distortion degree, and the better the effect of the compressed video frame image.
[0068] In this regard, the embodiment of the present application performs parameter iteration on the initial model of the compression model based on the difference between the sample HDR video frame image and the sample HDR decoding data and the difference between the sample SDR video frame image and the sample SDR decoding data, so that the compression model can not only learn the HDR data information based on the difference between the sample HDR video frame image and the sample HDR decoding data, but also learn the SDR data information based on the difference between the sample SDR video frame image and the sample SDR decoding data, so that the trained compression model can perform video compression with high quality.
[0069] Based on any of the above embodiments, based on the difference between the sample HDR video frame image and the sample HDR decoding data and the difference between the sample SDR video frame image and the sample SDR decoding data, perform parameter iteration on the initial model of the compression model to obtain the compression model, including:
[0070] determine an HDR loss value based on a difference between the sample HDR video frame image and the sample HDR decoded data;
[0071] determine an SDR loss value based on a difference between the sample SDR video frame image and the sample SDR decoded data;
[0072] perform parameter iteration on the initial model based on the HDR loss value and the SDR loss value to obtain the compression model.
[0073] Specifically, the HDR loss value is used to represent the distortion degree when the compression model compresses the HDR video, the greater the HDR loss value, the greater the distortion degree, and the worse the effect of the compressed video frame image; the smaller the HDR loss value, the smaller the distortion degree, and the better the effect of the compressed video frame image. The SDR loss value is used to represent the distortion degree when the compression model compresses the SDR video, the greater the SDR loss value, the greater the distortion degree, and the worse the effect of the compressed video frame image; the smaller the SDR loss value, the smaller the distortion degree, and the better the effect of the compressed video frame image.
[0074] After determining the HDR loss value and the SDR loss value, in order to avoid overfitting, the two values can be weighted and summed to obtain a loss value of the model, and the initial model is iterated based on the loss value to obtain the compression model. However, when the two loss values are weighted and summed, if the weight of the HDR loss value is too large, the compression performance of the compression model on the SDR video may be damaged. Therefore, in order to further improve the generalization performance of the compression model, the present embodiment can add an invariance regularization term, so that the compression model can achieve good compression performance on both HDR video and SDR video. Therefore, the loss value of the compression model can be determined based on the following formula:
[0075]
[0076]
[0077]
[0078] wherein, L final represents the loss value of the compression model, L sd represents the SDR loss value, L hdr represents the HDR loss value, w dnn represents the weight of the compression model, λ1, λ2 and λ3 are hyperparameters, represents the code rate of the compressed video frame image, x sdr represents the SDR video frame image before compression, represents a compressed SDR video frame image, w represents a generalization algorithm variable, λ4 represents a hyperparameter, x hdr represents an HDR video frame image before compression, represents a compressed HDR video frame image, l1 represents an L1 norm.
[0079] As shown in Figure 3 , the HDR sample refers to an HDR video, and the SDR sample refers to an SDR video. For the HDR sample, first, tone mapping is performed, then the image obtained after tone mapping is input to the compression model, compression is performed by the compression model to obtain a compressed image, inverse tone mapping is performed on the compressed image, and an HDR loss value is determined; for the SDR sample, direct compression is performed by the compression model to obtain a compressed image, and an SDR loss value is determined. The HDR loss value and the SDR loss value are regularized and fused to obtain a loss value of the compression model, and parameter iteration is performed based on the loss value of the compression model to obtain the compression model.
[0080] Based on any of the above embodiments, each video frame image of the video to be compressed is converted into an SDR format, including:
[0081] The perceptual value of each video frame image is obtained by perceptual uniform encoding.
[0082] The forward mapping value of each video frame image is obtained by forward mapping the perceptual value of each video frame image, and the video frame image in the corresponding SDR format is determined based on the forward mapping value of each video frame image.
[0083] Specifically, after determining each video frame image of the video to be compressed, perceptual uniform (PU) encoding is performed on each video frame image to obtain the perceptual value of each video frame image. Then, the forward mapping value of each video frame image is obtained by forward mapping the perceptual value of each video frame image, and the video frame image in the corresponding SDR format is determined based on the forward mapping value of each video frame image.
[0084] The perceptual value of each video frame image is determined based on the following formula:
[0085]
[0086]
[0087] wherein P(L) represents the perceptual value of each video frame image, S represents an absolute sensitivity constant, C1, C2 and C3 are parameters determined by contrast sensitivity, L min represents the minimum encoding brightness, L represents the absolute brightness, and T(l) represents the detection threshold.
[0088] The forward mapping value of each video frame image is determined based on the following formula:
[0089] v(u) = (u - u i )s i + v i , if u i < u < u i+1
[0090] Wherein, when performing the forward mapping, a series of nodes (u i , v i ) and linear functions are used to model the mapping curve, v(u) represents the forward mapping value of each video frame image, u represents each video frame image, u i represents the prediction value of the video frame image in the i-th node, s i represents the slope of the i-th linear function, and v i represents the prediction value of the forward mapping value of the video frame image in the i-th node.
[0091] Based on any of the above embodiments, the compressed video frame images are converted into HDR format, including:
[0092] The compressed video frame images are inversely mapped to obtain the inverse mapping values of the video frame images;
[0093] The inverse mapping values of the video frame images are perceptually uniform encoded to obtain the video frame images in HDR format.
[0094] Specifically, the inverse mapping values of the video frame images can be determined based on the following formula:
[0095]
[0096] Wherein, represents the inverse mapping value of each video frame image, v represents the forward prediction value of each video frame image, and v i represents the prediction value of the forward mapping value of the video frame image in the i-th node.
[0097] After obtaining the inverse mapping values of the video frame images, the inverse mapping values of the video frame images can be perceptually uniform encoded using the formula for determining the perceptual values of the video frame images to obtain the video frame images in HDR format.
[0098] Based on any of the above embodiments, the video to be compressed is obtained, and then further includes:
[0099] In the case that the video to be compressed is in SDR format, each video frame image of the video to be compressed is compressed, and based on the compressed video frame images, an SDR compressed video is obtained.
[0100] Specifically, in a case where the video to be compressed is in an SDR format, since the SDR video has no excessive luminance information, the video to be compressed can be directly video-framed, the obtained video frame images are compressed, and an SDR compressed video is obtained based on the compressed video frame images.
[0101] It can be understood that, in a case where the video to be compressed is in an SDR format, the video frame images can be compressed by using the compression model in the above embodiment, or the video to be compressed can be compressed by using an existing compression method based on deep learning, which is not specifically limited in the embodiment of the present application.
[0102] The video compression device provided by the present application is described below, and the video compression device described below can be correspondingly referred to the video compression method described above.
[0103] Based on any one of the above embodiments, the present application further provides a video compression device, as shown in the figure, which comprises: Figure 4
[0104] The acquisition unit 410 is configured to acquire a video to be compressed, and convert video frame images of the video to be compressed into an SDR format in a case where the video to be compressed is in an HDR format.
[0105] The conversion unit 420 is configured to compress the video frame images in the SDR format, and convert the compressed video frame images into an HDR format.
[0106] The compression unit 430 is configured to obtain an HDR compressed video based on the video frame images in the HDR format.
[0107] Based on any one of the above embodiments, the conversion unit 420 is configured to:
[0108] compress the video frame images in the SDR format based on a compression model;
[0109] The compression model is obtained by training based on sample HDR video frame images and sample SDR video frame images.
[0110] Based on any one of the above embodiments, the device further comprises:
[0111] The encoding unit is configured to input the sample HDR video frame images and the sample SDR video frame images into an encoding layer of the compression model respectively, to obtain sample HDR encoding data and sample SDR encoding data output by the encoding layer;
[0112] a decoding unit, configured to input the sample HDR encoded data and the sample SDR encoded data into decoding layers of the compression model respectively, to obtain sample HDR decoded data and sample SDR decoded data output by the decoding layers;
[0113] a training unit, configured to perform parameter iteration on an initial model of the compression model based on differences between the sample HDR video frame image and the sample HDR decoded data, and differences between the sample SDR video frame image and the sample SDR decoded data, to obtain the compression model.
[0114] According to any one of the above embodiments, the training unit comprises:
[0115] a first loss determination unit, configured to determine an HDR loss value based on the differences between the sample HDR video frame image and the sample HDR decoded data;
[0116] a second loss determination unit, configured to determine an SDR loss value based on the differences between the sample SDR video frame image and the sample SDR decoded data;
[0117] an iteration unit, configured to perform parameter iteration on the initial model based on the HDR loss value and the SDR loss value, to obtain the compression model.
[0118] According to any one of the above embodiments, the obtaining unit 410 comprises:
[0119] a first perception unit, configured to perform perceptual uniform encoding on each video frame image to obtain a perceptual value of each video frame image;
[0120] a forward mapping unit, configured to perform forward mapping on the perceptual value of each video frame image to obtain a forward mapping value of each video frame image, and determine a video frame image in a corresponding SDR format based on the forward mapping value of each video frame image.
[0121] According to any one of the above embodiments, the conversion unit 420 comprises:
[0122] an inverse mapping unit, configured to perform inverse mapping on each video frame image after compression to obtain an inverse mapping value of each video frame image;
[0123] a second perception unit, configured to perform perceptual uniform encoding on the inverse mapping value of each video frame image to obtain each video frame image in an HDR format.
[0124] According to any one of the above embodiments, the apparatus further comprises:
[0125] The SDR compression unit is used to compress each video frame of the video to be compressed after acquiring the video to be compressed, provided that the video to be compressed is in SDR format, and to obtain an SDR compressed video based on the compressed video frame images.
[0126] Figure 5 This is a schematic diagram of the structure of the electronic device provided by the present invention, such as... Figure 5 As shown, the electronic device may include a processor 510, a memory 520, a communication interface 530, and a communication bus 540, wherein the processor 510, memory 520, and communication interface 530 communicate with each other through the communication bus 540. The processor 510 can call logical instructions in the memory 520 to execute a video compression method, which includes: acquiring a video to be compressed, and if the video to be compressed is in HDR format, converting each video frame image of the video to be compressed into SDR format; compressing each SDR format video frame image, and converting each compressed video frame image into HDR format; and obtaining an HDR compressed video based on each HDR format video frame image.
[0127] Furthermore, the logical instructions in the aforementioned memory 520 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0128] In another aspect, the present application also provides a computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform the video compression method provided by any of the above methods, the method comprising: obtaining a to-be-compressed video, and converting each video frame image of the to-be-compressed video into an SDR format if the to-be-compressed video is in an HDR format; compressing each video frame image in the SDR format, and converting each compressed video frame image into an HDR format; and obtaining an HDR compressed video based on each video frame image in the HDR format.
[0129] In yet another aspect, the present application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement a video compression method provided by any of the above methods, the method comprising: obtaining a to-be-compressed video, and converting each video frame image of the to-be-compressed video into an SDR format if the to-be-compressed video is in an HDR format; compressing each video frame image in the SDR format, and converting each compressed video frame image into an HDR format; and obtaining an HDR compressed video based on each video frame image in the HDR format.
[0130] The device embodiments described above are merely illustrative, wherein the units described as separate components can or can not be physically separate, and the components displayed as units can or can not be physical units, i.e., can be located in one place or distributed on multiple network units. Part or all of the modules can be selected to achieve the purpose of the embodiment scheme according to actual needs. Those skilled in the art can understand and implement without creative labor.
[0131] From the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be realized by means of software plus a necessary general hardware platform, and of course can also be realized by hardware. Based on such understanding, the above technical solutions can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, etc., and includes a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in each embodiment or some parts of the embodiments.
[0132] It should be pointed out finally that the above embodiments are only used to illustrate the technical solutions of the present application, but not to limit the same; and although the present application has been described in detail with reference to the foregoing embodiments, it should be appreciated by those skilled in the art that the technical solutions recorded in the foregoing embodiments can be modified, or some technical features thereof can be replaced equivalently; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method of video compression, characterized by, The method comprises the following steps: acquiring a video to be compressed, and converting each video frame image of the video to be compressed into an SDR format if the video to be compressed is in an HDR format; compressing each video frame image in the SDR format based on a compression model, and converting each compressed video frame image into an HDR format; obtaining an HDR compressed video based on each video frame image in the HDR format; wherein the compression model is trained based on sample HDR video frame images and sample SDR video frame images, a loss value of the compression model is obtained by regularizing and fusing an HDR loss value and an SDR loss value, the HDR loss value is determined based on a difference between the sample HDR video frame images and sample HDR decoded data, and the SDR loss value is determined based on a difference between the sample SDR video frame images and sample SDR decoded data; the compression model is trained based on the following steps: inputting the sample HDR video frame images and the sample SDR video frame images into an encoding layer of the compression model respectively to obtain sample HDR encoded data and sample SDR encoded data output by the encoding layer; inputting the sample HDR encoded data and the sample SDR encoded data into a decoding layer of the compression model respectively to obtain sample HDR decoded data and sample SDR decoded data output by the decoding layer; performing parameter iteration on an initial model of the compression model based on a difference between the sample HDR video frame images and the sample HDR decoded data and a difference between the sample SDR video frame images and the sample SDR decoded data to obtain the compression model.
2. The video compression method of claim 1, wherein, The conversion of each video frame image of the video to be compressed into the SDR format comprises the following steps: performing perceptual uniform encoding on each video frame image to obtain a perceptual value of each video frame image; performing forward mapping on the perceptual value of each video frame image to obtain a forward mapping value of each video frame image, and determining a video frame image in the corresponding SDR format based on the forward mapping value of each video frame image.
3. The video compression method of any of claims 1-2, wherein, The conversion of each compressed video frame image into the HDR format comprises the following steps: performing inverse mapping on each compressed video frame image to obtain an inverse mapping value of each video frame image; performing perceptual uniform encoding on the inverse mapping value of each video frame image to obtain each video frame image in the HDR format.
4. The video compression method of any of claims 1 to 2, wherein, After acquiring the video to be compressed, the method further comprises the following steps: compressing each video frame image of the video to be compressed if the video to be compressed is in the SDR format, and obtaining an SDR compressed video based on each compressed video frame image.
5. A video compression apparatus characterized by comprising: The method comprises the following steps: an acquiring unit is configured to acquire a video to be compressed, and convert each video frame image of the video to be compressed into an SDR format if the video to be compressed is in an HDR format; a converting unit is configured to compress each video frame image in the SDR format based on a compression model, and convert each compressed video frame image into an HDR format; a compressing unit is configured to obtain an HDR compressed video based on each video frame image in the HDR format. The compression model is trained based on a sample HDR video frame image and a sample SDR video frame image, a loss value of the compression model is obtained by regularizing and fusing an HDR loss value and an SDR loss value, the HDR loss value is determined based on a difference between the sample HDR video frame image and sample HDR decoded data, and the SDR loss value is determined based on a difference between the sample SDR video frame image and sample SDR decoded data. The compression model is trained based on the following steps: The sample HDR video frame image and the sample SDR video frame image are respectively input into an encoding layer of the compression model to obtain sample HDR encoded data and sample SDR encoded data output by the encoding layer; The sample HDR encoded data and the sample SDR encoded data are respectively input into a decoding layer of the compression model to obtain sample HDR decoded data and sample SDR decoded data output by the decoding layer; An initial model of the compression model is iterated in parameters based on a difference between the sample HDR video frame image and the sample HDR decoded data and a difference between the sample SDR video frame image and the sample SDR decoded data to obtain the compression model.
6. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor implements the video compression method in any one of claims 1 to 4 when executing the program.
7. A non-transitory computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program implements the video compression method in any one of claims 1 to 4 when executed by the processor.
Citation Information
Patent Citations
Methods and systems for high dynamic range video coding
US20070201560A1