HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_Interleave.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UT_Interleave.h ( UT Library, C++)
7  *
8  * COMMENTS:
9  * Functions to do quick interleaving and deinterleaving of 1-4 component
10  * vector arrays. (a vector of 1 component is a degenerate case; however,
11  * since this class also does strides and components steps, it can be used
12  * for other purposes).
13  */
14 #ifndef UT_Interleave_h
15 #define UT_Interleave_h
16 
17 #include "UT_API.h"
18 
19 // Typesize The number of bytes per element. The array should be aligned
20 // to at least that size (ie, for floats, the array must be at
21 // least word aligned). It may be 1,2,4 or 8.
22 
23 // Vectorsize The size of the destination vector. Not all the sources need
24 // to be present (non-NULL) to meet the vectorsize (however, at
25 // least one must be in src[1,vectorsize]).
26 
27 // Width/Height The size of the array. For 1D arrays, leave height at 1.
28 
29 // Dest/Src Stride Used only when height is not 1, this specifies the number of
30 // bytes per scanline if the scanlines are padded. This must be
31 // evenly divisible by 'typesize'
32 
33 // Thread Enables threading of the op. Will still only thread if the
34 // total size is big enough to overcome the thread cost.
35 
36 
37 // INTERLEAVE
38 // interleave flat arrays src[N] into dest.
39 UT_API void UTinterleave(void *dest,
40  const void *src1,
41  const void *src2,
42  const void *src3,
43  const void *src4,
44  int typesize,
45  int vectorsize,
46  int width,
47  int height = 1,
48  int deststride = 0,
49  bool thread = true);
50 
51 // Similar to the above, but the dest and source arrays don't have to be flat.
52 // They can have a larger jump (dinc,sinc) between elements. The jumps are in
53 // elements, not bytes.
54 UT_API void UTinterleave(void *dest, int dinc,
55  const void *src1, int sinc1,
56  const void *src2, int sinc2,
57  const void *src3, int sinc3,
58  const void *src4, int sinc4,
59  int typesize,
60  int vectorsize,
61  int width,
62  int height = 1,
63  int deststride = 0,
64  bool thread = true);
65 
66 // Assuming data is deinterleaved(rrr..rgggg...gbbbb...b), interleave it.
67 // For 2D arrays, if by_scanline is true, only deinterleave per scanline.
68 // Otherwise, completely separate the 2D arrays.
69 UT_API void UTinterleaveSelf(void *data,
70  int typesize,
71  int vectorsize,
72  int width,
73  int height = 1,
74  bool by_scanline = true,
75  bool thread = true);
76 
77 
78 // DEINTERLEAVE
79 // Deinterleaving does the opposite - it extracts vector components out of 'src'
80 // and into flat arrays dest[N].
81 UT_API void UTdeinterleave(void *dest1,
82  void *dest2,
83  void *dest3,
84  void *dest4,
85  const void *src,
86  int typesize,
87  int vectorsize,
88  int width,
89  int height = 1,
90  int srcstride = 0,
91  bool thread = true);
92 
93 UT_API void UTdeinterleave(void *dest1, int dinc1,
94  void *dest2, int dinc2,
95  void *dest3, int dinc3,
96  void *dest4, int dinc4,
97  const void *src, int sinc,
98  int typesize,
99  int vectorsize,
100  int width,
101  int height = 1,
102  int srcstride = 0,
103  bool thread = true);
104 
105 // assume data is interleaved, write it back deinterleaved to data.
106 // For 2D arrays, if by_scanline is true, only scanlines are deinterleaved.
107 // Otherwise, the full 2D arrays are considered separate.
108 UT_API void UTdeinterleaveSelf(void *data,
109  int typesize,
110  int vectorsize,
111  int width,
112  int height = 1,
113  bool by_scanline = true,
114  bool thread = true);
115 
116 
117 #endif
118 
119 
#define UT_API
Definition: UT_API.h:14
UT_API void UTinterleave(void *dest, const void *src1, const void *src2, const void *src3, const void *src4, int typesize, int vectorsize, int width, int height=1, int deststride=0, bool thread=true)
UT_API void UTdeinterleave(void *dest1, void *dest2, void *dest3, void *dest4, const void *src, int typesize, int vectorsize, int width, int height=1, int srcstride=0, bool thread=true)
GLint GLsizei GLsizei height
Definition: glcorearb.h:103
UT_API void UTdeinterleaveSelf(void *data, int typesize, int vectorsize, int width, int height=1, bool by_scanline=true, bool thread=true)
**Note that the tasks the is the thread number *for the or if it s being executed by a non pool thread(this *can happen in cases where the whole pool is occupied and the calling *thread contributes to running the work load).**Thread pool.Have fun
GLint GLsizei width
Definition: glcorearb.h:103
UT_API void UTinterleaveSelf(void *data, int typesize, int vectorsize, int width, int height=1, bool by_scanline=true, bool thread=true)
Definition: format.h:895
GLenum src
Definition: glcorearb.h:1793