Doubt in HE-AACv2 header.
2009-10-07 05:40:06
Hai all, Currently I am working on HE-AACv2 (LC-AAC + SBR + PS) code. For this type of streams the input for PS Decoding module is mono and the output of PS Decoding module is stereo. Currently in the code I allocate the output buffer memory based on the number of channels extracted from the Unpack_ADTS_header function. Then, if PS is present in the first frame, I doubled the output buffer before writing the data in the output file. For the streams in which from the first frame itself, PS Data is present, then no issue. I have one stream. It has totally 106 frames. The first 53 frames dont have PS data. So if i check 'whether PS is present in the first frame?', it says 'No'. So I allocate single channel buffer. But from 54th frame onwards all the frames contain PS Data and PS_Present flag. Since I write the wave header and allocate the output buffer based on the information extracted from the very first frame, I write the output file as mono and the right channel data coming from 54th frame is getting treated as consecutive left channel data. Result? Breaks/ clipping/ Boosted noise floor in the second half of the output wave file. Unfortunately, this stream is ISO stream. I can't skip it from testing. In the spec (ISO_IEC_14496-3_2001_Amd_2_2004), they mention like this.(section 8.2.1) // Frame Basic unit that can be decoded on itself (file header information is required for general decoder settings). // My doubt : 1.Is there any file header (apart from frame headers) in the starting of the bitstream, to indicate that 'this stream is PS enabled stream.' So i can allocate the required buffer size before writing the first frame output. 2. Is it correct, that in a PS stream some frames have PS enabled and some not. Thanking You. Please help me, It's urgent..!! Regards, Vasanth.