Skip to content

Commit 3fc92d0

Browse files
authored
Show not colorized frames (#71)
1 parent 9444651 commit 3fc92d0

File tree

4 files changed

+27
-9
lines changed

4 files changed

+27
-9
lines changed

include/DMDUtil/Config.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ class DMDUTILAPI Config
5151
void SetMaximumUnknownFramesToSkip(int framesToSkip) { m_framesToSkip = framesToSkip; }
5252
int GetIgnoreUnknownFramesTimeout() { return m_framesTimeout; }
5353
int GetMaximumUnknownFramesToSkip() { return m_framesToSkip; }
54+
bool IsShowNotColorizedFrames() const { return m_showNotColorizedFrames; }
55+
void SetShowNotColorizedFrames(bool showNotColorizedFrames) { m_showNotColorizedFrames = showNotColorizedFrames; }
5456
bool IsDumpNotColorizedFrames() const { return m_dumpNotColorizedFrames; }
5557
void SetDumpNotColorizedFrames(bool dumpNotColorizedFrames) { m_dumpNotColorizedFrames = dumpNotColorizedFrames; }
5658
bool IsFilterTransitionalFrames() const { return m_filterTransitionalFrames; }
@@ -103,6 +105,7 @@ class DMDUTILAPI Config
103105
bool m_pupExactColorMatch;
104106
int m_framesTimeout;
105107
int m_framesToSkip;
108+
bool m_showNotColorizedFrames;
106109
bool m_dumpNotColorizedFrames;
107110
bool m_filterTransitionalFrames;
108111
bool m_zedmd;

include/DMDUtil/DMD.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,11 @@ class DMDUTILAPI DMD
9292
NotColorized = 10,
9393
};
9494

95-
bool IsSerumMode(Mode mode)
95+
bool IsSerumMode(Mode mode, bool showNotColorized = false)
9696
{
9797
return (mode == Mode::SerumV1 || mode == Mode::SerumV2_32 || mode == Mode::SerumV2_32_64 ||
98-
mode == Mode::SerumV2_64 || mode == Mode::SerumV2_64_32);
98+
mode == Mode::SerumV2_64 || mode == Mode::SerumV2_64_32 ||
99+
(showNotColorized && mode == Mode::NotColorized));
99100
}
100101

101102
bool IsSerumV2Mode(Mode mode)

src/Config.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Config::Config()
2323
m_pupExactColorMatch = true;
2424
m_framesTimeout = 0;
2525
m_framesToSkip = 0;
26+
m_showNotColorizedFrames = false;
2627
m_dumpNotColorizedFrames = false;
2728
m_filterTransitionalFrames = false;
2829
m_zedmd = true;

src/DMD.cpp

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,9 @@ void DMD::ZeDMDThread()
650650
m_dmdFrameReady.load(std::memory_order_acquire);
651651
m_stopFlag.load(std::memory_order_acquire);
652652

653+
Config* const pConfig = Config::GetInstance();
654+
bool showNotColorizedFrames = pConfig->IsShowNotColorizedFrames();
655+
653656
while (true)
654657
{
655658
std::shared_lock<std::shared_mutex> sl(m_dmdSharedMutex);
@@ -669,7 +672,7 @@ void DMD::ZeDMDThread()
669672
bufferPosition = GetNextBufferQueuePosition(bufferPosition, updateBufferQueuePosition);
670673

671674
if (m_pSerum &&
672-
(!IsSerumMode(m_pUpdateBufferQueue[bufferPosition]->mode) ||
675+
(!IsSerumMode(m_pUpdateBufferQueue[bufferPosition]->mode, showNotColorizedFrames) ||
673676
(m_pZeDMD->GetWidth() == 256 && m_pUpdateBufferQueue[bufferPosition]->mode == Mode::SerumV2_32_64) ||
674677
(m_pZeDMD->GetWidth() < 256 && m_pUpdateBufferQueue[bufferPosition]->mode == Mode::SerumV2_64_32)))
675678
continue;
@@ -720,7 +723,8 @@ void DMD::ZeDMDThread()
720723
memcpy(indexBuffer, m_pUpdateBufferQueue[bufferPosition]->data, frameSize);
721724
update = true;
722725
}
723-
else if (!m_pSerum && m_pUpdateBufferQueue[bufferPosition]->mode == Mode::Data)
726+
else if ((!m_pSerum && m_pUpdateBufferQueue[bufferPosition]->mode == Mode::Data) ||
727+
(showNotColorizedFrames && m_pUpdateBufferQueue[bufferPosition]->mode == Mode::NotColorized))
724728
{
725729
memcpy(indexBuffer, m_pUpdateBufferQueue[bufferPosition]->data, frameSize);
726730
update = true;
@@ -782,6 +786,7 @@ void DMD::SerumThread()
782786
m_stopFlag.load(std::memory_order_acquire);
783787

784788
Config* const pConfig = Config::GetInstance();
789+
bool showNotColorizedFrames = pConfig->IsShowNotColorizedFrames();
785790
bool dumpNotColorizedFrames = pConfig->IsDumpNotColorizedFrames();
786791

787792
while (true)
@@ -867,7 +872,7 @@ void DMD::SerumThread()
867872
prevTriggerId = m_pSerum->triggerID;
868873
}
869874
}
870-
else if (dumpNotColorizedFrames)
875+
else if (showNotColorizedFrames || dumpNotColorizedFrames)
871876
{
872877
Log(DMDUtil_LogLevel_DEBUG, "Serum: unidentified frame detected");
873878

@@ -1003,6 +1008,9 @@ void DMD::PixelcadeDMDThread()
10031008
m_dmdFrameReady.load(std::memory_order_acquire);
10041009
m_stopFlag.load(std::memory_order_acquire);
10051010

1011+
Config* const pConfig = Config::GetInstance();
1012+
bool showNotColorizedFrames = pConfig->IsShowNotColorizedFrames();
1013+
10061014
while (true)
10071015
{
10081016
std::shared_lock<std::shared_mutex> sl(m_dmdSharedMutex);
@@ -1020,7 +1028,7 @@ void DMD::PixelcadeDMDThread()
10201028
{
10211029
bufferPosition = GetNextBufferQueuePosition(bufferPosition, updateBufferQueuePosition);
10221030

1023-
if (m_pSerum && !IsSerumMode(m_pUpdateBufferQueue[bufferPosition]->mode)) continue;
1031+
if (m_pSerum && !IsSerumMode(m_pUpdateBufferQueue[bufferPosition]->mode, showNotColorizedFrames)) continue;
10241032

10251033
if (m_pUpdateBufferQueue[bufferPosition]->hasData || m_pUpdateBufferQueue[bufferPosition]->hasSegData)
10261034
{
@@ -1101,7 +1109,8 @@ void DMD::PixelcadeDMDThread()
11011109
memcpy(renderBuffer, m_pUpdateBufferQueue[bufferPosition]->data, length);
11021110
update = true;
11031111
}
1104-
else if (!m_pSerum && m_pUpdateBufferQueue[bufferPosition]->mode == Mode::Data)
1112+
else if ((!m_pSerum && m_pUpdateBufferQueue[bufferPosition]->mode == Mode::Data) ||
1113+
(showNotColorizedFrames && m_pUpdateBufferQueue[bufferPosition]->mode == Mode::NotColorized))
11051114
{
11061115
memcpy(renderBuffer, m_pUpdateBufferQueue[bufferPosition]->data, length);
11071116
update = true;
@@ -1218,6 +1227,9 @@ void DMD::RGB24DMDThread()
12181227
m_dmdFrameReady.load(std::memory_order_acquire);
12191228
m_stopFlag.load(std::memory_order_acquire);
12201229

1230+
Config* const pConfig = Config::GetInstance();
1231+
bool showNotColorizedFrames = pConfig->IsShowNotColorizedFrames();
1232+
12211233
while (true)
12221234
{
12231235
std::shared_lock<std::shared_mutex> sl(m_dmdSharedMutex);
@@ -1235,7 +1247,7 @@ void DMD::RGB24DMDThread()
12351247
{
12361248
bufferPosition = GetNextBufferQueuePosition(bufferPosition, updateBufferQueuePosition);
12371249

1238-
if (m_pSerum && !IsSerumMode(m_pUpdateBufferQueue[bufferPosition]->mode)) continue;
1250+
if (m_pSerum && !IsSerumMode(m_pUpdateBufferQueue[bufferPosition]->mode, showNotColorizedFrames)) continue;
12391251

12401252
if (!m_rgb24DMDs.empty() &&
12411253
(m_pUpdateBufferQueue[bufferPosition]->hasData || m_pUpdateBufferQueue[bufferPosition]->hasSegData))
@@ -1280,7 +1292,8 @@ void DMD::RGB24DMDThread()
12801292
m_pUpdateBufferQueue[bufferPosition]->r, m_pUpdateBufferQueue[bufferPosition]->g,
12811293
m_pUpdateBufferQueue[bufferPosition]->b);
12821294

1283-
if (!m_pSerum && m_pUpdateBufferQueue[bufferPosition]->mode == Mode::Data)
1295+
if ((!m_pSerum && m_pUpdateBufferQueue[bufferPosition]->mode == Mode::Data) ||
1296+
(showNotColorizedFrames && m_pUpdateBufferQueue[bufferPosition]->mode == Mode::NotColorized))
12841297
{
12851298
if (memcmp(renderBuffer, m_pUpdateBufferQueue[bufferPosition]->data, length) != 0)
12861299
{

0 commit comments

Comments
 (0)