Browse Source

Headerise each file

tags/v1.8.0
Xerbo 3 years ago
parent
commit
c5ec69f48a
14 changed files with 52 additions and 38 deletions
  1. +1
    -3
      src/color.c
  2. +9
    -0
      src/color.h
  3. +3
    -0
      src/common.h
  4. +1
    -1
      src/filter.h
  5. +1
    -1
      src/filtercoeff.h
  6. +2
    -3
      src/image.c
  7. +9
    -0
      src/image.h
  8. +3
    -20
      src/main.c
  9. +1
    -1
      src/median.c
  10. +5
    -7
      src/pngio.c
  11. +13
    -0
      src/pngio.h
  12. +2
    -1
      src/reg.c
  13. +1
    -0
      src/reg.h
  14. +1
    -1
      src/satcal.h

+ 1
- 3
src/color.c View File

@@ -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){
return (rgb_t){


+ 9
- 0
src/color.h View File

@@ -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];

+ 3
- 0
src/common.h View File

@@ -26,6 +26,8 @@
#define CONTAINS(str, char) (strchr(str, (int) char) != NULL)

// Typedefs
#ifndef STRUCTS_DEFINED
#define STRUCTS_DEFINED
typedef struct {
float r, g, b;
} rgb_t;
@@ -68,3 +70,4 @@ enum effects {
Linear_Equalise='l',
Crop_Noise='c'
};
#endif

+ 1
- 1
src/filter.h View File

@@ -19,4 +19,4 @@
float fir(float *buff, const float *coeff, const int len);
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);

+ 1
- 1
src/filtercoeff.h View File

@@ -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,
-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,
-3.37279e-04 };
-3.37279e-04 };

+ 2
- 3
src/image.c View File

@@ -23,16 +23,15 @@
#include <math.h>
#include <stdlib.h>

#include "common.h"
#include "offsets.h"
#include "reg.h"
#include "image.h"

#define REGORDER 3
typedef struct {
double cf[REGORDER + 1];
} rgparam_t;

extern void polyreg(const int m, const int n, const double x[], const double y[], double c[]);

// Compute regression
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 }


+ 9
- 0
src/image.h View File

@@ -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);

+ 3
- 20
src/main.c View File

@@ -27,32 +27,15 @@
#include <errno.h>
#include <time.h>

#include "common.h"
#include "offsets.h"

// DSP
extern int init_dsp(double F);
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
static SNDFILE *audioFile;


+ 1
- 1
src/median.c View File

@@ -53,4 +53,4 @@ float quick_select(float arr[], int n) {
high = hh - 1;
}
}
#undef ELEM_SWAP
#undef ELEM_SWAP

+ 5
- 7
src/pngio.c View File

@@ -24,12 +24,10 @@
#include <stdint.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) {
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_COMPRESSION_NONE, "Software", VERSION},
{PNG_TEXT_COMPRESSION_NONE, "Software", VERSION, sizeof(VERSION)},
{PNG_TEXT_COMPRESSION_NONE, "Channel", desc, sizeof(desc)},
{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);

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, "Description", "NOAA satellite image", 20}
};


+ 13
- 0
src/pngio.h View File

@@ -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();

+ 2
- 1
src/reg.c View File

@@ -12,9 +12,10 @@

#include <math.h>

#include "reg.h"

#define DMAX 5 /* Maximum degree of polynomial */
#define NMAX 10 /* Maximum number of points */

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[]) {


+ 1
- 0
src/reg.h View File

@@ -0,0 +1 @@
void polyreg(const int M, const int N, const double X[], const double Y[], double C[]);

+ 1
- 1
src/satcal.h View File

@@ -122,4 +122,4 @@ const struct {
}};

const float c1 = 1.1910427e-5;
const float c2 = 1.4387752;
const float c2 = 1.4387752;

Loading…
Cancel
Save