Video frame metadata correction method and device, equipment and storage medium
By constructing a display brightness, cubic spline, and saturation correction factor to reverse-correct metadata, the signal-metadata inconsistency problem caused by the independence of the encoder and metadata is solved, ensuring that the video frame metadata is consistent with the display signal, and achieving the accuracy and compatibility of tone mapping.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-25
- Publication Date
- 2026-03-13
AI Technical Summary
In traditional video encoding, the encoder and metadata generation module are independent, which leads to changes in the brightness distribution and contrast structure of the encoded video. This results in inconsistencies between the metadata and the actual video signal, causing tone mapping errors and a decrease in perceptual consistency.
By constructing target display brightness correction factors, target cubic spline correction factors, and target saturation correction factors, the initial metadata is corrected in reverse to ensure that the metadata is consistent with the video signal at the display end. The HDR Vivid standard is used for analysis and encoding to construct correction factors and correct metadata parameter values.
It achieves consistency between metadata and display video signals, ensures accurate tone mapping, is compatible with the HDR Vivid standard without changing metadata syntax or decoding process, and maintains compatibility and feasibility.
Smart Images

Figure CN121665057A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of video coding technology, and in particular to a method, apparatus, device, and storage medium for correcting video frame metadata. Background Technology
[0002] The HDR Vivid workflow typically includes: generating static or dynamic metadata by a metadata generation module; compressing and encoding the video using standard video encoders such as HEVC (High Efficiency Video Coding) and AVS3 (AVS, Audio Video Coding Standard) to generate a bitstream, and carrying the corresponding metadata information in the bitstream.
[0003] However, in traditional workflows, the encoder and metadata generation module operate independently. The encoder's quantization, bitrate control, and predictive decisions significantly alter the brightness distribution and contrast structure of the video, causing the encoded video to no longer perfectly correspond to the metadata generated based on the original signal. This results in increased tone mapping errors and decreased perceptual consistency at the terminal display.
[0004] In summary, how to reverse-correct the metadata of video frames to ensure that the metadata of video frames always remains consistent with the actual video signal received by the display is a technical problem that urgently needs to be solved. Summary of the Invention
[0005] In view of this, the purpose of this invention is to provide a video frame metadata correction method, apparatus, device, and storage medium, capable of reverse correction of video frame metadata to ensure that the video frame metadata is always consistent with the actual video signal received by the display end. The specific solution is as follows:
[0006] Firstly, this application provides a video frame metadata correction method, including:
[0007] The target HDR video is acquired, and the initial video frames of the target HDR video are analyzed based on the HDR Vivid standard to generate initial metadata of the initial video frames.
[0008] The target HDR video is compressed using a preset video encoder to generate a corresponding compressed bitstream, and the target quantization parameter map of the initial video frame is obtained; the quantization parameter map is used to record the quantization parameters corresponding to the spatial position of each coded block of the initial video frame.
[0009] Based on the target quantization parameter map, a target display brightness correction factor is constructed, as well as a target cubic spline correction factor and a target saturation correction factor;
[0010] The initial metadata is corrected using the target display brightness correction factor, the target cubic spline correction factor, and the target saturation correction factor to obtain target metadata. The compressed bitstream and the target metadata are then encapsulated based on the HDR Vivid standard to obtain the target file.
[0011] Optionally, the analysis of the initial video frames of the target HDR video based on the HDR Vivid standard to generate initial metadata for the initial video frames includes:
[0012] The initial video frame of the target HDR video is analyzed based on the dynamic metadata generation algorithm corresponding to the HDR Vivid standard to generate the initial metadata of the initial video frame;
[0013] The initial metadata includes the first brightness metadata, the first cubic spline metadata, and the first saturation metadata of the initial video frame; the first brightness metadata includes the first average brightness, the first maximum brightness, and the first minimum brightness of the displayed content of the initial video frame; and the first cubic spline metadata includes the first cubic spline interval parameters, the first cubic spline interval parameter offset, and the second cubic spline interval parameter offset.
[0014] Optionally, after compressing the target HDR video using a preset video encoder to generate a corresponding compressed bitstream, the method further includes:
[0015] Based on the compressed bitstream, determine the target video frame obtained by compressing the initial video frame;
[0016] The first red density offset and the first blue density offset of the initial video frame are determined, and the second red density offset and the second blue density offset of the target video frame are determined, so as to construct the target saturation correction factor based on the first red density offset, the first blue density offset, the second red density offset and the second blue density offset.
[0017] Optionally, constructing the target display brightness correction factor based on the target quantization parameter map includes:
[0018] The group of frames (GOPs) corresponding to the initial video frames are determined, and the minimum quantization parameter is determined from the quantization parameter graph corresponding to each video frame within the GOP; the GOP consists of several initial video frames of the target HDR video, and the GOP contains the initial video frames.
[0019] Determine the target scaling factor between the target video frame and the initial video frame, determine the target difference between the target quantization parameter map and the minimum quantization parameter, and determine the target weight based on the product of the target difference and the target scaling factor;
[0020] The texture complexity map corresponding to the initial video frame is determined, and a first sum value between the texture complexity map and a first preset constant is determined; the texture complexity map is used to record the texture complexity corresponding to the spatial position of each coded block of the initial video frame;
[0021] The target display brightness correction factor is constructed based on the quotient of the target weight and the first sum.
[0022] Optionally, the construction target cubic spline correction factor includes:
[0023] The target video frame is analyzed based on the dynamic metadata generation algorithm corresponding to the HDR Vivid standard to determine the target average brightness of the target video frame;
[0024] The target brightness deviation is determined based on the difference between the first average brightness and the target average brightness, and the target cubic spline correction factor is constructed based on the quotient of the target brightness deviation and the first average brightness.
[0025] Optionally, constructing the target saturation correction factor based on the first red concentration offset, the first blue concentration offset, the second red concentration offset, and the second blue concentration offset includes:
[0026] Determine the first absolute value corresponding to the difference between the first red concentration offset and the second red concentration offset, and determine the second absolute value corresponding to the difference between the first blue concentration offset and the second blue concentration offset;
[0027] The target chromaticity deviation is determined based on the sum of the first absolute value and the second absolute value, and a second sum value is determined between the absolute value of the first red concentration offset and the absolute value of the first blue concentration offset.
[0028] The first quotient is determined based on the second sum and the second preset constant, and the target saturation correction factor is constructed based on the second quotient between the target chromaticity deviation and the first quotient.
[0029] Optionally, the step of correcting the initial metadata using the target display brightness correction factor, the target cubic spline correction factor, and the target saturation correction factor to obtain target metadata includes:
[0030] The first average brightness, the first maximum brightness, and the first minimum brightness are corrected using the target display brightness correction factor to obtain the second average brightness, the second maximum brightness, and the second minimum brightness, and the second brightness metadata is determined based on the second average brightness, the second maximum brightness, and the second minimum brightness.
[0031] The first cubic spline interval parameter, the first cubic spline interval parameter offset, and the second cubic spline interval parameter offset are corrected respectively using the target cubic spline correction factor to obtain the second cubic spline interval parameter, the third cubic spline interval parameter offset, and the fourth cubic spline interval parameter offset. The second cubic spline metadata is then determined based on the second cubic spline interval parameter, the third cubic spline interval parameter offset, and the fourth cubic spline interval parameter offset.
[0032] The first saturation metadata is corrected using the target saturation correction factor to obtain the second saturation metadata;
[0033] The target metadata is determined based on the second luminance metadata, the second cubic spline metadata, and the second saturation metadata.
[0034] Secondly, this application provides a video frame metadata correction device, comprising:
[0035] The metadata generation module is used to acquire the target HDR video and analyze the initial video frames of the target HDR video based on the HDR Vivid standard to generate the initial metadata of the initial video frames.
[0036] The video compression module is used to compress the target HDR video using a preset video encoder to generate a corresponding compressed bitstream, and to obtain the target quantization parameter map of the initial video frame; the quantization parameter map is used to record the quantization parameters corresponding to the spatial position of each coded block of the initial video frame.
[0037] The correction factor construction module is used to construct a target display brightness correction factor based on the target quantization parameter map, and to construct a target cubic spline correction factor and a target saturation correction factor;
[0038] The metadata correction module is used to correct the initial metadata using the target display brightness correction factor, the target cubic spline correction factor, and the target saturation correction factor to obtain target metadata, and to encapsulate the compressed bitstream and the target metadata based on the HDRVivid standard to obtain the target file.
[0039] Thirdly, this application provides an electronic device, comprising:
[0040] Memory, used to store computer programs;
[0041] A processor is used to execute the computer program to implement the aforementioned video frame metadata correction method.
[0042] Fourthly, this application provides a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned video frame metadata correction method.
[0043] In this application, a target HDR video is first acquired, and the initial video frames of the target HDR video are analyzed based on the HDR Vivid standard to generate initial metadata of the initial video frames. Then, the target HDR video is compressed using a preset video encoder to generate a corresponding compressed bitstream, and a target quantization parameter map of the initial video frames is obtained. The quantization parameter map is used to record the quantization parameters corresponding to the spatial positions of each coded block of the initial video frames. Subsequently, a target display brightness correction factor is constructed based on the target quantization parameter map, and a target cubic spline correction factor and a target saturation correction factor are also constructed. Finally, the initial metadata is corrected using the target display brightness correction factor, the target cubic spline correction factor, and the target saturation correction factor to obtain target metadata. The compressed bitstream and the target metadata are then encapsulated based on the HDR Vivid standard to obtain a target file. As can be seen from the above, this application first analyzes the initial video frames of the target HDR video based on the HDR Vivid standard to obtain initial metadata; then, it compresses the target HDR video using a preset video encoder to obtain a compressed bitstream, and simultaneously acquires the target quantization parameter map corresponding to the compressed initial video frames; next, it constructs a target display brightness correction factor, a target cubic spline correction factor, and a target saturation correction factor based on the target quantization parameter map; finally, it uses the target display brightness correction factor, the target cubic spline correction factor, and the target saturation correction factor to reverse correct the initial metadata to obtain target metadata, and encapsulates the corrected target metadata with the compressed bitstream to form the target file. In this way, the construction of correction factors and the reverse correction of the video frame metadata in this application breaks the open-loop mode where metadata generation and video encoding are independent in the traditional process, solving the problem of "signal-metadata description mismatch," ensuring that the metadata of the video frame is always consistent with the actual video signal received by the display end, and guiding the display end to perform safer tone mapping by reverse adjusting the metadata. At the same time, this application is compatible with the HDR Vivid standard, only adding reverse correction on the metadata generation side to change the metadata parameter values, without changing the metadata syntax or decoding process, ensuring compatibility and feasibility. Attached Figure Description
[0044] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0045] Figure 1 A flowchart of a video frame metadata correction method provided in this application;
[0046] Figure 2 This application provides a specific flowchart for video frame metadata correction;
[0047] Figure 3 A schematic diagram of a video frame metadata correction device provided in this application;
[0048] Figure 4 This application provides a structural diagram of an electronic device. Detailed Implementation
[0049] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0050] The HDR Vivid workflow typically includes: generating static or dynamic metadata by a metadata generation module; compressing and encoding the video using a standard video encoder, such as HEVC or AVS3, to generate a bitstream, carrying the corresponding metadata information within the bitstream. However, in traditional workflows, the encoder and metadata generation module operate independently. The encoder's quantization, bitrate control, and prediction decisions significantly alter the video's brightness distribution and contrast structure, causing the encoded video to no longer perfectly correspond to the metadata generated based on the original signal. This results in increased tone mapping errors and decreased perceptual consistency at the terminal display. To address this, this application provides a video frame metadata correction scheme that reverse-corrects the video frame's metadata to ensure that the video frame's metadata always remains consistent with the actual video signal received at the display.
[0051] See Figure 1 As shown, this embodiment of the invention discloses a video frame metadata correction method, which may include:
[0052] Step S11: Obtain the target HDR video and analyze the initial video frames of the target HDR video based on the HDR Vivid standard to generate initial metadata of the initial video frames.
[0053] In this embodiment, a target HDR video is first acquired, and then the initial video frames of the target HDR video are analyzed based on the HDR Vivid standard to generate initial metadata of the initial video frames. The specific process may include: analyzing the initial video frames of the target HDR video based on the dynamic metadata generation algorithm corresponding to the HDR Vivid standard to generate the initial metadata of the initial video frames; wherein, the initial metadata includes first luminance metadata, first cubic spline metadata, and first saturation metadata of the initial video frames; the first luminance metadata includes the first average luminance, first maximum luminance, and first minimum luminance of the displayed content of the initial video frames, and the first cubic spline metadata includes first cubic spline interval parameters, first cubic spline interval parameter offset, and second cubic spline interval parameter offset.
[0054] Specifically, in this embodiment, the initial video frame i is analyzed based on the dynamic metadata generation algorithm corresponding to the HDR Vivid standard to generate a first average brightness. First maximum brightness and the first minimum brightness The first luminance metadata is obtained, and parameters of the first cubic spline interval are generated. First and third cubic spline interval parameter offset Second and third cubic spline interval parameter offset The first cubic spline metadata, and simultaneously generate metadata containing the first saturation correction intensity. The first saturation metadata.
[0055] Step S12: Compress the target HDR video using a preset video encoder to generate a corresponding compressed bitstream, and obtain the target quantization parameter map of the initial video frame; the quantization parameter map is used to record the quantization parameters corresponding to the spatial positions of each coding block of the initial video frame.
[0056] In this embodiment, a preset video encoder, such as H.266 / VVC (VVC, Versatile Video Coding), H.265 / HEVC, etc., can be used to compress the target HDR video to generate a compressed bitstream, and at the same time, the quantization parameter map of each video frame is exported to obtain the target quantization parameter map of the initial video frame i. The quantization parameter map is used to record the quantization parameters aligned with the spatial positions of each coded block of the initial video frame; where i represents the video frame number. Indicates the spatial location of the coded block.
[0057] It should be noted that after compressing the target HDR video using a preset video encoder to generate the corresponding compressed bitstream, the process may further include: determining the target video frame obtained by compressing the initial video frame based on the compressed bitstream; determining the first red density offset and the first blue density offset of the initial video frame, and determining the second red density offset and the second blue density offset of the target video frame, so as to construct the target saturation correction factor based on the first red density offset, the first blue density offset, the second red density offset, and the second blue density offset.
[0058] Specifically, the target video frame obtained by compressing the initial video frame is first determined based on the compressed bitstream. Then, the first red density offset of the initial video frame is determined. and the first blue concentration offset And determine the second red density offset of the target video frame. Second blue concentration offset ;in, and This is the density offset of the video frame decoded and recovered internally by the encoder, representing the distorted chroma signal that will be sent to the display.
[0059] Step S13: Construct a target display brightness correction factor based on the target quantization parameter map, and construct a target cubic spline correction factor and a target saturation correction factor.
[0060] In this embodiment, the target display brightness correction factor is constructed based on the target quantization parameter map. The specific process may include: first, determining the GOP (Group of Pictures) corresponding to the initial video frame, and determining the minimum quantization parameter from the quantization parameter map corresponding to each video frame within the GOP; the GOP consists of several initial video frames of the target HDR video, and the GOP contains the initial video frames; then, determining the target scaling factor between the target video frame and the initial video frame, and determining the target difference between the target quantization parameter map and the minimum quantization parameter, and determining the target weight based on the product of the target difference and the target scaling factor; subsequently, determining the texture complexity map corresponding to the initial video frame, and determining the first sum between the texture complexity map and a first preset constant; the texture complexity map is used to record the texture complexity corresponding to the spatial position of each coding block of the initial video frame; finally, constructing the target display brightness correction factor based on the quotient of the target weight and the first sum.
[0061] Specifically, the first step is to determine the Group of Pictures (GOP) corresponding to the initial video frames, and then determine the minimum quantization parameter from the quantization parameter graph corresponding to each video frame within the GOP. Then, the target scaling factor between the target video frame and the initial video frame can be determined. Subsequently, based on the minimum quantization parameter Target scaling factor And target quantization parameter diagram Generate target weights As shown below:
[0062] ;
[0063] in, The target scaling factor. For the minimum quantization parameter, Quantize the parameters for the target.
[0064] Next, use a small sliding window, the size of which is... or Local variance calculation is performed on the initial video frame to obtain the texture complexity map corresponding to the initial video frame. The texture complexity map is used to record the texture complexity corresponding to the spatial location of each coded block in the initial video frame.
[0065] Finally, construct the target display brightness correction factor. As shown below:
[0066] ;
[0067] in, This is the first preset constant, a small constant, to prevent division by zero. For the target weight, This is a texture complexity map. In this way, the formula for constructing the target display brightness correction factor assigns high weights to even small distortions indicated by quantization parameters in flat areas with a small Var; distortion weights in textured, complex areas with a large Var are effectively suppressed, accurately simulating the contrast masking effect of the human eye. Thus, in this embodiment, the encoding parameters are combined with the contrast masking effect, ensuring that the direction of display brightness correction in the metadata aligns with the visual sensitivity of the human eye.
[0068] In this embodiment, the specific process of constructing the target cubic spline correction factor may include: firstly, analyzing the target video frame based on the dynamic metadata generation algorithm corresponding to the HDR Vivid standard to determine the target average brightness of the target video frame; then, determining the target brightness deviation based on the difference between the first average brightness and the target average brightness, and constructing the target cubic spline correction factor based on the quotient of the target brightness deviation and the first average brightness.
[0069] Specifically, in this embodiment, the target video frame is first analyzed based on the dynamic metadata generation algorithm corresponding to the HDR Vivid standard to determine the target average brightness of the target video frame. Next, the target brightness deviation was determined. As shown below:
[0070] ;
[0071] in, The average brightness of the initial video frames. The average brightness of the target video frame.
[0072] Finally, construct the target cubic spline correction factor. As shown below:
[0073] ;
[0074] in, This refers to the target brightness deviation.
[0075] In this embodiment, a target saturation correction factor can be constructed based on the first red density offset, the first blue density offset, the second red density offset, and the second blue density offset of the target video frame. The specific process may include: first, determining the first absolute value corresponding to the difference between the first red density offset and the second red density offset, and determining the second absolute value corresponding to the difference between the first blue density offset and the second blue density offset; then, determining the target chromaticity deviation based on the sum of the first and second absolute values, and determining the second sum between the absolute values of the first red density offset and the first blue density offset; finally, determining the first quotient based on the second sum and a second preset constant, and constructing the target saturation correction factor based on the second quotient between the target chromaticity deviation and the first quotient.
[0076] Specifically, the target chromaticity deviation is first calculated. As shown below:
[0077] ;
[0078] in, This is the first blue concentration offset. This is the second blue concentration offset. This is the first red concentration offset. This is the offset of the second red concentration.
[0079] Next, the target saturation correction factor is constructed. As shown below:
[0080] ;
[0081] in, This is the second preset constant, a small constant, to prevent division by zero. The target chromaticity deviation.
[0082] Step S14: Correct the initial metadata using the target display brightness correction factor, the target cubic spline correction factor, and the target saturation correction factor to obtain target metadata, and encapsulate the compressed bitstream and the target metadata based on the HDR Vivid standard to obtain the target file.
[0083] In this embodiment, the first average brightness, the first maximum brightness, and the first minimum brightness can be corrected using the target display brightness correction factor to obtain the second average brightness, the second maximum brightness, and the second minimum brightness, and the second brightness metadata can be determined based on the second average brightness, the second maximum brightness, and the second minimum brightness.
[0084] Specifically, in the first embodiment, the first maximum brightness is corrected. As shown below:
[0085] (1) First, identify all brightness values in the initial video frame. The set of pixels S1 within the range; where, It is a threshold close to 1, such as 0.95, where S1 represents the "highlight core region" defined by the initial metadata.
[0086] (2) Target display brightness correction factor In the process, find the weight values corresponding to all pixels in set S1, and then calculate the average of the weight values corresponding to all pixels. ;in, Used to quantify the degree of failure of the encoder in preserving the visual quality of the "highlight core region". The higher the value, the more distortion that is perceptible to the human eye is generated in that area.
[0087] (3) Reverse correction of the first maximum brightness Second maximum brightness obtained The formula is as follows:
[0088] ;
[0089] in, This is a configurable attenuation factor, for example, between 0.05 and 0.2. The formula means that if the encoder cannot preserve highlight details with high quality (manifesting as high...),... Therefore, in this embodiment, the reported first maximum brightness needs to be lowered in the initial metadata to avoid amplifying encoding distortion and resulting in poor visual effects.
[0090] In the second specific implementation, the first minimum brightness is corrected. As shown below:
[0091] (1) First, identify all brightness values in the initial video frame. The set of pixels S2 within the range; where, It is a threshold slightly greater than 1.
[0092] (2) Target display brightness correction factor In the process, find the weight values corresponding to all pixels in set S2, and then calculate the average of the weight values corresponding to all pixels. .
[0093] (3) Reverse correction of the first minimum brightness Second maximum brightness obtained The formula is as follows:
[0094] ;
[0095] in, This is a configurable attenuation factor.
[0096] In the third specific embodiment, the first average brightness is corrected. As shown below:
[0097] (1) Target display brightness correction factor In the process, find the weight values corresponding to all pixels in the initial video frame, and then calculate the average of the weight values corresponding to all pixels. .
[0098] (2) Inverse correction of the first average brightness Second average brightness The formula is as follows:
[0099] ;
[0100] in, This is a configurable attenuation factor.
[0101] It should be noted that the cubic spline interval parameters and the offsets of the two cubic spline interval parameters in the cubic spline metadata define the key control points of the tone mapping curve's horizontal axis. The encoding process can cause changes in the actual brightness distribution; therefore, the metadata of these control points needs to be reverse-corrected to restore the correct brightness on the display. In this embodiment, the target cubic spline correction factor can be used to correct the first cubic spline interval parameters, the first cubic spline interval parameter offsets, and the second cubic spline interval parameter offsets, respectively, to obtain the second cubic spline interval parameters, the third cubic spline interval parameter offsets, and the fourth cubic spline interval parameter offsets. The second cubic spline metadata is then determined based on these offsets.
[0102] Specifically, the parameters of the first and third cubic spline intervals are corrected. Obtain the parameters of the second and third cubic spline intervals. As shown below:
[0103] ;
[0104] in, This indicates the target cubic spline correction factor. Limited to Within this range, the value of c is typically 0.2, indicating a maximum scaling down of 20%, to prevent extreme values from causing overscaling. To correct the scaling factor, it is used to compensate for the scaling factor of the target cubic spline. .
[0105] Then, the offset of the first and third spline interval parameters is corrected. Obtain the offset of the third and third cubic spline interval parameters As shown below:
[0106] ;
[0107] in, To correct the scaling factor, usually .
[0108] Then, the offset of the second and third spline interval parameters is corrected. Obtain the offset of the fourth cubic spline interval parameters As shown below:
[0109] ;
[0110] in, To correct the scaling factor, usually .
[0111] It should be noted that encoding may result in the loss or shift of chroma information, and false colors may occur when saturation is significantly increased. Therefore, it is necessary to adjust the first saturation metadata according to the chroma deviation after encoding. In this embodiment, the first saturation metadata can be corrected using a target saturation correction factor to obtain the second saturation metadata. Specifically, the first saturation correction intensity metadata is corrected using the target saturation correction factor. Obtain second saturation correction intensity metadata As shown below:
[0112] ;
[0113] in, To correct the scaling factor, usually .
[0114] In this embodiment, the corrected target metadata can be determined based on the second luminance metadata, the second cubic spline metadata, and the second saturation metadata. Next, see... Figure 2 As shown, in this embodiment, the target metadata of the compressed bitstream and the target video frame can be encapsulated based on the HDR Vivid standard to obtain the target file.
[0115] As can be seen from the above, in this embodiment, the target HDR video is first acquired, and the initial video frames of the target HDR video are analyzed based on the HDR Vivid standard to generate initial metadata of the initial video frames. Then, the target HDR video is compressed using a preset video encoder to generate a corresponding compressed bitstream, and the target quantization parameter map of the initial video frames is obtained. The quantization parameter map is used to record the quantization parameters corresponding to the spatial positions of each coding block of the initial video frames. Subsequently, a target display brightness correction factor, a target cubic spline correction factor, and a target saturation correction factor are constructed based on the target quantization parameter map. Finally, the initial metadata is corrected using the target display brightness correction factor, the target cubic spline correction factor, and the target saturation correction factor to obtain target metadata. The compressed bitstream and the target metadata are then encapsulated based on the HDR Vivid standard to obtain the target file. As can be seen from the above, this embodiment first analyzes the initial video frames of the target HDR video based on the HDR Vivid standard to obtain initial metadata; then, it uses a preset video encoder to compress the target HDR video to obtain a compressed bitstream, and simultaneously acquires the target quantization parameter map corresponding to the compressed initial video frames; next, it constructs a target display brightness correction factor, a target cubic spline correction factor, and a target saturation correction factor based on the target quantization parameter map; finally, it uses the target display brightness correction factor, the target cubic spline correction factor, and the target saturation correction factor to reverse correct the initial metadata to obtain target metadata, and encapsulates the corrected target metadata with the compressed bitstream to form the target file. In this way, this embodiment constructs correction factors and reverse corrects the metadata of the video frames, breaking the open-loop mode where metadata generation and video encoding are independent in the traditional process, solving the problem of "signal-metadata description mismatch," ensuring that the metadata of the video frames is always consistent with the actual video signal received by the display end, and guiding the display end to perform safer tone mapping by reverse adjusting the metadata. At the same time, this embodiment is compatible with the HDR Vivid standard, only adding reverse correction on the metadata generation side to change the metadata parameter values, without changing the metadata syntax or decoding process, ensuring compatibility and feasibility.
[0116] Accordingly, see Figure 3 As shown in the embodiments of this application, a video frame metadata correction device is also provided, which may include:
[0117] Metadata generation module 11 is used to acquire the target HDR video and analyze the initial video frames of the target HDR video based on the HDR Vivid standard to generate initial metadata of the initial video frames.
[0118] The video compression module 12 is used to compress the target HDR video using a preset video encoder to generate a corresponding compressed bitstream, and to obtain the target quantization parameter map of the initial video frame; the quantization parameter map is used to record the quantization parameters corresponding to the spatial position of each coded block of the initial video frame.
[0119] The correction factor construction module 13 is used to construct a target display brightness correction factor based on the target quantization parameter map, and to construct a target cubic spline correction factor and a target saturation correction factor;
[0120] Metadata correction module 14 is used to correct the initial metadata using the target display brightness correction factor, the target cubic spline correction factor and the target saturation correction factor to obtain target metadata, and to encapsulate the compressed bitstream and the target metadata based on the HDR Vivid standard to obtain a target file.
[0121] In some specific embodiments, the metadata generation module 11 may include:
[0122] The metadata generation unit is used to analyze the initial video frame of the target HDR video based on the dynamic metadata generation algorithm corresponding to the HDR Vivid standard, so as to generate the initial metadata of the initial video frame; wherein, the initial metadata includes the first luminance metadata, the first cubic spline metadata, and the first saturation metadata of the initial video frame; the first luminance metadata includes the first average luminance, the first maximum luminance, and the first minimum luminance of the display content of the initial video frame, and the first cubic spline metadata includes the first cubic spline interval parameters, the first cubic spline interval parameter offset, and the second cubic spline interval parameter offset.
[0123] In some specific embodiments, the video frame metadata correction device may further include:
[0124] The target video frame determination module is used to determine the target video frame obtained by compressing the initial video frame based on the compressed bitstream.
[0125] A saturation correction factor construction module is used to determine the first red density offset and the first blue density offset of the initial video frame, and to determine the second red density offset and the second blue density offset of the target video frame, so as to construct the target saturation correction factor based on the first red density offset, the first blue density offset, the second red density offset, and the second blue density offset.
[0126] In some specific embodiments, the correction factor construction module 13 may include:
[0127] The minimum quantization parameter determination unit is used to determine the group of frames (GOP) corresponding to the initial video frame and to determine the minimum quantization parameter from the quantization parameter graph corresponding to each video frame in the GOP; the GOP consists of several initial video frames of the target HDR video, and the GOP contains the initial video frames.
[0128] The target weight determination unit is used to determine the target scaling factor between the target video frame and the initial video frame, and to determine the target difference between the target quantization parameter map and the minimum quantization parameter, and to determine the target weight based on the product of the target difference and the target scaling factor;
[0129] A texture complexity map determination unit is used to determine the texture complexity map corresponding to the initial video frame, and to determine a first sum value between the texture complexity map and a first preset constant; the texture complexity map is used to record the texture complexity corresponding to the spatial position of each coded block of the initial video frame;
[0130] The display brightness correction factor construction unit is used to construct the target display brightness correction factor based on the quotient of the target weight and the first sum.
[0131] In some specific embodiments, the correction factor construction module 13 may include:
[0132] The target average brightness determination unit is used to analyze the target video frame based on the dynamic metadata generation algorithm corresponding to the HDR Vivid standard in order to determine the target average brightness of the target video frame.
[0133] The cubic spline correction factor construction unit is used to determine the target brightness deviation based on the difference between the first average brightness and the target average brightness, and to construct the target cubic spline correction factor based on the quotient of the target brightness deviation and the first average brightness.
[0134] In some specific embodiments, the saturation correction factor construction module may include:
[0135] An absolute value determination unit is used to determine a first absolute value corresponding to the difference between the first red concentration offset and the second red concentration offset, and to determine a second absolute value corresponding to the difference between the first blue concentration offset and the second blue concentration offset.
[0136] A color deviation determination unit is used to determine a target color deviation based on the sum of the first absolute value and the second absolute value, and to determine a second sum between the absolute value of the first red concentration offset and the absolute value of the first blue concentration offset;
[0137] A saturation correction factor construction unit is used to determine a first quotient based on the second sum and a second preset constant, and to construct the target saturation correction factor based on a second quotient between the target chromaticity deviation and the first quotient.
[0138] In some specific embodiments, the metadata correction module 14 may include:
[0139] A brightness metadata correction unit is used to correct the first average brightness, the first maximum brightness, and the first minimum brightness using the target display brightness correction factor to obtain a second average brightness, a second maximum brightness, and a second minimum brightness, and to determine the second brightness metadata based on the second average brightness, the second maximum brightness, and the second minimum brightness.
[0140] A cubic spline metadata correction unit is used to correct the first cubic spline interval parameter, the first cubic spline interval parameter offset, and the second cubic spline interval parameter offset respectively using the target cubic spline correction factor, so as to obtain the second cubic spline interval parameter, the third cubic spline interval parameter offset, and the fourth cubic spline interval parameter offset, and to determine the second cubic spline metadata based on the second cubic spline interval parameter, the third cubic spline interval parameter offset, and the fourth cubic spline interval parameter offset;
[0141] A saturation metadata correction unit is used to correct the first saturation metadata using the target saturation correction factor to obtain the second saturation metadata.
[0142] The target metadata determination unit is used to determine the target metadata based on the second luminance metadata, the second cubic spline metadata, and the second saturation metadata.
[0143] Furthermore, embodiments of this application also disclose an electronic device, Figure 4 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application. Specifically, the electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the video frame metadata correction method disclosed in any of the foregoing embodiments. Furthermore, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0144] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0145] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0146] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of performing the video frame metadata correction method executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs capable of performing other specific tasks.
[0147] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned video frame metadata correction method. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.
[0148] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0149] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0150] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0151] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0152] The technical solutions provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for correcting video frame metadata, characterized in that, include: The target HDR video is acquired, and the initial video frames of the target HDR video are analyzed based on the HDR Vivid standard to generate initial metadata of the initial video frames. The target HDR video is compressed using a preset video encoder to generate a corresponding compressed bitstream, and the target quantization parameter map of the initial video frame is obtained; the quantization parameter map is used to record the quantization parameters corresponding to the spatial position of each coded block of the initial video frame. Based on the target quantization parameter map, a target display brightness correction factor is constructed, as well as a target cubic spline correction factor and a target saturation correction factor; The initial metadata is corrected using the target display brightness correction factor, the target cubic spline correction factor, and the target saturation correction factor to obtain target metadata. The compressed bitstream and the target metadata are then encapsulated based on the HDR Vivid standard to obtain the target file.
2. The video frame metadata correction method according to claim 1, characterized in that, The analysis of the initial video frames of the target HDR video based on the HDR Vivid standard to generate initial metadata for the initial video frames includes: The initial video frame of the target HDR video is analyzed based on the dynamic metadata generation algorithm corresponding to the HDR Vivid standard to generate the initial metadata of the initial video frame; The initial metadata includes the first brightness metadata, the first cubic spline metadata, and the first saturation metadata of the initial video frame; the first brightness metadata includes the first average brightness, the first maximum brightness, and the first minimum brightness of the displayed content of the initial video frame; and the first cubic spline metadata includes the first cubic spline interval parameters, the first cubic spline interval parameter offset, and the second cubic spline interval parameter offset.
3. The video frame metadata correction method according to claim 2, characterized in that, After compressing the target HDR video using a preset video encoder to generate the corresponding compressed bitstream, the method further includes: Based on the compressed bitstream, determine the target video frame obtained by compressing the initial video frame; The first red density offset and the first blue density offset of the initial video frame are determined, and the second red density offset and the second blue density offset of the target video frame are determined, so as to construct the target saturation correction factor based on the first red density offset, the first blue density offset, the second red density offset and the second blue density offset.
4. The video frame metadata correction method according to claim 3, characterized in that, The construction of the target display brightness correction factor based on the target quantization parameter map includes: The group of frames (GOPs) corresponding to the initial video frames are determined, and the minimum quantization parameter is determined from the quantization parameter graph corresponding to each video frame within the GOP; the GOP consists of several initial video frames of the target HDR video, and the GOP contains the initial video frames. Determine the target scaling factor between the target video frame and the initial video frame, determine the target difference between the target quantization parameter map and the minimum quantization parameter, and determine the target weight based on the product of the target difference and the target scaling factor; The texture complexity map corresponding to the initial video frame is determined, and a first sum value between the texture complexity map and a first preset constant is determined; the texture complexity map is used to record the texture complexity corresponding to the spatial position of each coded block of the initial video frame; The target display brightness correction factor is constructed based on the quotient of the target weight and the first sum.
5. The video frame metadata correction method according to claim 3, characterized in that, The target cubic spline correction factor includes: The target video frame is analyzed based on the dynamic metadata generation algorithm corresponding to the HDR Vivid standard to determine the target average brightness of the target video frame; The target brightness deviation is determined based on the difference between the first average brightness and the target average brightness, and the target cubic spline correction factor is constructed based on the quotient of the target brightness deviation and the first average brightness.
6. The video frame metadata correction method according to claim 3, characterized in that, The construction of the target saturation correction factor based on the first red concentration offset, the first blue concentration offset, the second red concentration offset, and the second blue concentration offset includes: Determine the first absolute value corresponding to the difference between the first red concentration offset and the second red concentration offset, and determine the second absolute value corresponding to the difference between the first blue concentration offset and the second blue concentration offset; The target chromaticity deviation is determined based on the sum of the first absolute value and the second absolute value, and a second sum value is determined between the absolute value of the first red concentration offset and the absolute value of the first blue concentration offset. The first quotient is determined based on the second sum and the second preset constant, and the target saturation correction factor is constructed based on the second quotient between the target chromaticity deviation and the first quotient.
7. The video frame metadata correction method according to any one of claims 2 to 6, characterized in that, The process of correcting the initial metadata using the target display brightness correction factor, the target cubic spline correction factor, and the target saturation correction factor to obtain target metadata includes: The first average brightness, the first maximum brightness, and the first minimum brightness are corrected using the target display brightness correction factor to obtain the second average brightness, the second maximum brightness, and the second minimum brightness, and the second brightness metadata is determined based on the second average brightness, the second maximum brightness, and the second minimum brightness. The first cubic spline interval parameter, the first cubic spline interval parameter offset, and the second cubic spline interval parameter offset are corrected respectively using the target cubic spline correction factor to obtain the second cubic spline interval parameter, the third cubic spline interval parameter offset, and the fourth cubic spline interval parameter offset. The second cubic spline metadata is then determined based on the second cubic spline interval parameter, the third cubic spline interval parameter offset, and the fourth cubic spline interval parameter offset. The first saturation metadata is corrected using the target saturation correction factor to obtain the second saturation metadata; The target metadata is determined based on the second luminance metadata, the second cubic spline metadata, and the second saturation metadata.
8. A video frame metadata correction device, characterized in that, include: The metadata generation module is used to acquire the target HDR video and analyze the initial video frames of the target HDR video based on the HDR Vivid standard to generate the initial metadata of the initial video frames. The video compression module is used to compress the target HDR video using a preset video encoder to generate a corresponding compressed bitstream, and to obtain the target quantization parameter map of the initial video frame; the quantization parameter map is used to record the quantization parameters corresponding to the spatial position of each coded block of the initial video frame. The correction factor construction module is used to construct a target display brightness correction factor based on the target quantization parameter map, and to construct a target cubic spline correction factor and a target saturation correction factor; The metadata correction module is used to correct the initial metadata using the target display brightness correction factor, the target cubic spline correction factor, and the target saturation correction factor to obtain target metadata, and to encapsulate the compressed bitstream and the target metadata based on the HDRVivid standard to obtain the target file.
9. An electronic device, characterized in that, The electronic device includes a processor and a memory; wherein the memory is used to store a computer program, which is loaded and executed by the processor to implement the video frame metadata correction method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, Used to store a computer program, which, when executed by a processor, implements the video frame metadata correction method as described in any one of claims 1 to 7.