Difference between revisions of "Reconstructing AAC CPE"

From MultimediaWiki
Jump to navigation Jump to search
(add some more steps to the reconstruction process)
(reconstruct_channel_pair(2 ic_streams, 2 spec_data arrays(16 bit ints)))
Line 27: Line 27:
 
== reconstruct_channel_pair(2 ic_streams, 2 spec_data arrays(16 bit ints)) ==
 
== reconstruct_channel_pair(2 ic_streams, 2 spec_data arrays(16 bit ints)) ==
 
   declare 2 1024-element float arrays for spectral coefficients (spec_coeff1 and spec_coeff2)
 
   declare 2 1024-element float arrays for spectral coefficients (spec_coeff1 and spec_coeff2)
   quant_to_spec(ics1, spec_data1, ics1)
+
   inverse_quantization(spec_coeff1, spec_data1)
   quant_to_spec(ics2, spec_data2, ics2)
+
  inverse_quantization(spec_coeff2, spec_data2)
 +
  apply_scalefactors(ics1, spec_coeff1)
 +
   apply_scalefactors(ics2, spec_coeff2)
 +
  if ics1.window_sequence is EIGHT_SHORT_SEQUENCE (2)
 +
    quant_to_spec(ics1, spec_coeff1)
 +
  if ics2.window_sequence is EIGHT_SHORT_SEQUENCE (2)
 +
    quant_to_spec(ics2, spec_coeff2)
 
   if ics1.ms_mask_present
 
   if ics1.ms_mask_present
 
     pns_decode(ics1, ics2, spec_coef1, spec_coeff2)
 
     pns_decode(ics1, ics2, spec_coef1, spec_coeff2)

Revision as of 20:54, 11 March 2006

Part of Understanding AAC

This page describes the process of reconstructing PCM data based on the decoded CPE parameters in an AAC bitstream. For the moment, this description focuses on what is necessary to reconstruct low complexity (LC) profile data.

Reconstruction Process

 specrec.c:reconstruct_channel_pair()
   +-specrec.c:allocate_channel_pair()
   +-inverse_quantization()
   +-apply_scalefactors()
   +-specrec.c:quant_to_spec()
   +-pns.c:pns_decode()
   +-ms.c:ms_decode()
   +-is.c:is_decode()
   +-ic_predict.c:ic_prediction() (main profile)
   +-ic_predict.c:pns_reset_pred_state() (main profile)
   +-(processing that is specific LTP & LD profiles)
   +-tns.c:tns_decode_frame()
   +-drc.c:drc_decode()
   +-filtbank.c:ifilter_bank()
     +-filtbank.c:imdct_long()
     +-mdct.c:faad_imdct()
   +-ssr.c:ssr_decode()
   +-lt_predict.c:lt_update_state()
   +-sbr_dec.c:sbrDecodeInit()
   +-sbr_dec.c:sbrDecodeCoupleFrame()

reconstruct_channel_pair(2 ic_streams, 2 spec_data arrays(16 bit ints))

 declare 2 1024-element float arrays for spectral coefficients (spec_coeff1 and spec_coeff2)
 inverse_quantization(spec_coeff1, spec_data1)
 inverse_quantization(spec_coeff2, spec_data2)
 apply_scalefactors(ics1, spec_coeff1)
 apply_scalefactors(ics2, spec_coeff2)
 if ics1.window_sequence is EIGHT_SHORT_SEQUENCE (2)
   quant_to_spec(ics1, spec_coeff1)
 if ics2.window_sequence is EIGHT_SHORT_SEQUENCE (2)
   quant_to_spec(ics2, spec_coeff2)
 if ics1.ms_mask_present
   pns_decode(ics1, ics2, spec_coef1, spec_coeff2)
 else
   pns_decode(ics1, spec_coef1)
   pns_decode(ics2, spec_coef2)
 ms_decode(ics1, ics2, spec_coef1, spec_coef2)
 is_decode(ics1, ics2, spec_coef1, spec_coef2)
 // main profile decoding
 // LTP decoding
 tns_decode(ics1, spec_coeff1)
 tns_decode(ics2, spec_coeff2)
 // DRC stuff
 ifilter_bank(ics1, spec_coeff1)
 ifilter_bank(ics2, spec_coeff2)
 save window shape for next frame (I thought frames were independent)
 // LTP stuff
 // SBR stuff

allocate_channel_pair()

This function mostly contains considerations for non-LC decoding modes. Need to revisit the mechanics of this later.

inverse_quantization()

apply_scalefactors()

quant_to_spec()

pns_decode()

ms_decode()

is_decode()

ic_prediction()

pns_reset_pred_state()

tns_decode_frame()

drc_decode()

ifilter_bank()

imdct_long()

In low complexity mode, this function simply calls down to faad_imdct(). If LD is enabled, there is some more processing beforehand.

faad_imdct(real *in, real *out)

This comment appears in FAAD2's mdct.c file header:

"Fast (I)MDCT Implementation using (I)FFT ((Inverse) Fast Fourier Transform) and consists of three steps: pre-(I)FFT complex multiplication, complex (I)FFT, post-(I)FFT complex multiplication."

This function is apparently a good candidate for SIMD optimization.

ssr_decode()

lt_update_state()

sbrDecodeInit()

sbrDecodeCoupleFrame()