2023-05-17 17:45:47 +02:00

62 lines
1.1 KiB
C

#ifndef UTILS_H
#define UTILS_H
#include <mpfr.h>
#include <stdint.h>
#include <stdio.h>
#define DEBUG
#define DEBUG_PRINT(fmt, ...) \
do {if (DEBUG) fprintf(stderr, fmt, __VA_ARGS__);} while(0);
typedef struct {
int x;
int y;
} Vec2i;
typedef struct {
double x;
double y;
} Vec2d;
typedef struct {
uint32_t w;
uint32_t h;
double *buf;
} Matrixd;
typedef struct {
uint8_t r;
uint8_t g;
uint8_t b;
} Pixel;
typedef struct {
uint32_t w;
uint32_t h;
Pixel *buf;
} Matrixp;
typedef struct {
uint32_t w;
uint32_t h;
uint8_t *buf;
} Matrixu8;
Matrixd matrixd_create(uint32_t w, uint32_t h);
size_t matrixd_size(Matrixd *m);
void matrixd_print(Matrixd *m);
Matrixp matrixp_create(uint32_t w, uint32_t h);
Matrixp matrixp_create_from_file(const char *filename);
Matrixu8 matrixu8_create_from_file(const char *filename);
void matrixu8_write_to_bmp(Matrixu8 *matrix, const char *filename);
size_t matrixp_size(Matrixp* m);
size_t matrixu8_size(Matrixu8* m);
Matrixd gauss_filter_create(uint32_t size, double sigma);
const char* cl_get_error_string(int error);
#endif