CN113938690B - 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
CN113938690B
CN113938690B CN202111464487.5A CN202111464487A CN113938690B CN 113938690 B CN113938690 B CN 113938690B CN 202111464487 A CN202111464487 A CN 202111464487A CN 113938690 B CN113938690 B CN 113938690B
Authority
CN
China
Prior art keywords
prediction
current
cost
block
prediction direction
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.)
Active
Application number
CN202111464487.5A
Other languages
Chinese (zh)
Other versions
CN113938690A (en
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 CN202111464487.5A priority Critical patent/CN113938690B/en
Publication of CN113938690A publication Critical patent/CN113938690A/en
Application granted granted Critical
Publication of CN113938690B publication Critical patent/CN113938690B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/60Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding
    • H04N19/61Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding in combination with predictive coding
    • 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/103Selection of coding mode or of prediction mode

Landscapes

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

Abstract

The present disclosure relates to a video encoding method, apparatus, electronic device, and storage medium, where when performing bidirectional prediction, the video encoding method obtains a current prediction cost when the current iteration number meets a preset iteration number condition, determines whether the current prediction cost meets a preset cost condition, updates another prediction direction in the bidirectional prediction to a current prediction direction if the current prediction cost meets the preset cost condition, and updates the current iteration number, and continues to perform the bidirectional prediction iteration operation, otherwise, obtains a bidirectional prediction result of the current block based on prediction blocks in two prediction directions, so that redundant iteration during bidirectional prediction can be avoided, and encoding time is saved.

Description

Video encoding method, video encoding device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of image processing, and in particular, to a video encoding method, apparatus, electronic device, and storage medium.
Background
In video coding, a predetermined coding mode needs to be adaptively selected according to video content, which is called mode selection of video coding. Inter-frame bi-prediction is most time consuming in mode selection for video coding. Particularly in an offline coding scenario, in order to preserve coding performance as much as possible, a more aggressive pruning or search skip scheme cannot be used to save coding time, thereby improving coding efficiency, so a more reasonable and stable video coding method needs to be designed.
Disclosure of Invention
The disclosure provides a video coding method, a video coding device, an electronic device and a storage medium, which at least solve the problem of low coding efficiency caused by inter-frame bidirectional prediction time consumption in the related art.
According to a first aspect of embodiments of the present disclosure, there is provided a video encoding method including: comprising the following steps: determining a current prediction direction of bi-prediction for a current block and initializing a current iteration number; performing a bi-predictive iterative operation, wherein the bi-predictive iterative operation comprises: acquiring an inverted block of a prediction block of a current prediction direction, and performing motion search in another prediction direction except the current prediction direction in two prediction directions aiming at the current block based on the inverted block to obtain the prediction block in the other prediction direction; and under the condition that the current iteration number meets the preset iteration number condition, acquiring a current prediction cost, determining whether the current prediction cost meets the preset cost condition, if so, updating the other prediction direction in the bidirectional prediction to the current prediction direction, updating the current iteration number, and continuing to execute the bidirectional prediction iteration operation, otherwise, obtaining a bidirectional prediction result of the current block based on the prediction blocks in the two prediction directions.
Optionally, the determining the current prediction direction of the bi-prediction for the current block includes: unidirectional motion search is performed in two prediction directions for a current block, respectively, and a direction in which a prediction cost is smaller of the two prediction directions is determined as a current prediction direction for bidirectional prediction of the current block.
Optionally, the obtaining the inverted block of the prediction block of the current prediction direction, performing motion search in another prediction direction except the current prediction direction in the two prediction directions of the current block based on the inverted block, to obtain the prediction block in the other prediction direction, includes: and acquiring an inverted block of a prediction block with the minimum prediction cost in the current prediction direction, and performing motion search on the basis of the inverted block in the other prediction direction except the current prediction direction in the two prediction directions aiming at the current block to obtain the prediction block with the minimum prediction cost in the other prediction direction.
Optionally, the performing motion search based on the inverted block to obtain a prediction block with the minimum prediction cost in the other prediction direction includes: and searching a prediction block with the smallest difference with the inverse block in the time dimension and/or the space dimension in the reference frame in the other prediction direction as a prediction block with the smallest prediction cost in the other prediction direction.
Optionally, the obtaining the current predicted cost, and determining whether the current predicted cost meets a preset cost condition includes: acquiring the current prediction cost of the other prediction direction, and determining the relation between the current prediction cost of the other prediction direction and a cost threshold, wherein the cost threshold is determined according to the minimum prediction cost among the prediction costs of the two prediction directions during unidirectional motion search; and when the current predicted cost is larger than the cost threshold value, determining that the current predicted cost meets a preset cost condition, otherwise, determining that the current predicted cost does not meet the preset cost condition.
Optionally, the cost threshold is determined according to a minimum prediction cost among prediction costs of two prediction directions at the time of unidirectional motion search and a quantization step size for the current block.
Optionally, the cost threshold is obtained by dividing a minimum prediction cost among prediction costs of two prediction directions in the unidirectional motion search by a value determined based on the quantization step size.
Optionally, the value is determined by comparing the quantization step size with a predetermined step size threshold, wherein the value is equal to 1 when the quantization step size is greater than the predetermined step size threshold; otherwise, the value is equal to a value between 0 and 1 determined from the quantization step size.
Optionally, the method further comprises: and under the condition that the current iteration number does not meet the preset iteration number condition, obtaining a bidirectional prediction result of the current block based on the prediction blocks in the two prediction directions.
According to a second aspect of embodiments of the present disclosure, there is provided a video encoding apparatus including: an initialization unit configured to determine a current prediction direction of bi-prediction for a current block and initialize a current iteration number; a bi-prediction unit configured to: performing a bi-predictive iterative operation, wherein the bi-predictive iterative operation comprises: acquiring an inverted block of a prediction block of a current prediction direction, and performing motion search in another prediction direction except the current prediction direction in two prediction directions aiming at the current block based on the inverted block to obtain the prediction block in the other prediction direction; and under the condition that the current iteration number meets the preset iteration number condition, acquiring a current prediction cost, determining whether the current prediction cost meets the preset cost condition, if so, updating the other prediction direction in the bidirectional prediction to the current prediction direction, updating the current iteration number, and continuing to execute the bidirectional prediction iteration operation, otherwise, obtaining a bidirectional prediction result of the current block based on the prediction blocks in the two prediction directions.
Optionally, the determining the current prediction direction of the bi-prediction for the current block includes: unidirectional motion search is performed in two prediction directions for a current block, respectively, and a direction in which a prediction cost is smaller of the two prediction directions is determined as a current prediction direction for bidirectional prediction of the current block.
Optionally, the obtaining the inverted block of the prediction block of the current prediction direction, performing motion search in another prediction direction except the current prediction direction in the two prediction directions of the current block based on the inverted block, to obtain the prediction block in the other prediction direction, includes: and acquiring an inverted block of a prediction block with the minimum prediction cost in the current prediction direction, and performing motion search on the inverted block in the other prediction direction except the current prediction direction in the two prediction directions of the current block to obtain the prediction block with the minimum prediction cost in the other prediction direction.
Optionally, the performing motion search based on the inverted block to obtain a prediction block with the minimum prediction cost in the other prediction direction includes: and searching a prediction block with the smallest difference with the inverse block in the time dimension and/or the space dimension in the reference frame in the other prediction direction as a prediction block with the smallest prediction cost in the other prediction direction.
Optionally, the obtaining the current predicted cost, and determining whether the current predicted cost meets a preset cost condition includes: acquiring the current prediction cost of the other prediction direction, and determining the relation between the current prediction cost of the other prediction direction and a cost threshold, wherein the cost threshold is determined according to the minimum prediction cost among the prediction costs of the two prediction directions during unidirectional motion search; and when the current predicted cost is larger than the cost threshold value, determining that the current predicted cost meets a preset cost condition, otherwise, determining that the current predicted cost does not meet the preset cost condition.
Optionally, the cost threshold is determined according to a minimum prediction cost among prediction costs of two prediction directions at the time of unidirectional motion search and a quantization step size for the current block.
Optionally, the cost threshold is obtained by dividing a minimum prediction cost among prediction costs of two prediction directions in the unidirectional motion search by a value determined based on the quantization step size.
Optionally, the value is determined by comparing the quantization step size with a predetermined step size threshold, wherein the value is equal to 1 when the quantization step size is greater than the predetermined step size threshold; otherwise, the value is equal to a value between 0 and 1 determined from the quantization step size.
Optionally, the bi-prediction unit is further configured to: and under the condition that the current iteration number does not meet the preset iteration number condition, obtaining a bidirectional prediction result of the current block based on the prediction blocks in the two prediction directions.
According to a third aspect of the embodiments of the present disclosure, there is provided an electronic device, including: at least one processor; at least one memory storing computer-executable instructions, wherein the computer-executable instructions, when executed by the at least one processor, cause the at least one processor to perform a video encoding method as described above.
According to a fourth aspect of embodiments of the present disclosure, there is provided a computer readable storage medium storing instructions that, when executed by at least one processor, cause the at least one processor to perform a video encoding method as described above.
According to a fifth aspect of embodiments of the present disclosure, there is provided a computer program product comprising computer instructions, characterized in that the computer instructions, when executed by a processor, implement a video encoding method as described above.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects: according to the video coding method of the embodiment of the disclosure, under the condition that the current iteration number meets the preset iteration number condition, instead of directly continuing to execute bi-directional prediction, the current prediction cost is obtained, whether the current prediction cost meets the preset cost condition is determined, and bi-directional prediction iteration operation is continuously executed only when the preset cost condition is met, so that redundant iteration during bi-directional prediction can be avoided as much as possible under the condition that coding performance is ensured, time consumption is reduced, and coding efficiency is improved.
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 exemplary 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 system architecture in which exemplary embodiments of the present disclosure may be applied;
fig. 2 is a flowchart illustrating a video encoding method according to an exemplary embodiment of the present disclosure;
fig. 3 is a schematic diagram illustrating a current prediction direction of initializing bi-prediction for a current block according to an exemplary embodiment of the present disclosure;
fig. 4 is a schematic diagram illustrating an example of a video encoding method according to an exemplary embodiment of the present disclosure;
fig. 5 is a block diagram illustrating a video encoding apparatus according to an exemplary embodiment of the present disclosure;
fig. 6 is a block diagram of an electronic device according to an exemplary embodiment of the present 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 described herein. The embodiments described in the examples below are not representative of all embodiments 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.
It should be noted that, in this disclosure, "at least one of the items" refers to a case where three types of juxtaposition including "any one of the items", "a combination of any of the items", "an entirety of the items" are included. For example, "including at least one of a and B" includes three cases side by side as follows: (1) comprises A; (2) comprising B; (3) includes A and B. For example, "at least one of the first and second steps is executed", that is, three cases are juxtaposed as follows: (1) performing step one; (2) executing the second step; (3) executing the first step and the second step.
Fig. 1 illustrates an exemplary system architecture 100 in which exemplary embodiments of the present disclosure may be applied.
As shown in fig. 1, a system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used as a medium to provide communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others. A user may interact with the server 105 via the network 104 using the terminal devices 101, 102, 103 to receive or send messages (e.g., video data upload requests, video data download requests), etc. Various communication client applications, such as audio and video communication software, audio and video recording software, even communication software, conference software, mailbox client, social platform software, etc., may be installed on the terminal devices 101, 102, 103. The terminal devices 101, 102, 103 may be hardware or software. When the terminal devices 101, 102, 103 are hardware, they may be various electronic devices having a display screen and capable of audio and video playback, recording, editing, etc., including but not limited to smart phones, tablet computers, laptop and desktop computers, etc. When the terminal devices 101, 102, 103 are software, they may be installed in the above-listed electronic devices, which may be implemented as a plurality of software or software modules (e.g. to provide distributed services), or as a single software or software module. The present invention is not particularly limited herein.
The terminal devices 101, 102, 103 may be equipped with image capturing means (e.g. cameras) to capture video data. In practice, the smallest visual unit that makes up a video is a Frame. Each frame is a static image. A sequence of temporally successive frames is synthesized together to form a dynamic video. In addition, the terminal apparatuses 101, 102, 103 may also be mounted with components (e.g., speakers) for converting electric signals into sound to play the sound, and may also be mounted with means (e.g., microphones) for converting analog audio signals into digital audio signals to collect the sound. In addition, the terminal devices 101, 102, 103 may communicate with each other in voice or video.
The server 105 may be a server providing various services, such as a background server providing support for multimedia applications installed on the terminal devices 101, 102, 103. The background server may analyze, store, etc. the received data such as the audio and video data upload request, and may also receive the audio and video data download request sent by the terminal devices 101, 102, 103, and feed back the audio and video data indicated by the audio and video data download request to the terminal devices 101, 102, 103.
The server may be hardware or software. When the server is hardware, the server may be implemented as a distributed server cluster formed by a plurality of servers, or may be implemented as a single server. When the server is software, it may be implemented as a plurality of software or software modules (e.g., to provide distributed services), or as a single software or software module. The present invention is not particularly limited herein.
It should be noted that, the video encoding method provided by the embodiments of the present disclosure may be performed by a terminal device or a server. Accordingly, the video encoding device may be provided in either the terminal device or the server.
It should be understood that the number of terminal devices, networks and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers as desired, and the disclosure is not limited in this regard.
Next, a video encoding method of an exemplary embodiment of the present disclosure will be described with reference to fig. 2 to 4.
Fig. 2 is a flowchart illustrating a video encoding method according to an exemplary embodiment of the present disclosure.
Referring to fig. 2, in step S210, a current prediction direction of bi-prediction for a current block is determined, and a current iteration number is initialized. Specifically, the current iteration number may be initialized to a predetermined value, e.g., 0, which may be labeled loop=0. Further, determining the current prediction direction of the bi-prediction for the current block may be arbitrarily selecting one prediction direction from two prediction directions (forward or backward) for the current block as the current prediction direction. Alternatively, the determination of the current prediction direction for the bi-prediction of the current block may also be to select an appropriate direction from the two prediction directions according to a predetermined criterion as the current prediction direction. For example, the determining the current prediction direction for the bi-prediction of the current block may include: unidirectional motion search is performed in two prediction directions for a current block, respectively, and a direction in which a prediction cost is smaller of the two prediction directions is determined as a current prediction direction for bidirectional prediction of the current block. Specifically, unidirectional motion search may be performed on the current block in two prediction directions, respectively, to obtain a prediction block with the smallest prediction cost in each prediction direction, and then, a direction with smaller prediction cost in the two prediction directions may be determined according to the obtained prediction block, as the current prediction direction of bidirectional prediction on the current block.
Fig. 3 is a schematic diagram illustrating determining a current prediction direction for bi-prediction of a current block according to an exemplary embodiment of the present disclosure. Bi-prediction for the current block is forward prediction and backward prediction, respectively, assuming direction 0 to represent forward and direction 1 to represent backward. As shown in fig. 3, unidirectional motion search may be first performed in the direction 0 and the direction 1, respectively, for the current block, resulting in a prediction block with the minimum prediction cost in each prediction direction. Specifically, when unidirectional motion search is performed in each prediction direction, a prediction block having the smallest difference from the current block in the temporal and/or spatial dimensions may be searched from a reference frame of the current block in the prediction direction as a prediction block having the smallest prediction cost in the prediction direction. Then, the prediction cost in each prediction direction can be determined according to the difference between the prediction block obtained in each prediction direction and the current block in the time and/or space dimension, and the prediction cost in the two prediction directions is compared to determine the direction with smaller prediction cost in the two prediction directions. If direction 0 is less than the direction 1 prediction cost, then direction 0 is determined as the current prediction direction for the bi-prediction of the current block, otherwise direction 1 is determined as the current prediction direction for the bi-prediction of the current block. As an example, the difference in the temporal dimension may be a motion vector difference between the current block and the predicted block, and the difference in the spatial dimension may be a difference in pixel values of the two blocks.
Next, in step S220, a bi-prediction iterative operation is performed. According to an exemplary embodiment, a bi-predictive iterative operation includes: and acquiring an inverted block of a prediction block of the current prediction direction, and performing motion search in another prediction direction except the current prediction direction in two prediction directions of the current block based on the inverted block to obtain the prediction block in the other prediction direction.
According to an exemplary embodiment, obtaining an inverted block of a prediction block of a current prediction direction, performing motion search in another prediction direction other than the current prediction direction among two prediction directions for the current block based on the inverted block, to obtain the prediction block in the other prediction direction, includes: and acquiring an inverted block of a prediction block with the minimum prediction cost in the current prediction direction, and performing motion search on the basis of the inverted block in the other prediction direction except the current prediction direction in the two prediction directions aiming at the current block to obtain the prediction block with the minimum prediction cost in the other prediction direction.
Here, acquiring the inverted block of the prediction block having the smallest prediction cost in the current prediction direction may include: firstly, the prediction block with the smallest prediction cost in the current prediction direction is obtained, specifically, the prediction block with the smallest prediction cost may be obtained by directly reading the prediction block obtained by performing unidirectional motion search in the current prediction direction for the current block, or may be obtained by performing unidirectional motion search in the current prediction direction for the current block again. Then, after obtaining the prediction block with the minimum prediction cost in the current prediction direction, subtracting each pixel value of the prediction block from the maximum pixel value in the color space to obtain an inverted block of the prediction block.
Furthermore, according to an exemplary embodiment, performing a motion search based on the inverted block to obtain a prediction block with a minimum prediction cost in the other prediction direction includes: and searching a prediction block with the smallest difference with the inverse block in the time dimension and/or the space dimension in the reference frame in the other prediction direction as a prediction block with the smallest prediction cost in the other prediction direction. As an example, the difference in the temporal dimension may be a motion vector difference between the current block and the predicted block, and the difference in the spatial dimension may be a difference in pixel values of the two blocks.
In step S230, under the condition that the current iteration number meets the preset iteration number condition, a current prediction cost is obtained, whether the current prediction cost meets the preset cost condition is determined, if yes, another prediction direction in the bidirectional prediction is updated to be the current prediction direction, the current iteration number is updated, the bidirectional prediction iteration operation is continuously executed, and otherwise, a bidirectional prediction result of the current block is obtained based on prediction blocks in the two prediction directions.
For example, the preset iteration number condition may be that the current iteration number is smaller than the predetermined iteration number, but is not limited thereto.
As an example, the obtaining the current predicted cost, and determining whether the current predicted cost meets the preset cost condition includes: acquiring the current prediction cost of the other prediction direction, and determining the relation between the current prediction cost of the other prediction direction and a cost threshold; and when the current predicted cost is larger than the cost threshold value, determining that the current predicted cost meets a preset cost condition, otherwise, determining that the current predicted cost does not meet the preset cost condition.
As described above, for example, in step S220, motion search is performed based on the inverted block, and a prediction block with the minimum prediction cost in the other prediction direction is obtained. In this case, the prediction cost corresponding to the prediction block whose prediction cost in the other prediction direction is smallest may be directly taken as the current prediction cost in the other prediction direction.
As an example, the cost threshold may be determined according to the smallest predicted cost among the predicted costs of the two predicted directions at the time of unidirectional motion search. For example, the predetermined threshold may be the minimum prediction cost itself, or may be a threshold determined according to the minimum prediction cost. Furthermore, optionally, the cost threshold may be determined according to a minimum prediction cost among prediction costs of two prediction directions at the time of unidirectional motion search and a quantization step size for the current block. For example, the predetermined threshold may be a minimum prediction cost among prediction costs of two prediction directions at the time of the unidirectional motion search divided by a value determined based on the quantization step size.
Assuming that the minimum prediction cost is denoted as bestUniLumaCost and the value determined based on the quantization step is denoted as ratio, the cost threshold may be expressed as bestUniLumaCost/ratio. As an example, the numerical ratio may be determined by comparing the quantization step size with a predetermined step size threshold. For example, the value is equal to 1 when the quantization step size is greater than a predetermined step size threshold, and otherwise the value is equal to a value between 0 and 1 determined from the quantization step size. As an example, ratio=qp > 301:0.512 x exp (0.022 x QP), where 30 is the predetermined step threshold, ratio=1 when QP > 30, otherwise ratio=0.512 x exp (0.022 x QP), which is a value between 0 and 1. It should be noted that the predetermined step threshold is not limited to 30, but may be other values. For example, assuming that the current prediction cost is labeled iterCost, if the following formula is satisfied, the cost after the current iteration is considered to be too great, and then no better bi-prediction result than the uni-prediction is generated, it is not significant to perform more iterations, and the bi-prediction can be ended in advance (i.e., the operation of step S220 described above is not performed):
iterCost>bestUniLumaCost/ratio,
Where ratio=qp > 301:0.512 x exp (0.022 x qp).
Through the above description, under the condition that the current iteration number meets the preset iteration number condition (for example, the current iteration number is smaller than the preset iteration number), instead of directly continuing the bidirectional prediction iteration operation, the current prediction cost is obtained, whether the current prediction cost meets the preset cost condition is determined, if not, the bidirectional prediction is finished in advance, and the bidirectional prediction result of the current block is obtained based on the prediction blocks in the current two prediction directions. Therefore, under the condition of ensuring the coding performance, redundant iteration during bidirectional prediction can be avoided as much as possible, time consumption is reduced, and the coding efficiency is improved.
Optionally, although not shown in fig. 2, according to an exemplary embodiment, the video encoding method shown in fig. 2 may further include: and under the condition that the current iteration number does not meet the preset iteration number condition, obtaining a bidirectional prediction result of the current block based on the prediction blocks in the two prediction directions.
As an example, the above-described bi-prediction result of the current block based on the prediction blocks in the two prediction directions may be a bi-prediction result of the current block obtained by averaging or weighted-averaging pixel values of the prediction blocks in the current two prediction directions, but is not limited thereto. Further, in the case of obtaining a bi-prediction result of the current block, encoding of the current block may be performed based on the bi-prediction result of the current block. To more clearly understand a video encoding method according to an exemplary embodiment of the present disclosure, it is further described below with reference to the example of fig. 4. Fig. 4 is a schematic diagram illustrating an example of a video encoding method according to an exemplary embodiment of the present disclosure. In fig. 4, it is assumed that i is the current prediction direction, and it is assumed that direction 0 is determined as the current prediction direction (i.e., i=0) and the current iteration number is initialized to 0 (i.e., loop=0) at step S210.
Next, an inverted block of the prediction block with the smallest prediction cost in the direction i is acquired, and motion search is performed in the direction (1-i) based on the inverted block, to obtain the prediction block with the smallest prediction cost in the direction (1-i), and then, it is determined whether loop is smaller than N (predetermined iteration number, for example, n=4). If not, the bidirectional prediction is completed, and a bidirectional prediction result of the current block is obtained based on the prediction blocks in the current two prediction directions. If so, the current predicted cost of the direction (1-i) is obtained, and whether the predicted cost meets a preset cost condition is determined. If the preset cost condition is met, loop=loop+1 and i=1-i, then the bi-directional prediction iterative operation is continuously executed (namely, the inverted block of the predicted block with the minimum prediction cost in the direction i is obtained, the motion search is performed in the direction (1-i) based on the inverted block to obtain the predicted block with the minimum prediction cost in the direction (1-i)), otherwise, the bi-directional prediction is finished in advance, and the bi-directional prediction result of the current block is obtained based on the predicted blocks in the current direction 0 and the direction 1.
In the above, the video encoding method according to the embodiments of the present disclosure has been described with reference to fig. 2 to 4, according to the above video encoding method, in the case where the current iteration number satisfies the preset iteration number condition, bidirectional prediction is not directly performed continuously, but it is determined whether it is appropriate to continue the bidirectional prediction according to the current prediction cost, and if it is not appropriate, the bidirectional prediction is ended in advance, so that, while ensuring the encoding performance, redundant iterations during the bidirectional prediction can be avoided as much as possible, and time consumption is reduced, thereby facilitating improvement of the encoding efficiency.
A video encoding apparatus according to an exemplary embodiment of the present disclosure is briefly described below with reference to fig. 5.
Fig. 5 is a block diagram illustrating a video encoding apparatus according to an exemplary embodiment of the present disclosure. Referring to fig. 5, the video encoding device 500 may include an initialization unit 510 and a bi-prediction unit 520. In particular, the initialization unit 510 may be configured to determine a current prediction direction of bi-prediction for the current block and initialize a current iteration number. The bi-prediction unit 520 may be configured to:
performing a bi-predictive iterative operation, wherein the bi-predictive iterative operation comprises: acquiring an inverted block of a prediction block of a current prediction direction, and performing motion search in another prediction direction except the current prediction direction in two prediction directions aiming at the current block based on the inverted block to obtain the prediction block in the other prediction direction;
and under the condition that the current iteration number meets the preset iteration number condition, acquiring a current prediction cost, determining whether the current prediction cost meets the preset cost condition, if so, updating the other prediction direction in the bidirectional prediction to the current prediction direction, updating the current iteration number, and continuing to execute the bidirectional prediction iteration operation, otherwise, obtaining a bidirectional prediction result of the current block based on the prediction blocks in the two prediction directions.
Since the video encoding method shown in fig. 2 may be performed by the video encoding apparatus 500 shown in fig. 5 and the initialization unit 510 and the bi-prediction unit 520 may perform operations corresponding to step S210 and steps S220 to S230 in fig. 2, respectively, any relevant details concerning the operations performed by the units in fig. 5 may be referred to the corresponding descriptions concerning fig. 2 to 5, and will not be repeated here.
Further, it should be noted that, although the video encoding apparatus 500 is described above as being divided into units for performing the respective processes, it is apparent to those skilled in the art that the processes performed by the respective units described above may be performed without any specific division of units or without explicit demarcation between the units by the video encoding apparatus 500. In addition, the video encoding device 500 may also include other units, such as a storage unit, etc.
Fig. 6 is a block diagram of an electronic device according to an exemplary embodiment of the present disclosure.
Referring to fig. 6, an electronic device 600 may include at least one memory 601 and at least one processor 602, the at least one memory storing computer-executable instructions that, when executed by the at least one processor, cause the at least one processor 602 to perform a video encoding method according to an embodiment of the present disclosure.
By way of example, the electronic device may be a PC computer, tablet device, personal digital assistant, smart phone, or other device capable of executing the above-described set of instructions. Here, the electronic device is not necessarily a single electronic device, but may be any device or an aggregate of circuits capable of executing the above-described instructions (or instruction set) singly or in combination. The electronic device may also be part of an integrated control system or system manager, or may be configured as a portable electronic device that interfaces with either locally or remotely (e.g., via wireless transmission).
In an electronic device, a processor may include a Central Processing Unit (CPU), a Graphics Processor (GPU), a programmable logic device, a special purpose processor system, a microcontroller, or a microprocessor. By way of example, and not limitation, processors may also include analog processors, digital processors, microprocessors, multi-core processors, processor arrays, network processors, and the like.
The processor may execute instructions or code stored in the memory, wherein the memory may also store data. The instructions and data may also be transmitted and received over a network via a network interface device, which may employ any known transmission protocol.
The memory may be integrated with the processor, for example, RAM or flash memory disposed within an integrated circuit microprocessor or the like. In addition, the memory may include a stand-alone device, such as an external disk drive, a storage array, or any other storage device usable by a database system. The memory and the processor may be operatively coupled or may communicate with each other, for example, through an I/O port, a network connection, etc., such that the processor is able to read files stored in the memory.
In addition, the electronic device may also include a video display (such as a liquid crystal display) and a user interaction interface (such as a keyboard, mouse, touch input device, etc.). All components of the electronic device may be connected to each other via a bus and/or a network.
According to an embodiment of the present disclosure, there may also be provided a computer-readable storage medium storing instructions that, when executed by at least one processor, cause the at least one processor to perform a video encoding method according to an exemplary embodiment of the present disclosure. Examples of the computer readable storage medium herein include: read-only memory (ROM), random-access programmable read-only memory (PROM), electrically erasable programmable read-only memory (EEPROM), random-access memory (RAM), dynamic random-access memory (DRAM), static random-access memory (SRAM), flash memory, nonvolatile memory, CD-ROM, CD-R, CD + R, CD-RW, CD+RW, DVD-ROM, DVD-R, DVD + R, DVD-RW, DVD+RW, DVD-RAM, BD-ROM, BD-R, BD-R LTH, BD-RE, blu-ray or optical disk storage, hard Disk Drives (HDD), solid State Disks (SSD), card memory (such as multimedia cards, secure Digital (SD) cards or ultra-fast digital (XD) cards), magnetic tape, floppy disks, magneto-optical data storage, hard disks, solid state disks, and any other means configured to store computer programs and any associated data, data files and data structures in a non-transitory manner and to provide the computer programs and any associated data, data files and data structures to a processor or computer to enable the processor or computer to execute the programs. The instructions or computer programs in the computer-readable storage media described above can be run in an environment deployed in a computer device, such as a client, host, proxy device, server, etc., and further, in one example, the computer programs and any associated data, data files, and data structures are distributed across networked computer systems such that the computer programs and any associated data, data files, and data structures are stored, accessed, and executed in a distributed fashion by one or more processors or computers.
In accordance with embodiments of the present disclosure, there may also be provided a computer program product comprising computer instructions which, when executed by a processor, implement a video encoding method according to an exemplary embodiment of the present disclosure.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any adaptations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.

Claims (21)

1. A video encoding method, comprising:
determining a current prediction direction of bi-prediction for a current block and initializing a current iteration number;
performing a bi-predictive iterative operation, wherein the bi-predictive iterative operation comprises: acquiring an inverted block of a prediction block of a current prediction direction, and performing motion search in another prediction direction except the current prediction direction in two prediction directions aiming at the current block based on the inverted block to obtain the prediction block in the other prediction direction;
And under the condition that the current iteration number meets the preset iteration number condition, acquiring a current prediction cost, determining whether the current prediction cost meets the preset cost condition, if so, updating the other prediction direction in the bidirectional prediction to the current prediction direction, updating the current iteration number, and continuing to execute the bidirectional prediction iteration operation, otherwise, obtaining a bidirectional prediction result of the current block based on the prediction blocks in the two prediction directions.
2. The video coding method of claim 1, wherein the determining a current prediction direction for bi-prediction of the current block comprises:
unidirectional motion search is performed in two prediction directions for a current block, respectively, and a direction in which a prediction cost is smaller of the two prediction directions is determined as a current prediction direction for bidirectional prediction of the current block.
3. The video encoding method according to claim 1, wherein the obtaining an inverted block of a prediction block of a current prediction direction, performing motion search in another prediction direction other than the current prediction direction among two prediction directions for the current block based on the inverted block, obtains the prediction block in the other prediction direction, comprises:
And acquiring an inverted block of a prediction block with the minimum prediction cost in the current prediction direction, and performing motion search on the basis of the inverted block in the other prediction direction except the current prediction direction in the two prediction directions aiming at the current block to obtain the prediction block with the minimum prediction cost in the other prediction direction.
4. The video coding method according to claim 3, wherein said performing a motion search based on said inverse block to obtain a prediction block with a minimum prediction cost in said another prediction direction comprises:
and searching a prediction block with the smallest difference with the inverse block in the time dimension and/or the space dimension in the reference frame in the other prediction direction as a prediction block with the smallest prediction cost in the other prediction direction.
5. The video coding method according to any one of claims 1 to 4, wherein the obtaining the current prediction cost, determining whether the current prediction cost satisfies a preset cost condition, includes:
acquiring the current prediction cost of the other prediction direction, and determining the relation between the current prediction cost of the other prediction direction and a cost threshold, wherein the cost threshold is determined according to the minimum prediction cost among the prediction costs of the two prediction directions during unidirectional motion search;
And when the current predicted cost is larger than the cost threshold value, determining that the current predicted cost meets a preset cost condition, otherwise, determining that the current predicted cost does not meet the preset cost condition.
6. The video encoding method of claim 5, wherein the cost threshold is determined from a minimum prediction cost among prediction costs of two prediction directions in unidirectional motion search and a quantization step size for a current block.
7. The video encoding method of claim 6, wherein the cost threshold is a minimum prediction cost among prediction costs of two prediction directions at the time of the unidirectional motion search divided by a value determined based on the quantization step size.
8. The video encoding method of claim 7, wherein the value is determined by comparing the quantization step size to a predetermined step size threshold, wherein the value is equal to 1 when the quantization step size is greater than the predetermined step size threshold; otherwise, the value is equal to a value between 0 and 1 determined from the quantization step size.
9. The video coding method of claim 1, wherein the method further comprises:
And under the condition that the current iteration number does not meet the preset iteration number condition, obtaining a bidirectional prediction result of the current block based on the prediction blocks in the two prediction directions.
10. A video encoding apparatus, comprising:
an initialization unit configured to determine a current prediction direction of bi-prediction for a current block and initialize a current iteration number;
a bi-prediction unit configured to:
performing a bi-predictive iterative operation, wherein the bi-predictive iterative operation comprises: acquiring an inverted block of a prediction block of a current prediction direction, and performing motion search in another prediction direction except the current prediction direction in two prediction directions aiming at the current block based on the inverted block to obtain the prediction block in the other prediction direction;
and under the condition that the current iteration number meets the preset iteration number condition, acquiring a current prediction cost, determining whether the current prediction cost meets the preset cost condition, if so, updating the other prediction direction in the bidirectional prediction to the current prediction direction, updating the current iteration number, and continuing to execute the bidirectional prediction iteration operation, otherwise, obtaining a bidirectional prediction result of the current block based on the prediction blocks in the two prediction directions.
11. The video encoding device of claim 10, wherein the determining a current prediction direction for bi-prediction of the current block comprises:
unidirectional motion search is performed in two prediction directions for a current block, respectively, and a direction in which a prediction cost is smaller of the two prediction directions is determined as a current prediction direction for bidirectional prediction of the current block.
12. The video encoding device of claim 10, wherein the obtaining the inverted block of the prediction block of the current prediction direction, performing a motion search in another prediction direction other than the current prediction direction among two prediction directions for the current block based on the inverted block, obtains the prediction block in the other prediction direction, comprises:
and acquiring an inverted block of a prediction block with the minimum prediction cost in the current prediction direction, and performing motion search on the inverted block in the other prediction direction except the current prediction direction in the two prediction directions of the current block to obtain the prediction block with the minimum prediction cost in the other prediction direction.
13. The video coding device of claim 12, wherein the performing the motion search based on the inverted block to obtain the prediction block with the smallest prediction cost in the other prediction direction comprises:
And searching a prediction block with the smallest difference with the inverse block in the time dimension and/or the space dimension in the reference frame in the other prediction direction as a prediction block with the smallest prediction cost in the other prediction direction.
14. The video coding apparatus of any of claims 10-13, wherein the obtaining a current prediction cost, determining whether the current prediction cost satisfies a preset cost condition, comprises:
acquiring the current prediction cost of the other prediction direction, and determining the relation between the current prediction cost of the other prediction direction and a cost threshold, wherein the cost threshold is determined according to the minimum prediction cost among the prediction costs of the two prediction directions during unidirectional motion search;
and when the current predicted cost is larger than the cost threshold value, determining that the current predicted cost meets a preset cost condition, otherwise, determining that the current predicted cost does not meet the preset cost condition.
15. The video encoding device of claim 14, wherein the cost threshold is determined from a minimum prediction cost among prediction costs of two prediction directions at the time of unidirectional motion search and a quantization step size for a current block.
16. The video encoding device of claim 15, wherein the cost threshold is a minimum prediction cost among prediction costs of two prediction directions at the time of the unidirectional motion search divided by a value determined based on the quantization step size.
17. The video encoding device of claim 16, wherein the value is determined by comparing the quantization step size to a predetermined step size threshold, wherein the value is equal to 1 when the quantization step size is greater than the predetermined step size threshold; otherwise, the value is equal to a value between 0 and 1 determined from the quantization step size.
18. The video encoding device of claim 12, wherein the bi-prediction unit is further configured to: and under the condition that the current iteration number does not meet the preset iteration number condition, obtaining a bidirectional prediction result of the current block based on the prediction blocks in the two prediction directions.
19. An electronic device, comprising:
at least one processor;
at least one memory storing computer-executable instructions,
wherein the computer executable instructions, when executed by the at least one processor, cause the at least one processor to perform the video encoding method of any of claims 1 to 9.
20. A computer-readable storage medium storing instructions that, when executed by at least one processor, cause the at least one processor to perform the video encoding method of any of claims 1 to 9.
21. A computer program product comprising computer instructions which, when executed by a processor, implement the video encoding method of any one of claims 1 to 9.
CN202111464487.5A 2021-12-03 2021-12-03 Video encoding method, video encoding device, electronic equipment and storage medium Active CN113938690B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111464487.5A CN113938690B (en) 2021-12-03 2021-12-03 Video encoding method, video encoding device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111464487.5A CN113938690B (en) 2021-12-03 2021-12-03 Video encoding method, video encoding device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113938690A CN113938690A (en) 2022-01-14
CN113938690B true CN113938690B (en) 2023-10-31

Family

ID=79288705

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111464487.5A Active CN113938690B (en) 2021-12-03 2021-12-03 Video encoding method, video encoding device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113938690B (en)

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101022555A (en) * 2007-02-12 2007-08-22 清华大学 Interframe predictive coding mode quick selecting method
WO2008153262A1 (en) * 2007-06-15 2008-12-18 Sungkyunkwan University Foundation For Corporate Collaboration Bi-prediction coding method and apparatus, bi-prediction decoding method and apparatus, and recording midium
CN102065298A (en) * 2011-01-05 2011-05-18 西安电子科技大学 High-performance macroblock coding implementation method
CN104469336A (en) * 2013-09-25 2015-03-25 中国科学院深圳先进技术研究院 Coding method for multi-view depth video signals
EP3151558A1 (en) * 2015-09-30 2017-04-05 Thomson Licensing Method and device for predicting a current block of pixels in a current frame, and corresponding encoding and/or decoding methods and devices
CN110545425A (en) * 2019-08-21 2019-12-06 浙江大华技术股份有限公司 Inter-frame prediction method, terminal equipment and computer storage medium
CN110611820A (en) * 2019-09-11 2019-12-24 北京达佳互联信息技术有限公司 Video coding method and device, electronic equipment and storage medium
CN110636293A (en) * 2019-09-27 2019-12-31 腾讯科技(深圳)有限公司 Video encoding method, video decoding method, video encoding apparatus, video decoding apparatus, storage medium, and electronic apparatus
CN111543059A (en) * 2017-12-31 2020-08-14 华为技术有限公司 Image prediction method, device and codec
CN112004097A (en) * 2020-07-30 2020-11-27 浙江大华技术股份有限公司 Inter-frame prediction method, image processing apparatus, and computer-readable storage medium
CN112135126A (en) * 2019-11-05 2020-12-25 杭州海康威视数字技术股份有限公司 Encoding and decoding method, device and equipment
CN113573066A (en) * 2021-07-07 2021-10-29 网宿科技股份有限公司 Video coding method and device
CN113597767A (en) * 2019-03-08 2021-11-02 Oppo广东移动通信有限公司 Prediction method, encoder, decoder, and computer storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116600121A (en) * 2023-05-18 2023-08-15 北京大学深圳研究生院 Video coding method and device, electronic equipment and storage medium

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101022555A (en) * 2007-02-12 2007-08-22 清华大学 Interframe predictive coding mode quick selecting method
WO2008153262A1 (en) * 2007-06-15 2008-12-18 Sungkyunkwan University Foundation For Corporate Collaboration Bi-prediction coding method and apparatus, bi-prediction decoding method and apparatus, and recording midium
CN102065298A (en) * 2011-01-05 2011-05-18 西安电子科技大学 High-performance macroblock coding implementation method
CN104469336A (en) * 2013-09-25 2015-03-25 中国科学院深圳先进技术研究院 Coding method for multi-view depth video signals
EP3151558A1 (en) * 2015-09-30 2017-04-05 Thomson Licensing Method and device for predicting a current block of pixels in a current frame, and corresponding encoding and/or decoding methods and devices
CN111543059A (en) * 2017-12-31 2020-08-14 华为技术有限公司 Image prediction method, device and codec
CN113597767A (en) * 2019-03-08 2021-11-02 Oppo广东移动通信有限公司 Prediction method, encoder, decoder, and computer storage medium
CN110545425A (en) * 2019-08-21 2019-12-06 浙江大华技术股份有限公司 Inter-frame prediction method, terminal equipment and computer storage medium
CN110611820A (en) * 2019-09-11 2019-12-24 北京达佳互联信息技术有限公司 Video coding method and device, electronic equipment and storage medium
CN110636293A (en) * 2019-09-27 2019-12-31 腾讯科技(深圳)有限公司 Video encoding method, video decoding method, video encoding apparatus, video decoding apparatus, storage medium, and electronic apparatus
CN112135126A (en) * 2019-11-05 2020-12-25 杭州海康威视数字技术股份有限公司 Encoding and decoding method, device and equipment
CN112004097A (en) * 2020-07-30 2020-11-27 浙江大华技术股份有限公司 Inter-frame prediction method, image processing apparatus, and computer-readable storage medium
CN113573066A (en) * 2021-07-07 2021-10-29 网宿科技股份有限公司 Video coding method and device

Also Published As

Publication number Publication date
CN113938690A (en) 2022-01-14

Similar Documents

Publication Publication Date Title
US9235313B2 (en) Efficient motion estimation for remote desktop sharing
US8499055B2 (en) File decoding system and method
CN114268792A (en) Method and device for determining video transcoding scheme and method and device for video transcoding
CN113938690B (en) Video encoding method, video encoding device, electronic equipment and storage medium
US12003739B2 (en) Cross component intra prediction mode
CN114157868B (en) Video frame coding mode screening method and device and electronic equipment
KR20100123841A (en) Motion-compensated residue based temporal search range prediction
US11736720B2 (en) Motion vector refinement methods for video encoding
CN114157895A (en) Video processing method and device, electronic equipment and storage medium
CN116431347B (en) Method, device, electronic equipment and storage medium for resource processing
CN112714317B (en) Method, apparatus, electronic device and readable medium for video encoding
CN116896632A (en) Video coding method and device
CN115086678B (en) Video encoding method and device, and video decoding method and device
US11418810B2 (en) Methods of inter picture motion prediction for multi-view video compression
US11438633B2 (en) Temporal de-noising for video
US20210409706A1 (en) Low latency cross component intra prediction mode
CN116760986B (en) Candidate motion vector generation method, candidate motion vector generation device, computer equipment and storage medium
CN114222118B (en) Encoding method and device, decoding method and device
CN114501003B (en) Video decoding method and device
CN112788340B (en) Method and apparatus for adaptively determining the number of frames for a coded group of pictures
US20220141497A1 (en) Extended maximum coding unit size
CN116527914A (en) Decoding method and device suitable for space image
CN116016945A (en) Video encoding method and device, video decoding method and device and electronic equipment
CN116055749A (en) Video processing method and device
CN116708806A (en) Encoding method, decoding method and device applicable to spatial pictures

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
GR01 Patent grant
GR01 Patent grant