The synchronous method and system of a kind of controls playing frame per second
Technical field
The present invention relates to the video transmission technologies in multimedia field, relate in particular to the synchronous method and system of a kind of controls playing frame per second.
Background technology
In existing various video transmission applications, the frame synchronization during video playback always is a major issue.Different video stream medias has the different frame per second of recording, and different playback equipments also has different play frame rate, the frame number difference that promptly different playback equipments can refresh in each second.One frame of video data stream is represented piece image, and a frame is made up of hundreds of row even more line data.When the refreshing frame per second and be higher than the video data stream frame per second of playback equipment, must use the way that repeats to refresh same frame to come achieve frame synchronous.
Consult shown in Figure 1ly, the synchronous system of controls playing frame per second of existing video playback comprises video flowing unit 10, video decoding unit 20, line buffer unit 30, frame memory cell 40, refresh unit 50 and display unit 60.Utilize said units as follows in the prior art to the detailed process that the video data stream frame repeats to brush frame:
The data flow frame that video flowing unit 10 buffer memorys receive; 20 pairs of video data stream frames of video decoding unit are decoded; Decoded video data deposits in the line buffer unit (LBUF, line Buffer) 30 in real time; Video data by line buffer unit 30 again unloading in frame memory cell 40; The data that refresh unit 50 reads in the frame memory cell 40 refresh, meanwhile, 50 pairs of playback equipments of refresh unit refresh frame per second and the data flow frame per second compares, be higher than the data flow frame per second if refresh frame per second, then the data that read again in the frame memory cell 40 of refresh unit 50 refresh; Data after 60 pairs of refresh unit 50 of display unit refresh are resolved demonstration.By said process, realized refresh playback equipment play data stream frame per second under the situation that frame per second is higher than the data flow frame per second synchronously.
Because when the refreshing frame per second and be higher than the video data stream frame per second of playback equipment, need to adopt the way that repeats to refresh same data flow frame to come achieve frame synchronous, therefore, system needs a frame memory cell at least, and existing video playback control system is for realizing smooth playing process, usually use a jumbo frame memory cell with storage more data stream frame, thereby improved system cost.
Summary of the invention
The invention provides the synchronous method and system of a kind of controls playing frame per second, cause the high problem of system cost owing to there is the frame memory cell in Play System to solve in the prior art.
The invention provides the synchronous system of a kind of controls playing frame per second, comprising:
The video flowing unit is used for the video data stream frame that buffer memory receives;
Video decoding unit, when the system refresh frame per second is higher than the video data stream frame per second, video data stream frame to described video flowing unit caches carries out repeat decoding, and when described system refresh frame per second is lower than described video data stream frame per second, the partial frame in the video data stream frame of buffer memory is decoded and unnecessary frame abandoned do not do decoding;
Line buffer unit is used for becoming line data to carry out buffer memory the decoded block data transaction of described video decoding unit;
Refresh unit is used for based on the system refresh frame per second the switched line data of described line buffer unit being refreshed; Display unit is used for the data that described refresh unit has refreshed are resolved demonstration.
Preferably, video decoding unit specifically comprises: the data flow storing sub-units is used for the video data stream of the buffer memory sent the described video flowing of buffer memory unit; Refresh the frame per second storing sub-units, be used for storage system and refresh frame per second; The data flow frame per second is obtained subelement, is used to obtain the video data stream frame per second;
Frame per second is subelement relatively, is used for relatively refreshing the system refresh frame per second of frame per second storing sub-units storage and data flow frame per second and obtains relation between the video data stream frame per second that subelement obtains;
The decoding subelement, when being used for frame per second comparative result at frame per second comparison subelement and being the system refresh frame per second greater than the video data stream frame per second, video data stream frame to buffer memory in the data flow storing sub-units carries out repeat decoding, and be system refresh frame per second during less than the video data stream frame per second at the frame per second comparative result, the partial frame in the video data stream of buffer memory in the data flow storing sub-units is decoded and unnecessary frame abandoned do not do decoding.
Preferably, described data flow frame per second is obtained subelement and is included in frame per second in the video data stream by identification and identifies and obtain the video data stream frame per second.
Preferably, described decoding subelement is when repeat decoding, and the number of repeat decoding is the poor of system refresh frame per second and video data stream frame per second in per second; And when frame losing was decoded, the number that abandons frame in per second was the poor of video data stream frame per second and system refresh frame per second.
The invention provides the synchronous method of a kind of controls playing frame per second, comprise the steps:
The video data stream frame that A, buffer memory receive;
B, when the system refresh frame per second is higher than the video data stream frame per second, video data stream frame to described buffer memory carries out repeat decoding, and when described system refresh frame per second is lower than described video data stream frame per second, the partial frame in the video data stream frame of described buffer memory is decoded and unnecessary frame abandoned do not do decoding;
C, become line data to carry out buffer memory described decoded block data transaction;
D, refresh based on the line data of system refresh frame per second to described buffer memory;
E, the line data behind described the refreshing is resolved demonstration.
Wherein said step B comprises the steps:
B1, obtain the video data stream frame per second;
Relation between the system refresh frame per second of B2, the video data stream frame per second of relatively obtaining and storage in advance;
B3, be video data stream frame per second during, the video data stream frame of buffer memory is carried out repeat decoding less than the system refresh frame per second at described comparative result; At described comparative result is video data stream frame per second during greater than the system refresh frame per second, the partial frame in the video data stream frame of buffer memory is decoded and unnecessary frame abandoned do not do decoding.
Being included in frame per second in the video data stream by identification among the wherein said step B1 identifies and obtains the video data stream frame per second.
When repeat decoding, the number of repeat decoding is the poor of system refresh frame per second and video data stream frame per second in per second among the wherein said step B3; And when frame losing was decoded, the number that abandons frame in per second was the poor of video data stream frame per second and system refresh frame per second.
The invention provides a kind of Video Decoder, comprising:
The data flow storing sub-units is used for buffer memory video data stream frame;
Refresh the frame per second storing sub-units, be used for storage system and refresh frame per second;
The data flow frame per second is obtained subelement, is used to obtain the video data stream frame per second;
Frame per second is subelement relatively, is used for relatively refreshing the system refresh frame per second of frame per second storing sub-units storage and data flow frame per second and obtains relation between the video data stream frame per second that subelement obtains;
The decoding subelement, when being used for comparative result at frame per second comparison subelement and being the system refresh frame per second greater than the video data stream frame per second, video data stream frame to buffer memory in the described data flow storing sub-units carries out repeat decoding, and be system refresh frame per second during less than the video data stream frame per second at comparative result, the partial frame in the video data stream of buffer memory in the described data flow storing sub-units is decoded and unnecessary frame abandoned do not do decoding.
Wherein said data flow frame per second is obtained subelement and is included in frame per second in the video data stream by identification and identifies and obtain the video data stream frame per second.
Wherein said decoding subelement is when repeat decoding, and the number of repeat decoding is the poor of system refresh frame per second and video data stream frame per second in per second; And when frame losing was decoded, the number that abandons frame in per second was the poor of video data stream frame per second and system refresh frame per second.
The invention provides a kind of video encoding/decoding method, comprise step:
S1, the video data stream that receives is carried out buffer memory;
S2, obtain the video data stream frame per second that receives;
Relation between the system refresh frame per second of S3, the video data stream frame per second of relatively obtaining and storage in advance;
S4, be video data stream frame per second during, the video data stream frame of buffer memory is carried out repeat decoding less than the system refresh frame per second at described comparative result; At described comparative result is video data stream frame per second during greater than the system refresh frame per second, the partial frame in the video data stream frame of buffer memory is decoded and unnecessary frame abandoned do not do decoding.
Being included in frame per second in the video data stream by identification among the wherein said step S2 identifies and obtains the video data stream frame per second.
When repeat decoding, the number of repeat decoding is the poor of system refresh frame per second and video data stream frame per second in per second among the wherein said step S4; And when frame losing was decoded, the number that abandons frame in per second was the poor of video data stream frame per second and system refresh frame per second.
The present invention utilizes video decoding unit to require the video data stream frame that receives is carried out repeat decoding based on the system refresh frame per second, or only abandons to the decoding of the partial frame in the video data stream frame and with unnecessary frame and do not do decoding, realizes that play frame rate is synchronous.Therefore, the present invention has saved the frame memory cell in the Play System, thereby has reduced system cost.
Description of drawings
Fig. 1 is the synchronous system construction drawing of controls playing frame per second of prior art;
Fig. 2 is the synchronous system construction drawing of controls playing frame per second of the embodiment of the invention;
Fig. 3 is the structure chart of the video decoding unit of the embodiment of the invention;
Fig. 4 is the synchronous principle flow chart of controls playing frame per second of the embodiment of the invention.
Embodiment
Design philosophy of the present invention is to utilize video decoding unit to require the video data stream frame that receives is carried out repeat decoding based on the system refresh frame per second, or only abandon to the partial frame in video data stream frame decoding and with unnecessary frame and do not do decoding, realize that play frame rate is synchronous.This method has been saved the frame memory cell in the Play System, thereby has reduced system cost.
With reference to shown in Figure 2, the synchronous system of controls playing frame per second of the embodiment of the invention comprises video flowing unit 10, video decoding unit 20, line buffer unit 30, refresh unit 50 and display unit 60, and the function of each unit is as follows:
Video flowing unit 10 is used for the video data stream frame that buffer memory receives, and the video data stream frame behind the buffer memory is transferred in the video decoding unit 20;
Video decoding unit 20, be used for requiring the video data stream frame that receives is carried out repeat decoding according to the system refresh frame per second, or only abandon and do not do decoding, and decoded block data are input in the line buffer unit 30 to the partial frame in video data stream frame decoding and with unnecessary frame.
Consult shown in Figure 3ly, video decoding unit 20 comprises:
Data flow storing sub-units 201 is used for the video data stream frame of buffer memory by 10 outputs of video flowing unit;
The data flow frame per second is obtained subelement 202, is used for frame per second by the identification video data flow frame and identifies and obtain the video data stream frame per second;
Refresh frame per second storing sub-units 203, be used for storage system and refresh frame per second;
Frame per second is subelement 204 relatively, and refresh frame per second and the data flow frame per second that are used for relatively refreshing 203 storages of frame per second storing sub-units are obtained relation between the video data stream frame per second that subelement 202 obtains;
Decoding subelement 205, when being used for frame per second comparative result according to frame per second comparison subelement 204 and being the system refresh frame per second greater than the video data stream frame per second, video data stream frame to buffer memory in the data flow storing sub-units 201 carries out repeat decoding, and wherein the number of repeat decoding is the poor of system refresh frame per second and video data stream frame per second in per second; At the frame per second comparative result is that the system refresh frame per second is during less than the video data stream frame per second, partial frame in the video data stream of buffer memory in the data flow storing sub-units 201 decoded and unnecessary frame abandoned do not do decoding, the number that wherein abandons frame in per second is the poor of video data stream frame per second and system refresh frame per second.
Line buffer unit 30 is used for decoded block data transaction is become the line data that refreshes for refresh unit, and line data is stored.
Refresh unit 50 is used for requiring to read line buffer unit 30 switched line data based on the system refresh frame per second, and line data is refreshed.
Display unit 60 is used for the line data that refresh unit 50 has refreshed is resolved demonstration.
Consult shown in Figure 4ly, the synchronous idiographic flow of the controls playing frame per second of present embodiment is as follows:
The video data stream frame that S10, video flowing unit 10 buffer memorys receive, and the video data stream frame behind the buffer memory is transferred in the video decoding unit 20.
S20, video decoding unit 20 require the video data stream frame that receives is carried out repeat decoding according to the system refresh frame per second, or only abandon to the decoding of the partial frame in the video data stream frame and with unnecessary frame and do not do decoding, and the specific implementation process is as follows:
Data flow storing sub-units 201 buffer memorys are by the video data stream of video flowing unit 20 outputs; The data flow frame per second is obtained subelement 202 and is identified by the frame per second that comprises in the reading video data stream frame and obtain the video data stream frame per second; 204 pairs of data flow frame per second of frame per second comparison subelement are obtained subelement 202 video data stream frame per second of obtaining and the system refresh frame per second that refreshes storage in the frame per second storing sub-units 203 and are compared, and comparative result is input in the decoding subelement 205; Decoding subelement 205 is according to the frame per second comparative result that receives, the video data stream frame that is buffered in the data flow storing sub-units 201 is decoded with macro block behavior unit, further, if the system refresh frame per second is higher than the video data stream frame per second, then the video data stream frame to buffer memory carries out repeat decoding, wherein the number of repeat decoding is the poor of system refresh frame per second and video data stream frame per second in per second, if the system refresh frame per second is less than the video data stream frame per second, then the partial frame in the video data stream frame of buffer memory is decoded and unnecessary frame abandoned and do not do decoding, the number that wherein abandons frame in per second is the poor of video data stream frame per second and system refresh frame per second.
In a specific embodiment, the method for repeat decoding and frame losing decoding is:
At first, judge the size of system refresh frame per second and video data stream frame per second, if the system refresh frame per second greatly then carry out repeat decoding, if the video data stream frame per second greatly then carry out the frame losing decoding.
Calculate the fraction in lowest terms a/b of system refresh frame number A and video playback frame number B in a second.
If repeat decoding (a>b), then every broadcast b frame video data refreshes (a-b) frame video data;
If frame losing decoding (a<b), then whenever refresh a frame video data and abandon (b-a) frame video data.
Below be the embodiment that the decoding subelement carries out repeat decoding and frame losing decoding.It is per second 60 frames that supposing the system refreshes frame per second, video data stream frame per second per second 30 frames, system refresh 60 frames in 1 second then, video playback 30 frames, its fraction in lowest terms are 2/1, promptly in the second 30 frames in the video data stream frame of buffer memory are decoded, and this 30 frame in the video data stream frame of buffer memory carried out repeat decoding, that is to say that the video decode subelement is decoded to a frame that receives, then the same frame of having decoded is carried out repeat decoding; And supposing the system refreshes frame per second is per second 30 frames, video data stream frame per second per second 60 frames, system refresh 30 frames in 1 second then, video playback 60 frames, its fraction in lowest terms is 1/2, promptly 30 frames in the video data stream frame of buffer memory are decoded in a second and 30 unnecessary frames are abandoned and do not do decoding, that is to say, the video decode subelement abandons wherein a frame and does not do decoding when whenever receiving two frames.
S30, line buffer unit 30 become video decoding unit 20 decoded block data transaction line data to store, and read and refresh for 50 pairs of switched line data of refresh unit.
S40, refresh unit 50 require to read switched line data in the line buffer unit 30 based on the system refresh frame per second, and refresh.
The line data that S50,60 pairs of refresh unit 50 of display unit have refreshed is resolved demonstration.
Below with mpeg data stream the embodiment of the invention is described:
Motion Picture Experts Group (MPEG, Moving Picture Expert Group) standard is a series standard towards the moving image compression.Wherein, Moving Picture Experts Group-2 is direct high quality graphic and a sound coding standard relevant with digital television broadcasting.The structure of MPEG video data stream is based on the motion compensation technique of piece.When mpeg video stream was play, present embodiment utilized said method respectively the situation that the system refresh frame per second is higher or lower than the mpeg data stream frame per second to be realized that the synchronous process of play frame rate is specifically described:
First kind of situation, the system refresh frame per second is higher than the mpeg data stream frame per second, and it is per second 60 frames that supposing the system refreshes frame per second, mpeg data stream frame per second per second 30 frames.The frame per second that video decoding unit obtains mpeg data stream by the frame per second sign of identification MPEG video data stream is per second 30 frames, judge system refresh frame per second (per second 60 frames) simultaneously and be higher than mpeg data stream frame per second (per second 30 frames), then video decoding unit carries out repeat decoding according to comparative result to the same frame of the mpeg data stream of having decoded; Be transferred in the line buffer unit to decoded block data in real time; Line buffer unit transforms and stores data; Refresh unit reads line data and refreshes, thereby realizes that play frame rate is synchronous.
Second kind of situation, the system refresh frame per second is lower than the mpeg data stream frame per second, and supposing to refresh frame per second is per second 30 frames, data flow frame per second per second 60 frames.The frame per second that video decoding unit obtains mpeg data stream by the frame per second sign of identification MPEG video data stream is per second 60 frames, judge system refresh frame per second (per second 30 frames) simultaneously and be lower than mpeg data stream frame per second (per second 60 frames), abandon wherein a frame when then video decoding unit whenever receives two frames and do not do decoding; Be transferred in the line buffer unit to decoded block data in real time; Line buffer unit transforms and stores data; Refresh unit reads line data and refreshes, thereby realizes that play frame rate is synchronous.
Video data stream is being carried out in the decode procedure; data flow storing sub-units 201 in the video decoding unit 20 stores the video data stream of compressed format; and be packed data stream to be decoded also decoded data are dumped in the frame memory cell by line buffer unit in the Play System of prior art; because the video data stream of compressed format is changed into for the line data form by compressed format with respect to data flow; capacity can reduce greatly (usually based on identical content; the capacity of the video data stream of compressed format be by compressed format change into line data capacity 1/40); therefore also just reduction greatly of needed memory space; thereby Play System of the present invention is for Play System of the prior art, and cost can reduce.
Obviously, those skilled in the art can carry out various changes and modification to the present invention and not break away from the spirit and scope of the present invention.Like this, if of the present invention these are revised and modification belongs within the scope of claim of the present invention and equivalent technologies thereof, then the present invention also is intended to comprise these changes and modification interior.