| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1 | /* |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 2 | * Copyright (C) 2013 The Android Open Source Project |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ANDROID_RSCPPSTRUCTS_H |
| 18 | #define ANDROID_RSCPPSTRUCTS_H |
| 19 | |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 20 | #include "rsDefines.h" |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 21 | #include "util/RefBase.h" |
| Tim Murray | a423096 | 2013-07-17 16:50:10 -0700 | [diff] [blame] | 22 | |
| Tim Murray | 8c24cd6 | 2014-04-10 18:04:39 -0700 | [diff] [blame] | 23 | #include <pthread.h> |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 24 | |
| Miao Wang | 09d2dd2 | 2015-03-18 20:09:20 -0700 | [diff] [blame] | 25 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 26 | /** |
| 27 | * Every row in an RS allocation is guaranteed to be aligned by this amount, and |
| 28 | * every row in a user-backed allocation must be aligned by this amount. |
| 29 | */ |
| Tim Murray | 96267c2 | 2013-02-12 11:25:12 -0800 | [diff] [blame] | 30 | #define RS_CPU_ALLOCATION_ALIGNMENT 16 |
| 31 | |
| Jason Sams | 66f0a16 | 2014-11-11 13:46:38 -0800 | [diff] [blame] | 32 | struct dispatchTable; |
| 33 | |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 34 | namespace android { |
| Miao Wang | 09d2dd2 | 2015-03-18 20:09:20 -0700 | [diff] [blame] | 35 | class Surface; |
| 36 | |
| Tim Murray | 9eb7f4b | 2012-11-16 14:02:18 -0800 | [diff] [blame] | 37 | namespace RSC { |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 38 | |
| Jason Sams | 66f0a16 | 2014-11-11 13:46:38 -0800 | [diff] [blame] | 39 | |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 40 | typedef void (*ErrorHandlerFunc_t)(uint32_t errorNum, const char *errorText); |
| 41 | typedef void (*MessageHandlerFunc_t)(uint32_t msgNum, const void *msgData, size_t msgLen); |
| 42 | |
| 43 | class RS; |
| 44 | class BaseObj; |
| 45 | class Element; |
| 46 | class Type; |
| 47 | class Allocation; |
| 48 | class Script; |
| 49 | class ScriptC; |
| Tim Murray | 729b6fe | 2013-07-23 16:20:42 -0700 | [diff] [blame] | 50 | class Sampler; |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 51 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 52 | /** |
| 53 | * Possible error codes used by RenderScript. Once a status other than RS_SUCCESS |
| 54 | * is returned, the RenderScript context is considered dead and cannot perform any |
| 55 | * additional work. |
| 56 | */ |
| Tim Murray | 21fa7a0 | 2013-08-15 16:25:03 -0700 | [diff] [blame] | 57 | enum RSError { |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 58 | RS_SUCCESS = 0, ///< No error |
| 59 | RS_ERROR_INVALID_PARAMETER = 1, ///< An invalid parameter was passed to a function |
| 60 | RS_ERROR_RUNTIME_ERROR = 2, ///< The RenderScript driver returned an error; this is |
| 61 | ///< often indicative of a kernel that crashed |
| 62 | RS_ERROR_INVALID_ELEMENT = 3, ///< An invalid Element was passed to a function |
| Tim Murray | 21fa7a0 | 2013-08-15 16:25:03 -0700 | [diff] [blame] | 63 | RS_ERROR_MAX = 9999 |
| 64 | |
| 65 | }; |
| 66 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 67 | /** |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 68 | * Flags that can control RenderScript behavior on a per-context level. |
| 69 | */ |
| Tim Murray | 84e3dea | 2013-09-09 16:12:51 -0700 | [diff] [blame] | 70 | enum RSInitFlags { |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 71 | RS_INIT_SYNCHRONOUS = 1, ///< All RenderScript calls will be synchronous. May reduce latency. |
| 72 | RS_INIT_LOW_LATENCY = 2, ///< Prefer low latency devices over potentially higher throughput devices. |
| Stephen McGroarty | d5164d5 | 2015-05-08 15:31:49 +0100 | [diff] [blame] | 73 | // Bitflag 4 is reserved for the context flag low power |
| 74 | RS_INIT_WAIT_FOR_ATTACH = 8, ///< Kernel execution will hold to give time for a debugger to be attached |
| verena beckham | f502980 | 2015-05-22 16:51:42 +0100 | [diff] [blame] | 75 | RS_INIT_OPT_LEVEL_0 = 16, ///< Use the -O0 option to set the optimization level to zero when calling the bcc compiler. |
| 76 | RS_INIT_MAX = 32 |
| Tim Murray | 84e3dea | 2013-09-09 16:12:51 -0700 | [diff] [blame] | 77 | }; |
| 78 | |
| Miao Wang | 49b1226 | 2015-09-04 11:48:16 -0700 | [diff] [blame] | 79 | |
| 80 | class Byte2 { |
| 81 | public: |
| 82 | int8_t x, y; |
| 83 | |
| 84 | Byte2(int8_t initX, int8_t initY) |
| 85 | : x(initX), y(initY) {} |
| 86 | Byte2() : x(0), y(0) {} |
| 87 | }; |
| 88 | |
| 89 | class Byte3 { |
| 90 | public: |
| 91 | int8_t x, y, z; |
| 92 | |
| 93 | Byte3(int8_t initX, int8_t initY, int8_t initZ) |
| 94 | : x(initX), y(initY), z(initZ) {} |
| 95 | Byte3() : x(0), y(0), z(0) {} |
| 96 | }; |
| 97 | |
| 98 | class Byte4 { |
| 99 | public: |
| 100 | int8_t x, y, z, w; |
| 101 | |
| 102 | Byte4(int8_t initX, int8_t initY, int8_t initZ, int8_t initW) |
| 103 | : x(initX), y(initY), z(initZ), w(initW) {} |
| 104 | Byte4() : x(0), y(0), z(0), w(0) {} |
| 105 | }; |
| 106 | |
| 107 | class UByte2 { |
| 108 | public: |
| 109 | uint8_t x, y; |
| 110 | |
| 111 | UByte2(uint8_t initX, uint8_t initY) |
| 112 | : x(initX), y(initY) {} |
| 113 | UByte2() : x(0), y(0) {} |
| 114 | }; |
| 115 | |
| 116 | class UByte3 { |
| 117 | public: |
| 118 | uint8_t x, y, z; |
| 119 | |
| 120 | UByte3(uint8_t initX, uint8_t initY, uint8_t initZ) |
| 121 | : x(initX), y(initY), z(initZ) {} |
| 122 | UByte3() : x(0), y(0), z(0) {} |
| 123 | }; |
| 124 | |
| 125 | class UByte4 { |
| 126 | public: |
| 127 | uint8_t x, y, z, w; |
| 128 | |
| 129 | UByte4(uint8_t initX, uint8_t initY, uint8_t initZ, uint8_t initW) |
| 130 | : x(initX), y(initY), z(initZ), w(initW) {} |
| 131 | UByte4() : x(0), y(0), z(0), w(0) {} |
| 132 | }; |
| 133 | |
| 134 | class Short2 { |
| 135 | public: |
| 136 | short x, y; |
| 137 | |
| 138 | Short2(short initX, short initY) |
| 139 | : x(initX), y(initY) {} |
| 140 | Short2() : x(0), y(0) {} |
| 141 | }; |
| 142 | |
| 143 | class Short3 { |
| 144 | public: |
| 145 | short x, y, z; |
| 146 | |
| 147 | Short3(short initX, short initY, short initZ) |
| 148 | : x(initX), y(initY), z(initZ) {} |
| 149 | Short3() : x(0), y(0), z(0) {} |
| 150 | }; |
| 151 | |
| 152 | class Short4 { |
| 153 | public: |
| 154 | short x, y, z, w; |
| 155 | |
| 156 | Short4(short initX, short initY, short initZ, short initW) |
| 157 | : x(initX), y(initY), z(initZ), w(initW) {} |
| 158 | Short4() : x(0), y(0), z(0), w(0) {} |
| 159 | }; |
| 160 | |
| 161 | class UShort2 { |
| 162 | public: |
| 163 | uint16_t x, y; |
| 164 | |
| 165 | UShort2(uint16_t initX, uint16_t initY) |
| 166 | : x(initX), y(initY) {} |
| 167 | UShort2() : x(0), y(0) {} |
| 168 | }; |
| 169 | |
| 170 | class UShort3 { |
| 171 | public: |
| 172 | uint16_t x, y, z; |
| 173 | |
| 174 | UShort3(uint16_t initX, uint16_t initY, uint16_t initZ) |
| 175 | : x(initX), y(initY), z(initZ) {} |
| 176 | UShort3() : x(0), y(0), z(0) {} |
| 177 | }; |
| 178 | |
| 179 | class UShort4 { |
| 180 | public: |
| 181 | uint16_t x, y, z, w; |
| 182 | |
| 183 | UShort4(uint16_t initX, uint16_t initY, uint16_t initZ, uint16_t initW) |
| 184 | : x(initX), y(initY), z(initZ), w(initW) {} |
| 185 | UShort4() : x(0), y(0), z(0), w(0) {} |
| 186 | }; |
| 187 | |
| 188 | class Int2 { |
| 189 | public: |
| 190 | int x, y; |
| 191 | |
| 192 | Int2(int initX, int initY) |
| 193 | : x(initX), y(initY) {} |
| 194 | Int2() : x(0), y(0) {} |
| 195 | }; |
| 196 | |
| 197 | class Int3 { |
| 198 | public: |
| 199 | int x, y, z; |
| 200 | |
| 201 | Int3(int initX, int initY, int initZ) |
| 202 | : x(initX), y(initY), z(initZ) {} |
| 203 | Int3() : x(0), y(0), z(0) {} |
| 204 | }; |
| 205 | |
| 206 | class Int4 { |
| 207 | public: |
| 208 | int x, y, z, w; |
| 209 | |
| 210 | Int4(int initX, int initY, int initZ, int initW) |
| 211 | : x(initX), y(initY), z(initZ), w(initW) {} |
| 212 | Int4() : x(0), y(0), z(0), w(0) {} |
| 213 | }; |
| 214 | |
| 215 | class UInt2 { |
| 216 | public: |
| 217 | uint32_t x, y; |
| 218 | |
| 219 | UInt2(uint32_t initX, uint32_t initY) |
| 220 | : x(initX), y(initY) {} |
| 221 | UInt2() : x(0), y(0) {} |
| 222 | }; |
| 223 | |
| 224 | class UInt3 { |
| 225 | public: |
| 226 | uint32_t x, y, z; |
| 227 | |
| 228 | UInt3(uint32_t initX, uint32_t initY, uint32_t initZ) |
| 229 | : x(initX), y(initY), z(initZ) {} |
| 230 | UInt3() : x(0), y(0), z(0) {} |
| 231 | }; |
| 232 | |
| 233 | class UInt4 { |
| 234 | public: |
| 235 | uint32_t x, y, z, w; |
| 236 | |
| 237 | UInt4(uint32_t initX, uint32_t initY, uint32_t initZ, uint32_t initW) |
| 238 | : x(initX), y(initY), z(initZ), w(initW) {} |
| 239 | UInt4() : x(0), y(0), z(0), w(0) {} |
| 240 | }; |
| 241 | |
| 242 | class Long2 { |
| 243 | public: |
| 244 | int64_t x, y; |
| 245 | |
| 246 | Long2(int64_t initX, int64_t initY) |
| 247 | : x(initX), y(initY) {} |
| 248 | Long2() : x(0), y(0) {} |
| 249 | }; |
| 250 | |
| 251 | class Long3 { |
| 252 | public: |
| 253 | int64_t x, y, z; |
| 254 | |
| 255 | Long3(int64_t initX, int64_t initY, int64_t initZ) |
| 256 | : x(initX), y(initY), z(initZ) {} |
| 257 | Long3() : x(0), y(0), z(0) {} |
| 258 | }; |
| 259 | |
| 260 | class Long4 { |
| 261 | public: |
| 262 | int64_t x, y, z, w; |
| 263 | |
| 264 | Long4(int64_t initX, int64_t initY, int64_t initZ, int64_t initW) |
| 265 | : x(initX), y(initY), z(initZ), w(initW) {} |
| 266 | Long4() : x(0), y(0), z(0), w(0) {} |
| 267 | }; |
| 268 | |
| 269 | class ULong2 { |
| 270 | public: |
| 271 | uint64_t x, y; |
| 272 | |
| 273 | ULong2(uint64_t initX, uint64_t initY) |
| 274 | : x(initX), y(initY) {} |
| 275 | ULong2() : x(0), y(0) {} |
| 276 | }; |
| 277 | |
| 278 | class ULong3 { |
| 279 | public: |
| 280 | uint64_t x, y, z; |
| 281 | |
| 282 | ULong3(uint64_t initX, uint64_t initY, uint64_t initZ) |
| 283 | : x(initX), y(initY), z(initZ) {} |
| 284 | ULong3() : x(0), y(0), z(0) {} |
| 285 | }; |
| 286 | |
| 287 | class ULong4 { |
| 288 | public: |
| 289 | uint64_t x, y, z, w; |
| 290 | |
| 291 | ULong4(uint64_t initX, uint64_t initY, uint64_t initZ, uint64_t initW) |
| 292 | : x(initX), y(initY), z(initZ), w(initW) {} |
| 293 | ULong4() : x(0), y(0), z(0), w(0) {} |
| 294 | }; |
| 295 | |
| 296 | class Float2 { |
| 297 | public: |
| 298 | float x, y; |
| 299 | |
| 300 | Float2(float initX, float initY) |
| 301 | : x(initX), y(initY) {} |
| 302 | Float2() : x(0), y(0) {} |
| 303 | }; |
| 304 | |
| 305 | class Float3 { |
| 306 | public: |
| 307 | float x, y, z; |
| 308 | |
| 309 | Float3(float initX, float initY, float initZ) |
| 310 | : x(initX), y(initY), z(initZ) {} |
| 311 | Float3() : x(0.f), y(0.f), z(0.f) {} |
| 312 | }; |
| 313 | |
| 314 | class Float4 { |
| 315 | public: |
| 316 | float x, y, z, w; |
| 317 | |
| 318 | Float4(float initX, float initY, float initZ, float initW) |
| 319 | : x(initX), y(initY), z(initZ), w(initW) {} |
| 320 | Float4() : x(0.f), y(0.f), z(0.f), w(0.f) {} |
| 321 | }; |
| 322 | |
| 323 | class Double2 { |
| 324 | public: |
| 325 | double x, y; |
| 326 | |
| 327 | Double2(double initX, double initY) |
| 328 | : x(initX), y(initY) {} |
| 329 | Double2() : x(0), y(0) {} |
| 330 | }; |
| 331 | |
| 332 | class Double3 { |
| 333 | public: |
| 334 | double x, y, z; |
| 335 | |
| 336 | Double3(double initX, double initY, double initZ) |
| 337 | : x(initX), y(initY), z(initZ) {} |
| 338 | Double3() : x(0), y(0), z(0) {} |
| 339 | }; |
| 340 | |
| 341 | class Double4 { |
| 342 | public: |
| 343 | double x, y, z, w; |
| 344 | |
| 345 | Double4(double initX, double initY, double initZ, double initW) |
| 346 | : x(initX), y(initY), z(initZ), w(initW) {} |
| 347 | Double4() : x(0), y(0), z(0), w(0) {} |
| 348 | }; |
| 349 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 350 | /** |
| 351 | * The RenderScript context. This class controls initialization, resource management, and teardown. |
| 352 | */ |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 353 | class RS : public android::RSC::LightRefBase<RS> { |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 354 | |
| 355 | public: |
| 356 | RS(); |
| 357 | virtual ~RS(); |
| 358 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 359 | /** |
| 360 | * Initializes a RenderScript context. A context must be initialized before it can be used. |
| Tim Murray | caf4126 | 2013-12-13 12:54:37 -0800 | [diff] [blame] | 361 | * @param[in] name Directory name to be used by this context. This should be equivalent to |
| 362 | * Context.getCacheDir(). |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 363 | * @param[in] flags Optional flags for this context. |
| 364 | * @return true on success |
| 365 | */ |
| Miao Wang | fda5596 | 2016-01-12 09:14:21 +0800 | [diff] [blame^] | 366 | bool init(const char * name, uint32_t flags = 0); |
| 367 | |
| 368 | /** |
| 369 | * Initializes a RenderScript context. A context must be initialized before it can be used. |
| 370 | * @param[in] name Directory name to be used by this context. This should be equivalent to |
| 371 | * Context.getCacheDir(). |
| 372 | * @param[in] flags Flags for this context. |
| 373 | * @param[in] targetApi Target RS API level. |
| 374 | * @return true on success |
| 375 | */ |
| 376 | bool init(const char * name, uint32_t flags, int targetApi); |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 377 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 378 | /** |
| 379 | * Sets the error handler function for this context. This error handler is |
| 380 | * called whenever an error is set. |
| 381 | * |
| 382 | * @param[in] func Error handler function |
| 383 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 384 | void setErrorHandler(ErrorHandlerFunc_t func); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 385 | |
| 386 | /** |
| 387 | * Returns the current error handler function for this context. |
| 388 | * |
| 389 | * @return pointer to current error handler function or NULL if not set |
| 390 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 391 | ErrorHandlerFunc_t getErrorHandler() { return mErrorFunc; } |
| 392 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 393 | /** |
| 394 | * Sets the message handler function for this context. This message handler |
| 395 | * is called whenever a message is sent from a RenderScript kernel. |
| 396 | * |
| 397 | * @param[in] func Message handler function |
| 398 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 399 | void setMessageHandler(MessageHandlerFunc_t func); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 400 | |
| 401 | /** |
| 402 | * Returns the current message handler function for this context. |
| 403 | * |
| 404 | * @return pointer to current message handler function or NULL if not set |
| 405 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 406 | MessageHandlerFunc_t getMessageHandler() { return mMessageFunc; } |
| 407 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 408 | /** |
| 409 | * Returns current status for the context. |
| 410 | * |
| 411 | * @return current error |
| 412 | */ |
| Tim Murray | 10913a5 | 2013-08-20 17:19:47 -0700 | [diff] [blame] | 413 | RSError getError(); |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 414 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 415 | /** |
| 416 | * Waits for any currently running asynchronous operations to finish. This |
| 417 | * should only be used for performance testing and timing. |
| 418 | */ |
| Tim Murray | baca6c3 | 2012-11-14 16:51:46 -0800 | [diff] [blame] | 419 | void finish(); |
| 420 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 421 | RsContext getContext() { return mContext; } |
| 422 | void throwError(RSError error, const char *errMsg); |
| 423 | |
| Tim Murray | a423096 | 2013-07-17 16:50:10 -0700 | [diff] [blame] | 424 | static dispatchTable* dispatch; |
| 425 | |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 426 | private: |
| Tim Murray | 4a92d12 | 2013-07-22 10:56:18 -0700 | [diff] [blame] | 427 | static bool usingNative; |
| Tim Murray | a423096 | 2013-07-17 16:50:10 -0700 | [diff] [blame] | 428 | static bool initDispatch(int targetApi); |
| 429 | |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 430 | static void * threadProc(void *); |
| 431 | |
| 432 | static bool gInitialized; |
| 433 | static pthread_mutex_t gInitMutex; |
| 434 | |
| 435 | pthread_t mMessageThreadId; |
| 436 | pid_t mNativeMessageThreadId; |
| 437 | bool mMessageRun; |
| 438 | |
| 439 | RsDevice mDev; |
| 440 | RsContext mContext; |
| Tim Murray | 21fa7a0 | 2013-08-15 16:25:03 -0700 | [diff] [blame] | 441 | RSError mCurrentError; |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 442 | |
| 443 | ErrorHandlerFunc_t mErrorFunc; |
| 444 | MessageHandlerFunc_t mMessageFunc; |
| Tim Murray | a423096 | 2013-07-17 16:50:10 -0700 | [diff] [blame] | 445 | bool mInit; |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 446 | |
| Miao Wang | bc10dff | 2015-04-03 17:44:55 -0700 | [diff] [blame] | 447 | char mCacheDir[PATH_MAX+1]; |
| 448 | uint32_t mCacheDirLen; |
| Tim Murray | caf4126 | 2013-12-13 12:54:37 -0800 | [diff] [blame] | 449 | |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 450 | struct { |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 451 | sp<const Element> U8; |
| Tim Murray | eb4426d | 2013-08-27 15:30:16 -0700 | [diff] [blame] | 452 | sp<const Element> U8_2; |
| 453 | sp<const Element> U8_3; |
| 454 | sp<const Element> U8_4; |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 455 | sp<const Element> I8; |
| Tim Murray | eb4426d | 2013-08-27 15:30:16 -0700 | [diff] [blame] | 456 | sp<const Element> I8_2; |
| 457 | sp<const Element> I8_3; |
| 458 | sp<const Element> I8_4; |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 459 | sp<const Element> U16; |
| Tim Murray | eb4426d | 2013-08-27 15:30:16 -0700 | [diff] [blame] | 460 | sp<const Element> U16_2; |
| 461 | sp<const Element> U16_3; |
| 462 | sp<const Element> U16_4; |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 463 | sp<const Element> I16; |
| Tim Murray | eb4426d | 2013-08-27 15:30:16 -0700 | [diff] [blame] | 464 | sp<const Element> I16_2; |
| 465 | sp<const Element> I16_3; |
| 466 | sp<const Element> I16_4; |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 467 | sp<const Element> U32; |
| Tim Murray | eb4426d | 2013-08-27 15:30:16 -0700 | [diff] [blame] | 468 | sp<const Element> U32_2; |
| 469 | sp<const Element> U32_3; |
| 470 | sp<const Element> U32_4; |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 471 | sp<const Element> I32; |
| Tim Murray | eb4426d | 2013-08-27 15:30:16 -0700 | [diff] [blame] | 472 | sp<const Element> I32_2; |
| 473 | sp<const Element> I32_3; |
| 474 | sp<const Element> I32_4; |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 475 | sp<const Element> U64; |
| Tim Murray | eb4426d | 2013-08-27 15:30:16 -0700 | [diff] [blame] | 476 | sp<const Element> U64_2; |
| 477 | sp<const Element> U64_3; |
| 478 | sp<const Element> U64_4; |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 479 | sp<const Element> I64; |
| Tim Murray | eb4426d | 2013-08-27 15:30:16 -0700 | [diff] [blame] | 480 | sp<const Element> I64_2; |
| 481 | sp<const Element> I64_3; |
| 482 | sp<const Element> I64_4; |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 483 | sp<const Element> F32; |
| Tim Murray | eb4426d | 2013-08-27 15:30:16 -0700 | [diff] [blame] | 484 | sp<const Element> F32_2; |
| 485 | sp<const Element> F32_3; |
| 486 | sp<const Element> F32_4; |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 487 | sp<const Element> F64; |
| Tim Murray | eb4426d | 2013-08-27 15:30:16 -0700 | [diff] [blame] | 488 | sp<const Element> F64_2; |
| 489 | sp<const Element> F64_3; |
| 490 | sp<const Element> F64_4; |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 491 | sp<const Element> BOOLEAN; |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 492 | |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 493 | sp<const Element> ELEMENT; |
| 494 | sp<const Element> TYPE; |
| 495 | sp<const Element> ALLOCATION; |
| 496 | sp<const Element> SAMPLER; |
| 497 | sp<const Element> SCRIPT; |
| 498 | sp<const Element> MESH; |
| 499 | sp<const Element> PROGRAM_FRAGMENT; |
| 500 | sp<const Element> PROGRAM_VERTEX; |
| 501 | sp<const Element> PROGRAM_RASTER; |
| 502 | sp<const Element> PROGRAM_STORE; |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 503 | |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 504 | sp<const Element> A_8; |
| 505 | sp<const Element> RGB_565; |
| 506 | sp<const Element> RGB_888; |
| 507 | sp<const Element> RGBA_5551; |
| 508 | sp<const Element> RGBA_4444; |
| 509 | sp<const Element> RGBA_8888; |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 510 | |
| Tim Murray | eb4426d | 2013-08-27 15:30:16 -0700 | [diff] [blame] | 511 | sp<const Element> YUV; |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 512 | |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 513 | sp<const Element> MATRIX_4X4; |
| 514 | sp<const Element> MATRIX_3X3; |
| 515 | sp<const Element> MATRIX_2X2; |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 516 | } mElements; |
| 517 | |
| Tim Murray | 729b6fe | 2013-07-23 16:20:42 -0700 | [diff] [blame] | 518 | struct { |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 519 | sp<const Sampler> CLAMP_NEAREST; |
| 520 | sp<const Sampler> CLAMP_LINEAR; |
| 521 | sp<const Sampler> CLAMP_LINEAR_MIP_LINEAR; |
| 522 | sp<const Sampler> WRAP_NEAREST; |
| 523 | sp<const Sampler> WRAP_LINEAR; |
| 524 | sp<const Sampler> WRAP_LINEAR_MIP_LINEAR; |
| 525 | sp<const Sampler> MIRRORED_REPEAT_NEAREST; |
| 526 | sp<const Sampler> MIRRORED_REPEAT_LINEAR; |
| 527 | sp<const Sampler> MIRRORED_REPEAT_LINEAR_MIP_LINEAR; |
| Tim Murray | 729b6fe | 2013-07-23 16:20:42 -0700 | [diff] [blame] | 528 | } mSamplers; |
| 529 | friend class Sampler; |
| 530 | friend class Element; |
| Tim Murray | caf4126 | 2013-12-13 12:54:37 -0800 | [diff] [blame] | 531 | friend class ScriptC; |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 532 | }; |
| 533 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 534 | /** |
| 535 | * Base class for all RenderScript objects. Not for direct use by developers. |
| 536 | */ |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 537 | class BaseObj : public android::RSC::LightRefBase<BaseObj> { |
| 538 | public: |
| 539 | void * getID() const; |
| 540 | virtual ~BaseObj(); |
| 541 | virtual void updateFromNative(); |
| 542 | virtual bool equals(sp<const BaseObj> obj); |
| 543 | |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 544 | protected: |
| 545 | void *mID; |
| Tim Murray | 3560907 | 2013-12-03 11:36:03 -0800 | [diff] [blame] | 546 | RS* mRS; |
| Miao Wang | bc10dff | 2015-04-03 17:44:55 -0700 | [diff] [blame] | 547 | const char * mName; |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 548 | |
| 549 | BaseObj(void *id, sp<RS> rs); |
| 550 | void checkValid(); |
| 551 | |
| 552 | static void * getObjID(sp<const BaseObj> o); |
| 553 | |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 554 | }; |
| 555 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 556 | /** |
| 557 | * This class provides the primary method through which data is passed to and |
| 558 | * from RenderScript kernels. An Allocation provides the backing store for a |
| 559 | * given Type. |
| 560 | * |
| 561 | * An Allocation also contains a set of usage flags that denote how the |
| 562 | * Allocation could be used. For example, an Allocation may have usage flags |
| 563 | * specifying that it can be used from a script as well as input to a |
| 564 | * Sampler. A developer must synchronize across these different usages using |
| 565 | * syncAll(int) in order to ensure that different users of the Allocation have |
| 566 | * a consistent view of memory. For example, in the case where an Allocation is |
| 567 | * used as the output of one kernel and as Sampler input in a later kernel, a |
| 568 | * developer must call syncAll(RS_ALLOCATION_USAGE_SCRIPT) prior to launching the |
| 569 | * second kernel to ensure correctness. |
| 570 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 571 | class Allocation : public BaseObj { |
| 572 | protected: |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 573 | sp<const Type> mType; |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 574 | uint32_t mUsage; |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 575 | sp<Allocation> mAdaptedAllocation; |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 576 | |
| 577 | bool mConstrainedLOD; |
| 578 | bool mConstrainedFace; |
| 579 | bool mConstrainedY; |
| 580 | bool mConstrainedZ; |
| 581 | bool mReadAllowed; |
| 582 | bool mWriteAllowed; |
| Miao Wang | e5428e6 | 2015-03-10 15:29:40 -0700 | [diff] [blame] | 583 | bool mAutoPadding; |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 584 | uint32_t mSelectedY; |
| 585 | uint32_t mSelectedZ; |
| 586 | uint32_t mSelectedLOD; |
| 587 | RsAllocationCubemapFace mSelectedFace; |
| 588 | |
| 589 | uint32_t mCurrentDimX; |
| 590 | uint32_t mCurrentDimY; |
| 591 | uint32_t mCurrentDimZ; |
| 592 | uint32_t mCurrentCount; |
| 593 | |
| 594 | void * getIDSafe() const; |
| 595 | void updateCacheInfo(sp<const Type> t); |
| 596 | |
| 597 | Allocation(void *id, sp<RS> rs, sp<const Type> t, uint32_t usage); |
| 598 | |
| Miao Wang | e5428e6 | 2015-03-10 15:29:40 -0700 | [diff] [blame] | 599 | void validateIsInt64(); |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 600 | void validateIsInt32(); |
| 601 | void validateIsInt16(); |
| 602 | void validateIsInt8(); |
| 603 | void validateIsFloat32(); |
| Miao Wang | e5428e6 | 2015-03-10 15:29:40 -0700 | [diff] [blame] | 604 | void validateIsFloat64(); |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 605 | void validateIsObject(); |
| 606 | |
| 607 | virtual void updateFromNative(); |
| 608 | |
| 609 | void validate2DRange(uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h); |
| Tim Murray | 9d24ae6 | 2013-08-30 12:17:14 -0700 | [diff] [blame] | 610 | void validate3DRange(uint32_t xoff, uint32_t yoff, uint32_t zoff, |
| 611 | uint32_t w, uint32_t h, uint32_t d); |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 612 | |
| 613 | public: |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 614 | |
| 615 | /** |
| 616 | * Return Type for the allocation. |
| 617 | * @return pointer to underlying Type |
| 618 | */ |
| Stephen Hines | a180b7d | 2013-08-21 12:42:13 -0700 | [diff] [blame] | 619 | sp<const Type> getType() const { |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 620 | return mType; |
| 621 | } |
| 622 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 623 | /** |
| Miao Wang | e5428e6 | 2015-03-10 15:29:40 -0700 | [diff] [blame] | 624 | * Enable/Disable AutoPadding for Vec3 elements. |
| 625 | * |
| 626 | * @param useAutoPadding True: enable AutoPadding; flase: disable AutoPadding |
| 627 | * |
| 628 | */ |
| 629 | void setAutoPadding(bool useAutoPadding) { |
| 630 | mAutoPadding = useAutoPadding; |
| 631 | } |
| 632 | |
| 633 | /** |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 634 | * Propagate changes from one usage of the Allocation to other usages of the Allocation. |
| 635 | * @param[in] srcLocation source location with changes to propagate elsewhere |
| 636 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 637 | void syncAll(RsAllocationUsageType srcLocation); |
| Miao Wang | 09d2dd2 | 2015-03-18 20:09:20 -0700 | [diff] [blame] | 638 | |
| 639 | /** |
| 640 | * Send a buffer to the output stream. The contents of the Allocation will |
| 641 | * be undefined after this operation. This operation is only valid if |
| 642 | * USAGE_IO_OUTPUT is set on the Allocation. |
| 643 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 644 | void ioSendOutput(); |
| Miao Wang | 09d2dd2 | 2015-03-18 20:09:20 -0700 | [diff] [blame] | 645 | |
| 646 | /** |
| 647 | * Receive the latest input into the Allocation. This operation |
| 648 | * is only valid if USAGE_IO_INPUT is set on the Allocation. |
| 649 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 650 | void ioGetInput(); |
| 651 | |
| Miao Wang | 09d2dd2 | 2015-03-18 20:09:20 -0700 | [diff] [blame] | 652 | #if !defined(RS_SERVER) && !defined(RS_COMPATIBILITY_LIB) |
| 653 | /** |
| 654 | * Returns the handle to a raw buffer that is being managed by the screen |
| 655 | * compositor. This operation is only valid for Allocations with USAGE_IO_INPUT. |
| 656 | * @return Surface associated with allocation |
| 657 | */ |
| 658 | sp<Surface> getSurface(); |
| 659 | |
| 660 | /** |
| 661 | * Associate a Surface with this Allocation. This |
| 662 | * operation is only valid for Allocations with USAGE_IO_OUTPUT. |
| 663 | * @param[in] s Surface to associate with allocation |
| 664 | */ |
| 665 | void setSurface(sp<Surface> s); |
| 666 | #endif |
| 667 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 668 | /** |
| 669 | * Generate a mipmap chain. This is only valid if the Type of the Allocation |
| 670 | * includes mipmaps. This function will generate a complete set of mipmaps |
| 671 | * from the top level LOD and place them into the script memory space. If |
| 672 | * the Allocation is also using other memory spaces, a call to |
| 673 | * syncAll(Allocation.USAGE_SCRIPT) is required. |
| 674 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 675 | void generateMipmaps(); |
| Tim Murray | 509ea5c | 2012-11-13 11:56:40 -0800 | [diff] [blame] | 676 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 677 | /** |
| 678 | * Copy an array into part of this Allocation. |
| 679 | * @param[in] off offset of first Element to be overwritten |
| 680 | * @param[in] count number of Elements to copy |
| 681 | * @param[in] data array from which to copy |
| 682 | */ |
| Tim Murray | 0b93e30 | 2012-11-15 14:56:54 -0800 | [diff] [blame] | 683 | void copy1DRangeFrom(uint32_t off, size_t count, const void *data); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 684 | |
| 685 | /** |
| 686 | * Copy part of an Allocation into part of this Allocation. |
| 687 | * @param[in] off offset of first Element to be overwritten |
| 688 | * @param[in] count number of Elements to copy |
| 689 | * @param[in] data Allocation from which to copy |
| 690 | * @param[in] dataOff offset of first Element in data to copy |
| 691 | */ |
| Tim Murray | a4cbc2b | 2012-11-14 17:18:08 -0800 | [diff] [blame] | 692 | void copy1DRangeFrom(uint32_t off, size_t count, sp<const Allocation> data, uint32_t dataOff); |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 693 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 694 | /** |
| 695 | * Copy an array into part of this Allocation. |
| 696 | * @param[in] off offset of first Element to be overwritten |
| 697 | * @param[in] count number of Elements to copy |
| 698 | * @param[in] data array from which to copy |
| 699 | */ |
| Tim Murray | 0b93e30 | 2012-11-15 14:56:54 -0800 | [diff] [blame] | 700 | void copy1DRangeTo(uint32_t off, size_t count, void *data); |
| 701 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 702 | /** |
| 703 | * Copy entire array to an Allocation. |
| 704 | * @param[in] data array from which to copy |
| 705 | */ |
| Tim Murray | 0b93e30 | 2012-11-15 14:56:54 -0800 | [diff] [blame] | 706 | void copy1DFrom(const void* data); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 707 | |
| 708 | /** |
| 709 | * Copy entire Allocation to an array. |
| 710 | * @param[in] data destination array |
| 711 | */ |
| Tim Murray | 0b93e30 | 2012-11-15 14:56:54 -0800 | [diff] [blame] | 712 | void copy1DTo(void* data); |
| Tim Murray | a4cbc2b | 2012-11-14 17:18:08 -0800 | [diff] [blame] | 713 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 714 | /** |
| 715 | * Copy from an array into a rectangular region in this Allocation. The |
| 716 | * array is assumed to be tightly packed. |
| 717 | * @param[in] xoff X offset of region to update in this Allocation |
| 718 | * @param[in] yoff Y offset of region to update in this Allocation |
| 719 | * @param[in] w Width of region to update |
| 720 | * @param[in] h Height of region to update |
| 721 | * @param[in] data Array from which to copy |
| 722 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 723 | void copy2DRangeFrom(uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h, |
| Tim Murray | 0b93e30 | 2012-11-15 14:56:54 -0800 | [diff] [blame] | 724 | const void *data); |
| Tim Murray | 7b3e309 | 2012-11-16 13:32:24 -0800 | [diff] [blame] | 725 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 726 | /** |
| 727 | * Copy from this Allocation into a rectangular region in an array. The |
| 728 | * array is assumed to be tightly packed. |
| 729 | * @param[in] xoff X offset of region to copy from this Allocation |
| 730 | * @param[in] yoff Y offset of region to copy from this Allocation |
| 731 | * @param[in] w Width of region to update |
| 732 | * @param[in] h Height of region to update |
| 733 | * @param[in] data destination array |
| 734 | */ |
| Tim Murray | 7b3e309 | 2012-11-16 13:32:24 -0800 | [diff] [blame] | 735 | void copy2DRangeTo(uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h, |
| 736 | void *data); |
| 737 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 738 | /** |
| 739 | * Copy from an Allocation into a rectangular region in this Allocation. |
| 740 | * @param[in] xoff X offset of region to update in this Allocation |
| 741 | * @param[in] yoff Y offset of region to update in this Allocation |
| 742 | * @param[in] w Width of region to update |
| 743 | * @param[in] h Height of region to update |
| 744 | * @param[in] data Allocation from which to copy |
| 745 | * @param[in] dataXoff X offset of region to copy from in data |
| 746 | * @param[in] dataYoff Y offset of region to copy from in data |
| 747 | */ |
| Tim Murray | 0b93e30 | 2012-11-15 14:56:54 -0800 | [diff] [blame] | 748 | void copy2DRangeFrom(uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h, |
| 749 | sp<const Allocation> data, uint32_t dataXoff, uint32_t dataYoff); |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 750 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 751 | /** |
| 752 | * Copy from a strided array into a rectangular region in this Allocation. |
| 753 | * @param[in] xoff X offset of region to update in this Allocation |
| 754 | * @param[in] yoff Y offset of region to update in this Allocation |
| 755 | * @param[in] w Width of region to update |
| 756 | * @param[in] h Height of region to update |
| 757 | * @param[in] data array from which to copy |
| 758 | * @param[in] stride stride of data in bytes |
| 759 | */ |
| Tim Murray | 358747a | 2012-11-26 13:52:04 -0800 | [diff] [blame] | 760 | void copy2DStridedFrom(uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h, |
| 761 | const void *data, size_t stride); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 762 | |
| 763 | /** |
| 764 | * Copy from a strided array into this Allocation. |
| 765 | * @param[in] data array from which to copy |
| 766 | * @param[in] stride stride of data in bytes |
| 767 | */ |
| Tim Murray | 358747a | 2012-11-26 13:52:04 -0800 | [diff] [blame] | 768 | void copy2DStridedFrom(const void *data, size_t stride); |
| 769 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 770 | /** |
| 771 | * Copy from a rectangular region in this Allocation into a strided array. |
| 772 | * @param[in] xoff X offset of region to update in this Allocation |
| 773 | * @param[in] yoff Y offset of region to update in this Allocation |
| 774 | * @param[in] w Width of region to update |
| 775 | * @param[in] h Height of region to update |
| 776 | * @param[in] data destination array |
| 777 | * @param[in] stride stride of data in bytes |
| 778 | */ |
| Tim Murray | 358747a | 2012-11-26 13:52:04 -0800 | [diff] [blame] | 779 | void copy2DStridedTo(uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h, |
| 780 | void *data, size_t stride); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 781 | |
| 782 | /** |
| 783 | * Copy this Allocation into a strided array. |
| 784 | * @param[in] data destination array |
| 785 | * @param[in] stride stride of data in bytes |
| 786 | */ |
| Tim Murray | 358747a | 2012-11-26 13:52:04 -0800 | [diff] [blame] | 787 | void copy2DStridedTo(void *data, size_t stride); |
| 788 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 789 | |
| 790 | /** |
| 791 | * Copy from an array into a 3D region in this Allocation. The |
| 792 | * array is assumed to be tightly packed. |
| 793 | * @param[in] xoff X offset of region to update in this Allocation |
| 794 | * @param[in] yoff Y offset of region to update in this Allocation |
| 795 | * @param[in] zoff Z offset of region to update in this Allocation |
| 796 | * @param[in] w Width of region to update |
| 797 | * @param[in] h Height of region to update |
| 798 | * @param[in] d Depth of region to update |
| 799 | * @param[in] data Array from which to copy |
| 800 | */ |
| Tim Murray | 9d24ae6 | 2013-08-30 12:17:14 -0700 | [diff] [blame] | 801 | void copy3DRangeFrom(uint32_t xoff, uint32_t yoff, uint32_t zoff, uint32_t w, |
| 802 | uint32_t h, uint32_t d, const void* data); |
| 803 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 804 | /** |
| 805 | * Copy from an Allocation into a 3D region in this Allocation. |
| 806 | * @param[in] xoff X offset of region to update in this Allocation |
| 807 | * @param[in] yoff Y offset of region to update in this Allocation |
| 808 | * @param[in] zoff Z offset of region to update in this Allocation |
| 809 | * @param[in] w Width of region to update |
| 810 | * @param[in] h Height of region to update |
| 811 | * @param[in] d Depth of region to update |
| 812 | * @param[in] data Allocation from which to copy |
| 813 | * @param[in] dataXoff X offset of region in data to copy from |
| 814 | * @param[in] dataYoff Y offset of region in data to copy from |
| 815 | * @param[in] dataZoff Z offset of region in data to copy from |
| 816 | */ |
| Tim Murray | 9d24ae6 | 2013-08-30 12:17:14 -0700 | [diff] [blame] | 817 | void copy3DRangeFrom(uint32_t xoff, uint32_t yoff, uint32_t zoff, |
| 818 | uint32_t w, uint32_t h, uint32_t d, |
| 819 | sp<const Allocation> data, |
| 820 | uint32_t dataXoff, uint32_t dataYoff, uint32_t dataZoff); |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 821 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 822 | /** |
| Miao Wang | e5428e6 | 2015-03-10 15:29:40 -0700 | [diff] [blame] | 823 | * Copy a 3D region in this Allocation into an array. The |
| 824 | * array is assumed to be tightly packed. |
| 825 | * @param[in] xoff X offset of region to update in this Allocation |
| 826 | * @param[in] yoff Y offset of region to update in this Allocation |
| 827 | * @param[in] zoff Z offset of region to update in this Allocation |
| 828 | * @param[in] w Width of region to update |
| 829 | * @param[in] h Height of region to update |
| 830 | * @param[in] d Depth of region to update |
| 831 | * @param[in] data Array from which to copy |
| 832 | */ |
| 833 | void copy3DRangeTo(uint32_t xoff, uint32_t yoff, uint32_t zoff, uint32_t w, |
| 834 | uint32_t h, uint32_t d, void* data); |
| 835 | |
| 836 | /** |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 837 | * Creates an Allocation for use by scripts with a given Type. |
| 838 | * @param[in] rs Context to which the Allocation will belong |
| 839 | * @param[in] type Type of the Allocation |
| Stephen Hines | 8f615d6 | 2013-12-20 12:23:32 -0800 | [diff] [blame] | 840 | * @param[in] mipmaps desired mipmap behavior for the Allocation |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 841 | * @param[in] usage usage for the Allocation |
| 842 | * @return new Allocation |
| 843 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 844 | static sp<Allocation> createTyped(sp<RS> rs, sp<const Type> type, |
| Stephen Hines | 8f615d6 | 2013-12-20 12:23:32 -0800 | [diff] [blame] | 845 | RsAllocationMipmapControl mipmaps, uint32_t usage); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 846 | |
| 847 | /** |
| 848 | * Creates an Allocation for use by scripts with a given Type and a backing pointer. For use |
| 849 | * with RS_ALLOCATION_USAGE_SHARED. |
| 850 | * @param[in] rs Context to which the Allocation will belong |
| 851 | * @param[in] type Type of the Allocation |
| Stephen Hines | 8f615d6 | 2013-12-20 12:23:32 -0800 | [diff] [blame] | 852 | * @param[in] mipmaps desired mipmap behavior for the Allocation |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 853 | * @param[in] usage usage for the Allocation |
| 854 | * @param[in] pointer existing backing store to use for this Allocation if possible |
| 855 | * @return new Allocation |
| 856 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 857 | static sp<Allocation> createTyped(sp<RS> rs, sp<const Type> type, |
| Stephen Hines | 8f615d6 | 2013-12-20 12:23:32 -0800 | [diff] [blame] | 858 | RsAllocationMipmapControl mipmaps, uint32_t usage, void * pointer); |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 859 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 860 | /** |
| 861 | * Creates an Allocation for use by scripts with a given Type with no mipmaps. |
| 862 | * @param[in] rs Context to which the Allocation will belong |
| 863 | * @param[in] type Type of the Allocation |
| 864 | * @param[in] usage usage for the Allocation |
| 865 | * @return new Allocation |
| 866 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 867 | static sp<Allocation> createTyped(sp<RS> rs, sp<const Type> type, |
| 868 | uint32_t usage = RS_ALLOCATION_USAGE_SCRIPT); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 869 | /** |
| 870 | * Creates an Allocation with a specified number of given elements. |
| 871 | * @param[in] rs Context to which the Allocation will belong |
| 872 | * @param[in] e Element used in the Allocation |
| 873 | * @param[in] count Number of elements of the Allocation |
| 874 | * @param[in] usage usage for the Allocation |
| 875 | * @return new Allocation |
| 876 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 877 | static sp<Allocation> createSized(sp<RS> rs, sp<const Element> e, size_t count, |
| 878 | uint32_t usage = RS_ALLOCATION_USAGE_SCRIPT); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 879 | |
| 880 | /** |
| 881 | * Creates a 2D Allocation with a specified number of given elements. |
| 882 | * @param[in] rs Context to which the Allocation will belong |
| 883 | * @param[in] e Element used in the Allocation |
| 884 | * @param[in] x Width in Elements of the Allocation |
| 885 | * @param[in] y Height of the Allocation |
| 886 | * @param[in] usage usage for the Allocation |
| 887 | * @return new Allocation |
| 888 | */ |
| Tim Murray | 684726c | 2012-11-14 11:57:42 -0800 | [diff] [blame] | 889 | static sp<Allocation> createSized2D(sp<RS> rs, sp<const Element> e, |
| 890 | size_t x, size_t y, |
| 891 | uint32_t usage = RS_ALLOCATION_USAGE_SCRIPT); |
| 892 | |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 893 | |
| Jason Sams | b8a94e2 | 2014-02-24 17:52:32 -0800 | [diff] [blame] | 894 | /** |
| 895 | * Get the backing pointer for a USAGE_SHARED allocation. |
| 896 | * @param[in] stride optional parameter. when non-NULL, will contain |
| 897 | * stride in bytes of a 2D Allocation |
| 898 | * @return pointer to data |
| 899 | */ |
| 900 | void * getPointer(size_t *stride = NULL); |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 901 | }; |
| 902 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 903 | /** |
| 904 | * An Element represents one item within an Allocation. An Element is roughly |
| 905 | * equivalent to a C type in a RenderScript kernel. Elements may be basic |
| 906 | * or complex. Some basic elements are: |
| 907 | |
| 908 | * - A single float value (equivalent to a float in a kernel) |
| 909 | * - A four-element float vector (equivalent to a float4 in a kernel) |
| 910 | * - An unsigned 32-bit integer (equivalent to an unsigned int in a kernel) |
| 911 | * - A single signed 8-bit integer (equivalent to a char in a kernel) |
| 912 | |
| 913 | * Basic Elements are comprised of a Element.DataType and a |
| 914 | * Element.DataKind. The DataType encodes C type information of an Element, |
| 915 | * while the DataKind encodes how that Element should be interpreted by a |
| 916 | * Sampler. Note that Allocation objects with DataKind USER cannot be used as |
| 917 | * input for a Sampler. In general, Allocation objects that are intended for |
| 918 | * use with a Sampler should use bitmap-derived Elements such as |
| 919 | * Element::RGBA_8888. |
| 920 | */ |
| 921 | |
| 922 | |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 923 | class Element : public BaseObj { |
| 924 | public: |
| 925 | bool isComplex(); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 926 | |
| 927 | /** |
| 928 | * Elements could be simple, such as an int or a float, or a structure with |
| 929 | * multiple sub-elements, such as a collection of floats, float2, |
| 930 | * float4. This function returns zero for simple elements or the number of |
| 931 | * sub-elements otherwise. |
| 932 | * @return number of sub-elements |
| 933 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 934 | size_t getSubElementCount() { |
| Miao Wang | bc10dff | 2015-04-03 17:44:55 -0700 | [diff] [blame] | 935 | return mVisibleElementMapSize; |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 936 | } |
| 937 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 938 | /** |
| 939 | * For complex Elements, this returns the sub-element at a given index. |
| 940 | * @param[in] index index of sub-element |
| 941 | * @return sub-element |
| 942 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 943 | sp<const Element> getSubElement(uint32_t index); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 944 | |
| 945 | /** |
| 946 | * For complex Elements, this returns the name of the sub-element at a given |
| 947 | * index. |
| 948 | * @param[in] index index of sub-element |
| 949 | * @return name of sub-element |
| 950 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 951 | const char * getSubElementName(uint32_t index); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 952 | |
| 953 | /** |
| 954 | * For complex Elements, this returns the size of the sub-element at a given |
| 955 | * index. |
| 956 | * @param[in] index index of sub-element |
| 957 | * @return size of sub-element |
| 958 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 959 | size_t getSubElementArraySize(uint32_t index); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 960 | |
| 961 | /** |
| 962 | * Returns the location of a sub-element within a complex Element. |
| 963 | * @param[in] index index of sub-element |
| 964 | * @return offset in bytes |
| 965 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 966 | uint32_t getSubElementOffsetBytes(uint32_t index); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 967 | |
| 968 | /** |
| 969 | * Returns the data type used for the Element. |
| 970 | * @return data type |
| 971 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 972 | RsDataType getDataType() const { |
| 973 | return mType; |
| 974 | } |
| 975 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 976 | /** |
| 977 | * Returns the data kind used for the Element. |
| 978 | * @return data kind |
| 979 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 980 | RsDataKind getDataKind() const { |
| 981 | return mKind; |
| 982 | } |
| 983 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 984 | /** |
| 985 | * Returns the size in bytes of the Element. |
| 986 | * @return size in bytes |
| 987 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 988 | size_t getSizeBytes() const { |
| 989 | return mSizeBytes; |
| 990 | } |
| 991 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 992 | /** |
| 993 | * Returns the number of vector components for this Element. |
| 994 | * @return number of vector components |
| 995 | */ |
| Tim Murray | 10913a5 | 2013-08-20 17:19:47 -0700 | [diff] [blame] | 996 | uint32_t getVectorSize() const { |
| 997 | return mVectorSize; |
| 998 | } |
| 999 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1000 | /** |
| 1001 | * Utility function for returning an Element containing a single bool. |
| 1002 | * @param[in] rs RenderScript context |
| 1003 | * @return Element |
| 1004 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1005 | static sp<const Element> BOOLEAN(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1006 | /** |
| 1007 | * Utility function for returning an Element containing a single unsigned char. |
| 1008 | * @param[in] rs RenderScript context |
| 1009 | * @return Element |
| 1010 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1011 | static sp<const Element> U8(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1012 | /** |
| 1013 | * Utility function for returning an Element containing a single signed char. |
| 1014 | * @param[in] rs RenderScript context |
| 1015 | * @return Element |
| 1016 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1017 | static sp<const Element> I8(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1018 | /** |
| 1019 | * Utility function for returning an Element containing a single unsigned short. |
| 1020 | * @param[in] rs RenderScript context |
| 1021 | * @return Element |
| 1022 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1023 | static sp<const Element> U16(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1024 | /** |
| 1025 | * Utility function for returning an Element containing a single signed short. |
| 1026 | * @param[in] rs RenderScript context |
| 1027 | * @return Element |
| 1028 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1029 | static sp<const Element> I16(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1030 | /** |
| 1031 | * Utility function for returning an Element containing a single unsigned int. |
| 1032 | * @param[in] rs RenderScript context |
| 1033 | * @return Element |
| 1034 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1035 | static sp<const Element> U32(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1036 | /** |
| 1037 | * Utility function for returning an Element containing a single signed int. |
| 1038 | * @param[in] rs RenderScript context |
| 1039 | * @return Element |
| 1040 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1041 | static sp<const Element> I32(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1042 | /** |
| 1043 | * Utility function for returning an Element containing a single unsigned long long. |
| 1044 | * @param[in] rs RenderScript context |
| 1045 | * @return Element |
| 1046 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1047 | static sp<const Element> U64(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1048 | /** |
| 1049 | * Utility function for returning an Element containing a single signed long long. |
| 1050 | * @param[in] rs RenderScript context |
| 1051 | * @return Element |
| 1052 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1053 | static sp<const Element> I64(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1054 | /** |
| 1055 | * Utility function for returning an Element containing a single float. |
| 1056 | * @param[in] rs RenderScript context |
| 1057 | * @return Element |
| 1058 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1059 | static sp<const Element> F32(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1060 | /** |
| 1061 | * Utility function for returning an Element containing a single double. |
| 1062 | * @param[in] rs RenderScript context |
| 1063 | * @return Element |
| 1064 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1065 | static sp<const Element> F64(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1066 | /** |
| 1067 | * Utility function for returning an Element containing a single Element. |
| 1068 | * @param[in] rs RenderScript context |
| 1069 | * @return Element |
| 1070 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1071 | static sp<const Element> ELEMENT(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1072 | /** |
| 1073 | * Utility function for returning an Element containing a single Type. |
| 1074 | * @param[in] rs RenderScript context |
| 1075 | * @return Element |
| 1076 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1077 | static sp<const Element> TYPE(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1078 | /** |
| 1079 | * Utility function for returning an Element containing a single Allocation. |
| 1080 | * @param[in] rs RenderScript context |
| 1081 | * @return Element |
| 1082 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1083 | static sp<const Element> ALLOCATION(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1084 | /** |
| 1085 | * Utility function for returning an Element containing a single Sampler. |
| 1086 | * @param[in] rs RenderScript context |
| 1087 | * @return Element |
| 1088 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1089 | static sp<const Element> SAMPLER(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1090 | /** |
| 1091 | * Utility function for returning an Element containing a single Script. |
| 1092 | * @param[in] rs RenderScript context |
| 1093 | * @return Element |
| 1094 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1095 | static sp<const Element> SCRIPT(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1096 | /** |
| 1097 | * Utility function for returning an Element containing an ALPHA_8 pixel. |
| 1098 | * @param[in] rs RenderScript context |
| 1099 | * @return Element |
| 1100 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1101 | static sp<const Element> A_8(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1102 | /** |
| 1103 | * Utility function for returning an Element containing an RGB_565 pixel. |
| 1104 | * @param[in] rs RenderScript context |
| 1105 | * @return Element |
| 1106 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1107 | static sp<const Element> RGB_565(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1108 | /** |
| 1109 | * Utility function for returning an Element containing an RGB_888 pixel. |
| 1110 | * @param[in] rs RenderScript context |
| 1111 | * @return Element |
| 1112 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1113 | static sp<const Element> RGB_888(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1114 | /** |
| 1115 | * Utility function for returning an Element containing an RGBA_5551 pixel. |
| 1116 | * @param[in] rs RenderScript context |
| 1117 | * @return Element |
| 1118 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1119 | static sp<const Element> RGBA_5551(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1120 | /** |
| 1121 | * Utility function for returning an Element containing an RGBA_4444 pixel. |
| 1122 | * @param[in] rs RenderScript context |
| 1123 | * @return Element |
| 1124 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1125 | static sp<const Element> RGBA_4444(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1126 | /** |
| 1127 | * Utility function for returning an Element containing an RGBA_8888 pixel. |
| 1128 | * @param[in] rs RenderScript context |
| 1129 | * @return Element |
| 1130 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1131 | static sp<const Element> RGBA_8888(sp<RS> rs); |
| 1132 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1133 | /** |
| 1134 | * Utility function for returning an Element containing a float2. |
| 1135 | * @param[in] rs RenderScript context |
| 1136 | * @return Element |
| 1137 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1138 | static sp<const Element> F32_2(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1139 | /** |
| 1140 | * Utility function for returning an Element containing a float3. |
| 1141 | * @param[in] rs RenderScript context |
| 1142 | * @return Element |
| 1143 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1144 | static sp<const Element> F32_3(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1145 | /** |
| 1146 | * Utility function for returning an Element containing a float4. |
| 1147 | * @param[in] rs RenderScript context |
| 1148 | * @return Element |
| 1149 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1150 | static sp<const Element> F32_4(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1151 | /** |
| 1152 | * Utility function for returning an Element containing a double2. |
| 1153 | * @param[in] rs RenderScript context |
| 1154 | * @return Element |
| 1155 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1156 | static sp<const Element> F64_2(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1157 | /** |
| 1158 | * Utility function for returning an Element containing a double3. |
| 1159 | * @param[in] rs RenderScript context |
| 1160 | * @return Element |
| 1161 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1162 | static sp<const Element> F64_3(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1163 | /** |
| 1164 | * Utility function for returning an Element containing a double4. |
| 1165 | * @param[in] rs RenderScript context |
| 1166 | * @return Element |
| 1167 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1168 | static sp<const Element> F64_4(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1169 | /** |
| 1170 | * Utility function for returning an Element containing a uchar2. |
| 1171 | * @param[in] rs RenderScript context |
| 1172 | * @return Element |
| 1173 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1174 | static sp<const Element> U8_2(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1175 | /** |
| 1176 | * Utility function for returning an Element containing a uchar3. |
| 1177 | * @param[in] rs RenderScript context |
| 1178 | * @return Element |
| 1179 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1180 | static sp<const Element> U8_3(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1181 | /** |
| 1182 | * Utility function for returning an Element containing a uchar4. |
| 1183 | * @param[in] rs RenderScript context |
| 1184 | * @return Element |
| 1185 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1186 | static sp<const Element> U8_4(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1187 | /** |
| 1188 | * Utility function for returning an Element containing a char2. |
| 1189 | * @param[in] rs RenderScript context |
| 1190 | * @return Element |
| 1191 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1192 | static sp<const Element> I8_2(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1193 | /** |
| 1194 | * Utility function for returning an Element containing a char3. |
| 1195 | * @param[in] rs RenderScript context |
| 1196 | * @return Element |
| 1197 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1198 | static sp<const Element> I8_3(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1199 | /** |
| 1200 | * Utility function for returning an Element containing a char4. |
| 1201 | * @param[in] rs RenderScript context |
| 1202 | * @return Element |
| 1203 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1204 | static sp<const Element> I8_4(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1205 | /** |
| 1206 | * Utility function for returning an Element containing a ushort2. |
| 1207 | * @param[in] rs RenderScript context |
| 1208 | * @return Element |
| 1209 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1210 | static sp<const Element> U16_2(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1211 | /** |
| 1212 | * Utility function for returning an Element containing a ushort3. |
| 1213 | * @param[in] rs RenderScript context |
| 1214 | * @return Element |
| 1215 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1216 | static sp<const Element> U16_3(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1217 | /** |
| 1218 | * Utility function for returning an Element containing a ushort4. |
| 1219 | * @param[in] rs RenderScript context |
| 1220 | * @return Element |
| 1221 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1222 | static sp<const Element> U16_4(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1223 | /** |
| 1224 | * Utility function for returning an Element containing a short2. |
| 1225 | * @param[in] rs RenderScript context |
| 1226 | * @return Element |
| 1227 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1228 | static sp<const Element> I16_2(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1229 | /** |
| 1230 | * Utility function for returning an Element containing a short3. |
| 1231 | * @param[in] rs RenderScript context |
| 1232 | * @return Element |
| 1233 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1234 | static sp<const Element> I16_3(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1235 | /** |
| 1236 | * Utility function for returning an Element containing a short4. |
| 1237 | * @param[in] rs RenderScript context |
| 1238 | * @return Element |
| 1239 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1240 | static sp<const Element> I16_4(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1241 | /** |
| 1242 | * Utility function for returning an Element containing a uint2. |
| 1243 | * @param[in] rs RenderScript context |
| 1244 | * @return Element |
| 1245 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1246 | static sp<const Element> U32_2(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1247 | /** |
| 1248 | * Utility function for returning an Element containing a uint3. |
| 1249 | * @param[in] rs RenderScript context |
| 1250 | * @return Element |
| 1251 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1252 | static sp<const Element> U32_3(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1253 | /** |
| 1254 | * Utility function for returning an Element containing a uint4. |
| 1255 | * @param[in] rs RenderScript context |
| 1256 | * @return Element |
| 1257 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1258 | static sp<const Element> U32_4(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1259 | /** |
| 1260 | * Utility function for returning an Element containing an int2. |
| 1261 | * @param[in] rs RenderScript context |
| 1262 | * @return Element |
| 1263 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1264 | static sp<const Element> I32_2(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1265 | /** |
| 1266 | * Utility function for returning an Element containing an int3. |
| 1267 | * @param[in] rs RenderScript context |
| 1268 | * @return Element |
| 1269 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1270 | static sp<const Element> I32_3(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1271 | /** |
| 1272 | * Utility function for returning an Element containing an int4. |
| 1273 | * @param[in] rs RenderScript context |
| 1274 | * @return Element |
| 1275 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1276 | static sp<const Element> I32_4(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1277 | /** |
| 1278 | * Utility function for returning an Element containing a ulong2. |
| 1279 | * @param[in] rs RenderScript context |
| 1280 | * @return Element |
| 1281 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1282 | static sp<const Element> U64_2(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1283 | /** |
| 1284 | * Utility function for returning an Element containing a ulong3. |
| 1285 | * @param[in] rs RenderScript context |
| 1286 | * @return Element |
| 1287 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1288 | static sp<const Element> U64_3(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1289 | /** |
| 1290 | * Utility function for returning an Element containing a ulong4. |
| 1291 | * @param[in] rs RenderScript context |
| 1292 | * @return Element |
| 1293 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1294 | static sp<const Element> U64_4(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1295 | /** |
| 1296 | * Utility function for returning an Element containing a long2. |
| 1297 | * @param[in] rs RenderScript context |
| 1298 | * @return Element |
| 1299 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1300 | static sp<const Element> I64_2(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1301 | /** |
| 1302 | * Utility function for returning an Element containing a long3. |
| 1303 | * @param[in] rs RenderScript context |
| 1304 | * @return Element |
| 1305 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1306 | static sp<const Element> I64_3(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1307 | /** |
| 1308 | * Utility function for returning an Element containing a long4. |
| 1309 | * @param[in] rs RenderScript context |
| 1310 | * @return Element |
| 1311 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1312 | static sp<const Element> I64_4(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1313 | /** |
| 1314 | * Utility function for returning an Element containing a YUV pixel. |
| 1315 | * @param[in] rs RenderScript context |
| 1316 | * @return Element |
| 1317 | */ |
| Tim Murray | eb4426d | 2013-08-27 15:30:16 -0700 | [diff] [blame] | 1318 | static sp<const Element> YUV(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1319 | /** |
| 1320 | * Utility function for returning an Element containing an rs_matrix_4x4. |
| 1321 | * @param[in] rs RenderScript context |
| 1322 | * @return Element |
| 1323 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1324 | static sp<const Element> MATRIX_4X4(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1325 | /** |
| 1326 | * Utility function for returning an Element containing an rs_matrix_3x3. |
| 1327 | * @param[in] rs RenderScript context |
| 1328 | * @return Element |
| 1329 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1330 | static sp<const Element> MATRIX_3X3(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1331 | /** |
| 1332 | * Utility function for returning an Element containing an rs_matrix_2x2. |
| 1333 | * @param[in] rs RenderScript context |
| 1334 | * @return Element |
| 1335 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1336 | static sp<const Element> MATRIX_2X2(sp<RS> rs); |
| 1337 | |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1338 | void updateFromNative(); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1339 | |
| 1340 | /** |
| 1341 | * Create an Element with a given DataType. |
| 1342 | * @param[in] rs RenderScript context |
| 1343 | * @param[in] dt data type |
| 1344 | * @return Element |
| 1345 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1346 | static sp<const Element> createUser(sp<RS> rs, RsDataType dt); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1347 | /** |
| 1348 | * Create a vector Element with the given DataType |
| 1349 | * @param[in] rs RenderScript |
| 1350 | * @param[in] dt DataType |
| 1351 | * @param[in] size vector size |
| 1352 | * @return Element |
| 1353 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1354 | static sp<const Element> createVector(sp<RS> rs, RsDataType dt, uint32_t size); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1355 | /** |
| 1356 | * Create an Element with a given DataType and DataKind. |
| 1357 | * @param[in] rs RenderScript context |
| 1358 | * @param[in] dt DataType |
| 1359 | * @param[in] dk DataKind |
| 1360 | * @return Element |
| 1361 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1362 | static sp<const Element> createPixel(sp<RS> rs, RsDataType dt, RsDataKind dk); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1363 | |
| 1364 | /** |
| 1365 | * Returns true if the Element can interoperate with this Element. |
| 1366 | * @param[in] e Element to compare |
| 1367 | * @return true if Elements can interoperate |
| 1368 | */ |
| Tim Murray | 10913a5 | 2013-08-20 17:19:47 -0700 | [diff] [blame] | 1369 | bool isCompatible(sp<const Element>e) const; |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1370 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1371 | /** |
| 1372 | * Builder class for producing complex elements with matching field and name |
| 1373 | * pairs. The builder starts empty. The order in which elements are added is |
| 1374 | * retained for the layout in memory. |
| 1375 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1376 | class Builder { |
| 1377 | private: |
| Tim Murray | 3560907 | 2013-12-03 11:36:03 -0800 | [diff] [blame] | 1378 | RS* mRS; |
| Miao Wang | bc10dff | 2015-04-03 17:44:55 -0700 | [diff] [blame] | 1379 | size_t mElementsCount; |
| 1380 | size_t mElementsVecSize; |
| 1381 | sp<const Element> * mElements; |
| 1382 | char ** mElementNames; |
| 1383 | size_t * mElementNameLengths; |
| 1384 | uint32_t * mArraySizes; |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1385 | bool mSkipPadding; |
| 1386 | |
| 1387 | public: |
| 1388 | Builder(sp<RS> rs); |
| 1389 | ~Builder(); |
| Miao Wang | bc10dff | 2015-04-03 17:44:55 -0700 | [diff] [blame] | 1390 | void add(sp<const Element> e, const char * name, uint32_t arraySize = 1); |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1391 | sp<const Element> create(); |
| 1392 | }; |
| 1393 | |
| Stephen Hines | 7d1b757 | 2013-08-22 01:24:06 -0700 | [diff] [blame] | 1394 | protected: |
| Miao Wang | 70d8995 | 2015-09-14 15:05:41 -0700 | [diff] [blame] | 1395 | friend class Type; |
| Stephen Hines | 7d1b757 | 2013-08-22 01:24:06 -0700 | [diff] [blame] | 1396 | Element(void *id, sp<RS> rs, |
| Miao Wang | bc10dff | 2015-04-03 17:44:55 -0700 | [diff] [blame] | 1397 | sp<const Element> * elements, |
| 1398 | size_t elementCount, |
| 1399 | const char ** elementNames, |
| 1400 | size_t * elementNameLengths, |
| 1401 | uint32_t * arraySizes); |
| Stephen Hines | 7d1b757 | 2013-08-22 01:24:06 -0700 | [diff] [blame] | 1402 | Element(void *id, sp<RS> rs, RsDataType dt, RsDataKind dk, bool norm, uint32_t size); |
| Miao Wang | 70d8995 | 2015-09-14 15:05:41 -0700 | [diff] [blame] | 1403 | Element(void *id, sp<RS> rs); |
| Stephen Hines | 7d1b757 | 2013-08-22 01:24:06 -0700 | [diff] [blame] | 1404 | Element(sp<RS> rs); |
| 1405 | virtual ~Element(); |
| 1406 | |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1407 | private: |
| 1408 | void updateVisibleSubElements(); |
| 1409 | |
| Miao Wang | bc10dff | 2015-04-03 17:44:55 -0700 | [diff] [blame] | 1410 | size_t mElementsCount; |
| 1411 | size_t mVisibleElementMapSize; |
| 1412 | |
| 1413 | sp<const Element> * mElements; |
| 1414 | char ** mElementNames; |
| 1415 | size_t * mElementNameLengths; |
| 1416 | uint32_t * mArraySizes; |
| 1417 | uint32_t * mVisibleElementMap; |
| 1418 | uint32_t * mOffsetInBytes; |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1419 | |
| 1420 | RsDataType mType; |
| 1421 | RsDataKind mKind; |
| 1422 | bool mNormalized; |
| 1423 | size_t mSizeBytes; |
| 1424 | size_t mVectorSize; |
| 1425 | }; |
| 1426 | |
| Stephen Hines | 2c7206e | 2012-11-14 19:47:01 -0800 | [diff] [blame] | 1427 | class FieldPacker { |
| 1428 | protected: |
| 1429 | unsigned char* mData; |
| 1430 | size_t mPos; |
| 1431 | size_t mLen; |
| 1432 | |
| 1433 | public: |
| 1434 | FieldPacker(size_t len) |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 1435 | : mPos(0), mLen(len) { |
| 1436 | mData = new unsigned char[len]; |
| 1437 | } |
| Stephen Hines | 2c7206e | 2012-11-14 19:47:01 -0800 | [diff] [blame] | 1438 | |
| 1439 | virtual ~FieldPacker() { |
| 1440 | delete [] mData; |
| 1441 | } |
| 1442 | |
| 1443 | void align(size_t v) { |
| 1444 | if ((v & (v - 1)) != 0) { |
| Tim Murray | ab71636 | 2013-08-12 12:37:18 -0700 | [diff] [blame] | 1445 | // ALOGE("Non-power-of-two alignment: %zu", v); |
| Stephen Hines | 2c7206e | 2012-11-14 19:47:01 -0800 | [diff] [blame] | 1446 | return; |
| 1447 | } |
| 1448 | |
| 1449 | while ((mPos & (v - 1)) != 0) { |
| 1450 | mData[mPos++] = 0; |
| 1451 | } |
| 1452 | } |
| 1453 | |
| 1454 | void reset() { |
| 1455 | mPos = 0; |
| 1456 | } |
| 1457 | |
| 1458 | void reset(size_t i) { |
| 1459 | if (i >= mLen) { |
| Tim Murray | ab71636 | 2013-08-12 12:37:18 -0700 | [diff] [blame] | 1460 | // ALOGE("Out of bounds: i (%zu) >= len (%zu)", i, mLen); |
| Stephen Hines | 2c7206e | 2012-11-14 19:47:01 -0800 | [diff] [blame] | 1461 | return; |
| 1462 | } |
| 1463 | mPos = i; |
| 1464 | } |
| 1465 | |
| 1466 | void skip(size_t i) { |
| 1467 | size_t res = mPos + i; |
| 1468 | if (res > mLen) { |
| Tim Murray | ab71636 | 2013-08-12 12:37:18 -0700 | [diff] [blame] | 1469 | // ALOGE("Exceeded buffer length: i (%zu) > len (%zu)", i, mLen); |
| Stephen Hines | 2c7206e | 2012-11-14 19:47:01 -0800 | [diff] [blame] | 1470 | return; |
| 1471 | } |
| 1472 | mPos = res; |
| 1473 | } |
| 1474 | |
| 1475 | void* getData() const { |
| 1476 | return mData; |
| 1477 | } |
| 1478 | |
| 1479 | size_t getLength() const { |
| 1480 | return mLen; |
| 1481 | } |
| 1482 | |
| 1483 | template <typename T> |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 1484 | void add(T t) { |
| Stephen Hines | 2c7206e | 2012-11-14 19:47:01 -0800 | [diff] [blame] | 1485 | align(sizeof(t)); |
| 1486 | if (mPos + sizeof(t) <= mLen) { |
| 1487 | memcpy(&mData[mPos], &t, sizeof(t)); |
| 1488 | mPos += sizeof(t); |
| 1489 | } |
| 1490 | } |
| Stephen Hines | 43514cd | 2012-11-16 14:33:47 -0800 | [diff] [blame] | 1491 | |
| 1492 | /* |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 1493 | void add(rs_matrix4x4 m) { |
| 1494 | for (size_t i = 0; i < 16; i++) { |
| 1495 | add(m.m[i]); |
| 1496 | } |
| 1497 | } |
| Stephen Hines | 43514cd | 2012-11-16 14:33:47 -0800 | [diff] [blame] | 1498 | |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 1499 | void add(rs_matrix3x3 m) { |
| 1500 | for (size_t i = 0; i < 9; i++) { |
| 1501 | add(m.m[i]); |
| 1502 | } |
| 1503 | } |
| Stephen Hines | 43514cd | 2012-11-16 14:33:47 -0800 | [diff] [blame] | 1504 | |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 1505 | void add(rs_matrix2x2 m) { |
| 1506 | for (size_t i = 0; i < 4; i++) { |
| 1507 | add(m.m[i]); |
| 1508 | } |
| 1509 | } |
| Stephen Hines | 43514cd | 2012-11-16 14:33:47 -0800 | [diff] [blame] | 1510 | */ |
| 1511 | |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 1512 | void add(sp<BaseObj> obj) { |
| Stephen Hines | 43514cd | 2012-11-16 14:33:47 -0800 | [diff] [blame] | 1513 | if (obj != NULL) { |
| 1514 | add((uint32_t) (uintptr_t) obj->getID()); |
| 1515 | } else { |
| 1516 | add((uint32_t) 0); |
| 1517 | } |
| 1518 | } |
| Stephen Hines | 2c7206e | 2012-11-14 19:47:01 -0800 | [diff] [blame] | 1519 | }; |
| 1520 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1521 | /** |
| 1522 | * A Type describes the Element and dimensions used for an Allocation or a |
| 1523 | * parallel operation. |
| 1524 | * |
| 1525 | * A Type always includes an Element and an X dimension. A Type may be |
| 1526 | * multidimensional, up to three dimensions. A nonzero value in the Y or Z |
| 1527 | * dimensions indicates that the dimension is present. Note that a Type with |
| 1528 | * only a given X dimension and a Type with the same X dimension but Y = 1 are |
| 1529 | * not equivalent. |
| 1530 | * |
| 1531 | * A Type also supports inclusion of level of detail (LOD) or cube map |
| 1532 | * faces. LOD and cube map faces are booleans to indicate present or not |
| 1533 | * present. |
| 1534 | * |
| 1535 | * A Type also supports YUV format information to support an Allocation in a YUV |
| Pirama Arumuga Nainar | c6f4374 | 2015-11-06 20:47:25 -0800 | [diff] [blame] | 1536 | * format. The YUV formats supported are RS_YUV_YV12 and RS_YUV_NV21. |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1537 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1538 | class Type : public BaseObj { |
| 1539 | protected: |
| 1540 | friend class Allocation; |
| 1541 | |
| 1542 | uint32_t mDimX; |
| 1543 | uint32_t mDimY; |
| 1544 | uint32_t mDimZ; |
| Pirama Arumuga Nainar | c6f4374 | 2015-11-06 20:47:25 -0800 | [diff] [blame] | 1545 | RsYuvFormat mYuvFormat; |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1546 | bool mDimMipmaps; |
| 1547 | bool mDimFaces; |
| 1548 | size_t mElementCount; |
| 1549 | sp<const Element> mElement; |
| 1550 | |
| Stephen Hines | 7d1b757 | 2013-08-22 01:24:06 -0700 | [diff] [blame] | 1551 | Type(void *id, sp<RS> rs); |
| 1552 | |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1553 | void calcElementCount(); |
| 1554 | virtual void updateFromNative(); |
| 1555 | |
| 1556 | public: |
| 1557 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1558 | /** |
| 1559 | * Returns the YUV format. |
| 1560 | * @return YUV format of the Allocation |
| 1561 | */ |
| Pirama Arumuga Nainar | c6f4374 | 2015-11-06 20:47:25 -0800 | [diff] [blame] | 1562 | RsYuvFormat getYuvFormat() const { |
| Tim Murray | eb4426d | 2013-08-27 15:30:16 -0700 | [diff] [blame] | 1563 | return mYuvFormat; |
| 1564 | } |
| 1565 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1566 | /** |
| 1567 | * Returns the Element of the Allocation. |
| 1568 | * @return YUV format of the Allocation |
| 1569 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1570 | sp<const Element> getElement() const { |
| 1571 | return mElement; |
| 1572 | } |
| 1573 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1574 | /** |
| 1575 | * Returns the X dimension of the Allocation. |
| 1576 | * @return X dimension of the allocation |
| 1577 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1578 | uint32_t getX() const { |
| 1579 | return mDimX; |
| 1580 | } |
| 1581 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1582 | /** |
| 1583 | * Returns the Y dimension of the Allocation. |
| 1584 | * @return Y dimension of the allocation |
| 1585 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1586 | uint32_t getY() const { |
| 1587 | return mDimY; |
| 1588 | } |
| 1589 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1590 | /** |
| 1591 | * Returns the Z dimension of the Allocation. |
| 1592 | * @return Z dimension of the allocation |
| 1593 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1594 | uint32_t getZ() const { |
| 1595 | return mDimZ; |
| 1596 | } |
| 1597 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1598 | /** |
| 1599 | * Returns true if the Allocation has mipmaps. |
| 1600 | * @return true if the Allocation has mipmaps |
| 1601 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1602 | bool hasMipmaps() const { |
| 1603 | return mDimMipmaps; |
| 1604 | } |
| 1605 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1606 | /** |
| 1607 | * Returns true if the Allocation is a cube map |
| 1608 | * @return true if the Allocation is a cube map |
| 1609 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1610 | bool hasFaces() const { |
| 1611 | return mDimFaces; |
| 1612 | } |
| 1613 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1614 | /** |
| 1615 | * Returns number of accessible Elements in the Allocation |
| 1616 | * @return number of accessible Elements in the Allocation |
| 1617 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1618 | size_t getCount() const { |
| 1619 | return mElementCount; |
| 1620 | } |
| 1621 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1622 | /** |
| 1623 | * Returns size in bytes of all Elements in the Allocation |
| 1624 | * @return size in bytes of all Elements in the Allocation |
| 1625 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1626 | size_t getSizeBytes() const { |
| 1627 | return mElementCount * mElement->getSizeBytes(); |
| 1628 | } |
| 1629 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1630 | /** |
| 1631 | * Creates a new Type with the given Element and dimensions. |
| 1632 | * @param[in] rs RenderScript context |
| 1633 | * @param[in] e Element |
| 1634 | * @param[in] dimX X dimension |
| 1635 | * @param[in] dimY Y dimension |
| 1636 | * @param[in] dimZ Z dimension |
| 1637 | * @return new Type |
| 1638 | */ |
| Tim Murray | 96267c2 | 2013-02-12 11:25:12 -0800 | [diff] [blame] | 1639 | static sp<const Type> create(sp<RS> rs, sp<const Element> e, uint32_t dimX, uint32_t dimY, uint32_t dimZ); |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1640 | |
| 1641 | class Builder { |
| 1642 | protected: |
| Tim Murray | 3560907 | 2013-12-03 11:36:03 -0800 | [diff] [blame] | 1643 | RS* mRS; |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1644 | uint32_t mDimX; |
| 1645 | uint32_t mDimY; |
| 1646 | uint32_t mDimZ; |
| Pirama Arumuga Nainar | c6f4374 | 2015-11-06 20:47:25 -0800 | [diff] [blame] | 1647 | RsYuvFormat mYuvFormat; |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1648 | bool mDimMipmaps; |
| 1649 | bool mDimFaces; |
| 1650 | sp<const Element> mElement; |
| 1651 | |
| 1652 | public: |
| 1653 | Builder(sp<RS> rs, sp<const Element> e); |
| 1654 | |
| 1655 | void setX(uint32_t value); |
| Stephen Hines | 7d1b757 | 2013-08-22 01:24:06 -0700 | [diff] [blame] | 1656 | void setY(uint32_t value); |
| Tim Murray | eb4426d | 2013-08-27 15:30:16 -0700 | [diff] [blame] | 1657 | void setZ(uint32_t value); |
| Pirama Arumuga Nainar | c6f4374 | 2015-11-06 20:47:25 -0800 | [diff] [blame] | 1658 | void setYuvFormat(RsYuvFormat format); |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1659 | void setMipmaps(bool value); |
| 1660 | void setFaces(bool value); |
| 1661 | sp<const Type> create(); |
| 1662 | }; |
| 1663 | |
| 1664 | }; |
| 1665 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1666 | /** |
| 1667 | * The parent class for all executable Scripts. This should not be used by applications. |
| 1668 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1669 | class Script : public BaseObj { |
| 1670 | private: |
| 1671 | |
| 1672 | protected: |
| 1673 | Script(void *id, sp<RS> rs); |
| 1674 | void forEach(uint32_t slot, sp<const Allocation> in, sp<const Allocation> out, |
| 1675 | const void *v, size_t) const; |
| Matt Wala | 394e9a6 | 2015-08-03 11:35:55 -0700 | [diff] [blame] | 1676 | void reduce(uint32_t slot, sp<const Allocation> in, sp<const Allocation> out, |
| 1677 | const RsScriptCall *sc) const; |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1678 | void bindAllocation(sp<Allocation> va, uint32_t slot) const; |
| 1679 | void setVar(uint32_t index, const void *, size_t len) const; |
| 1680 | void setVar(uint32_t index, sp<const BaseObj> o) const; |
| 1681 | void invoke(uint32_t slot, const void *v, size_t len) const; |
| 1682 | |
| 1683 | |
| 1684 | void invoke(uint32_t slot) const { |
| 1685 | invoke(slot, NULL, 0); |
| 1686 | } |
| 1687 | void setVar(uint32_t index, float v) const { |
| 1688 | setVar(index, &v, sizeof(v)); |
| 1689 | } |
| 1690 | void setVar(uint32_t index, double v) const { |
| 1691 | setVar(index, &v, sizeof(v)); |
| 1692 | } |
| 1693 | void setVar(uint32_t index, int32_t v) const { |
| 1694 | setVar(index, &v, sizeof(v)); |
| 1695 | } |
| Jon Parr | b05c850 | 2015-03-13 14:41:58 +0000 | [diff] [blame] | 1696 | void setVar(uint32_t index, uint32_t v) const { |
| 1697 | setVar(index, &v, sizeof(v)); |
| 1698 | } |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1699 | void setVar(uint32_t index, int64_t v) const { |
| 1700 | setVar(index, &v, sizeof(v)); |
| 1701 | } |
| 1702 | void setVar(uint32_t index, bool v) const { |
| 1703 | setVar(index, &v, sizeof(v)); |
| 1704 | } |
| 1705 | |
| 1706 | public: |
| 1707 | class FieldBase { |
| 1708 | protected: |
| 1709 | sp<const Element> mElement; |
| 1710 | sp<Allocation> mAllocation; |
| 1711 | |
| 1712 | void init(sp<RS> rs, uint32_t dimx, uint32_t usages = 0); |
| 1713 | |
| 1714 | public: |
| 1715 | sp<const Element> getElement() { |
| 1716 | return mElement; |
| 1717 | } |
| 1718 | |
| 1719 | sp<const Type> getType() { |
| 1720 | return mAllocation->getType(); |
| 1721 | } |
| 1722 | |
| 1723 | sp<const Allocation> getAllocation() { |
| 1724 | return mAllocation; |
| 1725 | } |
| 1726 | |
| 1727 | //void updateAllocation(); |
| 1728 | }; |
| 1729 | }; |
| 1730 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1731 | /** |
| 1732 | * The parent class for all user-defined scripts. This is intended to be used by auto-generated code only. |
| 1733 | */ |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 1734 | class ScriptC : public Script { |
| 1735 | protected: |
| 1736 | ScriptC(sp<RS> rs, |
| 1737 | const void *codeTxt, size_t codeLength, |
| 1738 | const char *cachedName, size_t cachedNameLength, |
| 1739 | const char *cacheDir, size_t cacheDirLength); |
| 1740 | |
| 1741 | }; |
| 1742 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1743 | /** |
| 1744 | * The parent class for all script intrinsics. Intrinsics provide highly optimized implementations of |
| 1745 | * basic functions. This is not intended to be used directly. |
| 1746 | */ |
| Tim Murray | 7f0d568 | 2012-11-08 16:35:24 -0800 | [diff] [blame] | 1747 | class ScriptIntrinsic : public Script { |
| 1748 | protected: |
| Tim Murray | 10913a5 | 2013-08-20 17:19:47 -0700 | [diff] [blame] | 1749 | sp<const Element> mElement; |
| Tim Murray | 3cd44af | 2012-11-14 11:25:27 -0800 | [diff] [blame] | 1750 | ScriptIntrinsic(sp<RS> rs, int id, sp<const Element> e); |
| Tim Murray | b27b181 | 2013-08-05 14:00:40 -0700 | [diff] [blame] | 1751 | virtual ~ScriptIntrinsic(); |
| Tim Murray | 7f0d568 | 2012-11-08 16:35:24 -0800 | [diff] [blame] | 1752 | }; |
| 1753 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1754 | /** |
| 1755 | * Intrinsic for converting RGB to RGBA by using a 3D lookup table. The incoming |
| 1756 | * r,g,b values are use as normalized x,y,z coordinates into a 3D |
| 1757 | * allocation. The 8 nearest values are sampled and linearly interpolated. The |
| 1758 | * result is placed in the output. |
| 1759 | */ |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 1760 | class ScriptIntrinsic3DLUT : public ScriptIntrinsic { |
| Tim Murray | 21fa7a0 | 2013-08-15 16:25:03 -0700 | [diff] [blame] | 1761 | private: |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 1762 | ScriptIntrinsic3DLUT(sp<RS> rs, sp<const Element> e); |
| Tim Murray | 21fa7a0 | 2013-08-15 16:25:03 -0700 | [diff] [blame] | 1763 | public: |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1764 | /** |
| 1765 | * Supported Element types are U8_4. Default lookup table is identity. |
| 1766 | * @param[in] rs RenderScript context |
| 1767 | * @param[in] e Element |
| 1768 | * @return new ScriptIntrinsic |
| 1769 | */ |
| Tim Murray | 21fa7a0 | 2013-08-15 16:25:03 -0700 | [diff] [blame] | 1770 | static sp<ScriptIntrinsic3DLUT> create(sp<RS> rs, sp<const Element> e); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1771 | |
| 1772 | /** |
| 1773 | * Launch the intrinsic. |
| 1774 | * @param[in] ain input Allocation |
| 1775 | * @param[in] aout output Allocation |
| 1776 | */ |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 1777 | void forEach(sp<Allocation> ain, sp<Allocation> aout); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 1778 | |
| 1779 | /** |
| 1780 | * Sets the lookup table. The lookup table must use the same Element as the |
| 1781 | * intrinsic. |
| 1782 | * @param[in] lut new lookup table |
| 1783 | */ |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 1784 | void setLUT(sp<Allocation> lut); |
| 1785 | }; |
| 1786 | |
| Miao Wang | 49b1226 | 2015-09-04 11:48:16 -0700 | [diff] [blame] | 1787 | |
| 1788 | /** |
| 1789 | * Intrinsic kernel provides high performance RenderScript APIs to BLAS. |
| 1790 | * |
| 1791 | * The BLAS (Basic Linear Algebra Subprograms) are routines that provide standard |
| 1792 | * building blocks for performing basic vector and matrix operations. |
| 1793 | * |
| 1794 | * For detailed description of BLAS, please refer to http://www.netlib.org/blas/ |
| 1795 | * |
| 1796 | **/ |
| 1797 | class ScriptIntrinsicBLAS : public ScriptIntrinsic { |
| 1798 | private: |
| 1799 | ScriptIntrinsicBLAS(sp<RS> rs, sp<const Element> e); |
| 1800 | public: |
| 1801 | /** |
| 1802 | * Create an intrinsic to access BLAS subroutines. |
| 1803 | * |
| 1804 | * @param rs The RenderScript context |
| 1805 | * @return ScriptIntrinsicBLAS |
| 1806 | */ |
| 1807 | static sp<ScriptIntrinsicBLAS> create(sp<RS> rs); |
| 1808 | |
| 1809 | /** |
| 1810 | * SGEMV performs one of the matrix-vector operations |
| 1811 | * y := alpha*A*x + beta*y or y := alpha*A**T*x + beta*y |
| 1812 | * |
| 1813 | * Details: http://www.netlib.org/lapack/explore-html/db/d58/sgemv_8f.html |
| 1814 | * |
| 1815 | * @param TransA The type of transpose applied to matrix A. |
| 1816 | * @param alpha The scalar alpha. |
| 1817 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32}. |
| 1818 | * @param X The input allocation contains vector x, supported elements type: {Element#F32}. |
| 1819 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 1820 | * @param beta The scalar beta. |
| 1821 | * @param Y The input allocation contains vector y, supported elements type: {Element#F32}. |
| 1822 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 1823 | */ |
| 1824 | void SGEMV(RsBlasTranspose TransA, |
| 1825 | float alpha, sp<Allocation> A, sp<Allocation> X, int incX, |
| 1826 | float beta, sp<Allocation> Y, int incY); |
| 1827 | |
| 1828 | /** |
| 1829 | * DGEMV performs one of the matrix-vector operations |
| 1830 | * y := alpha*A*x + beta*y or y := alpha*A**T*x + beta*y |
| 1831 | * |
| 1832 | * Details: http://www.netlib.org/lapack/explore-html/dc/da8/dgemv_8f.html |
| 1833 | * |
| 1834 | * @param TransA The type of transpose applied to matrix A. |
| 1835 | * @param alpha The scalar alpha. |
| 1836 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64}. |
| 1837 | * @param X The input allocation contains vector x, supported elements type: {Element#F64}. |
| 1838 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 1839 | * @param beta The scalar beta. |
| 1840 | * @param Y The input allocation contains vector y, supported elements type: {Element#F64}. |
| 1841 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 1842 | */ |
| 1843 | void DGEMV(RsBlasTranspose TransA, |
| 1844 | double alpha, sp<Allocation> A, sp<Allocation> X, int incX, |
| 1845 | double beta, sp<Allocation> Y, int incY); |
| 1846 | |
| 1847 | /** |
| 1848 | * CGEMV performs one of the matrix-vector operations |
| 1849 | * y := alpha*A*x + beta*y or y := alpha*A**T*x + beta*y or y := alpha*A**H*x + beta*y |
| 1850 | * |
| 1851 | * Details: http://www.netlib.org/lapack/explore-html/d4/d8a/cgemv_8f.html |
| 1852 | * |
| 1853 | * @param TransA The type of transpose applied to matrix A. |
| 1854 | * @param alpha The scalar alpha. |
| 1855 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}. |
| 1856 | * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}. |
| 1857 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 1858 | * @param beta The scalar beta. |
| 1859 | * @param Y The input allocation contains vector y, supported elements type: {Element#F32_2}. |
| 1860 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 1861 | */ |
| 1862 | void CGEMV(RsBlasTranspose TransA, |
| 1863 | Float2 alpha, sp<Allocation> A, sp<Allocation> X, int incX, |
| 1864 | Float2 beta, sp<Allocation> Y, int incY); |
| 1865 | |
| 1866 | /** |
| 1867 | * ZGEMV performs one of the matrix-vector operations |
| 1868 | * y := alpha*A*x + beta*y or y := alpha*A**T*x + beta*y or y := alpha*A**H*x + beta*y |
| 1869 | * |
| 1870 | * Details: http://www.netlib.org/lapack/explore-html/db/d40/zgemv_8f.html |
| 1871 | * |
| 1872 | * @param TransA The type of transpose applied to matrix A. |
| 1873 | * @param alpha The scalar alpha. |
| 1874 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}. |
| 1875 | * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}. |
| 1876 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 1877 | * @param beta The scalar beta. |
| 1878 | * @param Y The input allocation contains vector y, supported elements type: {Element#F64_2}. |
| 1879 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 1880 | */ |
| 1881 | void ZGEMV(RsBlasTranspose TransA, |
| 1882 | Double2 alpha, sp<Allocation> A, sp<Allocation> X, int incX, |
| 1883 | Double2 beta, sp<Allocation> Y, int incY); |
| 1884 | |
| 1885 | /** |
| 1886 | * SGBMV performs one of the matrix-vector operations |
| 1887 | * y := alpha*A*x + beta*y or y := alpha*A**T*x + beta*y |
| 1888 | * |
| 1889 | * Details: http://www.netlib.org/lapack/explore-html/d6/d46/sgbmv_8f.html |
| 1890 | * |
| 1891 | * Note: For a M*N matrix, the input Allocation should also be of size M*N (dimY = M, dimX = N), |
| 1892 | * but only the region M*(KL+KU+1) will be referenced. The following subroutine can is an |
| 1893 | * example showing how to convert the original matrix 'a' to row-based band matrix 'b'. |
| 1894 | * for i in range(0, m): |
| 1895 | * for j in range(max(0, i-kl), min(i+ku+1, n)): |
| 1896 | * b[i, j-i+kl] = a[i, j] |
| 1897 | * |
| 1898 | * @param TransA The type of transpose applied to matrix A. |
| 1899 | * @param KL The number of sub-diagonals of the matrix A. |
| 1900 | * @param KU The number of super-diagonals of the matrix A. |
| 1901 | * @param alpha The scalar alpha. |
| 1902 | * @param A The input allocation contains the band matrix A, supported elements type: {Element#F32}. |
| 1903 | * @param X The input allocation contains vector x, supported elements type: {Element#F32}. |
| 1904 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 1905 | * @param beta The scalar beta. |
| 1906 | * @param Y The input allocation contains vector y, supported elements type: {Element#F32}. |
| 1907 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 1908 | */ |
| 1909 | void SGBMV(RsBlasTranspose TransA, |
| 1910 | int KL, int KU, float alpha, sp<Allocation> A, sp<Allocation> X, int incX, |
| 1911 | float beta, sp<Allocation> Y, int incY); |
| 1912 | |
| 1913 | /** |
| 1914 | * DGBMV performs one of the matrix-vector operations |
| 1915 | * y := alpha*A*x + beta*y or y := alpha*A**T*x + beta*y |
| 1916 | * |
| 1917 | * Details: http://www.netlib.org/lapack/explore-html/d2/d3f/dgbmv_8f.html |
| 1918 | * |
| 1919 | * Note: For a M*N matrix, the input Allocation should also be of size M*N (dimY = M, dimX = N), |
| 1920 | * but only the region M*(KL+KU+1) will be referenced. The following subroutine can is an |
| 1921 | * example showing how to convert the original matrix 'a' to row-based band matrix 'b'. |
| 1922 | * for i in range(0, m): |
| 1923 | * for j in range(max(0, i-kl), min(i+ku+1, n)): |
| 1924 | * b[i, j-i+kl] = a[i, j] |
| 1925 | * |
| 1926 | * @param TransA The type of transpose applied to matrix A. |
| 1927 | * @param KL The number of sub-diagonals of the matrix A. |
| 1928 | * @param KU The number of super-diagonals of the matrix A. |
| 1929 | * @param alpha The scalar alpha. |
| 1930 | * @param A The input allocation contains the band matrix A, supported elements type: {Element#F64}. |
| 1931 | * @param X The input allocation contains vector x, supported elements type: {Element#F64}. |
| 1932 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 1933 | * @param beta The scalar beta. |
| 1934 | * @param Y The input allocation contains vector y, supported elements type: {Element#F64}. |
| 1935 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 1936 | */ |
| 1937 | void DGBMV(RsBlasTranspose TransA, |
| 1938 | int KL, int KU, double alpha, sp<Allocation> A, sp<Allocation> X, |
| 1939 | int incX, double beta, sp<Allocation> Y, int incY); |
| 1940 | |
| 1941 | /** |
| 1942 | * CGBMV performs one of the matrix-vector operations |
| 1943 | * y := alpha*A*x + beta*y or y := alpha*A**T*x + beta*y or y := alpha*A**H*x + beta*y |
| 1944 | * |
| 1945 | * Details: http://www.netlib.org/lapack/explore-html/d0/d75/cgbmv_8f.html |
| 1946 | * |
| 1947 | * Note: For a M*N matrix, the input Allocation should also be of size M*N (dimY = M, dimX = N), |
| 1948 | * but only the region M*(KL+KU+1) will be referenced. The following subroutine can is an |
| 1949 | * example showing how to convert the original matrix 'a' to row-based band matrix 'b'. |
| 1950 | * for i in range(0, m): |
| 1951 | * for j in range(max(0, i-kl), min(i+ku+1, n)): |
| 1952 | * b[i, j-i+kl] = a[i, j] |
| 1953 | * |
| 1954 | * @param TransA The type of transpose applied to matrix A. |
| 1955 | * @param KL The number of sub-diagonals of the matrix A. |
| 1956 | * @param KU The number of super-diagonals of the matrix A. |
| 1957 | * @param alpha The scalar alpha. |
| 1958 | * @param A The input allocation contains the band matrix A, supported elements type: {Element#F32_2}. |
| 1959 | * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}. |
| 1960 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 1961 | * @param beta The scalar beta. |
| 1962 | * @param Y The input allocation contains vector y, supported elements type: {Element#F32_2}. |
| 1963 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 1964 | */ |
| 1965 | void CGBMV(RsBlasTranspose TransA, |
| 1966 | int KL, int KU, Float2 alpha, sp<Allocation> A, sp<Allocation> X, |
| 1967 | int incX, Float2 beta, sp<Allocation> Y, int incY); |
| 1968 | |
| 1969 | /** |
| 1970 | * ZGBMV performs one of the matrix-vector operations |
| 1971 | * y := alpha*A*x + beta*y or y := alpha*A**T*x + beta*y or y := alpha*A**H*x + beta*y |
| 1972 | * |
| 1973 | * Details: http://www.netlib.org/lapack/explore-html/d9/d46/zgbmv_8f.html |
| 1974 | * |
| 1975 | * Note: For a M*N matrix, the input Allocation should also be of size M*N (dimY = M, dimX = N), |
| 1976 | * but only the region M*(KL+KU+1) will be referenced. The following subroutine can is an |
| 1977 | * example showing how to convert the original matrix 'a' to row-based band matrix 'b'. |
| 1978 | * for i in range(0, m): |
| 1979 | * for j in range(max(0, i-kl), min(i+ku+1, n)): |
| 1980 | * b[i, j-i+kl] = a[i, j] |
| 1981 | * |
| 1982 | * @param TransA The type of transpose applied to matrix A. |
| 1983 | * @param KL The number of sub-diagonals of the matrix A. |
| 1984 | * @param KU The number of super-diagonals of the matrix A. |
| 1985 | * @param alpha The scalar alpha. |
| 1986 | * @param A The input allocation contains the band matrix A, supported elements type: {Element#F64_2}. |
| 1987 | * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}. |
| 1988 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 1989 | * @param beta The scalar beta. |
| 1990 | * @param Y The input allocation contains vector y, supported elements type: {Element#F64_2}. |
| 1991 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 1992 | */ |
| 1993 | void ZGBMV(RsBlasTranspose TransA, |
| 1994 | int KL, int KU, Double2 alpha, sp<Allocation> A, sp<Allocation> X, int incX, |
| 1995 | Double2 beta, sp<Allocation> Y, int incY); |
| 1996 | |
| 1997 | /** |
| 1998 | * STRMV performs one of the matrix-vector operations |
| 1999 | * x := A*x or x := A**T*x |
| 2000 | * |
| 2001 | * Details: http://www.netlib.org/lapack/explore-html/de/d45/strmv_8f.html |
| 2002 | * |
| 2003 | * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. |
| 2004 | * @param TransA The type of transpose applied to matrix A. |
| 2005 | * @param Diag Specifies whether or not A is unit triangular. |
| 2006 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32}. |
| 2007 | * @param X The input allocation contains vector x, supported elements type: {Element#F32}. |
| 2008 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2009 | */ |
| 2010 | void STRMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 2011 | sp<Allocation> A, sp<Allocation> X, int incX); |
| 2012 | |
| 2013 | /** |
| 2014 | * DTRMV performs one of the matrix-vector operations |
| 2015 | * x := A*x or x := A**T*x |
| 2016 | * |
| 2017 | * Details: http://www.netlib.org/lapack/explore-html/dc/d7e/dtrmv_8f.html |
| 2018 | * |
| 2019 | * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. |
| 2020 | * @param TransA The type of transpose applied to matrix A. |
| 2021 | * @param Diag Specifies whether or not A is unit triangular. |
| 2022 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64}. |
| 2023 | * @param X The input allocation contains vector x, supported elements type: {Element#F64}. |
| 2024 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2025 | */ |
| 2026 | void DTRMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 2027 | sp<Allocation> A, sp<Allocation> X, int incX); |
| 2028 | |
| 2029 | /** |
| 2030 | * CTRMV performs one of the matrix-vector operations |
| 2031 | * x := A*x or x := A**T*x or x := A**H*x |
| 2032 | * |
| 2033 | * Details: http://www.netlib.org/lapack/explore-html/df/d78/ctrmv_8f.html |
| 2034 | * |
| 2035 | * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. |
| 2036 | * @param TransA The type of transpose applied to matrix A. |
| 2037 | * @param Diag Specifies whether or not A is unit triangular. |
| 2038 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}. |
| 2039 | * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}. |
| 2040 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2041 | */ |
| 2042 | void CTRMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 2043 | sp<Allocation> A, sp<Allocation> X, int incX); |
| 2044 | |
| 2045 | /** |
| 2046 | * ZTRMV performs one of the matrix-vector operations |
| 2047 | * x := A*x or x := A**T*x or x := A**H*x |
| 2048 | * |
| 2049 | * Details: http://www.netlib.org/lapack/explore-html/d0/dd1/ztrmv_8f.html |
| 2050 | * |
| 2051 | * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. |
| 2052 | * @param TransA The type of transpose applied to matrix A. |
| 2053 | * @param Diag Specifies whether or not A is unit triangular. |
| 2054 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}. |
| 2055 | * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}. |
| 2056 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2057 | */ |
| 2058 | void ZTRMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 2059 | sp<Allocation> A, sp<Allocation> X, int incX); |
| 2060 | |
| 2061 | /** |
| 2062 | * STBMV performs one of the matrix-vector operations |
| 2063 | * x := A*x or x := A**T*x |
| 2064 | * |
| 2065 | * Details: http://www.netlib.org/lapack/explore-html/d6/d7d/stbmv_8f.html |
| 2066 | * |
| 2067 | * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N), |
| 2068 | * but only the region N*(K+1) will be referenced. The following subroutine can is an |
| 2069 | * example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'. |
| 2070 | * for i in range(0, n): |
| 2071 | * for j in range(i, min(i+k+1, n)): |
| 2072 | * b[i, j-i] = a[i, j] |
| 2073 | * |
| 2074 | * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. |
| 2075 | * @param TransA The type of transpose applied to matrix A. |
| 2076 | * @param Diag Specifies whether or not A is unit triangular. |
| 2077 | * @param K The number of off-diagonals of the matrix A |
| 2078 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32}. |
| 2079 | * @param X The input allocation contains vector x, supported elements type: {Element#F32}. |
| 2080 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2081 | */ |
| 2082 | void STBMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 2083 | int K, sp<Allocation> A, sp<Allocation> X, int incX); |
| 2084 | |
| 2085 | /** |
| 2086 | * DTBMV performs one of the matrix-vector operations |
| 2087 | * x := A*x or x := A**T*x |
| 2088 | * |
| 2089 | * Details: http://www.netlib.org/lapack/explore-html/df/d29/dtbmv_8f.html |
| 2090 | * |
| 2091 | * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N), |
| 2092 | * but only the region N*(K+1) will be referenced. The following subroutine can is an |
| 2093 | * example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'. |
| 2094 | * for i in range(0, n): |
| 2095 | * for j in range(i, min(i+k+1, n)): |
| 2096 | * b[i, j-i] = a[i, j] |
| 2097 | * |
| 2098 | * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. |
| 2099 | * @param TransA The type of transpose applied to matrix A. |
| 2100 | * @param Diag Specifies whether or not A is unit triangular. |
| 2101 | * @param K The number of off-diagonals of the matrix A |
| 2102 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64}. |
| 2103 | * @param X The input allocation contains vector x, supported elements type: {Element#F64}. |
| 2104 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2105 | */ |
| 2106 | void DTBMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 2107 | int K, sp<Allocation> A, sp<Allocation> X, int incX); |
| 2108 | |
| 2109 | /** |
| 2110 | * CTBMV performs one of the matrix-vector operations |
| 2111 | * x := A*x or x := A**T*x or x := A**H*x |
| 2112 | * |
| 2113 | * Details: http://www.netlib.org/lapack/explore-html/d3/dcd/ctbmv_8f.html |
| 2114 | * |
| 2115 | * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N), |
| 2116 | * but only the region N*(K+1) will be referenced. The following subroutine can is an |
| 2117 | * example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'. |
| 2118 | * for i in range(0, n): |
| 2119 | * for j in range(i, min(i+k+1, n)): |
| 2120 | * b[i, j-i] = a[i, j] |
| 2121 | * |
| 2122 | * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. |
| 2123 | * @param TransA The type of transpose applied to matrix A. |
| 2124 | * @param Diag Specifies whether or not A is unit triangular. |
| 2125 | * @param K The number of off-diagonals of the matrix A |
| 2126 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}. |
| 2127 | * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}. |
| 2128 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2129 | */ |
| 2130 | void CTBMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 2131 | int K, sp<Allocation> A, sp<Allocation> X, int incX); |
| 2132 | |
| 2133 | /** |
| 2134 | * ZTBMV performs one of the matrix-vector operations |
| 2135 | * x := A*x or x := A**T*x or x := A**H*x |
| 2136 | * |
| 2137 | * Details: http://www.netlib.org/lapack/explore-html/d3/d39/ztbmv_8f.html |
| 2138 | * |
| 2139 | * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N), |
| 2140 | * but only the region N*(K+1) will be referenced. The following subroutine can is an |
| 2141 | * example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'. |
| 2142 | * for i in range(0, n): |
| 2143 | * for j in range(i, min(i+k+1, n)): |
| 2144 | * b[i, j-i] = a[i, j] |
| 2145 | * |
| 2146 | * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. |
| 2147 | * @param TransA The type of transpose applied to matrix A. |
| 2148 | * @param Diag Specifies whether or not A is unit triangular. |
| 2149 | * @param K The number of off-diagonals of the matrix A |
| 2150 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}. |
| 2151 | * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}. |
| 2152 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2153 | */ |
| 2154 | void ZTBMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 2155 | int K, sp<Allocation> A, sp<Allocation> X, int incX); |
| 2156 | |
| 2157 | /** |
| 2158 | * STPMV performs one of the matrix-vector operations |
| 2159 | * x := A*x or x := A**T*x |
| 2160 | * |
| 2161 | * Details: http://www.netlib.org/lapack/explore-html/db/db1/stpmv_8f.html |
| 2162 | * |
| 2163 | * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, |
| 2164 | * The following subroutine can is an example showing how to convert a UPPER trianglar matrix |
| 2165 | * 'a' to packed matrix 'b'. |
| 2166 | * k = 0 |
| 2167 | * for i in range(0, n): |
| 2168 | * for j in range(i, n): |
| 2169 | * b[k++] = a[i, j] |
| 2170 | * |
| 2171 | * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. |
| 2172 | * @param TransA The type of transpose applied to matrix A. |
| 2173 | * @param Diag Specifies whether or not A is unit triangular. |
| 2174 | * @param Ap The input allocation contains packed matrix A, supported elements type: {Element#F32}. |
| 2175 | * @param X The input allocation contains vector x, supported elements type: {Element#F32}. |
| 2176 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2177 | */ |
| 2178 | void STPMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 2179 | sp<Allocation> Ap, sp<Allocation> X, int incX); |
| 2180 | |
| 2181 | /** |
| 2182 | * DTPMV performs one of the matrix-vector operations |
| 2183 | * x := A*x or x := A**T*x |
| 2184 | * |
| 2185 | * Details: http://www.netlib.org/lapack/explore-html/dc/dcd/dtpmv_8f.html |
| 2186 | * |
| 2187 | * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, |
| 2188 | * The following subroutine can is an example showing how to convert a UPPER trianglar matrix |
| 2189 | * 'a' to packed matrix 'b'. |
| 2190 | * k = 0 |
| 2191 | * for i in range(0, n): |
| 2192 | * for j in range(i, n): |
| 2193 | * b[k++] = a[i, j] |
| 2194 | * |
| 2195 | * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. |
| 2196 | * @param TransA The type of transpose applied to matrix A. |
| 2197 | * @param Diag Specifies whether or not A is unit triangular. |
| 2198 | * @param Ap The input allocation contains packed matrix A, supported elements type: {Element#F64}. |
| 2199 | * @param X The input allocation contains vector x, supported elements type: {Element#F64}. |
| 2200 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2201 | */ |
| 2202 | void DTPMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 2203 | sp<Allocation> Ap, sp<Allocation> X, int incX); |
| 2204 | |
| 2205 | /** |
| 2206 | * CTPMV performs one of the matrix-vector operations |
| 2207 | * x := A*x or x := A**T*x or x := A**H*x |
| 2208 | * |
| 2209 | * Details: http://www.netlib.org/lapack/explore-html/d4/dbb/ctpmv_8f.html |
| 2210 | * |
| 2211 | * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, |
| 2212 | * The following subroutine can is an example showing how to convert a UPPER trianglar matrix |
| 2213 | * 'a' to packed matrix 'b'. |
| 2214 | * k = 0 |
| 2215 | * for i in range(0, n): |
| 2216 | * for j in range(i, n): |
| 2217 | * b[k++] = a[i, j] |
| 2218 | * |
| 2219 | * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. |
| 2220 | * @param TransA The type of transpose applied to matrix A. |
| 2221 | * @param Diag Specifies whether or not A is unit triangular. |
| 2222 | * @param Ap The input allocation contains packed matrix A, supported elements type: {Element#F32_2}. |
| 2223 | * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}. |
| 2224 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2225 | */ |
| 2226 | void CTPMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 2227 | sp<Allocation> Ap, sp<Allocation> X, int incX); |
| 2228 | |
| 2229 | /** |
| 2230 | * ZTPMV performs one of the matrix-vector operations |
| 2231 | * x := A*x or x := A**T*x or x := A**H*x |
| 2232 | * |
| 2233 | * Details: http://www.netlib.org/lapack/explore-html/d2/d9e/ztpmv_8f.html |
| 2234 | * |
| 2235 | * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, |
| 2236 | * The following subroutine can is an example showing how to convert a UPPER trianglar matrix |
| 2237 | * 'a' to packed matrix 'b'. |
| 2238 | * k = 0 |
| 2239 | * for i in range(0, n): |
| 2240 | * for j in range(i, n): |
| 2241 | * b[k++] = a[i, j] |
| 2242 | * |
| 2243 | * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. |
| 2244 | * @param TransA The type of transpose applied to matrix A. |
| 2245 | * @param Diag Specifies whether or not A is unit triangular. |
| 2246 | * @param Ap The input allocation contains packed matrix A, supported elements type: {Element#F64_2}. |
| 2247 | * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}. |
| 2248 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2249 | */ |
| 2250 | void ZTPMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 2251 | sp<Allocation> Ap, sp<Allocation> X, int incX); |
| 2252 | |
| 2253 | /** |
| 2254 | * STRSV solves one of the systems of equations |
| 2255 | * A*x = b or A**T*x = b |
| 2256 | * |
| 2257 | * Details: http://www.netlib.org/lapack/explore-html/d0/d2a/strsv_8f.html |
| 2258 | * |
| 2259 | * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. |
| 2260 | * @param TransA The type of transpose applied to matrix A. |
| 2261 | * @param Diag Specifies whether or not A is unit triangular. |
| 2262 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32}. |
| 2263 | * @param X The input allocation contains vector x, supported elements type: {Element#F32}. |
| 2264 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2265 | */ |
| 2266 | void STRSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 2267 | sp<Allocation> A, sp<Allocation> X, int incX); |
| 2268 | |
| 2269 | /** |
| 2270 | * DTRSV solves one of the systems of equations |
| 2271 | * A*x = b or A**T*x = b |
| 2272 | * |
| 2273 | * Details: http://www.netlib.org/lapack/explore-html/d6/d96/dtrsv_8f.html |
| 2274 | * |
| 2275 | * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. |
| 2276 | * @param TransA The type of transpose applied to matrix A. |
| 2277 | * @param Diag Specifies whether or not A is unit triangular. |
| 2278 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64}. |
| 2279 | * @param X The input allocation contains vector x, supported elements type: {Element#F64}. |
| 2280 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2281 | */ |
| 2282 | void DTRSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 2283 | sp<Allocation> A, sp<Allocation> X, int incX); |
| 2284 | |
| 2285 | /** |
| 2286 | * CTRSV solves one of the systems of equations |
| 2287 | * A*x = b or A**T*x = b or A**H*x = b |
| 2288 | * |
| 2289 | * Details: http://www.netlib.org/lapack/explore-html/d4/dc8/ctrsv_8f.html |
| 2290 | * |
| 2291 | * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. |
| 2292 | * @param TransA The type of transpose applied to matrix A. |
| 2293 | * @param Diag Specifies whether or not A is unit triangular. |
| 2294 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}. |
| 2295 | * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}. |
| 2296 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2297 | */ |
| 2298 | void CTRSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 2299 | sp<Allocation> A, sp<Allocation> X, int incX); |
| 2300 | |
| 2301 | /** |
| 2302 | * ZTRSV solves one of the systems of equations |
| 2303 | * A*x = b or A**T*x = b or A**H*x = b |
| 2304 | * |
| 2305 | * Details: http://www.netlib.org/lapack/explore-html/d1/d2f/ztrsv_8f.html |
| 2306 | * |
| 2307 | * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. |
| 2308 | * @param TransA The type of transpose applied to matrix A. |
| 2309 | * @param Diag Specifies whether or not A is unit triangular. |
| 2310 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}. |
| 2311 | * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}. |
| 2312 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2313 | */ |
| 2314 | void ZTRSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 2315 | sp<Allocation> A, sp<Allocation> X, int incX); |
| 2316 | |
| 2317 | /** |
| 2318 | * STBSV solves one of the systems of equations |
| 2319 | * A*x = b or A**T*x = b |
| 2320 | * |
| 2321 | * Details: http://www.netlib.org/lapack/explore-html/d0/d1f/stbsv_8f.html |
| 2322 | * |
| 2323 | * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N), |
| 2324 | * but only the region N*(K+1) will be referenced. The following subroutine can is an |
| 2325 | * example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'. |
| 2326 | * for i in range(0, n): |
| 2327 | * for j in range(i, min(i+k+1, n)): |
| 2328 | * b[i, j-i] = a[i, j] |
| 2329 | * |
| 2330 | * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. |
| 2331 | * @param TransA The type of transpose applied to matrix A. |
| 2332 | * @param Diag Specifies whether or not A is unit triangular. |
| 2333 | * @param K The number of off-diagonals of the matrix A |
| 2334 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32}. |
| 2335 | * @param X The input allocation contains vector x, supported elements type: {Element#F32}. |
| 2336 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2337 | */ |
| 2338 | void STBSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 2339 | int K, sp<Allocation> A, sp<Allocation> X, int incX); |
| 2340 | |
| 2341 | /** |
| 2342 | * DTBSV solves one of the systems of equations |
| 2343 | * A*x = b or A**T*x = b |
| 2344 | * |
| 2345 | * Details: http://www.netlib.org/lapack/explore-html/d4/dcf/dtbsv_8f.html |
| 2346 | * |
| 2347 | * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N), |
| 2348 | * but only the region N*(K+1) will be referenced. The following subroutine can is an |
| 2349 | * example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'. |
| 2350 | * for i in range(0, n): |
| 2351 | * for j in range(i, min(i+k+1, n)): |
| 2352 | * b[i, j-i] = a[i, j] |
| 2353 | * |
| 2354 | * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. |
| 2355 | * @param TransA The type of transpose applied to matrix A. |
| 2356 | * @param Diag Specifies whether or not A is unit triangular. |
| 2357 | * @param K The number of off-diagonals of the matrix A |
| 2358 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64}. |
| 2359 | * @param X The input allocation contains vector x, supported elements type: {Element#F64}. |
| 2360 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2361 | */ |
| 2362 | void DTBSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 2363 | int K, sp<Allocation> A, sp<Allocation> X, int incX); |
| 2364 | |
| 2365 | /** |
| 2366 | * CTBSV solves one of the systems of equations |
| 2367 | * A*x = b or A**T*x = b or A**H*x = b |
| 2368 | * |
| 2369 | * Details: http://www.netlib.org/lapack/explore-html/d9/d5f/ctbsv_8f.html |
| 2370 | * |
| 2371 | * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N), |
| 2372 | * but only the region N*(K+1) will be referenced. The following subroutine can is an |
| 2373 | * example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'. |
| 2374 | * for i in range(0, n): |
| 2375 | * for j in range(i, min(i+k+1, n)): |
| 2376 | * b[i, j-i] = a[i, j] |
| 2377 | * |
| 2378 | * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. |
| 2379 | * @param TransA The type of transpose applied to matrix A. |
| 2380 | * @param Diag Specifies whether or not A is unit triangular. |
| 2381 | * @param K The number of off-diagonals of the matrix A |
| 2382 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}. |
| 2383 | * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}. |
| 2384 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2385 | */ |
| 2386 | void CTBSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 2387 | int K, sp<Allocation> A, sp<Allocation> X, int incX); |
| 2388 | |
| 2389 | /** |
| 2390 | * ZTBSV solves one of the systems of equations |
| 2391 | * A*x = b or A**T*x = b or A**H*x = b |
| 2392 | * |
| 2393 | * Details: http://www.netlib.org/lapack/explore-html/d4/d5a/ztbsv_8f.html |
| 2394 | * |
| 2395 | * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N), |
| 2396 | * but only the region N*(K+1) will be referenced. The following subroutine can is an |
| 2397 | * example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'. |
| 2398 | * for i in range(0, n): |
| 2399 | * for j in range(i, min(i+k+1, n)): |
| 2400 | * b[i, j-i] = a[i, j] |
| 2401 | * |
| 2402 | * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. |
| 2403 | * @param TransA The type of transpose applied to matrix A. |
| 2404 | * @param Diag Specifies whether or not A is unit triangular. |
| 2405 | * @param K The number of off-diagonals of the matrix A |
| 2406 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}. |
| 2407 | * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}. |
| 2408 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2409 | */ |
| 2410 | void ZTBSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 2411 | int K, sp<Allocation> A, sp<Allocation> X, int incX); |
| 2412 | |
| 2413 | /** |
| 2414 | * STPSV solves one of the systems of equations |
| 2415 | * A*x = b or A**T*x = b |
| 2416 | * |
| 2417 | * Details: http://www.netlib.org/lapack/explore-html/d0/d7c/stpsv_8f.html |
| 2418 | * |
| 2419 | * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, |
| 2420 | * The following subroutine can is an example showing how to convert a UPPER trianglar matrix |
| 2421 | * 'a' to packed matrix 'b'. |
| 2422 | * k = 0 |
| 2423 | * for i in range(0, n): |
| 2424 | * for j in range(i, n): |
| 2425 | * b[k++] = a[i, j] |
| 2426 | * |
| 2427 | * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. |
| 2428 | * @param TransA The type of transpose applied to matrix A. |
| 2429 | * @param Diag Specifies whether or not A is unit triangular. |
| 2430 | * @param Ap The input allocation contains packed matrix A, supported elements type: {Element#F32}. |
| 2431 | * @param X The input allocation contains vector x, supported elements type: {Element#F32}. |
| 2432 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2433 | */ |
| 2434 | void STPSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 2435 | sp<Allocation> Ap, sp<Allocation> X, int incX); |
| 2436 | |
| 2437 | /** |
| 2438 | * DTPSV solves one of the systems of equations |
| 2439 | * A*x = b or A**T*x = b |
| 2440 | * |
| 2441 | * Details: http://www.netlib.org/lapack/explore-html/d9/d84/dtpsv_8f.html |
| 2442 | * |
| 2443 | * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, |
| 2444 | * The following subroutine can is an example showing how to convert a UPPER trianglar matrix |
| 2445 | * 'a' to packed matrix 'b'. |
| 2446 | * k = 0 |
| 2447 | * for i in range(0, n): |
| 2448 | * for j in range(i, n): |
| 2449 | * b[k++] = a[i, j] |
| 2450 | * |
| 2451 | * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. |
| 2452 | * @param TransA The type of transpose applied to matrix A. |
| 2453 | * @param Diag Specifies whether or not A is unit triangular. |
| 2454 | * @param Ap The input allocation contains packed matrix A, supported elements type: {Element#F64}. |
| 2455 | * @param X The input allocation contains vector x, supported elements type: {Element#F64}. |
| 2456 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2457 | */ |
| 2458 | void DTPSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 2459 | sp<Allocation> Ap, sp<Allocation> X, int incX); |
| 2460 | |
| 2461 | /** |
| 2462 | * CTPSV solves one of the systems of equations |
| 2463 | * A*x = b or A**T*x = b or A**H*x = b |
| 2464 | * |
| 2465 | * Details: http://www.netlib.org/lapack/explore-html/d8/d56/ctpsv_8f.html |
| 2466 | * |
| 2467 | * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, |
| 2468 | * The following subroutine can is an example showing how to convert a UPPER trianglar matrix |
| 2469 | * 'a' to packed matrix 'b'. |
| 2470 | * k = 0 |
| 2471 | * for i in range(0, n): |
| 2472 | * for j in range(i, n): |
| 2473 | * b[k++] = a[i, j] |
| 2474 | * |
| 2475 | * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. |
| 2476 | * @param TransA The type of transpose applied to matrix A. |
| 2477 | * @param Diag Specifies whether or not A is unit triangular. |
| 2478 | * @param Ap The input allocation contains packed matrix A, supported elements type: {Element#F32_2}. |
| 2479 | * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}. |
| 2480 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2481 | */ |
| 2482 | void CTPSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 2483 | sp<Allocation> Ap, sp<Allocation> X, int incX); |
| 2484 | |
| 2485 | /** |
| 2486 | * ZTPSV solves one of the systems of equations |
| 2487 | * A*x = b or A**T*x = b or A**H*x = b |
| 2488 | * |
| 2489 | * Details: http://www.netlib.org/lapack/explore-html/da/d57/ztpsv_8f.html |
| 2490 | * |
| 2491 | * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, |
| 2492 | * The following subroutine can is an example showing how to convert a UPPER trianglar matrix |
| 2493 | * 'a' to packed matrix 'b'. |
| 2494 | * k = 0 |
| 2495 | * for i in range(0, n): |
| 2496 | * for j in range(i, n): |
| 2497 | * b[k++] = a[i, j] |
| 2498 | * |
| 2499 | * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix. |
| 2500 | * @param TransA The type of transpose applied to matrix A. |
| 2501 | * @param Diag Specifies whether or not A is unit triangular. |
| 2502 | * @param Ap The input allocation contains packed matrix A, supported elements type: {Element#F64_2}. |
| 2503 | * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}. |
| 2504 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2505 | */ |
| 2506 | void ZTPSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 2507 | sp<Allocation> Ap, sp<Allocation> X, int incX); |
| 2508 | |
| 2509 | /** |
| 2510 | * SSYMV performs the matrix-vector operation |
| 2511 | * y := alpha*A*x + beta*y |
| 2512 | * |
| 2513 | * Details: http://www.netlib.org/lapack/explore-html/d2/d94/ssymv_8f.html |
| 2514 | * |
| 2515 | * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. |
| 2516 | * @param alpha The scalar alpha. |
| 2517 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32}. |
| 2518 | * @param X The input allocation contains vector x, supported elements type: {Element#F32}. |
| 2519 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2520 | * @param beta The scalar beta. |
| 2521 | * @param Y The input allocation contains vector y, supported elements type: {Element#F32}. |
| 2522 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 2523 | */ |
| 2524 | void SSYMV(RsBlasUplo Uplo, float alpha, sp<Allocation> A, sp<Allocation> X, |
| 2525 | int incX, float beta, sp<Allocation> Y, int incY); |
| 2526 | |
| 2527 | /** |
| 2528 | * SSBMV performs the matrix-vector operation |
| 2529 | * y := alpha*A*x + beta*y |
| 2530 | * |
| 2531 | * Details: http://www.netlib.org/lapack/explore-html/d3/da1/ssbmv_8f.html |
| 2532 | * |
| 2533 | * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N), |
| 2534 | * but only the region N*(K+1) will be referenced. The following subroutine can is an |
| 2535 | * example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'. |
| 2536 | * for i in range(0, n): |
| 2537 | * for j in range(i, min(i+k+1, n)): |
| 2538 | * b[i, j-i] = a[i, j] |
| 2539 | * |
| 2540 | * @param Uplo Specifies whether the upper or lower triangular part of the band matrix A is being supplied. |
| 2541 | * @param K The number of off-diagonals of the matrix A |
| 2542 | * @param alpha The scalar alpha. |
| 2543 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32}. |
| 2544 | * @param X The input allocation contains vector x, supported elements type: {Element#F32}. |
| 2545 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2546 | * @param beta The scalar beta. |
| 2547 | * @param Y The input allocation contains vector y, supported elements type: {Element#F32}. |
| 2548 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 2549 | */ |
| 2550 | void SSBMV(RsBlasUplo Uplo, int K, float alpha, sp<Allocation> A, sp<Allocation> X, |
| 2551 | int incX, float beta, sp<Allocation> Y, int incY); |
| 2552 | |
| 2553 | /** |
| 2554 | * SSPMV performs the matrix-vector operation |
| 2555 | * y := alpha*A*x + beta*y |
| 2556 | * |
| 2557 | * Details: http://www.netlib.org/lapack/explore-html/d8/d68/sspmv_8f.html |
| 2558 | * |
| 2559 | * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, |
| 2560 | * The following subroutine can is an example showing how to convert a UPPER trianglar matrix |
| 2561 | * 'a' to packed matrix 'b'. |
| 2562 | * k = 0 |
| 2563 | * for i in range(0, n): |
| 2564 | * for j in range(i, n): |
| 2565 | * b[k++] = a[i, j] |
| 2566 | * |
| 2567 | * @param Uplo Specifies whether the upper or lower triangular part of the matrix A is supplied in packed form. |
| 2568 | * @param alpha The scalar alpha. |
| 2569 | * @param Ap The input allocation contains matrix A, supported elements type: {Element#F32}. |
| 2570 | * @param X The input allocation contains vector x, supported elements type: {Element#F32}. |
| 2571 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2572 | * @param beta The scalar beta. |
| 2573 | * @param Y The input allocation contains vector y, supported elements type: {Element#F32}. |
| 2574 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 2575 | */ |
| 2576 | void SSPMV(RsBlasUplo Uplo, float alpha, sp<Allocation> Ap, sp<Allocation> X, |
| 2577 | int incX, float beta, sp<Allocation> Y, int incY); |
| 2578 | |
| 2579 | /** |
| 2580 | * SGER performs the rank 1 operation |
| 2581 | * A := alpha*x*y**T + A |
| 2582 | * |
| 2583 | * Details: http://www.netlib.org/lapack/explore-html/db/d5c/sger_8f.html |
| 2584 | * |
| 2585 | * @param alpha The scalar alpha. |
| 2586 | * @param X The input allocation contains vector x, supported elements type: {Element#F32}. |
| 2587 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2588 | * @param Y The input allocation contains vector y, supported elements type: {Element#F32}. |
| 2589 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 2590 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32}. |
| 2591 | */ |
| 2592 | void SGER(float alpha, sp<Allocation> X, int incX, sp<Allocation> Y, int incY, sp<Allocation> A); |
| 2593 | |
| 2594 | /** |
| 2595 | * SSYR performs the rank 1 operation |
| 2596 | * A := alpha*x*x**T + A |
| 2597 | * |
| 2598 | * Details: http://www.netlib.org/lapack/explore-html/d6/dac/ssyr_8f.html |
| 2599 | * |
| 2600 | * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. |
| 2601 | * @param alpha The scalar alpha. |
| 2602 | * @param X The input allocation contains vector x, supported elements type: {Element#F32}. |
| 2603 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2604 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32}. |
| 2605 | */ |
| 2606 | void SSYR(RsBlasUplo Uplo, float alpha, sp<Allocation> X, int incX, sp<Allocation> A); |
| 2607 | |
| 2608 | /** |
| 2609 | * SSPR performs the rank 1 operation |
| 2610 | * A := alpha*x*x**T + A |
| 2611 | * |
| 2612 | * Details: http://www.netlib.org/lapack/explore-html/d2/d9b/sspr_8f.html |
| 2613 | * |
| 2614 | * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, |
| 2615 | * The following subroutine can is an example showing how to convert a UPPER trianglar matrix |
| 2616 | * 'a' to packed matrix 'b'. |
| 2617 | * k = 0 |
| 2618 | * for i in range(0, n): |
| 2619 | * for j in range(i, n): |
| 2620 | * b[k++] = a[i, j] |
| 2621 | * |
| 2622 | * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form. |
| 2623 | * @param alpha The scalar alpha. |
| 2624 | * @param X The input allocation contains vector x, supported elements type: {Element#F32}. |
| 2625 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2626 | * @param Ap The input allocation contains matrix A, supported elements type: {Element#F32}. |
| 2627 | */ |
| 2628 | void SSPR(RsBlasUplo Uplo, float alpha, sp<Allocation> X, int incX, sp<Allocation> Ap); |
| 2629 | |
| 2630 | /** |
| 2631 | * SSYR2 performs the symmetric rank 2 operation |
| 2632 | * A := alpha*x*y**T + alpha*y*x**T + A |
| 2633 | * |
| 2634 | * Details: http://www.netlib.org/lapack/explore-html/db/d99/ssyr2_8f.html |
| 2635 | * |
| 2636 | * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. |
| 2637 | * @param alpha The scalar alpha. |
| 2638 | * @param X The input allocation contains vector x, supported elements type: {Element#F32}. |
| 2639 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2640 | * @param Y The input allocation contains vector y, supported elements type: {Element#F32}. |
| 2641 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 2642 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32}. |
| 2643 | */ |
| 2644 | void SSYR2(RsBlasUplo Uplo, float alpha, sp<Allocation> X, int incX, |
| 2645 | sp<Allocation> Y, int incY, sp<Allocation> A); |
| 2646 | |
| 2647 | /** |
| 2648 | * SSPR2 performs the symmetric rank 2 operation |
| 2649 | * A := alpha*x*y**T + alpha*y*x**T + A |
| 2650 | * |
| 2651 | * Details: http://www.netlib.org/lapack/explore-html/db/d3e/sspr2_8f.html |
| 2652 | * |
| 2653 | * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, |
| 2654 | * The following subroutine can is an example showing how to convert a UPPER trianglar matrix |
| 2655 | * 'a' to packed matrix 'b'. |
| 2656 | * k = 0 |
| 2657 | * for i in range(0, n): |
| 2658 | * for j in range(i, n): |
| 2659 | * b[k++] = a[i, j] |
| 2660 | * |
| 2661 | * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form. |
| 2662 | * @param alpha The scalar alpha. |
| 2663 | * @param X The input allocation contains vector x, supported elements type: {Element#F32}. |
| 2664 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2665 | * @param Y The input allocation contains vector y, supported elements type: {Element#F32}. |
| 2666 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 2667 | * @param Ap The input allocation contains matrix A, supported elements type: {Element#F32}. |
| 2668 | */ |
| 2669 | void SSPR2(RsBlasUplo Uplo, float alpha, sp<Allocation> X, int incX, |
| 2670 | sp<Allocation> Y, int incY, sp<Allocation> Ap); |
| 2671 | |
| 2672 | /** |
| 2673 | * DSYMV performs the matrix-vector operation |
| 2674 | * y := alpha*A*x + beta*y |
| 2675 | * |
| 2676 | * Details: http://www.netlib.org/lapack/explore-html/d8/dbe/dsymv_8f.html |
| 2677 | * |
| 2678 | * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. |
| 2679 | * @param alpha The scalar alpha. |
| 2680 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64}. |
| 2681 | * @param X The input allocation contains vector x, supported elements type: {Element#F64}. |
| 2682 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2683 | * @param beta The scalar beta. |
| 2684 | * @param Y The input allocation contains vector y, supported elements type: {Element#F64}. |
| 2685 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 2686 | */ |
| 2687 | void DSYMV(RsBlasUplo Uplo, double alpha, sp<Allocation> A, sp<Allocation> X, int incX, |
| 2688 | double beta, sp<Allocation> Y, int incY); |
| 2689 | |
| 2690 | /** |
| 2691 | * DSBMV performs the matrix-vector operation |
| 2692 | * y := alpha*A*x + beta*y |
| 2693 | * |
| 2694 | * Details: http://www.netlib.org/lapack/explore-html/d8/d1e/dsbmv_8f.html |
| 2695 | * |
| 2696 | * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N), |
| 2697 | * but only the region N*(K+1) will be referenced. The following subroutine can is an |
| 2698 | * example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'. |
| 2699 | * for i in range(0, n): |
| 2700 | * for j in range(i, min(i+k+1, n)): |
| 2701 | * b[i, j-i] = a[i, j] |
| 2702 | * |
| 2703 | * @param Uplo Specifies whether the upper or lower triangular part of the band matrix A is being supplied. |
| 2704 | * @param K The number of off-diagonals of the matrix A |
| 2705 | * @param alpha The scalar alpha. |
| 2706 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64}. |
| 2707 | * @param X The input allocation contains vector x, supported elements type: {Element#F64}. |
| 2708 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2709 | * @param beta The scalar beta. |
| 2710 | * @param Y The input allocation contains vector y, supported elements type: {Element#F64}. |
| 2711 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 2712 | */ |
| 2713 | void DSBMV(RsBlasUplo Uplo, int K, double alpha, sp<Allocation> A, sp<Allocation> X, int incX, |
| 2714 | double beta, sp<Allocation> Y, int incY); |
| 2715 | |
| 2716 | /** |
| 2717 | * DSPMV performs the matrix-vector operation |
| 2718 | * y := alpha*A*x + beta*y |
| 2719 | * |
| 2720 | * Details: http://www.netlib.org/lapack/explore-html/d4/d85/dspmv_8f.html |
| 2721 | * |
| 2722 | * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, |
| 2723 | * The following subroutine can is an example showing how to convert a UPPER trianglar matrix |
| 2724 | * 'a' to packed matrix 'b'. |
| 2725 | * k = 0 |
| 2726 | * for i in range(0, n): |
| 2727 | * for j in range(i, n): |
| 2728 | * b[k++] = a[i, j] |
| 2729 | * |
| 2730 | * @param Uplo Specifies whether the upper or lower triangular part of the matrix A is supplied in packed form. |
| 2731 | * @param alpha The scalar alpha. |
| 2732 | * @param Ap The input allocation contains matrix A, supported elements type: {Element#F64}. |
| 2733 | * @param X The input allocation contains vector x, supported elements type: {Element#F64}. |
| 2734 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2735 | * @param beta The scalar beta. |
| 2736 | * @param Y The input allocation contains vector y, supported elements type: {Element#F64}. |
| 2737 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 2738 | */ |
| 2739 | void DSPMV(RsBlasUplo Uplo, double alpha, sp<Allocation> Ap, sp<Allocation> X, int incX, |
| 2740 | double beta, sp<Allocation> Y, int incY); |
| 2741 | |
| 2742 | /** |
| 2743 | * DGER performs the rank 1 operation |
| 2744 | * A := alpha*x*y**T + A |
| 2745 | * |
| 2746 | * Details: http://www.netlib.org/lapack/explore-html/dc/da8/dger_8f.html |
| 2747 | * |
| 2748 | * @param alpha The scalar alpha. |
| 2749 | * @param X The input allocation contains vector x, supported elements type: {Element#F64}. |
| 2750 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2751 | * @param Y The input allocation contains vector y, supported elements type: {Element#F64}. |
| 2752 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 2753 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64}. |
| 2754 | */ |
| 2755 | void DGER(double alpha, sp<Allocation> X, int incX, sp<Allocation> Y, int incY, sp<Allocation> A); |
| 2756 | |
| 2757 | /** |
| 2758 | * DSYR performs the rank 1 operation |
| 2759 | * A := alpha*x*x**T + A |
| 2760 | * |
| 2761 | * Details: http://www.netlib.org/lapack/explore-html/d3/d60/dsyr_8f.html |
| 2762 | * |
| 2763 | * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. |
| 2764 | * @param alpha The scalar alpha. |
| 2765 | * @param X The input allocation contains vector x, supported elements type: {Element#F64}. |
| 2766 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2767 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64}. |
| 2768 | */ |
| 2769 | void DSYR(RsBlasUplo Uplo, double alpha, sp<Allocation> X, int incX, sp<Allocation> A); |
| 2770 | |
| 2771 | /** |
| 2772 | * DSPR performs the rank 1 operation |
| 2773 | * A := alpha*x*x**T + A |
| 2774 | * |
| 2775 | * Details: http://www.netlib.org/lapack/explore-html/dd/dba/dspr_8f.html |
| 2776 | * |
| 2777 | * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, |
| 2778 | * The following subroutine can is an example showing how to convert a UPPER trianglar matrix |
| 2779 | * 'a' to packed matrix 'b'. |
| 2780 | * k = 0 |
| 2781 | * for i in range(0, n): |
| 2782 | * for j in range(i, n): |
| 2783 | * b[k++] = a[i, j] |
| 2784 | * |
| 2785 | * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form. |
| 2786 | * @param alpha The scalar alpha. |
| 2787 | * @param X The input allocation contains vector x, supported elements type: {Element#F64}. |
| 2788 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2789 | * @param Ap The input allocation contains matrix A, supported elements type: {Element#F64}. |
| 2790 | */ |
| 2791 | void DSPR(RsBlasUplo Uplo, double alpha, sp<Allocation> X, int incX, sp<Allocation> Ap); |
| 2792 | |
| 2793 | /** |
| 2794 | * DSYR2 performs the symmetric rank 2 operation |
| 2795 | * A := alpha*x*y**T + alpha*y*x**T + A |
| 2796 | * |
| 2797 | * Details: http://www.netlib.org/lapack/explore-html/de/d41/dsyr2_8f.html |
| 2798 | * |
| 2799 | * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. |
| 2800 | * @param alpha The scalar alpha. |
| 2801 | * @param X The input allocation contains vector x, supported elements type: {Element#F64}. |
| 2802 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2803 | * @param Y The input allocation contains vector y, supported elements type: {Element#F64}. |
| 2804 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 2805 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64}. |
| 2806 | */ |
| 2807 | void DSYR2(RsBlasUplo Uplo, double alpha, sp<Allocation> X, int incX, |
| 2808 | sp<Allocation> Y, int incY, sp<Allocation> A); |
| 2809 | |
| 2810 | /** |
| 2811 | * DSPR2 performs the symmetric rank 2 operation |
| 2812 | * A := alpha*x*y**T + alpha*y*x**T + A |
| 2813 | * |
| 2814 | * Details: http://www.netlib.org/lapack/explore-html/dd/d9e/dspr2_8f.html |
| 2815 | * |
| 2816 | * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, |
| 2817 | * The following subroutine can is an example showing how to convert a UPPER trianglar matrix |
| 2818 | * 'a' to packed matrix 'b'. |
| 2819 | * k = 0 |
| 2820 | * for i in range(0, n): |
| 2821 | * for j in range(i, n): |
| 2822 | * b[k++] = a[i, j] |
| 2823 | * |
| 2824 | * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form. |
| 2825 | * @param alpha The scalar alpha. |
| 2826 | * @param X The input allocation contains vector x, supported elements type: {Element#F64}. |
| 2827 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2828 | * @param Y The input allocation contains vector y, supported elements type: {Element#F64}. |
| 2829 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 2830 | * @param Ap The input allocation contains matrix A, supported elements type: {Element#F64}. |
| 2831 | */ |
| 2832 | void DSPR2(RsBlasUplo Uplo, double alpha, sp<Allocation> X, int incX, |
| 2833 | sp<Allocation> Y, int incY, sp<Allocation> Ap); |
| 2834 | |
| 2835 | /** |
| 2836 | * CHEMV performs the matrix-vector operation |
| 2837 | * y := alpha*A*x + beta*y |
| 2838 | * |
| 2839 | * Details: http://www.netlib.org/lapack/explore-html/d7/d51/chemv_8f.html |
| 2840 | * |
| 2841 | * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. |
| 2842 | * @param alpha The scalar alpha. |
| 2843 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}. |
| 2844 | * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}. |
| 2845 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2846 | * @param beta The scalar beta. |
| 2847 | * @param Y The input allocation contains vector y, supported elements type: {Element#F32_2}. |
| 2848 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 2849 | */ |
| 2850 | void CHEMV(RsBlasUplo Uplo, Float2 alpha, sp<Allocation> A, sp<Allocation> X, |
| 2851 | int incX, Float2 beta, sp<Allocation> Y, int incY); |
| 2852 | |
| 2853 | /** |
| 2854 | * CHBMV performs the matrix-vector operation |
| 2855 | * y := alpha*A*x + beta*y |
| 2856 | * |
| 2857 | * Details: http://www.netlib.org/lapack/explore-html/db/dc2/chbmv_8f.html |
| 2858 | * |
| 2859 | * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N), |
| 2860 | * but only the region N*(K+1) will be referenced. The following subroutine can is an |
| 2861 | * example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'. |
| 2862 | * for i in range(0, n): |
| 2863 | * for j in range(i, min(i+k+1, n)): |
| 2864 | * b[i, j-i] = a[i, j] |
| 2865 | * |
| 2866 | * @param Uplo Specifies whether the upper or lower triangular part of the band matrix A is being supplied. |
| 2867 | * @param K The number of off-diagonals of the matrix A |
| 2868 | * @param alpha The scalar alpha. |
| 2869 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}. |
| 2870 | * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}. |
| 2871 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2872 | * @param beta The scalar beta. |
| 2873 | * @param Y The input allocation contains vector y, supported elements type: {Element#F32_2}. |
| 2874 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 2875 | */ |
| 2876 | void CHBMV(RsBlasUplo Uplo, int K, Float2 alpha, sp<Allocation> A, sp<Allocation> X, |
| 2877 | int incX, Float2 beta, sp<Allocation> Y, int incY); |
| 2878 | |
| 2879 | /** |
| 2880 | * CHPMV performs the matrix-vector operation |
| 2881 | * y := alpha*A*x + beta*y |
| 2882 | * |
| 2883 | * Details: http://www.netlib.org/lapack/explore-html/d2/d06/chpmv_8f.html |
| 2884 | * |
| 2885 | * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, |
| 2886 | * The following subroutine can is an example showing how to convert a UPPER trianglar matrix |
| 2887 | * 'a' to packed matrix 'b'. |
| 2888 | * k = 0 |
| 2889 | * for i in range(0, n): |
| 2890 | * for j in range(i, n): |
| 2891 | * b[k++] = a[i, j] |
| 2892 | * |
| 2893 | * @param Uplo Specifies whether the upper or lower triangular part of the matrix A is supplied in packed form. |
| 2894 | * @param alpha The scalar alpha. |
| 2895 | * @param Ap The input allocation contains matrix A, supported elements type: {Element#F32_2}. |
| 2896 | * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}. |
| 2897 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2898 | * @param beta The scalar beta. |
| 2899 | * @param Y The input allocation contains vector y, supported elements type: {Element#F32_2}. |
| 2900 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 2901 | */ |
| 2902 | void CHPMV(RsBlasUplo Uplo, Float2 alpha, sp<Allocation> Ap, sp<Allocation> X, |
| 2903 | int incX, Float2 beta, sp<Allocation> Y, int incY); |
| 2904 | |
| 2905 | /** |
| 2906 | * CGERU performs the rank 1 operation |
| 2907 | * A := alpha*x*y**T + A |
| 2908 | * |
| 2909 | * Details: http://www.netlib.org/lapack/explore-html/db/d5f/cgeru_8f.html |
| 2910 | * |
| 2911 | * @param alpha The scalar alpha. |
| 2912 | * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}. |
| 2913 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2914 | * @param Y The input allocation contains vector y, supported elements type: {Element#F32_2}. |
| 2915 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 2916 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}. |
| 2917 | */ |
| 2918 | void CGERU(Float2 alpha, sp<Allocation> X, int incX, |
| 2919 | sp<Allocation> Y, int incY, sp<Allocation> A); |
| 2920 | |
| 2921 | /** |
| 2922 | * CGERC performs the rank 1 operation |
| 2923 | * A := alpha*x*y**H + A |
| 2924 | * |
| 2925 | * Details: http://www.netlib.org/lapack/explore-html/dd/d84/cgerc_8f.html |
| 2926 | * |
| 2927 | * @param alpha The scalar alpha. |
| 2928 | * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}. |
| 2929 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2930 | * @param Y The input allocation contains vector y, supported elements type: {Element#F32_2}. |
| 2931 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 2932 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}. |
| 2933 | */ |
| 2934 | void CGERC(Float2 alpha, sp<Allocation> X, int incX, |
| 2935 | sp<Allocation> Y, int incY, sp<Allocation> A); |
| 2936 | |
| 2937 | /** |
| 2938 | * CHER performs the rank 1 operation |
| 2939 | * A := alpha*x*x**H + A |
| 2940 | * |
| 2941 | * Details: http://www.netlib.org/lapack/explore-html/d3/d6d/cher_8f.html |
| 2942 | * |
| 2943 | * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. |
| 2944 | * @param alpha The scalar alpha. |
| 2945 | * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}. |
| 2946 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2947 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}. |
| 2948 | */ |
| 2949 | void CHER(RsBlasUplo Uplo, float alpha, sp<Allocation> X, int incX, sp<Allocation> A); |
| 2950 | |
| 2951 | /** |
| 2952 | * CHPR performs the rank 1 operation |
| 2953 | * A := alpha*x*x**H + A |
| 2954 | * |
| 2955 | * Details: http://www.netlib.org/lapack/explore-html/db/dcd/chpr_8f.html |
| 2956 | * |
| 2957 | * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, |
| 2958 | * The following subroutine can is an example showing how to convert a UPPER trianglar matrix |
| 2959 | * 'a' to packed matrix 'b'. |
| 2960 | * k = 0 |
| 2961 | * for i in range(0, n): |
| 2962 | * for j in range(i, n): |
| 2963 | * b[k++] = a[i, j] |
| 2964 | * |
| 2965 | * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form. |
| 2966 | * @param alpha The scalar alpha. |
| 2967 | * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}. |
| 2968 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2969 | * @param Ap The input allocation contains matrix A, supported elements type: {Element#F32_2}. |
| 2970 | */ |
| 2971 | void CHPR(RsBlasUplo Uplo, float alpha, sp<Allocation> X, int incX, sp<Allocation> Ap); |
| 2972 | |
| 2973 | /** |
| 2974 | * CHER2 performs the symmetric rank 2 operation |
| 2975 | * A := alpha*x*y**H + alpha*y*x**H + A |
| 2976 | * |
| 2977 | * Details: http://www.netlib.org/lapack/explore-html/db/d87/cher2_8f.html |
| 2978 | * |
| 2979 | * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. |
| 2980 | * @param alpha The scalar alpha. |
| 2981 | * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}. |
| 2982 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 2983 | * @param Y The input allocation contains vector y, supported elements type: {Element#F32_2}. |
| 2984 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 2985 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}. |
| 2986 | */ |
| 2987 | void CHER2(RsBlasUplo Uplo, Float2 alpha, sp<Allocation> X, int incX, |
| 2988 | sp<Allocation> Y, int incY, sp<Allocation> A); |
| 2989 | |
| 2990 | /** |
| 2991 | * CHPR2 performs the symmetric rank 2 operation |
| 2992 | * A := alpha*x*y**H + alpha*y*x**H + A |
| 2993 | * |
| 2994 | * Details: http://www.netlib.org/lapack/explore-html/d6/d44/chpr2_8f.html |
| 2995 | * |
| 2996 | * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, |
| 2997 | * The following subroutine can is an example showing how to convert a UPPER trianglar matrix |
| 2998 | * 'a' to packed matrix 'b'. |
| 2999 | * k = 0 |
| 3000 | * for i in range(0, n): |
| 3001 | * for j in range(i, n): |
| 3002 | * b[k++] = a[i, j] |
| 3003 | * |
| 3004 | * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form. |
| 3005 | * @param alpha The scalar alpha. |
| 3006 | * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}. |
| 3007 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 3008 | * @param Y The input allocation contains vector y, supported elements type: {Element#F32_2}. |
| 3009 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 3010 | * @param Ap The input allocation contains matrix A, supported elements type: {Element#F32_2}. |
| 3011 | */ |
| 3012 | void CHPR2(RsBlasUplo Uplo, Float2 alpha, sp<Allocation> X, int incX, |
| 3013 | sp<Allocation> Y, int incY, sp<Allocation> Ap); |
| 3014 | |
| 3015 | /** |
| 3016 | * ZHEMV performs the matrix-vector operation |
| 3017 | * y := alpha*A*x + beta*y |
| 3018 | * |
| 3019 | * Details: http://www.netlib.org/lapack/explore-html/d0/ddd/zhemv_8f.html |
| 3020 | * |
| 3021 | * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. |
| 3022 | * @param alpha The scalar alpha. |
| 3023 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}. |
| 3024 | * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}. |
| 3025 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 3026 | * @param beta The scalar beta. |
| 3027 | * @param Y The input allocation contains vector y, supported elements type: {Element#F64_2}. |
| 3028 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 3029 | */ |
| 3030 | void ZHEMV(RsBlasUplo Uplo, Double2 alpha, sp<Allocation> A, sp<Allocation> X, |
| 3031 | int incX, Double2 beta, sp<Allocation> Y, int incY); |
| 3032 | |
| 3033 | /** |
| 3034 | * ZHBMV performs the matrix-vector operation |
| 3035 | * y := alpha*A*x + beta*y |
| 3036 | * |
| 3037 | * Details: http://www.netlib.org/lapack/explore-html/d3/d1a/zhbmv_8f.html |
| 3038 | * |
| 3039 | * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N), |
| 3040 | * but only the region N*(K+1) will be referenced. The following subroutine can is an |
| 3041 | * example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'. |
| 3042 | * for i in range(0, n): |
| 3043 | * for j in range(i, min(i+k+1, n)): |
| 3044 | * b[i, j-i] = a[i, j] |
| 3045 | * |
| 3046 | * @param Uplo Specifies whether the upper or lower triangular part of the band matrix A is being supplied. |
| 3047 | * @param K The number of off-diagonals of the matrix A |
| 3048 | * @param alpha The scalar alpha. |
| 3049 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}. |
| 3050 | * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}. |
| 3051 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 3052 | * @param beta The scalar beta. |
| 3053 | * @param Y The input allocation contains vector y, supported elements type: {Element#F64_2}. |
| 3054 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 3055 | */ |
| 3056 | void ZHBMV(RsBlasUplo Uplo, int K, Double2 alpha, sp<Allocation> A, sp<Allocation> X, |
| 3057 | int incX, Double2 beta, sp<Allocation> Y, int incY); |
| 3058 | |
| 3059 | /** |
| 3060 | * ZHPMV performs the matrix-vector operation |
| 3061 | * y := alpha*A*x + beta*y |
| 3062 | * |
| 3063 | * Details: http://www.netlib.org/lapack/explore-html/d0/d60/zhpmv_8f.html |
| 3064 | * |
| 3065 | * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, |
| 3066 | * The following subroutine can is an example showing how to convert a UPPER trianglar matrix |
| 3067 | * 'a' to packed matrix 'b'. |
| 3068 | * k = 0 |
| 3069 | * for i in range(0, n): |
| 3070 | * for j in range(i, n): |
| 3071 | * b[k++] = a[i, j] |
| 3072 | * |
| 3073 | * @param Uplo Specifies whether the upper or lower triangular part of the matrix A is supplied in packed form. |
| 3074 | * @param alpha The scalar alpha. |
| 3075 | * @param Ap The input allocation contains matrix A, supported elements type: {Element#F64_2}. |
| 3076 | * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}. |
| 3077 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 3078 | * @param beta The scalar beta. |
| 3079 | * @param Y The input allocation contains vector y, supported elements type: {Element#F64_2}. |
| 3080 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 3081 | */ |
| 3082 | void ZHPMV(RsBlasUplo Uplo, Double2 alpha, sp<Allocation> Ap, sp<Allocation> X, |
| 3083 | int incX, Double2 beta, sp<Allocation> Y, int incY); |
| 3084 | |
| 3085 | /** |
| 3086 | * ZGERU performs the rank 1 operation |
| 3087 | * A := alpha*x*y**T + A |
| 3088 | * |
| 3089 | * Details: http://www.netlib.org/lapack/explore-html/d7/d12/zgeru_8f.html |
| 3090 | * |
| 3091 | * @param alpha The scalar alpha. |
| 3092 | * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}. |
| 3093 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 3094 | * @param Y The input allocation contains vector y, supported elements type: {Element#F64_2}. |
| 3095 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 3096 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}. |
| 3097 | */ |
| 3098 | void ZGERU(Double2 alpha, sp<Allocation> X, int incX, |
| 3099 | sp<Allocation> Y, int incY, sp<Allocation> A); |
| 3100 | |
| 3101 | /** |
| 3102 | * ZGERC performs the rank 1 operation |
| 3103 | * A := alpha*x*y**H + A |
| 3104 | * |
| 3105 | * Details: http://www.netlib.org/lapack/explore-html/d3/dad/zgerc_8f.html |
| 3106 | * |
| 3107 | * @param alpha The scalar alpha. |
| 3108 | * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}. |
| 3109 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 3110 | * @param Y The input allocation contains vector y, supported elements type: {Element#F64_2}. |
| 3111 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 3112 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}. |
| 3113 | */ |
| 3114 | void ZGERC(Double2 alpha, sp<Allocation> X, int incX, |
| 3115 | sp<Allocation> Y, int incY, sp<Allocation> A); |
| 3116 | |
| 3117 | /** |
| 3118 | * ZHER performs the rank 1 operation |
| 3119 | * A := alpha*x*x**H + A |
| 3120 | * |
| 3121 | * Details: http://www.netlib.org/lapack/explore-html/de/d0e/zher_8f.html |
| 3122 | * |
| 3123 | * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. |
| 3124 | * @param alpha The scalar alpha. |
| 3125 | * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}. |
| 3126 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 3127 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}. |
| 3128 | */ |
| 3129 | void ZHER(RsBlasUplo Uplo, double alpha, sp<Allocation> X, int incX, sp<Allocation> A); |
| 3130 | |
| 3131 | /** |
| 3132 | * ZHPR performs the rank 1 operation |
| 3133 | * A := alpha*x*x**H + A |
| 3134 | * |
| 3135 | * Details: http://www.netlib.org/lapack/explore-html/de/de1/zhpr_8f.html |
| 3136 | * |
| 3137 | * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, |
| 3138 | * The following subroutine can is an example showing how to convert a UPPER trianglar matrix |
| 3139 | * 'a' to packed matrix 'b'. |
| 3140 | * k = 0 |
| 3141 | * for i in range(0, n): |
| 3142 | * for j in range(i, n): |
| 3143 | * b[k++] = a[i, j] |
| 3144 | * |
| 3145 | * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form. |
| 3146 | * @param alpha The scalar alpha. |
| 3147 | * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}. |
| 3148 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 3149 | * @param Ap The input allocation contains matrix A, supported elements type: {Element#F64_2}. |
| 3150 | */ |
| 3151 | void ZHPR(RsBlasUplo Uplo, double alpha, sp<Allocation> X, int incX, sp<Allocation> Ap); |
| 3152 | |
| 3153 | /** |
| 3154 | * ZHER2 performs the symmetric rank 2 operation |
| 3155 | * A := alpha*x*y**H + alpha*y*x**H + A |
| 3156 | * |
| 3157 | * Details: http://www.netlib.org/lapack/explore-html/da/d8a/zher2_8f.html |
| 3158 | * |
| 3159 | * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. |
| 3160 | * @param alpha The scalar alpha. |
| 3161 | * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}. |
| 3162 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 3163 | * @param Y The input allocation contains vector y, supported elements type: {Element#F64_2}. |
| 3164 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 3165 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}. |
| 3166 | */ |
| 3167 | void ZHER2(RsBlasUplo Uplo, Double2 alpha, sp<Allocation> X, int incX, |
| 3168 | sp<Allocation> Y, int incY, sp<Allocation> A); |
| 3169 | |
| 3170 | /** |
| 3171 | * ZHPR2 performs the symmetric rank 2 operation |
| 3172 | * A := alpha*x*y**H + alpha*y*x**H + A |
| 3173 | * |
| 3174 | * Details: http://www.netlib.org/lapack/explore-html/d5/d52/zhpr2_8f.html |
| 3175 | * |
| 3176 | * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2, |
| 3177 | * The following subroutine can is an example showing how to convert a UPPER trianglar matrix |
| 3178 | * 'a' to packed matrix 'b'. |
| 3179 | * k = 0 |
| 3180 | * for i in range(0, n): |
| 3181 | * for j in range(i, n): |
| 3182 | * b[k++] = a[i, j] |
| 3183 | * |
| 3184 | * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form. |
| 3185 | * @param alpha The scalar alpha. |
| 3186 | * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}. |
| 3187 | * @param incX The increment for the elements of vector x, must be larger than zero. |
| 3188 | * @param Y The input allocation contains vector y, supported elements type: {Element#F64_2}. |
| 3189 | * @param incY The increment for the elements of vector y, must be larger than zero. |
| 3190 | * @param Ap The input allocation contains matrix A, supported elements type: {Element#F64_2}. |
| 3191 | */ |
| 3192 | void ZHPR2(RsBlasUplo Uplo, Double2 alpha, sp<Allocation> X, int incX, |
| 3193 | sp<Allocation> Y, int incY, sp<Allocation> Ap); |
| 3194 | |
| 3195 | /** |
| 3196 | * SGEMM performs one of the matrix-matrix operations |
| 3197 | * C := alpha*op(A)*op(B) + beta*C where op(X) is one of op(X) = X or op(X) = X**T |
| 3198 | * |
| 3199 | * Details: http://www.netlib.org/lapack/explore-html/d4/de2/sgemm_8f.html |
| 3200 | * |
| 3201 | * @param TransA The type of transpose applied to matrix A. |
| 3202 | * @param TransB The type of transpose applied to matrix B. |
| 3203 | * @param alpha The scalar alpha. |
| 3204 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32}. |
| 3205 | * @param B The input allocation contains matrix B, supported elements type: {Element#F32}. |
| 3206 | * @param beta The scalar beta. |
| 3207 | * @param C The input allocation contains matrix C, supported elements type: {Element#F32}. |
| 3208 | */ |
| 3209 | void SGEMM(RsBlasTranspose TransA, RsBlasTranspose TransB, float alpha, sp<Allocation> A, |
| 3210 | sp<Allocation> B, float beta, sp<Allocation> C); |
| 3211 | |
| 3212 | |
| 3213 | /** |
| 3214 | * DGEMM performs one of the matrix-matrix operations |
| 3215 | * C := alpha*op(A)*op(B) + beta*C where op(X) is one of op(X) = X or op(X) = X**T |
| 3216 | * |
| 3217 | * Details: http://www.netlib.org/lapack/explore-html/d7/d2b/dgemm_8f.html |
| 3218 | * |
| 3219 | * @param TransA The type of transpose applied to matrix A. |
| 3220 | * @param TransB The type of transpose applied to matrix B. |
| 3221 | * @param alpha The scalar alpha. |
| 3222 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64}. |
| 3223 | * @param B The input allocation contains matrix B, supported elements type: {Element#F64}. |
| 3224 | * @param beta The scalar beta. |
| 3225 | * @param C The input allocation contains matrix C, supported elements type: {Element#F64}. |
| 3226 | */ |
| 3227 | void DGEMM(RsBlasTranspose TransA, RsBlasTranspose TransB, double alpha, sp<Allocation> A, |
| 3228 | sp<Allocation> B, double beta, sp<Allocation> C); |
| 3229 | |
| 3230 | /** |
| 3231 | * CGEMM performs one of the matrix-matrix operations |
| 3232 | * C := alpha*op(A)*op(B) + beta*C where op(X) is one of op(X) = X or op(X) = X**T or op(X) = X**H |
| 3233 | * |
| 3234 | * Details: http://www.netlib.org/lapack/explore-html/d6/d5b/cgemm_8f.html |
| 3235 | * |
| 3236 | * @param TransA The type of transpose applied to matrix A. |
| 3237 | * @param TransB The type of transpose applied to matrix B. |
| 3238 | * @param alpha The scalar alpha. |
| 3239 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}. |
| 3240 | * @param B The input allocation contains matrix B, supported elements type: {Element#F32_2}. |
| 3241 | * @param beta The scalar beta. |
| 3242 | * @param C The input allocation contains matrix C, supported elements type: {Element#F32_2}. |
| 3243 | */ |
| 3244 | void CGEMM(RsBlasTranspose TransA, RsBlasTranspose TransB, Float2 alpha, sp<Allocation> A, |
| 3245 | sp<Allocation> B, Float2 beta, sp<Allocation> C); |
| 3246 | |
| 3247 | /** |
| 3248 | * ZGEMM performs one of the matrix-matrix operations |
| 3249 | * C := alpha*op(A)*op(B) + beta*C where op(X) is one of op(X) = X or op(X) = X**T or op(X) = X**H |
| 3250 | * |
| 3251 | * Details: http://www.netlib.org/lapack/explore-html/d7/d76/zgemm_8f.html |
| 3252 | * |
| 3253 | * @param TransA The type of transpose applied to matrix A. |
| 3254 | * @param TransB The type of transpose applied to matrix B. |
| 3255 | * @param alpha The scalar alpha. |
| 3256 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2 |
| 3257 | * @param B The input allocation contains matrix B, supported elements type: {Element#F64_2 |
| 3258 | * @param beta The scalar beta. |
| 3259 | * @param C The input allocation contains matrix C, supported elements type: {Element#F64_2 |
| 3260 | */ |
| 3261 | void ZGEMM(RsBlasTranspose TransA, RsBlasTranspose TransB, Double2 alpha, sp<Allocation> A, |
| 3262 | sp<Allocation> B, Double2 beta, sp<Allocation> C); |
| 3263 | |
| 3264 | /** |
| 3265 | * SSYMM performs one of the matrix-matrix operations |
| 3266 | * C := alpha*A*B + beta*C or C := alpha*B*A + beta*C |
| 3267 | * |
| 3268 | * Details: http://www.netlib.org/lapack/explore-html/d7/d42/ssymm_8f.html |
| 3269 | * |
| 3270 | * @param Side Specifies whether the symmetric matrix A appears on the left or right. |
| 3271 | * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. |
| 3272 | * @param alpha The scalar alpha. |
| 3273 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32}. |
| 3274 | * @param B The input allocation contains matrix B, supported elements type: {Element#F32}. |
| 3275 | * @param beta The scalar beta. |
| 3276 | * @param C The input allocation contains matrix C, supported elements type: {Element#F32}. |
| 3277 | */ |
| 3278 | void SSYMM(RsBlasSide Side, RsBlasUplo Uplo, float alpha, sp<Allocation> A, |
| 3279 | sp<Allocation> B, float beta, sp<Allocation> C); |
| 3280 | |
| 3281 | /** |
| 3282 | * DSYMM performs one of the matrix-matrix operations |
| 3283 | * C := alpha*A*B + beta*C or C := alpha*B*A + beta*C |
| 3284 | * |
| 3285 | * Details: http://www.netlib.org/lapack/explore-html/d8/db0/dsymm_8f.html |
| 3286 | * |
| 3287 | * @param Side Specifies whether the symmetric matrix A appears on the left or right. |
| 3288 | * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. |
| 3289 | * @param alpha The scalar alpha. |
| 3290 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64}. |
| 3291 | * @param B The input allocation contains matrix B, supported elements type: {Element#F64}. |
| 3292 | * @param beta The scalar beta. |
| 3293 | * @param C The input allocation contains matrix C, supported elements type: {Element#F64}. |
| 3294 | */ |
| 3295 | void DSYMM(RsBlasSide Side, RsBlasUplo Uplo, double alpha, sp<Allocation> A, |
| 3296 | sp<Allocation> B, double beta, sp<Allocation> C); |
| 3297 | |
| 3298 | /** |
| 3299 | * CSYMM performs one of the matrix-matrix operations |
| 3300 | * C := alpha*A*B + beta*C or C := alpha*B*A + beta*C |
| 3301 | * |
| 3302 | * Details: http://www.netlib.org/lapack/explore-html/db/d59/csymm_8f.html |
| 3303 | * |
| 3304 | * @param Side Specifies whether the symmetric matrix A appears on the left or right. |
| 3305 | * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. |
| 3306 | * @param alpha The scalar alpha. |
| 3307 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}. |
| 3308 | * @param B The input allocation contains matrix B, supported elements type: {Element#F32_2}. |
| 3309 | * @param beta The scalar beta. |
| 3310 | * @param C The input allocation contains matrix C, supported elements type: {Element#F32_2}. |
| 3311 | */ |
| 3312 | void CSYMM(RsBlasSide Side, RsBlasUplo Uplo, Float2 alpha, sp<Allocation> A, |
| 3313 | sp<Allocation> B, Float2 beta, sp<Allocation> C); |
| 3314 | |
| 3315 | /** |
| 3316 | * ZSYMM performs one of the matrix-matrix operations |
| 3317 | * C := alpha*A*B + beta*C or C := alpha*B*A + beta*C |
| 3318 | * |
| 3319 | * Details: http://www.netlib.org/lapack/explore-html/df/d51/zsymm_8f.html |
| 3320 | * |
| 3321 | * @param Side Specifies whether the symmetric matrix A appears on the left or right. |
| 3322 | * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. |
| 3323 | * @param alpha The scalar alpha. |
| 3324 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}. |
| 3325 | * @param B The input allocation contains matrix B, supported elements type: {Element#F64_2}. |
| 3326 | * @param beta The scalar beta. |
| 3327 | * @param C The input allocation contains matrix C, supported elements type: {Element#F64_2}. |
| 3328 | */ |
| 3329 | void ZSYMM(RsBlasSide Side, RsBlasUplo Uplo, Double2 alpha, sp<Allocation> A, |
| 3330 | sp<Allocation> B, Double2 beta, sp<Allocation> C); |
| 3331 | |
| 3332 | /** |
| 3333 | * SSYRK performs one of the symmetric rank k operations |
| 3334 | * C := alpha*A*A**T + beta*C or C := alpha*A**T*A + beta*C |
| 3335 | * |
| 3336 | * Details: http://www.netlib.org/lapack/explore-html/d0/d40/ssyrk_8f.html |
| 3337 | * |
| 3338 | * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced. |
| 3339 | * @param Trans The type of transpose applied to the operation. |
| 3340 | * @param alpha The scalar alpha. |
| 3341 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32}. |
| 3342 | * @param beta The scalar beta. |
| 3343 | * @param C The input allocation contains matrix C, supported elements type: {Element#F32}. |
| 3344 | */ |
| 3345 | void SSYRK(RsBlasUplo Uplo, RsBlasTranspose Trans, float alpha, |
| 3346 | sp<Allocation> A, float beta, sp<Allocation> C); |
| 3347 | |
| 3348 | /** |
| 3349 | * DSYRK performs one of the symmetric rank k operations |
| 3350 | * C := alpha*A*A**T + beta*C or C := alpha*A**T*A + beta*C |
| 3351 | * |
| 3352 | * Details: http://www.netlib.org/lapack/explore-html/dc/d05/dsyrk_8f.html |
| 3353 | * |
| 3354 | * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced. |
| 3355 | * @param Trans The type of transpose applied to the operation. |
| 3356 | * @param alpha The scalar alpha. |
| 3357 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64}. |
| 3358 | * @param beta The scalar beta. |
| 3359 | * @param C The input allocation contains matrix C, supported elements type: {Element#F64}. |
| 3360 | */ |
| 3361 | void DSYRK(RsBlasUplo Uplo, RsBlasTranspose Trans, double alpha, |
| 3362 | sp<Allocation> A, double beta, sp<Allocation> C); |
| 3363 | |
| 3364 | /** |
| 3365 | * CSYRK performs one of the symmetric rank k operations |
| 3366 | * C := alpha*A*A**T + beta*C or C := alpha*A**T*A + beta*C |
| 3367 | * |
| 3368 | * Details: http://www.netlib.org/lapack/explore-html/d3/d6a/csyrk_8f.html |
| 3369 | * |
| 3370 | * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced. |
| 3371 | * @param Trans The type of transpose applied to the operation. |
| 3372 | * @param alpha The scalar alpha. |
| 3373 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}. |
| 3374 | * @param beta The scalar beta. |
| 3375 | * @param C The input allocation contains matrix C, supported elements type: {Element#F32_2}. |
| 3376 | */ |
| 3377 | void CSYRK(RsBlasUplo Uplo, RsBlasTranspose Trans, Float2 alpha, |
| 3378 | sp<Allocation> A, Float2 beta, sp<Allocation> C); |
| 3379 | |
| 3380 | /** |
| 3381 | * ZSYRK performs one of the symmetric rank k operations |
| 3382 | * C := alpha*A*A**T + beta*C or C := alpha*A**T*A + beta*C |
| 3383 | * |
| 3384 | * Details: http://www.netlib.org/lapack/explore-html/de/d54/zsyrk_8f.html |
| 3385 | * |
| 3386 | * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced. |
| 3387 | * @param Trans The type of transpose applied to the operation. |
| 3388 | * @param alpha The scalar alpha. |
| 3389 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}. |
| 3390 | * @param beta The scalar beta. |
| 3391 | * @param C The input allocation contains matrix C, supported elements type: {Element#F64_2}. |
| 3392 | */ |
| 3393 | void ZSYRK(RsBlasUplo Uplo, RsBlasTranspose Trans, Double2 alpha, |
| 3394 | sp<Allocation> A, Double2 beta, sp<Allocation> C); |
| 3395 | |
| 3396 | /** |
| 3397 | * SSYR2K performs one of the symmetric rank 2k operations |
| 3398 | * C := alpha*A*B**T + alpha*B*A**T + beta*C or C := alpha*A**T*B + alpha*B**T*A + beta*C |
| 3399 | * |
| 3400 | * Details: http://www.netlib.org/lapack/explore-html/df/d3d/ssyr2k_8f.html |
| 3401 | * |
| 3402 | * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced. |
| 3403 | * @param Trans The type of transpose applied to the operation. |
| 3404 | * @param alpha The scalar alpha. |
| 3405 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32}. |
| 3406 | * @param B The input allocation contains matrix B, supported elements type: {Element#F32}. |
| 3407 | * @param beta The scalar beta. |
| 3408 | * @param C The input allocation contains matrix C, supported elements type: {Element#F32}. |
| 3409 | */ |
| 3410 | void SSYR2K(RsBlasUplo Uplo, RsBlasTranspose Trans, float alpha, |
| 3411 | sp<Allocation> A, sp<Allocation> B, float beta, sp<Allocation> C); |
| 3412 | |
| 3413 | /** |
| 3414 | * DSYR2K performs one of the symmetric rank 2k operations |
| 3415 | * C := alpha*A*B**T + alpha*B*A**T + beta*C or C := alpha*A**T*B + alpha*B**T*A + beta*C |
| 3416 | * |
| 3417 | * Details: http://www.netlib.org/lapack/explore-html/d1/dec/dsyr2k_8f.html |
| 3418 | * |
| 3419 | * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced. |
| 3420 | * @param Trans The type of transpose applied to the operation. |
| 3421 | * @param alpha The scalar alpha. |
| 3422 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64}. |
| 3423 | * @param B The input allocation contains matrix B, supported elements type: {Element#F64}. |
| 3424 | * @param beta The scalar beta. |
| 3425 | * @param C The input allocation contains matrix C, supported elements type: {Element#F64}. |
| 3426 | */ |
| 3427 | void DSYR2K(RsBlasUplo Uplo, RsBlasTranspose Trans, double alpha, |
| 3428 | sp<Allocation> A, sp<Allocation> B, double beta, sp<Allocation> C); |
| 3429 | |
| 3430 | /** |
| 3431 | * CSYR2K performs one of the symmetric rank 2k operations |
| 3432 | * C := alpha*A*B**T + alpha*B*A**T + beta*C or C := alpha*A**T*B + alpha*B**T*A + beta*C |
| 3433 | * |
| 3434 | * Details: http://www.netlib.org/lapack/explore-html/de/d7e/csyr2k_8f.html |
| 3435 | * |
| 3436 | * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced. |
| 3437 | * @param Trans The type of transpose applied to the operation. |
| 3438 | * @param alpha The scalar alpha. |
| 3439 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}. |
| 3440 | * @param B The input allocation contains matrix B, supported elements type: {Element#F32_2}. |
| 3441 | * @param beta The scalar beta. |
| 3442 | * @param C The input allocation contains matrix C, supported elements type: {Element#F32_2}. |
| 3443 | */ |
| 3444 | void CSYR2K(RsBlasUplo Uplo, RsBlasTranspose Trans, Float2 alpha, |
| 3445 | sp<Allocation> A, sp<Allocation> B, Float2 beta, sp<Allocation> C); |
| 3446 | |
| 3447 | /** |
| 3448 | * ZSYR2K performs one of the symmetric rank 2k operations |
| 3449 | * C := alpha*A*B**T + alpha*B*A**T + beta*C or C := alpha*A**T*B + alpha*B**T*A + beta*C |
| 3450 | * |
| 3451 | * Details: http://www.netlib.org/lapack/explore-html/df/d20/zsyr2k_8f.html |
| 3452 | * |
| 3453 | * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced. |
| 3454 | * @param Trans The type of transpose applied to the operation. |
| 3455 | * @param alpha The scalar alpha. |
| 3456 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}. |
| 3457 | * @param B The input allocation contains matrix B, supported elements type: {Element#F64_2}. |
| 3458 | * @param beta The scalar beta. |
| 3459 | * @param C The input allocation contains matrix C, supported elements type: {Element#F64_2}. |
| 3460 | */ |
| 3461 | void ZSYR2K(RsBlasUplo Uplo, RsBlasTranspose Trans, Double2 alpha, |
| 3462 | sp<Allocation> A, sp<Allocation> B, Double2 beta, sp<Allocation> C); |
| 3463 | |
| 3464 | /** |
| 3465 | * STRMM performs one of the matrix-matrix operations |
| 3466 | * B := alpha*op(A)*B or B := alpha*B*op(A) |
| 3467 | * op(A) is one of op(A) = A or op(A) = A**T |
| 3468 | * |
| 3469 | * Details: http://www.netlib.org/lapack/explore-html/df/d01/strmm_8f.html |
| 3470 | * |
| 3471 | * @param Side Specifies whether the symmetric matrix A appears on the left or right. |
| 3472 | * @param Uplo Specifies whether matrix A is upper or lower triangular. |
| 3473 | * @param TransA The type of transpose applied to matrix A. |
| 3474 | * @param Diag Specifies whether or not A is unit triangular. |
| 3475 | * @param alpha The scalar alpha. |
| 3476 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32}. |
| 3477 | * @param B The input allocation contains matrix B, supported elements type: {Element#F32}. |
| 3478 | */ |
| 3479 | void STRMM(RsBlasSide Side, RsBlasUplo Uplo, RsBlasTranspose TransA, |
| 3480 | RsBlasDiag Diag, float alpha, sp<Allocation> A, sp<Allocation> B); |
| 3481 | |
| 3482 | /** |
| 3483 | * DTRMM performs one of the matrix-matrix operations |
| 3484 | * B := alpha*op(A)*B or B := alpha*B*op(A) |
| 3485 | * op(A) is one of op(A) = A or op(A) = A**T |
| 3486 | * |
| 3487 | * Details: http://www.netlib.org/lapack/explore-html/dd/d19/dtrmm_8f.html |
| 3488 | * |
| 3489 | * @param Side Specifies whether the symmetric matrix A appears on the left or right. |
| 3490 | * @param Uplo Specifies whether matrix A is upper or lower triangular. |
| 3491 | * @param TransA The type of transpose applied to matrix A. |
| 3492 | * @param Diag Specifies whether or not A is unit triangular. |
| 3493 | * @param alpha The scalar alpha. |
| 3494 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64}. |
| 3495 | * @param B The input allocation contains matrix B, supported elements type: {Element#F64}. |
| 3496 | */ |
| 3497 | void DTRMM(RsBlasSide Side, RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 3498 | double alpha, sp<Allocation> A, sp<Allocation> B); |
| 3499 | |
| 3500 | /** |
| 3501 | * CTRMM performs one of the matrix-matrix operations |
| 3502 | * B := alpha*op(A)*B or B := alpha*B*op(A) |
| 3503 | * op(A) is one of op(A) = A or op(A) = A**T or op(A) = A**H |
| 3504 | * |
| 3505 | * Details: http://www.netlib.org/lapack/explore-html/d4/d9b/ctrmm_8f.html |
| 3506 | * |
| 3507 | * @param Side Specifies whether the symmetric matrix A appears on the left or right. |
| 3508 | * @param Uplo Specifies whether matrix A is upper or lower triangular. |
| 3509 | * @param TransA The type of transpose applied to matrix A. |
| 3510 | * @param Diag Specifies whether or not A is unit triangular. |
| 3511 | * @param alpha The scalar alpha. |
| 3512 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}. |
| 3513 | * @param B The input allocation contains matrix B, supported elements type: {Element#F32_2}. |
| 3514 | */ |
| 3515 | void CTRMM(RsBlasSide Side, RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 3516 | Float2 alpha, sp<Allocation> A, sp<Allocation> B); |
| 3517 | |
| 3518 | /** |
| 3519 | * ZTRMM performs one of the matrix-matrix operations |
| 3520 | * B := alpha*op(A)*B or B := alpha*B*op(A) |
| 3521 | * op(A) is one of op(A) = A or op(A) = A**T or op(A) = A**H |
| 3522 | * |
| 3523 | * Details: http://www.netlib.org/lapack/explore-html/d8/de1/ztrmm_8f.html |
| 3524 | * |
| 3525 | * @param Side Specifies whether the symmetric matrix A appears on the left or right. |
| 3526 | * @param Uplo Specifies whether matrix A is upper or lower triangular. |
| 3527 | * @param TransA The type of transpose applied to matrix A. |
| 3528 | * @param Diag Specifies whether or not A is unit triangular. |
| 3529 | * @param alpha The scalar alpha. |
| 3530 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}. |
| 3531 | * @param B The input allocation contains matrix B, supported elements type: {Element#F64_2}. |
| 3532 | */ |
| 3533 | void ZTRMM(RsBlasSide Side, RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 3534 | Double2 alpha, sp<Allocation> A, sp<Allocation> B); |
| 3535 | |
| 3536 | /** |
| 3537 | * STRSM solves one of the matrix equations |
| 3538 | * op(A)*X := alpha*B or X*op(A) := alpha*B |
| 3539 | * op(A) is one of op(A) = A or op(A) = A**T |
| 3540 | * |
| 3541 | * Details: http://www.netlib.org/lapack/explore-html/d2/d8b/strsm_8f.html |
| 3542 | * |
| 3543 | * @param Side Specifies whether the symmetric matrix A appears on the left or right. |
| 3544 | * @param Uplo Specifies whether matrix A is upper or lower triangular. |
| 3545 | * @param TransA The type of transpose applied to matrix A. |
| 3546 | * @param Diag Specifies whether or not A is unit triangular. |
| 3547 | * @param alpha The scalar alpha. |
| 3548 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32}. |
| 3549 | * @param B The input allocation contains matrix B, supported elements type: {Element#F32}. |
| 3550 | */ |
| 3551 | void STRSM(RsBlasSide Side, RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 3552 | float alpha, sp<Allocation> A, sp<Allocation> B); |
| 3553 | |
| 3554 | /** |
| 3555 | * DTRSM solves one of the matrix equations |
| 3556 | * op(A)*X := alpha*B or X*op(A) := alpha*B |
| 3557 | * op(A) is one of op(A) = A or op(A) = A**T |
| 3558 | * |
| 3559 | * Details: http://www.netlib.org/lapack/explore-html/de/da7/dtrsm_8f.html |
| 3560 | * |
| 3561 | * @param Side Specifies whether the symmetric matrix A appears on the left or right. |
| 3562 | * @param Uplo Specifies whether matrix A is upper or lower triangular. |
| 3563 | * @param TransA The type of transpose applied to matrix A. |
| 3564 | * @param Diag Specifies whether or not A is unit triangular. |
| 3565 | * @param alpha The scalar alpha. |
| 3566 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64}. |
| 3567 | * @param B The input allocation contains matrix B, supported elements type: {Element#F64}. |
| 3568 | */ |
| 3569 | void DTRSM(RsBlasSide Side, RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 3570 | double alpha, sp<Allocation> A, sp<Allocation> B); |
| 3571 | |
| 3572 | /** |
| 3573 | * CTRSM solves one of the matrix equations |
| 3574 | * op(A)*X := alpha*B or X*op(A) := alpha*B |
| 3575 | * op(A) is one of op(A) = A or op(A) = A**T or op(A) = A**H |
| 3576 | * |
| 3577 | * Details: http://www.netlib.org/lapack/explore-html/de/d30/ctrsm_8f.html |
| 3578 | * |
| 3579 | * @param Side Specifies whether the symmetric matrix A appears on the left or right. |
| 3580 | * @param Uplo Specifies whether matrix A is upper or lower triangular. |
| 3581 | * @param TransA The type of transpose applied to matrix A. |
| 3582 | * @param Diag Specifies whether or not A is unit triangular. |
| 3583 | * @param alpha The scalar alpha. |
| 3584 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}. |
| 3585 | * @param B The input allocation contains matrix B, supported elements type: {Element#F32_2}. |
| 3586 | */ |
| 3587 | void CTRSM(RsBlasSide Side, RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 3588 | Float2 alpha, sp<Allocation> A, sp<Allocation> B); |
| 3589 | |
| 3590 | /** |
| 3591 | * ZTRSM solves one of the matrix equations |
| 3592 | * op(A)*X := alpha*B or X*op(A) := alpha*B |
| 3593 | * op(A) is one of op(A) = A or op(A) = A**T or op(A) = A**H |
| 3594 | * |
| 3595 | * Details: http://www.netlib.org/lapack/explore-html/d1/d39/ztrsm_8f.html |
| 3596 | * |
| 3597 | * @param Side Specifies whether the symmetric matrix A appears on the left or right. |
| 3598 | * @param Uplo Specifies whether matrix A is upper or lower triangular. |
| 3599 | * @param TransA The type of transpose applied to matrix A. |
| 3600 | * @param Diag Specifies whether or not A is unit triangular. |
| 3601 | * @param alpha The scalar alpha. |
| 3602 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}. |
| 3603 | * @param B The input allocation contains matrix B, supported elements type: {Element#F64_2}. |
| 3604 | */ |
| 3605 | void ZTRSM(RsBlasSide Side, RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag, |
| 3606 | Double2 alpha, sp<Allocation> A, sp<Allocation> B); |
| 3607 | |
| 3608 | /** |
| 3609 | * CHEMM performs one of the matrix-matrix operations |
| 3610 | * C := alpha*A*B + beta*C or C := alpha*B*A + beta*C |
| 3611 | * |
| 3612 | * Details: http://www.netlib.org/lapack/explore-html/d3/d66/chemm_8f.html |
| 3613 | * |
| 3614 | * @param Side Specifies whether the symmetric matrix A appears on the left or right. |
| 3615 | * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. |
| 3616 | * @param alpha The scalar alpha. |
| 3617 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}. |
| 3618 | * @param B The input allocation contains matrix B, supported elements type: {Element#F32_2}. |
| 3619 | * @param beta The scalar beta. |
| 3620 | * @param C The input allocation contains matrix C, supported elements type: {Element#F32_2}. |
| 3621 | */ |
| 3622 | void CHEMM(RsBlasSide Side, RsBlasUplo Uplo, Float2 alpha, sp<Allocation> A, |
| 3623 | sp<Allocation> B, Float2 beta, sp<Allocation> C); |
| 3624 | |
| 3625 | /** |
| 3626 | * ZHEMM performs one of the matrix-matrix operations |
| 3627 | * C := alpha*A*B + beta*C or C := alpha*B*A + beta*C |
| 3628 | * |
| 3629 | * Details: http://www.netlib.org/lapack/explore-html/d6/d3e/zhemm_8f.html |
| 3630 | * |
| 3631 | * @param Side Specifies whether the symmetric matrix A appears on the left or right. |
| 3632 | * @param Uplo Specifies whether the upper or lower triangular part is to be referenced. |
| 3633 | * @param alpha The scalar alpha. |
| 3634 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}. |
| 3635 | * @param B The input allocation contains matrix B, supported elements type: {Element#F64_2}. |
| 3636 | * @param beta The scalar beta. |
| 3637 | * @param C The input allocation contains matrix C, supported elements type: {Element#F64_2}. |
| 3638 | */ |
| 3639 | void ZHEMM(RsBlasSide Side, RsBlasUplo Uplo, Double2 alpha, sp<Allocation> A, |
| 3640 | sp<Allocation> B, Double2 beta, sp<Allocation> C); |
| 3641 | |
| 3642 | /** |
| 3643 | * CHERK performs one of the hermitian rank k operations |
| 3644 | * C := alpha*A*A**H + beta*C or C := alpha*A**H*A + beta*C |
| 3645 | * |
| 3646 | * Details: http://www.netlib.org/lapack/explore-html/d8/d52/cherk_8f.html |
| 3647 | * |
| 3648 | * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced. |
| 3649 | * @param Trans The type of transpose applied to the operation. |
| 3650 | * @param alpha The scalar alpha. |
| 3651 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}. |
| 3652 | * @param beta The scalar beta. |
| 3653 | * @param C The input allocation contains matrix C, supported elements type: {Element#F32_2}. |
| 3654 | */ |
| 3655 | void CHERK(RsBlasUplo Uplo, RsBlasTranspose Trans, float alpha, sp<Allocation> A, |
| 3656 | float beta, sp<Allocation> C); |
| 3657 | |
| 3658 | /** |
| 3659 | * ZHERK performs one of the hermitian rank k operations |
| 3660 | * C := alpha*A*A**H + beta*C or C := alpha*A**H*A + beta*C |
| 3661 | * |
| 3662 | * Details: http://www.netlib.org/lapack/explore-html/d1/db1/zherk_8f.html |
| 3663 | * |
| 3664 | * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced. |
| 3665 | * @param Trans The type of transpose applied to the operation. |
| 3666 | * @param alpha The scalar alpha. |
| 3667 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}. |
| 3668 | * @param beta The scalar beta. |
| 3669 | * @param C The input allocation contains matrix C, supported elements type: {Element#F64_2}. |
| 3670 | */ |
| 3671 | void ZHERK(RsBlasUplo Uplo, RsBlasTranspose Trans, double alpha, sp<Allocation> A, |
| 3672 | double beta, sp<Allocation> C); |
| 3673 | |
| 3674 | /** |
| 3675 | * CHER2K performs one of the hermitian rank 2k operations |
| 3676 | * C := alpha*A*B**H + conjg( alpha )*B*A**H + beta*C or C := alpha*A**H*B + conjg( alpha )*B**H*A + beta*C |
| 3677 | * |
| 3678 | * Details: http://www.netlib.org/lapack/explore-html/d1/d82/cher2k_8f.html |
| 3679 | * |
| 3680 | * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced. |
| 3681 | * @param Trans The type of transpose applied to the operation. |
| 3682 | * @param alpha The scalar alpha. |
| 3683 | * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}. |
| 3684 | * @param B The input allocation contains matrix B, supported elements type: {Element#F32_2}. |
| 3685 | * @param beta The scalar beta. |
| 3686 | * @param C The input allocation contains matrix C, supported elements type: {Element#F32_2}. |
| 3687 | */ |
| 3688 | void CHER2K(RsBlasUplo Uplo, RsBlasTranspose Trans, Float2 alpha, sp<Allocation> A, |
| 3689 | sp<Allocation> B, float beta, sp<Allocation> C); |
| 3690 | |
| 3691 | /** |
| 3692 | * ZHER2K performs one of the hermitian rank 2k operations |
| 3693 | * C := alpha*A*B**H + conjg( alpha )*B*A**H + beta*C or C := alpha*A**H*B + conjg( alpha )*B**H*A + beta*C |
| 3694 | * |
| 3695 | * Details: http://www.netlib.org/lapack/explore-html/d7/dfa/zher2k_8f.html |
| 3696 | * |
| 3697 | * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced. |
| 3698 | * @param Trans The type of transpose applied to the operation. |
| 3699 | * @param alpha The scalar alpha. |
| 3700 | * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}. |
| 3701 | * @param B The input allocation contains matrix B, supported elements type: {Element#F64_2}. |
| 3702 | * @param beta The scalar beta. |
| 3703 | * @param C The input allocation contains matrix C, supported elements type: {Element#F64_2}. |
| 3704 | */ |
| 3705 | void ZHER2K(RsBlasUplo Uplo, RsBlasTranspose Trans, Double2 alpha, sp<Allocation> A, |
| 3706 | sp<Allocation> B, double beta, sp<Allocation> C); |
| 3707 | |
| 3708 | /** |
| 3709 | * 8-bit GEMM-like operation for neural networks: C = A * Transpose(B) |
| 3710 | * Calculations are done in 1.10.21 fixed-point format for the final output, |
| 3711 | * just before there's a shift down to drop the fractional parts. The output |
| 3712 | * values are gated to 0 to 255 to fit in a byte, but the 10-bit format |
| 3713 | * gives some headroom to avoid wrapping around on small overflows. |
| 3714 | * |
| 3715 | * @param A The input allocation contains matrix A, supported elements type: {Element#U8}. |
| 3716 | * @param a_offset The offset for all values in matrix A, e.g A[i,j] = A[i,j] - a_offset. Value should be from 0 to 255. |
| 3717 | * @param B The input allocation contains matrix B, supported elements type: {Element#U8}. |
| 3718 | * @param b_offset The offset for all values in matrix B, e.g B[i,j] = B[i,j] - b_offset. Value should be from 0 to 255. |
| 3719 | * @param C The input allocation contains matrix C, supported elements type: {Element#U8}. |
| 3720 | * @param c_offset The offset for all values in matrix C. |
| 3721 | * @param c_mult The multiplier for all values in matrix C, e.g C[i,j] = (C[i,j] + c_offset) * c_mult. |
| 3722 | **/ |
| 3723 | void BNNM(sp<Allocation> A, int a_offset, sp<Allocation> B, int b_offset, sp<Allocation> C, |
| 3724 | int c_offset, int c_mult); |
| 3725 | }; |
| 3726 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 3727 | /** |
| 3728 | * Intrinsic kernel for blending two Allocations. |
| 3729 | */ |
| Tim Murray | 7f0d568 | 2012-11-08 16:35:24 -0800 | [diff] [blame] | 3730 | class ScriptIntrinsicBlend : public ScriptIntrinsic { |
| Tim Murray | 21fa7a0 | 2013-08-15 16:25:03 -0700 | [diff] [blame] | 3731 | private: |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 3732 | ScriptIntrinsicBlend(sp<RS> rs, sp<const Element> e); |
| Tim Murray | 21fa7a0 | 2013-08-15 16:25:03 -0700 | [diff] [blame] | 3733 | public: |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 3734 | /** |
| 3735 | * Supported Element types are U8_4. |
| 3736 | * @param[in] rs RenderScript context |
| 3737 | * @param[in] e Element |
| 3738 | * @return new ScriptIntrinsicBlend |
| 3739 | */ |
| Tim Murray | 21fa7a0 | 2013-08-15 16:25:03 -0700 | [diff] [blame] | 3740 | static sp<ScriptIntrinsicBlend> create(sp<RS> rs, sp<const Element> e); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 3741 | /** |
| 3742 | * sets dst = {0, 0, 0, 0} |
| 3743 | * @param[in] in input Allocation |
| 3744 | * @param[in] out output Allocation |
| 3745 | */ |
| 3746 | void forEachClear(sp<Allocation> in, sp<Allocation> out); |
| 3747 | /** |
| 3748 | * Sets dst = src |
| 3749 | * @param[in] in input Allocation |
| 3750 | * @param[in] out output Allocation |
| 3751 | */ |
| 3752 | void forEachSrc(sp<Allocation> in, sp<Allocation> out); |
| 3753 | /** |
| 3754 | * Sets dst = dst (NOP) |
| 3755 | * @param[in] in input Allocation |
| 3756 | * @param[in] out output Allocation |
| 3757 | */ |
| 3758 | void forEachDst(sp<Allocation> in, sp<Allocation> out); |
| 3759 | /** |
| 3760 | * Sets dst = src + dst * (1.0 - src.a) |
| 3761 | * @param[in] in input Allocation |
| 3762 | * @param[in] out output Allocation |
| 3763 | */ |
| 3764 | void forEachSrcOver(sp<Allocation> in, sp<Allocation> out); |
| 3765 | /** |
| 3766 | * Sets dst = dst + src * (1.0 - dst.a) |
| 3767 | * @param[in] in input Allocation |
| 3768 | * @param[in] out output Allocation |
| 3769 | */ |
| 3770 | void forEachDstOver(sp<Allocation> in, sp<Allocation> out); |
| 3771 | /** |
| 3772 | * Sets dst = src * dst.a |
| 3773 | * @param[in] in input Allocation |
| 3774 | * @param[in] out output Allocation |
| 3775 | */ |
| 3776 | void forEachSrcIn(sp<Allocation> in, sp<Allocation> out); |
| 3777 | /** |
| 3778 | * Sets dst = dst * src.a |
| 3779 | * @param[in] in input Allocation |
| 3780 | * @param[in] out output Allocation |
| 3781 | */ |
| 3782 | void forEachDstIn(sp<Allocation> in, sp<Allocation> out); |
| 3783 | /** |
| 3784 | * Sets dst = src * (1.0 - dst.a) |
| 3785 | * @param[in] in input Allocation |
| 3786 | * @param[in] out output Allocation |
| 3787 | */ |
| 3788 | void forEachSrcOut(sp<Allocation> in, sp<Allocation> out); |
| 3789 | /** |
| 3790 | * Sets dst = dst * (1.0 - src.a) |
| 3791 | * @param[in] in input Allocation |
| 3792 | * @param[in] out output Allocation |
| 3793 | */ |
| 3794 | void forEachDstOut(sp<Allocation> in, sp<Allocation> out); |
| 3795 | /** |
| 3796 | * Sets dst.rgb = src.rgb * dst.a + (1.0 - src.a) * dst.rgb |
| 3797 | * @param[in] in input Allocation |
| 3798 | * @param[in] out output Allocation |
| 3799 | */ |
| 3800 | void forEachSrcAtop(sp<Allocation> in, sp<Allocation> out); |
| 3801 | /** |
| 3802 | * Sets dst.rgb = dst.rgb * src.a + (1.0 - dst.a) * src.rgb |
| 3803 | * @param[in] in input Allocation |
| 3804 | * @param[in] out output Allocation |
| 3805 | */ |
| 3806 | void forEachDstAtop(sp<Allocation> in, sp<Allocation> out); |
| 3807 | /** |
| 3808 | * Sets dst = {src.r ^ dst.r, src.g ^ dst.g, src.b ^ dst.b, src.a ^ dst.a} |
| 3809 | * @param[in] in input Allocation |
| 3810 | * @param[in] out output Allocation |
| 3811 | */ |
| 3812 | void forEachXor(sp<Allocation> in, sp<Allocation> out); |
| 3813 | /** |
| 3814 | * Sets dst = src * dst |
| 3815 | * @param[in] in input Allocation |
| 3816 | * @param[in] out output Allocation |
| 3817 | */ |
| 3818 | void forEachMultiply(sp<Allocation> in, sp<Allocation> out); |
| 3819 | /** |
| 3820 | * Sets dst = min(src + dst, 1.0) |
| 3821 | * @param[in] in input Allocation |
| 3822 | * @param[in] out output Allocation |
| 3823 | */ |
| 3824 | void forEachAdd(sp<Allocation> in, sp<Allocation> out); |
| 3825 | /** |
| 3826 | * Sets dst = max(dst - src, 0.0) |
| 3827 | * @param[in] in input Allocation |
| 3828 | * @param[in] out output Allocation |
| 3829 | */ |
| 3830 | void forEachSubtract(sp<Allocation> in, sp<Allocation> out); |
| Tim Murray | 7f0d568 | 2012-11-08 16:35:24 -0800 | [diff] [blame] | 3831 | }; |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 3832 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 3833 | /** |
| 3834 | * Intrinsic Gausian blur filter. Applies a Gaussian blur of the specified |
| 3835 | * radius to all elements of an Allocation. |
| 3836 | */ |
| Tim Murray | 8f1e60c | 2012-11-13 12:25:11 -0800 | [diff] [blame] | 3837 | class ScriptIntrinsicBlur : public ScriptIntrinsic { |
| Tim Murray | 21fa7a0 | 2013-08-15 16:25:03 -0700 | [diff] [blame] | 3838 | private: |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 3839 | ScriptIntrinsicBlur(sp<RS> rs, sp<const Element> e); |
| Tim Murray | 21fa7a0 | 2013-08-15 16:25:03 -0700 | [diff] [blame] | 3840 | public: |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 3841 | /** |
| 3842 | * Supported Element types are U8 and U8_4. |
| 3843 | * @param[in] rs RenderScript context |
| 3844 | * @param[in] e Element |
| 3845 | * @return new ScriptIntrinsicBlur |
| 3846 | */ |
| Tim Murray | 21fa7a0 | 2013-08-15 16:25:03 -0700 | [diff] [blame] | 3847 | static sp<ScriptIntrinsicBlur> create(sp<RS> rs, sp<const Element> e); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 3848 | /** |
| 3849 | * Sets the input of the blur. |
| 3850 | * @param[in] in input Allocation |
| 3851 | */ |
| Tim Murray | 21fa7a0 | 2013-08-15 16:25:03 -0700 | [diff] [blame] | 3852 | void setInput(sp<Allocation> in); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 3853 | /** |
| 3854 | * Runs the intrinsic. |
| 3855 | * @param[in] output Allocation |
| 3856 | */ |
| Tim Murray | 21fa7a0 | 2013-08-15 16:25:03 -0700 | [diff] [blame] | 3857 | void forEach(sp<Allocation> out); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 3858 | /** |
| 3859 | * Sets the radius of the blur. The supported range is 0 < radius <= 25. |
| 3860 | * @param[in] radius radius of the blur |
| 3861 | */ |
| Tim Murray | 8f1e60c | 2012-11-13 12:25:11 -0800 | [diff] [blame] | 3862 | void setRadius(float radius); |
| 3863 | }; |
| 3864 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 3865 | /** |
| 3866 | * Intrinsic for applying a color matrix to allocations. This has the |
| 3867 | * same effect as loading each element and converting it to a |
| 3868 | * F32_N, multiplying the result by the 4x4 color matrix |
| 3869 | * as performed by rsMatrixMultiply() and writing it to the output |
| 3870 | * after conversion back to U8_N or F32_N. |
| 3871 | */ |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 3872 | class ScriptIntrinsicColorMatrix : public ScriptIntrinsic { |
| Tim Murray | 21fa7a0 | 2013-08-15 16:25:03 -0700 | [diff] [blame] | 3873 | private: |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 3874 | ScriptIntrinsicColorMatrix(sp<RS> rs, sp<const Element> e); |
| Tim Murray | 21fa7a0 | 2013-08-15 16:25:03 -0700 | [diff] [blame] | 3875 | public: |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 3876 | /** |
| 3877 | * Creates a new intrinsic. |
| 3878 | * @param[in] rs RenderScript context |
| 3879 | * @return new ScriptIntrinsicColorMatrix |
| 3880 | */ |
| Tim Murray | aae73c9 | 2013-09-03 17:05:46 -0700 | [diff] [blame] | 3881 | static sp<ScriptIntrinsicColorMatrix> create(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 3882 | /** |
| 3883 | * Applies the color matrix. Supported types are U8 and F32 with |
| 3884 | * vector lengths between 1 and 4. |
| 3885 | * @param[in] in input Allocation |
| 3886 | * @param[out] out output Allocation |
| 3887 | */ |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 3888 | void forEach(sp<Allocation> in, sp<Allocation> out); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 3889 | /** |
| 3890 | * Set the value to be added after the color matrix has been |
| 3891 | * applied. The default value is {0, 0, 0, 0}. |
| 3892 | * @param[in] add float[4] of values |
| 3893 | */ |
| Tim Murray | 10913a5 | 2013-08-20 17:19:47 -0700 | [diff] [blame] | 3894 | void setAdd(float* add); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 3895 | |
| 3896 | /** |
| 3897 | * Set the color matrix which will be applied to each cell of the |
| 3898 | * image. The alpha channel will be copied. |
| 3899 | * |
| 3900 | * @param[in] m float[9] of values |
| 3901 | */ |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 3902 | void setColorMatrix3(float* m); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 3903 | /** |
| 3904 | * Set the color matrix which will be applied to each cell of the |
| 3905 | * image. |
| 3906 | * |
| 3907 | * @param[in] m float[16] of values |
| 3908 | */ |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 3909 | void setColorMatrix4(float* m); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 3910 | /** |
| 3911 | * Set a color matrix to convert from RGB to luminance. The alpha |
| 3912 | * channel will be a copy. |
| 3913 | */ |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 3914 | void setGreyscale(); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 3915 | /** |
| 3916 | * Set the matrix to convert from RGB to YUV with a direct copy of |
| 3917 | * the 4th channel. |
| 3918 | */ |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 3919 | void setRGBtoYUV(); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 3920 | /** |
| 3921 | * Set the matrix to convert from YUV to RGB with a direct copy of |
| 3922 | * the 4th channel. |
| 3923 | */ |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 3924 | void setYUVtoRGB(); |
| 3925 | }; |
| 3926 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 3927 | /** |
| 3928 | * Intrinsic for applying a 3x3 convolve to an allocation. |
| 3929 | */ |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 3930 | class ScriptIntrinsicConvolve3x3 : public ScriptIntrinsic { |
| Tim Murray | 21fa7a0 | 2013-08-15 16:25:03 -0700 | [diff] [blame] | 3931 | private: |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 3932 | ScriptIntrinsicConvolve3x3(sp<RS> rs, sp<const Element> e); |
| Tim Murray | 21fa7a0 | 2013-08-15 16:25:03 -0700 | [diff] [blame] | 3933 | public: |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 3934 | /** |
| 3935 | * Supported types U8 and F32 with vector lengths between 1 and |
| 3936 | * 4. The default convolution kernel is the identity. |
| 3937 | * @param[in] rs RenderScript context |
| 3938 | * @param[in] e Element |
| 3939 | * @return new ScriptIntrinsicConvolve3x3 |
| 3940 | */ |
| Tim Murray | 21fa7a0 | 2013-08-15 16:25:03 -0700 | [diff] [blame] | 3941 | static sp<ScriptIntrinsicConvolve3x3> create(sp<RS> rs, sp<const Element> e); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 3942 | /** |
| 3943 | * Sets input for intrinsic. |
| 3944 | * @param[in] in input Allocation |
| 3945 | */ |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 3946 | void setInput(sp<Allocation> in); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 3947 | /** |
| 3948 | * Launches the intrinsic. |
| 3949 | * @param[in] out output Allocation |
| 3950 | */ |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 3951 | void forEach(sp<Allocation> out); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 3952 | /** |
| 3953 | * Sets convolution kernel. |
| 3954 | * @param[in] v float[9] of values |
| 3955 | */ |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 3956 | void setCoefficients(float* v); |
| 3957 | }; |
| 3958 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 3959 | /** |
| 3960 | * Intrinsic for applying a 5x5 convolve to an allocation. |
| 3961 | */ |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 3962 | class ScriptIntrinsicConvolve5x5 : public ScriptIntrinsic { |
| Tim Murray | 21fa7a0 | 2013-08-15 16:25:03 -0700 | [diff] [blame] | 3963 | private: |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 3964 | ScriptIntrinsicConvolve5x5(sp<RS> rs, sp<const Element> e); |
| Tim Murray | 21fa7a0 | 2013-08-15 16:25:03 -0700 | [diff] [blame] | 3965 | public: |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 3966 | /** |
| 3967 | * Supported types U8 and F32 with vector lengths between 1 and |
| 3968 | * 4. The default convolution kernel is the identity. |
| 3969 | * @param[in] rs RenderScript context |
| 3970 | * @param[in] e Element |
| 3971 | * @return new ScriptIntrinsicConvolve5x5 |
| 3972 | */ |
| Tim Murray | 21fa7a0 | 2013-08-15 16:25:03 -0700 | [diff] [blame] | 3973 | static sp<ScriptIntrinsicConvolve5x5> create(sp<RS> rs, sp<const Element> e); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 3974 | /** |
| 3975 | * Sets input for intrinsic. |
| 3976 | * @param[in] in input Allocation |
| 3977 | */ |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 3978 | void setInput(sp<Allocation> in); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 3979 | /** |
| 3980 | * Launches the intrinsic. |
| 3981 | * @param[in] out output Allocation |
| 3982 | */ |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 3983 | void forEach(sp<Allocation> out); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 3984 | /** |
| 3985 | * Sets convolution kernel. |
| 3986 | * @param[in] v float[25] of values |
| 3987 | */ |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 3988 | void setCoefficients(float* v); |
| 3989 | }; |
| 3990 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 3991 | /** |
| 3992 | * Intrinsic for computing a histogram. |
| 3993 | */ |
| Tim Murray | b27b181 | 2013-08-05 14:00:40 -0700 | [diff] [blame] | 3994 | class ScriptIntrinsicHistogram : public ScriptIntrinsic { |
| Tim Murray | 21fa7a0 | 2013-08-15 16:25:03 -0700 | [diff] [blame] | 3995 | private: |
| Tim Murray | b27b181 | 2013-08-05 14:00:40 -0700 | [diff] [blame] | 3996 | ScriptIntrinsicHistogram(sp<RS> rs, sp<const Element> e); |
| Tim Murray | 10913a5 | 2013-08-20 17:19:47 -0700 | [diff] [blame] | 3997 | sp<Allocation> mOut; |
| Tim Murray | 21fa7a0 | 2013-08-15 16:25:03 -0700 | [diff] [blame] | 3998 | public: |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 3999 | /** |
| 4000 | * Create an intrinsic for calculating the histogram of an uchar |
| 4001 | * or uchar4 image. |
| 4002 | * |
| 4003 | * Supported elements types are U8_4, U8_3, U8_2, and U8. |
| 4004 | * |
| 4005 | * @param[in] rs The RenderScript context |
| 4006 | * @param[in] e Element type for inputs |
| 4007 | * |
| 4008 | * @return ScriptIntrinsicHistogram |
| 4009 | */ |
| Jon Parr | b05c850 | 2015-03-13 14:41:58 +0000 | [diff] [blame] | 4010 | static sp<ScriptIntrinsicHistogram> create(sp<RS> rs, sp<const Element> e); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4011 | /** |
| 4012 | * Set the output of the histogram. 32 bit integer types are |
| 4013 | * supported. |
| 4014 | * |
| 4015 | * @param[in] aout The output allocation |
| 4016 | */ |
| Tim Murray | b27b181 | 2013-08-05 14:00:40 -0700 | [diff] [blame] | 4017 | void setOutput(sp<Allocation> aout); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4018 | /** |
| 4019 | * Set the coefficients used for the dot product calculation. The |
| 4020 | * default is {0.299f, 0.587f, 0.114f, 0.f}. |
| 4021 | * |
| 4022 | * Coefficients must be >= 0 and sum to 1.0 or less. |
| 4023 | * |
| 4024 | * @param[in] r Red coefficient |
| 4025 | * @param[in] g Green coefficient |
| 4026 | * @param[in] b Blue coefficient |
| 4027 | * @param[in] a Alpha coefficient |
| 4028 | */ |
| Tim Murray | b27b181 | 2013-08-05 14:00:40 -0700 | [diff] [blame] | 4029 | void setDotCoefficients(float r, float g, float b, float a); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4030 | /** |
| 4031 | * Process an input buffer and place the histogram into the output |
| 4032 | * allocation. The output allocation may be a narrower vector size |
| 4033 | * than the input. In this case the vector size of the output is |
| 4034 | * used to determine how many of the input channels are used in |
| 4035 | * the computation. This is useful if you have an RGBA input |
| 4036 | * buffer but only want the histogram for RGB. |
| 4037 | * |
| 4038 | * 1D and 2D input allocations are supported. |
| 4039 | * |
| 4040 | * @param[in] ain The input image |
| 4041 | */ |
| Tim Murray | b27b181 | 2013-08-05 14:00:40 -0700 | [diff] [blame] | 4042 | void forEach(sp<Allocation> ain); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4043 | /** |
| 4044 | * Process an input buffer and place the histogram into the output |
| 4045 | * allocation. The dot product of the input channel and the |
| 4046 | * coefficients from 'setDotCoefficients' are used to calculate |
| 4047 | * the output values. |
| 4048 | * |
| 4049 | * 1D and 2D input allocations are supported. |
| 4050 | * |
| 4051 | * @param ain The input image |
| 4052 | */ |
| Tim Murray | b27b181 | 2013-08-05 14:00:40 -0700 | [diff] [blame] | 4053 | void forEach_dot(sp<Allocation> ain); |
| 4054 | }; |
| 4055 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4056 | /** |
| 4057 | * Intrinsic for applying a per-channel lookup table. Each channel of |
| 4058 | * the input has an independant lookup table. The tables are 256 |
| 4059 | * entries in size and can cover the full value range of U8_4. |
| 4060 | **/ |
| Tim Murray | b27b181 | 2013-08-05 14:00:40 -0700 | [diff] [blame] | 4061 | class ScriptIntrinsicLUT : public ScriptIntrinsic { |
| 4062 | private: |
| 4063 | sp<Allocation> LUT; |
| 4064 | bool mDirty; |
| 4065 | unsigned char mCache[1024]; |
| Tim Murray | 2acce99 | 2013-08-28 14:23:31 -0700 | [diff] [blame] | 4066 | void setTable(unsigned int offset, unsigned char base, unsigned int length, unsigned char* lutValues); |
| Tim Murray | 21fa7a0 | 2013-08-15 16:25:03 -0700 | [diff] [blame] | 4067 | ScriptIntrinsicLUT(sp<RS> rs, sp<const Element> e); |
| Tim Murray | b27b181 | 2013-08-05 14:00:40 -0700 | [diff] [blame] | 4068 | |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 4069 | public: |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4070 | /** |
| 4071 | * Supported elements types are U8_4. |
| 4072 | * |
| 4073 | * The defaults tables are identity. |
| 4074 | * |
| 4075 | * @param[in] rs The RenderScript context |
| 4076 | * @param[in] e Element type for intputs and outputs |
| 4077 | * |
| 4078 | * @return ScriptIntrinsicLUT |
| 4079 | */ |
| Tim Murray | 21fa7a0 | 2013-08-15 16:25:03 -0700 | [diff] [blame] | 4080 | static sp<ScriptIntrinsicLUT> create(sp<RS> rs, sp<const Element> e); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4081 | /** |
| 4082 | * Invoke the kernel and apply the lookup to each cell of ain and |
| 4083 | * copy to aout. |
| 4084 | * |
| 4085 | * @param[in] ain Input allocation |
| 4086 | * @param[in] aout Output allocation |
| 4087 | */ |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 4088 | void forEach(sp<Allocation> ain, sp<Allocation> aout); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4089 | /** |
| 4090 | * Sets entries in LUT for the red channel. |
| 4091 | * @param[in] base base of region to update |
| 4092 | * @param[in] length length of region to update |
| 4093 | * @param[in] lutValues LUT values to use |
| 4094 | */ |
| Tim Murray | 2acce99 | 2013-08-28 14:23:31 -0700 | [diff] [blame] | 4095 | void setRed(unsigned char base, unsigned int length, unsigned char* lutValues); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4096 | /** |
| 4097 | * Sets entries in LUT for the green channel. |
| 4098 | * @param[in] base base of region to update |
| 4099 | * @param[in] length length of region to update |
| 4100 | * @param[in] lutValues LUT values to use |
| 4101 | */ |
| Tim Murray | 2acce99 | 2013-08-28 14:23:31 -0700 | [diff] [blame] | 4102 | void setGreen(unsigned char base, unsigned int length, unsigned char* lutValues); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4103 | /** |
| 4104 | * Sets entries in LUT for the blue channel. |
| 4105 | * @param[in] base base of region to update |
| 4106 | * @param[in] length length of region to update |
| 4107 | * @param[in] lutValues LUT values to use |
| 4108 | */ |
| Tim Murray | 2acce99 | 2013-08-28 14:23:31 -0700 | [diff] [blame] | 4109 | void setBlue(unsigned char base, unsigned int length, unsigned char* lutValues); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4110 | /** |
| 4111 | * Sets entries in LUT for the alpha channel. |
| 4112 | * @param[in] base base of region to update |
| 4113 | * @param[in] length length of region to update |
| 4114 | * @param[in] lutValues LUT values to use |
| 4115 | */ |
| Tim Murray | 2acce99 | 2013-08-28 14:23:31 -0700 | [diff] [blame] | 4116 | void setAlpha(unsigned char base, unsigned int length, unsigned char* lutValues); |
| Tim Murray | b27b181 | 2013-08-05 14:00:40 -0700 | [diff] [blame] | 4117 | virtual ~ScriptIntrinsicLUT(); |
| 4118 | }; |
| 4119 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4120 | /** |
| Miao Wang | e5428e6 | 2015-03-10 15:29:40 -0700 | [diff] [blame] | 4121 | * Intrinsic for performing a resize of a 2D allocation. |
| 4122 | */ |
| 4123 | class ScriptIntrinsicResize : public ScriptIntrinsic { |
| 4124 | private: |
| 4125 | sp<Allocation> mInput; |
| 4126 | ScriptIntrinsicResize(sp<RS> rs, sp<const Element> e); |
| 4127 | public: |
| 4128 | /** |
| 4129 | * Supported Element types are U8_4. Default lookup table is identity. |
| 4130 | * @param[in] rs RenderScript context |
| 4131 | * @param[in] e Element |
| 4132 | * @return new ScriptIntrinsic |
| 4133 | */ |
| 4134 | static sp<ScriptIntrinsicResize> create(sp<RS> rs); |
| 4135 | |
| 4136 | /** |
| 4137 | * Resize copy the input allocation to the output specified. The |
| 4138 | * Allocation is rescaled if necessary using bi-cubic |
| 4139 | * interpolation. |
| 4140 | * @param[in] ain input Allocation |
| 4141 | * @param[in] aout output Allocation |
| 4142 | */ |
| 4143 | void forEach_bicubic(sp<Allocation> aout); |
| 4144 | |
| 4145 | /** |
| 4146 | * Set the input of the resize. |
| 4147 | * @param[in] lut new lookup table |
| 4148 | */ |
| 4149 | void setInput(sp<Allocation> ain); |
| 4150 | }; |
| 4151 | |
| 4152 | /** |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4153 | * Intrinsic for converting an Android YUV buffer to RGB. |
| 4154 | * |
| 4155 | * The input allocation should be supplied in a supported YUV format |
| 4156 | * as a YUV element Allocation. The output is RGBA; the alpha channel |
| 4157 | * will be set to 255. |
| 4158 | */ |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 4159 | class ScriptIntrinsicYuvToRGB : public ScriptIntrinsic { |
| Tim Murray | 21fa7a0 | 2013-08-15 16:25:03 -0700 | [diff] [blame] | 4160 | private: |
| Tim Murray | b27b181 | 2013-08-05 14:00:40 -0700 | [diff] [blame] | 4161 | ScriptIntrinsicYuvToRGB(sp<RS> rs, sp<const Element> e); |
| Tim Murray | 21fa7a0 | 2013-08-15 16:25:03 -0700 | [diff] [blame] | 4162 | public: |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4163 | /** |
| 4164 | * Create an intrinsic for converting YUV to RGB. |
| 4165 | * |
| 4166 | * Supported elements types are U8_4. |
| 4167 | * |
| 4168 | * @param[in] rs The RenderScript context |
| 4169 | * @param[in] e Element type for output |
| 4170 | * |
| 4171 | * @return ScriptIntrinsicYuvToRGB |
| 4172 | */ |
| Tim Murray | 21fa7a0 | 2013-08-15 16:25:03 -0700 | [diff] [blame] | 4173 | static sp<ScriptIntrinsicYuvToRGB> create(sp<RS> rs, sp<const Element> e); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4174 | /** |
| 4175 | * Set the input YUV allocation. |
| 4176 | * |
| 4177 | * @param[in] ain The input allocation. |
| 4178 | */ |
| Tim Murray | b27b181 | 2013-08-05 14:00:40 -0700 | [diff] [blame] | 4179 | void setInput(sp<Allocation> in); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4180 | |
| 4181 | /** |
| 4182 | * Convert the image to RGB. |
| 4183 | * |
| 4184 | * @param[in] aout Output allocation. Must match creation element |
| 4185 | * type. |
| 4186 | */ |
| Tim Murray | b27b181 | 2013-08-05 14:00:40 -0700 | [diff] [blame] | 4187 | void forEach(sp<Allocation> out); |
| Tim Murray | 89daad6 | 2013-07-29 14:30:02 -0700 | [diff] [blame] | 4188 | |
| 4189 | }; |
| Tim Murray | b27b181 | 2013-08-05 14:00:40 -0700 | [diff] [blame] | 4190 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4191 | /** |
| 4192 | * Sampler object that defines how Allocations can be read as textures |
| 4193 | * within a kernel. Samplers are used in conjunction with the rsSample |
| 4194 | * runtime function to return values from normalized coordinates. |
| 4195 | * |
| 4196 | * Any Allocation used with a Sampler must have been created with |
| 4197 | * RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE; using a Sampler on an |
| 4198 | * Allocation that was not created with |
| 4199 | * RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE is undefined. |
| 4200 | **/ |
| Tim Murray | 729b6fe | 2013-07-23 16:20:42 -0700 | [diff] [blame] | 4201 | class Sampler : public BaseObj { |
| 4202 | private: |
| 4203 | Sampler(sp<RS> rs, void* id); |
| Miao Wang | e5428e6 | 2015-03-10 15:29:40 -0700 | [diff] [blame] | 4204 | Sampler(sp<RS> rs, void* id, RsSamplerValue min, RsSamplerValue mag, |
| 4205 | RsSamplerValue wrapS, RsSamplerValue wrapT, float anisotropy); |
| Tim Murray | 729b6fe | 2013-07-23 16:20:42 -0700 | [diff] [blame] | 4206 | RsSamplerValue mMin; |
| 4207 | RsSamplerValue mMag; |
| 4208 | RsSamplerValue mWrapS; |
| 4209 | RsSamplerValue mWrapT; |
| Tim Murray | 729b6fe | 2013-07-23 16:20:42 -0700 | [diff] [blame] | 4210 | float mAniso; |
| 4211 | |
| 4212 | public: |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4213 | /** |
| 4214 | * Creates a non-standard Sampler. |
| 4215 | * @param[in] rs RenderScript context |
| 4216 | * @param[in] min minification |
| 4217 | * @param[in] mag magnification |
| 4218 | * @param[in] wrapS S wrapping mode |
| 4219 | * @param[in] wrapT T wrapping mode |
| 4220 | * @param[in] anisotropy anisotropy setting |
| 4221 | */ |
| Tim Murray | 729b6fe | 2013-07-23 16:20:42 -0700 | [diff] [blame] | 4222 | static sp<Sampler> create(sp<RS> rs, RsSamplerValue min, RsSamplerValue mag, RsSamplerValue wrapS, RsSamplerValue wrapT, float anisotropy); |
| 4223 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4224 | /** |
| 4225 | * @return minification setting for the sampler |
| 4226 | */ |
| Tim Murray | 729b6fe | 2013-07-23 16:20:42 -0700 | [diff] [blame] | 4227 | RsSamplerValue getMinification(); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4228 | /** |
| 4229 | * @return magnification setting for the sampler |
| 4230 | */ |
| Tim Murray | 729b6fe | 2013-07-23 16:20:42 -0700 | [diff] [blame] | 4231 | RsSamplerValue getMagnification(); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4232 | /** |
| 4233 | * @return S wrapping mode for the sampler |
| 4234 | */ |
| Tim Murray | 729b6fe | 2013-07-23 16:20:42 -0700 | [diff] [blame] | 4235 | RsSamplerValue getWrapS(); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4236 | /** |
| 4237 | * @return T wrapping mode for the sampler |
| 4238 | */ |
| Tim Murray | 729b6fe | 2013-07-23 16:20:42 -0700 | [diff] [blame] | 4239 | RsSamplerValue getWrapT(); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4240 | /** |
| 4241 | * @return anisotropy setting for the sampler |
| 4242 | */ |
| Tim Murray | 729b6fe | 2013-07-23 16:20:42 -0700 | [diff] [blame] | 4243 | float getAnisotropy(); |
| 4244 | |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4245 | /** |
| 4246 | * Retrieve a sampler with min and mag set to nearest and wrap modes set to |
| 4247 | * clamp. |
| 4248 | * |
| 4249 | * @param rs Context to which the sampler will belong. |
| 4250 | * |
| 4251 | * @return Sampler |
| 4252 | */ |
| Stephen Hines | 8a588bd | 2013-11-26 15:38:31 -0800 | [diff] [blame] | 4253 | static sp<const Sampler> CLAMP_NEAREST(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4254 | /** |
| 4255 | * Retrieve a sampler with min and mag set to linear and wrap modes set to |
| 4256 | * clamp. |
| 4257 | * |
| 4258 | * @param rs Context to which the sampler will belong. |
| 4259 | * |
| 4260 | * @return Sampler |
| 4261 | */ |
| Stephen Hines | 8a588bd | 2013-11-26 15:38:31 -0800 | [diff] [blame] | 4262 | static sp<const Sampler> CLAMP_LINEAR(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4263 | /** |
| 4264 | * Retrieve a sampler with mag set to linear, min linear mipmap linear, and |
| 4265 | * wrap modes set to clamp. |
| 4266 | * |
| 4267 | * @param rs Context to which the sampler will belong. |
| 4268 | * |
| 4269 | * @return Sampler |
| 4270 | */ |
| Stephen Hines | 8a588bd | 2013-11-26 15:38:31 -0800 | [diff] [blame] | 4271 | static sp<const Sampler> CLAMP_LINEAR_MIP_LINEAR(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4272 | /** |
| 4273 | * Retrieve a sampler with min and mag set to nearest and wrap modes set to |
| 4274 | * wrap. |
| 4275 | * |
| 4276 | * @param rs Context to which the sampler will belong. |
| 4277 | * |
| 4278 | * @return Sampler |
| 4279 | */ |
| Stephen Hines | 8a588bd | 2013-11-26 15:38:31 -0800 | [diff] [blame] | 4280 | static sp<const Sampler> WRAP_NEAREST(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4281 | /** |
| 4282 | * Retrieve a sampler with min and mag set to linear and wrap modes set to |
| 4283 | * wrap. |
| 4284 | * |
| 4285 | * @param rs Context to which the sampler will belong. |
| 4286 | * |
| 4287 | * @return Sampler |
| 4288 | */ |
| Stephen Hines | 8a588bd | 2013-11-26 15:38:31 -0800 | [diff] [blame] | 4289 | static sp<const Sampler> WRAP_LINEAR(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4290 | /** |
| 4291 | * Retrieve a sampler with mag set to linear, min linear mipmap linear, and |
| 4292 | * wrap modes set to wrap. |
| 4293 | * |
| 4294 | * @param rs Context to which the sampler will belong. |
| 4295 | * |
| 4296 | * @return Sampler |
| 4297 | */ |
| Stephen Hines | 8a588bd | 2013-11-26 15:38:31 -0800 | [diff] [blame] | 4298 | static sp<const Sampler> WRAP_LINEAR_MIP_LINEAR(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4299 | /** |
| 4300 | * Retrieve a sampler with min and mag set to nearest and wrap modes set to |
| 4301 | * mirrored repeat. |
| 4302 | * |
| 4303 | * @param rs Context to which the sampler will belong. |
| 4304 | * |
| 4305 | * @return Sampler |
| 4306 | */ |
| Stephen Hines | 8a588bd | 2013-11-26 15:38:31 -0800 | [diff] [blame] | 4307 | static sp<const Sampler> MIRRORED_REPEAT_NEAREST(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4308 | /** |
| 4309 | * Retrieve a sampler with min and mag set to linear and wrap modes set to |
| 4310 | * mirrored repeat. |
| 4311 | * |
| 4312 | * @param rs Context to which the sampler will belong. |
| 4313 | * |
| 4314 | * @return Sampler |
| 4315 | */ |
| Stephen Hines | 8a588bd | 2013-11-26 15:38:31 -0800 | [diff] [blame] | 4316 | static sp<const Sampler> MIRRORED_REPEAT_LINEAR(sp<RS> rs); |
| Tim Murray | 75e877d | 2013-09-11 14:45:20 -0700 | [diff] [blame] | 4317 | /** |
| 4318 | * Retrieve a sampler with min and mag set to linear and wrap modes set to |
| 4319 | * mirrored repeat. |
| 4320 | * |
| 4321 | * @param rs Context to which the sampler will belong. |
| 4322 | * |
| 4323 | * @return Sampler |
| 4324 | */ |
| Stephen Hines | 8a588bd | 2013-11-26 15:38:31 -0800 | [diff] [blame] | 4325 | static sp<const Sampler> MIRRORED_REPEAT_LINEAR_MIP_LINEAR(sp<RS> rs); |
| Tim Murray | 729b6fe | 2013-07-23 16:20:42 -0700 | [diff] [blame] | 4326 | |
| 4327 | }; |
| 4328 | |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 4329 | } |
| Tim Murray | 7f0d568 | 2012-11-08 16:35:24 -0800 | [diff] [blame] | 4330 | |
| Tim Murray | 84bf2b8 | 2012-10-31 16:03:16 -0700 | [diff] [blame] | 4331 | } |
| 4332 | |
| 4333 | #endif |