Video processing method, device and equipment
By calculating the macroblock weight factor of each frame's brightness in the video stream and adaptively adjusting, the problem of flickering or jumping in video preprocessing is solved, and smooth video playback is achieved.
Patent Information
- Application Number
- CN202111144320.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-28
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2041-09-28
AI Technical Summary
When the HDR format of the display device and the input video stream do not match, the flicker or jump problems caused by video preprocessing in the prior art cannot be effectively solved.
Reduce flicker or jump by obtaining macroblock weighting factors for each frame in the video stream frame sequence and brightness adjustments based on these weighting factors, including adaptive gamma transformation and tone-mapping mapping.
Effectively reduces flicker or jump during video preprocessing, ensuring smooth playback of video.
Smart Images

Figure CN113891081B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of video processing, and in particular to a video processing method, device and equipment. Background Art
[0002] HDR (High Dynamic Range) has multiple standard formats, and the display devices that support it also vary. When the HDR format of the display device and the input video stream do not match, adaptation is required through pre-processing or post-processing in the content production or player.
[0003] In the prior art, pre-processing is performed on a single frame basis. When the scene is not smooth, the brightness of the video stream may flicker or jump. Summary of the Invention
[0004] In view of the above problems, embodiments of the present invention are proposed to provide a video processing method, apparatus, and device that overcome the above problems or at least partially solve the above problems.
[0005] According to one aspect of an embodiment of the present invention, a video processing method is provided, including:
[0006] Obtaining a weight factor of a macroblock for adjusting the brightness of each frame in a frame sequence of a video stream in a current scene; the frame includes a plurality of macroblocks;
[0007] Brightness adjustment is performed on each frame in the frame sequence according to the weight factor of the macroblock.
[0008] According to another aspect of an embodiment of the present invention, there is provided a video processing apparatus, comprising:
[0009] An acquisition module, configured to obtain a weight factor of a macroblock for adjusting the brightness of each frame in a frame sequence of a video stream in a current scene; the frame includes a plurality of macroblocks;
[0010] A processing module is used to adjust the brightness of each frame in the frame sequence according to the weight factor of the macroblock.
[0011] According to another aspect of an embodiment of the present invention, there is provided a computing device, comprising: a processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other via the communication bus;
[0012] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute operations corresponding to the above-mentioned video processing method.
[0013] According to another aspect of the embodiments of the present invention, a computer storage medium is provided, wherein the storage medium stores at least one executable instruction, and the executable instruction enables a processor to perform operations corresponding to the above-mentioned video processing method.
[0014] According to the solution provided by the above-mentioned embodiment of the present invention, a weight factor of a macroblock is obtained for adjusting the brightness of each frame in a frame sequence of a video stream in a current scene; the frame includes multiple macroblocks; the brightness of each frame in the frame sequence is adjusted according to the weight factor of the macroblock; the flickering or jumping generated by the preprocessing process of the video content transcoding can be reduced, thereby solving the problem of flickering or jumping generated by the video preprocessing process in the prior art and achieving better beneficial effects.
[0015] The above description is only an overview of the technical solutions of the embodiments of the present invention. In order to more clearly understand the technical means of the embodiments of the present invention, they can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the embodiments of the present invention more obvious and easy to understand, the specific implementation methods of the embodiments of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Various other advantages and benefits will become apparent to those skilled in the art upon reading the detailed description of the preferred embodiment below. The accompanying drawings are for illustration purposes only and are not to be considered as limiting the embodiments of the present invention. The same reference numerals are used throughout the accompanying drawings to denote the same components. In the accompanying drawings:
[0017] Figure 1 A flowchart of a video processing method provided by an embodiment of the present invention is shown;
[0018] Figure 2 A schematic flow chart showing a preprocessing process in a video processing method provided by another embodiment of the present invention is shown;
[0019] Figure 3 A schematic diagram showing the overall flow of a video processing method provided by another embodiment of the present invention is shown;
[0020] Figure 4 A schematic structural diagram of a video processing device provided by an embodiment of the present invention is shown;
[0021] Figure 5 A schematic structural diagram of a computing device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0022] Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present invention and to fully convey the scope of the present invention to those skilled in the art.
[0023] Figure 1 FIG. 1 is a flow chart of a video processing method provided by an embodiment of the present invention. Figure 1 As shown, the method includes the following steps:
[0024] Step 11, obtaining a weight factor of a macroblock for adjusting the brightness of each frame in a frame sequence of a video stream in a current scene; the frame includes a plurality of macroblocks;
[0025] Step 12: Adjust the brightness of each frame in the frame sequence according to the weight factor of the macroblock.
[0026] In this embodiment, if the total number of frames included in the current scene is less than or equal to the preset upper limit, the frame sequence corresponding to the current scene includes every frame of the current scene;
[0027] If the total number of frames included in the current scene is greater than the preset upper limit, the current scene corresponds to multiple frame sequences, and the number of frames included in each frame sequence is less than or equal to the preset upper limit;
[0028] Here, in one implementation example, input frames of the video stream are cached in the current scene, and the total number of frames of the input frames of the video stream in the cache is counted. If the total number of frames is less than or equal to a preset upper limit, then the frame sequence corresponding to the current scene includes all frames accumulated in the cache, that is, every frame of the current scene;
[0029] If the total number of frames of the input frames of the video stream in the buffer is greater than the preset upper limit, the number of frames of the current preset upper limit is taken as a frame sequence, the buffer is cleared, and the frame number accumulation judgment of the next frame sequence is continued until the current accumulated number of frames in the buffer is less than or equal to the preset upper limit. In this way, the current scene contains multiple frame sequences, the number of frames of each frame sequence is the preset upper limit value, and the number of frames of the last frame sequence is less than or equal to the preset upper limit value;
[0030] In this embodiment, by accumulating and counting the number of input frames in the current scene and dividing the accumulated frames in the current scene into frame sequences based on a preset upper limit, scene switching can be more accurately determined. Furthermore, by obtaining a macroblock weight factor for adjusting the brightness of each frame in the frame sequence of the video stream in the current scene, and adjusting the brightness of each frame in the frame sequence based on the macroblock weight factor, the flicker or jump generated during the pre-processing of video content transcoding can be reduced or even eliminated, ensuring smooth playback of the video stream.
[0031] In the above embodiment, whether the scene is switched is determined by the following process:
[0032] Obtaining a standard deviation between macroblocks corresponding to two adjacent frames of the video stream;
[0033] If the standard deviation is greater than a set threshold, a scene switch is determined.
[0034] Specifically: the current frame and the previous frame are divided according to a fixed macroblock size, and a standard deviation between corresponding macroblocks of the current frame and the previous frame is calculated; when the standard deviation is greater than a set threshold, it is determined that a scene switch has occurred.
[0035] In an optional embodiment of the present invention, obtaining a weight factor of a macroblock for adjusting the brightness of each frame in a frame sequence of a video stream in a current scene includes:
[0036] According to the brightness variance of the macroblocks of all frames in the frame sequence, the chromaticity variance of the macroblocks, the maximum brightness area of the frame, and the maximum chromaticity area of the frame, a weight factor of the macroblock for adjusting the brightness of each frame in the frame sequence of the video stream in the current scene is obtained.
[0037] In specific implementation, this step may include:
[0038] Step 111, obtaining a histogram of luminance and chrominance of all macroblocks in each frame in a frame sequence when a scene is switched;
[0039] Step 112: Calculate the mean luminance and mean chrominance of the macroblock according to the histogram;
[0040] Step 113, calculating the brightness variance of the macroblock and the maximum brightness area of the frame where the macroblock is located based on the brightness mean;
[0041] Step 114, calculating the chroma variance of the macroblock and the maximum chroma area of the frame where the macroblock is located based on the chroma mean;
[0042] Step 115, obtaining a weight factor of a macroblock for adjusting the brightness of each frame in the frame sequence of the video stream in the current scene based on the brightness variance of the macroblocks of all frames in the frame sequence, the chrominance variance of the macroblocks, the maximum brightness area of the frame, and the maximum chrominance area of the frame.
[0043] Specifically, according to the following formula:
[0044]
[0045] Obtaining a weight factor of a macroblock for adjusting the brightness of each frame in a frame sequence of a video stream in a current scene;
[0046] Among them, λ k [j] is the weight factor of the current macroblock, j is the macroblock number of the current macroblock in a frame, k is the sequence number of the frame sequence in the current scene, i is the frame number of the frame in the frame sequence, N is the total number of frames in the frame sequence, σ Lkij is the brightness variance of the current macroblock, σ Ckij is the variance of the chrominance of the current macroblock, H Lkij is the statistical value of the maximum brightness area of the frame where the macroblock is located, H Ckij is the statistical value of the maximum chroma area of the frame where the macroblock is located, is a weight value greater than 0.5 and less than 1, α and β are constant values ranging from 0 to 1, and ε is a weight value less than 0.5.
[0047] is a weight value greater than 0.5 and less than 1, that is, the weight of brightness is greater than that of chroma, because the human eye is more sensitive to brightness information. α and β are constant values ranging from 0 to 1, and ε is a weight value less than 0.5. In this formula, when the variance and highlight, high chroma values are large, the adjustment weight is small. Conversely, when the variance and highlight, high chroma values are small, the adjustment weight is large. Unlike the calculation of single-frame evaluation indicators, this formula integrates information from multiple frames, including information such as the degree of change and significant characteristics. In subsequent processing, when adjusting through this weight factor, the fusion information of multiple nearby frames is referred to, making the adjustment more precise and accurate.
[0048] In an optional embodiment of the present invention, performing brightness adjustment on each frame in the frame sequence according to the weight factor of the macroblock includes:
[0049] Step 121, performing adaptive gamma transform processing on the frame where the macroblock is located according to the weight factor of the macroblock to obtain a first processing result;
[0050] Specifically, the formula can be used: Performing adaptive gamma transform processing on the current frame to obtain a first processing result;
[0051] Among them, Y jp is the first processing result, j is the number of the current macroblock in a frame, p is the pixel index in the macroblock, λ k [j] is the weight factor of the macroblock, X jp is the pixel to be processed;
[0052] γ1 is a preset transformation exponent greater than 1, which is used to enhance the details of brighter areas;
[0053] γ2 is a preset transformation exponent smaller than 1, which is used to enhance the details of darker areas.
[0054] When the brightness of the frame sequence is high and the variation is large, λ k The smaller the value of [j], the greater the weight of γ2 adjustment is, which enhances the details of darker areas.
[0055] Step 122: Adjust the brightness of each frame in the frame sequence according to the first processing result.
[0056] In this embodiment, adaptive gamma transformation processing is performed on the frame where the macroblock is located according to the weight factor of the macroblock. During adaptive adjustment, the position of the macroblock can be specifically adjusted in units of macroblocks, thereby achieving fine-grained adjustment of the brightness of the video stream.
[0057] In a specific implementation of the above-mentioned embodiment of the present invention, the input frames are first cached, the number of frames is accumulated and the scene switching detection is performed. When the number of frames accumulated in the frame sequence during the scene switching reaches a preset upper limit or the current frame is judged to be a scene switching, the value of the weight factor is cleared and the calculation is restarted; when the number of frames in the frame sequence is less than or equal to the preset upper limit and the current frame is not the last frame in the frame sequence, the brightness and chromaticity information statistics and weight factor calculation are performed.
[0058] In the step of calculating the weight factor for adjusting the brightness of the video stream, the frame is divided into macroblocks, the brightness and chromaticity histograms of all macroblocks in the current frame are counted, the brightness mean and chromaticity mean of the macroblocks, as well as the brightness variance and chromaticity variance of the macroblocks are calculated and saved;
[0059] Furthermore, the maximum area of brightness and chromaticity of the current frame is calculated by comparing the size of the pixels in the current macroblock with the overall mean, counting the number of pixels greater than the mean, and then recording and saving the value; here, the maximum value information saved by the macroblock can reflect the location information of the maximum area. When making adaptive adjustments later, the location of the macroblock can be specifically determined, and adjustments can be made in units of macroblocks, thereby realizing fine-grained adjustment of the brightness of the video stream.
[0060] The method of this embodiment is applied to the pre-processing adaptation process of content transcoding processing, such as Figure 2As shown, the pre-processing adaptation process of content transcoding includes: inputting a nonlinear signal (video stream), converting the input nonlinear signal through EOTF (Electro-Optical Transfer Function) to obtain linear light; the linear light is further converted through transmission curve conversion to obtain linear light, and the linear light is further converted through OETF (Oto-Electro-Optical Transfer Function) to output a nonlinear signal;
[0061] In this embodiment, after a nonlinear signal (video stream) is input and before EOTF processing, a weight factor of a macroblock of the current frame in a frame sequence at the time of scene switching is added, and an adaptive gamma transform is performed on the current frame. After the adaptive gamma transform, the gamma-transformed value is transformed into linear light using an EOTF function corresponding to the input source HDR (high dynamic range image) standard. When the maximum brightness of the input source is greater than that of the display device, brightness mapping is performed through adaptive tone-mapping. Finally, the linear light is converted into a nonlinear signal output using an OETF function corresponding to the HDR standard of the display device.
[0062] Furthermore, in step 122, adjusting the brightness of each frame in the frame sequence according to the first processing result may include:
[0063] If the maximum brightness of the current frame in the frame sequence is higher than the brightness of the output display device, the brightness of the current frame is adjusted according to the first processing result and the weight factor of the macroblock.
[0064] Here, when the maximum brightness (L_in) of the current frame of the video stream is higher than the brightness (L_out) of the output display device, tone-mapping mapping is required.
[0065] In this embodiment, the mapping method is improved by adding an adaptive adjustment factor, which is a weight factor of the macroblock;
[0066] Specifically, the formula can be used: performing brightness adjustment on each frame in the frame sequence;
[0067] Among them, Y ji is the adjustment value, j is the number of the current macroblock in a frame, p is the pixel index in the macroblock, λ k [j] is the weight factor of the macroblock, X jp is the pixel to be processed; A, B, C, D, E are constant values.
[0068] Specifically, A, B, C, D, and E are the constant values of the S curve of the tone-mapping algorithm. jiThe macroblock weight of the macroblock is added for adjustment. When the macroblock is bright and colorful or has a large change, the weight is small, otherwise, the weight is large.
[0069] In this embodiment, the adaptive gamma adjustment can reduce the flicker or jump introduced by the pre-processing during the HDR video adaptation process, or even eliminate the flicker or jump, thereby ensuring smooth playback of the video stream.
[0070] like Figure 3 FIG. 4 shows the overall process of the video processing method described in the above embodiment, including:
[0071] The analysis process 31 includes: converting the input video stream in YUV (brightness, chroma, and density image encoding) format into RGB (red, green, and blue) stream;
[0072] Cache input frames, accumulate frames and detect scene changes;
[0073] When the number of frames reaches the preset upper limit or the current frame is judged to be a scene switch, the value of the weight factor is reset to zero and the calculation starts again;
[0074] When the number of frames in the frame sequence of the video stream during scene switching is less than or equal to a preset upper limit and the current frame is not the last frame in the frame sequence, performing luminance and chrominance information statistics and weight factor calculation;
[0075] Count the brightness and chromaticity information of all macroblocks in the frame sequence and calculate the maximum area of brightness and chromaticity of the frame;
[0076] Calculating a weight factor of a macroblock of a current frame for adjusting brightness of each frame of a frame sequence of a current scene of the video stream;
[0077] The processing step 32 includes: performing adaptive gamma transformation on the current frame according to the weight factor of the macroblock; performing EOTF conversion;
[0078] If the maximum brightness of the current frame (L_in) is higher than the brightness of the output display device (L_out), the brightness of the current frame is adjusted (i.e., weighted Tone_mapping) according to the weight factor of the current macroblock, and OETF conversion is performed; otherwise, OETF conversion is performed directly;
[0079] Convert YUV from RGB and output non-linear signal.
[0080] In this embodiment, adaptive gamma transformation is performed on the current frame based on the weighting factor. When the maximum brightness of the input source exceeds the brightness of the output display device, tone-mapping is required. During mapping, an adaptive adjustment factor is added. This adjustment factor is also adjusted within each macroblock, referencing the adjustment weights calculated by the analysis module. This can reduce or even eliminate flicker or jumps caused by the HDR video preprocessing process, ensuring smooth playback of the video stream.
[0081] Figure 4 FIG. 4 is a schematic diagram showing the structure of a video processing device 40 provided in an embodiment of the present invention. Figure 4 As shown, the device 40 includes:
[0082] An acquisition module 41 is configured to obtain a weight factor of a macroblock for adjusting the brightness of each frame in a frame sequence of a video stream in a current scene; the frame includes a plurality of macroblocks;
[0083] The processing module 42 is configured to adjust the brightness of each frame in the frame sequence according to the weight factor of the macroblock.
[0084] Optionally, if the total number of frames included in the current scene is less than or equal to a preset upper limit, the frame sequence corresponding to the current scene includes every frame of the current scene;
[0085] If the total number of frames included in the current scene is greater than the preset upper limit, the current scene corresponds to multiple frame sequences, and the number of frames included in each frame sequence is less than or equal to the preset upper limit.
[0086] Optionally, whether the scene is switched is determined by the following process:
[0087] Obtaining a standard deviation between macroblocks corresponding to two adjacent frames of the video stream;
[0088] If the standard deviation is greater than a set threshold, a scene switch is determined.
[0089] Optionally, obtaining a weight factor of a macroblock for adjusting the brightness of each frame in a frame sequence of a video stream in a current scene includes:
[0090] According to the brightness variance of the macroblocks of all frames in the frame sequence, the chromaticity variance of the macroblocks, the maximum brightness area of the frame, and the maximum chromaticity area of the frame, a weight factor of the macroblock for adjusting the brightness of each frame in the frame sequence of the video stream in the current scene is obtained.
[0091] Optionally, obtaining a weight factor for adjusting the brightness of each frame in the frame sequence of the video stream in the current scene based on the brightness variance of the macroblocks of all frames in the frame sequence, the chrominance variance of the macroblocks, the maximum brightness area of the frame, and the maximum chrominance area of the frame includes:
[0092] According to the following formula:
[0093]
[0094] Obtaining a weight factor of a macroblock for adjusting the brightness of each frame in a frame sequence of a video stream in a current scene;
[0095] Among them, λ k [j] is the weight factor of the current macroblock, j is the macroblock number of the current macroblock in a frame, k is the sequence number of the frame sequence in the current scene, i is the frame number of the frame in the frame sequence, N is the total number of frames in the frame sequence, σ Lkij is the brightness variance of the current macroblock, σ Ckij is the variance of the chrominance of the current macroblock, H Lkij is the statistical value of the maximum brightness area of the frame where the macroblock is located, H Ckij is the statistical value of the maximum chroma area of the frame where the macroblock is located, is a weight value greater than 0.5 and less than 1, α and β are constant values ranging from 0 to 1, and ε is a weight value less than 0.5.
[0096] Optionally, performing brightness adjustment on each frame in the frame sequence according to the weight factor of the macroblock includes:
[0097] performing adaptive gamma transform processing on the frame where the macroblock is located according to the weight factor of the macroblock to obtain a first processing result;
[0098] According to the first processing result, brightness adjustment is performed on each frame in the frame sequence.
[0099] Optionally, performing adaptive gamma transform processing on the frame where the macroblock is located according to the weight factor of the macroblock to obtain a first processing result includes:
[0100] By formula: Performing adaptive gamma transform processing on the frame where the macroblock is located to obtain a first processing result;
[0101] Among them, y jp is the first processing result, j is the number of the current macroblock in the frame, p is the pixel index in the macroblock, λ k [j] is the weight factor of the macroblock, X jp is the pixel to be processed;
[0102] γ1 is a preset transformation exponent greater than 1, which is used to enhance the details of brighter areas;
[0103] γ2 is a preset transformation exponent smaller than 1, which is used to enhance the details of darker areas.
[0104] It should be noted that the device is a device corresponding to the above method, and all implementation methods in the above method embodiments are applicable to the embodiments of the device and can achieve the same technical effects.
[0105] An embodiment of the present invention provides a non-volatile computer storage medium, wherein the computer storage medium stores at least one executable instruction, and the computer executable instruction can execute the video processing method in any of the above method embodiments.
[0106] Figure 5 The schematic diagram of the structure of the computing device provided by the embodiment of the present invention is shown. The specific embodiment of the present invention does not limit the specific implementation of the computing device.
[0107] like Figure 5 As shown, the computing device may include: a processor, a communication interface, a memory, and a communication bus.
[0108] The processor, communication interface, and memory communicate with each other via a communication bus. The communication interface is used to communicate with other devices, such as client devices or other server network elements. The processor is used to execute programs, specifically, the steps described in the aforementioned embodiment of the video processing method for a computing device.
[0109] Specifically, the program may include program codes including computer operation instructions.
[0110] The processor may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention. The one or more processors included in the computing device may be processors of the same type, such as one or more CPUs, or processors of different types, such as one or more CPUs and one or more ASICs.
[0111] Memory is used to store programs. The memory may include high-speed RAM memory, and may also include non-volatile memory (non-volatile memory), such as at least one disk storage.
[0112] The program can be specifically used to cause the processor to execute the video processing method in any of the above-mentioned method embodiments. The specific implementation of each step in the program can refer to the corresponding description of the corresponding steps and units in the above-mentioned video processing method embodiments, and will not be repeated here. Those skilled in the art will clearly understand that for the convenience and brevity of description, the specific working process of the above-mentioned devices and modules can refer to the corresponding process description in the above-mentioned method embodiments, and will not be repeated here.
[0113] The algorithm or display provided herein is not inherently related to any particular computer, virtual system or other device. Various general-purpose systems can also be used together with the teachings based on this. According to the above description, it is obvious that the structure required for constructing such systems. In addition, the embodiment of the present invention is not directed to any specific programming language. It should be understood that various programming languages can be utilized to implement the content of the embodiment of the present invention described herein, and the above description of specific languages is for the purpose of disclosing the best mode of implementation of the embodiment of the present invention.
[0114] In the description provided herein, numerous specific details are described. However, it is understood that embodiments of the present invention may be practiced without these specific details. In some instances, well-known methods, structures, and techniques are not shown in detail so as not to obscure the understanding of this description.
[0115] Similarly, it should be understood that in order to streamline the embodiments of the invention and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the invention, various features of the embodiments of the invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed approach should not be interpreted as reflecting an intention that the claimed embodiments of the invention require more features than are expressly recited in each claim. Rather, as reflected in the claims below, inventive aspects lie in less than all of the features of the individual embodiments disclosed above. Accordingly, the claims that follow the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of the invention.
[0116] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition may be divided into multiple submodules or subunits or subcomponents. All features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed herein may be combined in any combination, except that at least some of such features and / or processes or units are mutually exclusive. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.
[0117] Furthermore, those skilled in the art will appreciate that although some embodiments herein include certain features included in other embodiments but not other features, combinations of features from different embodiments are intended to be within the scope of the present invention and to form different embodiments. For example, in the claims below, any of the claimed embodiments may be used in any combination.
[0118] The various component embodiments of the present invention can be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or digital signal processor (DSP) can be used in practice to implement some or all of the functions of some or all of the components according to the embodiments of the present invention. The embodiments of the present invention can also be implemented as a device or apparatus program (e.g., a computer program and a computer program product) for executing part or all of the methods described herein. Such a program implementing an embodiment of the present invention can be stored on a computer-readable medium, or can have the form of one or more signals. Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.
[0119] It should be noted that the above embodiments illustrate rather than limit the embodiments of the invention, and that a person skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between brackets should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The embodiments of the invention may be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third etc. does not indicate any order. These words may be interpreted as names. The steps in the above embodiments should not be understood as limiting the order of execution unless otherwise specified.
Claims
1. A video processing method, characterized in that: include: Obtaining a weight factor of a macroblock for adjusting the brightness of each frame in a frame sequence of a video stream in a current scene; The frame includes a plurality of macroblocks; performing brightness adjustment on each frame in the frame sequence according to the weight factor of the macroblock; The step of obtaining a weight factor of a macroblock for adjusting the brightness of each frame in a frame sequence of a video stream in a current scene includes: According to the luminance variance of the macroblocks of all frames in the frame sequence, the chrominance variance of the macroblocks, the maximum luminance area of the frame, and the maximum chrominance area of the frame, a weight factor of the macroblock for adjusting the brightness of each frame in the frame sequence of the video stream in the current scene is obtained.
2. The video processing method according to claim 1, wherein: If the total number of frames included in the current scene is less than or equal to the preset upper limit, the frame sequence corresponding to the current scene includes every frame of the current scene; If the total number of frames included in the current scene is greater than the preset upper limit, the current scene corresponds to multiple frame sequences, and the number of frames included in each frame sequence is less than or equal to the preset upper limit.
3. The video processing method according to claim 2, wherein: Whether the scene switches is determined by the following process: Obtaining a standard deviation between macroblocks corresponding to two adjacent frames of the video stream; If the standard deviation is greater than a set threshold, a scene switch is determined.
4. The video processing method according to claim 1, wherein: Obtaining a weight factor for adjusting the brightness of each frame in the frame sequence of the video stream in the current scene according to the brightness variance of the macroblocks of all frames in the frame sequence, the chrominance variance of the macroblocks, the maximum brightness area of the frame, and the maximum chrominance area of the frame, including: According to the following formula: Obtaining a weight factor of a macroblock for adjusting the brightness of each frame in a frame sequence of a video stream in a current scene; Among them, λ k [j] is the weight factor of the current macroblock, j is the macroblock number of the current macroblock in a frame, k is the sequence number of the frame sequence in the current scene, i is the frame number of the frame in the frame sequence, N is the total number of frames in the frame sequence, σ Lkij is the brightness variance of the current macroblock, σ Ckij is the variance of the chrominance of the current macroblock, H Lkij is the statistical value of the maximum brightness area of the frame where the macroblock is located, H Ckij is the statistical value of the maximum chroma area of the frame where the macroblock is located, is a weight value greater than 0.5 and less than 1, α and β are constant values ranging from 0 to 1, ε is a weight value less than 0.5, the maximum chrominance area of the frame where the macroblock is located is calculated based on the chrominance mean, where the chrominance mean is calculated based on the chrominance histogram, the maximum luminance area of the frame where the macroblock is located is calculated based on the luminance mean, where the luminance mean is calculated based on the luminance histogram.
5. The video processing method according to claim 4, wherein: Performing brightness adjustment on each frame in the frame sequence according to the weight factor of the macroblock, comprising: performing adaptive gamma transform processing on the frame where the macroblock is located according to the weight factor of the macroblock to obtain a first processing result; According to the first processing result, brightness adjustment is performed on each frame in the frame sequence.
6. The video processing method according to claim 4, wherein: Performing adaptive gamma transform processing on the frame where the macroblock is located according to the weight factor of the macroblock to obtain a first processing result, including: By formula: Performing adaptive gamma transform processing on the frame where the macroblock is located to obtain a first processing result; Among them, Y jp is the first processing result, j is the number of the current macroblock in the frame, p is the pixel index in the macroblock, λ k [j] is the weight factor of the macroblock, X jp is the pixel to be processed; γ1 is a preset transformation exponent greater than 1, which is used to enhance the details of brighter areas; γ2 is a preset transformation exponent smaller than 1, which is used to enhance the details of darker areas.
7. A video processing device, characterized in that: include: An acquisition module, configured to obtain a weight factor of a macroblock for adjusting the brightness of each frame in a frame sequence of a video stream in a current scene; The frame includes a plurality of macroblocks; a processing module, configured to adjust the brightness of each frame in the frame sequence according to the weight factor of the macroblock; The step of obtaining a weight factor of a macroblock for adjusting the brightness of each frame in a frame sequence of a video stream in a current scene includes: According to the luminance variance of the macroblocks of all frames in the frame sequence, the chrominance variance of the macroblocks, the maximum luminance area of the frame, and the maximum chrominance area of the frame, a weight factor of the macroblock for adjusting the brightness of each frame in the frame sequence of the video stream in the current scene is obtained.
8. A computing device comprising: A processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, where the executable instruction enables the processor to execute an operation corresponding to the video processing method according to any one of claims 1 to 6.
9. A computer storage medium, wherein at least one executable instruction is stored in the storage medium, and wherein the executable instruction enables a processor to execute an operation corresponding to the video processing method according to any one of claims 1 to 6.
Citation Information
Patent Citations
An integrated circuit having a circuit for and method of providing intensity correction for a video
CN102317970A
Enhancement processing method and device for video image and electronic equipment
CN112884683A