소스 검색

Readd apt_image_t::zenith and MSVC complex #20

tags/v1.8.0
Xerbo 2 년 전
부모
커밋
8be50e7844
No known key found for this signature in database GPG 키 ID: 34103F6D8F11CEB0
3개의 변경된 파일21개의 추가작업 그리고 5개의 파일을 삭제
  1. +1
    -0
      src/apt.h
  2. +18
    -3
      src/dsp.c
  3. +2
    -2
      src/main.c

+ 1
- 0
src/apt.h 파일 보기

@@ -81,6 +81,7 @@ typedef int (*apt_getsamples_t)(void *context, float *samples, int count);
typedef struct {
float *prow[APT_MAX_HEIGHT]; // Row buffers
int nrow; // Number of rows
int zenith; // Row in image where satellite reaches peak elevation
apt_channel_t chA, chB; // ID of each channel
char name[256]; // Stripped filename
char *palette; // Filename of palette


+ 18
- 3
src/dsp.c 파일 보기

@@ -26,6 +26,12 @@
#include "taps.h"
#include "util.h"

#ifdef _MSC_VER
typedef _Fcomplex complexf_t;
#else
typedef complex float complexf_t;
#endif

// Block sizes
#define BLKAMP 32768
#define BLKIN 32768
@@ -59,11 +65,11 @@ int apt_init(double sample_rate) {
return 0;
}

static float pll(float complex in) {
static float pll(complexf_t in) {
static float oscillator_phase = 0.0;

// Internal oscillator
float complex osc = cos(oscillator_phase) + -sin(oscillator_phase)*I;
complexf_t osc = cos(oscillator_phase) + -sin(oscillator_phase)*I;
in *= osc;

// Error detector
@@ -104,7 +110,7 @@ static int getamp(float *ampbuff, int count, apt_getsamples_t getsamples, void *
}

// Process read samples into a brightness value
float complex sample = hilbert_transform(&inbuff[idxin], hilbert_filter, HILBERT_FILTER_SIZE);
complexf_t sample = hilbert_transform(&inbuff[idxin], hilbert_filter, HILBERT_FILTER_SIZE);
ampbuff[n] = pll(sample);

// Increment current sample
@@ -159,6 +165,7 @@ int apt_getpixelrow(float *pixelv, int nrow, int *zenith, int reset, apt_getsamp
static size_t npv;
static int synced = 0;
static float max = 0.0;
static float minDoppler = 1000000000, previous = 0;

if(reset) synced = 0;

@@ -182,6 +189,14 @@ int apt_getpixelrow(float *pixelv, int nrow, int *zenith, int reset, apt_getsamp
corr = convolve(&pixelv[1], sync_pattern, SYNC_PATTERN_SIZE - 1);
lcorr = convolve(&pixelv[2], sync_pattern, SYNC_PATTERN_SIZE - 2);
FreqLine = 1.0+((ecorr-lcorr) / corr / APT_IMG_WIDTH / 4.0);

float val = fabs(lcorr - ecorr)*0.25 + previous*0.75;
if(val < minDoppler && nrow > 10){
minDoppler = val;
*zenith = nrow;
}
previous = fabs(lcorr - ecorr);

// The point in which the pixel offset is recalculated
if (corr < 0.75 * max) {
synced = 0;


+ 2
- 2
src/main.c 파일 보기

@@ -172,7 +172,7 @@ static int processAudio(char *filename, options_t *opts){
img.prow[img.nrow] = (float *) malloc(sizeof(float) * APT_PROW_WIDTH);

// Write into memory and break the loop when there are no more samples to read
if (apt_getpixelrow(img.prow[img.nrow], img.nrow, NULL, (img.nrow == 0), getsamples, NULL) == 0)
if (apt_getpixelrow(img.prow[img.nrow], img.nrow, &img.zenith, (img.nrow == 0), getsamples, NULL) == 0)
break;

if(opts->realtime) pushRow(img.prow[img.nrow], APT_IMG_WIDTH);
@@ -197,7 +197,7 @@ static int processAudio(char *filename, options_t *opts){

// Crop noise from start and end of image
if(CONTAINS(opts->effects, Crop_Noise)){
apt_cropNoise(&img);
img.zenith -= apt_cropNoise(&img);
}

// Denoise


불러오는 중...
취소
저장