ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinha...@outlook.com> | Fri May 10 20:10:46 2024 +0200| [80c2d7c89061e3511b815c355c1885111e029923] | committer: Andreas Rheinhardt
avcodec/mpegvideo_enc: Avoid branches for flipping no_rounding Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=80c2d7c89061e3511b815c355c1885111e029923 --- libavcodec/mpegvideo_enc.c | 10 ++++------ 1 file 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) { _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".