00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __IMG_Filter__
00022 #define __IMG_Filter__
00023
00024 #include "IMG_API.h"
00025 #include <UT/UT_Filter.h>
00026 #include "IMG_FileTypes.h"
00027
00028
00029 class img_FilterStorage;
00030 class SPUT_ThreadSet;
00031
00032 #ifdef CELLBE
00033 #include <SPU/SPU_FastBlur.h>
00034 #endif
00035
00036 class IMG_API IMG_RasterFilter
00037 {
00038 public:
00039 typedef int (*fetchFunc)(void *tag, void *buffer, int scanline);
00040
00041 IMG_RasterFilter(
00042 int inpXres, int inpYres,
00043 int outXres, int outYres,
00044 fetchFunc inpFetch,
00045
00046 UT_FilterType xfilter = UT_FILTER_BOX,
00047 float xwidth = 1,
00048
00049 UT_FilterType yfilter = UT_FILTER_BOX,
00050 float ywidth = 1,
00051
00052 IMG_DataType srcType = IMG_UCHAR,
00053 IMG_DataType destType = IMG_UCHAR,
00054
00055
00056 IMG_ColorModel colorModel = IMG_RGBA);
00057
00058 IMG_RasterFilter(
00059 int inpXres, int inpYres,
00060 int outXres, int outYres,
00061 fetchFunc inpFetch,
00062
00063 UT_Filter * xfilter,
00064 float xwidth,
00065
00066 UT_Filter * yfilter,
00067 float ywidth,
00068
00069 IMG_DataType srcType = IMG_UCHAR,
00070 IMG_DataType destType = IMG_UCHAR,
00071
00072
00073 IMG_ColorModel colorModel = IMG_RGBA);
00074
00075
00076 ~IMG_RasterFilter();
00077
00078 void restartFilter();
00079 int nextScanline(int y, void *buf, void *tag);
00080
00081
00082
00083
00084
00085
00086
00087
00088 IMG_RasterFilter( int xres, int yres,
00089 fetchFunc inpFetch,
00090 UT_FilterType filter = UT_FILTER_BOX,
00091 float xwidth = 1.0f,
00092 float ywidth = 1.0f,
00093 IMG_DataType type = IMG_UCHAR);
00094
00095 static void getApproxBlurBound(UT_FilterType type,
00096 float xsize,float ysize,
00097 int ix1,int iy1, int ix2, int iy2,
00098 int &x1,int &y1, int &x2, int &y2);
00099
00100
00101
00102
00103
00104
00105 int fastApproxBlur(void *buf, void *tag);
00106
00107
00108
00109 bool isRunning();
00110 void close();
00111
00112 private:
00113 int myInXres, myInYres;
00114 int myOutXres, myOutYres;
00115 fetchFunc myFetch;
00116
00117 int myYWindow;
00118 float myYRadius;
00119 float myXScale, myYScale;
00120
00121 IMG_DataType myInType;
00122 IMG_DataType myOutType;
00123 int myWPP;
00124
00125 UT_Filter *myYFilter;
00126 UT_FilterWindow *myXWeight;
00127 UT_FilterWindow myYWeight;
00128
00129 void *myInputBuffer;
00130 float *myFinal;
00131 float *myLoader;
00132 float **myActive;
00133 int *myLineBuf;
00134
00135
00136 void filterVerticalFastApprox(int x, float *tmp1, float *tmp2);
00137
00138 bool myFastApprox;
00139 int myNumPasses;
00140
00141 int myXRadius;
00142 float myXRadiusWeight;
00143 float myXArea;
00144 int myXOffset;
00145
00146 int myYIntRadius;
00147 float myYRadiusWeight;
00148 float myYArea;
00149 int myYOffset;
00150
00151 #ifdef CELLBE
00152 SPUT_ThreadSet *myThreadSet;
00153 SPU_FastBlurParms myParms;
00154 void *myImageBuffer;
00155 int myImageBufferStride;
00156 int myImageOutBufferStride;
00157 bool myUseSPUFlag;
00158
00159 int fastApproxBlurSPU(void *buf, void *tag);
00160 #endif
00161 };
00162
00163 #endif