Lunchbox  1.8.0
compressor.h
1 
2 /* Copyright (c) 2010, Cedric Stalder <cedric.stalder@gmail.com>
3  * 2010-2013, 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 
33 class Compressor : public NonCopyable
34 {
35 public:
37  LUNCHBOX_API Compressor();
38 
46  LUNCHBOX_API Compressor( PluginRegistry& from, const uint32_t name );
47 
49  LUNCHBOX_API virtual ~Compressor();
50 
52  LUNCHBOX_API bool isGood() const;
53 
58  LUNCHBOX_API bool uses( const uint32_t name ) const;
59 
61  LUNCHBOX_API const EqCompressorInfo& getInfo() const;
62 
78  static LUNCHBOX_API uint32_t choose( const PluginRegistry& registry,
79  const uint32_t tokenType,
80  const float minQuality,
81  const bool ignoreMSE );
82 
91  LUNCHBOX_API bool setup( PluginRegistry& from, const uint32_t name );
92 
98  LUNCHBOX_API bool setup( PluginRegistry& registry, const uint32_t tokenType,
99  const float minQuality, const bool ignoreMSE );
100 
102  LUNCHBOX_API bool realloc();
103 
105  LUNCHBOX_API void clear();
106 
114  LUNCHBOX_API void compress( void* const in, const uint64_t inDims[2] );
115 
124  LUNCHBOX_API void compress( void* const in, const uint64_t pvp[4],
125  const uint64_t flags );
126 
131  LUNCHBOX_API unsigned getNumResults() const;
132 
141  LUNCHBOX_API void getResult( const unsigned i, void** const out,
142  uint64_t* const outSize ) const;
143 private:
144  detail::Compressor* const impl_;
145  LB_TS_VAR( _thread );
146 };
147 }
148 #endif // LUNCHBOX_COMPRESSOR_H