blob: cb912163cbcc196f4bd3743908379e042dd7ffd9 [file] [log] [blame]
Tim Murray84bf2b82012-10-31 16:03:16 -07001/*
Tim Murray89daad62013-07-29 14:30:02 -07002 * Copyright (C) 2013 The Android Open Source Project
Tim Murray84bf2b82012-10-31 16:03:16 -07003 *
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 Murray89daad62013-07-29 14:30:02 -070020#include "rsDefines.h"
Tim Murray89daad62013-07-29 14:30:02 -070021#include "util/RefBase.h"
Tim Murraya4230962013-07-17 16:50:10 -070022
Tim Murray8c24cd62014-04-10 18:04:39 -070023#include <pthread.h>
Tim Murray89daad62013-07-29 14:30:02 -070024
Miao Wang09d2dd22015-03-18 20:09:20 -070025
Tim Murray75e877d2013-09-11 14:45:20 -070026/**
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 Murray96267c22013-02-12 11:25:12 -080030#define RS_CPU_ALLOCATION_ALIGNMENT 16
31
Jason Sams66f0a162014-11-11 13:46:38 -080032struct dispatchTable;
33
Tim Murray84bf2b82012-10-31 16:03:16 -070034namespace android {
Miao Wang09d2dd22015-03-18 20:09:20 -070035class Surface;
36
Tim Murray9eb7f4b2012-11-16 14:02:18 -080037namespace RSC {
Tim Murray84bf2b82012-10-31 16:03:16 -070038
Jason Sams66f0a162014-11-11 13:46:38 -080039
Tim Murray84bf2b82012-10-31 16:03:16 -070040typedef void (*ErrorHandlerFunc_t)(uint32_t errorNum, const char *errorText);
41typedef void (*MessageHandlerFunc_t)(uint32_t msgNum, const void *msgData, size_t msgLen);
42
43class RS;
44class BaseObj;
45class Element;
46class Type;
47class Allocation;
48class Script;
49class ScriptC;
Tim Murray729b6fe2013-07-23 16:20:42 -070050class Sampler;
Tim Murray84bf2b82012-10-31 16:03:16 -070051
Tim Murray75e877d2013-09-11 14:45:20 -070052/**
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 Murray21fa7a02013-08-15 16:25:03 -070057 enum RSError {
Tim Murray75e877d2013-09-11 14:45:20 -070058 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 Murray21fa7a02013-08-15 16:25:03 -070063 RS_ERROR_MAX = 9999
64
65 };
66
Tim Murray75e877d2013-09-11 14:45:20 -070067 /**
Tim Murray75e877d2013-09-11 14:45:20 -070068 * Flags that can control RenderScript behavior on a per-context level.
69 */
Tim Murray84e3dea2013-09-09 16:12:51 -070070 enum RSInitFlags {
Tim Murray75e877d2013-09-11 14:45:20 -070071 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 McGroartyd5164d52015-05-08 15:31:49 +010073 // 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 beckhamf5029802015-05-22 16:51:42 +010075 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 Murray84e3dea2013-09-09 16:12:51 -070077 };
78
Miao Wang49b12262015-09-04 11:48:16 -070079
80class 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
89class 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
98class 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
107class 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
116class 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
125class 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
134class 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
143class 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
152class 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
161class 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
170class 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
179class 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
188class 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
197class 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
206class 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
215class 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
224class 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
233class 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
242class 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
251class 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
260class 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
269class 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
278class 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
287class 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
296class 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
305class 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
314class 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
323class 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
332class 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
341class 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 Murray75e877d2013-09-11 14:45:20 -0700350 /**
351 * The RenderScript context. This class controls initialization, resource management, and teardown.
352 */
Tim Murray89daad62013-07-29 14:30:02 -0700353 class RS : public android::RSC::LightRefBase<RS> {
Tim Murray84bf2b82012-10-31 16:03:16 -0700354
355 public:
356 RS();
357 virtual ~RS();
358
Tim Murray75e877d2013-09-11 14:45:20 -0700359 /**
360 * Initializes a RenderScript context. A context must be initialized before it can be used.
Tim Murraycaf41262013-12-13 12:54:37 -0800361 * @param[in] name Directory name to be used by this context. This should be equivalent to
362 * Context.getCacheDir().
Tim Murray75e877d2013-09-11 14:45:20 -0700363 * @param[in] flags Optional flags for this context.
364 * @return true on success
365 */
Miao Wangfda55962016-01-12 09:14:21 +0800366 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 Murray84bf2b82012-10-31 16:03:16 -0700377
Tim Murray75e877d2013-09-11 14:45:20 -0700378 /**
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 Murray84bf2b82012-10-31 16:03:16 -0700384 void setErrorHandler(ErrorHandlerFunc_t func);
Tim Murray75e877d2013-09-11 14:45:20 -0700385
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 Murray84bf2b82012-10-31 16:03:16 -0700391 ErrorHandlerFunc_t getErrorHandler() { return mErrorFunc; }
392
Tim Murray75e877d2013-09-11 14:45:20 -0700393 /**
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 Murray84bf2b82012-10-31 16:03:16 -0700399 void setMessageHandler(MessageHandlerFunc_t func);
Tim Murray75e877d2013-09-11 14:45:20 -0700400
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 Murray84bf2b82012-10-31 16:03:16 -0700406 MessageHandlerFunc_t getMessageHandler() { return mMessageFunc; }
407
Tim Murray75e877d2013-09-11 14:45:20 -0700408 /**
409 * Returns current status for the context.
410 *
411 * @return current error
412 */
Tim Murray10913a52013-08-20 17:19:47 -0700413 RSError getError();
Tim Murray84bf2b82012-10-31 16:03:16 -0700414
Tim Murray75e877d2013-09-11 14:45:20 -0700415 /**
416 * Waits for any currently running asynchronous operations to finish. This
417 * should only be used for performance testing and timing.
418 */
Tim Murraybaca6c32012-11-14 16:51:46 -0800419 void finish();
420
Tim Murray75e877d2013-09-11 14:45:20 -0700421 RsContext getContext() { return mContext; }
422 void throwError(RSError error, const char *errMsg);
423
Tim Murraya4230962013-07-17 16:50:10 -0700424 static dispatchTable* dispatch;
425
Tim Murray84bf2b82012-10-31 16:03:16 -0700426 private:
Tim Murray4a92d122013-07-22 10:56:18 -0700427 static bool usingNative;
Tim Murraya4230962013-07-17 16:50:10 -0700428 static bool initDispatch(int targetApi);
429
Tim Murray84bf2b82012-10-31 16:03:16 -0700430 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 Murray21fa7a02013-08-15 16:25:03 -0700441 RSError mCurrentError;
Tim Murray84bf2b82012-10-31 16:03:16 -0700442
443 ErrorHandlerFunc_t mErrorFunc;
444 MessageHandlerFunc_t mMessageFunc;
Tim Murraya4230962013-07-17 16:50:10 -0700445 bool mInit;
Tim Murray84bf2b82012-10-31 16:03:16 -0700446
Miao Wangbc10dff2015-04-03 17:44:55 -0700447 char mCacheDir[PATH_MAX+1];
448 uint32_t mCacheDirLen;
Tim Murraycaf41262013-12-13 12:54:37 -0800449
Tim Murray84bf2b82012-10-31 16:03:16 -0700450 struct {
Tim Murray89daad62013-07-29 14:30:02 -0700451 sp<const Element> U8;
Tim Murrayeb4426d2013-08-27 15:30:16 -0700452 sp<const Element> U8_2;
453 sp<const Element> U8_3;
454 sp<const Element> U8_4;
Tim Murray89daad62013-07-29 14:30:02 -0700455 sp<const Element> I8;
Tim Murrayeb4426d2013-08-27 15:30:16 -0700456 sp<const Element> I8_2;
457 sp<const Element> I8_3;
458 sp<const Element> I8_4;
Tim Murray89daad62013-07-29 14:30:02 -0700459 sp<const Element> U16;
Tim Murrayeb4426d2013-08-27 15:30:16 -0700460 sp<const Element> U16_2;
461 sp<const Element> U16_3;
462 sp<const Element> U16_4;
Tim Murray89daad62013-07-29 14:30:02 -0700463 sp<const Element> I16;
Tim Murrayeb4426d2013-08-27 15:30:16 -0700464 sp<const Element> I16_2;
465 sp<const Element> I16_3;
466 sp<const Element> I16_4;
Tim Murray89daad62013-07-29 14:30:02 -0700467 sp<const Element> U32;
Tim Murrayeb4426d2013-08-27 15:30:16 -0700468 sp<const Element> U32_2;
469 sp<const Element> U32_3;
470 sp<const Element> U32_4;
Tim Murray89daad62013-07-29 14:30:02 -0700471 sp<const Element> I32;
Tim Murrayeb4426d2013-08-27 15:30:16 -0700472 sp<const Element> I32_2;
473 sp<const Element> I32_3;
474 sp<const Element> I32_4;
Tim Murray89daad62013-07-29 14:30:02 -0700475 sp<const Element> U64;
Tim Murrayeb4426d2013-08-27 15:30:16 -0700476 sp<const Element> U64_2;
477 sp<const Element> U64_3;
478 sp<const Element> U64_4;
Tim Murray89daad62013-07-29 14:30:02 -0700479 sp<const Element> I64;
Tim Murrayeb4426d2013-08-27 15:30:16 -0700480 sp<const Element> I64_2;
481 sp<const Element> I64_3;
482 sp<const Element> I64_4;
Tim Murray89daad62013-07-29 14:30:02 -0700483 sp<const Element> F32;
Tim Murrayeb4426d2013-08-27 15:30:16 -0700484 sp<const Element> F32_2;
485 sp<const Element> F32_3;
486 sp<const Element> F32_4;
Tim Murray89daad62013-07-29 14:30:02 -0700487 sp<const Element> F64;
Tim Murrayeb4426d2013-08-27 15:30:16 -0700488 sp<const Element> F64_2;
489 sp<const Element> F64_3;
490 sp<const Element> F64_4;
Tim Murray89daad62013-07-29 14:30:02 -0700491 sp<const Element> BOOLEAN;
Tim Murray84bf2b82012-10-31 16:03:16 -0700492
Tim Murray89daad62013-07-29 14:30:02 -0700493 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 Murray84bf2b82012-10-31 16:03:16 -0700503
Tim Murray89daad62013-07-29 14:30:02 -0700504 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 Murray84bf2b82012-10-31 16:03:16 -0700510
Tim Murrayeb4426d2013-08-27 15:30:16 -0700511 sp<const Element> YUV;
Tim Murray84bf2b82012-10-31 16:03:16 -0700512
Tim Murray89daad62013-07-29 14:30:02 -0700513 sp<const Element> MATRIX_4X4;
514 sp<const Element> MATRIX_3X3;
515 sp<const Element> MATRIX_2X2;
Tim Murray84bf2b82012-10-31 16:03:16 -0700516 } mElements;
517
Tim Murray729b6fe2013-07-23 16:20:42 -0700518 struct {
Tim Murray89daad62013-07-29 14:30:02 -0700519 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 Murray729b6fe2013-07-23 16:20:42 -0700528 } mSamplers;
529 friend class Sampler;
530 friend class Element;
Tim Murraycaf41262013-12-13 12:54:37 -0800531 friend class ScriptC;
Tim Murray84bf2b82012-10-31 16:03:16 -0700532};
533
Tim Murray75e877d2013-09-11 14:45:20 -0700534 /**
535 * Base class for all RenderScript objects. Not for direct use by developers.
536 */
Tim Murray89daad62013-07-29 14:30:02 -0700537class BaseObj : public android::RSC::LightRefBase<BaseObj> {
538public:
539 void * getID() const;
540 virtual ~BaseObj();
541 virtual void updateFromNative();
542 virtual bool equals(sp<const BaseObj> obj);
543
Tim Murray84bf2b82012-10-31 16:03:16 -0700544protected:
545 void *mID;
Tim Murray35609072013-12-03 11:36:03 -0800546 RS* mRS;
Miao Wangbc10dff2015-04-03 17:44:55 -0700547 const char * mName;
Tim Murray84bf2b82012-10-31 16:03:16 -0700548
549 BaseObj(void *id, sp<RS> rs);
550 void checkValid();
551
552 static void * getObjID(sp<const BaseObj> o);
553
Tim Murray84bf2b82012-10-31 16:03:16 -0700554};
555
Tim Murray75e877d2013-09-11 14:45:20 -0700556 /**
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 Murray84bf2b82012-10-31 16:03:16 -0700571class Allocation : public BaseObj {
572protected:
Tim Murray89daad62013-07-29 14:30:02 -0700573 sp<const Type> mType;
Tim Murray84bf2b82012-10-31 16:03:16 -0700574 uint32_t mUsage;
Tim Murray89daad62013-07-29 14:30:02 -0700575 sp<Allocation> mAdaptedAllocation;
Tim Murray84bf2b82012-10-31 16:03:16 -0700576
577 bool mConstrainedLOD;
578 bool mConstrainedFace;
579 bool mConstrainedY;
580 bool mConstrainedZ;
581 bool mReadAllowed;
582 bool mWriteAllowed;
Miao Wange5428e62015-03-10 15:29:40 -0700583 bool mAutoPadding;
Tim Murray84bf2b82012-10-31 16:03:16 -0700584 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 Wange5428e62015-03-10 15:29:40 -0700599 void validateIsInt64();
Tim Murray84bf2b82012-10-31 16:03:16 -0700600 void validateIsInt32();
601 void validateIsInt16();
602 void validateIsInt8();
603 void validateIsFloat32();
Miao Wange5428e62015-03-10 15:29:40 -0700604 void validateIsFloat64();
Tim Murray84bf2b82012-10-31 16:03:16 -0700605 void validateIsObject();
606
607 virtual void updateFromNative();
608
609 void validate2DRange(uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h);
Tim Murray9d24ae62013-08-30 12:17:14 -0700610 void validate3DRange(uint32_t xoff, uint32_t yoff, uint32_t zoff,
611 uint32_t w, uint32_t h, uint32_t d);
Tim Murray84bf2b82012-10-31 16:03:16 -0700612
613public:
Tim Murray75e877d2013-09-11 14:45:20 -0700614
615 /**
616 * Return Type for the allocation.
617 * @return pointer to underlying Type
618 */
Stephen Hinesa180b7d2013-08-21 12:42:13 -0700619 sp<const Type> getType() const {
Tim Murray84bf2b82012-10-31 16:03:16 -0700620 return mType;
621 }
622
Tim Murray75e877d2013-09-11 14:45:20 -0700623 /**
Miao Wange5428e62015-03-10 15:29:40 -0700624 * 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 Murray75e877d2013-09-11 14:45:20 -0700634 * 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 Murray84bf2b82012-10-31 16:03:16 -0700637 void syncAll(RsAllocationUsageType srcLocation);
Miao Wang09d2dd22015-03-18 20:09:20 -0700638
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 Murray84bf2b82012-10-31 16:03:16 -0700644 void ioSendOutput();
Miao Wang09d2dd22015-03-18 20:09:20 -0700645
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 Murray84bf2b82012-10-31 16:03:16 -0700650 void ioGetInput();
651
Miao Wang09d2dd22015-03-18 20:09:20 -0700652#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 Murray75e877d2013-09-11 14:45:20 -0700668 /**
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 Murray84bf2b82012-10-31 16:03:16 -0700675 void generateMipmaps();
Tim Murray509ea5c2012-11-13 11:56:40 -0800676
Tim Murray75e877d2013-09-11 14:45:20 -0700677 /**
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 Murray0b93e302012-11-15 14:56:54 -0800683 void copy1DRangeFrom(uint32_t off, size_t count, const void *data);
Tim Murray75e877d2013-09-11 14:45:20 -0700684
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 Murraya4cbc2b2012-11-14 17:18:08 -0800692 void copy1DRangeFrom(uint32_t off, size_t count, sp<const Allocation> data, uint32_t dataOff);
Tim Murray84bf2b82012-10-31 16:03:16 -0700693
Tim Murray75e877d2013-09-11 14:45:20 -0700694 /**
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 Murray0b93e302012-11-15 14:56:54 -0800700 void copy1DRangeTo(uint32_t off, size_t count, void *data);
701
Tim Murray75e877d2013-09-11 14:45:20 -0700702 /**
703 * Copy entire array to an Allocation.
704 * @param[in] data array from which to copy
705 */
Tim Murray0b93e302012-11-15 14:56:54 -0800706 void copy1DFrom(const void* data);
Tim Murray75e877d2013-09-11 14:45:20 -0700707
708 /**
709 * Copy entire Allocation to an array.
710 * @param[in] data destination array
711 */
Tim Murray0b93e302012-11-15 14:56:54 -0800712 void copy1DTo(void* data);
Tim Murraya4cbc2b2012-11-14 17:18:08 -0800713
Tim Murray75e877d2013-09-11 14:45:20 -0700714 /**
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 Murray84bf2b82012-10-31 16:03:16 -0700723 void copy2DRangeFrom(uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h,
Tim Murray0b93e302012-11-15 14:56:54 -0800724 const void *data);
Tim Murray7b3e3092012-11-16 13:32:24 -0800725
Tim Murray75e877d2013-09-11 14:45:20 -0700726 /**
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 Murray7b3e3092012-11-16 13:32:24 -0800735 void copy2DRangeTo(uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h,
736 void *data);
737
Tim Murray75e877d2013-09-11 14:45:20 -0700738 /**
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 Murray0b93e302012-11-15 14:56:54 -0800748 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 Murray84bf2b82012-10-31 16:03:16 -0700750
Tim Murray75e877d2013-09-11 14:45:20 -0700751 /**
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 Murray358747a2012-11-26 13:52:04 -0800760 void copy2DStridedFrom(uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h,
761 const void *data, size_t stride);
Tim Murray75e877d2013-09-11 14:45:20 -0700762
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 Murray358747a2012-11-26 13:52:04 -0800768 void copy2DStridedFrom(const void *data, size_t stride);
769
Tim Murray75e877d2013-09-11 14:45:20 -0700770 /**
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 Murray358747a2012-11-26 13:52:04 -0800779 void copy2DStridedTo(uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h,
780 void *data, size_t stride);
Tim Murray75e877d2013-09-11 14:45:20 -0700781
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 Murray358747a2012-11-26 13:52:04 -0800787 void copy2DStridedTo(void *data, size_t stride);
788
Tim Murray75e877d2013-09-11 14:45:20 -0700789
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 Murray9d24ae62013-08-30 12:17:14 -0700801 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 Murray75e877d2013-09-11 14:45:20 -0700804 /**
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 Murray9d24ae62013-08-30 12:17:14 -0700817 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 Murray84bf2b82012-10-31 16:03:16 -0700821
Tim Murray75e877d2013-09-11 14:45:20 -0700822 /**
Miao Wange5428e62015-03-10 15:29:40 -0700823 * 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 Murray75e877d2013-09-11 14:45:20 -0700837 * 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 Hines8f615d62013-12-20 12:23:32 -0800840 * @param[in] mipmaps desired mipmap behavior for the Allocation
Tim Murray75e877d2013-09-11 14:45:20 -0700841 * @param[in] usage usage for the Allocation
842 * @return new Allocation
843 */
Tim Murray84bf2b82012-10-31 16:03:16 -0700844 static sp<Allocation> createTyped(sp<RS> rs, sp<const Type> type,
Stephen Hines8f615d62013-12-20 12:23:32 -0800845 RsAllocationMipmapControl mipmaps, uint32_t usage);
Tim Murray75e877d2013-09-11 14:45:20 -0700846
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 Hines8f615d62013-12-20 12:23:32 -0800852 * @param[in] mipmaps desired mipmap behavior for the Allocation
Tim Murray75e877d2013-09-11 14:45:20 -0700853 * @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 Murray84bf2b82012-10-31 16:03:16 -0700857 static sp<Allocation> createTyped(sp<RS> rs, sp<const Type> type,
Stephen Hines8f615d62013-12-20 12:23:32 -0800858 RsAllocationMipmapControl mipmaps, uint32_t usage, void * pointer);
Tim Murray84bf2b82012-10-31 16:03:16 -0700859
Tim Murray75e877d2013-09-11 14:45:20 -0700860 /**
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 Murray84bf2b82012-10-31 16:03:16 -0700867 static sp<Allocation> createTyped(sp<RS> rs, sp<const Type> type,
868 uint32_t usage = RS_ALLOCATION_USAGE_SCRIPT);
Tim Murray75e877d2013-09-11 14:45:20 -0700869 /**
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 Murray84bf2b82012-10-31 16:03:16 -0700877 static sp<Allocation> createSized(sp<RS> rs, sp<const Element> e, size_t count,
878 uint32_t usage = RS_ALLOCATION_USAGE_SCRIPT);
Tim Murray75e877d2013-09-11 14:45:20 -0700879
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 Murray684726c2012-11-14 11:57:42 -0800889 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 Murray84bf2b82012-10-31 16:03:16 -0700893
Jason Samsb8a94e22014-02-24 17:52:32 -0800894 /**
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 Murray84bf2b82012-10-31 16:03:16 -0700901};
902
Tim Murray75e877d2013-09-11 14:45:20 -0700903 /**
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 Murray84bf2b82012-10-31 16:03:16 -0700923class Element : public BaseObj {
924public:
925 bool isComplex();
Tim Murray75e877d2013-09-11 14:45:20 -0700926
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 Murray84bf2b82012-10-31 16:03:16 -0700934 size_t getSubElementCount() {
Miao Wangbc10dff2015-04-03 17:44:55 -0700935 return mVisibleElementMapSize;
Tim Murray84bf2b82012-10-31 16:03:16 -0700936 }
937
Tim Murray75e877d2013-09-11 14:45:20 -0700938 /**
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 Murray84bf2b82012-10-31 16:03:16 -0700943 sp<const Element> getSubElement(uint32_t index);
Tim Murray75e877d2013-09-11 14:45:20 -0700944
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 Murray84bf2b82012-10-31 16:03:16 -0700951 const char * getSubElementName(uint32_t index);
Tim Murray75e877d2013-09-11 14:45:20 -0700952
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 Murray84bf2b82012-10-31 16:03:16 -0700959 size_t getSubElementArraySize(uint32_t index);
Tim Murray75e877d2013-09-11 14:45:20 -0700960
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 Murray84bf2b82012-10-31 16:03:16 -0700966 uint32_t getSubElementOffsetBytes(uint32_t index);
Tim Murray75e877d2013-09-11 14:45:20 -0700967
968 /**
969 * Returns the data type used for the Element.
970 * @return data type
971 */
Tim Murray84bf2b82012-10-31 16:03:16 -0700972 RsDataType getDataType() const {
973 return mType;
974 }
975
Tim Murray75e877d2013-09-11 14:45:20 -0700976 /**
977 * Returns the data kind used for the Element.
978 * @return data kind
979 */
Tim Murray84bf2b82012-10-31 16:03:16 -0700980 RsDataKind getDataKind() const {
981 return mKind;
982 }
983
Tim Murray75e877d2013-09-11 14:45:20 -0700984 /**
985 * Returns the size in bytes of the Element.
986 * @return size in bytes
987 */
Tim Murray84bf2b82012-10-31 16:03:16 -0700988 size_t getSizeBytes() const {
989 return mSizeBytes;
990 }
991
Tim Murray75e877d2013-09-11 14:45:20 -0700992 /**
993 * Returns the number of vector components for this Element.
994 * @return number of vector components
995 */
Tim Murray10913a52013-08-20 17:19:47 -0700996 uint32_t getVectorSize() const {
997 return mVectorSize;
998 }
999
Tim Murray75e877d2013-09-11 14:45:20 -07001000 /**
1001 * Utility function for returning an Element containing a single bool.
1002 * @param[in] rs RenderScript context
1003 * @return Element
1004 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001005 static sp<const Element> BOOLEAN(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001006 /**
1007 * Utility function for returning an Element containing a single unsigned char.
1008 * @param[in] rs RenderScript context
1009 * @return Element
1010 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001011 static sp<const Element> U8(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001012 /**
1013 * Utility function for returning an Element containing a single signed char.
1014 * @param[in] rs RenderScript context
1015 * @return Element
1016 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001017 static sp<const Element> I8(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001018 /**
1019 * Utility function for returning an Element containing a single unsigned short.
1020 * @param[in] rs RenderScript context
1021 * @return Element
1022 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001023 static sp<const Element> U16(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001024 /**
1025 * Utility function for returning an Element containing a single signed short.
1026 * @param[in] rs RenderScript context
1027 * @return Element
1028 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001029 static sp<const Element> I16(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001030 /**
1031 * Utility function for returning an Element containing a single unsigned int.
1032 * @param[in] rs RenderScript context
1033 * @return Element
1034 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001035 static sp<const Element> U32(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001036 /**
1037 * Utility function for returning an Element containing a single signed int.
1038 * @param[in] rs RenderScript context
1039 * @return Element
1040 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001041 static sp<const Element> I32(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001042 /**
1043 * Utility function for returning an Element containing a single unsigned long long.
1044 * @param[in] rs RenderScript context
1045 * @return Element
1046 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001047 static sp<const Element> U64(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001048 /**
1049 * Utility function for returning an Element containing a single signed long long.
1050 * @param[in] rs RenderScript context
1051 * @return Element
1052 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001053 static sp<const Element> I64(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001054 /**
1055 * Utility function for returning an Element containing a single float.
1056 * @param[in] rs RenderScript context
1057 * @return Element
1058 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001059 static sp<const Element> F32(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001060 /**
1061 * Utility function for returning an Element containing a single double.
1062 * @param[in] rs RenderScript context
1063 * @return Element
1064 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001065 static sp<const Element> F64(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001066 /**
1067 * Utility function for returning an Element containing a single Element.
1068 * @param[in] rs RenderScript context
1069 * @return Element
1070 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001071 static sp<const Element> ELEMENT(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001072 /**
1073 * Utility function for returning an Element containing a single Type.
1074 * @param[in] rs RenderScript context
1075 * @return Element
1076 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001077 static sp<const Element> TYPE(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001078 /**
1079 * Utility function for returning an Element containing a single Allocation.
1080 * @param[in] rs RenderScript context
1081 * @return Element
1082 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001083 static sp<const Element> ALLOCATION(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001084 /**
1085 * Utility function for returning an Element containing a single Sampler.
1086 * @param[in] rs RenderScript context
1087 * @return Element
1088 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001089 static sp<const Element> SAMPLER(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001090 /**
1091 * Utility function for returning an Element containing a single Script.
1092 * @param[in] rs RenderScript context
1093 * @return Element
1094 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001095 static sp<const Element> SCRIPT(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001096 /**
1097 * Utility function for returning an Element containing an ALPHA_8 pixel.
1098 * @param[in] rs RenderScript context
1099 * @return Element
1100 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001101 static sp<const Element> A_8(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001102 /**
1103 * Utility function for returning an Element containing an RGB_565 pixel.
1104 * @param[in] rs RenderScript context
1105 * @return Element
1106 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001107 static sp<const Element> RGB_565(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001108 /**
1109 * Utility function for returning an Element containing an RGB_888 pixel.
1110 * @param[in] rs RenderScript context
1111 * @return Element
1112 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001113 static sp<const Element> RGB_888(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001114 /**
1115 * Utility function for returning an Element containing an RGBA_5551 pixel.
1116 * @param[in] rs RenderScript context
1117 * @return Element
1118 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001119 static sp<const Element> RGBA_5551(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001120 /**
1121 * Utility function for returning an Element containing an RGBA_4444 pixel.
1122 * @param[in] rs RenderScript context
1123 * @return Element
1124 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001125 static sp<const Element> RGBA_4444(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001126 /**
1127 * Utility function for returning an Element containing an RGBA_8888 pixel.
1128 * @param[in] rs RenderScript context
1129 * @return Element
1130 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001131 static sp<const Element> RGBA_8888(sp<RS> rs);
1132
Tim Murray75e877d2013-09-11 14:45:20 -07001133 /**
1134 * Utility function for returning an Element containing a float2.
1135 * @param[in] rs RenderScript context
1136 * @return Element
1137 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001138 static sp<const Element> F32_2(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001139 /**
1140 * Utility function for returning an Element containing a float3.
1141 * @param[in] rs RenderScript context
1142 * @return Element
1143 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001144 static sp<const Element> F32_3(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001145 /**
1146 * Utility function for returning an Element containing a float4.
1147 * @param[in] rs RenderScript context
1148 * @return Element
1149 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001150 static sp<const Element> F32_4(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001151 /**
1152 * Utility function for returning an Element containing a double2.
1153 * @param[in] rs RenderScript context
1154 * @return Element
1155 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001156 static sp<const Element> F64_2(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001157 /**
1158 * Utility function for returning an Element containing a double3.
1159 * @param[in] rs RenderScript context
1160 * @return Element
1161 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001162 static sp<const Element> F64_3(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001163 /**
1164 * Utility function for returning an Element containing a double4.
1165 * @param[in] rs RenderScript context
1166 * @return Element
1167 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001168 static sp<const Element> F64_4(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001169 /**
1170 * Utility function for returning an Element containing a uchar2.
1171 * @param[in] rs RenderScript context
1172 * @return Element
1173 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001174 static sp<const Element> U8_2(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001175 /**
1176 * Utility function for returning an Element containing a uchar3.
1177 * @param[in] rs RenderScript context
1178 * @return Element
1179 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001180 static sp<const Element> U8_3(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001181 /**
1182 * Utility function for returning an Element containing a uchar4.
1183 * @param[in] rs RenderScript context
1184 * @return Element
1185 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001186 static sp<const Element> U8_4(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001187 /**
1188 * Utility function for returning an Element containing a char2.
1189 * @param[in] rs RenderScript context
1190 * @return Element
1191 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001192 static sp<const Element> I8_2(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001193 /**
1194 * Utility function for returning an Element containing a char3.
1195 * @param[in] rs RenderScript context
1196 * @return Element
1197 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001198 static sp<const Element> I8_3(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001199 /**
1200 * Utility function for returning an Element containing a char4.
1201 * @param[in] rs RenderScript context
1202 * @return Element
1203 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001204 static sp<const Element> I8_4(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001205 /**
1206 * Utility function for returning an Element containing a ushort2.
1207 * @param[in] rs RenderScript context
1208 * @return Element
1209 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001210 static sp<const Element> U16_2(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001211 /**
1212 * Utility function for returning an Element containing a ushort3.
1213 * @param[in] rs RenderScript context
1214 * @return Element
1215 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001216 static sp<const Element> U16_3(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001217 /**
1218 * Utility function for returning an Element containing a ushort4.
1219 * @param[in] rs RenderScript context
1220 * @return Element
1221 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001222 static sp<const Element> U16_4(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001223 /**
1224 * Utility function for returning an Element containing a short2.
1225 * @param[in] rs RenderScript context
1226 * @return Element
1227 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001228 static sp<const Element> I16_2(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001229 /**
1230 * Utility function for returning an Element containing a short3.
1231 * @param[in] rs RenderScript context
1232 * @return Element
1233 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001234 static sp<const Element> I16_3(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001235 /**
1236 * Utility function for returning an Element containing a short4.
1237 * @param[in] rs RenderScript context
1238 * @return Element
1239 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001240 static sp<const Element> I16_4(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001241 /**
1242 * Utility function for returning an Element containing a uint2.
1243 * @param[in] rs RenderScript context
1244 * @return Element
1245 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001246 static sp<const Element> U32_2(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001247 /**
1248 * Utility function for returning an Element containing a uint3.
1249 * @param[in] rs RenderScript context
1250 * @return Element
1251 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001252 static sp<const Element> U32_3(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001253 /**
1254 * Utility function for returning an Element containing a uint4.
1255 * @param[in] rs RenderScript context
1256 * @return Element
1257 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001258 static sp<const Element> U32_4(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001259 /**
1260 * Utility function for returning an Element containing an int2.
1261 * @param[in] rs RenderScript context
1262 * @return Element
1263 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001264 static sp<const Element> I32_2(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001265 /**
1266 * Utility function for returning an Element containing an int3.
1267 * @param[in] rs RenderScript context
1268 * @return Element
1269 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001270 static sp<const Element> I32_3(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001271 /**
1272 * Utility function for returning an Element containing an int4.
1273 * @param[in] rs RenderScript context
1274 * @return Element
1275 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001276 static sp<const Element> I32_4(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001277 /**
1278 * Utility function for returning an Element containing a ulong2.
1279 * @param[in] rs RenderScript context
1280 * @return Element
1281 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001282 static sp<const Element> U64_2(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001283 /**
1284 * Utility function for returning an Element containing a ulong3.
1285 * @param[in] rs RenderScript context
1286 * @return Element
1287 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001288 static sp<const Element> U64_3(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001289 /**
1290 * Utility function for returning an Element containing a ulong4.
1291 * @param[in] rs RenderScript context
1292 * @return Element
1293 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001294 static sp<const Element> U64_4(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001295 /**
1296 * Utility function for returning an Element containing a long2.
1297 * @param[in] rs RenderScript context
1298 * @return Element
1299 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001300 static sp<const Element> I64_2(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001301 /**
1302 * Utility function for returning an Element containing a long3.
1303 * @param[in] rs RenderScript context
1304 * @return Element
1305 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001306 static sp<const Element> I64_3(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001307 /**
1308 * Utility function for returning an Element containing a long4.
1309 * @param[in] rs RenderScript context
1310 * @return Element
1311 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001312 static sp<const Element> I64_4(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001313 /**
1314 * Utility function for returning an Element containing a YUV pixel.
1315 * @param[in] rs RenderScript context
1316 * @return Element
1317 */
Tim Murrayeb4426d2013-08-27 15:30:16 -07001318 static sp<const Element> YUV(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001319 /**
1320 * Utility function for returning an Element containing an rs_matrix_4x4.
1321 * @param[in] rs RenderScript context
1322 * @return Element
1323 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001324 static sp<const Element> MATRIX_4X4(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001325 /**
1326 * Utility function for returning an Element containing an rs_matrix_3x3.
1327 * @param[in] rs RenderScript context
1328 * @return Element
1329 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001330 static sp<const Element> MATRIX_3X3(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07001331 /**
1332 * Utility function for returning an Element containing an rs_matrix_2x2.
1333 * @param[in] rs RenderScript context
1334 * @return Element
1335 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001336 static sp<const Element> MATRIX_2X2(sp<RS> rs);
1337
Tim Murray84bf2b82012-10-31 16:03:16 -07001338 void updateFromNative();
Tim Murray75e877d2013-09-11 14:45:20 -07001339
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 Murray84bf2b82012-10-31 16:03:16 -07001346 static sp<const Element> createUser(sp<RS> rs, RsDataType dt);
Tim Murray75e877d2013-09-11 14:45:20 -07001347 /**
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 Murray84bf2b82012-10-31 16:03:16 -07001354 static sp<const Element> createVector(sp<RS> rs, RsDataType dt, uint32_t size);
Tim Murray75e877d2013-09-11 14:45:20 -07001355 /**
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 Murray84bf2b82012-10-31 16:03:16 -07001362 static sp<const Element> createPixel(sp<RS> rs, RsDataType dt, RsDataKind dk);
Tim Murray75e877d2013-09-11 14:45:20 -07001363
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 Murray10913a52013-08-20 17:19:47 -07001369 bool isCompatible(sp<const Element>e) const;
Tim Murray84bf2b82012-10-31 16:03:16 -07001370
Tim Murray75e877d2013-09-11 14:45:20 -07001371 /**
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 Murray84bf2b82012-10-31 16:03:16 -07001376 class Builder {
1377 private:
Tim Murray35609072013-12-03 11:36:03 -08001378 RS* mRS;
Miao Wangbc10dff2015-04-03 17:44:55 -07001379 size_t mElementsCount;
1380 size_t mElementsVecSize;
1381 sp<const Element> * mElements;
1382 char ** mElementNames;
1383 size_t * mElementNameLengths;
1384 uint32_t * mArraySizes;
Tim Murray84bf2b82012-10-31 16:03:16 -07001385 bool mSkipPadding;
1386
1387 public:
1388 Builder(sp<RS> rs);
1389 ~Builder();
Miao Wangbc10dff2015-04-03 17:44:55 -07001390 void add(sp<const Element> e, const char * name, uint32_t arraySize = 1);
Tim Murray84bf2b82012-10-31 16:03:16 -07001391 sp<const Element> create();
1392 };
1393
Stephen Hines7d1b7572013-08-22 01:24:06 -07001394protected:
Miao Wang70d89952015-09-14 15:05:41 -07001395 friend class Type;
Stephen Hines7d1b7572013-08-22 01:24:06 -07001396 Element(void *id, sp<RS> rs,
Miao Wangbc10dff2015-04-03 17:44:55 -07001397 sp<const Element> * elements,
1398 size_t elementCount,
1399 const char ** elementNames,
1400 size_t * elementNameLengths,
1401 uint32_t * arraySizes);
Stephen Hines7d1b7572013-08-22 01:24:06 -07001402 Element(void *id, sp<RS> rs, RsDataType dt, RsDataKind dk, bool norm, uint32_t size);
Miao Wang70d89952015-09-14 15:05:41 -07001403 Element(void *id, sp<RS> rs);
Stephen Hines7d1b7572013-08-22 01:24:06 -07001404 Element(sp<RS> rs);
1405 virtual ~Element();
1406
Tim Murray84bf2b82012-10-31 16:03:16 -07001407private:
1408 void updateVisibleSubElements();
1409
Miao Wangbc10dff2015-04-03 17:44:55 -07001410 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 Murray84bf2b82012-10-31 16:03:16 -07001419
1420 RsDataType mType;
1421 RsDataKind mKind;
1422 bool mNormalized;
1423 size_t mSizeBytes;
1424 size_t mVectorSize;
1425};
1426
Stephen Hines2c7206e2012-11-14 19:47:01 -08001427class FieldPacker {
1428protected:
1429 unsigned char* mData;
1430 size_t mPos;
1431 size_t mLen;
1432
1433public:
1434 FieldPacker(size_t len)
Tim Murray89daad62013-07-29 14:30:02 -07001435 : mPos(0), mLen(len) {
1436 mData = new unsigned char[len];
1437 }
Stephen Hines2c7206e2012-11-14 19:47:01 -08001438
1439 virtual ~FieldPacker() {
1440 delete [] mData;
1441 }
1442
1443 void align(size_t v) {
1444 if ((v & (v - 1)) != 0) {
Tim Murrayab716362013-08-12 12:37:18 -07001445 // ALOGE("Non-power-of-two alignment: %zu", v);
Stephen Hines2c7206e2012-11-14 19:47:01 -08001446 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 Murrayab716362013-08-12 12:37:18 -07001460 // ALOGE("Out of bounds: i (%zu) >= len (%zu)", i, mLen);
Stephen Hines2c7206e2012-11-14 19:47:01 -08001461 return;
1462 }
1463 mPos = i;
1464 }
1465
1466 void skip(size_t i) {
1467 size_t res = mPos + i;
1468 if (res > mLen) {
Tim Murrayab716362013-08-12 12:37:18 -07001469 // ALOGE("Exceeded buffer length: i (%zu) > len (%zu)", i, mLen);
Stephen Hines2c7206e2012-11-14 19:47:01 -08001470 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 Murray89daad62013-07-29 14:30:02 -07001484 void add(T t) {
Stephen Hines2c7206e2012-11-14 19:47:01 -08001485 align(sizeof(t));
1486 if (mPos + sizeof(t) <= mLen) {
1487 memcpy(&mData[mPos], &t, sizeof(t));
1488 mPos += sizeof(t);
1489 }
1490 }
Stephen Hines43514cd2012-11-16 14:33:47 -08001491
1492 /*
Tim Murray89daad62013-07-29 14:30:02 -07001493 void add(rs_matrix4x4 m) {
1494 for (size_t i = 0; i < 16; i++) {
1495 add(m.m[i]);
1496 }
1497 }
Stephen Hines43514cd2012-11-16 14:33:47 -08001498
Tim Murray89daad62013-07-29 14:30:02 -07001499 void add(rs_matrix3x3 m) {
1500 for (size_t i = 0; i < 9; i++) {
1501 add(m.m[i]);
1502 }
1503 }
Stephen Hines43514cd2012-11-16 14:33:47 -08001504
Tim Murray89daad62013-07-29 14:30:02 -07001505 void add(rs_matrix2x2 m) {
1506 for (size_t i = 0; i < 4; i++) {
1507 add(m.m[i]);
1508 }
1509 }
Stephen Hines43514cd2012-11-16 14:33:47 -08001510 */
1511
Tim Murray89daad62013-07-29 14:30:02 -07001512 void add(sp<BaseObj> obj) {
Stephen Hines43514cd2012-11-16 14:33:47 -08001513 if (obj != NULL) {
1514 add((uint32_t) (uintptr_t) obj->getID());
1515 } else {
1516 add((uint32_t) 0);
1517 }
1518 }
Stephen Hines2c7206e2012-11-14 19:47:01 -08001519};
1520
Tim Murray75e877d2013-09-11 14:45:20 -07001521/**
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 Nainarc6f43742015-11-06 20:47:25 -08001536 * format. The YUV formats supported are RS_YUV_YV12 and RS_YUV_NV21.
Tim Murray75e877d2013-09-11 14:45:20 -07001537 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001538class Type : public BaseObj {
1539protected:
1540 friend class Allocation;
1541
1542 uint32_t mDimX;
1543 uint32_t mDimY;
1544 uint32_t mDimZ;
Pirama Arumuga Nainarc6f43742015-11-06 20:47:25 -08001545 RsYuvFormat mYuvFormat;
Tim Murray84bf2b82012-10-31 16:03:16 -07001546 bool mDimMipmaps;
1547 bool mDimFaces;
1548 size_t mElementCount;
1549 sp<const Element> mElement;
1550
Stephen Hines7d1b7572013-08-22 01:24:06 -07001551 Type(void *id, sp<RS> rs);
1552
Tim Murray84bf2b82012-10-31 16:03:16 -07001553 void calcElementCount();
1554 virtual void updateFromNative();
1555
1556public:
1557
Tim Murray75e877d2013-09-11 14:45:20 -07001558 /**
1559 * Returns the YUV format.
1560 * @return YUV format of the Allocation
1561 */
Pirama Arumuga Nainarc6f43742015-11-06 20:47:25 -08001562 RsYuvFormat getYuvFormat() const {
Tim Murrayeb4426d2013-08-27 15:30:16 -07001563 return mYuvFormat;
1564 }
1565
Tim Murray75e877d2013-09-11 14:45:20 -07001566 /**
1567 * Returns the Element of the Allocation.
1568 * @return YUV format of the Allocation
1569 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001570 sp<const Element> getElement() const {
1571 return mElement;
1572 }
1573
Tim Murray75e877d2013-09-11 14:45:20 -07001574 /**
1575 * Returns the X dimension of the Allocation.
1576 * @return X dimension of the allocation
1577 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001578 uint32_t getX() const {
1579 return mDimX;
1580 }
1581
Tim Murray75e877d2013-09-11 14:45:20 -07001582 /**
1583 * Returns the Y dimension of the Allocation.
1584 * @return Y dimension of the allocation
1585 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001586 uint32_t getY() const {
1587 return mDimY;
1588 }
1589
Tim Murray75e877d2013-09-11 14:45:20 -07001590 /**
1591 * Returns the Z dimension of the Allocation.
1592 * @return Z dimension of the allocation
1593 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001594 uint32_t getZ() const {
1595 return mDimZ;
1596 }
1597
Tim Murray75e877d2013-09-11 14:45:20 -07001598 /**
1599 * Returns true if the Allocation has mipmaps.
1600 * @return true if the Allocation has mipmaps
1601 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001602 bool hasMipmaps() const {
1603 return mDimMipmaps;
1604 }
1605
Tim Murray75e877d2013-09-11 14:45:20 -07001606 /**
1607 * Returns true if the Allocation is a cube map
1608 * @return true if the Allocation is a cube map
1609 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001610 bool hasFaces() const {
1611 return mDimFaces;
1612 }
1613
Tim Murray75e877d2013-09-11 14:45:20 -07001614 /**
1615 * Returns number of accessible Elements in the Allocation
1616 * @return number of accessible Elements in the Allocation
1617 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001618 size_t getCount() const {
1619 return mElementCount;
1620 }
1621
Tim Murray75e877d2013-09-11 14:45:20 -07001622 /**
1623 * Returns size in bytes of all Elements in the Allocation
1624 * @return size in bytes of all Elements in the Allocation
1625 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001626 size_t getSizeBytes() const {
1627 return mElementCount * mElement->getSizeBytes();
1628 }
1629
Tim Murray75e877d2013-09-11 14:45:20 -07001630 /**
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 Murray96267c22013-02-12 11:25:12 -08001639 static sp<const Type> create(sp<RS> rs, sp<const Element> e, uint32_t dimX, uint32_t dimY, uint32_t dimZ);
Tim Murray84bf2b82012-10-31 16:03:16 -07001640
1641 class Builder {
1642 protected:
Tim Murray35609072013-12-03 11:36:03 -08001643 RS* mRS;
Tim Murray84bf2b82012-10-31 16:03:16 -07001644 uint32_t mDimX;
1645 uint32_t mDimY;
1646 uint32_t mDimZ;
Pirama Arumuga Nainarc6f43742015-11-06 20:47:25 -08001647 RsYuvFormat mYuvFormat;
Tim Murray84bf2b82012-10-31 16:03:16 -07001648 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 Hines7d1b7572013-08-22 01:24:06 -07001656 void setY(uint32_t value);
Tim Murrayeb4426d2013-08-27 15:30:16 -07001657 void setZ(uint32_t value);
Pirama Arumuga Nainarc6f43742015-11-06 20:47:25 -08001658 void setYuvFormat(RsYuvFormat format);
Tim Murray84bf2b82012-10-31 16:03:16 -07001659 void setMipmaps(bool value);
1660 void setFaces(bool value);
1661 sp<const Type> create();
1662 };
1663
1664};
1665
Tim Murray75e877d2013-09-11 14:45:20 -07001666/**
1667 * The parent class for all executable Scripts. This should not be used by applications.
1668 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001669class Script : public BaseObj {
1670private:
1671
1672protected:
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 Wala394e9a62015-08-03 11:35:55 -07001676 void reduce(uint32_t slot, sp<const Allocation> in, sp<const Allocation> out,
1677 const RsScriptCall *sc) const;
Tim Murray84bf2b82012-10-31 16:03:16 -07001678 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 Parrb05c8502015-03-13 14:41:58 +00001696 void setVar(uint32_t index, uint32_t v) const {
1697 setVar(index, &v, sizeof(v));
1698 }
Tim Murray84bf2b82012-10-31 16:03:16 -07001699 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
1706public:
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 Murray75e877d2013-09-11 14:45:20 -07001731/**
1732 * The parent class for all user-defined scripts. This is intended to be used by auto-generated code only.
1733 */
Tim Murray84bf2b82012-10-31 16:03:16 -07001734class ScriptC : public Script {
1735protected:
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 Murray75e877d2013-09-11 14:45:20 -07001743/**
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 Murray7f0d5682012-11-08 16:35:24 -08001747class ScriptIntrinsic : public Script {
1748 protected:
Tim Murray10913a52013-08-20 17:19:47 -07001749 sp<const Element> mElement;
Tim Murray3cd44af2012-11-14 11:25:27 -08001750 ScriptIntrinsic(sp<RS> rs, int id, sp<const Element> e);
Tim Murrayb27b1812013-08-05 14:00:40 -07001751 virtual ~ScriptIntrinsic();
Tim Murray7f0d5682012-11-08 16:35:24 -08001752};
1753
Tim Murray75e877d2013-09-11 14:45:20 -07001754/**
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 Murray89daad62013-07-29 14:30:02 -07001760class ScriptIntrinsic3DLUT : public ScriptIntrinsic {
Tim Murray21fa7a02013-08-15 16:25:03 -07001761 private:
Tim Murray89daad62013-07-29 14:30:02 -07001762 ScriptIntrinsic3DLUT(sp<RS> rs, sp<const Element> e);
Tim Murray21fa7a02013-08-15 16:25:03 -07001763 public:
Tim Murray75e877d2013-09-11 14:45:20 -07001764 /**
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 Murray21fa7a02013-08-15 16:25:03 -07001770 static sp<ScriptIntrinsic3DLUT> create(sp<RS> rs, sp<const Element> e);
Tim Murray75e877d2013-09-11 14:45:20 -07001771
1772 /**
1773 * Launch the intrinsic.
1774 * @param[in] ain input Allocation
1775 * @param[in] aout output Allocation
1776 */
Tim Murray89daad62013-07-29 14:30:02 -07001777 void forEach(sp<Allocation> ain, sp<Allocation> aout);
Tim Murray75e877d2013-09-11 14:45:20 -07001778
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 Murray89daad62013-07-29 14:30:02 -07001784 void setLUT(sp<Allocation> lut);
1785};
1786
Miao Wang49b12262015-09-04 11:48:16 -07001787
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 **/
1797class 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 Murray75e877d2013-09-11 14:45:20 -07003727/**
3728 * Intrinsic kernel for blending two Allocations.
3729 */
Tim Murray7f0d5682012-11-08 16:35:24 -08003730class ScriptIntrinsicBlend : public ScriptIntrinsic {
Tim Murray21fa7a02013-08-15 16:25:03 -07003731 private:
Tim Murray89daad62013-07-29 14:30:02 -07003732 ScriptIntrinsicBlend(sp<RS> rs, sp<const Element> e);
Tim Murray21fa7a02013-08-15 16:25:03 -07003733 public:
Tim Murray75e877d2013-09-11 14:45:20 -07003734 /**
3735 * Supported Element types are U8_4.
3736 * @param[in] rs RenderScript context
3737 * @param[in] e Element
3738 * @return new ScriptIntrinsicBlend
3739 */
Tim Murray21fa7a02013-08-15 16:25:03 -07003740 static sp<ScriptIntrinsicBlend> create(sp<RS> rs, sp<const Element> e);
Tim Murray75e877d2013-09-11 14:45:20 -07003741 /**
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 Murray7f0d5682012-11-08 16:35:24 -08003831};
Tim Murray84bf2b82012-10-31 16:03:16 -07003832
Tim Murray75e877d2013-09-11 14:45:20 -07003833/**
3834 * Intrinsic Gausian blur filter. Applies a Gaussian blur of the specified
3835 * radius to all elements of an Allocation.
3836 */
Tim Murray8f1e60c2012-11-13 12:25:11 -08003837class ScriptIntrinsicBlur : public ScriptIntrinsic {
Tim Murray21fa7a02013-08-15 16:25:03 -07003838 private:
Tim Murray89daad62013-07-29 14:30:02 -07003839 ScriptIntrinsicBlur(sp<RS> rs, sp<const Element> e);
Tim Murray21fa7a02013-08-15 16:25:03 -07003840 public:
Tim Murray75e877d2013-09-11 14:45:20 -07003841 /**
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 Murray21fa7a02013-08-15 16:25:03 -07003847 static sp<ScriptIntrinsicBlur> create(sp<RS> rs, sp<const Element> e);
Tim Murray75e877d2013-09-11 14:45:20 -07003848 /**
3849 * Sets the input of the blur.
3850 * @param[in] in input Allocation
3851 */
Tim Murray21fa7a02013-08-15 16:25:03 -07003852 void setInput(sp<Allocation> in);
Tim Murray75e877d2013-09-11 14:45:20 -07003853 /**
3854 * Runs the intrinsic.
3855 * @param[in] output Allocation
3856 */
Tim Murray21fa7a02013-08-15 16:25:03 -07003857 void forEach(sp<Allocation> out);
Tim Murray75e877d2013-09-11 14:45:20 -07003858 /**
3859 * Sets the radius of the blur. The supported range is 0 < radius <= 25.
3860 * @param[in] radius radius of the blur
3861 */
Tim Murray8f1e60c2012-11-13 12:25:11 -08003862 void setRadius(float radius);
3863};
3864
Tim Murray75e877d2013-09-11 14:45:20 -07003865/**
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 Murray89daad62013-07-29 14:30:02 -07003872class ScriptIntrinsicColorMatrix : public ScriptIntrinsic {
Tim Murray21fa7a02013-08-15 16:25:03 -07003873 private:
Tim Murray89daad62013-07-29 14:30:02 -07003874 ScriptIntrinsicColorMatrix(sp<RS> rs, sp<const Element> e);
Tim Murray21fa7a02013-08-15 16:25:03 -07003875 public:
Tim Murray75e877d2013-09-11 14:45:20 -07003876 /**
3877 * Creates a new intrinsic.
3878 * @param[in] rs RenderScript context
3879 * @return new ScriptIntrinsicColorMatrix
3880 */
Tim Murrayaae73c92013-09-03 17:05:46 -07003881 static sp<ScriptIntrinsicColorMatrix> create(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07003882 /**
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 Murray89daad62013-07-29 14:30:02 -07003888 void forEach(sp<Allocation> in, sp<Allocation> out);
Tim Murray75e877d2013-09-11 14:45:20 -07003889 /**
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 Murray10913a52013-08-20 17:19:47 -07003894 void setAdd(float* add);
Tim Murray75e877d2013-09-11 14:45:20 -07003895
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 Murray89daad62013-07-29 14:30:02 -07003902 void setColorMatrix3(float* m);
Tim Murray75e877d2013-09-11 14:45:20 -07003903 /**
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 Murray89daad62013-07-29 14:30:02 -07003909 void setColorMatrix4(float* m);
Tim Murray75e877d2013-09-11 14:45:20 -07003910 /**
3911 * Set a color matrix to convert from RGB to luminance. The alpha
3912 * channel will be a copy.
3913 */
Tim Murray89daad62013-07-29 14:30:02 -07003914 void setGreyscale();
Tim Murray75e877d2013-09-11 14:45:20 -07003915 /**
3916 * Set the matrix to convert from RGB to YUV with a direct copy of
3917 * the 4th channel.
3918 */
Tim Murray89daad62013-07-29 14:30:02 -07003919 void setRGBtoYUV();
Tim Murray75e877d2013-09-11 14:45:20 -07003920 /**
3921 * Set the matrix to convert from YUV to RGB with a direct copy of
3922 * the 4th channel.
3923 */
Tim Murray89daad62013-07-29 14:30:02 -07003924 void setYUVtoRGB();
3925};
3926
Tim Murray75e877d2013-09-11 14:45:20 -07003927/**
3928 * Intrinsic for applying a 3x3 convolve to an allocation.
3929 */
Tim Murray89daad62013-07-29 14:30:02 -07003930class ScriptIntrinsicConvolve3x3 : public ScriptIntrinsic {
Tim Murray21fa7a02013-08-15 16:25:03 -07003931 private:
Tim Murray89daad62013-07-29 14:30:02 -07003932 ScriptIntrinsicConvolve3x3(sp<RS> rs, sp<const Element> e);
Tim Murray21fa7a02013-08-15 16:25:03 -07003933 public:
Tim Murray75e877d2013-09-11 14:45:20 -07003934 /**
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 Murray21fa7a02013-08-15 16:25:03 -07003941 static sp<ScriptIntrinsicConvolve3x3> create(sp<RS> rs, sp<const Element> e);
Tim Murray75e877d2013-09-11 14:45:20 -07003942 /**
3943 * Sets input for intrinsic.
3944 * @param[in] in input Allocation
3945 */
Tim Murray89daad62013-07-29 14:30:02 -07003946 void setInput(sp<Allocation> in);
Tim Murray75e877d2013-09-11 14:45:20 -07003947 /**
3948 * Launches the intrinsic.
3949 * @param[in] out output Allocation
3950 */
Tim Murray89daad62013-07-29 14:30:02 -07003951 void forEach(sp<Allocation> out);
Tim Murray75e877d2013-09-11 14:45:20 -07003952 /**
3953 * Sets convolution kernel.
3954 * @param[in] v float[9] of values
3955 */
Tim Murray89daad62013-07-29 14:30:02 -07003956 void setCoefficients(float* v);
3957};
3958
Tim Murray75e877d2013-09-11 14:45:20 -07003959/**
3960 * Intrinsic for applying a 5x5 convolve to an allocation.
3961 */
Tim Murray89daad62013-07-29 14:30:02 -07003962class ScriptIntrinsicConvolve5x5 : public ScriptIntrinsic {
Tim Murray21fa7a02013-08-15 16:25:03 -07003963 private:
Tim Murray89daad62013-07-29 14:30:02 -07003964 ScriptIntrinsicConvolve5x5(sp<RS> rs, sp<const Element> e);
Tim Murray21fa7a02013-08-15 16:25:03 -07003965 public:
Tim Murray75e877d2013-09-11 14:45:20 -07003966 /**
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 Murray21fa7a02013-08-15 16:25:03 -07003973 static sp<ScriptIntrinsicConvolve5x5> create(sp<RS> rs, sp<const Element> e);
Tim Murray75e877d2013-09-11 14:45:20 -07003974 /**
3975 * Sets input for intrinsic.
3976 * @param[in] in input Allocation
3977 */
Tim Murray89daad62013-07-29 14:30:02 -07003978 void setInput(sp<Allocation> in);
Tim Murray75e877d2013-09-11 14:45:20 -07003979 /**
3980 * Launches the intrinsic.
3981 * @param[in] out output Allocation
3982 */
Tim Murray89daad62013-07-29 14:30:02 -07003983 void forEach(sp<Allocation> out);
Tim Murray75e877d2013-09-11 14:45:20 -07003984 /**
3985 * Sets convolution kernel.
3986 * @param[in] v float[25] of values
3987 */
Tim Murray89daad62013-07-29 14:30:02 -07003988 void setCoefficients(float* v);
3989};
3990
Tim Murray75e877d2013-09-11 14:45:20 -07003991/**
3992 * Intrinsic for computing a histogram.
3993 */
Tim Murrayb27b1812013-08-05 14:00:40 -07003994class ScriptIntrinsicHistogram : public ScriptIntrinsic {
Tim Murray21fa7a02013-08-15 16:25:03 -07003995 private:
Tim Murrayb27b1812013-08-05 14:00:40 -07003996 ScriptIntrinsicHistogram(sp<RS> rs, sp<const Element> e);
Tim Murray10913a52013-08-20 17:19:47 -07003997 sp<Allocation> mOut;
Tim Murray21fa7a02013-08-15 16:25:03 -07003998 public:
Tim Murray75e877d2013-09-11 14:45:20 -07003999 /**
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 Parrb05c8502015-03-13 14:41:58 +00004010 static sp<ScriptIntrinsicHistogram> create(sp<RS> rs, sp<const Element> e);
Tim Murray75e877d2013-09-11 14:45:20 -07004011 /**
4012 * Set the output of the histogram. 32 bit integer types are
4013 * supported.
4014 *
4015 * @param[in] aout The output allocation
4016 */
Tim Murrayb27b1812013-08-05 14:00:40 -07004017 void setOutput(sp<Allocation> aout);
Tim Murray75e877d2013-09-11 14:45:20 -07004018 /**
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 Murrayb27b1812013-08-05 14:00:40 -07004029 void setDotCoefficients(float r, float g, float b, float a);
Tim Murray75e877d2013-09-11 14:45:20 -07004030 /**
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 Murrayb27b1812013-08-05 14:00:40 -07004042 void forEach(sp<Allocation> ain);
Tim Murray75e877d2013-09-11 14:45:20 -07004043 /**
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 Murrayb27b1812013-08-05 14:00:40 -07004053 void forEach_dot(sp<Allocation> ain);
4054};
4055
Tim Murray75e877d2013-09-11 14:45:20 -07004056/**
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 Murrayb27b1812013-08-05 14:00:40 -07004061class ScriptIntrinsicLUT : public ScriptIntrinsic {
4062 private:
4063 sp<Allocation> LUT;
4064 bool mDirty;
4065 unsigned char mCache[1024];
Tim Murray2acce992013-08-28 14:23:31 -07004066 void setTable(unsigned int offset, unsigned char base, unsigned int length, unsigned char* lutValues);
Tim Murray21fa7a02013-08-15 16:25:03 -07004067 ScriptIntrinsicLUT(sp<RS> rs, sp<const Element> e);
Tim Murrayb27b1812013-08-05 14:00:40 -07004068
Tim Murray89daad62013-07-29 14:30:02 -07004069 public:
Tim Murray75e877d2013-09-11 14:45:20 -07004070 /**
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 Murray21fa7a02013-08-15 16:25:03 -07004080 static sp<ScriptIntrinsicLUT> create(sp<RS> rs, sp<const Element> e);
Tim Murray75e877d2013-09-11 14:45:20 -07004081 /**
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 Murray89daad62013-07-29 14:30:02 -07004088 void forEach(sp<Allocation> ain, sp<Allocation> aout);
Tim Murray75e877d2013-09-11 14:45:20 -07004089 /**
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 Murray2acce992013-08-28 14:23:31 -07004095 void setRed(unsigned char base, unsigned int length, unsigned char* lutValues);
Tim Murray75e877d2013-09-11 14:45:20 -07004096 /**
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 Murray2acce992013-08-28 14:23:31 -07004102 void setGreen(unsigned char base, unsigned int length, unsigned char* lutValues);
Tim Murray75e877d2013-09-11 14:45:20 -07004103 /**
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 Murray2acce992013-08-28 14:23:31 -07004109 void setBlue(unsigned char base, unsigned int length, unsigned char* lutValues);
Tim Murray75e877d2013-09-11 14:45:20 -07004110 /**
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 Murray2acce992013-08-28 14:23:31 -07004116 void setAlpha(unsigned char base, unsigned int length, unsigned char* lutValues);
Tim Murrayb27b1812013-08-05 14:00:40 -07004117 virtual ~ScriptIntrinsicLUT();
4118};
4119
Tim Murray75e877d2013-09-11 14:45:20 -07004120/**
Miao Wange5428e62015-03-10 15:29:40 -07004121 * Intrinsic for performing a resize of a 2D allocation.
4122 */
4123class 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 Murray75e877d2013-09-11 14:45:20 -07004153 * 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 Murray89daad62013-07-29 14:30:02 -07004159class ScriptIntrinsicYuvToRGB : public ScriptIntrinsic {
Tim Murray21fa7a02013-08-15 16:25:03 -07004160 private:
Tim Murrayb27b1812013-08-05 14:00:40 -07004161 ScriptIntrinsicYuvToRGB(sp<RS> rs, sp<const Element> e);
Tim Murray21fa7a02013-08-15 16:25:03 -07004162 public:
Tim Murray75e877d2013-09-11 14:45:20 -07004163 /**
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 Murray21fa7a02013-08-15 16:25:03 -07004173 static sp<ScriptIntrinsicYuvToRGB> create(sp<RS> rs, sp<const Element> e);
Tim Murray75e877d2013-09-11 14:45:20 -07004174 /**
4175 * Set the input YUV allocation.
4176 *
4177 * @param[in] ain The input allocation.
4178 */
Tim Murrayb27b1812013-08-05 14:00:40 -07004179 void setInput(sp<Allocation> in);
Tim Murray75e877d2013-09-11 14:45:20 -07004180
4181 /**
4182 * Convert the image to RGB.
4183 *
4184 * @param[in] aout Output allocation. Must match creation element
4185 * type.
4186 */
Tim Murrayb27b1812013-08-05 14:00:40 -07004187 void forEach(sp<Allocation> out);
Tim Murray89daad62013-07-29 14:30:02 -07004188
4189};
Tim Murrayb27b1812013-08-05 14:00:40 -07004190
Tim Murray75e877d2013-09-11 14:45:20 -07004191/**
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 Murray729b6fe2013-07-23 16:20:42 -07004201 class Sampler : public BaseObj {
4202 private:
4203 Sampler(sp<RS> rs, void* id);
Miao Wange5428e62015-03-10 15:29:40 -07004204 Sampler(sp<RS> rs, void* id, RsSamplerValue min, RsSamplerValue mag,
4205 RsSamplerValue wrapS, RsSamplerValue wrapT, float anisotropy);
Tim Murray729b6fe2013-07-23 16:20:42 -07004206 RsSamplerValue mMin;
4207 RsSamplerValue mMag;
4208 RsSamplerValue mWrapS;
4209 RsSamplerValue mWrapT;
Tim Murray729b6fe2013-07-23 16:20:42 -07004210 float mAniso;
4211
4212 public:
Tim Murray75e877d2013-09-11 14:45:20 -07004213 /**
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 Murray729b6fe2013-07-23 16:20:42 -07004222 static sp<Sampler> create(sp<RS> rs, RsSamplerValue min, RsSamplerValue mag, RsSamplerValue wrapS, RsSamplerValue wrapT, float anisotropy);
4223
Tim Murray75e877d2013-09-11 14:45:20 -07004224 /**
4225 * @return minification setting for the sampler
4226 */
Tim Murray729b6fe2013-07-23 16:20:42 -07004227 RsSamplerValue getMinification();
Tim Murray75e877d2013-09-11 14:45:20 -07004228 /**
4229 * @return magnification setting for the sampler
4230 */
Tim Murray729b6fe2013-07-23 16:20:42 -07004231 RsSamplerValue getMagnification();
Tim Murray75e877d2013-09-11 14:45:20 -07004232 /**
4233 * @return S wrapping mode for the sampler
4234 */
Tim Murray729b6fe2013-07-23 16:20:42 -07004235 RsSamplerValue getWrapS();
Tim Murray75e877d2013-09-11 14:45:20 -07004236 /**
4237 * @return T wrapping mode for the sampler
4238 */
Tim Murray729b6fe2013-07-23 16:20:42 -07004239 RsSamplerValue getWrapT();
Tim Murray75e877d2013-09-11 14:45:20 -07004240 /**
4241 * @return anisotropy setting for the sampler
4242 */
Tim Murray729b6fe2013-07-23 16:20:42 -07004243 float getAnisotropy();
4244
Tim Murray75e877d2013-09-11 14:45:20 -07004245 /**
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 Hines8a588bd2013-11-26 15:38:31 -08004253 static sp<const Sampler> CLAMP_NEAREST(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07004254 /**
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 Hines8a588bd2013-11-26 15:38:31 -08004262 static sp<const Sampler> CLAMP_LINEAR(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07004263 /**
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 Hines8a588bd2013-11-26 15:38:31 -08004271 static sp<const Sampler> CLAMP_LINEAR_MIP_LINEAR(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07004272 /**
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 Hines8a588bd2013-11-26 15:38:31 -08004280 static sp<const Sampler> WRAP_NEAREST(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07004281 /**
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 Hines8a588bd2013-11-26 15:38:31 -08004289 static sp<const Sampler> WRAP_LINEAR(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07004290 /**
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 Hines8a588bd2013-11-26 15:38:31 -08004298 static sp<const Sampler> WRAP_LINEAR_MIP_LINEAR(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07004299 /**
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 Hines8a588bd2013-11-26 15:38:31 -08004307 static sp<const Sampler> MIRRORED_REPEAT_NEAREST(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07004308 /**
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 Hines8a588bd2013-11-26 15:38:31 -08004316 static sp<const Sampler> MIRRORED_REPEAT_LINEAR(sp<RS> rs);
Tim Murray75e877d2013-09-11 14:45:20 -07004317 /**
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 Hines8a588bd2013-11-26 15:38:31 -08004325 static sp<const Sampler> MIRRORED_REPEAT_LINEAR_MIP_LINEAR(sp<RS> rs);
Tim Murray729b6fe2013-07-23 16:20:42 -07004326
4327};
4328
Tim Murray84bf2b82012-10-31 16:03:16 -07004329}
Tim Murray7f0d5682012-11-08 16:35:24 -08004330
Tim Murray84bf2b82012-10-31 16:03:16 -07004331}
4332
4333#endif