From 4b5e930bc8c6ad9031c4b6123639b1b3643836b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Wed, 27 Mar 2024 19:41:30 +0100 Subject: [PATCH] va: encoders: don't assert at target percentage when QVBR Instead of asserting, just get the max value between the current value and 10, which is the minimum required by QVBR. Part-of: --- subprojects/gst-plugins-bad/sys/va/gstvaav1enc.c | 2 +- subprojects/gst-plugins-bad/sys/va/gstvah264enc.c | 2 +- subprojects/gst-plugins-bad/sys/va/gstvah265enc.c | 2 +- subprojects/gst-plugins-bad/sys/va/gstvavp9enc.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/subprojects/gst-plugins-bad/sys/va/gstvaav1enc.c b/subprojects/gst-plugins-bad/sys/va/gstvaav1enc.c index 7457135b6f..1cffee5d4b 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvaav1enc.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvaav1enc.c @@ -2692,7 +2692,7 @@ _av1_ensure_rate_control (GstVaAV1Enc * self) self->rc.base_qindex = DEFAULT_BASE_QINDEX; /* Fall through. */ case VA_RC_QVBR: - g_assert (self->rc.target_percentage >= 10); + self->rc.target_percentage = MAX (10, self->rc.target_percentage); self->rc.max_bitrate = (guint) gst_util_uint64_scale_int (bitrate, 100, self->rc.target_percentage); self->rc.target_bitrate = bitrate; diff --git a/subprojects/gst-plugins-bad/sys/va/gstvah264enc.c b/subprojects/gst-plugins-bad/sys/va/gstvah264enc.c index a0b6a8f664..fac8d9f000 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvah264enc.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvah264enc.c @@ -653,7 +653,7 @@ _ensure_rate_control (GstVaH264Enc * self) /* Fall through. */ case VA_RC_QVBR: self->rc.qp_p = self->rc.qp_b = 26; - g_assert (self->rc.target_percentage >= 10); + self->rc.target_percentage = MAX (10, self->rc.target_percentage); self->rc.max_bitrate = (guint) gst_util_uint64_scale_int (bitrate, 100, self->rc.target_percentage); self->rc.target_bitrate = bitrate; diff --git a/subprojects/gst-plugins-bad/sys/va/gstvah265enc.c b/subprojects/gst-plugins-bad/sys/va/gstvah265enc.c index 08289e6e92..b918b7b75e 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvah265enc.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvah265enc.c @@ -3396,7 +3396,7 @@ _h265_ensure_rate_control (GstVaH265Enc * self) /* Fall through. */ case VA_RC_QVBR: self->rc.qp_p = self->rc.qp_b = 26; - g_assert (self->rc.target_percentage >= 10); + self->rc.target_percentage = MAX (10, self->rc.target_percentage); self->rc.max_bitrate = (guint) gst_util_uint64_scale_int (bitrate, 100, self->rc.target_percentage); self->rc.target_bitrate = bitrate; diff --git a/subprojects/gst-plugins-bad/sys/va/gstvavp9enc.c b/subprojects/gst-plugins-bad/sys/va/gstvavp9enc.c index 2925421b4c..a542545bde 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvavp9enc.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvavp9enc.c @@ -2023,7 +2023,7 @@ _vp9_ensure_rate_control (GstVaVp9Enc * self) self->rc.base_qindex = DEFAULT_BASE_QINDEX; /* Fall through. */ case VA_RC_QVBR: - g_assert (self->rc.target_percentage >= 10); + self->rc.target_percentage = MAX (10, self->rc.target_percentage); self->rc.max_bitrate = (guint) gst_util_uint64_scale_int (bitrate, 100, self->rc.target_percentage); self->rc.target_bitrate = bitrate;