[FFmpeg-devel] [PATCH] avutil/detection_bbox: Cleanup: Remove unneeded bbox_size struct member

Leandro Santiago leandrosansilva at gmail.com
Fri Feb 14 10:47:21 EET 2025


There is no need to store this field in the struct,
as it can be computed as sizeof(AVDetectionBBox).

Signed-off-by: Leandro Santiago <leandrosansilva at gmail.com>
---
 libavutil/detection_bbox.c | 1 -
 libavutil/detection_bbox.h | 7 +------
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/libavutil/detection_bbox.c b/libavutil/detection_bbox.c
index cb157b355b..456c35f87a 100644
--- a/libavutil/detection_bbox.c
+++ b/libavutil/detection_bbox.c
@@ -40,7 +40,6 @@ AVDetectionBBoxHeader *av_detection_bbox_alloc(uint32_t nb_bboxes, size_t *out_s
         return NULL;
 
     header->nb_bboxes     = nb_bboxes;
-    header->bbox_size     = bbox_size;
     header->bboxes_offset = bboxes_offset;
 
     if (out_size)
diff --git a/libavutil/detection_bbox.h b/libavutil/detection_bbox.h
index 011988052c..7844fb05da 100644
--- a/libavutil/detection_bbox.h
+++ b/libavutil/detection_bbox.h
@@ -70,11 +70,6 @@ typedef struct AVDetectionBBoxHeader {
      * the array of bounding boxes starts.
      */
     size_t bboxes_offset;
-
-    /**
-     * Size of each bounding box in bytes.
-     */
-    size_t bbox_size;
 } AVDetectionBBoxHeader;
 
 /*
@@ -85,7 +80,7 @@ av_get_detection_bbox(const AVDetectionBBoxHeader *header, unsigned int idx)
 {
     av_assert0(idx < header->nb_bboxes);
     return (AVDetectionBBox *)((uint8_t *)header + header->bboxes_offset +
-                               idx * header->bbox_size);
+                               idx * sizeof(AVDetectionBBox));
 }
 
 /**
-- 
2.48.1



More information about the ffmpeg-devel mailing list