Equalizer  1.4.1
plugins/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 
00167 #ifndef EQ_PLUGINS_COMPRESSOR
00168 #define EQ_PLUGINS_COMPRESSOR
00169 
00171 #include <sys/types.h>
00172 struct GLEWContextStruct;
00173 struct WGLEWContextStruct;
00174 typedef struct GLEWContextStruct GLEWContext;
00175 typedef struct WGLEWContextStruct WGLEWContext;
00176 typedef unsigned long long eq_uint64_t;
00177 
00178 #ifdef _MSC_VER
00179 #  ifdef EQ_PLUGIN_BUILD
00180 #    define EQ_PLUGIN_API __declspec(dllexport) 
00181 #  else
00182 #    define EQ_PLUGIN_API __declspec(dllimport)
00183 #  endif
00184 #else // _WIN32
00185 #  define EQ_PLUGIN_API __attribute__ ((visibility("default")))
00186 #endif
00187 
00192 #define EQ_COMPRESSOR_VERSION 4
00193 
00194 #define EQ_COMPRESSOR_VERSION_1 1
00195 
00196 #define EQ_COMPRESSOR_VERSION_2 1
00197 
00198 #define EQ_COMPRESSOR_VERSION_3 1
00199 
00200 #define EQ_COMPRESSOR_VERSION_4 1
00201 
00203 #include <co/plugins/compressorTokens.h>
00204 #include <co/plugins/compressorTypes.h>
00205 
00206 #ifdef __cplusplus
00207 #  include <vector>
00208 
00209 extern "C" {
00210 #endif
00211 
00223     #define EQ_COMPRESSOR_INPLACE    0x1
00224 
00229     #define EQ_COMPRESSOR_DATA_1D    0x2
00230 
00236     #define EQ_COMPRESSOR_DATA_2D    0x4
00237 
00254     #define EQ_COMPRESSOR_IGNORE_ALPHA 0x8
00255 
00256     #define EQ_COMPRESSOR_IGNORE_MSE EQ_COMPRESSOR_IGNORE_ALPHA
00257 
00264     #define EQ_COMPRESSOR_CPU 0
00265 
00272     #define EQ_COMPRESSOR_TRANSFER 0x10
00273 
00280     #define EQ_COMPRESSOR_USE_TEXTURE_RECT 0x20
00281 
00287     #define EQ_COMPRESSOR_USE_TEXTURE_2D 0x80
00288 
00294     #define EQ_COMPRESSOR_USE_FRAMEBUFFER 0x40
00295 
00302     #define EQ_COMPRESSOR_USE_ASYNC_DOWNLOAD 0x100
00303 
00304 #if 0 // Not implemented yet
00305 
00311     #define EQ_COMPRESSOR_USE_ASYNC_UPLOAD 0x200
00312 #endif
00313 
00318     struct EqCompressorInfo
00319     {
00328         unsigned version;
00329 
00331         unsigned name;
00332 
00341         unsigned tokenType;
00342 
00344         eq_uint64_t capabilities;
00345 
00347         float quality;
00348 
00350         float ratio;
00351 
00353         float speed;
00354 
00367         unsigned outputTokenType;
00368 
00370         unsigned outputTokenSize;
00371     };
00372 
00374     EQ_PLUGIN_API size_t EqCompressorGetNumCompressors();
00375 
00389     EQ_PLUGIN_API void EqCompressorGetInfo( const size_t n,
00390                                             EqCompressorInfo* const info );
00410     EQ_PLUGIN_API void* EqCompressorNewCompressor( const unsigned name );
00411 
00418     EQ_PLUGIN_API void EqCompressorDeleteCompressor( void* const compressor );
00419 
00433     EQ_PLUGIN_API void* EqCompressorNewDecompressor( const unsigned name );
00434 
00441     EQ_PLUGIN_API void EqCompressorDeleteDecompressor(void* const decompressor);
00469     EQ_PLUGIN_API void EqCompressorCompress( void* const compressor, 
00470                                              const unsigned name,
00471                                              void* const in, 
00472                                              const eq_uint64_t* inDims,
00473                                              const eq_uint64_t flags );
00474 
00486     EQ_PLUGIN_API unsigned EqCompressorGetNumResults( void* const compressor,
00487                                                       const unsigned name );
00488 
00499     EQ_PLUGIN_API void EqCompressorGetResult( void* const compressor, 
00500                                               const unsigned name,
00501                                               const unsigned i, 
00502                                               void** const out, 
00503                                               eq_uint64_t* const outSize );
00504 
00525     EQ_PLUGIN_API void EqCompressorDecompress( void* const decompressor, 
00526                                                const unsigned name,
00527                                                const void* const* in, 
00528                                                const eq_uint64_t* const inSizes,
00529                                                const unsigned numInputs,
00530                                                void* const out,
00531                                                eq_uint64_t* const outDims,
00532                                                const eq_uint64_t flags );
00551     EQ_PLUGIN_API bool EqCompressorIsCompatible( const unsigned name,
00552                                                const GLEWContext* glewContext );
00553 
00602     EQ_PLUGIN_API void EqCompressorDownload( void* const        compressor,
00603                                              const unsigned     name,
00604                                              const GLEWContext* glewContext,
00605                                              const eq_uint64_t  inDims[4],
00606                                              const unsigned     source,
00607                                              const eq_uint64_t  flags,
00608                                              eq_uint64_t        outDims[4],
00609                                              void**             out );
00610 
00635     EQ_PLUGIN_API void EqCompressorStartDownload( void* const        compressor,
00636                                                   const unsigned     name,
00637                                                  const GLEWContext* glewContext,
00638                                                   const eq_uint64_t  inDims[4],
00639                                                   const unsigned     source,
00640                                                   const eq_uint64_t  flags );
00641 
00659     EQ_PLUGIN_API void EqCompressorFinishDownload( void* const compressor,
00660                                                    const unsigned     name,
00661                                                  const GLEWContext* glewContext,
00662                                                    const eq_uint64_t  inDims[4],
00663                                                    const eq_uint64_t  flags,
00664                                                    eq_uint64_t outDims[4],
00665                                                    void**             out );
00666 
00709     EQ_PLUGIN_API void EqCompressorUpload( void* const        decompressor,
00710                                            const unsigned     name,
00711                                            const GLEWContext* glewContext, 
00712                                            const void*        buffer,
00713                                            const eq_uint64_t  inDims[4],
00714                                            const eq_uint64_t  flags,
00715                                            const eq_uint64_t  outDims[4],  
00716                                            const unsigned     destination );
00717 #if 0
00718     // TODO: add EqCompressorStart/FinishUpload and document operations and
00719     // parameters
00720 #endif
00721 
00723 #ifdef __cplusplus
00724 }
00725 #endif
00726 #endif // EQ_PLUGINS_COMPRESSOR
Generated on Mon Nov 26 2012 14:41:48 for Equalizer 1.4.1 by  doxygen 1.7.6.1