diff options
-rw-r--r-- | common/rfb/CMakeLists.txt | 2 | ||||
-rw-r--r-- | common/rfb/PixelTransformer.cxx | 202 | ||||
-rw-r--r-- | common/rfb/PixelTransformer.h | 76 | ||||
-rw-r--r-- | common/rfb/TransImageGetter.cxx | 67 | ||||
-rw-r--r-- | common/rfb/TransImageGetter.h | 82 | ||||
-rw-r--r-- | common/rfb/transInitTempl.h | 135 | ||||
-rw-r--r-- | common/rfb/transTempl.h | 118 | ||||
-rw-r--r-- | tests/pixelconv.cxx | 23 |
8 files changed, 0 insertions, 705 deletions
diff --git a/common/rfb/CMakeLists.txt b/common/rfb/CMakeLists.txt index 48590f36..ff9b0ce8 100644 --- a/common/rfb/CMakeLists.txt +++ b/common/rfb/CMakeLists.txt @@ -31,7 +31,6 @@ set(RFB_SOURCES Password.cxx PixelBuffer.cxx PixelFormat.cxx - PixelTransformer.cxx RREEncoder.cxx RREDecoder.cxx RawDecoder.cxx @@ -53,7 +52,6 @@ set(RFB_SOURCES Timer.cxx TightDecoder.cxx TightEncoder.cxx - TransImageGetter.cxx UpdateTracker.cxx VNCSConnectionST.cxx VNCServerST.cxx diff --git a/common/rfb/PixelTransformer.cxx b/common/rfb/PixelTransformer.cxx deleted file mode 100644 index 73ec349b..00000000 --- a/common/rfb/PixelTransformer.cxx +++ /dev/null @@ -1,202 +0,0 @@ -/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. - * Copyright 2011 Pierre Ossman <ossman@cendio.se> for Cendio AB - * Copyright (C) 2011 D. R. Commander. All Rights Reserved. - * - * This is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - * USA. - */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <rfb/PixelFormat.h> -#include <rfb/Exception.h> -#include <rfb/PixelBuffer.h> -#include <rfb/PixelTransformer.h> - -using namespace rfb; - -static void noTransFn(void* table_, - const PixelFormat& inPF, const void* inPtr, int inStride, - const PixelFormat& outPF, void* outPtr, int outStride, - int width, int height) -{ - rdr::U8* ip = (rdr::U8*)inPtr; - rdr::U8* op = (rdr::U8*)outPtr; - int inStrideBytes = inStride * (inPF.bpp/8); - int outStrideBytes = outStride * (outPF.bpp/8); - int widthBytes = width * (outPF.bpp/8); - - while (height > 0) { - memcpy(op, ip, widthBytes); - ip += inStrideBytes; - op += outStrideBytes; - height--; - } -} - -#define BPPOUT 8 -#include "transInitTempl.h" -#define BPPIN 8 -#include "transTempl.h" -#undef BPPIN -#define BPPIN 16 -#include "transTempl.h" -#undef BPPIN -#define BPPIN 32 -#include "transTempl.h" -#undef BPPIN -#undef BPPOUT - -#define BPPOUT 16 -#include "transInitTempl.h" -#define BPPIN 8 -#include "transTempl.h" -#undef BPPIN -#define BPPIN 16 -#include "transTempl.h" -#undef BPPIN -#define BPPIN 32 -#include "transTempl.h" -#undef BPPIN -#undef BPPOUT - -#define BPPOUT 32 -#include "transInitTempl.h" -#define BPPIN 8 -#include "transTempl.h" -#undef BPPIN -#define BPPIN 16 -#include "transTempl.h" -#undef BPPIN -#define BPPIN 32 -#include "transTempl.h" -#undef BPPIN -#undef BPPOUT - - -// Translation functions. Note that transSimple* is only used for 8/16bpp and -// transRGB* is used for 16/32bpp - -static transFnType transSimpleFns[][3] = { - { transSimple8to8, transSimple8to16, transSimple8to32 }, - { transSimple16to8, transSimple16to16, transSimple16to32 }, -}; -static transFnType transRGBFns[][3] = { - { transRGB16to8, transRGB16to16, transRGB16to32 }, - { transRGB32to8, transRGB32to16, transRGB32to32 } -}; - -// Table initialisation functions. - -typedef void (*initFnType)(rdr::U8** tablep, const PixelFormat& inPF, - const PixelFormat& outPF); - -static initFnType initSimpleFns[] = { - initSimple8, initSimple16, initSimple32 -}; - -static initFnType initRGBFns[] = { - initRGB8, initRGB16, initRGB32 -}; - - -PixelTransformer::PixelTransformer(bool econ) - : economic(econ), table(0), transFn(0) -{ -} - -PixelTransformer::~PixelTransformer() -{ - delete [] table; -} - -void PixelTransformer::init(const PixelFormat& inPF_, - const PixelFormat& outPF_) -{ - inPF = inPF_; - outPF = outPF_; - - if (table) - delete [] table; - table = NULL; - transFn = NULL; - - if ((inPF.bpp != 8) && (inPF.bpp != 16) && (inPF.bpp != 32)) - throw Exception("PixelTransformer: bpp in not 8, 16 or 32"); - - if ((outPF.bpp != 8) && (outPF.bpp != 16) && (outPF.bpp != 32)) - throw Exception("PixelTransformer: bpp out not 8, 16 or 32"); - - if (inPF.equal(outPF)) { - transFn = noTransFn; - return; - } - - if ((inPF.bpp > 16) || (economic && (inPF.bpp == 16))) { - transFn = transRGBFns[inPF.bpp/32][outPF.bpp/16]; - (*initRGBFns[outPF.bpp/16]) (&table, inPF, outPF); - } else { - transFn = transSimpleFns[inPF.bpp/16][outPF.bpp/16]; - (*initSimpleFns[outPF.bpp/16]) (&table, inPF, outPF); - } -} - -const PixelFormat &PixelTransformer::getInPF() const -{ - return inPF; -} - -const PixelFormat &PixelTransformer::getOutPF() const -{ - return outPF; -} - -void PixelTransformer::translatePixels(const void* inPtr, void* outPtr, - int nPixels) const -{ - if (!transFn) - throw Exception("PixelTransformer: not initialised yet"); - - (*transFn)(table, inPF, inPtr, nPixels, - outPF, outPtr, nPixels, nPixels, 1); -} - -void PixelTransformer::translateRect(const void* inPtr, int inStride, - Rect inRect, - void* outPtr, int outStride, - Point outCoord) const -{ - char *in, *out; - - if (!transFn) - throw Exception("PixelTransformer: not initialised yet"); - - in = (char*)inPtr; - in += inPF.bpp/8 * inRect.tl.x; - in += (inStride * inPF.bpp/8) * inRect.tl.y; - - out = (char*)outPtr; - out += outPF.bpp/8 * outCoord.x; - out += (outStride * outPF.bpp/8) * outCoord.y; - - (*transFn)(table, inPF, in, inStride, - outPF, out, outStride, - inRect.width(), inRect.height()); -} - -bool PixelTransformer::willTransform(void) -{ - return transFn != NULL && transFn != noTransFn; -} diff --git a/common/rfb/PixelTransformer.h b/common/rfb/PixelTransformer.h deleted file mode 100644 index 818daf66..00000000 --- a/common/rfb/PixelTransformer.h +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. - * Copyright 2011 Pierre Ossman <ossman@cendio.se> for Cendio AB - * Copyright (C) 2011 D. R. Commander. All Rights Reserved. - * - * This is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - * USA. - */ - -#ifndef __RFB_PIXELTRANSFORMER_H__ -#define __RFB_PIXELTRANSFORMER_H__ - -#include <stdlib.h> -#include <rfb/Rect.h> -#include <rfb/PixelFormat.h> - -namespace rfb { - typedef void (*transFnType)(void* table_, - const PixelFormat& inPF, const void* inPtr, - int inStride, - const PixelFormat& outPF, void* outPtr, - int outStride, int width, int height); - - class SMsgWriter; - class PixelBuffer; - - class PixelTransformer { - public: - - PixelTransformer(bool econ=false); - virtual ~PixelTransformer(); - - // init() is called to initialise the translation tables. The inPF and - // inCM arguments give the source format details, outPF gives the - // target pixel format. - - void init(const PixelFormat& inPF, const PixelFormat& outPF); - - const PixelFormat &getInPF() const; - const PixelFormat &getOutPF() const; - - // translatePixels() translates the given number of pixels from inPtr, - // putting it into the buffer pointed to by outPtr. The pixels at inPtr - // should be in the format given by inPF to init(), and the translated - // pixels will be in the format given by the outPF argument to init(). - void translatePixels(const void* inPtr, void* outPtr, int nPixels) const; - - // Similar to translatePixels() but handles an arbitrary region of - // two pixel buffers. - void translateRect(const void* inPtr, int inStride, Rect inRect, - void* outPtr, int outStride, Point outCoord) const; - - bool willTransform(void); - - private: - bool economic; - - PixelFormat inPF; - PixelFormat outPF; - - rdr::U8* table; - transFnType transFn; - }; -} -#endif diff --git a/common/rfb/TransImageGetter.cxx b/common/rfb/TransImageGetter.cxx deleted file mode 100644 index 05df1a98..00000000 --- a/common/rfb/TransImageGetter.cxx +++ /dev/null @@ -1,67 +0,0 @@ -/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. - * Copyright (C) 2011 D. R. Commander. All Rights Reserved. - * - * This is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - * USA. - */ -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <rfb/PixelFormat.h> -#include <rfb/Exception.h> -#include <rfb/ConnParams.h> -#include <rfb/SMsgWriter.h> -#include <rfb/PixelBuffer.h> -#include <rfb/TransImageGetter.h> - -using namespace rfb; - -TransImageGetter::TransImageGetter(bool econ) - : PixelTransformer(econ), pb(0) -{ -} - -TransImageGetter::~TransImageGetter() -{ -} - -void TransImageGetter::init(PixelBuffer* pb_, const PixelFormat& out, - SMsgWriter* writer_) -{ - pb = pb_; - writer = writer_; - - PixelTransformer::init(pb->getPF(), out); -} - -const rdr::U8 *TransImageGetter::getRawBufferR(const Rect &r, int *stride) -{ - if (!offset.equals(Point(0, 0))) - return pb->getBuffer(r.translate(offset.negate()), stride); - else - return pb->getBuffer(r, stride); -} - -void TransImageGetter::getImage(void* outPtr, const Rect& r, int outStride) -{ - int inStride; - const rdr::U8* inPtr = pb->getBuffer(r.translate(offset.negate()), &inStride); - - if (!outStride) outStride = r.width(); - - translateRect((void*)inPtr, inStride, Rect(0, 0, r.width(), r.height()), - outPtr, outStride, Point(0, 0)); -} diff --git a/common/rfb/TransImageGetter.h b/common/rfb/TransImageGetter.h deleted file mode 100644 index bfd9c2fa..00000000 --- a/common/rfb/TransImageGetter.h +++ /dev/null @@ -1,82 +0,0 @@ -/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. - * Copyright (C) 2011 D. R. Commander. All Rights Reserved. - * - * This is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - * USA. - */ -// -// TransImageGetter - class to perform translation between pixel formats, -// implementing the ImageGetter interface. -// - -#ifndef __RFB_TRANSIMAGEGETTER_H__ -#define __RFB_TRANSIMAGEGETTER_H__ - -#include <rfb/Rect.h> -#include <rfb/PixelFormat.h> -#include <rfb/PixelTransformer.h> - -namespace rfb { - - class SMsgWriter; - class PixelBuffer; - - class TransImageGetter : public PixelTransformer { - public: - - TransImageGetter(bool econ=false); - virtual ~TransImageGetter(); - - // init() is called to initialise the translation tables. The PixelBuffer - // argument gives the source data and format details, outPF gives the - // client's pixel format. - - void init(PixelBuffer* pb, const PixelFormat& outPF, SMsgWriter* writer=0); - - // getImage() gets the given rectangle of data from the PixelBuffer, - // translates it into the client's pixel format and puts it in the buffer - // pointed to by the outPtr argument. The optional outStride argument can - // be used where padding is required between the output scanlines (the - // padding will be outStride-r.width() pixels). - void getImage(void* outPtr, const Rect& r, int outStride=0); - - // getRawBufferR() gets the given rectangle of data directly from the - // underlying PixelBuffer, bypassing the translation logic. Only use - // this when doing something that's independent of the client's pixel - // format. - const rdr::U8 *getRawBufferR(const Rect &r, int *stride); - - // setPixelBuffer() changes the pixel buffer to be used. The new pixel - // buffer MUST have the same pixel format as the old one - if not you - // should call init() instead. - void setPixelBuffer(PixelBuffer* pb_) { pb = pb_; } - - PixelBuffer *getPixelBuffer(void) { return pb; } - - // setOffset() sets an offset which is subtracted from the coordinates of - // the rectangle given to getImage(). - void setOffset(const Point& offset_) { offset = offset_; } - - private: - bool economic; - PixelBuffer* pb; - PixelFormat outPF; - SMsgWriter* writer; - rdr::U8* table; - transFnType transFn; - Point offset; - }; -} -#endif diff --git a/common/rfb/transInitTempl.h b/common/rfb/transInitTempl.h deleted file mode 100644 index 348f12b9..00000000 --- a/common/rfb/transInitTempl.h +++ /dev/null @@ -1,135 +0,0 @@ -/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. - * - * This is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - * USA. - */ -// -// transInitTempl.h - templates for functions to initialise lookup tables for -// the translation functions. -// -// This file is #included after having set the following macros: -// BPPOUT - 8, 16 or 32 - -#if !defined(BPPOUT) -#error "transInitTempl.h: BPPOUT not defined" -#endif - -namespace rfb { - -// CONCAT2E concatenates its arguments, expanding them if they are macros - -#ifndef CONCAT2E -#define CONCAT2(a,b) a##b -#define CONCAT2E(a,b) CONCAT2(a,b) -#endif - -#ifndef SWAP16 -#define SWAP16(n) ((((n) & 0xff) << 8) | (((n) >> 8) & 0xff)) -#endif - -#ifndef SWAP32 -#define SWAP32(n) (((n) >> 24) | (((n) & 0x00ff0000) >> 8) | \ - (((n) & 0x0000ff00) << 8) | ((n) << 24)) -#endif - -#define OUTPIXEL rdr::CONCAT2E(U,BPPOUT) -#define SWAPOUT CONCAT2E(SWAP,BPPOUT) -#define initSimpleOUT CONCAT2E(initSimple,BPPOUT) -#define initRGBOUT CONCAT2E(initRGB,BPPOUT) -#define initOneRGBTableOUT CONCAT2E(initOneRGBTable,BPPOUT) -#define initOneRGBCubeTableOUT CONCAT2E(initOneRGBCubeTable,BPPOUT) - -#ifndef TRANS_INIT_TEMPL_ENDIAN_TEST -#define TRANS_INIT_TEMPL_ENDIAN_TEST - static rdr::U32 endianTest = 1; - static bool nativeBigEndian = *(rdr::U8*)(&endianTest) != 1; -#endif - -void initSimpleOUT (rdr::U8** tablep, const PixelFormat& inPF, - const PixelFormat& outPF) -{ - if (inPF.bpp != 8 && inPF.bigEndian != nativeBigEndian) - throw Exception("Internal error: inPF is not native endian"); - - int size = 1 << inPF.bpp; - - delete [] *tablep; - *tablep = new rdr::U8[size * sizeof(OUTPIXEL)]; - OUTPIXEL* table = (OUTPIXEL*)*tablep; - - for (int i = 0; i < size; i++) { - int r = (i >> inPF.redShift) & inPF.redMax; - int g = (i >> inPF.greenShift) & inPF.greenMax; - int b = (i >> inPF.blueShift) & inPF.blueMax; - - r = (r * outPF.redMax + inPF.redMax/2) / inPF.redMax; - g = (g * outPF.greenMax + inPF.greenMax/2) / inPF.greenMax; - b = (b * outPF.blueMax + inPF.blueMax/2) / inPF.blueMax; - - table[i] = ((r << outPF.redShift) | - (g << outPF.greenShift) | - (b << outPF.blueShift)); -#if (BPPOUT != 8) - if (outPF.bigEndian != nativeBigEndian) - table[i] = SWAPOUT (table[i]); -#endif - } -} - -static void initOneRGBTableOUT (OUTPIXEL* table, int inMax, int outMax, - int outShift, bool swap) -{ - int size = inMax + 1; - - for (int i = 0; i < size; i++) { - table[i] = ((i * outMax + inMax / 2) / inMax) << outShift; -#if (BPPOUT != 8) - if (swap) - table[i] = SWAPOUT (table[i]); -#endif - } -} - -void initRGBOUT (rdr::U8** tablep, const PixelFormat& inPF, - const PixelFormat& outPF) -{ - if (inPF.bpp != 8 && inPF.bigEndian != nativeBigEndian) - throw Exception("Internal error: inPF is not native endian"); - - int size = inPF.redMax + inPF.greenMax + inPF.blueMax + 3; - - delete [] *tablep; - *tablep = new rdr::U8[size * sizeof(OUTPIXEL)]; - - OUTPIXEL* redTable = (OUTPIXEL*)*tablep; - OUTPIXEL* greenTable = redTable + inPF.redMax + 1; - OUTPIXEL* blueTable = greenTable + inPF.greenMax + 1; - - bool swap = (outPF.bigEndian != nativeBigEndian); - - initOneRGBTableOUT (redTable, inPF.redMax, outPF.redMax, - outPF.redShift, swap); - initOneRGBTableOUT (greenTable, inPF.greenMax, outPF.greenMax, - outPF.greenShift, swap); - initOneRGBTableOUT (blueTable, inPF.blueMax, outPF.blueMax, - outPF.blueShift, swap); -} - - -#undef OUTPIXEL -#undef initSimpleOUT -#undef initRGBOUT -#undef initOneRGBTableOUT -} diff --git a/common/rfb/transTempl.h b/common/rfb/transTempl.h deleted file mode 100644 index 49edb0ac..00000000 --- a/common/rfb/transTempl.h +++ /dev/null @@ -1,118 +0,0 @@ -/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. - * - * This is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - * USA. - */ -// -// transTempl.h - templates for translation functions. -// -// This file is #included after having set the following macros: -// BPPIN - 8, 16 or 32 -// BPPOUT - 8, 16 or 32 - -#if !defined(BPPIN) || !defined(BPPOUT) -#error "transTempl.h: BPPIN or BPPOUT not defined" -#endif - -// CONCAT2E concatenates its arguments, expanding them if they are macros - -#ifndef CONCAT2E -#define CONCAT2(a,b) a##b -#define CONCAT2E(a,b) CONCAT2(a,b) -#endif - -#ifndef CONCAT4E -#define CONCAT4(a,b,c,d) a##b##c##d -#define CONCAT4E(a,b,c,d) CONCAT4(a,b,c,d) -#endif - -#define INPIXEL rdr::CONCAT2E(U,BPPIN) -#define OUTPIXEL rdr::CONCAT2E(U,BPPOUT) -#define transSimpleINtoOUT CONCAT4E(transSimple,BPPIN,to,BPPOUT) -#define transRGBINtoOUT CONCAT4E(transRGB,BPPIN,to,BPPOUT) - -#if (BPPIN <= 16) - -// transSimpleINtoOUT uses a single table. This can be used for any incoming -// and outgoing pixel formats, as long as the incoming pixel format is not too -// large (for 16bpp, the table needs 64K entries). - -void transSimpleINtoOUT (void* table_, - const PixelFormat& inPF, const void* inPtr, int inStride, - const PixelFormat& outPF, void* outPtr, int outStride, - int width, int height) -{ - OUTPIXEL* table = (OUTPIXEL*)table_; - INPIXEL* ip = (INPIXEL*)inPtr; - OUTPIXEL* op = (OUTPIXEL*)outPtr; - int inExtra = inStride - width; - int outExtra = outStride - width; - - while (height > 0) { - OUTPIXEL* opEndOfRow = op + width; - while (op < opEndOfRow) - *op++ = table[*ip++]; - ip += inExtra; - op += outExtra; - height--; - } -} - -#endif - -#if (BPPIN >= 16) - -// transRGBINtoOUT uses three tables, one each for red, green and blue -// components and adds the values to produce the result. This can be used -// where a single table would be too large (e.g. 32bpp). It only works for a -// trueColour incoming pixel format. Usually the outgoing pixel format is -// trueColour, but we add rather than ORing the three values so that it is also -// possible to generate an index into a colour cube. I believe that in most -// cases adding is just as fast as ORing - if not then we should split this -// into two different functions for efficiency. - -void transRGBINtoOUT (void* table, - const PixelFormat& inPF, const void* inPtr, int inStride, - const PixelFormat& outPF, void* outPtr, int outStride, - int width, int height) -{ - OUTPIXEL* redTable = (OUTPIXEL*)table; - OUTPIXEL* greenTable = redTable + inPF.redMax + 1; - OUTPIXEL* blueTable = greenTable + inPF.greenMax + 1; - INPIXEL* ip = (INPIXEL*)inPtr; - OUTPIXEL* op = (OUTPIXEL*)outPtr; - int inExtra = inStride - width; - int outExtra = outStride - width; - - while (height > 0) { - OUTPIXEL* opEndOfRow = op + width; - while (op < opEndOfRow) { - *op++ = (redTable [(*ip >> inPF.redShift) & inPF.redMax] + - greenTable[(*ip >> inPF.greenShift) & inPF.greenMax] + - blueTable [(*ip >> inPF.blueShift) & inPF.blueMax]); - ip++; - } - ip += inExtra; - op += outExtra; - height--; - } -} - -#endif - -#undef INPIXEL -#undef OUTPIXEL -#undef transSimpleINtoOUT -#undef transRGBINtoOUT diff --git a/tests/pixelconv.cxx b/tests/pixelconv.cxx index a30ed909..031ba8ce 100644 --- a/tests/pixelconv.cxx +++ b/tests/pixelconv.cxx @@ -4,7 +4,6 @@ #include <time.h> #include <rfb/PixelFormat.h> -#include <rfb/PixelTransformer.h> #include "util.h" @@ -13,8 +12,6 @@ static const int fbsize = 4096; static rdr::U8 *fb1, *fb2; -static rfb::PixelTransformer *pt = NULL; - typedef void (*testfn) (rfb::PixelFormat&, rfb::PixelFormat&, rdr::U8*, rdr::U8*); struct TestEntry { @@ -34,14 +31,6 @@ static void testMemcpy(rfb::PixelFormat &dstpf, rfb::PixelFormat &srcpf, } } -static void testPixelTransformer(rfb::PixelFormat &dstpf, - rfb::PixelFormat &srcpf, - rdr::U8 *dst, rdr::U8 *src) -{ - pt->translateRect(src, fbsize, rfb::Rect(0, 0, tile, tile), - dst, fbsize, rfb::Point(0, 0)); -} - static void testBuffer(rfb::PixelFormat &dstpf, rfb::PixelFormat &srcpf, rdr::U8 *dst, rdr::U8 *src) { @@ -62,11 +51,6 @@ static void testFromRGB(rfb::PixelFormat &dstpf, rfb::PixelFormat &srcpf, static void doTest(testfn fn, rfb::PixelFormat &dstpf, rfb::PixelFormat &srcpf) { - if (!srcpf.isLittleEndian() && (fn == testPixelTransformer)) { - printf("NaN"); - return; - } - startCpuCounter(); for (int i = 0;i < 10000;i++) { @@ -91,7 +75,6 @@ static void doTest(testfn fn, rfb::PixelFormat &dstpf, rfb::PixelFormat &srcpf) struct TestEntry tests[] = { {"memcpy", testMemcpy}, - {"PixelTransformer", testPixelTransformer}, {"bufferFromBuffer", testBuffer}, {"rgbFromBuffer", testToRGB}, {"bufferFromRGB", testFromRGB}, @@ -105,12 +88,6 @@ static void doTests(rfb::PixelFormat &dstpf, rfb::PixelFormat &srcpf) dstpf.print(dstb, sizeof(dstb)); srcpf.print(srcb, sizeof(srcb)); - if (srcpf.isLittleEndian()) { - delete pt; - pt = new rfb::PixelTransformer; - pt->init(srcpf, dstpf); - } - printf("%s,%s", srcb, dstb); for (i = 0;i < sizeof(tests)/sizeof(tests[0]);i++) { |