Summary of the invention
Purpose of the present invention is for providing a kind of stream data buffer unit.
Another object of the present invention is for providing a kind of access method of stream data buffer unit.
The invention provides a kind of stream data buffer unit,, comprise a storage buffer, a buffer zone proxy server and a fifo queue in order to provide a processing unit access one stream data.This storage buffer has N sub-buffer zone, in order to store this stream data.This buffer zone proxy server has a sub-buffer zone table, and in order to write down a duty of corresponding sub-buffer zone, wherein this duty comprises one first state and one second state.This fifo queue has the sub-buffer zone numbering of this first state in order to record.When this processing unit receives this stream data and is stored in this stream data buffer unit, this processing unit has one first sub-buffer zone of second state to store this stream data to this buffer zone proxy server request, after storage finishes, this buffer zone proxy server changes to first state with the state of this first sub-buffer zone, and the numbering that transmits this first sub-buffer zone is to this fifo queue.When this processing unit detects this fifo queue when having the one second sub-buffer zone numbering of first state, this processing unit reads the data that this second sub-buffer zone stores, read finish after, this fifo queue is removed this second sub-buffer zone numbering, and repayment is this second state to this buffer zone proxy server with the state of changing this second sub-buffer zone in this sub-buffer zone table.
Stream data buffer unit of the present invention, this first state is a logic state 1.
Stream data buffer unit of the present invention, this second state is a logic state 0.
Stream data buffer unit of the present invention, this sub-buffer zone table are a N position buffer.
Stream data buffer unit of the present invention, this storage buffer are a static RAM.
Stream data buffer unit of the present invention, this storage buffer are a flash memory.
The present invention more provides a kind of access method of stream data buffer unit, in order to provide a processing unit access one stream data, wherein this stream data buffer unit comprises a storage buffer, a buffer zone proxy server and a fifo queue, and comprising the following steps: to distinguish this storage buffer is a plurality of sub-buffer zones.This stream data buffer unit is carried out initialization.When this processing unit writes data to this stream data buffer unit: the one first sub-buffer zone numbering that has second state to this buffer zone proxy server request; Data are write this first sub-buffer zone; When this sub-buffer zone was filled maybe this storage release, the state that this buffer zone proxy server is changed this first sub-buffer zone was first state, and the numbering that transmits this first sub-buffer zone is to this fifo queue.When this processing unit during: detect the one second sub-buffer zone numbering whether this fifo queue has first state to this stream data buffer unit reading of data; Read the data of this second sub-buffer zone; After this read release, this fifo queue was removed this second sub-buffer zone numbering, and repayment is second state to this buffer zone proxy server with the state of changing this second sub-buffer zone.
The access method of stream data buffer unit of the present invention more comprises the following step: this stream data buffer unit is carried out initialization.
The access method of stream data buffer unit of the present invention is carried out initialized step to this stream data buffer unit and is more comprised the following step: this buffer zone of resetting; Set up a sub-buffer zone table and replacement, this sub-buffer zone table is in order to write down a duty of corresponding sub-buffer zone; And this fifo queue of resetting.
The access method of stream data buffer unit of the present invention, the duty of this sub-buffer zone comprise one first state and one second state, and this sub-buffer zone of this first state representation is for can read, and this sub-buffer zone of this second state representation is for using.
The access method of stream data buffer unit of the present invention, this first state is a logic state 1.
The access method of stream data buffer unit of the present invention, this second state is a logic state 0.
Streaming data buffer and its access method of the present invention can not take too many system storage, and makes efficient better.
Embodiment
For above and other objects of the present invention, feature and advantage can be become apparent, cited below particularlyly go out preferred embodiment, and cooperate appended graphicly, be described in detail below:
Fig. 2 is the synoptic diagram that a stream data treating apparatus uses a stream data snubber assembly of the present invention.Stream data buffer unit 22 comprises a buffer zone proxy server 26, a fifo queue 28 and a storage buffer 23.Storage buffer 23 is divided into N sub-buffer zone 24, and each sub-buffer zone 24 has a corresponding numbering.Have a sub-buffer zone table 27 in the buffer zone proxy server 26, in order to represent the user mode of this N sub-buffer zone 24.Group buffer zone 24 can not be written into data when (that is representing that this sub-buffer zone has data and can read for stream data treating apparatus 21), and its user mode is a logic state 1 in sub-buffer zone table 27.When this sub-buffer zone 24 can supply to write data, its user mode was a logic state 0 in sub-buffer zone table 27.It is that 1 sub-buffer zone is numbered to fifo queue 28 that buffer zone proxy server 26 transmits logic state in the sub-buffer zone table.Whether stream data treating apparatus 21 has logic state in can detecting fifo queues 28 is 1 sub-buffer zone numbering, if detect logic state and be 1 sub-buffer zone numbering, stream data treating apparatus 21 just sees through output/input interface 25 and reads data in this sub-buffer zone.After stream data treating apparatus 21 reading of data finished, fifo queue 28 was removed this sub-buffer zone numbering, and repayment buffer zone proxy server 26 is 0 with the user mode of revising this sub-buffer zone in the sub-buffer zone table 27.When stream data processing unit 21 storage datas during to stream data buffer unit 22, it is 0 sub-buffer zone numbering that stream data treating apparatus 21 must be earlier asked for a logic state to buffer zone proxy server 26, stores the data to corresponding sub-buffer zone again.When this sub-buffer zone is filled with data maybe during this storage release, the user mode of this sub-buffer zone is a logic state 1 in the sub-buffer zone table 27 of buffer zone proxy server 26 changes, and transmits the numbering to fifo queue 28 of this sub-buffer zone.
Fig. 3 is the process flow diagram that stream data treating apparatus 21 uses stream data buffer unit 22 among Fig. 2.Step S40 is to stream data buffer unit 22 initialization, comprises reset this storage buffer 23, sub-buffer zone table 27 and fifo queue 28.After stream data buffer unit 22 initialization finish, stream data treating apparatus 21 can be according to stream data buffer unit 22 is write or reads, and select step S41a storage data in this stream data buffer unit 22, or step S41b reads the data of stream data buffer unit 22.Stream data buffer unit 22 is write data or these two actions of reading of data can be carried out simultaneously.When stream data treating apparatus 21 write data through 25 pairs of stream data buffer units 22 of output/input interface, stream data treating apparatus 21 can write the sub-buffer zone of data earlier to these buffer zone proxy server 26 requests one, shown in step S42a.Whether buffer zone proxy server 26 can be sought sub-buffer zone table 27 the sub-buffer zone that can supply storage data, if there is not then rebound step S41a, then to select arbitrary logic state be 0 sub-buffer zone if having, and numbering that will this sub-buffer zone sends stream data treating apparatus 21 to, shown in step S43a.Stream data treating apparatus 21 is according to this sub-buffer zone numbering, with data storing in this sub-buffer zone, shown in step S44a.When this sub-buffer zone fills up data maybe after this storage release, stream data treating apparatus 21 can be notified buffer zone proxy server 26, the user mode that buffer zone proxy server 26 just changes this sub-buffer zone in the sub-buffer zone table 27 is 1, and numbering that will this sub-buffer zone is sent in this fifo queue 28, shown in step S45a.Then get back to step S41a if stream data treating apparatus 21 is still wanted storage data this moment, if do not continue the flow process that storage data then finishes stream data buffer unit 22 is write data, shown in step S46a.
Whether when stream data treating apparatus 21 sees through 25 pairs of stream data buffer unit 22 reading of data of output/input interface, having in the stream data treating apparatus 21 detecting fifo queues 28 can be for the sub-buffer zone numbering of reading of data, shown in step S42b.Then do not get back to step S41b if having, if the data that then read this sub-buffer zone according to this sub-buffer zone numbering are arranged, shown in step S43b.When the data of this sub-buffer zone were read, fifo queue 28 was removed the numbering of this sub-buffer zone earlier.After the data read of this sub-buffer zone finished, stream data treating apparatus 21 can be notified buffer zone proxy server 26, is 0 just buffer zone proxy server 26 changes the user mode of this sub-buffer zone in the sub-buffer zone table 27, shown in step S44b.Then get back to step S41b if stream data treating apparatus 21 is still wanted reading of data this moment, then do not finish flow process to stream data buffer unit 22 reading of data if do not continue reading of data, shown in step S45b.
Fig. 4 is the present invention's one specific embodiment of explanation flow process shown in Figure 3.In the present embodiment, storage buffer 23 is divided into 8 sub-buffer zones 41~48, be respectively the first sub-buffer zone, the second sub-buffer zone, the 3rd sub-buffer zone ..., the 8th sub-buffer zone, its numbering is respectively 000,001,010 ..., 111.Wherein, first sub-buffer zone the 41, the 4th sub-buffer zone 44 and the 5th sub-buffer zone 45 these sub-buffer zones of expression are storage data, can supply stream data treating apparatus 21 reading of data.Therefore be " 10011000 " at sub-buffer zone table 27 storage data, and storage data is " 000,011,100 " in the fifo queue 28.When stream data treating apparatus 21 write data through 25 pairs of stream data buffer units 22 of output/input interface, stream data treating apparatus 21 can write the sub-buffer zone of data earlier to these buffer zone proxy server 26 requests one.Behind the sub-buffer zone table 27 of buffer zone proxy server 26 inquiries this moment, transmit the numbering 001 of the second sub-buffer zone 42 and give stream data treating apparatus 21.When the second sub-buffer zone 42 fills up data maybe after this storage release, stream data treating apparatus 21 can be notified buffer zone proxy server 26, the user mode that buffer zone proxy server 26 just changes this sub-buffer zone in the sub-buffer zone table 27 is 1, this moment, sub-buffer zone table 27 storage data was " 11011000 ", and storage data is " 000; 011,100,001 " in the fifo queue 28.
When stream data treating apparatus 21 saw through 25 pairs of stream data buffer unit 22 reading of data of output/input interface, stream data treating apparatus 21 detects fifo queue 28 to have and can number 000 for the sub-buffer zone of reading of data.Storage data is " 011,100,001 " in the data that this moment, stream data treating apparatus 21 read in the first sub-buffer zone 41, and fifo queue 28 is removed the numbering 000 of the first sub-buffer zone 41, this moment fifo queue 28.After the data read of the first sub-buffer zone 41 finishes, stream data treating apparatus 21 can be notified buffer zone proxy server 26, the user mode that buffer zone proxy server 26 just changes the first sub-buffer zone 41 in the sub-buffer zone table 27 is 0, and this moment, sub-buffer zone table 27 storage data was " 01011000 ".
Fig. 5 is the synoptic diagram that two the first different stream data treating apparatus and the second stream data treating apparatus use identical stream data buffer unit.The action of the first stream data treating apparatus 21a, the second stream data treating apparatus 21b and stream data buffer unit 22 is approximately identical to stream data treating apparatus 21 and stream data buffer unit 22 among Fig. 2 among Fig. 5.Difference is in the data that store in fifo queue 28 and has difference.Because therefore stream data treating apparatus 21a and 21b access simultaneously stream data buffer unit 22 must be distinguished in order to the sub-buffer zone of storage data for both, in order to avoid the sub-buffer data of stream data treating apparatus read error.For instance, buffer zone proxy server 26 is given the first stream data treating apparatus 21a numbering 01, give the second stream data treating apparatus 21b numbering 10, in fifo queue 28, can provide to which stream data treating apparatus for sub-buffer zone numbering of reading of data and read, just can before sub-buffer zone numbering, add the numbering of this stream data treating apparatus in order to distinguish this.For instance, if the data that store in the fifo queue 28 are " 01000; 01001; 10010; 10011 ", the sub-buffer zone of i.e. expression numbering 000 and 001 provides the first stream data treating apparatus 21a and reads, and the sub-buffer zone of numbering 010 and 011 provides the second stream data treating apparatus 21b and reads.
The above only is preferred embodiment of the present invention; so it is not in order to limit scope of the present invention; any personnel that are familiar with this technology; without departing from the spirit and scope of the present invention; can do further improvement and variation on this basis, so the scope that claims were defined that protection scope of the present invention is worked as with the application is as the criterion.
Being simply described as follows of symbol in the accompanying drawing:
11: the stream data playing device
12: stream data buffer unit
13: buffer zone I
14: buffer zone II
15: receiving end
21,21a, 21b: stream data treating apparatus
22: stream data buffer unit
23: storage buffer
24: sub-buffer zone
25: output/input interface
26: the buffer zone proxy server
27: sub-buffer zone table
28: fifo queue
41: the first sub-buffer zones
42: the second sub-buffer zones
43: the three sub-buffer zones
44: the four sub-buffer zones
45: the five sub-buffer zones
46: the six sub-buffer zones
47: the seven sub-buffer zones
48: the eight sub-buffer zones
S40: to stream data buffer unit 22 initialization
S41a: storage data is in this stream data buffer unit 22
S41b: the data that read stream data buffer unit 22
S42a: 26 requests one can write the sub-buffer zone of data to the buffer zone proxy server
S43a: available sub-buffer zone is arranged?
S44a: with data storing in this sub-buffer zone
S45a: change the user mode of this sub-buffer zone in the sub-buffer zone table 27 and numbering that will this sub-buffer zone and be sent to this fifo queue 28
S46a: continue storage data?
Can S42b: having in the detecting fifo queue 28 be for the sub-buffer zone numbering of reading of data?
S43b: the data that read this sub-buffer zone
S44b: fifo queue 28 is removed the numbering of this sub-buffer zone earlier and is changed the user mode of this sub-buffer zone in the sub-buffer zone table 27
S45b: continue reading of data?