LiVES  2.4.1-svn
 All Data Structures Namespaces 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@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 #define SCREEN_GAMMA 2.2
13 
14 typedef struct {
15  uint8_t u0;
16  uint8_t y0;
17  uint8_t v0;
18  uint8_t y1;
20 
21 typedef struct {
22  uint8_t y0;
23  uint8_t u0;
24  uint8_t y1;
25  uint8_t v0;
27 
28 
29 typedef struct {
30  uint8_t u2;
31  uint8_t y0;
32  uint8_t y1;
33  uint8_t v2;
34  uint8_t y2;
35  uint8_t y3;
37 
38 
39 
40 
41 typedef struct {
42  void *src;
43  void *srcp[4];
44  int hsize;
45  int vsize;
46  int irowstrides[4];
47  int orowstrides[4];
48  void *dest;
49  void *destp[4];
50  boolean in_alpha;
51  boolean out_alpha;
52  boolean in_clamped;
53  boolean out_clamped;
58  boolean alpha_first;
59  int thread_id;
61 
62 
63 // internal thread fns
64 void *convert_rgb_to_uyvy_frame_thread(void *cc_params);
65 void *convert_bgr_to_uyvy_frame_thread(void *cc_params);
66 void *convert_rgb_to_yuyv_frame_thread(void *cc_params);
67 void *convert_bgr_to_yuyv_frame_thread(void *cc_params);
68 void *convert_argb_to_uyvy_frame_thread(void *cc_params);
69 void *convert_argb_to_yuyv_frame_thread(void *cc_params);
70 
71 
72 void *convert_rgb_to_yuv_frame_thread(void *cc_params);
73 void *convert_bgr_to_yuv_frame_thread(void *cc_params);
74 void *convert_argb_to_yuv_frame_thread(void *cc_params);
75 void *convert_rgb_to_yuvp_frame_thread(void *cc_params);
76 void *convert_bgr_to_yuvp_frame_thread(void *cc_params);
77 void *convert_argb_to_yuvp_frame_thread(void *cc_params);
78 
79 
80 void *convert_uyvy_to_rgb_frame_thread(void *cc_params);
81 void *convert_uyvy_to_bgr_frame_thread(void *cc_params);
82 void *convert_uyvy_to_argb_frame_thread(void *cc_params);
83 void *convert_yuyv_to_rgb_frame_thread(void *cc_params);
84 void *convert_yuyv_to_bgr_frame_thread(void *cc_params);
85 void *convert_yuyv_to_argb_frame_thread(void *cc_params);
86 
87 
88 void *convert_yuv_planar_to_rgb_frame_thread(void *cc_params);
89 void *convert_yuv_planar_to_bgr_frame_thread(void *cc_params);
90 void *convert_yuv_planar_to_argb_frame_thread(void *cc_params);
91 
92 void *convert_yuv888_to_rgb_frame_thread(void *cc_params);
93 void *convert_yuv888_to_bgr_frame_thread(void *cc_params);
94 void *convert_yuv888_to_argb_frame_thread(void *cc_params);
95 void *convert_yuva8888_to_rgba_frame_thread(void *cc_params);
96 void *convert_yuva8888_to_bgra_frame_thread(void *cc_params);
97 void *convert_yuva8888_to_argb_frame_thread(void *cc_params);
98 
99 
100 void *convert_swap3_frame_thread(void *cc_params);
101 void *convert_swap4_frame_thread(void *cc_params);
102 void *convert_swap3addpost_frame_thread(void *cc_params);
103 void *convert_swap3addpre_frame_thread(void *cc_params);
104 void *convert_swap3delpost_frame_thread(void *cc_params);
105 void *convert_swap3delpre_frame_thread(void *cc_params);
106 void *convert_addpre_frame_thread(void *cc_params);
107 void *convert_addpost_frame_thread(void *cc_params);
108 void *convert_delpre_frame_thread(void *cc_params);
109 void *convert_delpost_frame_thread(void *cc_params);
110 void *convert_swap3postalpha_frame_thread(void *cc_params);
111 void *convert_swapprepost_frame_thread(void *cc_params);
112 
113 void *convert_swab_frame_thread(void *cc_params);
114 
115 
116 
118 // these functions should be used in future
119 boolean convert_layer_palette(weed_plant_t *layer, int outpl, int op_clamping);
120 boolean convert_layer_palette_with_sampling(weed_plant_t *layer, int outpl, int out_sampling);
121 boolean convert_layer_palette_full(weed_plant_t *layer, int outpl, int osamtype, boolean oclamping, int osubspace);
122 //boolean apply_gamma (weed_plant_t *ilayer, weed_plant_t *olayer, double gamma); ///< not used
123 boolean resize_layer(weed_plant_t *layer, int width, int height, LiVESInterpType interp, int opal_hint, int oclamp_hint);
124 void letterbox_layer(weed_plant_t *layer, int width, int height, int nwidth, int nheight);
125 void compact_rowstrides(weed_plant_t *layer);
126 void weed_layer_pixel_data_free(weed_plant_t *layer);
127 void create_empty_pixel_data(weed_plant_t *layer, boolean black_fill, boolean may_contig);
128 void insert_blank_frames(int sfileno, int nframes, int after);
129 void pixel_data_planar_from_membuf(void **pixel_data, void *data, size_t size, int palette);
130 LiVESPixbuf *layer_to_pixbuf(weed_plant_t *layer);
131 boolean pixbuf_to_layer(weed_plant_t *layer, LiVESPixbuf *) WARN_UNUSED;
132 
133 weed_plant_t *weed_layer_copy(weed_plant_t *dlayer, weed_plant_t *slayer);
134 void weed_layer_free(weed_plant_t *layer);
135 weed_plant_t *weed_layer_new(int width, int height, int *rowstrides, int current_palette);
136 int weed_layer_get_palette(weed_plant_t *layer);
137 
138 lives_painter_t *layer_to_lives_painter(weed_plant_t *layer);
139 boolean lives_painter_to_layer(lives_painter_t *cairo, weed_plant_t *layer);
140 
141 void alpha_unpremult(weed_plant_t *layer, boolean un);
142 
143 
144 // palette information functions
145 boolean weed_palette_is_valid_palette(int pal);
146 boolean weed_palette_is_alpha_palette(int pal);
147 boolean weed_palette_is_rgb_palette(int pal);
148 boolean weed_palette_is_yuv_palette(int pal);
149 boolean weed_palette_is_float_palette(int pal);
150 boolean weed_palette_has_alpha_channel(int pal);
153 int weed_palette_get_numplanes(int pal);
154 double weed_palette_get_plane_ratio_horizontal(int pal, int plane);
155 double weed_palette_get_plane_ratio_vertical(int pal, int plane);
156 boolean weed_palette_is_lower_quality(int p1, int p2);
157 boolean weed_palette_is_resizable(int pal, int clamped, boolean in_out);
158 double weed_palette_get_compression_ratio(int pal);
159 
161 
162 #define BLACK_THRESH 20
163 boolean lives_pixbuf_is_all_black(LiVESPixbuf *pixbuf);
164 
165 
166 void lives_pixbuf_set_opaque(LiVESPixbuf *pixbuf);
167 
168 const char *weed_palette_get_name(int pal);
169 const char *weed_yuv_clamping_get_name(int clamping);
170 const char *weed_yuv_subspace_get_name(int subspace);
171 char *weed_palette_get_name_full(int pal, int clamped, int subspace);
172 
173 
174 #ifdef USE_SWSCALE
175 void sws_free_context(void);
176 #endif
177 
178 
179 #endif
void * convert_bgr_to_yuyv_frame_thread(void *cc_params)
Definition: colourspace.c:2269
int hsize
Definition: colourspace.h:44
boolean weed_palette_is_lower_quality(int p1, int p2)
return TRUE if p1 is lower quality than p2
Definition: colourspace.c:996
uint8_t v0
Definition: colourspace.h:25
const char * weed_yuv_clamping_get_name(int clamping)
Definition: colourspace.c:1091
int weed_layer_get_palette(weed_plant_t *layer)
Definition: colourspace.c:11259
uint8_t u0
Definition: colourspace.h:15
uint8_t y0
Definition: colourspace.h:31
boolean in_alpha
Definition: colourspace.h:50
void alpha_unpremult(weed_plant_t *layer, boolean un)
Definition: colourspace.c:7975
int out_sampling
Definition: colourspace.h:57
void * convert_swab_frame_thread(void *cc_params)
Definition: colourspace.c:6791
uint8_t v0
Definition: colourspace.h:17
uint8_t y1
Definition: colourspace.h:18
void compact_rowstrides(weed_plant_t *layer)
Definition: colourspace.c:10102
void * convert_uyvy_to_argb_frame_thread(void *cc_params)
Definition: colourspace.c:3522
boolean weed_palette_is_rgb_palette(int pal)
Definition: colourspace.c:915
int get_weed_palette_for_lives_painter(void)
Definition: colourspace.c:10940
int weed_palette_get_numplanes(int pal)
Definition: colourspace.c:923
void * convert_delpost_frame_thread(void *cc_params)
Definition: colourspace.c:6470
boolean pixbuf_to_layer(weed_plant_t *layer, LiVESPixbuf *) WARN_UNUSED
Definition: colourspace.c:10825
int thread_id
Definition: colourspace.h:59
int out_subspace
Definition: colourspace.h:55
void insert_blank_frames(int sfileno, int nframes, int after)
Definition: colourspace.c:11268
void * convert_bgr_to_yuvp_frame_thread(void *cc_params)
Definition: colourspace.c:2782
void * dest
Definition: colourspace.h:48
boolean convert_layer_palette_full(weed_plant_t *layer, int outpl, int osamtype, boolean oclamping, int osubspace)
Definition: colourspace.c:8147
void * convert_uyvy_to_bgr_frame_thread(void *cc_params)
Definition: colourspace.c:3450
void * convert_addpost_frame_thread(void *cc_params)
Definition: colourspace.c:6238
void * convert_rgb_to_yuv_frame_thread(void *cc_params)
Definition: colourspace.c:2509
void * convert_yuyv_to_bgr_frame_thread(void *cc_params)
Definition: colourspace.c:3678
void * convert_yuv_planar_to_argb_frame_thread(void *cc_params)
Definition: colourspace.c:4106
int weed_palette_get_bits_per_macropixel(int pal)
Definition: colourspace.c:938
void * convert_argb_to_yuv_frame_thread(void *cc_params)
Definition: colourspace.c:2862
void weed_layer_free(weed_plant_t *layer)
Definition: colourspace.c:11251
void * convert_argb_to_uyvy_frame_thread(void *cc_params)
Definition: colourspace.c:2347
double weed_palette_get_compression_ratio(int pal)
Definition: colourspace.c:1123
void * convert_yuyv_to_argb_frame_thread(void *cc_params)
Definition: colourspace.c:3750
void * convert_bgr_to_yuv_frame_thread(void *cc_params)
Definition: colourspace.c:2685
boolean out_clamped
Definition: colourspace.h:53
boolean weed_palette_is_resizable(int pal, int clamped, boolean in_out)
Definition: colourspace.c:10059
_palette * palette
Definition: main.c:89
uint8_t y3
Definition: colourspace.h:35
boolean alpha_first
Definition: colourspace.h:58
uint8_t y0
Definition: colourspace.h:22
uint8_t y2
Definition: colourspace.h:34
weed_plant_t * weed_layer_copy(weed_plant_t *dlayer, weed_plant_t *slayer)
Definition: colourspace.c:11126
uint8_t u2
Definition: colourspace.h:30
boolean in_clamped
Definition: colourspace.h:52
boolean weed_palette_has_alpha_channel(int pal)
Definition: colourspace.c:964
void * convert_argb_to_yuyv_frame_thread(void *cc_params)
Definition: colourspace.c:2425
Definition: colourspace.h:29
void * convert_delpre_frame_thread(void *cc_params)
Definition: colourspace.c:6549
void * convert_rgb_to_uyvy_frame_thread(void *cc_params)
Definition: colourspace.c:2019
void * convert_swapprepost_frame_thread(void *cc_params)
Definition: colourspace.c:6727
void * convert_swap3postalpha_frame_thread(void *cc_params)
Definition: colourspace.c:6154
boolean weed_palette_is_valid_palette(int pal)
Definition: colourspace.c:933
uint8_t y1
Definition: colourspace.h:32
double weed_palette_get_plane_ratio_horizontal(int pal, int plane)
Definition: colourspace.c:970
boolean weed_palette_is_alpha_palette(int pal)
Definition: colourspace.c:911
void * convert_swap4_frame_thread(void *cc_params)
Definition: colourspace.c:5914
void * convert_swap3delpre_frame_thread(void *cc_params)
Definition: colourspace.c:6626
void * convert_addpre_frame_thread(void *cc_params)
Definition: colourspace.c:6318
void * convert_swap3addpre_frame_thread(void *cc_params)
Definition: colourspace.c:6074
void * convert_rgb_to_yuyv_frame_thread(void *cc_params)
Definition: colourspace.c:2101
void * convert_yuv888_to_argb_frame_thread(void *cc_params)
Definition: colourspace.c:1604
int in_subspace
Definition: colourspace.h:54
boolean convert_layer_palette_with_sampling(weed_plant_t *layer, int outpl, int out_sampling)
void * convert_yuyv_to_rgb_frame_thread(void *cc_params)
Definition: colourspace.c:3601
void * convert_argb_to_yuvp_frame_thread(void *cc_params)
Definition: colourspace.c:2952
boolean weed_palette_is_float_palette(int pal)
Definition: colourspace.c:960
int weed_palette_get_pixels_per_macropixel(int pal)
Definition: colourspace.c:954
void * convert_uyvy_to_rgb_frame_thread(void *cc_params)
Definition: colourspace.c:3368
void * convert_yuv888_to_bgr_frame_thread(void *cc_params)
Definition: colourspace.c:1443
void create_empty_pixel_data(weed_plant_t *layer, boolean black_fill, boolean may_contig)
Definition: colourspace.c:7285
void * convert_swap3delpost_frame_thread(void *cc_params)
Definition: colourspace.c:6394
void * src
Definition: colourspace.h:42
void lives_pixbuf_set_opaque(LiVESPixbuf *pixbuf)
Definition: colourspace.c:10078
boolean convert_layer_palette(weed_plant_t *layer, int outpl, int op_clamping)
Definition: colourspace.c:9875
boolean weed_palette_is_yuv_palette(int pal)
Definition: colourspace.c:919
boolean lives_painter_to_layer(lives_painter_t *cairo, weed_plant_t *layer)
Definition: colourspace.c:11034
lives_painter_t * layer_to_lives_painter(weed_plant_t *layer)
Definition: colourspace.c:10946
int in_sampling
Definition: colourspace.h:56
void * convert_yuv888_to_rgb_frame_thread(void *cc_params)
Definition: colourspace.c:1276
boolean out_alpha
Definition: colourspace.h:51
void * convert_bgr_to_uyvy_frame_thread(void *cc_params)
Definition: colourspace.c:2183
void * convert_yuva8888_to_argb_frame_thread(void *cc_params)
Definition: colourspace.c:1685
void * convert_yuva8888_to_bgra_frame_thread(void *cc_params)
Definition: colourspace.c:1526
void * convert_yuv_planar_to_bgr_frame_thread(void *cc_params)
Definition: colourspace.c:4018
void weed_layer_pixel_data_free(weed_plant_t *layer)
Definition: colourspace.c:11213
void * convert_yuv_planar_to_rgb_frame_thread(void *cc_params)
Definition: colourspace.c:3926
void * convert_rgb_to_yuvp_frame_thread(void *cc_params)
Definition: colourspace.c:2602
weed_plant_t * weed_layer_new(int width, int height, int *rowstrides, int current_palette)
Definition: colourspace.c:11112
uint8_t y0
Definition: colourspace.h:16
uint8_t y1
Definition: colourspace.h:24
void pixel_data_planar_from_membuf(void **pixel_data, void *data, size_t size, int palette)
Definition: colourspace.c:1171
double weed_palette_get_plane_ratio_vertical(int pal, int plane)
Definition: colourspace.c:983
Definition: colourspace.h:21
void * convert_swap3_frame_thread(void *cc_params)
Definition: colourspace.c:5836
LiVESPixbuf * layer_to_pixbuf(weed_plant_t *layer)
Definition: colourspace.c:9934
Definition: colourspace.h:14
uint8_t u0
Definition: colourspace.h:23
char * weed_palette_get_name_full(int pal, int clamped, int subspace)
Definition: colourspace.c:1106
int vsize
Definition: colourspace.h:45
void letterbox_layer(weed_plant_t *layer, int width, int height, int nwidth, int nheight)
Definition: colourspace.c:10540
boolean resize_layer(weed_plant_t *layer, int width, int height, LiVESInterpType interp, int opal_hint, int oclamp_hint)
Definition: colourspace.c:10260
uint8_t v2
Definition: colourspace.h:33
Definition: colourspace.h:41
const char * weed_yuv_subspace_get_name(int subspace)
Definition: colourspace.c:1098
#define WARN_UNUSED
Definition: main.h:261
void * convert_yuva8888_to_rgba_frame_thread(void *cc_params)
Definition: colourspace.c:1359
void * convert_swap3addpost_frame_thread(void *cc_params)
Definition: colourspace.c:5994
const char * weed_palette_get_name(int pal)
Definition: colourspace.c:1042