[FFmpeg-devel] [PATCH V3 3/3] libavfilter: add filter dnn_detect for object detection

Nicolas George george at nsup.org
Mon Mar 1 15:57:05 EET 2021


Andreas Rheinhardt (12021-03-01):
> > thanks for the info, this struct is expected to be in side_data in the future, 
> > I'll add 'bboxes[1]' in it, and allocate sizeof(*header) + (nb_bbox - 1) * sizeof(*bbox).
> 
> Notice that in this case it is undefined behaviour to access any of the
> boxes outside of BoundingBoxHeader (i.e. when using header->bboxes[i],
> the compiler is allowed to infer that i == 0 as all other cases would be
> undefined behaviour).

Are you sure about it? Can you quote the standard?

Anyway, even if this is true, we can work around it with an extra
pointer or a cast, possibly wrapped in a macro. Saving a few dynamic
allocation is well worth the unusual code; we should shoo away the
people who oppose to go work on GStreamer or something.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20210301/0387a674/attachment.sig>


More information about the ffmpeg-devel mailing list