mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Upstream Kanji fix.
This commit is contained in:
parent
9091bc6ba0
commit
744a2d7b04
@ -2694,12 +2694,18 @@ static quirc_decode_error_t decode_kanji(struct quirc_data *data,
|
|||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
int d = take_bits(ds, 13);
|
int d = take_bits(ds, 13);
|
||||||
|
int msB = d / 0xc0;
|
||||||
|
int lsB = d % 0xc0;
|
||||||
|
int intermediate = (msB << 8) | lsB;
|
||||||
uint16_t sjw;
|
uint16_t sjw;
|
||||||
|
|
||||||
if (d + 0x8140 >= 0x9ffc)
|
if (intermediate + 0x8140 <= 0x9ffc) {
|
||||||
sjw = d + 0x8140;
|
/* bytes are in the range 0x8140 to 0x9FFC */
|
||||||
else
|
sjw = intermediate + 0x8140;
|
||||||
sjw = d + 0xc140;
|
} else {
|
||||||
|
/* bytes are in the range 0xE040 to 0xEBBF */
|
||||||
|
sjw = intermediate + 0xc140;
|
||||||
|
}
|
||||||
|
|
||||||
data->payload[data->payload_len++] = sjw >> 8;
|
data->payload[data->payload_len++] = sjw >> 8;
|
||||||
data->payload[data->payload_len++] = sjw & 0xff;
|
data->payload[data->payload_len++] = sjw & 0xff;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user