Video decoding method and device, video coding method and device, electronic equipment and medium
By adaptively adjusting the macroblock tree strength and quantization parameters, the problem of inflexible quantization parameters caused by fixed macroblock tree strength in the prior art is solved, and the video encoding and decoding performance is improved.
Patent Information
- Application Number
- CN202410321250.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-19
- Publication Date
- 2025-09-19
AI Technical Summary
In existing video compression standards, the macroblock tree strength is a fixed value, resulting in inflexible adjustment of quantization parameters and an inability to adapt to the texture complexity and motion amplitude of different video frames, which affects video encoding and decoding performance.
According to the texture complexity and motion amplitude of the current video frame, the macroblock tree strength is adaptively adjusted, and the quantization parameter is determined based on the adjusted macroblock tree strength to achieve macroblock encoding and decoding.
The flexibility and personalization of quantization parameters are improved, and video encoding and decoding performance is enhanced.
Smart Images

Figure CN120676150A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of video coding and decoding technology, and in particular to a video decoding method, a video encoding method, a video decoding device, a video encoding device, an electronic device, and a computer-readable storage medium. Background Art
[0002] In existing video compression standards, the macroblock tree (MB tree) is a rate control method. This method estimates the importance of each macroblock and the strength of the macroblock tree, adjusting the quantization parameter (QP) of each macroblock to achieve rate control, thereby adjusting the number of encoding bits for each macroblock. In related art, the aforementioned macroblock tree strength is a fixed value. Summary of the Invention
[0003] The present application provides a video decoding method, a video encoding method, a video decoding device, a video encoding device, an electronic device, and a computer-readable storage medium, which can adaptively adjust the macroblock tree strength corresponding to the current video frame according to the texture complexity and motion amplitude of the current video frame, thereby facilitating the improvement of video encoding and decoding performance.
[0004] In a first aspect, the present application provides a video encoding method, which includes: determining an adjusted macroblock tree strength corresponding to the current video frame based on the texture complexity and motion amplitude of the current video frame; determining an adjusted quantization parameter of a first macroblock in the current video frame based on the adjusted macroblock tree strength corresponding to the current video frame, wherein the first macroblock is any macroblock in the current video frame; and encoding the first macroblock based on the adjusted quantization parameter corresponding to the first macroblock.
[0005] In one implementation, based on the aforementioned scheme, the above-mentioned determination of the adjusted macroblock tree strength corresponding to the current video frame according to the texture complexity and motion amplitude of the current video frame includes: determining a first increase when the motion amplitude of the current video frame is less than a first amplitude threshold and the texture complexity of the current video frame is less than the first complexity threshold; and determining the adjusted macroblock tree strength corresponding to the current video frame according to the original macroblock tree strength and the above-mentioned first increase.
[0006] In one implementation, based on the aforementioned scheme, when the motion amplitude of the current video frame is less than the first amplitude threshold and the texture complexity of the current video frame is less than the first complexity threshold, determining the first increase amount includes: when the motion amplitude of the current video frame is less than the first amplitude threshold and the texture complexity of the current video frame is less than the first complexity threshold, determining the first increase amount according to at least one of the texture complexity and the motion amplitude of the current video frame.
[0007] In one implementation, based on the aforementioned scheme, the first increase amount is determined according to at least one of the texture complexity and motion amplitude of the current video frame, including: determining whether the texture complexity of the current video frame is less than a second complexity threshold, wherein the second complexity threshold is less than the first complexity threshold; in the case that the texture complexity of the current video frame is less than the second complexity threshold, determining the first positive value as the first increase amount; or, in the case that the texture complexity of the current video frame is greater than or equal to the second complexity threshold, determining the second positive value as the first increase amount, wherein the first positive value is greater than the second positive value.
[0008] In one implementation, based on the above-mentioned scheme, the determining of the first increase amount according to at least one of the texture complexity and the motion amplitude of the current video frame includes: determining whether the motion amplitude of the current video frame is less than a second amplitude threshold and whether the texture complexity of the current video frame is less than a third complexity threshold, wherein the second amplitude threshold is less than the first amplitude threshold, and the third complexity threshold is less than the first complexity threshold; if the motion amplitude of the current video frame is less than the second amplitude threshold and the texture complexity of the current video frame is less than the third complexity threshold, determining whether the texture complexity of the current video frame is less than a fourth complexity threshold, wherein the fourth complexity threshold is less than the third complexity threshold; if the texture complexity of the current video frame is less than the fourth complexity threshold, determining a third positive value as the first increase amount; or, if the texture complexity of the current video frame is greater than or equal to the fourth complexity threshold, determining a fourth positive value as the first increase amount, wherein the third positive value is greater than the fourth positive value;
[0009] When the motion amplitude of the current video frame is greater than or equal to the second amplitude threshold, or the texture complexity of the current video frame is greater than or equal to the third complexity threshold, determine whether the texture complexity of the current video frame is less than the fifth complexity threshold, wherein the fifth complexity threshold is less than the first complexity threshold and greater than the third complexity threshold; when the texture complexity of the current video frame is less than the fifth complexity threshold, determine the fifth positive value as the first increase, wherein the fifth positive value is less than or equal to the fourth positive value; or, when the texture complexity of the current video frame is greater than or equal to the fifth complexity threshold, determine the sixth positive value as the first increase, wherein the fifth positive value is greater than the sixth positive value.
[0010] In one implementation, based on the above-mentioned scheme, when the motion amplitude of the above-mentioned current video frame is less than the first amplitude threshold and the texture complexity of the above-mentioned current video frame is less than the first complexity threshold, the first increase amount is determined, including: when the motion amplitude of the above-mentioned current video frame is less than the first amplitude threshold and the texture complexity of the above-mentioned current video frame is less than the first complexity threshold, the seventh positive value is determined as the first increase amount.
[0011] In one implementation, based on the aforementioned scheme, determining the adjusted macroblock tree strength corresponding to the current video frame based on the texture complexity and motion amplitude of the current video frame includes: determining a first reduction amount in at least one of the following circumstances: the motion amplitude of the current video frame is greater than or equal to a first amplitude threshold, and the texture complexity of the current video frame is greater than or equal to a first complexity threshold; and determining the adjusted macroblock tree strength corresponding to the current video frame based on the original macroblock tree strength and the above-mentioned first reduction amount.
[0012] In one implementation, based on the aforementioned scheme, the first reduction amount is determined in at least one case that the motion amplitude of the current video frame is greater than or equal to the first amplitude threshold, and the texture complexity of the current video frame is greater than or equal to the first complexity threshold, including: in at least one case that the motion amplitude of the current video frame is greater than or equal to the first amplitude threshold, and the texture complexity of the current video frame is greater than or equal to the first complexity threshold, the first reduction amount is determined at least based on the texture complexity of the current video frame.
[0013] In one implementation, based on the aforementioned scheme, the first reduction amount is determined at least based on the texture complexity of the current video frame, including: determining whether the texture complexity of the current video frame is greater than a sixth complexity threshold, wherein the sixth complexity threshold is greater than the first complexity threshold; in the case that the texture complexity of the current video frame is greater than the sixth complexity threshold, determining an eighth positive value as the first reduction amount, wherein the eighth positive value is less than the original macroblock tree strength; and, in the case that the texture complexity of the current video frame is less than or equal to the sixth complexity threshold, determining a zero value as the first reduction amount.
[0014] In one implementation, based on the aforementioned solution, the determining of the first reduction amount based at least on the texture complexity of the current video frame includes: determining whether the texture complexity of the current video frame is greater than a sixth complexity threshold, wherein the sixth complexity threshold is greater than the first complexity threshold; if the texture complexity of the current video frame is greater than the sixth complexity threshold, determining whether the motion amplitude of the current video frame is less than a third amplitude threshold; if the motion amplitude of the current video frame is less than the third amplitude threshold, determining a ninth positive value as the first reduction amount; or, if the motion amplitude of the current video frame is greater than or equal to the third amplitude threshold, determining a tenth positive value as the first reduction amount, wherein the tenth positive value is greater than the ninth positive value;
[0015] When the texture complexity of the current video frame is less than the sixth complexity threshold, determine whether the texture complexity of the current video frame is greater than the seventh complexity threshold, wherein the seventh complexity threshold is less than the sixth complexity threshold; when the texture complexity of the current video frame is less than or equal to the seventh complexity threshold, determine the eleventh positive value as the first reduction; or, when the texture complexity of the current video frame is greater than the seventh complexity threshold, determine a zero value as the first reduction.
[0016] In one implementation, based on the aforementioned scheme, the first reduction amount is determined in at least one case that the motion amplitude of the current video frame is greater than or equal to the first amplitude threshold, and the texture complexity of the current video frame is greater than or equal to the first complexity threshold, including: in at least one case that the motion amplitude of the current video frame is greater than or equal to the first amplitude threshold, and the texture complexity of the current video frame is greater than or equal to the first complexity threshold, the twelfth positive value is determined as the first reduction amount.
[0017] In one implementation, based on the aforementioned scheme, the above-mentioned determining the adjusted quantization parameter of the first macroblock in the above-mentioned current video frame according to the adjusted macroblock tree strength corresponding to the above-mentioned current video frame includes: determining the quantization parameter reduction amount corresponding to the above-mentioned first macroblock according to the importance of the above-mentioned first macroblock and the adjusted macroblock tree strength corresponding to the above-mentioned current video frame; determining the adjusted quantization parameter corresponding to the above-mentioned first macroblock according to the original quantization parameter corresponding to the above-mentioned first macroblock and the above-mentioned quantization parameter reduction amount; wherein, the adjusted quantization parameter corresponding to the above-mentioned first macroblock is used to encode the above-mentioned first macroblock, and the above-mentioned quantization parameter reduction amount is used to write into the code stream.
[0018] In one implementation, based on the aforementioned scheme, the method further includes: determining the inter-frame prediction cost and the intra-frame coding cost of the current video frame; determining the ratio of the inter-frame prediction cost and the intra-frame coding cost of the current video frame as a first ratio; determining the intra-frame coding cost of the average pixel point based on the intra-frame prediction cost of the current video frame and the size information of the current video frame; wherein the first ratio is used to determine the motion amplitude of the current video frame, and the intra-frame coding cost of the average pixel point is used to determine the texture complexity of the current video frame.
[0019] In a second aspect, a video decoding method is provided, which includes: parsing a bit stream, determining an adjusted quantization parameter corresponding to a first macroblock in a current video frame, wherein the adjusted quantization parameter is determined based on an adjusted macroblock tree strength corresponding to the current video frame, the adjusted macroblock tree strength is determined based on texture complexity and motion amplitude of the current video frame, and the first macroblock is any macroblock in the current video frame; decoding the first macroblock based on the adjusted quantization parameter corresponding to the first macroblock.
[0020] In one implementation, based on the aforementioned solution, when the motion amplitude of the current video frame is less than a first amplitude threshold and the texture complexity of the current video frame is less than a first complexity threshold, the adjusted macroblock tree strength corresponding to the current video frame is determined based on the original macroblock tree strength and the first increase, wherein the first increase is determined based on at least one of the texture complexity and the motion amplitude of the current video frame; or,
[0021] In at least one of the following cases: the motion amplitude of the current video frame is greater than or equal to the first amplitude threshold, and the texture complexity of the current video frame is greater than or equal to the first complexity threshold, the adjusted macroblock tree strength corresponding to the current video frame is determined based on the original macroblock tree strength and the first reduction amount, wherein the first reduction amount is determined at least based on the texture complexity of the current video frame.
[0022] In one implementation, based on the aforementioned scheme, the parsing of the bitstream to determine the adjusted quantization parameter corresponding to the first macroblock in the current video frame includes: parsing the bitstream to obtain a quantization parameter reduction corresponding to the first macroblock in the current video frame, wherein the quantization parameter reduction is determined based on the importance of the first macroblock and the adjusted macroblock tree strength corresponding to the current video frame; and determining the adjusted quantization parameter corresponding to the first macroblock based on the quantization parameter reduction corresponding to the first macroblock and its original quantization parameter.
[0023] According to a third aspect, a video encoding device is provided, which includes: a first determination module, a second determination module and an encoding module; wherein the first determination module is used to determine the adjusted macroblock tree strength corresponding to the current video frame according to the texture complexity and motion amplitude of the current video frame; the second determination module is used to determine the adjusted quantization parameter of the first macroblock in the current video frame according to the adjusted macroblock tree strength corresponding to the current video frame, wherein the first macroblock is any macroblock in the current video frame; and the encoding module is used to encode the first macroblock according to the adjusted quantization parameter corresponding to the first macroblock.
[0024] In a fourth aspect, a video decoding device is provided, which includes: a parsing module and a decoding module; wherein the parsing module is used to parse the code stream and determine the adjusted quantization parameter corresponding to the first macroblock in the current video frame, wherein the adjusted quantization parameter is determined based on the adjusted macroblock tree strength corresponding to the current video frame, and the adjusted macroblock tree strength is determined based on the texture complexity and motion amplitude of the current video frame, and the first macroblock is any macroblock in the current video frame; and the decoding module is used to decode the first macroblock according to the adjusted quantization parameter corresponding to the first macroblock.
[0025] In a fifth aspect, an electronic device is provided, comprising a processor and a memory; the memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to execute the video encoding method provided by the above-mentioned first aspect and its various implementations, or to execute the video decoding method provided by the above-mentioned second aspect and its various implementations.
[0026] In a sixth aspect, a chip is provided, comprising: a processor for calling and running a computer program from a memory, so that a device equipped with the chip executes the video encoding method provided in the first aspect and its various implementations, or executes the video decoding method provided in the second aspect and its various implementations.
[0027] In the seventh aspect, a computer-readable storage medium is provided for storing a computer program, wherein the computer program enables a computer to execute the video encoding method provided by the above-mentioned first aspect and its various implementations, or to execute the video decoding method provided by the above-mentioned second aspect and its various implementations.
[0028] In an eighth aspect, a computer program product is provided, comprising computer program instructions, wherein the computer program instructions enable a computer to execute the video encoding method provided by the above-mentioned first aspect and its various implementations, or to execute the video decoding method provided by the above-mentioned second aspect and its various implementations.
[0029] In the ninth aspect, a computer program is provided, which, when running on a computer, enables the computer to execute the video encoding method provided by the above-mentioned first aspect and its various implementations, or to execute the video decoding method provided by the above-mentioned second aspect and its various implementations.
[0030] In summary, in the solution provided by the embodiment of the present application, the adjusted macroblock tree strength corresponding to the current video frame is determined based on the texture complexity and motion amplitude of the current video frame. Then, based on the adjusted macroblock tree strength corresponding to the current video frame, the adjusted quantization parameter of the first macroblock in the current video frame is determined, wherein the first macroblock is any macroblock in the current video frame. Furthermore, the first macroblock is encoded based on the adjusted quantization parameter corresponding to the first macroblock. It can be seen that the adjusted macroblock tree strength is related to the texture complexity and motion amplitude in the video frame, so that the macroblock tree strength can be adaptively adjusted according to the texture complexity and motion amplitude of different video frames during the video encoding process, which is beneficial to improving the flexibility and personalization of determining the quantization parameter, thereby improving the video encoding and decoding performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0032] Figure 1 2 is a diagram showing an example structure of a video encoder to which embodiments of the present application may be applied;
[0033] Figure 2 2 is a diagram showing an example structure of a video decoder to which the embodiments of the present application may be applied;
[0034] Figure 3 A schematic diagram of a video encoding method according to an embodiment of the present invention;
[0035] Figure 4 A flowchart of a method for determining the strength of a macroblock tree after adjustment provided in an embodiment of the present application;
[0036] Figure 5 A flowchart of a method for determining a first increase amount provided in an embodiment of the present application;
[0037] Figure 6 A flowchart of a method for determining a first increase amount provided in an embodiment of the present application;
[0038] Figure 7 A schematic flow chart of a method for determining a first reduction amount provided in an embodiment of the present application;
[0039] Figure 8 A schematic flow chart of a method for determining a first reduction amount provided in an embodiment of the present application;
[0040] Figure 9 A flowchart of a method for determining the strength of a macroblock tree after adjustment provided in an embodiment of the present application;
[0041] Figure 10 A flowchart of a method for determining an adjusted quantization parameter according to an embodiment of the present application;
[0042] Figure 11 A schematic diagram of a video decoding method according to an embodiment of the present invention;
[0043] Figure 12 A schematic diagram of the structure of a video encoding device provided in an embodiment of the present application;
[0044] Figure 13 A schematic diagram of the structure of a video decoding device provided in an embodiment of the present application;
[0045] Figure 14 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0046] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0047] It should be noted that the terms "first," "second," and the like in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or precedence. It should be understood that the numbers used in this manner are interchangeable where appropriate so that the embodiments of the application described herein can be implemented in an order other than those illustrated or described herein. In the embodiments of the present application, "B corresponding to A" means that B is associated with A. In one implementation, B can be determined based on A. However, it should also be understood that determining B based on A does not mean determining B solely based on A, but that B can also be determined based on A and / or other information. In addition, the terms "including" and "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to these processes, methods, products, or devices. In the description of this application, unless otherwise specified, "plurality" refers to two or more than two.
[0048] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0049] Figure 1 FIG1 is a diagram illustrating a structure of a video encoder 100 to which embodiments of the present application may be applied. The video encoder 100 can be used to perform lossy compression or lossless compression on an image. The lossless compression can be visually lossless or mathematically lossless.
[0050] The video encoder 100 can be applied to image data in a luminance and chrominance (YCbCr, YUV) format. For example, the YUV ratio can be 4:2:0, 4:2:2, or 4:4:4, where Y represents brightness (Luma), Cb (U) represents blue chrominance, Cr (V) represents red chrominance, and U and V represent chrominance (Chroma) used to describe color and saturation. For example, in terms of color format, 4:2:0 means that every 4 pixels have 4 luminance components and 2 chrominance components (YYYYCbCr), 4:2:2 means that every 4 pixels have 4 luminance components and 4 chrominance components (YYYYCbCrCbCr), and 4:4:4 represents full pixel display (YYYYCbCrCbCrCbCrCbCr).
[0051] Exemplarily, the video encoder 100 reads video data and, for each video frame in the video data, divides the video frame into macroblocks. For example, in H.264, a macroblock is the basic unit of encoding, and a video frame is divided into a number of 16x16 pixel macroblocks (MBs). To improve encoding efficiency, a macroblock can be further divided into smaller blocks for encoding, specifically including:
[0052] refer to Figure 1 The video encoder 100 may include a prediction module 110, a residual module 120, a transform / quantization module 130, an inverse transform / quantization module 140, a reconstruction module 150, a loop filter module 160, a decoded image buffer 170, and an entropy coding module 180. It should be noted that the video encoder 100 may include more, fewer, or different functional components.
[0053] Alternatively, in this application, a prediction block may also be referred to as a prediction image block or an image prediction block, and a reconstructed image block may also be referred to as a reconstructed block or an image reconstruction block. Due to the need for parallel processing, an image may be divided into slices. Slices within the same image can be processed in parallel, meaning that there is no data dependency between them. "Frame" is a commonly used term, and it can generally be understood that a frame is an image. The term "frame" herein may also be replaced with "image" or "slice," etc.
[0054] In some embodiments, the prediction module 110 includes an inter-frame prediction module 111 and an intra-frame prediction module 112. Because there is a strong correlation between adjacent pixels in a video image, intra-frame prediction is used in video coding and decoding technologies to eliminate spatial redundancy between adjacent pixels. Because there is a strong similarity between adjacent images in a video, inter-frame prediction is used in video coding and decoding technologies to eliminate temporal redundancy between adjacent images, thereby improving coding efficiency.
[0055] The inter-frame prediction module 111 can be used for inter-frame prediction, which includes motion estimation and motion compensation. It can reference image information from different images. Inter-frame prediction uses motion information to find a reference block from a reference image and generate a prediction block based on the reference block to eliminate temporal redundancy. Inter-frame prediction uses motion information to find a reference block from a reference image and generate a prediction block based on the reference block. Motion information includes the reference image list in which the reference image is located, the reference image index, and a motion vector. The motion vector can be integer pixel or fractional pixel. If the motion vector is fractional pixel, interpolation filtering is required to generate the required fractional pixel block in the reference image. Here, the integer pixel or fractional pixel block in the reference image found based on the motion vector is called a reference block. Some technologies directly use the reference block as the prediction block, while others further process the reference block to generate a prediction block. Reprocessing a reference block to generate a prediction block can also be understood as using the reference block as the prediction block and then processing the prediction block to generate a new prediction block.
[0056] The intra-frame prediction module 112 only refers to information of the same image to predict pixel information within the current code image block to eliminate spatial redundancy.
[0057] There are multiple prediction modes for intra-frame prediction. Taking the H series of international digital video coding standards as an example, the H.264 / AVC standard has 8 angular prediction modes and 1 non-angular prediction mode, and H.265 / HEVC has expanded this to 33 angular prediction modes and 2 non-angular prediction modes. The intra-frame prediction modes used by HEVC include planar mode, direct current mode (DC), and 33 angular modes, for a total of 35 prediction modes. The intra-frame modes used by versatile video coding (VVC) include planar, DC, and 65 angular modes, for a total of 67 prediction modes. It should be noted that with the increase in angular modes, intra-frame prediction will become more accurate and more in line with the needs of the development of high-definition and ultra-high-definition digital video.
[0058] Residual module 120 may generate a residual block for the macroblock based on the pixel block of the macroblock and the prediction block (PU) of the macroblock. For example, residual module 120 may generate the residual block for the macroblock such that each sample in the residual block has a value equal to the difference between a sample in the pixel block of the macroblock and a corresponding sample in the prediction block of the macroblock.
[0059] The transform / quantization module 130 may quantize the transform coefficients. The transform / quantization module 130 may quantize the transform coefficients associated with the macroblock based on a quantization parameter (QP) value associated with the macroblock. The video encoder 100 may adjust the degree of quantization applied to the transform coefficients associated with the macroblock by adjusting the quantization parameter associated with the macroblock.
[0060] The inverse transform / quantization module 140 may apply inverse quantization and inverse transform, respectively, to the quantized transform coefficients to reconstruct a residual block from the quantized transform coefficients.
[0061] Reconstruction module 150 may add samples of the reconstructed residual block to corresponding samples of one or more prediction blocks generated by prediction module 110 to generate a reconstructed image block associated with the macroblock. By reconstructing each sample block of the macroblock in this manner, video encoder 100 may reconstruct the pixel blocks of the macroblock.
[0062] The loop filter module 160 is used to process the inverse transformed and inverse quantized pixels to compensate for distortion information and provide a better reference for subsequent pixel encoding. For example, it can perform a deblocking filter operation to reduce the blocking effect of pixel blocks associated with the macroblock.
[0063] In some embodiments, the loop filtering module 160 includes a deblocking filtering module and a sample adaptive offset / adaptive loop filtering (SAO / ALF) module, wherein the deblocking filtering module is used to remove blocking effects, and the SAO / ALF module is used to remove ringing effects.
[0064] The decoded image buffer 170 may store the reconstructed pixel blocks. The inter-frame prediction module 111 may use the reference image containing the reconstructed pixel blocks to perform inter-frame prediction on PUs of other images. In addition, the intra-frame prediction module 112 may use the reconstructed pixel blocks in the decoded image buffer 170 to perform intra-frame prediction on other PUs in the same image as the macroblock.
[0065] The entropy encoding module 180 may receive the quantized transform coefficients from the transform / quantization module 130. The entropy encoding module 180 may perform one or more entropy encoding operations on the quantized transform coefficients to generate entropy-encoded data.
[0066] Figure 2 2 is a schematic diagram of the structure of the video decoder 200 involved in the embodiment of the present application. Figure 2 The video decoder 200 includes an entropy decoding module 210, a prediction module 220, an inverse quantization / transformation module 230, a reconstruction module 240, a loop filter module 250, and a decoded image buffer 260. It should be noted that the video decoder 200 may include more, fewer, or different functional components.
[0067] The video decoder 200 may receive a bitstream. The entropy decoding module 210 may parse the bitstream to extract syntax elements from the bitstream. As part of parsing the bitstream, the entropy decoding module 210 may parse the entropy-encoded syntax elements in the bitstream. The prediction module 220, the inverse quantization / transformation module 230, the reconstruction module 240, and the loop filter module 250 may decode the video data based on the syntax elements extracted from the bitstream, thereby generating decoded video data.
[0068] In some embodiments, the prediction module 220 includes an intra-frame prediction module 222 and an inter-frame prediction module 221 .
[0069] The intra prediction module 222 may perform intra prediction to generate a prediction block for a PU. The intra prediction module 222 may use an intra prediction mode to generate a prediction block for the PU based on pixel blocks of spatially neighboring PUs. The intra prediction module 222 may also determine the intra prediction mode for the PU based on one or more syntax elements parsed from the codestream.
[0070] The inter-frame prediction module 221 may construct a first reference picture list (List 0) and a second reference picture list (List 1) based on syntax elements parsed from the codestream. Furthermore, if a PU is encoded using inter-frame prediction, the entropy decoding module 210 may parse the motion information of the PU. The inter-frame prediction module 221 may determine one or more reference blocks for the PU based on the motion information of the PU. The inter-frame prediction module 221 may generate a prediction block for the PU based on the one or more reference blocks of the PU.
[0071] The inverse quantization / transform module 230 may inversely quantize (ie, dequantize) the transform coefficients associated with the macroblock. The inverse quantization / transform module 230 may use a quantization parameter associated with the macroblock to determine a degree of quantization.
[0072] After inverse quantizing the transform coefficients, inverse quantization / transform module 230 may apply one or more inverse transforms to the inverse quantized transform coefficients to generate a residual block associated with the macroblock.
[0073] The reconstruction module 240 uses the residual block associated with the macroblock and the prediction block of the macroblock to reconstruct the pixel block of the macroblock. For example, the reconstruction module 240 can add samples of the residual block to corresponding samples of the prediction block to reconstruct the pixel block of the macroblock to obtain a reconstructed image block.
[0074] The loop filtering module 250 may perform a deblocking filtering operation to reduce blocking artifacts of pixel blocks associated with a macroblock.
[0075] The video decoder 200 may store the reconstructed image of the macroblock in the decoded image buffer 260. The video decoder 200 may use the reconstructed image in the decoded image buffer 260 as a reference image for subsequent prediction, or transmit the reconstructed image to a display device for presentation.
[0076] The basic process of video encoding and decoding is as follows: At the encoder end, an image is divided into multiple macroblocks. For the current block, the prediction module 110 uses intra-frame prediction or inter-frame prediction to generate a prediction block for the current block. The residual module 120 calculates a residual block based on the predicted block and the original block of the current block. This residual block is the difference between the predicted block and the original block of the current block. This residual block can also be referred to as residual information. This residual block undergoes transformation and quantization by the transform / quantization module 130, removing information that is insensitive to the human eye and eliminating visual redundancy. Optionally, the residual block before transformation and quantization by the transform / quantization module 130 can be referred to as a time-domain residual block, and the time-domain residual block after transformation and quantization by the transform / quantization module 130 can be referred to as a frequency residual block or a frequency-domain residual block. The entropy coding module 180 receives the quantized change coefficients output by the transform and quantization module 130 and performs entropy coding on these quantized change coefficients to output a bitstream. For example, the entropy coding module 180 can eliminate character redundancy based on the target context model and the probability information of the binary bitstream.
[0077] At the decoding end, the entropy decoding module 210 can parse the code stream to obtain the prediction information, quantization coefficient matrix, etc. of the current block. The prediction module 220 uses intra-frame prediction or inter-frame prediction on the current block based on the prediction information to generate a prediction block for the current block. The inverse quantization / transformation module 230 uses the quantization coefficient matrix obtained from the code stream to inverse quantize and inverse transform the quantization coefficient matrix to obtain a residual block. The reconstruction module 240 adds the prediction block and the residual block to obtain a reconstructed block. The reconstructed blocks constitute a reconstructed image, and the loop filtering module 250 performs loop filtering on the reconstructed image based on the image or block to obtain a decoded image. The encoding end also requires similar operations as the decoding end to obtain a decoded image. The decoded image can also be called a reconstructed image, and the reconstructed image can be used as a reference image for inter-frame prediction of subsequent images.
[0078] It should be noted that the block division information determined by the encoder, as well as mode information or parameter information such as prediction, transform, quantization, entropy coding, and loop filtering, etc., are carried in the bitstream when necessary. The decoder parses the bitstream and analyzes the existing information to determine the same block division information, prediction, transform, quantization, entropy coding, loop filtering, etc. mode information or parameter information as the encoder, thereby ensuring that the decoded image obtained by the encoder and the decoder are identical.
[0079] It is understandable that the "inverse transformation" of the transform coefficients at the decoding end may also be referred to as "transformation" in the standard text. The "transformation" and "inverse transformation" in the embodiments of the present application correspond to two opposite processes. For example, if the "transformation" converts the numerical values in the spatial domain to the coefficients in the frequency domain, then the "inverse transformation" converts the coefficients in the frequency domain to the numerical values in the spatial domain. If the standard only stipulates decoding, then the "transformation" in the standard text is the decoding part, which refers to the "inverse transformation" in this article. The "inverse transformation" of the transform coefficients at the decoding end may also be referred to as "transformation" in the standard text.
[0080] For example, the video decoder or video encoder described above can be configured in a user terminal. User terminals include, but are not limited to, mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle-mounted terminals, aircraft, and the like. Embodiments of the present invention can be applied in various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, and assisted driving.
[0081] Currently, mainstream video coding standards such as AVC, HEVC, VVC, AVS3, the second-generation video coding standard developed by the Alliance for Open Media Video 2 (AV2), and the first-generation video coding standard developed by the Alliance for Open Media Video 1 (AV1) all adopt the above-mentioned block-based hybrid coding framework. As technology develops, some modules or steps of this framework or process may be optimized. This application is applicable to the basic process of the video codec under this block-based hybrid coding framework, but is not limited to this framework and process.
[0082] As mentioned above, in existing video compression standards, the macroblock tree (MB Tree) is a rate control method. In this rate control method, the importance of each macroblock and the strength of the macroblock tree are estimated, and the quantization parameter (QP) value of the macroblock is adjusted, thereby adjusting the number of coding bits consumed by different macroblocks to achieve rate control. For example, the formula (1) for adjusting the quantization parameter of the macroblock by the macroblock tree method in the H264 encoder can be expressed as:
[0083] qp aft_i =qp bef_i - strength×importance _i (1)
[0084] Among them, importance _i Indicates the importance of the i-th macroblock; qp aft_i Indicates the quantization parameter of the i-th macroblock after macroblock tree adjustment; qpbef_i The quantization parameter of the i-th macroblock before adjustment through the macroblock tree is called the original quantization parameter for that macroblock; strength represents the macroblock tree strength. The macroblock tree strength is a fixed value, meaning that for video frames with varying degrees of motion and texture complexity, the magnitude of the adjustment to the quantization parameter based on the macroblock tree strength is fixed. Therefore, the flexibility of the quantization parameter determined by the macroblock tree strength needs to be improved.
[0085] In response to the above-mentioned technical problems existing in the related art, an embodiment of the present application determines the adjusted macroblock tree strength corresponding to the current video frame according to the texture complexity and motion amplitude of the current video frame. Then, based on the adjusted macroblock tree strength corresponding to the current video frame, the adjusted quantization parameter of the first macroblock in the current video frame is determined, wherein the first macroblock is any macroblock in the current video frame. Furthermore, the first macroblock is encoded according to the adjusted quantization parameter corresponding to the first macroblock. It can be seen that the adjusted macroblock tree strength is related to the texture complexity and motion amplitude in the video frame, so that the macroblock tree strength can be adaptively adjusted according to the texture complexity and motion amplitude of different video frames during the video encoding process, which is conducive to improving the flexibility and personalization of determining the quantization parameters, thereby helping to improve the video encoding and decoding performance.
[0086] The following describes the technical solutions of the embodiments of the present application in detail through some embodiments. The following embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.
[0087] Figure 3 This is a flow chart of the video encoding method P300 provided in an embodiment of the present application. Figure 3 , method P300 includes S310 to S330.
[0088] In S310 , the adjusted macroblock tree strength corresponding to the current video frame is determined according to the texture complexity and motion amplitude of the current video frame.
[0089] In an exemplary embodiment, the intra-frame coding cost of the average pixel can be determined based on the intra-frame prediction cost and size information of the current video frame. Furthermore, the texture complexity of the current video frame can be measured based on the intra-frame coding cost of the average pixel. Taking the i-th video frame as an example, the intra-frame coding cost of the average pixel ave_intra_cost can be determined by formula (2): i .
[0090]
[0091] Among them, intra_cost i Indicates the intra-frame prediction cost of the i-th video frame, frame_width i Indicates the width of the i-th video frame, frame_height i Indicates the height of the i-th video frame.
[0092] In an exemplary embodiment, a first ratio can be determined based on the inter-frame prediction cost and the intra-frame prediction cost of the current video frame. Furthermore, the ratio can be used to measure the motion amplitude of the current video frame. Taking the i-th video frame as an example, the first ratio can be determined using formula (3).
[0093]
[0094] Among them, inter_cost i represents the inter-frame prediction cost of the i-th video frame.
[0095] In an exemplary embodiment, the inter-frame coding cost of the average pixel can be determined based on the inter-frame prediction cost and size information of the current video frame. Furthermore, the motion amplitude of the current video frame can be measured based on the inter-frame coding cost of the average pixel. Taking the i-th video frame as an example, the frame coding cost of the average pixel ave_inter_cost can also be determined by formula (4): i .
[0096]
[0097] For example, the intra cost and inter cost of the current video frame calculated when making a frame type decision in the Lookahead process can be reused, thereby effectively saving computing power.
[0098] The Lookahead process is a step that predicts and analyzes the content of future frames to optimize bitrate control and frame type decisions. During the Lookahead process, the encoder reads and analyzes the next video sequence in advance, but does not immediately encode it.
[0099] In an exemplary embodiment, if there may be multiple inter-frame prediction costs for the same video frame in the Lookahead process, an average of the multiple inter-frame prediction costs may be calculated and used as the inter-frame prediction value inter cost of the video frame.
[0100] In an exemplary embodiment, if the current video frame has not yet determined whether to use inter-frame prediction coding (i.e., calculating its cost as a B frame) during the Lookahead process, and according to the coding configuration, a maximum of n consecutive B frames are allowed to exist. In order to evaluate the possibility and cost of using B frame coding for the current video frame, the encoder will select a frame at a distance of n+1 from the current video frame as a prediction reference frame. This is because the B frame is a bidirectional prediction frame, which needs to refer to both the previous frame and the next frame for motion compensation prediction, so selecting a frame at a distance of n+1 can meet the requirements of bidirectional prediction. Specifically, the motion estimation error (residual) of the current video frame relative to the above-selected reference frame is calculated and the error is quantized, and then the number of bits required to encode this residual is estimated through entropy coding to obtain the inter cost in the current video.
[0101] It should be noted that the method for calculating the intra cost and inter cost of the current video frame is not limited to the above embodiment.
[0102] In an exemplary embodiment, after determining the parameters for measuring the texture complexity and motion amplitude of the current video frame, the texture complexity and motion amplitude of the current video frame can be measured according to the following formula: Figure 4 The illustrated embodiment determines the macroblock tree strength corresponding to the current video frame. Figure 4 This is a flow chart of a method P400 for determining the macroblock tree strength corresponding to the current video frame provided in an embodiment of the present application. Figure 4 , method P400 includes S410-S450.
[0103] In S410 , it is determined that the motion amplitude of the current video frame is smaller than a first amplitude threshold, and the texture complexity of the current video frame is smaller than a first complexity threshold.
[0104] The first amplitude threshold and the second complexity threshold are both positive values determined based on multiple experiments.
[0105] Exemplarily, if it is determined that the motion amplitude of the current video frame is less than the first amplitude threshold and the texture complexity of the current video frame is less than the first complexity threshold, S420 and S430 are performed. In S420, a first increase is determined; in S430, an adjusted macroblock tree strength corresponding to the current video frame is determined based on the original macroblock tree strength and the first increase.
[0106] According to formula (1), the greater the macroblock tree strength, the greater the adjustment of the quantization parameter, specifically, the greater the reduction on the basis of the original quantization parameter. For video frames with small motion amplitude and low texture content complexity, by increasing the macroblock tree strength, the quantization parameters of all macroblocks (including important macroblocks) in the video frame can be significantly reduced. As a result, the important content of simple texture frames with small motion amplitude has higher quality, and can provide more complete information for reference of other macroblocks, which is ultimately beneficial to improve the quality of codecs, such as achieving the Peak Signal-to-Noise Ratio (PNSR) of the encoded video sequence, the Structural Similarity Index Measure (SSIM), and the Video Multi-method Assessment Fusion (VMAF) indicators ( Delta Rate (BD-rate) is improved. BD-rate is a metric used to quantify video coding efficiency, particularly when comparing the performance of different encoders or different parameter settings of the same encoder. BD-rate is expressed as a percentage and calculates the bitrate savings achieved by a new encoder compared to a baseline encoder while maintaining equivalent visual quality. A negative BD-rate for an encoder, such as -10%, means that the new encoder requires a 10% reduction in bitrate while maintaining the same visual quality. Conversely, a positive value indicates an increase in bitrate. In video codec research and development, the goal is typically to minimize BD-rate, thereby improving coding efficiency.
[0107] The following describes a specific implementation method for determining the first increase:
[0108] Method 1
[0109] When it is determined that the motion amplitude of the current video frame is less than the first amplitude threshold and the texture complexity of the current video frame is less than the first complexity threshold, the seventh positive value is determined as the first increase amount.
[0110] In this embodiment, the seventh positive value is a value determined based on multiple experiments, and may also be a value set according to actual needs.
[0111] In the embodiment provided by method 1, under the premise that it is determined that the texture complexity in the current video frame is small (i.e., less than the first complexity threshold) and the motion amplitude is also small (i.e., less than the first amplitude threshold), the above-mentioned seventh positive value is directly determined as the first increase, so that the macroblock tree strength corresponding to each video frame can be determined efficiently.
[0112] Method 2
[0113] When it is determined that the motion amplitude of the current video frame is less than the first amplitude threshold and the texture complexity of the current video frame is less than the first complexity threshold, the first increase amount is determined according to the texture complexity or the motion amplitude of the current video frame.
[0114] Exemplary, reference Figure 5 , which shows an implementation method of determining the first increase amount according to the texture complexity of the current video frame when it is determined that the motion amplitude of the current video frame is less than the first amplitude threshold and the texture complexity of the current video frame is less than the first complexity threshold. Figure 5 , the embodiment shown in the figure includes the following steps.
[0115] In S420 - A1 , it is determined whether the texture complexity of the current video frame is less than a second complexity threshold.
[0116] The second complexity threshold is smaller than the first complexity threshold.
[0117] The motion amplitude of the current video frame is smaller than the first amplitude threshold and the texture complexity of the current video frame is smaller than the first complexity threshold, indicating that the texture complexity of the current video frame is smaller and the motion amplitude is also smaller. In this embodiment, the second complexity threshold is used to determine whether the texture complexity of the current video frame is smaller, and this is used as an influencing factor for determining the increase amount.
[0118] Specifically, if it is determined that the texture complexity of the current video frame is less than the second complexity threshold, it means that the texture complexity of the current video frame is very small and is suitable for using a smaller quantization parameter, and S420-A2 is executed: the first positive value is determined to be the first increment; if it is determined that the texture complexity of the current video frame is greater than or equal to the second complexity threshold, it means that the texture complexity of the current video frame is between the first complexity threshold and the second complexity threshold, and S420-A3 is executed: the second positive value is determined to be the first increment, wherein the first positive value is greater than the second positive value. Thus, the quantization parameter determined in S420-A2 can be controlled to be smaller than the quantization parameter determined in S420-A3.
[0119] Similarly, if the motion amplitude of the current video frame is smaller than the first amplitude threshold and the texture complexity of the current video frame is smaller than the first complexity threshold, then the other threshold (for example, A) smaller than the first amplitude threshold can be used to determine whether the motion amplitude of the current video frame is smaller, and this can be used as an influencing factor for determining the increase. If it is determined that the motion amplitude of the current video frame is smaller than A, it means that the motion amplitude of the current video frame is very small and is suitable for using a smaller quantization parameter, and S420-A2' is executed: the positive value a is determined as the first increase; if it is determined that the motion amplitude of the current video frame is greater than or equal to A, it means that the motion amplitude of the current video frame is between A and the first amplitude threshold, and S420-A2' is executed: a' is determined as the first increase, wherein a>a'. Thus, the quantization parameter determined in the case of S420-A2' can be controlled to be smaller than the quantization parameter determined in the case of S420-A3'.
[0120] In the embodiment provided by the second method, on the premise that the texture complexity of the current video frame is small (i.e., smaller than the first complexity threshold) and the motion amplitude is also small (i.e., smaller than the first amplitude threshold), different positive values are determined according to whether the texture complexity or motion amplitude of the current video frame is smaller, thereby making the adjustment of the macroblock tree strength more specific, more in line with the actual situation of the video frame, and making the adjustment method richer.
[0121] Method 3
[0122] When it is determined that the motion amplitude of the current video frame is less than the first amplitude threshold and the texture complexity of the current video frame is less than the first complexity threshold, the first increase amount is determined according to the texture complexity and motion amplitude of the current video frame.
[0123] Exemplary, reference Figure 6 , the embodiment shown in the figure includes the following steps.
[0124] In S420 - B1 , it is determined whether the motion amplitude of the current video frame is less than a second amplitude threshold and whether the texture complexity of the current video frame is less than a third complexity threshold.
[0125] The second amplitude threshold is smaller than the first amplitude threshold, and the third complexity threshold is smaller than the first complexity threshold.
[0126] If the motion amplitude of the current video frame is less than the first amplitude threshold and the texture complexity of the current video frame is less than the first complexity threshold, it means that the texture complexity of the current video frame is small and the motion amplitude is also small. In this embodiment, the third complexity threshold is used to determine whether the texture complexity of the current video frame is smaller, and the second amplitude threshold is used to determine whether the motion amplitude of the current video frame is smaller. This allows for more detailed classification of the video frames to provide a more realistic macroblock tree strength.
[0127] The current video frame may be classified into a first category or a second category through S420-B1. The first category is when the motion amplitude of the current video frame is less than the second amplitude threshold and the texture complexity is less than the third complexity threshold, which is a case where both the texture complexity and the motion complexity are very small. The second category is when the motion amplitude of the current video frame is between the second amplitude threshold and the first amplitude threshold, or the texture complexity is between the third complexity threshold and the first complexity threshold, which is a case where both the texture complexity and the motion complexity are relatively small.
[0128] For each of the above two categories, the first increase amount can be determined by adopting the implementation method as method one, that is, directly determining the preset positive value as the first increase amount. It should be noted that when the current video frame belongs to the first category, the corresponding positive value is a1, and when the current video frame belongs to the second category, the corresponding positive value is a2.
[0129] For each of the above two categories, the first increase amount can also be determined by adopting the second embodiment, that is, the first increase amount is further determined according to the texture complexity or motion amplitude of the current video frame. Figure 6 In the illustrated embodiment, that is, under both of the above two categories, the first increase amount is determined according to the texture complexity of the current video frame.
[0130] Specifically, for the first classification described above, S420 - B2 to S420 - B4 are executed.
[0131] In S420 - B2 , it is determined whether the texture complexity of the current video frame is less than a fourth complexity threshold.
[0132] The fourth complexity threshold is smaller than the third complexity threshold.
[0133] The motion amplitude of the current video frame is smaller than the second amplitude threshold and the texture complexity of the current video frame is smaller than the third complexity threshold, indicating that the texture complexity in the current video frame is very small and the motion amplitude is also very small. In this embodiment, the fourth complexity threshold is used to determine whether the texture complexity of the current video frame is smaller, and this is used as an influencing factor for determining the increase amount.
[0134] Specifically, if it is determined that the texture complexity of the current video frame is less than the fourth complexity threshold, it means that the texture complexity of the current video frame is smaller than the third complexity threshold and is suitable for using a smaller quantization parameter, and S420-B3 is executed: the third positive value is determined to be the first increment; if it is determined that the texture complexity of the current video frame is greater than or equal to the fourth complexity threshold, it means that the texture complexity of the current video frame is between the fourth complexity threshold and the third complexity threshold, and S420-B4 is executed: the fourth positive value is determined to be the first increment, wherein the third positive value is greater than the fourth positive value. Thus, the quantization parameter determined in S420-B3 can be controlled to be smaller than the quantization parameter determined in S420-B4.
[0135] Similarly, if the motion amplitude of the current video frame is less than the second amplitude threshold and the texture complexity of the current video frame is less than the third complexity threshold, then another threshold (for example, B) that is less than the second amplitude threshold can be used to determine whether the motion amplitude of the current video frame is smaller than the second motion amplitude, and this can be used as an influencing factor for determining the increase. If it is determined that the motion amplitude of the current video frame is less than B, it means that the motion amplitude of the current video frame is smaller than the second amplitude threshold, and it is appropriate to use a smaller quantization parameter, and execute S420-B3': determine the positive value b as the first increase; if it is determined that the motion amplitude of the current video frame is greater than or equal to B, it means that the motion amplitude of the current video frame is between B and the second amplitude threshold, and execute S420-B4': determine b' as the first increase, wherein the above b>b'. Thus, the quantization parameter determined in the case of S420-B3' can be controlled to be smaller than the quantization parameter determined in the case of S420-B4'.
[0136] Specifically, for the second classification described above, S420 - B5 to S420 - B7 are executed.
[0137] In S420 - B5 , it is determined whether the texture complexity of the current video frame is less than a fifth complexity threshold.
[0138] The fifth complexity threshold is smaller than the first complexity threshold.
[0139] If the motion amplitude of the current video frame is between the second amplitude threshold and the first amplitude threshold, or if the texture complexity is between the third complexity threshold and the first complexity threshold, it indicates that the texture complexity or motion complexity of the current video frame is relatively small. In this embodiment, the relationship between the fifth complexity threshold and the texture complexity of the current video frame is used as an influencing factor for determining the amount of increase. The fifth complexity threshold is smaller than the first complexity threshold and larger than the third complexity threshold.
[0140] Specifically, if it is determined that the texture complexity of the current video frame is less than the fifth complexity threshold, it means that the texture complexity of the current video frame is smaller than the fifth complexity threshold and is suitable for using a smaller quantization parameter, and S420-B6 is executed: the fifth positive value is determined to be the first increment, wherein the fifth positive value is less than or equal to the fourth positive value; if it is determined that the texture complexity of the current video frame is greater than or equal to the fifth complexity threshold, it means that the texture complexity of the current video frame is between the fifth complexity threshold and the first complexity threshold, and S420-B7 is executed: the sixth positive value is determined to be the first increment, wherein the fifth positive value is greater than the sixth positive value. Thus, the quantization parameter determined in the case of S420-B7 can be controlled to be smaller than the quantization parameter determined in the case of S420-B8.
[0141] Similarly, if the motion amplitude of the current video frame is between the second amplitude threshold and the first amplitude threshold, or the texture complexity is between the third complexity threshold and the first complexity threshold, then the other amplitude threshold (e.g., C, where C is greater than the second amplitude threshold and less than the first amplitude threshold) can be used to determine whether the motion amplitude of the current video frame is smaller than the second motion amplitude, and this can be used as an influencing factor for determining the increase. This embodiment will not be described in detail again.
[0142] In the embodiment provided by method three, on the premise that it is determined that the texture complexity in the current video frame is small (i.e., smaller than the first complexity threshold) and the motion amplitude is also small (i.e., smaller than the first amplitude threshold), different first increase amounts are determined based on the texture complexity and motion amplitude of the current video frame, thereby making the adjustment of the macroblock tree strength more specific, more in line with the actual situation of the video frame, and making the adjustment method richer.
[0143] After the first increase is determined through the above implementation, the adjusted macroblock tree strength corresponding to the current video frame may be determined using the original macroblock tree strength and the first increase.
[0144] In an embodiment of the present application, for video frames with small motion amplitude and low texture content complexity, a greater macroblock tree strength is provided, thereby reducing the quantization parameters corresponding to the macroblocks in such video frames, so that such video frames have higher quality after encoding and decoding. The reason is that the human eye is more sensitive to the quality of such video frames, and if there are low-quality areas, they are easily detected. In addition, a small motion amplitude indicates that the speed of change of the video content is slow. A high-quality video frame can be used as a reference frame to provide a large number of high-quality reference blocks to other video frames, which helps to reduce coding residuals and improve coding performance.
[0145] In an exemplary embodiment, the operation of increasing the above-mentioned first increase amount on the basis of the original macroblock tree strength will result in an increase in the bit cost of encoding the current video frame. Therefore, in the embodiment of the present application, for video frames with large motion amplitude and high texture content complexity, the corresponding macroblock tree strength is reduced, thereby increasing the quantization parameters of important macroblocks in such video frames, thereby reducing the number of encoded bits, achieving a dynamic balance of the overall encoding bit number, and avoiding the situation where the total number of encoded bits of the final encoded video stream is significantly increased. For example, continue to refer to Figure 4 If at least one of the following conditions is determined: the motion amplitude of the current video frame is greater than or equal to a first amplitude threshold, and the texture complexity of the current video frame is greater than or equal to a first complexity threshold, S440 and S450 are executed. In S440, a first reduction amount is determined; in S450, an adjusted macroblock tree strength corresponding to the current video frame is determined based on the original macroblock tree strength and the first reduction amount.
[0146] The following describes a specific implementation method for determining the first reduction amount:
[0147] Method 4
[0148] In at least one of the cases where it is determined that the motion amplitude of the current video frame is greater than or equal to the first amplitude threshold and the texture complexity of the current video frame is greater than or equal to the first complexity threshold, the twelfth positive value is determined as the first reduction amount.
[0149] In this embodiment, the twelfth positive value is a value determined based on multiple experiments, and may also be a value set according to actual needs.
[0150] In the embodiment provided by method 4, under the premise of determining that the texture complexity in the current video frame is large (i.e., greater than or equal to the first complexity threshold) or the motion amplitude is large (i.e., greater than or equal to the first amplitude threshold), the above-mentioned twelfth positive value is directly determined as the first reduction amount, so that the macroblock tree strength corresponding to each video frame can be determined efficiently.
[0151] In other embodiments, in at least one of the cases where the motion amplitude of the current video frame is greater than or equal to a first amplitude threshold, and the texture complexity of the current video frame is greater than or equal to a first complexity threshold, the first reduction amount is determined based on at least one of the motion amplitude and the texture complexity of the current video frame.
[0152] Method 5
[0153] In at least one of the following situations: the motion amplitude of the current video frame is greater than or equal to a first amplitude threshold, and the texture complexity of the current video frame is greater than or equal to a first complexity threshold, a first reduction amount is determined according to the texture complexity of the current video frame.
[0154] Exemplary, reference Figure 7 , which shows an implementation method for determining the first reduction amount according to the texture complexity of the current video frame in at least one of the following cases: determining that the motion amplitude of the current video frame is greater than or equal to the first amplitude threshold, and determining that the texture complexity of the current video frame is greater than or equal to the first complexity threshold. Figure 7 , the embodiment shown in the figure includes the following steps.
[0155] In S440 - A1 , it is determined whether the texture complexity of the current video frame is greater than a sixth complexity threshold.
[0156] The sixth complexity threshold is greater than the first complexity threshold.
[0157] The motion amplitude of the current video frame is greater than or equal to the first amplitude threshold, and / or the texture complexity of the current video frame is greater than or equal to the first complexity threshold, indicating that the texture complexity of the current video frame is large and / or the motion amplitude is large. In this embodiment, the sixth complexity threshold is used to determine whether the texture complexity of the current video frame is greater than the first complexity threshold, and this is used as an influencing factor for determining the increase amount.
[0158] Specifically, if it is determined that the texture complexity of the current video frame is less than or equal to the sixth complexity threshold, it means that the texture complexity of the current video frame is not very large and is not suitable for adopting a larger quantization parameter. Instead, the original macroblock tree strength can be maintained. Therefore, S440-A3 is executed: a zero value is determined as the first reduction amount. If it is determined that the texture complexity of the current video frame is greater than the sixth complexity threshold, it means that the texture complexity of the current video frame is very large. Then, S440-A2 is executed: an eighth positive value is determined as the first reduction amount, wherein the eighth positive value is less than the original macroblock tree strength. Thus, the adjusted macroblock tree strength determined in the case of S440-A2 can be controlled to be greater than zero.
[0159] In the embodiment provided by method five, under the premise of determining that the texture complexity in the current video frame is large (i.e., greater than or equal to the first complexity threshold), or the motion amplitude is large (i.e., greater than or equal to the first amplitude threshold), the current video frame is first divided into two cases based on the relationship between the texture complexity and the sixth complexity threshold. If it is greater than the sixth complexity threshold, it means that the texture complexity of the current video frame is very large, and its macroblock tree strength can be reduced; if it is not greater than the sixth complexity threshold, it means that the texture complexity of the current video frame is not very large, and its original macroblock tree strength can be maintained. The embodiment provided by this method can make the adjustment of the macroblock tree strength more specific, fit the actual situation of the video frame, and enrich the adjustment methods.
[0160] Method 6
[0161] In at least one of the following situations: the motion amplitude of the current video frame is greater than or equal to a first amplitude threshold, and the texture complexity of the current video frame is greater than or equal to a first complexity threshold, a first reduction amount is determined according to the motion amplitude of the current video frame.
[0162] In S440-A1', it is determined whether the motion amplitude of the current video frame is greater than D. The D value is greater than the first amplitude threshold. If the motion amplitude of the current video frame is greater than or equal to the first amplitude threshold, and / or the texture complexity of the current video frame is greater than or equal to the first complexity threshold, it indicates that the texture complexity and / or motion amplitude of the current video frame are large. In this embodiment, the D value is used to determine whether the motion amplitude of the current video frame is greater than the first amplitude threshold, and this is used as an influencing factor for determining the amount of increase.
[0163] Specifically, if the motion amplitude of the current video frame is determined to be less than or equal to the aforementioned D value, this indicates that the motion amplitude of the current video frame is not very large and is not suitable for a larger quantization parameter. Instead, the original macroblock tree strength can be maintained. Therefore, S440-A3' is executed: a value of zero is determined as the first reduction amount. If the motion amplitude of the current video frame is determined to be greater than the aforementioned D value, this indicates that the motion amplitude of the current video frame is very large. Then, S440-A2' is executed: a positive value d is determined as the first reduction amount, where the d value is less than the original macroblock tree strength. This allows the adjusted macroblock tree strength determined in S440-A2' to be greater than zero.
[0164] In the embodiment provided by method six, upon determining that the texture complexity of the current video frame is large (i.e., greater than or equal to a first complexity threshold) or the motion amplitude is large (i.e., greater than or equal to a first amplitude threshold), the current video frame is first divided into two cases based on the relationship between the motion amplitude and the D value. If the motion amplitude is greater than the D value, it indicates that the motion amplitude of the current video frame is very large, and its macroblock tree strength can be reduced; if the motion amplitude is not greater than the D value, it indicates that the motion amplitude of the current video frame is not very large, and its original macroblock tree strength can be maintained. The embodiment provided by this method can make the adjustment of the macroblock tree strength more specific, fit the actual situation of the video frame, and enrich the adjustment methods.
[0165] Method 7
[0166] In at least one of the following cases: the motion amplitude of the current video frame is greater than or equal to a first amplitude threshold, and the texture complexity of the current video frame is greater than or equal to a first complexity threshold, a first reduction amount is determined based on the texture complexity and motion amplitude of the current video frame.
[0167] Exemplary, reference Figure 8, which shows an implementation method for determining the first reduction amount based on both the texture complexity and the motion amplitude of the current video frame when at least one of the conditions that the motion amplitude of the current video frame is greater than or equal to the first amplitude threshold and the texture complexity of the current video frame is greater than or equal to the first complexity threshold. Figure 8 , the embodiment shown in the figure includes the following steps.
[0168] In S440 - B1 , it is determined whether the texture complexity of the current video frame is greater than a sixth complexity threshold.
[0169] The sixth complexity threshold is greater than the first complexity threshold.
[0170] The motion amplitude of the current video frame is greater than or equal to the first amplitude threshold, and / or the texture complexity of the current video frame is greater than or equal to the first complexity threshold, indicating that the texture complexity of the current video frame is large and / or the motion amplitude is large. In this embodiment, the sixth complexity threshold is used to determine whether the texture complexity of the current video frame is greater than the first complexity threshold, and this is used as an influencing factor for determining the increase amount.
[0171] If it is determined that the texture complexity of the current video frame is greater than the above-mentioned sixth complexity threshold, it means that the texture complexity of the current video frame is very large. In this case, the embodiment of the present application determines different reduction amounts according to the motion amplitude of the current video frame, and then executes S440-B2: determines whether the motion amplitude of the current video frame is less than the third amplitude threshold, wherein the third amplitude threshold is greater than the first amplitude threshold. Specifically, in this case, if the motion amplitude is larger, the reduction amount is larger, and conversely, if the motion amplitude is smaller, the reduction amount is smaller. In the case of determining that the motion amplitude of the current video frame is less than the third amplitude threshold, execute S440-B3: determine the ninth positive value as the first reduction amount; in the case of determining that the motion amplitude of the current video frame is greater than or equal to the third amplitude threshold, execute S440-B3: determine the tenth positive value as the first reduction amount, wherein the tenth positive value is greater than the ninth positive value.
[0172] If it is determined that the texture complexity of the current video frame is less than or equal to the sixth complexity threshold, it means that the texture complexity of the current video frame is not very large. In this case, the embodiments provided by Methods 5 and 6 maintain the original macroblock tree strength. In order to further improve the level of refinement, the embodiment of the present application can determine whether the texture complexity of the current video frame is greater than the seventh complexity threshold (less than the sixth complexity threshold), so as to determine whether the original macroblock tree strength needs to be reduced. Therefore, execute S440-B5: determine whether the texture complexity of the current video frame is greater than the seventh complexity threshold. In the case that the texture complexity of the current video frame is less than or equal to the sixth complexity threshold and greater than the seventh complexity threshold, it means that although the texture complexity of the current video frame is not very large, it is greater than the seventh complexity threshold and belongs to a relatively large range, then execute S440-B6: determine the eleventh positive value as the first reduction amount; wherein, the eleventh positive value is less than the ninth positive value. When the texture complexity of the current video frame is less than or equal to the seventh complexity threshold, it means that the texture complexity of the current video frame is not very large and is less than or equal to the seventh complexity threshold, nor does it belong to a relatively large range, then execute S440-B7: determine that the zero value is the first reduction amount.
[0173] In the embodiment provided by method seven, under the premise of determining that the texture complexity in the current video frame is large (i.e., greater than or equal to the first complexity threshold), or the motion amplitude is large (i.e., greater than or equal to the first amplitude threshold), the current video frame is first divided into two cases based on the relationship between the texture complexity and the sixth complexity threshold. In the case where it is greater than the sixth complexity threshold, it means that the texture complexity of the current video frame is very large, and its macroblock tree strength can be reduced. Specifically, the degree of reduction can be further determined based on its motion amplitude; in the case where it is not greater than the sixth complexity threshold, it means that the texture complexity of the current video frame is not very large, and it can be further determined whether the corresponding macroblock tree strength needs to be reduced based on the seventh complexity threshold. Compared with methods five and six, the embodiment provided by this method can make the adjustment of the macroblock tree strength more specific, more in line with the actual situation of the video frame, and also make the adjustment method richer.
[0174] In an exemplary embodiment, Figure 9 The flowchart of the method P900 for determining the strength of the macroblock tree after adjustment provided by the embodiment of the present application is shown in FIG. The embodiment provided by the method P900 can be regarded as a combination of the above-mentioned method 3 and method 7. Figure 9 , method P900 includes S90 to S910.
[0175] In S90, get ave_intra_cost i 、ratio i and ave_inter_costi .
[0176] Among them, ave_intra_cost i is used to measure the texture complexity of the i-th video frame, and ratio i or ave_inter_cost i is used to measure the motion amplitude of the i-th video frame.
[0177] In S91, it is judged whether ratio i < TH1 and ave_intra_cost i < TH2.
[0178] Exemplarily, in this embodiment, it is first judged whether the i-th video frame belongs to a video frame with a very low motion amplitude and very simple texture content, that is, it is judged whether ratio i < TH1 and ave_intra_cost i < TH2 holds.
[0179] Among them, the above TH1 is equivalent to the second amplitude threshold in the third embodiment, and TH2 is equivalent to the third complexity threshold in the third embodiment.
[0180] If S91 holds, then S92 is executed: judge whether ave_intra_cost i < TH7.
[0181] If S91 holds, it means that the i-th video frame has a very low motion amplitude and very simple texture content, then it can be determined that an increase amount is required to increase the corresponding amount on the basis of the original macroblock tree strength so as to increase the macroblock tree strength. In order to further improve the adjustment flexibility of the macroblock tree strength, at this time, it can also be further judged whether ave_intra_cost i < TH7 holds, that is, to judge the texture complexity again. Specifically, in the case of being less than TH7, S921 is executed: increase a on the basis of the original macroblock tree strength; in the case of not less than TH7, S922 is executed: increase b on the basis of the original macroblock tree strength, so as to give different macroblock tree strengths, where a > b.
[0182] Among them, TH7 is equivalent to the fourth complexity threshold in the third embodiment. The above a is equivalent to the third positive value in the third embodiment, and b is equivalent to the fourth positive value in the third embodiment.
[0183] If S91 does not hold, then S93 is executed: judge whether TH1 < ratio i < TH3 and TH2 < ave_intra_cost i < TH4.
[0184] If S91 does not hold, then determine whether the video frame belongs to a frame with a low motion amplitude and a relatively simple texture content, that is, determine whether TH1 < ratio i < TH3 and TH2 < ave_intra_cost i < TH4 holds; if it holds, it means that the i-th video frame has a low motion amplitude and a relatively simple texture content.
[0185] Among them, the above TH3 is equivalent to the first amplitude threshold in the third embodiment, and TH4 is equivalent to the first complexity threshold in the third embodiment.
[0186] If S93 holds, then execute S94: Determine ave_intra_cost i < TH8.
[0187] If S93 holds, it means that the i-th video frame has a low motion amplitude and a relatively simple texture content. At this time, further determine whether ave_intra_cost i < TH8 holds, and judge the complexity of the texture content again. Specifically, in the case of being less than TH8, execute S941: Increase c based on the original macroblock tree strength; in the case of not being less than TH8, execute S942: Increase d based on the original macroblock tree strength, so as to assign different macroblock tree strengths, where c > d. Among them, b ≥ c.
[0188] Among them, TH8 is equivalent to the fifth complexity threshold in the third embodiment. The above c is equivalent to the fourth positive value in the third embodiment, and d is equivalent to the sixth positive value in the third embodiment.
[0189] If S93 does not hold, then execute S95: Determine ave_intra_cost i > TH5.
[0190] If S93 does not hold, then determine whether the texture content of the i-th video frame is very complex, that is, determine whether ave_intra_cost i > TH5 holds.
[0191] Among them, the above TH5 is equivalent to the sixth complexity threshold in the seventh embodiment.
[0192] If S95 holds, execute S96: Determine ave_inter_cost i <TH9.
[0193] If S95 is established, it means that the texture content of the i-th video frame is very complex. It is possible to reduce the original macroblock tree strength by a certain amount to increase the quantization parameter of the macroblock in the i-th video frame. Specifically, the motion amplitude of the i-th video frame is judged to determine the reduction amount to different degrees, so that different macroblock tree strengths can be assigned according to the motion amplitude. If ave_inter_cost i <TH9, indicating that the motion amplitude of the i-th video frame is small, then execute S961: reduce e based on the original macroblock tree strength; if ave_inter_cost i ≥TH9, indicating that the motion amplitude of the i-th video frame is large, then executing S962: reducing f based on the original macroblock tree strength, where f>e.
[0194] TH9 is equivalent to the third amplitude threshold in the seventh embodiment. The above-mentioned e is equivalent to the ninth positive value in the seventh embodiment, and f is equivalent to the tenth positive value in the seventh embodiment.
[0195] If S95 is not established, execute S97: determine TH5>ave_intra_cost i >TH6.
[0196] If S95 is not established, it is determined that the texture content of the i-th video frame is more complex, that is, it is determined that TH5>ave_intra_cost i >Whether TH6 is established.
[0197] Among them, the above TH6 is equivalent to the seventh complexity threshold in the seventh embodiment.
[0198] If S97 is satisfied, execute S971: reduce g based on the original macroblock tree strength. If S97 is not satisfied, execute S972: reduce h based on the original macroblock tree strength.
[0199] If S97 is true, it means that the content of the i-th video frame is relatively complex, and the original macroblock tree strength is determined to be reduced by an amount g, where g<e; if the previous S97 is not true, the original macroblock tree strength is not modified, which means that h is actually 0.
[0200] Here, g is equivalent to the eleventh positive value in the seventh embodiment.
[0201] In S98, the adjusted macroblock tree strength may be determined according to the original macroblock tree strength and the adjustment amount.
[0202] like Figure 9 In the embodiment shown, TH1-TH9 may be values determined based on multiple experiments or may be pre-set values based on actual needs, and ag is a positive value.
[0203] Multiple complexity thresholds and amplitude thresholds used in the above process of determining the first increase amount and the first decrease amount, and Figure 9 TH1-TH9 shown in the embodiment can also be determined based on a machine learning method, thereby improving the intelligence and efficiency of parameter determination.
[0204] In the above specific implementation of S310 , the texture complexity and motion amplitude of the current video frame are determined based on the intra cost and inter cost of the current video frame as input parameters.
[0205] In some other embodiments of S310, the pixel values of the video frame and adjacent frames may be used as input parameters to determine the motion amplitude and texture content complexity of the video frame through machine learning. For example, the pixel values of the current video frame and adjacent frames are used as inputs to a trained machine learning model. Based on the model output, it is determined that the texture complexity and motion amplitude of the current video frame are relatively small. Furthermore, a predetermined positive value may be directly determined as the first increment, thereby efficiently determining the macroblock tree strength corresponding to each video frame.
[0206] Continuing with reference to 3, in S320, an adjusted quantization parameter of a first macroblock in the current video frame is determined according to the adjusted macroblock tree strength corresponding to the current video frame, wherein the first macroblock is any macroblock in the current video frame.
[0207] In an exemplary embodiment, Figure 10 This is a flow chart of a method for determining the adjusted quantization parameter according to an embodiment of the present application. Figure 10 , the method shown in the figure includes S320 - 1 and S320 - 3 .
[0208] In S320-1, a quantization parameter reduction amount corresponding to the first macroblock is determined based on the importance of the first macroblock and the adjusted macroblock tree strength corresponding to the current video frame. Furthermore, in S320-2, an adjusted quantization parameter corresponding to the first macroblock is determined based on the original quantization parameter corresponding to the first macroblock and the quantization parameter reduction amount.
[0209] For example, in the solution provided in the embodiment of the present application, for the j-th macroblock in the i-th video frame, the adjusted quantization parameter qp aft_j The determination method of can be expressed as formula (4).
[0210] qp aft_j =qp bef_j - strength _i ×importance _j (4)
[0211] Among them, importance _j Indicates the importance of the jth macroblock in the i-th video frame; qp aft_j represents the quantization parameter of the jth macroblock in the i-th video frame after macroblock tree adjustment; qp bef_i Indicates the original quantization parameter of the jth macroblock in the i-th video frame; strength _i Indicates the macroblock tree strength corresponding to the i-th video frame. _i is determined based on the texture complexity and motion amplitude of the i-th video frame. It can be seen that in the embodiments of the present application, the macroblock tree strength determined for video frames with different motion levels and different texture content complexities can be different, and thus the adjustment amplitude of the quantization parameter based on the macroblock tree strength is also different, thereby improving the flexibility of the quantization parameter determined based on the macroblock tree strength.
[0212] In S330 , the first macroblock is encoded according to the adjusted quantization parameter corresponding to the first macroblock.
[0213] The embodiment of encoding the first macroblock according to the adjusted quantization parameter corresponding to the first macroblock can refer to Figure 1 The relevant parts of the illustrated embodiment will not be described again in detail.
[0214] In addition, in some embodiments, the encoder may write the quantization parameter reduction corresponding to the first macroblock into the bitstream, so that the decoder can parse the bitstream to obtain the quantization parameter reduction corresponding to the above-mentioned first macroblock. Further, based on the original quantization parameter of the macroblock and the quantization parameter reduction, the adjusted quantization parameter of the macroblock is determined, and decoding is achieved based on this.
[0215] In the video encoding scheme provided in the embodiment of the present application, the adjusted macroblock tree strength corresponding to the current video frame is determined based on the texture complexity and motion amplitude of the current video frame. Then, based on the adjusted macroblock tree strength corresponding to the current video frame, the adjusted quantization parameter of the first macroblock in the current video frame is determined, wherein the first macroblock is any macroblock in the current video frame. Furthermore, the first macroblock is encoded based on the adjusted quantization parameter corresponding to the first macroblock. It can be seen that the adjusted macroblock tree strength is related to the texture complexity and motion amplitude in the video frame, so that the macroblock tree strength can be adaptively adjusted according to the texture complexity and motion amplitude of different video frames during the video encoding process, which is beneficial to improving the flexibility and personalization of determining the quantization parameter, thereby improving the video encoding and decoding performance.
[0216] The above describes in detail the video encoding method provided by the embodiment of the present application. The following describes the video decoding method provided by the embodiment of the present application through specific examples.
[0217] Figure 11 This is a flow chart of the video decoding method P1100 provided in an embodiment of the present application. Figure 11 , the method P1100 shown in the figure includes S1110 and S1120.
[0218] In S1110, the bitstream is parsed to determine an adjusted quantization parameter corresponding to a first macroblock in a current video frame, wherein the adjusted quantization parameter is determined based on an adjusted macroblock tree strength corresponding to the current video frame, the adjusted macroblock tree strength is determined based on texture complexity and motion amplitude of the current video frame, and the first macroblock is any macroblock in the current video frame.
[0219] In an exemplary embodiment, the encoder writes the quantization parameter reduction corresponding to the first macroblock into the bitstream. Thus, the decoder parses the bitstream and can obtain the quantization parameter reduction corresponding to the first macroblock in the current video frame, wherein the quantization parameter reduction is determined based on the importance of the first macroblock and the adjusted macroblock tree strength corresponding to the current video frame. Furthermore, the decoder determines the adjusted quantization parameter corresponding to the first macroblock based on the quantization parameter reduction corresponding to the first macroblock and its original quantization parameter. Since the above-mentioned adjusted macroblock tree strength is related to the texture complexity and motion amplitude in the video frame, the adjusted macroblock tree strength of different video frames can be adaptively adjusted according to the different texture complexity and motion amplitude of the frame, which is conducive to improving the flexibility and personalization of determining the quantization parameter, and ultimately helps to improve the video encoding and decoding performance.
[0220] In an exemplary embodiment, when the motion amplitude of the current video frame is less than a first amplitude threshold and the texture complexity of the current video frame is less than a first complexity threshold, the adjusted macroblock tree strength corresponding to the current video frame is determined based on the original macroblock tree strength and the first increase, wherein the first increase is determined based on at least one of the texture complexity and the motion amplitude of the current video frame.
[0221] According to formula (1), the greater the macroblock tree strength, the greater the adjustment of the quantization parameter. Specifically, the greater the reduction in the original quantization parameter. For video frames with small motion amplitude and low texture content complexity, by increasing the macroblock tree strength, the quantization parameters of all macroblocks (including important macroblocks) in the video frame can be significantly reduced. This ensures that the important content of simple texture frames with small motion amplitude has higher quality, and can provide more complete information for reference for other macroblocks, ultimately helping to improve codec quality, such as achieving an increase in the BD-rate of PNSR, SSIM, and VMAF of the encoded video sequence.
[0222] Exemplarily, the determination of the first increase amount may refer to the first to third methods shown in the video encoding method, which will not be described in detail here.
[0223] In an exemplary embodiment, in at least one of the following cases: the motion amplitude of the current video frame is greater than or equal to a first amplitude threshold, and the texture complexity of the current video frame is greater than or equal to a first complexity threshold, the adjusted macroblock tree strength corresponding to the current video frame is determined based on the original macroblock tree strength and the first reduction amount, wherein the first reduction amount is determined at least based on the texture complexity of the current video frame.
[0224] Increasing the original macroblock tree strength by the first increment will result in an increase in the bit count required to encode the current video frame. Therefore, in this embodiment, for video frames with large motion amplitudes and highly complex texture content, the corresponding macroblock tree strength is reduced, thereby increasing the quantization parameters of important macroblocks in such video frames. This, in turn, reduces the number of encoded bits, achieving a dynamic balance in the overall number of encoded bits and avoiding a significant increase in the number of encoded bits in the final encoded video stream.
[0225] Exemplarily, the determination of the first reduction amount may refer to the fourth to seventh methods shown in the video encoding method, which will not be described in detail here.
[0226] In S1120 , the first macroblock is decoded according to the adjusted quantization parameter corresponding to the first macroblock.
[0227] In the video decoding solution provided in the embodiment of the present application, the video decoder parses the code stream to obtain the adjusted quantization parameter corresponding to the first macroblock in the i-th video frame, wherein the adjusted quantization parameter is determined based on the adjusted macroblock tree strength corresponding to the i-th video frame, and the adjusted macroblock tree strength corresponding to the i-th video frame is determined based on the texture complexity and motion amplitude of the i-th video frame. It can be seen that the adjusted macroblock tree strength is related to the texture complexity and motion amplitude in the video frame, so that during the video decoding process, the macroblock tree strength corresponding to different video frames can be adaptively adjusted based on the texture complexity and motion amplitude of different video frames, which is beneficial to improving the flexibility and personalization of determining the quantization parameter, thereby improving video encoding and decoding performance.
[0228] The video encoding and decoding scheme provided by the embodiment of the present application can be applied to video compression scenarios that allow a certain delay, such as live broadcast and on-demand scenarios. In this scenario, the application of the proposed macroblock tree strength adaptive method can adaptively adjust the macroblock tree strength of the video frame without basically increasing the computing power, thereby improving the BD-rate indicators of PSNR, SSIM and VMAF of the entire video sequence after encoding. For example, after the test sequence is encoded by the scheme provided by the embodiment of the present application, the average BD-rate gains of PSNR, SSIM and VMAF in the live broadcast scenario are -0.73%, -0.48% and -0.76% respectively; in the on-demand scenario, the average BD-rate gains of PSNR, SSIM and VMAF are -0.48%, -0.48% and -0.46% respectively. In addition, in the live broadcast and on-demand scenarios, the encoding time after enabling the embodiment of the present application will basically not increase, that is, the scheme provided by the embodiment of the present application will not introduce additional encoding frame delay.
[0229] Combined with the above Figures 1 to 11 , describes the method embodiment of the present application in detail, and the following is combined with Figures 12 to 13 , describe in detail the device embodiments of the present application.
[0230] Figure 12 This is a schematic diagram of the structure of the video encoding device 1200 provided in an embodiment of the present application. Figure 12The video encoding device 1200 includes: a first determination module 1210, a first determination module 1220 and an encoding module 1230; wherein the first determination module 1210 is used to determine the adjusted macroblock tree strength corresponding to the current video frame according to the texture complexity and motion amplitude of the current video frame; the second determination module 1220 is used to determine the adjusted quantization parameter of the first macroblock in the current video frame according to the adjusted macroblock tree strength corresponding to the current video frame, wherein the first macroblock is any macroblock in the current video frame; and the encoding module 1230 is used to encode the first macroblock according to the adjusted quantization parameter corresponding to the first macroblock.
[0231] In an exemplary embodiment, based on the aforementioned scheme, the above-mentioned first determination module 1210 includes: an increase amount determination unit and a first adjustment unit; wherein the above-mentioned increase amount determination unit is used to determine the first increase amount when the motion amplitude of the above-mentioned current video frame is less than the first amplitude threshold and the texture complexity of the above-mentioned current video frame is less than the first complexity threshold; the above-mentioned first adjustment unit is used to determine the adjusted macroblock tree strength corresponding to the above-mentioned current video frame based on the original macroblock tree strength and the above-mentioned first increase amount.
[0232] In an exemplary embodiment, based on the above-mentioned scheme, the above-mentioned increase amount determination unit is specifically used to: when the motion amplitude of the above-mentioned current video frame is less than the first amplitude threshold and the texture complexity of the above-mentioned current video frame is less than the first complexity threshold, determine the first increase amount according to at least one of the texture complexity and motion amplitude of the above-mentioned current video frame.
[0233] In an exemplary embodiment, based on the above-mentioned scheme, the above-mentioned increase amount determination unit is specifically used to: determine whether the texture complexity of the above-mentioned current video frame is less than the second complexity threshold, wherein the above-mentioned second complexity threshold is less than the above-mentioned first complexity threshold; in the case that the texture complexity of the above-mentioned current video frame is less than the above-mentioned second complexity threshold, determine the first positive value as the above-mentioned first increase amount; or, in the case that the texture complexity of the above-mentioned current video frame is greater than or equal to the above-mentioned second complexity threshold, determine the second positive value as the above-mentioned first increase amount, wherein the above-mentioned first positive value is greater than the above-mentioned second positive value.
[0234] In an exemplary embodiment, based on the above-mentioned scheme, the above-mentioned increase amount determination unit is specifically used to: determine whether the motion amplitude of the above-mentioned current video frame is less than the second amplitude threshold and whether the texture complexity of the above-mentioned current video frame is less than the third complexity threshold, wherein the above-mentioned second amplitude threshold is less than the above-mentioned first amplitude threshold, and the above-mentioned third complexity threshold is less than the above-mentioned first complexity threshold; when the motion amplitude of the above-mentioned current video frame is less than the above-mentioned second amplitude threshold and the texture complexity of the above-mentioned current video frame is less than the above-mentioned third complexity threshold, determine whether the texture complexity of the above-mentioned current video frame is less than the fourth complexity threshold, wherein the above-mentioned fourth complexity threshold is less than the above-mentioned third complexity threshold; when the texture complexity of the above-mentioned current video frame is less than the above-mentioned fourth complexity threshold, determine the third positive value as the above-mentioned first increase amount; or, when the texture complexity of the above-mentioned current video frame is greater than or equal to the above-mentioned fourth complexity threshold, determine the fourth positive value as the above-mentioned first increase amount, wherein the above-mentioned third positive value is greater than the above-mentioned fourth positive value;
[0235] The above-mentioned increase determination unit is specifically further used to: when the motion amplitude of the above-mentioned current video frame is greater than or equal to the above-mentioned second amplitude threshold, or the texture complexity of the above-mentioned current video frame is greater than or equal to the above-mentioned third complexity threshold, determine whether the texture complexity of the above-mentioned current video frame is less than the fifth complexity threshold, wherein the above-mentioned fifth complexity threshold is less than the above-mentioned first complexity threshold and greater than the above-mentioned third complexity threshold; when the texture complexity of the above-mentioned current video frame is less than the above-mentioned fifth complexity threshold, determine the fifth positive value as the above-mentioned first increase, wherein the above-mentioned fifth positive value is less than or equal to the above-mentioned fourth positive value; or, when the texture complexity of the above-mentioned current video frame is greater than or equal to the above-mentioned fifth complexity threshold, determine the sixth positive value as the above-mentioned first increase, wherein the above-mentioned fifth positive value is greater than the above-mentioned sixth positive value.
[0236] In an exemplary embodiment, based on the above-mentioned scheme, the above-mentioned increase amount determination unit is specifically used to: when the motion amplitude of the above-mentioned current video frame is less than the first amplitude threshold and the texture complexity of the above-mentioned current video frame is less than the first complexity threshold, determine the seventh positive value as the first increase amount.
[0237] In an exemplary embodiment, based on the aforementioned scheme, the first determination module 1210 includes: a reduction amount determination unit and a second adjustment unit; wherein the reduction amount determination unit is used to determine the first reduction amount in at least one of the following cases: the motion amplitude of the current video frame is greater than or equal to the first amplitude threshold, and the texture complexity of the current video frame is greater than or equal to the first complexity threshold; and the second adjustment unit is used to determine the adjusted macroblock tree strength corresponding to the current video frame based on the original macroblock tree strength and the first reduction amount.
[0238] In an exemplary embodiment, based on the aforementioned scheme, the above-mentioned reduction amount determination unit is specifically used to: in at least one of the cases where the motion amplitude of the above-mentioned current video frame is greater than or equal to the first amplitude threshold, and the texture complexity of the above-mentioned current video frame is greater than or equal to the first complexity threshold, determine the first reduction amount at least based on the texture complexity of the above-mentioned current video frame.
[0239] In an exemplary embodiment, based on the above-mentioned scheme, the above-mentioned reduction amount determination unit is specifically used to: determine whether the texture complexity of the above-mentioned current video frame is greater than the sixth complexity threshold, wherein the above-mentioned sixth complexity threshold is greater than the above-mentioned first complexity threshold; in the case that the texture complexity of the above-mentioned current video frame is greater than the above-mentioned sixth complexity threshold, determine the eighth positive value as the first reduction amount, wherein the above-mentioned eighth positive value is less than the above-mentioned original macroblock tree strength; and, in the case that the texture complexity of the above-mentioned current video frame is less than or equal to the above-mentioned sixth complexity threshold, determine a zero value as the above-mentioned first reduction amount.
[0240] In an exemplary embodiment, based on the aforementioned scheme, the reduction amount determining unit is specifically configured to: determine whether the texture complexity of the current video frame is greater than a sixth complexity threshold, wherein the sixth complexity threshold is greater than the first complexity threshold; if the texture complexity of the current video frame is greater than the sixth complexity threshold, determine whether the motion amplitude of the current video frame is less than a third amplitude threshold; if the motion amplitude of the current video frame is less than the third amplitude threshold, determine a ninth positive value as the first reduction amount; or, if the motion amplitude of the current video frame is greater than or equal to the third amplitude threshold, determine a tenth positive value as the first reduction amount, wherein the tenth positive value is greater than the ninth positive value;
[0241] The reduction amount determination unit is further configured to: when the texture complexity of the current video frame is less than the sixth complexity threshold, determine whether the texture complexity of the current video frame is greater than a seventh complexity threshold, wherein the seventh complexity threshold is less than the sixth complexity threshold;
[0242] When the texture complexity of the current video frame is less than or equal to the seventh complexity threshold, the eleventh positive value is determined to be the first reduction amount; or, when the texture complexity of the current video frame is greater than the seventh complexity threshold, the zero value is determined to be the first reduction amount.
[0243] In an exemplary embodiment, based on the aforementioned scheme, the above-mentioned reduction amount determination unit is specifically used to: determine the twelfth positive value as the first reduction amount in at least one of the following cases: the motion amplitude of the above-mentioned current video frame is greater than or equal to the first amplitude threshold, and the texture complexity of the above-mentioned current video frame is greater than or equal to the first complexity threshold.
[0244] In an exemplary embodiment, based on the aforementioned scheme, the second determination module 1220 is specifically used to: determine the quantization parameter reduction corresponding to the first macroblock according to the importance of the first macroblock and the adjusted macroblock tree strength corresponding to the current video frame; and determine the adjusted quantization parameter corresponding to the first macroblock according to the original quantization parameter corresponding to the first macroblock and the quantization parameter reduction; wherein the adjusted quantization parameter corresponding to the first macroblock is used to encode the first macroblock, and the quantization parameter reduction is used to write into the bitstream.
[0245] In an exemplary embodiment, based on the above-mentioned scheme, the above-mentioned video encoding device 1200 also includes: a third determination module; wherein the above-mentioned third determination module is used to: determine the inter-frame prediction cost and the intra-frame coding cost of the above-mentioned current video frame; determine the ratio of the inter-frame prediction cost and the intra-frame coding cost of the above-mentioned current video frame as a first ratio; determine the intra-frame coding cost of the average pixel point according to the intra-frame prediction cost of the above-mentioned current video frame and the size information of the above-mentioned current video frame; wherein the above-mentioned first ratio is used to determine the motion amplitude of the above-mentioned current video frame, and the intra-frame coding cost of the above-mentioned average pixel point is used to determine the texture complexity of the above-mentioned current video frame.
[0246] It should be understood that the video encoding device embodiment and the video encoding method embodiment may correspond to each other, and similar descriptions may refer to the method embodiment. To avoid repetition, they will not be described here. Specifically, Figure 12 The video encoding device shown can execute the embodiment of the above-mentioned video encoding method, and the aforementioned and other operations and / or functions of each module in the device are respectively for implementing the embodiment of the video encoding method, which will not be repeated here for the sake of brevity.
[0247] Figure 13 This is a structural diagram of the video decoding device 1300 provided in an embodiment of the present application. Figure 13The video decoding device 1300 includes: a parsing module 1310 and a decoding module 1320; wherein the parsing module 1310 is used to parse the code stream and determine the adjusted quantization parameter corresponding to the first macroblock in the current video frame, wherein the adjusted quantization parameter is determined according to the adjusted macroblock tree strength corresponding to the current video frame, and the adjusted macroblock tree strength is determined according to the texture complexity and motion amplitude of the current video frame, and the first macroblock is any macroblock in the current video frame; and the decoding module 1320 is used to decode the first macroblock according to the adjusted quantization parameter corresponding to the first macroblock.
[0248] In an exemplary embodiment, based on the aforementioned solution, when the motion amplitude of the current video frame is less than a first amplitude threshold and the texture complexity of the current video frame is less than a first complexity threshold, the adjusted macroblock tree strength corresponding to the current video frame is determined based on the original macroblock tree strength and the first increase, wherein the first increase is determined based on at least one of the texture complexity and the motion amplitude of the current video frame; or,
[0249] In at least one of the following cases: the motion amplitude of the current video frame is greater than or equal to the first amplitude threshold, and the texture complexity of the current video frame is greater than or equal to the first complexity threshold, the adjusted macroblock tree strength corresponding to the current video frame is determined based on the original macroblock tree strength and the first reduction amount, wherein the first reduction amount is determined at least based on the texture complexity of the current video frame.
[0250] In an exemplary embodiment, based on the above-mentioned scheme, the above-mentioned parsing module 1310 includes a parsing unit and a confirmation unit; wherein the above-mentioned parsing unit is used to parse the code stream to obtain the quantization parameter reduction corresponding to the first macroblock in the current video frame, wherein the above-mentioned quantization parameter reduction is determined according to the importance of the above-mentioned first macroblock and the adjusted macroblock tree strength corresponding to the above-mentioned current video frame; and the above-mentioned determination unit is used to determine the adjusted quantization parameter corresponding to the above-mentioned first macroblock based on the quantization parameter reduction corresponding to the above-mentioned first macroblock and its original quantization parameter.
[0251] It should be understood that the video decoding device embodiment and the video decoding method embodiment may correspond to each other, and similar descriptions may refer to the method embodiment. To avoid repetition, they will not be described here. Specifically, Figure 13 The video decoding device shown can execute the embodiment of the above-mentioned video decoding method, and the aforementioned and other operations and / or functions of each module in the device are respectively for implementing the embodiment of the video decoding method, which will not be repeated here for the sake of brevity.
[0252] The above describes the apparatus of the embodiment of the video decoding method of the present application from the perspective of functional modules in conjunction with the accompanying drawings. It should be understood that the functional module can be implemented in hardware form, can be implemented by instructions in software form, or can be implemented by a combination of hardware and software modules. Specifically, the steps of the method embodiment in the embodiment of the present application can be completed by the hardware integrated logic circuit and / or software form instructions in the processor, and the steps of the method disclosed in the embodiment of the present application can be directly embodied as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. Optionally, the software module can be located in a mature storage medium in the art such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps in the above method embodiment in conjunction with its hardware.
[0253] Figure 14 is a schematic block diagram of an electronic device 1400 provided in an embodiment of the present application. Figure 14 The electronic device 1400 can be used to perform the above-mentioned video encoding method, or perform the above-mentioned video decoding method. Figure 14 As shown, the electronic device 1400 may include:
[0254] The memory 1410 and the processor 1420 are configured to store a computer program 1430 and transmit the program code 1430 to the processor 1420. In other words, the processor 1420 can call and execute the computer program 1430 from the memory 1410 to implement the method in the embodiment of the present application.
[0255] For example, the processor 1420 may be configured to execute the steps of the above method according to the instructions in the computer program 1430 .
[0256] In some embodiments of the present application, the processor 1420 may include but is not limited to:
[0257] General-purpose processor, Digital Signal Processor (DSP), Application Specific Integrated Circuit (ASIC), Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc.
[0258] In some embodiments of the present application, the memory 1410 includes but is not limited to:
[0259] Volatile memory and / or non-volatile memory. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM bus random access memory (DR RAM).
[0260] In some embodiments of the present application, the computer program 1430 may be divided into one or more modules, which are stored in the memory 1410 and executed by the processor 1420 to implement the above-mentioned video encoding method or the above-mentioned video decoding method provided by the present application. The one or more modules may be a series of computer program instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of the computer program 1430 in the electronic device.
[0261] like Figure 14 As shown, the electronic device 1400 may further include:
[0262] The transceiver 1440 may be connected to the processor 1420 or the memory 1410 .
[0263] The processor 1420 may control the transceiver 1440 to communicate with other devices. Specifically, the processor 1420 may send information or data to other devices or receive information or data sent by other devices. The transceiver 1440 may include a transmitter and a receiver. The transceiver 1440 may further include an antenna, which may be one or more.
[0264] It should be understood that the various components in the electronic device 1430 are connected via a bus system, wherein the bus system includes not only a data bus but also a power bus, a control bus and a status signal bus.
[0265] According to one aspect of the present application, a computer storage medium is provided, on which a computer program is stored. When the computer program is executed by a computer, the computer is enabled to perform the method of the above-described method embodiment. Alternatively, the present application also provides a computer program product containing instructions. When the computer is executed by the instructions, the computer is enabled to perform the method of the above-described method embodiment.
[0266] According to another aspect of the present application, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the method of the above-described method embodiment.
[0267] In other words, when implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a digital video disc (DVD)), or a semiconductor medium (e.g., a solid-state drive (SSD)).
[0268] Those skilled in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel 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.
[0269] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the modules is merely a logical function division. In actual implementation, there may be other division methods, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0270] Modules described as separate components may or may not be physically separate, and components displayed as modules may or may not be physical modules, i.e., they may be located in one place or distributed across multiple network elements. Some or all of the modules may be selected based on actual needs to achieve the purpose of the present embodiment. For example, the functional modules in the various embodiments of the present application may be integrated into a processing module, or each module may exist physically separately, or two or more modules may be integrated into a single module.
[0271] The above content is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. A video encoding method, characterized in that: The method comprises: Determining an adjusted macroblock tree strength corresponding to the current video frame according to texture complexity and motion amplitude of the current video frame; Determining an adjusted quantization parameter of a first macroblock in the current video frame according to the adjusted macroblock tree strength corresponding to the current video frame, wherein the first macroblock is any macroblock in the current video frame; The first macroblock is encoded according to the adjusted quantization parameter corresponding to the first macroblock.
2. The method according to claim 1, characterized in that The step of determining the adjusted macroblock tree strength corresponding to the current video frame according to the texture complexity and motion amplitude of the current video frame includes: determining a first increase amount when the motion amplitude of the current video frame is less than a first amplitude threshold and the texture complexity of the current video frame is less than a first complexity threshold; An adjusted macroblock tree strength corresponding to the current video frame is determined according to the original macroblock tree strength and the first increase.
3. The method according to claim 2, characterized in that The determining of the first increase amount when the motion amplitude of the current video frame is less than the first amplitude threshold and the texture complexity of the current video frame is less than the first complexity threshold includes: When the motion amplitude of the current video frame is less than a first amplitude threshold and the texture complexity of the current video frame is less than a first complexity threshold, a first increase amount is determined according to at least one of the texture complexity and the motion amplitude of the current video frame.
4. The method according to claim 3, characterized in that The determining the first increase amount according to at least one of the texture complexity and the motion amplitude of the current video frame includes: Determining whether the texture complexity of the current video frame is less than a second complexity threshold, wherein the second complexity threshold is less than the first complexity threshold; When the texture complexity of the current video frame is less than the second complexity threshold, determining a first positive value as the first increase; or When the texture complexity of the current video frame is greater than or equal to the second complexity threshold, a second positive value is determined as the first increase, wherein the first positive value is greater than the second positive value.
5. The method according to claim 3, characterized in that The determining the first increase amount according to at least one of the texture complexity and the motion amplitude of the current video frame includes: determining whether a motion amplitude of the current video frame is less than a second amplitude threshold and whether a texture complexity of the current video frame is less than a third complexity threshold, wherein the second amplitude threshold is less than the first amplitude threshold, and the third complexity threshold is less than the first complexity threshold; When the motion amplitude of the current video frame is less than the second amplitude threshold and the texture complexity of the current video frame is less than the third complexity threshold, determining whether the texture complexity of the current video frame is less than a fourth complexity threshold, wherein the fourth complexity threshold is less than the third complexity threshold; When the texture complexity of the current video frame is less than the fourth complexity threshold, determining a third positive value as the first increment; or, when the texture complexity of the current video frame is greater than or equal to the fourth complexity threshold, determining a fourth positive value as the first increment, wherein the third positive value is greater than the fourth positive value; When the motion amplitude of the current video frame is greater than or equal to the second amplitude threshold, or the texture complexity of the current video frame is greater than or equal to the third complexity threshold, determining whether the texture complexity of the current video frame is less than a fifth complexity threshold, wherein the fifth complexity threshold is less than the first complexity threshold and greater than the third complexity threshold; When the texture complexity of the current video frame is less than the fifth complexity threshold, the fifth positive value is determined as the first increase, wherein the fifth positive value is less than or equal to the fourth positive value; or, when the texture complexity of the current video frame is greater than or equal to the fifth complexity threshold, the sixth positive value is determined as the first increase, wherein the fifth positive value is greater than the sixth positive value.
6. The method according to claim 2, characterized in that The determining of the first increase amount when the motion amplitude of the current video frame is less than the first amplitude threshold and the texture complexity of the current video frame is less than the first complexity threshold includes: When the motion amplitude of the current video frame is smaller than the first amplitude threshold and the texture complexity of the current video frame is smaller than the first complexity threshold, the seventh positive value is determined as the first increase amount.
7. The method according to claim 1, characterized in that The step of determining the adjusted macroblock tree strength corresponding to the current video frame according to the texture complexity and motion amplitude of the current video frame includes: determining a first reduction amount in at least one of the following circumstances: a motion amplitude of the current video frame is greater than or equal to a first amplitude threshold, and a texture complexity of the current video frame is greater than or equal to a first complexity threshold; An adjusted macroblock tree strength corresponding to the current video frame is determined according to the original macroblock tree strength and the first reduction amount.
8. The method according to claim 7, characterized in that The determining of the first reduction amount in at least one of the cases where the motion amplitude of the current video frame is greater than or equal to the first amplitude threshold and the texture complexity of the current video frame is greater than or equal to the first complexity threshold comprises: In at least one of the cases where the motion amplitude of the current video frame is greater than or equal to a first amplitude threshold, and the texture complexity of the current video frame is greater than or equal to a first complexity threshold, a first reduction amount is determined at least based on the texture complexity of the current video frame.
9. The method according to claim 8, characterized in that The determining of the first reduction amount based on at least the texture complexity of the current video frame comprises: Determining whether a texture complexity of the current video frame is greater than a sixth complexity threshold, wherein the sixth complexity threshold is greater than the first complexity threshold; When the texture complexity of the current video frame is greater than the sixth complexity threshold, determining an eighth positive value as a first reduction amount, wherein the eighth positive value is less than the original macroblock tree strength; In a case where the texture complexity of the current video frame is less than or equal to the sixth complexity threshold, a value of zero is determined as the first reduction amount.
10. The method according to claim 8, characterized in that The determining of the first reduction amount based on at least the texture complexity of the current video frame comprises: Determining whether a texture complexity of the current video frame is greater than a sixth complexity threshold, wherein the sixth complexity threshold is greater than the first complexity threshold; In a case where the texture complexity of the current video frame is greater than the sixth complexity threshold, determining whether the motion amplitude of the current video frame is less than a third amplitude threshold; When the motion amplitude of the current video frame is less than the third amplitude threshold, determining a ninth positive value as the first reduction amount; or, when the motion amplitude of the current video frame is greater than or equal to the third amplitude threshold, determining a tenth positive value as the first reduction amount, wherein the tenth positive value is greater than the ninth positive value; When the texture complexity of the current video frame is less than the sixth complexity threshold, determining whether the texture complexity of the current video frame is greater than a seventh complexity threshold, wherein the seventh complexity threshold is less than the sixth complexity threshold; When the texture complexity of the current video frame is less than or equal to the seventh complexity threshold, the eleventh positive value is determined to be the first reduction amount; or, when the texture complexity of the current video frame is greater than the seventh complexity threshold, the zero value is determined to be the first reduction amount.
11. The method according to claim 7, characterized in that The determining of the first reduction amount in at least one of the cases where the motion amplitude of the current video frame is greater than or equal to the first amplitude threshold and the texture complexity of the current video frame is greater than or equal to the first complexity threshold comprises: In at least one of the following situations: the motion amplitude of the current video frame is greater than or equal to a first amplitude threshold, and the texture complexity of the current video frame is greater than or equal to a first complexity threshold, the twelfth positive value is determined as the first reduction amount.
12. The method according to any one of claims 1 to 11, characterized in that The determining, according to the adjusted macroblock tree strength corresponding to the current video frame, the adjusted quantization parameter of the first macroblock in the current video frame includes: determining a reduction amount of a quantization parameter corresponding to the first macroblock according to the importance of the first macroblock and the adjusted macroblock tree strength corresponding to the current video frame; determining an adjusted quantization parameter corresponding to the first macroblock according to an original quantization parameter corresponding to the first macroblock and the quantization parameter reduction amount; The adjusted quantization parameter corresponding to the first macroblock is used to encode the first macroblock, and the reduction amount of the quantization parameter is used to write into the bitstream.
13. The method according to any one of claims 1 to 11, characterized in that The method further comprises: Determining an inter-frame prediction cost and an intra-frame coding cost of the current video frame; determining a ratio of an inter-frame prediction cost to an intra-frame coding cost of the current video frame as a first ratio; or determining an average pixel inter-frame coding cost based on the inter-frame prediction cost of the current video frame and size information of the current video frame; Determining an average pixel intra-frame coding cost according to the intra-frame prediction cost of the current video frame and size information of the current video frame; The first ratio or the inter-frame coding cost of the average pixel point is used to determine the motion amplitude of the current video frame, and the intra-frame coding cost of the average pixel point is used to determine the texture complexity of the current video frame.
14. A video decoding method, characterized in that: The method comprises: Parsing a bitstream to determine an adjusted quantization parameter corresponding to a first macroblock in a current video frame, wherein the adjusted quantization parameter is determined based on an adjusted macroblock tree strength corresponding to the current video frame, wherein the adjusted macroblock tree strength is determined based on texture complexity and motion amplitude of the current video frame, and the first macroblock is any macroblock in the current video frame; The first macroblock is decoded according to the adjusted quantization parameter corresponding to the first macroblock.
15. The method according to claim 14, characterized in that When the motion amplitude of the current video frame is less than a first amplitude threshold and the texture complexity of the current video frame is less than a first complexity threshold, the adjusted macroblock tree strength corresponding to the current video frame is determined according to the original macroblock tree strength and a first increase, wherein the first increase is determined according to at least one of the texture complexity and the motion amplitude of the current video frame; or In at least one of the following cases: the motion amplitude of the current video frame is greater than or equal to a first amplitude threshold, and the texture complexity of the current video frame is greater than or equal to a first complexity threshold, the adjusted macroblock tree strength corresponding to the current video frame is determined based on the original macroblock tree strength and a first reduction amount, wherein the first reduction amount is determined at least based on the texture complexity of the current video frame.
16. The method according to claim 14 or 15, characterized in that The parsing of the code stream to determine the adjusted quantization parameter corresponding to the first macroblock in the current video frame includes: Parsing the bitstream to obtain a quantization parameter reduction corresponding to a first macroblock in a current video frame, wherein the quantization parameter reduction is determined according to an importance of the first macroblock and an adjusted macroblock tree strength corresponding to the current video frame; An adjusted quantization parameter corresponding to the first macroblock is determined according to the quantization parameter reduction amount corresponding to the first macroblock and its original quantization parameter.
17. A video encoding device, characterized in that: The device comprises: A first determining module is configured to determine an adjusted macroblock tree strength corresponding to the current video frame according to texture complexity and motion amplitude of the current video frame; A second determining module is configured to determine an adjusted quantization parameter of a first macroblock in the current video frame according to the adjusted macroblock tree strength corresponding to the current video frame, wherein the first macroblock is any macroblock in the current video frame; The encoding module is configured to encode the first macroblock according to the adjusted quantization parameter corresponding to the first macroblock.
18. A video decoding device, characterized in that: The device comprises: a parsing module, configured to parse a bitstream and determine an adjusted quantization parameter corresponding to a first macroblock in a current video frame, wherein the adjusted quantization parameter is determined based on an adjusted macroblock tree strength corresponding to the current video frame, wherein the adjusted macroblock tree strength is determined based on texture complexity and motion amplitude of the current video frame, and the first macroblock is any macroblock in the current video frame; A decoding module is configured to decode the first macroblock according to the adjusted quantization parameter corresponding to the first macroblock.
19. An electronic device comprising a processor and a memory; The memory is used to store computer programs; The processor is configured to execute the computer program to implement the video encoding method as described in any one of claims 1 to 13, or to implement the video decoding method as described in any one of claims 14 to 16.
20. A computer-readable storage medium, characterized in that For storing computer programs; The computer program enables a computer to execute the video encoding method according to any one of claims 1 to 13, or to execute the video decoding method according to any one of claims 14 to 16.