[FFmpeg-devel] [PATCH] avutil/detection_bbox: Cleanup: Remove unneeded bbox_size struct member
Zhao Zhili
quinkblack at foxmail.com
Fri Feb 14 11:56:55 EET 2025
> On Feb 14, 2025, at 16:47, Leandro Santiago <leandrosansilva at gmail.com> wrote:
>
> 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));
> }
No, this field is for ABI compatibility. New fields can be added at the end of AVDetectionBBox,
sizeof(AVDetectionBBox) can be different between API user of libavutil and libavutil internal.
>
> /**
> --
> 2.48.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-devel
mailing list