summaryrefslogtreecommitdiff
path: root/libavcodec/mpeg12enc.c
Commit message (Collapse)AuthorAgeFilesLines
* avcodec: use the new AVFrame key_frame flag in all decoders and encodersJames Almer2023-05-041-1/+1
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: use the new AVFrame interlace flags in all decoders and encodersJames Almer2023-05-041-1/+1
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/mpegvideo_enc: do not use AVFrame.*_picture_number for encodingMarton Balint2023-02-131-2/+2
| | | | | | Move these fields to MPEGPicture instead and use that. Signed-off-by: Marton Balint <cus@passwd.hu>
* avcodec/avcodec: Remove AV_CODEC_FLAG2_DROP_FRAME_TIMECODEAndreas Rheinhardt2023-02-091-1/+0
| | | | | | | | | | It has been deprecated in 94d68a41fabb55dd8c7e59b88fe4a28a637d1e5f and can't be set via AVOptions. The only codecs that use it (the MPEG-1/2 encoders) have private options for this. So remove it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: Anton Khirnov <anton@khirnov.net>
* lavc/mpegvideo_enc: handle frame durations and ↵Anton Khirnov2023-01-291-2/+4
| | | | | | | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE For delay-capable encoders, i.e. mpeg12 and mpeg4video. Generic code in encode.c already handles this for all other mpegvideo encoders.
* avcodec/mpegvideo_enc: remove picture_number parameter from encode functionsMarton Balint2023-01-261-1/+1
| | | | | | They are unused. Signed-off-by: Marton Balint <cus@passwd.hu>
* avcodec/mpegvideodata: Join mpeg1/2 dc scale tablesAndreas Rheinhardt2022-10-311-1/+1
| | | | | | Avoids relocations. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpeg12enc: Don't initialize unused parts of RLTableAndreas Rheinhardt2022-10-271-7/+10
| | | | | | | | | ff_rl_init() initializes RLTable.(max_level|max_run|index_run); max_run is unused by the MPEG-1/2 encoders (as well as SpeedHQ). Furthermore, it initializes these things twice (for two passes), but the second half of this is never used. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpeg12enc: Don't initialize ff_rl_mpeg2 unnecessarilyAndreas Rheinhardt2022-10-271-4/+3
| | | | | | | | | | | ff_rl_mpeg1 and ff_rl_mpeg2 differ only in RLTable.table_vlc, which ff_rl_init() does not use to initialize RLTable.max_level, RLTable.max_run and RLTable.index_run. This implies that these tables agree for ff_rl_mpeg1 and ff_rl_mpeg2; hence one can just use one of them and avoid calling ff_rl_init() ff_rl_mpeg2 alltogether. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpeg12enc: Pass tables explicitly in ff_mpeg1_init_uni_ac_vlcAndreas Rheinhardt2022-10-271-7/+12
| | | | | | | This will allow to remove ff_rl_mpeg2 soon and remove all uses of RLTable in MPEG-1/2/SpeedHQ later. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpeg12enc: Avoid unnecessary indirectionAndreas Rheinhardt2022-10-271-2/+2
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo: Move VIDEO_FORMAT_* defines to mpeg12enc.cAndreas Rheinhardt2022-10-201-0/+6
| | | | | | Forgotten in f899e3b51bc85c45f54f7ac64abfbde6b2cd7d3d. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpeg12: Inline ff_mpeg12_common_init() into mpeg12enc.cAndreas Rheinhardt2022-10-041-1/+3
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpeg12vlc: Move MPEG-1/2 RL VLCs to itAndreas Rheinhardt2022-10-041-0/+1
| | | | | | | It is better place for these declarations than mpeg12data.h as RL VLC are just a variant of VLCs. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/codec_internal: Add macro to set AVCodec.long_nameAndreas Rheinhardt2022-09-031-2/+2
| | | | | | | | It reduces typing: Before this patch, there were 105 codecs whose long_name-definition exceeded the 80 char line length limit. Now there are only nine of them. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Make init-threadsafety the defaultAndreas Rheinhardt2022-07-181-2/+2
| | | | | | | | | | | and remove FF_CODEC_CAP_INIT_THREADSAFE All our native codecs are already init-threadsafe (only wrappers for external libraries and hwaccels are typically not marked as init-threadsafe yet), so it is only natural for this to also be the default state. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideoenc: Remove ineffective optionsAndreas Rheinhardt2022-05-241-10/+1
| | | | | | | | | | | | | | | | This commit removes the ineffective FF_MPV_DEPRECATED_ options, namely mpeg_quant (this is only an option for MPEG-4), a53cc (this is only an option for MPEG-2), force_duplicated_matrix (applies only to MJPEG) and b_strategy, b_sensitivity and brd_scale (these options only make sense for encoders supporting B-frames, which currently means the MPEG-1/2 and MPEG-4 encoders). Given that these options never changed the outcome of encoding, they are removed at once. Notice that the options for the encoders for which it made sense are not affected by this. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mjpegenc: Remove pointless motion-estimation optionsAndreas Rheinhardt2022-05-241-0/+2
| | | | | | | | (M)JPEG does not use motion estimation/motion vectors at all. These options therefore don't affect the output at all. So remove them. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/codec_internal: Use union for FFCodec decode/encode callbacksAndreas Rheinhardt2022-04-051-2/+2
| | | | | | | | | | | This is possible, because every given FFCodec has to implement exactly one of these. Doing so decreases sizeof(FFCodec) and therefore decreases the size of the binary. Notice that in case of position-independent code the decrease is in .data.rel.ro, so that this translates to decreased memory consumption. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo: Remove strict_std_compliance from MpegEncContextAndreas Rheinhardt2022-04-011-1/+1
| | | | | | It just duplicates AVCodecContext.strict_std_compliance. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/codec_internal: Add FFCodec, hide internal part of AVCodecAndreas Rheinhardt2022-03-211-18/+18
| | | | | | | | | | | | | | | | 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>
* avcodec/internal: Move FF_CODEC_CAP_* to a new header codec_internal.hAndreas Rheinhardt2022-03-211-0/+1
| | | | | | | | | | 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>
* configure: Use a separate config_components.h header for $ALL_COMPONENTSMartin Storsjö2022-03-161-0/+1
| | | | | | | | This avoids unnecessary rebuilds of most source files if only the list of enabled components has changed, but not the other properties of the build, set in config.h. Signed-off-by: Martin Storsjö <martin@martin.st>
* avcodec/mpegvideo: Remove write-only [fb]_codeAndreas Rheinhardt2022-02-131-5/+0
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo: Move encoder-only stuff to a new headerAndreas Rheinhardt2022-02-131-0/+1
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpeg12.h: Move encoder-only stuff into a new headerAndreas Rheinhardt2022-02-131-1/+1
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo: Use offset instead of pointer for vbv_delayAndreas Rheinhardt2022-01-291-1/+1
| | | | | | | | | | An offset has the advantage of not needing to be updated when the buffer is reallocated. Furthermore, the way the pointer is currently updated is undefined behaviour in case the pointer is not already set (i.e. when not encoding MPEG-1/2), because it calculates the nonsense NULL - s->pb.buf. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo: Move frame_rate_index to (Mpeg1|MPEG12Enc)ContextAndreas Rheinhardt2022-01-291-5/+6
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo: Move gop_picture_number to MPEG12EncContextAndreas Rheinhardt2022-01-291-3/+6
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpeg12enc: Reindent after the previous commitAndreas Rheinhardt2022-01-291-128/+127
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpeg12enc: Return early if no Sequence Header is writtenAndreas Rheinhardt2022-01-291-4/+5
| | | | | | Allows to avoid one level of indentation. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpeg12enc: Use stack variable for aspect_ratio_infoAndreas Rheinhardt2022-01-291-2/+3
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpeg12enc: Inline constantsAndreas Rheinhardt2022-01-041-8/+8
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpeg12enc: Partially inline whether codec is MPEG-1Andreas Rheinhardt2022-01-041-1/+3
| | | | | | | MPEG-1 only supports 4:2:0, so one can optimize away the checks for whether one encodes MPEG-1 in codepaths that encode 4:2:2. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpeg12enc: Also inline chroma subsamplingAndreas Rheinhardt2022-01-041-5/+6
| | | | | | | | | | | ff_mpeg1_encode_mb() contains two inlined calls to mpeg1_encode_mb_internal(); these calls are supposed to inline the properties depending upon the color space used. Yet inlining vertical chroma subsampling (which allows to remove complete branches and blocks depending upon them) has been forgotten. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpeg12enc: Move options-related fields to MPEG12EncContextAndreas Rheinhardt2022-01-041-23/+35
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpeg12enc: Add custom context, move mpeg2_frame_rate_ext to itAndreas Rheinhardt2022-01-041-9/+17
| | | | | | It is only used here. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpeg12enc: Simplify check for A53 closed captionsAndreas Rheinhardt2022-01-041-1/+1
| | | | | | | | | | | | | | | The a53_cc option is only useful and meaningful for MPEG-2, yet it was accidentally added for all mpegvideo-based encoders. This means that it is possible for a53_cc to be set for other encoders as well. This commit changes this and reroutes a53_cc to the dummy field in MpegEncContext for all codecs for which it is not supported. This allows to avoid a check for the current codec in mpeg12enc.c. Also add a compile-time check for whether the MPEG-2 encoder is available while at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* 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>