00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * Mark Alexander 00008 * Side Effects 00009 * 123 Front Street West, Suite 1401 00010 * Toronto, Ontario 00011 * Canada M5J 2M2 00012 * 416-504-9876 00013 * 00014 * NAME: UT_Interleave.h ( UT Library, C++) 00015 * 00016 * COMMENTS: 00017 * Functions to do quick interleaving and deinterleaving of 1-4 component 00018 * vector arrays. (a vector of 1 component is a degenerate case; however, 00019 * since this class also does strides and components steps, it can be used 00020 * for other purposes). 00021 */ 00022 #ifndef UT_Interleave_h 00023 #define UT_Interleave_h 00024 00025 #include "UT_API.h" 00026 00027 // Typesize The number of bytes per element. The array should be aligned 00028 // to at least that size (ie, for floats, the array must be at 00029 // least word aligned). It may be 1,2,4 or 8. 00030 00031 // Vectorsize The size of the destination vector. Not all the sources need 00032 // to be present (non-NULL) to meet the vectorsize (however, at 00033 // least one must be in src[1,vectorsize]). 00034 00035 // Width/Height The size of the array. For 1D arrays, leave height at 1. 00036 00037 // Dest/Src Stride Used only when height is not 1, this specifies the number of 00038 // bytes per scanline if the scanlines are padded. This must be 00039 // evenly divisible by 'typesize' 00040 00041 // Thread Enables threading of the op. Will still only thread if the 00042 // total size is big enough to overcome the thread cost. 00043 00044 00045 // INTERLEAVE 00046 // interleave flat arrays src[N] into dest. 00047 UT_API void UTinterleave(void *dest, 00048 const void *src1, 00049 const void *src2, 00050 const void *src3, 00051 const void *src4, 00052 int typesize, 00053 int vectorsize, 00054 int width, 00055 int height = 1, 00056 int deststride = 0, 00057 bool thread = true); 00058 00059 // Similar to the above, but the dest and source arrays don't have to be flat. 00060 // They can have a larger jump (dinc,sinc) between elements. The jumps are in 00061 // elements, not bytes. 00062 UT_API void UTinterleave(void *dest, int dinc, 00063 const void *src1, int sinc1, 00064 const void *src2, int sinc2, 00065 const void *src3, int sinc3, 00066 const void *src4, int sinc4, 00067 int typesize, 00068 int vectorsize, 00069 int width, 00070 int height = 1, 00071 int deststride = 0, 00072 bool thread = true); 00073 00074 // Assuming data is deinterleaved(rrr..rgggg...gbbbb...b), interleave it. 00075 // For 2D arrays, if by_scanline is true, only deinterleave per scanline. 00076 // Otherwise, completely separate the 2D arrays. 00077 UT_API void UTinterleaveSelf(void *data, 00078 int typesize, 00079 int vectorsize, 00080 int width, 00081 int height = 1, 00082 bool by_scanline = true, 00083 bool thread = true); 00084 00085 00086 // DEINTERLEAVE 00087 // Deinterleaving does the opposite - it extracts vector components out of 'src' 00088 // and into flat arrays dest[N]. 00089 UT_API void UTdeinterleave(void *dest1, 00090 void *dest2, 00091 void *dest3, 00092 void *dest4, 00093 const void *src, 00094 int typesize, 00095 int vectorsize, 00096 int width, 00097 int height = 1, 00098 int srcstride = 0, 00099 bool thread = true); 00100 00101 UT_API void UTdeinterleave(void *dest1, int dinc1, 00102 void *dest2, int dinc2, 00103 void *dest3, int dinc3, 00104 void *dest4, int dinc4, 00105 const void *src, int sinc, 00106 int typesize, 00107 int vectorsize, 00108 int width, 00109 int height = 1, 00110 int srcstride = 0, 00111 bool thread = true); 00112 00113 // assume data is interleaved, write it back deinterleaved to data. 00114 // For 2D arrays, if by_scanline is true, only scanlines are deinterleaved. 00115 // Otherwise, the full 2D arrays are considered separate. 00116 UT_API void UTdeinterleaveSelf(void *data, 00117 int typesize, 00118 int vectorsize, 00119 int width, 00120 int height = 1, 00121 bool by_scanline = true, 00122 bool thread = true); 00123 00124 00125 #endif 00126 00127
1.5.9