Thursday, July 24, 2014

Decoding the AC-3 Bitstream


AC-3 algorithm uses perceptual coding for compression. It divides the audio spectrum of each
channel into narrow frequency bands based on the frequency selectivity of human hearing.
These frequency bands are analyzed and more number of bits are used to represent most
audible signals. Encoding is done in the frequency domain, using a 512-point MDCT (or two
256-point transforms for transient signals) with 50% overlap.

The different steps described in the previous sections for decoding the AC-3 bitstream is shown as a
pseudo code in below.

                             Detect AC-3 frame sync
                             Error Check (CRC)
                             Unpack BSI (Bit Stream Information) data
                             For audio block 0 to 5
                                     Unpack fixed data (coupling,bit allocation & other info)
                                      For channel 1 to No. of coded channels
                                      Unpack exponents
                                       For band 1 to No. of bands
                                              Compute bit allocation
                                               Unpack mantissas
                                                Scale mantissas
                                                 Decouple mantissa
                                                 Denormalize mantissas by exponents
                                          Compute partial inverse transform
                                         Downmix to appropriate output channels
                                  For channel 1 to No. of output channels
                                               Window/ overlap-add with delay buffer
                                                Store samples in PCM output buffer
                                               Copy downmix buffer values to delay
Figure 4. Pseudo Code for the Decoder

1 comment: