Background technology
At present, portable media player improves the extended capability of audio frequency apparatus by using the data audio interface, offers consumer's specialty, hearing enjoying easily.Wherein, the data audio interface comprises: SONY/PHILIPS DAB (S/PDIF) interface of civilian level and U.S. Audio Engineering Society/European Broadcasting Union (AES/EBU) standard interface of specialized standard broadcast level.Usually the voice data that transmits between audiogenic device and player need carry out the encoding and decoding processing by codec, but owing to have serious electromagnetic wave between audiogenic device and the player, if transmission of analogue signal between them will certainly cause the decline of tonequality.Therefore processing scheme commonly used is: finish pulse code modulation (PCM) (Pulse CodeModulation by digital audio interface, PCM) transmission of voice data, in player or audio amplifier, finish modulus (D/A) the converter decoding of pcm audio data, amplify output then, so that promote tonequality.
In order to realize said process, need in portable media player, realize two-way mark coding (Biphase-Mark Decoding), S/PDIF interface and AES/EBU interface can both be realized two-way mark (Biphase-Mark) code encoding/decoding mode.
With the S/PDIF interface is example, and its data flow transmitted is made of piece (block), the form of each block as shown in Figure 1:
Each block is made up of 192 frames (frames); Each frame is made up of 2 subframes (sub-frame); Sub-frame represents a sampling point of a left side or R channel, and its form as shown in Figure 2.Preamble is divided into preamble B among Fig. 1, preamble W and preamble M.Wherein, the frame head of first L channel (Channel L) sampling point of a block of preamble B sign, the frame head of R channel (Channel R) sampling point among the preamble W sign block, the frame head of preamble M sign L channel sampling point (in block first L channel sampling point).
In sub-frame form shown in Figure 2,0-3 bit (bit) is synchronizing frame head (preamble), is the opening flag (start flag) of sampled point, and 4-27bit is the value of sampled point.The S/PDIF interface is supported the resolution (resolution) of 24bit or 20bit, and when the resolution of sampled point was 20bit, LSB was from 8bit, and 4-7bit fills out 0; Otherwise LSB is from 4bit.28bit is effective marker (validate flag), be used to indicate whether this sampling point value is effective, 29bit is user ID (user flag), indicate that this sub-frame is a multimedia form, or broadcasting format, 30bit is channel status (channel state), and 31bit is parity check bit (parity bit).
The coding of sampling point value satisfies the two-way mark coded format, specifically as shown in Figure 3: when data are encoded, following rule is followed in coded pulse: the boundary in the pulse of each bit data bit correspondence of raw data all saltus step can occur, as above the impulse level of a bit data bit is high (high level), the impulse level of then next bit data bit can saltus step be low (low level), opposite process is also set up, and locates shown in the dotted line among Fig. 3; Simultaneously, when data are encoded, when if current bit is " 1 ", place in the middle of the pulsewidth of this bit data bit correspondence, a saltus step also can occur, and current bit keeps then its corresponding impulse level value constant when being " 0 ", as part shown in the arrow of below among Fig. 3, indicated and in cataloged procedure, produce impulse hits and keep the constant corresponding moment point of impulse level.After having passed through the two-way mark coding, in the string graphic data interface, a minimum pulse width has in fact just been represented half information of True Data, usually this minimum pulse width is referred to as chip.
S/PDIF is as asynchronous unidirectional, self-built clock (self-clocking) interface, in data, implied clock information, so, bring in for reception and to say, can from data message, recover clock signal, and utilize this clock signal to finish reading of data, and sampling rate information is submitted to application layer, finish the broadcast of voice data.
In audio interface; recovered clock information can adopt synchronised logic (the analogphase-locked loop of simulation usually; PLL); Mo Ni phaselocked loop just, but because in the two-way mark coding, 1 is different with 0 coded system; if the input data are complete " 1 "; then the clock information after the digital coding is the twice of actual clock, because in the middle of the pulsewidth of each bit correspondence, all the pulsatile once saltus step can occur.And when the input data be complete " 0 ", then coding back hopping edge information and clock information be with frequency, because only can just saltus step can occur at the boundary of the pulse of bit correspondence.So adopt the phaselocked loop of traditional simulation can't lock actual clock information, and PLL can seriously be subject to the instability tolerance (JitterTolerance) of input signal.
The method that is applied to the sampling point position of digital audio interface accordatura audio data really at present in the prior art mainly contains two kinds: remove 3 methods and revised law.The basic thought that removes 3 methods is by calculating first high level or the low level length of synchronizing frame head pulse, again divided by 3, and then can determine the sampling point position of voice data, and 3 methods of removing realize simple, but need divider in the circuit, cause circuit area bigger; Revised law is at first supposed a sampling point position, determine the sampling point position of current voice data by the sampling point position that continues the correction original hypothesis, compare with 3 methods of removing, the revised law circuit realizes that area is less, but since the sampling point position of original hypothesis may be not accurate enough and need not stop to audio data detection to continue to revise current sampling point position, the situation that loss of data therefore may occur, and power consumption is bigger.
Summary of the invention
The invention provides a kind of method and device of definite audio data sampling point position, in order to solve loss of data and the big problem of power consumption in the prior art.
The embodiment of the invention provides a kind of method of definite audio data sampling point position, described voice data adopts two-way mark coded system coding to transfer to receiving end by transmitting terminal, described voice data is made up of data block, data block is made of frame, each frame comprises synchronizing frame head B pulse, and described method comprises:
The hopping edge is carried out in synchronizing frame head B pulse in the voice data that receives detect, and, count by the receiving terminal system clock according to detected hopping edge number;
Calculate first hopping edge during second hopping edge count value and the count value during three hopping edges, second hopping edge to the and value, as first count value; And calculate count value during three hopping edges, second hopping edge to the and the 3rd hopping edge to the forth jump become along during count value and value, as second count value; And calculate the 3rd hopping edge to the forth jump become along during count value and the forth jump become along become to the fifth jump along during count value and value, as the 3rd count value; Described first hopping edge, second hopping edge, the 3rd hopping edge, the forth jump become the edge and the fifth jump change edge is the hopping edge of described synchronizing frame head B pulse;
When the absolute value of 2 times difference of described first count value and described second count value smaller or equal to 1, and the absolute value of the difference of described first count value and described the 3rd count value determines that smaller or equal to 1 o'clock described synchronizing frame head B pulse is correct; Otherwise, determine that described synchronizing frame head B pulse is incorrect;
When definite described synchronizing frame head B pulse is correct, the size of more described first count value and described the 3rd count value; And with less in described first count value and described the 3rd count value count value divided by 4, obtain and the corresponding count value of transmitting terminal clock-pulse width;
According to the corresponding count value of described transmitting terminal clock-pulse width, determine the corresponding moment, with the described corresponding described audio data sampling point position that constantly is defined as at its half calculated value.
The method of described definite audio data sampling point position also comprises:
When determining that described synchronizing frame head B pulse is incorrect, abandon the affiliated data of described synchronizing frame head B pulse and determine.
Described with less in described first count value and described the 3rd count value count value divided by 4, be specially:
A less count value in described first count value of storing in the register and described the 3rd count value is moved to right 2.
The embodiment of the invention also provides a kind of device of definite audio data sampling point position, described voice data adopts two-way mark coded system coding back to transfer to receiving end by transmitting terminal, described voice data is made up of data block, data block is made of frame, each frame comprises synchronizing frame head B pulse, comprising: hopping edge detecting unit, counting unit, first determining unit, second determining unit, the 3rd determining unit and the 4th determining unit;
Described hopping edge detecting unit is used for that the hopping edge is carried out in the synchronizing frame head B pulse of the voice data that receives and detects, and when detecting the hopping edge of synchronizing frame head B pulse, notifies described counting unit;
Described counting unit is used for counting by the receiving terminal system clock according to detected hopping edge;
Described first determining unit, be used to calculate first hopping edge during second hopping edge count value and the count value during three hopping edges, second hopping edge to the and value, as first count value; And calculate count value during three hopping edges, second hopping edge to the and the 3rd hopping edge to the forth jump become along during count value and value, as second count value; And calculate the 3rd hopping edge to the forth jump become along during count value and the forth jump become along become to the fifth jump along during count value and value, as the 3rd count value; Described first hopping edge, described second hopping edge, described the 3rd hopping edge, described the forth jump become the edge and described the fifth jump change edge is the hopping edge of described synchronizing frame head B pulse;
Described second determining unit, be used for absolute value when 2 times difference of described first count value and described second count value smaller or equal to 1, and the absolute value of the difference of described first count value and described the 3rd count value determines that smaller or equal to 1 o'clock described synchronizing frame head B pulse is correct; Otherwise, determine that described synchronizing frame head B pulse is incorrect;
Described the 3rd determining unit is used for when definite described synchronizing frame head B pulse is correct the size of more described first count value and described the 3rd count value; And with less in described first count value and described the 3rd count value count value divided by 4, obtain and the corresponding count value of transmitting terminal clock-pulse width;
Described the 4th determining unit is used for according to the corresponding count value of described transmitting terminal clock-pulse width, determines the corresponding moment at its half calculated value, with the described corresponding described audio data sampling point position that constantly is defined as.
Described second determining unit also is used for when definite described synchronizing frame head B pulse is incorrect, abandons the affiliated data block of described synchronizing frame head B pulse.
Beneficial effect of the present invention is as follows:
The embodiment of the invention provides the method and the device of the sampling point position of accordatura audio data really, at receiving end the hopping edge is carried out in the synchronizing frame head B pulse in the voice data that receives and detects, and according to detected hopping edge, count by the receiving terminal system clock; Determine this synchronizing frame head B pulse first, corresponding first count value, second count value and the 3rd count value during second and the 3rd the adjacent in the same way hopping edge; According to the numerical relation that satisfies between first count value, second count value and the 3rd count value, determine that correctly whether this synchronizing frame head B pulse; According to the relation between synchronizing frame head B pulse width and the transmitting terminal clock-pulse width, determine and the corresponding count value of transmitting terminal clock-pulse width when correct; According to the corresponding count value of transmitting terminal clock-pulse width, determine in the corresponding moment of its half calculated value, should correspondence be defined as audio data sampling point position constantly; When incorrect, abandon the affiliated data block of this synchronizing frame head B pulse.Pulse detects to synchronizing frame head B owing to the inventive method, has determined sampling point position accurately before to the data sampling, therefore, avoided loss of data, and only pulse detects the inventive method to synchronizing frame head B, and pulse does not detect to data, has reduced power consumption.
Embodiment
The embodiment of the invention provides a kind of method of definite audio data sampling point position, comprising:
The hopping edge is carried out in synchronizing frame head B pulse in the voice data that receives detect, and, count by the receiving terminal system clock according to detected hopping edge;
Determine synchronizing frame head B pulse first, corresponding first count value, second count value and the 3rd count value during second and the 3rd the adjacent in the same way hopping edge;
According to the numerical relation that satisfies between first count value, second count value and the 3rd count value, determine whether synchronizing frame head B pulse is correct;
When determining that synchronizing frame head B pulse is correct,, determine and the corresponding count value of transmitting terminal clock-pulse width according to the relation between synchronizing frame head B pulse width and the transmitting terminal clock-pulse width;
According to the corresponding count value of transmitting terminal clock-pulse width, determine the corresponding moment at its half calculated value, should correspondence be defined as audio data sampling point position constantly;
When definite synchronizing frame head B pulse is incorrect, abandon the affiliated data block of synchronizing frame head B pulse.
Below in conjunction with accompanying drawing said method of the present invention is described in detail.
Figure 4 shows that the process flow diagram of determining the method for audio data sampling point position in the embodiment of the invention, comprising:
Step S401, receiving end receive through the synchronizing frame head B pulse in the asynchronous string shape voice data behind the two-way mark coding.
Receiving end uses a system clock SCLK, and needing this system clock usually is that the data sending terminal clock frequency is more than 3 times, to guarantee the accuracy and the security of sampled data.With regard to present system, generally adopt the above clock frequency of 20MHz to satisfy the demands.
Figure 5 shows that synchronizing frame head B pulse synoptic diagram in the embodiment of the invention.
When voice data being carried out the two-way mark coding, the coded format of synchronizing frame head B pulse has two kinds of forms according to its last position for " 0 " or " 1 ", correspondence is respectively 11101000 or 00010111, when last position of synchronizing frame head B pulse is " 0 ", follow-up first data bit is " 1 ", when last position of synchronizing frame head B pulse was " 1 ", follow-up first data bit was " 0 ".
As seen, synchronizing frame head B pulse has following feature:
When 1, entering synchronizing frame head B pulse, a saltus step appears in the level value of pulse.For a kind of form, the situation of " 1 " appears being jumped to by " 0 "; For another kind of form, the situation of " 0 " appears being jumped to by " 1 ".
When 2, withdrawing from synchronizing frame head B pulse, a saltus step appears in the level value of pulse.For a kind of form, the situation of " 1 " appears being jumped to by " 0 "; For another kind of form, the situation of " 0 " appears being jumped to by " 1 ".
3, the 4th of synchronizing frame head B pulse the opposite with the 5th bit data, a saltus step appears in the level value of pulse this moment.For a kind of form, the situation of " 1 " appears being jumped to by " 0 "; For another kind of form, the situation of " 0 " appears being jumped to by " 1 ".
4, the 3rd of synchronizing frame head B pulse the opposite with the 4th bit data, a saltus step appears in the level value of pulse this moment.For a kind of form, the situation of " 0 " appears being jumped to by " 1 "; For another kind of form, the situation of " 1 " appears being jumped to by " 0 ".
5, the 5th of synchronizing frame head B pulse the opposite with the 6th bit data, a saltus step appears in the level value of pulse this moment.For a kind of form, the situation of " 0 " appears being jumped to by " 1 "; For another kind of form, the situation of " 1 " appears being jumped to by " 0 ".
The embodiment of the invention is promptly utilized the above-mentioned feature of synchronizing frame head B pulse, judges whether the synchronizing frame head B pulse of current block is correct.
Step S402, when receiving end receives the new block of in the voice data one, the hopping edge is carried out in the synchronizing frame head B pulse of this block to be detected, promptly pulse detects to synchronizing frame head B, when the level value that detects synchronizing frame head B pulse by " 0 " saltus step for " 1 " or by " 1 " saltus step when " 0 ", promptly think the hopping edge that detects synchronizing frame head B pulse.
Step S403, detect each hopping edge, during per two adjacent hopping edges, count according to the system clock frequency of receiving end; Obtain the count value during per two adjacent hopping edges.
Step S404, determine synchronizing frame head B pulse first, the corresponding first count value X1, the second count value X2 and the 3rd count value X3 during second and the 3rd the adjacent in the same way hopping edge.
Step S403 and step S404 are specially:
When detecting first hopping edge, begin counting, according to the clock frequency of receiving end, whenever receive a clock trigger signal, then count value adds 1, when detecting follow-up second hopping edge, obtain the count value A1 of first hopping edge during second hopping edge, and preserve count value A1;
When detecting second hopping edge, restart counting, when detecting follow-up the 3rd hopping edge, obtain the count value A2 during three hopping edges, second hopping edge to the, and preserve count value A2;
Count value A1 and count value A2 and, obtain during these two adjacent in the same way hopping edges, three hopping edges, first hopping edge to the, just corresponding count value X1 during first adjacent in the same way hopping edge;
When detecting the 3rd hopping edge, restart counting, up to detect follow-up the forth jump become along the time, obtain the 3rd hopping edge to the forth jump become along during count value A3, and preserve count value A3;
Count value A2 and count value A3 and, obtain second hopping edge and become during these two the adjacent in the same way hopping edges, just corresponding count value X2 during second adjacent in the same way hopping edge to the forth jump;
When detect the forth jump become along the time, restart counting, up to detect follow-up the fifth jump become along the time, obtain the forth jump become along become to the fifth jump along during count value A4, and preserve count value A4;
Count value A3 and count value A4 and, obtain the 3rd hopping edge and become during these two the adjacent in the same way hopping edges, just corresponding count value X3 during the 3rd adjacent in the same way hopping edge to the fifth jump.
Can adopt three counters to realize above-mentioned functions when particular hardware realizes, implementation method is as follows:
When detecting first hopping edge, first counter is carried out zero clearing, begin counting, clock frequency according to receiving end, whenever receive a clock trigger signal, then the count value of first counter adds 1, when detecting second hopping edge, obtain the count value A1 of first hopping edge during second hopping edge, and send this count value A1 to second counter.
Simultaneously, when detecting second hopping edge, after sending count value A1 to second counter,, restart counting, when detecting the 3rd hopping edge, obtain the count value A2 during three hopping edges, second hopping edge to the first counter O reset.
Calculate the count value A2 that first counter obtains and the count value A1 sum of second counter storage by the 3rd counter, obtain corresponding count value X1 during first adjacent in the same way hopping edge.
Then, the count value A2 that first counter is obtained sends to behind second counter first counter O reset, restarts counting, up to detect the forth jump become along the time, obtain the 3rd hopping edge to the forth jump become along during count value A3.
Calculate the count value A3 that first counter obtains and the count value A2 sum of second counter storage by the 3rd counter, obtain corresponding count value X2 during second adjacent in the same way hopping edge.
Then, the count value A3 that first counter is obtained sends to behind second counter first counter O reset, restarts counting, up to detect the fifth jump become along the time, obtain the forth jump become along become to the fifth jump along during count value A4.
Calculate the count value A4 that first counter obtains and the count value A3 sum of second counter storage by the 3rd counter, obtain corresponding count value X3 during the 3rd the adjacent in the same way hopping edge.
Step S405, according to the numerical relation that satisfies between count value X1, X2 and the X3, determine whether synchronizing frame head B pulse correct.
According to as shown in Figure 5 synchronizing frame head B pulse as can be known, synchronizing frame head B pulse width (each hopping edge that is synchronizing frame head B pulse is to the width between its corresponding next hopping edge) has following relation with the transmitting terminal clock-pulse width: first pulse of synchronizing frame head B (preceding 3 " 111 " or " 000 " of corresponding its coding) width comprises 3 transmitting terminal clock-pulse widths; Second pulse of synchronizing frame head B (the 4th " 0 " or " 1 " of corresponding its coding) width comprises 1 transmitting terminal clock-pulse width; The 3rd pulse of synchronizing frame head B (the 5th " 1 " or " 0 " of corresponding its coding) width comprises 1 transmitting terminal clock-pulse width; The 4th pulse of synchronizing frame head B (back three " 000 " or " 111 " of corresponding its coding) width, comprise 3 transmitting terminal clock-pulse widths, therefore, when the count value of supposing corresponding transmitting terminal clock-pulse width was W, the count values in four synchronizing frame head B pulse width range were respectively: 3W, 1W, 1W and 3W.
Accordingly, corresponding during the adjacent in the same way hopping edge of first of synchronizing frame head B pulse is first and second pulse (corresponding its encode preceding 4 " 1110 " or " 0001 ") of synchronizing frame head B, the corresponding first count value X1; Correspondence is second and the 3rd pulse (corresponding its encode the 4th and the 5th " 01 " or " 10 ") of synchronizing frame head B during second adjacent in the same way hopping edge of synchronizing frame head B pulse, the corresponding second count value X2; Correspondence is the 3rd and the 4th pulse (corresponding its encode back 4 " 1000 " or " 0111 ") of synchronizing frame head B during the 3rd the adjacent in the same way hopping edge of synchronizing frame head B pulse, corresponding the 3rd count value X3, therefore, the first count value X1, the second count value X2 and the 3rd count value X3 are respectively 4W, 2W and 4W.
Because the system clock frequency of receiving end and the system clock frequency of transmitting terminal may not be the integral multiple relations, therefore, not to equate fully mutually between the X1 that when counting, is obtained, 2 times X2 and the X3, may have error smaller or equal to 1 according to the system clock frequency of receiving end.
Based on above-mentioned principle, whether the embodiment of the invention judges the absolute value of 2 times difference of the first count value X1 and the second count value X2 smaller or equal to 1, and whether the absolute value of the difference of the first count value X1 and the 3rd count value X3 is smaller or equal to 1.
If satisfy above-mentioned condition, promptly the absolute value of 2 times the difference of the first count value X1 and the second count value X2 is smaller or equal to 1, and the absolute value of the difference of the first count value X1 and the 3rd count value X3 determines then that smaller or equal to 1 synchronizing frame head B is correct;
Otherwise, determine that synchronizing frame head B is incorrect.
Step S406, when definite synchronizing frame head B pulse is correct, according to the relation between synchronizing frame head B pulse width and the transmitting terminal clock-pulse width, determine and the corresponding count value W of transmitting terminal clock-pulse width.
In the embodiment of the invention, when definite synchronizing frame head B is correct, because the first count value X1 and the 3rd count value X3 are 4W, consider as far as possible not obliterated data simultaneously, relatively the size of the first count value X1 and the 3rd count value X3 is selected a wherein less count value, and this count value of storing in the register is moved to right 2, promptly be equivalent to this count value divided by 4, the result is the corresponding count value W of transmitting terminal clock-pulse width;
Step S407, according to the corresponding count value W of transmitting terminal clock-pulse width, determine half calculated value of count value W corresponding constantly, should correspondence be defined as audio data sampling point position constantly.
Step S408, when definite synchronizing frame head B is incorrect, abandon the block under this synchronizing frame head B.
Based on same inventive concept, the method of the sampling point position of accordatura audio data really is provided according to the above embodiment of the present invention, correspondingly, the embodiment of the invention also provides a kind of device of definite audio data sampling point position, the apparatus structure synoptic diagram comprises as shown in Figure 6: hopping edge detecting unit 601, counting unit 602, first determining unit 603, second determining unit 604, the 3rd determining unit 605 and the 4th determining unit 606;
Hopping edge detecting unit 601 is used for that the hopping edge is carried out in the synchronizing frame head B pulse of the voice data that receives and detects, and when detecting the hopping edge of synchronizing frame head B pulse, notifications count unit 602;
Counting unit 602 is used for counting by the receiving terminal system clock according to detected hopping edge;
First determining unit 603, be used for determining synchronizing frame head B pulse first, corresponding first count value, second count value and the 3rd count value during second and the 3rd the adjacent in the same way hopping edge;
Second determining unit 604 is used for determining according to numerical relation satisfied between first count value, second count value and the 3rd count value whether synchronizing frame head B pulse is correct;
The 3rd determining unit 605 is used for when definite synchronizing frame head B pulse is correct, according to the relation between synchronizing frame head B pulse width and the transmitting terminal clock-pulse width, determines and the corresponding count value of transmitting terminal clock-pulse width;
The 4th determining unit 606 is used for according to the corresponding count value of transmitting terminal clock-pulse width, determines the corresponding moment at its half calculated value, should correspondence be defined as audio data sampling point position constantly.
Above-mentioned second determining unit 604 also is used for when definite synchronizing frame head B pulse is incorrect, abandons the affiliated data block of this synchronizing frame head B pulse.
Above-mentioned first determining unit 603 as shown in Figure 7, further comprises: obtain subelement 701, storing sub-units 702 and computation subunit 703;
Obtain subelement 701, be used to obtain the count value during two adjacent hopping edges of synchronizing frame head B pulse, and send storing sub-units 702 and computation subunit 703 to;
Storing sub-units 702 is used to store the count values of obtaining subelement 701 the last transmission;
Computation subunit 703 is used to calculate the count value of storing sub-units 702 storages and obtain subelement 701 these count value sums that get access to, as the corresponding count value during two adjacent in the same way hopping edges of synchronizing frame head B pulse.
Above-mentioned second determining unit 604 as shown in Figure 8, further comprises: first relatively subelement 801, determine subelement 802;
First subelement 801 relatively is used to calculate the absolute value of 2 times difference of first count value and second count value, and the absolute value that calculates the difference of first count value and the 3rd count value, and relatively this absolute value whether smaller or equal to 1;
Determine subelement 802, be used for when this absolute value smaller or equal to 1 the time, determine that synchronizing frame head B pulse is correct; Otherwise, determine that synchronizing frame head B pulse is incorrect, abandon the affiliated data block of this synchronizing frame head B pulse.
Above-mentioned the 3rd determining unit 605 as shown in Figure 9, further comprises: second compares subelement 901 and computation subunit 902;
Second compares subelement 901, is used for the size of comparison first count value and the 3rd count value;
Computation subunit 902 is used for the count value that first count value and the 3rd count value is less divided by 4, obtains and the corresponding count value of transmitting terminal clock-pulse width.
Determine method and apparatus according to above-mentioned audio data sampling point position, the embodiment of the invention provides a kind of concrete realization circuit, and its circuit block diagram as shown in figure 10.
The edge is carried out in the synchronizing frame head B pulse of voice data of input detect 1001, whenever detect impulse hits along the time, counter of notifications 1002 zero clearings, begin counting, when detecting follow-up next hopping edge, counter 1002 sends current count value to counter 1003 sum counters 1004, restart counting then, the last count value of counter 1003 memory counters 1002, the count value of the current count value sum counter 1003 of counter 1004 computing counters 1002 and, by counter 1002, the continuous counting and the calculating of counter 1003 sum counters 1004, successively obtain the first count value X1, the second count value X2 and the 3rd count value X3, obtain being stored in the register 1005 behind the first count value X1, the second count value X2 that obtains was moved to left after 1 1006 (being equivalent to multiply by 2), in equality comparator 1007, equate relatively with the count value X1 of register 1005 storages, the 3rd count value X3 that will obtain again equates in equality comparator 1007 relatively with the first count value X1 of register 1005 storages, because above-mentioned twice equates relatively to carry out in the different time, therefore only need to use an equality comparator 1007 promptly can realize equating for twice relatively, according to comparative result, when the absolute value of 2 times the difference of the first count value X1 and the second count value X2 smaller or equal to 1, and the absolute value of the difference of first count value X1 and the 3rd count value X3 was smaller or equal to 1 o'clock, equality comparator 1007 judges that synchronizing frame head B is correct, the first count value X1 and the 3rd count value X3 are got minimum value 1008, again this value is moved to right 2 (being equivalent to divided by 4), obtain count value W, the absolute value of difference that deducts 2 times the second count value X2 as the first count value X1 is not below or equal to 1, or first the count value X1 absolute value that deducts the difference of the 3rd count value X3 be not below or equal to 1 o'clock, equality comparator 1007 judges that synchronizing frame head B is incorrect, abandons the affiliated block of this synchronizing frame head B.
In sum, the scheme that the embodiment of the invention provides, receiving end to synchronizing frame head B pulse carry out the hopping edge and detect, and, count by the receiving terminal system clock according to detected hopping edge; Determine count value corresponding during per two the adjacent in the same way hopping edges of this synchronizing frame head B pulse; Determine according to this count value whether this synchronizing frame head B pulse is correct; When correct, according to the relation between this count value and synchronizing frame head B pulse width and the transmitting terminal clock-pulse width, determine and the corresponding count value of transmitting terminal clock-pulse width, according to this count value determine its half calculated value corresponding constantly, should correspondence be defined as audio data sampling point position constantly; When incorrect, abandon the affiliated data block of this synchronizing frame head B pulse.Adopt method provided by the invention and device, solved loss of data and the big problem of power consumption in the prior art.
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.