summaryrefslogtreecommitdiff
path: root/libavcodec/rv34.c
Commit message (Collapse)AuthorAge
* avcodec/codec_internal: Make FFCodec.decode use AVFrame*Andreas Rheinhardt2022-04-05
| | | | | | | | This increases type-safety by avoiding conversions from/through void*. It also avoids the boilerplate "AVFrame *frame = data;" line for non-subtitle decoders. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/internal: Move FF_QSCALE_TYPE_* to mpegvideodec.hAndreas Rheinhardt2022-03-23
| | | | | | These values are only used by mpegvideo-based decoders. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo: Move decoder-only stuff to a new headerAndreas Rheinhardt2022-02-13
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/thread: Don't use ThreadFrame when unnecessaryAndreas Rheinhardt2022-02-09
| | | | | | | | | | | | | | | | | | | | | | | The majority of frame-threaded decoders (mainly the intra-only) need exactly one part of ThreadFrame: The AVFrame. They don't need the owners nor the progress, yet they had to use it because ff_thread_(get|release)_buffer() requires it. This commit changes this and makes these functions work with ordinary AVFrames; the decoders that need the extra fields for progress use ff_thread_(get|release)_ext_buffer() which work exactly as ff_thread_(get|release)_buffer() used to do. This also avoids some unnecessary allocations of progress AVBuffers, namely for H.264 and HEVC film grain frames: These frames are not used for synchronization and therefore don't need a ThreadFrame. Also move the ThreadFrame structure as well as ff_thread_ref_frame() to threadframe.h, the header for frame-threaded decoders with inter-frame dependencies. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/thread: Move ff_thread_(await|report)_progress to new headerAndreas Rheinhardt2022-02-09
| | | | | | | | | | This is in preparation for further commits that will stop using ThreadFrame for frame-threaded codecs that don't use ff_thread_(await|report)_progress(); the API for those codecs having inter-frame depdendencies will live in threadframe.h. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/rv34: Move dsp init code to rv30/rv40Andreas Rheinhardt2021-04-12
| | | | | | It avoids both runtime and compile-time checks. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/rv34, mpegvideo: Fix segfault upon frame size change errorAndreas Rheinhardt2021-04-08
| | | | | | | | | | | | | | | | | | | | | The RealVideo 3.0 and 4.0 decoders call ff_mpv_common_init() only during their init function and not during decode_frame(); when the size of the frame changes, they call ff_mpv_common_frame_size_change(). Yet upon error, said function calls ff_mpv_common_end() which frees the whole MpegEncContext and not only those parts that ff_mpv_common_frame_size_change() reinits. As a result, the context will never be usable again; worse, because decode_frame() contains no check for whether the context is initialized or not, it is presumed that it is initialized, leading to segfaults. Basically the same happens if rv34_decoder_realloc() fails. This commit fixes this by only resetting the parts that ff_mpv_common_frame_size_change() changes upon error and by actually checking whether the context is in need of reinitialization in ff_rv34_decode_frame(). Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* mpegvideo: use the AVVideoEncParams API for exporting QP tablesAnton Khirnov2021-01-01
| | | | | | | | | | Do it only when requested with the AV_CODEC_EXPORT_DATA_VIDEO_ENC_PARAMS flag. Drop previous code using the long-deprecated AV_FRAME_DATA_QP_TABLE* API. Temporarily disable fate-filter-pp, fate-filter-pp7, fate-filter-spp. They will be reenabled once these filters are converted in following commits.
* lavu: move LOCAL_ALIGNED from internal.h to mem_internal.hAnton Khirnov2021-01-01
| | | | That is a more appropriate place for it.
* avcodec/mpegvideo: Merge ff_mpv_decode_defaults into ff_mpv_decode_initAndreas Rheinhardt2020-12-31
| | | | | | | | | | | | | These two are always called directly after each other (with the exception of the calls in mpeg_decode_init() where some irrelevant modifications of the avctx (which could just as well be done before ff_mpv_decode_defaults(), because it doesn't have a pointer to the AVCodecContext at all and therefore can't see these modifications at all) are performed in between), so merge ff_mpv_decode_defaults() in ff_mpv_decode_init(). Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/rv34: Make initializing static VLC tables thread-safeAndreas Rheinhardt2020-12-08
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/rv34: Avoid offsets table for initialization of static VLCsAndreas Rheinhardt2020-12-08
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/rv34: Simplify getting right VLCAndreas Rheinhardt2020-10-26
| | | | | | | | | | | For both RealVideo 3.0 as well as RealVideo 4.0 the VLC table to use depends upon the slice's quantization parameter; these are coded on five bits in the bitstream and are therefore in the range of 0..31; yet the last element here is not valid and therefore the quantizer is clipped to the range 0..30 to get the index. But this is unnecessary: One can just add one element more to the relevant array to avoid the clipping. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/rv34: Don't needlessly copy VLC length and symbol arraysAndreas Rheinhardt2020-10-26
| | | | | | | | | | | | | | | | | | | | | | | Most of the VLCs used by RealVideo 3 and 4 obey three simple rules: Shorter codes are on the left of the tree, for each length, the symbols are ascending from left to right and the symbols either form a permutation of 1..size or 0..(size - 1). For the latter case, one just needs to store the length of each symbol and create the codes according to the other rules; no explicit code or symbol array must be stored. The former case is also treated in much the same way by artificially assigning a length of zero to the symbol 0; when a length of zero was encountered, the element was ignored except that the symbol counter was still incremented. If the length was nonzero, the symbol would be assigned via the symbol counter and the length copied over into a new array. Yet this is unnecessary, as ff_init_vlc_sparse() follows exactly the same pattern: If a length of zero is encountered, the element is ignored and only the symbol counter incremented. So one can directly forward the length array and also need not create a symbol table oneself, because ff_init_vlc_sparse() will infer the same symbol table in this case. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* pthread_frame: merge the functionality for normal decoder init and ↵Anton Khirnov2020-04-10
| | | | | | | | | | | | | | | | init_thread_copy The current design, where - proper init is called for the first per-thread context - first thread's private data is copied into private data for all the other threads - a "fixup" function is called for all the other threads to e.g. allocate dynamically allocated data is very fragile and hard to follow, so it is abandoned. Instead, the same init function is used to init each per-thread context. Where necessary, AVCodecInternal.is_copy can be used to differentiate between the first thread and the other ones (e.g. for decoding the extradata just once).
* lavc: replace AVCodecInternal.allocate_progress with an internal capAnton Khirnov2020-04-10
| | | | This is a constant codec property, so a capability flag is more appropriate.
* libavcodec/rv34: error out earlier on missing referencesMichael Niedermayer2018-04-07
| | | | | | | | Fixes visual corruption on seeking Fixes: downloadTest_clip_24M.rmvb Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/rv34: Fix runtime error: signed integer overflow: 768 * 4126720 ↵Michael Niedermayer2017-05-17
| | | | | | | | | cannot be represented in type 'int' Fixes: 1655/clusterfuzz-testcase-minimized-5587079276789760 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/rv34: Fix runtime error: signed integer overflow: 36880 * 66288 ↵Michael Niedermayer2017-03-13
| | | | | | | | | cannot be represented in type 'int' Fixes: 768/clusterfuzz-testcase-4807444305805312 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/rv34: Simplify and factor get_slice_offset() codeMichael Niedermayer2017-02-24
| | | | | | | | | This also fixes several integer overflows by checking each value before use. Fixes: 662/clusterfuzz-testcase-4898131432964096 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/rv34: Forward error from rv34_decode_mv()Michael Niedermayer2017-02-22
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/rv34: Fix runtime error: signed integer overflow: -2 + -2147483648 ↵Michael Niedermayer2017-02-22
| | | | | | | | | cannot be represented in type 'int' Fixes: 642/clusterfuzz-testcase-558358808074649 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Merge commit '4024b566d664a4b161d677554be52f32e7ad4236'Hendrik Leppkes2016-06-26
|\ | | | | | | | | | | | | * commit '4024b566d664a4b161d677554be52f32e7ad4236': golomb: Give svq3_get_se_golomb()/svq3_get_ue_golomb() better names Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * golomb: Give svq3_get_se_golomb()/svq3_get_ue_golomb() better namesDiego Biurrun2016-05-25
| |
* | Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'Clément Bœsch2016-06-21
|\| | | | | | | | | | | | | * commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb': cosmetics: Fix spelling mistakes Merged-by: Clément Bœsch <u@pkh.me>
| * cosmetics: Fix spelling mistakesVittorio Giovara2016-05-04
| | | | | | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
* | avcodec/rv34: Delay failure return for B frames with a missing referenceMichael Niedermayer2015-09-17
| | | | | | | | | | | | | | Failing earlier causes the context to be insufficiently initialized which can break decoding future frames with threads Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/rv34: Clear pointers in ff_rv34_decode_init_thread_copy()Michael Niedermayer2015-07-18
| | | | | | | | | | | | | | | | Avoids leaving stale pointers Fixes: signal_sigabrt_7ffff70eccc9_819_sabtriple.rm with memlimit 536870912 Found-by: Samuel Groß, Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit 'da0c8664b4dc906696803685f7e53ade68594ab8'Michael Niedermayer2015-06-08
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'da0c8664b4dc906696803685f7e53ade68594ab8': mpegvideo: Move various temporary buffers to a separate context Conflicts: libavcodec/mpegvideo.c libavcodec/mpegvideo_enc.c libavcodec/mpegvideo_motion.c libavcodec/rv34.c libavcodec/vc1_mc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * mpegvideo: Move various temporary buffers to a separate contextVittorio Giovara2015-06-08
| |
* | avcodec/mpegvideo: Factor ff_mpv_decode_init() outMichael Niedermayer2014-09-05
| | | | | | | | | | Reviewed-by: Benoit Fouet <benoit.fouet@free.fr> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit 'dc4b2e7d33903a6b9380e8a84b22b3a20facbb08'Michael Niedermayer2014-08-22
|\| | | | | | | | | | | | | * commit 'dc4b2e7d33903a6b9380e8a84b22b3a20facbb08': rv34: use ff_mpeg_update_thread_context only when decoder is fully initialized Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * rv34: use ff_mpeg_update_thread_context only when decoder is fully initializedJanne Grunau2014-08-22
| | | | | | | | | | | | | | | | | | | | | | | | | | MpegEncContext based decoders are only fully initialized after the first ff_thread_get_buffer() call. The RV30/40 decoders may fail before a frame buffer was requested. ff_mpeg_update_thread_context() fails on half initialized MpegEncContexts. Since this can only happen before a the first frame was decoded there is no need to call ff_mpeg_update_thread_context(). Based on patches by John Stebbins and tested by John Stebbins. CC: libav-stable@libav.org
* | Merge commit '4b1f5e5090abed6c618c8ba380cd7d28d140f867'Michael Niedermayer2014-08-15
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '4b1f5e5090abed6c618c8ba380cd7d28d140f867': cosmetics: Write NULL pointer inequality checks more compactly Conflicts: libavcodec/dvdsubdec.c libavcodec/h263dec.c libavcodec/libxvid.c libavcodec/rv10.c libavcodec/utils.c libavformat/format.c libavformat/matroskadec.c libavformat/segment.c libavutil/opt.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * cosmetics: Write NULL pointer inequality checks more compactlyGabriel Dume2014-08-15
| | | | | | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
* | Merge commit '835f798c7d20bca89eb4f3593846251ad0d84e4b'Michael Niedermayer2014-08-15
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '835f798c7d20bca89eb4f3593846251ad0d84e4b': mpegvideo: cosmetics: Lowercase ugly uppercase MPV_ function name prefixes Conflicts: libavcodec/h261dec.c libavcodec/intrax8.c libavcodec/mjpegenc.c libavcodec/mpeg12dec.c libavcodec/mpeg12enc.c libavcodec/mpeg4videoenc.c libavcodec/mpegvideo.c libavcodec/mpegvideo.h libavcodec/mpegvideo_enc.c libavcodec/rv10.c libavcodec/x86/mpegvideoenc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * mpegvideo: cosmetics: Lowercase ugly uppercase MPV_ function name prefixesDiego Biurrun2014-08-15
| |
* | Merge commit '998c9f15d1ca8c7489775ebcca51623b915988f1'Michael Niedermayer2014-08-15
|\| | | | | | | | | | | | | | | | | | | | | | | | | * commit '998c9f15d1ca8c7489775ebcca51623b915988f1': idct: remove call to ff_idctdsp_init from ff_MPV_common_init Conflicts: libavcodec/dnxhdenc.c libavcodec/h263dec.c libavcodec/mpegvideo.c libavcodec/mpegvideo.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * idct: remove call to ff_idctdsp_init from ff_MPV_common_initJohn Stebbins2014-08-14
| | | | | | | | | | One step in untangling the mpegvideo code and fixing some problems in the order that initialization is being done in h263dec and h261dec.
* | avcodec/rv34: fix crash while seeking on very damaged fileMichael Niedermayer2014-07-11
| | | | | | | | | | | | | | Fixes null pointer dereference Fixes Ticket2093 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit '7b9ef8d701c319c26f7d0664fe977e176764c74e'Michael Niedermayer2014-06-23
|\| | | | | | | | | | | | | | | | | | | | | | | * commit '7b9ef8d701c319c26f7d0664fe977e176764c74e': mpeg: Split error resilience bits off into a separate file Conflicts: configure libavcodec/Makefile libavcodec/mpegvideo.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * mpeg: Split error resilience bits off into a separate fileDiego Biurrun2014-06-22
| |
* | avcodec/rv34: fix edge emu with uv stride <= 25Michael Niedermayer2014-06-13
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit '368f50359eb328b0b9d67451f56fda20b3255f9a'Michael Niedermayer2014-05-30
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '368f50359eb328b0b9d67451f56fda20b3255f9a': dsputil: Split off quarterpel bits into their own context Conflicts: configure libavcodec/dsputil.c libavcodec/h263dec.c libavcodec/mpegvideo.c libavcodec/mpegvideo_enc.c libavcodec/vc1dec.c libavcodec/vc1dsp.c libavcodec/x86/dsputil_init.c libavcodec/x86/qpeldsp.asm Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * dsputil: Split off quarterpel bits into their own contextDiego Biurrun2014-05-29
| |
* | avcodec/rv34: Fix () in GET_PTS_DIFF() macroMichael Niedermayer2014-05-25
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge remote-tracking branch 'qatar/master'Michael Niedermayer2014-04-09
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * qatar/master: mpegvideo: operate with pointers to AVFrames instead of whole structs Conflicts: libavcodec/h261dec.c libavcodec/h263dec.c libavcodec/intrax8.c libavcodec/mpeg12enc.c libavcodec/mpegvideo.c libavcodec/mpegvideo.h libavcodec/mpegvideo_enc.c libavcodec/mpegvideo_motion.c libavcodec/mpegvideo_xvmc.c libavcodec/msmpeg4.c libavcodec/ratecontrol.c libavcodec/vaapi.c libavcodec/vc1dec.c libavcodec/vdpau_vc1.c See: fc567ac49e17151f00f31b59030cd10f952612ef Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * mpegvideo: operate with pointers to AVFrames instead of whole structswm42014-04-09
| | | | | | | | | | | | | | | | | | | | | | | | | | The most interesting parts are initialization in ff_MPV_common_init() and uninitialization in ff_MPV_common_end(). ff_mpeg_unref_picture and ff_thread_release_buffer have additional NULL checks for Picture.f, because these functions can be called on uninitialized or partially initialized Pictures. NULL pointer checks are added to ff_thread_release_buffer() stub function. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | Merge commit 'e0c16e4e3259cf50b5bac4c23bb6e517f397c74b'Michael Niedermayer2014-03-17
|\| | | | | | | | | | | | | | | | | | | | | | | | | * commit 'e0c16e4e3259cf50b5bac4c23bb6e517f397c74b': mpegvideo: move mpegvideo formats-related defines to mpegutils.h Conflicts: libavcodec/h264_cabac.c libavcodec/h264_cavlc.c libavcodec/h264_mvpred.h libavcodec/svq1enc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * mpegvideo: move mpegvideo formats-related defines to mpegutils.hVittorio Giovara2014-03-16
| |