Skip to content

Commit

Permalink
pupdmd: use improved indexed matching (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkalkbrenner authored Mar 30, 2024
1 parent 9341124 commit aafa373
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion dmdserver.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PUPCapture = 1
# Overwrite the PUPVideosPath sent by the client and set it to a fixed value.
PUPVideosPath =
# Set to 1 if PUP DMD frame matching should respect the exact colors, 0 if not.
PUPExactColorMatch = 0
PUPExactColorMatch = 1

[ZeDMD]
# Set to 1 if ZeDMD is attached.
Expand Down
2 changes: 1 addition & 1 deletion platforms/android/arm64-v8a/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=42d95ed6f1fe2065ecbd247502d177d7e5eb7e4c
LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f
LIBPUPDMD_SHA=52d485f6276d7ca57b59a61ac2f11fb8cbfcf9ac
LIBPUPDMD_SHA=a444a178b9c61290470acefbfb65128d56f6556b

if [[ $(uname) == "Linux" ]]; then
NUM_PROCS=$(nproc)
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 @@ -6,7 +6,7 @@ CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=42d95ed6f1fe2065ecbd247502d177d7e5eb7e4c
LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f
LIBPUPDMD_SHA=52d485f6276d7ca57b59a61ac2f11fb8cbfcf9ac
LIBPUPDMD_SHA=a444a178b9c61290470acefbfb65128d56f6556b

NUM_PROCS=$(sysctl -n hw.ncpu)

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 @@ -6,7 +6,7 @@ CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=42d95ed6f1fe2065ecbd247502d177d7e5eb7e4c
LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f
LIBPUPDMD_SHA=52d485f6276d7ca57b59a61ac2f11fb8cbfcf9ac
LIBPUPDMD_SHA=a444a178b9c61290470acefbfb65128d56f6556b

NUM_PROCS=$(nproc)

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 @@ -6,7 +6,7 @@ CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=42d95ed6f1fe2065ecbd247502d177d7e5eb7e4c
LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f
LIBPUPDMD_SHA=52d485f6276d7ca57b59a61ac2f11fb8cbfcf9ac
LIBPUPDMD_SHA=a444a178b9c61290470acefbfb65128d56f6556b

NUM_PROCS=$(nproc)

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 @@ -6,7 +6,7 @@ CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=42d95ed6f1fe2065ecbd247502d177d7e5eb7e4c
LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f
LIBPUPDMD_SHA=52d485f6276d7ca57b59a61ac2f11fb8cbfcf9ac
LIBPUPDMD_SHA=a444a178b9c61290470acefbfb65128d56f6556b

NUM_PROCS=$(sysctl -n hw.ncpu)

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 @@ -6,7 +6,7 @@ CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=42d95ed6f1fe2065ecbd247502d177d7e5eb7e4c
LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f
LIBPUPDMD_SHA=52d485f6276d7ca57b59a61ac2f11fb8cbfcf9ac
LIBPUPDMD_SHA=a444a178b9c61290470acefbfb65128d56f6556b

NUM_PROCS=$(sysctl -n hw.ncpu)

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 @@ -6,7 +6,7 @@ CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=42d95ed6f1fe2065ecbd247502d177d7e5eb7e4c
LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f
LIBPUPDMD_SHA=52d485f6276d7ca57b59a61ac2f11fb8cbfcf9ac
LIBPUPDMD_SHA=a444a178b9c61290470acefbfb65128d56f6556b

NUM_PROCS=$(sysctl -n hw.ncpu)

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 @@ -6,7 +6,7 @@ CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=42d95ed6f1fe2065ecbd247502d177d7e5eb7e4c
LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f
LIBPUPDMD_SHA=52d485f6276d7ca57b59a61ac2f11fb8cbfcf9ac
LIBPUPDMD_SHA=a444a178b9c61290470acefbfb65128d56f6556b

echo "Building libraries..."
echo " CARGS_SHA: ${CARGS_SHA}"
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 @@ -6,7 +6,7 @@ CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=42d95ed6f1fe2065ecbd247502d177d7e5eb7e4c
LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f
LIBPUPDMD_SHA=52d485f6276d7ca57b59a61ac2f11fb8cbfcf9ac
LIBPUPDMD_SHA=a444a178b9c61290470acefbfb65128d56f6556b

echo "Building libraries..."
echo " CARGS_SHA: ${CARGS_SHA}"
Expand Down
2 changes: 1 addition & 1 deletion src/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Config::Config()
m_altColorPath.clear();
m_pupCapture = false;
m_pupVideosPath.clear();
m_pupExactColorMatch = false;
m_pupExactColorMatch = true;
m_framesTimeout = 0;
m_framesToSkip = 0;
m_zedmd = true;
Expand Down
12 changes: 6 additions & 6 deletions src/DMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,7 @@ void DMD::PupDMDThread()
m_pPUPDMD = new PUPDMD::DMD();
m_pPUPDMD->SetLogCallback(PUPDMDLogCallback, nullptr);

if (!m_pPUPDMD->Load(m_pupVideosPath, m_romName))
if (!m_pPUPDMD->Load(m_pupVideosPath, m_romName, m_pUpdateBufferQueue[bufferPosition]->depth))
{
delete (m_pPUPDMD);
m_pPUPDMD = nullptr;
Expand All @@ -1344,6 +1344,10 @@ void DMD::PupDMDThread()

uint16_t triggerID = 0;
if (Config::GetInstance()->IsPUPExactColorMatch())
{
triggerID = m_pPUPDMD->MatchIndexed(renderBuffer);
}
else
{
UpdatePalette(palette, m_pUpdateBufferQueue[bufferPosition]->depth, m_pUpdateBufferQueue[bufferPosition]->r,
m_pUpdateBufferQueue[bufferPosition]->g, m_pUpdateBufferQueue[bufferPosition]->b);
Expand All @@ -1354,13 +1358,9 @@ void DMD::PupDMDThread()
uint16_t pos = renderBuffer[i] * 3;
memcpy(&pFrame[i * 3], &palette[pos], 3);
}
triggerID = m_pPUPDMD->Match(pFrame, true);
triggerID = m_pPUPDMD->Match(pFrame, false);
free(pFrame);
}
else
{
triggerID = m_pPUPDMD->MatchIndexed(renderBuffer);
}

if (triggerID > 0) handleTrigger(triggerID);
}
Expand Down

0 comments on commit aafa373

Please sign in to comment.