35 static const unsigned int alloc_counts[] = { 0, 1, 4 };
38 printf(
"Testing av_detection_bbox_alloc()\n");
40 unsigned int nb = alloc_counts[
i];
43 printf(
"alloc %u: OK, nb=%u, size>0=%s\n",
44 nb,
header->nb_bboxes,
size > 0 ?
"yes" :
"no");
47 printf(
"alloc %u: FAIL\n", nb);
57 printf(
"\nTesting av_get_detection_bbox()\n");
60 for (
int i = 0;
i < 3;
i++) {
62 if ((uint8_t *)bbox != (uint8_t *)
header +
header->bboxes_offset +
64 printf(
"bbox %d: pointer inconsistent with bboxes_offset/bbox_size\n",
i);
73 for (
int i = 0;
i < 3;
i++) {
75 printf(
"bbox %d: x=%d y=%d w=%d h=%d label=%s conf=%d/%d\n",
76 i, bbox->
x, bbox->
y, bbox->
w, bbox->
h,
85 printf(
"\nTesting classify fields\n");
98 printf(
"classify %d: %s %d/%d\n",
i,
106 printf(
"\nTesting source field\n");
115 printf(
"\nTesting av_detection_bbox_create_side_data()\n");
124 printf(
"side_data bbox 0: x=%d y=%d\n", bbox->
x, bbox->
y);
126 printf(
"side_data: FAIL\n");
#define i(width, name, range_min, range_max)
__device__ int printf(const char *,...)
AVDetectionBBoxHeader * av_detection_bbox_alloc(uint32_t nb_bboxes, size_t *out_size)
Allocates memory for AVDetectionBBoxHeader, plus an array of nb_bboxes AVDetectionBBox,...
AVDetectionBBoxHeader * av_detection_bbox_create_side_data(AVFrame *frame, uint32_t nb_bboxes)
Allocates memory for AVDetectionBBoxHeader, plus an array of nb_bboxes AVDetectionBBox,...
static av_always_inline AVDetectionBBox * av_get_detection_bbox(const AVDetectionBBoxHeader *header, unsigned int idx)
reference-counted frame API
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Utility Preprocessor macros.
Memory handling functions.
static const uint8_t header[24]
#define FF_ARRAY_ELEMS(a)
char detect_label[AV_DETECTION_BBOX_LABEL_NAME_MAX_SIZE]
Detect result with confidence.
int x
Distance in pixels from the left/top edge of the frame, together with width and height,...
char classify_labels[AV_NUM_DETECTION_BBOX_CLASSIFY][AV_DETECTION_BBOX_LABEL_NAME_MAX_SIZE]
AVRational detect_confidence
AVRational classify_confidences[AV_NUM_DETECTION_BBOX_CLASSIFY]
This structure describes decoded (raw) audio or video data.
Rational number (pair of numerator and denominator).