Home | History | Annotate | Download | only in aacdec
      1 /* ------------------------------------------------------------------
      2  * Copyright (C) 1998-2009 PacketVideo
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
     13  * express or implied.
     14  * See the License for the specific language governing permissions
     15  * and limitations under the License.
     16  * -------------------------------------------------------------------
     17  */
     18 /*
     19 
     20  Filename: ps_applied.c
     21 
     22 ------------------------------------------------------------------------------
     23  REVISION HISTORY
     24 
     25 
     26  Who:                                   Date: MM/DD/YYYY
     27  Description:
     28 
     29 ------------------------------------------------------------------------------
     30  INPUT AND OUTPUT DEFINITIONS
     31 
     32 
     33 
     34 ------------------------------------------------------------------------------
     35  FUNCTION DESCRIPTION
     36 
     37         Applies Parametric Stereo Tool to a QMF-analized mono signal
     38         providing a stereo image as output
     39 
     40 
     41      _______                                              ________
     42     |       |                                  _______   |        |
     43   ->|Hybrid | LF ----                         |       |->| Hybrid |-->
     44     | Anal. |        |                        |       |  | Synth  |   QMF -> L
     45      -------         o----------------------->|       |   --------    Synth
     46 QMF                  |                s_k(n)  |Stereo |-------------->
     47 Anal.              -------------------------->|       |
     48      _______       | |                        |       |   ________
     49     |       | HF --o |   -----------          |Process|  |        |
     50   ->| Delay |      |  ->|           |-------->|       |->| Hybrid |-->
     51      -------       |    |decorrelate| d_k(n)  |       |  | Synth  |   QMF -> R
     52                    ---->|           |-------->|       |   --------    Synth
     53                          -----------          |_______|-------------->
     54 
     55 
     56 ------------------------------------------------------------------------------
     57  REQUIREMENTS
     58 
     59 
     60 ------------------------------------------------------------------------------
     61  REFERENCES
     62 
     63 SC 29 Software Copyright Licencing Disclaimer:
     64 
     65 This software module was originally developed by
     66   Coding Technologies
     67 
     68 and edited by
     69   -
     70 
     71 in the course of development of the ISO/IEC 13818-7 and ISO/IEC 14496-3
     72 standards for reference purposes and its performance may not have been
     73 optimized. This software module is an implementation of one or more tools as
     74 specified by the ISO/IEC 13818-7 and ISO/IEC 14496-3 standards.
     75 ISO/IEC gives users free license to this software module or modifications
     76 thereof for use in products claiming conformance to audiovisual and
     77 image-coding related ITU Recommendations and/or ISO/IEC International
     78 Standards. ISO/IEC gives users the same free license to this software module or
     79 modifications thereof for research purposes and further ISO/IEC standardisation.
     80 Those intending to use this software module in products are advised that its
     81 use may infringe existing patents. ISO/IEC have no liability for use of this
     82 software module or modifications thereof. Copyright is not released for
     83 products that do not conform to audiovisual and image-coding related ITU
     84 Recommendations and/or ISO/IEC International Standards.
     85 The original developer retains full right to modify and use the code for its
     86 own purpose, assign or donate the code to a third party and to inhibit third
     87 parties from using the code for products that do not conform to audiovisual and
     88 image-coding related ITU Recommendations and/or ISO/IEC International Standards.
     89 This copyright notice must be included in all copies or derivative works.
     90 Copyright (c) ISO/IEC 2003.
     91 
     92 ------------------------------------------------------------------------------
     93  PSEUDO-CODE
     94 
     95 ------------------------------------------------------------------------------
     96 */
     97 
     98 
     99 /*----------------------------------------------------------------------------
    100 ; INCLUDES
    101 ----------------------------------------------------------------------------*/
    102 
    103 #ifdef AAC_PLUS
    104 
    105 #ifdef PARAMETRICSTEREO
    106 #include    "aac_mem_funcs.h"
    107 #include    "ps_stereo_processing.h"
    108 #include    "ps_decorrelate.h"
    109 #include    "ps_hybrid_synthesis.h"
    110 #include    "ps_hybrid_analysis.h"
    111 #include    "ps_applied.h"
    112 
    113 /*----------------------------------------------------------------------------
    114 ; MACROS
    115 ; Define module specific macros here
    116 ----------------------------------------------------------------------------*/
    117 
    118 
    119 /*----------------------------------------------------------------------------
    120 ; DEFINES
    121 ; Include all pre-processor statements here. Include conditional
    122 ; compile variables also.
    123 ----------------------------------------------------------------------------*/
    124 
    125 /*----------------------------------------------------------------------------
    126 ; LOCAL FUNCTION DEFINITIONS
    127 ; Function Prototype declaration
    128 ----------------------------------------------------------------------------*/
    129 
    130 /*----------------------------------------------------------------------------
    131 ; LOCAL STORE/BUFFER/POINTER DEFINITIONS
    132 ; Variable declaration - defined here and used outside this module
    133 ----------------------------------------------------------------------------*/
    134 
    135 /*----------------------------------------------------------------------------
    136 ; EXTERNAL FUNCTION REFERENCES
    137 ; Declare functions defined elsewhere and referenced in this module
    138 ----------------------------------------------------------------------------*/
    139 
    140 /*----------------------------------------------------------------------------
    141 ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
    142 ; Declare variables used in this module but defined elsewhere
    143 ----------------------------------------------------------------------------*/
    144 
    145 
    146 /*----------------------------------------------------------------------------
    147 ; FUNCTION CODE
    148 ----------------------------------------------------------------------------*/
    149 
    150 void ps_applied(STRUCT_PS_DEC *h_ps_dec,
    151                 Int32 rIntBufferLeft[][64],
    152                 Int32 iIntBufferLeft[][64],
    153                 Int32 *rIntBufferRight,
    154                 Int32 *iIntBufferRight,
    155                 Int32 scratch_mem[],
    156                 Int32 band)
    157 
    158 {
    159 
    160     /*
    161      *  Get higher frequency resolution in the lower QMF subbands
    162      *  creating sub-subbands
    163      */
    164     ps_hybrid_analysis(rIntBufferLeft,
    165                        iIntBufferLeft,
    166                        h_ps_dec->mHybridRealLeft,
    167                        h_ps_dec->mHybridImagLeft,
    168                        h_ps_dec->hHybrid,
    169                        scratch_mem,
    170                        band);
    171 
    172     /*
    173      *  By means of delaying and all-pass filtering, sub-subbands of
    174      *  left ch. are decorrelate to creates right ch. sub-subbands
    175      */
    176 
    177     ps_decorrelate(h_ps_dec,
    178                    *rIntBufferLeft,
    179                    *iIntBufferLeft,
    180                    rIntBufferRight,
    181                    iIntBufferRight,
    182                    scratch_mem);
    183 
    184     /*
    185      *  sub-subbands of left and right ch. are processed according to
    186      *  stereo clues.
    187      */
    188 
    189     ps_stereo_processing(h_ps_dec,
    190                          *rIntBufferLeft,
    191                          *iIntBufferLeft,
    192                          rIntBufferRight,
    193                          iIntBufferRight);
    194 
    195     /*
    196      *  Reconstruct stereo signals
    197      */
    198 
    199     ps_hybrid_synthesis((const Int32*)h_ps_dec->mHybridRealLeft,
    200                         (const Int32*)h_ps_dec->mHybridImagLeft,
    201                         *rIntBufferLeft,
    202                         *iIntBufferLeft,
    203                         h_ps_dec->hHybrid);
    204 
    205     ps_hybrid_synthesis((const Int32*)h_ps_dec->mHybridRealRight,
    206                         (const Int32*)h_ps_dec->mHybridImagRight,
    207                         rIntBufferRight,
    208                         iIntBufferRight,
    209                         h_ps_dec->hHybrid);
    210 
    211 }/* END ps_applied */
    212 #endif
    213 
    214 
    215 #endif
    216 
    217