[FFmpeg-devel] [PATCH V3 3/3] libavfilter: add filter dnn_detect for object detection
Guo, Yejun
yejun.guo at intel.com
Mon Mar 1 16:44:22 EET 2021
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of Nicolas
> George
> Sent: 2021年3月1日 21:57
> To: FFmpeg development discussions and patches <ffmpeg-devel at ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH V3 3/3] libavfilter: add filter dnn_detect
> for object detection
>
> 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;
Hi, glad to hear there's a good solution, could you share a bit of code as an example,
it would be nice if I could refine my code better when possible, thanks.
More information about the ffmpeg-devel
mailing list