[FFmpeg-devel] [PATCH v3] libavfilter/vf_find_rect: convert the object image to gray8 format instead of failed directly
Michael Niedermayer
michael at niedermayer.cc
Sun Jun 9 00:41:42 EEST 2019
On Sat, Jun 08, 2019 at 06:53:58AM +0800, lance.lmwang at gmail.com wrote:
> From: Limin Wang <lance.lmwang at gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
> ---
> libavfilter/vf_find_rect.c | 40 +++++++++++++++++++++++++++-------------
> 1 file changed, 27 insertions(+), 13 deletions(-)
>
> diff --git a/libavfilter/vf_find_rect.c b/libavfilter/vf_find_rect.c
> index d7e6579..6fe12fe 100644
> --- a/libavfilter/vf_find_rect.c
> +++ b/libavfilter/vf_find_rect.c
> @@ -28,6 +28,7 @@
> #include "internal.h"
>
> #include "lavfutils.h"
> +#include "lswsutils.h"
>
> #define MAX_MIPMAPS 5
>
> @@ -235,8 +236,6 @@ static av_cold void uninit(AVFilterContext *ctx)
> av_frame_free(&foc->haystack_frame[i]);
> }
>
> - if (foc->obj_frame)
> - av_freep(&foc->obj_frame->data[0]);
> av_frame_free(&foc->obj_frame);
> }
this alone will leak
something like:
foc->obj_frame->buf[0] =
av_buffer_create(foc->obj_frame->data[0],
foc->obj_frame->linesize[0] * foc->obj_frame->height,
av_buffer_default_free,
NULL,
0);
would be needed, but maybe theres a cleaner way to do this
like having a function that does all this in one step and produces a normal
AVFrame. I think more filters could benefit from this if theres nothing
like it yet ...
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190608/7b6f8498/attachment.sig>
More information about the ffmpeg-devel
mailing list