test

Dependencies:   Nanopb iSerial mbed BaseJpegDecode FatFileSystem SDFileSystem RingBuffer Camera_LS_Y201

Committer:
cgraham
Date:
Thu Sep 18 15:21:47 2014 +0000
Revision:
0:d69efd0ee139
test

Who changed what in which revision?

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