Subversion Repositories svnkaklik

Rev

Rev 542 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 542 Rev 543
Line 187... Line 187...
187
unsigned int linear_windowed_chirp(unsigned int *pole, unsigned int delka_pole,unsigned int offset)
187
unsigned int linear_windowed_chirp(unsigned int *pole, unsigned int delka_pole,unsigned int offset)
188
{
188
{
189
unsigned int maxval = (1 << (snd_pcm_format_width(format) - 1)) - 1;
189
unsigned int maxval = (1 << (snd_pcm_format_width(format) - 1)) - 1;
190
 
190
 
191
static const float f0 = 1000;
191
static const float f0 = 1000;
192
static const float fmax = 10000;
192
static const float fmax = 7000;
193
static const float Tw = 0.002;
193
static const float Tw = 0.002;
194
static float k;
194
static float k;
195
 
195
 
196
unsigned int n=0;
196
unsigned int n=0;
197
double t;
197
double t;
Line 411... Line 411...
411
	  L_signal[i]=signal[j];
411
	  L_signal[i]=signal[j];
412
	  R_signal[i]=signal[j+1];
412
	  R_signal[i]=signal[j+1];
413
	  j+=2;
413
	  j+=2;
414
	}
414
	}
415
 
415
 
-
 
416
//        linear_windowed_chirp(L_signal,1000000, 1000);
-
 
417
 
416
	printf("\nData transmitted... \ncorrelating...\n");
418
	printf("\nData transmitted... \ncorrelating...\n");
417
	for(n=0; n < (SIGNAL_SAMPLES - chirp_size);n++){
419
	for(n=0; n < (SIGNAL_SAMPLES - chirp_size);n++){
418
	  l=0;
420
	  l=0;
419
          r=0;
421
          r=0;
420
	  for(m=CHIRP_OFFSET;m < 500;m++)
422
	  for(m=CHIRP_OFFSET;m < chirp_size;m++)
421
          {
423
          {
422
            l += chirp[m]*L_signal[m+n];	// correlate with left channel
424
            l += chirp[m]*L_signal[m+n];	// correlate with left channel
423
            r += chirp[m]*R_signal[m+n];	// correlate with right channel
425
            r += chirp[m]*R_signal[m+n];	// correlate with right channel
424
          }
426
          }
425
	  correlationl[n]=l;
427
	  correlationl[n]=l;
426
	  correlationr[n]=r;
428
	  correlationr[n]=r;
427
	}
429
	}
428
 
430
 
429
/*	printf("\nSearching echos...\n");
431
	printf("\nSearching echos...\n");
430
	r=0;
432
	r=0;
431
	l=0;
433
	l=0;
432
	for(n=0; n < (SIGNAL_SAMPLES - chirp_size);n++){			//najde nejvetsi korelace
434
	for(n=0; n < (SIGNAL_SAMPLES - chirp_size);n++){			//najde nejvetsi korelace
433
	  if (l < correlationl[n]){
435
	  if (l < correlationl[n]){
434
	  delay[1] = n;
436
	  delay[1] = n;
Line 436... Line 438...
436
	  }
438
	  }
437
	  if (r < correlationr[n]){
439
	  if (r < correlationr[n]){
438
	  delay[2] = n;
440
	  delay[2] = n;
439
	  r = correlationr[n];
441
	  r = correlationr[n];
440
	  }
442
	  }
441
	}*/
443
	}
442
 
444
 
443
  out=fopen("./output.txt","w");
445
  out=fopen("./output.txt","w");
444
  j=0;
446
  j=0;
445
  for(i=0;i<=60000;i++){
447
  for(i=0;i<=100000;i++){
446
    fprintf(out,"%6d %6d %6d %6d %9ld %9ld\n",i,chirp[i],L_signal[i],R_signal[i],correlationl[i], correlationr[i]);
448
    fprintf(out,"%6d %6d %6d %6d %9ld %9ld\n",i,chirp[i],L_signal[i],R_signal[i],correlationl[i], correlationr[i]);
447
    j+=2;
449
    j+=2;
448
  }
450
  }
449
  fclose(out);
451
  fclose(out);
450
 
452