summaryrefslogtreecommitdiffstats
path: root/TOOLS/alaw-gen.c
diff options
context:
space:
mode:
authorarpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-05-25 18:17:27 +0000
committerarpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-05-25 18:17:27 +0000
commit6c18809ad203aff398276442272c8064305ebb0a (patch)
tree951dfa214a039607c2b966107131c1eb56026025 /TOOLS/alaw-gen.c
parent80ab4a31ae8199b3d836e40c860dbf5a5483f697 (diff)
downloadmpv-6c18809ad203aff398276442272c8064305ebb0a.tar.bz2
mpv-6c18809ad203aff398276442272c8064305ebb0a.tar.xz
alaw and ulaw table generator
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@880 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'TOOLS/alaw-gen.c')
-rw-r--r--TOOLS/alaw-gen.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/TOOLS/alaw-gen.c b/TOOLS/alaw-gen.c
new file mode 100644
index 0000000000..529a1ff056
--- /dev/null
+++ b/TOOLS/alaw-gen.c
@@ -0,0 +1,47 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+// sox -t raw -A -r 8000 -b alaw.alaw -t sw alaw.out
+
+int main(){
+int i;
+FILE *f;
+
+f=fopen("alaw.dat","wb");
+for(i=0;i<256;i++) fwrite(&i,1,1,f);
+fclose(f);
+
+system("sox -t raw -A -r 8000 -b alaw.dat -t sw alaw.out");
+
+printf("// Generated by TOOLS/alaw-gen.c\n");
+
+printf("\nshort alaw2short[]={\n");
+
+f=fopen("alaw.out","rb");
+for(i=0;i<256;i++){
+ signed short x;
+ fread(&x,2,1,f);
+ printf("%6d",x);
+ if(i!=255) putchar(',');
+ if((i&7)==7) printf("\n");
+}
+fclose(f);
+printf("}\n");
+
+system("sox -t raw -U -r 8000 -b alaw.dat -t sw alaw.out");
+
+printf("\nshort ulaw2short[]={\n");
+
+f=fopen("alaw.out","rb");
+for(i=0;i<256;i++){
+ signed short x;
+ fread(&x,2,1,f);
+ printf("%6d",x);
+ if(i!=255) putchar(',');
+ if((i&7)==7) printf("\n");
+}
+fclose(f);
+printf("}\n");
+
+
+}