CN106782573B - Method for generating AAC file through coding - Google Patents

Method for generating AAC file through coding Download PDF

Info

Publication number
CN106782573B
CN106782573B CN201611079228.XA CN201611079228A CN106782573B CN 106782573 B CN106782573 B CN 106782573B CN 201611079228 A CN201611079228 A CN 201611079228A CN 106782573 B CN106782573 B CN 106782573B
Authority
CN
China
Prior art keywords
data
bytes
aac
size
processed
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.)
Active
Application number
CN201611079228.XA
Other languages
Chinese (zh)
Other versions
CN106782573A (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.)
Beijing Kuwo Technology Co Ltd
Original Assignee
Beijing Kuwo Technology 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 Beijing Kuwo Technology Co Ltd filed Critical Beijing Kuwo Technology Co Ltd
Priority to CN201611079228.XA priority Critical patent/CN106782573B/en
Publication of CN106782573A publication Critical patent/CN106782573A/en
Application granted granted Critical
Publication of CN106782573B publication Critical patent/CN106782573B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G10MUSICAL INSTRUMENTS; ACOUSTICS
    • G10LSPEECH ANALYSIS TECHNIQUES OR SPEECH SYNTHESIS; SPEECH RECOGNITION; SPEECH OR VOICE PROCESSING TECHNIQUES; SPEECH OR AUDIO CODING OR DECODING
    • G10L19/00Speech or audio signals analysis-synthesis techniques for redundancy reduction, e.g. in vocoders; Coding or decoding of speech or audio signals, using source filter models or psychoacoustic analysis
    • G10L19/0017Lossless audio signal coding; Perfect reconstruction of coded audio signal by transmission of coding error

Landscapes

  • Engineering & Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • Acoustics & Sound (AREA)
  • Multimedia (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

The invention relates to a method for generating an AAC file by coding, which comprises the following steps: step 1, frame data processing: dividing original data to be processed into a plurality of standard data blocks with the size of 4096 bytes according to the size of 4096 bytes, and storing the last nonstandard data blocks with the size less than 4096 bytes; step 2, encoding: sending the standard data block to an AAC coding algorithm for processing; step 3, when new original data to be processed comes, splicing the nonstandard data blocks stored in the step 1 at the initial part of the new original data to be processed, and executing the steps 1 and 2 again; and by analogy, the whole data block with any size is encoded into a complete AAC format file in batches according to the size of one frame. When an audio file in an AAC format is generated by encoding, the invention automatically forms a frame by any size of data sent each time so as to prevent the encoded AAC file from having noise caused by data loss.

Description

Method for generating AAC file through coding
Technical Field
The invention relates to the field of digital audio coding and decoding algorithms, in particular to a method for generating an AAC file through coding. In particular to a method for generating an AAC file by automatic framing coding.
Background
In audio processing, there are many cases where an original PCM format audio file (PCM is WAV, and generally, a frame of PCM is composed of 2048 samples) needs to be encoded into an AAC format audio file (AAC file), and in the AAC encoding format, 1024 samples (samples) are required for a frame of audio data, if two-channel audio data is used, 1024 2(4096) bytes are required for a frame of audio data, and if less than one frame of audio data is generated during encoding into the AAC format audio file, for example, less than 4096 bytes are generated for a frame of two-channel audio data, the encoding algorithm discards the frame of audio data, so that in practical applications, each time a block of data delivered to the encoding algorithm cannot be evenly divided by 4096, each block of PCM data with a size that cannot be evenly divided by 4096 will have less than one frame of PCM data discarded, eventually resulting in an incomplete generated AAC file that sounds murky. The specific situations are as follows:
case 1, data block larger than 4096 bytes: the coding algorithm divides the data into a plurality of data blocks equal to 4096 bytes for coding, and discards the remaining data blocks smaller than 4096 bytes;
case 2, a data block smaller than 4096 bytes, the coding algorithm is directly discarded;
case 3, equal to a 4096 byte data block, the encoding algorithm encodes directly.
Since the space of 4096 bytes can be predefined in the prior art when encoding into an AAC format audio file, a frame of data with a fixed size is delivered to the encoding algorithm each time, and the data blocks to be processed in many scenarios in practical application are not all integral multiples of 4096, so the use limitation is very large.
Disclosure of Invention
Aiming at the defects in the prior art, the invention aims to provide a method for encoding and generating an AAC file, which automatically forms data with any size sent each time into a frame when an audio file in an AAC format is encoded and generated so as to prevent the AAC file from having noise after encoding due to data loss.
In order to achieve the above purposes, the technical scheme adopted by the invention is as follows:
a method of encoding an AAC file, comprising the steps of:
step 1, frame data processing: the raw data to be processed is divided into several standard blocks of 4096 bytes in size by 4096 bytes,
storing the last nonstandard data block with the size less than 4096 bytes;
step 2, encoding: sending the standard data block to an AAC coding algorithm for processing;
step 3, when new original data to be processed comes, splicing the nonstandard data blocks stored in the step 1 at the initial part of the new original data to be processed, and executing the steps 1 and 2 again;
and by analogy, the whole data block with any size is encoded into a complete AAC format file in batches according to the size of one frame.
On the basis of the technical scheme, in the step 1, the non-standard data block is stored in the memory.
On the basis of the above technical solution, in step 3, when no new original data to be processed arrives, the stored non-standard data block is discarded.
On the basis of the technical scheme, when the original data to be processed is the PCM data, the PCM data is processed in batches by any data block larger than 4096 bytes.
On the basis of the technical scheme, any data block larger than 4096 bytes is generated by a random algorithm.
The method for generating the AAC file by coding automatically forms data with any size sent each time into a frame when the audio file with the AAC format is generated by coding, so that the AAC file after coding is prevented from having noise caused by data loss.
Drawings
The invention has the following drawings:
FIG. 1 is a flow chart of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings.
The method for generating the AAC file by coding does not need to prepare 4096 bytes of data with fixed size in advance, and can transmit data blocks with any size to an AAC coding algorithm (coding algorithm for short). The method specifically comprises the following conditions:
1. the data block is larger than 4096 and cannot be evenly divided by 4096:
dividing the data block into a plurality of data blocks which are equal to 4096 for coding, and storing the remaining data blocks which are smaller than 4096 for splicing with the next data block; discarding if there is no next data block;
2. the data block is larger than 4096 and can be evenly divided by 4096:
dividing the data block into a plurality of data blocks which are equal to 4096 for encoding;
3. data block equals 4096:
directly sending to a coding algorithm for coding;
4. data block is smaller than 4096:
if the data block is the last data block, because the frame is not enough, the coding algorithm cannot code the error of the returned data which is too small and directly discards the error, otherwise, the error is spliced with the next data block.
The method for generating an AAC file by encoding, as shown in FIG. 1, comprises the following steps:
step 1, frame data processing: the raw data to be processed is divided into several standard blocks of 4096 bytes in size by 4096 bytes,
storing the last nonstandard data block with the size less than 4096 bytes;
step 2, encoding: sending the standard data block to an AAC coding algorithm for processing;
step 3, when new original data to be processed comes, splicing the nonstandard data blocks stored in the step 1 at the initial part of the new original data to be processed, and executing the steps 1 and 2 again;
by analogy, the whole data block (PCM format audio file) with any size is encoded into the complete AAC format file in batches according to the size of one frame (4096 bytes).
On the basis of the technical scheme, in the step 1, the non-standard data block is stored in the memory.
On the basis of the above technical solution, in step 3, when no new original data to be processed arrives, the stored non-standard data block is discarded.
The method of the invention can process the PCM data which needs to be coded into an AAC format file in batches by any data block which is larger than 4096 bytes, automatically frames into a plurality of standard data blocks which are 4096 bytes in size to code AAC, and then codes the complete frame data into an AAC file.
The following are specific examples.
In the singing and up-down-tuning function, an AAC accompaniment file downloaded from a server is decoded into PCM data, then the PCM data is processed by an up-down-tuning algorithm, and then the PCM data and the human voice are mixed and finally encoded into the AAC accompaniment file. The total data size in the processing process of the example is arbitrary, the size of each data is also arbitrary, and the algorithm is finished after the whole decoded AAC file is completely processed. Most of each data in the process is not multiple of 4096, that is, each data is divided into less than one frame, but the data is transmitted to the algorithm of the invention for processing, so that the data is automatically framed and prevented from being discarded until the data is coded into a complete AAC work file.
For example: the total data is 11, 010, 048 bytes, and is divided into 35 data, each data is of any size but larger than 4096 bytes, and any data block larger than 4096 bytes is generated by a random algorithm.
Take the first three data as an example:
the first data: 9876 bytes, the algorithm divides the data into three blocks of 4096, 4096 and 1684, directly encodes the first two blocks of data, and stores the rest 1684 bytes in the memory;
and the second pen data: 10000 bytes, dividing it into 2412, 4096 and 3492, splicing three blocks of data, 2412 and the residual 1684 bytes of the first data into a frame, then coding it with the following second block 4096 bytes of data, and then storing the 3492 third block of data;
and the third stroke of data: 8192 bytes, dividing it into 604, 4096 and 3492 blocks of data, 604 splicing with the last remaining 3492 block into a frame and a second block for encoding, storing 3492,
and so on, each data is processed step by step, and the data processing of the last two strokes is as follows:
the penultimate data: 23456 bytes, dividing into several blocks, the first block may be spliced with the last remaining data into a frame or a frame, i.e. the data is divided into six blocks of 4096, 4096, 4096, 4096, 4096 and 2976 bytes, the first five blocks of data are sequentially coded, and 2976 is stored;
the last data: 10066 bytes, divided into 1120, 4096 and 754 bytes, splicing 1120 and the last but one stroke of the remaining 2976 into one frame, and encoding the two blocks of data sequentially, wherein the last block of data 754 bytes is discarded by the encoding algorithm because it is less than one frame. Obviously, the algorithm only discards 754 bytes of data, and the generated AAC file has good integrity, small loss data and no obvious noise.
Those not described in detail in this specification are within the skill of the art.

Claims (2)

1. A method of encoding an AAC file, comprising the steps of:
step 1, frame data processing: the raw data to be processed is divided into several standard blocks of 4096 bytes in size by 4096 bytes,
storing the last nonstandard data block with the size less than 4096 bytes;
when the original data to be processed is PCM data, the PCM data is processed in batches by any data block larger than 4096 bytes;
generating any data block larger than 4096 bytes by a random algorithm;
step 2, encoding: sending the standard data block to an AAC coding algorithm for processing;
step 3, when new original data to be processed comes, splicing the nonstandard data blocks stored in the step 1 at the initial part of the new original data to be processed, and executing the steps 1 and 2 again;
by analogy, the whole data block with any size is encoded into a complete AAC format file in batches according to the size of one frame;
in step 3, when no new original data to be processed comes, the stored nonstandard data block is discarded.
2. The method of encoding an AAC file of claim 1, wherein: in step 1, the non-standard data block is stored in the memory.
CN201611079228.XA 2016-11-30 2016-11-30 Method for generating AAC file through coding Active CN106782573B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611079228.XA CN106782573B (en) 2016-11-30 2016-11-30 Method for generating AAC file through coding

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611079228.XA CN106782573B (en) 2016-11-30 2016-11-30 Method for generating AAC file through coding

Publications (2)

Publication Number Publication Date
CN106782573A CN106782573A (en) 2017-05-31
CN106782573B true CN106782573B (en) 2020-04-24

Family

ID=58901069

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611079228.XA Active CN106782573B (en) 2016-11-30 2016-11-30 Method for generating AAC file through coding

Country Status (1)

Country Link
CN (1) CN106782573B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110888750A (en) * 2018-09-07 2020-03-17 阿里巴巴集团控股有限公司 Data processing method and device
CN111262798B (en) * 2018-11-30 2023-03-14 深圳市中兴微电子技术有限公司 Information processing method, information processing equipment and computer storage medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1162006A (en) * 1997-02-26 1997-10-15 覃戊文 High-effective gas additive
CN1189745A (en) * 1996-10-22 1998-08-05 索尼公司 Transmitting apparatus and method, receiving apparatus and method
CN1669358A (en) * 2002-07-16 2005-09-14 皇家飞利浦电子股份有限公司 Audio coding
EP1626504A1 (en) * 2003-05-21 2006-02-15 Sony Corporation Data processing device, encoding device, encoding method, decoding device, decoding method, and program
CN102254560A (en) * 2010-05-19 2011-11-23 安凯(广州)微电子技术有限公司 Audio processing method in mobile digital television recording
US8924207B2 (en) * 2009-07-23 2014-12-30 Texas Instruments Incorporated Method and apparatus for transcoding audio data
CN104732979A (en) * 2015-03-24 2015-06-24 无锡天脉聚源传媒科技有限公司 Processing method and device of audio data
CN105070292A (en) * 2015-07-10 2015-11-18 珠海市杰理科技有限公司 Audio file data reordering method and system
CN105247614A (en) * 2013-04-05 2016-01-13 杜比国际公司 Audio encoder and decoder

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100466601C (en) * 2005-04-28 2009-03-04 华为技术有限公司 Data read/write device and method
CN100580770C (en) * 2005-08-08 2010-01-13 中国科学院声学研究所 Voice end detection method based on energy and harmonic
CN101345531B (en) * 2008-08-19 2012-12-26 无锡中星微电子有限公司 Data processing method for ogg format stream
CN102364472A (en) * 2011-10-25 2012-02-29 中兴通讯股份有限公司 Data storage method and system
CN104050968B (en) * 2014-06-23 2017-02-15 东南大学 Embedded type audio acquisition terminal AAC audio coding method
CN104795072A (en) * 2015-03-25 2015-07-22 无锡天脉聚源传媒科技有限公司 Method and device for coding audio data
CN104778150B (en) * 2015-03-27 2018-12-14 华为技术有限公司 A kind of frequency domain technique and device
CN105337617B (en) * 2015-12-09 2018-10-26 浙江维融电子科技股份有限公司 A kind of FSN files high-efficiency compression method

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1189745A (en) * 1996-10-22 1998-08-05 索尼公司 Transmitting apparatus and method, receiving apparatus and method
CN1162006A (en) * 1997-02-26 1997-10-15 覃戊文 High-effective gas additive
CN1669358A (en) * 2002-07-16 2005-09-14 皇家飞利浦电子股份有限公司 Audio coding
EP1626504A1 (en) * 2003-05-21 2006-02-15 Sony Corporation Data processing device, encoding device, encoding method, decoding device, decoding method, and program
US8924207B2 (en) * 2009-07-23 2014-12-30 Texas Instruments Incorporated Method and apparatus for transcoding audio data
CN102254560A (en) * 2010-05-19 2011-11-23 安凯(广州)微电子技术有限公司 Audio processing method in mobile digital television recording
CN105247614A (en) * 2013-04-05 2016-01-13 杜比国际公司 Audio encoder and decoder
CN104732979A (en) * 2015-03-24 2015-06-24 无锡天脉聚源传媒科技有限公司 Processing method and device of audio data
CN105070292A (en) * 2015-07-10 2015-11-18 珠海市杰理科技有限公司 Audio file data reordering method and system

Also Published As

Publication number Publication date
CN106782573A (en) 2017-05-31

Similar Documents

Publication Publication Date Title
US8942502B2 (en) Parallelization of variable length decoding
JP2016528796A5 (en)
JP2016513916A5 (en)
TW201236380A (en) Entropy encoding and decoding scheme
CN108777606B (en) Decoding method, apparatus and readable storage medium
CN111262876B (en) Data processing method, device and equipment based on block chain and storage medium
RU2013144556A (en) PULSE-CODE MODULATION WITH QUANTIZATION WHEN CODING VIDEO INFORMATION
CN110518917A (en) LZW data compression method and system based on Huffman coding
CN110572165A (en) Method and device for processing rate matching of codes
CN106782573B (en) Method for generating AAC file through coding
KR101870594B1 (en) Coding and decoding of spectral peak positions
KR20160123302A (en) Devices and methods of source-encoding and decoding of data
CN114362885B (en) Data transmission method, communication system, equipment and medium of Internet of things
CN110535846B (en) Data frame compression method and system based on DL/T698.45 protocol
TW201618084A (en) Encoder, decoder, system and methods for encoding and decoding
ZA202201250B (en) Determination of picture partition mode based on block size
WO2015117407A1 (en) Processing method and device for terminal information
MX2021011102A (en) Probability initialization for video coding.
TW201440442A (en) Secure and lossless data compression
WO2016003130A1 (en) Method and apparatus for performing arithmetic coding by limited carry operation
CN112887054B (en) Data stream packaging method, data stream unpacking method and data stream unpacking system based on length escape
CN116193160A (en) Digital watermark embedding method, device, equipment and medium
CN104780376B (en) A kind of video coding and decoding system with ultralow end-to-end time delay, method and device
CN110473264B (en) Depth map compression method and decompression method based on Huffman coding and encoder
CN108259904B (en) Method, encoder and electronic device for encoding image data

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant