LiVES  1.6.4-svn
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
colourspace.h
Go to the documentation of this file.
1 // colourspace.h
2 // LiVES
3 // (c) G. Finch 2004 - 2012 <salsaman@xs4all.nl,salsaman@gmail.com>
4 // Released under the GPL 3 or later
5 // see file ../COPYING for licensing details
6 
7 // headers for palette conversions
8 
9 #ifndef HAS_LIVES_COLOURSPACE_H
10 #define HAS_LIVES_COLOURSPACE_H
11 
12 
13 typedef struct {
14  guchar u0;
15  guchar y0;
16  guchar v0;
17  guchar y1;
19 
20 typedef struct {
21  guchar y0;
22  guchar u0;
23  guchar y1;
24  guchar v0;
26 
27 
28 typedef struct {
29  guchar u2;
30  guchar y0;
31  guchar y1;
32  guchar v2;
33  guchar y2;
34  guchar y3;
36 
37 
38 
39 
40 typedef struct {
41  void *src;
42  void *srcp[4];
43  gint hsize;
44  gint vsize;
45  gint irowstrides[4];
46  gint orowstrides[4];
47  void *dest;
48  void *destp[4];
49  boolean in_alpha;
50  boolean out_alpha;
51  boolean in_clamped;
52  boolean out_clamped;
57  boolean alpha_first;
58  int thread_id;
60 
61 
62 // internal thread fns
63 void *convert_rgb_to_uyvy_frame_thread(void *cc_params);
64 void *convert_bgr_to_uyvy_frame_thread(void *cc_params);
65 void *convert_rgb_to_yuyv_frame_thread(void *cc_params);
66 void *convert_bgr_to_yuyv_frame_thread(void *cc_params);
67 void *convert_argb_to_uyvy_frame_thread(void *cc_params);
68 void *convert_argb_to_yuyv_frame_thread(void *cc_params);
69 
70 
71 void *convert_rgb_to_yuv_frame_thread(void *cc_params);
72 void *convert_bgr_to_yuv_frame_thread(void *cc_params);
73 void *convert_argb_to_yuv_frame_thread(void *cc_params);
74 void *convert_rgb_to_yuvp_frame_thread(void *cc_params);
75 void *convert_bgr_to_yuvp_frame_thread(void *cc_params);
76 void *convert_argb_to_yuvp_frame_thread(void *cc_params);
77 
78 
79 void *convert_uyvy_to_rgb_frame_thread(void *cc_params);
80 void *convert_uyvy_to_bgr_frame_thread(void *cc_params);
81 void *convert_uyvy_to_argb_frame_thread(void *cc_params);
82 void *convert_yuyv_to_rgb_frame_thread(void *cc_params);
83 void *convert_yuyv_to_bgr_frame_thread(void *cc_params);
84 void *convert_yuyv_to_argb_frame_thread(void *cc_params);
85 
86 
87 void *convert_yuv_planar_to_rgb_frame_thread(void *cc_params);
88 void *convert_yuv_planar_to_bgr_frame_thread(void *cc_params);
89 void *convert_yuv_planar_to_argb_frame_thread(void *cc_params);
90 
91 void *convert_yuv888_to_rgb_frame_thread(void *cc_params);
92 void *convert_yuv888_to_bgr_frame_thread(void *cc_params);
93 void *convert_yuv888_to_argb_frame_thread(void *cc_params);
94 void *convert_yuva8888_to_rgba_frame_thread(void *cc_params);
95 void *convert_yuva8888_to_bgra_frame_thread(void *cc_params);
96 void *convert_yuva8888_to_argb_frame_thread(void *cc_params);
97 
98 
99 void *convert_swap3_frame_thread(void *cc_params);
100 void *convert_swap4_frame_thread(void *cc_params);
101 void *convert_swap3addpost_frame_thread(void *cc_params);
102 void *convert_swap3addpre_frame_thread(void *cc_params);
103 void *convert_swap3delpost_frame_thread(void *cc_params);
104 void *convert_swap3delpre_frame_thread(void *cc_params);
105 void *convert_addpre_frame_thread(void *cc_params);
106 void *convert_addpost_frame_thread(void *cc_params);
107 void *convert_delpre_frame_thread(void *cc_params);
108 void *convert_delpost_frame_thread(void *cc_params);
109 void *convert_swap3postalpha_frame_thread(void *cc_params);
110 void *convert_swapprepost_frame_thread(void *cc_params);
111 
112 void *convert_swab_frame_thread(void *cc_params);
113 
114 
115 
117 // these functions should be used in future
118 boolean convert_layer_palette(weed_plant_t *layer, int outpl, int op_clamping);
119 boolean convert_layer_palette_with_sampling(weed_plant_t *layer, int outpl, int out_sampling);
120 boolean convert_layer_palette_full(weed_plant_t *layer, int outpl, int osamtype, boolean oclamping, int osubspace);
121 //boolean apply_gamma (weed_plant_t *ilayer, weed_plant_t *olayer, double gamma); ///< not used
122 boolean resize_layer (weed_plant_t *layer, int width, int height, LiVESInterpType interp);
123 void letterbox_layer (weed_plant_t *layer, int width, int height, int nwidth, int nheight);
124 void compact_rowstrides(weed_plant_t *layer);
125 void create_empty_pixel_data(weed_plant_t *layer, boolean black_fill, boolean may_contig);
126 void pixel_data_planar_from_membuf(void **pixel_data, void *data, size_t size, int palette);
127 LiVESPixbuf *layer_to_pixbuf (weed_plant_t *layer);
128 boolean pixbuf_to_layer(weed_plant_t *layer, LiVESPixbuf *);
129 
130 weed_plant_t *weed_layer_copy (weed_plant_t *dlayer, weed_plant_t *slayer);
131 void weed_layer_free (weed_plant_t *layer);
132 weed_plant_t *weed_layer_new(int width, int height, int *rowstrides, int current_palette);
133 int weed_layer_get_palette(weed_plant_t *layer);
134 
135 cairo_t *layer_to_cairo(weed_plant_t *layer);
136 boolean cairo_to_layer(cairo_t *cairo, weed_plant_t *layer);
137 
138 void alpha_unpremult(weed_plant_t *layer, boolean un);
139 
140 
141 // palette information functions
142 boolean weed_palette_is_valid_palette(int pal);
143 boolean weed_palette_is_alpha_palette(int pal);
144 boolean weed_palette_is_rgb_palette(int pal);
145 boolean weed_palette_is_yuv_palette(int pal);
146 boolean weed_palette_is_float_palette(int pal);
147 boolean weed_palette_has_alpha_channel(int pal);
150 gint weed_palette_get_numplanes(int pal);
151 gdouble weed_palette_get_plane_ratio_horizontal(int pal, int plane);
152 gdouble weed_palette_get_plane_ratio_vertical(int pal, int plane);
153 boolean weed_palette_is_lower_quality(int p1, int p2);
154 boolean weed_palette_is_resizable(int pal);
155 gdouble weed_palette_get_compression_ratio (int pal);
156 
158 
159 #define BLACK_THRESH 20
160 boolean lives_pixbuf_is_all_black(LiVESPixbuf *pixbuf);
161 
162 
163 void lives_pixbuf_set_opaque(LiVESPixbuf *pixbuf);
164 
165 const char *weed_palette_get_name(int pal);
166 const char *weed_yuv_clamping_get_name(int clamping);
167 const char *weed_yuv_subspace_get_name(int subspace);
168 gchar *weed_palette_get_name_full(int pal, int clamped, int subspace);
169 
170 
171 #ifdef USE_SWSCALE
172 void sws_free_context(void);
173 #endif
174 
175 
176 #endif