| 1 | /* ----------------- */ |
|---|
| 2 | /* --- nrwrap1.c --- */ |
|---|
| 3 | /* ----------------- */ |
|---|
| 4 | |
|---|
| 5 | /* |
|---|
| 6 | * Copyright (c) 2000-2014, Lionel Lacassagne, All rights reserved |
|---|
| 7 | * Univ Paris Sud XI, CNRS |
|---|
| 8 | * Distributed under the Boost Software License, Version 1.0 |
|---|
| 9 | * see accompanying file LICENSE.txt or copy it at |
|---|
| 10 | * http://www.boost.org/LICENSE_1_0.txt |
|---|
| 11 | */ |
|---|
| 12 | |
|---|
| 13 | /* |
|---|
| 14 | * 2002/06/11 ajout des fonctions endline |
|---|
| 15 | */ |
|---|
| 16 | #include <stdio.h> |
|---|
| 17 | #include <stddef.h> |
|---|
| 18 | #include <stdlib.h> |
|---|
| 19 | #include <math.h> // fabs |
|---|
| 20 | |
|---|
| 21 | #include "mypredef.h" |
|---|
| 22 | #include "nrtype.h" |
|---|
| 23 | #include "nrdef.h" |
|---|
| 24 | #include "nrmacro.h" |
|---|
| 25 | #include "nrkernel.h" |
|---|
| 26 | |
|---|
| 27 | #include "nrwrap1.h" |
|---|
| 28 | |
|---|
| 29 | /* --------------- */ |
|---|
| 30 | /* --- Mapping --- */ |
|---|
| 31 | /* --------------- */ |
|---|
| 32 | |
|---|
| 33 | /* -------------------------------------------- */ |
|---|
| 34 | IMAGE_EXPORT(sint8*) si8vector_map(int nl, int nh) |
|---|
| 35 | /* -------------------------------------------- */ |
|---|
| 36 | { |
|---|
| 37 | // nothing to do: no alloc required... |
|---|
| 38 | return NULL; |
|---|
| 39 | } |
|---|
| 40 | /* -------------------------------------------- */ |
|---|
| 41 | IMAGE_EXPORT(uint8*) ui8vector_map(int nl, int nh) |
|---|
| 42 | /* -------------------------------------------- */ |
|---|
| 43 | { |
|---|
| 44 | // nothing to do: no alloc required... |
|---|
| 45 | return NULL; |
|---|
| 46 | } |
|---|
| 47 | /* ---------------------------------------------- */ |
|---|
| 48 | IMAGE_EXPORT(sint16*) si16vector_map(int nl, int nh) |
|---|
| 49 | /* ---------------------------------------------- */ |
|---|
| 50 | { |
|---|
| 51 | // nothing to do: no alloc required... |
|---|
| 52 | return NULL; |
|---|
| 53 | } |
|---|
| 54 | /* ---------------------------------------------- */ |
|---|
| 55 | IMAGE_EXPORT(uint16*) ui16vector_map(int nl, int nh) |
|---|
| 56 | /* ---------------------------------------------- */ |
|---|
| 57 | { |
|---|
| 58 | // nothing to do: no alloc required... |
|---|
| 59 | return NULL; |
|---|
| 60 | } |
|---|
| 61 | /* ---------------------------------------------- */ |
|---|
| 62 | IMAGE_EXPORT(sint32*) si32vector_map(int nl, int nh) |
|---|
| 63 | /* ---------------------------------------------- */ |
|---|
| 64 | { |
|---|
| 65 | // nothing to do: no alloc required... |
|---|
| 66 | return NULL; |
|---|
| 67 | } |
|---|
| 68 | /* ---------------------------------------------- */ |
|---|
| 69 | IMAGE_EXPORT(uint32*) ui32vector_map(int nl, int nh) |
|---|
| 70 | /* ---------------------------------------------- */ |
|---|
| 71 | { |
|---|
| 72 | // nothing to do: no alloc required... |
|---|
| 73 | return NULL; |
|---|
| 74 | } |
|---|
| 75 | /* ---------------------------------------------- */ |
|---|
| 76 | IMAGE_EXPORT(float32*) f32vector_map(int nl, int nh) |
|---|
| 77 | /* ---------------------------------------------- */ |
|---|
| 78 | { |
|---|
| 79 | // nothing to do: no alloc required... |
|---|
| 80 | return NULL; |
|---|
| 81 | } |
|---|
| 82 | /* ---------------------------------------------- */ |
|---|
| 83 | IMAGE_EXPORT(float64*) f64vector_map(int nl, int nh) |
|---|
| 84 | /* ---------------------------------------------- */ |
|---|
| 85 | { |
|---|
| 86 | // nothing to do: no alloc required... |
|---|
| 87 | return NULL; |
|---|
| 88 | } |
|---|
| 89 | /* -------------------------------------------- */ |
|---|
| 90 | IMAGE_EXPORT(rgb8*) rgb8vector_map(int nl, int nh) |
|---|
| 91 | /* -------------------------------------------- */ |
|---|
| 92 | { |
|---|
| 93 | // nothing to do: no alloc required... |
|---|
| 94 | return NULL; |
|---|
| 95 | } |
|---|
| 96 | /* ---------------------------------------------- */ |
|---|
| 97 | IMAGE_EXPORT(rgbx8*) rgbx8vector_map(int nl, int nh) |
|---|
| 98 | /* ---------------------------------------------- */ |
|---|
| 99 | { |
|---|
| 100 | // nothing to do: no alloc required... |
|---|
| 101 | return NULL; |
|---|
| 102 | } |
|---|
| 103 | /* ------------------ */ |
|---|
| 104 | /* --- Mapping 1D --- */ |
|---|
| 105 | /* ------------------ */ |
|---|
| 106 | /* ----------------------------------------------------------------------------------------- */ |
|---|
| 107 | IMAGE_EXPORT(sint8*) si8vector_map_1D_pitch(sint8 *v, int nl, int nh, void *data_1D, int pitch) |
|---|
| 108 | /* ----------------------------------------------------------------------------------------- */ |
|---|
| 109 | { |
|---|
| 110 | v = (sint8*) data_1D; |
|---|
| 111 | v -= nl; |
|---|
| 112 | return v; |
|---|
| 113 | } |
|---|
| 114 | /* ----------------------------------------------------------------------------------------- */ |
|---|
| 115 | IMAGE_EXPORT(uint8*) ui8vector_map_1D_pitch(uint8 *v, int nl, int nh, void *data_1D, int pitch) |
|---|
| 116 | /* ----------------------------------------------------------------------------------------- */ |
|---|
| 117 | { |
|---|
| 118 | v = (uint8*) data_1D; |
|---|
| 119 | v -= nl; |
|---|
| 120 | return v; |
|---|
| 121 | } |
|---|
| 122 | /* -------------------------------------------------------------------------------------------- */ |
|---|
| 123 | IMAGE_EXPORT(uint16*) ui16vector_map_1D_pitch(uint16 *v, int nl, int nh, void *data_1D, int pitch) |
|---|
| 124 | /* -------------------------------------------------------------------------------------------- */ |
|---|
| 125 | { |
|---|
| 126 | v = (uint16*) data_1D; |
|---|
| 127 | v -= nl; |
|---|
| 128 | return v; |
|---|
| 129 | } |
|---|
| 130 | /* -------------------------------------------------------------------------------------------- */ |
|---|
| 131 | IMAGE_EXPORT(sint16*) si16vector_map_1D_pitch(sint16 *v, int nl, int nh, void *data_1D, int pitch) |
|---|
| 132 | /* -------------------------------------------------------------------------------------------- */ |
|---|
| 133 | { |
|---|
| 134 | v = (sint16*) data_1D; |
|---|
| 135 | v -= nl; |
|---|
| 136 | return v; |
|---|
| 137 | } |
|---|
| 138 | /* -------------------------------------------------------------------------------------------- */ |
|---|
| 139 | IMAGE_EXPORT(uint32*) ui32vector_map_1D_pitch(uint32 *v, int nl, int nh, void *data_1D, int pitch) |
|---|
| 140 | /* -------------------------------------------------------------------------------------------- */ |
|---|
| 141 | { |
|---|
| 142 | v = (uint32*) data_1D; |
|---|
| 143 | v -= nl; |
|---|
| 144 | return v; |
|---|
| 145 | } |
|---|
| 146 | /* -------------------------------------------------------------------------------------------- */ |
|---|
| 147 | IMAGE_EXPORT(sint32*) si32vector_map_1D_pitch(sint32 *v, int nl, int nh, void *data_1D, int pitch) |
|---|
| 148 | /* -------------------------------------------------------------------------------------------- */ |
|---|
| 149 | { |
|---|
| 150 | v = (sint32*) data_1D; |
|---|
| 151 | v -= nl; |
|---|
| 152 | return v; |
|---|
| 153 | } |
|---|
| 154 | /* --------------------------------------------------------------------------------------------- */ |
|---|
| 155 | IMAGE_EXPORT(float32*) f32vector_map_1D_pitch(float32 *v, int nl, int nh, void *data_1D, int pitch) |
|---|
| 156 | /* --------------------------------------------------------------------------------------------- */ |
|---|
| 157 | { |
|---|
| 158 | v = (float32*) data_1D; |
|---|
| 159 | v -= nl; |
|---|
| 160 | return v; |
|---|
| 161 | } |
|---|
| 162 | /* --------------------------------------------------------------------------------------------- */ |
|---|
| 163 | IMAGE_EXPORT(float64*) f64vector_map_1D_pitch(float64 *v, int nl, int nh, void *data_1D, int pitch) |
|---|
| 164 | /* --------------------------------------------------------------------------------------------- */ |
|---|
| 165 | { |
|---|
| 166 | v = (float64*) data_1D; |
|---|
| 167 | v -= nl; |
|---|
| 168 | return v; |
|---|
| 169 | } |
|---|
| 170 | /* ---------------------------------------------------------------------------------------- */ |
|---|
| 171 | IMAGE_EXPORT(rgb8*) rgb8vector_map_1D_pitch(rgb8 *v, int nl, int nh, void *data_1D, int pitch) |
|---|
| 172 | /* ---------------------------------------------------------------------------------------- */ |
|---|
| 173 | { |
|---|
| 174 | v = (rgb8*) data_1D; |
|---|
| 175 | v -= nl; |
|---|
| 176 | return v; |
|---|
| 177 | } |
|---|
| 178 | /* ------------------------------------------------------------------------------------------- */ |
|---|
| 179 | IMAGE_EXPORT(rgbx8*) rgbx8vector_map_1D_pitch(rgbx8 *v, int nl, int nh, void *data_1D, int pitch) |
|---|
| 180 | /* ------------------------------------------------------------------------------------------- */ |
|---|
| 181 | { |
|---|
| 182 | v = (rgbx8*) data_1D; |
|---|
| 183 | v -= nl; |
|---|
| 184 | return v; |
|---|
| 185 | } |
|---|
| 186 | |
|---|