@@ -17,9 +17,7 @@ | |||||
* | * | ||||
*/ | */ | ||||
#include "common.h" | |||||
#define MCOMPOSITE(m1, a1, m2, a2) (m1*a1 + m2*a2*(1-a1)) | |||||
#include "color.h" | |||||
rgb_t applyPalette(char *palette, int val){ | rgb_t applyPalette(char *palette, int val){ | ||||
return (rgb_t){ | return (rgb_t){ | ||||
@@ -0,0 +1,9 @@ | |||||
#include "common.h" | |||||
#define MCOMPOSITE(m1, a1, m2, a2) (m1*a1 + m2*a2*(1-a1)) | |||||
rgb_t applyPalette(char *palette, int val); | |||||
rgb_t RGBcomposite(rgb_t top, float top_a, rgb_t bottom, float bottom_a); | |||||
char TempPalette[256*3]; | |||||
char PrecipPalette[58*3]; |
@@ -26,6 +26,8 @@ | |||||
#define CONTAINS(str, char) (strchr(str, (int) char) != NULL) | #define CONTAINS(str, char) (strchr(str, (int) char) != NULL) | ||||
// Typedefs | // Typedefs | ||||
#ifndef STRUCTS_DEFINED | |||||
#define STRUCTS_DEFINED | |||||
typedef struct { | typedef struct { | ||||
float r, g, b; | float r, g, b; | ||||
} rgb_t; | } rgb_t; | ||||
@@ -68,3 +70,4 @@ enum effects { | |||||
Linear_Equalise='l', | Linear_Equalise='l', | ||||
Crop_Noise='c' | Crop_Noise='c' | ||||
}; | }; | ||||
#endif |
@@ -19,4 +19,4 @@ | |||||
float fir(float *buff, const float *coeff, const int len); | float fir(float *buff, const float *coeff, const int len); | ||||
void iqfir(float *buff, const float *coeff, const int len, double *I, double *Q); | void iqfir(float *buff, const float *coeff, const int len, double *I, double *Q); | ||||
float rsfir(double *buff, const float *coeff, const int len, const double offset, const double delta); | |||||
float rsfir(double *buff, const float *coeff, const int len, const double offset, const double delta); |
@@ -93,4 +93,4 @@ const float rsfilter[RSFilterLen] = { -3.37279e-04, -8.80292e-06, -3.96418e-04, | |||||
-6.46202e-04, -8.02450e-04, -9.64235e-04, -1.08660e-03, -1.15302e-03, -1.23904e-03, -1.20955e-03, | -6.46202e-04, -8.02450e-04, -9.64235e-04, -1.08660e-03, -1.15302e-03, -1.23904e-03, -1.20955e-03, | ||||
-1.26937e-03, -1.15443e-03, -1.19836e-03, -1.01377e-03, -1.05669e-03, -8.15327e-04, -8.79730e-04, | -1.26937e-03, -1.15443e-03, -1.19836e-03, -1.01377e-03, -1.05669e-03, -8.15327e-04, -8.79730e-04, | ||||
-5.93148e-04, -6.95337e-04, -3.75376e-04, -5.27511e-04, -1.78544e-04, -3.96418e-04, -8.80292e-06, | -5.93148e-04, -6.95337e-04, -3.75376e-04, -5.27511e-04, -1.78544e-04, -3.96418e-04, -8.80292e-06, | ||||
-3.37279e-04 }; | |||||
-3.37279e-04 }; |
@@ -23,16 +23,15 @@ | |||||
#include <math.h> | #include <math.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include "common.h" | |||||
#include "offsets.h" | #include "offsets.h" | ||||
#include "reg.h" | |||||
#include "image.h" | |||||
#define REGORDER 3 | #define REGORDER 3 | ||||
typedef struct { | typedef struct { | ||||
double cf[REGORDER + 1]; | double cf[REGORDER + 1]; | ||||
} rgparam_t; | } rgparam_t; | ||||
extern void polyreg(const int m, const int n, const double x[], const double y[], double c[]); | |||||
// Compute regression | // Compute regression | ||||
static void rgcomp(double x[16], rgparam_t * rgpr) { | static void rgcomp(double x[16], rgparam_t * rgpr) { | ||||
// { 0.106, 0.215, 0.324, 0.433, 0.542, 0.652, 0.78, 0.87, 0.0 } | // { 0.106, 0.215, 0.324, 0.433, 0.542, 0.652, 0.78, 0.87, 0.0 } | ||||
@@ -0,0 +1,9 @@ | |||||
#include "common.h" | |||||
void histogramEqualise(float **prow, int nrow, int offset, int width); | |||||
void linearEnhance(float **prow, int nrow, int offset, int width); | |||||
int calibrate(float **prow, int nrow, int offset, int width) ; | |||||
void denoise(float **prow, int nrow, int offset, int width); | |||||
void flipImage(image_t *img, int width, int offset); | |||||
void cropNoise(image_t *img); | |||||
void temperature(options_t *opts, image_t *img, int offset, int width); |
@@ -27,32 +27,15 @@ | |||||
#include <errno.h> | #include <errno.h> | ||||
#include <time.h> | #include <time.h> | ||||
#include "common.h" | |||||
#include "offsets.h" | #include "offsets.h" | ||||
// DSP | // DSP | ||||
extern int init_dsp(double F); | extern int init_dsp(double F); | ||||
extern int getpixelrow(float *pixelv, int nrow, int *zenith, int reset); | extern int getpixelrow(float *pixelv, int nrow, int *zenith, int reset); | ||||
// I/O | |||||
extern int readRawImage(char *filename, float **prow, int *nrow); | |||||
extern int ImageOut(options_t *opts, image_t *img, int offset, int width, char *desc, char chid, char *palette); | |||||
extern int initWriter(options_t *opts, image_t *img, int width, int height, char *desc, char *chid); | |||||
extern void pushRow(float *row, int width); | |||||
extern void closeWriter(); | |||||
// Image functions | |||||
extern int calibrate(float **prow, int nrow, int offset, int width); | |||||
extern void histogramEqualise(float **prow, int nrow, int offset, int width); | |||||
extern void linearEnhance(float **prow, int nrow, int offset, int width); | |||||
extern void temperature(options_t *opts, image_t *img, int offset, int width); | |||||
extern void denoise(float **prow, int nrow, int offset, int width); | |||||
extern void flipImage(image_t *img, int width, int offset); | |||||
extern void cropNoise(image_t *img); | |||||
// Palettes | |||||
extern char GviPalette[256*3]; | |||||
extern char TempPalette[256*3]; | |||||
#include "pngio.h" | |||||
#include "image.h" | |||||
#include "color.h" | |||||
// Audio file | // Audio file | ||||
static SNDFILE *audioFile; | static SNDFILE *audioFile; | ||||
@@ -53,4 +53,4 @@ float quick_select(float arr[], int n) { | |||||
high = hh - 1; | high = hh - 1; | ||||
} | } | ||||
} | } | ||||
#undef ELEM_SWAP | |||||
#undef ELEM_SWAP |
@@ -24,12 +24,10 @@ | |||||
#include <stdint.h> | #include <stdint.h> | ||||
#include <math.h> | #include <math.h> | ||||
#include "common.h" | |||||
#include "offsets.h" | |||||
#include "pngio.h" | |||||
extern char PrecipPalette[256*3]; | |||||
extern rgb_t applyPalette(char *palette, int val); | |||||
extern rgb_t RGBcomposite(rgb_t top, float top_a, rgb_t bottom, float bottom_a); | |||||
#pragma GCC diagnostic ignored "-Wmissing-field-initializers" | |||||
#pragma clang diagnostic ignored "-Wmissing-field-initializers" | |||||
int mapOverlay(char *filename, rgb_t **crow, int nrow, int zenith, int MCIR) { | int mapOverlay(char *filename, rgb_t **crow, int nrow, int zenith, int MCIR) { | ||||
FILE *fp = fopen(filename, "rb"); | FILE *fp = fopen(filename, "rb"); | ||||
@@ -323,7 +321,7 @@ int ImageOut(options_t *opts, image_t *img, int offset, int width, char *desc, c | |||||
} | } | ||||
png_text meta[] = { | png_text meta[] = { | ||||
{PNG_TEXT_COMPRESSION_NONE, "Software", VERSION}, | |||||
{PNG_TEXT_COMPRESSION_NONE, "Software", VERSION, sizeof(VERSION)}, | |||||
{PNG_TEXT_COMPRESSION_NONE, "Channel", desc, sizeof(desc)}, | {PNG_TEXT_COMPRESSION_NONE, "Channel", desc, sizeof(desc)}, | ||||
{PNG_TEXT_COMPRESSION_NONE, "Description", "NOAA satellite image", 20} | {PNG_TEXT_COMPRESSION_NONE, "Description", "NOAA satellite image", 20} | ||||
}; | }; | ||||
@@ -497,7 +495,7 @@ int initWriter(options_t *opts, image_t *img, int width, int height, char *desc, | |||||
sprintf(outName, "%s/%s-%s.png", opts->path, img->name, chid); | sprintf(outName, "%s/%s-%s.png", opts->path, img->name, chid); | ||||
png_text meta[] = { | png_text meta[] = { | ||||
{PNG_TEXT_COMPRESSION_NONE, "Software", VERSION}, | |||||
{PNG_TEXT_COMPRESSION_NONE, "Software", VERSION, sizeof(VERSION)}, | |||||
{PNG_TEXT_COMPRESSION_NONE, "Channel", desc, sizeof(desc)}, | {PNG_TEXT_COMPRESSION_NONE, "Channel", desc, sizeof(desc)}, | ||||
{PNG_TEXT_COMPRESSION_NONE, "Description", "NOAA satellite image", 20} | {PNG_TEXT_COMPRESSION_NONE, "Description", "NOAA satellite image", 20} | ||||
}; | }; | ||||
@@ -0,0 +1,13 @@ | |||||
#include "common.h" | |||||
#include "offsets.h" | |||||
#include "color.h" | |||||
int mapOverlay(char *filename, rgb_t **crow, int nrow, int zenith, int MCIR); | |||||
int readRawImage(char *filename, float **prow, int *nrow); | |||||
int readPalette(char *filename, rgb_t **pixels); | |||||
void prow2crow(float **prow, int nrow, char *palette, rgb_t **crow); | |||||
int applyUserPalette(float **prow, int nrow, char *filename, rgb_t **crow); | |||||
int ImageOut(options_t *opts, image_t *img, int offset, int width, char *desc, char chid, char *palette); | |||||
int initWriter(options_t *opts, image_t *img, int width, int height, char *desc, char *chid); | |||||
void pushRow(float *row, int width); | |||||
void closeWriter(); |
@@ -12,9 +12,10 @@ | |||||
#include <math.h> | #include <math.h> | ||||
#include "reg.h" | |||||
#define DMAX 5 /* Maximum degree of polynomial */ | #define DMAX 5 /* Maximum degree of polynomial */ | ||||
#define NMAX 10 /* Maximum number of points */ | #define NMAX 10 /* Maximum number of points */ | ||||
static void FactPiv(int N, double A[DMAX][DMAX], double B[], double Cf[]); | static void FactPiv(int N, double A[DMAX][DMAX], double B[], double Cf[]); | ||||
void polyreg(const int M, const int N, const double X[], const double Y[], double C[]) { | void polyreg(const int M, const int N, const double X[], const double Y[], double C[]) { | ||||
@@ -0,0 +1 @@ | |||||
void polyreg(const int M, const int N, const double X[], const double Y[], double C[]); |
@@ -122,4 +122,4 @@ const struct { | |||||
}}; | }}; | ||||
const float c1 = 1.1910427e-5; | const float c1 = 1.1910427e-5; | ||||
const float c2 = 1.4387752; | |||||
const float c2 = 1.4387752; |