Method and apparatus for determining coding mode
By replacing RDcost with absolute transform error and SATD, and combining rate distortion influence parameters, the selection of encoding mode is simplified, the problem of high encoding complexity is solved, and encoding efficiency and accuracy are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ALIBABA (CHINA) CO LTD
- Filing Date
- 2022-03-22
- Publication Date
- 2026-05-19
AI Technical Summary
In current video encoding processes, the selection of encoding modes is complex and affects encoding efficiency.
The absolute transform error and SATD are used to replace the rate distortion optimization cost RDcost, and the rate distortion influence parameter is combined to simplify the coding mode selection process.
It reduces the encoding complexity of the encoder, improves encoding efficiency and accuracy, and enhances encoding performance.
Smart Images

Figure CN114760467B_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of video processing technology in one or more embodiments, and more particularly to a method and apparatus for determining an encoding mode. Background Technology
[0002] In related technologies, a video sequence can be encoded into a compressed bitstream by an encoder and then transmitted to a decoder at the receiving end. The encoder's encoding process, when encoding video images in a video sequence, may include: dividing the video images into non-overlapping coding units (CUs), performing intra-frame coding or inter-frame coding on these CUs to obtain predicted image blocks, obtaining prediction residuals based on the predicted image blocks, and then processing the prediction residuals using discrete cosine transform, quantization, entropy coding, etc., to obtain the compressed bitstream.
[0003] In the aforementioned encoding process, when encoding a CU, the encoder first determines the encoding mode of the CU, and then performs encoding according to the determined encoding mode. For a CU, there are multiple encoding modes to choose from. Usually, the rate-distortion optimization cost (RDcost) of these encoding modes can be calculated, and the mode with the smaller RDcost is selected as the preferred encoding mode. However, in practice, it has been found that the selection process of the encoding mode is quite complex, which affects the encoding efficiency. Summary of the Invention
[0004] In view of this, one or more embodiments of this specification provide a method and apparatus for determining an encoding mode.
[0005] To achieve the above objectives, one or more embodiments of this specification provide the following technical solutions:
[0006] According to a first aspect of one or more embodiments of this specification, a method for determining an encoding pattern is provided, the method comprising:
[0007] Obtain the rate-distortion optimization cost (RDcost) of the first coding mode and the absolute transform error (SATD) of the second coding mode;
[0008] Based on the SATD and rate-distortion impact parameters, the estimated coding cost of the second coding mode is obtained; the rate-distortion impact parameters are used to represent the correlation parameters of the RDcost of the second coding mode.
[0009] In response to the fact that the RDcost of the first coding mode is less than the estimated coding cost of the second coding mode, the first coding mode is selected as the mode used to encode the target coding unit.
[0010] According to a second aspect of one or more embodiments of this specification, an apparatus for determining an encoding pattern is provided, the apparatus comprising:
[0011] The cost acquisition module is used to acquire the rate-distortion optimization cost RDcost of the first coding mode and the absolute transform error and SATD of the second coding mode;
[0012] The cost adjustment module is used to obtain the estimated coding cost of the second coding mode based on the SATD and the rate-distortion impact parameter; the rate-distortion impact parameter is used to represent the correlation parameter of the RDcost of the second coding mode;
[0013] The mode determination module is used to select the first encoding mode as the mode used to encode the target encoding unit in response to the fact that the RDcost of the first encoding mode is less than the estimated encoding cost of the second encoding mode.
[0014] According to a third aspect of one or more embodiments of this specification, an electronic device is provided, the device comprising:
[0015] processor;
[0016] Memory used to store processor-executable instructions;
[0017] The processor executes the executable instructions to implement the encoding mode determination method of any embodiment of this specification.
[0018] According to a fourth aspect of one or more embodiments of this specification, a computer-readable storage medium is provided that stores computer instructions thereon, which, when executed by a processor, implement a method for determining an encoding mode according to any embodiment of this specification.
[0019] According to a fifth aspect of one or more embodiments of this specification, a method for selecting an inter-frame predictive coding mode is provided, the method comprising:
[0020] Obtain the RDcost of the first inter-frame predictive coding mode and the SATD of the second inter-frame predictive coding mode;
[0021] Based on the SATD and rate-distortion impact parameters, the estimated coding cost of the second inter-frame predictive coding mode is obtained; the rate-distortion impact parameters are used to represent the correlation parameters of the RDcost of the inter-frame predictive coding mode.
[0022] If the RDcost of the first inter-frame predictive coding mode is less than the estimated coding cost of the second inter-frame predictive coding mode, the first inter-frame predictive coding mode is selected as the inter-frame predictive coding mode for the target coding unit.
[0023] The method and apparatus for determining the encoding mode in the embodiments of this specification replace the RDcost cost with the SATD cost of the second encoding mode in the cost comparison between modes, and directly select the first encoding mode for encoding when the RDcost of the first encoding mode is less than the estimated encoding cost of the second encoding mode. This eliminates the need to calculate the RDcost of the second encoding mode, thus avoiding the high-complexity RDO process for the second encoding mode, thereby reducing the encoding complexity of the encoder and improving the encoding efficiency. Furthermore, the estimated encoding cost of the second encoding mode is not only based on SATD, but also incorporates a rate-distortion influence parameter that affects the calculation of the RDcost of the second encoding mode. This makes the estimated encoding cost more accurately reflect the RDcost of the second encoding mode, which helps to make the cost comparison results between modes more accurate, thereby making the selection of the encoding mode more accurate and improving the encoding performance. This achieves the goal of improving encoding performance as much as possible while reducing encoding complexity and improving encoding efficiency. Attached Figure Description
[0024] To more clearly illustrate the technical solutions in one or more embodiments or related technologies of this disclosure, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments recorded in one or more embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0025] Figure 1 This is an exemplary embodiment of a video sequence structure;
[0026] Figure 2 This is a schematic diagram of an encoding process provided in an exemplary embodiment;
[0027] Figure 3 This is a schematic diagram of a decoding process provided in an exemplary embodiment;
[0028] Figure 4 This is a flowchart illustrating a method for determining an encoding mode, as provided in an exemplary embodiment.
[0029] Figure 5 This is a flowchart of another method for determining an encoding mode provided in an exemplary embodiment;
[0030] Figure 6 This is a schematic diagram showing the positions of five adjacent coding units provided in an exemplary embodiment;
[0031] Figure 7 This is a schematic diagram of the structure of an encoding mode determination device provided in an exemplary embodiment;
[0032] Figure 8 This is a flowchart illustrating an inter-frame predictive coding mode selection method provided in an exemplary embodiment. Detailed Implementation
[0033] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with one or more embodiments of this specification. Rather, they are merely examples of apparatuses and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.
[0034] It should be noted that the steps of the corresponding methods are not necessarily performed in the order shown and described in this specification in other embodiments. In some other embodiments, the methods may include more or fewer steps than described in this specification. Furthermore, a single step described in this specification may be broken down into multiple steps in other embodiments; and multiple steps described in this specification may be combined into a single step in other embodiments.
[0035] Video is a collection of still images (which may be called "frames") arranged in a time sequence, used to store visual information. Video capture devices (e.g., cameras) can be used to capture and store these images in a time sequence, and video playback devices (e.g., televisions, computers, smartphones, tablets, video players, or any end-user terminal with a display function) can be used to display such images in a time sequence. Furthermore, in some applications, video capture devices can transmit the captured video in real time to video playback devices (e.g., computers), such as for conferencing, live broadcasting, etc.
[0036] To reduce the storage space and transmission bandwidth required for such applications, video can be compressed before storage and transmission, and decompressed before display. Compression and decompression can be implemented by software executed by a processor (e.g., a processor in a general-purpose computer) or dedicated hardware. The compression module is generally called an "encoder," and the decompression module is generally called a "decoder." Encoders and decoders can be collectively referred to as "codecs." Encoders and decoders can be implemented as any of a variety of suitable hardware, software, or combinations thereof. For example, hardware implementations of encoders and decoders can include circuits such as one or more microprocessors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), discrete logic, or any combination thereof. Software implementations of encoders and decoders can include program code, computer-executable instructions, firmware, or any suitable computer-implemented algorithm or process embedded in a computer-readable medium. Video compression and decompression can be implemented using various algorithms or standards such as MPEG-1, MPEG-2, MPEG-4, H.26x series, etc. In some applications, a codec can decompress video according to a first coding standard and recompress the decompressed video using a second coding standard. In this case, the codec can be called a "transcoder".
[0037] Video encoding identifies and retains useful information that can be used to reconstruct images, while ignoring information that is not important for reconstruction. If the ignored, unimportant information cannot be fully reconstructed, such an encoding process can be called "lossy." Otherwise, it can be called "lossless." Most encoding processes are lossy, a trade-off to reduce required storage space and transmission bandwidth.
[0038] Useful information about the image being encoded (referred to as the "current image") includes changes relative to a reference image (e.g., a previously encoded and reconstructed image). Such changes can include changes in pixel position, brightness, or color, with positional changes being the most important. The positional changes of a set of pixels representing an object can reflect the object's movement between the reference image and the current image.
[0039] An image encoded without referencing another image (i.e., it is its own reference image) is called an "I-image". An image encoded using a previous image as a reference image is called a "P-image". An image encoded using both a previous image and a future image as reference images (i.e., the reference is "bidirectional") is called a "B-image".
[0040] Figure 1The structure of an example video sequence 100 according to some embodiments of the present disclosure is illustrated. The video sequence 100 may be live video or video that has been captured and archived. The video 100 may be real-world video, computer-generated video (e.g., computer game video), or a combination thereof (e.g., real-world video with augmented reality effects). The video sequence 100 may be input from a video capture device (e.g., a camera), a video archive containing previously captured video (e.g., a video file stored on a storage device), or a video feed interface (e.g., a video broadcast transceiver) that receives video from a video content provider.
[0041] like Figure 1 As shown, video sequence 100 may include a series of images arranged temporally along a timeline, including images 102, 104, 106, and 108. Images 102 to 106 are consecutive, and there are more images between images 106 and 108. Figure 1 In this diagram, image 102 is an I-image, and its reference image is image 102 itself. Image 104 is a P-image, and its reference image is image 102, as indicated by the arrow. Image 106 is a B-image, and its reference images are images 104 and 108, as indicated by the arrow. In some embodiments, the reference image of an image (e.g., image 104) may not immediately precede or follow that image. For example, the reference image of image 104 may be an image preceding image 102. It should be noted that the reference images of images 102 to 106 are merely examples, and this disclosure does not limit the implementation of the reference images to specific cases. Figure 1 The example shown.
[0042] Typically, due to the computational complexity of these tasks, video codecs do not encode or decode the entire image at once. Instead, they divide the image into basic segments and encode or decode the image segment by segment. These basic segments are referred to herein as basic processing units (“BPUs”). For example, Figure 1Structure 110 illustrates an example structure of a picture (e.g., any of pictures 102 through 108) of video sequence 100. In structure 110, the picture is divided into 4×4 basic processing units, the boundaries of which are shown as dashed lines. In some implementations, the basic processing unit may be referred to as a "macroblock" in some video coding standards (e.g., MPEG series, H.261, H.263, or H.264 / AVC), or as a "coding tree unit" (CTU) in some other video coding standards (e.g., H.265 / HEVC or H.266 / VVC). Within a picture, the basic processing unit can have a variable size, such as 128×128, 64×64, 32×32, 16×16, 4×8, 16×32, or any arbitrary shape and size of pixels. The size and shape of the basic processing units for a picture can be chosen based on a balance between coding efficiency and the level of detail to be preserved within the basic processing unit.
[0043] A basic processing unit can be a logical unit that may include a set of different types of video data stored in computer memory (e.g., in a video frame buffer). For example, a basic processing unit for a color image may include a luminance component (Y) representing non-color luminance information, one or more chrominance components (e.g., Cb and Cr) representing color information, and associated syntax elements, wherein the luminance and chrominance components may have the same size as the basic processing unit. In some video coding standards (e.g., H.265 / HEVC or H.266 / VVC), the luminance and chrominance components may be referred to as "code tree blocks" ("CTBs"). Any operation performed on a basic processing unit may be repeated on each of its luminance and chrominance components.
[0044] Video coding has multiple operational stages, examples of which will be detailed later. For each stage, the size of the basic processing unit may still be too large to process, and therefore can be further subdivided. These segments are referred to herein as "basic processing subunits." In some embodiments, the basic processing subunit may be referred to as a "block" in some video coding standards (e.g., MPEG series, H.261, H.263, or H.264 / AVC), or as a "coding unit" ("CU") in some other video coding standards (e.g., H.265 / HEVC or H.266 / VVC). Basic processing subunits may have the same or smaller size as basic processing units. Similar to basic processing units, basic processing subunits are also logical units that may include a set of different types of video data (e.g., Y, Cb, Cr, and associated syntactic elements) stored in computer memory (e.g., stored in a video frame buffer). Any operation performed on a basic processing subunit can be repeated on each of its luminance and chrominance components. It should be noted that this subdivision can be extended to deeper levels as needed for processing. It should also be noted that different schemes can be used to divide the basic processing units at different stages.
[0045] Figure 2 A schematic diagram illustrating an example encoding process according to some embodiments of the present disclosure is provided, such as... Figure 2 As shown, the encoder can encode the video sequence 202 into a video bitstream 228 according to process 200B. Similar to... Figure 1 In structure 110, the original images of video sequence 202 can be divided into basic processing units, basic processing sub-units, or regions by the encoder for processing. Figure 2In this process, the encoder feeds the basic processing unit (referred to as the "raw BPU") of the original image of video sequence 202 to the prediction stage to generate prediction data 206 and prediction BPU 208. The encoder can subtract prediction BPU 208 from the raw BPU to generate residual BPU 210. The encoder can feed residual BPU 210 to transform stage 212 and quantization stage 214 to generate quantization transform coefficients 216. The encoder can feed prediction data 206 and quantization transform coefficients 216 to binary encoding stage 226 to generate video bitstream 228. Components 202, prediction stage, 206, 208, 210, 212, 214, 216, 226, and 228 can be referred to as the "forward path". During process 200B, after quantization stage 214, the encoder can feed quantization transform coefficients 216 to inverse quantization stage 218 and inverse transform stage 220 to generate reconstructed residual BPU 222. The encoder can add the reconstruction residual BPU 222 to the prediction BPU 208 to generate a prediction reference 224, which is used in the next iteration of process 200B during prediction phase 204. The components 218, 220, 222, and 224 of process 200B can be referred to as "reconstruction paths." Reconstruction paths are used to ensure that the encoder and decoder use the same reference data for prediction.
[0046] The prediction phase described above can include spatial prediction and temporal prediction. Spatial prediction (e.g., intra-image prediction or "intra-prediction") can use pixels from one or more already encoded neighboring BPUs in the same image to predict the current BPU. Spatial prediction can reduce the inherent spatial redundancy of images. Temporal prediction (e.g., inter-image prediction or "inter-prediction") can use regions from one or more already encoded images to predict the current BPU. Temporal prediction can reduce the inherent temporal redundancy of images.
[0047] Reference process 200B, in the forward path, the encoder performs prediction operations in the spatial prediction phase 2042 and the temporal prediction phase 2044. For example, in the spatial prediction phase 2042, the encoder may perform intra-frame prediction. For the original BPU of the image being encoded, prediction reference 224 may include one or more adjacent BPUs in the same image that have been encoded (in the forward path) and reconstructed (in the reconstruction path). The encoder can generate predicted BPU 208 by extrapolating adjacent BPUs.
[0048] For example, in the temporal prediction phase 2044, the encoder can perform inter-frame prediction. For the original BPU of the current image, the prediction reference 224 may include one or more images (referred to as "reference images") that have been encoded (in the forward path) and reconstructed (in the reconstruction path). In some implementations, the reference image may be generated by encoding and reconstructing the BPU. For example, the encoder may add the reconstructed residual BPU 222 to the prediction BPU 208 to generate a reconstructed BPU. When all reconstructed BPUs for the same image are generated, the encoder can generate the reconstructed image as the reference image. The encoder can perform a "motion estimation" operation to search for matching regions within the range of the reference image (referred to as a "search window"). The position of the search window in the reference image may be determined based on the position of the original BPU in the current image.
[0049] Motion estimation can be used to identify various types of motion, such as translation, rotation, scaling, etc. For inter-frame prediction, prediction data 206 may include, for example, the location (e.g., coordinates) of the matching region, the motion vector associated with the matching region, the number of reference images, the weights associated with the reference images, etc.
[0050] Referring again to the forward path of process 200B, after spatial prediction 2042 and temporal prediction stages 2044, in the mode determination stage 230, the encoder can select a prediction mode (e.g., one of intra-frame prediction or inter-frame prediction) for the current iteration of process 200B. For example, the encoder can perform rate-distortion optimization techniques, whereby the encoder selects a prediction mode based on the bit rate of the candidate prediction modes and the distortion of the reconstructed reference image in the candidate prediction modes to minimize the value of the cost function. Based on the selected prediction mode, the encoder can generate the corresponding prediction BPU 208 and prediction data 206.
[0051] In the reconstruction path of process 200B, if intra-prediction mode is selected in the forward path, after generating prediction reference 224 (e.g., the current BPU that has been encoded and reconstructed in the current image), the encoder can directly feed prediction reference 224 to spatial prediction stage 2042 for later use (e.g., for extrapolation of the next BPU in the current image). If inter-prediction mode is selected in the forward path, after generating prediction reference 224 (e.g., the current image where all BPUs have been encoded and reconstructed), the encoder can feed prediction reference 224 to loop filter stage 232. In loop filter stage 232, the encoder can apply loop filters to prediction reference 224 to reduce or eliminate distortions introduced by inter-prediction (e.g., blocking artifacts). The encoder can apply various loop filter techniques in loop filter stage 232, such as deblocking, sample adaptive shifting, adaptive loop filtering, etc. The loop filter reference image can be stored in buffer 234 (or "decoded image buffer") for later use (e.g., as an inter-frame prediction reference image to be used as future images of video sequence 202). The encoder can store one or more reference images in buffer 234 for use in the time prediction stage 2044. In some embodiments, the encoder can encode the parameters of the loop filter (e.g., loop filter strength), as well as the quantization transform coefficients 216, the prediction data 206, and other information in the binary encoding stage 226.
[0052] The encoder can iteratively execute process 200B to encode each raw BPU of the original image (in the forward path) and generate a prediction reference 224 (in the reconstruction path) for encoding the next raw BPU of the original image. After encoding all raw BPUs of the original image, the encoder can continue to encode the next image in the video sequence 202.
[0053] Referring to process 200B, the encoder may receive a video sequence 202 generated by a video capture device (e.g., a camera). As used herein, the term "receive" may refer to any action, in any manner, of receiving, inputting, acquiring, retrieving, obtaining, reading, accessing, or relating to input data.
[0054] In prediction phase 204, during the current iteration, the encoder may receive the original BPU and prediction reference 224 and perform prediction operations to generate prediction data 206 and prediction BPU 208. Prediction reference 224 may be generated based on the reconstruction path of a previous iteration of process 200A. The purpose of prediction phase 204 is to reduce information redundancy by extracting prediction data 206, which can be used to reconstruct the original BPU into prediction BPU 208 based on prediction data 206 and prediction reference 224.
[0055] To further compress the residual BPU 210, in the transform stage 212, the encoder can reduce its spatial redundancy by decomposing the residual BPU 210 into a set of two-dimensional “basic patterns,” each basic pattern being associated with a “transform coefficient.” Different transform algorithms can use different basic patterns. Various transform algorithms can be used in the transform stage 212, such as discrete cosine transform, discrete sine transform, etc. The transform at transform stage 212 is reversible. That is, the encoder can recover the residual BPU 210 through the inverse operation of the transform (called the “inverse transform”). The encoder can record only the transform coefficients, and the decoder can reconstruct the residual BPU 210 based on the transform coefficients without receiving the basic patterns from the encoder. Compared to the residual BPU 210, the transform coefficients can have fewer bits, but they can be used to reconstruct the residual BPU 210 without significantly degrading the quality. Therefore, the residual BPU 210 is further compressed.
[0056] The encoder can further compress the transform coefficients in the quantization stage 214. The quantization process is also reversible, whereby the quantized transform coefficients 216 can be reconstructed into transform coefficients in the inverse operation of quantization (called "inverse quantization").
[0057] In the binary encoding stage 226, the encoder may encode the prediction data 206 and the quantization transform coefficients 216 using binary encoding techniques such as entropy coding, variable-length coding, arithmetic coding, Huffman coding, context-adaptive binary arithmetic coding, or any other lossless or lossy compression algorithm. In some embodiments, in addition to the prediction data 206 and the quantization transform coefficients 216, the encoder may also encode other information in the binary encoding stage 226, such as the prediction mode used in the prediction stage 204, the parameters of the prediction operation, the transform type in the transform stage 212, the parameters of the quantization process (e.g., quantization parameters), encoder control parameters (e.g., bitrate control parameters), etc. The encoder may use the output data of the binary encoding stage 226 to generate a video bitstream 228. In some embodiments, the video bitstream 228 may be further packaged for network transmission.
[0058] Figure 3 A schematic diagram illustrating an example decoding process according to some embodiments of the present disclosure is provided, such as... Figure 3 As shown, process 300B can be corresponding to Figure 2 The compression process in the 200B is the decompression process.
[0059] The decoder can feed a portion of the video bitstream 228 associated with a basic processing unit (referred to as an "encoded BPU") of the encoded image to binary decoding stage 302. In binary decoding stage 302, the decoder can decode this portion into prediction data 206 and quantization transform coefficients 216. The decoder can feed the quantization transform coefficients 216 to inverse quantization stage 218 and inverse transform stage 220 to generate a reconstructed residual BPU 222. The decoder can feed the prediction data 206 to the prediction stage to generate a prediction BPU 208. The decoder can add the reconstructed residual BPU 222 to the prediction BPU 208 to generate a prediction reference 224. In some embodiments, the prediction reference 224 can be stored in a buffer (e.g., a decoded image buffer in computer memory). The decoder can feed the prediction reference 224 to the prediction stage to perform a prediction operation in the next iteration of process 300B.
[0060] The decoder can iteratively execute process 300A to decode each encoded BPU of the encoded image and generate a prediction reference 224 for encoding the next encoded BPU of the encoded image. After decoding all encoded BPUs of the encoded image, the decoder can output the image to video stream 304 for display and continue decoding the next encoded image in video bitstream 228.
[0061] In process 300B, the prediction stage is divided into a spatial prediction stage 2042 and a temporal prediction stage 2044, and the reconstruction path includes a loop filter stage 232 and a buffer section 234.
[0062] For the encoded basic processing unit (referred to as the "current BPU") of the encoded image being decoded (referred to as the "current image"), the prediction data 206 decoded by the decoder from the binary decoding stage 302 can include various types of data, depending on the prediction mode used by the encoder to encode the current BPU. For example, if the encoder uses intra-frame prediction to encode the current BPU, the prediction data 206 can include prediction mode indicators (e.g., flag values) indicating intra-frame prediction, parameters for the intra-frame prediction operation, etc. For example, parameters for the intra-frame prediction operation can include the positions (e.g., coordinates) of one or more neighboring BPUs used as references, the sizes of neighboring BPUs, extrapolation parameters, the orientations of neighboring BPUs relative to the original BPU, etc. As another example, if the encoder uses inter-frame prediction to encode the current BPU, the prediction data 206 can include prediction mode indicators (e.g., flag values) indicating inter-frame prediction, parameters for the inter-frame prediction operation, etc. For example, the parameters of the inter-frame prediction operation may include the number of reference images associated with the current BPU, the weights associated with the reference images respectively, the positions (e.g., coordinates) of one or more matching regions in the corresponding reference images, and one or more motion vectors associated with the matching regions respectively.
[0063] Based on the prediction mode indicator, the decoder can decide whether to perform spatial prediction (e.g., intra-frame prediction) in the spatial prediction phase 2042 or temporal prediction (e.g., inter-frame prediction) in the temporal prediction phase 2044. Figure 2 The details of performing such spatial or temporal predictions have been described and will not be repeated here. After performing such spatial or temporal predictions, the decoder can generate prediction BPU 208. The decoder can then add prediction BPU 208 and the reconstructed residual BPU 222 to generate prediction reference 224.
[0064] In process 300B, the decoder can feed prediction reference 224 to spatial prediction stage 2042 or temporal prediction stage 2044 to perform prediction operations in the next iteration of process 300B. For example, if the current BPU is decoded using intra-frame prediction in spatial prediction stage 2042, the decoder can feed prediction reference 224 directly to spatial prediction stage 2042 after generating prediction reference 224 (e.g., the decoded current BPU) for later use (e.g., for extrapolating the next BPU of the current image). If the current BPU is decoded using inter-frame prediction in temporal prediction stage 2044, the encoder can feed prediction reference 224 to loop filter stage 232 after generating prediction reference 224 (e.g., a reference image of all BPUs that have been decoded) to reduce or eliminate distortion (e.g., blockiness). The decoder can... Figure 2The loop filter is applied to prediction reference 224 in the manner described. The loop-filtered reference image can be stored in buffer 234 (e.g., a decoded image buffer in computer memory) for later use (e.g., an inter-frame prediction reference image that will be used as a future encoded image for video bitstream 228). The decoder can store one or more reference images in buffer 234 for use in the temporal prediction stage 2044. In some embodiments, the prediction data can further include parameters of the loop filter (e.g., loop filter strength) when the prediction mode indicator of the prediction data 206 indicates that inter-frame prediction is used to encode the current BPU.
[0065] Figure 4 This is a flowchart illustrating a method for determining an encoding mode, provided in an exemplary embodiment. This method is applied to the encoder's selection of the encoding mode before encoding the CU. For example, inter-frame coding modes may include Skip mode, Merge mode, and AMVP mode, while intra-frame coding modes may include intra mode and IBC mode. The encoding mode selection process can be achieved by calculating the Rate Distortion Optimization (RDO) cost (RDcost) of the encoding mode and selecting the mode with the lower RDcost as the preferred encoding mode. However, the RDO process for most encoding modes is quite complex, affecting the encoder's coding efficiency.
[0066] The encoding mode determination method provided in the embodiments of this specification improves the encoding mode selection process, aiming to reduce encoding complexity, improve mode selection efficiency, and at the same time ensure high encoding performance as much as possible.
[0067] Before describing the method, let me first explain the concept behind it: Given that the RDO process of most coding modes is relatively complex, other costs of the coding mode can be used to replace RDcost in the cost comparison between modes. These other costs can be obtained more simply and quickly than the calculation process of RDcost, so as to speed up the mode selection process.
[0068] Taking the Merge pattern as an example, its RDO process requires processing the prediction residuals through discrete cosine transform, quantization, and entropy coding, which is quite complex. The SATD cost of the Merge pattern can be used to replace the RDcost calculation, as the SATD cost calculation is simpler and faster than the RDcost calculation. For instance, the RDcost of the Skip pattern and the SATD of the Merge pattern can be compared to determine which pattern to use for encoding. The reason for choosing the SATD cost of the Merge pattern to replace the RDcost is that there is a positive correlation between SATD and RDcost. For example, if the RDcost of the Skip pattern is much smaller than the SATD of the Merge pattern, then it can be concluded that the RDcost of the Skip pattern will also be smaller than the RDcost of the Merge pattern. Since the SATD calculation is simpler than the RDcost calculation, the SATD cost of the Merge pattern can be used to replace the RDcost in cost comparisons between patterns.
[0069] Figure 4 The method for determining the encoding mode illustrated can be performed by the encoder, specifically by selecting the mode when the encoder is encoding the CU. For example... Figure 4 As shown, the method may include the following processing:
[0070] In step 400, the RDcost of the first encoding mode and the SATD of the second encoding mode are obtained.
[0071] There are multiple options for the first encoding mode and the second encoding mode, and this embodiment does not limit the specific mode.
[0072] For example, these two modes can be two inter-frame coding modes, such as Skip mode and AMVP mode; or they can be two intra-frame coding modes, such as intra mode and IBC mode; or they can be one inter-frame mode and one intra-frame mode.
[0073] This embodiment takes the first encoding mode as Skip mode and the second encoding mode as Merge mode as an example.
[0074] Furthermore, in the aforementioned first and second coding modes, one coding mode can be selected to calculate SATD, while the other coding mode calculates RDcost. For example, since Skip mode does not require transformation or quantization of the residuals, the RDO process in Merge mode is more complex than that in Skip mode. Therefore, the RDcost of Skip mode can be calculated, and the SATD of Merge mode can be calculated. Alternatively, the calculation cost can be determined according to the order of the coding modes to be selected. For instance, if inter-frame coding modes precede intra-frame coding modes, the RDcost of inter-frame coding modes can be calculated, and the SATD of intra-frame coding modes can be calculated.
[0075] In step 402, the estimated coding cost of the second coding mode is obtained based on the SATD and the rate-distortion impact parameter; the rate-distortion impact parameter is used to represent the correlation parameter of the RDcost of the second coding mode.
[0076] In this step, in order to improve coding performance as much as possible while reducing the coding complexity of the encoder, after calculating SATD for the second coding mode, the estimated coding cost of the second coding mode is obtained by combining the SATD and the rate-distortion influence parameter. The following formula (1) is used:
[0077] Estimated coding cost = SATD + rate-distortion effect parameter……….(1)
[0078] Among them, the rate-distortion impact parameter can be a related parameter that affects the RDcost calculation of the second coding mode.
[0079] Specifically, as conceived in the embodiments of this specification mentioned above, the SATD of the second encoding mode can replace RDcost in the cost comparison between modes. For example, if the RDcost of the Skip mode is much smaller than the SATD of the Merge mode, then it can be inferred that the RDcost of the Skip mode will also be smaller than the RDcost of the Merge mode.
[0080] In other words, see the following cost comparison methods:
[0081] Standard approach: Compare the RDcost of the first encoding mode with the RDcost of the second encoding mode.
[0082] Alternative method 1: Compare the "RDcost of the first encoding mode" with the "SATD of the second encoding mode";
[0083] Alternative approach 2: Compare the "RD cost of the first coding scheme" with the "estimated coding cost of the second coding scheme".
[0084] When using the second alternative method described above, the comparison result is closer to the standard method. For example, suppose that if the standard method is used, the comparison result is that "RDcost of the first coding mode" is less than "RDcost of the second coding mode," and therefore the first coding mode should be selected as the preferred mode. However, if the first alternative method is used, the comparison result might be the opposite, that is, "RDcost of the first coding mode" might be greater than "SATD of the second coding mode," thus concluding that the second coding mode should be selected as the preferred mode. But if the second alternative method is used, the comparison result might be that "RDcost of the first coding mode" is less than "estimated coding cost of the second coding mode," thus selecting the first coding mode as the preferred mode. As mentioned above, when using "estimated coding cost of the second coding mode" compared to "SATD of the second coding mode" in the mode cost comparison, the comparison result is more accurate. The improved accuracy of the comparison result can help to more accurately select the preferred coding mode, thereby improving coding performance.
[0085] The rate-distortion impact parameter refers to the parameter affecting the calculation of the RDcost of the second coding mode. Introducing this rate-distortion impact parameter based on the calculation of the SATD of the second coding mode will make the obtained estimated coding cost closer to the RDcost of the second coding mode.
[0086] For example, taking the Merge mode as the second coding mode, a quantization step size Qstep can be introduced into the calculation of the SATD of the Merge mode. For instance, the RDO process of the Merge mode requires transformation, quantization, and entropy coding of the prediction residuals. The quantization parameter Qstep used in the quantization process will affect the RDcost of the Merge mode. Therefore, Qstep can be called the rate-distortion impact parameter affecting the calculation of the RDcost of the Merge mode. Using "SATD + Qstep" as the estimated coding cost of the Merge mode for cost comparison will be more accurate.
[0087] For example, consider a Skip mode as the first encoding pattern and an AMVP mode as the second encoding pattern. Since the RDO process of the AMVP mode is more complex than that of the Skip mode, the RDcost of the Skip mode can be calculated, and the SATD of the AMVP mode can be calculated. After obtaining the SATD of the AMVP mode, the estimated encoding cost of the AMVP mode can be calculated using the following formula (2):
[0088] Estimating encoding cost AMVP =SATD AMVP +Qstep AMVP +MV AMVP ……….(2)
[0089] In the above formula, the rate-distortion impact parameters of the AMVP mode can include Qstep and MV. AMVP Both the Motion Vector and the Motion Vector parameter can affect the RDcost value in AMVP mode. MV is used to characterize the intensity of motion of objects in the previous and next frames.
[0090] In one example, when determining the estimated coding cost of the second coding mode based on the SATD and rate-distortion impact parameters, weighting coefficients can be set for SATD and rate-distortion impact parameters respectively, so that the two are weighted and added together. For example, see the following formula (3):
[0091] Estimated coding cost = α * SATD + β * rate distortion effect parameter……….(3)
[0092] In this embodiment, α can be called the first weighting coefficient, β can be called the second weighting coefficient, "α*SATD" can be called the adjusted SATD, and "β*rate distortion effect parameter" can be called the adjusted rate distortion effect parameter. This embodiment does not limit the values of α and β; for example, α can be 0.1 and β can be 0.3.
[0093] This embodiment does not limit the specific form of formula (3), and it can be changed in specific implementations. For example, α and β can be in the form of quadratic powers, or α and β can also be adjusted for costs in other forms.
[0094] In step 404, in response to the fact that the RDcost of the first coding mode is less than the estimated coding cost of the second coding mode, the first coding mode is selected as the mode used to encode the target coding unit.
[0095] In this step, the RDcost of the first encoding mode obtained in step 400 can be compared with the estimated encoding cost of the second encoding mode obtained in step 402. If the RDcost of the first encoding mode is less than the estimated encoding cost of the second encoding mode, then the first encoding mode can be selected as the mode for encoding the CU. For example, if the RDcost of skip is less than the estimated encoding cost of merge, the skip mode can be selected as the mode for encoding the CU.
[0096] Furthermore, if the RD cost of the first coding mode is greater than the estimated coding cost of the second coding mode, the RD cost of the second coding mode can be calculated, and then the RD costs of the first and second coding modes can be compared. The mode with the smaller RD cost is selected as the coding mode for the CU. For example, if the RD cost of skip is greater than the estimated coding cost of merge, the RD cost of merge can be calculated, and the mode with the smaller RD cost is selected as the preferred coding mode for the CU.
[0097] Furthermore, in another example, if the RDcost of the first coding mode is less than the estimated coding cost of the second coding mode, the difference between the two can be calculated, for example, by calculating "estimated coding cost - RDcost". This difference is then compared with a preset difference threshold x. If the difference is greater than or equal to the difference threshold x, the first coding mode is determined as the mode to be used for coding the CU. If the difference is less than the difference threshold x, the RDcost of the second coding mode can be calculated, and then the RDcosts of the first and second coding modes can be compared. The mode with the smaller RDcost is selected as the mode for coding the CU. This helps to make the cost comparison results more accurate.
[0098] The encoding mode determination method in this embodiment replaces the RDcost cost with the SATD cost for the second encoding mode, which has a higher RDO process complexity, in the cost comparison between modes. When the RDcost of the first encoding mode is less than the estimated encoding cost of the second encoding mode, the first encoding mode is directly selected for encoding. This eliminates the need to calculate the RDcost of the second encoding mode, thus avoiding the execution of the complex RDO process for the second encoding mode and reducing the encoding complexity of the encoder. Furthermore, the estimated encoding cost of the second encoding mode is not only based on SATD but also incorporates rate-distortion influence parameters that affect the calculation of the RDcost of the second encoding mode. This allows the estimated encoding cost to more accurately reflect the RDcost of the second encoding mode, which helps to make the cost comparison results between modes more accurate. Consequently, the selection of the encoding mode is more accurate, improving encoding performance. This achieves the goal of improving encoding performance as much as possible while reducing encoding complexity and increasing encoding efficiency.
[0099] Figure 5 This is a flowchart illustrating another method for determining an encoding mode, provided in an exemplary embodiment. In this embodiment, the selection of the skip mode and the merge mode is used as an example to describe the mode selection method. However, it is understood that this method can also be applied to the selection between other two modes. Figure 5 As shown, the method may include the following processing:
[0100] In step 500, the initial RDcost for skip mode and the initial SATD for merge mode are obtained.
[0101] In this step, the initial RDcost of the skip mode and the initial SATD of the merge mode can be calculated in the same way as the conventional SATD and RDcost calculation methods, which will not be repeated in this embodiment.
[0102] For example, the RDcost for the skip mode is calculated using the conventional RDcost method. To distinguish it from the RDcost appearing in subsequent steps, this RDcost is referred to here as the initial RDcost. The RDcost appearing in subsequent steps is obtained by scaling and normalizing this initial RDcost. Similarly, the initial SATD for the merge mode is also obtained using the conventional SATD calculation method.
[0103] For example, in this step, the initial SATD of the Merge pattern can be calculated first, and then the initial RDcost of the Skip pattern can be calculated.
[0104] In step 502, the initial RDcost and initial SATD are normalized based on the size of the target coding unit to obtain the RDcost of the first coding mode and the SATD of the second coding mode.
[0105] The target coding unit can be the CU to be encoded.
[0106] This embodiment can normalize the initial RDcost and initial SATD to the same dimension based on the size of the CU. By normalizing based on the CU size, the coding cost value at a single pixel can be reflected, thereby minimizing the influence of the CU size on the cost value and making the cost comparison results more accurate.
[0107] For example, the initial RDcost and initial SATD mentioned above can be normalized according to the following formulas (4) and (5):
[0108]
[0109]
[0110] As mentioned above, CUsize is the size of the target coding unit, SATD is the initial SATD, skip_RDcost is the initial RDcost, and SATD... scale That is, the SATD of the Merge pattern is obtained by normalizing the initial SATD according to formula (4). Similarly, skip_RDcost scaleThat is, the RDcost of the skip pattern is obtained by normalizing the initial RDcost according to formula (5).
[0111] In step 504, the encoding modes corresponding to at least one associated encoding unit of the target encoding unit are obtained, wherein the associated encoding unit and the target encoding unit have encoding correlation in the time domain or the spatial domain.
[0112] In this embodiment, after obtaining the RDcost of the first coding mode and the SATD of the second coding mode, the cost comparison between modes can be performed according to the following formula (6):
[0113] skip_RDcost scale <α*SATD scale +β*Q step ……(6)
[0114] In subsequent steps of this embodiment, it can be determined whether the above formula (6) holds true. For example, α can be 0.1, and β can be 0.01 + offset. The above α can be called the first weighting coefficient, and β can be called the second weighting coefficient. The rate distortion influence parameter in this embodiment is Q. step “β*Q step "That is, the adjustment rate distortion effect parameter, "α*SATD" scale That is, adjust SATD, "α*SATD" scale +β*Q step "That is, the estimated coding cost of the second coding mode Merge."
[0115] Therefore, the value of the second weighting coefficient β can be determined through steps 504 to 508. As shown above, the value of β can be 0.01 + offset, and the value of offset needs to be determined first.
[0116] In this step, the coding modes corresponding to at least one associated coding unit of the target coding unit can be obtained. Here, the associated coding unit refers to a CU that has a coding correlation with the target coding unit in the temporal or spatial domain.
[0117] For example, within the same coding layer, a CU (Coding Unit) closer to a target coding unit is more likely to use the same coding mode as that target coding unit. That is, CUs within a certain distance of the target coding unit are likely to use the same coding mode. These CUs can be called adjacent coding units, and they have spatial coding correlation with the target coding unit. Referring to the coding modes of these adjacent coding units when determining the coding mode of the target coding unit helps to make the determination of the target coding unit's mode more accurate. For example, if the four adjacent coding units of the target coding unit all use the skip mode, then there is a high probability that the target coding unit should also use the skip mode.
[0118] Figure 6 The example illustrates the positions of five adjacent coding units, including the CU located to the left (L), above (A), upper left (AL), lower left (BL), and upper right (AR) of the current CU (target coding unit). Of course, this embodiment does not limit the number and position of adjacent coding units; for example, the number of adjacent coding units could be three, and the positions could also be... Figure 6 Other positions besides the indicated position, such as the CU to the left of L, can also be called adjacent coding units.
[0119] For example, an associated coding unit can also be the parent coding unit of the target coding unit in the preceding coding layer. For instance, a 64*64 CU, after being segmented into a 32*32 CU, is the target coding unit, and the 64*64 CU is the parent CU of its preceding coding layer, meaning it is segmented from the parent CU. Optionally, the parent CU of the preceding coding layer of the target coding unit can be referenced, or the parent CUs of the previous two coding layers can be referenced. For example, a 64*64 CU, after being segmented into a 32*32 CU, and this 32*32 CU is further segmented into a 16*16 CU. If this 16*16 CU is called the target coding unit, then the 32*32 CU and the 64*64 CU are the parent CUs of its previous two coding layers.
[0120] For example, an associated coding unit can also be a temporal co-occurring block of the target coding unit. This temporal co-occurring block is the CU at the same position in the previous image frame where the target coding unit is located in the current image frame. This takes into account the temporal correlation of the coding. Similarly, the temporal co-occurring block is also highly likely to use the same coding mode as the target coding unit. In addition, the number of temporal co-occurring blocks can also be one or more. For example, it can refer to the CU at the same position in the previous image frame, which is one temporal co-occurring block; or it can refer to the CU at the same position in the previous two image frames, which is two temporal co-occurring blocks.
[0121] In this step, when obtaining at least one associated coding unit of the target coding unit, this at least one associated coding unit may include at least one of the above-mentioned adjacent coding units, parent CU, and time-domain co-occurring blocks. For example, assuming that the coding mode of 5 associated coding units is to be obtained, these 5 associated coding units may include the following components:
[0122] For example, the five associated coding units can include five adjacent coding units, such as Figure 6 The indicated location.
[0123] For example, the five associated coding units may include four adjacent coding units and one parent CU.
[0124] For example, the five associated coding units may include three adjacent coding units, one parent CU, and one time-domain co-occurrence block.
[0125] Furthermore, after the encoder determines the encoding mode of a CU, it can save the encoding modes used by these CUs. Therefore, in this embodiment, several positions can be predetermined. Let's assume that the predetermined positions... Figure 6 The encoder can detect the existence of adjacent coding units at the five positions shown. If they exist, it reads the previously stored coding patterns of these CUs to obtain the coding patterns corresponding to these associated coding units.
[0126] In step 406, the bias parameters corresponding to the at least one associated coding unit are determined according to the coding modes corresponding to the at least one associated coding unit.
[0127] Please refer to the following formula (7):
[0128]
[0129] As can be seen above, the value of offset is obtained based on the offset corresponding to each associated coding unit. i That is, the offset value corresponding to the associated coding unit.
[0130] Table 1 below illustrates the offset values for each mode.
[0131] Table 1 shows the offsets for each mode.
[0132] mode type Skip mode Merge mode AMVP mode Intra / IBC mode offset 0.01 -0.16 -0.16 -0.03
[0133] Once the encoding modes corresponding to at least one associated encoding unit stored in the encoder are obtained, the offset parameter corresponding to each associated encoding unit can be obtained according to Table 1 above.
[0134] It should be noted that since the larger β is, the easier it is to satisfy formula (6), and the easier it is to select skip as the preferred mode, the offset corresponding to the skip mode can be set to a positive number, while other modes can be set to negative numbers. However, Table 1 above is only for illustration. This embodiment does not limit the value of offset, and other values other than those in Table 1 can also be used. The specific value can be determined after adjusting the frame rate gain and performance loss of the video sequence where the target coding unit is located after performing the mode selection.
[0135] Furthermore, the encoder can store multiple mapping tables similar to Table 1, showing the relationship between modes and offset parameters. When comparing different encoding modes, the mapping table corresponding to the mode being compared can be selected. For example, if choosing between Merge and AMVP, the offset for the Merge mode in the table can be positive, while the offsets for other modes can be negative. The specific values can be determined based on the video sequence, adjusted according to frame rate gain and performance loss.
[0136] In step 408, the second weight coefficient is obtained by combining the bias parameters corresponding to the at least one associated coding unit.
[0137] For example, in getting Figure 6 After illustrating the coding patterns of the five adjacent coding units, the offsets corresponding to these five adjacent coding units can be obtained from Table 1, and then added together according to formula (7) to obtain the offset. Then, the value of β, i.e., the second weighting coefficient, is obtained according to the statement that "β can be 0.01 + offset".
[0138] It is understandable that formula (7) and the relationship between β and offset "β = 0.01 + offset" can be varied and are not limited to the examples listed above. For example, when converting the offset corresponding to each encoding mode... i When adding, each offset can also be used. i Different weights can be assigned. When obtaining β from the offset, the offset can also be multiplied by a certain weighting coefficient, etc.
[0139] In step 410, the adjusted rate distortion influence parameter is obtained based on the second weighting coefficient and the rate distortion influence parameter; the adjusted SATD is obtained based on the first weighting coefficient and the SATD.
[0140] For example, according to "β*Q step "Obtain the adjustment rate distortion influence parameter, based on "α*SATD" scale "SATD has been adjusted."
[0141] In step 412, the estimated coding cost of the second coding mode is determined based on the adjusted SATD and the adjustment rate distortion effect parameter.
[0142] Among them, according to formula (6), "α*SATD scale +β*Q step "That is, the estimated coding cost of the second coding mode Merge."
[0143] Furthermore, in the example above, detection is possible. Figure 6 The five adjacent coding units shown are considered. If any of these five adjacent coding units are missing, for example, when the target coding unit is located at the edge of an image frame, there may be a situation where no adjacent coding unit is present. Figure 6 The adjacent coding unit at the bottom left (BL) position in the middle, or Figure 6 If there are no adjacent coding units at the top left (AL) and left left (L) positions shown, then the second weight coefficient β can be set to 0.
[0144] In step 514, in response to the fact that the RDcost of the first coding mode is less than the estimated coding cost of the second coding mode, the first coding mode is selected as the mode used to encode the target coding unit.
[0145] For example, according to formula (6), if the condition of formula (6) is met, that is, the RDcost of the skip pattern is "skip_RDcost". scale "Estimated coding cost α*SATD less than Merge mode" scale +β*Q step If so, the skip mode can be selected as the encoding mode used by the target coding unit.
[0146] Conversely, if the conditions of formula (6) are not met, the RD cost of Merge can be calculated, and the RD cost of skip can be compared with the RD cost of Merge. The smaller one can be selected as the preferred coding mode of the target coding unit.
[0147] The encoding mode determination method in this embodiment not only reduces the encoding complexity of the encoder, making the selection of encoding modes more accurate and improving encoding performance, but also takes into account the temporal or spatial correlation in the encoding process by referring to the encoding modes of the associated encoding units of the target encoding unit, thus making the cost comparison results more accurate, thereby making the mode selection more accurate and improving encoding performance.
[0148] Figure 7This is a schematic diagram of an encoding mode determination device provided in an exemplary embodiment. This device can be used to implement the encoding mode determination method of any embodiment of this specification. The structure of the device is briefly described below; the implementation principles of each module can be found in the method embodiments. Figure 7 As shown, the device may include: a cost acquisition module 71, a cost adjustment module 72, and a mode determination module 73.
[0149] The cost acquisition module 71 is used to acquire the rate-distortion optimization cost RDcost of the first coding mode and the absolute transform error and SATD of the second coding mode.
[0150] The cost adjustment module 72 is used to obtain the estimated coding cost of the second coding mode based on the SATD and the rate-distortion impact parameter; the rate-distortion impact parameter is used to represent the correlation parameter of the RDcost of the second coding mode.
[0151] The mode determination module 73 is used to select the first encoding mode as the mode used to encode the target encoding unit in response to the fact that the RDcost of the first encoding mode is less than the estimated encoding cost of the second encoding mode.
[0152] In one example, the cost adjustment module 72, when used to obtain the estimated coding cost of the second coding mode based on the SATD and the rate distortion impact parameter, includes: obtaining an adjusted SATD based on a first weighting coefficient and the SATD; obtaining an adjusted rate distortion impact parameter based on a second weighting coefficient and the rate distortion impact parameter; and determining the estimated coding cost of the second coding mode based on the adjusted SATD and the adjusted rate distortion impact parameter.
[0153] In one example, the cost adjustment module 72, when used to obtain the adjusted rate distortion impact parameter based on the second weighting coefficient and the rate distortion impact parameter, includes: obtaining the coding modes corresponding to at least one associated coding unit of the target coding unit, wherein the associated coding unit and the target coding unit have coding correlation in the temporal or spatial domain; determining the bias parameters corresponding to the at least one associated coding unit based on the coding modes corresponding to the at least one associated coding unit; and obtaining the second weighting coefficient by combining the bias parameters corresponding to the at least one associated coding unit.
[0154] In one example, the associated coding unit includes at least one of the following: an adjacent coding unit in the same coding layer as the target coding unit; a parent coding unit of the target coding unit in the previous coding layer; and a temporal co-occurrence block of the target coding unit.
[0155] In one example, the cost adjustment module 72, when used to obtain the rate distortion impact parameter based on the second weighting coefficient and the rate distortion impact parameter, includes: detecting adjacent coding units at a predetermined plurality of positions in the same coding layer of the target coding unit; and setting the second weighting coefficient to 0 in response to the absence of adjacent coding units at the plurality of positions.
[0156] In one example, the cost acquisition module 71, when acquiring the rate-distortion optimization cost RDcost of the first coding mode and the absolute transform error and SATD of the second coding mode, includes: acquiring the initial RDcost of the first coding mode and the initial SATD of the second coding mode; and normalizing the initial RDcost and the initial SATD based on the size of the target coding unit to obtain the RDcost of the first coding mode and the SATD of the second coding mode.
[0157] In one example, the mode determination module 73, when selecting the first encoding mode as the mode for encoding the target coding unit in response to the RDcost of the first encoding mode being less than the estimated encoding cost of the second encoding mode, includes: obtaining the difference between the estimated encoding cost and the RDcost when the RDcost of the first encoding mode is less than the estimated encoding cost of the second encoding mode; and selecting the first encoding mode as the mode for encoding the target coding unit in response to the difference reaching a difference threshold.
[0158] In one example, the mode determination module 73 is further configured to: in response to the difference being less than the difference threshold, obtain the RDcost of the second encoding mode; and select the mode with the smaller RDcost from the first encoding mode and the second encoding mode as the mode used to encode the target encoding unit, based on the RDcost of the first encoding mode and the RDcost of the second encoding mode.
[0159] Figure 8 This is a flowchart illustrating an exemplary embodiment of a method for selecting an inter-frame predictive coding mode, as shown below. Figure 8 As shown, the method may include the following processing:
[0160] In step 800, the RDcost of the first inter-frame predictive coding mode and the SATD of the second inter-frame predictive coding mode are obtained.
[0161] For example, the first inter-frame predictive coding mode could be Skip mode, and the second inter-frame predictive coding mode could be Merge mode. In practice, it is not limited to these and other inter-frame predictive coding modes can also be used.
[0162] In step 802, the estimated coding cost of the second inter-frame predictive coding mode is obtained based on the SATD and the rate-distortion impact parameter; the rate-distortion impact parameter is used to represent the correlation parameter of the RDcost of the inter-frame predictive coding mode.
[0163] For example, this step can calculate the estimated coding cost of the Merge mode based on the "SATD and rate-distortion impact parameter" of the Merge mode. For instance, the rate-distortion impact parameter of the Merge mode in this embodiment can be Q... step .
[0164] So, according to the Merge pattern, "SATD and Q" step "The estimated encoding cost of the Merge pattern can be obtained."
[0165] For example, the estimated encoding cost of the Merge pattern = α*SATD + β*Q step Here, α can be called the first weighting coefficient, and β can be called the second weighting coefficient. The values of α and β can be found in the descriptions in the foregoing method embodiments.
[0166] In step 804, if the RDcost of the first inter-frame predictive coding mode is less than the estimated coding cost of the second inter-frame predictive coding mode, the first inter-frame predictive coding mode is selected as the inter-frame predictive coding mode of the target coding unit.
[0167] For example, if the RD cost of Skip mode is less than the estimated coding cost of Merge mode, Skip mode can be selected as the coding mode for inter-frame prediction of target coding units.
[0168] Furthermore, the above process is only an example. In other examples, the RDcost of Skip mode and the SATD of Merge mode can be normalized based on the CU size first, and then the RDcost of Skip mode after processing can be compared with the estimated coding cost of Merge mode. If the RDcost of Skip mode is less than the estimated coding cost of Merge mode, Skip mode can be selected as the coding mode for inter-frame prediction of target coding units.
[0169] An exemplary embodiment of this specification also provides a schematic structural diagram of a device. At the hardware level, the device includes a processor, an internal bus, a network interface, memory, and non-volatile memory, and may also include other hardware. One or more embodiments of this specification can be implemented in software, such as by the processor reading the corresponding computer program from non-volatile memory into memory and then running it. Of course, besides software implementation, one or more embodiments of this specification do not exclude other implementation methods, such as logic devices or a combination of hardware and software, etc. That is to say, the execution entity of the following processing flow is not limited to individual logic units, but can also be hardware or logic devices.
[0170] An exemplary embodiment of this specification also provides a computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, implement a method for determining an encoding mode according to any embodiment of this specification.
[0171] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which can take the form of a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email sending and receiving device, game console, tablet computer, wearable device, or any combination of these devices.
[0172] In a typical configuration, a computer includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0173] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0174] Computer-readable media, including both permanent and non-permanent, removable and non-removable media, can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0175] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0176] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0177] The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of one or more embodiments of this specification. The singular forms “a,” “described,” and “the” used in one or more embodiments of this specification and in the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0178] It should be understood that although the terms first, second, third, etc., may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first information may also be referred to as second information without departing from the scope of one or more embodiments of this specification, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "in response to a determination," or "when," or "in the event of a determination."
[0179] The above description is merely a preferred embodiment of one or more embodiments of this specification and is not intended to limit the scope of one or more embodiments of this specification. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of one or more embodiments of this specification should be included within the protection scope of one or more embodiments of this specification.
Claims
1. A method for determining an encoding pattern, characterized in that, The method includes: Obtain the rate-distortion optimization cost (RDcost) of the first coding mode and the absolute transform error (SATD) of the second coding mode; The estimated coding cost of the second coding mode is obtained based on the SATD and the rate-distortion impact parameter, including: obtaining the adjusted SATD based on the first weight coefficient and the SATD; and obtaining the adjusted rate-distortion impact parameter based on the second weight coefficient and the rate-distortion impact parameter; determining the estimated coding cost of the second coding mode based on the adjusted SATD and the adjusted rate-distortion impact parameter; the rate-distortion impact parameter is used to represent the correlation parameter of the RDcost of the second coding mode; the second weight coefficient is determined by: obtaining the coding modes corresponding to at least one associated coding unit of the target coding unit, wherein the associated coding unit and the target coding unit have coding correlation in the temporal or spatial domain; determining the bias parameter corresponding to the at least one associated coding unit based on the coding modes corresponding to the at least one associated coding unit; and obtaining the second weight coefficient by combining the bias parameter corresponding to the at least one associated coding unit. In response to the fact that the RDcost of the first encoding mode is less than the estimated encoding cost of the second encoding mode, the first encoding mode is selected as the mode used to encode the target encoding unit.
2. The method according to claim 1, characterized in that, The first encoding mode is Skip mode, and the second encoding mode is Merge mode; The rate distortion effect parameter is the quantization step size Qstep.
3. The method according to claim 1, characterized in that, The associated coding unit includes at least one of the following: Adjacent coding units in the same coding layer as the target coding unit; The target coding unit is the parent coding unit in the pre-coding layer; The temporal co-occurrence block of the target coding unit.
4. The method according to claim 1, characterized in that, The step of obtaining the adjusted rate distortion influence parameter based on the second weighting coefficient and the rate distortion influence parameter includes: In the same coding layer of the target coding unit, adjacent coding units at multiple predetermined positions are detected; In response to the situation where adjacent coding units are missing at the multiple positions, the second weighting coefficient is set to 0.
5. The method according to any one of claims 1 to 4, characterized in that, The acquisition of the rate-distortion optimization cost (RDcost) of the first coding mode and the absolute transform error (SATD) of the second coding mode includes: Obtain the initial RDcost of the first encoding mode and the initial SATD of the second encoding mode; Based on the size of the target coding unit, the initial RDcost and initial SATD are normalized to obtain the RDcost of the first coding mode and the SATD of the second coding mode.
6. The method according to claim 1, characterized in that, The method further includes: In response to the fact that the RDcost of the first encoding mode is greater than the estimated encoding cost of the second encoding mode, the RDcost of the second encoding mode is obtained; Based on the RDcost of the first encoding mode and the RDcost of the second encoding mode, the mode with the smaller RDcost is selected from the first encoding mode and the second encoding mode as the mode used to encode the target encoding unit.
7. The method according to claim 1, characterized in that, The step of selecting the first coding mode as the mode for encoding the target coding unit in response to the first coding mode having an RD cost less than the estimated coding cost of the second coding mode includes: If the RDcost of the first encoding mode is less than the estimated encoding cost of the second encoding mode, the difference between the estimated encoding cost and the RDcost is obtained. In response to the difference reaching a difference threshold, the first encoding mode is selected as the mode used to encode the target encoding unit.
8. The method according to claim 7, characterized in that, The method further includes: In response to the difference being less than the difference threshold, the RDcost of the second encoding mode is obtained; Based on the RDcost of the first encoding mode and the RDcost of the second encoding mode, the mode with the smaller RDcost is selected from the first encoding mode and the second encoding mode as the mode used to encode the target encoding unit.
9. A device for determining an encoding pattern, characterized in that, The device includes: The cost acquisition module is used to acquire the rate-distortion optimization cost RDcost of the first coding mode and the absolute transform error and SATD of the second coding mode; The cost adjustment module is used to obtain the estimated coding cost of the second coding mode based on the SATD and the rate-distortion impact parameter, including: obtaining the adjusted SATD based on the first weight coefficient and the SATD; and obtaining the adjusted rate-distortion impact parameter based on the second weight coefficient and the rate-distortion impact parameter; determining the estimated coding cost of the second coding mode based on the adjusted SATD and the adjusted rate-distortion impact parameter; the rate-distortion impact parameter is used to represent the correlation parameter of the RDcost of the second coding mode; the second weight coefficient is determined by: obtaining the coding modes corresponding to at least one associated coding unit of the target coding unit, wherein the associated coding unit and the target coding unit have coding correlation in the temporal or spatial domain; determining the bias parameter corresponding to the at least one associated coding unit based on the coding modes corresponding to the at least one associated coding unit; and obtaining the second weight coefficient by combining the bias parameter corresponding to the at least one associated coding unit. The mode determination module is configured to select the first encoding mode as the mode used to encode the target encoding unit in response to the first encoding mode having an RD cost less than the estimated encoding cost of the second encoding mode.
10. An electronic device, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor implements the method as described in any one of claims 1-8 by executing the executable instructions.
11. A method for selecting an inter-frame predictive coding mode, characterized in that, The method includes: Obtain the RDcost of the first inter-frame predictive coding mode and the SATD of the second inter-frame predictive coding mode; The estimated coding cost of the second inter-frame predictive coding mode is obtained based on the SATD and the rate-distortion impact parameter, including: obtaining an adjusted SATD based on a first weight coefficient and the SATD; and obtaining an adjusted rate-distortion impact parameter based on a second weight coefficient and the rate-distortion impact parameter; determining the estimated coding cost of the second inter-frame predictive coding mode based on the adjusted SATD and the adjusted rate-distortion impact parameter; the rate-distortion impact parameter is used to represent the correlation parameter of the RDcost of the inter-frame predictive coding mode; the second weight coefficient is determined by: obtaining the coding modes corresponding to at least one associated coding unit of the target coding unit, wherein the associated coding unit has temporal or spatial coding correlation with the target coding unit; determining the bias parameters corresponding to the at least one associated coding unit based on the coding modes corresponding to the at least one associated coding unit; and obtaining the second weight coefficient by combining the bias parameters corresponding to the at least one associated coding unit. If the RDcost of the first inter-frame predictive coding mode is less than the estimated coding cost of the second inter-frame predictive coding mode, the first inter-frame predictive coding mode is selected as the inter-frame predictive coding mode of the target coding unit.