A kind of method of reading reference frame data, system and multimedia processor
Technical field
The invention belongs to multimedia technology field, relate in particular to a kind of method, system and multimedia processor of reading reference frame data.
Background technology
At present, mobile multimedia processor is widely used in various portable type electronic products, and market is also more and more higher to the requirement of its performance.Especially the Video processing ability of mobile multimedia processor is had higher requirement.
In order to improve video decoding capability, except basic video frequency source coding algorithm, the Novel video standard also comprises 4 kinds of negotiable codes selections, in order to improve performance, as unconfined motion vector, the arithmetic coding based on syntax, senior prediction and PB frame.
Under unconfined motion vector pattern, motion vector allows to point to outside image.Boundary pixel can be used for the pixel of prediction " not existing ".If the border that image is crossed in motion adopts this pattern just can obtain significant benefit, especially for less picture format.In addition, this pattern comprises a kind of expansion to motion vector range, in order to can use larger motion vector.This pattern is especially in the situation that camera motion is useful.
The common methods that realizes at present the unrestricted motion vector is before the inter prediction of doing a frame, carries out the Boundary filling operation with reference to the data of frame.Each padding will be done the filling of horizontal and vertical directions simultaneously, is about to 16 pixels of pixel value extension of boundary.Fig. 1 shows the method for existing techniques in realizing unrestricted motion vector.This image filling method need to take a large amount of DMA (Direct Memory Access, direct access access) bandwidth, and in the insufficient situation of bandwidth, padding is slow, not too is fit to hardware operation.
Also have and a kind ofly support that the method for unrestricted motion vector is to adjust according to the out-of-bounds situation of current block the size that reads reference data, then the data that read are done filling.Although this method may be saved the bandwidth of DMA in some cases, reads block size uncertain, complexity is higher, and hardware implementation cost is larger.
Revise discrete cosine transform and realize that the method for rotating is the method that realizes image rotation the most frequently used in existing hardware designs, but the dimensional requirement for the target image that rotates is stricter, picture size must be the integral multiple of a plurality of matrix datas unit, should use accommodation very limited.
In addition in former video standard, because the piece partition mode is limited, so in the past inadequate to the support of block size scope in scheme, majority is only supported 16 * 16 macro blocks and four these two kinds of dividing mode of 8 * 8 sub-blocks, limit the hardware multiplexing of many video standards, also therefore improved hardware cost.
Summary of the invention
Embodiment of the present invention technical problem to be solved is to provide a kind of method, system and multimedia processor of reading reference frame data, realize the rotation of image when predicting between conducting frame, to improve image decoding efficient and to save the hardware cost that image shows.
For solving the problems of the technologies described above, the embodiment of the present invention provides a kind of method of reading reference frame data, and described interframe prediction data reading method comprises the steps:
Read needed parameter, described parameter comprises the image rotation angle;
The reading images reference frame data;
When described image rotation angle is that 0 degree or 180 is when spending, or described image rotation angle is that the data block size of 90 degree or 270 degree and request is during for symmetrical piece, if the data block of request is the directions X out-of-bounds, the data that image is outer are all with the data stuffing in an image on border; If the data block of request is the out-of-bounds of Y-direction, at first determine that according to the out-of-bounds motion vector dy on described Y-direction the data block of described request is top out-of-bounds or bottom out-of-bounds, a few row data are arranged outside described image in the data block of definite described request simultaneously; If the data block of request is top out-of-bounds, with the deposit data of the first row request in buffering area, be used for filling the data line of out-of-bounds; If the data block of request is following out-of-bounds, the data line on boundary bottom is stored in buffering area, the data line of out-of-bounds is filled with data in buffering area;
When described image rotation angle is 90 degree or 270 degree, when if the data block of request size is the data block of asymmetric n * m, the data block size of actual request is (n+1) * (m+1), when data are write the reference data buffering area, write the data block of two (m+1) * (m+1), m<n wherein, m and n are natural number.
Another purpose of the embodiment of the present invention is, a kind of system of reading reference frame data is provided, and the system of described reading reference frame data comprises: external data storage district, direct memory access module, reading out data module and reference data buffering area.Described direct memory access module is used for the reading images reference frame data from the external data storage district, described reading out data module is by DMA reading images reference frame data, and obtain needed parameter from software, described parameter comprises the image rotation angle, that 0 degree or 180 is when spending in described image rotation angle, or described image rotation angle is that the data block size of 90 degree or 270 degree and request is during for symmetrical piece, if the data block of request is the directions X out-of-bounds, the data that image is outer are all with the data stuffing in an image on border; If the data block of request is the out-of-bounds of Y-direction, at first determine that according to the out-of-bounds motion vector dy on described Y-direction the data block of described request is top out-of-bounds or bottom out-of-bounds, a few row data are arranged outside described image in the data block of definite described request simultaneously; If the data block of request is top out-of-bounds, with the deposit data of the first row request in buffering area, be used for filling the data line of out-of-bounds; If the data block of request is following out-of-bounds, the data line on boundary bottom is stored in buffering area, the data line of out-of-bounds is filled with data in buffering area;
90 degree or 270 degree in described image rotation angle, when if the data block of request size is the data block of asymmetric n * m, the data block size of actual request is (n+1) * (m+1), when data are write the reference data buffering area, write the data block of two (m+1) * (m+1), m<n wherein, m and n are natural number.
Another purpose of the embodiment of the present invention is, a kind of multimedia processor that comprises the system of above-mentioned reading reference frame data is provided.
Beneficial effect of the present invention is, a kind of method, system and multimedia processor of reading reference frame data is provided, and described method realizes the rotation of image when predicting between can conducting frame.Can take full advantage of the bandwidth of DMA during reading out data, bandwidth availability ratio can reach more than 90%.Because the present invention can support multiple partition mode, therefore can compatible a lot of different video standards, thus effective economize on hardware R﹠D costs.
Description of drawings
Fig. 1 is the method schematic diagram of existing techniques in realizing unrestricted motion vector;
Fig. 2 is the method flow diagram of the reading reference frame data that provides of the embodiment of the present invention;
Fig. 3 is the data block of the request that provides of embodiment of the present invention data structure schematic diagram when being the directions X out-of-bounds;
Fig. 4 is the data block of the request that provides of embodiment of the present invention data structure schematic diagram when being top out-of-bounds;
Fig. 5 is that the data block of the request that provides of the embodiment of the present invention is the data structure schematic diagram of the data block of actual request in the situation of top out-of-bounds;
Fig. 6 is the data block of the request that provides of embodiment of the present invention data structure schematic diagram when being following out-of-bounds;
Fig. 7 is the data block of the request that provides of embodiment of the present invention data structure schematic diagram when being following complete out-of-bounds;
Fig. 8 is that the data block of the request that provides of the embodiment of the present invention is the data structure schematic diagram of the data block of actual request in the situation of following complete out-of-bounds;
Fig. 9 is that the data block of the request that provides of the embodiment of the present invention is the situation of the complete out-of-bounds in the left side;
Figure 10 is that the data block of the request that provides of the embodiment of the present invention is the data structure schematic diagram of the data block of actual request in the situation of the complete out-of-bounds in the left side;
Figure 11 is the system construction drawing of the reading reference frame data that provides of the embodiment of the present invention.
Embodiment
In order to make purpose of the present invention, technical scheme and advantage clearer, below in conjunction with drawings and Examples, the present invention is further elaborated.Should be appreciated that specific embodiment described herein only in order to explain the present invention, is not intended to limit the present invention.
The embodiment of the present invention is mainly used in multimedia processor.Fig. 2 shows the method flow diagram of the reading reference frame data that the embodiment of the present invention provides, and is described as follows below in conjunction with Fig. 2.
Step S201, the needed parameter of reading DMA operation;
The needed DMA parameter of reading out data module comprises the dividing mode, the out-of-bounds motion vector dx on the data block directions X, out-of-bounds motion vector dy and the image rotation angle on Y-direction of address, the macro block of reference data.
Step S202 is by DMA reading images reference frame data from outside SDRAM;
The reading out data module is after the dividing mode of the address that obtains reading reference data and macro block, namely send the DMA request and read reference data, institute's request msg block size is determined by the macroblock partitions mode, when being the luminance component of macro block, the data block size of request is 9 * 9, when being the chromatic component of macro block, the data block size of request is 5 * 5;
Then described reading reference frame data module can be rotated and the out-of-bounds processing image according to described dx and dy, and inside modules buffering area (buffer) is kept in the data of out-of-bounds.
Step S203 carries out out-of-bounds according to the image rotation angle to the image reference frame data and processes, and result is write in the reference data buffering area;
When the required image rotation angle that reads is 0 degree or 180 when spending, it is as follows that concrete grammar is processed in the required out-of-bounds of carrying out:
If the partial data of the data block of request has following steps beyond image:
When the data block of asking is the directions X out-of-bounds, five data are arranged is beyond image to data in buffer as described in Figure 3, need to fill, the operation that the present invention takes is that data that image is outer are all with the data stuffing in an image on border;
When the data block of asking is the out-of-bounds of Y-direction, at first according to the out-of-bounds motion vector dy on Y-direction, determine that the data block of asking is top out-of-bounds or bottom out-of-bounds, a few row data are arranged outside image in the data block of determining simultaneously to ask;
The data block that Fig. 4 shows request is the situation of top out-of-bounds, and the data block that Fig. 5 shows request is the data structure schematic diagram of the data block of actual request in the situation of top out-of-bounds.From outside reading out data the time, can be used for filling the data line of out-of-bounds with the deposit data of the first row request in buffer, then will write in the reference data buffering area through the image reference frame data of filling;
The data block that Fig. 6 shows request is the situation of following out-of-bounds.If the data block of request is following out-of-bounds, according to the number of data lines of out-of-bounds, the data line on boundary bottom is stored in buffer, when writing the reference buffer district, the data line of out-of-bounds can be replaced with data in buffer.
If the total data of the data block of request is all beyond image, need the DMA parameter is handled accordingly, if the data block of asking is top complete out-of-bounds, the number of data lines of the actual out-of-bounds line number that equals to ask subtracts 1, the processing of remainder and top out-of-bounds is identical, thus the processing of out-of-bounds fully above realizing;
The data block that Fig. 7 shows request is the situation of following complete out-of-bounds, and the data block that Fig. 8 shows request is the data structure schematic diagram of the data block of actual request in the situation of following complete out-of-bounds.If the data block of asking is following complete out-of-bounds, the line number that the number of data lines of actual out-of-bounds equals to ask subtracts 1, and the processing of remainder and following out-of-bounds is identical, so just can process the situation of following out-of-bounds fully.
The data block that Fig. 9 shows request is the situation of the complete out-of-bounds in the left side, and the data block that Figure 10 shows request is the data structure schematic diagram of the data block of actual request in the situation of the complete out-of-bounds in the left side.If the data block of the asking complete out-of-bounds that are the left side, the columns that the out-of-bounds columns of actual directions X equals to ask subtracts 1, the processing of remainder and left side out-of-bounds is identical, so just can process the circumstances of the complete out-of-bounds in the left side, the situation of the complete out-of-bounds in the right side is also done the same processing with the complete out-of-bounds in the left side.
When the required image rotation angle that reads is 90 degree or 270 when spending, it is as follows that concrete grammar is processed in the required out-of-bounds of carrying out:
When if the data block size of request be symmetrical piece (as 8 * 8), the situation of (0 spend or 180 spend) is the same when not rotating to the processing of requested data block;
When if the data block size of request is asymmetric (as 16 * 8), process as follows for the piece out-of-bounds of request:
The data block of request n * m, according to the needs of interpolation algorithm, the data block size of actual request is (n+1) * (m+1), when data are write the reference data buffering area, can write the data block of two (m+1) * (m+1), m<n wherein, m and n are natural number.If institute's requested data block is the situation of top out-of-bounds, after the data that need to wait until the data block of two (m+1) * (m+1) all are written in the reference data buffering area fully, just can give the functional module of back, as the interpolation processing module etc., send two data block useful signals; In the situation that other out-of-bounds, only need to there be (m+1) * (m+1) data block effective, just can send the data useful signal, wait the next one (m+1) * when (m+1) data block is effective, then send a data block useful signal.
To ask 16 * 8 data block as example, according to the needs of interpolation algorithm, the data block size of actual request is 17 * 9, when data are write the reference data buffering area, can write the data block of two 9 * 9.If institute's requested data block is the situation of top out-of-bounds, after the data that need to wait until the data block of two 9 * 9 all are written in the reference data buffering area fully, just can give the functional module of back, as the interpolation processing module etc., send two data blocks of data useful signals; In the situation that other out-of-bounds, only need to there be 9 * 9 data blocks effective, just can send the data useful signal, wait the next one 9 * 9 data blocks when effective, then send a data block useful signal.
Figure 11 shows the reading reference frame data system construction drawing that the embodiment of the present invention provides, and described reading reference frame data system comprises: external data storage district, direct memory access module, reading reference frame data module and reference data buffering area.Described direct memory access module is used for the reading images reference frame data from the external data storage district, described reading out data module is by DMA reading images reference frame data, and obtain needed parameter from software, according to the parameter that obtains, described image reference frame data being carried out out-of-bounds processes, and the image reference frame data piece after processing writes described reference data buffering area, and described reference data buffering area is used for the good image reference frame data of storage reading out data resume module.
The present invention utilizes buffer area (buffer) to store by the data that needs are filled, and do not need repetitive requests not need the partial data of filling, can take full advantage of the bandwidth of DMA during reading out data, bandwidth availability ratio can reach more than 90%, realized the reading of the reference frame data of unrestricted motion vector, and can process the image of the rotation in unrestricted motion vector situation.Because the present invention can support multiple partition mode, therefore can compatible a lot of different video standards, thus effectively save R﹠D costs.
The above is only preferred embodiment of the present invention, not in order to limiting the present invention, all any modifications of doing within the spirit and principles in the present invention, is equal to and replaces and improvement etc., within all should being included in protection scope of the present invention.