X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Fxfer.h;h=508f977bdd949726c460d2f0368f9b1dad57f2bb;hb=ce9d2233f4653ae54ee7bdfa4a7313326a9d8240;hp=ddbca7f07636e586ea81e2026d32e19edcda1b48;hpb=30bdb85eb33a8ee7ba675038a86c6be59c43d7bd;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/guicast/xfer.h b/cinelerra-5.1/guicast/xfer.h index ddbca7f0..508f977b 100644 --- a/cinelerra-5.1/guicast/xfer.h +++ b/cinelerra-5.1/guicast/xfer.h @@ -1,4 +1,9 @@ #include "bccmodels.h" +#include "bcresources.h" +#include "condition.h" +#include "linklist.h" +#include "mutex.h" +#include "thread.h" #include "clip.h" static inline float clp(const int n, float v) { @@ -17,68 +22,9 @@ static inline float fclp(float v, const int n) { ZTYP(int); ZTYP(float); -// All variables are unsigned -// y -> 24 bits u, v, -> 8 bits r, g, b -> 8 bits -#define YUV_TO_RGB(y, u, v, r, g, b) \ -{ \ - (r) = ((y + vtor_tab[v]) >> 16); \ - (g) = ((y + utog_tab[u] + vtog_tab[v]) >> 16); \ - (b) = ((y + utob_tab[u]) >> 16); \ - CLAMP(r, 0, 0xff); CLAMP(g, 0, 0xff); CLAMP(b, 0, 0xff); \ -} - -// y -> 0 - 1 float -// u, v, -> 8 bits -// r, g, b -> float -#define YUV_TO_FLOAT(y, u, v, r, g, b) \ -{ \ - (r) = y + vtor_float_tab[v]; \ - (g) = y + utog_float_tab[u] + vtog_float_tab[v]; \ - (b) = y + utob_float_tab[u]; \ -} - -// y -> 0 - 1 float -// u, v, -> 16 bits -// r, g, b -> float -#define YUV16_TO_RGB_FLOAT(y, u, v, r, g, b) \ -{ \ - (r) = y + v16tor_float_tab[v]; \ - (g) = y + u16tog_float_tab[u] + v16tog_float_tab[v]; \ - (b) = y + u16tob_float_tab[u]; \ -} - -// y -> 24 bits u, v-> 16 bits -#define YUV_TO_RGB16(y, u, v, r, g, b) \ -{ \ - (r) = ((y + vtor_tab16[v]) >> 8); \ - (g) = ((y + utog_tab16[u] + vtog_tab16[v]) >> 8); \ - (b) = ((y + utob_tab16[u]) >> 8); \ - CLAMP(r, 0, 0xffff); CLAMP(g, 0, 0xffff); CLAMP(b, 0, 0xffff); \ -} - - - - -#define RGB_TO_YUV(y, u, v, r, g, b) \ -{ \ - y = ((rtoy_tab[r] + gtoy_tab[g] + btoy_tab[b]) >> 16); \ - u = ((rtou_tab[r] + gtou_tab[g] + btou_tab[b]) >> 16); \ - v = ((rtov_tab[r] + gtov_tab[g] + btov_tab[b]) >> 16); \ - CLAMP(y, 0, 0xff); CLAMP(u, 0, 0xff); CLAMP(v, 0, 0xff); \ -} - -// r, g, b -> 16 bits -#define RGB_TO_YUV16(y, u, v, r, g, b) \ -{ \ - y = ((rtoy_tab16[r] + gtoy_tab16[g] + btoy_tab16[b]) >> 8); \ - u = ((rtou_tab16[r] + gtou_tab16[g] + btou_tab16[b]) >> 8); \ - v = ((rtov_tab16[r] + gtov_tab16[g] + btov_tab16[b]) >> 8); \ - CLAMP(y, 0, 0xffff); CLAMP(u, 0, 0xffff); CLAMP(v, 0, 0xffff); \ -} - #define xfer_flat_row_out(oty_t) \ - for( unsigned i=0; i, public Thread { + public: + Condition *init, *complete; + Slicer(BC_Xfer *xp); + ~Slicer(); + void slice(BC_Xfer *xp, unsigned y0, unsigned y1); + void run(); + BC_Xfer *xp; + int done, y0, y1; + }; + + class SlicerList : public List, public Mutex { + public: + int count; + Slicer *get_slicer(BC_Xfer *xp); + void reset(); + SlicerList(); + ~SlicerList(); + }; + static SlicerList slicers; void init( uint8_t **output_rows, int out_colormodel, int out_x, int out_y, int out_w, int out_h,