diff --git a/RgbToHiRes.vcxproj.user b/RgbToHiRes.vcxproj.user
new file mode 100644
index 0000000..26ab88e
--- /dev/null
+++ b/RgbToHiRes.vcxproj.user
@@ -0,0 +1,11 @@
+
+
+
+ -i D:\Chris.ARES\Dropbox\_Partages\_Macbook\Green.png
+ WindowsLocalDebugger
+
+
+ -i D:\Chris.ARES\Dropbox\_Partages\_Macbook\Green.png
+ WindowsLocalDebugger
+
+
\ No newline at end of file
diff --git a/src/HiRes.cpp b/src/HiRes.cpp
index d5b7f18..0392e37 100644
--- a/src/HiRes.cpp
+++ b/src/HiRes.cpp
@@ -17,12 +17,10 @@ namespace RgbToHires {
BlockHr::BlockHr(const BlockPixel& source)
{
- const auto group = getGroup(source);
+ const auto groups = getGroup(source);
//Init data, depending on the group
- for (auto& byte : _data) {
- //Hi bit depending on color group
- group == GROUP_1 ? byte = 0x0 : byte = 0x80;
- }
+ groups.first == GROUP_1 ? _data[0] = 0x0 : _data[0] = 0x80;
+ groups.second == GROUP_1 ? _data[1] = 0x0 : _data[1] = 0x80;
//Getting the bit pairs
//Left 7 bit group
_data[0] |= getDibit(source[0]);
@@ -39,19 +37,30 @@ namespace RgbToHires {
}
- BlockHr::eColorGroup BlockHr::getGroup(const BlockPixel& block) const
+ std::pair BlockHr::getGroup(const BlockPixel& block) const
{
- auto group = GROUP_1;
- for (const auto& color : block) {
- if (color == GREEN || color == VIOLET) {
+ std::pair groups{ GROUP_1, GROUP_1 };
+ //1st block group, including the last semi-pixel
+ for (auto i = 0u; i < 4u; ++i) {
+ if (block[i] == GREEN || block[i] == VIOLET) {
break;
}
- if (color == ORANGE || color == BLUE) {
- group = GROUP_2;
+ else if (block[i] == ORANGE || block[i] == BLUE) {
+ groups.first = GROUP_2;
break;
}
}
- return group;
+ //2nd block group, excluding the first semi-pixel
+ for (auto i = 4u; i < 7u; ++i) {
+ if (block[i] == GREEN || block[i] == VIOLET) {
+ break;
+ }
+ else if (block[i] == ORANGE || block[i] == BLUE) {
+ groups.second = GROUP_2;
+ break;
+ }
+ }
+ return groups;
}
@@ -81,7 +90,7 @@ namespace RgbToHires {
{
auto pixel_src = source.getConstPixels(0u, 0u, WIDTH, HEIGHT);
- for (auto& line : _blobHr) {
+ for (auto& line : _blob) {
for (auto& block : line) {
BlockPixel blockPxRgb;
for (auto& pxRgb : blockPxRgb) {
diff --git a/src/HiRes.h b/src/HiRes.h
index 00e3567..403aaf9 100644
--- a/src/HiRes.h
+++ b/src/HiRes.h
@@ -9,8 +9,7 @@
namespace RgbToHires {
- using BlockPixel = std::array;
- using LinePixel = std::array;
+ using BlockPixel = std::array;
class BlockHr
{
@@ -27,7 +26,7 @@ namespace RgbToHires {
};
/// \brief Returns the color group of these two pixel blocks
/// Works on double blocks instead of single blocks
- eColorGroup getGroup(const BlockPixel&) const;
+ std::pair getGroup(const BlockPixel&) const;
/// \brief Returns the bit pait corresponding to the given color
uint8_t getDibit(const Magick::Color&) const;
@@ -35,8 +34,7 @@ namespace RgbToHires {
};
using LineHr = std::array;
- template
- using Blob = std::array;
+ using Blob = std::array;
class HiRes
{
@@ -46,9 +44,7 @@ namespace RgbToHires {
private:
-
- Blob _blobPx; ///< A frame ordered buffer of pixels
- Blob _blobHr; ///< A frame ordered buffer of hires data
+ Blob _blob; ///< A frame ordered buffer of hires data
};
diff --git a/src/Main.cpp b/src/Main.cpp
index bd4fd93..547b662 100644
--- a/src/Main.cpp
+++ b/src/Main.cpp
@@ -36,7 +36,6 @@ int main( int argc, char *argv[] )
}
const auto imageRgb = Magick::Image{ filepath };
auto imageQuantized = ImageQuantized{ imageRgb };
- imageQuantized.write("C:\\Users\\Chris.ARES\\Temp\\toto.png");
const auto imageHiRes = HiRes{ imageQuantized };
}