Video encoding method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202310779634.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-28
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2043-06-28
AI Technical Summary
[0003]通常情况下,在视频压缩过程中,可能会带来编码质量损失的问题,从而降低了视频数据的呈现质量
[0022]本公开提供了一种视频编码方法,至少带来以下有益效果:本公开可以实现对待编码视频中的任意一个编码单元,进行自适应运动矢量分辨率(adaptive motion vectorresolution,AMVR)模式的选择,确定出一个与编码单元对应的最优目标编码结果。并且,由于AMVR模式为在预设编码模式的基础上进一步扩展的编码模式,故在预设编码模式(例如Inter ME模式)对应的率失真代价与最小率失真代价的差值大于第一阈值的情况下,即可确定AMVR模式不适用于当前编码单元的编码,实现跳过AMVR模式的选择,以最小率失真代价对应的候选编码结果确定为目标编码结果即为当前编码单元最优的编码结果。另外,由于第一阈值在一定程度上能够表征编码单元的编码序列特征,也使得视频编码装置确定的最优目标编码结果更加合理,避免编码单元存在较大的编码质量损失。
Smart Images

Figure CN116723324B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of video coding technology, and in particular to a video coding method, apparatus, electronic device and storage medium. Background Technology
[0002] To reduce the resources used by video data during transmission, video coding techniques can be used to compress the video data. Video coding techniques typically use prediction methods that take advantage of redundancy present in video images or sequences (e.g., inter-frame prediction, intra-frame prediction, etc.) to compress video data to use a lower bit rate while avoiding or minimizing the degradation of video quality.
[0003] Typically, video compression can lead to a loss of encoding quality, thus reducing the overall quality of the video data. Therefore, minimizing this loss of encoding quality during video compression is a pressing issue that needs to be addressed. Summary of the Invention
[0004] This disclosure provides a video encoding method, apparatus, electronic device, and storage medium to reduce encoding quality loss during the video encoding process. The technical solution of this disclosure is as follows: According to a first aspect of the present disclosure, a video coding method is provided, the method comprising: acquiring coding units in a video to be encoded, and encoding the coding units using multiple coding modes to obtain multiple candidate coding results; determining the rate-distortion cost of each coding result among the multiple candidate coding results to obtain multiple rate-distortion costs; determining a first rate-distortion cost and a minimum rate-distortion cost from the multiple rate-distortion costs, wherein the first rate-distortion cost is a rate-distortion cost corresponding to a preset coding mode among the multiple coding modes, and the preset coding mode is a coding mode based on motion estimation; and, if the difference between the first rate-distortion cost and the minimum rate-distortion cost is greater than a first threshold, determining the candidate coding result corresponding to the minimum rate-distortion cost as the target coding result of the coding unit; the target coding result is used to compose the coding data of the video to be encoded.
[0005] Optionally, if the difference between the first rate-distortion cost and the minimum rate-distortion cost is less than or equal to the first threshold, it is determined whether there is a residual in the candidate coding result corresponding to the minimum rate-distortion cost; if there is no residual in the candidate coding result corresponding to the minimum rate-distortion cost, and the difference between the first rate-distortion cost and the minimum rate-distortion cost is greater than the second threshold, then the candidate coding result corresponding to the minimum rate-distortion cost is determined as the target coding result of the coding unit; the second threshold is less than the first threshold.
[0006] Optionally, if the candidate coding result corresponding to the minimum rate distortion cost has no residual, and the difference between the first rate distortion cost and the minimum rate distortion cost is less than or equal to the second threshold, then the target coding result of the coding unit is determined according to the coding mode of the corresponding pari-block of the coding unit.
[0007] Optionally, if the difference between the first rate-distortion cost and the minimum rate-distortion cost is less than or equal to the first threshold, it is determined whether the coding mode corresponding to the minimum rate-distortion cost is a skipped coding mode; if the coding mode corresponding to the minimum rate-distortion cost is a skipped coding mode, and if the difference between the first rate-distortion cost and the minimum rate-distortion cost is greater than the second threshold, the candidate coding result corresponding to the minimum rate-distortion cost is determined as the target coding result of the coding unit; the second threshold is less than the first threshold.
[0008] Optionally, if the coding mode corresponding to the minimum rate distortion cost is the skip coding mode, and the difference between the first rate distortion cost and the minimum rate distortion cost is less than or equal to the second threshold, then the target coding result of the coding unit is determined according to the coding mode of the corresponding co-occurrence block of the coding unit.
[0009] Optionally, if the first rate-distortion cost is not included among the multiple rate-distortion costs, the video coding method further includes: determining the target coding result of the coding unit according to the coding mode of the corresponding co-position block of the coding unit.
[0010] Optionally, the target coding result of the coding unit is determined according to the coding mode of the corresponding block of the coding unit, including: when the coding mode of the corresponding block of the coding unit is the adaptive motion vector resolution mode, the coding result corresponding to the adaptive motion vector resolution mode is determined as the target coding result of the coding unit; when the coding mode of the corresponding block of the coding unit is not the adaptive motion vector resolution mode, the candidate coding result corresponding to the minimum rate distortion cost is determined as the target coding result of the coding unit.
[0011] Optionally, the adaptive motion vector resolution mode is not included among the multiple encoding modes.
[0012] According to a second aspect of the present disclosure, a video encoding apparatus is provided, comprising: an acquisition unit, a processing unit, and a determination unit. The acquisition unit is configured to acquire encoding units in a video to be encoded. The processing unit is configured to encode the encoding units using multiple encoding modes to obtain multiple candidate encoding results. The determination unit is configured to determine the rate-distortion cost of each encoding result among the multiple candidate encoding results to obtain multiple rate-distortion costs. The determination unit is further configured to determine a first rate-distortion cost and a minimum rate-distortion cost from the multiple rate-distortion costs, wherein the first rate-distortion cost is a rate-distortion cost corresponding to a preset encoding mode among the multiple encoding modes, and the preset encoding mode is an encoding mode based on motion estimation. The determination unit is further configured to, if the difference between the first rate-distortion cost and the minimum rate-distortion cost is greater than a first threshold, determine the candidate encoding result corresponding to the minimum rate-distortion cost as the target encoding result of the encoding unit; the target encoding result is used to constitute the encoded data of the video to be encoded.
[0013] Optionally, the determining unit is further configured to determine whether there is a residual in the candidate coding result corresponding to the minimum rate distortion cost when the difference between the first rate distortion cost and the minimum rate distortion cost is less than or equal to the first threshold; if there is no residual in the candidate coding result corresponding to the minimum rate distortion cost, and the difference between the first rate distortion cost and the minimum rate distortion cost is greater than the second threshold, then the candidate coding result corresponding to the minimum rate distortion cost is determined as the target coding result of the coding unit; the second threshold is less than the first threshold.
[0014] Optionally, the determining unit is further configured to determine the target coding result of the coding unit based on the coding mode of the corresponding pari-block when there is no residual in the candidate coding result corresponding to the minimum rate distortion cost.
[0015] Optionally, the determining unit is further configured to determine whether the coding mode corresponding to the minimum rate distortion cost is a skipped coding mode if the difference between the first rate distortion cost and the minimum rate distortion cost is less than or equal to the first threshold; if the coding mode corresponding to the minimum rate distortion cost is a skipped coding mode, and the difference between the first rate distortion cost and the minimum rate distortion cost is greater than the second threshold, then the candidate coding result corresponding to the minimum rate distortion cost is determined as the target coding result of the coding unit; the second threshold is less than the first threshold.
[0016] Optionally, the determining unit is further configured to, when the coding mode corresponding to the minimum rate distortion cost is a skip coding mode, determine the target coding result of the coding unit according to the coding mode of the corresponding co-position block of the coding unit if the difference between the first rate distortion cost and the minimum rate distortion cost is less than or equal to the second threshold.
[0017] Optionally, the determining unit is also used to determine the target encoding result of the encoding unit based on the encoding mode of the corresponding pari-block of the encoding unit.
[0018] Optionally, the determining unit is specifically configured to determine the coding result corresponding to the adaptive motion vector resolution mode as the target coding result of the coding unit when the coding mode of the corresponding co-block of the coding unit is the adaptive motion vector resolution mode; and to determine the candidate coding result corresponding to the minimum rate distortion cost as the target coding result of the coding unit when the coding mode of the corresponding co-block of the coding unit is not the adaptive motion vector resolution mode.
[0019] Optionally, in the video encoding apparatus, the adaptive motion vector resolution mode is not included among the multiple encoding modes.
[0020] According to a third aspect of the present disclosure, an electronic device is provided, comprising: a processor and a memory for storing processor-executable instructions; wherein the processor is configured to execute instructions to implement the video encoding method of the first aspect described above.
[0021] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which instructions are stored, such that when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is able to perform the video encoding method of the first aspect described above.
[0022] This disclosure provides a video coding method that offers at least the following advantages: It enables the selection of an adaptive motion vector resolution (AMVR) mode for any coding unit in the video to be encoded, determining an optimal target coding result corresponding to that unit. Furthermore, since AMVR is an extension of a preset coding mode, if the difference between the rate-distortion cost corresponding to the preset coding mode (e.g., Inter ME mode) and the minimum rate-distortion cost exceeds a first threshold, it can be determined that AMVR is not suitable for the current coding unit. This allows skipping the AMVR mode selection and using the candidate coding result corresponding to the minimum rate-distortion cost as the target coding result, which is the optimal coding result for the current coding unit. Additionally, since the first threshold can characterize the coding sequence features of the coding unit to some extent, the optimal target coding result determined by the video coding device is more reasonable, avoiding significant coding quality loss in the coding unit.
[0023] It should be noted that the technical effects of any of the implementation methods in the second to fourth aspects can be found in the technical effects of the corresponding implementation methods in the first aspect, and will not be repeated here.
[0024] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0025] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.
[0026] Figure 1 An exemplary block diagram of a block-based video coding system provided in this disclosure embodiment; Figure 2 This is a schematic diagram of the structure of a video encoding system provided in an embodiment of this disclosure; Figure 3 One of the schematic diagrams of the video encoding method provided in this disclosure embodiment; Figure 4 This is the second flowchart of the video encoding method provided in the embodiments of this disclosure; Figure 5 The third flowchart of the video encoding method provided in this embodiment of the disclosure; Figure 6 The fourth flowchart of the video encoding method provided in this embodiment of the disclosure; Figure 7 The fifth flowchart of the video encoding method provided in this disclosure embodiment; Figure 8 Flowchart six of the video encoding method provided in this disclosure embodiment; Figure 9 Seventh schematic diagram of the video encoding method provided in the embodiments of this disclosure; Figure 10 Eighth schematic diagram of the video encoding method provided in the embodiments of this disclosure; Figure 11 This is a schematic diagram of the structure of a video encoding device provided in an embodiment of the present disclosure; Figure 12 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0027] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.
[0028] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0029] Furthermore, in the description of the embodiments of this disclosure, unless otherwise stated, " / " means "or," for example, A / B can mean either A or B. The term "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, in the description of the embodiments of this disclosure, "multiple" refers to two or more than two.
[0030] It should be noted that the user information (including but not limited to user device information, user personal information, user behavior information, etc.) and data (including but not limited to program code, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.
[0031] Before providing a detailed explanation of the embodiments of this disclosure, some related technical terms and technologies involved in the embodiments of this disclosure will be introduced first.
[0032] Figure 1 A block diagram of a block-based video coding system is shown. The input video signal includes signals of multiple image frames, each of which can be processed block by block. A block can be, for example, but not limited to, a coding tree unit (CTU), a largest coding unit (LCU), a coding unit (CU), a prediction unit (PU), and a transform unit (TU).
[0033] The principle of video coding is to use the similarity between consecutive image frames and the similarity between adjacent blocks within the same image frame / strip to encode a portion of representative image frames or blocks according to their original pixel values. For other image frames or blocks besides the representative ones, the pixel values are predicted by using the similarity between consecutive image frames or adjacent blocks, thereby compressing the video signal to remove redundancy in the spatial and temporal dimensions.
[0034] When performing video encoding, depending on whether the similarity between adjacent blocks or between consecutive image frames is utilized, intra-frame prediction and / or inter-frame prediction can be performed on blocks of the current image frame.
[0035] Intra-frame prediction (or "spatial prediction") uses the pixel values of pixels from reconstructed neighboring blocks (neighboring blocks refer to already encoded adjacent blocks) stored in memory (called reference pixels) to predict the current block, thus obtaining the predicted block. Intra-frame prediction reduces the spatial redundancy inherent in the video signal.
[0036] The coding modes corresponding to intra-frame prediction can include, for example, luminance intra-frame prediction mode, planar mode, direct current (DC) mode, and angle mode.
[0037] Inter-frame prediction (also known as "temporal prediction" or "motion-compensated prediction") corresponds to Figure 1 The "motion estimation" and "motion compensation" sections use reconstructed pixels (reconstructed pixels refer to pixels that have already been encoded) from the encoded image frames (called "reference image frames") stored in the image frame buffer to predict the current block, thus obtaining the predicted block. Inter-frame prediction reduces the inherent temporal redundancy in the video signal. The temporal prediction signal for the current block is typically determined based on one or more predicted motion vectors, which indicate the motion offset and direction between the current block and its temporal reference (called the "reference block," which is a block in the reference image frame). The process of determining the predicted motion vector is called motion estimation; the process of determining the reference block based on the predicted motion vector, the current block, and the reference image frame is called motion compensation, and the determined reference block becomes the predicted block. In addition, if the encoder and decoder support the use of multiple reference image frames, the encoder also sends a reference image frame index when sending the encoded information to the decoder. This index is used to identify which reference image frame in the image frame buffer the temporal prediction signal comes from, i.e., which reference image frame needs to be used for motion compensation.
[0038] Among them, the coding modes corresponding to inter-frame prediction can include, for example, Merge mode, Skip mode, Inter mode, and Subblock-based temporal motion vector prediction (SbtMVP) mode.
[0039] Merge mode directly uses spatially adjacent motion vectors (MVs) or temporally adjacent MVs as the final MV of the current coding block, without requiring motion estimation (i.e., there is no motion vector difference (MVD)). The encoder and decoder construct a merge candidate list in the same way (the candidate list contains motion information of adjacent blocks, such as MVs, reference frame list, reference frame index, etc.), and the encoder selects the best candidate MV through rate-distortion optimization (RDO).
[0040] Skip mode is a special type of Merge mode. In this mode, the transformation and quantization of the prediction residual are skipped. The encoder only needs to encode the index of the MV in the candidate list, and does not need to encode the quantized residual.
[0041] Inter mode requires inter-frame motion search of the predicted blocks to obtain the motion information corresponding to the best matching block, and then encodes the motion information and prediction residual information. Examples of Inter mode include advanced motion vector prediction (AMVP) mode, symmetric MVD coding (SMVD) mode, and AMVR mode.
[0042] In the AMVP mode, the candidate list of motion vectors (MVs) is first constructed by the spatial neighboring blocks and the temporal neighboring blocks. The best MV is selected from the list to obtain the motion vector prediction (MVP) of the current block. Then, motion search is performed with the MVP as the starting point to obtain the best MV. The difference between the searched MV and the MVP, MVD, is further encoded.
[0043] AMVR mode allows the CU's MVD to be encoded with different precisions.
[0044] Depending on the current CU's mode (regular AMVP mode or affine AVMP mode), the MVD of the current CU can be adaptively selected as follows: 1. Standard AMVP mode: 1 / 4 brightness pixel precision, 1 / 2 brightness pixel precision, integer brightness pixel precision, or four times the brightness pixel precision.
[0045] 2. Affine AMVP mode: 1 / 4 brightness pixel precision, integer brightness pixel precision, or 1 / 16 brightness pixel precision.
[0046] After intra-frame and / or inter-frame prediction, the encoder determines the intra-frame / inter-frame mode, for example, by selecting the optimal prediction mode based on rate-distortion optimization methods. Then, the difference between the current block and the predicted block is determined, specifically by subtracting the corresponding pixel values of the predicted block from the pixel values of each pixel in the current block to obtain the prediction residual. The prediction-related information, such as the coding mode (inter-frame or intra-frame), motion information, and the prediction residual, are then encoded to obtain the encoded information of the current block. This encoded information can be sent to the decoder via a bitstream. Furthermore, based on the prediction residual and the predicted block, the reconstructed signal of the current block can be determined, which is the encoded and compressed pixel values of each pixel in the current block, and stored in memory. Before placing the reconstructed signal of the current block (which may be referred to as the "reconstructed block" signal) into the image frame buffer as a reference block for encoding future blocks, further loop filtering can be applied to the reconstructed block, such as, but not limited to, at least one of deblocking filters, pixel adaptive offsets, and adaptive loop filters.
[0047] In practical applications, the performance of each coding mode is usually measured by its rate-distortion cost. The rate-distortion cost of a coding mode is determined by the coding distortion under that mode, the number of bits required for encoding, and the quantization parameters.
[0048] For example, in the encoder, rate-distortion optimization is used for mode selection, as shown in the following formula: Formula 1 Where argmin represents the variable value that minimizes the objective function J, J is the rate-distortion cost of a specific encoding mode, D is the encoding distortion produced by using the encoding mode, and R is the number of bits required for encoding the mode (i.e., the code rate). This is the rate-distortion optimization factor, which is related to the quantization parameters. The specific calculation formula is related to the encoding standard and encoder, and the calculation formula is as follows: Formula 2 Where QP is the quantization parameter and a is a constant.
[0049] In related technologies, the encoder typically classifies the video frames in the video before encoding. For example, it divides the video frames into high-level and low-level frames based on their hierarchy (high-level frames are not used as reference frames by other frames). Furthermore, the encoder skips the AMVR mode selection process for high-level frames, thereby accelerating the encoding of the video by reducing the supported range of the AMVR mode selection process. However, forcibly skipping the AMVR mode selection process based solely on the frame type results in significant encoding quality loss for frames that skip the AMVR mode selection process, as they are not processed according to the encoding sequence of the coding unit.
[0050] Another related technology includes an AMVR mode selection method, which prioritizes rate-distortion optimization using modes other than AMVR. If the optimal mode among these is the zero-residual skip mode, the AMVR mode selection process is skipped to accelerate video encoding. However, for video sequences with complex scenes, directly skipping AMVR mode can lead to significant encoding quality loss. Therefore, this approach has limited applicability and lacks universality.
[0051] In view of this, embodiments of the present disclosure provide a video encoding method for optimizing the AMVR mode selection process for any encoding unit in the video to be encoded, so that the rate-distortion optimization decision can achieve the best overall encoding quality.
[0052] The video encoding method provided in the embodiments of this disclosure will now be described in detail with reference to the accompanying drawings.
[0053] The video encoding method provided in this disclosure can be applied to video encoding systems. Figure 2 A schematic diagram of one structure of the video encoding system is shown. For example... Figure 2 As shown, the video encoding system 10 includes a video encoding device 11 and an electronic device 12. The video encoding device 11 is connected to the electronic device 12. The video encoding device 11 and the electronic device 12 can be connected via a wired connection or a wireless connection; this embodiment does not limit the connection in this way.
[0054] The video encoding device 11 can store multiple encoding modes, such as Merge mode, Skip mode, Inter mode, Luminance Intra-Frame Prediction mode, and Planar mode.
[0055] The video encoding apparatus 11 is used to encode encoding units in the video to be encoded using multiple encoding modes to obtain multiple candidate encoding results, and to determine the rate-distortion cost of each encoding result among the multiple candidate encoding results, thus obtaining multiple rate-distortion costs. The video encoding apparatus 11 is also used to determine a first rate-distortion cost and a minimum rate-distortion cost corresponding to a preset encoding mode from the multiple encoding modes. The video encoding apparatus 11 is further used to determine the candidate encoding result corresponding to the minimum rate-distortion cost as the target encoding result of the encoding unit when the difference between the first rate-distortion cost and the minimum rate-distortion cost is greater than a first threshold, wherein the target encoding result is used to compose the encoded data of the video to be encoded.
[0056] The video encoding apparatus 11 can implement the video encoding method of this disclosure embodiment in various electronic devices 12. For example, the electronic device 12 can be a mobile phone, tablet computer, wearable device, in-vehicle device, augmented reality (AR) / virtual reality (VR) device, laptop computer, ultra-mobile personal computer (Ultra). Mobile personal computers (UMPCs), netbooks, personal digital assistants (PDAs), desktop computers, cloud servers, etc. In some cases, electronic device 12 can also be an encoder in the above-mentioned devices. This disclosure does not limit the specific type of electronic device.
[0057] In different application scenarios, the video encoding device 11 and the electronic device 12 can be independent devices or integrated into the same device. This disclosure does not specifically limit this.
[0058] When the video encoding device 11 and the electronic device 12 are integrated into the same device, the data transmission method between the video encoding device 11 and the electronic device 12 is the data transmission between modules within the device. In this case, the data transmission process between the two is the same as that when the video encoding device 11 and the electronic device 12 are independent of each other.
[0059] In the following embodiments provided in this disclosure, the video encoding device 11 and the electronic device 12 are described as being configured independently of each other.
[0060] Figure 3 This is a flowchart illustrating a video encoding method according to some exemplary embodiments. In some embodiments, the above-described video encoding method can be applied to, for example... Figure 2 The video encoding device and electronic equipment shown can also be applied to other similar devices.
[0061] like Figure 3 As shown, the video encoding method provided in this embodiment includes the following steps S201-S207.
[0062] S201, The video encoding device acquires the encoding units in the video to be encoded.
[0063] The video to be encoded includes multiple image frames, and each image frame includes multiple coding units. The coding unit acquired by the video encoding device can be any coding unit on any image frame in the video to be encoded.
[0064] As one possible implementation, the video encoding device obtains encoding units from the image frames of the input video to be encoded.
[0065] In some embodiments, if the video to be encoded is accompanied by instruction information associated with the video to be encoded, the video encoding device, in response to the input instruction information, sequentially obtains the encoding units indicated by the encoding unit identifier in the video to be encoded, based on the encoding unit identifier included in the instruction information and the encoding unit processing order.
[0066] In other embodiments, if the video encoding device receives only the video to be encoded within a certain time range, the video encoding device sequentially acquires the encoding units in the video to be encoded based on a preset encoding unit processing order.
[0067] S202. The video encoding device encodes the encoding unit using multiple encoding modes to obtain multiple candidate encoding results.
[0068] Among these multiple coding modes are at least two of the following: Merge mode, Skip mode, Inter ME (motion estimation) mode, AMVP mode, AMVR mode, Luminance Intra-Frame Prediction mode, and Planar mode.
[0069] As one possible implementation, the video encoding device, based on the encoding unit obtained in step S201 above, and based on multiple encoding modes built into the video encoding device, encodes the encoding unit with each of the multiple encoding modes respectively, to obtain multiple candidate encoding results that correspond one-to-one with the multiple encoding modes.
[0070] For example, the video encoding device encodes the above encoding units based on the Merge pattern to obtain the encoding result A. Merge The video encoding device also encodes the above encoding units based on the Skip mode to obtain the encoding result A. Skip; until multiple candidate coding results are obtained after encoding the coding unit with multiple coding modes, establish the correspondence between each coding mode and the candidate coding result, where the correspondence between the coding mode and the candidate coding result is shown in Table 1 below.
[0071] Table 1: Correspondence between coding modes and candidate coding results
[0072] In some embodiments, the adaptive motion vector resolution (AMVR) mode is not included among the above-described multiple encoding modes.
[0073] If the AMVR mode is not included in the multiple encoding modes, the candidate encoding results mentioned above do not include the candidate encoding results corresponding to the AMVR mode. The video encoding device encodes the encoding unit using multiple encoding modes other than the AMVR mode, respectively, to obtain the candidate encoding results corresponding to each encoding mode other than the AMVR mode.
[0074] Understandably, the higher pixel precision in AMVR encoding leads to increased encoding complexity. Therefore, encoding units using modes other than AMVR can improve computational efficiency to some extent.
[0075] S203. The video coding device determines the rate-distortion cost of each coding result among multiple candidate coding results, and obtains multiple rate-distortion costs.
[0076] As one possible implementation, the video coding device, based on the multiple candidate coding results obtained in step S202 above, determines the coding distortion and bitrate for each candidate coding result. Furthermore, the video coding device uses a rate-distortion calculation formula to calculate the rate-distortion cost for each candidate coding result based on the coding distortion and bitrate of each candidate coding mode, thus obtaining multiple rate-distortion costs.
[0077] For example, the video encoding device determines candidate encoding result A. Merge Given the encoding distortion D1 and the code rate R1, determine the rate-distortion cost J for the Merge mode. Merge The video encoding device determines the candidate encoding result A. Skip Given the encoding distortion D2 and the code rate R2, determine the rate-distortion cost of the Skip mode as J. Skip Until the rate-distortion cost of each candidate coding result is determined, a correspondence between each coding mode and the rate-distortion cost is established. The correspondence between coding modes and rate-distortion costs is shown in Table 2 below.
[0078] Table 2: Correspondence between coding modes and rate-distortion costs
[0079] S204. The video encoding device determines whether a first rate distortion cost exists among multiple rate distortion costs.
[0080] The first rate-distortion cost is the rate-distortion cost corresponding to a preset coding mode among multiple coding modes, where the preset coding mode is a coding mode based on motion estimation.
[0081] As one possible implementation, the video encoding device queries whether a preset encoding mode is included among multiple encoding modes based on the identifier of the preset encoding mode. Further, if the preset encoding mode is found to be included among multiple encoding modes, the video encoding device determines that a first rate-distortion cost exists; if the preset encoding mode is not found to be included among multiple encoding modes, the video encoding device determines that a first rate-distortion cost does not exist.
[0082] S205, The video encoding device determines a first rate-distortion cost and a minimum rate-distortion cost from multiple rate-distortion costs.
[0083] As one possible implementation, if the video encoding device determines the existence of a first rate-distortion cost in step S204, it obtains the first rate-distortion cost corresponding to the preset encoding mode from the correspondence between the encoding modes and rate-distortion costs based on the identifier of the preset encoding mode. Furthermore, the video encoding device compares multiple rate-distortion costs to determine the minimum rate-distortion cost.
[0084] For example, the specific implementation of the video encoding device determining the minimum rate-distortion cost can be as follows: the video encoding device sorts multiple rate-distortion costs according to their size based on a sorting algorithm, obtaining a rate-distortion cost sequence arranged in ascending order. If the multiple rate-distortion costs in the rate-distortion cost sequence are sorted in ascending order, the video encoding device determines the first rate-distortion cost in the rate-distortion cost sequence as the minimum rate-distortion cost; if the multiple rate-distortion costs in the rate-distortion cost sequence are sorted in descending order, the video encoding device determines the last rate-distortion cost in the rate-distortion cost sequence as the minimum rate-distortion cost.
[0085] In another example, the specific implementation of the video encoding device determining the minimum rate distortion cost can also be as follows: the video encoding device arbitrarily selects a rate distortion cost from multiple rate distortion costs to determine the current rate distortion cost, and compares the current rate distortion cost with other rate distortion costs. If the current rate distortion cost is less than or equal to the rate distortion cost being compared with it, it compares it with the next rate distortion cost. If the current rate distortion cost is greater than the rate distortion cost being compared with it, the current rate distortion cost is updated to the rate distortion cost being compared with it, and then compared with the next rate distortion cost, until all rate distortion costs have been compared, and then the current rate distortion cost is determined to be the minimum rate distortion cost.
[0086] It should be noted that the above-mentioned preset encoding mode can be the Inter ME mode, the AMVP mode, or other encoding modes based on motion estimation. It can be set in advance in the video encoding device by the operation and maintenance personnel of the video encoding system. This disclosure embodiment does not make specific limitations on this.
[0087] S206. The video encoding device determines whether the difference between the first rate distortion cost and the minimum rate distortion cost is greater than the first threshold.
[0088] As one possible implementation, the video encoding device calculates the difference between the first rate-distortion cost and the second rate-distortion cost based on the first rate-distortion cost and the second rate-distortion cost determined in step S205 above. Further, the video encoding device compares the calculated difference with the magnitude of a first threshold.
[0089] In some embodiments, the video encoding apparatus has a built-in first preset algorithm, which is used to determine a first threshold based on the encoding sequence of the encoding unit. The video encoding apparatus can input the encoding sequence of the encoding unit into the first preset algorithm to obtain the first threshold.
[0090] It is understandable that since the first threshold is obtained by the first preset algorithm based on the coding sequence of the coding unit, it can characterize the coding sequence features of the coding unit to a certain extent, that is, the complexity of the coding unit.
[0091] S207. If the difference between the first rate distortion cost and the minimum rate distortion cost is greater than the first threshold, the video coding device determines the candidate coding result corresponding to the minimum rate distortion cost as the target coding result of the coding unit.
[0092] The target encoding result is used to compose the encoded data of the video to be encoded.
[0093] As one possible implementation, if the difference between the first rate-distortion cost and the minimum rate-distortion cost is greater than a first threshold, the video coding device determines the candidate coding result corresponding to the minimum rate-distortion cost. Further, the video coding device determines the target coding result from the candidate coding result corresponding to the minimum rate-distortion cost.
[0094] It should be noted that the first threshold can be set in advance in the video encoding device by the operation and maintenance personnel of the video encoding system, and this disclosure does not make specific limitations on it.
[0095] Understandably, the technical solution provided in this disclosure can be applied to any coding unit in the video to be encoded, enabling the selection of the AMVR mode and determining an optimal target coding result corresponding to the coding unit. Furthermore, since the AMVR mode is an extension of the preset coding mode, if the difference between the rate-distortion cost corresponding to the preset coding mode (e.g., Inter ME mode) and the minimum rate-distortion cost is greater than a first threshold, it can be determined that the AMVR mode is not suitable for the current coding unit. This allows skipping the selection of the AMVR mode and determining the candidate coding result corresponding to the minimum rate-distortion cost as the target coding result, which is the optimal coding result for the current coding unit. Additionally, since the first threshold can characterize the coding sequence features of the coding unit to a certain extent, it also makes the optimal target coding result determined by the video coding device more reasonable, avoiding significant coding quality loss in the coding unit.
[0096] In one design, to further optimize the AMVR mode selection process, combined with Figure 3 ,like Figure 4 As shown, in step S206 above, if the video encoding device determines that the difference between the first rate distortion cost and the minimum rate distortion cost is not greater than the first threshold, the video encoding method provided in this embodiment of the present disclosure further includes S301-S303.
[0097] S301. If the difference between the first rate distortion cost and the minimum rate distortion is less than or equal to the first threshold, the video encoding device determines whether there is a residual in the candidate encoding result corresponding to the minimum rate distortion cost.
[0098] As one possible implementation, the video encoding device determines the candidate encoding result corresponding to the minimum rate distortion cost when the difference is less than or equal to a first threshold, and determines whether there is a residual from the candidate encoding result.
[0099] It should be noted that the specific implementation method for the video encoding device to determine whether there is a residual in the candidate encoding result can be as follows: the video encoding device parses the candidate encoding result and queries the residual data in the parsed data of the candidate encoding result. If the video encoding device finds a residual in the parsed data, the video encoding device determines that there is a residual in the candidate encoding result corresponding to the minimum rate distortion cost; if the video encoding device does not find a residual in the parsed data, the video encoding device determines that there is no residual in the candidate encoding result corresponding to the minimum rate distortion cost.
[0100] Another specific implementation for the video encoding device to determine whether residuals exist in the candidate encoding results is as follows: the video encoding device searches for a field recording residuals in the candidate encoding results. If the video encoding device finds a field recording residuals in the candidate encoding results, the video encoding device determines that the candidate encoding result corresponding to the minimum rate distortion cost has residuals; if the video encoding device does not find a field recording residuals in the candidate encoding results, the video encoding device determines that the candidate encoding result corresponding to the minimum rate distortion cost does not have residuals.
[0101] S302. When there is no residual in the candidate coding result corresponding to the minimum rate distortion cost, the video coding device determines whether the difference between the first rate distortion cost and the minimum rate distortion cost is greater than the second threshold.
[0102] The second threshold is less than the first threshold.
[0103] As one possible implementation, when the candidate coding result corresponding to the minimum rate-distortion cost has no residual, the video coding device calculates the difference between the first rate-distortion cost and the second rate-distortion cost based on the first rate-distortion cost and the second rate-distortion cost determined in step S205 above. Further, the video coding device compares the calculated difference with the magnitude of a second threshold.
[0104] It should be noted that the second threshold can be set in advance in the video encoding device by the operation and maintenance personnel of the video encoding system, and this disclosure does not make specific limitations on it.
[0105] In some embodiments, the video encoding device has a built-in second preset algorithm for obtaining a second threshold from the encoding sequence of the input encoding unit. After calculating the difference between the first rate distortion cost and the minimum rate distortion cost, the video encoding device inputs the encoding sequence of the encoding unit into the second preset algorithm to obtain the second threshold. The second threshold obtained based on the second preset algorithm can characterize the encoding sequence features of the encoding unit to a certain extent.
[0106] In other embodiments, the video encoding device contains preset values set by maintenance personnel. After calculating the difference between the first rate distortion cost and the minimum rate distortion cost, the video encoding device calculates a second threshold that is less than the first threshold based on the first threshold determined in step S205 and the preset value.
[0107] Specifically, when the preset value is a coefficient greater than 0 and less than 1, the video encoding device calculates the product of the first threshold and the preset value to obtain the second threshold; when the preset value is the difference between the first threshold and the second threshold set by the maintenance personnel, the video encoding device calculates the difference between the first threshold and the preset value to obtain the second threshold.
[0108] S303. If the difference between the first rate distortion cost and the minimum rate distortion cost is greater than the second threshold when there is no residual in the candidate coding result corresponding to the minimum rate distortion cost, the video coding device determines the candidate coding result corresponding to the minimum rate distortion cost as the target coding result of the coding unit.
[0109] As one possible implementation, if the difference between the first rate-distortion cost and the minimum rate-distortion cost is greater than a second threshold, the video coding device determines the candidate coding result corresponding to the minimum rate-distortion cost. Further, the video coding device determines the candidate coding result corresponding to the minimum rate-distortion cost as the target coding result.
[0110] Understandably, if there is no residual in the candidate coding result corresponding to the minimum rate distortion cost, it indicates that the change between the current coding unit and the reference block is small. In this case, if the difference between the first rate distortion cost and the minimum rate distortion cost is greater than the second threshold which is smaller than the first threshold, it means that the coding mode corresponding to the minimum rate distortion cost is a more suitable coding mode for the current coding unit. This allows skipping the selection of the AMVR mode and determining the candidate coding result corresponding to the minimum rate distortion cost as the target coding result, which is the optimal coding result for the current coding unit.
[0111] In one design, to further optimize the AMVR mode selection process, combined with Figure 4 ,like Figure 5 As shown, in step S302 above, if there is no residual in the candidate coding result corresponding to the minimum rate distortion cost, the video coding device determines that the difference between the first rate distortion cost and the minimum rate distortion cost is not greater than the second threshold. The video coding method provided in this embodiment of the present disclosure further includes S304.
[0112] S304. If the difference between the first rate distortion cost and the minimum rate distortion cost is less than or equal to the second threshold when there is no residual in the candidate coding result corresponding to the minimum rate distortion cost, the video coding device determines the target coding result of the coding unit according to the coding mode of the corresponding pari-block of the coding unit.
[0113] As one possible implementation, the video coding device determines the coding mode of the corresponding parito block of the current coding unit when the difference between the first rate distortion cost and the minimum rate distortion cost is less than or equal to a second threshold, and determines the target coding result of the coding unit based on the coding mode of the corresponding parito block.
[0114] It should be noted that how the video coding unit determines the target coding result of the coding unit according to the coding mode of the corresponding pari passé block can be referred to the subsequent description of the embodiments of this disclosure, and will not be repeated here.
[0115] Understandably, the above embodiments of this disclosure supplement the technical solution of the video coding device to determine the target coding result of the coding unit when there is no residual in the candidate coding result corresponding to the minimum rate distortion cost, and the difference between the first rate distortion cost and the minimum rate distortion cost is less than or equal to the second threshold. Since the co-occurring block is the block in the reference frame that is at the same position as the current coding unit, the target coding result of the coding unit is determined based on the coding mode of the co-occurring block of the current coding unit in the reference frame, which is equivalent to determining the optimal coding result of the current coding unit by combining the coding sequence characteristics of the coding unit.
[0116] In one design, to further optimize the AMVR mode selection process, combined with Figure 3 ,like Figure 6 As shown, in step S206 above, if the video encoding device determines that the difference between the first rate distortion cost and the minimum rate distortion cost is not greater than the first threshold, the video encoding method provided in this embodiment of the present disclosure further includes S401-S403.
[0117] S401. If the difference between the first rate distortion cost and the minimum rate distortion cost is less than or equal to the first threshold, the video encoding device determines whether the encoding mode corresponding to the minimum rate distortion cost is a skip encoding mode.
[0118] The above-mentioned skip encoding mode is the Skip mode.
[0119] As one possible implementation, the video encoding device determines whether the difference between the first rate-distortion cost and the minimum rate-distortion cost, as described in step S205 above, is less than or equal to the first threshold. Further, if the difference is less than or equal to the first threshold, the video encoding device determines whether the encoding mode corresponding to the minimum rate-distortion cost is a skipped encoding mode based on the correspondence between rate-distortion cost and encoding modes.
[0120] S402. When the encoding mode corresponding to the minimum rate distortion cost is the skip encoding mode, the video encoding device determines whether the difference between the first rate distortion cost and the minimum rate distortion cost is greater than the second threshold.
[0121] The second threshold is less than the first threshold.
[0122] As one possible implementation, when the encoding mode corresponding to the minimum rate-distortion cost is the skip encoding mode, the video encoding device calculates the difference between the first rate-distortion cost and the second rate-distortion cost based on the first rate-distortion cost and the second rate-distortion cost determined in step S205 above. Further, the video encoding device compares the calculated difference with the magnitude of a second threshold.
[0123] It should be noted that the specific method for determining the second threshold can be referred to the description in the above embodiments of this disclosure, and will not be repeated here.
[0124] S403. When the coding mode corresponding to the minimum rate distortion cost is the skip coding mode, if the difference between the first rate distortion cost and the minimum rate distortion cost is greater than the second threshold, the candidate coding result corresponding to the minimum rate distortion cost is determined as the target coding result of the coding unit.
[0125] As one possible implementation, if the difference between the first rate-distortion cost and the minimum rate-distortion cost is greater than a second threshold, the video coding device determines the candidate coding result corresponding to the minimum rate-distortion cost. Further, the video coding device determines the candidate coding result corresponding to the minimum rate-distortion cost as the target coding result.
[0126] Understandably, when the coding mode corresponding to the minimum rate distortion cost is the skip coding mode, due to the characteristics of the skip coding mode, it means that the coding result corresponding to the minimum rate distortion cost has no residual, which indicates that the change between the current coding unit and the reference block is small. In this case, if the difference between the first rate distortion cost and the minimum rate distortion cost is greater than the second threshold which is smaller than the first threshold, it means that the coding mode corresponding to the minimum rate distortion cost is a more suitable coding mode for the current coding unit. This allows the selection of the AMVR mode to be skipped, and the candidate coding result corresponding to the minimum rate distortion cost is determined as the target coding result, which is the optimal coding result for the current coding unit.
[0127] In one design, to further optimize the AMVR mode selection process, combined with Figure 6 ,like Figure 7 As shown, in step S402 above, if the encoding mode corresponding to the minimum rate distortion cost is the skip encoding mode, the video encoding device determines that the difference between the first rate distortion cost and the minimum rate distortion cost is not greater than the second threshold. The video encoding method provided in this embodiment of the present disclosure further includes S404.
[0128] S404. When the coding mode corresponding to the minimum rate distortion cost is the skip coding mode, if the difference between the first rate distortion cost and the minimum rate distortion cost is less than or equal to the second threshold, the video coding device determines the target coding result of the coding unit according to the coding mode of the corresponding co-occurrence block of the coding unit.
[0129] As one possible implementation, the video coding device determines the coding mode of the corresponding parito block of the current coding unit when the difference between the first rate distortion cost and the minimum rate distortion cost is less than or equal to a second threshold, and determines the target coding result of the coding unit based on the coding mode of the parito block.
[0130] It should be noted that how the video coding unit determines the target coding result of the coding unit according to the coding mode of the corresponding pari passé block can be referred to the subsequent description of the embodiments of this disclosure, and will not be repeated here.
[0131] Understandably, the above embodiments of this disclosure supplement the technical solution of determining the target coding result of the coding unit when the coding mode corresponding to the minimum rate distortion cost is the skip coding mode, and the difference between the first rate distortion cost and the minimum rate distortion cost is less than or equal to the second threshold. Since the co-occurring block is the block in the reference frame that is at the same position as the current coding unit, the target coding result of the coding unit is determined based on the coding mode of the co-occurring block of the current coding unit in the reference frame, which is equivalent to determining the optimal coding result of the current coding unit by combining the coding sequence characteristics of the coding unit.
[0132] In one design, to enable the video encoding device to determine the target encoding result of the encoding unit based on the encoding mode of the corresponding pariomal block, such as... Figure 8 As shown, in the video encoding method provided in this embodiment, the target encoding result of the encoding unit is determined according to the encoding mode of the corresponding pari-block of the encoding unit, specifically including S501-S503.
[0133] S501, The video encoding device determines whether the encoding mode of the corresponding block of the encoding unit is the adaptive motion vector resolution mode.
[0134] As one possible implementation, the video encoding apparatus determines the corresponding co-occurrence block of the encoding unit in a reference frame of the image frame where the encoding unit is located, and obtains the encoding mode of the corresponding co-occurrence block. Further, the video encoding apparatus determines whether the encoding mode of the corresponding co-occurrence block is AMVR mode.
[0135] S502. When the encoding mode of the corresponding block of the encoding unit is the adaptive motion vector resolution mode, the video encoding device determines the encoding result corresponding to the adaptive motion vector resolution mode as the target encoding result of the encoding unit.
[0136] As one possible implementation, the video encoding device obtains the encoding mode of the corresponding co-location block of the encoding unit and determines whether the encoding mode of the co-location block is Adaptive Motion Vector Resolution (AMVR) mode. Further, if the encoding mode of the co-location block is AMVR mode, the video encoding device determines to encode the encoding unit in AMVR mode. Further still, the video encoding device determines the encoding result obtained by encoding the encoding unit based on AMVR mode as the target encoding result of the encoding unit.
[0137] S503. When the coding mode of the corresponding block of the coding unit is not the adaptive motion vector resolution mode, the video coding device determines the candidate coding result corresponding to the minimum rate distortion cost as the target coding result of the coding unit.
[0138] As one possible implementation, the video encoding device obtains the encoding mode of the corresponding co-occurrence block of the encoding unit and determines whether the encoding mode of the co-occurrence block is AMVR mode. Further, if the encoding mode of the co-occurrence block is not AMVR mode, the video encoding device determines the candidate encoding result corresponding to the minimum rate distortion cost. Further still, the video encoding device determines the candidate encoding result corresponding to the minimum rate distortion cost as the target encoding result.
[0139] It is understood that in the technical solution provided by the above embodiments of this disclosure, the optimal target encoding result for the encoding unit is determined based on the encoding mode of the encoding unit of the co-occurring block. Since the co-occurring block is the block in the reference frame that is at the same position as the current encoding unit, the target encoding result of the encoding unit is determined based on the encoding mode of the co-occurring block of the current encoding unit in the reference frame, which is equivalent to determining the optimal encoding result of the current encoding unit by combining the encoding sequence characteristics of the encoding unit.
[0140] In one design, to further optimize the AMVR mode selection process, combined with Figure 3 ,like Figure 9 As shown, in step S204 above, if the video encoding device fails to determine the first rate-distortion cost among multiple rate-distortion costs, the video encoding method provided in this embodiment of the disclosure further includes step S208.
[0141] S208. The video encoding device determines the target encoding result of the encoding unit according to the encoding mode of the corresponding pari-block of the encoding unit.
[0142] It should be noted that the specific method by which the video coding unit determines the target coding result of the coding unit based on the coding mode of the co-occurrence block can be referred to the description in the above embodiments of this disclosure, and will not be repeated here.
[0143] Understandably, when a video encoding device encodes a coding unit in multiple encoding modes, it may execute some fast algorithms, which may cause the preset encoding algorithm to be skipped, meaning there is no first-rate distortion cost. This design supplements the technical solution for the video encoding device to determine the target encoding result of the coding unit after the preset encoding algorithm is skipped. Since the co-occurring block is the block in the reference frame that is at the same position as the current coding unit, the target encoding result of the coding unit is determined based on the encoding mode of the co-occurring block of the current coding unit in the reference frame. This is equivalent to combining the encoding sequence characteristics of the coding unit to determine the optimal encoding result of the current coding unit.
[0144] In a design, such as Figure 10 As shown, this disclosure also provides a video encoding method combined with the video encoding method disclosed in the above embodiments, including S601-S608.
[0145] S601. The video encoding device encodes the current encoding unit using an encoding mode other than AMVR mode and determines the minimum rate distortion cost.
[0146] S602, The video encoding device determines the rate-distortion cost of the Inter ME mode and identifies it as the second rate-distortion cost.
[0147] S603, The video encoding device determines whether the difference between the second rate distortion cost and the minimum rate distortion cost is greater than the first threshold.
[0148] It should be noted that if the video encoding device determines that the difference between the second rate distortion cost and the minimum rate distortion cost is not greater than the first threshold, then step S604 is executed; if the video encoding device determines that the difference between the second rate distortion cost and the minimum rate distortion cost is greater than the first threshold, then step S608 is executed.
[0149] S604. When there is no residual in the encoding result corresponding to the minimum rate distortion cost, the video encoding device determines whether the difference between the second rate distortion cost and the minimum rate distortion cost is greater than the second threshold.
[0150] It should be noted that, if the encoding result corresponding to the minimum rate distortion cost has no residual, and the video encoding device determines that the difference between the second rate distortion cost and the minimum rate distortion cost is not greater than the second threshold, then step S605 is executed; if the video encoding device determines that the difference between the second rate distortion cost and the minimum rate distortion cost is greater than the second threshold, then step S608 is executed.
[0151] S605. The video encoding device determines the encoding mode of the corresponding pari-block of the current encoding unit.
[0152] S606. The video encoding device determines whether the encoding mode of the corresponding block of the current encoding unit is AMVR mode.
[0153] It should be noted that if the video encoding device determines that the encoding mode of the corresponding block of the encoding unit is AMVR mode, then step S607 is executed; if the video encoding device determines that the encoding mode of the corresponding block of the encoding unit is not AMVR mode, then step S608 is executed.
[0154] S607. The video encoding device encodes the current encoding unit in AMVR mode and determines the resulting encoding result as the target encoding result.
[0155] S608, The video encoding device determines the encoding result corresponding to the minimum rate distortion cost as the target encoding result.
[0156] It should be noted that the specific implementation of the video encoding method in steps S601-S608 above can be referred to the description in the above embodiments of this disclosure, and will not be repeated here.
[0157] When conducting actual tests based on the above-described technical solution of this disclosure, the encoding speed of the encoder's AMVR mode selection can be significantly improved, and the impact on compression performance is relatively small.
[0158] The foregoing primarily describes the solutions provided by the embodiments of this disclosure from a methodological perspective. To achieve the aforementioned functions, the display device or terminal equipment for media resources includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should readily recognize that, based on the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein, this disclosure can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this disclosure.
[0159] This disclosure embodiment can, according to the above method, exemplarily divide a media resource display device or terminal device into functional modules. For example, the media resource display device or terminal device may include various functional modules corresponding to each functional division, or two or more functions may be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module. It should be noted that the module division in this disclosure embodiment is illustrative and only represents one logical functional division; in actual implementation, there may be other division methods.
[0160] Figure 11 This is a schematic diagram illustrating the structure of a video encoding apparatus according to an exemplary embodiment. (Refer to...) Figure 11 As shown, the encoding device 70 provided in this embodiment includes an acquisition unit 701, a processing unit 702, and a determination unit 703.
[0161] The acquisition unit 701 is used to acquire coding units in the video to be encoded. The processing unit 702 is used to encode the coding units using multiple coding modes to obtain multiple candidate coding results. The determination unit 703 is used to determine the rate-distortion cost of each coding result among the multiple candidate coding results to obtain multiple rate-distortion costs. The determination unit 703 is further used to determine a first rate-distortion cost and a minimum rate-distortion cost from the multiple rate-distortion costs. The first rate-distortion cost is the rate-distortion cost corresponding to a preset coding mode among the multiple coding modes. The preset coding mode is a coding mode based on motion estimation. The determination unit 703 is further used to determine the candidate coding result corresponding to the minimum rate-distortion cost as the target coding result of the coding unit if the difference between the first rate-distortion cost and the minimum rate-distortion cost is greater than a first threshold. The target coding result is used to form the coding data of the video to be encoded.
[0162] Optionally, the determining unit 703 is further configured to determine whether there is a residual in the candidate coding result corresponding to the minimum rate distortion cost when the difference between the first rate distortion cost and the minimum rate distortion cost is less than or equal to the first threshold; and if there is no residual in the candidate coding result corresponding to the minimum rate distortion cost, and the difference between the first rate distortion cost and the minimum rate distortion cost is greater than the second threshold, then the candidate coding result corresponding to the minimum rate distortion cost is determined as the target coding result of the coding unit; the second threshold is less than the first threshold.
[0163] Optionally, the determining unit 703 is further configured to determine the target coding result of the coding unit according to the coding mode of the corresponding block of the coding unit if the difference between the first rate distortion cost and the minimum rate distortion cost is less than or equal to the second threshold when there is no residual in the candidate coding result corresponding to the minimum rate distortion cost.
[0164] Optionally, the determining unit 703 is further configured to determine whether the coding mode corresponding to the minimum rate distortion cost is a skipped coding mode if the difference between the first rate distortion cost and the minimum rate distortion cost is less than or equal to the first threshold; if the coding mode corresponding to the minimum rate distortion cost is a skipped coding mode, and if the difference between the first rate distortion cost and the minimum rate distortion cost is greater than the second threshold, then the candidate coding result corresponding to the minimum rate distortion cost is determined as the target coding result of the coding unit; the second threshold is less than the first threshold.
[0165] Optionally, the determining unit 703 is further configured to, when the coding mode corresponding to the minimum rate distortion cost is the skip coding mode, determine the target coding result of the coding unit according to the coding mode of the corresponding co-position block of the coding unit if the difference between the first rate distortion cost and the minimum rate distortion cost is less than or equal to the second threshold.
[0166] Optionally, the determining unit 703 is also used to determine the target encoding result of the encoding unit according to the encoding mode of the corresponding co-occurrence block of the encoding unit.
[0167] Optionally, the determining unit 703 is specifically configured to determine the coding result corresponding to the adaptive motion vector resolution mode as the target coding result of the coding unit when the coding mode of the corresponding co-block of the coding unit is the adaptive motion vector resolution mode; and to determine the candidate coding result corresponding to the minimum rate distortion cost as the target coding result of the coding unit when the coding mode of the corresponding co-block of the coding unit is not the adaptive motion vector resolution mode.
[0168] Optionally, in the video encoding apparatus 70, the adaptive motion vector resolution mode is not included among the multiple encoding modes.
[0169] When the functions of the integrated modules described above are implemented in hardware, this disclosure provides a possible structural schematic diagram of the electronic device involved in the above embodiments. For example... Figure 12 As shown, the electronic device 80 includes a processor 801, a memory 802, and a bus 803. The processor 801 and the memory 802 can be connected via the bus 803.
[0170] Processor 801 is the control center of electronic device 80. It can be a single processor or a collective term for multiple processing elements. For example, processor 801 can be a general-purpose central processing unit (CPU) or other general-purpose processors. Among them, the general-purpose processor can be a microprocessor or any conventional processor.
[0171] As one embodiment, processor 801 may include one or more CPUs, for example... Figure 12 CPU 0 and CPU 1 are shown in the diagram.
[0172] The memory 802 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), disk storage medium or other magnetic storage device, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but is not limited thereto.
[0173] In one possible implementation, the memory 802 can exist independently of the processor 801. The memory 802 can be connected to the processor 801 via a bus 803 and is used to store instructions or program code. When the processor 801 calls and executes the instructions or program code stored in the memory 802, it can implement the sensor determination method provided in the embodiments of this disclosure.
[0174] In another possible implementation, the memory 802 can also be integrated with the processor 801.
[0175] The 803 bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. This bus can be divided into address bus, data bus, and control bus, etc. For ease of representation, Figure 12 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0176] It should be pointed out that, Figure 12 The structure shown does not constitute a limitation on the electronic device 80. Except... Figure 12 In addition to the components shown, the electronic device 80 may include more or fewer components than illustrated, or combine certain components, or have different component arrangements.
[0177] Optionally, the electronic device 80 provided in this embodiment may further include a communication interface 804.
[0178] Communication interface 804 is used to connect to other devices via a communication network. This communication network can be Ethernet, a wireless access network, a wireless local area network (WLAN), etc. Communication interface 804 may include a receiving unit for receiving data and a transmitting unit for transmitting data.
[0179] In one design, the communication interface of the electronic device 80 provided in this embodiment of the present disclosure may also be integrated into the processor.
[0180] In another hardware architecture of the server provided in this disclosure embodiment, the electronic device may include a processor and a communication interface. The processor is coupled to the communication interface.
[0181] The functions of the processor can be referred to in the processor description above. In addition, the processor also has storage functions, which can be referred to in the memory function description above.
[0182] The communication interface is used to provide data to the processor. This communication interface can be an internal interface of the electronic device 80 or an external interface of the electronic device 80.
[0183] It should be noted that the above-mentioned alternative hardware structure does not constitute a limitation on the electronic device. In addition to the above-mentioned alternative hardware component, the electronic device may include more or fewer components, or combine certain components, or have different component arrangements.
[0184] When the functions of the integrated modules described above are implemented in hardware, the present disclosure provides a structural diagram of the middleware involved in the above embodiments, which can be referred to the structural diagram of the execution machine described above.
[0185] This disclosure also provides a computer-readable storage medium storing instructions that, when executed by a computer, perform each step of the media resource display method flow shown in the above method embodiments.
[0186] This disclosure also provides a computer program product containing instructions that, when executed on a computer, cause the computer to perform the media resource display method described in the above method embodiments.
[0187] The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), registers, hard disks, optical fibers, compact disc read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing, or any other form of computer-readable storage medium in the art. An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium may also be a component of the processor. The processor and the storage medium may reside in an application-specific integrated circuit (ASIC). In this embodiment of the disclosure, the computer-readable storage medium may be any tangible medium that contains or stores a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0188] Since the server, user equipment, computer-readable storage medium, and computer program product in the embodiments of this disclosure can be applied to the above methods, the technical effects that can be obtained can also be referred to the above method embodiments. The embodiments of this disclosure will not be repeated here.
[0189] The above are merely specific embodiments of this disclosure, but the scope of protection of this disclosure is not limited thereto. Any changes or substitutions within the technical scope disclosed in this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A video encoding method, characterized in that, The method includes: The coding units in the video to be encoded are obtained, and the coding units are encoded using multiple coding modes to obtain multiple candidate coding results; Determine the rate-distortion cost of each encoding result among the multiple candidate encoding results to obtain multiple rate-distortion costs; A first rate-distortion cost and a minimum rate-distortion cost are determined from the plurality of rate-distortion costs. The first rate-distortion cost is the rate-distortion cost corresponding to a preset coding mode among the plurality of coding modes. The preset coding mode is a coding mode based on motion estimation. If the difference between the first rate-distortion cost and the minimum rate-distortion cost is greater than a first threshold, the candidate coding result corresponding to the minimum rate-distortion cost is determined as the target coding result of the coding unit; the target coding result is used to form the coding data of the video to be encoded. Where the first rate-distortion cost is not included among the plurality of rate-distortion costs, the method further includes: The target encoding result of the encoding unit is determined according to the encoding mode of the corresponding block of the encoding unit; The determination of the target encoding result of the encoding unit based on the encoding mode of the corresponding block of the encoding unit includes: When the encoding mode of the corresponding block of the encoding unit is the adaptive motion vector resolution mode, the encoding result corresponding to the adaptive motion vector resolution mode is determined as the target encoding result of the encoding unit; If the encoding mode of the corresponding block of the encoding unit is not the adaptive motion vector resolution mode, the candidate encoding result corresponding to the minimum rate distortion cost is determined as the target encoding result of the encoding unit.
2. The video encoding method according to claim 1, characterized in that, The method further includes: If the difference between the first rate-distortion cost and the minimum rate-distortion cost is less than or equal to the first threshold, determine whether there is a residual in the candidate coding result corresponding to the minimum rate-distortion cost; If the candidate coding result corresponding to the minimum rate distortion cost has no residual, and the difference between the first rate distortion cost and the minimum rate distortion cost is greater than a second threshold, then the candidate coding result corresponding to the minimum rate distortion cost is determined as the target coding result of the coding unit; the second threshold is less than the first threshold.
3. The video encoding method according to claim 2, characterized in that, The method further includes: If the candidate coding result corresponding to the minimum rate distortion cost has no residual, and if the difference between the first rate distortion cost and the minimum rate distortion cost is less than or equal to the second threshold, then the target coding result of the coding unit is determined according to the coding mode of the corresponding block of the coding unit.
4. The video encoding method according to claim 1, characterized in that, The method further includes: If the difference between the first rate-distortion cost and the minimum rate-distortion cost is less than or equal to the first threshold, it is determined whether the encoding mode corresponding to the minimum rate-distortion cost is a skip encoding mode. When the coding mode corresponding to the minimum rate distortion cost is a skip coding mode, if the difference between the first rate distortion cost and the minimum rate distortion cost is greater than a second threshold, then the candidate coding result corresponding to the minimum rate distortion cost is determined as the target coding result of the coding unit; the second threshold is less than the first threshold.
5. The video encoding method according to claim 4, characterized in that, The method further includes: When the encoding mode corresponding to the minimum rate distortion cost is a skip encoding mode, if the difference between the first rate distortion cost and the minimum rate distortion cost is less than or equal to the second threshold, then the target encoding result of the encoding unit is determined according to the encoding mode of the corresponding block of the encoding unit.
6. The video encoding method according to any one of claims 1-5, characterized in that, The adaptive motion vector resolution mode is not included among the multiple encoding modes.
7. A video encoding device, characterized in that, include: Acquisition unit, processing unit, and determination unit; The acquisition unit is used to acquire the encoding units in the video to be encoded; The processing unit is used to encode the encoding unit in multiple encoding modes to obtain multiple candidate encoding results; The determining unit is used to determine the rate-distortion cost of each coding result among the plurality of candidate coding results, thereby obtaining a plurality of rate-distortion costs; The determining unit is further configured to determine a first rate-distortion cost and a minimum rate-distortion cost from the plurality of rate-distortion costs, wherein the first rate-distortion cost is a rate-distortion cost corresponding to a preset coding mode among the plurality of coding modes, and the preset coding mode is a coding mode based on motion estimation. The determining unit is further configured to determine the candidate encoding result corresponding to the minimum rate distortion cost as the target encoding result of the encoding unit when the difference between the first rate distortion cost and the minimum rate distortion cost is greater than a first threshold; the target encoding result is used to form the encoded data of the video to be encoded. The determining unit, when the first rate-distortion cost is not included among the plurality of rate-distortion costs, is further configured to determine the target encoding result of the encoding unit according to the encoding mode of the corresponding pari-block of the encoding unit; The determining unit is specifically used to determine the encoding result corresponding to the adaptive motion vector resolution mode as the target encoding result of the encoding unit when the encoding mode of the corresponding pari-block of the encoding unit is the adaptive motion vector resolution mode. If the encoding mode of the corresponding block of the encoding unit is not the adaptive motion vector resolution mode, the candidate encoding result corresponding to the minimum rate distortion cost is determined as the target encoding result of the encoding unit.
8. An electronic device, characterized in that, include: A processor and a communication interface; the communication interface is coupled to the processor, the processor being used to run computer programs or instructions to implement the video encoding method as described in any one of claims 1-6.
9. A computer-readable storage medium storing instructions, characterized in that, When the computer executes the instruction, the computer performs the video encoding method as described in any one of claims 1-6.
Citation Information
Patent Citations
Video coding method, coding device, electronic equipment and storage medium
CN112261413A
