diff mbox series

[FFmpeg-devel,2/2] avcodec/cfhd: properly handle midstream size changes for transform type 2

Message ID 20201223113539.19880-2-onemda@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel,1/2] avcodec/cfhd: only increase s->level if transform is known
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Paul B Mahol Dec. 23, 2020, 11:35 a.m. UTC
Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavcodec/cfhd.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Michael Niedermayer Dec. 23, 2020, 3:07 p.m. UTC | #1
On Wed, Dec 23, 2020 at 12:35:39PM +0100, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol <onemda@gmail.com>
> ---
>  libavcodec/cfhd.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
> index a4f4cb4b3c..ae0d4b9496 100644
> --- a/libavcodec/cfhd.c
> +++ b/libavcodec/cfhd.c
> @@ -1372,6 +1372,9 @@ static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
>      if (dst == src || psrc->transform_type == 0)
>          return 0;
>  
> +    if (pdst->plane[0].idwt_size != psrc->plane[0].idwt_size)
> +        free_buffers(pdst);

What if idwt_size is the same but the dimensions that is 
width and height are not ?

thx

[...]
Paul B Mahol Dec. 23, 2020, 4:01 p.m. UTC | #2
On Wed, Dec 23, 2020 at 4:07 PM Michael Niedermayer <michael@niedermayer.cc>
wrote:

> On Wed, Dec 23, 2020 at 12:35:39PM +0100, Paul B Mahol wrote:
> > Signed-off-by: Paul B Mahol <onemda@gmail.com>
> > ---
> >  libavcodec/cfhd.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
> > index a4f4cb4b3c..ae0d4b9496 100644
> > --- a/libavcodec/cfhd.c
> > +++ b/libavcodec/cfhd.c
> > @@ -1372,6 +1372,9 @@ static int update_thread_context(AVCodecContext
> *dst, const AVCodecContext *src)
> >      if (dst == src || psrc->transform_type == 0)
> >          return 0;
> >
> > +    if (pdst->plane[0].idwt_size != psrc->plane[0].idwt_size)
> > +        free_buffers(pdst);
>
> What if idwt_size is the same but the dimensions that is
> width and height are not ?
>

Yes, I will also check that.


>
> thx
>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Complexity theory is the science of finding the exact solution to an
> approximation. Benchmarking OTOH is finding an approximation of the exact
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Michael Niedermayer Dec. 23, 2020, 9:07 p.m. UTC | #3
On Wed, Dec 23, 2020 at 05:01:44PM +0100, Paul B Mahol wrote:
> On Wed, Dec 23, 2020 at 4:07 PM Michael Niedermayer <michael@niedermayer.cc>
> wrote:
> 
> > On Wed, Dec 23, 2020 at 12:35:39PM +0100, Paul B Mahol wrote:
> > > Signed-off-by: Paul B Mahol <onemda@gmail.com>
> > > ---
> > >  libavcodec/cfhd.c | 3 +++
> > >  1 file changed, 3 insertions(+)
> > >
> > > diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
> > > index a4f4cb4b3c..ae0d4b9496 100644
> > > --- a/libavcodec/cfhd.c
> > > +++ b/libavcodec/cfhd.c
> > > @@ -1372,6 +1372,9 @@ static int update_thread_context(AVCodecContext
> > *dst, const AVCodecContext *src)
> > >      if (dst == src || psrc->transform_type == 0)
> > >          return 0;
> > >
> > > +    if (pdst->plane[0].idwt_size != psrc->plane[0].idwt_size)
> > > +        free_buffers(pdst);
> >
> > What if idwt_size is the same but the dimensions that is
> > width and height are not ?
> >
> 
> Yes, I will also check that.

then the change looks fine to me

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
index a4f4cb4b3c..ae0d4b9496 100644
--- a/libavcodec/cfhd.c
+++ b/libavcodec/cfhd.c
@@ -1372,6 +1372,9 @@  static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
     if (dst == src || psrc->transform_type == 0)
         return 0;
 
+    if (pdst->plane[0].idwt_size != psrc->plane[0].idwt_size)
+        free_buffers(pdst);
+
     pdst->a_format = psrc->a_format;
     pdst->a_width  = psrc->a_width;
     pdst->a_height = psrc->a_height;