Skip to content

Commit

Permalink
Merge branch 'speed_ai' of github.com:ZoneMinder/zoneminder into spee…
Browse files Browse the repository at this point in the history
…d_ai
  • Loading branch information
Isaac Connor committed Feb 27, 2025
2 parents 42cc082 + 5724079 commit 56d0079
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/netint_network.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#ifdef HAVE_QUADRA
/*
* Copyright (c) 2010 Nicolas George
* Copyright (c) 2011 Stefano Sabatini
Expand Down Expand Up @@ -545,3 +546,4 @@ int ni_convert_to_tensors(NiNetworkContext *network_ctx, NiNetworkFrame *frame,
}
return 0;
}
#endif
2 changes: 2 additions & 0 deletions src/ni_yolo_utils.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#ifdef HAVE_QUADRA
#include "ni_yolo_utils.h"
#include "zm_logger.h"

Expand Down Expand Up @@ -405,3 +406,4 @@ void ni_resize_coords_padding_mode(detection *det, struct roi_box *roi_box,
roi_box->objectness = det->objectness;
roi_box->prob = det->max_prob;
}
#endif
2 changes: 2 additions & 0 deletions src/yolov4_postprocess.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#ifdef HAVE_QUADRA
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
Expand Down Expand Up @@ -441,3 +442,4 @@ YoloModel yolov4 = {
.ni_get_boxes = ni_yolov4_get_boxes,
};

#endif
2 changes: 2 additions & 0 deletions src/yolov5_postprocess.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#ifdef HAVE_QUADRA
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
Expand Down Expand Up @@ -197,3 +198,4 @@ YoloModel yolov5 = {
.ni_get_boxes = ni_yolov5_get_boxes,
};

#endif
2 changes: 2 additions & 0 deletions src/yolov8_postprocess.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#ifdef HAVE_QUADRA
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
Expand Down Expand Up @@ -197,3 +198,4 @@ YoloModel yolov8 = {
.ni_get_boxes = ni_yolov8_get_boxes,
};

#endif
8 changes: 8 additions & 0 deletions src/zm_monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@
#include "zm_libvnc_camera.h"
#endif // HAVE_LIBVNC

#ifdef HAVE_QUADRA
#include "libavutil/hwcontext_ni_quad.h"
#endif

#include <algorithm>
#include <cstring>
Expand Down Expand Up @@ -338,8 +340,10 @@ Monitor::Monitor() :
#ifdef HAVE_UNTETHER_H
speedai(nullptr),
#endif
#ifdef HAVE_QUADRA
quadra(nullptr),
quadra_yolo(nullptr),
#endif
red_val(0),
green_val(0),
blue_val(0),
Expand Down Expand Up @@ -1369,8 +1373,10 @@ Monitor::~Monitor() {
delete Amcrest_Manager;
}
if (onvif) delete onvif;
#ifdef HAVE_QUADRA
if (quadra) delete quadra;
if (quadra_yolo) delete quadra_yolo;
#endif
} // end Monitor::~Monitor()

void Monitor::AddPrivacyBitmask() {
Expand Down Expand Up @@ -2154,6 +2160,7 @@ int Monitor::Analyse() {
}
} // end if decoding enabled

#ifdef HAVE_QUADRA
if (objectdetection == OBJECT_DETECTION_QUADRA) {
if (!quadra_yolo and packet->hw_frame) {
quadra_yolo = new Quadra_Yolo(this, packet->hw_frame ? true : false);
Expand Down Expand Up @@ -2278,6 +2285,7 @@ int Monitor::Analyse() {
} // end if delayed_packet
} // end yolo
packet->hw_frame = nullptr; // Free it?
#endif

#ifdef HAVE_UNTETHER_H
if (speedai) {
Expand Down
8 changes: 8 additions & 0 deletions src/zm_monitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,13 @@
#include "zm_untether_speedai.h"
#endif

#ifdef HAVE_QUADRA
extern "C" {
#include <ni_device_api.h>
#include <ni_av_codec.h>
#include <ni_util.h>
}
#endif

class Group;
class MonitorLinkExpression;
Expand All @@ -65,7 +67,9 @@ class MonitorLinkExpression;
#define MOTION_CAUSE "Motion"
#define LINKED_CAUSE "Linked"

#ifdef HAVE_QUADRA
#include "zm_netint_yolo.h"
#endif

//
// This is the main class for monitors. Each monitor is associated
Expand Down Expand Up @@ -350,6 +354,7 @@ class Monitor : public std::enable_shared_from_this<Monitor> {
protected:


#ifdef HAVE_QUADRA
class Quadra {
public:
explicit Quadra(Monitor *p_monitor);
Expand All @@ -368,6 +373,7 @@ class Monitor : public std::enable_shared_from_this<Monitor> {

Monitor *monitor;
};
#endif

class ONVIF {
protected:
Expand Down Expand Up @@ -717,8 +723,10 @@ class Monitor : public std::enable_shared_from_this<Monitor> {
#ifdef HAVE_UNTETHER_H
SpeedAI *speedai;
#endif
#ifdef HAVE_QUADRA
Quadra *quadra;
Quadra_Yolo *quadra_yolo;
#endif

// Used in check signal
uint8_t red_val;
Expand Down
2 changes: 2 additions & 0 deletions src/zm_netint_ai.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

#ifdef HAVE_QUADRA
#include "zm_monitor.h"
#include "zm_signal.h"
#include "zm_time.h"
Expand Down Expand Up @@ -123,3 +124,4 @@ bool Monitor::Quadra::detect(AVFrame *in_frame) {

return true;
}
#endif
4 changes: 2 additions & 2 deletions src/zm_netint_yolo.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#ifdef HAVE_QUADRA

#include "zm_logger.h"
#include "zm_ffmpeg.h"
Expand Down Expand Up @@ -793,5 +794,4 @@ int Quadra_Yolo::ni_read_roi(AVFrame *out, int frame_count) {
return ret;
}



#endif

0 comments on commit 56d0079

Please sign in to comment.