forked from derpibooru/cli_intensities
-
Notifications
You must be signed in to change notification settings - Fork 3
/
definitions.h
52 lines (42 loc) · 1.04 KB
/
definitions.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef _DEFINITIONS_H
#define _DEFINITIONS_H
#include <stdint.h>
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#define sRGB_R_Y 0.2126
#define sRGB_G_Y 0.7152
#define sRGB_B_Y 0.0722
typedef struct rgb_pixel {
uint8_t r;
uint8_t g;
uint8_t b;
} rgb_pixel;
typedef struct intensity_sum {
uint64_t r;
uint64_t g;
uint64_t b;
} intensity_sum;
typedef struct quadrant_sums {
intensity_sum nw;
intensity_sum ne;
intensity_sum sw;
intensity_sum se;
} quadrant_sums;
typedef struct raster_data {
uint32_t width;
uint32_t height;
rgb_pixel *pixels;
int error;
} raster_data;
typedef struct intensity_data {
double nw;
double ne;
double sw;
double se;
int error;
} intensity_data;
raster_data read_jpeg_file(const char *file_name);
raster_data read_png_file(const char *file_name);
quadrant_sums rgb_sums(rgb_pixel *restrict pixels, uint32_t width, uint32_t height);
intensity_data jpeg_intensities(const char *file_name);
intensity_data png_intensities(const char *file_name);
#endif