diff mbox

[FFmpeg-devel] fate/source: Check for cases that could use av_clip_uintp2() and av_clip_intp2()

Message ID 20170217005908.3727-1-michael@niedermayer.cc
State Accepted
Headers show

Commit Message

Michael Niedermayer Feb. 17, 2017, 12:59 a.m. UTC
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 tests/fate/source-check.sh | 14 ++++++++++++++
 tests/ref/fate/source      |  2 ++
 2 files changed, 16 insertions(+)

Comments

Clément Bœsch Feb. 20, 2017, 11:34 a.m. UTC | #1
On Fri, Feb 17, 2017 at 01:59:08AM +0100, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  tests/fate/source-check.sh | 14 ++++++++++++++
>  tests/ref/fate/source      |  2 ++
>  2 files changed, 16 insertions(+)
> 
> diff --git a/tests/fate/source-check.sh b/tests/fate/source-check.sh
> index ac2878d9f7..72e1511f0d 100755
> --- a/tests/fate/source-check.sh
> +++ b/tests/fate/source-check.sh
> @@ -30,4 +30,18 @@ for f in `git ls-files | grep '\.h$'` ; do
>      grep -L "^#define $macro$" $f
>  done
>  

> +echo "Use of av_clip() where av_clip_uintp2 could be used:"

the use of () is not consistent

> +git grep -E 'av_clip *\(.*, *0 *, *(3|7|15|31|63|127|255|511|1023|2047|4095|8191|'\
> +'16383|32767|65535|131071|262143|524287|1048575|2097151|4194303|8388607|16777215|'\
> +'33554431|67108863|134217727|268435455|536870911|1073741823) *\)' | grep -v fate/source
> +
> +echo "Use of av_clip() where av_clip_intp2 could be used:"
> +git grep -E 'av_clip *\(.*, *(-2 *, *1|-4 *, *3|-8 *, *7|-16 *, *15|-32 *, *31|-64'\
> +' *, *63|-128 *, *127|-256 *, *255|-512 *, *511|-1024 *, *1023|-2048 *, *2047|-4096'\
> +' *, *4095|-8192 *, *8191|-16384 *, *16383|-32768 *, *32767|-65536 *, *65535|-131072'\
> +' *, *131071|-262144 *, *262143|-524288 *, *524287|-1048576 *, *1048575|-2097152 *,'\
> +' *2097151|-4194304 *, *4194303|-8388608 *, *8388607|-16777216 *, *16777215|-33554432'\
> +' *, *33554431|-67108864 *, *67108863|-134217728 *, *134217727|-268435456 *, *'\
> +'268435455|-536870912 *, *536870911|-1073741824 *, *1073741823) *\)'| grep -v fate/source
> +

you could add support for the 0x forms:

libavcodec/g726.c:    return av_clip(re_signal << 2, -0xffff, 0xffff);

[...]
Michael Niedermayer Feb. 20, 2017, 6:15 p.m. UTC | #2
On Mon, Feb 20, 2017 at 12:34:36PM +0100, Clément Bœsch wrote:
> On Fri, Feb 17, 2017 at 01:59:08AM +0100, Michael Niedermayer wrote:
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  tests/fate/source-check.sh | 14 ++++++++++++++
> >  tests/ref/fate/source      |  2 ++
> >  2 files changed, 16 insertions(+)
> > 
> > diff --git a/tests/fate/source-check.sh b/tests/fate/source-check.sh
> > index ac2878d9f7..72e1511f0d 100755
> > --- a/tests/fate/source-check.sh
> > +++ b/tests/fate/source-check.sh
> > @@ -30,4 +30,18 @@ for f in `git ls-files | grep '\.h$'` ; do
> >      grep -L "^#define $macro$" $f
> >  done
> >  
> 
> > +echo "Use of av_clip() where av_clip_uintp2 could be used:"
> 
> the use of () is not consistent

fixed


> 
> > +git grep -E 'av_clip *\(.*, *0 *, *(3|7|15|31|63|127|255|511|1023|2047|4095|8191|'\
> > +'16383|32767|65535|131071|262143|524287|1048575|2097151|4194303|8388607|16777215|'\
> > +'33554431|67108863|134217727|268435455|536870911|1073741823) *\)' | grep -v fate/source
> > +
> > +echo "Use of av_clip() where av_clip_intp2 could be used:"
> > +git grep -E 'av_clip *\(.*, *(-2 *, *1|-4 *, *3|-8 *, *7|-16 *, *15|-32 *, *31|-64'\
> > +' *, *63|-128 *, *127|-256 *, *255|-512 *, *511|-1024 *, *1023|-2048 *, *2047|-4096'\
> > +' *, *4095|-8192 *, *8191|-16384 *, *16383|-32768 *, *32767|-65536 *, *65535|-131072'\
> > +' *, *131071|-262144 *, *262143|-524288 *, *524287|-1048576 *, *1048575|-2097152 *,'\
> > +' *2097151|-4194304 *, *4194303|-8388608 *, *8388607|-16777216 *, *16777215|-33554432'\
> > +' *, *33554431|-67108864 *, *67108863|-134217728 *, *134217727|-268435456 *, *'\
> > +'268435455|-536870912 *, *536870911|-1073741824 *, *1073741823) *\)'| grep -v fate/source
> > +
> 
> you could add support for the 0x forms:
> 
> libavcodec/g726.c:    return av_clip(re_signal << 2, -0xffff, 0xffff);

-0xffff is not one of the supported cases of av_clip_intp2

will apply this patchset with my next push

thx

[...]
diff mbox

Patch

diff --git a/tests/fate/source-check.sh b/tests/fate/source-check.sh
index ac2878d9f7..72e1511f0d 100755
--- a/tests/fate/source-check.sh
+++ b/tests/fate/source-check.sh
@@ -30,4 +30,18 @@  for f in `git ls-files | grep '\.h$'` ; do
     grep -L "^#define $macro$" $f
 done
 
+echo "Use of av_clip() where av_clip_uintp2 could be used:"
+git grep -E 'av_clip *\(.*, *0 *, *(3|7|15|31|63|127|255|511|1023|2047|4095|8191|'\
+'16383|32767|65535|131071|262143|524287|1048575|2097151|4194303|8388607|16777215|'\
+'33554431|67108863|134217727|268435455|536870911|1073741823) *\)' | grep -v fate/source
+
+echo "Use of av_clip() where av_clip_intp2 could be used:"
+git grep -E 'av_clip *\(.*, *(-2 *, *1|-4 *, *3|-8 *, *7|-16 *, *15|-32 *, *31|-64'\
+' *, *63|-128 *, *127|-256 *, *255|-512 *, *511|-1024 *, *1023|-2048 *, *2047|-4096'\
+' *, *4095|-8192 *, *8191|-16384 *, *16383|-32768 *, *32767|-65536 *, *65535|-131072'\
+' *, *131071|-262144 *, *262143|-524288 *, *524287|-1048576 *, *1048575|-2097152 *,'\
+' *2097151|-4194304 *, *4194303|-8388608 *, *8388607|-16777216 *, *16777215|-33554432'\
+' *, *33554431|-67108864 *, *67108863|-134217728 *, *134217727|-268435456 *, *'\
+'268435455|-536870912 *, *536870911|-1073741824 *, *1073741823) *\)'| grep -v fate/source
+
 exit 0
diff --git a/tests/ref/fate/source b/tests/ref/fate/source
index 67906d1198..6a8f12f815 100644
--- a/tests/ref/fate/source
+++ b/tests/ref/fate/source
@@ -31,3 +31,5 @@  compat/cuda/dynlink_nvcuvid.h
 compat/float/float.h
 compat/float/limits.h
 compat/nvenc/nvEncodeAPI.h
+Use of av_clip() where av_clip_uintp2 could be used:
+Use of av_clip() where av_clip_intp2 could be used: