From 7211e3fffda106828fc21e7eed159fe73c0163ef Mon Sep 17 00:00:00 2001 From: He Junyan Date: Tue, 14 May 2024 10:31:05 +0800 Subject: [PATCH] vah26{4,5}enc: Set the qp_p and qp_b to qp_i value in ICQ and QVBR Set the P and B frame qp to I frame value to avoid generating delta QP between different frame types. For ICQ and QVBR modes, we can only set the qpi value, so the qpp and qpb values should be set to the same value as the qpi. Part-of: --- subprojects/gst-plugins-bad/sys/va/gstvah264enc.c | 4 ++-- subprojects/gst-plugins-bad/sys/va/gstvah265enc.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/subprojects/gst-plugins-bad/sys/va/gstvah264enc.c b/subprojects/gst-plugins-bad/sys/va/gstvah264enc.c index a0e5337ace..e323beadb6 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvah264enc.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvah264enc.c @@ -629,7 +629,7 @@ _ensure_rate_control (GstVaH264Enc * self) switch (self->rc.rc_ctrl_mode) { case VA_RC_NONE: case VA_RC_ICQ: - self->rc.qp_p = self->rc.qp_b = 26; + self->rc.qp_p = self->rc.qp_b = self->rc.qp_i; /* Fall through. */ case VA_RC_CQP: bitrate = 0; @@ -648,7 +648,7 @@ _ensure_rate_control (GstVaH264Enc * self) self->rc.qp_i = 26; /* Fall through. */ case VA_RC_QVBR: - self->rc.qp_p = self->rc.qp_b = 26; + self->rc.qp_p = self->rc.qp_b = self->rc.qp_i; 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); diff --git a/subprojects/gst-plugins-bad/sys/va/gstvah265enc.c b/subprojects/gst-plugins-bad/sys/va/gstvah265enc.c index 1d4466c79c..0c4d262e00 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvah265enc.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvah265enc.c @@ -3373,7 +3373,7 @@ _h265_ensure_rate_control (GstVaH265Enc * self) switch (self->rc.rc_ctrl_mode) { case VA_RC_NONE: case VA_RC_ICQ: - self->rc.qp_p = self->rc.qp_b = 26; + self->rc.qp_p = self->rc.qp_b = self->rc.qp_i; /* Fall through. */ case VA_RC_CQP: bitrate = 0; @@ -3392,7 +3392,7 @@ _h265_ensure_rate_control (GstVaH265Enc * self) self->rc.qp_i = 26; /* Fall through. */ case VA_RC_QVBR: - self->rc.qp_p = self->rc.qp_b = 26; + self->rc.qp_p = self->rc.qp_b = self->rc.qp_i; 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);