diff mbox

[FFmpeg-devel] avformat/vpcc: fix values in VP9 level detection heuristics

Message ID 20180828015904.7572-1-jamrial@gmail.com
State New
Headers show

Commit Message

James Almer Aug. 28, 2018, 1:59 a.m. UTC
The levels are stored as decimal values, not hexadecimal.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavformat/vpcc.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

Comments

James Almer Sept. 15, 2018, 1:39 a.m. UTC | #1
On 8/27/2018 10:59 PM, James Almer wrote:
> The levels are stored as decimal values, not hexadecimal.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavformat/vpcc.c | 28 ++++++++++++++--------------
>  1 file changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/libavformat/vpcc.c b/libavformat/vpcc.c
> index 79514483af..e0b7f288a6 100644
> --- a/libavformat/vpcc.c
> +++ b/libavformat/vpcc.c
> @@ -81,33 +81,33 @@ static int get_vp9_level(AVCodecParameters *par, AVRational *frame_rate) {
>      if (picture_size <= 0) {
>          return 0;
>      } else if (sample_rate <= 829440     && picture_size <= 36864) {
> -        return 0x10;
> +        return 10;
>      } else if (sample_rate <= 2764800    && picture_size <= 73728) {
> -        return 0x11;
> +        return 11;
>      } else if (sample_rate <= 4608000    && picture_size <= 122880) {
> -        return 0x20;
> +        return 20;
>      } else if (sample_rate <= 9216000    && picture_size <= 245760) {
> -        return 0x21;
> +        return 21;
>      } else if (sample_rate <= 20736000   && picture_size <= 552960) {
> -        return 0x30;
> +        return 30;
>      } else if (sample_rate <= 36864000   && picture_size <= 983040) {
> -        return 0x31;
> +        return 31;
>      } else if (sample_rate <= 83558400   && picture_size <= 2228224) {
> -        return 0x40;
> +        return 40;
>      } else if (sample_rate <= 160432128  && picture_size <= 2228224) {
> -        return 0x41;
> +        return 41;
>      } else if (sample_rate <= 311951360  && picture_size <= 8912896) {
> -        return 0x50;
> +        return 50;
>      } else if (sample_rate <= 588251136  && picture_size <= 8912896) {
> -        return 0x51;
> +        return 51;
>      } else if (sample_rate <= 1176502272 && picture_size <= 8912896) {
> -        return 0x52;
> +        return 52;
>      } else if (sample_rate <= 1176502272 && picture_size <= 35651584) {
> -        return 0x60;
> +        return 60;
>      } else if (sample_rate <= 2353004544 && picture_size <= 35651584) {
> -        return 0x61;
> +        return 61;
>      } else if (sample_rate <= 4706009088 && picture_size <= 35651584) {
> -        return 0x62;
> +        return 62;
>      } else {
>          return 0;
>      }

Ping.
James Zern Sept. 15, 2018, 3:28 a.m. UTC | #2
On Fri, Sep 14, 2018 at 6:39 PM James Almer <jamrial@gmail.com> wrote:
>
> On 8/27/2018 10:59 PM, James Almer wrote:
> > The levels are stored as decimal values, not hexadecimal.
> >
> > Signed-off-by: James Almer <jamrial@gmail.com>
> > ---
> >  libavformat/vpcc.c | 28 ++++++++++++++--------------
> >  1 file changed, 14 insertions(+), 14 deletions(-)
> >

lgtm. For anyone following, one reference is here:
https://www.webmproject.org/vp9/mp4/#vp-codec-configuration-box

> > diff --git a/libavformat/vpcc.c b/libavformat/vpcc.c
> > index 79514483af..e0b7f288a6 100644
> > --- a/libavformat/vpcc.c
> > +++ b/libavformat/vpcc.c
> > @@ -81,33 +81,33 @@ static int get_vp9_level(AVCodecParameters *par, AVRational *frame_rate) {
> >      if (picture_size <= 0) {
> >          return 0;
> >      } else if (sample_rate <= 829440     && picture_size <= 36864) {
> > -        return 0x10;
> > +        return 10;
> >      } else if (sample_rate <= 2764800    && picture_size <= 73728) {
> > -        return 0x11;
> > +        return 11;
> >      } else if (sample_rate <= 4608000    && picture_size <= 122880) {
> > -        return 0x20;
> > +        return 20;
> >      } else if (sample_rate <= 9216000    && picture_size <= 245760) {
> > -        return 0x21;
> > +        return 21;
> >      } else if (sample_rate <= 20736000   && picture_size <= 552960) {
> > -        return 0x30;
> > +        return 30;
> >      } else if (sample_rate <= 36864000   && picture_size <= 983040) {
> > -        return 0x31;
> > +        return 31;
> >      } else if (sample_rate <= 83558400   && picture_size <= 2228224) {
> > -        return 0x40;
> > +        return 40;
> >      } else if (sample_rate <= 160432128  && picture_size <= 2228224) {
> > -        return 0x41;
> > +        return 41;
> >      } else if (sample_rate <= 311951360  && picture_size <= 8912896) {
> > -        return 0x50;
> > +        return 50;
> >      } else if (sample_rate <= 588251136  && picture_size <= 8912896) {
> > -        return 0x51;
> > +        return 51;
> >      } else if (sample_rate <= 1176502272 && picture_size <= 8912896) {
> > -        return 0x52;
> > +        return 52;
> >      } else if (sample_rate <= 1176502272 && picture_size <= 35651584) {
> > -        return 0x60;
> > +        return 60;
> >      } else if (sample_rate <= 2353004544 && picture_size <= 35651584) {
> > -        return 0x61;
> > +        return 61;
> >      } else if (sample_rate <= 4706009088 && picture_size <= 35651584) {
> > -        return 0x62;
> > +        return 62;
> >      } else {
> >          return 0;
> >      }
>
> Ping.
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
James Almer Sept. 15, 2018, 9:07 p.m. UTC | #3
On 9/15/2018 12:28 AM, James Zern wrote:
> On Fri, Sep 14, 2018 at 6:39 PM James Almer <jamrial@gmail.com> wrote:
>>
>> On 8/27/2018 10:59 PM, James Almer wrote:
>>> The levels are stored as decimal values, not hexadecimal.
>>>
>>> Signed-off-by: James Almer <jamrial@gmail.com>
>>> ---
>>>  libavformat/vpcc.c | 28 ++++++++++++++--------------
>>>  1 file changed, 14 insertions(+), 14 deletions(-)
>>>
> 
> lgtm. For anyone following, one reference is here:
> https://www.webmproject.org/vp9/mp4/#vp-codec-configuration-box
> 

Pushed, thanks.
diff mbox

Patch

diff --git a/libavformat/vpcc.c b/libavformat/vpcc.c
index 79514483af..e0b7f288a6 100644
--- a/libavformat/vpcc.c
+++ b/libavformat/vpcc.c
@@ -81,33 +81,33 @@  static int get_vp9_level(AVCodecParameters *par, AVRational *frame_rate) {
     if (picture_size <= 0) {
         return 0;
     } else if (sample_rate <= 829440     && picture_size <= 36864) {
-        return 0x10;
+        return 10;
     } else if (sample_rate <= 2764800    && picture_size <= 73728) {
-        return 0x11;
+        return 11;
     } else if (sample_rate <= 4608000    && picture_size <= 122880) {
-        return 0x20;
+        return 20;
     } else if (sample_rate <= 9216000    && picture_size <= 245760) {
-        return 0x21;
+        return 21;
     } else if (sample_rate <= 20736000   && picture_size <= 552960) {
-        return 0x30;
+        return 30;
     } else if (sample_rate <= 36864000   && picture_size <= 983040) {
-        return 0x31;
+        return 31;
     } else if (sample_rate <= 83558400   && picture_size <= 2228224) {
-        return 0x40;
+        return 40;
     } else if (sample_rate <= 160432128  && picture_size <= 2228224) {
-        return 0x41;
+        return 41;
     } else if (sample_rate <= 311951360  && picture_size <= 8912896) {
-        return 0x50;
+        return 50;
     } else if (sample_rate <= 588251136  && picture_size <= 8912896) {
-        return 0x51;
+        return 51;
     } else if (sample_rate <= 1176502272 && picture_size <= 8912896) {
-        return 0x52;
+        return 52;
     } else if (sample_rate <= 1176502272 && picture_size <= 35651584) {
-        return 0x60;
+        return 60;
     } else if (sample_rate <= 2353004544 && picture_size <= 35651584) {
-        return 0x61;
+        return 61;
     } else if (sample_rate <= 4706009088 && picture_size <= 35651584) {
-        return 0x62;
+        return 62;
     } else {
         return 0;
     }