libopenraw

neffile.h

00001 /*
00002  * libopenraw - neffile.h
00003  *
00004  * Copyright (C) 2006-2008 Hubert Figuiere
00005  * Copyright (C) 2008 Novell, Inc.
00006  *
00007  * This library is free software: you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public License
00009  * as published by the Free Software Foundation, either version 3 of
00010  * the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library.  If not, see
00019  * <http://www.gnu.org/licenses/>.
00020  */
00021 
00022 #ifndef __NEFFILE_H_
00023 #define __NEFFILE_H_
00024 
00025 #include "tiffepfile.h"
00026 #include "huffman.h"
00027 #include <vector>
00028 
00029 namespace OpenRaw {
00030 
00031     class Thumbnail;
00032 
00033     namespace Internals {
00034         class IOFile;
00035         class IFDFileContainer;
00036 
00037         class NEFFile
00038             : public TiffEpFile
00039         {
00040         public:
00041             static RawFile *factory(IO::Stream* _f);
00042             NEFFile(IO::Stream * _f);
00043             virtual ~NEFFile();
00044 
00048             static bool isCompressed(RawContainer & container, uint32_t offset);
00049 
00050             class NEFCompressionInfo {
00051             public:
00052               uint16_t vpred[2][2];
00053               std::vector<uint16_t> curve;
00054               const HuffmanNode* huffman;
00055             };
00056         private:
00057 
00058             NEFFile(const NEFFile&);
00059             NEFFile & operator=(const NEFFile &);
00060 
00061             virtual ::or_error _getRawData(RawData & data, uint32_t options);
00062             static const IFDFile::camera_ids_t s_def[];
00063             int _getCompressionCurve(RawData&, NEFCompressionInfo&);
00064             ::or_error _decompressNikonQuantized(RawData&);
00065             ::or_error _decompressIfNeeded(RawData&, uint32_t);
00066         };
00067     }
00068 
00069 }
00070 
00071 #endif