diff mbox series

[FFmpeg-devel,1/2] avcodec/cfhd: only increase s->level if transform is known

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

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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer Dec. 23, 2020, 3:04 p.m. UTC | #1
On Wed, Dec 23, 2020 at 12:35:38PM +0100, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol <onemda@gmail.com>
> ---
>  libavcodec/cfhd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
> index a2b9c7c76a..a4f4cb4b3c 100644
> --- a/libavcodec/cfhd.c
> +++ b/libavcodec/cfhd.c
> @@ -436,7 +436,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
>              }
>              init_plane_defaults(s);
>          } else if (tag == SubbandNumber) {
> -            if (s->subband_num != 0 && data == 1)  // hack
> +            if (s->subband_num != 0 && data == 1 && s->transform_type >= 0)  // hack
>                  s->level++;
>              av_log(avctx, AV_LOG_DEBUG, "Subband number %"PRIu16"\n", data);
>              s->subband_num = data;

What about all the other places which use transform_type ?
If its allowed never to set transform_type or to set it between several uses 
of transform_type. 
Is that always safe ?

Iam asking because that should not be possible with enforced order and a mandatory
transform_type element. But that is not enforced with your solution.

Thanks

[...]
Paul B Mahol Dec. 24, 2020, 11:06 a.m. UTC | #2
On Wed, Dec 23, 2020 at 4:04 PM Michael Niedermayer <michael@niedermayer.cc>
wrote:

> On Wed, Dec 23, 2020 at 12:35:38PM +0100, Paul B Mahol wrote:
> > Signed-off-by: Paul B Mahol <onemda@gmail.com>
> > ---
> >  libavcodec/cfhd.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
> > index a2b9c7c76a..a4f4cb4b3c 100644
> > --- a/libavcodec/cfhd.c
> > +++ b/libavcodec/cfhd.c
> > @@ -436,7 +436,7 @@ static int cfhd_decode(AVCodecContext *avctx, void
> *data, int *got_frame,
> >              }
> >              init_plane_defaults(s);
> >          } else if (tag == SubbandNumber) {
> > -            if (s->subband_num != 0 && data == 1)  // hack
> > +            if (s->subband_num != 0 && data == 1 && s->transform_type
> >= 0)  // hack
> >                  s->level++;
> >              av_log(avctx, AV_LOG_DEBUG, "Subband number %"PRIu16"\n",
> data);
> >              s->subband_num = data;
>
> What about all the other places which use transform_type ?
> If its allowed never to set transform_type or to set it between several
> uses
> of transform_type.
> Is that always safe ?
>
> Iam asking because that should not be possible with enforced order and a
> mandatory
> transform_type element. But that is not enforced with your solution.
>

Transform type in always mandatory to be set in each packet.


> Thanks
>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> If you fake or manipulate statistics in a paper in physics you will never
> get a job again.
> If you fake or manipulate statistics in a paper in medicin you will get
> a job for life at the pharma industry.
> _______________________________________________
> 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".
Paul B Mahol Dec. 28, 2020, 11:26 a.m. UTC | #3
On Thu, Dec 24, 2020 at 12:06 PM Paul B Mahol <onemda@gmail.com> wrote:

>
>
> On Wed, Dec 23, 2020 at 4:04 PM Michael Niedermayer <michael@niedermayer.cc>
> wrote:
>
>> On Wed, Dec 23, 2020 at 12:35:38PM +0100, Paul B Mahol wrote:
>> > Signed-off-by: Paul B Mahol <onemda@gmail.com>
>> > ---
>> >  libavcodec/cfhd.c | 2 +-
>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
>> > index a2b9c7c76a..a4f4cb4b3c 100644
>> > --- a/libavcodec/cfhd.c
>> > +++ b/libavcodec/cfhd.c
>> > @@ -436,7 +436,7 @@ static int cfhd_decode(AVCodecContext *avctx, void
>> *data, int *got_frame,
>> >              }
>> >              init_plane_defaults(s);
>> >          } else if (tag == SubbandNumber) {
>> > -            if (s->subband_num != 0 && data == 1)  // hack
>> > +            if (s->subband_num != 0 && data == 1 && s->transform_type
>> >= 0)  // hack
>> >                  s->level++;
>> >              av_log(avctx, AV_LOG_DEBUG, "Subband number %"PRIu16"\n",
>> data);
>> >              s->subband_num = data;
>>
>> What about all the other places which use transform_type ?
>> If its allowed never to set transform_type or to set it between several
>> uses
>> of transform_type.
>> Is that always safe ?
>>
>> Iam asking because that should not be possible with enforced order and a
>> mandatory
>> transform_type element. But that is not enforced with your solution.
>>
>
> Transform type in always mandatory to be set in each packet.
>
>

Also transform_type is supported only if its 0 or 2 and thus it makes sense
to increase level
only in such cases.



> Thanks
>>
>> [...]
>> --
>> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>>
>> If you fake or manipulate statistics in a paper in physics you will never
>> get a job again.
>> If you fake or manipulate statistics in a paper in medicin you will get
>> a job for life at the pharma industry.
>> _______________________________________________
>> 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".
>
>
diff mbox series

Patch

diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
index a2b9c7c76a..a4f4cb4b3c 100644
--- a/libavcodec/cfhd.c
+++ b/libavcodec/cfhd.c
@@ -436,7 +436,7 @@  static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
             }
             init_plane_defaults(s);
         } else if (tag == SubbandNumber) {
-            if (s->subband_num != 0 && data == 1)  // hack
+            if (s->subband_num != 0 && data == 1 && s->transform_type >= 0)  // hack
                 s->level++;
             av_log(avctx, AV_LOG_DEBUG, "Subband number %"PRIu16"\n", data);
             s->subband_num = data;