Skip to content

Commit

Permalink
Merge branch 'main' into aa/update-submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
joiskash authored Oct 4, 2024
2 parents 6a8df58 + bdc49cc commit ebf33cb
Show file tree
Hide file tree
Showing 45 changed files with 3,602 additions and 1,890 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build-test-lin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ jobs:
uses: actions/checkout@v3
with:
submodules: 'recursive'
lfs: true
fetch-depth: 0

- name: List Submodules
Expand Down
64 changes: 38 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ A pipeline framework for developing video and image processing applications. Sup
Learn more about ApraPipes here https://apra-labs.github.io/ApraPipes.

## Build status
Aprapipes is automatically built and tested on Ubuntu (18.04 and 20.04), Jetson Boards (Jetpack 4.4) and Windows (11) x64 Visual Studio 2017 Community.
Aprapipes is automatically built and tested on Ubuntu (18.04 and 20.04), Jetson Boards (Jetpack 4.4) and Windows (11) x64 Visual Studio 2019 Community.
|OS|Version|With Cuda|Tests|Status|
|--|-------|---------|------|------|
|Windows|2019|No|[![Test Results](https://gist.githubusercontent.com/kumaakh/f80af234a4aabedc69af3ee197f66944/raw/badge_Windows.svg)](https://gist.githubusercontent.com/kumaakh/f80af234a4aabedc69af3ee197f66944/raw/badge_Windows.svg)|[![CI-Win-NoCUDA](https://github.com/Apra-Labs/ApraPipes/actions/workflows/CI-Win-NoCUDA.yml/badge.svg)](https://github.com/Apra-Labs/ApraPipes/actions/workflows/CI-Win-NoCUDA.yml)|
Expand Down Expand Up @@ -40,22 +40,24 @@ Aprapipes is automatically built and tested on Ubuntu (18.04 and 20.04), Jetson
<details>
<summary>Requirements</summary>

### Prerequisites

### Visual Studio
* Install Visual Studio 2019 Community
* Install Desktop development C++
* .NET Desktop development
* Universal Windows Development Platform

### Cuda
* Create an account on developer.nvidia.com if you're not already a member. Note : Otherwise the next step will show HTTP 404/403 error.
* Windows 10/11 : [Cuda Toolkit 10.2](https://developer.nvidia.com/cuda-10.2-download-archive?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exelocal) or [CUDA Toolkit 11.8](https://developer.nvidia.com/cuda-11-8-0-download-archive?target_os=Windows).

### Cudnn
* Download [Cudnn](https://developer.nvidia.com/rdp/cudnn-archive#a-collapse765-102) and extract files where cuda is installed. Note: Please be aware that this process requires some effort. Here are the necessary steps:
* Download the correct zip file matching your cuda version. _Do not download the exe/installer/deb package._
* Windows:
* Download [this file](https://developer.nvidia.com/compute/cudnn/secure/8.3.2/local_installers/10.2/cudnn-windows-x86_64-8.3.2.44_cuda10.2-archive.zip).

### Prerequisites
* Install Visual Studio 2019 Community
* Install Desktop development C++
* .NET Desktop development
* Universal Windows Development Platform

* Download the correct zip file matching your cuda version. _Do not download the exe/installer/deb package._
* Windows:
* Download [this file](https://developer.nvidia.com/compute/cudnn/secure/8.3.2/local_installers/10.2/cudnn-windows-x86_64-8.3.2.44_cuda10.2-archive.zip).

* Clone with submodules and LFS.
```
git clone --recursive https://github.com/Apra-Labs/ApraPipes.git
Expand All @@ -66,9 +68,9 @@ Aprapipes is automatically built and tested on Ubuntu (18.04 and 20.04), Jetson
<details>
<summary>Build</summary>

### Build Without Cuda
Open PowerShell as an administrator and execute the following commands

### Build Without Cuda
If your windows system does not have an NVIDIA GPU use this script
```
build_windows_no_cuda.bat
Expand All @@ -77,7 +79,10 @@ Aprapipes is automatically built and tested on Ubuntu (18.04 and 20.04), Jetson
```
build_windows_cuda.bat
```

### To Build With Documentation
```
build_windows_cuda.bat --build-doc
```
</details>

<details>
Expand Down Expand Up @@ -114,6 +119,8 @@ Aprapipes is automatically built and tested on Ubuntu (18.04 and 20.04), Jetson
<details>
<summary>Requirements</summary>

### Prerequisites

### Cuda
* Create an account on developer.nvidia.com if you're not already a member. Note : Otherwise the next step will show HTTP 404/403 error.
* Ubuntu 18.04/20.04:
Expand All @@ -125,7 +132,8 @@ Aprapipes is automatically built and tested on Ubuntu (18.04 and 20.04), Jetson
* Linux:
* Download [this file](https://developer.nvidia.com/compute/cudnn/secure/8.3.2/local_installers/10.2/cudnn-linux-x86_64-8.3.2.44_cuda10.2-archive.tar.xz)

### Prerequisites
* Clone with submodules and LFS.
```
git clone --recursive https://github.com/Apra-Labs/ApraPipes.git
```

Expand All @@ -141,11 +149,15 @@ Aprapipes is automatically built and tested on Ubuntu (18.04 and 20.04), Jetson
### Build Without Cuda
If your windows system does not have an NVIDIA GPU use this script
```
sudo ./build_linux_no_cuda.sh
./build_linux_no_cuda.sh
```
### Build With Cuda
```
sudo ./build_linux_cuda.sh
./build_linux_cuda.sh
```
### To Build With Documentation
```
./build_linux_cuda.sh --build-doc
```

Build can take ~2 hours depending on the machine configuration.
Expand Down Expand Up @@ -200,11 +212,14 @@ Aprapipes is automatically built and tested on Ubuntu (18.04 and 20.04), Jetson
```
chmod +x build_jetson.sh
```
* ApraPipes builds CUDA version on Jerson Boads.
* ApraPipes builds CUDA version on Jetson Boards.
```
sudo ./build_jetson.sh
./build_jetson.sh
```
* To Build With Documentation
```
./build_jetson.sh --build-doc
```
Build can take ~12 hours on Jetson Nano.
Note: Jetson build can also be done using Ubuntu 18.04 x86_64 Laptop via cross compilation.
</details>
Expand Down Expand Up @@ -290,13 +305,10 @@ This build will be fairly fast (~10 mins) as entire vcpkg cache comes down with
git submodule update --init --recursive
```
## Update Documentation
After making changes to the documentation located in the /docs/source folder, it's essential to regenerate the documentation by following the provided steps. Once regenerated, commit the new content to ensure the latest documentation is up-to-date.
To update documentation, refer to Documentation Guidelines in the [Contribution-Guidelines](https://github.com/Apra-Labs/ApraPipes/wiki/Contribution-Guidelines).

### To regenerate documentation
Run,
```
./build_documentation.sh
```
To build docs
apt-install get python-sphinx
pip install sphinx-rtd-theme
cd docs
make html
```
8 changes: 8 additions & 0 deletions base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ SET(CORE_FILES
src/MotionVectorExtractor.cpp
src/OverlayModule.cpp
src/OrderedCacheOfFiles.cpp
src/SimpleControlModule.cpp
src/APErrorObject.cpp
src/APHealthObject.cpp
)

SET(CORE_FILES_H
Expand Down Expand Up @@ -257,6 +260,10 @@ SET(CORE_FILES_H
include/OrderedCacheOfFiles.h
include/TestSignalGeneratorSrc.h
include/AbsControlModule.h
include/SimpleControlModule.h
include/APErrorObject.h
include/APCallback.h
include/APHealthObject.h
)

IF(ENABLE_WINDOWS)
Expand Down Expand Up @@ -620,6 +627,7 @@ SET(UT_FILES
test/overlaymodule_tests.cpp
test/testSignalGeneratorSrc_tests.cpp
test/audioToTextXform_tests.cpp
test/simpleControlModuleTests.cpp
${ARM64_UT_FILES}
${CUDA_UT_FILES}
)
Expand Down
1 change: 1 addition & 0 deletions base/include/AIPExceptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#define MP4_OCOF_INVALID_DUR 7823
#define MP4_UNEXPECTED_STATE 7824
#define MODULE_ENROLLMENT_FAILED 7825
#define CTRL_MODULE_INVALID_STATE 7826


#define AIPException_LOG_SEV(severity,type) for(std::ostringstream stream; Logger::getLogger()->push(severity, stream);) Logger::getLogger()->aipexceptionPre(stream, severity,type)
Expand Down
7 changes: 7 additions & 0 deletions base/include/APCallback.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once
#include "APErrorObject.h"
#include "APHealthObject.h"
#include <functional>

using APErrorCallback = std::function<void(const APErrorObject &)>;
using APHealthCallback = std::function<void(const APHealthObject &)>;
28 changes: 28 additions & 0 deletions base/include/APErrorObject.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#pragma once
#include <string>

class APErrorObject {
private:
int mErrorCode;
std::string mErrorMessage;
std::string mModuleName;
std::string mModuleId;
std::string mTimestamp;

std::string getCurrentTimestamp() const;

public:
APErrorObject(int errCode, const std::string &errorMsg);

int getErrorCode() const;
std::string getErrorMessage() const;
std::string getModuleName() const;
std::string getModuleId() const;
std::string getTimestamp() const;

void displayError() const;
void setErrorCode(int errCode);
void setErrorMessage(const std::string &errorMsg);
void setModuleName(const std::string &modName);
void setModuleId(const std::string &modId);
};
19 changes: 19 additions & 0 deletions base/include/APHealthObject.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#pragma once
#include <string>

class APHealthObject
{
private:
std::string mModuleId;
std::string mTimestamp;

std::string getCurrentTimestamp() const;

public:
APHealthObject(const std::string &modId);

std::string getModuleId() const;
std::string getTimestamp() const;

void setModuleId(const std::string &modId);
};
63 changes: 38 additions & 25 deletions base/include/AbsControlModule.h
Original file line number Diff line number Diff line change
@@ -1,40 +1,53 @@
#pragma once
#include "APCallback.h"
#include "Command.h"
#include "Module.h"
#include <map>

class PipeLine;
class AbsControlModuleProps : public ModuleProps {
public:
AbsControlModuleProps() {}
AbsControlModuleProps() {}
};

class AbsControlModule : public Module {
public:
AbsControlModule(AbsControlModuleProps _props);
~AbsControlModule();
bool init();
bool term();
std::string enrollModule(boost::shared_ptr<PipeLine> p, std::string role,
boost::shared_ptr<Module> module);
std::pair<bool, boost::shared_ptr<Module>> getModuleofRole(PipeLine p,
std::string role);
virtual void handleMp4MissingVideotrack(std::string previousVideoFile, std::string nextVideoFile) {}
virtual void handleMMQExport(Command cmd, bool priority = false) {}
virtual void handleMMQExportView(uint64_t startTS, uint64_t endTS = 9999999999999, bool playabckDirection = true, bool Mp4ReaderExport = false, bool priority = false) {}
virtual void handleSendMMQTSCmd(uint64_t mmqBeginTS, uint64_t mmqEndTS, bool priority = false) {}
virtual void handleLastGtkGLRenderTS(uint64_t latestGtkGlRenderTS, bool priority) {}
virtual void handleGoLive(bool goLive, bool priority) {}
virtual void handleDecoderSpeed(DecoderPlaybackSpeed cmd, bool priority) {}
boost::container::deque<boost::shared_ptr<Module>> pipelineModules;
std::map<std::string, boost::shared_ptr<Module>> moduleRoles;

AbsControlModule(AbsControlModuleProps _props);
~AbsControlModule();
bool init();
bool term();
bool enrollModule(std::string role, boost::shared_ptr<Module> module);
boost::shared_ptr<Module> getModuleofRole(std::string role);
std::string printStatus();
virtual void handleMp4MissingVideotrack(std::string previousVideoFile, std::string nextVideoFile) {}
virtual void handleMMQExport(Command cmd, bool priority = false) {}
virtual void handleMMQExportView(uint64_t startTS, uint64_t endTS = 9999999999999, bool playabckDirection = true, bool Mp4ReaderExport = false, bool priority = false) {}
virtual void handleSendMMQTSCmd(uint64_t mmqBeginTS, uint64_t mmqEndTS, bool priority = false) {}
virtual void handleLastGtkGLRenderTS(uint64_t latestGtkGlRenderTS, bool priority) {}
virtual void handleGoLive(bool goLive, bool priority) {}
virtual void handleDecoderSpeed(DecoderPlaybackSpeed cmd, bool priority) {}
// Note: weak pointers to avoid cyclic dependency and mem leaks
std::map<std::string, boost::weak_ptr<Module>> moduleRoles;
virtual void handleError(const APErrorObject &error) {}
virtual void handleHealthCallback(const APHealthObject& healthObj);
/**
* @brief Register external function to be triggered on every health callBack that control modules recieves from the modules.
* For eg. In SimpleControlModule, this extention is called at the end of handleHealthCallback function.
* @param function with signature void f(const APHealthObject*, unsigned short)
* @return nothing.
*/
void registerHealthCallbackExtention(
boost::function<void(const APHealthObject*, unsigned short)> callbackFunction);
protected:
bool process(frame_container &frames);
bool handleCommand(Command::CommandType type, frame_sp &frame);
bool handlePropsChange(frame_sp &frame);

bool process(frame_container& frames);
bool handleCommand(Command::CommandType type, frame_sp& frame);
bool handlePropsChange(frame_sp& frame);
virtual void sendEOS() {}
virtual void sendEOS(frame_sp& frame) {}
virtual void sendEOPFrame() {}
std::vector<std::string> serializeControlModule();
boost::function<void(const APHealthObject*, unsigned short)> healthCallbackExtention;
private:
class Detail;
boost::shared_ptr<Detail> mDetail;
class Detail;
boost::shared_ptr<Detail> mDetail;
};
1 change: 0 additions & 1 deletion base/include/BrightnessContrastControlXform.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class BrightnessContrastControl : public Module
bool validateInputPins();
bool validateOutputPins();
void addInputPin(framemetadata_sp &metadata, string &pinId);
void setProps(BrightnessContrastControl);
bool handlePropsChange(frame_sp &frame);

private:
Expand Down
8 changes: 6 additions & 2 deletions base/include/FramesMuxer.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,22 @@ class FramesMuxerProps : public ModuleProps
public:
enum Strategy {
ALL_OR_NONE,
MAX_DELAY_ANY
MAX_DELAY_ANY,
MAX_TIMESTAMP_DELAY
};

public:
FramesMuxerProps() : ModuleProps()
FramesMuxerProps() : ModuleProps()
{
maxTsDelayInMS = 16.67;
maxDelay = 30;
strategy = ALL_OR_NONE;
fIndexStrategyType = FIndexStrategy::FIndexStrategyType::NONE;
}

int maxDelay; // Difference between current frame and first frame in the queue
Strategy strategy;
double maxTsDelayInMS; // Max TimeStampDelay in Milli Seconds
};

class FramesMuxerStrategy;
Expand Down
Loading

0 comments on commit ebf33cb

Please sign in to comment.