Skip to main content


Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Huge decoded MDCT spectrum (Read 888 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Huge decoded MDCT spectrum

Hi all!

I'm trying to build decoder for MPEG 2 AAC files (from scratch) based on a 2004 version of the MPEG2-7 standard. I've gotten some results but for some reason I keep getting decoded spectra of insanely huge amplitudes. The shape is alright, compared to theoretical calculations based on a wav version of the signal and on results obtained using the GAAC decoder.

I've checked every key variable that might skew the results in this manner, both in the MPEG 2 AAC and MPEG 4 standards but everything seemed okay.

Does anyone have any idea what could cause this?

Re: Huge decoded MDCT spectrum

Reply #1
Since it looks like your values are scaled by roughly N, does your MDCT have a scale factor? 

Re: Huge decoded MDCT spectrum

Reply #2
Since it looks like your values are scaled by roughly N, does your MDCT have a scale factor? 
Not that I'm aware of, I mean various sections of the spectrum each have their scalefactors, but other than that, I don't think the spectrum as a whole has a scalefactor. That would actually be the global_gain parameter which I've already verified. I find the "correct" value and AFAIK I'm using it correctly during decoding.

Re: Huge decoded MDCT spectrum

Reply #3
I mean, does the MDCT algorithm you've chosen scale the output.  This is common, especially by a value of N.  You can compensate by folding in that scaling into the MDCT windowing. 

Re: Huge decoded MDCT spectrum

Reply #4
I've coded the MDCT algorithm myself, using only the documentation in the standard. I've used it separately on a few examples to make sure it was reversible. I don't think there is a scaling in the standard but yeah the problem can definitely be stemming from there so I'll check again.

Re: Huge decoded MDCT spectrum

Reply #5
I realized that my decoder was doing the job okay, except for that bizarre amplitude. I've recorded a test file with Audacity, converted it to aac using faac, and decoded it with my program. The amplitude was way off, but the shape of the signal was the same as in audacity.  When I normalized the amplitude to 1 (by dividing the signal by max(abs(signal))) I was able to listen to it and it was perfect.

SimplePortal 1.0.0 RC1 © 2008-2021