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 #51

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ IF(ENABLE_ARM64)
src/NvTransform.cpp
src/ApraEGLDisplay.cpp
src/DMAFDToHostCopy.cpp
src/AffineTransform.cpp
)
ELSE()
SET(CUDA_IP_FILES ${CUDA_IP_FILES}
Expand All @@ -316,7 +317,7 @@ SET(CUDA_IP_FILES_H
IF(ENABLE_ARM64)
SET(CUDA_IP_FILES_H ${CUDA_IP_FILES_H}
include/JPEGDecoderL4TMHelper.h
include/JPEGDecoderL4TM.h
include/JPEGDecoderL4TM.h
include/JPEGEncoderL4TMHelper.h
include/JPEGEncoderL4TM.h
include/AV4L2Buffer.h
Expand All @@ -338,6 +339,7 @@ IF(ENABLE_ARM64)
include/ApraEGLDisplay.h
include/DMAFrameUtils.h
include/DMAFDToHostCopy.h
include/AffineTransform.h
)
ELSE()
SET(CUDA_IP_FILES_H ${CUDA_IP_FILES_H}
Expand Down
64 changes: 64 additions & 0 deletions base/include/AffineTransform.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#pragma once

#include "Module.h"
#include "CudaCommon.h"

class AffineTransformProps : public ModuleProps
{
public:
AffineTransformProps(cudastream_sp &_stream, double _angle, int _x=0, int _y=0, float _scale=1.0f)
{
stream = _stream;
angle = _angle;
x = _x;
y = _y;
scale = _scale;
}

int x=0;
int y = 0;
float scale = 1.0f;
Comment on lines +18 to +20
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No hard coding values. Pleas remove from function definition also

double angle;
cudastream_sp stream;
size_t getSerializeSize()
{
return ModuleProps::getSerializeSize() + sizeof(int) * 2 + sizeof(double) + sizeof(float) ;
}

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 ;
}
};

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);
void setProps(AffineTransform);
bool handlePropsChange(frame_sp &frame);

private:
class Detail;
boost::shared_ptr<Detail> mDetail;
};
Loading