1 | /* |
---|
2 | * libpipi Pathetic image processing interface library |
---|
3 | * Copyright (c) 2004-2009 Sam Hocevar <sam@hocevar.net> |
---|
4 | * All Rights Reserved |
---|
5 | * |
---|
6 | * $Id$ |
---|
7 | * |
---|
8 | * This library is free software. It comes without any warranty, to |
---|
9 | * the extent permitted by applicable law. You can redistribute it |
---|
10 | * and/or modify it under the terms of the Do What The Fuck You Want |
---|
11 | * To Public License, Version 2, as published by Sam Hocevar. See |
---|
12 | * http://sam.zoy.org/wtfpl/COPYING for more details. |
---|
13 | */ |
---|
14 | |
---|
15 | /* |
---|
16 | * pipi_internals.h: internal types |
---|
17 | */ |
---|
18 | |
---|
19 | #ifndef __PIPI_INTERNALS_H__ |
---|
20 | #define __PIPI_INTERNALS_H__ |
---|
21 | |
---|
22 | #include "pipi_stubs.h" |
---|
23 | |
---|
24 | #define SET_FLAG_GRAY 0x00000001 |
---|
25 | #define SET_FLAG_WRAP 0x00000002 |
---|
26 | #define SET_FLAG_8BIT 0x00000004 |
---|
27 | |
---|
28 | struct pipi_histogram |
---|
29 | { |
---|
30 | int r_present, g_present, b_present, y_present; |
---|
31 | unsigned int a[256]; |
---|
32 | unsigned int r[256]; |
---|
33 | unsigned int g[256]; |
---|
34 | unsigned int b[256]; |
---|
35 | unsigned int y[256]; |
---|
36 | }; |
---|
37 | |
---|
38 | #ifdef USE_TILES |
---|
39 | #define TILE_SIZE 128 |
---|
40 | |
---|
41 | struct pipi_tile |
---|
42 | { |
---|
43 | int x, y; |
---|
44 | int zoom; |
---|
45 | |
---|
46 | int refcount; |
---|
47 | |
---|
48 | pipi_format_t fmt; |
---|
49 | int plane; |
---|
50 | union { uint8_t *u8; float *f; double *d; } data; |
---|
51 | union { uint8_t u8[1]; float f[1]; double d[1]; } align; |
---|
52 | }; |
---|
53 | #endif /* USE_TILES */ |
---|
54 | |
---|
55 | /* pipi_image_t: the image structure. This is probably going to be the most |
---|
56 | * complex structure in the library, but right now it only has fairly normal |
---|
57 | * stuff, like width and height and pointers to pixel areas. */ |
---|
58 | struct pipi_image |
---|
59 | { |
---|
60 | int w, h, pitch; |
---|
61 | |
---|
62 | #ifdef USE_TILES |
---|
63 | pipi_tile_t **tiles; |
---|
64 | int ntiles; |
---|
65 | #endif /* USE_TILES */ |
---|
66 | |
---|
67 | /* A list of internal image flags. |
---|
68 | * wrap: should filters wrap around at edges? |
---|
69 | * u8: are the image samples still 8-bit per channel? */ |
---|
70 | int wrap, u8; |
---|
71 | |
---|
72 | /* Translation vectors for wrap around and tiling. */ |
---|
73 | int wrapx1, wrapy1, wrapx2, wrapy2; |
---|
74 | |
---|
75 | /* List of all possible pixel formats and the last active one. */ |
---|
76 | pipi_pixels_t p[PIPI_PIXELS_MAX]; |
---|
77 | pipi_format_t last_modified; |
---|
78 | |
---|
79 | /* Private data used by the codec */ |
---|
80 | pipi_format_t codec_format; |
---|
81 | void *codec_priv; |
---|
82 | int (*codec_free)(pipi_image_t *); |
---|
83 | }; |
---|
84 | |
---|
85 | struct pipi_sequence |
---|
86 | { |
---|
87 | int w, h, fps; |
---|
88 | uint8_t *convert_buf; |
---|
89 | |
---|
90 | void *codec_priv; |
---|
91 | }; |
---|
92 | |
---|
93 | struct pipi_context |
---|
94 | { |
---|
95 | int nimages; |
---|
96 | pipi_image_t *images[1024]; /* FIXME: do dynamic allocation */ |
---|
97 | }; |
---|
98 | |
---|
99 | #ifdef USE_IMLIB2 |
---|
100 | pipi_image_t *pipi_load_imlib2(const char *name); |
---|
101 | int pipi_save_imlib2(pipi_image_t *img, const char *name); |
---|
102 | #endif |
---|
103 | |
---|
104 | #ifdef USE_OPENCV |
---|
105 | pipi_image_t *pipi_load_opencv(const char *name); |
---|
106 | int pipi_save_opencv(pipi_image_t *img, const char *name); |
---|
107 | #endif |
---|
108 | |
---|
109 | #ifdef USE_SDL |
---|
110 | pipi_image_t *pipi_load_sdl(const char *name); |
---|
111 | int pipi_save_sdl(pipi_image_t *img, const char *name); |
---|
112 | #endif |
---|
113 | |
---|
114 | #ifdef USE_GDIPLUS |
---|
115 | pipi_image_t *pipi_load_gdiplus(const char *name); |
---|
116 | int pipi_save_gdiplus(pipi_image_t *img, const char *name); |
---|
117 | #endif |
---|
118 | |
---|
119 | #ifdef USE_GDI |
---|
120 | pipi_image_t *pipi_load_gdi(const char *name); |
---|
121 | int pipi_save_gdi(pipi_image_t *img, const char *name); |
---|
122 | #endif |
---|
123 | |
---|
124 | #ifdef USE_COCOA |
---|
125 | pipi_image_t *pipi_load_coreimage(const char *name); |
---|
126 | int pipi_save_coreimage(pipi_image_t *img, const char *name); |
---|
127 | #endif |
---|
128 | |
---|
129 | #ifdef USE_JPEG |
---|
130 | pipi_image_t *pipi_load_jpeg(const char *name); |
---|
131 | int pipi_save_jpeg(pipi_image_t *img, const char *name); |
---|
132 | #endif |
---|
133 | |
---|
134 | pipi_image_t *pipi_load_oric(const char *name); |
---|
135 | int pipi_save_oric(pipi_image_t *img, const char *name); |
---|
136 | |
---|
137 | #endif /* __PIPI_INTERNALS_H__ */ |
---|
138 | |
---|