1 /*
2 * Format Conversion Utils
3 * Copyright (c) 2000, 2001 Fabrice Bellard
4 * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
26
29 {
30 int i;
32 dst[i] = src[i] * mul;
33 }
34
38 {
39 int i;
40 for (i = 0; i <
len; i += 8)
42 }
43
45 return av_clip_int16(
lrintf(*src));
46 }
47
49 {
50 int i;
53 }
54
56 long len,
int channels)
57 {
59 if(channels==2){
63 }
64 }else{
65 for(c=0; c<channels; c++)
66 for(i=0, j=c; i<
len; i++, j+=channels)
68 }
69 }
70
72 int channels)
73 {
75 unsigned int i;
76 if (channels == 2) {
77 for (i = 0; i <
len; i++) {
78 dst[2*i] = src[0][i];
79 dst[2*i+1] = src[1][i];
80 }
81 } else if (channels == 1 && len < INT_MAX / sizeof(float)) {
82 memcpy(dst, src[0], len * sizeof(float));
83 } else {
84 for (c = 0; c < channels; c++)
85 for (i = 0, j = c; i <
len; i++, j += channels)
86 dst[j] = src[c][i];
87 }
88 }
89
91 {
97
102 }
103
104 /* ffdshow custom code */
106 {
108 if(channels==2){
109 for(i=0; i<
len; i++){
110 dst[2*i] = src[0][i] / 32768.0f;
111 dst[2*i+1] = src[1][i] / 32768.0f;
112 }
113 }else{
114 for(c=0; c<channels; c++)
115 for(i=0, j=c; i<
len; i++, j+=channels)
116 dst[j] = src[c][i] / 32768.0f;
117 }
118 }
119
121 {
123 if(channels==2){
124 for(i=0; i<
len; i++){
125 dst[2*i] = src[0][i];
126 dst[2*i+1] = src[1][i];
127 }
128 }else{
129 for(c=0; c<channels; c++)
130 for(i=0, j=c; i<
len; i++, j+=channels)
131 dst[j] = src[c][i];
132 }
133 }