Additional changes for quality setting.

This commit is contained in:
Philip Heron 2016-06-30 10:11:20 +01:00
parent 6ac66a047f
commit 6ff1a1073a
2 changed files with 4 additions and 3 deletions

3
main.c
View File

@ -139,7 +139,7 @@ int main(int argc, char *argv[])
ssdv_dec_header(&p, pkt); ssdv_dec_header(&p, pkt);
fprintf(stderr, "Decoded image packet. Callsign: %s, Image ID: %d, Resolution: %dx%d, Packet ID: %d (%d errors corrected)\n" fprintf(stderr, "Decoded image packet. Callsign: %s, Image ID: %d, Resolution: %dx%d, Packet ID: %d (%d errors corrected)\n"
">> Type: %d, EOI: %d, MCU Mode: %d, MCU Offset: %d, MCU ID: %d/%d\n", ">> Type: %d, Quality: %d, EOI: %d, MCU Mode: %d, MCU Offset: %d, MCU ID: %d/%d\n",
p.callsign_s, p.callsign_s,
p.image_id, p.image_id,
p.width, p.width,
@ -147,6 +147,7 @@ int main(int argc, char *argv[])
p.packet_id, p.packet_id,
errors, errors,
p.type, p.type,
p.quality,
p.eoi, p.eoi,
p.mcu_mode, p.mcu_mode,
p.mcu_offset, p.mcu_offset,

4
ssdv.c
View File

@ -1244,7 +1244,7 @@ char ssdv_dec_feed(ssdv_t *s, uint8_t *packet)
s->width = packet[9] << 4; s->width = packet[9] << 4;
s->height = packet[10] << 4; s->height = packet[10] << 4;
s->mcu_count = packet[9] * packet[10]; s->mcu_count = packet[9] * packet[10];
s->quality = ((((packet[11] >> 3) & 7) ^ 4) - 4) + 4; s->quality = ((packet[11] >> 3) & 7) ^ 4;
s->mcu_mode = packet[11] & 0x03; s->mcu_mode = packet[11] & 0x03;
/* Configure the payload size and CRC position */ /* Configure the payload size and CRC position */
@ -1468,7 +1468,7 @@ void ssdv_dec_header(ssdv_packet_info_t *info, uint8_t *packet)
info->width = packet[9] << 4; info->width = packet[9] << 4;
info->height = packet[10] << 4; info->height = packet[10] << 4;
info->eoi = (packet[11] >> 2) & 1; info->eoi = (packet[11] >> 2) & 1;
info->quality = (packet[11] >> 3) & 7; info->quality = ((packet[11] >> 3) & 7) ^ 4;
info->mcu_mode = packet[11] & 0x03; info->mcu_mode = packet[11] & 0x03;
info->mcu_offset = packet[12]; info->mcu_offset = packet[12];
info->mcu_id = (packet[13] << 8) | packet[14]; info->mcu_id = (packet[13] << 8) | packet[14];