00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __OPENRAW_CRWDECOMPRESS_H__
00022 #define __OPENRAW_CRWDECOMPRESS_H__
00023
00024 #include <boost/noncopyable.hpp>
00025
00026 #include <libopenraw/libopenraw.h>
00027
00028 #include "decompressor.h"
00029
00030 namespace OpenRaw {
00031
00032 class RawData;
00033
00034 namespace IO {
00035 class Stream;
00036 }
00037
00038 namespace Internals {
00039
00040 class RawContainer;
00041
00042 class CrwDecompressor
00043 : public Decompressor
00044 {
00045 public:
00046 CrwDecompressor(IO::Stream * stream,
00047 RawContainer * container);
00048 virtual ~CrwDecompressor();
00049
00057 virtual RawData *decompress(RawData *in = NULL);
00058 void setDecoderTable(uint32_t t)
00059 { m_table = t; }
00060 void setOutputDimensions(uint32_t x, uint32_t y)
00061 { m_height = y; m_width = x; }
00062 private:
00063
00064 struct decode_t {
00065 decode_t *branch[2];
00066 int leaf;
00067 };
00068
00069 uint32_t getbits(IO::Stream * s, int nbits);
00070 void make_decoder(decode_t *dest, const uint8_t *source,
00071 int level);
00072 void init_tables(uint32_t table_idx);
00073
00074 uint32_t m_table;
00075 uint32_t m_height, m_width;
00076
00077 decode_t m_first_decode[32];
00078 decode_t m_second_decode[512];
00079
00080 decode_t *m_free;
00081 int m_leaf;
00082
00083 uint32_t m_bitbuf;
00084 int m_vbits;
00085 };
00086
00087 }
00088 }
00089
00090
00091 #endif