commit 1d298214196a616764c534fd7fc820803d8f28d9 Author: Thierry Leconte Date: Wed Oct 8 16:37:30 2003 +0000 Initial revision diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..fe426b5 --- /dev/null +++ b/Makefile @@ -0,0 +1,17 @@ + +INCLUDES=-I. + +CFLAGS= -O4 $(INCLUDES) + +OBJS= main.o image.o dsp.o filter.o + +atpdec: $(OBJS) + $(CC) -o $@ $(OBJS) -lm -lsndfile -lpng + +main.o: main.c cmap.h +dsp.o: dsp.c filtercoeff.h filter.h +filter.o: filter.c filter.h +image.o: image.c + +clean: + rm -f *.o atpdec diff --git a/convert.c b/convert.c new file mode 100644 index 0000000..6669c09 --- /dev/null +++ b/convert.c @@ -0,0 +1,32 @@ +#include + +main(int argc,char **argv) +{ +FILE *fin,*fout; +int x,y; +int width,height; +int r,v,g; + +fin=fopen(argv[1],"r"); +fout=fopen(argv[2],"w"); + +fscanf(fin,"P3\n"); +fscanf(fin,"%d %d\n",&width,&height); +fscanf(fin,"255\n"); + +fprintf(fout,"png_color cmap[%d][%d]={\n",width,height); + for(y=0;y +#include +#include + +#define Fe 11025 +#define PixelLine 2080 +#define Fp (2*PixelLine) +#define RSMULT 265 +#define Fi (Fp*RSMULT) + +static double FreqOsc=2.0*2400.0/Fe; +static double FreqLine=1.0; +extern int getsample(float *inbuff ,int nb); + +static float pll(float Iv, float Qv) +{ +/* pll coeff */ +#define K1 0.01 +#define K2 5e-6 + +static double PhaseOsc=0.0; + +double DPhi; +double DF; +double Phi; +double I,Q; +double Io,Qo; + +/* quadrature oscillator */ +Phi=M_PI*PhaseOsc; +Io=cos(Phi); Qo=sin(Phi); + +/* phase detector */ +I=Iv*Io+Qv*Qo; +Q=Qv*Io-Iv*Qo; +DPhi=atan2(Q,I)/M_PI; + +/* update */ +DF=K1*DPhi+FreqOsc; +FreqOsc+=K2*DPhi; + +PhaseOsc+=DF; +if (PhaseOsc > 1.0) PhaseOsc-=2.0; +if (PhaseOsc <= -1.0) PhaseOsc+=2.0; + +return (float)I; +} + +static double fr=4800.0/Fe; +static double offset=0.0; + +getamp(float *ambuff,int nb) +{ +#define BLKIN 4096 +static float inbuff[BLKIN]; +static int nin=0; +static int idxin=0; + +int n; + + for(n=0;n0) + memmove(pixelv,pixels,npv*sizeof(float)); + + if(npv=1.0 || ph <= -1.0) { + synced=0; + FreqLine=1.0; + } + + if(synced<8) { + int shift,mshift; + + if(npvmax) { + mshift=shift; + max=corr; + } + } + if(mshift !=0) { + memmove(pixelv,&(pixelv[mshift]),(npv-mshift)*sizeof(float)); + npv-=mshift; + synced=0; + FreqLine=1.0; + } else + synced+=1; + } + + if(npv + +float fir( float *buff, float *coeff, int len) +{ +int i; +double r; + +r=0.0; +for(i=0;i