Lunchbox  1.9.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
compressor.h
1 
2 /* Copyright (c) 2010, Cedric Stalder <cedric.stalder@gmail.com>
3  * 2010-2014, Stefan Eilemann <eile@eyescale.ch>
4  *
5  * This file is part of Lunchbox <https://github.com/Eyescale/Lunchbox>
6  *
7  * This library is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU Lesser General Public License version 2.1 as published
9  * by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14  * details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #ifndef LUNCHBOX_COMPRESSOR_H
22 #define LUNCHBOX_COMPRESSOR_H
23 
24 #include <lunchbox/api.h>
25 #include <lunchbox/types.h>
26 #include <lunchbox/thread.h> // thread-safety macros
27 
28 namespace lunchbox
29 {
30 namespace detail { class Compressor; }
31 
37 class Compressor : public boost::noncopyable
38 {
39  typedef detail::Compressor* const Compressor::*bool_t;
40 
41 public:
43  LUNCHBOX_API Compressor();
44 
52  LUNCHBOX_API Compressor( PluginRegistry& from, const uint32_t name );
53 
55  LUNCHBOX_API virtual ~Compressor();
56 
58  LUNCHBOX_API bool isGood() const;
59 
64  operator bool_t() const { return isGood() ? &Compressor::impl_ : 0; }
65 
67  bool operator ! () const { return !isGood(); }
68 
73  LUNCHBOX_API bool uses( const uint32_t name ) const;
74 
76  LUNCHBOX_API const EqCompressorInfo& getInfo() const;
77 
93  static LUNCHBOX_API uint32_t choose( const PluginRegistry& registry,
94  const uint32_t tokenType,
95  const float minQuality,
96  const bool ignoreMSE );
97 
106  LUNCHBOX_API bool setup( PluginRegistry& from, const uint32_t name );
107 
113  LUNCHBOX_API bool setup( PluginRegistry& registry, const uint32_t tokenType,
114  const float minQuality, const bool ignoreMSE );
115 
117  LUNCHBOX_API bool realloc();
118 
120  LUNCHBOX_API void clear();
121 
129  LUNCHBOX_API void compress( void* const in, const uint64_t inDims[2] );
130 
139  LUNCHBOX_API void compress( void* const in, const uint64_t pvp[4],
140  const uint64_t flags );
141 
146  LUNCHBOX_API unsigned getNumResults() const LB_DEPRECATED;
147 
152  LUNCHBOX_API CompressorResult getResult() const;
153 
155  LUNCHBOX_API void getResult( const unsigned i, void** const out,
156  uint64_t* const outSize ) const LB_DEPRECATED;
157 
158 private:
159  detail::Compressor* const impl_;
160  LB_TS_VAR( _thread );
161 };
162 }
163 #endif // LUNCHBOX_COMPRESSOR_H
A registry for loaded plugins.
Defines export visibility macros for Lunchbox.
Basic type definitions not provided by the operating system.
bool operator!() const
Definition: compressor.h:67
A C++ class to handle one compressor plugin instance.
Definition: compressor.h:37
LUNCHBOX_API unsigned getNumResults() const LB_DEPRECATED
static LUNCHBOX_API uint32_t choose(const PluginRegistry &registry, const uint32_t tokenType, const float minQuality, const bool ignoreMSE)
Find the best compressor in all plugins for the given parameters.
LUNCHBOX_API CompressorResult getResult() const
LUNCHBOX_API void compress(void *const in, const uint64_t inDims[2])
Compress one-dimensional data.
LUNCHBOX_API bool uses(const uint32_t name) const
LUNCHBOX_API void clear()
Reset to EQ_COMPRESSOR_NONE.
Information about one compressor.
LUNCHBOX_API bool isGood() const
LUNCHBOX_API Compressor()
Construct a new, invalid compressor instance.
LUNCHBOX_API bool realloc()
Reallocate the current instance.
virtual LUNCHBOX_API ~Compressor()
Destruct the compressor.
LUNCHBOX_API bool setup(PluginRegistry &from, const uint32_t name)
Set up a new, named compressor instance.
LUNCHBOX_API const EqCompressorInfo & getInfo() const
A structure to hold the results from one compress operation.