no longer need ffmpeg patch0 which was for Termux
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / overlaynearest.h
1 /*
2  * This program is free software; you can redistribute it and/or modify it
3  * under the terms of the GNU General Public License as published
4  * by the Free Software Foundation; either version 2 of the License, or
5  * (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful, but
8  * WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10  * General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public
13  * License along with this program; if not, write to the Free Software
14  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
15  * USA
16  */
17
18
19 #ifndef __OVERLAYNEAREST_H__
20 #define __OVERLAYNEAREST_H__
21 #include "overlayframe.h"
22
23 #define XBLEND_3NN(FN, temp_type, type, max, components, ofs, round) { \
24         temp_type opcty = fade * max + round, trnsp = max - opcty; \
25         type** output_rows = (type**)output->get_rows(); \
26         type** input_rows = (type**)input->get_rows(); \
27         ox *= components; \
28  \
29         for( int i=pkg->out_row1; i<pkg->out_row2; ++i ) { \
30                 int *lx = engine->in_lookup_x; \
31                 type* in_row = input_rows[*ly++]; \
32                 type* output = output_rows[i] + ox; \
33                 for( int j=ow; --j>=0; ) { \
34                         in_row += *lx++; \
35                         if( components == 4 ) { \
36                                 temp_type r, g, b, a; \
37                                 ALPHA4_BLEND(FN, temp_type, in_row, output, max, ofs, ofs, round); \
38                                 ALPHA4_STORE(output, ofs, max); \
39                         } \
40                         else { \
41                                 temp_type r, g, b; \
42                                 ALPHA3_BLEND(FN, temp_type, in_row, output, max, ofs, ofs, round); \
43                                 ALPHA3_STORE(output, ofs, max); \
44                         } \
45                         output += components; \
46                 } \
47         } \
48 } break
49
50 #endif