Commit Graph

69 Commits

Author SHA1 Message Date
Andreas Rheinhardt 790f793844 avutil/common: Don't auto-include mem.h
There are lots of files that don't need it: The number of object
files that actually need it went down from 2011 to 884 here.

Keep it for external users in order to not cause breakages.

Also improve the other headers a bit while just at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-31 00:08:43 +01:00
Andreas Rheinhardt 363837de0e avcodec/faxcompr: Avoid superfluous VLC structures
Of all these VLCs here, only VLC.table was really used
after init, so use the ff_vlc_init_tables API
to get rid of them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:46:59 +01:00
Andreas Rheinhardt 9cdf82c2c2 avcodec/vlc: Use proper namespace
Therefore use a proper prefix for this API, e.g.
ff_init_vlc_sparse -> ff_vlc_init_sparse
ff_free_vlc        -> ff_vlc_free
INIT_VLC_LE        -> VLC_INIT_LE
INIT_VLC_USE_NEW_STATIC -> VLC_INIT_USE_STATIC
(The ancient INIT_VLC_USE_STATIC has been removed
in 595324e143, so that
the NEW has been dropped.)
Finally, reorder the flags and change their values
accordingly.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-11 00:27:45 +02:00
Andreas Rheinhardt 2d764069be avcodec/vlc: Use structure instead of VLC_TYPE array as VLC element
In C, qualifiers for arrays are broken:
const VLC_TYPE (*foo)[2] is a pointer to an array of two const VLC_TYPE
elements and unfortunately this is not compatible with a pointer
to a const array of two VLC_TYPE, because the latter does not exist
as array types are never qualified (the qualifier applies to the base
type instead). This is the reason why get_vlc2() doesn't accept
a const VLC table despite not modifying the table at all, as
there is no automatic conversion from VLC_TYPE (*)[2] to
const VLC_TYPE (*)[2].

Fix this by using a structure VLCElem for the VLC table.
This also has the advantage of making it clear which
element is which.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-17 16:47:29 +02:00
Michael Niedermayer f803635c4f avcodec/faxcompr: Check for end of input in cmode == 1 in decode_group3_2d_line()
Fixes: Infinite loop
Fixes: 35591/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-4503764022198272

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-08-10 18:05:13 +02:00
Michael Niedermayer ff56c139e0 avcodec/faxcompr: Check available bits in decode_uncompressed()
Fixes: Timeout
Fixes: 34950/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5686764151898112
Fixes: 34966/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-4587409334468608

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-06-12 14:22:42 +02:00
Michael Niedermayer 7d8421e3d5 avcodec/faxcompr: Check if bits are available before reading in cmode == 9 || cmode == 10
Fixes: Timeout
Fixes: 34950/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5686764151898112

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-06-12 14:22:42 +02:00
Michael Niedermayer 08d2df4153 avcodec/faxcompr: Check for end of bitstream in decode_group3_1d_line() and decode_group3_2d_line()
Fixes: infinite loop
Fixes: 33674/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-4816457818046464

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-05-04 17:55:24 +02:00
Michael Niedermayer 7b3881f0da avcodec/faxcompr: Check remaining bits on error in decode_group3_1d_line()
Fixes: Timeout
Fixes: 32886/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-4779761466474496

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-04-22 15:06:55 +02:00
Andreas Rheinhardt f41f58f0a7 avcodec/faxcompr: Make ff_ccitt_unpack_init() thread-safe
This will allow to make the TIFF decoder's init function thread-safe.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-04 15:46:46 +01:00
Michael Niedermayer d4a731b84a avcodec/faxcompr: Add missing runs check in decode_uncompressed()
Fixes out of array access
Fixes: 54e488b9da4abbceaf405d6492515697/asan_heap-oob_32769b0_160_a8755eb08ee8f9579348501945a33955.TIF

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-05 21:36:14 +01:00
Michael Niedermayer 012784052a avcodec/faxcompr: negate uncompressed runs
Fixes remaining part of Ticket700

Found-by: ami_stuff
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-14 13:54:05 +02:00
Michael Niedermayer b2e95e012c avcodec/faxcompr: Factor decode_uncompressed() out
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-14 13:47:18 +02:00
Michael Niedermayer a4f9bb228b avcodec/faxcompr: Support uncompressed escapes in decode_group3_1d_line()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-13 17:01:11 +02:00
Michael Niedermayer 38025e6898 avcodec/faxcompr: Support cmode == 9 && xxx == 7
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-13 16:11:00 +02:00
Michael Niedermayer bd2d4cc4a9 avcodec/faxcompr: Print the unsupported mode number
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-13 14:39:15 +02:00
Dyami Caliri 50833c9f7b Fix buffer_size argument to init_put_bits() in multiple encoders.
Several encoders were multiplying the buffer size by 8, in order to get
a bit size. However, the buffer_size argument is for the byte size of
the buffer. We had experienced crashes encoding prores (Anatoliy) at
size 4096x4096.
2015-02-26 20:14:00 +01:00
Michael Niedermayer 424ed1a83e avcodec/faxcompr: Fix memleak
Fixes CID1270816

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-18 11:38:00 +01:00
Paul B Mahol 134e8c73ea avcodec/faxcompr: use init_get_bits8()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-02-07 17:16:14 +00:00
Michael Niedermayer 713e62e91d avcodec/faxcompr: use av_malloc_array()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-12 15:37:57 +02:00
Michael Niedermayer f973f17416 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  faxcompr: return meaningful errors

Conflicts:
	libavcodec/faxcompr.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-08 12:38:18 +02:00
Michael Niedermayer a5a9bcc876 Merge commit 'f32aefcf349f2f1367f0143782397643416d18f3'
* commit 'f32aefcf349f2f1367f0143782397643416d18f3':
  faxcompr: K&R formatting cosmetics

Conflicts:
	libavcodec/faxcompr.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-08 12:30:15 +02:00
Luca Barbato a3b2b83f01 faxcompr: return meaningful errors
And optionally forward them to the caller instead of concealing them.

Unify err and ret in a single variable.
2013-06-07 17:23:53 +02:00
Luca Barbato f32aefcf34 faxcompr: K&R formatting cosmetics 2013-06-07 17:23:53 +02:00
Michael Niedermayer 6f9ae391de faxcompr: Dont read ref when the end has been reached in pass mode
Fixes reading over the end

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-12 22:55:44 +01:00
Michael Niedermayer 98b7a50a21 tiffdec: Fix runend handling
Fixes Ticket1999

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-24 04:35:12 +01:00
Michael Niedermayer 5891e454a6 faxcompr: fix out of array read
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-07 12:36:00 +02:00
Michael Niedermayer 438b86fed4 faxcompr: fix byte alignment case
Fixes Ticket1653

Found-by: ami_stuff
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-08-30 22:24:58 +02:00
Michael Niedermayer 3a1ca240d9 ccitt fax: fix some group3 1d files without EOL
Fixes Ticket832

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-08-17 02:58:41 +02:00
Michael Niedermayer 367d9b2957 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  swscale: K&R formatting cosmetics (part II)
  tiffdec: Add a malloc check and refactor another.
  faxcompr: Check malloc results and unify return path
  configure: escape colons in values written to config.fate
  ac3dsp: call femms/emms at the end of float_to_fixed24() for 3DNow and SSE
  matroska: Fix leaking memory allocated for laces.
  pthread: Fix crash due to fctx->delaying not being cleared.
  vp3: Assert on invalid filter_limit values.
  h264: fix 10bit biweight functions after recent x86inc.asm fixes.
  ffv1: Fix size mismatch in encode_line.
  movenc: Remove a dead initialization
  git-howto: Explain how to avoid Windows line endings in git checkouts.
  build: Move all arch OBJS declarations into arch subdirectory Makefiles.

Conflicts:
	configure
	libavcodec/vp3.c
	libavformat/matroskadec.c
	libavutil/Makefile
	libswscale/Makefile
	libswscale/swscale.c
	libswscale/swscale_internal.h
	libswscale/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-04-13 21:50:37 +02:00
Alex Converse 99a335299f faxcompr: Check malloc results and unify return path 2012-04-13 09:49:13 -07:00
Michael Niedermayer 6cb2085278 Merge remote-tracking branch 'qatar/master'
* qatar/master: (27 commits)
  ppc: Add ff_ prefix to nonstatic symbols
  sh4: Add ff_ prefix to nonstatic symbols
  mpegvideo: Add ff_ prefix to nonstatic functions
  rtjpeg: Add ff_ prefix to nonstatic symbols
  rv: Add ff_ prefix to nonstatic symbols
  vp56: Add ff_ prefix to nonstatic symbols
  vorbis: Add ff_ prefix to nonstatic symbols
  msmpeg4: Add ff_ prefix to nonstatic symbols
  vc1: Add ff_ prefix to nonstatic symbols
  msmpeg4: Add ff_ prefixes to nonstatic symbols
  snow: Add ff_ prefix to nonstatic symbols
  mpeg12: Add ff_ prefix to nonstatic symbols
  mpeg4: Add ff_ prefixes to nonstatic symbols
  lagarith: Add ff_ prefix to lag_rac_init
  libavcodec: Add ff_ prefix to j_rev_dct*
  dsputil: Add ff_ prefix to inv_zigzag_direct16
  libavcodec: Prefix fdct_ifast, fdct_ifast248
  dsputil: Add ff_ prefix to the dsputil*_init* functions
  libavcodec: Add ff_ prefix to some nonstatic symbols
  vlc/rl: Add ff_ prefix to the nonstatic symbols
  ...

Conflicts:
	libavcodec/Makefile
	libavcodec/allcodecs.c
	libavcodec/dnxhddec.c
	libavcodec/ffv1.c
	libavcodec/h263.h
	libavcodec/h263dec.c
	libavcodec/h264.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo_enc.c
	libavcodec/nuv.c
	libavcodec/ppc/dsputil_ppc.c
	libavcodec/proresdsp.c
	libavcodec/svq3.c
	libavcodec/version.h
	libavformat/dv.h
	libavformat/dvenc.c
	libavformat/matroskadec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-02-16 01:34:37 +01:00
Martin Storsjö e96b4a53df vlc/rl: Add ff_ prefix to the nonstatic symbols
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-15 22:06:26 +02:00
Michael Niedermayer 042f9d62ca Merge remote-tracking branch 'qatar/master'
* qatar/master:
  configure: Automatically add more flags required on symbian
  mem.h: switch doxygen parameter order to match function prototype
  doxygen: replace @sa tag by the more readable but equivalent @see
  doxygen: use Doxygen markup for authors and web links where appropriate
  doxygen: do not include license boilerplate in Doxygen documentation
  ac3enc: Mark AVClasses const
  ffserver: Replace two loops with one loop.
  ffmpeg: Fix the check for experimental codecs
  swscale: extend mmx padding.
  swscale: clip unscaled colorspace conversion path.
  doxygen: misc consistency cosmetics
  doc: remove file name from @file directive in Doxygen usage example
  doxygen: consistently place brief description
  doxygen: place empty line between brief description and detailed description
  avformat_open_input(): Add braces to shut up gcc warning.

Conflicts:
	libavcodec/8svx.c
	libavcodec/tiff.c
	libavcodec/tiff.h
	libavcodec/vaapi_h264.c
	libavcodec/vorbis.c
	libavcodec/vorbisdec.c
	libavcodec/vp6.c
	libswscale/swscale_unscaled.c
	libswscale/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-07-15 17:51:09 +02:00
Diego Biurrun f6f95d4e49 doxygen: consistently place brief description 2011-07-14 20:49:37 +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
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
Reimar Döffinger badce93dad Simplify r20025: use align_get_bits instead of reimplementing it.
Originally committed as revision 20079 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-09-29 11:06:04 +00:00
Kostya Shishkov a5568f4608 Make sure all the bits are written to output in fax data decoder.
This fixes decoding TIFF images with fax compression and width being not
multiple of eight (and issue 1429).

Originally committed as revision 20072 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-09-29 05:55:14 +00:00
Kostya Shishkov d2cdf20147 cosmetics: reindent and reformat function declarations
Originally committed as revision 20066 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-09-28 05:19:13 +00:00
Kostya Shishkov 8da5d3dc37 Finally distinguish TIFF_CCITT_RLE and TIFF_G3 1-D case, so both of them
will be decoded correctly.
This fixes issue 1423.

Originally committed as revision 20065 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-09-28 05:17:20 +00:00
Kostya Shishkov a8c7a3d2c1 Fix decoding of TIFF CCITT RLE compressed data.
This fixes issue 1417.

Originally committed as revision 20025 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-09-26 05:48:50 +00:00
Stefano Sabatini 9106a698e7 Rename bitstream.h to get_bits.h.
Originally committed as revision 18494 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-04-13 16:20:26 +00:00
Stefano Sabatini b275500706 Split bitstream.h, put the bitstream writer stuff in the new file
put_bits.h.

Originally committed as revision 18461 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-04-12 08:35:26 +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 dc8a7c93d3 Add missing void keyword to parameterless function declarations.
Originally committed as revision 16860 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-01-30 18:38:25 +00:00
Michael Niedermayer a56f82eaf8 indent
Originally committed as revision 16348 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-12-26 18:39:24 +00:00
Michael Niedermayer 537bf4266f Simplify vertical mode
Originally committed as revision 16347 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-12-26 18:39:07 +00:00
Michael Niedermayer eb0094b224 And another sechole ...
Originally committed as revision 16346 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-12-26 18:14:59 +00:00
Michael Niedermayer 268309750b Fix yet another sechole.
Originally committed as revision 16345 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-12-26 18:06:29 +00:00