videoeditorengine/audioeditorengine/resampler/src/resampler_rate_conversion_output_driven_int16.cpp
changeset 0 951a5db380a0
equal deleted inserted replaced
-1:000000000000 0:951a5db380a0
       
     1 /*
       
     2 * Copyright (c) 2010 Ixonos Plc.
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - Initial contribution
       
    11 *
       
    12 * Contributors:
       
    13 * Ixonos Plc
       
    14 *
       
    15 * Description:
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #include "resampler_rate_conversion_output_driven_int16.h"
       
    21 #include "resampler_sinc_conv_one_to_two_int16.h"
       
    22 #include "resampler_sinc_conv_one_to_three_int16.h"
       
    23 #include "resampler_sinc_conv_two_to_three_int16.h"
       
    24 #include "resampler_sinc_conv_44_to_48_int16.h"
       
    25 #include "resampler_sinc_conv_two_to_one_int16.h"
       
    26 #include "resampler_sinc_conv_three_to_one_int16.h"
       
    27 
       
    28 bool 
       
    29 RESAMPLER_RateConversionOutputDrivenInt16::RateSupported(float inRate, 
       
    30                                                    float outRate, 
       
    31                                                    int channelCount)
       
    32 {
       
    33     /* Note that this is a dummy test just to get rid of some warnings. */
       
    34     if (inRate == 0 || outRate == 0 || channelCount == 0)
       
    35     {
       
    36         return false;
       
    37     }
       
    38 
       
    39     if (RESAMPLER_SincConvOneToTwoInt16::RateSupported(inRate, outRate))
       
    40     {
       
    41         return true;
       
    42     }
       
    43 
       
    44     if (RESAMPLER_SincConvOneToThreeInt16::RateSupported(inRate, outRate))
       
    45     {
       
    46         return true;
       
    47     }
       
    48 
       
    49     if (RESAMPLER_SincConvTwoToThreeInt16::RateSupported(inRate, outRate))
       
    50     {
       
    51         return true;
       
    52     }
       
    53 
       
    54     if (RESAMPLER_SincConv44To48Int16::RateSupported(inRate, outRate))
       
    55     {
       
    56         return true;
       
    57     }
       
    58 
       
    59     if (RESAMPLER_SincConvTwoToOneInt16::RateSupported(inRate, outRate))
       
    60     {
       
    61         return true;
       
    62     }
       
    63 
       
    64     if (RESAMPLER_SincConvThreeToOneInt16::RateSupported(inRate, outRate))
       
    65     {
       
    66         return true;
       
    67     }
       
    68 
       
    69     return false;
       
    70 }
       
    71 
       
    72 
       
    73 RESAMPLER_RateConversionOutputDrivenInt16 *
       
    74 RESAMPLER_RateConversionOutputDrivenInt16::New(float inRate, 
       
    75                                          float outRate, 
       
    76                                          int channelCount)
       
    77 {
       
    78     RESAMPLER_RateConversionOutputDrivenInt16 *converter = 0;
       
    79     
       
    80     /* Note that this is a dummy test just to make configuration easier. */
       
    81     if (inRate == 0 || outRate == 0 || channelCount == 0)
       
    82     {
       
    83         converter = 0;
       
    84     }
       
    85 
       
    86     else if (2*inRate == outRate)
       
    87     {
       
    88         converter = new RESAMPLER_SincConvOneToTwoInt16(channelCount);
       
    89     }
       
    90 
       
    91     else if (3*inRate == outRate)
       
    92     {
       
    93         converter = new RESAMPLER_SincConvOneToThreeInt16(channelCount);
       
    94     }
       
    95 
       
    96     else if (3*inRate == 2*outRate)
       
    97     {
       
    98         converter = new RESAMPLER_SincConvTwoToThreeInt16(channelCount);
       
    99     }
       
   100 
       
   101 	else if (160 * inRate == 147 * outRate)
       
   102     {
       
   103         converter = new RESAMPLER_SincConv44To48Int16(channelCount);
       
   104     }
       
   105 
       
   106     else if (inRate == 2 * outRate)
       
   107     {
       
   108         converter = new RESAMPLER_SincConvTwoToOneInt16(channelCount);
       
   109     }
       
   110 
       
   111     else if (inRate == 3 * outRate)
       
   112     {
       
   113         converter = new RESAMPLER_SincConvThreeToOneInt16(channelCount);
       
   114     }
       
   115 
       
   116 	return converter;
       
   117 }
       
   118 
       
   119 bool RESAMPLER_RateConversionOutputDrivenInt16::SetQualityOutputDriven(int /* mode */)
       
   120 {
       
   121     return true;
       
   122 }
       
   123 
       
   124 void RESAMPLER_RateConversionOutputDrivenInt16::EnableChannelOutputDriven(int /* channel */)
       
   125 {
       
   126 }
       
   127 
       
   128 void RESAMPLER_RateConversionOutputDrivenInt16::DisableChannelOutputDriven(int /* channel */)
       
   129 {
       
   130 }
       
   131