LiVES  3.2.0
Macros | Functions
colourspace.c File Reference
#include <math.h>
#include "main.h"
#include "cvirtual.h"
#include "effects-weed.h"

Go to the source code of this file.

Macros

#define USE_THREADS   1
 set to 0 to disable threading for pixbuf operations, 1 to enable. Other values are invalid. More...
 
#define get_pixbuf_rowstride_value(rowstride)   ((rowstride + 3) & ~3)
 
#define get_last_pixbuf_rowstride_value(width, nchans)   (width * (((nchans << 3) + 7) >> 3))
 
#define CLAMP0255(a)   ((unsigned char)((((-a) >> 31) & a) | (255 - a) >> 31) )
 
#define CLAMP0255f(a)   (a > 255. ? 255.: a < 0. ? 0. : a)
 
#define CLAMP0255fi(a)   ((int)(a > 255. ? 255.: a < 0. ? 0. : a))
 
#define spc_rnd(val)   (_spc_rnd((val), prefs ? prefs->pb_quality : PB_QUALITY_HIGH))
 
#define LAB0   0.008856
 
#define LAB1   0.33333333333
 
#define LAB2   7.787
 
#define LAB3   0.13793103448
 
#define KL   1.0
 
#define KC   1.0
 
#define KH   1.0
 
#define K1   0.045
 
#define K2   0.015
 
#define RNDFAC   0.0000000001
 
#define DIST_THRESH   10.
 
#define RAT_START   .9
 
#define RAT_TIO   .9999999
 
#define RAT_MIN   .2
 
#define avg_chroma(x, y)   ((uint8_t)(*(cavg + ((int)(x) << 8) + (int)(y))))
 
#define avg_chroma_3_1(x, y)   ((uint8_t)(avg_chroma(x, avg_chroma(x, y))))
 
#define avg_chroma_1_3(x, y)   ((uint8_t)(avg_chroma(avg_chroma(x, y), y)))
 
#define avg_chroma_3_1f(x, y)   ((uint8_t)(avg_chromaf(x, avg_chromaf(x, y))))
 
#define avg_chroma_1_3f(x, y)   ((uint8_t)(avg_chromaf(avg_chromaf(x, y), y)))
 
#define bgr2yuv(b0, g0, r0, y, u, v)   rgb2yuv(r0, g0, b0, y, u, v)
 
#define bgr2yuv_with_gamma(b0, g0, r0, y, u, v)   rgb2yuv(r0, g0, b0, y, u, v, lut)
 
#define yuv2bgr(y, u, v, b, g, r)   yuv2rgb(y, u, v, r, g, b)
 
#define yuv2bgr_with_gamma(y, u, v, b, g, r, lut)   yuv2rgb_with_gamma(y, u, v, r, g, b, lut)
 
#define SHIFTVAL   sbits
 
#define ALIGN_SIZE   (1 << SHIFTVAL)
 

Functions

boolean weed_palette_is_sane (int pal)
 
LIVES_GLOBAL_INLINE int32_t round_special (int32_t val)
 
double get_luma8 (uint8_t r, uint8_t g, uint8_t b)
 
double get_luma16 (uint16_t r, uint16_t g, uint16_t b)
 
void rgb2xyz (uint8_t r, uint8_t g, uint8_t b, double *x, double *y, double *z)
 
LIVES_LOCAL_INLINE double lab_conv (double a)
 
void xyz2lab (double x, double y, double z, double *l, double *a, double *b)
 
double cdist94 (uint8_t r0, uint8_t g0, uint8_t b0, uint8_t r1, uint8_t g1, uint8_t b1)
 
void rgb2hsv (uint8_t r, uint8_t g, uint8_t b, double *h, double *s, double *v)
 
void hsv2rgb (double h, double s, double v, uint8_t *r, uint8_t *g, uint8_t *b)
 
boolean pick_nice_colour (uint8_t r0, uint8_t g0, uint8_t b0, uint8_t *r1, uint8_t *g1, uint8_t *b1, double max, double lmin, double lmax)
 
void init_advanced_palettes (void)
 
LIVES_GLOBAL_INLINE const weed_macropixel_t * get_advanced_palette (int weed_palette)
 
LIVES_GLOBAL_INLINE boolean weed_palette_is_valid (int pal)
 
LIVES_GLOBAL_INLINE int get_simple_palette (weed_macropixel_t *mpx)
 
LIVES_LOCAL_INLINE boolean is_rgbchan (uint16_t ctype)
 
LIVES_LOCAL_INLINE boolean is_yuvchan (uint16_t ctype)
 
LIVES_GLOBAL_INLINE size_t pixel_size (int pal)
 
LIVES_GLOBAL_INLINE int weed_palette_get_pixels_per_macropixel (int pal)
 
LIVES_GLOBAL_INLINE int weed_palette_get_bits_per_macropixel (int pal)
 
LIVES_GLOBAL_INLINE int weed_palette_get_nplanes (int pal)
 
LIVES_GLOBAL_INLINE boolean weed_palette_is_alpha (int pal)
 
LIVES_GLOBAL_INLINE boolean weed_palette_red_first (int pal)
 
LIVES_GLOBAL_INLINE boolean weed_palettes_rbswapped (int pal0, int pal1)
 
LIVES_GLOBAL_INLINE boolean weed_palette_is_rgb (int pal)
 
LIVES_GLOBAL_INLINE boolean weed_palette_is_yuv (int pal)
 
LIVES_GLOBAL_INLINE boolean weed_palette_has_alpha (int pal)
 
LIVES_GLOBAL_INLINE boolean weed_palette_is_float (int pal)
 
LIVES_GLOBAL_INLINE double weed_palette_get_plane_ratio_horizontal (int pal, int plane)
 
LIVES_GLOBAL_INLINE double weed_palette_get_plane_ratio_vertical (int pal, int plane)
 
LIVES_LOCAL_INLINE int _get_alpha (int pal)
 
LIVES_GLOBAL_INLINE int weed_palette_get_alpha_plane (int pal)
 
LIVES_GLOBAL_INLINE int weed_palette_get_alpha_offset (int pal)
 
LIVES_GLOBAL_INLINE boolean weed_palette_has_alpha_first (int pal)
 
LIVES_GLOBAL_INLINE boolean weed_palette_has_alpha_last (int pal)
 
void init_colour_engine (void)
 
LIVES_GLOBAL_INLINE void init_conversions (int intent)
 
LIVES_INLINE void rgb2yuv_with_gamma (uint8_t r0, uint8_t g0, uint8_t b0, uint8_t *y, uint8_t *u, uint8_t *v, uint8_t *lut)
 
LIVES_INLINE void rgb2yuyv_with_gamma (uint8_t r0, uint8_t g0, uint8_t b0, uint8_t r1, uint8_t g1, uint8_t b1, yuyv_macropixel *yuyv, uint8_t *lut)
 
LIVES_GLOBAL_INLINE boolean weed_palette_is_painter_palette (int pal)
 
boolean weed_palette_is_lower_quality (int p1, int p2)
 
LIVES_GLOBAL_INLINE boolean lives_pixbuf_is_all_black (LiVESPixbuf *pixbuf)
 
void pixel_data_planar_from_membuf (void **pixel_data, void *data, size_t size, int palette, boolean contig)
 
LIVES_INLINE void fill_plane (uint8_t *ptr, int psize, int width, int height, int rowstride, unsigned char *bpix)
 a "layer" is CHANNEL type plant which is not created from a plugin CHANNEL_TEMPLATE. More...
 
boolean create_empty_pixel_data (weed_layer_t *layer, boolean black_fill, boolean may_contig)
 creates pixel data for layer More...
 
weed_layer_tcreate_blank_layer (weed_layer_t *layer, const char *image_ext, int width, int height, int target_palette)
 fills layer with default values. More...
 
LIVES_GLOBAL_INLINE boolean rowstrides_differ (int n1, int *n1_array, int n2, int *n2_array)
 
LIVES_GLOBAL_INLINE weed_layer_tweed_layer_new (int layer_type)
 
LIVES_GLOBAL_INLINE int weed_layer_get_type (weed_layer_t *layer)
 
LIVES_GLOBAL_INLINE int weed_layer_is_video (weed_layer_t *layer)
 
LIVES_GLOBAL_INLINE int weed_layer_is_audio (weed_layer_t *layer)
 
LIVES_GLOBAL_INLINE weed_layer_tweed_layer_set_audio_data (weed_layer_t *layer, float **data, int arate, int naudchans, weed_size_t nsamps)
 
LIVES_GLOBAL_INLINE weed_layer_tweed_layer_set_flags (weed_layer_t *layer, int flags)
 
LIVES_GLOBAL_INLINE int weed_layer_get_flags (weed_layer_t *layer)
 
LIVES_GLOBAL_INLINE int lives_layer_get_clip (weed_layer_t *layer)
 
LIVES_GLOBAL_INLINE frames_t lives_layer_get_frame (weed_layer_t *layer)
 
LIVES_GLOBAL_INLINE weed_layer_tweed_layer_set_width (weed_layer_t *layer, int width)
 width in macropixels of the layer palette More...
 
LIVES_GLOBAL_INLINE weed_layer_tweed_layer_set_height (weed_layer_t *layer, int height)
 
LIVES_GLOBAL_INLINE weed_layer_tweed_layer_set_size (weed_layer_t *layer, int width, int height)
 
LIVES_GLOBAL_INLINE weed_layer_tweed_layer_set_pixel_data (weed_layer_t *layer, void **pixel_data, int nplanes)
 
LIVES_GLOBAL_INLINE weed_layer_tweed_layer_set_pixel_data_packed (weed_layer_t *layer, void *pixel_data)
 
LIVES_GLOBAL_INLINE weed_layer_tweed_layer_nullify_pixel_data (weed_layer_t *layer)
 
LIVES_GLOBAL_INLINE weed_layer_tweed_layer_set_rowstrides (weed_layer_t *layer, int *rowstrides, int nplanes)
 
LIVES_GLOBAL_INLINE weed_layer_tweed_layer_set_rowstride (weed_layer_t *layer, int rowstride)
 
LIVES_GLOBAL_INLINE weed_layer_tweed_layer_set_palette (weed_layer_t *layer, int palette)
 functions all return the input layer for convenience; no checking for valid values is done if layer is NULL or not weed_layer then NULL is returned More...
 
LIVES_GLOBAL_INLINE weed_layer_tweed_layer_set_gamma (weed_layer_t *layer, int gamma_type)
 
LIVES_GLOBAL_INLINE weed_layer_tweed_layer_set_yuv_clamping (weed_layer_t *layer, int clamping)
 
LIVES_GLOBAL_INLINE weed_layer_tweed_layer_set_yuv_sampling (weed_layer_t *layer, int sampling)
 
LIVES_GLOBAL_INLINE weed_layer_tweed_layer_set_yuv_subspace (weed_layer_t *layer, int subspace)
 
LIVES_GLOBAL_INLINE weed_layer_tweed_layer_set_palette_yuv (weed_layer_t *layer, int palette, int clamping, int sampling, int subspace)
 
LIVES_GLOBAL_INLINE void lives_layer_set_frame (weed_layer_t *layer, frames_t frame)
 
LIVES_GLOBAL_INLINE void lives_layer_set_clip (weed_layer_t *layer, int clip)
 
LIVES_GLOBAL_INLINE weed_layer_tlives_layer_new_for_frame (int clip, frames_t frame)
 
boolean copy_pixel_data (weed_layer_t *layer, weed_layer_t *old_layer, size_t alignment)
 
void alpha_unpremult (weed_layer_t *layer, boolean un)
 (un)premultply alpha using a lookup table More...
 
LIVES_LOCAL_INLINE boolean can_inline_gamma (int inpl, int opal)
 
boolean convert_layer_palette_full (weed_layer_t *layer, int outpl, int oclamping, int osampling, int osubspace, int tgamma)
 convert the palette of a layer More...
 
boolean convert_layer_palette (weed_layer_t *layer, int outpl, int op_clamping)
 
LiVESPixbuf * lives_pixbuf_new_blank (int width, int height, int palette)
 
LIVES_INLINE LiVESPixbuf * lives_pixbuf_cheat (boolean has_alpha, int width, int height, uint8_t *buf)
 
int weed_layer_get_gamma (weed_layer_t *layer)
 
void gamma_conv_params (int gamma_type, weed_layer_t *inst, boolean is_in)
 
boolean gamma_convert_sub_layer (int gamma_type, double fileg, weed_layer_t *layer, int x, int y, int width, int height, boolean may_thread)
 alter the transfer function of a Weed layer, from current value to gamma_type More...
 
LIVES_GLOBAL_INLINE boolean gamma_convert_layer (int gamma_type, weed_layer_t *layer)
 
LIVES_GLOBAL_INLINE boolean gamma_convert_layer_variant (double file_gamma, int tgamma, weed_layer_t *layer)
 
LiVESPixbuf * layer_to_pixbuf (weed_layer_t *layer, boolean realpalette, boolean fordisplay)
 
LIVES_INLINE boolean weed_palette_is_resizable (int pal, int clamped, boolean in_out)
 
void lives_pixbuf_set_opaque (LiVESPixbuf *pixbuf)
 
void lives_layer_set_opaque (weed_layer_t *layer)
 
boolean compact_rowstrides (weed_layer_t *layer)
 
boolean resize_layer (weed_layer_t *layer, int width, int height, LiVESInterpType interp, int opal_hint, int oclamp_hint)
 resize a layer More...
 
boolean letterbox_layer (weed_layer_t *layer, int nwidth, int nheight, int width, int height, LiVESInterpType interp, int tpal, int tclamp)
 
boolean pixbuf_to_layer (weed_layer_t *layer, LiVESPixbuf *pixbuf)
 turn a (Gdk)Pixbuf into a Weed layer More...
 
LIVES_LOCAL_INLINE int swap_red_blue (int pal)
 
boolean consider_swapping (int *inpal, int *outpal)
 look for shortcuts in palette conversions instead of converting e.g RGB -> BGRA, we may be able to pretend that the input palette is BGR and thus the conversion to BGRA is slightly cheaper we can do this provided the caller can take into account that the red / blue components are now swapped. More...
 
lives_painter_t * layer_to_lives_painter (weed_layer_t *layer)
 convert a weed layer to lives_painter (a.k.a cairo) More...
 
boolean lives_painter_to_layer (lives_painter_t *cr, weed_layer_t *layer)
 convert a lives_painter_t (a.k.a) cairo_t to a weed layer More...
 
int resize_all (int fileno, int width, int height, lives_img_type_t imgtype, boolean do_back, int *nbad, int *nmiss)
 utility funcs for GUI More...
 
weed_layer_tweed_layer_create (int width, int height, int *rowstrides, int palette)
 create a layer, setting the most important properties More...
 
weed_layer_tweed_layer_create_full (int width, int height, int *rowstrides, int palette, int YUV_clamping, int YUV_sampling, int YUV_subspace, int gamma_type)
 
weed_layer_tweed_layer_copy (weed_layer_t *dlayer, weed_layer_t *slayer)
 copy source layer slayer to dest layer dlayer More...
 
LIVES_GLOBAL_INLINE int weed_layer_count_refs (weed_layer_t *layer)
 
void weed_layer_pixel_data_free (weed_layer_t *layer)
 free pixel_data from layer More...
 
LIVES_GLOBAL_INLINE weed_layer_tweed_layer_free (weed_layer_t *layer)
 frees pixel_data for a layer, then the layer itself More...
 
int weed_layer_unref (weed_layer_t *layer)
 
LIVES_GLOBAL_INLINE int weed_layer_ref (weed_layer_t *layer)
 
LIVES_GLOBAL_INLINE void ** weed_layer_get_pixel_data (weed_layer_t *layer, int *nplanes)
 
LIVES_GLOBAL_INLINE uint8_t * weed_layer_get_pixel_data_packed (weed_layer_t *layer)
 
LIVES_GLOBAL_INLINE float ** weed_layer_get_audio_data (weed_layer_t *layer, int *naudchans)
 
LIVES_GLOBAL_INLINE int * weed_layer_get_rowstrides (weed_layer_t *layer, int *nplanes)
 
LIVES_GLOBAL_INLINE int weed_layer_get_rowstride (weed_layer_t *layer)
 for packed palettes More...
 
LIVES_GLOBAL_INLINE int weed_layer_get_width (weed_layer_t *layer)
 
LIVES_GLOBAL_INLINE int weed_layer_get_width_pixels (weed_layer_t *layer)
 
LIVES_GLOBAL_INLINE int weed_layer_get_height (weed_layer_t *layer)
 
LIVES_GLOBAL_INLINE int weed_layer_get_yuv_clamping (weed_layer_t *layer)
 
LIVES_GLOBAL_INLINE int weed_layer_get_yuv_sampling (weed_layer_t *layer)
 
LIVES_GLOBAL_INLINE int weed_layer_get_yuv_subspace (weed_layer_t *layer)
 
LIVES_GLOBAL_INLINE int weed_layer_get_palette (weed_layer_t *layer)
 
LIVES_GLOBAL_INLINE int weed_layer_get_palette_yuv (weed_layer_t *layer, int *clamping, int *sampling, int *subspace)
 
LIVES_GLOBAL_INLINE int weed_layer_get_audio_rate (weed_layer_t *layer)
 
LIVES_GLOBAL_INLINE int weed_layer_get_naudchans (weed_layer_t *layer)
 
LIVES_GLOBAL_INLINE int weed_layer_get_audio_length (weed_layer_t *layer)
 

Macro Definition Documentation

◆ ALIGN_SIZE

#define ALIGN_SIZE   (1 << SHIFTVAL)

Definition at line 9035 of file colourspace.c.

◆ avg_chroma

#define avg_chroma (   x,
 
)    ((uint8_t)(*(cavg + ((int)(x) << 8) + (int)(y))))

Definition at line 1790 of file colourspace.c.

◆ avg_chroma_1_3

#define avg_chroma_1_3 (   x,
 
)    ((uint8_t)(avg_chroma(avg_chroma(x, y), y)))

Definition at line 1792 of file colourspace.c.

◆ avg_chroma_1_3f

#define avg_chroma_1_3f (   x,
 
)    ((uint8_t)(avg_chromaf(avg_chromaf(x, y), y)))

Definition at line 1818 of file colourspace.c.

◆ avg_chroma_3_1

#define avg_chroma_3_1 (   x,
 
)    ((uint8_t)(avg_chroma(x, avg_chroma(x, y))))

Definition at line 1791 of file colourspace.c.

◆ avg_chroma_3_1f

#define avg_chroma_3_1f (   x,
 
)    ((uint8_t)(avg_chromaf(x, avg_chromaf(x, y))))

Definition at line 1817 of file colourspace.c.

◆ bgr2yuv

#define bgr2yuv (   b0,
  g0,
  r0,
  y,
  u,
 
)    rgb2yuv(r0, g0, b0, y, u, v)

Definition at line 1830 of file colourspace.c.

◆ bgr2yuv_with_gamma

#define bgr2yuv_with_gamma (   b0,
  g0,
  r0,
  y,
  u,
 
)    rgb2yuv(r0, g0, b0, y, u, v, lut)

Definition at line 1844 of file colourspace.c.

◆ CLAMP0255

#define CLAMP0255 (   a)    ((unsigned char)((((-a) >> 31) & a) | (255 - a) >> 31) )

Definition at line 211 of file colourspace.c.

◆ CLAMP0255f

#define CLAMP0255f (   a)    (a > 255. ? 255.: a < 0. ? 0. : a)

Definition at line 212 of file colourspace.c.

◆ CLAMP0255fi

#define CLAMP0255fi (   a)    ((int)(a > 255. ? 255.: a < 0. ? 0. : a))

Definition at line 213 of file colourspace.c.

◆ DIST_THRESH

#define DIST_THRESH   10.

◆ get_last_pixbuf_rowstride_value

#define get_last_pixbuf_rowstride_value (   width,
  nchans 
)    (width * (((nchans << 3) + 7) >> 3))

Definition at line 201 of file colourspace.c.

◆ get_pixbuf_rowstride_value

#define get_pixbuf_rowstride_value (   rowstride)    ((rowstride + 3) & ~3)

Definition at line 194 of file colourspace.c.

◆ K1

#define K1   0.045

Definition at line 1036 of file colourspace.c.

◆ K2

#define K2   0.015

Definition at line 1037 of file colourspace.c.

◆ KC

#define KC   1.0

Definition at line 1034 of file colourspace.c.

◆ KH

#define KH   1.0

Definition at line 1035 of file colourspace.c.

◆ KL

#define KL   1.0

Definition at line 1033 of file colourspace.c.

◆ LAB0

#define LAB0   0.008856

Definition at line 1022 of file colourspace.c.

◆ LAB1

#define LAB1   0.33333333333

Definition at line 1023 of file colourspace.c.

◆ LAB2

#define LAB2   7.787

Definition at line 1024 of file colourspace.c.

◆ LAB3

#define LAB3   0.13793103448

Definition at line 1025 of file colourspace.c.

◆ RAT_MIN

#define RAT_MIN   .2

◆ RAT_START

#define RAT_START   .9

◆ RAT_TIO

#define RAT_TIO   .9999999

◆ RNDFAC

#define RNDFAC   0.0000000001

Definition at line 1038 of file colourspace.c.

◆ SHIFTVAL

#define SHIFTVAL   sbits

Definition at line 9034 of file colourspace.c.

◆ spc_rnd

#define spc_rnd (   val)    (_spc_rnd((val), prefs ? prefs->pb_quality : PB_QUALITY_HIGH))

Definition at line 541 of file colourspace.c.

◆ USE_THREADS

#define USE_THREADS   1

set to 0 to disable threading for pixbuf operations, 1 to enable. Other values are invalid.

Definition at line 37 of file colourspace.c.

◆ yuv2bgr

#define yuv2bgr (   y,
  u,
  v,
  b,
  g,
 
)    yuv2rgb(y, u, v, r, g, b)

Definition at line 2050 of file colourspace.c.

◆ yuv2bgr_with_gamma

#define yuv2bgr_with_gamma (   y,
  u,
  v,
  b,
  g,
  r,
  lut 
)    yuv2rgb_with_gamma(y, u, v, r, g, b, lut)

Definition at line 2058 of file colourspace.c.

Function Documentation

◆ _get_alpha()

LIVES_LOCAL_INLINE int _get_alpha ( int  pal)

◆ alpha_unpremult()

void alpha_unpremult ( weed_layer_t layer,
boolean  un 
)

(un)premultply alpha using a lookup table

if un is FALSE we go the other way, and do a pre-multiplication

this is only used when going from palette with alpha to one without

special case - planar with alpha

unclamped YUVA8888 (packed)

Definition at line 9923 of file colourspace.c.

◆ can_inline_gamma()

LIVES_LOCAL_INLINE boolean can_inline_gamma ( int  inpl,
int  opal 
)

Definition at line 10108 of file colourspace.c.

◆ cdist94()

double cdist94 ( uint8_t  r0,
uint8_t  g0,
uint8_t  b0,
uint8_t  r1,
uint8_t  g1,
uint8_t  b1 
)

Definition at line 1075 of file colourspace.c.

Referenced by pick_nice_colour().

◆ compact_rowstrides()

boolean compact_rowstrides ( weed_layer_t layer)

Definition at line 12422 of file colourspace.c.

◆ consider_swapping()

boolean consider_swapping ( int *  inpal,
int *  outpal 
)

look for shortcuts in palette conversions instead of converting e.g RGB -> BGRA, we may be able to pretend that the input palette is BGR and thus the conversion to BGRA is slightly cheaper we can do this provided the caller can take into account that the red / blue components are now swapped.

If this is possible, then either inpal or outpal mau ne altered, and TRUE is returned

since we dont have ABGR, we can switch the out palette instead

Definition at line 13427 of file colourspace.c.

◆ convert_layer_palette()

boolean convert_layer_palette ( weed_layer_t layer,
int  outpl,
int  op_clamping 
)

Definition at line 11945 of file colourspace.c.

Referenced by cconx_convert_pixel_data().

◆ convert_layer_palette_full()

boolean convert_layer_palette_full ( weed_layer_t layer,
int  outpl,
int  oclamping,
int  osampling,
int  osubspace,
int  tgamma 
)

convert the palette of a layer

convert to/from the 5 non-float RGB palettes and 10 YUV palettes giving a total of 15*14=210 conversions

in addition YUV can be converted from clamped to unclamped and vice-versa

chroma sub and supersampling is implemented, and threading is used wherever possible

all conversions are performed via lookup tables

NOTE - if converting to YUV411, we cut pixels so (RGB) width is divisible by 4 if converting to YUV420 or YVU420, we cut pixels so (RGB) width is divisible by 2 if converting to YUV420 or YVU420, we cut pixels so height is divisible by 2

returns FALSE if the palette conversion fails or if layer is NULL

  • original palette pixel_data is free()d (unless converting between YUV420 and YVU420, there the u and v pointers are simply swapped).

current limitations:

  • chroma is assumed centred between luma for input and output
  • bt709 yuv is only implemented for conversions to / from rgb palettes and yuv420 / yvu420
  • rowstride values may be ignored for UYVY, YUYV and YUV411 planar palettes.
  • RGB float palettes not yet implemented

if V plane is before U, swap the pointers

add pre

inpl has post

outpl has post

outpl has pre

outpl has post

outpl has pre

if we came in as YVU, we got swapped to YUV

swap (again) and both become YVU

swap again and both become YUV (YVU out will get swapped on more time)

if V plane is before U, swap the pointers

Definition at line 10160 of file colourspace.c.

Referenced by convert_layer_palette().

◆ copy_pixel_data()

boolean copy_pixel_data ( weed_layer_t layer,
weed_layer_t old_layer,
size_t  alignment 
)

Definition at line 9843 of file colourspace.c.

◆ create_blank_layer()

weed_layer_t* create_blank_layer ( weed_layer_t layer,
const char *  image_ext,
int  width,
int  height,
int  target_palette 
)

fills layer with default values.

If either width or height are zero, then dimensions will be taken from the layer or defaults used if layer has a palette set, that will be maintained, else it will be set to target_palette if targette palette is WEED_PALETTE_END then default will be set depending on image_ext if this is "jpg" then it will be RGB24, otherwise RGBA32 finally we create the pixel data for layer

Definition at line 9611 of file colourspace.c.

◆ create_empty_pixel_data()

boolean create_empty_pixel_data ( weed_layer_t layer,
boolean  black_fill,
boolean  may_contig 
)

creates pixel data for layer

layer should be pre-set with palette, width in MACROPIXELS, and height gamma_type will be set WEED_GAMMA_SRGB, old pixel_data will not be freed.

Returns
FALSE on memory error

width, height, and current_palette must be pre-set in layer; width is in (macro) pixels of the palette width and height may be adjusted (rounded) in the function rowstrides will be set, and each plane will be aligned depending on THREADVAR(rowstride_alignment) if THREADVAR(rowstride_alignment_hint) is non 0 it will set THREADVAR(rowstride_alignment), which must be a power of 2 the special value -1 for the hint will create compact frames (rowstride = width * pixel_size)

if black_fill is set, fill with opaque black in the specified palette: for yuv palettes, YUV_clamping may be pre-set otherwise it will be set to WEED_YUV_CLAMPING_CLAMPED.

may_contig should normally be set to TRUE, except for special uses during palette conversion if set, then for planar palettes, only plane 0 will be allocated, so only this value should be freed in this case, the leaf WEED_LEAF_HOST_PIXEL_DATA_CONTIGUOUS will be set to WEED_TRUE

the allocated frames will be aligned to the pixel size for whatever palette and may be padded with extra bytes to guard against accidental overwrites

force use of fixed rowstrides, eg. decoder plugin

Definition at line 9058 of file colourspace.c.

Referenced by cconx_convert_pixel_data().

◆ fill_plane()

LIVES_INLINE void fill_plane ( uint8_t *  ptr,
int  psize,
int  width,
int  height,
int  rowstride,
unsigned char *  bpix 
)

a "layer" is CHANNEL type plant which is not created from a plugin CHANNEL_TEMPLATE.

When we pass this to a plugin, we need to adjust it depending on the plugin's CHANNEL_TEMPLATE to which we will assign it.

e.g.: memory may need aligning afterwards for particular plugins which set channel template flags: layer palette may need changing, layer may need resizing

fills the plane pointed to by ptr with bpix

psize is sizeof(bpix), width, height and rowstride are the dimensions of the target plane

Definition at line 9019 of file colourspace.c.

◆ gamma_conv_params()

void gamma_conv_params ( int  gamma_type,
weed_layer_t inst,
boolean  is_in 
)

Definition at line 12019 of file colourspace.c.

◆ gamma_convert_layer()

LIVES_GLOBAL_INLINE boolean gamma_convert_layer ( int  gamma_type,
weed_layer_t layer 
)

Definition at line 12195 of file colourspace.c.

◆ gamma_convert_layer_variant()

LIVES_GLOBAL_INLINE boolean gamma_convert_layer_variant ( double  file_gamma,
int  tgamma,
weed_layer_t layer 
)

Definition at line 12202 of file colourspace.c.

◆ gamma_convert_sub_layer()

boolean gamma_convert_sub_layer ( int  gamma_type,
double  fileg,
weed_layer_t layer,
int  x,
int  y,
int  width,
int  height,
boolean  may_thread 
)

alter the transfer function of a Weed layer, from current value to gamma_type

Definition at line 12124 of file colourspace.c.

◆ get_advanced_palette()

LIVES_GLOBAL_INLINE const weed_macropixel_t* get_advanced_palette ( int  weed_palette)

◆ get_luma16()

double get_luma16 ( uint16_t  r,
uint16_t  g,
uint16_t  b 
)

return luma value between 0. (black) and 1. (white)

Definition at line 557 of file colourspace.c.

◆ get_luma8()

double get_luma8 ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)

return luma value between 0. (black) and 1. (white)

Definition at line 549 of file colourspace.c.

Referenced by get_luma16(), and pick_nice_colour().

◆ get_simple_palette()

LIVES_GLOBAL_INLINE int get_simple_palette ( weed_macropixel_t *  mpx)

Definition at line 1378 of file colourspace.c.

◆ hsv2rgb()

void hsv2rgb ( double  h,
double  s,
double  v,
uint8_t *  r,
uint8_t *  g,
uint8_t *  b 
)

Definition at line 1113 of file colourspace.c.

◆ init_advanced_palettes()

void init_advanced_palettes ( void  )

yuv planar

yuv packed

alpha

Definition at line 1201 of file colourspace.c.

◆ init_colour_engine()

void init_colour_engine ( void  )

Definition at line 1661 of file colourspace.c.

◆ init_conversions()

LIVES_GLOBAL_INLINE void init_conversions ( int  intent)

set the 'effort' to as low as possible; if using adaptive quality

Definition at line 1804 of file colourspace.c.

Referenced by play_file(), and render_events().

◆ is_rgbchan()

LIVES_LOCAL_INLINE boolean is_rgbchan ( uint16_t  ctype)

Definition at line 1383 of file colourspace.c.

Referenced by weed_palette_is_rgb().

◆ is_yuvchan()

LIVES_LOCAL_INLINE boolean is_yuvchan ( uint16_t  ctype)

Definition at line 1387 of file colourspace.c.

Referenced by weed_palette_is_yuv().

◆ lab_conv()

LIVES_LOCAL_INLINE double lab_conv ( double  a)

Definition at line 1026 of file colourspace.c.

Referenced by xyz2lab().

◆ layer_to_lives_painter()

lives_painter_t* layer_to_lives_painter ( weed_layer_t layer)

convert a weed layer to lives_painter (a.k.a cairo)

width, height and rowstrides of source layer may all change

Definition at line 13473 of file colourspace.c.

◆ layer_to_pixbuf()

LiVESPixbuf* layer_to_pixbuf ( weed_layer_t layer,
boolean  realpalette,
boolean  fordisplay 
)

Definition at line 12210 of file colourspace.c.

◆ letterbox_layer()

boolean letterbox_layer ( weed_layer_t layer,
int  nwidth,
int  nheight,
int  width,
int  height,
LiVESInterpType  interp,
int  tpal,
int  tclamp 
)

no letterboxing needed - resize and return

resize the inner rectangle

create the outer rectangle in layer

get the actual size after any adjustments

this shouldnt happen, but if the outer rectangle is smaller than the inner we have to abort

retain pixel_data if it belongs to mainw->frame_layer

otherwise do not nullify, as we want to free old pixel_data

Definition at line 13015 of file colourspace.c.

◆ lives_layer_get_clip()

LIVES_GLOBAL_INLINE int lives_layer_get_clip ( weed_layer_t layer)

Definition at line 9705 of file colourspace.c.

◆ lives_layer_get_frame()

LIVES_GLOBAL_INLINE frames_t lives_layer_get_frame ( weed_layer_t layer)

Definition at line 9711 of file colourspace.c.

◆ lives_layer_new_for_frame()

LIVES_GLOBAL_INLINE weed_layer_t* lives_layer_new_for_frame ( int  clip,
frames_t  frame 
)

Definition at line 9833 of file colourspace.c.

Referenced by load_frame_image(), load_rfx_preview(), and render_events().

◆ lives_layer_set_clip()

LIVES_GLOBAL_INLINE void lives_layer_set_clip ( weed_layer_t layer,
int  clip 
)

Definition at line 9828 of file colourspace.c.

Referenced by lives_layer_new_for_frame().

◆ lives_layer_set_frame()

LIVES_GLOBAL_INLINE void lives_layer_set_frame ( weed_layer_t layer,
frames_t  frame 
)

Definition at line 9822 of file colourspace.c.

Referenced by lives_layer_new_for_frame().

◆ lives_layer_set_opaque()

void lives_layer_set_opaque ( weed_layer_t layer)

Definition at line 12385 of file colourspace.c.

◆ lives_painter_to_layer()

boolean lives_painter_to_layer ( lives_painter_t *  cr,
weed_layer_t layer 
)

convert a lives_painter_t (a.k.a) cairo_t to a weed layer

flush to ensure all writing to the image surface was done

un-premultiply the alpha

Definition at line 13549 of file colourspace.c.

◆ lives_pixbuf_cheat()

LIVES_INLINE LiVESPixbuf* lives_pixbuf_cheat ( boolean  has_alpha,
int  width,
int  height,
uint8_t *  buf 
)

Definition at line 11990 of file colourspace.c.

◆ lives_pixbuf_is_all_black()

LIVES_GLOBAL_INLINE boolean lives_pixbuf_is_all_black ( LiVESPixbuf *  pixbuf)

return FALSE if r >= 32, b >= 32 and g >= 24 here we use a, b, and c for the first 3 bytes of the pixel. Since a and c are symmetric and we ignore byte 4, this will work for RGB, BGR, RGBA and BGRA (we could also check ARGB by setting offs to 1).

Algorithm: (a & 0x1F) ^ a - nonzero iff a >= 32 (c & 0x1F) ^ c - nonzero iff c >= 32

((a & c) & 0x1F) ^ (a & c) - nonzero only if both are true

(b & 0x1F) ^ b - nonzero iff b >= 32 ((b << 1) & 0x1F) ^ (b << 1) - nonzero iff b >= 16 ((b << 2) & 0x1F) ^ (b << 2) - nonzero iff b >= 8 b & 0x0F - masks any values >= 32

Definition at line 2193 of file colourspace.c.

◆ lives_pixbuf_new_blank()

LiVESPixbuf* lives_pixbuf_new_blank ( int  width,
int  height,
int  palette 
)

Definition at line 11953 of file colourspace.c.

Referenced by insert_blank_frames().

◆ lives_pixbuf_set_opaque()

void lives_pixbuf_set_opaque ( LiVESPixbuf *  pixbuf)

Definition at line 12362 of file colourspace.c.

◆ pick_nice_colour()

boolean pick_nice_colour ( uint8_t  r0,
uint8_t  g0,
uint8_t  b0,
uint8_t *  r1,
uint8_t *  g1,
uint8_t *  b1,
double  max,
double  lmin,
double  lmax 
)

pick a random col

Definition at line 1142 of file colourspace.c.

◆ pixbuf_to_layer()

boolean pixbuf_to_layer ( weed_layer_t layer,
LiVESPixbuf *  pixbuf 
)

turn a (Gdk)Pixbuf into a Weed layer

return TRUE if we can use the original pixbuf pixels; in this case the pixbuf pixels should only be freed via lives_layer_pixel_data_free() or lives_layer_free() see code example.

code example:

if (pixbuf) { if (!pixbuf_to_layer(layer, pixbuf)) lives_widget_object_unref(pixbuf); else do NOT unref the pixbuf !!!! }

do something with layer...

weed_layer_pixel_data_free(layer); unrefs the pixbuf or weed_layer_free(layer); also unrefs the pixbuf

Definition at line 13347 of file colourspace.c.

◆ pixel_data_planar_from_membuf()

void pixel_data_planar_from_membuf ( void **  pixel_data,
void *  data,
size_t  size,
int  palette,
boolean  contig 
)

Definition at line 2236 of file colourspace.c.

◆ pixel_size()

LIVES_GLOBAL_INLINE size_t pixel_size ( int  pal)

This is actually the MACRO pixel size om bytes, to get the real pixel size, divide by weed_palette_pixels_per_macropixel()

Definition at line 1391 of file colourspace.c.

Referenced by weed_palette_get_bits_per_macropixel().

◆ resize_all()

int resize_all ( int  fileno,
int  width,
int  height,
lives_img_type_t  imgtype,
boolean  do_back,
int *  nbad,
int *  nmiss 
)

utility funcs for GUI

Definition at line 13622 of file colourspace.c.

Referenced by after_foreign_play().

◆ resize_layer()

boolean resize_layer ( weed_layer_t layer,
int  width,
int  height,
LiVESInterpType  interp,
int  opal_hint,
int  oclamp_hint 
)

resize a layer

widths in PIXELS

width is in PIXELS (not macropixels)

opal_hint and oclamp_hint may be set to hint the desired output palette and YUV clamping this is simply to ensure more efficient resizing, and may be ignored

  • setting opal_hint to WEED_PALETTE_END will attempt to minimise palette changes

"current_palette" should be checked on return as it may change

Returns
FALSE if we were unable to resize

Definition at line 12537 of file colourspace.c.

◆ rgb2hsv()

void rgb2hsv ( uint8_t  r,
uint8_t  g,
uint8_t  b,
double *  h,
double *  s,
double *  v 
)

Definition at line 1090 of file colourspace.c.

◆ rgb2xyz()

void rgb2xyz ( uint8_t  r,
uint8_t  g,
uint8_t  b,
double *  x,
double *  y,
double *  z 
)

Definition at line 1013 of file colourspace.c.

Referenced by cdist94().

◆ rgb2yuv_with_gamma()

LIVES_INLINE void rgb2yuv_with_gamma ( uint8_t  r0,
uint8_t  g0,
uint8_t  b0,
uint8_t *  y,
uint8_t *  u,
uint8_t *  v,
uint8_t *  lut 
)

Definition at line 1833 of file colourspace.c.

◆ rgb2yuyv_with_gamma()

LIVES_INLINE void rgb2yuyv_with_gamma ( uint8_t  r0,
uint8_t  g0,
uint8_t  b0,
uint8_t  r1,
uint8_t  g1,
uint8_t  b1,
yuyv_macropixel yuyv,
uint8_t *  lut 
)

Definition at line 1893 of file colourspace.c.

◆ round_special()

LIVES_GLOBAL_INLINE int32_t round_special ( int32_t  val)

Definition at line 544 of file colourspace.c.

Referenced by test_palette_conversions().

◆ rowstrides_differ()

LIVES_GLOBAL_INLINE boolean rowstrides_differ ( int  n1,
int *  n1_array,
int  n2,
int *  n2_array 
)

Definition at line 9647 of file colourspace.c.

◆ swap_red_blue()

LIVES_LOCAL_INLINE int swap_red_blue ( int  pal)

Definition at line 13411 of file colourspace.c.

Referenced by consider_swapping().

◆ weed_layer_copy()

weed_layer_t* weed_layer_copy ( weed_layer_t dlayer,
weed_layer_t slayer 
)

copy source layer slayer to dest layer dlayer

if dlayer is NULL, we return a new layer, otherwise we return dlayer for a newly created layer, this is a deep copy, since the pixel_data array is also copied for an existing dlayer, we copy pixel_data by reference. all the other relevant attributes are also copied

deep copy

shallow copy

Definition at line 13739 of file colourspace.c.

Referenced by load_rfx_preview(), and save_to_scrap_file().

◆ weed_layer_count_refs()

LIVES_GLOBAL_INLINE int weed_layer_count_refs ( weed_layer_t layer)

Definition at line 13799 of file colourspace.c.

Referenced by weed_layer_pixel_data_free().

◆ weed_layer_create()

weed_layer_t* weed_layer_create ( int  width,
int  height,
int *  rowstrides,
int  palette 
)

create a layer, setting the most important properties

Definition at line 13708 of file colourspace.c.

◆ weed_layer_create_full()

weed_layer_t* weed_layer_create_full ( int  width,
int  height,
int *  rowstrides,
int  palette,
int  YUV_clamping,
int  YUV_sampling,
int  YUV_subspace,
int  gamma_type 
)

Definition at line 13722 of file colourspace.c.

◆ weed_layer_free()

LIVES_GLOBAL_INLINE weed_layer_t* weed_layer_free ( weed_layer_t layer)

frees pixel_data for a layer, then the layer itself

if plant is freed returns (void *)NULL for convenience

Definition at line 13883 of file colourspace.c.

Referenced by close_current_file(), get_frames_sizes(), load_frame_image(), load_rfx_preview(), on_multitrack_activate(), and render_events().

◆ weed_layer_get_audio_data()

LIVES_GLOBAL_INLINE float** weed_layer_get_audio_data ( weed_layer_t layer,
int *  naudchans 
)

Definition at line 13921 of file colourspace.c.

◆ weed_layer_get_audio_length()

LIVES_GLOBAL_INLINE int weed_layer_get_audio_length ( weed_layer_t layer)

Definition at line 14004 of file colourspace.c.

Referenced by weed_apply_audio_effects_rt().

◆ weed_layer_get_audio_rate()

LIVES_GLOBAL_INLINE int weed_layer_get_audio_rate ( weed_layer_t layer)

Definition at line 13992 of file colourspace.c.

Referenced by weed_apply_audio_effects_rt().

◆ weed_layer_get_flags()

LIVES_GLOBAL_INLINE int weed_layer_get_flags ( weed_layer_t layer)

Definition at line 9699 of file colourspace.c.

◆ weed_layer_get_gamma()

int weed_layer_get_gamma ( weed_layer_t layer)

Definition at line 12002 of file colourspace.c.

Referenced by render_text_overlay().

◆ weed_layer_get_height()

LIVES_GLOBAL_INLINE int weed_layer_get_height ( weed_layer_t layer)

Definition at line 13953 of file colourspace.c.

Referenced by get_frames_sizes().

◆ weed_layer_get_naudchans()

LIVES_GLOBAL_INLINE int weed_layer_get_naudchans ( weed_layer_t layer)

Definition at line 13998 of file colourspace.c.

Referenced by weed_apply_audio_effects_rt().

◆ weed_layer_get_palette()

int weed_layer_get_palette ( weed_layer_t layer)

◆ weed_layer_get_palette_yuv()

LIVES_GLOBAL_INLINE int weed_layer_get_palette_yuv ( weed_layer_t layer,
int *  clamping,
int *  sampling,
int *  subspace 
)

Definition at line 13983 of file colourspace.c.

◆ weed_layer_get_pixel_data()

LIVES_GLOBAL_INLINE void** weed_layer_get_pixel_data ( weed_layer_t layer,
int *  nplanes 
)

Definition at line 13908 of file colourspace.c.

Referenced by weed_layer_copy(), and weed_layer_pixel_data_free().

◆ weed_layer_get_pixel_data_packed()

LIVES_GLOBAL_INLINE uint8_t* weed_layer_get_pixel_data_packed ( weed_layer_t layer)

Definition at line 13915 of file colourspace.c.

◆ weed_layer_get_rowstride()

LIVES_GLOBAL_INLINE int weed_layer_get_rowstride ( weed_layer_t layer)

for packed palettes

Definition at line 13935 of file colourspace.c.

Referenced by render_text_to_layer().

◆ weed_layer_get_rowstrides()

LIVES_GLOBAL_INLINE int* weed_layer_get_rowstrides ( weed_layer_t layer,
int *  nplanes 
)

Definition at line 13928 of file colourspace.c.

Referenced by compact_rowstrides(), and copy_pixel_data().

◆ weed_layer_get_type()

LIVES_GLOBAL_INLINE int weed_layer_get_type ( weed_layer_t layer)

Definition at line 9663 of file colourspace.c.

Referenced by weed_layer_is_audio(), and weed_layer_is_video().

◆ weed_layer_get_width()

LIVES_GLOBAL_INLINE int weed_layer_get_width ( weed_layer_t layer)

◆ weed_layer_get_width_pixels()

LIVES_GLOBAL_INLINE int weed_layer_get_width_pixels ( weed_layer_t layer)

Definition at line 13947 of file colourspace.c.

◆ weed_layer_get_yuv_clamping()

LIVES_GLOBAL_INLINE int weed_layer_get_yuv_clamping ( weed_layer_t layer)

Definition at line 13959 of file colourspace.c.

Referenced by vpp_try_match_palette(), and weed_layer_get_palette_yuv().

◆ weed_layer_get_yuv_sampling()

LIVES_GLOBAL_INLINE int weed_layer_get_yuv_sampling ( weed_layer_t layer)

Definition at line 13965 of file colourspace.c.

Referenced by weed_layer_get_palette_yuv().

◆ weed_layer_get_yuv_subspace()

LIVES_GLOBAL_INLINE int weed_layer_get_yuv_subspace ( weed_layer_t layer)

Definition at line 13971 of file colourspace.c.

Referenced by weed_layer_get_palette_yuv().

◆ weed_layer_is_audio()

LIVES_GLOBAL_INLINE int weed_layer_is_audio ( weed_layer_t layer)

Definition at line 9675 of file colourspace.c.

◆ weed_layer_is_video()

LIVES_GLOBAL_INLINE int weed_layer_is_video ( weed_layer_t layer)

Definition at line 9669 of file colourspace.c.

◆ weed_layer_new()

LIVES_GLOBAL_INLINE weed_layer_t* weed_layer_new ( int  layer_type)

Definition at line 9655 of file colourspace.c.

Referenced by get_frames_sizes(), and lives_layer_new_for_frame().

◆ weed_layer_nullify_pixel_data()

LIVES_GLOBAL_INLINE weed_layer_t* weed_layer_nullify_pixel_data ( weed_layer_t layer)

Definition at line 9753 of file colourspace.c.

Referenced by render_events(), and weed_layer_pixel_data_free().

◆ weed_layer_pixel_data_free()

void weed_layer_pixel_data_free ( weed_layer_t layer)

free pixel_data from layer

we do not free if WEED_LEAF_HOST_ORIG_PDATA is set (data is an alpha in which "belongs" to another out param)

take care of WEED_LEAF_HOST_PIXEL_DATA_CONTIGUOUS take care of WEED_LEAF_HOST_PIXBUF_SRC take care of WEED_LEAF_HOST_SURFACE_SRC

sets WEED_LEAF_PIXEL_DATA to NULL for the layer

this function should always be used to free WEED_LEAF_PIXEL_DATA

Definition at line 13819 of file colourspace.c.

Referenced by cconx_convert_pixel_data(), load_frame_image(), render_events(), and weed_layer_unref().

◆ weed_layer_ref()

LIVES_GLOBAL_INLINE int weed_layer_ref ( weed_layer_t layer)

Definition at line 13899 of file colourspace.c.

◆ weed_layer_set_audio_data()

LIVES_GLOBAL_INLINE weed_layer_t* weed_layer_set_audio_data ( weed_layer_t layer,
float **  data,
int  arate,
int  naudchans,
weed_size_t  nsamps 
)

Definition at line 9681 of file colourspace.c.

Referenced by push_audio_to_channel().

◆ weed_layer_set_flags()

LIVES_GLOBAL_INLINE weed_layer_t* weed_layer_set_flags ( weed_layer_t layer,
int  flags 
)

Definition at line 9692 of file colourspace.c.

◆ weed_layer_set_gamma()

LIVES_GLOBAL_INLINE weed_layer_t* weed_layer_set_gamma ( weed_layer_t layer,
int  gamma_type 
)

Definition at line 9784 of file colourspace.c.

Referenced by render_text_overlay().

◆ weed_layer_set_height()

LIVES_GLOBAL_INLINE weed_layer_t* weed_layer_set_height ( weed_layer_t layer,
int  height 
)

Definition at line 9724 of file colourspace.c.

◆ weed_layer_set_palette()

LIVES_GLOBAL_INLINE weed_layer_t* weed_layer_set_palette ( weed_layer_t layer,
int  palette 
)

functions all return the input layer for convenience; no checking for valid values is done if layer is NULL or not weed_layer then NULL is returned

Definition at line 9777 of file colourspace.c.

Referenced by weed_layer_set_palette_yuv().

◆ weed_layer_set_palette_yuv()

LIVES_GLOBAL_INLINE weed_layer_t* weed_layer_set_palette_yuv ( weed_layer_t layer,
int  palette,
int  clamping,
int  sampling,
int  subspace 
)

Definition at line 9812 of file colourspace.c.

◆ weed_layer_set_pixel_data()

LIVES_GLOBAL_INLINE weed_layer_t* weed_layer_set_pixel_data ( weed_layer_t layer,
void **  pixel_data,
int  nplanes 
)

Definition at line 9739 of file colourspace.c.

◆ weed_layer_set_pixel_data_packed()

LIVES_GLOBAL_INLINE weed_layer_t* weed_layer_set_pixel_data_packed ( weed_layer_t layer,
void *  pixel_data 
)

Definition at line 9746 of file colourspace.c.

◆ weed_layer_set_rowstride()

LIVES_GLOBAL_INLINE weed_layer_t* weed_layer_set_rowstride ( weed_layer_t layer,
int  rowstride 
)

Definition at line 9770 of file colourspace.c.

◆ weed_layer_set_rowstrides()

LIVES_GLOBAL_INLINE weed_layer_t* weed_layer_set_rowstrides ( weed_layer_t layer,
int *  rowstrides,
int  nplanes 
)

Definition at line 9763 of file colourspace.c.

◆ weed_layer_set_size()

LIVES_GLOBAL_INLINE weed_layer_t* weed_layer_set_size ( weed_layer_t layer,
int  width,
int  height 
)

Definition at line 9731 of file colourspace.c.

◆ weed_layer_set_width()

LIVES_GLOBAL_INLINE weed_layer_t* weed_layer_set_width ( weed_layer_t layer,
int  width 
)

width in macropixels of the layer palette

Definition at line 9717 of file colourspace.c.

◆ weed_layer_set_yuv_clamping()

LIVES_GLOBAL_INLINE weed_layer_t* weed_layer_set_yuv_clamping ( weed_layer_t layer,
int  clamping 
)

Definition at line 9791 of file colourspace.c.

Referenced by weed_layer_set_palette_yuv().

◆ weed_layer_set_yuv_sampling()

LIVES_GLOBAL_INLINE weed_layer_t* weed_layer_set_yuv_sampling ( weed_layer_t layer,
int  sampling 
)

Definition at line 9798 of file colourspace.c.

Referenced by weed_layer_set_palette_yuv().

◆ weed_layer_set_yuv_subspace()

LIVES_GLOBAL_INLINE weed_layer_t* weed_layer_set_yuv_subspace ( weed_layer_t layer,
int  subspace 
)

Definition at line 9805 of file colourspace.c.

Referenced by weed_layer_set_palette_yuv().

◆ weed_layer_unref()

int weed_layer_unref ( weed_layer_t layer)

Definition at line 13888 of file colourspace.c.

Referenced by weed_layer_free().

◆ weed_palette_get_alpha_offset()

LIVES_GLOBAL_INLINE int weed_palette_get_alpha_offset ( int  pal)

Definition at line 1510 of file colourspace.c.

Referenced by lives_layer_set_opaque().

◆ weed_palette_get_alpha_plane()

LIVES_GLOBAL_INLINE int weed_palette_get_alpha_plane ( int  pal)

Definition at line 1505 of file colourspace.c.

Referenced by lives_layer_set_opaque().

◆ weed_palette_get_bits_per_macropixel()

LIVES_GLOBAL_INLINE int weed_palette_get_bits_per_macropixel ( int  pal)

Definition at line 1411 of file colourspace.c.

Referenced by cconx_convert_pixel_data(), and weed_palette_get_compression_ratio().

◆ weed_palette_get_nplanes()

LIVES_GLOBAL_INLINE int weed_palette_get_nplanes ( int  pal)

Definition at line 1417 of file colourspace.c.

Referenced by weed_palette_get_compression_ratio().

◆ weed_palette_get_pixels_per_macropixel()

LIVES_GLOBAL_INLINE int weed_palette_get_pixels_per_macropixel ( int  pal)

◆ weed_palette_get_plane_ratio_horizontal()

LIVES_GLOBAL_INLINE double weed_palette_get_plane_ratio_horizontal ( int  pal,
int  plane 
)

Definition at line 1480 of file colourspace.c.

Referenced by weed_palette_get_compression_ratio().

◆ weed_palette_get_plane_ratio_vertical()

LIVES_GLOBAL_INLINE double weed_palette_get_plane_ratio_vertical ( int  pal,
int  plane 
)

Definition at line 1488 of file colourspace.c.

Referenced by weed_palette_get_compression_ratio().

◆ weed_palette_has_alpha()

LIVES_GLOBAL_INLINE boolean weed_palette_has_alpha ( int  pal)

Definition at line 1466 of file colourspace.c.

Referenced by best_palette_match(), and weed_palette_get_compression_ratio().

◆ weed_palette_has_alpha_first()

LIVES_GLOBAL_INLINE boolean weed_palette_has_alpha_first ( int  pal)

Definition at line 1515 of file colourspace.c.

◆ weed_palette_has_alpha_last()

LIVES_GLOBAL_INLINE boolean weed_palette_has_alpha_last ( int  pal)

Definition at line 1519 of file colourspace.c.

◆ weed_palette_is_alpha()

LIVES_GLOBAL_INLINE boolean weed_palette_is_alpha ( int  pal)

◆ weed_palette_is_float()

LIVES_GLOBAL_INLINE boolean weed_palette_is_float ( int  pal)

Definition at line 1475 of file colourspace.c.

◆ weed_palette_is_lower_quality()

boolean weed_palette_is_lower_quality ( int  p1,
int  p2 
)

Definition at line 2143 of file colourspace.c.

◆ weed_palette_is_painter_palette()

LIVES_GLOBAL_INLINE boolean weed_palette_is_painter_palette ( int  pal)

Definition at line 2130 of file colourspace.c.

◆ weed_palette_is_resizable()

LIVES_INLINE boolean weed_palette_is_resizable ( int  pal,
int  clamped,
boolean  in_out 
)

Definition at line 12343 of file colourspace.c.

◆ weed_palette_is_rgb()

LIVES_GLOBAL_INLINE boolean weed_palette_is_rgb ( int  pal)

◆ weed_palette_is_sane()

LIVES_GLOBAL_INLINE boolean weed_palette_is_sane ( int  pal)

Definition at line 1523 of file colourspace.c.

◆ weed_palette_is_valid()

LIVES_GLOBAL_INLINE boolean weed_palette_is_valid ( int  pal)

Definition at line 1374 of file colourspace.c.

Referenced by weed_palette_get_compression_ratio().

◆ weed_palette_is_yuv()

LIVES_GLOBAL_INLINE boolean weed_palette_is_yuv ( int  pal)

◆ weed_palette_red_first()

LIVES_GLOBAL_INLINE boolean weed_palette_red_first ( int  pal)

Definition at line 1433 of file colourspace.c.

Referenced by weed_palettes_rbswapped().

◆ weed_palettes_rbswapped()

LIVES_GLOBAL_INLINE boolean weed_palettes_rbswapped ( int  pal0,
int  pal1 
)

Definition at line 1444 of file colourspace.c.

◆ xyz2lab()

void xyz2lab ( double  x,
double  y,
double  z,
double *  l,
double *  a,
double *  b 
)

Definition at line 1028 of file colourspace.c.

Referenced by cdist94().