nice refactors, now way cleaner to work with!

This commit is contained in:
2026-04-07 17:20:42 +02:00
parent 966c15cffb
commit bdc58f5b48
17 changed files with 61 additions and 31 deletions

17
include/encoder/image.h Normal file
View File

@@ -0,0 +1,17 @@
#ifndef IMAGE_H
#define IMAGE_H
#include <stdint.h>
typedef struct {
int width;
int height;
uint8_t *data;
} image_t;
int image_load(image_t *img, const char *filename);
int image_resize(image_t *src, image_t *dst, int new_w, int new_h);
void image_free(image_t *img);
void image_free_raw(image_t *img);
#endif // !IMAGE_H

View File

@@ -0,0 +1,23 @@
#ifndef MARTIN_H
#define MARTIN_H
#include "sound/wav.h"
#include <stdint.h>
typedef struct {
uint8_t vis_code; // in hexadecimal not normal decimal (ex 0x08)
int width;
int height;
double sync_ms;
double sync_porch_ms;
double separator_ms;
double scan_ms;
} martin_mode_t;
extern const martin_mode_t MARTIN_M1;
extern const martin_mode_t MARTIN_M2;
void martin_encode_image(wav_t *wav, uint8_t *rgb, const martin_mode_t *mode);
int sstv_encode_martin(const char *input_image, const char *output_wav, const martin_mode_t *mode);
#endif // !MARTIN_H

View File

@@ -0,0 +1,12 @@
#ifndef ROBOT36_H
#define ROBOT36_H
#include "sound/wav.h"
#include <stdint.h>
#define ROBOT36_WIDTH 320
#define ROBOT36_HEIGHT 240
void robot36_encode_image(wav_t *wav, uint8_t *rgb);
#endif // !ROBOT36_H

View File

@@ -0,0 +1,24 @@
#ifndef SCOTTIE_H
#define SCOTTIE_H
#include "sound/wav.h"
#include <stdint.h>
typedef struct {
uint8_t vis_code;
int width;
int height;
double separator_ms;
double sync_ms;
double sync_porch_ms;
double scan_ms;
} scottie_mode_t;
extern const scottie_mode_t SCOTTIE_S1;
extern const scottie_mode_t SCOTTIE_S2;
extern const scottie_mode_t SCOTTIE_DX;
void scottie_encode_image(wav_t *wav, uint8_t *rgb, const scottie_mode_t *mode);
int sstv_encode_scottie(const char *input_image, const char *output_wav, const scottie_mode_t *mode);
#endif // !SCOTTIE_H

15
include/encoder/sstv.h Normal file
View File

@@ -0,0 +1,15 @@
#ifndef SSTV_H
#define SSTV_H
#include "sound/wav.h"
#include <stdint.h>
void sstv_tone(wav_t *wav, double freq, double duration_ms);
void sstv_vis_header(wav_t *wav);
void sstv_vis_header_ex(wav_t *wav, uint8_t vis_code);
int sstv_encode_robot36(const char *input_image, const char *output_wav);
#endif // !SSTV_H