From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH 6/6] avcodec/mpegvideo_enc: Call ff_mpeg1_encode_init() earlier
Date: Sun, 2 Oct 2022 23:18:15 +0200
Message-ID: <GV1P250MB07376A7A4EE1EE1F2A627D838F589@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <GV1P250MB07375159DB6AEC93CE0E3D298F589@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM>
It does not require anything that is being set between
the new position where it is called and the old position
where it used to be called; and nothing that it sets
gets overwritten between these two positions.
Doing so allows to remove a check lateron.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/mpegvideo_enc.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 8d74f9e978..f0fe35d7a3 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -647,17 +647,17 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
s->time_increment_bits = av_log2(avctx->time_base.den - 1) + 1;
switch (avctx->codec->id) {
- case AV_CODEC_ID_MPEG1VIDEO:
- s->out_format = FMT_MPEG1;
- s->low_delay = !!(avctx->flags & AV_CODEC_FLAG_LOW_DELAY);
- avctx->delay = s->low_delay ? 0 : (s->max_b_frames + 1);
- break;
+#if CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER
case AV_CODEC_ID_MPEG2VIDEO:
+ s->rtp_mode = 1;
+ /* fallthrough */
+ case AV_CODEC_ID_MPEG1VIDEO:
s->out_format = FMT_MPEG1;
s->low_delay = !!(avctx->flags & AV_CODEC_FLAG_LOW_DELAY);
avctx->delay = s->low_delay ? 0 : (s->max_b_frames + 1);
- s->rtp_mode = 1;
+ ff_mpeg1_encode_init(s);
break;
+#endif
#if CONFIG_MJPEG_ENCODER || CONFIG_AMV_ENCODER
case AV_CODEC_ID_MJPEG:
case AV_CODEC_ID_AMV:
@@ -895,10 +895,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
ff_set_cmp(&s->mecc, s->mecc.ildct_cmp, avctx->ildct_cmp);
ff_set_cmp(&s->mecc, s->mecc.frame_skip_cmp, s->frame_skip_cmp);
- if ((CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER)
- && s->out_format == FMT_MPEG1) {
- ff_mpeg1_encode_init(s);
- } else if (CONFIG_H263_ENCODER && s->out_format == FMT_H263) {
+ if (CONFIG_H263_ENCODER && s->out_format == FMT_H263) {
ff_h263_encode_init(s);
if (CONFIG_MSMPEG4ENC && s->msmpeg4_version)
ff_msmpeg4_encode_init(s);
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2022-10-02 21:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-02 21:14 [FFmpeg-devel] [PATCH 1/6] fate/vcodec: Add speedhq tests Andreas Rheinhardt
2022-10-02 21:18 ` [FFmpeg-devel] [PATCH 2/6] avcodec/mpegvideo_enc: Move SpeedHQ check to speedhqenc.c Andreas Rheinhardt
2022-10-02 21:18 ` [FFmpeg-devel] [PATCH 3/6] avcodec/mpegvideo_enc: Call ff_h261_encode_init() earlier Andreas Rheinhardt
2022-10-02 21:18 ` [FFmpeg-devel] [PATCH 4/6] avcodec/mpegvideo_enc: Move H.261 size check to h261enc.c Andreas Rheinhardt
2022-10-02 21:18 ` [FFmpeg-devel] [PATCH 5/6] avcodec/h261enc: Store the H.261 format value Andreas Rheinhardt
2022-10-02 21:18 ` Andreas Rheinhardt [this message]
2022-10-05 11:38 ` [FFmpeg-devel] [PATCH 1/6] fate/vcodec: Add speedhq tests Andreas Rheinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=GV1P250MB07376A7A4EE1EE1F2A627D838F589@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM \
--to=andreas.rheinhardt@outlook.com \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git