llimagejpeg.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLIMAGEJPEG_H
00033 #define LL_LLIMAGEJPEG_H
00034 
00035 #include <setjmp.h>
00036 
00037 #include "llimage.h"
00038 
00039 extern "C" {
00040 #ifdef LL_STANDALONE
00041 # include <jpeglib.h>
00042 # include <jerror.h>
00043 #else
00044 # include "jpeglib/jpeglib.h"
00045 # include "jpeglib/jerror.h"
00046 #endif
00047 }
00048 
00049 class LLImageJPEG : public LLImageFormatted
00050 {
00051 protected:
00052         virtual ~LLImageJPEG();
00053         
00054 public:
00055         LLImageJPEG();
00056 
00057         /*virtual*/ BOOL updateData();
00058         /*virtual*/ BOOL decode(LLImageRaw* raw_image, F32 time=0.0);
00059         /*virtual*/ BOOL encode(const LLImageRaw* raw_image, F32 time=0.0);
00060 
00061         void                    setEncodeQuality( S32 q )       { mEncodeQuality = q; } // on a scale from 1 to 100
00062         S32                             getEncodeQuality()                      { return mEncodeQuality; }
00063 
00064         // Callbacks registered with jpeglib
00065         static void             encodeInitDestination ( j_compress_ptr cinfo );
00066         static boolean  encodeEmptyOutputBuffer(j_compress_ptr cinfo);
00067         static void             encodeTermDestination(j_compress_ptr cinfo);
00068 
00069         static void             decodeInitSource(j_decompress_ptr cinfo);
00070         static boolean  decodeFillInputBuffer(j_decompress_ptr cinfo);
00071         static void             decodeSkipInputData(j_decompress_ptr cinfo, long num_bytes);
00072         static void             decodeTermSource(j_decompress_ptr cinfo);
00073 
00074 
00075         static void             errorExit(j_common_ptr cinfo);
00076         static void             errorEmitMessage(j_common_ptr cinfo, int msg_level);
00077         static void             errorOutputMessage(j_common_ptr cinfo);
00078 
00079         static BOOL             decompress(LLImageJPEG* imagep);
00080 
00081 protected:
00082         U8*                             mOutputBuffer;          // temp buffer used during encoding
00083         S32                             mOutputBufferSize;      // bytes in mOuputBuffer
00084 
00085         S32                             mEncodeQuality;         // on a scale from 1 to 100
00086 
00087         jmp_buf                 mSetjmpBuffer;          // To allow the library to abort.
00088 };
00089 
00090 #endif  // LL_LLIMAGEJPEG_H

Generated on Thu Jul 1 06:08:44 2010 for Second Life Viewer by  doxygen 1.4.7