From 6ff1a1073a403d9aa82965e7875f264714990e71 Mon Sep 17 00:00:00 2001 From: Philip Heron Date: Thu, 30 Jun 2016 10:11:20 +0100 Subject: [PATCH] Additional changes for quality setting. --- main.c | 3 ++- ssdv.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 465e6f5..0b4b61b 100644 --- a/main.c +++ b/main.c @@ -139,7 +139,7 @@ int main(int argc, char *argv[]) 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" - ">> 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.image_id, p.width, @@ -147,6 +147,7 @@ int main(int argc, char *argv[]) p.packet_id, errors, p.type, + p.quality, p.eoi, p.mcu_mode, p.mcu_offset, diff --git a/ssdv.c b/ssdv.c index 0453748..18d73cc 100644 --- a/ssdv.c +++ b/ssdv.c @@ -1244,7 +1244,7 @@ char ssdv_dec_feed(ssdv_t *s, uint8_t *packet) s->width = packet[9] << 4; s->height = packet[10] << 4; 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; /* 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->height = packet[10] << 4; 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_offset = packet[12]; info->mcu_id = (packet[13] << 8) | packet[14];