Skip to content
Open
43 changes: 23 additions & 20 deletions base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ find_package(LibLZMA REQUIRED)
find_package(FFMPEG REQUIRED)
find_package(ZXing CONFIG REQUIRED)
find_package(bigint CONFIG REQUIRED)
find_package(SFML COMPONENTS system window audio graphics CONFIG REQUIRED)
find_package(SFML COMPONENTS System Window Audio Graphics CONFIG REQUIRED)
find_package(whisper CONFIG REQUIRED)


Expand Down Expand Up @@ -188,15 +188,15 @@ SET(CORE_FILES
src/Split.cpp
src/Utils.cpp
src/FIndexStrategy.cpp
src/AudioCaptureSrc.cpp
#src/AudioCaptureSrc.cpp
src/QRReader.cpp
src/Mp4WriterSink.cpp
#src/Mp4WriterSink.cpp
src/Mp4WriterSinkUtils.cpp
src/MultimediaQueueXform.cpp
src/Mp4ReaderSource.cpp
src/RTSPClientSrc.cpp
src/RTSPClientSrc.cpp
src/MotionVectorExtractor.cpp
#src/MotionVectorExtractor.cpp
src/OverlayModule.cpp
src/OrderedCacheOfFiles.cpp
src/SimpleControlModule.cpp
Expand Down Expand Up @@ -409,24 +409,24 @@ SET(CUDA_IP_FILES

IF(ENABLE_ARM64)
SET(CUDA_IP_FILES ${CUDA_IP_FILES}
# src/JPEGDecoderL4TM.cpp
# src/JPEGDecoderL4TMHelper.cpp
src/JPEGDecoderL4TM.cpp
src/JPEGDecoderL4TMHelper.cpp
src/JPEGEncoderL4TM.cpp
src/JPEGEncoderL4TMHelper.cpp
src/AV4L2Buffer.cpp
src/AV4L2ElementPlane.cpp
# src/H264EncoderV4L2Helper.cpp
# src/V4L2CUYUV420Converter.cpp
# src/H264EncoderV4L2.cpp
src/H264EncoderV4L2Helper.cpp
src/V4L2CUYUV420Converter.cpp
src/H264EncoderV4L2.cpp
src/DMAFDWrapper.cpp
# src/NvArgusCameraHelper.cpp
# src/NvArgusCamera.cpp
src/NvArgusCameraHelper.cpp
src/NvArgusCamera.cpp
# src/NvV4L2Camera.cpp
# src/NvV4L2CameraHelper.cpp
# src/EglRenderer.cpp
# src/NvEglRenderer.cpp
src/DMAUtils.cpp
# src/NvTransform.cpp
src/NvTransform.cpp
src/ApraEGLDisplay.cpp
src/DMAFDToHostCopy.cpp
src/H264DecoderV4L2Helper.cpp
Expand Down Expand Up @@ -531,16 +531,16 @@ target_include_directories ( aprapipes PRIVATE

IF (ENABLE_ARM64)
SET(ARM64_UT_FILES
# test/jpegencoderl4tm_tests.cpp
# test/jpegdecoderl4tm_tests.cpp
test/jpegencoderl4tm_tests.cpp
test/jpegdecoderl4tm_tests.cpp
# test/l4tm_dec_enc_1_tests.cpp #todo this test needs to be improved to add to jetson suite
# test/opencvresize_tests.cpp
#test/opencvresize_tests.cpp
# test/h264encoderv4l2_tests.cpp
# test/nvarguscamerahelper_tests.cpp
# test/nvarguscamera_tests.cpp
#test/nvarguscamerahelper_tests.cpp
test/nvarguscamera_tests.cpp
# test/nvv4l2camera_test.cpp
# test/nvv4l2camerahelper_test.cpp
# test/nvtransform_tests.cpp
test/nvtransform_tests.cpp
# test/eglrenderer_test.cpp
# test/cuda_arm_tests.cpp
# test/apraegldisplay_tests.cpp
Expand Down Expand Up @@ -577,7 +577,7 @@ ENDIF(ENABLE_CUDA)
SET(UT_FILES
test/utmain.cpp
test/unit_tests.cpp
test/cv_memory_leaks_tests.cpp
#test/cv_memory_leaks_tests.cpp--
test/module_tests.cpp
# test/calchistogramcv_tests.cpp
# test/filenamestrategy_tests.cpp
Expand Down Expand Up @@ -692,7 +692,10 @@ target_link_libraries(aprapipesut
ZLIB::ZLIB
LibLZMA::LibLZMA
bigint::bigint
sfml-audio
SFML::Audio
SFML::System
SFML::Window
SFML::Graphics
whisper::whisper
/usr/lib/aarch64-linux-gnu/libEGL.so.1.1.0

Expand Down
1 change: 1 addition & 0 deletions base/include/DMAFrameUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class DMAFrameUtils
{
width[i] = rawMetadata->getWidth(i);
height[i] = rawMetadata->getHeight(i);
pitch[i]=rawMetadata->getStep(i);
}
auto metadata = framemetadata_sp(new RawImagePlanarMetadata(width[0], height[0], imageType, size_t(0), CV_8U, FrameMetadata::MemType::DMABUF));
DMAAllocator::setMetadata(metadata, width[0], height[0], imageType, pitch, offset);
Expand Down
25 changes: 19 additions & 6 deletions base/include/DMAUtils.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
#pragma once


#include "EGL/egl.h"
#include "cudaEGL.h"

#include <nvbufsurface.h> // Include the new header for NvBufSurface

class Frame;
class DMAUtils {
public:
static uint8_t* getCudaPtrForFD(int fd, EGLImageKHR eglImage, CUgraphicsResource *pResource, CUeglFrame eglFrame, EGLDisplay eglDisplay);
static uint8_t* getCudaPtr(EGLImageKHR eglImage, CUgraphicsResource *pResource, CUeglFrame eglFrame, EGLDisplay eglDisplay);
static void freeCudaPtr(EGLImageKHR eglImage, CUgraphicsResource *pResource, EGLDisplay eglDisplay);
};
/**
* @brief Registers an EGLImage as a CUDA resource and maps it to a CUeglFrame.
* @param eglImage The EGL image handle.
* @param pResource Pointer to the CUgraphicsResource handle.
* @param pEglFrame Pointer to the CUeglFrame structure to fill.
* @return A pointer to the CUDA mapped buffer, or nullptr on failure.
*/
static uint8_t* getCudaPtr(EGLImageKHR eglImage, CUgraphicsResource *pResource, CUeglFrame *pEglFrame);

/**
* @brief Unregisters a CUDA resource, unmaps the EGLImage, and destroys the NvBufSurface.
* @param eglImage The EGL image handle (no longer needed, but kept for legacy reference).
* @param pResource Pointer to the CUgraphicsResource handle.
* @param surf Pointer to the NvBufSurface.
* @param eglDisplay The EGL display handle.
*/
static void freeCudaPtr(EGLImageKHR eglImage, CUgraphicsResource *pResource, NvBufSurface *surf, EGLDisplay eglDisplay);
};
3 changes: 2 additions & 1 deletion base/include/JPEGDecoderL4TM.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ class JPEGDecoderL4TMProps : public ModuleProps
public:
JPEGDecoderL4TMProps() : ModuleProps()
{

decodeToFd=false;
}
bool decodeToFd;
};

class JPEGDecoderL4TM : public Module
Expand Down
1 change: 1 addition & 0 deletions base/include/JPEGDecoderL4TMHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class JPEGDecoderL4TMHelper

bool init(const unsigned char* in_buf, unsigned long in_buf_size, int& width, int& height);
int decode(const unsigned char* in_buf, unsigned long in_buf_size, unsigned char *out_buf);
int decodeToFd(int &fd, unsigned char * in_buf,unsigned long in_buf_size);

private:

Expand Down
10 changes: 10 additions & 0 deletions base/include/JPEGEncoderL4TMHelper.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#ifndef __NV_JPEG_ENCODER_H__
#define __NV_JPEG_ENCODER_H__
#ifndef TEGRA_ACCELERATE
/**
* @c TEGRA_ACCELERATE must be defined to enable hardware acceleration of
* JPEG encoding.
*/
#define TEGRA_ACCELERATE
#endif

#include <stdint.h>
#include <stdio.h>
Expand All @@ -13,6 +20,9 @@ class JPEGEncoderL4TMHelper

bool init(uint32_t width, uint32_t height, uint32_t stride, J_COLOR_SPACE color_space, double scale);
int encode(const unsigned char* in_buf, unsigned char **out_buf, unsigned long &out_buf_size);
int encodeFromFd(int fd, J_COLOR_SPACE color_space,
unsigned char **out_buf, unsigned long &out_buf_size,
int quality);

private:
struct jpeg_compress_struct cinfo;
Expand Down
Loading