Commit Graph

149 Commits

Author SHA1 Message Date
Andreas Rheinhardt 20f9727018 avcodec/codec_internal: Add FFCodec, hide internal part of AVCodec
Up until now, codec.h contains both public and private parts
of AVCodec. This exposes the internals of AVCodec to users
and leads them into the temptation of actually using them
and forces us to forward-declare structures and types that
users can't use at all.

This commit changes this by adding a new structure FFCodec to
codec_internal.h that extends AVCodec, i.e. contains the public
AVCodec as first member; the private fields of AVCodec are moved
to this structure, leaving codec.h clean.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-21 01:33:09 +01:00
Andreas Rheinhardt a688f3c13c avcodec/internal: Move FF_CODEC_CAP_* to a new header codec_internal.h
Also move FF_CODEC_TAGS_END as well as struct AVCodecDefault.
This reduces the amount of files that have to include internal.h
(which comes with quite a lot of indirect inclusions), as e.g.
most encoders don't need it. It is furthemore in preparation
for moving the private part of AVCodec out of the public codec.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-21 01:33:09 +01:00
Andreas Rheinhardt a88a141c17 avcodec: Remove unnecessary h263.h inclusions
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-09 09:46:21 +01:00
Andreas Rheinhardt a247ac640d avcodec: Constify AVCodecs
Given that the AVCodec.next pointer has now been removed, most of the
AVCodecs are not modified at all any more and can therefore be made
const (as this patch does); the only exceptions are the very few codecs
for external libraries that have a init_static_data callback.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:15 -03:00
Paul B Mahol 2fc309e699 avcodec/svq1dec: use av_fast_padded_malloc() for allocation pmv only when necessary 2021-03-02 15:06:22 +01:00
Andreas Rheinhardt be1f5bae31 avcodec/svq1dec: Increase nb_bits of VLC to read it in one go
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-31 23:42:05 +01:00
Andreas Rheinhardt da860802ad avcodec/svq1dec: Make decoder init-threadsafe
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-11-29 00:01:53 +01:00
Paul B Mahol 7c66d24460 avcodec/svq1dec: use av_malloc_array() to allocate pmv 2020-09-17 19:23:11 +02:00
Michael Niedermayer 55e344ee5a avcodec/svq1dec: Check that there is data left after the header
Fixes: Timeout (21sec -> 255ms)
Fixes: 20709/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SVQ1_fuzzer-5085075089915904

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-29 23:31:02 +02:00
Michael Niedermayer b4a4aadfaf libavcodec/svq: Remove ff_svq1_packet_checksum()
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-02-19 22:37:30 +01:00
Clément Bœsch 8839cbf911 Revert "avcodec/svq1: zero initialize entries array"
This reverts commit aed84ee4d1.

It is a false positive from Valgrind with recent GCC and
-funswitch-loops (present in -O3).
2017-04-10 16:10:17 +02:00
James Almer aed84ee4d1 avcodec/svq1: zero initialize entries array
Fixes valgrind warnings about "Use of uninitialised value of size 8"

Reviewed-by: Kieran Kunhya <kierank@obe.tv>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-04-09 13:38:41 -03:00
Clément Bœsch e59d8d030f Merge commit '21e500ba647aec233d5930d3d1081489d0d53ceb'
* commit '21e500ba647aec233d5930d3d1081489d0d53ceb':
  svq1dec: Change type of array pitch parameters to ptrdiff_t

Merged-by: Clément Bœsch <u@pkh.me>
2017-03-20 09:17:34 +01:00
Diego Biurrun 21e500ba64 svq1dec: Change type of array pitch parameters to ptrdiff_t
ptrdiff_t is the correct type for array pitches and similar.
2016-09-04 11:57:15 +02:00
Clément Bœsch 8ef57a0d61 Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'
* commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb':
  cosmetics: Fix spelling mistakes

Merged-by: Clément Bœsch <u@pkh.me>
2016-06-21 21:55:34 +02:00
Vittorio Giovara 41ed7ab45f cosmetics: Fix spelling mistakes
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-04 18:16:21 +02:00
Diego Biurrun 0f40c90984 Drop pointless assert.h #includes 2016-05-03 15:45:10 +02:00
Michael Niedermayer a51d4246d8 avcodec/svq1dec: Check init_get_bits8() for failure
Fixes: CID1322313

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-04 01:28:26 +02:00
Michael Niedermayer 444e9874a7 Merge commit 'def97856de6021965db86c25a732d78689bd6bb0'
* commit 'def97856de6021965db86c25a732d78689bd6bb0':
  lavc: AV-prefix all codec capabilities

Conflicts:
	cmdutils.c
	ffmpeg.c
	ffplay.c
	libavcodec/8svx.c
	libavcodec/aacenc.c
	libavcodec/ac3dec.c
	libavcodec/adpcm.c
	libavcodec/alac.c
	libavcodec/atrac3plusdec.c
	libavcodec/bink.c
	libavcodec/dnxhddec.c
	libavcodec/dvdec.c
	libavcodec/dvenc.c
	libavcodec/ffv1dec.c
	libavcodec/ffv1enc.c
	libavcodec/fic.c
	libavcodec/flacdec.c
	libavcodec/flacenc.c
	libavcodec/flvdec.c
	libavcodec/fraps.c
	libavcodec/frwu.c
	libavcodec/gifdec.c
	libavcodec/h261dec.c
	libavcodec/hevc.c
	libavcodec/iff.c
	libavcodec/imc.c
	libavcodec/libopenjpegdec.c
	libavcodec/libvo-aacenc.c
	libavcodec/libvorbisenc.c
	libavcodec/libvpxdec.c
	libavcodec/libvpxenc.c
	libavcodec/libx264.c
	libavcodec/mjpegbdec.c
	libavcodec/mjpegdec.c
	libavcodec/mpegaudiodec_float.c
	libavcodec/msmpeg4dec.c
	libavcodec/mxpegdec.c
	libavcodec/nvenc_h264.c
	libavcodec/nvenc_hevc.c
	libavcodec/pngdec.c
	libavcodec/qpeg.c
	libavcodec/ra288.c
	libavcodec/rv10.c
	libavcodec/s302m.c
	libavcodec/sp5xdec.c
	libavcodec/takdec.c
	libavcodec/tiff.c
	libavcodec/tta.c
	libavcodec/utils.c
	libavcodec/v210dec.c
	libavcodec/vp6.c
	libavcodec/vp9.c
	libavcodec/wavpack.c
	libavcodec/yop.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 22:50:18 +02:00
Michael Niedermayer 94d68a41fa Merge commit '7c6eb0a1b7bf1aac7f033a7ec6d8cacc3b5c2615'
* commit '7c6eb0a1b7bf1aac7f033a7ec6d8cacc3b5c2615':
  lavc: AV-prefix all codec flags

Conflicts:
	doc/examples/muxing.c
	ffmpeg.c
	ffmpeg_opt.c
	ffplay.c
	libavcodec/aacdec.c
	libavcodec/aacenc.c
	libavcodec/ac3dec.c
	libavcodec/ac3enc_float.c
	libavcodec/atrac1.c
	libavcodec/atrac3.c
	libavcodec/atrac3plusdec.c
	libavcodec/dcadec.c
	libavcodec/ffv1enc.c
	libavcodec/h264.c
	libavcodec/h264_loopfilter.c
	libavcodec/h264_mb.c
	libavcodec/imc.c
	libavcodec/libmp3lame.c
	libavcodec/libtheoraenc.c
	libavcodec/libtwolame.c
	libavcodec/libvpxenc.c
	libavcodec/libxavs.c
	libavcodec/libxvid.c
	libavcodec/mpeg12dec.c
	libavcodec/mpeg12enc.c
	libavcodec/mpegaudiodec_template.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo_enc.c
	libavcodec/mpegvideo_motion.c
	libavcodec/nellymoserdec.c
	libavcodec/nellymoserenc.c
	libavcodec/nvenc.c
	libavcodec/on2avc.c
	libavcodec/options_table.h
	libavcodec/opus_celt.c
	libavcodec/pngenc.c
	libavcodec/ra288.c
	libavcodec/ratecontrol.c
	libavcodec/twinvq.c
	libavcodec/vc1_block.c
	libavcodec/vc1_loopfilter.c
	libavcodec/vc1_mc.c
	libavcodec/vc1dec.c
	libavcodec/vorbisdec.c
	libavcodec/vp3.c
	libavcodec/wma.c
	libavcodec/wmaprodec.c
	libavcodec/x86/hpeldsp_init.c
	libavcodec/x86/me_cmp_init.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 22:10:35 +02:00
Vittorio Giovara def97856de lavc: AV-prefix all codec capabilities
Express bitfields more simply.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:58 +01:00
Vittorio Giovara 7c6eb0a1b7 lavc: AV-prefix all codec flags
Convert doxygen to multiline and express bitfields more simply.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:58 +01:00
Michael Niedermayer ff1d85b0ed avcodec/svq1dec: Remove duplicate buf_size check
Fixes CID1297573

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-15 20:06:24 +02:00
Michael Niedermayer 8f7b022c8c Merge commit '6a85dfc830f51f1f5c2d36d4182d265c1ea3ba25'
* commit '6a85dfc830f51f1f5c2d36d4182d265c1ea3ba25':
  lavc: Replace av_dlog and tprintf with internal macros

Conflicts:
	libavcodec/aacdec.c
	libavcodec/audio_frame_queue.c
	libavcodec/bitstream.c
	libavcodec/dcadec.c
	libavcodec/dnxhddec.c
	libavcodec/dvbsubdec.c
	libavcodec/dvdec.c
	libavcodec/dvdsubdec.c
	libavcodec/get_bits.h
	libavcodec/gifdec.c
	libavcodec/h264.h
	libavcodec/h264_cabac.c
	libavcodec/h264_cavlc.c
	libavcodec/h264_loopfilter.c
	libavcodec/h264_refs.c
	libavcodec/imc.c
	libavcodec/interplayvideo.c
	libavcodec/jpeglsdec.c
	libavcodec/libopencore-amr.c
	libavcodec/mjpegdec.c
	libavcodec/mpeg12dec.c
	libavcodec/mpegvideo_enc.c
	libavcodec/mpegvideo_parser.c
	libavcodec/pngdec.c
	libavcodec/ratecontrol.c
	libavcodec/rv10.c
	libavcodec/svq1dec.c
	libavcodec/vqavideo.c
	libavcodec/wmadec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-20 04:10:10 +02:00
Vittorio Giovara 6a85dfc830 lavc: Replace av_dlog and tprintf with internal macros 2015-04-19 12:41:59 +01:00
Michael Niedermayer 7b0daec233 avcodec/svq1dec: Fix undefined shifts
Found-by: Clang -fsanitize=shift
Reported-by: Thierry Foucu <tfoucu@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-13 11:55:45 +01:00
Michael Niedermayer 741b56fcee avcodec/svq1dec: Add assert to ensure "stages >= 0"
This is currently always true, the assert protects against
future changes to the code breaking this assumtation

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-03 23:03:38 +01:00
Michael Niedermayer cba3a46e93 Merge commit '9b8c8a9395c849639aea0f6b5300e991e93c3a73'
* commit '9b8c8a9395c849639aea0f6b5300e991e93c3a73':
  svq1dec: Validate the stages value strictly

Not merged, this is wrong, the condition is not possible

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-03 23:03:19 +01:00
Luca Barbato 9b8c8a9395 svq1dec: Validate the stages value strictly
It can be less than -1.

Bug-Id: CID 1194397 / CID 1194398
CC: libav-stable@libav.org
2015-02-03 15:23:21 +00:00
Paul B Mahol 335c150ba1 avcodec/svq1dec: remove unneeded #include, there are no assert()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-01-31 08:57:06 +00:00
Michael Niedermayer d2f9b9da03 Merge commit '5a82ad644f281701eb22e0359fd732fac67aafa4'
* commit '5a82ad644f281701eb22e0359fd732fac67aafa4':
  svq1dec: Unbreak the scratch buffer allocation

Conflicts:
	libavcodec/svq1dec.c

See: 4213fc5b9e
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-15 12:23:27 +01:00
Michael Niedermayer 5a82ad644f svq1dec: Unbreak the scratch buffer allocation
The input packets are always assumed to be padded and
the av_fast_ family of function takes a pointer to a pointer.

Thanks to Nicolas Dufresne <nicolas.dufresne@collabora.com> for
a similar patch.

Introduced in 7b588bb691.

Bug-Id: 766
CC: libav-stable@libav.org
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-12-14 22:03:58 +01:00
Michael Niedermayer e91ba2efa9 avcodec/svq1dec: zero terminate embedded message before printing
Fixes out of array access
Fixes: asan_stack-oob_49b1e5_10_009.mov
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-30 18:23:09 +01:00
Paul B Mahol 6dfa70f272 Correct few "ffmpeg" typos
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2014-08-24 11:05:42 +00:00
Michael Niedermayer 4213fc5b9e avcodec/svq1dec: Fix multiple bugs from "svq1: do not modify the input packet"
Add padding, clear size, use the correct pointer.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-07 02:27:07 +02:00
Michael Niedermayer e55e09949e Merge commit '7b588bb691644e1b3c168b99accf74248a24e3cf'
* commit '7b588bb691644e1b3c168b99accf74248a24e3cf':
  svq1: do not modify the input packet

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-07 02:08:56 +02:00
Anton Khirnov 7b588bb691 svq1: do not modify the input packet
The input data must remain constant, make a copy instead. This is in
theory a performance hit, but since I failed to find any samples
using this feature, this should not matter in practice.

Also, check the size of the header, avoiding invalid reads on truncated
data.

CC:libav-stable@libav.org
2014-08-06 18:59:27 +00:00
Michael Niedermayer 0ee905e243 Merge commit '5b9c3b4505206143d85398c1410949319fa1180f'
* commit '5b9c3b4505206143d85398c1410949319fa1180f':
  Replace all instances of avcodec_alloc_frame() with av_frame_alloc().

Conflicts:
	doc/examples/decoding_encoding.c
	doc/examples/muxing.c
	ffmpeg.c
	libavcodec/alacenc.c
	libavcodec/libopenjpegenc.c
	libavcodec/libvpxenc.c
	libavcodec/pcm.c
	libavcodec/xbmenc.c
	libavcodec/xwdenc.c
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-16 23:54:10 +01:00
Anton Khirnov 5b9c3b4505 Replace all instances of avcodec_alloc_frame() with av_frame_alloc(). 2013-11-16 12:44:20 +01:00
Michael Niedermayer ffd100b111 Merge commit 'c265b8bb7638546919465e3585441b1d40c4b13d'
* commit 'c265b8bb7638546919465e3585441b1d40c4b13d':
  tiff: stop using deprecated avcodec_set_dimensions
  targa: stop using deprecated avcodec_set_dimensions
  svq1dec: stop using deprecated avcodec_set_dimensions
  sunrast: stop using deprecated avcodec_set_dimensions

Conflicts:
	libavcodec/sunrast.c
	libavcodec/targa.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-01 15:43:29 +01:00
Anton Khirnov 7fbb75cc70 svq1dec: stop using deprecated avcodec_set_dimensions 2013-10-31 20:14:16 +01:00
Michael Niedermayer c882b62d14 avcodec/svq1dec: Use skip_1stop_8data_bits()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-30 18:28:00 +01:00
Michael Niedermayer ee77140afa Merge commit 'b2bed9325dbd6be0da1d91ffed3f513c40274fd2'
* commit 'b2bed9325dbd6be0da1d91ffed3f513c40274fd2':
  cosmetics: Group .name and .long_name together in codec/format declarations

Conflicts:
	libavcodec/8svx.c
	libavcodec/alac.c
	libavcodec/cljr.c
	libavcodec/dnxhddec.c
	libavcodec/dnxhdenc.c
	libavcodec/dpxenc.c
	libavcodec/dvdec.c
	libavcodec/dvdsubdec.c
	libavcodec/dvdsubenc.c
	libavcodec/ffv1dec.c
	libavcodec/flacdec.c
	libavcodec/flvdec.c
	libavcodec/fraps.c
	libavcodec/frwu.c
	libavcodec/g726.c
	libavcodec/gif.c
	libavcodec/gifdec.c
	libavcodec/h261dec.c
	libavcodec/h263dec.c
	libavcodec/iff.c
	libavcodec/imc.c
	libavcodec/libopencore-amr.c
	libavcodec/libopenjpegdec.c
	libavcodec/libopenjpegenc.c
	libavcodec/libspeexenc.c
	libavcodec/libvo-amrwbenc.c
	libavcodec/libvorbisenc.c
	libavcodec/libvpxenc.c
	libavcodec/libx264.c
	libavcodec/libxavs.c
	libavcodec/libxvid.c
	libavcodec/ljpegenc.c
	libavcodec/mjpegbdec.c
	libavcodec/mjpegdec.c
	libavcodec/mpeg12dec.c
	libavcodec/mpeg4videodec.c
	libavcodec/msmpeg4dec.c
	libavcodec/pgssubdec.c
	libavcodec/pngdec.c
	libavcodec/pngenc.c
	libavcodec/proresdec_lgpl.c
	libavcodec/proresenc_kostya.c
	libavcodec/ra144enc.c
	libavcodec/rawdec.c
	libavcodec/rv10.c
	libavcodec/sp5xdec.c
	libavcodec/takdec.c
	libavcodec/tta.c
	libavcodec/v210dec.c
	libavcodec/vp6.c
	libavcodec/wavpack.c
	libavcodec/xbmenc.c
	libavcodec/yop.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-04 12:34:23 +02:00
Diego Biurrun b2bed9325d cosmetics: Group .name and .long_name together in codec/format declarations 2013-10-03 23:32:01 +02:00
Michael Niedermayer b7a025092f Merge commit 'c591d4575a6f97fbbe6145304b1ea960e8e81e14'
* commit 'c591d4575a6f97fbbe6145304b1ea960e8e81e14':
  avcodec: Replace local extern declarations for tables with header #includes

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-16 13:01:44 +02:00
Diego Biurrun c591d4575a avcodec: Replace local extern declarations for tables with header #includes 2013-08-15 14:38:03 +02:00
Michael Niedermayer 8c707a129a avcodec/svq1dec: use init_get_bits8()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-04 13:40:08 +02:00
Carl Eugen Hoyos 052838f765 Insert a newline before showing embedded svq1 messages.
Messages may start with a carriage return.
2013-06-09 19:25:43 +02:00
Ronald S. Bultje 6caa44aa7d svq1: Use hpeldsp instead of dsputil for half-pel functions
This makes svq1 independent of dsputil.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-04-19 23:18:14 +03:00
Michael Niedermayer 0a946599f8 Merge commit 'ecff5acb5a738fcb4f9e206a12070dac4bf259b3'
* commit 'ecff5acb5a738fcb4f9e206a12070dac4bf259b3':
  svq1dec: clip motion vectors to the frame size.

Conflicts:
	libavcodec/svq1dec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-17 15:52:10 +02:00