Commit Graph

49 Commits

Author SHA1 Message Date
Marton Balint 8fccd6d510 avutil/rational: increase av_d2q precision
Fixes parsing small timebases from expressions (where the expression API
converts the result to double), like in this command line:

ffprobe -f lavfi -i testsrc=d=1,settb=1/2000000000 -show_streams -show_entries stream=time_base

Before the patch timebase was parsed as 1/1999999999.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-04 20:04:18 +01:00
Nicolas George 6b65c4ec54 lavu: add av_gcd_q(). 2020-05-23 15:51:44 +02:00
Derek Buitenhuis 96d616052b Merge commit 'd12b5b2f135aade4099f4b26b0fe678656158c13'
* commit 'd12b5b2f135aade4099f4b26b0fe678656158c13':
  build: Split test programs off into separate files

Some conversions done by: James Almer <jamrial@gmail.com>
Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-05-11 19:13:03 +01:00
Ganesh Ajjanagadde 7dabc78ce1 lavu/rational: add more info regarding floor(x+0.5) usage
Add some more verbose info regarding why the imprecise and slow floor(x+0.5) hack
is used; helpful for future maintenance.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanag@gmail.com>
2016-02-29 19:26:55 -05:00
Michael Niedermayer 97b8db334a avutil/rational: Test av_rescale_rnd() with combinations of "special" values
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-02 21:38:11 +01:00
Ganesh Ajjanagadde 8d9f86bd37 avutil/rational: use frexp rather than ad-hoc log to get floating point exponent
This simplifies and cleans up the code.
Furthermore, it is much faster due to absence of the slow log computation.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-10-30 23:18:43 -04:00
Michael Niedermayer 1fb9b2a283 avutil: Add av_q2intfloat()
This function allows writing AVRationals as IEEE floats without the need
of platform dependant float operations

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-26 18:31:53 +02:00
Michael Niedermayer 827af24230 avutil/rational: Check that av_reduce() returns values within the requested max
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-29 15:52:34 +01:00
Michael Niedermayer cd7037dd7a avutil/rational: av_add_stable() test code
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-04 15:10:14 +01:00
Michael Niedermayer 46ad287a2a avutil/rational: avoid llrint() and rint()
This should workaround issues with these functions on ia64 and sparc64

Fixes Ticket2713

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-04 23:50:58 +02:00
Michael Niedermayer 887d74c47e av_d2q: Add a special case for |value| > MAX and |value| < 1/MAX
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-31 17:10:36 +02:00
Michael Niedermayer d480b36db4 av_d2q: Avoid llrint(), its not correctly implemented in old netbsd
This should fix some fate failure

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-26 03:19:55 +02:00
Michael Niedermayer 64eacb839e av_d2q: fix rounding for negative values
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-25 16:04:08 +02:00
Michael Niedermayer de7d290631 av_d2q: Fix infinity check
The old check would fail on huge but not infinite values
and the later code could then fail to handle them correctly in
some cases.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-25 16:03:50 +02:00
Michael Niedermayer 4390fa6273 Merge commit 'd46c588f3cb1963a00e990ceaf4ba9ffa05a716d'
* commit 'd46c588f3cb1963a00e990ceaf4ba9ffa05a716d':
  Remove commented-out #includes
  h263dec: Remove broken and disabled debug cruft
  vc1: Reindent INIT_LUT(), align backslashes

Conflicts:
	libavcodec/vc1.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-16 09:11:04 +02:00
Diego Biurrun d46c588f3c Remove commented-out #includes 2013-05-15 23:01:21 +02:00
Michael Niedermayer 0efcf16a3e replace av_log(0, by av_log(NULL,
The first parameter is a pointer and NULL is more correct

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-23 18:10:02 +01:00
Michael Niedermayer 6204ea17f1 rational: test add/sub too
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-01 02:59:44 +01:00
Michael Niedermayer 707138593a Merge remote-tracking branch 'qatar/master'
* qatar/master:
  adpcmenc: cosmetics: pretty-printing
  ac3dec: cosmetics: pretty-printing
  yuv4mpeg: cosmetics: pretty-printing
  shorten: remove dead initialization
  roqvideodec: set AVFrame reference before reget_buffer.
  bmp: fix some 1bit samples.
  latmdec: add fate test for audio config change
  oma: PCM support
  oma: better format detection with small probe buffer
  oma: clearify ambiguous if condition
  wavpack: Properly clip samples during lossy decode
  Code clean-up for crc.c, lfg.c, log.c, random_see.d, rational.c and tree.c.
  Cleaned pixdesc.c file in libavutil
  zmbv.c: coding style clean-up.
  xan.c: coding style clean-up.
  mpegvideo.c: code cleanup - first 500 lines.

Conflicts:
	Changelog
	libavcodec/adpcmenc.c
	libavcodec/bmp.c
	libavcodec/zmbv.c
	libavutil/log.c
	libavutil/pixdesc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-12-05 00:11:57 +01:00
Yordan Makariev 425b45d4b0 Code clean-up for crc.c, lfg.c, log.c, random_see.d, rational.c and tree.c.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-12-03 15:13:48 -08:00
Michael Niedermayer 8c0cbb0848 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  rational-test: Add proper main() declaration to fix gcc warnings.
  configure: Add vdpau and dxva2 to configure results output.
  Remove unused, never built libavutil/pca.[ch]
  matroskadec: forward parsing errors to caller.
  av_find_stream_info: simplify EAGAIN handling.
  aacenc: Fix determination of Mid/Side Mode.
  psymodel: Remove the single channel analysis function
  aacenc: Implement dummy channel group analysis that just calls the single channel analysis for each channel.
  psymodel: Add channels and channel groups to the psymodel.
  ARM: remove check for PLD instruction
  fate: move amr[nw]b test rules into separate files
  ogg: fix double free when finding length of small chained oggs.
  swscale: implement >8bit scaling support.
  build: fix creation of tools dir with make 3.81
  build: Mark all-yes Makefile target as phony.
  pixfmt: fix YUV422/444 wrong endian comment
  build: create output directories as needed
  Add new yuv444 pixfmts to avcodec_align_dimensions2

Conflicts:
	Makefile
	configure
	libavutil/pca.c
	libavutil/pca.h
	libavutil/pixfmt.h
	libswscale/swscale.c
	libswscale/utils.c
	libswscale/x86/swscale_template.c
	tests/ref/lavfi/pixdesc
	tests/ref/lavfi/pixfmts_copy
	tests/ref/lavfi/pixfmts_null
	tests/ref/lavfi/pixfmts_scale
	tests/ref/lavfi/pixfmts_vflip

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-06-30 04:32:24 +02:00
Diego Biurrun 812f2376ee rational-test: Add proper main() declaration to fix gcc warnings. 2011-06-30 01:35:47 +02:00
Mans Rullgard 2912e87a6c Replace FFmpeg with Libav in licence headers
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-19 13:33:20 +00:00
Michael Niedermayer 59a3bf0e51 Add selftest code for av_cmp_q().
Originally committed as revision 25339 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-10-05 01:43:34 +00:00
Stefano Sabatini 6b4ed22f75 Make av_d2q() manage the case in which the value to convert is inf.
Originally committed as revision 25332 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-10-04 13:41:01 +00:00
Stefano Sabatini 1405782cf4 Avoid cast of double nan to int.
It may cause exceptions on some platform.

Originally committed as revision 25311 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-10-02 09:50:56 +00:00
Måns Rullgård b64b4134d5 Rename libavutil/assert.h to avassert.h
This avoids conflicts with the system assert.h.

Originally committed as revision 25284 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-10-01 13:55:13 +00:00
Michael Niedermayer b926b6282d av_assert() system.
With this the developer can now choose if he wants an assert always enabled or at which
compile time assert level. This can thus replace the #define NDEBUG hacks

Originally committed as revision 25278 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-09-30 21:57:31 +00:00
David Conrad 31fdd64194 Convert NaN to 0/0 in av_d2q
This fixes aspect ratio calculation for encoding from files with 0/0 stored,
common with ogg/theora

Originally committed as revision 23280 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-05-24 00:44:02 +00:00
Diego Biurrun ba87f0801d Remove explicit filename from Doxygen @file commands.
Passing an explicit filename to this command is only necessary if the
documentation in the @file block refers to a file different from the
one the block resides in.

Originally committed as revision 22921 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-04-20 14:45:34 +00:00
Diego Biurrun bad5537e2c Use full internal pathname in doxygen @file directives.
Otherwise doxygen complains about ambiguous filenames when files exist
under the same name in different subdirectories.

Originally committed as revision 16912 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-02-01 02:00:19 +00:00
Diego Biurrun 674bd4f691 cosmetics: Use 'num' instead of 'nom' as abbreviation for numerator.
Originally committed as revision 16910 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-02-01 00:20:45 +00: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
Diego Biurrun dfcb6b56f9 Directly #include a bunch of indirectly #included headers.
Originally committed as revision 16748 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-01-24 14:55:30 +00:00
Aurelien Jacobs 9ce6c13879 export gcd function as av_gcd()
Originally committed as revision 16653 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-01-17 11:13:33 +00:00
Stefano Sabatini 05b90fc0c5 Implement av_nearer_q() and av_find_nearest_q_idx() functions.
Originally committed as revision 15415 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-09-25 19:23:13 +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
Dujardin Bernard 0b0065992e move doxy comments from rational.c to rational.h and add some new comments
patch by Dujardin Bernard %dujardin P iut A numericable P fr%

Originally committed as revision 8132 to svn://svn.ffmpeg.org/ffmpeg/trunk
2007-02-26 14:27:29 +00:00
Michael Niedermayer 6880edab82 fix av_reduce() with things like 1/0 and 0/0
Originally committed as revision 7431 to svn://svn.ffmpeg.org/ffmpeg/trunk
2007-01-09 11:58:06 +00:00
Michael Niedermayer 62b9fc1571 fix overflow and remove wrong comment
Originally committed as revision 7187 to svn://svn.ffmpeg.org/ffmpeg/trunk
2006-11-30 11:43:08 +00:00
Michael Niedermayer 3db1b8b538 return optimal fraction
based on a patch by Uoti Urpala

Originally committed as revision 7186 to svn://svn.ffmpeg.org/ffmpeg/trunk
2006-11-30 01:18:57 +00:00
Diego Biurrun c26abfa541 Rename ABS macro to FFABS.
Originally committed as revision 6666 to svn://svn.ffmpeg.org/ffmpeg/trunk
2006-10-11 23:17:58 +00:00
Diego Biurrun b78e7197a8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
and fix GPL/LGPL version mismatches.

Originally committed as revision 6577 to svn://svn.ffmpeg.org/ffmpeg/trunk
2006-10-07 15:30:46 +00:00
Michael Niedermayer 79dc59b726 simplify
Originally committed as revision 5802 to svn://svn.ffmpeg.org/ffmpeg/trunk
2006-07-20 10:14:06 +00:00
Michael Niedermayer 0912bf577a for floats fabs is better & smaller then ABS
Originally committed as revision 5801 to svn://svn.ffmpeg.org/ffmpeg/trunk
2006-07-20 09:06:23 +00:00
Diego Biurrun 5509bffa88 Update licensing information: The FSF changed postal address.
Originally committed as revision 4842 to svn://svn.ffmpeg.org/ffmpeg/trunk
2006-01-12 22:43:26 +00:00
Diego Biurrun 115329f160 COSMETICS: Remove all trailing whitespace.
Originally committed as revision 4749 to svn://svn.ffmpeg.org/ffmpeg/trunk
2005-12-17 18:14:38 +00:00
Alexander Strasser c11c2bc20b libavutil: Utility code from libavcodec moved to a separate library.
Originally committed as revision 4489 to svn://svn.ffmpeg.org/ffmpeg/trunk
2005-08-01 20:07:05 +00:00
Diego Biurrun 80391552c9 libavutil: Remove pointless rational test program. 2012-03-26 13:00:09 +02:00