Skip to content

Commit

Permalink
Merge pull request #1 from electronicarts/update-github
Browse files Browse the repository at this point in the history
Update to 1.1.0
  • Loading branch information
blamacaz authored Apr 21, 2024
2 parents 6adb17e + a0c05c4 commit fd3e09e
Show file tree
Hide file tree
Showing 47 changed files with 1,658 additions and 341 deletions.
26 changes: 21 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ option(BUILD_EXAMPLE_APP "Build Iris example console application" OFF)
option(EXPORT_IRIS "Export and install library" ON)
option(BUILD_SHARED_LIBS "Build iris as a shared library" OFF)
option(BUILD_COVERAGE "Builds code coverage target" OFF)
option(PROFILER "Enable profiling" OFF)

if (NOT UNIX)
if (BUILD_COVERAGE AND NOT UNIX)
set(BUILD_COVERAGE OFF)
message("Code coverage can only be built in Linux systems")
endif()
Expand All @@ -32,6 +33,7 @@ set(PUBLIC_HEADERS
"include/iris/Log.h"
"include/iris/Result.h"
"include/iris/TotalFlashIncidents.h"
"include/iris/ScopeProfiler.h"
)

source_group("Public header files" FILES ${PUBLIC_HEADERS})
Expand All @@ -44,14 +46,12 @@ set(SOURCE_FILES
"src/RedSaturation.h"
"src/RedSaturation.cpp"
"src/CDLuminance.cpp"
"src/TransitionEvaluator.cpp"
"src/Configuration.cpp"
"src/ConfigurationParams.h"
"src/Flash.h"
"src/RelativeLuminance.h"
"src/CDLuminance.h"
"src/FrameRgbConverter.h"
"src/TransitionEvaluator.h"
"src/FrameRgbConverter.h"
"src/FrameData.h"
"src/FlashDetection.h"
"src/FlashDetection.cpp"
Expand All @@ -60,12 +60,19 @@ set(SOURCE_FILES
"src/PatternDetection.h"
"src/PatternDetection.cpp"
"src/PhotosensitivityDetector.h"
"src/TransitionTracker.h"
"src/TransitionTrackerByFPS.h"
"src/TransitionTrackerByTime.h"
"src/TransitionTrackerByFPS.cpp"
"src/TransitionTrackerByTime.cpp"
"src/ScopeProfiler.cpp"
)

source_group("Source files" FILES ${SOURCE_FILES})

# Dependencies
find_package(OpenCV CONFIG REQUIRED)
find_package(FFMPEG REQUIRED)
add_subdirectory ("utils")

if(BUILD_SHARED_LIBS)
Expand Down Expand Up @@ -115,6 +122,7 @@ target_link_libraries(${PROJECT_NAME}
PUBLIC
utils
${OpenCV_LIBS}
${FFMPEG_LIBRARIES}
)

# ---------------------------------------------------------------------------------------
Expand All @@ -136,6 +144,14 @@ if(BUILD_TESTS)
add_subdirectory("test/AddressSanitizer.Tests")
endif()

# ---------------------------------------------------------------------------------------
# Profiler
# ---------------------------------------------------------------------------------------
if(PROFILER)
message("Profiler enabled")
target_compile_definitions(${PROJECT_NAME} PUBLIC -DPROFILING)
endif()

# ---------------------------------------------------------------------------------------
# Install
# ---------------------------------------------------------------------------------------
Expand Down Expand Up @@ -192,4 +208,4 @@ export(EXPORT "${PROJECT_NAME}Targets"
NAMESPACE ${namespace}::
)

endif()
endif()
9 changes: 6 additions & 3 deletions config/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,12 @@
"MaxDataStored": 10 //max stored frame data in memory until persistence
},

"TransitionEvaluator": {
"TransitionTracker": {
"MaxTransitions": 6, //max allowed transitions and max transitions to count for extended fail
"MinTransitions": 4, //amount of min transitions to add to extended fail count
"ExtendedFailSeconds": 4, //max seconds until the start of extended failure
"ExtendedFailWindow": 5 //seconds in extended fail count window
"ExtendedFailWindow": 5, //seconds in extended fail count window
"AnalyseByTime": false
},

"FlashDetection": {
Expand Down Expand Up @@ -559,7 +560,9 @@

"VideoAnalyser": {
"LuminanceType": "RELATIVE", //CD || RELATIVE
"PatternDetectionEnabled": false
"PatternDetectionEnabled": false,
"FrameResizeEnabled": false,
"ResizeFrameProportion": 0.2
},

"Logging": {
Expand Down
20 changes: 16 additions & 4 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,31 @@ target_include_directories(${PROJECT_NAME} PUBLIC
# Copy needed dll files into executable when building iris as dll
if(BUILD_SHARED_LIBS)
message("Copy dynamic libraries into IrisApp directory")
file(GLOB_RECURSE DLL_FILES ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin/*.dll)
file(COPY ${DLL_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
set(IRIS_DLL iris.dll)

if (CMAKE_BUILD_TYPE STREQUAL "Debug") # set DEBUG_POSTFIX
set(IRIS_DLL irisd.dll)
set(UTILS_DLL utilsd.dll)
file(GLOB_RECURSE DLL_DEBUG_FILES ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/bin/*.dll)
file(COPY ${DLL_DEBUG_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

else()
file(GLOB_RECURSE DLL_FILES ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin/*.dll)
file(COPY ${DLL_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
set(IRIS_DLL iris.dll)
set(UTILS_DLL utils.dll)
endif()

add_custom_command(TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_BINARY_DIR}/${IRIS_DLL}
${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Copying Iris DLL to build directory"
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_BINARY_DIR}/utils/${UTILS_DLL}
${CMAKE_CURRENT_BINARY_DIR}

COMMENT "Copying Iris and utils DLL to build directory"
)


endif()
9 changes: 6 additions & 3 deletions example/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,12 @@
"MaxDataStored": 10 //max stored frame data in memory until persistence
},

"TransitionEvaluator": {
"TransitionTracker": {
"MaxTransitions": 6, //max allowed transitions and max transitions to count for extended fail
"MinTransitions": 4, //amount of min transitions to add to extended fail count
"ExtendedFailSeconds": 4, //max seconds until the start of extended failure
"ExtendedFailWindow": 5 //seconds in extended fail count window
"ExtendedFailWindow": 5, //seconds in extended fail count window
"AnalyseByTime": false
},

"FlashDetection": {
Expand Down Expand Up @@ -558,7 +559,9 @@

"VideoAnalyser": {
"LuminanceType": "RELATIVE", //CD || RELATIVE
"PatternDetectionEnabled": false
"PatternDetectionEnabled": false,
"FrameResizeEnabled": false,
"ResizeFrameProportion": 0.2
},

"Logging": {
Expand Down
13 changes: 12 additions & 1 deletion example/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,18 @@ int main(int argc, char* argv[])
configuration.SetPatternDetectionStatus(false);
}
}
if (cmdOptionExists(argv, argv + argc, "-r"))
{
std::string resize = getCmdOption(argv, argv + argc, "-r");
if (resize == "true" || resize == "1")
{
configuration.SetFrameResizeEnabled(true);
}
else if (resize == "false" || resize == "0")
{
configuration.SetFrameResizeEnabled(false);
}
}

if (cmdOptionExists(argv, argv + argc, "-a"))
{
Expand All @@ -126,7 +138,6 @@ int main(int argc, char* argv[])
//Run video analysis
CreateResultsDir(configuration);


if (sourceVideo != nullptr) //Run specific video
{
iris::VideoAnalyser vA(&configuration);
Expand Down
18 changes: 14 additions & 4 deletions include/iris/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace EA::EACC::Utils
namespace iris
{
struct FlashParams;
struct TransitionEvaluatorParams;
struct TransitionTrackerParams;
struct PatternDetectionParams;
struct PatternAnalyserParams;
struct StraightLineDetectorParams;
Expand Down Expand Up @@ -42,11 +42,17 @@ namespace iris
inline FlashParams* GetRedSaturationFlashParams() { return m_redSaturationFlashParams; }
inline EA::EACC::Utils::FrameConverterParams* GetFrameSrgbConverterParams() { return m_frameSrgbConverterParams; }
inline EA::EACC::Utils::FrameConverterParams* GetFrameCDLuminanceConverterParams() { return m_frameCDLuminanceConverterParams; }
inline TransitionEvaluatorParams* GetTransitionEvaluatorParams() { return m_transitionEvaluatorParams; }
inline TransitionTrackerParams* GetTransitionTrackerParams() { return m_transitionTrackerParams; }
inline PatternDetectionParams* GetPatternDetectionParams() { return m_patternDetectionParams; }

inline bool PatternDetectionEnabled() { return m_patternDetectionEnabled; }
inline void SetPatternDetectionStatus(bool status) { m_patternDetectionEnabled = status; }

inline bool FrameResizeEnabled() { return m_frameResizeEnabled; }
inline void SetFrameResizeEnabled(bool status) { m_frameResizeEnabled = status; }

inline float GetFrameResizeProportion() { return m_frameResizeProportion; }
inline void SetFrameResizeProportion(float proportion) { m_frameResizeProportion = proportion; }

void SetSafeArea(float areaProportion);

Expand All @@ -58,11 +64,15 @@ namespace iris
FlashParams* m_redSaturationFlashParams = nullptr;
EA::EACC::Utils::FrameConverterParams* m_frameSrgbConverterParams = nullptr;
EA::EACC::Utils::FrameConverterParams* m_frameCDLuminanceConverterParams = nullptr;
TransitionEvaluatorParams* m_transitionEvaluatorParams = nullptr;
TransitionTrackerParams* m_transitionTrackerParams = nullptr;
PatternDetectionParams* m_patternDetectionParams = nullptr;

LuminanceType m_luminanceType = LuminanceType::UN_SET;
bool m_patternDetectionEnabled = true;
bool m_frameResizeEnabled = true;

float m_frameResizeProportion = 1;

std::string m_resultsPath;
};
}
}
34 changes: 17 additions & 17 deletions include/iris/FrameData.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace iris
public:

FrameData() {};
FrameData(int frame, long timeMs) : Frame(frame)
FrameData(unsigned int frame, unsigned long timeMs) : Frame(frame)
{
TimeStampMs = msToTimeSpan(timeMs);
};
Expand Down Expand Up @@ -108,7 +108,7 @@ namespace iris
/// <summary>
/// Frame index
/// </summary>
int Frame = 0;
unsigned int Frame = 0;

/// <summary>
/// frame timestamp in milliseconds
Expand All @@ -123,10 +123,10 @@ namespace iris
float AverageRedDiff = 0;
float AverageRedDiffAcc = 0;
float PatternRisk = 0;
int LuminanceTransitions = 0;
int RedTransitions = 0;
int LuminanceExtendedFailCount = 0;
int RedExtendedFailCount = 0;
unsigned int LuminanceTransitions = 0;
unsigned int RedTransitions = 0;
unsigned int LuminanceExtendedFailCount = 0;
unsigned int RedExtendedFailCount = 0;
FlashResult luminanceFrameResult = FlashResult::Pass;
FlashResult redFrameResult = FlashResult::Pass;
std::string patternArea = "0.00%";
Expand Down Expand Up @@ -161,7 +161,7 @@ namespace iris

struct FrameDataJson
{
void reserve(const int& size)
void reserve(const unsigned int& size)
{
frame.reserve(size);
timeStampMs.reserve(size);
Expand Down Expand Up @@ -190,7 +190,7 @@ namespace iris

}

void reserveLineGraphData(const int& size)
void reserveLineGraphData(const unsigned int& size)
{
timeStampMs.reserve(size);
luminanceTransitions.reserve(size);
Expand Down Expand Up @@ -238,25 +238,25 @@ namespace iris
patternFrameResult.push_back((int)data.patternFrameResult);
}

std::vector<int> frame;
std::vector<unsigned int> frame;
std::vector<std::string> timeStampMs;
std::vector<std::string> luminanceFlashArea;
std::vector<float> luminanceAverage;
std::vector<float> averageLuminanceDiff;
std::vector<float> averageLuminanceDiffAcc;
std::vector <std::string> redFlashArea;
std::vector < std::string> redFlashArea;
std::vector<float> redAverage;
std::vector<float> averageRedDiff;
std::vector<float> averageRedDiffAcc;
std::vector<int> luminanceTransitions;
std::vector<int> redTransitions;
std::vector<int> luminanceExtendedFailCount;
std::vector<int> redExtendedFailCount;
std::vector<short> luminanceFrameResult;
std::vector<short> redFrameResult;
std::vector<unsigned int> luminanceTransitions;
std::vector<unsigned int> redTransitions;
std::vector<unsigned int> luminanceExtendedFailCount;
std::vector<unsigned int> redExtendedFailCount;
std::vector<unsigned short> luminanceFrameResult;
std::vector<unsigned short> redFrameResult;
std::vector<std::string> patternArea;
std::vector<int> patternDetectedLines;
std::vector<short> patternFrameResult;
std::vector<unsigned short> patternFrameResult;
};

//Serializes FrameData to Json object
Expand Down
8 changes: 4 additions & 4 deletions include/iris/Result.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ namespace iris

struct Result
{
int VideoLen = 0;
int AnalysisTime = 0;
int TotalFrame = 0;
int patternFailFrames = 0;
float VideoLen = 0;
unsigned int AnalysisTime = 0;
unsigned int TotalFrame = 0;
AnalysisResult OverallResult = AnalysisResult::Pass;
std::vector<AnalysisResult> Results;
//total amount of frames that were counted that belonged to each incident type
TotalFlashIncidents totalLuminanceIncidents;
TotalFlashIncidents totalRedIncidents;
unsigned int patternFailFrames = 0;
};


Expand Down
Loading

0 comments on commit fd3e09e

Please sign in to comment.