Mercurial > mplayer.hg
annotate TOOLS/alaw-gen.c @ 34573:2d60b7bc2918
Support RGB48 tiff decoding.
author | cehoyos |
---|---|
date | Tue, 07 Feb 2012 23:09:52 +0000 |
parents | b573c7c7173b |
children |
rev | line source |
---|---|
30416
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
26057
diff
changeset
|
1 /* |
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
26057
diff
changeset
|
2 * This program is free software; you can redistribute it and/or modify |
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
26057
diff
changeset
|
3 * it under the terms of the GNU General Public License as published by |
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
26057
diff
changeset
|
4 * the Free Software Foundation; either version 2 of the License, or |
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
26057
diff
changeset
|
5 * (at your option) any later version. |
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
26057
diff
changeset
|
6 * |
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
26057
diff
changeset
|
7 * This program is distributed in the hope that it will be useful, |
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
26057
diff
changeset
|
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
26057
diff
changeset
|
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
26057
diff
changeset
|
10 * GNU General Public License for more details. |
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
26057
diff
changeset
|
11 * |
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
26057
diff
changeset
|
12 * You should have received a copy of the GNU General Public License along |
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
26057
diff
changeset
|
13 * with this program; if not, write to the Free Software Foundation, Inc., |
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
26057
diff
changeset
|
14 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
26057
diff
changeset
|
15 */ |
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
26057
diff
changeset
|
16 |
879 | 17 #include <stdio.h> |
18 #include <stdlib.h> | |
19 | |
20 // sox -t raw -A -r 8000 -b alaw.alaw -t sw alaw.out | |
21 | |
23662
5c5fb6af79d1
Mark main() function as a function that takes no parameters.
diego
parents:
23659
diff
changeset
|
22 int main(void){ |
879 | 23 int i; |
24 FILE *f; | |
25 | |
26 f=fopen("alaw.dat","wb"); | |
27 for(i=0;i<256;i++) fwrite(&i,1,1,f); | |
28 fclose(f); | |
29 | |
30 system("sox -t raw -A -r 8000 -b alaw.dat -t sw alaw.out"); | |
31 | |
25865
b1316c443f87
Add multiple inclusion guards to generated header file.
diego
parents:
25864
diff
changeset
|
32 printf("// Generated by TOOLS/alaw-gen.c\n\n"); |
b1316c443f87
Add multiple inclusion guards to generated header file.
diego
parents:
25864
diff
changeset
|
33 |
26057
044b3c830459
Add MPLAYER_ prefix to multiple inclusion guard of generated file.
diego
parents:
25865
diff
changeset
|
34 printf("#ifndef MPLAYER_ALAW_H\n"); |
044b3c830459
Add MPLAYER_ prefix to multiple inclusion guard of generated file.
diego
parents:
25865
diff
changeset
|
35 printf("#define MPLAYER_ALAW_H\n"); |
879 | 36 |
25863 | 37 printf("\nconst short alaw2short[]={\n"); |
879 | 38 |
39 f=fopen("alaw.out","rb"); | |
40 for(i=0;i<256;i++){ | |
41 signed short x; | |
42 fread(&x,2,1,f); | |
25864
ae6c30322f95
Change format string so that the table is nicely aligned.
diego
parents:
25863
diff
changeset
|
43 printf("%7d",x); |
879 | 44 if(i!=255) putchar(','); |
45 if((i&7)==7) printf("\n"); | |
46 } | |
47 fclose(f); | |
880 | 48 printf("};\n"); |
879 | 49 |
50 system("sox -t raw -U -r 8000 -b alaw.dat -t sw alaw.out"); | |
51 | |
25863 | 52 printf("\nconst short ulaw2short[]={\n"); |
879 | 53 |
54 f=fopen("alaw.out","rb"); | |
55 for(i=0;i<256;i++){ | |
56 signed short x; | |
57 fread(&x,2,1,f); | |
25864
ae6c30322f95
Change format string so that the table is nicely aligned.
diego
parents:
25863
diff
changeset
|
58 printf("%7d",x); |
879 | 59 if(i!=255) putchar(','); |
60 if((i&7)==7) printf("\n"); | |
61 } | |
62 fclose(f); | |
25865
b1316c443f87
Add multiple inclusion guards to generated header file.
diego
parents:
25864
diff
changeset
|
63 printf("};\n\n"); |
b1316c443f87
Add multiple inclusion guards to generated header file.
diego
parents:
25864
diff
changeset
|
64 |
26057
044b3c830459
Add MPLAYER_ prefix to multiple inclusion guard of generated file.
diego
parents:
25865
diff
changeset
|
65 printf("#endif /* MPLAYER_ALAW_H */\n"); |
879 | 66 |
23659
f15f95c2671a
Fix "control reaches end of non-void function" warnings.
diego
parents:
880
diff
changeset
|
67 return 0; |
879 | 68 } |