|
@@ -131,7 +131,7 @@ static double pll(double I, double Q) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Convert samples into pixels |
|
|
// Convert samples into pixels |
|
|
static int getamp(double *ampbuff, int count, apt_getsample_t getsample, void *context) { |
|
|
|
|
|
|
|
|
static int getamp(double *ampbuff, int count, apt_getsamples_t getsamples, void *context) { |
|
|
static float inbuff[BLKIN]; |
|
|
static float inbuff[BLKIN]; |
|
|
static int idxin = 0; |
|
|
static int idxin = 0; |
|
|
static int nin = 0; |
|
|
static int nin = 0; |
|
@@ -147,7 +147,7 @@ static int getamp(double *ampbuff, int count, apt_getsample_t getsample, void *c |
|
|
idxin = 0; |
|
|
idxin = 0; |
|
|
|
|
|
|
|
|
// Read some samples |
|
|
// Read some samples |
|
|
res = getsample(context, &(inbuff[nin]), BLKIN - nin); |
|
|
|
|
|
|
|
|
res = getsamples(context, &(inbuff[nin]), BLKIN - nin); |
|
|
nin += res; |
|
|
nin += res; |
|
|
|
|
|
|
|
|
// Make sure there is enough samples to continue |
|
|
// Make sure there is enough samples to continue |
|
@@ -168,7 +168,7 @@ static int getamp(double *ampbuff, int count, apt_getsample_t getsample, void *c |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Sub-pixel offsetting + FIR compensation |
|
|
// Sub-pixel offsetting + FIR compensation |
|
|
int getpixelv(float *pvbuff, int count, apt_getsample_t getsample, void *context) { |
|
|
|
|
|
|
|
|
int getpixelv(float *pvbuff, int count, apt_getsamples_t getsamples, void *context) { |
|
|
// Amplitude buffer |
|
|
// Amplitude buffer |
|
|
static double ampbuff[BLKAMP]; |
|
|
static double ampbuff[BLKAMP]; |
|
|
static int nam = 0; |
|
|
static int nam = 0; |
|
@@ -187,7 +187,7 @@ int getpixelv(float *pvbuff, int count, apt_getsample_t getsample, void *context |
|
|
int res; |
|
|
int res; |
|
|
memmove(ampbuff, &(ampbuff[idxam]), nam * sizeof(double)); |
|
|
memmove(ampbuff, &(ampbuff[idxam]), nam * sizeof(double)); |
|
|
idxam = 0; |
|
|
idxam = 0; |
|
|
res = getamp(&(ampbuff[nam]), BLKAMP - nam, getsample, context); |
|
|
|
|
|
|
|
|
res = getamp(&(ampbuff[nam]), BLKAMP - nam, getsamples, context); |
|
|
nam += res; |
|
|
nam += res; |
|
|
if (nam < m) |
|
|
if (nam < m) |
|
|
return n; |
|
|
return n; |
|
@@ -207,7 +207,7 @@ int getpixelv(float *pvbuff, int count, apt_getsample_t getsample, void *context |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Get an entire row of pixels, aligned with sync markers |
|
|
// Get an entire row of pixels, aligned with sync markers |
|
|
int apt_getpixelrow(float *pixelv, int nrow, int *zenith, int reset, apt_getsample_t getsample, void *context) { |
|
|
|
|
|
|
|
|
int apt_getpixelrow(float *pixelv, int nrow, int *zenith, int reset, apt_getsamples_t getsamples, void *context) { |
|
|
static float pixels[PixelLine + SyncFilterLen]; |
|
|
static float pixels[PixelLine + SyncFilterLen]; |
|
|
static int npv; |
|
|
static int npv; |
|
|
static int synced = 0; |
|
|
static int synced = 0; |
|
@@ -225,7 +225,7 @@ int apt_getpixelrow(float *pixelv, int nrow, int *zenith, int reset, apt_getsamp |
|
|
|
|
|
|
|
|
// Get the sync line |
|
|
// Get the sync line |
|
|
if (npv < SyncFilterLen + 2) { |
|
|
if (npv < SyncFilterLen + 2) { |
|
|
res = getpixelv(&(pixelv[npv]), SyncFilterLen + 2 - npv, getsample, context); |
|
|
|
|
|
|
|
|
res = getpixelv(&(pixelv[npv]), SyncFilterLen + 2 - npv, getsamples, context); |
|
|
npv += res; |
|
|
npv += res; |
|
|
if (npv < SyncFilterLen + 2) |
|
|
if (npv < SyncFilterLen + 2) |
|
|
return 0; |
|
|
return 0; |
|
@@ -256,7 +256,7 @@ int apt_getpixelrow(float *pixelv, int nrow, int *zenith, int reset, apt_getsamp |
|
|
static int lastmshift; |
|
|
static int lastmshift; |
|
|
|
|
|
|
|
|
if (npv < PixelLine + SyncFilterLen) { |
|
|
if (npv < PixelLine + SyncFilterLen) { |
|
|
res = getpixelv(&(pixelv[npv]), PixelLine + SyncFilterLen - npv, getsample, context); |
|
|
|
|
|
|
|
|
res = getpixelv(&(pixelv[npv]), PixelLine + SyncFilterLen - npv, getsamples, context); |
|
|
npv += res; |
|
|
npv += res; |
|
|
if (npv < PixelLine + SyncFilterLen) |
|
|
if (npv < PixelLine + SyncFilterLen) |
|
|
return 0; |
|
|
return 0; |
|
@@ -294,7 +294,7 @@ int apt_getpixelrow(float *pixelv, int nrow, int *zenith, int reset, apt_getsamp |
|
|
|
|
|
|
|
|
// Get the rest of this row |
|
|
// Get the rest of this row |
|
|
if (npv < PixelLine) { |
|
|
if (npv < PixelLine) { |
|
|
res = getpixelv(&(pixelv[npv]), PixelLine - npv, getsample, context); |
|
|
|
|
|
|
|
|
res = getpixelv(&(pixelv[npv]), PixelLine - npv, getsamples, context); |
|
|
npv += res; |
|
|
npv += res; |
|
|
if (npv < PixelLine) |
|
|
if (npv < PixelLine) |
|
|
return 0; |
|
|
return 0; |
|
|