~ubuntu-branches/ubuntu/saucy/darktable/saucy

« back to all changes in this revision

Viewing changes to src/rawspeed/RawSpeed/NikonDecompressor.h

  • Committer: Bazaar Package Importer
  • Author(s): David Bremner
  • Date: 2011-04-14 23:42:12 UTC
  • Revision ID: james.westby@ubuntu.com-20110414234212-kuffcz5wiu18v6ra
Tags: upstream-0.8
ImportĀ upstreamĀ versionĀ 0.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#pragma once
 
2
#include "LJpegDecompressor.h"
 
3
#include "BitPumpMSB.h"
 
4
/* 
 
5
    RawSpeed - RAW file decoder.
 
6
 
 
7
    Copyright (C) 2009 Klaus Post
 
8
 
 
9
    This library is free software; you can redistribute it and/or
 
10
    modify it under the terms of the GNU Lesser General Public
 
11
    License as published by the Free Software Foundation; either
 
12
    version 2 of the License, or (at your option) any later version.
 
13
 
 
14
    This library is distributed in the hope that it will be useful,
 
15
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
17
    Lesser General Public License for more details.
 
18
 
 
19
    You should have received a copy of the GNU Lesser General Public
 
20
    License along with this library; if not, write to the Free Software
 
21
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
22
 
 
23
    http://www.klauspost.com
 
24
*/
 
25
 
 
26
namespace RawSpeed {
 
27
 
 
28
class NikonDecompressor :
 
29
  public LJpegDecompressor
 
30
{
 
31
public:
 
32
  NikonDecompressor(FileMap* file, RawImage img );
 
33
public:
 
34
  virtual ~NikonDecompressor(void);
 
35
  void DecompressNikon(ByteStream *meta, uint32 w, uint32 h, uint32 bitsPS, uint32 offset, uint32 size);
 
36
private:
 
37
  void initTable(uint32 huffSelect);
 
38
  int HuffDecodeNikon();
 
39
  uint32 curve[0xffff];
 
40
  BitPumpMSB *bits;
 
41
};
 
42
 
 
43
static const uchar8 nikon_tree[][32] = {
 
44
  { 0,1,5,1,1,1,1,1,1,2,0,0,0,0,0,0,    /* 12-bit lossy */
 
45
  5,4,3,6,2,7,1,0,8,9,11,10,12 },
 
46
  { 0,1,5,1,1,1,1,1,1,2,0,0,0,0,0,0,    /* 12-bit lossy after split */
 
47
  0x39,0x5a,0x38,0x27,0x16,5,4,3,2,1,0,11,12,12 },
 
48
  { 0,1,4,2,3,1,2,0,0,0,0,0,0,0,0,0,  /* 12-bit lossless */
 
49
  5,4,6,3,7,2,8,1,9,0,10,11,12 },
 
50
  { 0,1,4,3,1,1,1,1,1,2,0,0,0,0,0,0,    /* 14-bit lossy */
 
51
  5,6,4,7,8,3,9,2,1,0,10,11,12,13,14 },
 
52
  { 0,1,5,1,1,1,1,1,1,1,2,0,0,0,0,0,    /* 14-bit lossy after split */
 
53
  8,0x5c,0x4b,0x3a,0x29,7,6,5,4,3,2,1,0,13,14 },
 
54
  { 0,1,4,2,2,3,1,2,0,0,0,0,0,0,0,0,    /* 14-bit lossless */
 
55
  7,6,8,5,9,4,10,3,11,12,2,0,1,13,14 } };
 
56
  
 
57
} // namespace RawSpeed