Parent Directory
|
Revision Log
Release 2.0.7 tag
1 /* 2 DDS GIMP plugin 3 4 Copyright (C) 2004-2008 Shawn Kirst <skirst@insightbb.com>, 5 with parts (C) 2003 Arne Reuter <homepage@arnereuter.de> where specified. 6 7 This program is free software; you can redistribute it and/or 8 modify it under the terms of the GNU General Public 9 License as published by the Free Software Foundation; either 10 version 2 of the License, or (at your option) any later version. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with this program; see the file COPYING. If not, write to 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 20 Boston, MA 02111-1307, USA. 21 */ 22 23 #ifndef IMATH_H 24 #define IMATH_H 25 26 #ifndef MIN 27 #define MIN(a, b) ((a) < (b) ? (a) : (b)) 28 #endif 29 #ifndef MAX 30 #define MAX(a, b) ((a) > (b) ? (a) : (b)) 31 #endif 32 33 #define IS_POW2(x) (!((x) & ((x) - 1))) 34 #define IS_MUL4(x) (((x) & 3) == 0) 35 36 /* round integer x up to next multiple of 4 */ 37 #define RND_MUL4(x) ((x) + (4 - ((x) & 3))) 38 39 static inline int mul8bit(int a, int b) 40 { 41 int t = a * b + 128; 42 return((t + (t >> 8)) >> 8); 43 } 44 45 static inline int blerp(int a, int b, int x) 46 { 47 return(a + mul8bit(b - a, x)); 48 } 49 50 static inline int icerp(int a, int b, int c, int d, int x) 51 { 52 int p = (d - c) - (a - b); 53 int q = (a - b) - p; 54 int r = c - a; 55 return((x * (x * (x * p + (q << 7)) + (r << 14)) + (b << 21)) >> 21); 56 } 57 58 #endif
| ViewVC Help | |
| Powered by ViewVC 1.0.4 |