mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-08 13:22:53 +02:00
avcodec/mpegvideo_enc: Avoid branches for flipping no_rounding
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
91fce67691
commit
80c2d7c890
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user