/* SDL_imageFilter - bytes-image "filter" routines (uses inline x86 MMX optimizations if available) LGPL (c) A. Schiffler */ // convert to D by shinichiro.h import SDL; /* Set up for C function definitions, even when using C++ */ extern (C) { /* Comments: */ /* 1.) MMX functions work best if all data blocks are aligned on a 32 bytes boundary. */ /* 2.) Data that is not within an 8 byte boundary is processed using the C routine. */ /* 3.) Convolution routines do not have C routines at this time. */ // Detect MMX capability in CPU int SDL_imageFilterMMXdetect(); // Force use of MMX off (or turn possible use back on) void SDL_imageFilterMMXoff(); void SDL_imageFilterMMXon(); // // All routines return: // 0 OK // -1 Error (internal error, parameter error) // // SDL_imageFilterAdd: D = saturation255(S1 + S2) int SDL_imageFilterAdd(Uint8 *Src1, Uint8 *Src2, Uint8 *Dest, int length); // SDL_imageFilterMean: D = S1/2 + S2/2 int SDL_imageFilterMean(Uint8 *Src1, Uint8 *Src2, Uint8 *Dest, int length); // SDL_imageFilterSub: D = saturation0(S1 - S2) int SDL_imageFilterSub(Uint8 *Src1, Uint8 *Src2, Uint8 *Dest, int length); // SDL_imageFilterAbsDiff: D = | S1 - S2 | int SDL_imageFilterAbsDiff(Uint8 *Src1, Uint8 *Src2, Uint8 *Dest, int length); // SDL_imageFilterMult: D = saturation(S1 * S2) int SDL_imageFilterMult(Uint8 *Src1, Uint8 *Src2, Uint8 *Dest, int length); // SDL_imageFilterMultNor: D = S1 * S2 (non-MMX) int SDL_imageFilterMultNor(Uint8 *Src1, Uint8 *Src2, Uint8 *Dest, int length); // SDL_imageFilterMultDivby2: D = saturation255(S1/2 * S2) int SDL_imageFilterMultDivby2(Uint8 *Src1, Uint8 *Src2, Uint8 *Dest, int length); // SDL_imageFilterMultDivby4: D = saturation255(S1/2 * S2/2) int SDL_imageFilterMultDivby4(Uint8 *Src1, Uint8 *Src2, Uint8 *Dest, int length); // SDL_imageFilterBitAnd: D = S1 & S2 int SDL_imageFilterBitAnd(Uint8 *Src1, Uint8 *Src2, Uint8 *Dest, int length); // SDL_imageFilterBitOr: D = S1 | S2 int SDL_imageFilterBitOr(Uint8 *Src1, Uint8 *Src2, Uint8 *Dest, int length); // SDL_imageFilterDiv: D = S1 / S2 (non-MMX) int SDL_imageFilterDiv(Uint8 *Src1, Uint8 *Src2, Uint8 *Dest, int length); // SDL_imageFilterBitNegation: D = !S int SDL_imageFilterBitNegation(Uint8 *Src1, Uint8 *Dest, int length); // SDL_imageFilterAddByte: D = saturation255(S + C) int SDL_imageFilterAddByte(Uint8 *Src1, Uint8 *Dest, int length, Uint8 C); // SDL_imageFilterAddByteToHalf: D = saturation255(S/2 + C) int SDL_imageFilterAddByteToHalf(Uint8 *Src1, Uint8 *Dest, int length, Uint8 C); // SDL_imageFilterSubByte: D = saturation0(S - C) int SDL_imageFilterSubByte(Uint8 *Src1, Uint8 *Dest, int length, Uint8 C); // SDL_imageFilterShiftRight: D = saturation0(S >> N) int SDL_imageFilterShiftRight(Uint8 *Src1, Uint8 *Dest, int length, Uint8 N); // SDL_imageFilterMultByByte: D = saturation255(S * C) int SDL_imageFilterMultByByte(Uint8 *Src1, Uint8 *Dest, int length, Uint8 C); // SDL_imageFilterShiftRightAndMultByByte: D = saturation255((S >> N) * C) int SDL_imageFilterShiftRightAndMultByByte(Uint8 *Src1, Uint8 *Dest, int length, Uint8 N, Uint8 C); // SDL_imageFilterShiftLeftByte: D = (S << N) int SDL_imageFilterShiftLeftByte(Uint8 *Src1, Uint8 *Dest, int length, Uint8 N); // SDL_imageFilterShiftLeft: D = saturation255(S << N) int SDL_imageFilterShiftLeft(Uint8 *Src1, Uint8 *Dest, int length, Uint8 N); // SDL_imageFilterBinarizeUsingThreshold: D = S >= T ? 255:0 int SDL_imageFilterBinarizeUsingThreshold(Uint8 *Src1, Uint8 *Dest, int length, Uint8 T); // SDL_imageFilterClipToRange: D = (S >= Tmin) & (S <= Tmax) 255:0 int SDL_imageFilterClipToRange(Uint8 *Src1, Uint8 *Dest, int length, Uint8 Tmin, Uint8 Tmax); // SDL_imageFilterNormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin) int SDL_imageFilterNormalizeLinear(Uint8 *Src1, Uint8 *Dest, int length, int Cmin, int Cmax, int Nmin, int Nmax); /* !!! NO C-ROUTINE FOR THESE FUNCTIONS YET !!! */ // SDL_imageFilterConvolveKernel3x3Divide: Dij = saturation0and255( ... ) int SDL_imageFilterConvolveKernel3x3Divide(Uint8 *Src, Uint8 *Dest, int rows, int columns, Sint16 *Kernel, Uint8 Divisor); // SDL_imageFilterConvolveKernel5x5Divide: Dij = saturation0and255( ... ) int SDL_imageFilterConvolveKernel5x5Divide(Uint8 *Src, Uint8 *Dest, int rows, int columns, Sint16 *Kernel, Uint8 Divisor); // SDL_imageFilterConvolveKernel7x7Divide: Dij = saturation0and255( ... ) int SDL_imageFilterConvolveKernel7x7Divide(Uint8 *Src, Uint8 *Dest, int rows, int columns, Sint16 *Kernel, Uint8 Divisor); // SDL_imageFilterConvolveKernel9x9Divide: Dij = saturation0and255( ... ) int SDL_imageFilterConvolveKernel9x9Divide(Uint8 *Src, Uint8 *Dest, int rows, int columns, Sint16 *Kernel, Uint8 Divisor); // SDL_imageFilterConvolveKernel3x3ShiftRight: Dij = saturation0and255( ... ) int SDL_imageFilterConvolveKernel3x3ShiftRight(Uint8 *Src, Uint8 *Dest, int rows, int columns, Sint16 *Kernel, Uint8 NRightShift); // SDL_imageFilterConvolveKernel5x5ShiftRight: Dij = saturation0and255( ... ) int SDL_imageFilterConvolveKernel5x5ShiftRight(Uint8 *Src, Uint8 *Dest, int rows, int columns, Sint16 *Kernel, Uint8 NRightShift); // SDL_imageFilterConvolveKernel7x7ShiftRight: Dij = saturation0and255( ... ) int SDL_imageFilterConvolveKernel7x7ShiftRight(Uint8 *Src, Uint8 *Dest, int rows, int columns, Sint16 *Kernel, Uint8 NRightShift); // SDL_imageFilterConvolveKernel9x9ShiftRight: Dij = saturation0and255( ... ) int SDL_imageFilterConvolveKernel9x9ShiftRight(Uint8 *Src, Uint8 *Dest, int rows, int columns, Sint16 *Kernel, Uint8 NRightShift); // SDL_imageFilterSobelX: Dij = saturation255( ... ) int SDL_imageFilterSobelX(Uint8 *Src, Uint8 *Dest, int rows, int columns); // SDL_imageFilterSobelXShiftRight: Dij = saturation255( ... ) int SDL_imageFilterSobelXShiftRight(Uint8 *Src, Uint8 *Dest, int rows, int columns, Uint8 NRightShift); // Align/restore stack to 32 byte boundary -- Functionality untested! -- void SDL_imageFilterAlignStack(); void SDL_imageFilterRestoreStack(); /* Ends C function definitions when using C++ */ }