An inter prediction method and apparatus
By using an internal caching module to store pixel data within the search window in inter-frame prediction, and combining time-division multiplexing and the EPZS algorithm, the problems of high system bandwidth and long search time in inter-frame prediction are solved, achieving more efficient video coding.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-18
- Publication Date
- 2026-03-27
AI Technical Summary
In existing technologies, inter-frame prediction systems have large bandwidth and long inter-frame search times, resulting in low video coding efficiency.
When performing inter-frame prediction on the current macroblock of the video frame to be encoded, the internal cache module stores the pixel data in the search window, and the data is read from the external cache using time-division multiplexing. The enhanced prediction region search algorithm (EPZS) and the predicted motion vector value (MVP) are used to determine the search window, reducing interaction with external memory and reducing the system bandwidth burden.
It improves the efficiency of video coding, reduces inter-frame search time, and enhances the feasibility and accuracy of inter-frame prediction methods.
Smart Images

Figure CN115914645B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of video coding, in particular to an inter-frame prediction method and device. BACKGROUND
[0002] Many video or animation have great correlation between two consecutive frames, that is, there is redundancy between adjacent frames, so in video compression and video communication, all pixel information of each frame does not need to be transmitted to the decoder, only the motion information needs to be transmitted, and the decoder can update the current frame according to the previous frame image and the motion information, so as to achieve the purpose of compression. Motion estimation refers to searching for an image block in a reference frame that is most similar to the image block of the current frame, that is, a target image block, and the search result is represented by a motion vector. Motion estimation is performed by the inter-frame prediction method, the correlation between image frames is utilized to realize image compression, the information that needs to be transmitted in the encoding process of each image block is reduced, the information that needs to be entropy encoded is reduced, the compression rate of the final encoding is improved, and the bandwidth in the communication system is saved.
[0003] In view of search efficiency and required memory, the above inter-frame prediction first locates a search window on the reference frame, and searches for a target image block with minimum encoding cost in the search window. When searching for the target image block, a certain algorithm is used to determine a plurality of to-be-searched image blocks, the data of the to-be-searched image blocks are sequentially obtained, and whether the to-be-searched image blocks are target image blocks is sequentially determined.
[0004] In the prior art, the search window takes the coordinate position (0, 0) in the reference frame as a center point, when obtaining the data of the to-be-calculated image block, the search window is divided into a plurality of parts according to the position of the to-be-calculated image block relative to the center point, the search window is slid from one part of the center point to the position part by part, all data in the sliding range is read from the external memory part by part, and the data of the to-be-calculated image block is obtained. However, in the case that the position of the to-be-calculated image block relative to the center point changes greatly, a large amount of data needs to be read by the above method; moreover, since the reference frame is stored in the external memory, the data reading of the above method is realized by interacting with the external memory, the access delay of the external memory is large, the requirement for bandwidth is also high, the above method will increase the bandwidth of the system and the inter-frame search time, and reduce the video coding efficiency. SUMMARY
[0005] The present application provides an inter-frame prediction method and device, which solves the problems of large system bandwidth, long inter-frame search time and low video coding efficiency in the prior art.
[0006] In a first aspect, the present application provides an inter-frame prediction method, which comprises:
[0007] When inter-frame prediction is performed on a current macroblock in a video frame, a search window corresponding to a reference frame of the video frame is determined for the current macroblock;
[0008] Pixel data in the search window is read from an external buffer and stored in an internal cache module;
[0009] Pixel data of a reference macroblock of the current macroblock is read from the internal cache module at least once according to a storage address of the pixel data of the reference macroblock in the internal cache module, to search for a target reference macroblock with a coding cost meeting a first preset requirement.
[0010] Optionally, the search window corresponding to the reference frame of the video frame is determined for the current macroblock, comprising:
[0011] A motion vector (MV) value of the current macroblock is predicted according to an MV value of a macroblock adjacent to the current macroblock, to obtain a predicted motion vector value (MVP);
[0012] The MVP is rounded, and a search window of a preset size is obtained by performing a clipping operation on the reference frame with a pixel position corresponding to the rounded MVP as a center.
[0013] The inter-frame prediction method provided by the embodiment of the present application predicts and rounds the MV value, and determines the search window with a pixel position corresponding to the rounded MVP as a center, thereby providing an implementation manner of determining the search window, and improving the implementability of the inter-frame prediction method of the embodiment of the present application.
[0014] Optionally, after the search window of the preset size is obtained, the method further comprises:
[0015] An enhanced prediction zone search (EPZS) algorithm is used to predict motion vectors of N reference macroblocks with a coding cost less than a preset threshold in the search window relative to the current macroblock, wherein the N is a positive integer.
[0016] A pixel position corresponding to the predicted motion vector is taken as a pixel position of a prediction point, and the prediction point is used to determine a reference macroblock to be searched.
[0017] The inter-frame prediction method provided by the embodiment of the present application uses the EPZS algorithm to predict at least one prediction point used to determine a reference macroblock to be searched, thereby determining a search range of the target reference macroblock, and improving the implementability and accuracy of the inter-frame prediction method of the embodiment of the present application.
[0018] Optionally, before the pixel data of the reference macroblock of the current macroblock is read from the internal cache module at least once according to the storage address of the pixel data of the reference macroblock in the internal cache module, the method further comprises:
[0019] According to the MV value of the prediction point, a storage address of pixel data of a reference macroblock of the current macroblock in the internal cache module is determined.
[0020] The inter-frame prediction method provided by the embodiment of the present application provides an implementation of determining a storage address of pixel data of a reference macroblock of a current macroblock in an internal cache module, which provides a necessary implementation basis for reading the pixel data of the reference macroblock, and improves the implementability of the inter-frame prediction method of the embodiment of the present application.
[0021] Optionally, the pixel data in the search window is read from the external cache and stored in the internal cache module, including:
[0022] The pixel data is sequentially read from the external cache according to a storage unit tile size, and each two adjacent storage unit tiles of the pixel data sequentially read are respectively stored in the first internal cache module and the second internal cache module;
[0023] The pixel data of the reference macroblock is read from the internal cache module, including:
[0024] The pixel data of adjacent storage unit tiles is read from the first internal cache module and the second internal cache module according to the order of the storage unit tiles.
[0025] The inter-frame prediction method provided by the embodiment of the present application provides an implementation of storing pixel data of an external cache in an internal cache module, and provides an implementation of reading pixel data from the internal cache module, which limits the data storage and reading mode of the internal cache module, uses the tile mode to store the search window, virtualizes the search window, can reduce the system bandwidth burden of the inter-frame prediction method of the embodiment of the present application, reduces the time of inter-frame search, and improves the efficiency of video coding.
[0026] Optionally, before the inter-frame prediction of the current macroblock in the video frame to be coded, the method further includes:
[0027] The pixel data of the current macroblock in the video frame is read from the external cache by a first process; wherein the first process and a second process read the pixel data in a time division multiplexing mode, and the second process is used to read the pixel data from the external cache for intra-frame prediction.
[0028] The inter-frame prediction method provided by the embodiment of the present application reads data from the external cache in a time division multiplexing mode, which can save hardware overhead.
[0029] Optionally, the pixel data is luminance color YUV data.
[0030] The inter-frame prediction method provided by the embodiment of the present application limits the data type of pixel data, and improves the implementability of the inter-frame prediction method.
[0031] Optionally, reading the pixel data of the reference macro block from the internal cache module for at least one search comprises:
[0032] searching the to-be-searched reference macro block corresponding to the integer motion vector, and determining a first target reference macro block with an integer encoding cost meeting a second preset requirement;
[0033] According to the first target reference macro block, searching the to-be-searched reference macro block corresponding to the fractional motion vector, and determining a second target reference macro block with a fractional encoding cost meeting a third preset requirement;
[0034] determining the second target reference macro block as the target reference macro block with the encoding cost meeting the first preset requirement.
[0035] The inter-frame prediction method provided by the embodiment of the present application determines the target reference macro block with the encoding cost meeting the preset requirement through searching the integer encoding cost and searching the fractional encoding cost, and improves the implementability and accuracy of the inter-frame prediction method.
[0036] Optionally, searching the to-be-searched reference macro block corresponding to the integer motion vector, and determining a first target reference macro block with an integer encoding cost meeting a second preset requirement comprises:
[0037] determining a first to-be-searched reference macro block corresponding to the pixel position of the rounded MVP as the center, and calculating a first integer encoding cost of the first to-be-searched reference macro block;
[0038] If the first integer encoding cost is less than a first set threshold, ending the search of the first target reference macro block corresponding to the integer motion vector;
[0039] Otherwise, re-determining the to-be-searched reference macro block and performing the next search.
[0040] The inter-frame prediction method provided by the embodiment of the present application provides an implementation manner of integer search, and improves the implementability and accuracy of the inter-frame prediction method.
[0041] Optionally, re-determining the to-be-searched reference macro block and performing the next search comprises:
[0042] When it is determined that there are N prediction points, determining a second to-be-searched reference macro block corresponding to each prediction point as the center, and calculating a second integer encoding cost of the second to-be-searched reference macro block;
[0043] If the second to-be-searched reference macroblock with the second integer encoding cost less than the second set threshold exists, the searching of the first target reference macroblock corresponding to the integer motion vector is ended.
[0044] The inter-frame prediction method provided by the embodiment of the present application provides an implementation of re-determining the to-be-searched reference macroblock and performing the next search, and improves the implementability and accuracy of the inter-frame prediction method.
[0045] Optionally, when the to-be-searched reference macroblock is re-determined and the next search is performed, the method further comprises:
[0046] If the next search is performed and the N prediction points do not exist, or the second to-be-searched reference macroblock with the second integer encoding cost less than the second set threshold does not exist, the following is performed:
[0047] The to-be-searched reference macroblock with the minimum encoding cost in the to-be-searched reference macroblock determined by the previous search is taken as a starting point, and the next search of the to-be-searched reference macroblock corresponding to the integer motion vector is performed in the search template in a sliding manner.
[0048] The inter-frame prediction method provided by the embodiment of the present application provides an implementation of re-determining the to-be-searched reference macroblock and performing the next search in a preset search template, and improves the implementability and accuracy of the inter-frame prediction method.
[0049] Optionally, the to-be-searched reference macroblock corresponding to the fractional motion vector is searched according to the first target reference macroblock, the second target reference macroblock with the fractional encoding cost meeting the preset requirement is determined, and the searching comprises:
[0050] The at least one pixel position with a set distance from the center pixel position corresponding to the first target reference macroblock is determined, and the set distance is less than the distance between adjacent pixels;
[0051] The third to-be-searched reference macroblock corresponding to the determined pixel position is determined, and the third fractional encoding cost of the third to-be-searched reference macroblock is calculated.
[0052] The to-be-searched reference macroblock corresponding to the minimum encoding cost in the third fractional encoding cost is determined as the second target reference macroblock.
[0053] The inter-frame prediction method provided by the embodiment of the present application provides an implementation of fractional search, and improves the implementability and accuracy of the inter-frame prediction method.
[0054] In a second aspect, the present application provides an inter-frame prediction device comprising an internal cache module and a circuit control module, wherein:
[0055] The internal cache module is configured to store pixel data of the current macroblock in the video frame within a search window corresponding to a reference frame of the video frame when performing inter-frame prediction on the current macroblock in the video frame to be encoded.
[0056] The integrated circuit control module is configured to perform the steps of the inter-frame prediction method according to any one of the first aspect. The inter-frame prediction method and device provided by the present application have the following beneficial effects:
[0057] The internal cache module is configured to store pixel data of the current macroblock in the video frame within a search window corresponding to a reference frame of the video frame when performing inter-frame prediction on the current macroblock in the video frame to be encoded. BRIEF DESCRIPTION OF DRAWINGS
[0058] Figure 1 FIG. 1 is a schematic diagram of an H.264 encoder according to an embodiment of the present application;
[0059] Figure 2 FIG. 2 is a flowchart of an inter-frame prediction method according to an embodiment of the present application;
[0060] Figure 3 FIG. 3 is a schematic diagram of a small diamond search according to an embodiment of the present application;
[0061] Figure 4 FIG. 4 is a flowchart of an integer search according to an embodiment of the present application;
[0062] Figure 5 FIG. 5 is a schematic diagram of a hardware architecture of a video encoder according to an embodiment of the present application;
[0063] Figure 6 FIG. 6 is a schematic diagram of an application scenario of an inter-frame prediction device according to an embodiment of the present application;
[0064] Figure 7 FIG. 7 is a schematic diagram of an inter-frame prediction device according to an embodiment of the present application;
[0065] Figure 8 FIG. 8 is a schematic diagram of a search window in the prior art;
[0066] Figure 9 FIG. 9 is a schematic diagram of an internal cache module according to an embodiment of the present application. DETAILED DESCRIPTION
[0067] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.
[0068] It should be noted that the terms "first", "second", and the like in the description and claims of the present disclosure and the foregoing drawings are used to distinguish between similar objects, and are not necessarily used to describe a particular sequential or chronological order. It should be understood that the data thus used can be interchanged, where appropriate, so that the embodiments of the present disclosure described herein can be carried out in other than the order shown or described herein.
[0069] The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present disclosure. Instead, they are merely examples of apparatuses and methods consistent with some aspects of the present disclosure as detailed in the appended claims. Based on the implementations in the present application, all other implementations obtained by those of ordinary skill in the art without creative effort are within the scope of the present application.
[0070] In the description of the embodiments of the present application, unless otherwise specified, " / " represents the meaning of or, for example, A / B can represent A or B; "and / or" in the text only describes the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B, which means that there are three cases of A alone, A and B together, and B alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two, and other quantifiers similar thereto should be understood. The preferred embodiments described herein are only used to illustrate and explain the present application, and do not limit the present application, and the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0071] In the following, some terms in the embodiments of the present application are explained and described, so as to facilitate the understanding of those skilled in the art.
[0072] (1) In the embodiments of the present application, the term "video encoding" means converting a file in the original video format into another video format file through compression technology.
[0073] (2) In the embodiments of the present application, the term "macro block (Macro Block, MB)" is the basic unit of H.264 encoding. A coded image frame is first divided into multiple blocks (4x4 pixels) to be processed. A macro block is composed of an integer number of blocks, and the size of a macro block is usually 16x16 pixels.
[0074] (3) In the embodiments of the present application, the term "motion vector (Motion Vector, MV)" refers to the relative displacement between the current macro block to be encoded and the matching macro block in the reference image frame in inter-frame encoding. The prediction motion vector (Motion Vector Prediction, MVP) is the prediction value of the above-mentioned MV.
[0075] (4) The term "cache" in the embodiment of the present application has a structure similar to that of memory and also contains addresses and contents, but the contents of the cache contain not only stored data but also address information of the physical memory of the stored data, so that corresponding data can be found in the cache according to the address information. One address information and the data corresponding thereto constitute a row of cache lines.
[0076] (5) The term "Enhance Predictive Zonal Search (EPZS)" algorithm in the embodiment of the present application is a search algorithm for integer-pixel motion estimation, which uses a prediction method with higher correlation and more motion vector prediction according to existing conditions.
[0077] (6) The term "Double Data Rate Synchronous Dynamic Random Access Memory (DDR SDRAM)" in the embodiment of the present application is a DDR memory developed on the basis of SDRAM memory, which still uses the SDRAM production system but has doubled speed.
[0078] (7) The term "luminance color data" in the embodiment of the present application is YUV data, which is divided into three components, wherein "Y" represents luminance (Luminance or Luma), that is, a gray value; and "U" and "V" represent chrominance (Chrominance or Chroma), which is used to describe image color and saturation and to specify the color of a pixel.
[0079] (8) The term "ping-pong random access memory (RAM)" in the embodiment of the present application mainly consists of two RAMs and two two-way data selectors. When an input data stream passes through the two-way data selectors, it is allocated to two RAM data buffers; in the first data buffering period, the input data stream is buffered to RAM A; in the second data buffering period, the input data stream is buffered to RAM B, and the data buffered in RAM A in the previous period is transmitted to an output data selector; in the third data buffering period, the input data stream is buffered to RAM A, and the data buffered in RAM B in the previous period is transmitted to the output data selector; and the cycle is repeated until the transmission of the data stream is completed.
[0080] H.264 is a new generation of digital video compression format proposed by International Organization for Standardization (ISO) and International Telecommunication Union (ITU).
[0081] As shown in Fig. 1, it is a schematic diagram of an H.264 encoder. Figure 1
[0082] As shown in Fig. 1, it is a schematic diagram of an H.264 encoder. Figure 1 It can be obtained that the encoding process of the H.264 encoder mainly includes inter-frame and intra-frame prediction, transformation and inverse transformation, quantization and inverse quantization, loop filtering, entropy encoding and code rate control.
[0083] The input Fn is the current video frame, Fn-1' is the reference frame, and motion prediction and intra-frame prediction selection are performed according to the above input data, and then mode selection is performed according to the results of intra-frame prediction and inter-frame prediction; after transformation, quantization, reordering and entropy encoding of Fn according to the selected intra-frame prediction / inter-frame prediction mode, the compressed code stream is output.
[0084] The code rate control inputs related data to the motion prediction and intra-frame prediction selection to assist in determining the results of intra-frame prediction and inter-frame prediction.
[0085] The compressed code stream is obtained after inverse quantization, inverse transformation and loop filtering of the reconstructed video frame data of Fn'.
[0086] The main goal of the above H.264 standard is to provide better image quality at the same bandwidth compared with other existing video standards. The compression efficiency of the H.264 standard under the same image quality is about 2 times higher than that of the previous standards, such as Moving Pictures Experts Group (MPEG) 2 standard.
[0087] In video communication, the compressed code stream needs to be transmitted on the network, and must adapt to the low-bandwidth network transmission requirement, so that the inter-frame prediction plays an important role in the above H.264 encoding. The above inter-frame prediction utilizes the correlation between video image frames to realize image compression, reduces the information to be transmitted in the encoding process of each macro block through the correlation in time, thereby reducing the information to be entropy encoded, improving the compression rate of the final encoding, and saving the bandwidth in the communication system. Moreover, the video image frames have strong correlation, and the inter-frame encoding can obtain much higher compression ratio than the intra-frame encoding, and can better adapt to the low-bandwidth network transmission requirement.
[0088] In addition to the above-mentioned scheme of using a sliding search window, there is a scheme of re-reading data in a correlation search window in the prior art, and the above-mentioned scheme causes the same data to be read multiple times, increases the bandwidth of the system, and increases the time of the entire inter-frame search, thereby reducing the efficiency of the encoder.
[0089] In view of the problems of the inter-frame prediction scheme in the prior art, such as a large system bandwidth, a long inter-frame search time, and a low video coding efficiency, the present application provides an inter-frame prediction method and device.
[0090] The inter-frame prediction method and device in the embodiment of the present application will be described in detail below with reference to the accompanying drawings.
[0091] Embodiment 1
[0092] The embodiment of the present application provides a flowchart of an inter-frame prediction method, as shown in Figure 2 , which comprises the following steps.
[0093] In step S201, when performing inter-frame prediction on a current macroblock in a video frame to be encoded, a search window corresponding to a reference frame of the video frame is determined for the current macroblock.
[0094] In the inter-frame prediction, a video frame to be encoded and a reference frame of the video frame are determined.
[0095] The reference frame refers to a video frame referenced when performing inter-frame prediction on the video frame to be encoded, and is a video frame having a relatively high correlation with the video frame to be encoded.
[0096] It should be noted that the time sequence of the reference frame can be before or after the time sequence of the video frame to be encoded.
[0097] The manner of determining the reference frame of the video frame to be encoded can be any implementable manner, which is not the focus of the present application and will not be described here.
[0098] The search window is used to locate the current macroblock in the reference frame of the video frame.
[0099] As an optional implementation, before performing inter-frame prediction on a current macroblock in a video frame to be encoded, the method further comprises the following steps.
[0100] Pixel data of the current macroblock in the video frame is read from an external buffer by a first process; wherein the first process and a second process read pixel data in a time division multiplexing manner, and the second process is used to read pixel data from an external buffer for intra-frame prediction.
[0101] It should be noted that the pixel data can be luminance color YUV data.
[0102] The pixel data of the current macroblock is read from the external buffer by the first process, and the pixel data is read from the external buffer by the second process, and the first process and the second process read the pixel data in a time division multiplexing manner, so that the multiplexing of the external buffer is realized, and the hardware cost is saved.
[0103] It should be noted that the external buffer for storing the pixel data of the current macroblock and the external buffer for storing the pixel data of the reference frame can be one external buffer or different external buffers.
[0104] As an optional implementation, the pixel data of the current macroblock is stored in two ping-pong RAMs.
[0105] As an optional implementation, determining the search window corresponding to the reference frame of the video frame of the current macroblock comprises:
[0106] According to the motion vector MV value of the macroblock adjacent to the current macroblock, the MV value of the current macroblock is predicted to obtain a predicted motion vector value MVP.
[0107] The MVP is rounded, and the reference frame is intercepted with the pixel position corresponding to the integer part of the rounded MVP as the center to obtain a search window of a preset size.
[0108] The solving process of the center point of the search window is based on the prediction method of the MVP in the Joint Model (JM) to predict the MVP value of the current macroblock.
[0109] The center point of the search window only needs to use the pixel position corresponding to the integer part of the MVP, so the predicted MVP is rounded.
[0110] It should be noted that the pixel position (0, 0) is within the search window.
[0111] The inter prediction method provided by the embodiment of the application provides a specific implementation of determining a search window, determines the search window with the pixel position corresponding to the rounded MVP as the center by predicting and rounding the MV value, and provides a necessary implementation basis for virtualizing the search window, reducing the system bandwidth burden of the inter prediction method, and improving the efficiency of video coding.
[0112] As an optional implementation, after obtaining the search window of the preset size, the method further comprises:
[0113] The EPZS (Enhanced Predictive Zonal Search) algorithm is used to predict motion vectors of N reference macroblocks whose encoding cost is less than a preset threshold in the search window relative to the current macroblock, wherein N is a positive integer.
[0114] The pixel position corresponding to the predicted motion vector is taken as a pixel position of a prediction point used to determine a reference macroblock to be searched.
[0115] It should be noted that the "encoding cost less than a preset threshold" and "N" are both screening conditions for the "reference macroblock": the encoding cost of the reference macroblock in the search window is predicted, and N reference macroblocks are screened from the reference macroblocks whose encoding cost is less than the preset threshold, for motion vector prediction.
[0116] The preset threshold is a preset encoding cost value, and the encoding cost less than the preset threshold is a quality requirement for the screened reference macroblock; N is a preset quantity value, and the N is a quantity requirement for the screened reference macroblock.
[0117] It should be noted that N and the preset threshold have no correlation, and the specific values of N and the preset threshold can be specifically set according to specific implementation conditions, for example, as an optional implementation, N is set to 7, and the embodiment of the present application does not make any limitation on this. It should be noted that the pixel position of the prediction point includes the pixel position (0, 0).
[0118] The inter-frame prediction method provided by the embodiment of the present application uses the EPZS algorithm to predict N prediction points that meet the conditions and are used to determine a reference macroblock to be searched, determines the search range of the target reference macroblock, improves the efficiency of inter-frame prediction, and improves the accuracy of inter-frame prediction.
[0119] In step S202, pixel data in the search window is read from an external buffer and stored in an internal cache module.
[0120] The external buffer can be any form of memory with data storage capability independent of the inter-frame prediction device of the embodiment of the present application.
[0121] For example, the external buffer can be a DDR SDRAM.
[0122] As an optional implementation, the internal cache module is a cache module of a cache structure.
[0123] As an optional implementation, reading the pixel data in the search window from the external buffer and storing it in the internal cache module includes:
[0124] The pixel data is read from the external buffer in sequence according to the size of the storage unit tile, and each two adjacent storage unit tiles of the pixel data read in sequence are respectively stored into the first internal buffer module and the second internal buffer module.
[0125] It should be noted that the size of the tile can be set according to a specific implementation scenario, for example, the size of the tile is set to 16x8, and the present application does not make any limitation thereto.
[0126] Through the above storage mode, the pixel data of adjacent storage unit tiles is stored separately.
[0127] The inter prediction method provided by the embodiment of the present application provides an implementation manner of storing the pixel data of the external buffer into the internal buffer module, compared with the external buffer which has large access delay and high bandwidth requirement, the embodiment of the present application stores the search window in the form of tile, virtualizes the search window, can improve the efficiency of inter prediction, and reduces the system bandwidth burden of inter prediction. It should be noted that the internal buffer module includes the first internal buffer module and the second internal buffer module.
[0128] As an optional implementation manner, the pixel data of the reference macro block is read from the internal buffer module, including:
[0129] The pixel data of adjacent storage unit tiles is read from the first internal buffer module and the second internal buffer module according to the order of the storage unit tile.
[0130] It should be noted that the pixel data of adjacent storage unit tiles can be read simultaneously or separately from the first internal buffer module and the second internal buffer module, and the embodiment of the present application does not make any limitation thereto.
[0131] When calculating the cost of inter prediction, it is necessary to calculate in the unit of macro block, and the size of each macro block is 16x16. Through the above manner of reading pixel data, 16 pixel points can be read at a time for calculation, and the process of integer search is accelerated.
[0132] The inter prediction method provided by the embodiment of the present application provides an implementation manner of reading the pixel data from the internal buffer module, which is combined with the above implementation manner of storing the pixel data of the external buffer into the internal buffer module, and provides a complete implementation manner of accessing pixel data. The pixel data in the virtual search window is read in the unit of tile, which can improve the efficiency of inter prediction and reduce the system bandwidth burden of inter prediction.
[0133] As an optional implementation, before reading the pixel data of the reference macroblock from the internal cache module at least once for the search according to the storage address of the pixel data of the reference macroblock of the current macroblock in the internal cache module, the method further comprises:
[0134] According to the MV value of the prediction point, the storage address of the pixel data of the reference macroblock of the current macroblock in the internal cache module is determined.
[0135] The inter-frame prediction method provided by the embodiment of the application provides an implementation of determining the storage address of the pixel data of the reference macroblock of the current macroblock in the internal cache module, which provides a necessary implementation basis for reading the pixel data of the reference macroblock, and improves the implementability of the inter-frame prediction method of the embodiment of the application.
[0136] The internal cache module is used to store the search window, the concept of the search window is virtualized, and the EPZS algorithm in the JM model is used, so that the MVP predicted each time is offset relative to the MVP corresponding to the previous macroblock. The internal cache module stores the pixel data of the previous search window, and most of the data in the current search window is the same as that in the previous search window. Only the offset part, i.e., the non-existing pixel data, needs to be read, which can greatly reduce the bandwidth of the system and improve the efficiency of the encoder.
[0137] In step S203, the pixel data of the reference macroblock is read from the internal cache module at least once for the search according to the storage address of the pixel data of the reference macroblock of the current macroblock in the internal cache module, until the target reference macroblock whose encoding cost meets the first preset requirement is searched.
[0138] The first preset requirement can be that the encoding cost of the reference macroblock corresponding to the integer motion vector is less than the first set threshold or the second set threshold, and the encoding cost of the reference macroblock corresponding to the fractional motion vector is the minimum.
[0139] It should be noted that the specific values of the first set threshold and the second set threshold have no certain relationship, and the values of the two can be set respectively according to the specific implementation, and the embodiment of the application does not make any limitation on this.
[0140] Based on the first preset requirement, the embodiment of the application uses the following implementation to read the pixel data of the reference macroblock from the internal cache module at least once for the search:
[0141] The search reference macroblock corresponding to the integer motion vector is searched, and the first target reference macroblock whose integer encoding cost meets the second preset requirement is determined.
[0142] According to the first target reference macroblock, a to-be-searched reference macroblock corresponding to a fractional motion vector is searched, and a second target reference macroblock with a fractional encoding cost meeting a third preset requirement is determined.
[0143] The second target reference macroblock is determined as the target reference macroblock with the encoding cost meeting a first preset requirement.
[0144] The second preset requirement can be that a first integer encoding cost of the first to-be-searched reference macroblock is less than the first preset threshold, or a second integer encoding cost of the second to-be-searched reference macroblock is less than the second preset threshold; and the third preset requirement can be that the encoding cost is minimum.
[0145] The inter-frame prediction method provided by the embodiment of the application first screens a first target reference macroblock by searching an integer encoding cost, roughly positions the target reference macroblock, and then finally determines the target reference macroblock by searching a fractional encoding cost, thereby reducing the workload of searching, improving the search efficiency, ensuring the accuracy of inter-frame prediction, and improving the implementability of the inter-frame prediction method.
[0146] The EPZS algorithm in the JM model is adopted in the inter-frame prediction main part.
[0147] The integer search ME (Motion Estimate) process is mainly divided into three stages.
[0148] (1) integer encoding cost calculation of a reference macroblock corresponding to the MVP is performed;
[0149] After the integer encoding cost is obtained, a threshold value is determined, if the integer encoding cost is less than the threshold value, the process is exited, otherwise, the second step is performed.
[0150] As an optional implementation, searching a to-be-searched reference macroblock corresponding to an integer motion vector, and determining a first target reference macroblock with an integer encoding cost meeting a second preset requirement, includes:
[0151] Taking the pixel position corresponding to the integer MVP as the center, a first to-be-searched reference macroblock is determined, and a first integer encoding cost of the first to-be-searched reference macroblock is calculated;
[0152] If the first integer encoding cost is less than a first preset threshold, the first target reference macroblock corresponding to the integer motion vector is searched;
[0153] Otherwise, the to-be-searched reference macroblock is determined again, and the next search is performed.
[0154] It should be noted that the size of the to-be-searched reference macro block is a preset fixed value, and thus determining the center as the pixel position corresponding to the MVP after the rounding can uniquely determine the first to-be-searched reference macro block. The principle of determining the reference macro block after the center is determined is the same as the above principle, and thus will not be described herein again.
[0155] The first integer encoding cost is a sum of absolute difference (SAD) value.
[0156] It should be noted that all the integer encoding costs in the embodiments of the present application are SAD values, and any calculation method of the SAD value can be applied to the embodiments of the present application, and the present application does not make any limitation thereon, and thus will not be described herein again.
[0157] The calculated SAD value is compared with a first set threshold T0, if the SAD value is greater than T0, the second step is continued, otherwise, the optimal integer motion vector value is obtained by early exiting.
[0158] The inter prediction method provided by the embodiments of the present application provides an implementation of determining the first target reference macro block by integer search, the first to-be-searched reference macro block is located by the MVP after the rounding, and whether the first to-be-searched reference macro block meets the requirements of the first target reference macro block is determined by calculating the encoding cost, if yes, the decimal search is directly entered, which can reduce the workload of the search and improve the search efficiency.
[0159] (2) integer encoding cost calculation of the reference macro block corresponding to the N prediction points is performed;
[0160] After the integer encoding cost is calculated, a threshold judgment is performed, if the integer encoding cost is less than the threshold, the optimal integer motion vector value is obtained by early exiting, otherwise, the third step is performed.
[0161] As an optional implementation, the to-be-searched reference macro block is re-determined and the next search is performed, including:
[0162] When the N prediction points exist, the second to-be-searched reference macro block corresponding to each prediction point is determined by taking each prediction point as the center, and the second integer encoding cost of the second to-be-searched reference macro block is calculated.
[0163] If the second to-be-searched reference macro block with the second integer encoding cost less than the second set threshold exists, the first target reference macro block search corresponding to the integer motion vector is ended.
[0164] It should be noted that the N prediction points are pixel positions corresponding to the N motion vectors predicted by the EPZS algorithm.
[0165] After calculating the SAD value of the second reference macroblock to be searched corresponding to each of the above prediction points, determine the second reference macroblock to be searched corresponding to the prediction point with the smallest SAD value, compare the smallest SAD value with the second set threshold T1, if the SAD value is greater than T1, continue to the third step, otherwise exit the integer search process in advance.
[0166] It should be noted that the first set threshold T0 and the second set threshold T1 can be the same threshold or different thresholds. The specific values of the first set threshold T0 and the second set threshold T1, and the relationship between them, can be set according to the specific implementation. For example, the second set threshold T1 can be set to be less than the first set threshold T0. This embodiment of the invention does not limit this.
[0167] The inter-frame prediction method provided in this invention offers an implementation for re-determining the reference macroblock to be searched and performing the next search. When the first reference macroblock to be searched does not meet the requirements of the first target reference macroblock, a second reference macroblock to be searched is determined using N predetermined prediction points. The first target reference macroblock that meets the requirements is then searched within the determined second reference macroblock to be searched. This provides a supplementary scheme for determining the first target reference macroblock, which can reduce the workload of the search and improve the search efficiency.
[0168] (3) Make corrections (refinements);
[0169] It should be noted that the output of ME is the coordinates of the integer pixel with the minimum integer encoding cost and the integer encoding cost.
[0170] After the integer pixel search is completed, the integer pixel with the minimum integer encoding cost is obtained, and the storage address of the reference macroblock centered on that point is provided to the fractional search module to perform a fractional search and obtain the optimal motion estimate.
[0171] As an optional implementation, when redetermining the reference macroblock to be searched and performing the next search, the above method further includes:
[0172] If there are no N prediction points when performing the next search, or if there is no second search reference macroblock whose second integer encoding cost is less than the second set threshold, then execute:
[0173] Starting with the macroblock with the lowest encoding cost among the previously determined macroblocks to be searched, the next search is performed by sliding a preset search template to determine the macroblock to be searched corresponding to the integer motion vector within the search template.
[0174] The preset search template of the refinement can be any search template, for example, full search algorithm, three-step search algorithm, four-step search algorithm, large diamond search algorithm, small diamond search algorithm, etc. The template can be selected according to the specific implementation, and the search efficiency and search effect are comprehensively considered.
[0175] The inter-frame prediction method provided by the embodiment of the application provides an implementation mode of re-determining a to-be-searched reference macro block by using a preset search template and performing next search. When the first target reference macro block cannot be determined in the above two implementation modes, the search is performed in a sliding manner by using the preset search template, the continuation of the integer search is ensured, and the implementability of the inter-frame prediction method is improved.
[0176] As an optional implementation mode, the preset search template is a small diamond template.
[0177] The small diamond template is that four candidate pixel points are initially selected, and then three candidate pixel points are selected. Each time, the integer pixel point with the minimum encoding cost is selected from the multiple candidate pixel points in the last time.
[0178] As shown in FIG. 3, the embodiment of the application provides a schematic diagram of small diamond search. Figure 3
[0179] The circular shape with a diagonal pattern represents the center pixel point of the to-be-searched reference macro block with the minimum encoding cost in the to-be-searched reference macro block determined by the previous search. The circular shape with a grid pattern is the first batch of candidate pixel points. The pixel positions of the first batch of candidate pixel points are respectively (-1, 0), (0, -1), (1, 0) and (0, 1) from the center pixel point, and the unit is an integer pixel.
[0180] The subsequent search only moves the center point of the small diamond template. For example, in the above Figure 3 , it is assumed that the candidate pixel point above the center pixel point corresponds to the to-be-searched reference macro block with the minimum encoding cost. The center point of the small diamond template is moved to the candidate pixel point. Then, the pixel points above, below and left of the candidate pixel point are determined as the second batch of candidate pixel points, that is, the circular shape without a pattern in the above figure.
[0181] When the pixel point with the minimum encoding cost corresponding to the to-be-searched reference macro block is in the center of the small diamond template, the integer pixel search process is completed.
[0182] For example, in the above Figure 3 In the embodiment, the encoding cost of the second batch of candidate pixel point corresponding to the reference macro block to be searched is greater than the encoding cost of the candidate pixel point corresponding to the center of the small rhombus template, and the integer pixel search process is completed.
[0183] When the optimal point of a round of search is on the boundary of the search window, and the point is not the center of the rhombus, the search can be performed along the boundary direction, and the SAD value of the point outside the boundary is assigned as infinity.
[0184] It should be noted that the total number of SAD calculations of the integer search should be less than 23, otherwise the integer search is forced to exit, and the optimal point before the exit is taken as the optimal point of the integer search.
[0185] As Figure 4 described, the embodiment of the present application provides a flowchart of the integer search, which comprises:
[0186] In step S401, a first reference macro block to be searched is determined with the pixel position corresponding to the integer MVP as the center, and a first integer encoding cost of the first reference macro block to be searched is calculated.
[0187] In step S402, it is judged whether the first integer encoding cost is less than a first set threshold, if yes, step S407 is executed; otherwise, step S403 is executed.
[0188] In step S403, it is judged whether there are N prediction points, if yes, step S404 is executed; otherwise, step S406 is executed.
[0189] In step S404, a second reference macro block to be searched is determined with each prediction point as the center, and a second integer encoding cost of the second reference macro block to be searched is calculated.
[0190] In step S405, it is judged whether the second integer encoding cost is less than a second set threshold, if yes, step S407 is executed; otherwise, step S406 is executed.
[0191] In step S406, the reference macro block to be searched with the minimum encoding cost is taken as the starting point, and the next search is performed on the reference macro block to be searched corresponding to the integer motion vector in the search template by using the preset search template sliding manner.
[0192] In step S407, the search of the target reference macro block corresponding to the integer motion vector is ended.
[0193] As an optional implementation, the reference macro block to be searched corresponding to the fractional motion vector is searched according to the first target reference macro block, and the second target reference macro block with the fractional encoding cost meeting the preset requirement is determined, which comprises:
[0194] determine at least one pixel position with a set distance from the center pixel position corresponding to the first target reference macroblock, wherein the set distance is less than the distance between adjacent pixels;
[0195] determine a third to-be-searched reference macroblock based on the determined pixel position, and calculate a third fractional encoding cost of the third to-be-searched reference macroblock;
[0196] determine the to-be-searched reference macroblock corresponding to the minimum encoding cost in the third fractional encoding cost as a second target reference macroblock.
[0197] The inter-frame prediction method provided by the embodiment of the present application provides an implementation of fractional search, and further fractional search is performed based on the first target reference macroblock determined by integer search, so that the accuracy of inter-frame prediction is ensured.
[0198] As an optional implementation, the fractional search starts from the center pixel position corresponding to the to-be-searched reference macroblock with the minimum integer encoding cost, and 1 / 2 pixel search and 1 / 4 pixel search are performed to determine the target reference macroblock. That is, the set distance is set to 1 / 2 pixel and 1 / 4 pixel.
[0199] The 1 / 2 pixel search followed by the 1 / 4 pixel search can reduce the workload of search and improve the search efficiency under the premise of ensuring the accuracy of search. It should be noted that the third fractional encoding cost is the absolute transform difference and SATD value.
[0200] After the fractional search is completed, the MV value and the encoding cost value of the target reference macroblock are transmitted to a mode selection module of a next stage, and the encoding cost value and the encoding cost value of the intra-frame prediction are compared by the mode selection module to obtain the prediction mode with the minimum encoding cost value.
[0201] Embodiment 2
[0202] As shown in Figure 5 The embodiment of the present application provides a schematic diagram of a hardware architecture of video encoding, which comprises a pre-processing module, a mode prediction module, and an entropy encoding / deblocking filtering module.
[0203] The video encoding provided by the embodiment of the present application is mainly completed in three stages of flow. The pre-processing module of the first stage is used for pre-processing of an image. The mode prediction module of the second stage is used for motion estimation and mode selection. The entropy encoding / deblocking filtering module of the third stage is used for adaptive context encoding and deblocking filtering.
[0204] The mode prediction module is the first pipeline stage after encoding mode, and motion estimation is divided into intra-frame prediction and inter-frame prediction, intra-frame prediction is spatial prediction, inter-frame prediction is time prediction, and finally the mode selection is used to select the intra-frame prediction / inter-frame prediction mode with the minimum encoding cost for the next stage of entropy encoding.
[0205] As shown in Figure 6 , the embodiment of the present application provides a schematic diagram of an application scenario of an inter-frame prediction device, which comprises:
[0206] The inter-frame prediction device 601 is connected with an external buffer, an intra-frame prediction device, and a mode selection device, and is used to store pixel data of a current macro block in a search window corresponding to a reference frame of a video frame to be encoded, and perform the steps of the inter-frame prediction method in any of the above embodiments.
[0207] The external buffer 602 is connected with the inter-frame prediction device and the intra-frame prediction device, and is used to store the video frame to be encoded and the reference frame of the video frame.
[0208] The intra-frame prediction device 603 is used to perform intra-frame prediction and determine a target reference macro block of the intra-frame prediction.
[0209] The mode selection device 604 is connected with the inter-frame prediction device and the intra-frame prediction device, and is used to select a prediction mode used by video encoding according to the target reference macro blocks determined by the inter-frame prediction device and the intra-frame prediction device.
[0210] The external buffer 602 comprises:
[0211] The video frame buffer 602-1 is used to store the video frame to be encoded.
[0212] The reference frame buffer 602-2 is used to store the reference frame of the video frame.
[0213] The video frame buffer 602-1 comprises a first video frame buffer 602-1a and a second video frame buffer 602-1b.
[0214] The pre-processing module in the above Figure 5 is located at a previous stage of the mode selection module, and as an optional embodiment, the pre-processing module interacts with the mode selection module through two ping-pong RAMs storing original YUV data.
[0215] The intra-frame prediction device and the inter-frame prediction device need to use the original luminance color YUV data stored in the video frame buffer, and data is read from the video frame buffer in a time division multiplexing manner using the intra-frame prediction device and the inter-frame prediction device, so that the area can be saved.
[0216] As shown in Figure 7 FIG. 1 is a schematic diagram of an inter-frame prediction device 601 according to an embodiment of the present application, which comprises an internal buffer module 601-1 and a circuit control module 601-2, wherein:
[0217] The internal buffer module is configured to store pixel data of a current macro block in a video frame in a search window corresponding to a reference frame of the video frame when the current macro block is inter-frame predicted.
[0218] The circuit control module is configured to perform the steps of the inter-frame prediction method according to any one of Embodiment 1.
[0219] It should be noted that the circuit control module is applied to an integrated circuit (IC) chip and is implemented by a hardware architecture, and the inter-frame prediction method according to any one of Embodiment 1 is implemented by a logic combination of microelectronic components.
[0220] As an optional implementation, the circuit control module 601-2 comprises:
[0221] The control module 601-2a is configured to determine a search window of a current macro block in a video frame when the current macro block is inter-frame predicted.
[0222] The data reading module 601-2b is configured to read pixel data in the search window from an external buffer and store the pixel data in the internal buffer module.
[0223] When reading the reference frame data each time, it is first determined whether the required data exists in the cache, and if the data exists, no command needs to be sent to the system, and only a small amount of command needs to be sent for each macro block to obtain the entire search window, thereby saving the bandwidth of the entire system and improving the efficiency of the entire search process.
[0224] The search module 601-2c is configured to read pixel data of a reference macro block from the internal buffer module at least once according to a storage address of the pixel data of the reference macro block in the internal buffer module, to search for a target reference macro block whose encoding cost meets a first preset requirement.
[0225] It should be noted that the control module, the data reading module, and the search module are all implemented by a hardware architecture, and the functions are implemented by a logic combination of microelectronic components.
[0226] The search module includes an integer search module 601-2c-1 and a fractional search module 601-2c-2.
[0227] The integer search module 601-2c-1 is configured to search for a to-be-searched reference macro block corresponding to an integer motion vector, and determine a first target reference macro block with an integer coding cost meeting a second preset requirement.
[0228] The fractional search module 601-2c-2 is configured to search, according to the first target reference macro block, a to-be-searched reference macro block corresponding to a fractional motion vector, determine a second target reference macro block with a fractional coding cost meeting a third preset requirement, and determine the second target reference macro block as a target reference macro block with a coding cost meeting a first preset requirement.
[0229] It should be noted that, after the integer search module determines an integer motion vector with a minimum integer coding cost, the integer motion vector, a storage position of the integer motion vector in the internal cache module, and a predicted MVP are passed to the fractional search module.
[0230] When performing fractional search, the fractional search module only needs to read corresponding pixel data from the internal cache module according to the information to calculate the SATD, and does not need to re-judge the position of the pixel data, thereby saving the calculation time of the entire encoding pipeline.
[0231] As an optional implementation, the internal cache module 601-1 includes a first internal cache module 601-1a and a second internal cache module 601-1b.
[0232] As shown in FIG. 1, a search window in the prior art is shown. Figure 8
[0233] Wherein, (S_win_ox, S_win_oy) is the coordinate of the center point of the search window in the above-mentioned, and Rb_0 to Rb_7 are the coordinates of the pixel data in the search window. Figure 8
[0234] The image in the search window is reconstructed and filtered after previous encoding, and the data of the search window is stored in the DDR.
[0235] The internal cache module with a 2-way cache structure is used in the embodiment of the present application to replace the conventional search window, which not only accelerates the reading time of the search window, but also reduces the amount of data read. When the MVP offset is not large, a small amount of data is read from the external cache to obtain the entire search window, thereby saving the bandwidth loss and accelerating the reading speed of the reference frame.
[0236] As Figure 9 shown in the figure, the embodiment of the present application provides a schematic diagram of an internal cache module.
[0237] The above-mentioned Figure 9 2-way cache structure, the size of each cache line is 16x8, and there are two odd lines (cache odd lines) and two even lines (cache even lines), with a size of 64x64.
[0238] When storing the pixel data of the search window, the pixel data is stored in the storage unit tile of 64x64 size blocks.
[0239] It should be noted that the size of the above-mentioned internal cache module is determined according to the size of the above-mentioned search window.
[0240] For example, the preset size of the search window is 86x54, and the use of the above-mentioned 2-way 64x64 size cache can cache all the data of the search window.
[0241] The size of the above-mentioned internal cache module can be specifically set according to the specific implementation, and the present application does not make any limitation.
[0242] Since inter-frame prediction calculates the encoding cost in units of macroblocks, the size of each macroblock is 16x16, and the size of the set cache line is 16x8. In order to speed up the process of integer search, the above-mentioned cache is divided into odd lines and even lines and stored in two cache RAMs respectively, ensuring that 16 pixel points can be read out at a time for calculation, which can save time and achieve higher efficiency.
[0243] Optionally, the circuit control module determines a search window corresponding to the current macroblock in a reference frame of the video frame, comprising:
[0244] According to the motion vector MV value of the macroblock adjacent to the current macroblock, the MV value of the current macroblock is predicted to obtain a predicted motion vector value MVP;
[0245] The MVP is rounded, and the reference frame is intercepted with the pixel position corresponding to the rounded MVP as the center to obtain a search window of a preset size.
[0246] Optionally, after obtaining the search window of the preset size, the circuit control module is further used for:
[0247] Using an enhanced prediction zone search EPZS algorithm, the motion vector of N reference macroblocks in the search window with an encoding cost less than a preset threshold relative to the current macroblock is predicted, wherein N is a positive integer.
[0248] The pixel position corresponding to the predicted motion vector is taken as a pixel position of a prediction point used to determine the reference macroblock to be searched.
[0249] Optionally, before reading the pixel data of the reference macroblock from the internal cache module for at least one search, the circuit control module is further configured to:
[0250] According to the MV value of the prediction point, the storage address of the pixel data of the reference macroblock of the current macroblock in the internal cache module is determined.
[0251] Optionally, the circuit control module reads the pixel data in the search window from the external cache and stores the pixel data to the internal cache module, including:
[0252] The pixel data is read from the external cache in sequence according to a storage unit tile size, and each two adjacent storage unit tiles of the pixel data read in sequence are respectively stored to the first internal cache module and the second internal cache module;
[0253] The circuit control module reads the pixel data of the reference macroblock from the internal cache module, including:
[0254] According to the order of the storage unit tile, the pixel data of the adjacent storage unit tile is read from the first internal cache module and the second internal cache module.
[0255] Optionally, before performing inter-frame prediction on the current macroblock in the video frame to be encoded, the circuit control module is further configured to:
[0256] The pixel data of the current macroblock in the video frame is read from the external cache by a first process; wherein the first process and a second process read the pixel data in a time division multiplexing manner, and the second process is used to read the pixel data from the external cache for intra-frame prediction.
[0257] Optionally, the pixel data is luminance color YUV data.
[0258] Optionally, the circuit control module reads the pixel data of the reference macroblock from the internal cache module for at least one search, including:
[0259] The reference macroblock corresponding to the integer motion vector to be searched is searched, and a first target reference macroblock with an integer encoding cost meeting a second preset requirement is determined.
[0260] According to the first target reference macroblock, the reference macroblock corresponding to the fractional motion vector to be searched is searched, and a second target reference macroblock with a fractional encoding cost meeting a third preset requirement is determined.
[0261] determining the second target reference macroblock as a target reference macroblock searched with a coding cost meeting a first preset requirement.
[0262] Optionally, the circuit control module searches for the reference macroblock corresponding to the integer motion vector, determines a first target reference macroblock with an integer coding cost meeting a second preset requirement, and includes the following steps.
[0263] determining a first reference macroblock to be searched corresponding to the pixel position of the rounded MVP as a center, and calculating a first integer coding cost of the first reference macroblock to be searched;
[0264] If the first integer coding cost is less than a first set threshold, ending the search for the first target reference macroblock corresponding to the integer motion vector.
[0265] Otherwise, re-determining the reference macroblock to be searched and performing the next search.
[0266] Optionally, the circuit control module re-determines the reference macroblock to be searched and performs the next search, and includes the following steps.
[0267] determining a second reference macroblock to be searched corresponding to each prediction point as a center when there are N prediction points, and calculating a second integer coding cost of the second reference macroblock to be searched;
[0268] If there is a second reference macroblock to be searched with a second integer coding cost less than a second set threshold, ending the search for the first target reference macroblock corresponding to the integer motion vector.
[0269] Optionally, when re-determining the reference macroblock to be searched and performing the next search, the circuit control module is further configured to:
[0270] If there are no N prediction points when performing the next search, or there is no second reference macroblock to be searched with a second integer coding cost less than a second set threshold, performing the following steps.
[0271] starting from the reference macroblock to be searched with the smallest coding cost determined in the previous search, performing the next search on the reference macroblock to be searched corresponding to the integer motion vector in a search template in a preset search template sliding manner.
[0272] Optionally, the circuit control module searches for the reference macroblock corresponding to the fractional motion vector according to the first target reference macroblock, determines a second target reference macroblock with a fractional coding cost meeting a preset requirement, and includes the following steps.
[0273] determine at least one pixel position with a set distance from the center pixel position corresponding to the first target reference macroblock; wherein the set distance is less than the distance between adjacent pixels;
[0274] determine a third to-be-searched reference macroblock corresponding to the determined pixel position, and calculate a third decimal encoding cost of the third to-be-searched reference macroblock;
[0275] determine the to-be-searched reference macroblock corresponding to the minimum encoding cost in the third decimal encoding cost as a second target reference macroblock.
[0276] In several embodiments provided in the present application, it should be understood that the disclosed system, device, apparatus and method can be implemented by other manners. For example, the above-described device embodiments are merely illustrative, for example, the division of the modules is merely a logical function division, and actual implementation can have another division manner, for example, a plurality of modules or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection can be indirect coupling or communication connection through some interfaces, devices or modules, and can be electrical, mechanical or other forms.
[0277] The modules described as separate components can or can not be physically separated, and the components shown as modules can or can not be physical modules, that is, can be located in one place, or can be distributed on a plurality of network modules. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0278] In addition, the functional modules in each embodiment of the present application can be integrated in one processing module, or each module can be physically present alone, or two or more modules can be integrated in one module. The above integrated module can be realized in the form of hardware or in the form of software functional module. When the integrated module is realized in the form of software functional module and sold or used as an independent product, it can be stored in a computer readable storage medium.
[0279] In the above embodiments, all or part can be realized by software, hardware, firmware or any combination thereof. When realized by software, it can be realized in the form of computer program product in whole or in part.
[0280] The technical solutions provided by the present application are described in detail above, the principles and implementation manners of the present application are described by using specific examples, the above examples are only used to help understand the method and core idea of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, the specific implementation manners and application ranges can be changed, and the above description should not be understood as a limitation of the present application.
[0281] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can adopt a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can adopt a computer program product in the form of being implemented on one or more computer usable storage media containing computer usable program codes (including but not limited to disk storage, CD-ROM, optical storage, etc.).
[0282] The present application is described with reference to flowcharts and / or block diagrams of the method, device (system), and computer program product according to the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device implemented in the flowcharts and / or block diagrams. Figure 1 The function specified in one or more flows and / or blocks Figure 1 The function specified in one or more flows and / or blocks
[0283] These computer program instructions can also be stored in a computer readable storage medium capable of guiding a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable storage medium produce a product including instruction devices, which implement the functions specified in the flowcharts and / or block diagrams. Figure 1 The function specified in one or more flows and / or blocks Figure 1 The function specified in one or more flows and / or blocks
[0284] These computer program instructions can also be loaded into a computer or other programmable data processing device, so that a series of operation steps are performed on the computer or other programmable device to produce a computer implemented process, so that the instructions executed on the computer or other programmable device provide a process for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 The function specified in one or more flows and / or blocks Figure 1 The function specified in one or more flows and / or blocks
[0285] Obviously, many modifications and variations of the present application are possible in light of the above teachings. It is, therefore, to be understood that within the scope of the appended claims and their equivalents, the application can be practiced otherwise than as specifically described.
Claims
1. An inter-frame prediction method, characterized in that, include: When performing inter-frame prediction on the current macroblock in the video frame to be encoded, the search window corresponding to the reference frame of the video frame for the current macroblock is determined. According to the size of the storage unit tile, the pixel data in the search window is read from the external cache in sequence, and every two adjacent storage units of the pixel data read in sequence are stored in the first internal cache module and the second internal cache module in the internal cache module respectively. Using the Enhanced Predictive Region Search (EPZS) algorithm, the motion vectors of N reference macroblocks with encoding costs less than a preset threshold within the search window are predicted relative to the current macroblock, where N is a positive integer; The pixel position corresponding to the predicted motion vector is used as the pixel position of the prediction point, and the storage address of the pixel data of the reference macroblock of the current macroblock in the internal cache module is determined based on the motion vector MV value of the prediction point. Based on the storage address of the pixel data of the reference macroblock of the current macroblock in the internal cache module, the pixel data of the reference macroblock is read from the internal cache module and searched at least once until a target reference macroblock whose encoding cost meets the first preset requirement is found. The step of reading the pixel data of the reference macroblock from the internal cache module includes: Based on the order of the storage unit tiles, pixel data of adjacent storage unit tiles are read from the first internal cache module and the second internal cache module.
2. The method according to claim 1, characterized in that, Determining the search window corresponding to the reference frame of the current macroblock in the video frame includes: Based on the motion vector MV values of the macroblocks adjacent to the current macroblock, the MV value of the current macroblock is predicted to obtain the predicted motion vector value MVP. The MVP is rounded down, and the reference frame is truncated with the pixel position corresponding to the rounded MVP as the center to obtain a search window of a preset size.
3. The method according to claim 1, characterized in that, Before performing inter-frame prediction on the current macroblock in the video frame to be encoded, the following steps are also included: The first process reads the pixel data of the current macroblock in the video frame from the external buffer; wherein the first process and the second process read the pixel data in a time-division multiplexing manner, and the second process is used to read the pixel data from the external buffer for intra-frame prediction.
4. The method according to claim 1, characterized in that, The pixel data is luminance and color YUV data.
5. The method according to any one of claims 1 to 2, characterized in that, Read the pixel data of the reference macroblock from the internal cache module and perform at least one search, including: Search for the reference macroblock to be searched corresponding to the integer motion vector, and determine the first target reference macroblock whose integer encoding cost meets the second preset requirement; Based on the first target reference macroblock, search for the reference macroblock to be searched corresponding to the decimal motion vector, and determine the second target reference macroblock whose decimal encoding cost meets the third preset requirement; The second target reference macroblock is determined to be the target reference macroblock whose encoding cost meets the first preset requirement.
6. The method according to claim 5, characterized in that, Search for the reference macroblock to be searched corresponding to the integer motion vector, and determine the first target reference macroblock whose integer encoding cost meets the second preset requirement, including: Using the pixel position corresponding to the rounded MVP as the center, determine the corresponding first reference macroblock to be searched, and calculate the first integer encoding cost of the first reference macroblock to be searched. If the first integer encoding cost is less than the first preset threshold, the search for the first target reference macroblock corresponding to the integer motion vector ends. Otherwise, redetermine the reference macroblock to be searched and proceed with the next search.
7. The method according to claim 6, characterized in that, Re-identify the reference macroblock to be searched and perform the next search, including: When it is determined that there are N prediction points, the corresponding second reference macroblock to be searched is determined with each prediction point as the center, and the second integer encoding cost of the second reference macroblock to be searched is calculated. If there exists a second target reference macroblock whose second integer encoding cost is less than the second set threshold, the search for the first target reference macroblock corresponding to the integer motion vector ends.
8. The method according to claim 7, characterized in that, When redefining the reference macroblock to be searched and performing the next search, it also includes: If there are no N prediction points when performing the next search, or if there is no second search reference macroblock whose second integer encoding cost is less than the second set threshold, then execute: Starting with the macroblock with the lowest encoding cost among the previously determined macroblocks to be searched, the next search is performed by sliding a preset search template to determine the macroblock to be searched corresponding to the integer motion vector within the search template.
9. The method according to claim 5, characterized in that, Based on the first target reference macroblock, search for the target reference macroblock corresponding to the decimal motion vector, and determine the second target reference macroblock whose decimal encoding cost meets the third preset requirement, including: Determine at least one pixel position at a set distance from the center pixel position corresponding to the first target reference macroblock; wherein the set distance is less than the distance between adjacent pixels; The third reference macroblock to be searched is determined with the determined pixel position as the center, and the third fractional encoding cost of the third reference macroblock to be searched is calculated. The search reference macroblock corresponding to the smallest encoding cost among the third fractional encoding costs is determined as the second target reference macroblock.
10. An inter-frame prediction device, characterized in that, It includes an internal cache module and a circuit control module, wherein: The internal cache module is used to store the pixel data of the current macroblock in the search window corresponding to the reference frame of the video frame when performing inter-frame prediction on the current macroblock in the video frame to be encoded. The circuit control module is used to perform the steps of the inter-frame prediction method as described in any one of claims 1 to 9.
Citation Information
Patent Citations
Search window buffer device based on AVS encoder
CN102377999A
AVS2 video coding and decoding standard optimization scheme
CN110365975A