Skip to content

Commit

Permalink
updated libzedmd, just use ZeDMD zone streaming, nothing else (vpinba…
Browse files Browse the repository at this point in the history
  • Loading branch information
mkalkbrenner authored Dec 16, 2024
1 parent 564cf49 commit 5485111
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 51 deletions.
2 changes: 1 addition & 1 deletion platforms/android/arm64-v8a/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=60fade98a01d0a4844a02abc413b8a93a7b9e78f
LIBZEDMD_SHA=d876b37587a6d53776a88f1b6822f2958b3df8a3
LIBSERUM_SHA=03ef7b5eeb4c2327b5a772f06634e487eb8ed0fc
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f
LIBPUPDMD_SHA=124f45e5ddd59ceb339591de88fcca72f8c54612
Expand Down
2 changes: 1 addition & 1 deletion platforms/ios-simulator/arm64/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=60fade98a01d0a4844a02abc413b8a93a7b9e78f
LIBZEDMD_SHA=d876b37587a6d53776a88f1b6822f2958b3df8a3
LIBSERUM_SHA=03ef7b5eeb4c2327b5a772f06634e487eb8ed0fc
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f
LIBPUPDMD_SHA=124f45e5ddd59ceb339591de88fcca72f8c54612
Expand Down
2 changes: 1 addition & 1 deletion platforms/ios/arm64/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=60fade98a01d0a4844a02abc413b8a93a7b9e78f
LIBZEDMD_SHA=d876b37587a6d53776a88f1b6822f2958b3df8a3
LIBSERUM_SHA=03ef7b5eeb4c2327b5a772f06634e487eb8ed0fc
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f
LIBPUPDMD_SHA=124f45e5ddd59ceb339591de88fcca72f8c54612
Expand Down
2 changes: 1 addition & 1 deletion platforms/linux/aarch64/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=60fade98a01d0a4844a02abc413b8a93a7b9e78f
LIBZEDMD_SHA=d876b37587a6d53776a88f1b6822f2958b3df8a3
LIBSERUM_SHA=03ef7b5eeb4c2327b5a772f06634e487eb8ed0fc
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f
LIBPUPDMD_SHA=124f45e5ddd59ceb339591de88fcca72f8c54612
Expand Down
2 changes: 1 addition & 1 deletion platforms/linux/x64/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=60fade98a01d0a4844a02abc413b8a93a7b9e78f
LIBZEDMD_SHA=d876b37587a6d53776a88f1b6822f2958b3df8a3
LIBSERUM_SHA=03ef7b5eeb4c2327b5a772f06634e487eb8ed0fc
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f
LIBPUPDMD_SHA=124f45e5ddd59ceb339591de88fcca72f8c54612
Expand Down
2 changes: 1 addition & 1 deletion platforms/macos/arm64/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=60fade98a01d0a4844a02abc413b8a93a7b9e78f
LIBZEDMD_SHA=d876b37587a6d53776a88f1b6822f2958b3df8a3
LIBSERUM_SHA=03ef7b5eeb4c2327b5a772f06634e487eb8ed0fc
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f
LIBPUPDMD_SHA=124f45e5ddd59ceb339591de88fcca72f8c54612
Expand Down
2 changes: 1 addition & 1 deletion platforms/macos/x64/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=60fade98a01d0a4844a02abc413b8a93a7b9e78f
LIBZEDMD_SHA=d876b37587a6d53776a88f1b6822f2958b3df8a3
LIBSERUM_SHA=03ef7b5eeb4c2327b5a772f06634e487eb8ed0fc
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f
LIBPUPDMD_SHA=124f45e5ddd59ceb339591de88fcca72f8c54612
Expand Down
2 changes: 1 addition & 1 deletion platforms/tvos/arm64/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=60fade98a01d0a4844a02abc413b8a93a7b9e78f
LIBZEDMD_SHA=d876b37587a6d53776a88f1b6822f2958b3df8a3
LIBSERUM_SHA=03ef7b5eeb4c2327b5a772f06634e487eb8ed0fc
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f
LIBPUPDMD_SHA=124f45e5ddd59ceb339591de88fcca72f8c54612
Expand Down
2 changes: 1 addition & 1 deletion platforms/win/x64/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=60fade98a01d0a4844a02abc413b8a93a7b9e78f
LIBZEDMD_SHA=d876b37587a6d53776a88f1b6822f2958b3df8a3
LIBSERUM_SHA=03ef7b5eeb4c2327b5a772f06634e487eb8ed0fc
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f
LIBPUPDMD_SHA=124f45e5ddd59ceb339591de88fcca72f8c54612
Expand Down
2 changes: 1 addition & 1 deletion platforms/win/x86/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=60fade98a01d0a4844a02abc413b8a93a7b9e78f
LIBZEDMD_SHA=d876b37587a6d53776a88f1b6822f2958b3df8a3
LIBSERUM_SHA=03ef7b5eeb4c2327b5a772f06634e487eb8ed0fc
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f
LIBPUPDMD_SHA=124f45e5ddd59ceb339591de88fcca72f8c54612
Expand Down
68 changes: 27 additions & 41 deletions src/DMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ void DMD::FindDisplays()

if (pConfig->IsZeDMDWiFiEnabled())
{
std::string WiFiAddr = pConfig->GetZeDMDWiFiAddr() ? pConfig->GetZeDMDWiFiAddr() : "";
std::string WiFiAddr = pConfig->GetZeDMDWiFiAddr() ? pConfig->GetZeDMDWiFiAddr() : "zedmd-wifi.local";
uint16_t udpPortNumber = pConfig->GetZeDMDWiFiPort() > 0 ? pConfig->GetZeDMDWiFiPort() : 3333;

if (WiFiAddr.empty())
Expand Down Expand Up @@ -622,9 +622,11 @@ void DMD::ZeDMDThread()
uint8_t bufferPosition = 0;
uint16_t width = 0;
uint16_t height = 0;
uint16_t frameSize = 0;
uint16_t segData1[128] = {0};
uint16_t segData2[128] = {0};
uint8_t palette[PALETTE_SIZE] = {0};
uint8_t renderBuffer[256 * 64] = {0};

m_dmdFrameReady.load(std::memory_order_acquire);
m_stopFlag.load(std::memory_order_acquire);
Expand Down Expand Up @@ -664,6 +666,7 @@ void DMD::ZeDMDThread()
m_pUpdateBufferQueue[bufferPosition]->width, m_pUpdateBufferQueue[bufferPosition]->height);
width = m_pUpdateBufferQueue[bufferPosition]->width;
height = m_pUpdateBufferQueue[bufferPosition]->height;
frameSize = width * height;
// Activate the correct scaling mode.
m_pZeDMD->SetFrameSize(width, height);
}
Expand All @@ -675,57 +678,33 @@ void DMD::ZeDMDThread()
m_pUpdateBufferQueue[bufferPosition]->r, m_pUpdateBufferQueue[bufferPosition]->g,
m_pUpdateBufferQueue[bufferPosition]->b);
}

if (m_pUpdateBufferQueue[bufferPosition]->mode == Mode::RGB24)
{
// ZeDMD HD supports 256 * 64 pixels.
uint8_t rgb24Data[256 * 64 * 3];

AdjustRGB24Depth(m_pUpdateBufferQueue[bufferPosition]->data, rgb24Data, (size_t)width * height, palette,
m_pUpdateBufferQueue[bufferPosition]->depth);
m_pZeDMD->DisablePreUpscaling();
m_pZeDMD->RenderRgb24(rgb24Data);
m_pZeDMD->EnablePreUpscaling();
m_pZeDMD->RenderRgb888(rgb24Data);
}
else if (m_pUpdateBufferQueue[bufferPosition]->mode == Mode::RGB16)
else if (m_pUpdateBufferQueue[bufferPosition]->mode == Mode::RGB16 ||
(m_pSerum && IsSerumV2Mode(m_pUpdateBufferQueue[bufferPosition]->mode)))
{
m_pZeDMD->DisablePreUpscaling();
m_pZeDMD->RenderRgb565(m_pUpdateBufferQueue[bufferPosition]->segData);
m_pZeDMD->EnablePreUpscaling();
}
else if (m_pSerum && IsSerumMode(m_pUpdateBufferQueue[bufferPosition]->mode))
else
{
if (IsSerumV2Mode(m_pUpdateBufferQueue[bufferPosition]->mode))
{
m_pZeDMD->RenderRgb565(m_pUpdateBufferQueue[bufferPosition]->segData);
}
else
if (m_pUpdateBufferQueue[bufferPosition]->mode == Mode::SerumV1)
{
// Note that uint16_t segData is used to transport the uint8_t palette data to keep the dmdserver protocol
// stable.
memcpy(palette, m_pUpdateBufferQueue[bufferPosition]->segData, PALETTE_SIZE);
m_pZeDMD->RenderColoredGray6(m_pUpdateBufferQueue[bufferPosition]->data, palette, nullptr);
memcpy(renderBuffer, m_pUpdateBufferQueue[bufferPosition]->data, frameSize);
update = true;
}
}
else if (!m_pSerum)
{
if (m_pUpdateBufferQueue[bufferPosition]->mode == Mode::Data)
else if (!m_pSerum && m_pUpdateBufferQueue[bufferPosition]->mode == Mode::Data)
{
m_pZeDMD->SetPalette(palette, m_pUpdateBufferQueue[bufferPosition]->depth == 2 ? 4 : 16);

switch (m_pUpdateBufferQueue[bufferPosition]->depth)
{
case 2:
m_pZeDMD->RenderGray2(m_pUpdateBufferQueue[bufferPosition]->data);
break;

case 4:
m_pZeDMD->RenderGray4(m_pUpdateBufferQueue[bufferPosition]->data);
break;

default:
//@todo log error
break;
}
memcpy(renderBuffer, m_pUpdateBufferQueue[bufferPosition]->data, frameSize);
update = true;
}
else if (m_pUpdateBufferQueue[bufferPosition]->mode == Mode::AlphaNumeric)
{
Expand All @@ -744,19 +723,26 @@ void DMD::ZeDMDThread()

if (update)
{
// ZeDMD HD supports 256 * 64 pixels.
uint8_t renderBuffer[256 * 64];

if (m_pUpdateBufferQueue[bufferPosition]->hasSegData2)
m_pAlphaNumeric->Render(renderBuffer, m_pUpdateBufferQueue[bufferPosition]->layout, segData1, segData2);
else
m_pAlphaNumeric->Render(renderBuffer, m_pUpdateBufferQueue[bufferPosition]->layout, segData1);
}
}

m_pZeDMD->SetPalette(palette, 4);
m_pZeDMD->RenderGray2(renderBuffer);
if (update)
{
for (int i = 0; i < frameSize; i++)
{
int pos = renderBuffer[i] * 3;
uint32_t r = palette[pos];
uint32_t g = palette[pos + 1];
uint32_t b = palette[pos + 2];
}
}
}

if (update) m_pZeDMD->RenderRgb888(renderBuffer);
}
}
}
Expand Down

0 comments on commit 5485111

Please sign in to comment.