LiVES 2.4.6

- Main Page
- Namespaces
- Data Structures
- Files

- File List
- Globals

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;
19 } uyvy_macropixel;
20
21 typedef struct {
22 uint8_t y0;
23 uint8_t u0;
24 uint8_t y1;
25 uint8_t v0;
26 } yuyv_macropixel;
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;
36 } yuv411_macropixel;
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;
54 int in_subspace;
55 int out_subspace;
56 int in_sampling;
57 int out_sampling;
58 boolean alpha_first;
59 int thread_id;
60 } lives_cc_params;
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);
151 int weed_palette_get_bits_per_macropixel(int pal);
152 int weed_palette_get_pixels_per_macropixel(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
160 int get_weed_palette_for_lives_painter(void);
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
weed_layer_new
weed_plant_t * weed_layer_new(int width, int height, int *rowstrides, int current_palette)
Definition: colourspace.c:11123
weed_layer_copy
weed_plant_t * weed_layer_copy(weed_plant_t *dlayer, weed_plant_t *slayer)
Definition: colourspace.c:11137
convert_bgr_to_yuvp_frame_thread
void * convert_bgr_to_yuvp_frame_thread(void *data)
Definition: colourspace.c:2782
convert_rgb_to_yuvp_frame_thread
void * convert_rgb_to_yuvp_frame_thread(void *data)
Definition: colourspace.c:2602
lives_cc_params::hsize
int hsize
Definition: colourspace.h:44
pixel_data_planar_from_membuf
void pixel_data_planar_from_membuf(void **pixel_data, void *data, size_t size, int palette)
Definition: colourspace.c:1171
insert_blank_frames
void insert_blank_frames(int sfileno, int nframes, int after)
Definition: colourspace.c:11295
yuyv_macropixel::v0
uint8_t v0
Definition: colourspace.h:25
weed_yuv_subspace_get_name
const char * weed_yuv_subspace_get_name(int subspace)
Definition: colourspace.c:1098
convert_addpre_frame_thread
void * convert_addpre_frame_thread(void *data)
Definition: colourspace.c:6322
compact_rowstrides
void compact_rowstrides(weed_plant_t *layer)
Definition: colourspace.c:10134
layer_to_lives_painter
lives_painter_t * layer_to_lives_painter(weed_plant_t *layer)
Definition: colourspace.c:10957
convert_argb_to_yuv_frame_thread
void * convert_argb_to_yuv_frame_thread(void *data)
Definition: colourspace.c:2862
resize_layer
boolean resize_layer(weed_plant_t *layer, int width, int height, LiVESInterpType interp, int opal_hint, int oclamp_hint)
Definition: colourspace.c:10292
uyvy_macropixel::u0
uint8_t u0
Definition: colourspace.h:15
yuv411_macropixel::y0
uint8_t y0
Definition: colourspace.h:31
lives_cc_params::in_alpha
boolean in_alpha
Definition: colourspace.h:50
weed_layer_pixel_data_free
void weed_layer_pixel_data_free(weed_plant_t *layer)
Definition: colourspace.c:11224
get_weed_palette_for_lives_painter
LIVES_INLINE int get_weed_palette_for_lives_painter(void)
Definition: colourspace.c:10951
convert_yuv888_to_rgb_frame_thread
void * convert_yuv888_to_rgb_frame_thread(void *data)
Definition: colourspace.c:1276
weed_palette_get_name
const char * weed_palette_get_name(int pal)
Definition: colourspace.c:1042
weed_palette_get_plane_ratio_vertical
LIVES_INLINE double weed_palette_get_plane_ratio_vertical(int pal, int plane)
Definition: colourspace.c:983
lives_cc_params::out_sampling
int out_sampling
Definition: colourspace.h:57
uyvy_macropixel::v0
uint8_t v0
Definition: colourspace.h:17
convert_bgr_to_uyvy_frame_thread
void * convert_bgr_to_uyvy_frame_thread(void *data)
Definition: colourspace.c:2183
weed_layer_free
void weed_layer_free(weed_plant_t *layer)
Definition: colourspace.c:11279
uyvy_macropixel::y1
uint8_t y1
Definition: colourspace.h:18
convert_yuyv_to_argb_frame_thread
void * convert_yuyv_to_argb_frame_thread(void *data)
Definition: colourspace.c:3750
convert_yuyv_to_rgb_frame_thread
void * convert_yuyv_to_rgb_frame_thread(void *data)
Definition: colourspace.c:3601
lives_cc_params::thread_id
int thread_id
Definition: colourspace.h:59
lives_cc_params::out_subspace
int out_subspace
Definition: colourspace.h:55
lives_cc_params::dest
void * dest
Definition: colourspace.h:48
pixbuf_to_layer
boolean pixbuf_to_layer(weed_plant_t *layer, LiVESPixbuf *pixbuf)
Definition: colourspace.c:10839
convert_yuva8888_to_argb_frame_thread
void * convert_yuva8888_to_argb_frame_thread(void *data)
Definition: colourspace.c:1685
weed_palette_is_resizable
LIVES_INLINE boolean weed_palette_is_resizable(int pal, int clamped, boolean in_out)
Definition: colourspace.c:10091
convert_rgb_to_uyvy_frame_thread
void * convert_rgb_to_uyvy_frame_thread(void *data)
Definition: colourspace.c:2019
convert_argb_to_yuvp_frame_thread
void * convert_argb_to_yuvp_frame_thread(void *data)
Definition: colourspace.c:2952
weed_palette_is_float_palette
LIVES_INLINE boolean weed_palette_is_float_palette(int pal)
Definition: colourspace.c:960
lives_cc_params::out_clamped
boolean out_clamped
Definition: colourspace.h:53
palette
_palette * palette
Definition: main.c:89
alpha_unpremult
void alpha_unpremult(weed_plant_t *layer, boolean un)
Definition: colourspace.c:7981
weed_palette_is_valid_palette
LIVES_INLINE boolean weed_palette_is_valid_palette(int pal)
Definition: colourspace.c:933
yuv411_macropixel::y3
uint8_t y3
Definition: colourspace.h:35
weed_palette_get_pixels_per_macropixel
LIVES_INLINE int weed_palette_get_pixels_per_macropixel(int pal)
Definition: colourspace.c:954
weed_palette_get_compression_ratio
double weed_palette_get_compression_ratio(int pal)
Definition: colourspace.c:1123
lives_cc_params::alpha_first
boolean alpha_first
Definition: colourspace.h:58
yuyv_macropixel::y0
uint8_t y0
Definition: colourspace.h:22
yuv411_macropixel::y2
uint8_t y2
Definition: colourspace.h:34
yuv411_macropixel::u2
uint8_t u2
Definition: colourspace.h:30
lives_cc_params::in_clamped
boolean in_clamped
Definition: colourspace.h:52
convert_rgb_to_yuv_frame_thread
void * convert_rgb_to_yuv_frame_thread(void *data)
Definition: colourspace.c:2509
weed_palette_is_rgb_palette
LIVES_INLINE boolean weed_palette_is_rgb_palette(int pal)
Definition: colourspace.c:915
yuv411_macropixel
Definition: colourspace.h:29
convert_swap3postalpha_frame_thread
void * convert_swap3postalpha_frame_thread(void *data)
Definition: colourspace.c:6158
convert_swapprepost_frame_thread
void * convert_swapprepost_frame_thread(void *data)
Definition: colourspace.c:6731
convert_delpost_frame_thread
void * convert_delpost_frame_thread(void *data)
Definition: colourspace.c:6474
convert_yuva8888_to_bgra_frame_thread
void * convert_yuva8888_to_bgra_frame_thread(void *data)
Definition: colourspace.c:1526
convert_uyvy_to_argb_frame_thread
void * convert_uyvy_to_argb_frame_thread(void *data)
Definition: colourspace.c:3522
yuv411_macropixel::y1
uint8_t y1
Definition: colourspace.h:32
convert_yuv888_to_argb_frame_thread
void * convert_yuv888_to_argb_frame_thread(void *data)
Definition: colourspace.c:1604
convert_bgr_to_yuyv_frame_thread
void * convert_bgr_to_yuyv_frame_thread(void *data)
Definition: colourspace.c:2269
lives_cc_params::in_subspace
int in_subspace
Definition: colourspace.h:54
convert_delpre_frame_thread
void * convert_delpre_frame_thread(void *data)
Definition: colourspace.c:6553
convert_layer_palette_with_sampling
boolean convert_layer_palette_with_sampling(weed_plant_t *layer, int outpl, int out_sampling)
weed_palette_get_plane_ratio_horizontal
LIVES_INLINE double weed_palette_get_plane_ratio_horizontal(int pal, int plane)
Definition: colourspace.c:970
convert_yuyv_to_bgr_frame_thread
void * convert_yuyv_to_bgr_frame_thread(void *data)
Definition: colourspace.c:3678
lives_pixbuf_set_opaque
void lives_pixbuf_set_opaque(LiVESPixbuf *pixbuf)
Definition: colourspace.c:10110
weed_palette_is_alpha_palette
LIVES_INLINE boolean weed_palette_is_alpha_palette(int pal)
Definition: colourspace.c:911
convert_layer_palette
boolean convert_layer_palette(weed_plant_t *layer, int outpl, int op_clamping)
Definition: colourspace.c:9909
convert_uyvy_to_bgr_frame_thread
void * convert_uyvy_to_bgr_frame_thread(void *data)
Definition: colourspace.c:3450
lives_painter_to_layer
boolean lives_painter_to_layer(lives_painter_t *cr, weed_plant_t *layer)
Definition: colourspace.c:11045
convert_swap3addpre_frame_thread
void * convert_swap3addpre_frame_thread(void *data)
Definition: colourspace.c:6078
letterbox_layer
void letterbox_layer(weed_plant_t *layer, int width, int height, int nwidth, int nheight)
Definition: colourspace.c:10552
convert_addpost_frame_thread
void * convert_addpost_frame_thread(void *data)
Definition: colourspace.c:6242
lives_cc_params::src
void * src
Definition: colourspace.h:42
weed_palette_get_bits_per_macropixel
LIVES_INLINE int weed_palette_get_bits_per_macropixel(int pal)
Definition: colourspace.c:938
convert_bgr_to_yuv_frame_thread
void * convert_bgr_to_yuv_frame_thread(void *data)
Definition: colourspace.c:2685
weed_yuv_clamping_get_name
const char * weed_yuv_clamping_get_name(int clamping)
Definition: colourspace.c:1091
create_empty_pixel_data
void create_empty_pixel_data(weed_plant_t *layer, boolean black_fill, boolean may_contig)
Definition: colourspace.c:7289
lives_cc_params::in_sampling
int in_sampling
Definition: colourspace.h:56
weed_layer_get_palette
int weed_layer_get_palette(weed_plant_t *layer)
Definition: colourspace.c:11286
convert_argb_to_yuyv_frame_thread
void * convert_argb_to_yuyv_frame_thread(void *data)
Definition: colourspace.c:2425
convert_yuv_planar_to_argb_frame_thread
void * convert_yuv_planar_to_argb_frame_thread(void *data)
Definition: colourspace.c:4110
convert_yuv_planar_to_bgr_frame_thread
void * convert_yuv_planar_to_bgr_frame_thread(void *data)
Definition: colourspace.c:4022
weed_palette_get_name_full
char * weed_palette_get_name_full(int pal, int clamped, int subspace)
Definition: colourspace.c:1106
convert_swap4_frame_thread
void * convert_swap4_frame_thread(void *data)
Definition: colourspace.c:5918
lives_cc_params::out_alpha
boolean out_alpha
Definition: colourspace.h:51
weed_palette_has_alpha_channel
LIVES_INLINE boolean weed_palette_has_alpha_channel(int pal)
Definition: colourspace.c:964
weed_palette_is_yuv_palette
LIVES_INLINE boolean weed_palette_is_yuv_palette(int pal)
Definition: colourspace.c:919
weed_palette_get_numplanes
LIVES_INLINE int weed_palette_get_numplanes(int pal)
Definition: colourspace.c:923
convert_swap3addpost_frame_thread
void * convert_swap3addpost_frame_thread(void *data)
Definition: colourspace.c:5998
convert_swap3_frame_thread
void * convert_swap3_frame_thread(void *data)
Definition: colourspace.c:5840
uyvy_macropixel::y0
uint8_t y0
Definition: colourspace.h:16
yuyv_macropixel::y1
uint8_t y1
Definition: colourspace.h:24
convert_rgb_to_yuyv_frame_thread
void * convert_rgb_to_yuyv_frame_thread(void *data)
Definition: colourspace.c:2101
yuyv_macropixel
Definition: colourspace.h:21
convert_yuv_planar_to_rgb_frame_thread
void * convert_yuv_planar_to_rgb_frame_thread(void *data)
Definition: colourspace.c:3930
convert_swap3delpre_frame_thread
void * convert_swap3delpre_frame_thread(void *data)
Definition: colourspace.c:6630
convert_yuva8888_to_rgba_frame_thread
void * convert_yuva8888_to_rgba_frame_thread(void *data)
Definition: colourspace.c:1359
uyvy_macropixel
Definition: colourspace.h:14
yuyv_macropixel::u0
uint8_t u0
Definition: colourspace.h:23
lives_cc_params::vsize
int vsize
Definition: colourspace.h:45
convert_swab_frame_thread
void * convert_swab_frame_thread(void *data)
Definition: colourspace.c:6795
convert_layer_palette_full
boolean convert_layer_palette_full(weed_plant_t *layer, int outpl, int osamtype, boolean oclamping, int osubspace)
Definition: colourspace.c:8153
convert_uyvy_to_rgb_frame_thread
void * convert_uyvy_to_rgb_frame_thread(void *data)
Definition: colourspace.c:3368
convert_argb_to_uyvy_frame_thread
void * convert_argb_to_uyvy_frame_thread(void *data)
Definition: colourspace.c:2347
yuv411_macropixel::v2
uint8_t v2
Definition: colourspace.h:33
convert_yuv888_to_bgr_frame_thread
void * convert_yuv888_to_bgr_frame_thread(void *data)
Definition: colourspace.c:1443
weed_palette_is_lower_quality
boolean weed_palette_is_lower_quality(int p1, int p2)
return TRUE if p1 is lower quality than p2
Definition: colourspace.c:996
lives_cc_params
Definition: colourspace.h:41
WARN_UNUSED
#define WARN_UNUSED
Definition: main.h:271
convert_swap3delpost_frame_thread
void * convert_swap3delpost_frame_thread(void *data)
Definition: colourspace.c:6398
layer_to_pixbuf
LiVESPixbuf * layer_to_pixbuf(weed_plant_t *layer)
Definition: colourspace.c:9968