[772] | 1 | /* ----------------- */ |
---|
| 2 | /* --- nrbool1.c --- */ |
---|
| 3 | /* ----------------- */ |
---|
| 4 | |
---|
| 5 | /* |
---|
| 6 | * Copyright (c) 2000-2014, Lionel Lacassagne, All rights reserved |
---|
| 7 | * Univ Paris Sud XI, CNRS |
---|
| 8 | * |
---|
| 9 | * Distributed under the Boost Software License, Version 1.0 |
---|
| 10 | * see accompanying file LICENSE.txt or copy it at |
---|
| 11 | * http://www.boost.org/LICENSE_1_0.txt |
---|
| 12 | */ |
---|
| 13 | |
---|
| 14 | #include <stdio.h> |
---|
| 15 | #include <stddef.h> |
---|
| 16 | #include <stdlib.h> |
---|
| 17 | #include <math.h> // fabs |
---|
| 18 | |
---|
[822] | 19 | #include "nrc_os_config.h" |
---|
[772] | 20 | #include "mypredef.h" |
---|
| 21 | #include "nrtype.h" |
---|
| 22 | #include "nrdef.h" |
---|
| 23 | #include "nrmacro.h" |
---|
| 24 | #include "nrkernel.h" |
---|
| 25 | |
---|
| 26 | #include "nrbool1.h" |
---|
| 27 | |
---|
| 28 | /* |
---|
| 29 | * ----------- |
---|
| 30 | * --- Not --- |
---|
| 31 | * ----------- |
---|
| 32 | */ |
---|
| 33 | |
---|
[822] | 34 | #undef not_type_vector |
---|
| 35 | #define not_type_vector(t) \ |
---|
| 36 | void short_name(t,not_,vector)(t * X, int32_t ncl, int32_t nch, t * Y) \ |
---|
| 37 | { \ |
---|
| 38 | for (int32_t j = ncl; j <= nch; j++) { \ |
---|
| 39 | Y[j] = ~X[j]; \ |
---|
| 40 | } \ |
---|
[772] | 41 | } |
---|
[822] | 42 | |
---|
| 43 | not_type_vector(int8_t); |
---|
| 44 | not_type_vector(uint8_t); |
---|
| 45 | not_type_vector(int16_t); |
---|
| 46 | not_type_vector(uint16_t); |
---|
| 47 | not_type_vector(int32_t); |
---|
| 48 | not_type_vector(uint32_t); |
---|
| 49 | not_type_vector(int64_t); |
---|
| 50 | not_type_vector(uint64_t); |
---|
| 51 | |
---|
| 52 | |
---|
[772] | 53 | /* ----------------------------------------------------------------- */ |
---|
[822] | 54 | void not_rgb8vector(rgb8 * X, int32_t ncl, int32_t nch, rgb8 * Y) |
---|
[772] | 55 | /* ----------------------------------------------------------------- */ |
---|
| 56 | { |
---|
[822] | 57 | for (int32_t j = ncl; j <= nch; j++) { |
---|
| 58 | RGB8_NOT(X[j], Y[j]); |
---|
[772] | 59 | } |
---|
| 60 | } |
---|
[822] | 61 | |
---|
[772] | 62 | /* -------------------------------------------------------------------- */ |
---|
[822] | 63 | void not_rgbx8vector(rgbx8 * X, int32_t ncl, int32_t nch, rgbx8 * Y) |
---|
[772] | 64 | /* -------------------------------------------------------------------- */ |
---|
| 65 | { |
---|
[822] | 66 | for (int32_t j = ncl; j <= nch; j++) { |
---|
| 67 | RGBX8_NOT(X[j], Y[j]); |
---|
[772] | 68 | } |
---|
| 69 | } |
---|
[822] | 70 | |
---|
[772] | 71 | /* |
---|
| 72 | * ----------- |
---|
| 73 | * --- Or --- |
---|
| 74 | * ----------- |
---|
| 75 | */ |
---|
| 76 | |
---|
[822] | 77 | #undef or_type_vector |
---|
| 78 | #define or_type_vector(t) \ |
---|
| 79 | void short_name(t,or_,vector)(t * X, int32_t ncl, int32_t nch, t * Y, t * Z) \ |
---|
| 80 | { \ |
---|
| 81 | for (int32_t j = ncl; j <= nch; j++) { \ |
---|
| 82 | Z[j] = X[j] | Y[j]; \ |
---|
| 83 | } \ |
---|
[772] | 84 | } |
---|
[822] | 85 | |
---|
| 86 | or_type_vector(int8_t); |
---|
| 87 | or_type_vector(uint8_t); |
---|
| 88 | or_type_vector(int16_t); |
---|
| 89 | or_type_vector(uint16_t); |
---|
| 90 | or_type_vector(int32_t); |
---|
| 91 | or_type_vector(uint32_t); |
---|
| 92 | or_type_vector(int64_t); |
---|
| 93 | or_type_vector(uint64_t); |
---|
| 94 | |
---|
| 95 | |
---|
[772] | 96 | /* ------------------------------------------------------------------------- */ |
---|
[822] | 97 | void or_rgb8vector(rgb8 * X, int32_t ncl, int32_t nch, rgb8 * Y, rgb8 * Z) |
---|
[772] | 98 | /* ------------------------------------------------------------------------- */ |
---|
| 99 | { |
---|
[822] | 100 | for (int32_t j = ncl; j <= nch; j++) { |
---|
| 101 | RGB8_OR(X[j], Y[j], Z[j]); |
---|
[772] | 102 | } |
---|
| 103 | } |
---|
| 104 | /* ----------------------------------------------------------------------------- */ |
---|
[822] | 105 | void or_rgbx8vector(rgbx8 * X, int32_t ncl, int32_t nch, rgbx8 * Y, rgbx8 * Z) |
---|
[772] | 106 | /* ----------------------------------------------------------------------------- */ |
---|
| 107 | { |
---|
[822] | 108 | for (int32_t j = ncl; j <= nch; j++) { |
---|
| 109 | RGBX8_OR(X[j], Y[j], Z[j]); |
---|
[772] | 110 | } |
---|
| 111 | } |
---|
[822] | 112 | |
---|
| 113 | |
---|
| 114 | #undef orc_type_vector |
---|
| 115 | #define orc_type_vector(t) \ |
---|
| 116 | void short_name(t,orc_,vector)(t * X, int32_t ncl, int32_t nch, t y, t * Z) \ |
---|
| 117 | { \ |
---|
| 118 | for (int32_t j = ncl; j <= nch; j++) { \ |
---|
| 119 | Z[j] = X[j] | y; \ |
---|
| 120 | } \ |
---|
[772] | 121 | } |
---|
[822] | 122 | |
---|
| 123 | orc_type_vector(int8_t); |
---|
| 124 | orc_type_vector(uint8_t); |
---|
| 125 | orc_type_vector(int16_t); |
---|
| 126 | orc_type_vector(uint16_t); |
---|
| 127 | orc_type_vector(int32_t); |
---|
| 128 | orc_type_vector(uint32_t); |
---|
| 129 | orc_type_vector(int64_t); |
---|
| 130 | orc_type_vector(uint64_t); |
---|
| 131 | |
---|
| 132 | |
---|
[772] | 133 | /* ------------------------------------------------------------------------- */ |
---|
[822] | 134 | void orc_rgb8vector(rgb8 * X, int32_t ncl, int32_t nch, rgb8 y, rgb8 * Z) |
---|
[772] | 135 | /* ------------------------------------------------------------------------- */ |
---|
| 136 | { |
---|
[822] | 137 | for (int32_t j = ncl; j <= nch; j++) { |
---|
| 138 | RGB8_OR(X[j], y, Z[j]); |
---|
[772] | 139 | } |
---|
| 140 | } |
---|
[822] | 141 | |
---|
[772] | 142 | /* ----------------------------------------------------------------------------- */ |
---|
[822] | 143 | void orc_rgbx8vector(rgbx8 * X, int32_t ncl, int32_t nch, rgbx8 y, rgbx8 * Z) |
---|
[772] | 144 | /* ----------------------------------------------------------------------------- */ |
---|
| 145 | { |
---|
[822] | 146 | for (int32_t j = ncl; j <= nch; j++) { |
---|
| 147 | RGBX8_OR(X[j], y, Z[j]); |
---|
[772] | 148 | } |
---|
| 149 | } |
---|
[822] | 150 | |
---|
| 151 | |
---|
[772] | 152 | /* |
---|
| 153 | * ----------- |
---|
| 154 | * --- XOR --- |
---|
| 155 | * ----------- |
---|
| 156 | */ |
---|
[822] | 157 | |
---|
| 158 | #undef xor_type_vector |
---|
| 159 | #define xor_type_vector(t) \ |
---|
| 160 | void short_name(t,xor_,vector)(t * X, int32_t ncl, int32_t nch, t * Y, t * Z) \ |
---|
| 161 | { \ |
---|
| 162 | for (int32_t j = ncl; j <= nch; j++) { \ |
---|
| 163 | Z[j] = X[j] ^ Y[j]; \ |
---|
| 164 | } \ |
---|
[772] | 165 | } |
---|
[822] | 166 | |
---|
| 167 | xor_type_vector(int8_t); |
---|
| 168 | xor_type_vector(uint8_t); |
---|
| 169 | xor_type_vector(int16_t); |
---|
| 170 | xor_type_vector(uint16_t); |
---|
| 171 | xor_type_vector(int32_t); |
---|
| 172 | xor_type_vector(uint32_t); |
---|
| 173 | xor_type_vector(int64_t); |
---|
| 174 | xor_type_vector(uint64_t); |
---|
| 175 | |
---|
| 176 | |
---|
[772] | 177 | /* -------------------------------------------------------------------------- */ |
---|
[822] | 178 | void xor_rgb8vector(rgb8 * X, int32_t ncl, int32_t nch, rgb8 * Y, rgb8 * Z) |
---|
[772] | 179 | /* -------------------------------------------------------------------------- */ |
---|
| 180 | { |
---|
[822] | 181 | for (int32_t j = ncl; j <= nch; j++) { |
---|
| 182 | RGB8_XOR(X[j], Y[j], Z[j]); |
---|
[772] | 183 | } |
---|
| 184 | } |
---|
[822] | 185 | |
---|
[772] | 186 | /* ------------------------------------------------------------------------------ */ |
---|
[822] | 187 | void xor_rgbx8vector(rgbx8 * X, int32_t ncl, int32_t nch, rgbx8 * Y, rgbx8 * Z) |
---|
[772] | 188 | /* ------------------------------------------------------------------------------ */ |
---|
| 189 | { |
---|
[822] | 190 | for (int32_t j = ncl; j <= nch; j++) { |
---|
| 191 | RGBX8_XOR(X[j], Y[j], Z[j]); |
---|
[772] | 192 | } |
---|
| 193 | } |
---|
[822] | 194 | |
---|
| 195 | |
---|
| 196 | #undef xorc_type_vector |
---|
| 197 | #define xorc_type_vector(t) \ |
---|
| 198 | void short_name(t,xorc_,vector)(t * X, int32_t ncl, int32_t nch, t y, t * Z) \ |
---|
| 199 | { \ |
---|
| 200 | for (int32_t j = ncl; j <= nch; j++) { \ |
---|
| 201 | Z[j] = X[j] ^ y; \ |
---|
| 202 | } \ |
---|
[772] | 203 | } |
---|
[822] | 204 | |
---|
| 205 | xorc_type_vector(int8_t); |
---|
| 206 | xorc_type_vector(uint8_t); |
---|
| 207 | xorc_type_vector(int16_t); |
---|
| 208 | xorc_type_vector(uint16_t); |
---|
| 209 | xorc_type_vector(int32_t); |
---|
| 210 | xorc_type_vector(uint32_t); |
---|
| 211 | xorc_type_vector(int64_t); |
---|
| 212 | xorc_type_vector(uint64_t); |
---|
| 213 | |
---|
| 214 | |
---|
[772] | 215 | /* -------------------------------------------------------------------------- */ |
---|
[822] | 216 | void xorc_rgb8vector(rgb8 * X, int32_t ncl, int32_t nch, rgb8 y, rgb8 * Z) |
---|
[772] | 217 | /* -------------------------------------------------------------------------- */ |
---|
| 218 | { |
---|
[822] | 219 | for (int32_t j = ncl; j <= nch; j++) { |
---|
| 220 | RGB8_XOR(X[j], y, Z[j]); |
---|
[772] | 221 | } |
---|
| 222 | } |
---|
[822] | 223 | |
---|
[772] | 224 | /* ------------------------------------------------------------------------------ */ |
---|
[822] | 225 | void xorc_rgbx8vector(rgbx8 * X, int32_t ncl, int32_t nch, rgbx8 y, rgbx8 * Z) |
---|
[772] | 226 | /* ------------------------------------------------------------------------------ */ |
---|
| 227 | { |
---|
[822] | 228 | for (int32_t j = ncl; j <= nch; j++) { |
---|
| 229 | RGBX8_XOR(X[j], y, Z[j]); |
---|
[772] | 230 | } |
---|
| 231 | } |
---|
[822] | 232 | |
---|
| 233 | |
---|
[772] | 234 | /* |
---|
| 235 | * ----------- |
---|
| 236 | * --- AND --- |
---|
| 237 | * ----------- |
---|
| 238 | */ |
---|
[822] | 239 | |
---|
| 240 | |
---|
| 241 | #undef and_type_vector |
---|
| 242 | #define and_type_vector(t) \ |
---|
| 243 | void short_name(t,and_,vector)(t * X, int32_t ncl, int32_t nch, t * Y, t * Z) \ |
---|
| 244 | { \ |
---|
| 245 | for (int32_t j = ncl; j <= nch; j++) { \ |
---|
| 246 | Z[j] = X[j] & Y[j]; \ |
---|
| 247 | } \ |
---|
[772] | 248 | } |
---|
[822] | 249 | |
---|
| 250 | and_type_vector(int8_t); |
---|
| 251 | and_type_vector(uint8_t); |
---|
| 252 | and_type_vector(int16_t); |
---|
| 253 | and_type_vector(uint16_t); |
---|
| 254 | and_type_vector(int32_t); |
---|
| 255 | and_type_vector(uint32_t); |
---|
| 256 | and_type_vector(int64_t); |
---|
| 257 | and_type_vector(uint64_t); |
---|
| 258 | |
---|
| 259 | |
---|
[772] | 260 | /* -------------------------------------------------------------------------- */ |
---|
[822] | 261 | void and_rgb8vector(rgb8 * X, int32_t ncl, int32_t nch, rgb8 * Y, rgb8 * Z) |
---|
[772] | 262 | /* -------------------------------------------------------------------------- */ |
---|
| 263 | { |
---|
[822] | 264 | for (int32_t j = ncl; j <= nch; j++) { |
---|
| 265 | RGB8_AND(X[j], Y[j], Z[j]); |
---|
[772] | 266 | } |
---|
| 267 | } |
---|
[822] | 268 | |
---|
[772] | 269 | /* ------------------------------------------------------------------------------ */ |
---|
[822] | 270 | void and_rgbx8vector(rgbx8 * X, int32_t ncl, int32_t nch, rgbx8 * Y, rgbx8 * Z) |
---|
[772] | 271 | /* ------------------------------------------------------------------------------ */ |
---|
| 272 | { |
---|
[822] | 273 | for (int32_t j = ncl; j <= nch; j++) { |
---|
| 274 | RGBX8_AND(X[j], Y[j], Z[j]); |
---|
[772] | 275 | } |
---|
| 276 | } |
---|
[822] | 277 | |
---|
| 278 | |
---|
| 279 | #undef andc_type_vector |
---|
| 280 | #define andc_type_vector(t) \ |
---|
| 281 | void short_name(t,andc_,vector)(t * X, int32_t ncl, int32_t nch, t y, t * Z) \ |
---|
| 282 | { \ |
---|
| 283 | for (int32_t j = ncl; j <= nch; j++) { \ |
---|
| 284 | Z[j] = X[j] ^ y; \ |
---|
| 285 | } \ |
---|
[772] | 286 | } |
---|
[822] | 287 | |
---|
| 288 | andc_type_vector(int8_t); |
---|
| 289 | andc_type_vector(uint8_t); |
---|
| 290 | andc_type_vector(int16_t); |
---|
| 291 | andc_type_vector(uint16_t); |
---|
| 292 | andc_type_vector(int32_t); |
---|
| 293 | andc_type_vector(uint32_t); |
---|
| 294 | andc_type_vector(int64_t); |
---|
| 295 | andc_type_vector(uint64_t); |
---|
| 296 | |
---|
| 297 | |
---|
[772] | 298 | /* -------------------------------------------------------------------------- */ |
---|
[822] | 299 | void andc_rgb8vector(rgb8 * X, int32_t ncl, int32_t nch, rgb8 y, rgb8 * Z) |
---|
[772] | 300 | /* -------------------------------------------------------------------------- */ |
---|
| 301 | { |
---|
[822] | 302 | for (int32_t j = ncl; j <= nch; j++) { |
---|
| 303 | RGB8_AND(X[j], y, Z[j]); |
---|
[772] | 304 | } |
---|
| 305 | } |
---|
[822] | 306 | |
---|
[772] | 307 | /* ------------------------------------------------------------------------------ */ |
---|
[822] | 308 | void andc_rgbx8vector(rgbx8 * X, int32_t ncl, int32_t nch, rgbx8 y, rgbx8 * Z) |
---|
[772] | 309 | /* ------------------------------------------------------------------------------ */ |
---|
| 310 | { |
---|
[822] | 311 | for (int32_t j = ncl; j <= nch; j++) { |
---|
| 312 | RGBX8_AND(X[j], y, Z[j]); |
---|
[772] | 313 | } |
---|
| 314 | } |
---|
[822] | 315 | |
---|
| 316 | |
---|
| 317 | // Local Variables: |
---|
| 318 | // tab-width: 4 |
---|
| 319 | // c-basic-offset: 4 |
---|
| 320 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
| 321 | // indent-tabs-mode: nil |
---|
| 322 | // End: |
---|
| 323 | |
---|
| 324 | // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
| 325 | |
---|