vah264enc: Avoid precision lost by just rounding up.
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Sat, 17 Sep 2022 08:14:40 +0000 (10:14 +0200)
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Sat, 17 Sep 2022 08:14:40 +0000 (10:14 +0200)
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

index 2805b8a..655154c 100644 (file)
@@ -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;
   }