BaseJpegDeocde exampe program

Dependencies:   BaseJpegDecode Terminal BaseUsbHost mbed mbed-rtos

Fork of BaseJpegDecode by Norimasa Okamoto

Committer:
va009039
Date:
Thu Nov 15 10:20:38 2012 +0000
Revision:
5:033432f9baf3
Parent:
4:7d88de31c55a
bug fix SimpleJpegDecode.cpp

Who changed what in which revision?

UserRevisionLine numberNew contents of line
va009039 4:7d88de31c55a 1 #ifndef SIMPLE_JPEG_DECODE_H
va009039 4:7d88de31c55a 2 #define SIMPLE_JPEG_DECODE_H
va009039 4:7d88de31c55a 3
va009039 4:7d88de31c55a 4 #include "BaseJpegDecode.h"
va009039 4:7d88de31c55a 5 #include "inverseDCT.h"
va009039 4:7d88de31c55a 6
va009039 5:033432f9baf3 7 #define YUV 0
va009039 5:033432f9baf3 8 #define RGB24 1
va009039 5:033432f9baf3 9
va009039 4:7d88de31c55a 10 class SimpleJpegDecode : public BaseJpegDecode, public inverseDCT {
va009039 4:7d88de31c55a 11 public:
va009039 5:033432f9baf3 12 SimpleJpegDecode(uint8_t output_mode=RGB24);
va009039 5:033432f9baf3 13
va009039 5:033432f9baf3 14 void format_YUV(int mcu, int block, int8_t* values);
va009039 5:033432f9baf3 15 void format_RGB24(int mcu, int block, int8_t* values);
va009039 5:033432f9baf3 16
va009039 4:7d88de31c55a 17 void output(int mcu, int block, int scan, int value);
va009039 4:7d88de31c55a 18 virtual void outputDC(int mcu, int block, int value);
va009039 4:7d88de31c55a 19 virtual void outputAC(int mcu, int block, int scan, int value);
va009039 4:7d88de31c55a 20 virtual void outputMARK(uint8_t c);
va009039 5:033432f9baf3 21 virtual void outputBLOCK(int muc, int block, int8_t* values); // iDCT
va009039 4:7d88de31c55a 22
va009039 5:033432f9baf3 23 int8_t m_block_data[5][64];
va009039 4:7d88de31c55a 24 int DC_count;
va009039 4:7d88de31c55a 25 int AC_count;
va009039 4:7d88de31c55a 26 int BLOCK_count;
va009039 4:7d88de31c55a 27
va009039 4:7d88de31c55a 28 ///Setups the result callback
va009039 4:7d88de31c55a 29 /**
va009039 4:7d88de31c55a 30 @param pMethod : callback function
va009039 4:7d88de31c55a 31 */
va009039 4:7d88de31c55a 32 void setOnResult( void (*pMethod)(int, int, uint8_t*) );
va009039 4:7d88de31c55a 33
va009039 4:7d88de31c55a 34 ///Setups the result callback
va009039 4:7d88de31c55a 35 /**
va009039 4:7d88de31c55a 36 @param pItem : instance of class on which to execute the callback method
va009039 4:7d88de31c55a 37 @param pMethod : callback method
va009039 4:7d88de31c55a 38 */
va009039 4:7d88de31c55a 39 class CDummy;
va009039 4:7d88de31c55a 40 template<class T>
va009039 4:7d88de31c55a 41 void setOnResult( T* pItem, void (T::*pMethod)(int, int, uint8_t*) )
va009039 4:7d88de31c55a 42 {
va009039 4:7d88de31c55a 43 m_pCb = NULL;
va009039 4:7d88de31c55a 44 m_pCbItem = (CDummy*) pItem;
va009039 4:7d88de31c55a 45 m_pCbMeth = (void (CDummy::*)(int, int, uint8_t*)) pMethod;
va009039 4:7d88de31c55a 46 }
va009039 4:7d88de31c55a 47 void clearOnResult();
va009039 4:7d88de31c55a 48 protected:
va009039 4:7d88de31c55a 49 void onResult(int x, int y, uint8_t* yuv);
va009039 4:7d88de31c55a 50 CDummy* m_pCbItem;
va009039 4:7d88de31c55a 51 void (CDummy::*m_pCbMeth)(int, int, uint8_t*);
va009039 4:7d88de31c55a 52 void (*m_pCb)(int, int, uint8_t*);
va009039 5:033432f9baf3 53 uint8_t m_output_mode;
va009039 4:7d88de31c55a 54 };
va009039 4:7d88de31c55a 55
va009039 4:7d88de31c55a 56 #endif // SIMPLE_JPEG_DECODE_H