view TOOLS/alaw-gen.c @ 17893:aa38bf333f18

1.1230: Typo fix: "URLs to forces" --> "URLs to force" 1.1229: Allows the LIVE555 library to forces the client's port to be used... 1.1228: dwStart support for mencoder. 1.1227: This patch removes mmap support because it doesn't have any benefit. 1.1226: Rephrase telecine and film2pal mpegopts. 1.1225: Remove stray space. 1.1224: mention film2pal in -mpegopts 1.1223: -fixed-vo shall no longer be called BETA-CODE.
author kraymer
date Sat, 18 Mar 2006 20:02:47 +0000
parents 714bc8aadb68
children f15f95c2671a
line wrap: on
line source

#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");


}