Commit Graph

54 Commits

Author SHA1 Message Date
Michael Niedermayer e34fe61bf4 avutil/softfloat: Add FLOAT_MIN
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-05 22:13:16 +01:00
Michael Niedermayer 6019d721d4 avutil/softfloat: Fix sign error in and improve documentation of av_int2sf()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-04 23:41:08 +02:00
Michael Niedermayer 277e397eb5 avutil/softfloat: Fix overflow in av_div_sf()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-06 23:23:39 +02:00
Michael Niedermayer 35f3df0d76 avutil/softfloat: Fix multiple runtime error: left shift of negative value -8
Fixes: 1352/clusterfuzz-testcase-minimized-5757565017260032

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-06 00:33:19 +02:00
Michael Niedermayer 79aa2ff199 avutil/softfloat: use ldexp(), fixes undefined shift
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-02 22:55:44 +02:00
Andreas Cadhalpun 2d6f46d801 softfloat: decrease MIN_EXP to cover full float range
floats are not necessarily normalized, so a normalized softfloat needs
MIN_EXP lowered by 23 to cover that range.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-25 01:23:48 +01:00
Andreas Cadhalpun 0edd569466 softfloat: handle -INT_MAX correctly
This is similar to commit 9ac61e73d0.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-14 22:57:07 +01:00
Michael Niedermayer 52ca24bdd2 avutil/softfloat: Improve doxy for av_sub_sf() and av_sf2int()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-29 14:45:07 +02:00
Michael Niedermayer d1520a6cfd avutil/softfloat: Document public constants and a few public functions
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-28 14:24:20 +02:00
Michael Niedermayer 5e8b9e746f avutil/softfloat: Assert that the exponent did not overflow the legal range in av_normalize1_sf()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-11 13:39:21 +01:00
James Almer 9f4a41bf99 avutil/softfloat: use abort() instead of av_assert0(0)
Fixes compilation of host tool aacps_fixed_tablegen.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2015-11-10 13:37:24 -03:00
Andreas Cadhalpun 9ac61e73d0 softfloat: handle INT_MIN correctly in av_int2sf
Otherwise v=INT_MIN doesn't get normalized and thus triggers av_assert2
in other functions.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-11-08 21:06:40 +01:00
Andreas Cadhalpun f3866a14c3 softfloat: assert when the argument of av_sqrt_sf is negative
The correct result can't be expressed in SoftFloat.
Currently it returns a random value from an out of bounds read.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-11-08 21:05:21 +01:00
Michael Niedermayer 05b05a7a84 avutil/softfloat: Fix av_gt_sf() with large exponents try #2
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-08 15:03:28 +01:00
Michael Niedermayer cee3c9d29a avutil/softfloat: Fix overflows in shifts in av_cmp_sf() and av_gt_sf()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-08 14:54:51 +01:00
Michael Niedermayer 046218b212 avutil/softfloat: Fix exponent underflow in av_div_sf()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-08 14:23:38 +01:00
Michael Niedermayer a1e3303fc0 avutil/softfloat: Fix exponent underflow in av_mul_sf()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-08 14:23:38 +01:00
Michael Niedermayer 4135a2bfd6 avutil/softfloat: Fix typo in av_mul_sf() doxy
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-08 14:23:37 +01:00
Michael Niedermayer 4b6ad23609 Revert "avutil/softfloat: Check for MIN_EXP in av_sqrt_sf()"
This case should not be possible if the input has a exponent within
the valid range

This reverts commit 0269fb11e3.
2015-11-08 14:23:37 +01:00
Michael Niedermayer 0269fb11e3 avutil/softfloat: Check for MIN_EXP in av_sqrt_sf()
Otherwise the exponent could eventually underflow

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-08 13:39:06 +01:00
Michael Niedermayer 107db5abf3 avutil/softfloat: Correctly set the exponent for 0.0 in av_sqrt_sf()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-08 13:39:06 +01:00
Michael Niedermayer a66b243d52 avutil/softfloat: FLOAT_0 should use MIN_EXP
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-08 03:57:02 +01:00
James Almer a176bbc873 avutil/softfloat: move av_sincos_sf() back to header
Fixes compilation of host tool aacps_fixed_tablegen

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2015-07-22 23:12:21 -03:00
Djordje Pesut f85bc147fb avcodec: Implementation of AAC_fixed_decoder (SBR-module)
Add fixed poind code.

Signed-off-by: Nedeljko Babic <nedeljko.babic@imgtec.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-20 17:20:16 +02:00
James Almer 20abb1afe5 softfloat: make av_div_sf() inline
Removes a defined but not used warning on files including softfloat.h

Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
2015-06-13 22:28:39 -03:00
Michael Niedermayer daf1158d77 avutil/softfloat: Move av_sf2double() to header
It was not intended to be a static private function

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-11 16:16:38 +02:00
Michael Niedermayer af8d63e756 avutil/softfloat: Fix alternative implementation of av_normalize1_sf()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-05 17:40:16 +02:00
Michael Niedermayer 6690ca22b3 avutil/softfloat: Fix alternative implementation of av_normalize_sf()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-05 17:40:16 +02:00
Michael Niedermayer d3585c53de avutil/softfloat: Move av_sincos_sf() from header to c file
The function is quite big and trigonometric functions should not really
be used in speed critical code

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-05 13:42:05 +02:00
Michael Niedermayer c7ce16e716 avutil/softfloat: Fix thresholds in av_normalize_sf()
Found-by: Nedeljko Babic <Nedeljko.Babic@imgtec.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-05 12:56:12 +02:00
Nedeljko Babic 7131aba916 libavutil/softfloat: Fix av_normalize1_sf bias.
av_normalize1_sf doesn't properly address border case when mantis is
exactly -0x40000000.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-04 17:20:03 +02:00
Nedeljko Babic 1fae268307 libavutil/softfloat: Add functions.
Functions av_gt_sf, av_sqrt_sf and av_sincos_sf added to softfloat

Signed-off-by: Nedeljko Babic <nedeljko.babic@imgtec.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-30 15:05:12 +02:00
Nedeljko Babic 7bab281475 libavutil/softfloat: Added av_normalize_sf in av_add_sf
This will normalize sums for which mantissa is smaller than the lower boundary
(needed for implementation of fixed point aac decoder).

Signed-off-by: Nedeljko Babic <nedeljko.babic@imgtec.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-30 14:53:09 +02:00
Nedeljko Babic a1c7fe431c libavutil/softfloat: exponent adjusted for aac fixed point dec
Exponent usage and calculation in softfloat adjusted to the format used in
implementation of fixed point aac decoder.

Signed-off-by: Nedeljko Babic <nedeljko.babic@imgtec.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-30 14:20:28 +02:00
Michael Niedermayer a3110beebd avutil/softfloat: document av_int2sf()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-25 14:51:02 +02:00
Nedeljko Babic f4ccf38902 libavutil/softfloat: Change order of fields in SoftFloat structure.
Softfloat will be used in implementation of AAC fixed point decoder.
This change is needed in order to more easily integrate ffmpegs softfloat in
already developed algorithm for AAC.

Signed-off-by: Nedeljko Babic <nedeljko.babic@imgtec.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-15 18:53:55 +02:00
Michael Niedermayer 171d971dbf avutil/softfloat: Fix undefined shift in av_add_sf()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-10 19:36:12 +02:00
Michael Niedermayer 99afec08f8 avutil/softfloat: add some asserts
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-09 17:02:59 +02:00
Michael Niedermayer 44198a728d avutil/softfloat: Fix dependence on signed overflow in av_normalize1_sf()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-09 16:52:56 +02:00
Diego Biurrun 89c9ff504b spelling/grammar/consistency review part I
Originally committed as revision 16840 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-01-28 00:16:05 +00:00
Stefano Sabatini 987903826b Globally rename the header inclusion guard names.
Consistently apply this rule: the guard name is obtained from the
filename by stripping the leading "lib", converting '/' and '.'  to
'_' and uppercasing the resulting name. Guard names in the root
directory have to be prefixed by "FFMPEG_".

Originally committed as revision 15120 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-08-31 07:39:47 +00:00
Diego Biurrun ca74c0a180 cosmetics: Fix two common typos: wont --> will not, lets --> let us.
Originally committed as revision 14372 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-07-24 17:09:28 +00:00
Måns Rullgård 3540b950ec add missing #include "common.h" to libavutil headers
Originally committed as revision 12502 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-03-19 08:47:31 +00:00
Zuxy Meng 85074d3c93 Reapply r12489: Add pure, const and malloc attributes to proper functions
in libavutil.
Fix a compilation failure in r12489.

Originally committed as revision 12498 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-03-19 06:17:43 +00:00
Benoit Fouet 2119bb8f51 revert r12489.
Originally committed as revision 12490 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-03-18 16:29:47 +00:00
Zuxy Meng 6544f48f03 Pure, const and malloc attributes to libavutil.
Patch by Zuxy Meng: zuxy meng gmail com
Original thread:
[FFmpeg-devel] [PATCH] Pure, const and malloc attributes to libavutil
Date: 03/18/2008 6:09 AM

Originally committed as revision 12489 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-03-18 15:27:15 +00:00
Diego Biurrun 5b21bdabe4 Add FFMPEG_ prefix to all multiple inclusion guards.
Originally committed as revision 10765 to svn://svn.ffmpeg.org/ffmpeg/trunk
2007-10-17 09:37:46 +00:00
Diego Biurrun e5a389a1b7 license header consistency cosmetics
Originally committed as revision 9484 to svn://svn.ffmpeg.org/ffmpeg/trunk
2007-07-05 10:40:25 +00:00
Guillaume Poirier efb775777f add a comment to indicate which #endif belong to which #define
Originally committed as revision 9356 to svn://svn.ffmpeg.org/ffmpeg/trunk
2007-06-17 18:59:28 +00:00
Måns Rullgård 699b3f99d0 add multiple inclusion guards to headers
Originally committed as revision 9345 to svn://svn.ffmpeg.org/ffmpeg/trunk
2007-06-17 00:01:30 +00:00