aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/vc1.c
Commit message (Collapse)AuthorAgeFilesLines
* avcodec/mpegvideo: Move loop_filter to {H263Dec,MPVEnc,VC1}ContextAndreas Rheinhardt2025-07-031-8/+8
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vc1: Stop using MpegEncContext.gbAndreas Rheinhardt2025-07-031-7/+7
| | | | | | | Add a GetBitContext to VC1Context instead. This is in preparation for removing MpegEncContext.gb. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vc1: Remove write-only qs_lastAndreas Rheinhardt2025-05-161-7/+0
| | | | | | Write-only since 9cc74c9f6e8b645e67d45b2070db004caca09af7. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: remove deprecated FF_API_TICKS_PER_FRAMEJames Almer2025-03-281-8/+0
| | | | | | Deprecated since 2023-05-15. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/mpegvideo: Move MSMPEG4 fields to MSMPEG4 contextsAndreas Rheinhardt2025-03-261-6/+6
| | | | | | | Several fields are not used by any generic code and can therefore be moved to more specialized contexts. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vc1: Add max_b_frames field to VC1ContextAndreas Rheinhardt2025-03-041-2/+2
| | | | | | | | Don't reuse MpegEncContext.max_b_frames, which is supposed to be encoder-only. Reviewed-by: Ramiro Polla <ramiro.polla@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vc1: Combine identical checksAndreas Rheinhardt2024-06-201-8/+10
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegpicture: Split MPVPicture into WorkPicture and ordinary PicAndreas Rheinhardt2024-06-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are two types of MPVPictures: Three (cur_pic, last_pic, next_pic) that are directly part of MpegEncContext and an array of MPVPictures that are separately allocated and are mostly accessed via pointers (cur|last|next)_pic_ptr; they are also used to store AVFrames in the encoder (necessary due to B-frames). As the name implies, each of the former is directly associated with one of the _ptr pointers: They actually share the same underlying buffers, but the ones that are part of the context can have their data pointers offset and their linesize doubled for field pictures. Up until now, each of these had their own references; in particular, there was an underlying av_frame_ref() to sync cur_pic and cur_pic_ptr etc. This is wasteful. This commit changes this relationship: cur_pic, last_pic and next_pic now become MPVWorkPictures; this structure does not have an AVFrame at all any more, but only the cached values of data and linesize. It also contains a pointer to the corresponding MPVPicture, establishing a more natural relationsship between the two. This already means that creating the context-pictures from the pointers can no longer fail. What has not been changed is the fact that the MPVPicture* pointers are not ownership pointers and that the MPVPictures are part of an array of MPVPictures that is owned by a single AVCodecContext. Doing so will be done in a latter commit. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo: Shorten variable namesAndreas Rheinhardt2024-06-121-1/+1
| | | | | | | | current_picture->cur_pic, last_picture->last_pic, similarly for new_picture and next_picture. Also rename the corresponding *_ptr fields. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vc1: Avoid superfluous VLC structuresAndreas Rheinhardt2023-10-311-30/+30
| | | | | | | | | | | For all VLCs here, the number of bits of the VLC is write-only, because it is hardcoded at the call site. Therefore one can replace these VLC structures with the only thing that is actually used: The pointer to the VLCElem table. And in some cases one can even avoid this. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc: deprecate AVCodecContext.ticks_per_frameAnton Khirnov2023-05-151-3/+8
| | | | | | | | For encoding, this field is entirely redundant with AVCodecContext.framerate. For decoding, this field is entirely redundant with AV_CODEC_PROP_FIELDS.
* avcodec/vc1: Move ff_vc1_init_common() to vc1dec.cAndreas Rheinhardt2022-11-061-362/+0
| | | | | | | This is possible given that it is no longer used by the parser. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vc1data: Move VLC codes/lengths tables to a headerAndreas Rheinhardt2022-11-061-34/+35
| | | | | | | and include said header at the place where the VLCs are created. This allows to make said tables static. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vc1: Move setting res_fasttx-IDCT functions to vc1dec.cAndreas Rheinhardt2022-11-061-11/+0
| | | | | | It allows to avoid compiling simple_idct.o for the VC-1 parser. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vc1: Don't use VLC to read bfractionAndreas Rheinhardt2022-11-061-4/+4
| | | | | | | The VLC here is very simple, so that it can just be read by two get_bits(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vc1: Don't check for errors for complete VLCAndreas Rheinhardt2022-11-061-1/+1
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vc1: Remove always-false checkAndreas Rheinhardt2022-11-061-2/+0
| | | | | | | | | Added in b50be4e38dc83389925dc14f24fa11e660d32197; this check was racy back then (as the VLC could be initialized concurrently) and it is redundant (always-false) since commit c742ab4e81bb9dcabfdab006d6b8b09a5808c4ce. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vc1: Don't check for AVCodecContext.codecAndreas Rheinhardt2022-11-061-2/+0
| | | | | | | | | | | | | | | This check has been added in c617bed34f39a122ab1f89581ddce9cc63885383, merging ee769c6a7c1d4ec6560f5e5a6f457b770b10fb33 to fix a possible segfault if AVCodecContext.codec is not set as it may be during parsing. While this fixes the segfault, it has the unfortunate side effect that it makes the output of the parser dependent on whether a decoder is set (and ultimately available). The fix later applied in 5d2be71b9ecf2a88752666a2c4039f4d98419d35 does not have this downside and makes checking AVCodecContext.codec superfluous. So remove this check. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/internal: Move ff_set_dimensions() to decode.hAndreas Rheinhardt2022-08-271-1/+0
| | | | | | | | | Decoder-only, as the dimensions are set by the user when encoding. Also fixup the other headers a bit while removing unnecessary internal.h inclusions. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/internal: Move ff_set_sar() to decode.hAndreas Rheinhardt2022-08-271-0/+1
| | | | | | | Only used by decoders, as the SAR has to be set by the user when encoding. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vlc: Use structure instead of VLC_TYPE array as VLC elementAndreas Rheinhardt2022-06-171-1/+1
| | | | | | | | | | | | | | | | | | 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>
* avcodec/vc1: Fix indentationAndreas Rheinhardt2022-02-141-107/+106
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vc1: Check remaining bits in ff_vc1_parse_frame_header()Michael Niedermayer2021-05-121-0/+5
| | | | | | | | Fixes: Timeout Fixes: 33156/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV3_fuzzer-6259655027326976 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vc1: Remove unused hrd fieldsAndreas Rheinhardt2021-04-121-2/+0
| | | | | | Unused since be3492ec7eb2dbb0748c123af911a06c125c90db. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vc1: Don't pretend ff_vc1_init_common() can failAndreas Rheinhardt2021-04-121-3/+1
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/vc1: Make ff_vc1_init_common() thread-safeAndreas Rheinhardt2020-12-081-14/+18
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* vcodec/vc1: compute rangex/y only for P/B framesMichael Niedermayer2019-09-281-4/+5
| | | | | | | | Fixes: left shift of 1073741824 by 1 places cannot be represented in type 'int' Fixes: 16976/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1_fuzzer-4847262047404032 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vc1: Check for excessive resolutionMichael Niedermayer2019-09-281-1/+5
| | | | | | | | | Fixes: overflow in aspect ratio calculation Fixes: signed integer overflow: 393215 * 14594 cannot be represented in type 'int' Fixes: 15728/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV3IMAGE_fuzzer-5661588893204480 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vc1: check REFDISTMichael Niedermayer2019-09-281-1/+3
| | | | | | | "9.1.1.43 P Reference Distance (REFDIST)" "The value of REFDIST shall be less than, or equal to, 16." Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vc1: fix decoding of old WMV3 formatJerome Borsboom2019-01-121-5/+0
| | | | | | | | | | The position of the second MV predicitor candidate is slightly different for the old WMV3 format indicated by RES_RTM_FLAG. This patch fixes decoding of niceday.wmv on the samples server. Fixes: #6641 Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* avcodec/vc1: FIELDTX is only present in interlaced frame I/BI picturesJerome Borsboom2018-05-201-1/+2
| | | | | | | | If v->fieldtx_is_raw is not reset to zero, it may spill over from a previous interlaced frame I/BI picture. Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vc1: more corrections for AC inverse quantization scalingJerome Borsboom2018-04-251-0/+1
| | | | | | | | | | | HALFQP should only be added to the inverse quantizer when the block is coded with PQUANT. When PQUANT is equal to ALTPQUANT, the original test for the addition of HALFQP fails. A negative value for mquant indicates that the value was derived from VOPDQUANT. Fixes #4372 Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* avcodec/vc1: correct mspel for field-interlace B framesJerome Borsboom2018-04-251-1/+1
| | | | | | | mspel indicates the use of bicubic interpolation. The check wrongly included MVMODE MV_PMODE_1MV_HPEL as using bilinear interpolation. Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* avcodec/vc1: check return value of bitplane_decoding()Paul B Mahol2018-04-231-0/+2
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* simple_idct: Template functions to support an input bitdepth parameterKieran Kunhya2018-04-021-2/+2
|
* avcodec/vc1: add bitstream elements for VAAPI VC-1 interlaced decodingJerome Borsboom2018-03-041-46/+49
| | | | | | | We need to pass more bitstream elements to the VAAPI VC-1 decoder in order to start doing interlaced decoding in hardware. Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
* Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'Clément Bœsch2016-06-211-3/+3
|\ | | | | | | | | | | | | * commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb': cosmetics: Fix spelling mistakes Merged-by: Clément Bœsch <u@pkh.me>
| * cosmetics: Fix spelling mistakesVittorio Giovara2016-05-041-3/+3
| | | | | | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
| * Drop pointless assert.h #includesDiego Biurrun2016-05-031-3/+0
| |
* | Merge commit 'f9fbd474676e903e12efe83203697d60a9d28cf9'Derek Buitenhuis2016-02-241-1/+1
|\| | | | | | | | | | | | | * commit 'f9fbd474676e903e12efe83203697d60a9d28cf9': msmpeg4data: Move WMV2 data tables to their own file Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * msmpeg4data: Move WMV2 data tables to their own fileDiego Biurrun2016-02-191-1/+1
| |
* | Merge commit '29c2d06d67724e994980045afa055c6c34611b30'Derek Buitenhuis2016-02-241-1/+0
|\| | | | | | | | | | | | | * commit '29c2d06d67724e994980045afa055c6c34611b30': cosmetics: Drop empty comment lines Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * cosmetics: Drop empty comment linesDiego Biurrun2016-02-181-1/+0
| |
* | Merge commit '6a85dfc830f51f1f5c2d36d4182d265c1ea3ba25'Michael Niedermayer2015-04-201-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
| * lavc: Replace av_dlog and tprintf with internal macrosVittorio Giovara2015-04-191-1/+1
| |
* | avcodec/vc1: Fix undefined shiftsMichael Niedermayer2015-03-151-2/+2
| | | | | | | | | | | | Found-by: Clang -fsanitize=shift Reported-by: Thierry Foucu <tfoucu@google.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/vc1: cleanup and simplificationzhaoxiu.zeng2015-02-151-112/+97
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/vc1: remove unneeded #includes, there are no assert() only av_assert*Paul B Mahol2015-01-311-3/+0
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | avcodec/vc1: fix time_base and framerateMichael Niedermayer2014-10-151-1/+0
| | | | | | | | | | | | | | They are not just inverses of each other. This should restore behavior to before the introduction of framerate Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit '7ea1b3472a61de4aa4d41b571e99418e4997ad41'Michael Niedermayer2014-10-151-5/+5
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '7ea1b3472a61de4aa4d41b571e99418e4997ad41': lavc: deprecate the use of AVCodecContext.time_base for decoding Conflicts: libavcodec/avcodec.h libavcodec/h264.c libavcodec/mpegvideo_parser.c libavcodec/utils.c libavcodec/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>