Equalizer  1.3.1-git
compressor.h
Go to the documentation of this file.
00001 
00002 /* Copyright (c) 2009-2010, Cedric Stalder <cedric.stalder@gmail.com> 
00003  *               2009-2012, Stefan Eilemann <eile@equalizergraphics.com>
00004  *
00005  * This library is free software; you can redistribute it and/or modify it under
00006  * the terms of the GNU Lesser General Public License version 2.1 as published
00007  * by the Free Software Foundation.
00008  *  
00009  * This library is distributed in the hope that it will be useful, but WITHOUT
00010  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00011  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00012  * details.
00013  * 
00014  * You should have received a copy of the GNU Lesser General Public License
00015  * along with this library; if not, write to the Free Software Foundation, Inc.,
00016  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00017  */
00018 
00162 #ifndef EQ_PLUGINS_COMPRESSOR
00163 #define EQ_PLUGINS_COMPRESSOR
00164 
00166 #include <sys/types.h>
00167 struct GLEWContextStruct;
00168 struct WGLEWContextStruct;
00169 typedef struct GLEWContextStruct GLEWContext;
00170 typedef struct WGLEWContextStruct WGLEWContext;
00171 typedef unsigned long long eq_uint64_t;
00172 
00173 #ifdef _MSC_VER
00174 #  ifdef EQ_PLUGIN_BUILD
00175 #    define EQ_PLUGIN_API __declspec(dllexport) 
00176 #  else
00177 #    define EQ_PLUGIN_API __declspec(dllimport)
00178 #  endif
00179 #else // _WIN32
00180 #  define EQ_PLUGIN_API __attribute__ ((visibility("default")))
00181 #endif
00182 
00187 #define EQ_COMPRESSOR_VERSION 4
00188 
00189 #define EQ_COMPRESSOR_VERSION_1 1
00190 
00191 #define EQ_COMPRESSOR_VERSION_2 1
00192 
00193 #define EQ_COMPRESSOR_VERSION_3 1
00194 
00195 #define EQ_COMPRESSOR_VERSION_4 1
00196 
00198 #include <co/plugins/compressorTokens.h>
00199 #include <co/plugins/compressorTypes.h>
00200 
00201 #ifdef __cplusplus
00202 #  include <vector>
00203 
00204 extern "C" {
00205 #endif
00206 
00218     #define EQ_COMPRESSOR_INPLACE    0x1
00219 
00224     #define EQ_COMPRESSOR_DATA_1D    0x2
00225 
00231     #define EQ_COMPRESSOR_DATA_2D    0x4
00232 
00249     #define EQ_COMPRESSOR_IGNORE_ALPHA 0x8
00250 
00251     #define EQ_COMPRESSOR_IGNORE_MSE EQ_COMPRESSOR_IGNORE_ALPHA
00252 
00259     #define EQ_COMPRESSOR_CPU 0
00260 
00267     #define EQ_COMPRESSOR_TRANSFER 0x10
00268 
00275     #define EQ_COMPRESSOR_USE_TEXTURE_RECT 0x20
00276 
00282     #define EQ_COMPRESSOR_USE_TEXTURE_2D 0x80
00283 
00289     #define EQ_COMPRESSOR_USE_FRAMEBUFFER 0x40
00290 
00297     #define EQ_COMPRESSOR_USE_ASYNC_DOWNLOAD 0x100
00298 
00299 #if 0 // Not implemented yet
00300 
00306     #define EQ_COMPRESSOR_USE_ASYNC_UPLOAD 0x200
00307 #endif
00308 
00313     struct EqCompressorInfo
00314     {
00323         unsigned version;
00324 
00326         unsigned name;
00327 
00336         unsigned tokenType;
00337 
00339         eq_uint64_t capabilities;
00340 
00342         float quality;
00343 
00345         float ratio;
00346 
00348         float speed;
00349 
00362         unsigned outputTokenType;
00363 
00365         unsigned outputTokenSize;
00366     };
00367 
00369     EQ_PLUGIN_API size_t EqCompressorGetNumCompressors();
00370 
00384     EQ_PLUGIN_API void EqCompressorGetInfo( const size_t n,
00385                                             EqCompressorInfo* const info );
00405     EQ_PLUGIN_API void* EqCompressorNewCompressor( const unsigned name );
00406 
00413     EQ_PLUGIN_API void EqCompressorDeleteCompressor( void* const compressor );
00414 
00428     EQ_PLUGIN_API void* EqCompressorNewDecompressor( const unsigned name );
00435     EQ_PLUGIN_API void EqCompressorDeleteDecompressor(void* const decompressor);
00463     EQ_PLUGIN_API void EqCompressorCompress( void* const compressor, 
00464                                              const unsigned name,
00465                                              void* const in, 
00466                                              const eq_uint64_t* inDims,
00467                                              const eq_uint64_t flags );
00468 
00480     EQ_PLUGIN_API unsigned EqCompressorGetNumResults( void* const compressor,
00481                                                       const unsigned name );
00482 
00493     EQ_PLUGIN_API void EqCompressorGetResult( void* const compressor, 
00494                                               const unsigned name,
00495                                               const unsigned i, 
00496                                               void** const out, 
00497                                               eq_uint64_t* const outSize );
00498 
00519     EQ_PLUGIN_API void EqCompressorDecompress( void* const decompressor, 
00520                                                const unsigned name,
00521                                                const void* const* in, 
00522                                                const eq_uint64_t* const inSizes,
00523                                                const unsigned numInputs,
00524                                                void* const out,
00525                                                eq_uint64_t* const outDims,
00526                                                const eq_uint64_t flags );
00545     EQ_PLUGIN_API bool EqCompressorIsCompatible( const unsigned name,
00546                                                const GLEWContext* glewContext );
00547 
00596     EQ_PLUGIN_API void EqCompressorDownload( void* const        compressor,
00597                                              const unsigned     name,
00598                                              const GLEWContext* glewContext,
00599                                              const eq_uint64_t  inDims[4],
00600                                              const unsigned     source,
00601                                              const eq_uint64_t  flags,
00602                                              eq_uint64_t        outDims[4],
00603                                              void**             out );
00604 
00629     EQ_PLUGIN_API void EqCompressorStartDownload( void* const        compressor,
00630                                                   const unsigned     name,
00631                                                  const GLEWContext* glewContext,
00632                                                   const eq_uint64_t  inDims[4],
00633                                                   const unsigned     source,
00634                                                   const eq_uint64_t  flags );
00635 
00653     EQ_PLUGIN_API void EqCompressorFinishDownload( void* const compressor,
00654                                                    const unsigned     name,
00655                                                  const GLEWContext* glewContext,
00656                                                    const eq_uint64_t  inDims[4],
00657                                                    const eq_uint64_t  flags,
00658                                                    eq_uint64_t outDims[4],
00659                                                    void**             out );
00660 
00703     EQ_PLUGIN_API void EqCompressorUpload( void* const        decompressor,
00704                                            const unsigned     name,
00705                                            const GLEWContext* glewContext, 
00706                                            const void*        buffer,
00707                                            const eq_uint64_t  inDims[4],
00708                                            const eq_uint64_t  flags,
00709                                            const eq_uint64_t  outDims[4],  
00710                                            const unsigned     destination );
00711 #if 0
00712     // TODO: add EqCompressorStart/FinishUpload and document operations and
00713     // parameters
00714 #endif
00715 
00717 #ifdef __cplusplus
00718 }
00719 #endif
00720 #endif // EQ_PLUGINS_COMPRESSOR
Generated on Tue May 1 2012 15:14:25 for Equalizer 1.3.1-git by  doxygen 1.8.0