Any changes are to allow conversion to BMP
Dependencies: BaseJpegDecode Camera_LS_Y201 Motordriver Servo mbed
Fork of Bitmap_copy_copy by
SimpleJpegDecode/SimpleJpegDecode.h@1:d721e32cf79c, 2014-04-30 (annotated)
- Committer:
- kylepost3
- Date:
- Wed Apr 30 14:19:33 2014 +0000
- Revision:
- 1:d721e32cf79c
Final design project for ECE 4180. The device takes scans left to right taking pictures (In JPEG), converts the picture to BMP, and scans for red pixels. When the threshold of red pixels is reached, it fires the catapult and reloads.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kylepost3 | 1:d721e32cf79c | 1 | #ifndef SIMPLE_JPEG_DECODE_H |
kylepost3 | 1:d721e32cf79c | 2 | #define SIMPLE_JPEG_DECODE_H |
kylepost3 | 1:d721e32cf79c | 3 | |
kylepost3 | 1:d721e32cf79c | 4 | #include "BaseJpegDecode.h" |
kylepost3 | 1:d721e32cf79c | 5 | #include "inverseDCT.h" |
kylepost3 | 1:d721e32cf79c | 6 | |
kylepost3 | 1:d721e32cf79c | 7 | #define YUV 0 |
kylepost3 | 1:d721e32cf79c | 8 | #define RGB24 1 |
kylepost3 | 1:d721e32cf79c | 9 | |
kylepost3 | 1:d721e32cf79c | 10 | class SimpleJpegDecode : public BaseJpegDecode, public inverseDCT { |
kylepost3 | 1:d721e32cf79c | 11 | public: |
kylepost3 | 1:d721e32cf79c | 12 | SimpleJpegDecode(uint8_t output_mode=RGB24); |
kylepost3 | 1:d721e32cf79c | 13 | |
kylepost3 | 1:d721e32cf79c | 14 | void format_YUV(int mcu, int block, int8_t* values); |
kylepost3 | 1:d721e32cf79c | 15 | void format_RGB24(int mcu, int block, int8_t* values); |
kylepost3 | 1:d721e32cf79c | 16 | |
kylepost3 | 1:d721e32cf79c | 17 | void output(int mcu, int block, int scan, int value); |
kylepost3 | 1:d721e32cf79c | 18 | virtual void outputDC(int mcu, int block, int value); |
kylepost3 | 1:d721e32cf79c | 19 | virtual void outputAC(int mcu, int block, int scan, int value); |
kylepost3 | 1:d721e32cf79c | 20 | virtual void outputMARK(uint8_t c); |
kylepost3 | 1:d721e32cf79c | 21 | virtual void outputBLOCK(int muc, int block, int8_t* values); // iDCT |
kylepost3 | 1:d721e32cf79c | 22 | |
kylepost3 | 1:d721e32cf79c | 23 | int8_t m_block_data[5][64]; |
kylepost3 | 1:d721e32cf79c | 24 | int DC_count; |
kylepost3 | 1:d721e32cf79c | 25 | int AC_count; |
kylepost3 | 1:d721e32cf79c | 26 | int BLOCK_count; |
kylepost3 | 1:d721e32cf79c | 27 | |
kylepost3 | 1:d721e32cf79c | 28 | ///Setups the result callback |
kylepost3 | 1:d721e32cf79c | 29 | /** |
kylepost3 | 1:d721e32cf79c | 30 | @param pMethod : callback function |
kylepost3 | 1:d721e32cf79c | 31 | */ |
kylepost3 | 1:d721e32cf79c | 32 | void setOnResult( void (*pMethod)(int, int, uint8_t*) ); |
kylepost3 | 1:d721e32cf79c | 33 | |
kylepost3 | 1:d721e32cf79c | 34 | ///Setups the result callback |
kylepost3 | 1:d721e32cf79c | 35 | /** |
kylepost3 | 1:d721e32cf79c | 36 | @param pItem : instance of class on which to execute the callback method |
kylepost3 | 1:d721e32cf79c | 37 | @param pMethod : callback method |
kylepost3 | 1:d721e32cf79c | 38 | */ |
kylepost3 | 1:d721e32cf79c | 39 | class CDummy; |
kylepost3 | 1:d721e32cf79c | 40 | template<class T> |
kylepost3 | 1:d721e32cf79c | 41 | void setOnResult( T* pItem, void (T::*pMethod)(int, int, uint8_t*) ) |
kylepost3 | 1:d721e32cf79c | 42 | { |
kylepost3 | 1:d721e32cf79c | 43 | m_pCb = NULL; |
kylepost3 | 1:d721e32cf79c | 44 | m_pCbItem = (CDummy*) pItem; |
kylepost3 | 1:d721e32cf79c | 45 | m_pCbMeth = (void (CDummy::*)(int, int, uint8_t*)) pMethod; |
kylepost3 | 1:d721e32cf79c | 46 | } |
kylepost3 | 1:d721e32cf79c | 47 | void clearOnResult(); |
kylepost3 | 1:d721e32cf79c | 48 | protected: |
kylepost3 | 1:d721e32cf79c | 49 | void onResult(int x, int y, uint8_t* yuv); |
kylepost3 | 1:d721e32cf79c | 50 | CDummy* m_pCbItem; |
kylepost3 | 1:d721e32cf79c | 51 | void (CDummy::*m_pCbMeth)(int, int, uint8_t*); |
kylepost3 | 1:d721e32cf79c | 52 | void (*m_pCb)(int, int, uint8_t*); |
kylepost3 | 1:d721e32cf79c | 53 | uint8_t m_output_mode; |
kylepost3 | 1:d721e32cf79c | 54 | }; |
kylepost3 | 1:d721e32cf79c | 55 | |
kylepost3 | 1:d721e32cf79c | 56 | #endif // SIMPLE_JPEG_DECODE_H |