SDL_gfx: SDL_imageFilter.h Source File

- Main Page
- Data Structures
- Files

- File List
- Globals

# SDL_imageFilter.h

Go to the documentation of this file.

    00001 /*
    00002
    00003 SDL_imageFilter - bytes-image "filter" routines
    00004 (uses inline x86 MMX optimizations if available)
    00005
    00006 LGPL (c) A. Schiffler
    00007
    00008 */
    00009
    00010 #ifndef _SDL_imageFilter_h
    00011 #define _SDL_imageFilter_h
    00012
    00013 /* Set up for C function definitions, even when using C++ */
    00014 #ifdef __cplusplus
    00015 extern "C" {
    00016 #endif
    00017
    00018         /* ---- Function Prototypes */
    00019
    00020 #if defined(WIN32) || defined(WIN64)
    00021 #  if defined(DLL_EXPORT) && !defined(LIBSDL_GFX_DLL_IMPORT)
    00022 #    define SDL_IMAGEFILTER_SCOPE __declspec(dllexport)
    00023 #  else
    00024 #    ifdef LIBSDL_GFX_DLL_IMPORT
    00025 #      define SDL_IMAGEFILTER_SCOPE __declspec(dllimport)
    00026 #    endif
    00027 #  endif
    00028 #endif
    00029 #ifndef SDL_IMAGEFILTER_SCOPE
    00030 #  define SDL_IMAGEFILTER_SCOPE extern
    00031 #endif
    00032
    00033         /* Comments:                                                                           */
    00034         /*  1.) MMX functions work best if all data blocks are aligned on a 32 bytes boundary. */
    00035         /*  2.) Data that is not within an 8 byte boundary is processed using the C routine.   */
    00036         /*  3.) Convolution routines do not have C routines at this time.                      */
    00037
    00038         // Detect MMX capability in CPU
    00039         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMMXdetect(void);
    00040
    00041         // Force use of MMX off (or turn possible use back on)
    00042         SDL_IMAGEFILTER_SCOPE void SDL_imageFilterMMXoff(void);
    00043         SDL_IMAGEFILTER_SCOPE void SDL_imageFilterMMXon(void);
    00044
    00045         //
    00046         // All routines return:
    00047         //   0   OK
    00048         //  -1   Error (internal error, parameter error)
    00049         //
    00050
    00051         //  SDL_imageFilterAdd: D = saturation255(S1 + S2)
    00052         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterAdd(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
    00053
    00054         //  SDL_imageFilterMean: D = S1/2 + S2/2
    00055         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMean(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
    00056
    00057         //  SDL_imageFilterSub: D = saturation0(S1 - S2)
    00058         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterSub(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
    00059
    00060         //  SDL_imageFilterAbsDiff: D = | S1 - S2 |
    00061         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterAbsDiff(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
    00062
    00063         //  SDL_imageFilterMult: D = saturation(S1 * S2)
    00064         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMult(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
    00065
    00066         //  SDL_imageFilterMultNor: D = S1 * S2   (non-MMX)
    00067         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMultNor(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
    00068
    00069         //  SDL_imageFilterMultDivby2: D = saturation255(S1/2 * S2)
    00070         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMultDivby2(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest,
    00071                 unsigned int length);
    00072
    00073         //  SDL_imageFilterMultDivby4: D = saturation255(S1/2 * S2/2)
    00074         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMultDivby4(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest,
    00075                 unsigned int length);
    00076
    00077         //  SDL_imageFilterBitAnd: D = S1 & S2
    00078         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterBitAnd(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
    00079
    00080         //  SDL_imageFilterBitOr: D = S1 | S2
    00081         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterBitOr(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
    00082
    00083         //  SDL_imageFilterDiv: D = S1 / S2   (non-MMX)
    00084         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterDiv(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
    00085
    00086         //  SDL_imageFilterBitNegation: D = !S
    00087         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterBitNegation(unsigned char *Src1, unsigned char *Dest, unsigned int length);
    00088
    00089         //  SDL_imageFilterAddByte: D = saturation255(S + C)
    00090         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterAddByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C);
    00091
    00092         //  SDL_imageFilterAddUint: D = saturation255(S + (uint)C)
    00093         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterAddUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C);
    00094
    00095         //  SDL_imageFilterAddByteToHalf: D = saturation255(S/2 + C)
    00096         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterAddByteToHalf(unsigned char *Src1, unsigned char *Dest, unsigned int length,
    00097                 unsigned char C);
    00098
    00099         //  SDL_imageFilterSubByte: D = saturation0(S - C)
    00100         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterSubByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C);
    00101
    00102         //  SDL_imageFilterSubUint: D = saturation0(S - (uint)C)
    00103         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterSubUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C);
    00104
    00105         //  SDL_imageFilterShiftRight: D = saturation0(S >> N)
    00106         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterShiftRight(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N);
    00107
    00108         //  SDL_imageFilterShiftRightUint: D = saturation0((uint)S >> N)
    00109         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterShiftRightUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N);
    00110
    00111         //  SDL_imageFilterMultByByte: D = saturation255(S * C)
    00112         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMultByByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C);
    00113
    00114         //  SDL_imageFilterShiftRightAndMultByByte: D = saturation255((S >> N) * C)
    00115         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterShiftRightAndMultByByte(unsigned char *Src1, unsigned char *Dest, unsigned int length,
    00116                 unsigned char N, unsigned char C);
    00117
    00118         //  SDL_imageFilterShiftLeftByte: D = (S << N)
    00119         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterShiftLeftByte(unsigned char *Src1, unsigned char *Dest, unsigned int length,
    00120                 unsigned char N);
    00121
    00122         //  SDL_imageFilterShiftLeftUint: D = ((uint)S << N)
    00123         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterShiftLeftUint(unsigned char *Src1, unsigned char *Dest, unsigned int length,
    00124                 unsigned char N);
    00125
    00126         //  SDL_imageFilterShiftLeft: D = saturation255(S << N)
    00127         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterShiftLeft(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N);
    00128
    00129         //  SDL_imageFilterBinarizeUsingThreshold: D = S >= T ? 255:0
    00130         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterBinarizeUsingThreshold(unsigned char *Src1, unsigned char *Dest, unsigned int length,
    00131                 unsigned char T);
    00132
    00133         //  SDL_imageFilterClipToRange: D = (S >= Tmin) & (S <= Tmax) 255:0
    00134         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterClipToRange(unsigned char *Src1, unsigned char *Dest, unsigned int length,
    00135                 unsigned char Tmin, unsigned char Tmax);
    00136
    00137         //  SDL_imageFilterNormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin)
    00138         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterNormalizeLinear(unsigned char *Src, unsigned char *Dest, unsigned int length, int Cmin,
    00139                 int Cmax, int Nmin, int Nmax);
    00140
    00141         /* !!! NO C-ROUTINE FOR THESE FUNCTIONS YET !!! */
    00142
    00143         //  SDL_imageFilterConvolveKernel3x3Divide: Dij = saturation0and255( ... )
    00144         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel3x3Divide(unsigned char *Src, unsigned char *Dest, int rows,
    00145                 int columns, signed short *Kernel, unsigned char Divisor);
    00146
    00147         //  SDL_imageFilterConvolveKernel5x5Divide: Dij = saturation0and255( ... )
    00148         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel5x5Divide(unsigned char *Src, unsigned char *Dest, int rows,
    00149                 int columns, signed short *Kernel, unsigned char Divisor);
    00150
    00151         //  SDL_imageFilterConvolveKernel7x7Divide: Dij = saturation0and255( ... )
    00152         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel7x7Divide(unsigned char *Src, unsigned char *Dest, int rows,
    00153                 int columns, signed short *Kernel, unsigned char Divisor);
    00154
    00155         //  SDL_imageFilterConvolveKernel9x9Divide: Dij = saturation0and255( ... )
    00156         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel9x9Divide(unsigned char *Src, unsigned char *Dest, int rows,
    00157                 int columns, signed short *Kernel, unsigned char Divisor);
    00158
    00159         //  SDL_imageFilterConvolveKernel3x3ShiftRight: Dij = saturation0and255( ... )
    00160         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel3x3ShiftRight(unsigned char *Src, unsigned char *Dest, int rows,
    00161                 int columns, signed short *Kernel,
    00162                 unsigned char NRightShift);
    00163
    00164         //  SDL_imageFilterConvolveKernel5x5ShiftRight: Dij = saturation0and255( ... )
    00165         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel5x5ShiftRight(unsigned char *Src, unsigned char *Dest, int rows,
    00166                 int columns, signed short *Kernel,
    00167                 unsigned char NRightShift);
    00168
    00169         //  SDL_imageFilterConvolveKernel7x7ShiftRight: Dij = saturation0and255( ... )
    00170         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel7x7ShiftRight(unsigned char *Src, unsigned char *Dest, int rows,
    00171                 int columns, signed short *Kernel,
    00172                 unsigned char NRightShift);
    00173
    00174         //  SDL_imageFilterConvolveKernel9x9ShiftRight: Dij = saturation0and255( ... )
    00175         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel9x9ShiftRight(unsigned char *Src, unsigned char *Dest, int rows,
    00176                 int columns, signed short *Kernel,
    00177                 unsigned char NRightShift);
    00178
    00179         //  SDL_imageFilterSobelX: Dij = saturation255( ... )
    00180         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterSobelX(unsigned char *Src, unsigned char *Dest, int rows, int columns);
    00181
    00182         //  SDL_imageFilterSobelXShiftRight: Dij = saturation255( ... )
    00183         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterSobelXShiftRight(unsigned char *Src, unsigned char *Dest, int rows, int columns,
    00184                 unsigned char NRightShift);
    00185
    00186         // Align/restore stack to 32 byte boundary -- Functionality untested! --
    00187         SDL_IMAGEFILTER_SCOPE void SDL_imageFilterAlignStack(void);
    00188         SDL_IMAGEFILTER_SCOPE void SDL_imageFilterRestoreStack(void);
    00189
    00190         /* Ends C function definitions when using C++ */
    00191 #ifdef __cplusplus
    00192 }
    00193 #endif
    00194
    00195 #endif                          /* _SDL_imageFilter_h */