Improve MTVZA-GY Decoding

This commit is contained in:
Aang23 2021-10-23 20:21:14 +02:00
parent 8c8ab309b4
commit 63d8a008c5
2 changed files with 17 additions and 8 deletions

View file

@ -79,8 +79,8 @@ namespace meteor
logger->info("Global Composite...");
int all_width_count = 20;
int all_height_count = 6;
cimg_library::CImg<unsigned short> imageAll(26 * 5 * all_width_count, reader.getChannel(0).height() * all_height_count, 1, 1);
int all_height_count = 3;
cimg_library::CImg<unsigned short> 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));
}
}
}

View file

@ -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<unsigned short> MTVZAReader::getChannel(int channel)
{
cimg_library::CImg<unsigned short> img = cimg_library::CImg<unsigned short>(channels[channel], 26, lines);
cimg_library::CImg<unsigned short> img = cimg_library::CImg<unsigned short>(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;
}