Browse Source

Add map offset argument, change southbound to northbound

Passes are flipped when northbound, not southbound
tags/v1.8.0
Xerbo 3 years ago
parent
commit
377bc3f9d7
5 changed files with 12 additions and 6 deletions
  1. +2
    -1
      README.md
  2. +1
    -0
      common.h
  3. +1
    -1
      image.c
  4. +7
    -3
      main.c
  5. +1
    -1
      pngio.c

+ 2
- 1
README.md View File

@@ -71,6 +71,7 @@ Apply a falsecolor palette
-p <path> Path to palette
-r Realtime decode
-g Gamma adjustment (1.0 = off)
-k Map offset (in px, default: 0)
```

### Image types
@@ -89,7 +90,7 @@ Apply a falsecolor palette
- `l`: Linear equalise
- `d`: Denoise
- `p`: Precipitation overlay
- `f`: Flip image (for southbound passes)
- `f`: Flip image (for northbound passes)
- `c`: Crop noise from ends of image

## Realtime decoding


+ 1
- 0
common.h View File

@@ -47,6 +47,7 @@ typedef struct {
char *filename; // Output filename
char *palette; // Filename of palette
float gamma; // Gamma
int mapOffset;
} options_t;

enum imagetypes {


+ 1
- 1
image.c View File

@@ -306,7 +306,7 @@ void denoise(float **prow, int nrow, int offset, int width){
}
#undef TRIG_LEVEL

// Flips a channe, for southbound passes
// Flips a channel, for northbound passes
void flipImage(image_t *img, int width, int offset){
for(int y = 1; y < img->nrow; y++){
for(int x = 1; x < ceil(width / 2.0); x++){


+ 7
- 3
main.c View File

@@ -75,11 +75,11 @@ int main(int argc, char **argv) {
usage();
}

options_t opts = { "r", "", 19, "", ".", 0, "", "", 1.0 };
options_t opts = { "r", "", 19, "", ".", 0, "", "", 1.0, 0 };

// Parse arguments
int opt;
while ((opt = getopt(argc, argv, "o:m:d:i:s:e:p:g:r")) != EOF) {
while ((opt = getopt(argc, argv, "o:m:d:i:s:e:p:g:k:r")) != EOF) {
switch (opt) {
case 'd':
opts.path = optarg;
@@ -112,6 +112,9 @@ int main(int argc, char **argv) {
case 'g':
opts.gamma = atof(optarg);
break;
case 'k':
opts.mapOffset = atoi(optarg);
break;
default:
usage();
}
@@ -216,7 +219,7 @@ static int processAudio(char *filename, options_t *opts){
denoise(img.prow, img.nrow, CHB_OFFSET, CH_WIDTH);
}

// Flip, for southbound passes
// Flip, for northbound passes
if(CONTAINS(opts->effects, Flip_Image)){
flipImage(&img, CH_WIDTH, CHA_OFFSET);
flipImage(&img, CH_WIDTH, CHB_OFFSET);
@@ -345,6 +348,7 @@ static void usage(void) {
" -p <path> Path to palette\n"
" -r Realtime decode\n"
" -g Gamma adjustment (1.0 = off)\n"
" -k Map offset (in px, default: 0)"
"\nRefer to the README for more infomation\n");

exit(EINVAL);


+ 1
- 1
pngio.c View File

@@ -429,7 +429,7 @@ int ImageOut(options_t *opts, image_t *img, int offset, int width, char *desc, c

// Map stuff
if(opts->map != NULL && opts->map[0] != '\0'){
if(!mapOverlay(opts->map, crow, img->nrow, img->zenith, CONTAINS(opts->type, MCIR))){
if(!mapOverlay(opts->map, crow, img->nrow, img->zenith+opts->mapOffset, CONTAINS(opts->type, MCIR))){
fprintf(stderr, "Skipping MCIR generation.\n");
return 0;
}


Loading…
Cancel
Save