|
|
|
@ -182,138 +182,82 @@ static const uint16_t usGrayTo565[] = {0x0000,0x0000,0x0000,0x0000,0x0020,0x0020
|
|
|
|
|
//
|
|
|
|
|
// Clip and convert red value into 5-bits for RGB565
|
|
|
|
|
//
|
|
|
|
|
static const uint16_t usRangeTableR[] = {0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // 0
|
|
|
|
|
0x0800,0x0800,0x0800,0x0800,0x0800,0x0800,0x0800,0x0800,
|
|
|
|
|
0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
|
|
|
|
|
0x1800,0x1800,0x1800,0x1800,0x1800,0x1800,0x1800,0x1800,
|
|
|
|
|
0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,0x2000,
|
|
|
|
|
0x2800,0x2800,0x2800,0x2800,0x2800,0x2800,0x2800,0x2800,
|
|
|
|
|
0x3000,0x3000,0x3000,0x3000,0x3000,0x3000,0x3000,0x3000,
|
|
|
|
|
0x3800,0x3800,0x3800,0x3800,0x3800,0x3800,0x3800,0x3800,
|
|
|
|
|
0x4000,0x4000,0x4000,0x4000,0x4000,0x4000,0x4000,0x4000,
|
|
|
|
|
0x4800,0x4800,0x4800,0x4800,0x4800,0x4800,0x4800,0x4800,
|
|
|
|
|
0x5000,0x5000,0x5000,0x5000,0x5000,0x5000,0x5000,0x5000,
|
|
|
|
|
0x5800,0x5800,0x5800,0x5800,0x5800,0x5800,0x5800,0x5800,
|
|
|
|
|
0x6000,0x6000,0x6000,0x6000,0x6000,0x6000,0x6000,0x6000,
|
|
|
|
|
0x6800,0x6800,0x6800,0x6800,0x6800,0x6800,0x6800,0x6800,
|
|
|
|
|
0x7000,0x7000,0x7000,0x7000,0x7000,0x7000,0x7000,0x7000,
|
|
|
|
|
0x7800,0x7800,0x7800,0x7800,0x7800,0x7800,0x7800,0x7800,
|
|
|
|
|
0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,
|
|
|
|
|
0x8800,0x8800,0x8800,0x8800,0x8800,0x8800,0x8800,0x8800,
|
|
|
|
|
0x9000,0x9000,0x9000,0x9000,0x9000,0x9000,0x9000,0x9000,
|
|
|
|
|
0x9800,0x9800,0x9800,0x9800,0x9800,0x9800,0x9800,0x9800,
|
|
|
|
|
0xa000,0xa000,0xa000,0xa000,0xa000,0xa000,0xa000,0xa000,
|
|
|
|
|
0xa800,0xa800,0xa800,0xa800,0xa800,0xa800,0xa800,0xa800,
|
|
|
|
|
0xb000,0xb000,0xb000,0xb000,0xb000,0xb000,0xb000,0xb000,
|
|
|
|
|
0xb800,0xb800,0xb800,0xb800,0xb800,0xb800,0xb800,0xb800,
|
|
|
|
|
0xc000,0xc000,0xc000,0xc000,0xc000,0xc000,0xc000,0xc000,
|
|
|
|
|
0xc800,0xc800,0xc800,0xc800,0xc800,0xc800,0xc800,0xc800,
|
|
|
|
|
0xd000,0xd000,0xd000,0xd000,0xd000,0xd000,0xd000,0xd000,
|
|
|
|
|
0xd800,0xd800,0xd800,0xd800,0xd800,0xd800,0xd800,0xd800,
|
|
|
|
|
0xe000,0xe000,0xe000,0xe000,0xe000,0xe000,0xe000,0xe000,
|
|
|
|
|
0xe800,0xe800,0xe800,0xe800,0xe800,0xe800,0xe800,0xe800,
|
|
|
|
|
0xf000,0xf000,0xf000,0xf000,0xf000,0xf000,0xf000,0xf000,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800, // 256
|
|
|
|
|
static const uint16_t usRangeTableR[] = {0x0000, // 0
|
|
|
|
|
0x0800,
|
|
|
|
|
0x1000,
|
|
|
|
|
0x1800,
|
|
|
|
|
0x2000,
|
|
|
|
|
0x2800,
|
|
|
|
|
0x3000,
|
|
|
|
|
0x3800,
|
|
|
|
|
0x4000,
|
|
|
|
|
0x4800,
|
|
|
|
|
0x5000,
|
|
|
|
|
0x5800,
|
|
|
|
|
0x6000,
|
|
|
|
|
0x6800,
|
|
|
|
|
0x7000,
|
|
|
|
|
0x7800,
|
|
|
|
|
0x8000,
|
|
|
|
|
0x8800,
|
|
|
|
|
0x9000,
|
|
|
|
|
0x9800,
|
|
|
|
|
0xa000,
|
|
|
|
|
0xa800,
|
|
|
|
|
0xb000,
|
|
|
|
|
0xb800,
|
|
|
|
|
0xc000,
|
|
|
|
|
0xc800,
|
|
|
|
|
0xd000,
|
|
|
|
|
0xd800,
|
|
|
|
|
0xe000,
|
|
|
|
|
0xe800,
|
|
|
|
|
0xf000,
|
|
|
|
|
0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800, // 32
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,0xf800,
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 512
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
|
|
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0,
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 64
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 96
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
|
|
|
|
//
|
|
|
|
|
// Clip and convert green value into 5-bits for RGB565
|
|
|
|
|
// Clip and convert green value into 6-bits for RGB565
|
|
|
|
|
//
|
|
|
|
|
static const uint16_t usRangeTableG[] = {0x0000,0x0000,0x0000,0x0000,0x0020,0x0020,0x0020,0x0020, // 0
|
|
|
|
|
0x0040,0x0040,0x0040,0x0040,0x0060,0x0060,0x0060,0x0060,
|
|
|
|
|
0x0080,0x0080,0x0080,0x0080,0x00a0,0x00a0,0x00a0,0x00a0,
|
|
|
|
|
0x00c0,0x00c0,0x00c0,0x00c0,0x00e0,0x00e0,0x00e0,0x00e0,
|
|
|
|
|
0x0100,0x0100,0x0100,0x0100,0x0120,0x0120,0x0120,0x0120,
|
|
|
|
|
0x0140,0x0140,0x0140,0x0140,0x0160,0x0160,0x0160,0x0160,
|
|
|
|
|
0x0180,0x0180,0x0180,0x0180,0x01a0,0x01a0,0x01a0,0x01a0,
|
|
|
|
|
0x01c0,0x01c0,0x01c0,0x01c0,0x01e0,0x01e0,0x01e0,0x01e0,
|
|
|
|
|
0x0200,0x0200,0x0200,0x0200,0x0220,0x0220,0x0220,0x0220,
|
|
|
|
|
0x0240,0x0240,0x0240,0x0240,0x0260,0x0260,0x0260,0x0260,
|
|
|
|
|
0x0280,0x0280,0x0280,0x0280,0x02a0,0x02a0,0x02a0,0x02a0,
|
|
|
|
|
0x02c0,0x02c0,0x02c0,0x02c0,0x02e0,0x02e0,0x02e0,0x02e0,
|
|
|
|
|
0x0300,0x0300,0x0300,0x0300,0x0320,0x0320,0x0320,0x0320,
|
|
|
|
|
0x0340,0x0340,0x0340,0x0340,0x0360,0x0360,0x0360,0x0360,
|
|
|
|
|
0x0380,0x0380,0x0380,0x0380,0x03a0,0x03a0,0x03a0,0x03a0,
|
|
|
|
|
0x03c0,0x03c0,0x03c0,0x03c0,0x03e0,0x03e0,0x03e0,0x03e0,
|
|
|
|
|
0x0400,0x0400,0x0400,0x0400,0x0420,0x0420,0x0420,0x0420,
|
|
|
|
|
0x0440,0x0440,0x0440,0x0440,0x0460,0x0460,0x0460,0x0460,
|
|
|
|
|
0x0480,0x0480,0x0480,0x0480,0x04a0,0x04a0,0x04a0,0x04a0,
|
|
|
|
|
0x04c0,0x04c0,0x04c0,0x04c0,0x04e0,0x04e0,0x04e0,0x04e0,
|
|
|
|
|
0x0500,0x0500,0x0500,0x0500,0x0520,0x0520,0x0520,0x0520,
|
|
|
|
|
0x0540,0x0540,0x0540,0x0540,0x0560,0x0560,0x0560,0x0560,
|
|
|
|
|
0x0580,0x0580,0x0580,0x0580,0x05a0,0x05a0,0x05a0,0x05a0,
|
|
|
|
|
0x05c0,0x05c0,0x05c0,0x05c0,0x05e0,0x05e0,0x05e0,0x05e0,
|
|
|
|
|
0x0600,0x0600,0x0600,0x0600,0x0620,0x0620,0x0620,0x0620,
|
|
|
|
|
0x0640,0x0640,0x0640,0x0640,0x0660,0x0660,0x0660,0x0660,
|
|
|
|
|
0x0680,0x0680,0x0680,0x0680,0x06a0,0x06a0,0x06a0,0x06a0,
|
|
|
|
|
0x06c0,0x06c0,0x06c0,0x06c0,0x06e0,0x06e0,0x06e0,0x06e0,
|
|
|
|
|
0x0700,0x0700,0x0700,0x0700,0x0720,0x0720,0x0720,0x0720,
|
|
|
|
|
0x0740,0x0740,0x0740,0x0740,0x0760,0x0760,0x0760,0x0760,
|
|
|
|
|
0x0780,0x0780,0x0780,0x0780,0x07a0,0x07a0,0x07a0,0x07a0,
|
|
|
|
|
0x07c0,0x07c0,0x07c0,0x07c0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0, // 256
|
|
|
|
|
static const uint16_t usRangeTableG[] = {0x0000,0x0020, // 0
|
|
|
|
|
0x0040,0x0060,
|
|
|
|
|
0x0080,0x00a0,
|
|
|
|
|
0x00c0,0x00e0,
|
|
|
|
|
0x0100,0x0120,
|
|
|
|
|
0x0140,0x0160,
|
|
|
|
|
0x0180,0x01a0,
|
|
|
|
|
0x01c0,0x01e0,
|
|
|
|
|
0x0200,0x0220,
|
|
|
|
|
0x0240,0x0260,
|
|
|
|
|
0x0280,0x02a0,
|
|
|
|
|
0x02c0,0x02e0,
|
|
|
|
|
0x0300,0x0320,
|
|
|
|
|
0x0340,0x0360,
|
|
|
|
|
0x0380,0x03a0,
|
|
|
|
|
0x03c0,0x03e0,
|
|
|
|
|
0x0400,0x0420,
|
|
|
|
|
0x0440,0x0460,
|
|
|
|
|
0x0480,0x04a0,
|
|
|
|
|
0x04c0,0x04e0,
|
|
|
|
|
0x0500,0x0520,
|
|
|
|
|
0x0540,0x0560,
|
|
|
|
|
0x0580,0x05a0,
|
|
|
|
|
0x05c0,0x05e0,
|
|
|
|
|
0x0600,0x0620,
|
|
|
|
|
0x0640,0x0660,
|
|
|
|
|
0x0680,0x06a0,
|
|
|
|
|
0x06c0,0x06e0,
|
|
|
|
|
0x0700,0x0720,
|
|
|
|
|
0x0740,0x0760,
|
|
|
|
|
0x0780,0x07a0,
|
|
|
|
|
0x07c0,0x07e0,
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0, // 64
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
@ -321,160 +265,56 @@ static const uint16_t usRangeTableG[] = {0x0000,0x0000,0x0000,0x0000,0x0020,0x00
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
|
0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,0x07e0,
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 512
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0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,0,0,0,0,0,0,0,0,0,0,0,
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 196
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
|
|
|
|
//
|
|
|
|
|
// Clip and convert blue value into 5-bits for RGB565
|
|
|
|
|
//
|
|
|
|
|
static const uint16_t usRangeTableB[] = {0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // 0
|
|
|
|
|
0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
|
|
|
|
|
0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,
|
|
|
|
|
0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,
|
|
|
|
|
0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,
|
|
|
|
|
0x0005,0x0005,0x0005,0x0005,0x0005,0x0005,0x0005,0x0005,
|
|
|
|
|
0x0006,0x0006,0x0006,0x0006,0x0006,0x0006,0x0006,0x0006,
|
|
|
|
|
0x0007,0x0007,0x0007,0x0007,0x0007,0x0007,0x0007,0x0007,
|
|
|
|
|
0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,
|
|
|
|
|
0x0009,0x0009,0x0009,0x0009,0x0009,0x0009,0x0009,0x0009,
|
|
|
|
|
0x000a,0x000a,0x000a,0x000a,0x000a,0x000a,0x000a,0x000a,
|
|
|
|
|
0x000b,0x000b,0x000b,0x000b,0x000b,0x000b,0x000b,0x000b,
|
|
|
|
|
0x000c,0x000c,0x000c,0x000c,0x000c,0x000c,0x000c,0x000c,
|
|
|
|
|
0x000d,0x000d,0x000d,0x000d,0x000d,0x000d,0x000d,0x000d,
|
|
|
|
|
0x000e,0x000e,0x000e,0x000e,0x000e,0x000e,0x000e,0x000e,
|
|
|
|
|
0x000f,0x000f,0x000f,0x000f,0x000f,0x000f,0x000f,0x000f,
|
|
|
|
|
0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,
|
|
|
|
|
0x0011,0x0011,0x0011,0x0011,0x0011,0x0011,0x0011,0x0011,
|
|
|
|
|
0x0012,0x0012,0x0012,0x0012,0x0012,0x0012,0x0012,0x0012,
|
|
|
|
|
0x0013,0x0013,0x0013,0x0013,0x0013,0x0013,0x0013,0x0013,
|
|
|
|
|
0x0014,0x0014,0x0014,0x0014,0x0014,0x0014,0x0014,0x0014,
|
|
|
|
|
0x0015,0x0015,0x0015,0x0015,0x0015,0x0015,0x0015,0x0015,
|
|
|
|
|
0x0016,0x0016,0x0016,0x0016,0x0016,0x0016,0x0016,0x0016,
|
|
|
|
|
0x0017,0x0017,0x0017,0x0017,0x0017,0x0017,0x0017,0x0017,
|
|
|
|
|
0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,0x0018,
|
|
|
|
|
0x0019,0x0019,0x0019,0x0019,0x0019,0x0019,0x0019,0x0019,
|
|
|
|
|
0x001a,0x001a,0x001a,0x001a,0x001a,0x001a,0x001a,0x001a,
|
|
|
|
|
0x001b,0x001b,0x001b,0x001b,0x001b,0x001b,0x001b,0x001b,
|
|
|
|
|
0x001c,0x001c,0x001c,0x001c,0x001c,0x001c,0x001c,0x001c,
|
|
|
|
|
0x001d,0x001d,0x001d,0x001d,0x001d,0x001d,0x001d,0x001d,
|
|
|
|
|
0x001e,0x001e,0x001e,0x001e,0x001e,0x001e,0x001e,0x001e,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f, // 256
|
|
|
|
|
static const uint16_t usRangeTableB[] = {0x0000, // 0
|
|
|
|
|
0x0001,
|
|
|
|
|
0x0002,
|
|
|
|
|
0x0003,
|
|
|
|
|
0x0004,
|
|
|
|
|
0x0005,
|
|
|
|
|
0x0006,
|
|
|
|
|
0x0007,
|
|
|
|
|
0x0008,
|
|
|
|
|
0x0009,
|
|
|
|
|
0x000a,
|
|
|
|
|
0x000b,
|
|
|
|
|
0x000c,
|
|
|
|
|
0x000d,
|
|
|
|
|
0x000e,
|
|
|
|
|
0x000f,
|
|
|
|
|
0x0010,
|
|
|
|
|
0x0011,
|
|
|
|
|
0x0012,
|
|
|
|
|
0x0013,
|
|
|
|
|
0x0014,
|
|
|
|
|
0x0015,
|
|
|
|
|
0x0016,
|
|
|
|
|
0x0017,
|
|
|
|
|
0x0018,
|
|
|
|
|
0x0019,
|
|
|
|
|
0x001a,
|
|
|
|
|
0x001b,
|
|
|
|
|
0x001c,
|
|
|
|
|
0x001d,
|
|
|
|
|
0x001e,
|
|
|
|
|
0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f, // 32
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,
|
|
|
|
|
0x001f,0x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0,0,
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 64
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 96
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
|
|
|
|
#if defined (__MACH__) || defined( __LINUX__ ) || defined( __MCUXPRESSO )
|
|
|
|
|
//
|
|
|
|
@ -2288,9 +2128,9 @@ static void JPEGPixelLE(uint16_t *pDest, int iY, int iCb, int iCr)
|
|
|
|
|
iCBG = -1409 * (iCb-0x80);
|
|
|
|
|
iCRG = -2925 * (iCr-0x80);
|
|
|
|
|
iCRR = 5742 * (iCr-0x80);
|
|
|
|
|
usPixel = usRangeTableB[((iCBB + iY) >> 12) & 0x3ff]; // blue pixel
|
|
|
|
|
usPixel |= usRangeTableG[((iCBG + iCRG + iY) >> 12) & 0x3ff]; // green pixel
|
|
|
|
|
usPixel |= usRangeTableR[((iCRR + iY) >> 12) & 0x3ff]; // red pixel
|
|
|
|
|
usPixel = usRangeTableB[((iCBB + iY) >> 15) & 0x7f]; // blue pixel
|
|
|
|
|
usPixel |= usRangeTableG[((iCBG + iCRG + iY) >> 14) & 0xff]; // green pixel
|
|
|
|
|
usPixel |= usRangeTableR[((iCRR + iY) >> 15) & 0x7f]; // red pixel
|
|
|
|
|
pDest[0] = usPixel;
|
|
|
|
|
#endif
|
|
|
|
|
} /* JPEGPixelLE() */
|
|
|
|
@ -2304,9 +2144,9 @@ static void JPEGPixelBE(uint16_t *pDest, int iY, int iCb, int iCr)
|
|
|
|
|
iCBG = -1409 * (iCb-0x80);
|
|
|
|
|
iCRG = -2925 * (iCr-0x80);
|
|
|
|
|
iCRR = 5742 * (iCr-0x80);
|
|
|
|
|
usPixel = usRangeTableB[((iCBB + iY) >> 12) & 0x3ff]; // blue pixel
|
|
|
|
|
usPixel |= usRangeTableG[((iCBG + iCRG + iY) >> 12) & 0x3ff]; // green pixel
|
|
|
|
|
usPixel |= usRangeTableR[((iCRR + iY) >> 12) & 0x3ff]; // red pixel
|
|
|
|
|
usPixel = usRangeTableB[((iCBB + iY) >> 15) & 0x7f]; // blue pixel
|
|
|
|
|
usPixel |= usRangeTableG[((iCBG + iCRG + iY) >> 14) & 0xff]; // green pixel
|
|
|
|
|
usPixel |= usRangeTableR[((iCRR + iY) >> 15) & 0x7f]; // red pixel
|
|
|
|
|
pDest[0] = __builtin_bswap16(usPixel);
|
|
|
|
|
} /* JPEGPixelBE() */
|
|
|
|
|
|
|
|
|
@ -2340,13 +2180,13 @@ static void JPEGPixel2LE(uint16_t *pDest, int iY1, int iY2, int iCb, int iCr)
|
|
|
|
|
iCBG = -1409 * (iCb-0x80);
|
|
|
|
|
iCRG = -2925 * (iCr-0x80);
|
|
|
|
|
iCRR = 5742 * (iCr-0x80);
|
|
|
|
|
ulPixel1 = usRangeTableB[((iCBB + iY1) >> 12) & 0x3ff]; // blue pixel
|
|
|
|
|
ulPixel1 |= usRangeTableG[((iCBG + iCRG + iY1) >> 12) & 0x3ff]; // green pixel
|
|
|
|
|
ulPixel1 |= usRangeTableR[((iCRR + iY1) >> 12) & 0x3ff]; // red pixel
|
|
|
|
|
ulPixel1 = usRangeTableB[((iCBB + iY1) >> 15) & 0x7f]; // blue pixel
|
|
|
|
|
ulPixel1 |= usRangeTableG[((iCBG + iCRG + iY1) >> 14) & 0xff]; // green pixel
|
|
|
|
|
ulPixel1 |= usRangeTableR[((iCRR + iY1) >> 15) & 0x7f]; // red pixel
|
|
|
|
|
|
|
|
|
|
ulPixel2 = usRangeTableB[((iCBB + iY2) >> 12) & 0x3ff]; // blue pixel
|
|
|
|
|
ulPixel2 |= usRangeTableG[((iCBG + iCRG + iY2) >> 12) & 0x3ff]; // green pixel
|
|
|
|
|
ulPixel2 |= usRangeTableR[((iCRR + iY2) >> 12) & 0x3ff]; // red pixel
|
|
|
|
|
ulPixel2 = usRangeTableB[((iCBB + iY2) >> 15) & 0x7f]; // blue pixel
|
|
|
|
|
ulPixel2 |= usRangeTableG[((iCBG + iCRG + iY2) >> 14) & 0xff]; // green pixel
|
|
|
|
|
ulPixel2 |= usRangeTableR[((iCRR + iY2) >> 15) & 0x7f]; // red pixel
|
|
|
|
|
*(uint32_t *)&pDest[0] = (ulPixel1 | (ulPixel2<<16));
|
|
|
|
|
#endif
|
|
|
|
|
} /* JPEGPixel2LE() */
|
|
|
|
@ -2360,16 +2200,42 @@ static void JPEGPixel2BE(uint16_t *pDest, int32_t iY1, int32_t iY2, int32_t iCb,
|
|
|
|
|
iCBG = -1409L * (iCb-0x80);
|
|
|
|
|
iCRG = -2925L * (iCr-0x80);
|
|
|
|
|
iCRR = 5742L * (iCr-0x80);
|
|
|
|
|
ulPixel1 = usRangeTableB[((iCBB + iY1) >> 12) & 0x3ff]; // blue pixel
|
|
|
|
|
ulPixel1 |= usRangeTableG[((iCBG + iCRG + iY1) >> 12) & 0x3ff]; // green pixel
|
|
|
|
|
ulPixel1 |= usRangeTableR[((iCRR + iY1) >> 12) & 0x3ff]; // red pixel
|
|
|
|
|
ulPixel1 = usRangeTableB[((iCBB + iY1) >> 15) & 0x7f]; // blue pixel
|
|
|
|
|
ulPixel1 |= usRangeTableG[((iCBG + iCRG + iY1) >> 14) & 0xff]; // green pixel
|
|
|
|
|
ulPixel1 |= usRangeTableR[((iCRR + iY1) >> 15) & 0x7f]; // red pixel
|
|
|
|
|
|
|
|
|
|
ulPixel2 = usRangeTableB[((iCBB + iY2) >> 12) & 0x3ff]; // blue pixel
|
|
|
|
|
ulPixel2 |= usRangeTableG[((iCBG + iCRG + iY2) >> 12) & 0x3ff]; // green pixel
|
|
|
|
|
ulPixel2 |= usRangeTableR[((iCRR + iY2) >> 12) & 0x3ff]; // red pixel
|
|
|
|
|
ulPixel2 = usRangeTableB[((iCBB + iY2) >> 15) & 0x7f]; // blue pixel
|
|
|
|
|
ulPixel2 |= usRangeTableG[((iCBG + iCRG + iY2) >> 14) & 0xff]; // green pixel
|
|
|
|
|
ulPixel2 |= usRangeTableR[((iCRR + iY2) >> 15) & 0x7f]; // red pixel
|
|
|
|
|
*(uint32_t *)&pDest[0] = __builtin_bswap16(ulPixel1) | ((uint32_t)__builtin_bswap16(ulPixel2)<<16);
|
|
|
|
|
} /* JPEGPixel2BE() */
|
|
|
|
|
|
|
|
|
|
static void JPEGPixelLE888(uint8_t *pDest, int iY, int iCb, int iCr)
|
|
|
|
|
{
|
|
|
|
|
int32_t iCBB, iCBG, iCRG, iCRR;
|
|
|
|
|
uint32_t uVal;
|
|
|
|
|
|
|
|
|
|
iCBB = 7258 * (iCb-0x80);
|
|
|
|
|
iCBG = -1409 * (iCb-0x80);
|
|
|
|
|
iCRG = -2925 * (iCr-0x80);
|
|
|
|
|
iCRR = 5742 * (iCr-0x80);
|
|
|
|
|
|
|
|
|
|
// Red
|
|
|
|
|
uVal = ((iCRR + iY) >> 13) & 0x1FF;
|
|
|
|
|
if (uVal & 0x100) uVal = 0;
|
|
|
|
|
*pDest++ = uVal;
|
|
|
|
|
|
|
|
|
|
// Green
|
|
|
|
|
uVal = ((iCBG + iCRG + iY) >> 13) & 0x1FF;
|
|
|
|
|
if (uVal & 0x100) uVal = 0;
|
|
|
|
|
*pDest++ = uVal;
|
|
|
|
|
|
|
|
|
|
// Blue
|
|
|
|
|
uVal = ((iCBB + iY) >> 13) & 0x1FF;
|
|
|
|
|
if (uVal & 0x100) uVal = 0;
|
|
|
|
|
*pDest++ = uVal;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void JPEGPutMCU11(JPEGIMAGE *pJPEG, int x, int iPitch)
|
|
|
|
|
{
|
|
|
|
|
int iCr, iCb;
|
|
|
|
@ -2378,6 +2244,7 @@ static void JPEGPutMCU11(JPEGIMAGE *pJPEG, int x, int iPitch)
|
|
|
|
|
int iRow;
|
|
|
|
|
uint8_t *pY, *pCr, *pCb;
|
|
|
|
|
uint16_t *pOutput = &pJPEG->usPixels[x];
|
|
|
|
|
uint8_t *pOutput8 = ((uint8_t*)pJPEG->usPixels) + x * 3;
|
|
|
|
|
|
|
|
|
|
pY = (unsigned char *)&pJPEG->sMCUs[0*DCTSIZE];
|
|
|
|
|
pCb = (unsigned char *)&pJPEG->sMCUs[1*DCTSIZE];
|
|
|
|
@ -2474,6 +2341,17 @@ static void JPEGPutMCU11(JPEGIMAGE *pJPEG, int x, int iPitch)
|
|
|
|
|
JPEGPixelLE(pOutput+iCol, Y, iCb, iCr);
|
|
|
|
|
} // for col
|
|
|
|
|
}
|
|
|
|
|
else if (pJPEG->ucPixelType == RGB888_LITTLE_ENDIAN)
|
|
|
|
|
{
|
|
|
|
|
for (iCol=0; iCol<8; iCol++) // up to 4x2 cols to do
|
|
|
|
|
{
|
|
|
|
|
iCr = *pCr++;
|
|
|
|
|
iCb = *pCb++;
|
|
|
|
|
Y = (int)(*pY++) << 12;
|
|
|
|
|
JPEGPixelLE888(pOutput8+iCol*3, Y, iCb, iCr);
|
|
|
|
|
} // for col
|
|
|
|
|
pOutput8 += iPitch * 3;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
for (iCol=0; iCol<8; iCol++) // up to 4x2 cols to do
|
|
|
|
@ -2829,6 +2707,7 @@ static void JPEGPutMCU12(JPEGIMAGE *pJPEG, int x, int iPitch)
|
|
|
|
|
int iRow, iCol, iXCount, iYCount;
|
|
|
|
|
uint8_t *pY, *pCr, *pCb;
|
|
|
|
|
uint16_t *pOutput = &pJPEG->usPixels[x];
|
|
|
|
|
uint8_t *pOutput8 = ((uint8_t*)pJPEG->usPixels) + x * 3;
|
|
|
|
|
|
|
|
|
|
pY = (uint8_t *)&pJPEG->sMCUs[0*DCTSIZE];
|
|
|
|
|
pCb = (uint8_t *)&pJPEG->sMCUs[2*DCTSIZE];
|
|
|
|
@ -2960,6 +2839,11 @@ static void JPEGPutMCU12(JPEGIMAGE *pJPEG, int x, int iPitch)
|
|
|
|
|
JPEGPixelLE(pOutput + iCol, Y1, Cb, Cr);
|
|
|
|
|
JPEGPixelLE(pOutput + iPitch + iCol, Y2, Cb, Cr);
|
|
|
|
|
}
|
|
|
|
|
else if (pJPEG->ucPixelType == RGB888_LITTLE_ENDIAN)
|
|
|
|
|
{
|
|
|
|
|
JPEGPixelLE888(pOutput8 + iCol*3, Y1, Cb, Cr);
|
|
|
|
|
JPEGPixelLE888(pOutput8 + (iPitch + iCol)*3, Y2, Cb, Cr);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
JPEGPixelBE(pOutput + iCol, Y1, Cb, Cr);
|
|
|
|
@ -2972,6 +2856,7 @@ static void JPEGPutMCU12(JPEGIMAGE *pJPEG, int x, int iPitch)
|
|
|
|
|
pCb += 8;
|
|
|
|
|
pCr += 8;
|
|
|
|
|
pOutput += iPitch*2; // next 2 lines of dest pixels
|
|
|
|
|
pOutput8 += iPitch*6;
|
|
|
|
|
}
|
|
|
|
|
} /* JPEGPutMCU12() */
|
|
|
|
|
static void JPEGPutMCU21(JPEGIMAGE *pJPEG, int x, int iPitch)
|
|
|
|
@ -3229,6 +3114,8 @@ static int DecodeJPEG(JPEGIMAGE *pJPEG)
|
|
|
|
|
cDCTable2 = pJPEG->JPCI[2].dc_tbl_no;
|
|
|
|
|
cACTable2 = pJPEG->JPCI[2].ac_tbl_no;
|
|
|
|
|
iDCPred0 = iDCPred1 = iDCPred2 = mcuCX = mcuCY = 0;
|
|
|
|
|
|
|
|
|
|
printf("SubSample mode: 0x%x\n", pJPEG->ucSubSample);
|
|
|
|
|
|
|
|
|
|
switch (pJPEG->ucSubSample) // set up the parameters for the different subsampling options
|
|
|
|
|
{
|
|
|
|
@ -3287,6 +3174,8 @@ static int DecodeJPEG(JPEGIMAGE *pJPEG)
|
|
|
|
|
iMCUCount = MAX_BUFFERED_PIXELS / (mcuCX * mcuCY);
|
|
|
|
|
if (pJPEG->ucPixelType == EIGHT_BIT_GRAYSCALE)
|
|
|
|
|
iMCUCount *= 2; // each pixel is only 1 byte
|
|
|
|
|
else if (pJPEG->ucPixelType == RGB888_LITTLE_ENDIAN)
|
|
|
|
|
iMCUCount = (iMCUCount >> 1) + (iMCUCount >> 3); // each picel is 3 bytes
|
|
|
|
|
if (iMCUCount > cx)
|
|
|
|
|
iMCUCount = cx; // don't go wider than the image
|
|
|
|
|
if (iMCUCount > pJPEG->iMaxMCUs) // did the user set an upper bound on how many pixels per JPEGDraw callback?
|
|
|
|
@ -3296,6 +3185,9 @@ static int DecodeJPEG(JPEGIMAGE *pJPEG)
|
|
|
|
|
jd.iBpp = 16;
|
|
|
|
|
switch (pJPEG->ucPixelType)
|
|
|
|
|
{
|
|
|
|
|
case RGB888_LITTLE_ENDIAN:
|
|
|
|
|
jd.iBpp = 24;
|
|
|
|
|
break;
|
|
|
|
|
case EIGHT_BIT_GRAYSCALE:
|
|
|
|
|
jd.iBpp = 8;
|
|
|
|
|
break;
|
|
|
|
|