CN116723324A - Video encoding method, video encoding device, electronic equipment and storage medium - Google Patents

Video encoding method, video encoding device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116723324A
CN116723324A CN202310779634.0A CN202310779634A CN116723324A CN 116723324 A CN116723324 A CN 116723324A CN 202310779634 A CN202310779634 A CN 202310779634A CN 116723324 A CN116723324 A CN 116723324A
Authority
CN
China
Prior art keywords
coding
distortion cost
encoding
mode
video
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310779634.0A
Other languages
Chinese (zh)
Inventor
郑羽珊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202310779634.0A priority Critical patent/CN116723324A/en
Publication of CN116723324A publication Critical patent/CN116723324A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/146Data rate or code amount at the encoder output
    • H04N19/147Data rate or code amount at the encoder output according to rate distortion criteria
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/124Quantisation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/154Measured or subjectively estimated visual quality after decoding, e.g. measurement of distortion
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/157Assigned coding mode, i.e. the coding mode being predefined or preselected to be further used for selection of another element or parameter
    • H04N19/159Prediction type, e.g. intra-frame, inter-frame or bidirectional frame prediction
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction
    • H04N19/51Motion estimation or motion compensation
    • H04N19/513Processing of motion vectors
    • H04N19/517Processing of motion vectors by encoding
    • H04N19/52Processing of motion vectors by encoding by predictive encoding

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The disclosure relates to a video coding method, a video coding device, electronic equipment and a storage medium, and relates to the technical field of video coding. The method comprises the following steps: acquiring coding units in a video to be coded, and coding the coding units in a plurality of coding modes to obtain a plurality of candidate coding results; determining the rate distortion cost of each coding result in the plurality of candidate coding results to obtain a plurality of rate distortion costs; determining 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 the rate-distortion cost corresponding to a preset coding mode in the plurality of coding modes; under the condition that the difference value between the first rate distortion cost and the minimum rate distortion cost is larger than a first threshold value, determining a candidate coding result corresponding to the minimum rate distortion cost as a target coding result of the coding unit; the target coding result is used for forming coding data of the video to be coded, so that the AMVR selection process is accelerated based on coding sequence characteristics, and larger coding quality loss is avoided.

Description

Video encoding method, video encoding device, electronic equipment and storage medium
Technical Field
The disclosure relates to the technical field of video coding, and in particular relates to a video coding method, a video coding device, electronic equipment and a storage medium.
Background
In order to reduce the resources used by video data during transmission, video data may be compressed by video coding techniques. Video coding techniques typically use prediction methods (e.g., inter-prediction, intra-prediction, etc.) that exploit redundancy present in video images or sequences to compress video data to use lower bit rates while avoiding or minimizing degradation of video quality.
In general, in the video compression process, there may be a problem of loss of coding quality, thereby reducing the presentation quality of video data. Therefore, how to reduce the coding quality loss in video compression process is a problem to be solved.
Disclosure of Invention
The present disclosure provides a video encoding method, apparatus, device, and storage medium for reducing encoding quality loss in a video encoding process. The technical scheme of the present disclosure is as follows:
according to a first aspect of embodiments of the present disclosure, there is provided a video encoding method, the method including: acquiring coding units in a video to be coded, and coding the coding units in a plurality of coding modes to obtain a plurality of candidate coding results; determining the rate distortion cost of each coding result in the plurality of candidate coding results to obtain a plurality of rate distortion costs; determining 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 in the plurality of coding modes, and the preset coding mode is a coding mode for coding based on motion estimation; under the condition that the difference value between the first rate distortion cost and the minimum rate distortion cost is larger than a first threshold value, determining a candidate coding result corresponding to the minimum rate distortion cost as a target coding result of the coding unit; the target encoding result is used to compose encoded data of the video to be encoded.
Optionally, if the difference between the first rate-distortion cost and the minimum rate-distortion cost is smaller than or equal to a first threshold, judging whether a residual exists in the candidate coding result corresponding to the minimum rate-distortion cost; under the condition that a candidate coding result corresponding to the minimum rate distortion cost has no residual error, if the difference value between the first rate distortion cost and the minimum rate distortion cost is larger than a second threshold value, determining the candidate coding result corresponding to the minimum rate distortion cost as a target coding result of the coding unit; the second threshold is less than the first threshold.
Optionally, if the difference between the first rate-distortion cost and the minimum rate-distortion cost is less than or equal to the second threshold under the condition that the candidate coding result corresponding to the minimum rate-distortion cost has no residual, determining the target coding result of the coding unit according to the coding mode of the corresponding co-located block of the coding unit.
Optionally, determining whether the coding mode corresponding to the minimum rate distortion cost is a skipped coding mode or not when the difference between the first rate distortion cost and the minimum rate distortion cost is smaller than or equal to a first threshold; under the condition that the coding mode corresponding to the minimum rate distortion cost is a skip coding mode, if the difference value between the first rate distortion cost and the minimum rate distortion cost is larger than a second threshold value, determining a candidate coding result corresponding to the minimum rate distortion cost as a target coding result of the coding unit; the second threshold is less than the first threshold.
Optionally, if 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 smaller than or equal to the second threshold, determining a target coding result of the coding unit according to the coding mode of the corresponding co-located block of the coding unit.
Optionally, in the case that the first rate-distortion cost is not included in the plurality of rate-distortion costs, the video encoding method further includes: and determining the target coding result of the coding unit according to the coding mode of the corresponding homobit block of the coding unit.
Optionally, determining the target coding result of the coding unit according to the coding mode of the corresponding homobit block of the coding unit includes: under the condition that the coding mode of the coding unit corresponding to the homonymous block is the self-adaptive motion vector resolution mode, determining a coding result corresponding to the self-adaptive motion vector resolution mode as a target coding result of the coding unit; and under the condition that the coding mode of the coding unit corresponding to the homonymous block is not the adaptive motion vector resolution mode, determining a candidate coding result corresponding to the minimum rate distortion cost as a target coding result of the coding unit.
Optionally, the adaptive motion vector resolution mode is not included in the plurality of coding modes.
According to a second aspect of embodiments of the present disclosure, there is provided a video encoding apparatus including: an acquisition unit, a processing unit and a determination unit. The acquisition unit is used for acquiring the coding unit in the video to be coded. The processing unit is used for encoding the encoding unit in a plurality of encoding modes to obtain a plurality of candidate encoding results. The determining unit is used for determining the rate distortion cost of each of the plurality of candidate encoding results to obtain 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, the first rate-distortion cost being a rate-distortion cost corresponding to a preset encoding mode of the plurality of encoding modes, the preset encoding mode being an encoding mode that encodes based on motion estimation. The determining unit is further configured to determine, as a target encoding result of the encoding unit, a candidate encoding result corresponding to the minimum rate-distortion cost if a 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 compose encoded data of the video to be encoded.
Optionally, the determining unit is further configured to determine whether a residual exists in the candidate encoding result corresponding to the minimum rate-distortion cost if the difference between the first rate-distortion cost and the minimum rate-distortion cost is less than or equal to a first threshold; under the condition that a candidate coding result corresponding to the minimum rate distortion cost has no residual error, if the difference value between the first rate distortion cost and the minimum rate distortion cost is larger than a second threshold value, determining the candidate coding result corresponding to the minimum rate distortion cost as a target coding result of the coding unit; the second threshold is less than the first threshold.
Optionally, the determining unit is further configured to determine, if the difference between the first rate-distortion cost and the minimum rate-distortion cost is less than or equal to the second threshold under the condition that the candidate encoding result corresponding to the minimum rate-distortion cost has no residual, a target encoding result of the encoding unit according to the encoding mode of the encoding unit corresponding to the co-located block.
Optionally, the determining unit is further configured to determine, if the difference between the first rate-distortion cost and the minimum rate-distortion cost is less than or equal to a first threshold, whether the coding mode corresponding to the minimum rate-distortion cost is a skipped coding mode; under the condition that the coding mode corresponding to the minimum rate distortion cost is a skip coding mode, if the difference value between the first rate distortion cost and the minimum rate distortion cost is larger than a second threshold value, determining a candidate coding result corresponding to the minimum rate distortion cost as a target coding result of the coding unit; the second threshold is less than the first threshold.
Optionally, the determining unit is further configured to determine, if the difference between the first rate-distortion cost and the minimum rate-distortion cost is less than or equal to the second threshold under the condition that the coding mode corresponding to the minimum rate-distortion cost is the skip coding mode, a target coding result of the coding unit according to the coding mode of the co-located block corresponding to the coding unit.
Optionally, the determining unit is further configured to determine a target encoding result of the encoding unit according to the encoding mode of the corresponding co-located block of the encoding unit.
Optionally, the determining unit is specifically configured to determine, as the target encoding result of the encoding unit, the encoding result corresponding to the adaptive motion vector resolution mode in the case where the encoding mode of the encoding unit corresponding to the homonymous block is the adaptive motion vector resolution mode; and under the condition that the coding mode of the coding unit corresponding to the homonymous block is not the adaptive motion vector resolution mode, determining a candidate coding result corresponding to the minimum rate distortion cost as a target coding result of the coding unit.
Optionally, in the video encoding device, the adaptive motion vector resolution mode is not included in the plurality of encoding modes.
According to a third aspect of embodiments of the present disclosure, there is provided an electronic device, comprising: a processor, a memory for storing instructions executable by the processor; wherein the processor is configured to execute instructions to implement the video encoding method of the first aspect described above.
According to a fourth aspect of embodiments of the present disclosure, there is provided a computer-readable storage medium having instructions stored thereon, which, when executed by a processor of an electronic device, enable the electronic device to perform the video encoding method of the first aspect as described above.
The present disclosure provides a video encoding method, which brings at least the following beneficial effects: the method and the device can realize the selection of the adaptive motion vector resolution (adaptive motion vector resolution, AMVR) mode of any coding unit in the video to be coded, and determine an optimal target coding result corresponding to the coding unit. And because the AMVR mode is a coding mode which is further expanded on the basis of the preset coding mode, when the difference value between the rate distortion cost corresponding to the preset coding mode (for example, the Inter mode) and the minimum rate distortion cost is larger than a first threshold value, the AMVR mode can be determined to be unsuitable for coding of the current coding unit, selection of the AMVR mode is skipped, and the candidate coding result corresponding to the minimum rate distortion cost is determined to be the optimal coding result of the current coding unit. In addition, the first threshold can represent the coding sequence characteristics of the coding unit to a certain extent, so that the optimal target coding result determined by the video coding device is more reasonable, and the coding unit is prevented from having larger coding quality loss.
It should be noted that, the technical effects caused by any implementation manner of the second aspect to the fifth aspect may refer to the technical effects caused by the corresponding implementation manner in the first aspect, which are not described herein.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure and do not constitute an undue limitation on the disclosure.
Fig. 1 is an exemplary block diagram of a block-based video coding system provided by an embodiment of the present disclosure;
fig. 2 is a schematic structural diagram of a video encoding system according to an embodiment of the present disclosure;
fig. 3 is a schematic diagram of a video encoding method according to an embodiment of the disclosure;
FIG. 4 is a second flowchart of a video encoding method according to an embodiment of the disclosure;
FIG. 5 is a third flowchart of a video encoding method according to an embodiment of the disclosure;
FIG. 6 is a flowchart of a video encoding method according to an embodiment of the present disclosure;
FIG. 7 is a fifth flowchart of a video encoding method according to an embodiment of the present disclosure;
FIG. 8 is a flowchart of a video encoding method according to an embodiment of the present disclosure;
FIG. 9 is a diagram of a video encoding method according to an embodiment of the disclosure;
FIG. 10 is a schematic diagram of a video encoding method according to an embodiment of the disclosure;
fig. 11 is a schematic structural diagram of a video encoding apparatus according to an embodiment of the present disclosure;
fig. 12 is a schematic structural diagram of an electronic device according to an embodiment of the disclosure.
Detailed Description
In order to enable those skilled in the art to better understand the technical solutions of the present disclosure, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the foregoing figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the disclosure described herein may be capable of operation in sequences other than those illustrated or otherwise described herein. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present disclosure as detailed in the accompanying claims.
In addition, in the description of the embodiments of the present disclosure, "/" means or means, for example, a/B may mean a or B, unless otherwise specified. "and/or" herein is merely an association relationship describing an association object, and means that three relationships may exist, for example, a and/or B may mean: a exists alone, A and B exist together, and B exists alone. In addition, in the description of the embodiments of the present disclosure, "a plurality" means two or more than two.
It should be noted that, the user information (including, but not limited to, user equipment information, user personal information, user behavior information, etc.) and the data (including, but not limited to, program code, etc.) related to the present disclosure are information and data authorized by the user or sufficiently authorized by each party.
Before explaining the embodiments of the present disclosure in detail, some related technical terms and related technologies related to the embodiments of the present disclosure are described.
Fig. 1 shows a block diagram of a block-based video coding system. The input video signal includes a signal of a plurality of image frames, each of which may be processed block by block, and a block may be, for example, but not limited to, a Coding Tree Unit (CTU), a maximum coding unit (largest coding unit, LCU), a Coding Unit (CU), a Prediction Unit (PU), a Transform Unit (TU), and the like.
The principle of video coding is that, using the similarity between consecutive image frames and the similarity between adjacent blocks within the same image frame/stripe, encoding a part of representative image frames or blocks according to original pixel values, and predicting the pixel values of other image frames or blocks except the representative image frames or blocks, using the similarity between consecutive image frames or the similarity between adjacent blocks, thereby implementing compression of video signals to remove redundancy in spatial and temporal dimensions.
In performing video encoding, intra-prediction and/or inter-prediction may be performed on blocks of a current image frame depending on whether similarity between neighboring blocks or similarity between consecutive image frames is utilized.
Intra prediction (or "spatial prediction") predicts a current block using pixel values of pixels (which are referred to as reference pixels) of reconstructed neighboring blocks (neighboring blocks refer to neighboring blocks that have completed encoding) from the same image frame/slice stored in a memory, resulting in a predicted block. Intra prediction reduces the spatial redundancy inherent in video signals.
The coding modes corresponding to intra prediction may include, for example, a luminance intra prediction mode, a Planar mode, a Direct Current (DC) mode, an angle mode, and the like.
Inter prediction (also referred to as "temporal prediction" or "motion compensated prediction", corresponding to the portions of "motion estimation" and "motion compensation" in fig. 1) predicts a current block using reconstructed pixels (reconstructed pixels refer to pixels that have completed encoding) in already encoded image frames (referred to as "reference image frames") stored in an image frame buffer, resulting in a predicted block. Inter prediction reduces the temporal redundancy inherent in video signals. The temporal prediction signal for a current block is typically determined based on one or more prediction motion vectors that indicate the motion offset and direction between the current block and its temporal reference (referred to as a "reference block," which is a block in a reference image frame). The process of determining the predicted motion vector is called motion estimation; the process of determining a 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 is referred to as a predicted block. In addition, if the encoding side and the decoding side support the use of a plurality of reference image frames, the encoding side additionally transmits a reference image frame index for identifying which reference image frame in the image frame buffer the temporal prediction signal is from, that is, which reference image frame needs to be used when motion compensation, when transmitting the encoding information to the decoding side.
Among them, the coding modes corresponding to the Inter prediction may include, for example, merge mode, skip mode, inter mode, and sub-block-based temporal motion vector prediction (sbtvp) mode, etc.
The Merge mode is to directly use a spatial neighboring Motion Vector (MV) or a temporal neighboring MV as the final MV of the current coding block, and motion estimation is not needed (i.e., there is no motion vector difference (motion vector difference, MVD)). The coding end constructs a Merge candidate list (the candidate list contains motion information of adjacent blocks, such as MV, reference frame list, reference frame index, etc.), and the coding end selects the best candidate MV through Rate-distortion optimization (Rate-distortion optimization, RDO).
Skip mode is a special Merge mode, in which transform and quantization of prediction residual are skipped, and the coding end only needs to code the index of MV in candidate list, and does not need to code quantized residual.
Inter mode requires Inter motion search of the predicted block to obtain motion information corresponding to the best matching block, and then encodes the motion information and prediction residual information. Inter modes include, among others, advanced motion vector prediction (advanced motion vector prediction, AMVP) mode, symmetric MVD coding (Symmetric MVD coding, SMVD) mode, and AMVR mode, for example.
The AMVP mode firstly constructs an MV candidate list through a spatial domain adjacent block and a temporal domain adjacent block, selects an optimal MV from the MV candidate list to obtain a motion vector predicted value (motion vector prediction, MVP) serving as a current block, then performs motion search by taking the MVP as a search starting point to obtain the optimal MV, and further codes a difference MVD between the searched MVs and the MVP.
The AMVR mode allows MVDs of CUs to be encoded with different precision.
Depending on the mode of the current CU (conventional AMVP mode or affine AVMP mode), the MVD of the current CU may be adaptively selected as follows:
1. conventional AMVP mode: 1/4 luminance pixel precision, 1/2 luminance pixel precision, integer luminance pixel precision, or four times luminance pixel precision.
2. Affine AMVP mode: 1/4 luminance pixel precision, integer luminance pixel precision, or 1/16 luminance pixel precision.
After intra and/or inter prediction, intra/inter mode decisions in the encoder select the best prediction mode, e.g. based on a rate distortion optimization method. Then, the difference between the current block and the predicted block is determined, specifically, for example, the pixel value of the corresponding pixel of the predicted block is subtracted from the pixel value of each pixel of the current block to obtain a predicted residual, and then the prediction related information such as the coding mode (inter or intra), the motion information and the like and the predicted residual line are coded to obtain the coding information of the current block. The encoded information may be transmitted to the decoding side through a bitstream. In addition, based on the prediction residual and the prediction block, a reconstructed signal of the current block, that is, a pixel value of each pixel in the current block after encoding compression, may be determined and stored in the memory. Before placing the reconstructed signal of the current block (which may be referred to as a "reconstructed block") into the image frame buffer for use as a reference block for encoding future blocks, further loop filtering may be applied to the reconstructed block, such as, but not limited to, at least one of a deblocking filter, a pixel adaptive offset, an adaptive loop filter, and the like.
In practical applications, the performance of each coding mode is generally measured according to the rate distortion cost of each coding mode. The rate-distortion cost of a coding mode is determined by the coding distortion under the coding of the mode, the number of bits that need to be spent for coding, and the quantization parameters.
Illustratively, in an encoder, rate distortion optimization is employed for mode selection, as follows:
argminj=d+λ R formula one
Wherein argmin represents a variable value when the objective function J takes the minimum value, J is a rate distortion cost of a specific mode code, D is coding distortion generated by using the mode code, R is the number of bits (i.e., code rate) consumed by the mode code, and λ is a rate distortion optimization factor related to a quantization parameter. The specific calculation formula of lambda is related to the coding standard and the coder, and the calculation formula is as follows:
λ=a*2 QP/6 formula II
Where QP is quantization parameter and a is constant.
In the related art, generally, before encoding a video to be encoded, an encoder classifies video frames included in the video to be encoded first, for example, according to the level of the video frames, the video frames are divided into a high-level video frame and a low-level video frame (the high-level video frame is not used as a reference frame by other video frames). Furthermore, the encoder does not execute the selection flow of the AMVR mode for the high-level video frames, and the encoding of the video to be encoded is accelerated by reducing the support range of the selection flow of the AMVR mode. However, the AMVR mode selection procedure is forcibly skipped considering only the type of video frame, and there is a large encoding quality loss for the video frame that is skipped by the AMVR mode selection procedure, which is not processed according to the encoding sequence of the encoding unit.
In addition, the related art further includes another method for selecting an AMVR mode, specifically, rate distortion optimization is performed by preferentially adopting other modes except the AMVR mode, and when the optimal mode in the other modes is a skip mode without residual error, the selection process of the AMVR mode is skipped, so as to achieve the purpose of accelerating the encoding speed of video encoding. However, for video sequences with complex scenes, skipping the AMVR mode directly brings a large coding quality loss, so that the application range of the scheme is small and the scheme has no universality.
In view of this, the embodiments of the present disclosure provide a video encoding method for optimizing an AMVR mode selection procedure for any one of encoding units in a video to be encoded, so that a rate-distortion optimization decision can obtain an optimal overall encoding quality.
The video encoding method provided by the embodiments of the present disclosure will be described in detail with reference to the accompanying drawings.
The video coding method provided by the embodiment of the disclosure can be applied to a video coding system, and fig. 2 shows a schematic structural diagram of the video coding system. As shown in fig. 2, the video encoding system 10 includes a video encoding apparatus 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 may be connected by a wired manner or may be connected by a wireless manner, which is not limited in the embodiment of the present disclosure.
The video encoding device 11 may store a plurality of encoding modes including, for example, a Merge mode, a Skip mode, an Inter mode, a luminance intra prediction mode, a Planar mode, and the like.
The video encoding device 11 is configured to encode an encoding unit in a video to be encoded in a plurality of encoding modes to obtain a plurality of candidate encoding results, and determine a rate-distortion cost of each encoding result in the plurality of candidate encoding results to obtain a plurality of rate-distortion costs. The video encoding device 11 is further configured to determine a first rate-distortion cost corresponding to a preset encoding mode from the plurality of encoding modes, and a minimum rate-distortion cost from the plurality of rate-distortion costs. The video encoding device 11 is further configured to determine, as a target encoding result of the encoding unit, a candidate encoding result corresponding to the minimum rate-distortion cost, where the target encoding result is used to form encoded data of the video to be encoded, if a difference between the first rate-distortion cost and the minimum rate-distortion cost is greater than a first threshold.
The video encoding apparatus 11 may implement the video encoding method of the embodiments of the present disclosure in various electronic devices 12. For example, the electronic device 12 may be a cell phone, tablet computer, wearable device, in-vehicle device, augmented reality (augmented reality, AR)/Virtual Reality (VR) device, notebook computer, ultra-mobile personal computer (mobile personal computer, UMPC), netbook, personal digital assistant (personal digital assistant, PDA), desktop computer, cloud server, etc., and in some cases the electronic device 12 may also be an encoder in the above device, the specific type of electronic device is not limited by the disclosed embodiments.
In different application scenarios, the video encoding apparatus 11 and the electronic device 12 may be independent devices, or may be integrated in the same device, which is not specifically limited in the embodiments of the present disclosure.
When the video encoding device 11 and the electronic device 12 are integrated in the same device, the data transmission between the video encoding device 11 and the electronic device 12 is performed by data transmission between internal modules of the device. In this case, the data transfer flow therebetween is the same as "in the case where the video encoding apparatus 11 and the electronic device 12 are independent of each other".
In the following embodiments provided in the embodiments of the present disclosure, description will be given taking an example in which the video encoding apparatus 11 and the electronic device 12 are provided independently of each other.
Fig. 3 is a flow chart illustrating a video encoding method according to some example embodiments. In some embodiments, the video encoding method described above may be applied to a video encoding apparatus, an electronic device, and the like as shown in fig. 2.
As shown in fig. 3, the video encoding method provided in the embodiment of the present disclosure includes the following S201 to S207.
S201, the video coding device acquires a coding unit in the video to be coded.
The video to be encoded comprises a plurality of image frames, and the image frames comprise a plurality of encoding units. The coding unit obtained by the video coding device can be any coding unit on any image frame in the video to be coded.
As a possible implementation manner, the video encoding device obtains an encoding unit from an image frame of an input video to be encoded in response to the video to be encoded.
In some embodiments, if indication information associated with the video to be encoded is also input together with the video to be encoded, the video encoding apparatus sequentially acquires, in response to the input indication information, encoding units indicated by the encoding unit identifiers in the video to be encoded based on the encoding unit identifiers included in the indication information and the encoding unit processing order.
In other embodiments, if the video encoding device only receives 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 sequence.
S202, the video coding device codes the coding unit in a plurality of coding modes to obtain a plurality of candidate coding results.
The plurality of encoding modes include at least two encoding modes such as a Merge mode, a Skip mode, an Inter ME (motion estimation ) mode, an AMVP mode, an AMVR mode, a luma intra prediction mode, and a Planar mode.
As a possible implementation manner, the video encoding device encodes the encoding unit in each of the plurality of encoding modes based on the encoding unit acquired in the step S201, and based on the plurality of encoding modes built in the video encoding device, and obtains a plurality of candidate encoding results corresponding to the plurality of encoding modes one by one.
For example, the video encoding device encodes the encoding unit based on the Merge mode to obtain the encoding result a Merge The method comprises the steps of carrying out a first treatment on the surface of the The video coding device also codes the coding unit based on Skip mode to obtain a coding result A Skip The method comprises the steps of carrying out a first treatment on the surface of the And establishing a corresponding relation between each coding mode and the candidate coding result until a plurality of candidate coding results are obtained after the coding units are coded by the plurality of coding modes, wherein the corresponding relation between the coding modes and the candidate coding results is shown in the following table 1.
Table 1: correspondence table of coding mode and candidate coding result
Coding mode Candidate encoding results
Merge mode A Merge
Skip mode A Skip
InterME mode A Inter ME
AMVR mode A AMVR
In some embodiments, the Adaptive Motion Vector Resolution (AMVR) mode is not included in the plurality of coding modes.
When the plurality of coding modes do not include the AMVR mode, the plurality of candidate coding results do not include the candidate coding result corresponding to the AMVR mode. The video encoding device encodes the encoding units in a plurality of encoding modes except for the AMVR mode, respectively, and obtains candidate encoding results corresponding to the encoding modes except for the AMVR mode.
It can be appreciated that the pixel precision is finer when the AMVR mode is adopted for encoding, which results in further improvement of encoding complexity. Therefore, by encoding the encoding unit in a mode other than the AMVR mode, the calculation efficiency can be improved to some extent.
S203, the video coding device determines the rate distortion cost of each coding result in the plurality of candidate coding results, and obtains a plurality of rate distortion costs.
As a possible implementation manner, the video encoding apparatus determines, for each candidate encoding result of the plurality of candidate encoding results, the encoding distortion and the code rate of each candidate encoding result based on the plurality of candidate encoding results obtained in step S202 described above. Further, the video coding device adopts a rate distortion calculation formula, and based on the coding distortion and the code rate of each candidate coding mode, the rate distortion cost of each candidate coding result is calculated respectively, so that a plurality of rate distortion costs are obtained.
Illustratively, the video encoding device determines candidate encoding result A Merge Coding distortion D of (2) 1 Sum code rate R 1 Determining the rate distortion cost of the Merge mode as J Merge The method comprises the steps of carrying out a first treatment on the surface of the The video encoding device determines candidate encoding result a Skip Coding distortion D of (2) 2 Sum code rate R 2 Determining the rate distortion cost of Skip mode as J Skip The method comprises the steps of carrying out a first treatment on the surface of the Until the rate distortion cost of each candidate coding result is determined, a corresponding relation between each coding mode and the rate distortion cost is established, wherein the corresponding relation between the coding mode and the rate distortion cost is shown in the following table 2.
Table 2: corresponding relation table of coding mode and rate distortion cost
S204, the video encoding device judges whether a first rate distortion cost exists in the plurality of rate distortion costs.
The first rate distortion cost is a rate distortion cost corresponding to a preset coding mode in a plurality of coding modes, and the preset coding mode is a coding mode for coding based on motion estimation.
As a possible implementation manner, the video encoding device queries whether the preset encoding mode is included in the plurality of encoding modes based on the identification of the preset encoding mode. Further, under the condition that the plurality of coding modes comprise a preset coding mode, the video coding device determines that a first rate distortion cost exists; in the case that the preset coding mode is not included in the plurality of coding modes, the video coding device determines that the first rate distortion cost does not exist.
S205, the video coding device determines a first rate distortion cost and a minimum rate distortion cost from a plurality of rate distortion costs.
As a possible implementation manner, when the video encoding apparatus determines in the step S204 that the first rate-distortion cost exists, based on the identification of the preset encoding mode, the video encoding apparatus obtains the first rate-distortion cost corresponding to the preset encoding mode from the correspondence between the encoding mode and the rate-distortion cost. Further, the video encoding device compares based on the plurality of rate distortion costs to determine a minimum rate distortion cost.
For example, a specific implementation manner of determining the minimum rate-distortion cost by the video encoding device may be that the video encoding device orders a plurality of rate-distortion costs according to sizes based on an ordering algorithm, so as to obtain a rate-distortion cost sequence arranged based on a size order. If a plurality of rate-distortion costs in the rate-distortion cost sequence are ordered in a descending order, the video coding device determines that the first rate-distortion cost in the rate-distortion cost sequence is the minimum rate-distortion cost; if the plurality of rate-distortion costs in the rate-distortion cost sequence are ordered in a descending order, the video encoding device determines that the last rate-distortion cost in the rate-distortion sequence is the smallest rate-distortion cost.
In another example, the specific implementation manner of determining the minimum rate distortion cost by the video encoding device may further be that the video encoding device arbitrarily selects one rate distortion cost from the plurality of rate distortion costs, determines the current rate distortion cost as the current rate distortion cost, compares with other rate distortion costs based on the current rate distortion cost, compares with the next rate distortion cost if the current rate distortion cost is less than or equal to the rate distortion cost compared with the current rate distortion cost, and updates the current rate distortion cost as the rate distortion cost compared with the current rate distortion cost if the current rate distortion cost is greater than the rate distortion cost compared with the current rate distortion cost until all the rate distortion costs are compared, and determines the current rate distortion cost as the minimum rate distortion cost.
It should be noted that, the preset encoding mode may be an Inter ME mode, an AMVP mode, or another encoding mode that encodes based on motion estimation, and may be set in advance in the video encoding device by an operator of the video encoding system, which is not specifically limited in the embodiment of the present disclosure.
S206, the video encoding device judges whether the difference value between the first rate distortion cost and the minimum rate distortion cost is larger than a first threshold value.
As a possible implementation manner, the video encoding apparatus calculates a 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. Further, the video encoding device judges the calculated difference value and the first threshold value.
In some embodiments, the video encoding device has a first preset algorithm built in, and the first preset algorithm is used for determining a first threshold according to a coding sequence of the coding unit. The video coding device may input the coding sequence of the coding unit into a first preset algorithm to obtain a first threshold.
It can be understood that, since the first threshold is obtained by the first preset algorithm according to the coding sequence operation of the coding unit, the coding sequence feature of the coding unit, that is, the complexity of the coding unit, can be represented to a certain extent.
S207, the video coding device determines a candidate coding result corresponding to the minimum rate distortion cost as a target coding result of the coding unit under the condition that the difference value between the first rate distortion cost and the minimum rate distortion cost is larger than a first threshold value.
The target coding result is used for forming coding data of the video to be coded.
As one possible implementation manner, the video encoding device determines a candidate encoding result corresponding to the minimum rate-distortion cost if a difference between the first rate-distortion cost and the minimum rate-distortion cost is greater than a first threshold. Further, the video encoding device determines a target encoding result from the candidate encoding result corresponding to the minimum rate distortion cost.
It should be noted that, the first threshold may be set in advance in the video encoding device by an operator of the video encoding system, which is not specifically limited in this disclosure.
It can be appreciated that the technical scheme provided by the disclosure can be applied to any coding unit in the video to be coded, so as to realize selection of an AMVR mode and determine an optimal target coding result corresponding to the coding unit. And because the AMVR mode is a coding mode which is further expanded on the basis of the preset coding mode, when the difference value between the rate distortion cost corresponding to the preset coding mode (for example, the Inter mode) and the minimum rate distortion cost is larger than a first threshold value, the AMVR mode can be determined to be unsuitable for coding of the current coding unit, selection of the AMVR mode is skipped, and the candidate coding result corresponding to the minimum rate distortion cost is determined to be the optimal coding result of the current coding unit. In addition, the first threshold can represent the coding sequence characteristics of the coding unit to a certain extent, so that the optimal target coding result determined by the video coding device is more reasonable, and the coding unit is prevented from having larger coding quality loss.
In one design, in order to further optimize the selection flow of the AMVR mode, as shown in fig. 4 in conjunction with fig. 3, in step S206, if the video encoding apparatus 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 the embodiment of the present disclosure further includes S301 to S303.
S301, the video coding device determines whether residual errors exist in candidate coding results corresponding to the minimum rate distortion cost under the condition that the difference value between the first rate distortion cost and the minimum rate distortion is smaller than or equal to a first threshold value.
As a possible implementation manner, the video encoding device determines a candidate encoding result corresponding to the minimum rate distortion cost when the difference value is less than or equal to the first threshold value, and determines whether a residual exists from the candidate encoding results.
The specific implementation manner of determining whether the residual exists in the candidate coding result by the video coding device may be that the video coding device analyzes the candidate coding result and queries residual data in analysis data of the candidate coding result. Under the condition that the video coding device searches residual errors from the analysis data, the video coding device determines that residual errors exist in candidate coding results corresponding to the minimum rate distortion cost; in the case that the video encoding device does not find a residual from the parsed data, the video encoding device determines that the candidate encoding corresponding to the minimum rate distortion cost does not have a residual.
The specific implementation manner of the video coding device to determine whether the residual exists in the candidate coding result may also be that the video coding device searches whether a field for recording the residual exists in the candidate coding result. Under the condition that the video coding device searches a field for recording residual errors from the candidate coding results, the video coding device determines that the candidate coding results corresponding to the minimum rate distortion cost have residual errors; in the case that the video encoding device does not find a field recording a residual error from the candidate encoding results, the video encoding device determines that the candidate encoding result corresponding to the minimum rate distortion cost does not have a residual error.
S302, the video coding device judges whether the difference value between the first rate distortion cost and the minimum rate distortion cost is larger than a second threshold value under the condition that a candidate coding result corresponding to the minimum rate distortion cost has no residual error.
Wherein the second threshold is less than the first threshold.
As a possible implementation manner, in the case that the candidate encoding result corresponding to the minimum rate distortion cost has no residual, the video encoding apparatus calculates a difference value 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. Further, the video encoding device judges the calculated difference value and the second threshold value.
It should be noted that, the second threshold may be set in advance in the video encoding device by an operator of the video encoding system, which is not specifically limited in this disclosure.
In some embodiments, a second preset algorithm for obtaining a second threshold value by inputting the coding sequence of the coding unit is built in the video coding device, after the video coding device calculates and obtains the difference value between the first rate distortion cost and the minimum rate distortion cost, the coding sequence of the coding unit is input into the second preset algorithm to obtain the second threshold value, and the coding sequence characteristic of the coding unit can be represented to a certain extent based on the second threshold value obtained by the second preset algorithm.
In other embodiments, there is a preset value preset by an operator in the video encoding apparatus, and after the video encoding apparatus calculates the difference between the first rate-distortion cost and the minimum rate-distortion cost, the video encoding apparatus calculates a second threshold smaller than the first threshold based on the first threshold determined in step S205 and the preset value.
Under the condition that the preset value is a coefficient larger than 0 and smaller than 1, the video coding device calculates the product of the first threshold value and the preset value to obtain a second threshold value; and under the condition that the preset value is the difference between the first threshold value and the second threshold value set by the operation and maintenance personnel, the video coding device calculates the difference between the first threshold value and the preset value to obtain the second threshold value.
S303, under the condition that a candidate coding result corresponding to the minimum rate distortion cost does not have residual errors, if the difference value between the first rate distortion cost and the minimum rate distortion cost is larger than a second threshold value, the video coding device determines the candidate coding result corresponding to the minimum rate distortion cost as a target coding result of the coding unit.
As one possible implementation manner, the video encoding device determines a candidate encoding result corresponding to the minimum rate-distortion cost if the difference between the first rate-distortion cost and the minimum rate-distortion cost is greater than a second threshold. Further, the video encoding device determines a candidate encoding result corresponding to the minimum rate distortion cost as a target encoding result.
It can be understood that, in the case that the candidate coding result corresponding to the minimum rate-distortion cost has no residual error, the change between the current coding unit and the reference block is indicated to be smaller, in this case, if the difference between the first rate-distortion cost and the minimum rate-distortion cost is greater than a second threshold smaller than the first threshold, that is, the coding mode corresponding to the minimum rate-distortion cost is indicated to be the coding mode more suitable for the current coding unit, the selection of skipping the AMVR mode is implemented, and the candidate coding result corresponding to the minimum rate-distortion cost is determined to be the target coding result, that is, the optimal coding result of the current coding unit.
In one design, in order to further optimize the selection flow of the AMVR mode, as shown in fig. 5, in step S302, if the candidate encoding result corresponding to the minimum rate-distortion cost has no residual, the video encoding apparatus determines that the difference between the first rate-distortion cost and the minimum rate-distortion cost is not greater than the second threshold, and the video encoding method provided in the embodiment of the present disclosure further includes S304.
And S304, under the condition that the candidate coding result corresponding to the minimum rate distortion cost has no residual error, if the difference value between the first rate distortion cost and the minimum rate distortion cost is smaller than or equal to a second threshold value, determining a target coding result of the coding unit according to the coding mode of the corresponding homonymous block of the coding unit.
As a possible implementation manner, the video encoding device determines the encoding mode of the current encoding unit corresponding to the co-located block when the difference between the first rate-distortion cost and the minimum rate-distortion cost is smaller than or equal to the second threshold, and determines the target encoding result of the encoding unit according to the encoding mode of the corresponding co-located block.
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 co-located block may refer to the following description of the embodiments of the present disclosure, and no further description is given here.
It can be appreciated that, in the above embodiment of the disclosure, the technical scheme of determining, by the video encoding apparatus, the target encoding result of the encoding 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 value in the case that the candidate encoding result corresponding to the minimum rate-distortion cost has no residual error is supplemented, because the co-located block is a block in the reference frame and the same location as the current encoding unit, determining, based on the encoding mode of the co-located block of the current encoding unit in the reference frame, the target encoding result of the encoding unit is equivalent to determining, by combining the encoding sequence characteristics of the encoding unit, the optimal encoding result of the current encoding unit.
In one design, in order to further optimize the selection flow of the AMVR mode, as shown in fig. 6 in conjunction with fig. 3, in step S206, if the video encoding apparatus 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 the embodiment of the present disclosure further includes S401 to S403.
S401, the video coding device determines whether a coding mode corresponding to the minimum rate distortion cost is a skip coding mode or not under the condition that the difference value between the first rate distortion cost and the minimum rate distortion cost is smaller than or equal to a first threshold value.
The Skip coding mode is Skip mode.
As a possible implementation manner, the video encoding apparatus determines whether the difference value is less than or equal to the first threshold based on the method of determining the difference value between the first rate-distortion cost and the minimum rate-distortion cost and the first threshold in step S205. Further, the video encoding device determines whether the coding mode corresponding to the minimum rate-distortion cost is a skip coding mode based on the corresponding relation between the rate-distortion cost and the coding mode when the difference value is smaller than or equal to a first threshold value.
S402, the video coding device judges whether the difference value between the first rate distortion cost and the minimum rate distortion cost is larger than a second threshold value under the condition that the coding mode corresponding to the minimum rate distortion cost is a skip coding mode.
Wherein the second threshold is less than the first threshold.
As a possible implementation manner, in the case where the coding mode corresponding to the minimum rate distortion cost is the skip coding mode, the video coding apparatus calculates a difference value 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. Further, the video encoding device judges the calculated difference value and the second threshold value.
The specific determination method of the second threshold may refer to the description of the foregoing embodiments of the disclosure, and will not be described herein.
S403, if the video coding device skips the coding mode corresponding to the minimum rate distortion cost, and if the difference between the first rate distortion cost and the minimum rate distortion cost is greater than a second threshold, determining a candidate coding result corresponding to the minimum rate distortion cost as a target coding result of the coding unit.
As one possible implementation manner, the video encoding device determines a candidate encoding result corresponding to the minimum rate-distortion cost if the difference between the first rate-distortion cost and the minimum rate-distortion cost is greater than a second threshold. Further, the video encoding device determines a candidate encoding result corresponding to the minimum rate distortion cost as a target encoding result.
It can be understood that, in the case that the coding mode corresponding to the minimum rate distortion cost is the skip coding mode, because the characteristic of the skip coding mode indicates that the coding result corresponding to the minimum rate distortion cost has no residual error, and further indicates that the change between the current coding unit and the reference block is smaller, in this case, if the difference between the first rate distortion cost and the minimum rate distortion cost is greater than the second threshold smaller than the first threshold, that is, the coding mode corresponding to the minimum rate distortion cost is the coding mode more suitable for the current coding unit, the selection of the skip AMVR mode is implemented, and the candidate coding result corresponding to the minimum rate distortion cost is determined as the optimal coding result of the current coding unit.
In one design, in order to further optimize the selection flow of the AMVR mode, as shown in fig. 7, in step S402, if the coding mode corresponding to the minimum rate-distortion cost is the skip coding mode, the video coding apparatus determines that the difference between the first rate-distortion cost and the minimum rate-distortion cost is not greater than the second threshold, and the video coding method provided in the embodiment of the present disclosure further includes S404.
S404, the video coding device determines a target coding result of the coding unit according to the coding mode of the corresponding same-bit block of the coding unit if the difference value between the first rate distortion cost and the minimum rate distortion cost is smaller than or equal to a second threshold value under the condition that the coding mode corresponding to the minimum rate distortion cost is the skip coding mode.
As a possible implementation manner, the video encoding device determines the encoding mode of the current encoding unit corresponding to the co-located block when the difference between the first rate-distortion cost and the minimum rate-distortion cost is smaller than or equal to the second threshold, and determines the target encoding result of the encoding unit according to the encoding mode of the co-located block.
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 co-located block may refer to the following description of the embodiments of the present disclosure, and no further description is given here.
It can be appreciated that, in the foregoing embodiment of the disclosure, 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 apparatus determines a technical scheme of a target coding result of the coding unit, and since the same-bit block is a block in the reference frame and the same position as the current coding unit, determining the target coding result of the coding unit based on the coding mode of the same-bit block of the current coding unit in the reference frame is equivalent to determining the optimal coding result of the current coding unit by combining the coding sequence characteristics of the coding unit.
In one design, in order to determine a target encoding result of an encoding unit according to an encoding mode of a corresponding co-located block by a video encoding device, as shown in fig. 8, in the video encoding method provided in the embodiment of the present disclosure, the target encoding result of the encoding unit is determined according to the encoding mode of the corresponding co-located block by the encoding unit, which specifically includes S501-S503.
S501, the video coding device judges whether the coding mode of the corresponding homonymy block of the coding unit is an adaptive motion vector resolution mode.
As a possible implementation manner, the video encoding device determines, based on an image frame in which the encoding unit is located, a corresponding co-located block of the encoding unit in a reference frame of the image frame, and acquires an encoding mode of the corresponding co-located block. Further, the video encoding device determines whether the encoding mode of the corresponding co-located block is an AMVR mode.
S502, the video coding device determines a coding result corresponding to the adaptive motion vector resolution mode as a target coding result of the coding unit when the coding mode of the coding unit corresponding to the homonymous block is the adaptive motion vector resolution mode.
As one possible implementation, the video encoding apparatus acquires an encoding mode of a corresponding co-located block of an encoding unit, and determines whether the encoding mode of the co-located block is an Adaptive Motion Vector Resolution (AMVR) mode. Further, the video encoding device determines to encode the encoding unit in the AMVR mode when the encoding mode of the co-located block is the AMVR mode. Further, the video encoding device determines an encoding result obtained by encoding the encoding unit based on the AMVR mode as a target encoding result of the encoding unit.
S503, the video coding device determines a candidate coding result corresponding to the minimum rate distortion cost as a target coding result of the coding unit when the coding mode of the coding unit corresponding to the homonym block is not the adaptive motion vector resolution mode.
As one possible implementation manner, the video encoding device obtains the encoding mode of the corresponding co-located block of the encoding unit, and determines whether the encoding mode of the co-located block is an AMVR mode. Further, the video encoding device determines a candidate encoding result corresponding to the minimum rate distortion cost when the encoding mode of the same bit block is not the AMVR mode. Further, the video encoding device determines a candidate encoding result corresponding to the minimum rate distortion cost as a target encoding result.
It can be understood that in the technical solution provided in the foregoing embodiments of the present disclosure, the determination of the optimal target encoding result for the encoding unit according to the encoding mode of the encoding unit of the same-bit block is implemented, and since the same-bit block is a block in the reference frame with the same position as the current encoding unit, determining the target encoding result for the encoding unit based on the encoding mode of the same-bit block of the current encoding unit in the reference frame is equivalent to determining the optimal encoding result for the current encoding unit in combination with the encoding sequence feature of the encoding unit.
In one design, in order to further optimize the selection flow of the AMVR mode, as shown in fig. 9 in conjunction with fig. 3, in step S204, if the video encoding apparatus does not determine the first rate-distortion cost among the multiple rate-distortion costs, the video encoding method provided in the embodiments of the present disclosure further includes S208.
S208, the video coding device determines a target coding result of the coding unit according to the coding mode of the corresponding homobit block of the coding unit.
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 same bit block specifically may refer to the description of the foregoing embodiments of the present disclosure, and no further description is given here.
It can be understood that, because the video coding apparatus performs coding on the coding unit in multiple coding modes according to some fast algorithms, the preset coding algorithm may be skipped, that is, there is no first rate distortion cost, and the design is supplemented with a technical scheme that the video coding apparatus determines the target coding result of the coding unit after the preset coding algorithm is skipped.
In one design, as shown in fig. 10, the embodiment of the present disclosure further provides a video encoding method after combining the video encoding methods disclosed in the above embodiments, including S601-S608.
S601, the video coding device codes the current coding unit in other coding modes except for an AMVR mode, and determines the minimum rate distortion cost.
S602, the video coding device determines the rate distortion cost of the Inter ME mode and determines the rate distortion cost as a second rate distortion cost.
S603, the video encoding device judges whether the difference value between the second rate distortion cost and the minimum rate distortion cost is larger than a first threshold value.
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, step S604 is performed, and 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, step S608 is performed.
S604, under the condition that the coding result corresponding to the minimum rate distortion cost has no residual error, the video coding device judges whether the difference value between the second rate distortion cost and the minimum rate distortion cost is larger than a second threshold value.
It should be noted that, if the video encoding device determines that the encoding result corresponding to the minimum rate distortion cost has no residual error, 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 second threshold, step S605 is executed, and 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, step S608 is executed.
S605, the video coding device determines the coding mode of the corresponding homonymous block of the current coding unit.
S606, the video coding device judges whether the coding mode of the current coding unit corresponding to the homonym block is an AMVR mode.
If the video encoding device determines that the encoding mode of the co-located block corresponding to the encoding unit is the AMVR mode, step S607 is performed, and if the video encoding device determines that the encoding mode of the co-located block corresponding to the encoding unit is not the AMVR mode, step S608 is performed.
S607, the video coding device codes the current coding unit in AMVR mode, and determines the obtained coding result as the target coding result.
S608, the video coding device determines a coding result corresponding to the minimum rate distortion cost as a target coding result.
It should be noted that, for the specific implementation manner of the video encoding method in the above steps S601 to S608, reference may be made to the description in the above embodiments of the disclosure, and no further description is given here.
When the practical test is carried out based on the technical scheme disclosed by the invention, the coding speed of AMVR mode selection of the encoder can be greatly improved, and the influence on the compression performance is small.
The foregoing description of the embodiments of the present disclosure has been presented primarily in terms of methods. In order to realize the above functions, the display device or the terminal device of the media resource includes a hardware structure and/or a software module for executing the respective functions. Those of skill in the art will readily appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as hardware or combinations of hardware and computer software. Whether a function is implemented as hardware or computer software driven hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present disclosure.
The embodiment of the disclosure may divide the functional modules of the display device or the terminal device of the media resource according to the above method, for example, the display device or the terminal device of the media resource may include each functional module corresponding to each functional division, or two or more functions may be integrated into one processing module. The integrated modules may be implemented in hardware or in software functional modules. It should be noted that, in the embodiment of the present disclosure, the division of the modules is merely a logic function division, and other division manners may be implemented in actual practice.
Fig. 11 is a schematic diagram illustrating a structure of a video encoding apparatus according to an exemplary embodiment. Referring to fig. 11, an encoding apparatus 70 provided in an embodiment of the present disclosure includes an acquisition unit 701, a processing unit 702, and a determination unit 703.
An obtaining unit 701, configured to obtain an encoding unit in a video to be encoded. The processing unit 702 is configured to encode the encoding unit in a plurality of encoding modes to obtain a plurality of candidate encoding results. A determining unit 703, configured to determine a rate distortion cost of each of the plurality of candidate encoding results, to obtain a plurality of rate distortion costs. The determining unit 703 is further configured to determine a first rate-distortion cost and a minimum rate-distortion cost from the plurality of rate-distortion costs, where the first rate-distortion cost is a rate-distortion cost corresponding to a preset encoding mode from the plurality of encoding modes, and the preset encoding mode is an encoding mode that encodes based on motion estimation. The determining unit 703 is further configured to determine, as a target encoding result of the encoding unit, a candidate encoding result corresponding to the minimum rate-distortion cost if a 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 compose encoded data of the video to be encoded.
Optionally, the determining unit 703 is further configured to determine whether a residual exists in the candidate encoding result corresponding to the minimum rate-distortion cost if the difference between the first rate-distortion cost and the minimum rate-distortion cost is less than or equal to the first threshold; under the condition that a candidate coding result corresponding to the minimum rate distortion cost has no residual error, if the difference value between the first rate distortion cost and the minimum rate distortion cost is larger than a second threshold value, determining the candidate coding result corresponding to the minimum rate distortion cost as a target coding result of the coding unit; the second threshold is less than the first threshold.
Optionally, the determining unit 703 is further configured to determine, if the difference between the first rate-distortion cost and the minimum rate-distortion cost is less than or equal to the second threshold under the condition that the candidate encoding result corresponding to the minimum rate-distortion cost has no residual, a target encoding result of the encoding unit according to the encoding mode of the co-located block corresponding to the encoding unit.
Optionally, the determining unit 703 is further configured to determine, if the difference between the first rate-distortion cost and the minimum rate-distortion cost is less than or equal to a first threshold, whether the coding mode corresponding to the minimum rate-distortion cost is a skipped coding mode; under the condition that the coding mode corresponding to the minimum rate distortion cost is a skip coding mode, if the difference value between the first rate distortion cost and the minimum rate distortion cost is larger than a second threshold value, determining a candidate coding result corresponding to the minimum rate distortion cost as a target coding result of the coding unit; the second threshold is less than the first threshold.
Optionally, the determining unit 703 is further configured to determine, if the difference between the first rate-distortion cost and the minimum rate-distortion cost is less than or equal to the second threshold, a target encoding result of the encoding unit according to the encoding mode of the co-located block corresponding to the encoding unit, where the encoding mode corresponding to the minimum rate-distortion cost is a skipped encoding mode.
Optionally, the determining unit 703 is further configured to determine a target encoding result of the encoding unit according to the encoding mode of the corresponding co-located block of the encoding unit.
Optionally, the determining unit 703 is specifically configured to determine, in a case where the coding mode of the coding unit corresponding to the co-located block is an adaptive motion vector resolution mode, a coding result corresponding to the adaptive motion vector resolution mode as a target coding result of the coding unit; and under the condition that the coding mode of the coding unit corresponding to the homonymous block is not the adaptive motion vector resolution mode, determining a candidate coding result corresponding to the minimum rate distortion cost as a target coding result of the coding unit.
Alternatively, in the video encoding apparatus 70, the adaptive motion vector resolution mode is not included in the plurality of encoding modes.
In the case of implementing the functions of the integrated modules in the form of hardware, the embodiments of the present disclosure provide a possible structural schematic diagram of the electronic device involved in the above embodiments. As shown in fig. 12, the electronic device 80 includes a processor 801, a memory 802, and a bus 803. The processor 801 and the memory 802 may be connected by a bus 803.
The processor 801 is a control center of the electronic device 80, and may be one processor or a collective name of a plurality of processing elements. For example, the processor 801 may be a general-purpose central processing unit (central processing unit, CPU), or may be another general-purpose processor. Wherein the general purpose processor may be a microprocessor or any conventional processor or the like.
As one example, processor 801 may include one or more CPUs, such as CPU 0 and CPU 1 shown in fig. 12.
Memory 802 may be, but is not limited to, a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (random access memory, RAM) or other type of dynamic storage device that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), magnetic disk storage or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer.
As a possible implementation, the memory 802 may exist separately from the processor 801, and the memory 802 may be connected to the processor 801 through the bus 803 for storing instructions or program code. The processor 801, when calling and executing instructions or program code stored in the memory 802, is capable of implementing the sensor determination method provided by the embodiments of the present disclosure.
In another possible implementation, the memory 802 may also be integrated with the processor 801.
Bus 803 may be an industry standard architecture (Industry Standard Architecture, ISA) bus, a peripheral interconnect (Peripheral Component Interconnect, PCI) bus, or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, among others. The bus may be classified as an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in fig. 12, but not only one bus or one type of bus.
Note that the structure shown in fig. 12 does not constitute a limitation of the electronic apparatus 80. The electronic device 80 may include more or fewer components than shown in fig. 12, or may combine certain components or a different arrangement of components.
Optionally, the electronic device 80 provided by the embodiments of the present disclosure may further include a communication interface 804.
A communication interface 804 for connecting with other devices via a communication network. The communication network may be an ethernet, a radio access network, a wireless local area network (wireless local area networks, WLAN), etc. The communication interface 804 may include a receiving unit for receiving data and a transmitting unit for transmitting data.
In one design, the communication interface may also be integrated into the processor in the electronic device 80 provided by embodiments of the present disclosure.
In another hardware structure of the server provided by the embodiments of the present disclosure, an electronic device may include a processor and a communication interface. The processor is coupled to the communication interface.
The function of the processor may be as described above with reference to the processor. The processor also has a memory function, which can be referred to as the memory.
The communication interface is for providing data to the processor. The communication interface may be an internal interface of the electronic device 80 or an external interface of the electronic device 80.
It should be noted that the above-described alternative hardware configuration does not constitute a limitation of the electronic device, and the electronic device may include more or less components, or may combine some components, or may be arranged with different components, in addition to the above-described alternative hardware components.
In the case of implementing the functions of the integrated modules in the form of hardware, the structural schematic diagrams of the middleware related to the embodiments may refer to the structural schematic diagrams of the execution machine.
The embodiment of the present disclosure also provides a computer-readable storage medium, in which instructions are stored, which when executed by a computer, perform each step in the flow of the display method of the media resource shown in the above-mentioned method embodiment.
The disclosed embodiments also provide a computer program product comprising instructions which, when executed on a computer, cause the computer to perform the method of displaying a media resource in the method embodiments described above.
The computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: electrical connections having one or more wires, portable computer diskette, hard disk. Random access Memory (Random Access Memory, RAM), read-Only Memory (ROM), erasable programmable Read-Only Memory (Erasable Programmable Read Only Memory, EPROM), registers, hard disk, optical fiber, portable compact disc Read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any other form of computer-readable storage medium suitable for use by a person or persons of skill in the art. An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an application specific integrated circuit (Application Specific Integrated Circuit, ASIC). In the disclosed embodiments, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
Since the server, the user equipment, the computer readable storage medium, and the computer program product in the embodiments of the present disclosure may be applied to the above-mentioned method, the technical effects that may be obtained by the method may also refer to the above-mentioned method embodiments, and the embodiments of the present disclosure are not described herein again.
The foregoing is merely a specific embodiment of the disclosure, but the protection scope of the disclosure is not limited thereto, and any changes or substitutions within the technical scope of the disclosure should be covered in the protection scope of the disclosure.

Claims (11)

1. A method of video encoding, the method comprising:
acquiring a coding unit in a video to be coded, and coding the coding unit in a plurality of coding modes to obtain a plurality of candidate coding results;
determining the rate distortion cost of each coding result in the candidate coding results to obtain a plurality of rate distortion costs;
determining 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 in the plurality of coding modes, and the preset coding mode is a coding mode for coding based on motion estimation;
Under the condition that the difference value between the first rate distortion cost and the minimum rate distortion cost is larger than a first threshold value, determining a candidate coding result corresponding to the minimum rate distortion cost as a target coding result of the coding unit; the target coding result is used for forming coding data of the video to be coded.
2. The video coding method of claim 1, wherein the method further comprises:
judging whether residual errors exist in candidate coding results corresponding to the minimum rate distortion cost or not under the condition that the difference value between the first rate distortion cost and the minimum rate distortion cost is smaller than or equal to the first threshold value;
under the condition that a candidate coding result corresponding to the minimum rate distortion cost has no residual error, if the difference value between the first rate distortion cost and the minimum rate distortion cost is larger than a second threshold value, determining the candidate coding result corresponding to the minimum rate distortion cost as the target coding result of the coding unit; the second threshold is less than the first threshold.
3. The video coding method of claim 2, wherein the method further comprises:
and under the condition that the candidate coding result corresponding to the minimum rate distortion cost has no residual error, if the difference value between the first rate distortion cost and the minimum rate distortion cost is smaller than or equal to the second threshold value, determining the target coding result of the coding unit according to the coding mode of the corresponding co-located block of the coding unit.
4. The video coding method of claim 1, wherein the method further comprises:
judging whether the coding mode corresponding to the minimum rate distortion cost is a skip coding mode or not under the condition that the difference value between the first rate distortion cost and the minimum rate distortion cost is smaller than or equal to the first threshold value;
if the coding mode corresponding to the minimum rate distortion cost is a skip coding mode, determining a 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 second threshold; the second threshold is less than the first threshold.
5. The video coding method of claim 4, wherein the method further comprises:
and under the condition that the coding mode corresponding to the minimum rate distortion cost is a skip coding mode, if the difference value between the first rate distortion cost and the minimum rate distortion cost is smaller than or equal to the second threshold value, determining the target coding result of the coding unit according to the coding mode of the corresponding co-located block of the coding unit.
6. The video coding method of claim 1, wherein, in the case where the first rate-distortion cost is not included in the plurality of rate-distortion costs, the method further comprises:
and determining the target coding result of the coding unit according to the coding mode of the corresponding homobit block of the coding unit.
7. The video coding method according to claim 3, 5 or 6, wherein determining the target coding result of the coding unit according to the coding mode of the corresponding homoblock of the coding unit comprises:
determining a coding result corresponding to the adaptive motion vector resolution mode as the target coding result of the coding unit under the condition that the coding mode of the coding unit corresponding to the homonymous block is the adaptive motion vector resolution mode;
and under the condition that the coding mode of the coding unit corresponding to the homonym block is not the adaptive motion vector resolution mode, determining a candidate coding result corresponding to the minimum rate distortion cost as the target coding result of the coding unit.
8. The video coding method of any of claims 1-6, wherein the plurality of coding modes does not include an adaptive motion vector resolution mode.
9. A video encoding apparatus, comprising: the device comprises an acquisition unit, a processing unit and a determination unit;
the acquisition unit is used for acquiring the coding unit in the video to be coded;
the processing unit is used for encoding the encoding unit in a plurality of encoding modes to obtain a plurality of candidate encoding results;
the determining unit is configured to determine a rate distortion cost of each of the plurality of candidate encoding results, to obtain 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 multiple rate-distortion costs, where the first rate-distortion cost is a rate-distortion cost corresponding to a preset encoding mode in the multiple encoding modes, and the preset encoding mode is an encoding mode that performs encoding based on motion estimation;
the determining unit is further configured to determine, as a target encoding result of the encoding unit, a candidate encoding result corresponding to the minimum rate-distortion cost if a 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 for forming coding data of the video to be coded.
10. An electronic device, comprising: a processor and a communication interface; the communication interface is coupled to the processor for running a computer program or instructions to implement the video coding method according to any of claims 1-8.
11. A computer readable storage medium having instructions stored therein, which when executed by a computer, performs the video encoding method of any one of claims 1-8.
CN202310779634.0A 2023-06-28 2023-06-28 Video encoding method, video encoding device, electronic equipment and storage medium Pending CN116723324A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310779634.0A CN116723324A (en) 2023-06-28 2023-06-28 Video encoding method, video encoding device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310779634.0A CN116723324A (en) 2023-06-28 2023-06-28 Video encoding method, video encoding device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116723324A true CN116723324A (en) 2023-09-08

Family

ID=87867740

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310779634.0A Pending CN116723324A (en) 2023-06-28 2023-06-28 Video encoding method, video encoding device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116723324A (en)

Similar Documents

Publication Publication Date Title
US10911759B2 (en) Method and apparatus for encoding and decoding motion information
US11057640B2 (en) Image decoding method and apparatus based on inter-prediction in image coding system
US11070797B2 (en) Image decoding method and apparatus based on inter prediction in image coding system
US11122285B2 (en) Sub-prediction unit temporal motion vector prediction (sub-PU TMVP) for video coding
US20200154132A1 (en) Method for coding and an apparatus
EP3566447B1 (en) Method and apparatus for encoding and decoding motion information
EP4243417A2 (en) Method, device, and system for determining prediction weight for merge mode
WO2018065296A1 (en) Method and apparatus for encoding and decoding motion information
EP3301919A1 (en) Method and apparatus for encoding and decoding motion information
WO2019002215A1 (en) Multiple predictor candidates for motion compensation
KR20230057473A (en) Method and device for image decoding according to inter-prediction in image coding system
CN112673627B (en) Affine motion prediction-based image decoding method and apparatus using affine merge candidate list in image encoding system
US11558608B2 (en) On split prediction
US20210258601A1 (en) Image encoding/decoding method and apparatus
WO2019147541A1 (en) Method and apparatus for adaptive illumination compensation in video encoding and decoding
CN116723324A (en) Video encoding method, video encoding device, electronic equipment and storage medium
WO2023131047A1 (en) Method, apparatus, and medium for video processing
WO2023061306A1 (en) Method, apparatus, and medium for video processing
WO2023051646A1 (en) Method, apparatus, and medium for video processing
WO2023246634A1 (en) Method, apparatus, and medium for video processing

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination