00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef SH_JPEGFILE_H
00022 #define SH_JPEGFILE_H
00023
00024 #include "common.h"
00025
00026 #ifdef USE_LIBJPEG
00027
00028 #include <vector>
00029
00030 extern "C" {
00031 #include <stdio.h>
00032 #include <jpeglib.h>
00033 }
00034
00035 class BinaryIO ;
00036 #include "CvrStgFile.h"
00037 class SampleValue ;
00038
00045 class JpegFile : public CvrStgFile {
00046 public:
00047 JpegFile (BinaryIO* io) ;
00048 ~JpegFile (void) ;
00049
00050 void read (BinaryIO* io) ;
00051 void write (void) ;
00052
00053 std::list<CvrStgFile::Property> getProperties (void) const ;
00054 std::vector<MatchingAlgorithm*> getMatchingAlgorithms (Graph* g, Matching* m) const ;
00055
00056 unsigned long getNumSamples (void) const ;
00057 void replaceSample (const SamplePos pos, const SampleValue* s) ;
00058 SampleValue* getSampleValue (const SamplePos pos) const ;
00059 EmbValue getEmbeddedValue (const SamplePos pos) const ;
00060
00061 #ifdef DEBUG
00062 std::map<SampleKey,unsigned long>* getFrequencies (void) ;
00069 void printFrequencies (const std::map<SampleKey,unsigned long>& freqs) ;
00070 #endif
00071
00072 private:
00074 static const unsigned int CoeffPerBlock = 64 ;
00075
00076 static const unsigned short SamplesPerVertex = 3 ;
00077 static const UWORD32 Radius = 1 ;
00078 static const EmbValue EmbValueModulus = 2 ;
00079
00080 struct jpeg_compress_struct CInfo ;
00081 struct jpeg_decompress_struct DeCInfo ;
00082 unsigned int* HeightInBlocks ;
00083 unsigned int* WidthInBlocks ;
00084 jvirt_barray_ptr* DctCoeffs ;
00085
00086 std::vector<SWORD16> LinDctCoeffs ;
00087 std::vector<UWORD32> StegoIndices ;
00088 } ;
00089
00090 #endif // def USE_LIBJPEG
00091
00092 #endif // ndef SH_JPEGFILE_H