1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000,2001,2002 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGNFIOQUANTIZER_H_
40 #define _OSGNFIOQUANTIZER_H_
45 #include "OSGBaseTypes.h"
49 /*! \brief Quantizer class.
50 quantize reals into 8, 16, or 24 bit integers.
51 round then left-reconstruct
59 /*========================== PUBLIC =================================*/
62 /*---------------------------------------------------------------------*/
63 /*! \name Constructor */
66 Quantizer(Real32 inputMin
, Real32 inputMax
, UInt8 res
);
69 /*---------------------------------------------------------------------*/
70 /*! \name Encode/Decode */
73 UInt32
encode(Real32 input
);
74 Real32
decode(UInt32 encodedValue
);
77 /*---------------------------------------------------------------------*/
78 /*! \name Constants */
81 static const UInt8 QRES_OFF
;
82 static const UInt8 QRES_8BIT
;
83 static const UInt8 QRES_16BIT
;
84 static const UInt8 QRES_24BIT
;
87 /*========================== PRIVATE ================================*/
91 Real32
normalizeInput(Real32 input
, Real32 inputMin
, Real32 inputScale
);
102 #endif /* _OSGNFIOQUANTIZER_H_ */