summaryrefslogtreecommitdiff
path: root/libavcodec/mpeg12enc.c
Commit message (Collapse)AuthorAgeFilesLines
* avcodec: Constify AVCodecsAndreas Rheinhardt2021-04-271-2/+2
| | | | | | | | | | 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>
* avutil/buffer: Switch AVBuffer API to size_tAndreas Rheinhardt2021-04-271-2/+2
| | | | | | | Announced in 14040a1d913794d9a3fd6406a6d8c2f0e37e0062. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: Remove private options from AVCodecContextAndreas Rheinhardt2021-04-271-7/+0
| | | | | | | | | Several options that were too codec-specific were deprecated between 0e6c8532215790bbe560a9eea4f3cc82bb55cf92 and 0e9c4fe254073b209970df3e3cb84531bc388e99. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/mpegvideo: Deprecate bframe opts for encoders not supporting themAndreas Rheinhardt2021-04-101-0/+1
| | | | | | | | | | | MPEG-1/2/4 are the only mpegvideo based encoders that support bframes; yet even the encoders not supporting bframes have options that only make sense for an encoder that supports bframes; setting any of these options for such an encoder has no impact on the encoded outcome (but setting b_strategy to two slows down encoding considerably). So deprecate these options. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo: Deprecate duplicate matrix opt for unsupported codecsAndreas Rheinhardt2021-04-101-0/+2
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo: Deprecate a53cc option for encoders != MPEG-2Andreas Rheinhardt2021-04-101-0/+2
| | | | | | | The MPEG-2 encoder is the only mpegvideo-based encoder that supports embedding a53 side data. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo: Deprecate mpeg_quant option for codecs != MPEG-4Andreas Rheinhardt2021-04-101-0/+7
| | | | | | | | | | | | | | mpeg_quant may only be set for MPEG-4 and MPEG-2, yet for the latter it is no option as the code acts as if it were always set. So deprecate the option for all codecs for which it makes no sense. Furthermore, given that the code already errors out if the option is set for a codec that doesn't support it we can restrict the range of the option for all these codecs without breaking something. This means that the checks for whether mpeg_quant is set for these codecs can be removed as soon as AVCodecContext.mpeg_quant is removed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpeg12enc: Perform size/level/profile checks earlierAndreas Rheinhardt2021-04-101-22/+22
| | | | | | | This has the advantage that one does not waste some allocations if one errors out because of these checks. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpeg12enc: Move MPEG-1/2 dimension checks to mpeg12encAndreas Rheinhardt2021-04-101-0/+8
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Avoid intermediate bitcount for number of bytes in PutBitContextAndreas Rheinhardt2021-03-301-1/+1
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpegvideo_enc: Make mpv_encode_defaults thread-safeAndreas Rheinhardt2021-01-251-2/+2
| | | | | | | | | This is a prerequisite for making any encoder that uses ff_mpv_encode_init() init-threadsafe; it already makes the AMV, the MJPEG and the MPEG-1/2 encoders init-threadsafe. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpeg12enc, speedhqenc: Avoid redundant copies of tablesAndreas Rheinhardt2021-01-251-10/+2
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpeg12: Don't initialize encoder-only parts of RLTableAndreas Rheinhardt2020-12-311-2/+4
| | | | | | | | | | | ff_mpeg12_init_vlcs() currently initializes index_run, max_level and max_run of ff_rl_mpeg1/2; yet the only user of these fields is the MPEG-1/2 encoder which already initializes these tables on its own. So remove the initializations in ff_mpeg12_init_vlcs(); this also simplifies making ff_mpeg12_init_vlcs() thread-safe. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/speedhqenc: Call correct functionAndreas Rheinhardt2020-12-111-3/+8
| | | | | | | | | | | | | | | | | | | Up until now, the SpeedHQ encoder called a wrong function for init: void ff_init_uni_ac_vlc(const uint8_t huff_size_ac[256], uint8_t *uni_ac_vlc_len); Yet the first argument actually used is of type RLTable; the size of said struct is less than 256 if the size of a pointer is four, leading to an access beyond the end of the RLTable. This commit fixes this by calling the actually intended function: init_uni_ac_vlc() from mpeg12enc.c. It was intended to use this function [1], yet doing so was forgotten when the patch was actually applied. [1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-July/266187.html Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpeg12enc: Disallow using MPEG-2 intra VLC table for mpeg1videoAndreas Rheinhardt2020-12-021-2/+2
| | | | | | | | | | | | Using MPEG-2 intra VLC tables is spec-incompliant for MPEG-1 and given that an MPEG-1 bitstream can't signal whether MPEG-2 intra VLC tables have been used the output is broken. Therefore this option is removed immediately without any deprecation period. Reviewed-by: James Almer <jamrial@gmail.com> Reviewed-by: Marton Balint <cus@passwd.hu> Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpeg12enc: ReindentationAndreas Rheinhardt2020-11-251-59/+55
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpeg12enc: Use ff_thread_once() for static initializationsAndreas Rheinhardt2020-11-251-8/+12
| | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpeg12enc: Always initialize MPEG-2 intra VLC table lengthsAndreas Rheinhardt2020-11-251-1/+0
| | | | | | | | | | | | | The MPEG-1/2 encoders initialize several tables once during the first time one of the encoders is initialized; the table for MPEG-2 intra VLC lengths is only initialized if it is used for this encoder instance. This implies that if the first MPEG-1/2 encoder to be initialized does not use it, it will never be initialized even if a later encoder instance makes use of them. Fix this by initializing this table unconditionally. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* put_bits: make avpriv_align_put_bits() inlineAnton Khirnov2020-10-281-1/+1
| | | | | | | | | This function is so extremely simple that it is preferable to make it inline rather than deal with all the complications arising from it being an exported symbol. Keep avpriv_align_put_bits() around until the next major bump to preserve ABI compatibility.
* avcodec/mpeg12enc: support mpeg2 encoder const levelLimin Wang2020-08-141-0/+6
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/mpeg12enc: support mpeg2 encoder const profileLimin Wang2020-06-011-0/+2
| | | | | Reviewed-by: Marton Balint <cus@passwd.hu> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/mpeg12enc: return more specific error codes for encode_init()Limin Wang2020-05-091-6/+7
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/mpeg12enc: Use FF_PROFILE_MPEG2_xxx macrosLimin Wang2020-05-011-4/+4
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* remove CHAR_MIN/CHAR_MAX usagePaul B Mahol2020-03-171-1/+1
| | | | It is not needed at all.
* avcodec/mpeg12enc: Add FF_CODEC_CAP_INIT_CLEANUPMichael Niedermayer2019-09-111-0/+2
| | | | | | | | Fixes: Multiple memleaks Fixes: ffmpeg-memory-leak Found-by: Francis Provencher <francis@protekresearchlab.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* mpeg12enc: Use Closed Captions if availableMathieu Duponchelle2019-03-161-0/+32
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/mpeg12enc: add support for specifying video_format in the ↵Marton Balint2018-02-131-2/+10
| | | | | | | | | | | sequence_display_extension In a recent commit the default was changed from 0 (component) to 5 (unspecified), however some standards require using 0. With this option, the user will be able to do so. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Marton Balint <cus@passwd.hu>
* Merge commit '4c0588b4562abad5540f6a5435c62828de9e4fdf'James Almer2017-11-111-1/+1
|\ | | | | | | | | | | | | * commit '4c0588b4562abad5540f6a5435c62828de9e4fdf': mpeg2enc: Don't mark all streams as component video Merged-by: James Almer <jamrial@gmail.com>
| * mpeg2enc: Don't mark all streams as component videoMark Thompson2017-08-201-1/+1
| | | | | | | | | | | | | | | | Since there is no information about the source format, "unspecified" is the correct value to write here. All tests using the MPEG-2 encoder are updated, as this changes the header on all outputs.
* | Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'Clément Bœsch2016-06-211-6/+6
|\ \ | |/ | | | | | | | | | | * commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb': cosmetics: Fix spelling mistakes Merged-by: Clément Bœsch <u@pkh.me>
| * cosmetics: Fix spelling mistakesVittorio Giovara2016-05-041-6/+6
| | | | | | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
| * mpeg12enc: always write closed gops for intra only outputsMarton Balint2016-02-221-1/+1
| | | | | | | | | | Reviewed-by: Michael Niedermayer <michaelni@gmx.at> Signed-off-by: Marton Balint <cus@passwd.hu>
* | Merge commit 'd749615333084e62c9fcc480d1ae466369fdf14f'Derek Buitenhuis2016-01-311-5/+15
|\ \ | |/ | | | | | | | | | | * commit 'd749615333084e62c9fcc480d1ae466369fdf14f': lavc: Move timecode_frame_start to codec private options Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * lavc: Move timecode_frame_start to codec private optionsVittorio Giovara2016-01-211-2/+11
| | | | | | | | | | | | | | This option is only used by mpeg2. It is a very codec-specific option, so deprecate the global variant. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | avcodec/mpeg12enc: Move high resolution thread check to before initializing ↵Michael Niedermayer2016-01-211-3/+0
| | | | | | | | | | | | | | | | threads Cleaner solution is welcome! Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/motion_est: Fix mv_penalty table sizeMichael Niedermayer2016-01-051-3/+3
| | | | | | | | | | | | | | Fixes out of array read Found-by: Tyson Smith <twsmith@mozilla.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec: use AV_OPT_TYPE_BOOL in a bunch of placesClément Bœsch2015-12-041-5/+5
| |
* | avcodec/mpeg12enc: Basic support for encoding non even QPs for ↵Michael Niedermayer2015-09-181-13/+1
| | | | | | | | | | | | -non_linear_quant 1 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/mpeg12enc: extend QP range to 28 for non linear quantizersMichael Niedermayer2015-07-301-4/+6
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit 'def97856de6021965db86c25a732d78689bd6bb0'Michael Niedermayer2015-07-271-2/+2
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
| * lavc: AV-prefix all codec capabilitiesVittorio Giovara2015-07-271-2/+2
| | | | | | | | | | | | Express bitfields more simply. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | Merge commit '7c6eb0a1b7bf1aac7f033a7ec6d8cacc3b5c2615'Michael Niedermayer2015-07-271-2/+2
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
| * lavc: AV-prefix all codec flagsVittorio Giovara2015-07-271-1/+1
| | | | | | | | | | | | Convert doxygen to multiline and express bitfields more simply. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | Merge commit '6f57375d707de40dcec28d3cef886c364e032c21'Michael Niedermayer2015-05-281-2/+2
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | * commit '6f57375d707de40dcec28d3cef886c364e032c21': rl: Rename ff_*_rl() to ff_rl_*() Conflicts: libavcodec/mpeg4videodec.c libavcodec/rl.c libavcodec/rl.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * rl: Rename ff_*_rl() to ff_rl_*()Anton Khirnov2015-05-281-2/+2
| |
* | Merge commit '848e86f74d3e6e87fa592ee8ba8c184cc5fd9a42'Michael Niedermayer2015-05-221-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '848e86f74d3e6e87fa592ee8ba8c184cc5fd9a42': mpegvideo: Drop flags and flags2 Conflicts: libavcodec/mpeg12dec.c libavcodec/mpeg12enc.c libavcodec/mpegvideo.c libavcodec/mpegvideo_enc.c libavcodec/mpegvideo_motion.c libavcodec/ratecontrol.c libavcodec/vc1_block.c libavcodec/vc1_loopfilter.c libavcodec/vc1_mc.c libavcodec/vc1dec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * mpegvideo: Drop flags and flags2Vittorio Giovara2015-05-221-1/+1
| | | | | | | | They are just duplicates of AVCodecContext members so use those instead.
| * mpeg12enc: increase declared size of block function argumentMichael Niedermayer2014-11-111-2/+2
| | | | | | | | | | | | CC: libav-stable@libav.org Bug-Id: CID 1047236 Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | avcodec: use av_mod_uintp2() where usefulJames Almer2015-04-211-4/+4
| | | | | | | | | | Reviewed-by: Michael Niedermayer <michaelni@gmx.at> Signed-off-by: James Almer <jamrial@gmail.com>
* | Merge commit '37b3361e755361d4ff14a2973df001c0140d98d6'Michael Niedermayer2014-11-061-1/+2
|\ \ | |/ | | | | | | | | | | * commit '37b3361e755361d4ff14a2973df001c0140d98d6': mpeg12enc: factor out check in encode_dc Merged-by: Michael Niedermayer <michaelni@gmx.at>