Lcd companion boards support (VKLCD50RTA & VKLCD70RT)
What is this ?
This is a demo program using Renesas RGA library & USB Camera to demonstrate VK-RZ/A1H's companion boards workability.
Supported companion Boards:
VKLCD50RTA
VKLCD70RT
How to Configure ?
You can choose which display is installed by altering the lcd_panel.h file
Leave the active one & comment out the others:
#define LCD_VDC5_CH0_PANEL LCD_CH0_PANEL_VKLCD50RTA //#define LCD_VDC5_CH0_PANEL LCD_CH0_PANEL_VKLCD70RT
You can alter the whole demo with your pictures if you like:
How to compile ?
- The Demo can be compiled in 3 modes:
- I. Execution from the internal 10-MB on-chip SRAM.
- II. Execution from the on-board serial FALSH in dual (32-MB) mode.
- After import in the online compiler just leave only the VKRZA1H_DOUBLE.sct & delete all others linker files in the TOOLCHAIN_ARM_STD folder.
- Drag & drop the result binary in MBED disk, (previously inited in double flash mode)
- III. Execution from the on-board serial FALSH in single (16-MB) mode.
- After import in the online compiler just leave only the VKRZA1H_SINGLE.sct & delete all others linker files in the TOOLCHAIN_ARM_STD folder.
- Drag & drop the result binary in MBED disk, (previously inited in single flash mode )
Quick presentation:
Other demos ?
More demos you can find on our FTP
USB/uvc/decodeMJPEG.cpp@0:6435b67ad23c, 2017-02-16 (annotated)
- Committer:
- tvendov
- Date:
- Thu Feb 16 10:23:48 2017 +0000
- Revision:
- 0:6435b67ad23c
Initial lcd support (VKLCD50RTA & VKLCD70RT companion boards)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tvendov | 0:6435b67ad23c | 1 | // decodeMJPEG.cpp 2012/12/8 |
tvendov | 0:6435b67ad23c | 2 | // decode motion-jpeg to jpeg |
tvendov | 0:6435b67ad23c | 3 | #include "mbed.h" |
tvendov | 0:6435b67ad23c | 4 | #include "decodeMJPEG.h" |
tvendov | 0:6435b67ad23c | 5 | |
tvendov | 0:6435b67ad23c | 6 | #define MARK_SOF0 0xc0 |
tvendov | 0:6435b67ad23c | 7 | #define MARK_DHT 0xc4 |
tvendov | 0:6435b67ad23c | 8 | #define MARK_RST0 0xd0 |
tvendov | 0:6435b67ad23c | 9 | #define MARK_RST7 0xd7 |
tvendov | 0:6435b67ad23c | 10 | #define MARK_SOI 0xd8 |
tvendov | 0:6435b67ad23c | 11 | #define MARK_EOI 0xd9 |
tvendov | 0:6435b67ad23c | 12 | #define MARK_SOS 0xda |
tvendov | 0:6435b67ad23c | 13 | #define MARK_DQT 0xdb |
tvendov | 0:6435b67ad23c | 14 | #define MARK_DRI 0xdd |
tvendov | 0:6435b67ad23c | 15 | #define MARK_APP 0xe0 |
tvendov | 0:6435b67ad23c | 16 | |
tvendov | 0:6435b67ad23c | 17 | #define SEQ_INIT 0 |
tvendov | 0:6435b67ad23c | 18 | #define SEQ_SOI 1 |
tvendov | 0:6435b67ad23c | 19 | #define SEQ_FRAME 2 |
tvendov | 0:6435b67ad23c | 20 | #define SEQ_MARK 3 |
tvendov | 0:6435b67ad23c | 21 | #define SEQ_SEG_LEN 4 |
tvendov | 0:6435b67ad23c | 22 | #define SEQ_SEG_LEN2 5 |
tvendov | 0:6435b67ad23c | 23 | #define SEQ_SEG_BODY 6 |
tvendov | 0:6435b67ad23c | 24 | #define SEQ_SOS 7 |
tvendov | 0:6435b67ad23c | 25 | #define SEQ_SOS2 8 |
tvendov | 0:6435b67ad23c | 26 | |
tvendov | 0:6435b67ad23c | 27 | static const uint8_t dht[] = { |
tvendov | 0:6435b67ad23c | 28 | 0xFF,0xC4,0x01,0xA2,0x00,0x00,0x01,0x05,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00, |
tvendov | 0:6435b67ad23c | 29 | 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A, |
tvendov | 0:6435b67ad23c | 30 | 0x0B,0x01,0x00,0x03,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00, |
tvendov | 0:6435b67ad23c | 31 | 0x00,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x10,0x00, |
tvendov | 0:6435b67ad23c | 32 | 0x02,0x01,0x03,0x03,0x02,0x04,0x03,0x05,0x05,0x04,0x04,0x00,0x00,0x01,0x7D,0x01, |
tvendov | 0:6435b67ad23c | 33 | 0x02,0x03,0x00,0x04,0x11,0x05,0x12,0x21,0x31,0x41,0x06,0x13,0x51,0x61,0x07,0x22, |
tvendov | 0:6435b67ad23c | 34 | 0x71,0x14,0x32,0x81,0x91,0xA1,0x08,0x23,0x42,0xB1,0xC1,0x15,0x52,0xD1,0xF0,0x24, |
tvendov | 0:6435b67ad23c | 35 | 0x33,0x62,0x72,0x82,0x09,0x0A,0x16,0x17,0x18,0x19,0x1A,0x25,0x26,0x27,0x28,0x29, |
tvendov | 0:6435b67ad23c | 36 | 0x2A,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A, |
tvendov | 0:6435b67ad23c | 37 | 0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A, |
tvendov | 0:6435b67ad23c | 38 | 0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A, |
tvendov | 0:6435b67ad23c | 39 | 0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8, |
tvendov | 0:6435b67ad23c | 40 | 0xA9,0xAA,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xC2,0xC3,0xC4,0xC5,0xC6, |
tvendov | 0:6435b67ad23c | 41 | 0xC7,0xC8,0xC9,0xCA,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xE1,0xE2,0xE3, |
tvendov | 0:6435b67ad23c | 42 | 0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9, |
tvendov | 0:6435b67ad23c | 43 | 0xFA,0x11,0x00,0x02,0x01,0x02,0x04,0x04,0x03,0x04,0x07,0x05,0x04,0x04,0x00,0x01, |
tvendov | 0:6435b67ad23c | 44 | 0x02,0x77,0x00,0x01,0x02,0x03,0x11,0x04,0x05,0x21,0x31,0x06,0x12,0x41,0x51,0x07, |
tvendov | 0:6435b67ad23c | 45 | 0x61,0x71,0x13,0x22,0x32,0x81,0x08,0x14,0x42,0x91,0xA1,0xB1,0xC1,0x09,0x23,0x33, |
tvendov | 0:6435b67ad23c | 46 | 0x52,0xF0,0x15,0x62,0x72,0xD1,0x0A,0x16,0x24,0x34,0xE1,0x25,0xF1,0x17,0x18,0x19, |
tvendov | 0:6435b67ad23c | 47 | 0x1A,0x26,0x27,0x28,0x29,0x2A,0x35,0x36,0x37,0x38,0x39,0x3A,0x43,0x44,0x45,0x46, |
tvendov | 0:6435b67ad23c | 48 | 0x47,0x48,0x49,0x4A,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x63,0x64,0x65,0x66, |
tvendov | 0:6435b67ad23c | 49 | 0x67,0x68,0x69,0x6A,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x82,0x83,0x84,0x85, |
tvendov | 0:6435b67ad23c | 50 | 0x86,0x87,0x88,0x89,0x8A,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0xA2,0xA3, |
tvendov | 0:6435b67ad23c | 51 | 0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA, |
tvendov | 0:6435b67ad23c | 52 | 0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8, |
tvendov | 0:6435b67ad23c | 53 | 0xD9,0xDA,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xF2,0xF3,0xF4,0xF5,0xF6, |
tvendov | 0:6435b67ad23c | 54 | 0xF7,0xF8,0xF9,0xFA, |
tvendov | 0:6435b67ad23c | 55 | }; |
tvendov | 0:6435b67ad23c | 56 | |
tvendov | 0:6435b67ad23c | 57 | decodeMJPEG::decodeMJPEG() |
tvendov | 0:6435b67ad23c | 58 | { |
tvendov | 0:6435b67ad23c | 59 | m_seq = SEQ_INIT; |
tvendov | 0:6435b67ad23c | 60 | } |
tvendov | 0:6435b67ad23c | 61 | |
tvendov | 0:6435b67ad23c | 62 | void decodeMJPEG::inputPacket(const uint8_t* buf, int len) |
tvendov | 0:6435b67ad23c | 63 | { |
tvendov | 0:6435b67ad23c | 64 | for(int i = 12; i < len; i++) { |
tvendov | 0:6435b67ad23c | 65 | input(buf[i]); |
tvendov | 0:6435b67ad23c | 66 | } |
tvendov | 0:6435b67ad23c | 67 | } |
tvendov | 0:6435b67ad23c | 68 | |
tvendov | 0:6435b67ad23c | 69 | void decodeMJPEG::input(uint8_t c) |
tvendov | 0:6435b67ad23c | 70 | { |
tvendov | 0:6435b67ad23c | 71 | switch(m_seq) { |
tvendov | 0:6435b67ad23c | 72 | case SEQ_INIT: |
tvendov | 0:6435b67ad23c | 73 | if (c == 0xff) { |
tvendov | 0:6435b67ad23c | 74 | m_seq = SEQ_SOI; |
tvendov | 0:6435b67ad23c | 75 | } |
tvendov | 0:6435b67ad23c | 76 | break; |
tvendov | 0:6435b67ad23c | 77 | case SEQ_SOI: |
tvendov | 0:6435b67ad23c | 78 | if (c == MARK_SOI) { |
tvendov | 0:6435b67ad23c | 79 | outputJPEG(0xff, JPEG_START); // start |
tvendov | 0:6435b67ad23c | 80 | outputJPEG(c); |
tvendov | 0:6435b67ad23c | 81 | m_bDHT = false; |
tvendov | 0:6435b67ad23c | 82 | m_seq = SEQ_FRAME; |
tvendov | 0:6435b67ad23c | 83 | } else { |
tvendov | 0:6435b67ad23c | 84 | m_seq = SEQ_INIT; |
tvendov | 0:6435b67ad23c | 85 | } |
tvendov | 0:6435b67ad23c | 86 | break; |
tvendov | 0:6435b67ad23c | 87 | case SEQ_FRAME: |
tvendov | 0:6435b67ad23c | 88 | if (c == 0xff) { |
tvendov | 0:6435b67ad23c | 89 | m_seq = SEQ_MARK; |
tvendov | 0:6435b67ad23c | 90 | } else { |
tvendov | 0:6435b67ad23c | 91 | m_seq = SEQ_INIT; |
tvendov | 0:6435b67ad23c | 92 | } |
tvendov | 0:6435b67ad23c | 93 | break; |
tvendov | 0:6435b67ad23c | 94 | case SEQ_MARK: |
tvendov | 0:6435b67ad23c | 95 | if (c == MARK_SOI || c == MARK_EOI || c == 0x00) { |
tvendov | 0:6435b67ad23c | 96 | m_seq = SEQ_INIT; |
tvendov | 0:6435b67ad23c | 97 | break; |
tvendov | 0:6435b67ad23c | 98 | } |
tvendov | 0:6435b67ad23c | 99 | m_mark = c; |
tvendov | 0:6435b67ad23c | 100 | m_seq = SEQ_SEG_LEN; |
tvendov | 0:6435b67ad23c | 101 | break; |
tvendov | 0:6435b67ad23c | 102 | case SEQ_SEG_LEN: |
tvendov | 0:6435b67ad23c | 103 | m_seg_len = c; |
tvendov | 0:6435b67ad23c | 104 | m_seq = SEQ_SEG_LEN2; |
tvendov | 0:6435b67ad23c | 105 | break; |
tvendov | 0:6435b67ad23c | 106 | case SEQ_SEG_LEN2: |
tvendov | 0:6435b67ad23c | 107 | m_seg_len <<= 8; |
tvendov | 0:6435b67ad23c | 108 | m_seg_len |= c; |
tvendov | 0:6435b67ad23c | 109 | m_seg_len -= 2; |
tvendov | 0:6435b67ad23c | 110 | m_seg_pos = 0; |
tvendov | 0:6435b67ad23c | 111 | m_seq = SEQ_SEG_BODY; |
tvendov | 0:6435b67ad23c | 112 | if (m_mark == MARK_SOS) { |
tvendov | 0:6435b67ad23c | 113 | if (m_bDHT == false) { |
tvendov | 0:6435b67ad23c | 114 | for(int i = 0; i < sizeof(dht); i++) { |
tvendov | 0:6435b67ad23c | 115 | outputJPEG(dht[i]); |
tvendov | 0:6435b67ad23c | 116 | } |
tvendov | 0:6435b67ad23c | 117 | } |
tvendov | 0:6435b67ad23c | 118 | m_output_desable = false; |
tvendov | 0:6435b67ad23c | 119 | } else if (m_mark == MARK_DHT) { |
tvendov | 0:6435b67ad23c | 120 | m_bDHT = true; |
tvendov | 0:6435b67ad23c | 121 | m_output_desable = false; |
tvendov | 0:6435b67ad23c | 122 | } else { |
tvendov | 0:6435b67ad23c | 123 | m_output_desable = false; |
tvendov | 0:6435b67ad23c | 124 | } |
tvendov | 0:6435b67ad23c | 125 | if (!m_output_desable) { |
tvendov | 0:6435b67ad23c | 126 | outputJPEG(0xff); |
tvendov | 0:6435b67ad23c | 127 | outputJPEG(m_mark); |
tvendov | 0:6435b67ad23c | 128 | outputJPEG((m_seg_len+2) >> 8); |
tvendov | 0:6435b67ad23c | 129 | outputJPEG((m_seg_len+2) & 0xff); |
tvendov | 0:6435b67ad23c | 130 | } |
tvendov | 0:6435b67ad23c | 131 | break; |
tvendov | 0:6435b67ad23c | 132 | case SEQ_SEG_BODY: |
tvendov | 0:6435b67ad23c | 133 | if (!m_output_desable) { |
tvendov | 0:6435b67ad23c | 134 | outputJPEG(c); |
tvendov | 0:6435b67ad23c | 135 | } |
tvendov | 0:6435b67ad23c | 136 | if (++m_seg_pos < m_seg_len) { |
tvendov | 0:6435b67ad23c | 137 | break; |
tvendov | 0:6435b67ad23c | 138 | } |
tvendov | 0:6435b67ad23c | 139 | if (m_mark == MARK_SOS) { |
tvendov | 0:6435b67ad23c | 140 | m_seq = SEQ_SOS; |
tvendov | 0:6435b67ad23c | 141 | break; |
tvendov | 0:6435b67ad23c | 142 | } |
tvendov | 0:6435b67ad23c | 143 | m_seq = SEQ_FRAME; |
tvendov | 0:6435b67ad23c | 144 | break; |
tvendov | 0:6435b67ad23c | 145 | case SEQ_SOS: |
tvendov | 0:6435b67ad23c | 146 | if (c == 0xff) { |
tvendov | 0:6435b67ad23c | 147 | m_seq = SEQ_SOS2; |
tvendov | 0:6435b67ad23c | 148 | break; |
tvendov | 0:6435b67ad23c | 149 | } |
tvendov | 0:6435b67ad23c | 150 | outputJPEG(c); |
tvendov | 0:6435b67ad23c | 151 | break; |
tvendov | 0:6435b67ad23c | 152 | case SEQ_SOS2: |
tvendov | 0:6435b67ad23c | 153 | if (c == 0x00) { |
tvendov | 0:6435b67ad23c | 154 | outputJPEG(0xff); |
tvendov | 0:6435b67ad23c | 155 | outputJPEG(0x00); |
tvendov | 0:6435b67ad23c | 156 | m_seq = SEQ_SOS; |
tvendov | 0:6435b67ad23c | 157 | break; |
tvendov | 0:6435b67ad23c | 158 | } else if (c >= MARK_RST0 && c <= MARK_RST7) { |
tvendov | 0:6435b67ad23c | 159 | outputJPEG(0xff); |
tvendov | 0:6435b67ad23c | 160 | outputJPEG(c); |
tvendov | 0:6435b67ad23c | 161 | m_seq = SEQ_SOS; |
tvendov | 0:6435b67ad23c | 162 | break; |
tvendov | 0:6435b67ad23c | 163 | } else if (c == MARK_EOI) { |
tvendov | 0:6435b67ad23c | 164 | outputJPEG(0xff); |
tvendov | 0:6435b67ad23c | 165 | outputJPEG(c, JPEG_END); |
tvendov | 0:6435b67ad23c | 166 | m_seq = SEQ_INIT; |
tvendov | 0:6435b67ad23c | 167 | break; |
tvendov | 0:6435b67ad23c | 168 | } else if (c == MARK_SOI) { |
tvendov | 0:6435b67ad23c | 169 | outputJPEG(0xff); |
tvendov | 0:6435b67ad23c | 170 | outputJPEG(c); |
tvendov | 0:6435b67ad23c | 171 | m_seq = SEQ_INIT; |
tvendov | 0:6435b67ad23c | 172 | break; |
tvendov | 0:6435b67ad23c | 173 | } |
tvendov | 0:6435b67ad23c | 174 | m_seq = SEQ_INIT; |
tvendov | 0:6435b67ad23c | 175 | break; |
tvendov | 0:6435b67ad23c | 176 | default: |
tvendov | 0:6435b67ad23c | 177 | m_seq = SEQ_INIT; |
tvendov | 0:6435b67ad23c | 178 | break; |
tvendov | 0:6435b67ad23c | 179 | } |
tvendov | 0:6435b67ad23c | 180 | } |