diff options
author | Moonchild <mcwerewolf@gmail.com> | 2018-10-01 15:25:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-01 15:25:44 +0200 |
commit | 8e8fcee4a55de171303ebe526d3cf051522111bf (patch) | |
tree | fef75d382fc6216a093eeaf80560473dff19d883 /media/ffvpx/libavutil/integer.c | |
parent | 79b00fc33b5cb6d56d29b50efac6d62ce3a89018 (diff) | |
parent | 45c24f05d023a2cd8289ed40a13708392ce2e6a4 (diff) | |
download | UXP-8e8fcee4a55de171303ebe526d3cf051522111bf.tar UXP-8e8fcee4a55de171303ebe526d3cf051522111bf.tar.gz UXP-8e8fcee4a55de171303ebe526d3cf051522111bf.tar.lz UXP-8e8fcee4a55de171303ebe526d3cf051522111bf.tar.xz UXP-8e8fcee4a55de171303ebe526d3cf051522111bf.zip |
Merge pull request #805 from MoonchildProductions/revert-801-update-from-upstream
Revert "Update ffvpx code to 4.0.2"
Diffstat (limited to 'media/ffvpx/libavutil/integer.c')
-rw-r--r-- | media/ffvpx/libavutil/integer.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/media/ffvpx/libavutil/integer.c b/media/ffvpx/libavutil/integer.c index 890e314dc..6d6855fa1 100644 --- a/media/ffvpx/libavutil/integer.c +++ b/media/ffvpx/libavutil/integer.c @@ -164,3 +164,41 @@ int64_t av_i2int(AVInteger a){ } return out; } + +#ifdef TEST + +const uint8_t ff_log2_tab[256]={ + 0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 +}; + +int main(void){ + int64_t a,b; + + for(a=7; a<256*256*256; a+=13215){ + for(b=3; b<256*256*256; b+=27118){ + AVInteger ai= av_int2i(a); + AVInteger bi= av_int2i(b); + + av_assert0(av_i2int(ai) == a); + av_assert0(av_i2int(bi) == b); + av_assert0(av_i2int(av_add_i(ai,bi)) == a+b); + av_assert0(av_i2int(av_sub_i(ai,bi)) == a-b); + av_assert0(av_i2int(av_mul_i(ai,bi)) == a*b); + av_assert0(av_i2int(av_shr_i(ai, 9)) == a>>9); + av_assert0(av_i2int(av_shr_i(ai,-9)) == a<<9); + av_assert0(av_i2int(av_shr_i(ai, 17)) == a>>17); + av_assert0(av_i2int(av_shr_i(ai,-17)) == a<<17); + av_assert0(av_log2_i(ai) == av_log2(a)); + av_assert0(av_i2int(av_div_i(ai,bi)) == a/b); + } + } + return 0; +} +#endif |