From a8387fdc6b6ee67c35bb587abc631563185490f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Sat, 17 Sep 2022 10:14:40 +0200 Subject: [PATCH] vah264enc: Avoid precision lost by just rounding up. The code where dividing by 16 and later multiplying by 16, which is spurious and a potential loose of precision. --- subprojects/gst-plugins-bad/sys/va/gstvah264enc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/subprojects/gst-plugins-bad/sys/va/gstvah264enc.c b/subprojects/gst-plugins-bad/sys/va/gstvah264enc.c index 2805b8a0df..655154c8c8 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvah264enc.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvah264enc.c @@ -1570,8 +1570,9 @@ gst_va_h264_enc_reconfig (GstVaBaseEnc * base) max_ref_frames = self->gop.num_ref_frames + 3 /* scratch frames */ ; if (!gst_va_encoder_open (base->encoder, base->profile, base->entrypoint, GST_VIDEO_INFO_FORMAT (&base->input_state->info), base->rt_format, - self->mb_width * 16, self->mb_height * 16, base->codedbuf_size, - max_ref_frames, self->rc.rc_ctrl_mode, self->packed_headers)) { + GST_ROUND_UP_16 (base->width), GST_ROUND_UP_16 (base->height), + base->codedbuf_size, max_ref_frames, self->rc.rc_ctrl_mode, + self->packed_headers)) { GST_ERROR_OBJECT (self, "Failed to open the VA encoder."); return FALSE; }