Integrate CAN-aware CMS risk pipeline and relocatable Orin runtime
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
#include "common.hpp"
|
||||
#include <npp.h>
|
||||
#include <opencv2/core.hpp>
|
||||
namespace cms {
|
||||
inline void nppCheck(NppStatus status) {if(status<0)throw std::runtime_error("NPP error "+std::to_string(int(status)));}
|
||||
inline NppStreamContext nppContext(cudaStream_t stream) {
|
||||
NppStreamContext c{};c.hStream=stream;CUDA_CHECK(cudaGetDevice(&c.nCudaDeviceId));cudaDeviceProp p{};CUDA_CHECK(cudaGetDeviceProperties(&p,c.nCudaDeviceId));
|
||||
c.nMultiProcessorCount=p.multiProcessorCount;c.nMaxThreadsPerMultiProcessor=p.maxThreadsPerMultiProcessor;c.nMaxThreadsPerBlock=p.maxThreadsPerBlock;c.nSharedMemPerBlock=p.sharedMemPerBlock;c.nCudaDevAttrComputeCapabilityMajor=p.major;c.nCudaDevAttrComputeCapabilityMinor=p.minor;CUDA_CHECK(cudaStreamGetFlags(stream,&c.nStreamFlags));return c;
|
||||
}
|
||||
class YoloPreprocess {
|
||||
public:
|
||||
YoloPreprocess(int width,int height):width_(width),height_(height) {CUDA_CHECK(cudaMalloc(&letter_,size_t(width)*height*3));}
|
||||
~YoloPreprocess(){cudaFree(source_);cudaFree(letter_);}
|
||||
void enqueue(cv::Mat const& frame,float* destination,cudaStream_t stream);
|
||||
private:
|
||||
int width_,height_;size_t capacity_{};unsigned char *source_{},*letter_{};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user