1 /*
2 * Copyright (C) 2004-2010 NXP Software
3 * Copyright (C) 2010 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18 /**********************************************************************************
19 INCLUDE FILES
20 ***********************************************************************************/
21
22 #include "LVC_Mixer_Private.h"
23 #include "VectorArithmetic.h"
24
25 /**********************************************************************************
26 FUNCTION LVC_MixSoft_2St_D16C31_SAT.c
27 ***********************************************************************************/
28
LVC_MixSoft_2St_D16C31_SAT(LVMixer3_2St_st * ptrInstance,const LVM_INT16 * src1,LVM_INT16 * src2,LVM_INT16 * dst,LVM_INT16 n)29 void LVC_MixSoft_2St_D16C31_SAT( LVMixer3_2St_st *ptrInstance,
30 const LVM_INT16 *src1,
31 LVM_INT16 *src2,
32 LVM_INT16 *dst,
33 LVM_INT16 n)
34 {
35 Mix_Private_st *pInstance1=(Mix_Private_st *)(ptrInstance->MixerStream[0].PrivateParams);
36 Mix_Private_st *pInstance2=(Mix_Private_st *)(ptrInstance->MixerStream[1].PrivateParams);
37
38 if(n<=0) return;
39
40 /******************************************************************************
41 SOFT MIXING
42 *******************************************************************************/
43 if ((pInstance1->Current == pInstance1->Target)&&(pInstance1->Current == 0)){
44 LVC_MixSoft_1St_D16C31_SAT( (LVMixer3_1St_st *)(&ptrInstance->MixerStream[1]), src2, dst, n);
45 }
46 else if ((pInstance2->Current == pInstance2->Target)&&(pInstance2->Current == 0)){
47 LVC_MixSoft_1St_D16C31_SAT( (LVMixer3_1St_st *)(&ptrInstance->MixerStream[0]), src1, dst, n);
48 }
49 else if ((pInstance1->Current != pInstance1->Target) || (pInstance2->Current != pInstance2->Target))
50 {
51 LVC_MixSoft_1St_D16C31_SAT((LVMixer3_1St_st *)(&ptrInstance->MixerStream[0]), src1, dst, n);
52 LVC_MixInSoft_D16C31_SAT( (LVMixer3_1St_st *)(&ptrInstance->MixerStream[1]), src2, dst, n);
53 }
54 else{
55 /******************************************************************************
56 HARD MIXING
57 *******************************************************************************/
58 if(pInstance2->Shift!=0)
59 Shift_Sat_v16xv16 ((LVM_INT16)pInstance2->Shift,src2,src2,n);
60 if(pInstance1->Shift!=0)
61 {
62 Shift_Sat_v16xv16 ((LVM_INT16)pInstance1->Shift,src1,dst,n);
63 LVC_Core_MixHard_2St_D16C31_SAT( &ptrInstance->MixerStream[0], &ptrInstance->MixerStream[1], dst, src2, dst, n);
64 }
65 else
66 LVC_Core_MixHard_2St_D16C31_SAT( &ptrInstance->MixerStream[0], &ptrInstance->MixerStream[1], src1, src2, dst, n);
67 }
68 }
69
70 /**********************************************************************************/
71