[Okvm-cvs] okvm/realvnc/rfb 24bpp.cxx,NONE,1.1 ConnParams.cxx,1.1.1.1,1.2 Makefile.in,1.1.1.1,1.2 Tr
Status: Pre-Alpha
Brought to you by:
david-m
|
From: David M. <da...@us...> - 2006-05-28 11:53:13
|
Update of /cvsroot/okvm/okvm/realvnc/rfb In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25632/realvnc/rfb Modified Files: ConnParams.cxx Makefile.in TransImageGetter.cxx transInitTempl.h transTempl.h Added Files: 24bpp.cxx Log Message: This patch allows using 24bpp data sources. This lets me use my webcams and ensures my colors are what they should be. It wasn't the easiest as there is no native 24 bit datatype. The patch uses C++ object for the 24bit data type. Scott Burns <sb...@ii...> Index: Makefile.in =================================================================== RCS file: /cvsroot/okvm/okvm/realvnc/rfb/Makefile.in,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Makefile.in 4 Nov 2005 12:17:50 -0000 1.1.1.1 --- Makefile.in 28 May 2006 11:53:07 -0000 1.2 *************** *** 47,51 **** secTypes.cxx \ util.cxx \ ! vncAuth.cxx SRCS = d3des.c $(CXXSRCS) --- 47,52 ---- secTypes.cxx \ util.cxx \ ! vncAuth.cxx \ ! 24bpp.cxx SRCS = d3des.c $(CXXSRCS) Index: transTempl.h =================================================================== RCS file: /cvsroot/okvm/okvm/realvnc/rfb/transTempl.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** transTempl.h 4 Nov 2005 12:17:48 -0000 1.1.1.1 --- transTempl.h 28 May 2006 11:53:07 -0000 1.2 *************** *** 20,25 **** // // 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) --- 20,25 ---- // // This file is #included after having set the following macros: ! // BPPIN - 8, 16, 24 or 32 ! // BPPOUT - 8, 16, 24 or 32 #if !defined(BPPIN) || !defined(BPPOUT) *************** *** 132,138 **** --- 132,145 ---- OUTPIXEL* opEndOfRow = op + width; while (op < opEndOfRow) { + #if BPPOUT == 24 + *op++ = cubeTable->operator[]( + (redTable [(*ip >> inPF.redShift) & inPF.redMax] + + greenTable[(*ip >> inPF.greenShift) & inPF.greenMax] + + blueTable [(*ip >> inPF.blueShift) & inPF.blueMax])); + #else *op++ = cubeTable[(redTable [(*ip >> inPF.redShift) & inPF.redMax] + greenTable[(*ip >> inPF.greenShift) & inPF.greenMax] + blueTable [(*ip >> inPF.blueShift) & inPF.blueMax])]; + #endif ip++; } --- NEW FILE: 24bpp.cxx --- /* Copyright (C) 2006 Scott Burns. 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 "rdr/types.h" using namespace rdr; U24::U24() { red = 0; green = 0; blue = 0; } U24 U24::operator+ (U24 param) { U24 temp; temp.red = red + param.red; temp.blue = red + param.blue; temp.green = red + param.green; return temp; } int U24::operator>> (int param) { int temp = blue << 16 | green << 8 | red; return temp >> param; } U24 U24::operator= (int param) { U24 temp; temp.red = param & 0x00ff; param >> 8; temp.green = param & 0x00ff; param >> 8; temp.blue = param & 0x00ff; return temp; } U24 U24::operator[] (U24 param) { U24 * temp; int offset = param >> 0; temp = this + offset; return *this; } Index: transInitTempl.h =================================================================== RCS file: /cvsroot/okvm/okvm/realvnc/rfb/transInitTempl.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** transInitTempl.h 4 Nov 2005 12:17:48 -0000 1.1.1.1 --- transInitTempl.h 28 May 2006 11:53:07 -0000 1.2 *************** *** 21,25 **** // // This file is #included after having set the following macros: ! // BPPOUT - 8, 16 or 32 #if !defined(BPPOUT) --- 21,25 ---- // // This file is #included after having set the following macros: ! // BPPOUT - 8, 16, 24 or 32 #if !defined(BPPOUT) *************** *** 40,43 **** --- 40,48 ---- #endif + #ifndef SWAP24 + // SBSBSB swapping packed 24 bit colours just doesn't make sense... + #define SWAP24(n) n + #endif + #ifndef SWAP32 #define SWAP32(n) (((n) >> 24) | (((n) & 0x00ff0000) >> 8) | \ Index: TransImageGetter.cxx =================================================================== RCS file: /cvsroot/okvm/okvm/realvnc/rfb/TransImageGetter.cxx,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** TransImageGetter.cxx 4 Nov 2005 12:17:52 -0000 1.1.1.1 --- TransImageGetter.cxx 28 May 2006 11:53:07 -0000 1.2 *************** *** 59,62 **** --- 59,65 ---- #include "transTempl.h" #undef BPPIN + #define BPPIN 24 + #include "transTempl.h" + #undef BPPIN #define BPPIN 32 #include "transTempl.h" *************** *** 72,75 **** --- 75,97 ---- #include "transTempl.h" #undef BPPIN + #define BPPIN 24 + #include "transTempl.h" + #undef BPPIN + #define BPPIN 32 + #include "transTempl.h" + #undef BPPIN + #undef BPPOUT + + #define BPPOUT 24 + #include "transInitTempl.h" + #define BPPIN 8 + #include "transTempl.h" + #undef BPPIN + #define BPPIN 16 + #include "transTempl.h" + #undef BPPIN + #define BPPIN 24 + #include "transTempl.h" + #undef BPPIN #define BPPIN 32 #include "transTempl.h" *************** *** 85,88 **** --- 107,113 ---- #include "transTempl.h" #undef BPPIN + #define BPPIN 24 + #include "transTempl.h" + #undef BPPIN #define BPPIN 32 #include "transTempl.h" *************** *** 94,108 **** // 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 } }; ! static transFnType transRGBCubeFns[][3] = { ! { transRGBCube16to8, transRGBCube16to16, transRGBCube16to32 }, ! { transRGBCube32to8, transRGBCube32to16, transRGBCube32to32 } }; --- 119,140 ---- // transRGB* is used for 16/32bpp ! static transFnType transSimpleFns[][5] = { ! { NULL, transSimple8to8, transSimple8to16, transSimple8to24, transSimple8to32 }, ! { NULL, transSimple16to8, transSimple16to16, transSimple16to24, transSimple16to32 }, }; ! static transFnType transRGBFns[][5] = { ! { NULL, NULL, NULL, NULL, NULL }, ! { NULL, NULL, NULL, NULL, NULL }, ! { NULL, transRGB16to8, transRGB16to16, transRGB16to24, transRGB16to32 }, ! { NULL, transRGB24to8, transRGB24to16, transRGB24to24, transRGB24to32 }, ! { NULL, transRGB32to8, transRGB32to16, transRGB32to24, transRGB32to32 } }; ! // { NULL, transRGBCube16to8, transRGBCube16to16, transRGBCube16to24, transRGBCube16to32 }, ! static transFnType transRGBCubeFns[][5] = { ! { NULL, NULL, NULL, NULL, NULL }, ! { NULL, NULL, NULL, NULL, NULL }, ! { NULL, transRGBCube16to8, transRGBCube16to16, transRGBCube16to24, transRGBCube16to32 }, ! { NULL, transRGBCube24to8, transRGBCube24to16, transRGBCube24to24, transRGBCube24to32 }, ! { NULL, transRGBCube32to8, transRGBCube32to16, transRGBCube32to24, transRGBCube32to32 } }; *************** *** 120,144 **** static initCMtoTCFnType initSimpleCMtoTCFns[] = { ! initSimpleCMtoTC8, initSimpleCMtoTC16, initSimpleCMtoTC32 }; static initTCtoTCFnType initSimpleTCtoTCFns[] = { ! initSimpleTCtoTC8, initSimpleTCtoTC16, initSimpleTCtoTC32 }; static initCMtoCubeFnType initSimpleCMtoCubeFns[] = { ! initSimpleCMtoCube8, initSimpleCMtoCube16, initSimpleCMtoCube32 }; static initTCtoCubeFnType initSimpleTCtoCubeFns[] = { ! initSimpleTCtoCube8, initSimpleTCtoCube16, initSimpleTCtoCube32 }; static initTCtoTCFnType initRGBTCtoTCFns[] = { ! initRGBTCtoTC8, initRGBTCtoTC16, initRGBTCtoTC32 }; static initTCtoCubeFnType initRGBTCtoCubeFns[] = { ! initRGBTCtoCube8, initRGBTCtoCube16, initRGBTCtoCube32 }; --- 152,176 ---- static initCMtoTCFnType initSimpleCMtoTCFns[] = { ! NULL, initSimpleCMtoTC8, initSimpleCMtoTC16, initSimpleCMtoTC24, initSimpleCMtoTC32 }; static initTCtoTCFnType initSimpleTCtoTCFns[] = { ! NULL, initSimpleTCtoTC8, initSimpleTCtoTC16, initSimpleTCtoTC24, initSimpleTCtoTC32 }; static initCMtoCubeFnType initSimpleCMtoCubeFns[] = { ! NULL, initSimpleCMtoCube8, initSimpleCMtoCube16, initSimpleCMtoCube24, initSimpleCMtoCube32 }; static initTCtoCubeFnType initSimpleTCtoCubeFns[] = { ! NULL, initSimpleTCtoCube8, initSimpleTCtoCube16, initSimpleTCtoCube24, initSimpleTCtoCube32 }; static initTCtoTCFnType initRGBTCtoTCFns[] = { ! NULL, initRGBTCtoTC8, initRGBTCtoTC16, initRGBTCtoTC24, initRGBTCtoTC32 }; static initTCtoCubeFnType initRGBTCtoCubeFns[] = { ! NULL, initRGBTCtoCube8, initRGBTCtoCube16, initRGBTCtoCube24, initRGBTCtoCube32 }; *************** *** 163,171 **** const PixelFormat& inPF = pb->getPF(); ! if ((inPF.bpp != 8) && (inPF.bpp != 16) && (inPF.bpp != 32)) ! throw Exception("TransImageGetter: bpp in not 8, 16 or 32"); ! if ((outPF.bpp != 8) && (outPF.bpp != 16) && (outPF.bpp != 32)) ! throw Exception("TransImageGetter: bpp out not 8, 16 or 32"); if (!outPF.trueColour) { --- 195,203 ---- const PixelFormat& inPF = pb->getPF(); ! if ((inPF.bpp != 8) && (inPF.bpp != 16) && (inPF.bpp != 24) && (inPF.bpp != 32)) ! throw Exception("TransImageGetter: bpp in not 8, 24, 16 or 32"); ! if ((outPF.bpp != 8) && (outPF.bpp != 16) && (outPF.bpp != 24) && (outPF.bpp != 32)) ! throw Exception("TransImageGetter: bpp out not 8, 16, 24 or 32"); if (!outPF.trueColour) { *************** *** 180,185 **** if (cube) { ! transFn = transSimpleFns[inPF.bpp/16][outPF.bpp/16]; ! (*initSimpleCMtoCubeFns[outPF.bpp/16]) (&table, inPF, pb->getColourMap(), cube); } else { --- 212,217 ---- if (cube) { ! transFn = transSimpleFns[inPF.bpp/16][outPF.bpp/8]; ! (*initSimpleCMtoCubeFns[outPF.bpp/8]) (&table, inPF, pb->getColourMap(), cube); } else { *************** *** 196,204 **** if ((inPF.bpp > 16) || (economic && (inPF.bpp == 16))) { ! transFn = transRGBCubeFns[inPF.bpp/32][outPF.bpp/16]; ! (*initRGBTCtoCubeFns[outPF.bpp/16]) (&table, inPF, cube); } else { ! transFn = transSimpleFns[inPF.bpp/16][outPF.bpp/16]; ! (*initSimpleTCtoCubeFns[outPF.bpp/16]) (&table, inPF, cube); } --- 228,236 ---- if ((inPF.bpp > 16) || (economic && (inPF.bpp == 16))) { ! transFn = transRGBCubeFns[inPF.bpp/8][outPF.bpp/8]; ! (*initRGBTCtoCubeFns[outPF.bpp/8]) (&table, inPF, cube); } else { ! transFn = transSimpleFns[inPF.bpp/16][outPF.bpp/8]; ! (*initSimpleTCtoCubeFns[outPF.bpp/8]) (&table, inPF, cube); } *************** *** 222,227 **** if (inPF.bpp != 8) throw Exception("TransImageGetter: inPF has colourMap but not 8bpp"); ! transFn = transSimpleFns[inPF.bpp/16][outPF.bpp/16]; ! (*initSimpleCMtoTCFns[outPF.bpp/16]) (&table, inPF, pb->getColourMap(), outPF); return; --- 254,259 ---- if (inPF.bpp != 8) throw Exception("TransImageGetter: inPF has colourMap but not 8bpp"); ! transFn = transSimpleFns[inPF.bpp/16][outPF.bpp/8]; ! (*initSimpleCMtoTCFns[outPF.bpp/8]) (&table, inPF, pb->getColourMap(), outPF); return; *************** *** 231,239 **** if ((inPF.bpp > 16) || (economic && (inPF.bpp == 16))) { ! transFn = transRGBFns[inPF.bpp/32][outPF.bpp/16]; ! (*initRGBTCtoTCFns[outPF.bpp/16]) (&table, inPF, outPF); } else { ! transFn = transSimpleFns[inPF.bpp/16][outPF.bpp/16]; ! (*initSimpleTCtoTCFns[outPF.bpp/16]) (&table, inPF, outPF); } } --- 263,271 ---- if ((inPF.bpp > 16) || (economic && (inPF.bpp == 16))) { ! transFn = transRGBFns[inPF.bpp/8][outPF.bpp/8]; ! (*initRGBTCtoTCFns[outPF.bpp/8]) (&table, inPF, outPF); } else { ! transFn = transSimpleFns[inPF.bpp/16][outPF.bpp/8]; ! (*initSimpleTCtoTCFns[outPF.bpp/8]) (&table, inPF, outPF); } } *************** *** 247,254 **** if (outPF.trueColour) { ! (*initSimpleCMtoTCFns[outPF.bpp/16]) (&table, pb->getPF(), pb->getColourMap(), outPF); } else if (cube) { ! (*initSimpleCMtoCubeFns[outPF.bpp/16]) (&table, pb->getPF(), pb->getColourMap(), cube); } else if (writer && pb->getColourMap()) { --- 279,286 ---- if (outPF.trueColour) { ! (*initSimpleCMtoTCFns[outPF.bpp/8]) (&table, pb->getPF(), pb->getColourMap(), outPF); } else if (cube) { ! (*initSimpleCMtoCubeFns[outPF.bpp/8]) (&table, pb->getPF(), pb->getColourMap(), cube); } else if (writer && pb->getColourMap()) { Index: ConnParams.cxx =================================================================== RCS file: /cvsroot/okvm/okvm/realvnc/rfb/ConnParams.cxx,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ConnParams.cxx 4 Nov 2005 12:17:52 -0000 1.1.1.1 --- ConnParams.cxx 28 May 2006 11:53:07 -0000 1.2 *************** *** 69,74 **** pf_ = pf; ! if (pf.bpp != 8 && pf.bpp != 16 && pf.bpp != 32) ! throw Exception("setPF: not 8, 16 or 32 bpp?"); } --- 69,74 ---- pf_ = pf; ! if (pf.bpp != 8 && pf.bpp != 16 && pf.bpp != 24 && pf.bpp != 32) ! throw Exception("setPF: not 8, 16, 24 or 32 bpp?"); } |