-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsat.h
48 lines (41 loc) · 1.24 KB
/
sat.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
#ifndef NETPBM__SAT_H_
#define NETPBM__SAT_H_
#include <stdint.h>
#include "types/pgm.h"
#include "types/sat.h"
/**
* Allocate memory for a summed area table.
*
* @param width The width of the image.
* @param height The height of the image.
* @return A pointer to the SummedAreaTable, or NULL if an error
* occurred.
*/
extern SummedAreaTable *AllocateSat(uint32_t width, uint32_t height);
/**
* Compute the summed area table of a PGM image.
*
* @param pgm The PGM image.
* @return The summed area table, or NULL if an error occurred.
*/
extern SummedAreaTable *PgmToSat(const PgmImage *pgm);
/**
* Query the summed area table.
*
* @param sat The summed area table.
* @param tlx Top-left x coordinate.
* @param tly Top-left y coordinate.
* @param brx Bottom-right x coordinate.
* @param bry Bottom-right y coordinate.
* @return The sum of the pixels in the rectangle defined by the given
* coordinates.
*/
extern uint64_t SatQuery(const SummedAreaTable *sat, uint32_t tlx, uint32_t tly,
uint32_t brx, uint32_t bry);
/**
* Free memory for a summed area table.
*
* @param sat The summed area table to free.
*/
extern void FreeSat(SummedAreaTable *sat);
#endif// NETPBM__SAT_H_