Summary of the invention
Technical problem to be solved by this invention is, at the deficiencies in the prior art, the control device of a kind of video decode display buffer is proposed, this device passes through the coordinated management of the buffering area realization of low capacity to decoded picture, reference picture and display image, coordinate decoding, the demonstration of control of video, reduce the cost of decoding chip.
Another technical problem to be solved by this invention is, at the deficiencies in the prior art, a kind of control method of video frequency decoding buffer zone is proposed, realize that by the buffering area of a low capacity storage of decode image data, demonstration reach to the core codec module provides reference picture, need not duplicate a large amount of RAM data.
The present invention realizes by the following technical solutions:
A kind of video frequency decoding buffer zone control device, comprise that buffering area control module, reference picture obtain control module, decoded picture storage control module, display image and obtain control module, display control module, wherein, described buffering area control module is used for calculate obtaining current decoded picture memory address, current reference picture address, display image address, and with above address respectively correspondence send to reference picture and obtain control module, decoded picture storage control module, display image and obtain control module;
Described reference picture obtains the address that control module is sent according to the buffering area control module, obtains reference picture from decoding image buffering area, and sends to the motion compensating module in the decoding nucleus module, decodes;
The address that described decoded picture storage control module is sent according to the buffering area control module will be left in this address from the current decoded data of decoding nucleus module output;
Described display image obtains the address that control module is sent according to the buffering area control module, obtains display image from decoding image buffering area, and sends it to display control module;
The display image that described display control module control receives shows that on display the address with display image writes display status register simultaneously.
Device of the present invention can pass through the coordinated management of the buffering area realization of low capacity to decoded picture, reference picture and display image, coordinate decoding, the demonstration of control of video, do not need to duplicate lot of data, the buffer pool size that can meet the demands is little, has reduced the cost of decoding chip.
The present invention also proposes a kind of control method of video frequency decoding buffer zone, comprises following step:
Step 1, buffering area control module obtain current decoded picture memory address, current reference picture address, display image address according to the view data of current decoding image buffering area and the state of this view data;
Step 2, buffering area control module send to reference picture with described current reference picture address and obtain control module, described reference picture obtains control module and obtains reference image data according to the reference picture address that the buffering area control module sends over from decoding image buffering area, and send it to the motion compensating module of decoding in the nucleus module, decode;
Step 3, buffering area control module judge whether the image of described decoded picture memory address correspondence is shown, if be not shown, whether the image that then continues detection decoded picture memory address correspondence is shown, if show, carries out next step;
Step 4, buffering area control module send to the decoded picture storage control module with the memory address of current decoded picture; The decoded picture storage control module will deposit decoding image buffering area in from the decoded data of decoding nucleus module output according to this memory address;
Step 5, buffering area control module send to display image with the display image address and obtain control module, and simultaneously described display image address are write display image address emulation fifo buffer; Display image obtains control module according to described display image address reading displayed view data and send it to display control module from decoding image buffering area;
Step 6, display control module receive and control described display image data and show on display, and display control module writes display status register with the initial address of this video data simultaneously.
Method of the present invention only just can realize coordinated management to decoded picture, reference picture and display image with a very little buffering area of capacity, coordinates decoding, the demonstration of control of video, can make decoding speed and display speed synchronous,
Embodiment
Below the present invention will be described in detail by accompanying drawing and specific embodiment.
Referring to Fig. 2, be the operation principle schematic diagram of device of the present invention.
As we know from the figure, this device comprises that buffering area control module 1, reference picture obtain control module 2, decoded picture storage control module 3, display image and obtain control module 4, display control module 5, the control of this device is stored in the decoding image buffering area 9 from the decoded data of decoding nucleus module 8 outputs, and takes out display images from decoding image buffering area 9 and deliver to the display 6 and show.
Wherein, the control core that described buffering area control module 1 is whole buffering area, calculate to obtain the address of the reference picture that current decoded picture need use, and send to reference picture and obtain control module 2, so that obtain reference data for the decoding present image;
Calculate the memory address that obtains current decoded picture, and send to the control that decoded picture storage control module 3 is carried out the decoded data storage;
Calculate the decoded picture address that next image need show, and send to display image and obtain control module 4, display image obtains control module 4 and sends display control module 5 to by this address acquisition video data again, these display control module 5 these video datas of control show on display 6, display control module 5 is stored in the address of current display image in the current display status register 7 simultaneously, whether buffering area control module 1 has been shown the decoding that determines whether continuing this image by the data that are stored in the current explicit address judgement memory address as calculated in the current display status register, if be shown, then continue decoding, otherwise wait for, till this address is shown.The concrete determination strategy whether conflict the address is as follows:
Also comprise a display image address emulation FIFO in the buffering area control module 1 of device of the present invention, described display image address emulation FIFO is used for that the memory buffer control module sends to that display image obtains control module but the display image address that also is not shown, buffering area control module 1 is every to explicit address of display control module transmission, just writes this address in this buffering area; And after calculating acquisition memory image address, the buffering area control module will be obtained the current explicit address in the current display status register, remove all explicit addresses that are positioned among the display image address emulation FIFO before this explicit address, because the image before this explicit address is shown;
The decoded picture memory address that search is calculated in the explicit address that is left in display image address emulation FIFO, if there is equal address to occur, the image that this address then is described also is not shown (mainly due to decoding speed greater than display speed), if the address that does not have to equate occurs, illustrate that the image of this address shows.
Described reference picture obtains reference picture address that control module 2 sends over according to buffering area control module 1 and obtains from decoding image buffering area (RAM) when reference image data sends in the decoding nucleus module 8 for motion compensation and use;
The memory address that decoded picture storage control module 3 sends over according to buffering area control module 1 is to decoding image buffering area 9 storage decoded datas;
Display image obtains display image address that control module 4 sends over according to buffering area control module 1 and obtains display image data offer display control module 5 from decoding image buffering area 9, is shown on display 6 by display control module 5 these video datas of control;
The display image data that display control module 5 controls are obtained normally shows on display 6, and feeds back current display image address information by current display status register to the buffering area control module.When display image obtains control module not to display control module transmission address information, display control module will be controlled the data that repeat to show last display image.
Decoded picture storage control module 3 will judge whether that at the decoded data that will export decoded data can store before decoding image buffering area 9 storage from the core codec chip, whether there is decoded data to store in order to judge, multiple mode can be arranged, as:
The decoded picture storage control module can comprise a decoded data FIFO, described decoded data FIFO is used for the current decoded data of buffer memory from the output of decoding nucleus module, when having judged whether that decoded data can be stored, have only whether this decoded data of retrieval FIFO is empty getting final product; Perhaps described decoded picture storage control module is connected with the block elimination effect filter of decoding nucleus module, receives the signal that whether has decoded data to export that block elimination effect filter sends, and can judge whether that according to this signal decoded data can store.
The present invention also provides a kind of control method of video frequency decoding buffer zone, as shown in Figure 3, comprises following step:
Step 1, buffering area control module obtain current decoded picture memory address, current reference picture address, display image address according to the view data of current buffering area and the state of this view data;
Step 2, buffering area control module send to reference picture with described current reference picture address and obtain control module, described reference picture obtains control module and obtains reference image data according to the reference picture address that the buffering area control module sends over from decoding image buffering area (RAM), and sends it to the motion compensating module of decoding nucleus module;
Step 3, buffering area control module judge whether the image of described decoded picture memory address correspondence is shown, if be not shown, then carry out collision detection, if show, carry out next step;
Step 4, buffering area control module send to the decoded picture storage control module with the memory address of current decoded picture; The decoded picture storage control module will deposit decoding image buffering area in from the decoded data of decoding nucleus module output according to this memory address;
Step 5, buffering area control module send to display image with the display image address and obtain control module, and write display image address emulation FIFO simultaneously, display image obtains control module according to this display image address reading displayed view data and send it to display control module from decoding image buffering area, display control module is controlled this display image data and is shown on display, and the while display control module initial address of video data at this moment writes display status register.
Wherein, the decoded picture storage control module judges whether to still have decoded data from the output of decoding nucleus module, if any, continue storage, behind the two field picture of having decoded, return step 1, as do not have, then the decoded picture storage control module enters idle condition, waits for gathering data arrival next time.
The used buffer pool size of the present invention is determined by following formula:
S=(RefNum+φ)×PictureSize
Wherein RefNum is the maximum reference picture number of standard code, for example is 2 in the AVS standard; φ is weights, decides according to concrete flowing water project organization, stores the recycling space of current decoded picture except being used for the space of stored reference image in its expression buffering area.For example in the AVS standard,, then except the space of 2 reference pictures, also have the space of 2 images can offer decoded picture storage control module and display control module use if buffer size is 4.For the AVS standard, its reference picture number is 2, and these two positions must keep so that other image comes reference.And storage and demonstration need a memory space at least, if having only a space, mutual wait can occur when decoding processing, and promptly the decoded picture of this position does not also show, and must deposit the decoded data of back toward this buffer location in.Decoder stopped and wait to show end this moment, carried out the decoding processing of next image again, thereby influenced overall performance.And adopt 4 buffering areas, then can address this problem preferably.Be generally 2 and can carry out normal continuous productive process;
PictureSize is the size of decoded picture.
Above-mentioned reference picture address, the memory address of decoded picture, the display image address obtains by following formula:
Addr=Base+Pos×PictureSize,
Wherein, refer to the Position Number of this address at DPB (Decoded Picture Buffer, decoding image buffering area are called for short DPB) buffering area during the value of Pos, Base is meant DPB buffering area plot.
Pos value in the described reference picture address obtains by following process:
State information according to image in the current DPB buffering area, for the AVS standard, analyze the state information of 4 images in the current DPB buffering area, the position (0~3) of non-B image (being I or P image) of selecting wherein to have maximum image number is as the Pos value in the reference picture address, for the AVS standard, the position (0~3) of two non-B images (being I or P image) of selecting wherein to have maximum image number is as the Pos value in the reference picture address.
Pos value in the memory address of described decoded picture obtains by following process:
If the non-B image more than the reference picture number is arranged in the current DPB buffering area, the value of non-B picture position of getting the picture number minimum is as the Pos value in the memory address of decoded picture, for the AVS standard, because must have 2 to be reference picture in 4 buffering areas of DPB, they are right and wrong B image all, and other 2 can be the image of combination in any.If a right and wrong B image is arranged in other 2, that is to say, current DPB buffering area has 3 non-B images, at this moment, the minimum non-B image of numbering has not used meaning, this space can reuse, and the value of position that just will number minimum non-B image is as the Pos value in the memory address of decoded picture;
If it is the B image that other images except that the number of reference picture are arranged in the DPB buffering area, the value of then choosing the position of picture number minimum in the B image is as the Pos value in the memory address of decoded picture.For the AVS standard, if other 2 except that the non-B image of 2 reference pictures is the B image, because the B image is showing before reference picture thereafter all the time, as long as preserving, decoding finishes, the B image can show as early as possible that this is that DISPLAY ORDER is desired, and one of them B image has shown and finishes so, this image that showed has not just had the meaning of preservation yet so, and this space can be reused.So, with the value of the position of picture number minimum in the B image as the Pos value in the memory address of decoded picture.
The Pos value of described display image address obtains by following process:
Search for the image state of current DPB buffering area, find current non-B image and the B picture position that is not shown respectively with minimum image number.If all B images all show in the DPB buffering area, the value of position of non-B image of then getting lowest number is as the Pos value in the display image address; If B image and non-B image all have also not demonstration, if this moment lowest number the forward direction reference picture of the non-B image B image that is lowest number, the positional value of then getting non-B image is as the Pos value in the memory address, if the forward direction reference picture of the B image that the non-B image of lowest number is not a lowest number, the value of position of then getting the B image is as the Pos value in the memory address.
The described buffering area control module of step 2 judges that the process whether image of described decoded picture memory address correspondence has been shown is: the address of the current display image of depositing in the buffering area control module reading displayed status register, remove and be positioned at this explicit address all explicit addresses before among the display image address emulation FIFO, because the image before this explicit address is shown, the decoded picture memory address that search is calculated in the remaining explicit address of display image address emulation FIFO, if find to have equal address to occur, illustrate that then the image in this decoded picture memory address does not also show, if the address that does not have to equate occurs, illustrate that the image in this decoded picture memory address shows.
With AVS Video 1.0 coding standards is that example describes, in AVS 1.0 standards, the number that the reference picture number is B image between 2, two non-B images to the maximum can only be 0,1 and 2 three kind of numerical value, below by having the code stream order of 2 B images to describe between two non-B images for embodiment.
A typical decoder input order is as follows:
I
0?P
1B
2B
3?P
4B
5B
6?P
7B
8B
9?P
10B
11B
12?P
13B
14B
15?P
16B
17B
18?P
19
Corresponding demonstration output order is as follows:
I
0?B
2B
3P
1?B
5B
6P
4?B
8B
9P
7?B
11B
12P
10?B
14B
15P
13?B
17B
18P
16
The process of buffer management is by shown in the following table:
| ?????????????????????????????????DPB | ????Store | ??????????????MC | ????Display |
????Cur | ????0 | ????1 | ????2 | ????3 | ????S
0 | | ????N
0 | ????N
1 | ????ref
0 | ????ref
1 | ????D
0 | |
????I
0 | ????I
0????[0]
| | | | ????0 | ????I
0 | ????N | ????N | | | ????N | |
????P
1 | ????I
0????[0]
| ????P
1????[0]
| | | ????1 | ????P
1 | ????0 | ????N | ????I
0 | | | |
????B
2 | ????I
0????[1]
| ????P
1????[0]
| ????B
2????[0]
| | ????2 | ????B
2 | ????0 | ????1 | ????I
0 | ????P
1 | ????0 | ????I
0 |
????B
3 | ????I
0????[1]
| ????P
1????[0]
| ????B
2????[0]
| ????B
3????[0]
| ????3 | ????B
3 | ????0 | ????1 | ????I
0 | ????P
1 | ????2 | ????B
2 |
????P
4 | ????I
0????[1]
| ????P
1????[0]
| ????P
4????[0]
| ????B
3????[0]
| ????2 | ????P
4 | ????0 | ????1 | ????I
0 | ????P
1 | ????3 | ????B
3 |
????B
5 | ????B
5????[0]
| ????P
1????[0]
| ????P
4????[0]
| ????B
3????[1]
| ????0 | ????B
5 | ????1 | ????2 | ????P
1 | ????P
4 | ????1 | ????P
1 |
????B
6 | ????B
5????[0]
| ????P
1????[1]
| ????P
4????[0]
| ????B
6????[0]
| ????3 | ????B
6 | ????1 | ????2 | ????P
1 | ????P
4 | ????0 | ????B
5 |
????P
7 | ????P
7????[0]
| ????P
1????[1]
| ????P
4????[0]
| ????B
6????[0]
| ????0 | ????P
7 | ????1 | ????2 | ????P
1 | ????P
4 | ????3 | ????B
6 |
????B
8 | ????P
7????[0]
| ????B
8????[0]
| ????P
4????[0]
| ????B
6????[1]
| ????1 | ????B
8 | ????2 | ????0 | ????P
4 | ????P
7 | ????2 | ????P
4 |
????B
9 | ????P
7????[0]
| ????B
8????[0]
| ????P
4????[1]
| ????B
9????[0]
| ????3 | ????B
9 | ????2 | ????0 | ????P
4 | ????P
7 | ????1 | ????B
8 |
????P
10 | ????P
7????[0]
| ????P
10???[0]
| ????P
4????[1]
| ????B
9????[0]
| ????1 | ????P
10 | ????2 | ????0 | ????P
4 | ????P
7 | ????3 | ????B
9 |
????B
11 | ????P
7????[0]
| ????P
10???[0]
| ????B
11???[0]
| ????B
9????[1]
| ????2 | ????B
11 | ????0 | ????1 | ????P
7 | ????P
10 | ????0 | ????P
7 |
????B
12 | ????P
7????[1]
| ????P
10???[0]
| ????B
11???[0]
| ????B
12???[0]
| ????3 | ????B
12 | ????0 | ????1 | ????P
7 | ????P
10 | ????2 | ????B
11 |
????P
13 | ????P
7????[1]
| ????P
10???[0]
| ????P
13???[0]
| ????B
12???[0]
| ????2 | ????P
13 | ????0 | ????1 | ????P
7 | ????P
10 | ????3 | ????B
12 |
????B
14 | ????B
14???[0]
| ????P
10???[0]
| ????P
13???[0]
| ????B
12???[1]
| ????0 | ????B
14 | ????1 | ????2 | ????P
10 | ????P
13 | ????1 | ????P
10 |
????B
15 | ????B
14???[0]
| ????P
10???[1]
| ????P
13???[0]
| ????B
15???[0]
| ????3 | ????B
15 | ????1 | ????2 | ????P
10 | ????P
13 | ????0 | ????B
14 |
????P
16 | ????P
16???[0]
| ????P
10???[1]
| ????P
13???[0]
| ????B
15???[0]
| ????0 | ????P
16 | ????1 | ????2 | ????P
10 | ????P
13 | ????3 | ????B
15 |
????B
17 | ????P
16???[0]
| ????B
17???[0]
| ????P
13???[0]
| ????B
15???[1]
| ????1 | ????B
17 | ????2 | ????0 | ????P
13 | ????P
16 | ????2 | ????P
13 |
????B
18 | ????P
16???[0]
| ????B
17???[0]
| ????P
13???[1]
| ????B
18???[0]
| ????3 | ????B
18 | ????2 | ????0 | ????P
13 | ????P
16 | ????1 | ????B
17 |
????P
19 | ????P
16???[0]
| ????P
19???[0]
| ????P
13???[1]
| ????B
18???[0]
| ????1 | ????P
19 | ????2 | ????0 | ????P
13 | ????P
16 | ????3 | ????B
18 |
| | | | | | | | | | | ????0 | ????P
16 |
It is as follows to show every meaning interpretation, in conjunction with a behavior example.
| ??????????????????????DPB | Store | ????MC | ?Display |
??Cur | ??0 | 1 | 2 | 3 | S
0 | | ?N
0 | ?N
1 | ?ref
0 | ?ref
1 | ?D
0 | |
??P
10 | ??P
7??[0]
| P
10??[0]
| P
4????[1]
| B
9????[0]
| 1 | ??P
10 | ?2 | ?0 | ?P
4 | ?P
7 | ?3 | ?B
9 |
??B
11 | ??P
7??[0]
| P
10??[0]
| B
11???[0]
| B
9????[1]
| 2 | ??B
11 | ?0 | ?1 | ?P
7 | ?P
10 | ?0 | ?P
7 |
| ??P
7??[1]
| P
10??[0]
| B
11???[0]
| | | | | | | | ?2 | ?B
11 |
Cur represents the image of current decoder input, as B
11, i.e. the 11st image, its type is the B image.0,1,2 and 3 of DPB represents 4 memory locations of buffering area respectively, as P
7P
10B
11B
9, i.e. 4 images of current storage are divided into two P images and two B images, and its picture number is divided into 7,10,11 and 9.B wherein
11It is the image that has just deposited in.Store represents the position of storing and corresponding image, and it is as shown in the table will import B
11Deposit 2 positions in.MC represents the position of reference picture, as above B
11Reference picture be P
7And P
10, the memory location of their correspondences is 0 and 1.Display represents the B with display position 2
11Image.[] of each postpone represents whether this Pos place image shows, 1 expression shows that 0 expression does not show.The demonstration here represents it is the address have been sent into image address emulation FIFO, and whether image really is shown the explicit address register information that need check that image display is returned.
The control method process of video frequency decoding buffer zone is as follows:
Step 1, current buffer contents are P
7P
10P
4B
9, the buffering area control module is checked the state information of 4 positions, and is specific as follows:
P
4Show that other 3 images all do not send apparent.
B
9Front and back be respectively that forward direction is P to reference picture
4, the back is to being P
7
According to the address that formula calculates reference picture address, decoded picture address stored, display image, wherein, described formula is:
Addr=Base+Pos×PictureSize,
Base in the formula is meant DPB buffering area plot, refers to its Position Number at the DPB buffering area during value of Pos;
Wherein, determine the position of reference picture: choose two P images, i.e. P with maximum image number
7And P
10Be current decoded picture B
11Reference picture, its position is 0 and 1, obtains the address of reference picture according to the value of this position;
Determine the position of decoded picture storage: because this moment 3 P images are arranged, so should be deposited into the picture position of minimum image number, i.e. P
4So position 2 is can be with B
11Write the position 2 of DPB.Value according to this position obtains the decoded picture address stored;
Determine the position of display image: find two not show non-B image and B image, i.e. P respectively with minimum image number
10And B
11, because P
10Be B
11Back to reference picture, so this moment should show B
11Be B
11Decoding finishes and can notify display module to begin to show this image, obtains the address of display image according to the value of this position;
Step 2, buffering area control module send to reference picture with described current reference picture address and obtain control module, and described reference picture obtains control module and obtains reference image data P according to the reference picture address that the buffering area control module sends over from decoding image buffering area (RAM)
7And P
10, and send it to the decoding nucleus module motion compensating module decode;
The address of the current display image of depositing in step 3, the buffering area controller reading displayed status register, remove and be positioned at this explicit address all explicit addresses before among the display image address emulation FIFO, because the image before this explicit address is shown, the decoded picture memory address that search is calculated in the explicit address that is left in emulation FIFO is because P
4The address not in display image address emulation FIFO, so image P in this decoded picture memory address is described
4Show.
Step 4, buffering area control module send to the decoded picture storage control module with the memory address of current decoded picture; The decoded picture storage control module judges whether to still have decoded data from the output of decoding nucleus module, as does not have, and then the decoded picture storage control module enters idle condition, waits for gathering data arrival next time; If any, according to this memory address, will deposit original P the decoding image buffering area in from the current decoded data of decoding nucleus module output
4The position, in the present embodiment because current decoded data B arranged
11So, with B
11Deposit original P in the decoding image buffering area in
4The position, this moment buffering area become P
7P
10B
11B
9
Step 5, buffering area control module send to display image with the display image address and obtain control module, and simultaneously this address being write display image address emulation FIFO, display image obtains control module according to this display image address reading displayed view data B from decoding image buffering area
11, and sending it to display control module, display control module is controlled this display image data B
11Show that on display the initial address of display control module video data understanding at this moment simultaneously writes display status register.
At this moment, current decoded data B
11Decoding, show and to finish dealing with, next repeat above-mentioned steps and handle next view data.
When implementation strategy is managed, can adopt a simple structure to realize the statistics of corresponding informance.
typedef?struct
{
int?pictype;
int?number;
int?disped;
int?motion[2];
}DPBMap_T;
DPBMap_T??g_arrDPBMap[4];
Used corresponding with last surface analysis to information, write down every data of 4 positions of DPB respectively by the g_arrDPBMap array, comprise pictype presentation video type, number presentation video numbering, disped represents whether show, motion writes down two reference picture positions of present image respectively.By safeguarding this structural array, just can obtain all required analysis of strategies information.
Adopt corresponding strategy can guarantee in the scope of 4 buffering areas, effectively manage each image storage.This strategy not only is suitable for the IPBB sequence, for the IPPP sequence, and the IPB sequence, perhaps the IPBBPBPBBPBP sequence all can be suitable for.Because management strategy is to determine from the relation between the image, it doesn't matter order to occur with concrete image type.
It should be noted last that: above embodiment is the unrestricted technical scheme of the present invention in order to explanation only, although the present invention is had been described in detail with reference to the foregoing description, those of ordinary skill in the art is to be understood that: still can make amendment or be equal to replacement the present invention, and not breaking away from any modification or partial replacement of the spirit and scope of the present invention, it all should be encompassed in the middle of the claim scope of the present invention.