view TOOLS/alaw-gen.c @ 27146:a8681ded2d41

r25756: Document vo gl lscale=3 r25757: Add experimental unsharp-mask OpenGL scaler. r25767: misc spelling fixes r25768: misc markup fixes r25769: better ao/vo profile examples r25786: Add a fragment program for 5x5 unsharp masking r25821: (instead of adding quotation mark, this added a missing paragraph!) r25955: (previously applied) r25973: Hint about possible libmpeg2 problems with -hardframedrop r25984: Slightly document alpha for OSD color r26014: -dumpstream will not dump chapters anymore r26015: Document that framedrop needs -no-correct-pts r26017: removed wrong example
author kraymer
date Mon, 30 Jun 2008 19:35:36 +0000
parents 044b3c830459
children b573c7c7173b
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(void){
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\n");

printf("#ifndef MPLAYER_ALAW_H\n");
printf("#define MPLAYER_ALAW_H\n");

printf("\nconst short alaw2short[]={\n");

f=fopen("alaw.out","rb");
for(i=0;i<256;i++){
  signed short x;
  fread(&x,2,1,f);
  printf("%7d",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("\nconst short ulaw2short[]={\n");

f=fopen("alaw.out","rb");
for(i=0;i<256;i++){
  signed short x;
  fread(&x,2,1,f);
  printf("%7d",x);
  if(i!=255) putchar(',');
  if((i&7)==7) printf("\n");
}
fclose(f);
printf("};\n\n");

printf("#endif /* MPLAYER_ALAW_H */\n");

return 0;
}