M4ChannelConverter.c revision b5c7784c96a606890eb8a8b560153ef4a5d1a0d9
1/*
2 * Copyright (C) 2011 The Android Open Source Project
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 express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16/**
17 ******************************************************************************
18 * @file    M4ChannelCoverter.c
19 * @brief
20 * @note
21 ******************************************************************************
22 */
23
24void MonoTo2I_16( const short *src,
25                        short *dst,
26                        short n)
27{
28    short ii;
29    src += n-1;
30    dst += (n*2)-1;
31
32    for (ii = n; ii != 0; ii--){
33        *dst-- = *src;
34        *dst-- = *src--;
35    }
36
37    return;
38}
39
40void From2iToMono_16( const short *src,
41                            short *dst,
42                            short n)
43{
44    short ii;
45    long Temp;
46    for (ii = n; ii != 0; ii--){
47        Temp = (long)*(src++);
48        Temp += (long)*(src++);
49        *(dst++) = (short)(Temp >>1);
50    }
51
52    return;
53}
54
55