v0.7.1.0 Release

v0.7.1.0 Release
This commit is contained in:
jdsouza90
2022-09-20 10:00:17 -07:00
parent 7f69da2ee4
commit 3058988f6f
39 changed files with 2128 additions and 395 deletions

View File

@@ -217,16 +217,16 @@ NvCV_Status BatchProcess(const char* effectName, const std::vector<const char*>&
App app;
cv::Mat ocv1, ocv2;
NvCVImage nvx1, nvx2;
unsigned srcWidth, srcHeight, dstHeight, i;
unsigned srcWidth, srcHeight, dstHeight;
void** arrayOfStates = nullptr;
void** batchOfStates = nullptr;
unsigned int stateSizeInBytes;
int numOfVideoStreams = srcVideos.size();
unsigned int numOfVideoStreams = static_cast<unsigned int>(srcVideos.size());
std::vector<cv::VideoCapture> srcCaptures(numOfVideoStreams);
std::vector<cv::VideoWriter> dstWriters(numOfVideoStreams);
for (int i = 0; i < numOfVideoStreams; i++) {
for (unsigned int i = 0; i < numOfVideoStreams; i++) {
srcCaptures[i].open(srcVideos[i]);
if (srcCaptures[i].isOpened()==false) BAIL(err, NVCV_ERR_READ);
@@ -260,7 +260,7 @@ NvCV_Status BatchProcess(const char* effectName, const std::vector<const char*>&
// Creating state objects, one per stream.
BAIL_IF_ERR(err = NvVFX_GetU32(app._eff, NVVFX_STATE_SIZE, &stateSizeInBytes));
arrayOfStates = (void**)calloc(numOfVideoStreams, sizeof(void*)); // allocating void* array of numOfVideoStreams elements
for (int i = 0; i < numOfVideoStreams; i++) {
for (unsigned int i = 0; i < numOfVideoStreams; i++) {
cudaMalloc(&arrayOfStates[i], stateSizeInBytes);
cudaMemsetAsync(arrayOfStates[i], 0, stateSizeInBytes,app._stream);
}
@@ -273,7 +273,7 @@ NvCV_Status BatchProcess(const char* effectName, const std::vector<const char*>&
CVWrapperForNvCVImage(&nvx2, &ocv2);
for(int j=0;;j++)
{
for (int i = 0; i < batchSize; i++) {
for (unsigned int i = 0; i < batchSize; i++) {
int capIdx = i%numOfVideoStreams; // interlacing frames from different video stream, but can in any order
srcCaptures[capIdx] >> ocv1;
if (ocv1.empty()) goto bail;
@@ -295,7 +295,7 @@ NvCV_Status BatchProcess(const char* effectName, const std::vector<const char*>&
BAIL_IF_ERR(err = NvVFX_Run(app._eff, 0));
for (i = 0; i < batchSize; ++i) {
for (unsigned int i = 0; i < batchSize; ++i) {
int writerIdx = i % numOfVideoStreams;
BAIL_IF_ERR(err = TransferFromNthImage(i, &app._dst, &nvx2, 255.f, app._stream, &app._stg));
dstWriters[writerIdx] << ocv2;
@@ -304,7 +304,7 @@ NvCV_Status BatchProcess(const char* effectName, const std::vector<const char*>&
}
bail:
if (arrayOfStates) {
for (unsigned i = 0; i < numOfVideoStreams; i++) {
for (unsigned int i = 0; i < numOfVideoStreams; i++) {
if (arrayOfStates[i]) cudaFree(arrayOfStates[i]);
}
free(arrayOfStates);