/* * CINELERRA * Copyright (C) 2016-2020 William Morrow * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ #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) { v *= ((float)(n*(1-1./0x1000000))); return v < 0 ? 0 : v >= n ? n-1 : v; } static inline float fclp(float v, const int n) { v /= ((float)(n*(1-1./0x1000000))); return v < 0 ? 0 : v > 1 ? 1 : v; } #include #define ZTYP(ty) typedef ty z_##ty __attribute__ ((__unused__)) ZTYP(int); ZTYP(float); #define xfer_flat_row_out(oty_t) \ for( unsigned i=y0; 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, uint8_t *out_yp, uint8_t *out_up, uint8_t *out_vp, uint8_t *out_ap, int out_rowspan, uint8_t **input_rows, int in_colormodel, int in_x, int in_y, int in_w, int in_h, uint8_t *in_yp, uint8_t *in_up, uint8_t *in_vp, uint8_t *in_ap, int in_rowspan, int bg_color, int bg_alpha); // generated code concatentated here