Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Affine transform module - support DMA/CUDA via NPPI and HOST via open cv #227

Merged
merged 57 commits into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
87f2a83
intial commit
venkat0907 May 4, 2023
6204931
refactoring
venkat0907 May 4, 2023
63dc041
added startegy for to support DMA
venkat0907 May 11, 2023
b82e0cb
refactoring
venkat0907 May 11, 2023
b719010
supports both DMA and CUDA
venkat0907 May 12, 2023
4508f42
refactoring
venkat0907 May 12, 2023
3b1087e
removed one build error
venkat0907 May 12, 2023
d21da65
refactoring
venkat0907 May 15, 2023
03167d0
refactoring
venkat0907 May 16, 2023
8d8e86a
removed the if else of raw image
venkat0907 May 16, 2023
da2a2be
refactoring
venkat0907 May 16, 2023
9729373
setting moutputMetadata on memtype
venkat0907 May 17, 2023
38127a8
integrated host
venkat0907 May 26, 2023
b124a7f
refactoring
venkat0907 May 30, 2023
65f9488
refactoring
venkat0907 May 30, 2023
01c89ef
changed matrix for host
venkat0907 May 30, 2023
29beb6b
added ouput images and modified strategy
venkat0907 May 30, 2023
d04ddf4
refactoring
venkat0907 May 30, 2023
d64d4f1
added GetsetProps
venkat0907 Jun 1, 2023
dac2232
refactoring
venkat0907 Jun 1, 2023
05582e8
refactoring
venkat0907 Jun 2, 2023
387e01b
refactoring
venkat0907 Jun 2, 2023
70739ef
refactoring
venkat0907 Jun 2, 2023
60280b0
added setmetadatahelper in DetailGPU
venkat0907 Jun 2, 2023
7fc1afd
changed camke from cuda to generic
venkat0907 Jun 5, 2023
709e0f6
refactoring
venkat0907 Jun 5, 2023
30c31a3
refactoring
venkat0907 Jun 6, 2023
ca21b9b
refactoring
venkat0907 Jun 6, 2023
300de84
added ifdef condition
venkat0907 Jun 6, 2023
9b243c8
refactoring
venkat0907 Jun 6, 2023
6e54b27
refactoring
venkat0907 Jun 6, 2023
c8ecbef
refactoring
venkat0907 Jun 6, 2023
3938373
diable few tests
venkat0907 Jun 6, 2023
b2d8562
added ifdef in tests
venkat0907 Jun 6, 2023
e07cd48
added DMA test
Jun 9, 2023
cb85de7
intial commit
venkat0907 May 4, 2023
a22fdba
supports both DMA and CUDA
venkat0907 May 12, 2023
4b2c87b
refactoring
venkat0907 May 16, 2023
333a966
setting moutputMetadata on memtype
venkat0907 May 17, 2023
694f484
integrated host
venkat0907 May 26, 2023
5748152
added ouput images and modified strategy
venkat0907 May 30, 2023
6bc5652
added GetsetProps
venkat0907 Jun 1, 2023
19835e8
refactoring
venkat0907 Jun 1, 2023
f786e53
refactoring
venkat0907 Jun 2, 2023
e57c5e8
changed camke from cuda to generic
venkat0907 Jun 5, 2023
ddbaccc
refactoring
venkat0907 Jun 5, 2023
7ca0246
refactoring
venkat0907 Jun 6, 2023
031ae84
refactoring
venkat0907 Jun 6, 2023
6a592fc
refactoring
venkat0907 Jun 6, 2023
a6a66d4
diable few tests
venkat0907 Jun 6, 2023
8e12e20
added DMA test
Jun 9, 2023
05d862c
resolved cmake list merge conflict
venkat0907 Jul 18, 2023
08297ed
Merge branch 'main' into AffineTransformNPPI
mraduldubey Jul 19, 2023
3e99303
Merge branch 'main' into AffineTransformNPPI
mraduldubey Jul 19, 2023
08e9382
resolved conflicts
venkat0907 Jul 20, 2023
f534108
changed Detail to DetailMemoryAbstract
venkat0907 Jul 20, 2023
1e84736
Merge branch 'main' into AffineTransformNPPI
mraduldubey Jul 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ SET(IP_FILES
src/FacialLandmarksCV.cpp
src/ImageEncoderCV.cpp
src/RotateCV.cpp
src/AffineTransform.cpp
src/BrightnessContrastControlXform.cpp
src/VirtualPTZ.cpp
src/WebCamSource.cpp
Expand Down Expand Up @@ -293,6 +294,7 @@ SET(IP_FILES_H
include/FacialLandmarksCV.h
include/ImageEncoderCV.h
include/RotateCV.h
include/AffineTransform.h
include/BrightnessContrastControlXform.h
include/VirtualPTZ.h
include/WebCamSource.h
Expand Down Expand Up @@ -526,6 +528,7 @@ SET(UT_FILES
test/faciallandmarkscv_tests.cpp
test/ImageEncodeCV_tests.cpp
test/rotatecv_tests.cpp
test/affinetransform_tests.cpp
test/brightness_contrast_tests.cpp
test/virtualptz_tests.cpp
test/webcam_source_tests.cpp
Expand Down
115 changes: 115 additions & 0 deletions base/include/AffineTransform.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
#pragma once

#include "Module.h"
#ifdef APRA_CUDA_ENABLED
#include "CudaCommon.h"
#endif

class DetailMemoryAbstract;
class DeatilCUDA;
class DetailDMA;
class DetailHost;
class DetailGPU;

class AffineTransformProps : public ModuleProps
{
public:
enum Interpolation {
mraduldubey marked this conversation as resolved.
Show resolved Hide resolved
NN = 0,
LINEAR,
CUBIC,
UNDEFINED,
CUBIC2P_BSPLINE,
CUBIC2P_CATMULLROM,
CUBIC2P_B05C03,
SUPER,
LANCZOS,
LANCZOS3_ADVANCED
};

enum TransformType
{
USING_OPENCV = 0,
USING_NPPI
};

AffineTransformProps(TransformType _type, double _angle, int _x = 0, int _y = 0, double _scale = 1.0)
{
if (_type != TransformType::USING_OPENCV)
{
throw AIPException(AIP_FATAL, "This constructor only supports Opencv");
}
angle = _angle;
x = _x;
y = _y;
scale = _scale;
type = _type;
}
#ifdef APRA_CUDA_ENABLED
AffineTransformProps(TransformType _type, Interpolation _interpolation, cudastream_sp &_stream, double _angle, int _x=0, int _y=0, double _scale = 1.0)
{
if (_type != TransformType::USING_NPPI)
{
throw AIPException(AIP_FATAL, "This constructor only supports using NPPI");
}
stream = _stream;
angle = _angle;
x = _x;
y = _y;
scale = _scale;
interpolation = _interpolation;
type = _type;
}
#endif

int x = 0;
int y = 0;
double scale = 1.0;
double angle;
#ifdef APRA_CUDA_ENABLED
cudastream_sp stream;
#endif
Interpolation interpolation = AffineTransformProps::NN;
TransformType type;

size_t getSerializeSize()
{
return ModuleProps::getSerializeSize() + sizeof(int) * 2 + sizeof(double) + sizeof(float) + sizeof(interpolation) + sizeof(type);
}

private:
friend class boost::serialization::access;

template <class Archive>
void serialize(Archive &ar, const unsigned int version)
{
ar &boost::serialization::base_object<ModuleProps>(*this);
ar &angle &x &y &scale ;
ar& interpolation;
ar& type;
}
};

class AffineTransform : public Module
{

public:
AffineTransform(AffineTransformProps props);
virtual ~AffineTransform();
bool init();
bool term();
void setProps(AffineTransformProps &props);
AffineTransformProps getProps();

protected:
bool process(frame_container &frames);
bool processSOS(frame_sp &frame);
bool validateInputPins();
bool validateOutputPins();
void addInputPin(framemetadata_sp &metadata, string &pinId); // throws exception if validation fails
bool shouldTriggerSOS();
bool processEOS(string &pinId);
AffineTransformProps mProp;
bool handlePropsChange(frame_sp& frame);
boost::shared_ptr<DetailMemoryAbstract> mDetail;
};
Loading
Loading