A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://patents.google.com/patent/CN106782573B/en below:

CN106782573B - Method for generating AAC file through coding

CN106782573B - Method for generating AAC file through coding - Google PatentsMethod 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
2016-11-30
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.)
2016-11-30
Filing date
2016-11-30
Publication date
2020-04-24
2016-11-30 Application filed by Beijing Kuwo Technology Co Ltd filed Critical Beijing Kuwo Technology Co Ltd
2016-11-30 Priority to CN201611079228.XA priority Critical patent/CN106782573B/en
2017-05-31 Publication of CN106782573A publication Critical patent/CN106782573A/en
2020-04-24 Application granted granted Critical
2020-04-24 Publication of CN106782573B publication Critical patent/CN106782573B/en
Status Active legal-status Critical Current
2036-11-30 Anticipated expiration legal-status Critical
Links Images Classifications Landscapes 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) 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) Families Citing this family (2) * Cited by examiner, † Cited by third party Publication number Priority date Publication date Assignee Title CN110888750B (en) * 2018-09-07 2024-07-05 阿里巴巴集团控股有限公司 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 华为技术有限公司 A data reading and writing device and reading and writing method thereof CN100580770C (en) * 2005-08-08 2010-01-13 中国科学院声学研究所 Speech endpoint detection method based on energy and harmonics 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 Similar Documents Publication Publication Date Title RU2630750C1 (en) 2017-09-12 Device and method for encoding and decoding initial data US8942502B2 (en) 2015-01-27 Parallelization of variable length decoding JP2016513916A5 (en) 2016-07-14 CN110518917A (en) 2019-11-29 LZW data compression method and system based on Huffman coding EP3799314A1 (en) 2021-03-31 Rate matching with sub-block interleaving and a virtual buffer for polar codes KR101870594B1 (en) 2018-06-22 Coding and decoding of spectral peak positions CN108777606B (en) 2021-07-27 Decoding method, apparatus and readable storage medium CN106782573B (en) 2020-04-24 Method for generating AAC file through coding MX2024007726A (en) 2024-07-01 Methods, apparatus and systems for generation, transportation and processing of immediate playout frames (ipfs). ZA202201250B (en) 2023-11-29 Determination of picture partition mode based on block size CN110535846B (en) 2022-03-04 Data frame compression method and system based on DL/T698.45 protocol US11398832B2 (en) 2022-07-26 Data compression method and apparatus, and computer readable storage medium WO2016003130A1 (en) 2016-01-07 Method and apparatus for performing arithmetic coding by limited carry operation US20190132649A1 (en) 2019-05-02 Method for Improving Video Resolution and Video Quality, Encoder, and Decoder CN102891730B (en) 2015-04-22 Method and device for encoding satellite short message based on binary coded decimal (BCD) code CN116884419A (en) 2023-10-13 Tone color conversion method, device, apparatus, storage medium, and program product WO2014029081A1 (en) 2014-02-27 Compression method and apparatus CN104780376B (en) 2018-03-23 A kind of video coding and decoding system with ultralow end-to-end time delay, method and device CN110473264B (en) 2023-04-07 Depth map compression method and decompression method based on Huffman coding and encoder CN1669225B (en) 2015-11-25 To the method encoded in the position of the data element in data structure CN104468028B (en) 2018-11-16 A kind of data decoding method and equipment CN106533628B (en) 2019-10-18 A Huffman parallel decoding method and device thereof US20220415441A1 (en) 2022-12-29 Method for the Compression of Genome Sequence Data CN102572425A (en) 2012-07-11 Huffman decoding method KR20080094043A (en) 2008-10-22 Data encoding and decoding methods, data transmission methods, transmitters and receivers Legal Events Date Code Title Description 2017-05-31 PB01 Publication 2017-05-31 PB01 Publication 2017-06-23 SE01 Entry into force of request for substantive examination 2017-06-23 SE01 Entry into force of request for substantive examination 2020-04-24 GR01 Patent grant 2020-04-24 GR01 Patent grant

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4