Help - Search - Members - Calendar
Full Version: Crossover distortion
Hydrogenaudio Forums > Lossy Audio Compression > MP3 > MP3 - Tech
manhattan
Hello all,

I have a question about crossover distortion. It is mentionned in the dist10 decoder in the last step of the decoding, when the time domain samples are converted to PCM :
CODE

   /* Casting truncates towards zero for both positive and negative numbers,
   the result is cross-over distortion,  1995-07-12 shn */

   if (time_sample > 0)  {
     foo = (long) (time_sample * (double)SCALE+ (double)0.5);
   }
   else  {
     foo = (long) (time_sample * (double)SCALE - (double)0.5);
   }

   if (foo >= (long) SCALE)   {
     pcm = (short)(SCALE-1);
   }
   else if (foo < (long) -SCALE)  {
     pcm = (short)(-SCALE);
   }
   else
     pcm =(short)foo;

SCALE is equal to 32768.

What is crossover distortion exactly ? Does the addition of +/- 0.5 make a noticeable difference in the final result ?
MugFunky
crossover distortion is a throwback to amplifier design speak.

most of the more efficient amp designs (ie. not class A) will handle positive and negative currents with 2 different circuits. there is a (very small) lag between when one stops and the other begins, that is when a wave crest passes zero and becomes a trough. the lag here causes a kind of "vertical clipping" (apoligies for the awful term) called "crossover distortion", for the obvious reason that it occurs when the wave "crosses over".

rounding 16bit integers to zero as described above gives the same kind of distortion in digital form (though not as horrible). i doubt anyone would be able to ABX a difference that small, but the fact that loss exists there is bothersome i suppose.
manhattan
Thanks MugFunky, I think I understand. Without the +/- 0.5, all samples between 0.9999... and -0.9999... will be rounded to 0. With the +/- 0.5, all samples between 0.5 and 0.999... are rounded to 1 and all samples between -0.999 and -0.5 are rounded to -1.

That's because the C language specify to use truncation to convert real numbers to integers. It would not be necessary if the truncating mode was round-to-nearest.
cabbagerat
The top Google result for "Crossover distortion" gives some nice pretty pictures:
http://www.aikenamps.com/CrossoverDistortion.htm

The diagrams show how it effects sound in both the time and frequency domains. Crossover distortion tends to add odd harmonic distortion (much like clipping) which sounds much worse than even harmonic distortion. Not entirely convinced you would notice one part in 2^16 rounding (as in the initial example) though - might be worth a listening test.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.