CN102082633B - Method and device for positioning adaptive multi-rate (AMR) frame header, and player - Google Patents

Method and device for positioning adaptive multi-rate (AMR) frame header, and player Download PDF

Info

Publication number
CN102082633B
CN102082633B CN201010613720.7A CN201010613720A CN102082633B CN 102082633 B CN102082633 B CN 102082633B CN 201010613720 A CN201010613720 A CN 201010613720A CN 102082633 B CN102082633 B CN 102082633B
Authority
CN
China
Prior art keywords
amr
frame
byte
standard regulation
type
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN201010613720.7A
Other languages
Chinese (zh)
Other versions
CN102082633A (en
Inventor
罗朝飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Device Co Ltd
Original Assignee
Huawei Device Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Device Co Ltd filed Critical Huawei Device Co Ltd
Priority to CN201010613720.7A priority Critical patent/CN102082633B/en
Publication of CN102082633A publication Critical patent/CN102082633A/en
Application granted granted Critical
Publication of CN102082633B publication Critical patent/CN102082633B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Signal Processing For Digital Recording And Reproducing (AREA)

Abstract

The embodiment of the invention discloses a method and a device for positioning an adaptive multi-rate (AMR) frame header, and a player and belongs to the field of AMR coding. The method comprises the following steps of: reading one byte of an AMR file randomly; judging whether bits identifying a frame type specified by an AMR standard in the read byte are the frame type specified by the AMR standard or not; and if the bits identifying the frame type specified by the AMR standard in the read byte are the frame type specified by the AMR standard, determining that the byte is the frame header. The device comprises a reading module, a judgment module and a positioning module. The player comprises a processor. According to the steps of the method, the frame header can be positioned from any position of the AMR file; the player adopting the frame header positioning technology can be played from any position; and the user experience is good.

Description

Method and apparatus and the player of AMR frame head location
Technical field
The present invention relates to AMR(Adaptive Multi-Rate, adaptive multi-rate) coding field, particularly method and apparatus and the player of a kind of AMR frame head location.
Background technology
AMR is by 3GPP(The Third Generation Partnership Project, third generation partner program) be absorbed as standard, be mainly used in following WCDMA(Wideband Code Division Multiple Access, Wideband Code Division Multiple Access (WCDMA)) mobile communication system.
AMR file comprises file header and the unfixed frame of some length, and a frame comprises the frame head of a byte and the frame data of corresponding length.Universal search algorithm needs locating frame head, must start locating frame head from file header at present, and detailed process comprises:
Read the file header of AMR file, first byte after file header is frame head, reads this frame head, and determines frame length according to the frame type of this frame head, reads the frame data with the corresponding length of this frame type, and frame data are decoded.
In realizing process of the present invention, inventor finds that prior art at least exists following problem:
Existing AMR frame head targeting scheme must start locating frame head from the file header of AMR file, if from the optional position of AMR file, and can not locating frame head.
Summary of the invention
For the optional position from AMR file starts to carry out frame head location, the embodiment of the present invention provides method and apparatus and the player of a kind of AMR frame head location.Described technical scheme is as follows:
A method for AMR frame head location, described method comprises:
Natural number q=0 is set, and q represents the number of frames for AMR frame head location;
Read arbitrarily a byte in adaptive multi-rate AMR file;
In the byte that judgement is read, whether the position of the identification frames type of AMR standard regulation is the frame type of AMR standard regulation;
If the frame type of AMR standard regulation increases by 1 by q;
Judge whether q reaches preset value, if q reaches preset value, determine that described byte is frame head.
A device for AMR frame head location, described device comprises:
First arranges module, and for natural number q=0 is set, q represents the number of frames for AMR frame head location;
Read module, for reading arbitrarily byte of adaptive multi-rate AMR file;
Judge module, for judging the byte reading, whether the position of the identification frames type of AMR standard regulation is the frame type of AMR standard regulation;
Locating module, for if the frame type of AMR standard regulation increases by 1 by q; Judge whether q reaches preset value, if q reaches preset value, determine that described byte is frame head.
The beneficial effect that the technical scheme that the embodiment of the present invention provides is brought is: by reading arbitrarily a byte in AMR file, in the byte that judgement is read, whether the position of the identification frames type of AMR standard regulation is the frame type of AMR standard regulation, if the frame type of AMR standard regulation, determine that this byte is frame head, thereby realized, from the optional position of AMR file, start to carry out frame head location.
Accompanying drawing explanation
Fig. 1 is the method flow diagram of the AMR frame head location that provides in the embodiment of the present invention 1;
Fig. 2 is the method flow diagram of the AMR frame head location that provides in the embodiment of the present invention 2;
Fig. 3 is the apparatus structure schematic diagram of the AMR frame head location that provides in the embodiment of the present invention 3;
Fig. 4 is another structural representation of device of the AMR frame head location that provides in the embodiment of the present invention 3;
Fig. 5 is the player structure schematic diagram providing in the embodiment of the present invention 4.
Embodiment
For making the object, technical solutions and advantages of the present invention clearer, below in conjunction with accompanying drawing, embodiment of the present invention is described further in detail.
Embodiment 1
Referring to Fig. 1, the present embodiment provides the method for a kind of AMR frame head location, comprising:
101: read arbitrarily a byte in AMR file;
Wherein, a byte comprises 8 bit positions.
102: in the byte that judgement is read, whether the position of the identification frames type of AMR standard regulation is the frame type of AMR standard regulation;
Wherein, the position of the identification frames type of AMR standard regulation comprises 4 bit positions at present, and referring to table 1, the 4-7 position of little-endian in frame head binary representation (table 1 underscore sign) is the position of the identification frames type of AMR standard regulation.
103: if the frame type of AMR standard regulation determines that this byte is frame head.
Further, the method for this AMR frame head location also comprises: read AMR standard regulation with the hardwood data corresponding length of this hardwood type.
Further, read arbitrarily in AMR file before a byte, natural number q=0 can also be set, q represents that this step specifically comprises for the number of frames of AMR frame head location:
If the frame type of AMR standard regulation increases by 1 by q; Judge whether q reaches preset value, if q reaches preset value, determine that byte is frame head.If q does not reach preset value, read next bytes AMR standard regulation and the frame data corresponding length of frame type; Again perform step 102.
Q can be random natural number, when q=1, as long as judgment result is that is once the frame type of AMR standard regulation, determine that this byte is frame head, thereby complete frame head location, but the accuracy of location is lower, during q=2, just can reach 75% accuracy, during q=3, just can reach 87.5% accuracy, during q=4, just can reach more than 93% accuracy, during q=5, just can reach more than 96% accuracy, q is larger, number of frames for AMR frame head location is more, also the number of times of location is more continuously, frame head correct localization is higher, therefore, q when practical application in general 3 to 5 scopes can meet the demands.
The present embodiment is by reading arbitrarily a byte in AMR file, in the byte that judgement is read, whether the position of the identification frames type of AMR standard regulation is the frame type of AMR standard regulation, if the frame type of AMR standard regulation, determine that this byte is frame head, thereby realized, from the optional position of AMR file, start to carry out frame head location, further, the player of applying this frame head location technology can start from optional position to play, user experiences, and can, by a plurality of frames are judged continuously, improve the accuracy of frame head location.
Embodiment 2
The present embodiment improves based on embodiment 1, and referring to Fig. 2, the method for a kind of AMR frame head location that the present embodiment provides, comprising:
201: natural number p=0 is set, natural number q=0;
Wherein, the byte that p represents to read from AMR file, the position of the identification frames type of AMR standard regulation is not the byte quantity of the frame type of AMR standard regulation.Q represents the number of frames for AMR frame head location.
202: read arbitrarily a byte in AMR file;
Wherein, AMR file comprises file header and the unfixed frame of some length, and a frame comprises the frame head of a byte and the frame data of corresponding length, and corresponding, frame length is the byte quantity that comprises a frame of frame head and frame data.Concrete, referring to table 1, AMR standard is supported 8 kinds of frames, the 4-7 position of little-endian in frame head binary representation (table 1 underscore sign) is the position of the identification frames type of AMR standard regulation, frame length corresponding to dissimilar frame in other words frame sign is different, for example, the maximum frame size of AMR standard support is 32, i.e. the frame length of frame type 0111 correspondence.
Table 1
203: in the byte that judgement is read, whether the position of the identification frames type of AMR standard regulation is the frame type of AMR standard regulation;
Concrete, if judgment result is that it is the frame type of AMR standard regulation, execution step 204, if judgment result is that the frame type that is not AMR standard regulation, execution step 207;
204: if judgment result is that it is the frame type of AMR standard regulation, q is increased to 1;
205: judge whether q reaches preset value;
Concrete, if q reaches preset value, determine that this byte is frame head, complete frame head location, flow process finishes; If q does not reach preset value, execution step 206.
Further, q can be random natural number, when q=1, as long as judgment result is that is once the frame type of AMR standard regulation, determine that this byte is frame head, thereby complete frame head location, but the accuracy of location is lower, during q=2, just can reach 75% accuracy, during q=3, just can reach 87.5% accuracy, during q=4, just can reach more than 93% accuracy, during q=5, just can reach more than 96% accuracy, q is larger, number of frames for AMR frame head location is more, also the number of times of location is more continuously, frame head correct localization is higher, therefore, q when practical application in general 3 to 5 scopes can meet the demands.
206: read next bytes AMR standard regulation and the frame data corresponding length of this frame type, and again perform step 203;
Further, can also read AMR standard regulation and the frame data corresponding length of this frame type, and the frame data that read are decoded.
207: if judgment result is that the frame type that is not AMR standard regulation, q=0 is set, p is increased to 1, and read the next byte that this reads arbitrarily byte;
208: judge whether p is less than or equal to the maximum frame size that AMR standard is supported, if so, execution step 203, if not, and frame head location mistake, flow process finishes;
Wherein, the maximum frame size of AMR standard support is 32 at present.
The present embodiment is by reading arbitrarily a byte in AMR file, in the byte that judgement is read, whether the position of the identification frames type of AMR standard regulation is the frame type of AMR standard regulation, if the frame type of AMR standard regulation, determine that this byte is frame head, thereby realized, from the optional position of AMR file, start to carry out frame head location, further, the player of applying this frame head location technology can start from optional position to play, user experiences, and can, by a plurality of frames are judged continuously, improve the accuracy of frame head location.
Embodiment 3
Referring to Fig. 3, the present embodiment provides the device of a kind of AMR frame head location, comprising:
Read module 301, for reading arbitrarily byte of adaptive multi-rate AMR file;
Judge module 302, for judging the byte reading, whether the position of the identification frames type of AMR standard regulation is the frame type of AMR standard regulation;
Locating module 303, for if the frame type of AMR standard regulation determines that this byte is frame head.
Further, referring to Fig. 4, this device also comprises:
First arranges module 304, before carrying out read module 301, natural number q=0 is set, and q represents the number of frames for AMR frame head location;
Locating module 303, specifically for if the frame type of AMR standard regulation increases by 1 by q; Judge whether q reaches preset value, if q reaches preset value, determine that this byte is frame head.
Q can be random natural number, when q=1, as long as judgment result is that is once the frame type of AMR standard regulation, determine that this byte is frame head, thereby complete frame head location, but the accuracy of location is lower, during q=2, just can reach 75% accuracy, during q=3, just can reach 87.5% accuracy, during q=4, just can reach more than 93% accuracy, during q=5, just can reach more than 96% accuracy, q is larger, number of frames for AMR frame head location is more, also the number of times of location is more continuously, frame head correct localization is higher, therefore, q when practical application in general 3 to 5 scopes can meet the demands.
Further, this device also comprises:
Loop module, after judging whether q reaches preset value, if q does not reach preset value, reads next bytes AMR standard regulation and the frame data corresponding length of this frame type; Again carry out judge module 302.
Further, this device also comprises:
Second arranges module 305, before carrying out read module 301, natural number p=0 is set, and the byte that p represents to read from AMR file, the position of the identification frames type of AMR standard regulation is not the byte quantity of the frame type of AMR standard regulation;
The second judge module 306, after carrying out judge module 302, the frame type if not AMR standard regulation, arranges natural number q=0, and q represents the number of frames for AMR frame head location, and p is increased to 1, and reads the next byte that this reads arbitrarily byte; Judge whether p is less than or equal to the maximum frame size that AMR standard is supported, if p is less than or equal to the maximum frame size that AMR standard is supported, then carry out judge module 302, if p is greater than the maximum frame size that AMR standard is supported, frame head location mistake.
The device that the present embodiment provides can be specifically player or the processor that is built in player, belongs to same design with square embodiment, and its specific implementation process refers to embodiment of the method, repeats no more here.
The present embodiment is by reading arbitrarily a byte in AMR file, in the byte that judgement is read, whether the position of the identification frames type of AMR standard regulation is the frame type of AMR standard regulation, if the frame type of AMR standard regulation, determine that this byte is frame head, thereby realized, from the optional position of AMR file, start to carry out frame head location, further, the player of applying this frame head location technology can start from optional position to play, user experiences, and can, by a plurality of frames are judged continuously, improve the accuracy of frame head location.
Embodiment 4
Referring to Fig. 5, the present embodiment provides a kind of player, and this player comprises processor 401, for
Read arbitrarily a byte in adaptive multi-rate AMR file;
In the byte that judgement is read, whether the position of the identification frames type of AMR standard regulation is the frame type of AMR standard regulation;
If the frame type of AMR standard regulation determines that byte is frame head.
Further, processor 401, also for
Read arbitrarily in adaptive multi-rate AMR file before a byte, natural number q=0 is set, q represents the number of frames for AMR frame head location;
If the frame type of AMR standard regulation determines that byte is that frame head comprises:
If the frame type of AMR standard regulation increases by 1 by q;
Judge whether q reaches preset value, if q reaches preset value, determine that byte is frame head;
If q does not reach preset value, read next bytes AMR standard regulation and the frame data corresponding length of frame type;
Again carry out and judge whether the position of the identification frames type of AMR standard regulation in the byte reading is the step of the frame type of AMR standard regulation.
Q can be random natural number, when q=1, as long as judgment result is that is once the frame type of AMR standard regulation, determine that this byte is frame head, thereby complete frame head location, but the accuracy of location is lower, during q=2, just can reach 75% accuracy, during q=3, just can reach 87.5% accuracy, during q=4, just can reach more than 93% accuracy, during q=5, just can reach more than 96% accuracy, q is larger, number of frames for AMR frame head location is more, also the number of times of location is more continuously, frame head correct localization is higher, therefore, q when practical application in general 3 to 5 scopes can meet the demands.
Further, processor 401, also for
Read arbitrarily in AMR file before a byte, natural number p=0 is set, the byte that p represents to read from AMR file, the position of the identification frames type of AMR standard regulation is not the byte quantity of the frame type of AMR standard regulation;
In the byte that judgement is read, whether the position of the identification frames type of AMR standard regulation is that the frame type that AMR standard is stipulated comprises afterwards:
If the position of the identification frames type of AMR standard regulation is not the frame type of AMR standard regulation in the byte reading, natural number q=0 is set, q represents the number of frames for AMR frame head location, and p is increased to 1, and reads the next byte that reads arbitrarily byte;
Judge whether p is less than or equal to the maximum frame size that AMR standard is supported, if p is less than or equal to the maximum frame size that AMR standard is supported, carry out and judge whether the position of the identification frames type of AMR standard regulation in the byte reading is the step of the frame type of AMR standard regulation, if p is greater than the maximum frame size that AMR standard is supported, frame head location mistake.
The player that the present embodiment provides and embodiment of the method belong to same design, and its specific implementation process refers to embodiment of the method, repeats no more here.
The player that the present embodiment provides, its processor is by reading arbitrarily a byte in AMR file, in the byte that judgement is read, whether the position of the identification frames type of AMR standard regulation is the frame type of AMR standard regulation, if the frame type of AMR standard regulation, determine that this byte is frame head, realized and from the optional position of AMR file, started to carry out frame head location, thereby can start from optional position to play, user experiences, and can, by a plurality of frames are judged continuously, improve the accuracy of frame head location.
All or part of content in the technical scheme that above embodiment provides can realize by software programming, and its software program is stored in the storage medium can read, storage medium for example: the hard disk in computer, CD or floppy disk.
The foregoing is only preferred embodiment of the present invention, in order to limit the present invention, within the spirit and principles in the present invention not all, any modification of doing, be equal to replacement, improvement etc., within all should being included in protection scope of the present invention.

Claims (6)

1. a method for AMR frame head location, is characterized in that, described method comprises:
Natural number q=0 is set, and q represents the number of frames for AMR frame head location;
Read arbitrarily a byte in adaptive multi-rate AMR file;
In the byte that judgement is read, whether the position of the identification frames type of AMR standard regulation is the frame type of AMR standard regulation;
If the frame type of AMR standard regulation increases by 1 by q;
Judge whether q reaches preset value, if q reaches preset value, determine that described byte is frame head.
2. method according to claim 1, is characterized in that, the described q of judgement comprises after whether reaching preset value:
If q does not reach preset value, read next bytes AMR standard regulation and the frame data corresponding length of described frame type;
Whether the position of carrying out the identification frames type of AMR standard regulation in the byte that described judgement reads is the step of the frame type of AMR standard regulation.
3. method according to claim 1, is characterized in that, described reading arbitrarily in AMR file comprises before a byte:
Natural number p=0 is set, and the byte that p represents to read from AMR file, the position of the identification frames type of AMR standard regulation is not the byte quantity of the frame type of AMR standard regulation;
In the byte that described judgement is read, whether the position of the identification frames type of AMR standard regulation is that the frame type that AMR standard is stipulated comprises afterwards:
Frame type if not AMR standard regulation, arranges natural number q=0, and q represents the number of frames for AMR frame head location, and p is increased to 1, and reads the described next byte that reads arbitrarily byte;
Judge whether p is less than or equal to the maximum frame size that AMR standard is supported, if p is less than or equal to the maximum frame size that AMR standard is supported, whether the position of carrying out the identification frames type of AMR standard regulation in the byte that described judgement reads is the step of the frame type of AMR standard regulation, if p is greater than the maximum frame size that AMR standard is supported, frame head location mistake.
4. a device for AMR frame head location, is characterized in that, described device comprises:
First arranges module, and for natural number q=0 is set, q represents the number of frames for AMR frame head location;
Read module, for reading arbitrarily byte of adaptive multi-rate AMR file;
Judge module, for judging the byte reading, whether the position of the identification frames type of AMR standard regulation is the frame type of AMR standard regulation;
Locating module, for if the frame type of AMR standard regulation increases by 1 by q; Judge whether q reaches preset value, if q reaches preset value, determine that described byte is frame head.
5. device according to claim 4, is characterized in that, described device also comprises:
Loop module, after judging whether q reaches preset value, if q does not reach preset value, reads next bytes AMR standard regulation and the frame data corresponding length of described frame type; Again carry out described judge module.
6. device according to claim 4, is characterized in that, described device also comprises:
Second arranges module, before carrying out described read module, natural number p=0 is set, and the byte that p represents to read from AMR file, the position of the identification frames type of AMR standard regulation is not the byte quantity of the frame type of AMR standard regulation;
The second judge module, after carrying out described judge module, the frame type if not AMR standard regulation, arranges natural number q=0, and q represents the number of frames for AMR frame head location, and p is increased to 1, and reads the described next byte that reads arbitrarily byte; Judge whether p is less than or equal to the maximum frame size that AMR standard is supported, if p is less than or equal to the maximum frame size that AMR standard is supported, then carry out described judge module, if p is greater than the maximum frame size that AMR standard is supported, frame head location mistake.
CN201010613720.7A 2010-12-27 2010-12-27 Method and device for positioning adaptive multi-rate (AMR) frame header, and player Expired - Fee Related CN102082633B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201010613720.7A CN102082633B (en) 2010-12-27 2010-12-27 Method and device for positioning adaptive multi-rate (AMR) frame header, and player

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201010613720.7A CN102082633B (en) 2010-12-27 2010-12-27 Method and device for positioning adaptive multi-rate (AMR) frame header, and player

Publications (2)

Publication Number Publication Date
CN102082633A CN102082633A (en) 2011-06-01
CN102082633B true CN102082633B (en) 2014-04-16

Family

ID=44088396

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201010613720.7A Expired - Fee Related CN102082633B (en) 2010-12-27 2010-12-27 Method and device for positioning adaptive multi-rate (AMR) frame header, and player

Country Status (1)

Country Link
CN (1) CN102082633B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106095910B (en) * 2016-06-08 2018-01-19 广东欧珀移动通信有限公司 Label information analytic method, device and the terminal of a kind of audio file

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050226227A1 (en) * 2004-04-12 2005-10-13 Samsung Electronics Co., Ltd. Apparatus and method for processing voice packet data in a mobile communication system providing voice service using packet network
WO2006047339A2 (en) * 2004-10-22 2006-05-04 Marvell World Trade Ltd. Encoding and error correction system for enhanced performance of legacy communications networks
CN1964250B (en) * 2006-11-23 2010-04-14 华为技术有限公司 Data frame type identification method and device
CN101814973B (en) * 2010-01-29 2013-07-03 深圳市融创天下科技股份有限公司 RTP rapid packet accumulation method based on AMR audio frame

Also Published As

Publication number Publication date
CN102082633A (en) 2011-06-01

Similar Documents

Publication Publication Date Title
US9043549B2 (en) Memory storage apparatus, memory controller, and method for transmitting and identifying data stream
CN104272243B (en) Method and host apparatus for the execution of assessing trimming instruction
US9141537B2 (en) Magnetic random access memory journal
BRPI0918901B8 (en) “method and device for decoding transport block, and, method and device for iterative transport block decoding.”
CN102521349A (en) Pre-reading method of files
US8626323B2 (en) Method and apparatus for playing audio files
TWI691965B (en) Data processing device and operating method thereof
KR20120113853A (en) Memory controller, data processing method thereof, memory system having the same
WO2006071937A3 (en) System and method for efficient use of memory device bandwidth
WO2008131203A3 (en) Computer memory addressing mode employing memory segmenting and masking
WO2009158183A3 (en) Apparatus and method for cache utilization
US11061803B2 (en) Checking system, checking method and compiling method of system start-up file
US8055842B1 (en) Using raid with large sector size ATA mass storage devices
TW200512647A (en) System and method for authenticating software installation on different personal computers, associated computer system and associated computer-readable recording media
CN105280239A (en) Method and device for dynamically realizing ECC check codes of solid state drives
TW201917578A (en) Method for accessing flash memory module and associated flash memory controller and electronic device
CN102082633B (en) Method and device for positioning adaptive multi-rate (AMR) frame header, and player
US10331365B2 (en) Accessing a serial number of a removable non-volatile memory device
JP2009533763A (en) Multimedia card with large storage capacity
CN106201851A (en) The detection method of heap memory operation and device
CN107807870B (en) Method and system for testing power-down protection function of storage server mainboard
US20100262789A1 (en) Methods and Devices for Accessing a Memory and a Central Processing Unit Using the Same
CN101977231A (en) Method for downloading mapping file
US8516190B1 (en) Reporting logical sector alignment for ATA mass storage devices
US9671973B2 (en) Data storage in degraded solid state memory

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20140416

Termination date: 20161227

CF01 Termination of patent right due to non-payment of annual fee