Skip to content

Commit

Permalink
Merge pull request mipops#864 from MediaArea/signalstats
Browse files Browse the repository at this point in the history
DeckLink Input: Add frame saturation statistics
  • Loading branch information
JeromeMartinez authored Jun 17, 2024
2 parents 7a610ef + 3271ed3 commit c43c820
Show file tree
Hide file tree
Showing 18 changed files with 557 additions and 64 deletions.
9 changes: 6 additions & 3 deletions Project/GNU/CLI/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,17 @@ if BUILD_AVFCTL
endif

if BUILD_DECKLINK
dvrescue_SOURCES += ../../../Source/Common/DecklinkWrapper.cpp
dvrescue_SOURCES += ../../../Source/Common/DecklinkWrapper.cpp \
../../../Source/Common/Output_Mkv.cpp \
../../../Source/Common/SignalStats.cpp
endif

if BUILD_DECKLINK
dvrescue_SOURCES += ../../../Source/Common/Output_Mkv.cpp

else
if BUILD_SIMULATOR
dvrescue_SOURCES += ../../../Source/Common/Output_Mkv.cpp
dvrescue_SOURCES += ../../../Source/Common/Output_Mkv.cpp \
../../../Source/Common/SignalStats.cpp
endif
endif

Expand Down
2 changes: 2 additions & 0 deletions Project/MSVC2017/CLI/DVRescue.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
<ClCompile Include="..\..\..\Source\Common\Output_Webvtt.cpp" />
<ClCompile Include="..\..\..\Source\Common\Output_Xml.cpp" />
<ClCompile Include="..\..\..\Source\Common\Output_Mkv.cpp" />
<ClCompile Include="..\..\..\Source\Common\SignalStats.cpp" />
<ClCompile Include="..\..\..\Source\Common\ProcessFile.cpp" />
<ClCompile Include="..\..\..\Source\Common\ProcessFileWrapper.cpp" />
<ClCompile Include="..\..\..\Source\Common\SimulatorWrapper.cpp" />
Expand All @@ -184,6 +185,7 @@
<ClInclude Include="..\..\..\Source\Common\Output_Webvtt.h" />
<ClInclude Include="..\..\..\Source\Common\Output_Xml.h" />
<ClInclude Include="..\..\..\Source\Common\Output_Mkv.h" />
<ClInclude Include="..\..\..\Source\Common\SignalStats.h" />
<ClInclude Include="..\..\..\Source\Common\ProcessFile.h" />
<ClInclude Include="..\..\..\Source\Common\ProcessFileWrapper.h" />
<ClInclude Include="..\..\..\Source\Common\SimulatorWrapper.h" />
Expand Down
2 changes: 2 additions & 0 deletions Project/MSVC2019/CLI/DVRescue.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@
<ClCompile Include="..\..\..\Source\Common\Output_Webvtt.cpp" />
<ClCompile Include="..\..\..\Source\Common\Output_Xml.cpp" />
<ClCompile Include="..\..\..\Source\Common\Output_Mkv.cpp" />
<ClCompile Include="..\..\..\Source\Common\SignalStats.cpp" />
<ClCompile Include="..\..\..\Source\Common\ProcessFile.cpp" />
<ClCompile Include="..\..\..\Source\Common\ProcessFileWrapper.cpp" />
<ClCompile Include="..\..\..\Source\Common\SimulatorWrapper.cpp" />
Expand All @@ -185,6 +186,7 @@
<ClInclude Include="..\..\..\Source\Common\Output_Webvtt.h" />
<ClInclude Include="..\..\..\Source\Common\Output_Xml.h" />
<ClInclude Include="..\..\..\Source\Common\Output_Mkv.h" />
<ClInclude Include="..\..\..\Source\Common\SignalStats.h" />
<ClInclude Include="..\..\..\Source\Common\ProcessFile.h" />
<ClInclude Include="..\..\..\Source\Common\ProcessFileWrapper.h" />
<ClInclude Include="..\..\..\Source\Common\SimulatorWrapper.h" />
Expand Down
2 changes: 2 additions & 0 deletions Project/MSVC2022/CLI/DVRescue.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@
<ClCompile Include="..\..\..\Source\Common\Output_Webvtt.cpp" />
<ClCompile Include="..\..\..\Source\Common\Output_Xml.cpp" />
<ClCompile Include="..\..\..\Source\Common\Output_Mkv.cpp" />
<ClCompile Include="..\..\..\Source\Common\SignalStats.cpp" />
<ClCompile Include="..\..\..\Source\Common\ProcessFile.cpp" />
<ClCompile Include="..\..\..\Source\Common\ProcessFileWrapper.cpp" />
<ClCompile Include="..\..\..\Source\Common\SimulatorWrapper.cpp" />
Expand All @@ -185,6 +186,7 @@
<ClInclude Include="..\..\..\Source\Common\Output_Webvtt.h" />
<ClInclude Include="..\..\..\Source\Common\Output_Xml.h" />
<ClInclude Include="..\..\..\Source\Common\Output_Mkv.h" />
<ClInclude Include="..\..\..\Source\Common\SignalStats.h" />
<ClInclude Include="..\..\..\Source\Common\ProcessFile.h" />
<ClInclude Include="..\..\..\Source\Common\ProcessFileWrapper.h" />
<ClInclude Include="..\..\..\Source\Common\SimulatorWrapper.h" />
Expand Down
28 changes: 28 additions & 0 deletions Source/Common/DecklinkWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@ static uint32_t decklink_audio_sources[Decklink_Audio_Source_Max] =
bmdAudioConnectionMicrophone
};

//---------------------------------------------------------------------------
static uint32_t decklink_pixel_formats[Decklink_Pixel_Format_Max] =
{
bmdFormatUnspecified,
bmdFormat8BitYUV,
bmdFormat10BitYUV,
bmdFormat8BitARGB,
bmdFormat8BitBGRA,
bmdFormat10BitRGB
};

//---------------------------------------------------------------------------
static uint32_t decklink_timecode_formats[Decklink_Timecode_Format_Max] =
{
Expand Down Expand Up @@ -129,9 +140,26 @@ HRESULT DecklinkWrapper::CaptureDelegate::VideoInputFrameArrived(IDeckLinkVideoI
}
}

uint8_t PixelFormat = (uint8_t)Decklink_Pixel_Format_Unspecified;
switch (VideoFrame->GetPixelFormat())
{
case bmdFormat8BitYUV:
PixelFormat = (uint8_t)Decklink_Pixel_Format_8BitYUV; break;
case bmdFormat10BitYUV:
PixelFormat = (uint8_t)Decklink_Pixel_Format_10BitYUV; break;
case bmdFormat8BitARGB:
PixelFormat = (uint8_t)Decklink_Pixel_Format_8BitARGB; break;
case bmdFormat8BitBGRA:
PixelFormat = (uint8_t)Decklink_Pixel_Format_8BitBGRA; break;
case bmdFormat10BitRGB:
PixelFormat = (uint8_t)Decklink_Pixel_Format_10BitRGB; break;
default:;
}

decklink_frame Buffer = {
.Width = (uint32_t)VideoFrame->GetWidth(),
.Height = (uint32_t)VideoFrame->GetHeight(),
.Pixel_Format = PixelFormat,
.Video_Buffer = (uint8_t*)VideoBuffer,
.Video_Buffer_Size = VideoBufferSize,
.Audio_Buffer = (uint8_t*)AudioBuffer,
Expand Down
1 change: 1 addition & 0 deletions Source/Common/Merge.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ extern const char* Control_Port;
extern uint8_t DeckLinkVideoMode;
extern uint8_t DeckLinkVideoSource;
extern uint8_t DeckLinkAudioSource;
extern uint8_t DeckLinkPixelFormat;
extern uint8_t DeckLinkTimecodeFormat;
#endif
extern size_t Merge_Rewind_Count;
Expand Down
Loading

0 comments on commit c43c820

Please sign in to comment.