aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-05-10 20:10:46 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-06-20 18:58:38 +0200
commit80c2d7c89061e3511b815c355c1885111e029923 (patch)
tree93547eaff3d86396e16745f72542ee0e75d49ed5
parent91fce67691088fca6311fa38f7a56900f028775b (diff)
downloadffmpeg-80c2d7c89061e3511b815c355c1885111e029923.tar.gz
avcodec/mpegvideo_enc: Avoid branches for flipping no_rounding
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavcodec/mpegvideo_enc.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index eda2305630..6ad5b0eb39 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -713,6 +713,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
s->modified_quant = s->h263_aic;
s->loop_filter = (avctx->flags & AV_CODEC_FLAG_LOOP_FILTER) ? 1 : 0;
s->unrestricted_mv = s->obmc || s->loop_filter || s->umvplus;
+ s->flipflop_rounding = 1;
/* /Fx */
/* These are just to be sure */
@@ -746,6 +747,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
s->out_format = FMT_H263;
s->h263_pred = 1;
s->unrestricted_mv = 1;
+ s->flipflop_rounding = 1;
s->low_delay = s->max_b_frames ? 0 : 1;
avctx->delay = s->low_delay ? 0 : (s->max_b_frames + 1);
break;
@@ -1829,10 +1831,7 @@ vbv_retry:
s->mb_skipped = 0; // done in frame_start()
// done in encode_picture() so we must undo it
if (s->pict_type == AV_PICTURE_TYPE_P) {
- if (s->flipflop_rounding ||
- s->codec_id == AV_CODEC_ID_H263P ||
- s->codec_id == AV_CODEC_ID_MPEG4)
- s->no_rounding ^= 1;
+ s->no_rounding ^= s->flipflop_rounding;
}
if (s->pict_type != AV_PICTURE_TYPE_B) {
s->time_base = s->last_time_base;
@@ -3576,8 +3575,7 @@ static int encode_picture(MpegEncContext *s, const AVPacket *pkt)
if(s->pict_type==AV_PICTURE_TYPE_I){
s->no_rounding = s->msmpeg4_version >= MSMP4_V3;
}else if(s->pict_type!=AV_PICTURE_TYPE_B){
- if(s->flipflop_rounding || s->codec_id == AV_CODEC_ID_H263P || s->codec_id == AV_CODEC_ID_MPEG4)
- s->no_rounding ^= 1;
+ s->no_rounding ^= s->flipflop_rounding;
}
if (s->avctx->flags & AV_CODEC_FLAG_PASS2) {