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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6841>
This commit is contained in:
He Junyan 2024-05-14 10:31:05 +08:00
parent 9d23c26027
commit 7211e3fffd
2 changed files with 4 additions and 4 deletions

View file

@ -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);

View file

@ -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);