From 63d8a008c587e8d6ef0194de861514f960dcab7a Mon Sep 17 00:00:00 2001 From: Aang23 Date: Sat, 23 Oct 2021 20:21:14 +0200 Subject: [PATCH] Improve MTVZA-GY Decoding --- .../instruments/mtvza/module_meteor_mtvza.cpp | 6 +++--- .../meteor/instruments/mtvza/mtvza_reader.cpp | 19 ++++++++++++++----- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src-core/modules/meteor/instruments/mtvza/module_meteor_mtvza.cpp b/src-core/modules/meteor/instruments/mtvza/module_meteor_mtvza.cpp index 009e467a8..a61dd7c18 100644 --- a/src-core/modules/meteor/instruments/mtvza/module_meteor_mtvza.cpp +++ b/src-core/modules/meteor/instruments/mtvza/module_meteor_mtvza.cpp @@ -79,8 +79,8 @@ namespace meteor logger->info("Global Composite..."); int all_width_count = 20; - int all_height_count = 6; - cimg_library::CImg imageAll(26 * 5 * all_width_count, reader.getChannel(0).height() * all_height_count, 1, 1); + int all_height_count = 3; + cimg_library::CImg imageAll(26 * 2 * all_width_count, reader.getChannel(0).height() * all_height_count, 1, 1); { int height = reader.getChannel(0).height(); @@ -91,7 +91,7 @@ namespace meteor if (row * all_width_count + column >= 8461) break; - imageAll.draw_image(26 * 5 * column, height * row, 0, 0, reader.getChannel(row * all_width_count + column)); + imageAll.draw_image(26 * 2 * column, height * row, 0, 0, reader.getChannel(row * all_width_count + column)); } } } diff --git a/src-core/modules/meteor/instruments/mtvza/mtvza_reader.cpp b/src-core/modules/meteor/instruments/mtvza/mtvza_reader.cpp index a85ca73ba..9d825c89e 100644 --- a/src-core/modules/meteor/instruments/mtvza/mtvza_reader.cpp +++ b/src-core/modules/meteor/instruments/mtvza/mtvza_reader.cpp @@ -4,11 +4,19 @@ namespace meteor { namespace mtvza { + unsigned char reverse(unsigned char b) + { + b = (b & 0xF0) >> 4 | (b & 0x0F) << 4; + b = (b & 0xCC) >> 2 | (b & 0x33) << 2; + b = (b & 0xAA) >> 1 | (b & 0x55) << 1; + return b; + } + MTVZAReader::MTVZAReader() { for (int i = 0; i < 150; i++) { - channels[i] = new unsigned short[10000 * 26]; + channels[i] = new unsigned short[10000 * 26 * 2]; } lines = 0; } @@ -28,9 +36,10 @@ namespace meteor if (counter <= 26) { int pos = 7; - for (int ch = 0; ch < 120; ch++) + for (int ch = 0; ch < 60; ch++) { - channels[ch][lines * 26 + (counter - 1)] = data[pos + 0] << 8 | data[pos + 1]; + channels[ch][lines * 26 * 2 + (counter - 1) * 2 + 0] = data[pos + 0] << 8 | data[pos + 1]; + channels[ch][lines * 26 * 2 + (counter - 1) * 2 + 1] = data[pos + 120 + 0] << 8 | data[pos + 120 + 1]; pos += 2; } } @@ -42,10 +51,10 @@ namespace meteor cimg_library::CImg MTVZAReader::getChannel(int channel) { - cimg_library::CImg img = cimg_library::CImg(channels[channel], 26, lines); + cimg_library::CImg img = cimg_library::CImg(channels[channel], 26 * 2, lines); img.normalize(0, 65535); img.equalize(1000); - img.resize(img.width() * 5, img.height()); + //img.resize(img.width() * 2, img.height()); //img.mirror('x'); return img; }