mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-09 08:55:33 +00:00
va: encoder: update the bitrate change correctly
We should update and notify the bitrate change at a common place, no matter whether the bitrate is calculated or not. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6433>
This commit is contained in:
parent
56703704a5
commit
71eff7ce97
4 changed files with 10 additions and 12 deletions
|
@ -2651,9 +2651,6 @@ _av1_ensure_rate_control (GstVaAV1Enc * self)
|
|||
GST_VIDEO_INFO_FPS_D (&base->in_info)) / 1000;
|
||||
|
||||
GST_INFO_OBJECT (self, "target bitrate computed to %u kbps", bitrate);
|
||||
|
||||
self->prop.bitrate = bitrate;
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_BITRATE]);
|
||||
}
|
||||
|
||||
/* Adjust the setting based on RC mode. */
|
||||
|
@ -2661,6 +2658,7 @@ _av1_ensure_rate_control (GstVaAV1Enc * self)
|
|||
case VA_RC_NONE:
|
||||
case VA_RC_ICQ:
|
||||
case VA_RC_CQP:
|
||||
bitrate = 0;
|
||||
self->rc.max_bitrate = 0;
|
||||
self->rc.target_bitrate = 0;
|
||||
self->rc.target_percentage = 0;
|
||||
|
@ -2709,7 +2707,8 @@ _av1_ensure_rate_control (GstVaAV1Enc * self)
|
|||
|| self->rc.rc_ctrl_mode == VA_RC_QVBR)
|
||||
_av1_calculate_bitrate_hrd (self);
|
||||
|
||||
/* notifications */
|
||||
/* update & notifications */
|
||||
update_property_uint (base, &self->prop.bitrate, bitrate, PROP_BITRATE);
|
||||
update_property_uint (base, &self->prop.cpb_size, self->rc.cpb_size,
|
||||
PROP_CPB_SIZE);
|
||||
update_property_uint (base, &self->prop.target_percentage,
|
||||
|
|
|
@ -636,6 +636,7 @@ _ensure_rate_control (GstVaH264Enc * self)
|
|||
self->rc.qp_p = self->rc.qp_b = 26;
|
||||
/* Fall through. */
|
||||
case VA_RC_CQP:
|
||||
bitrate = 0;
|
||||
self->rc.max_bitrate = 0;
|
||||
self->rc.target_bitrate = 0;
|
||||
self->rc.target_percentage = 0;
|
||||
|
|
|
@ -3369,10 +3369,7 @@ _h265_ensure_rate_control (GstVaH265Enc * self)
|
|||
bitrate = gst_util_uint64_scale (factor,
|
||||
GST_VIDEO_INFO_FPS_N (&base->in_info),
|
||||
GST_VIDEO_INFO_FPS_D (&base->in_info)) / 1000;
|
||||
|
||||
GST_INFO_OBJECT (self, "target bitrate computed to %u kbps", bitrate);
|
||||
|
||||
update_property_uint (base, &self->prop.bitrate, bitrate, PROP_BITRATE);
|
||||
}
|
||||
|
||||
/* Adjust the setting based on RC mode. */
|
||||
|
@ -3382,6 +3379,7 @@ _h265_ensure_rate_control (GstVaH265Enc * self)
|
|||
self->rc.qp_p = self->rc.qp_b = 26;
|
||||
/* Fall through. */
|
||||
case VA_RC_CQP:
|
||||
bitrate = 0;
|
||||
self->rc.max_bitrate = 0;
|
||||
self->rc.target_bitrate = 0;
|
||||
self->rc.target_percentage = 0;
|
||||
|
@ -3431,7 +3429,8 @@ _h265_ensure_rate_control (GstVaH265Enc * self)
|
|||
|| self->rc.rc_ctrl_mode == VA_RC_QVBR)
|
||||
_h265_calculate_bitrate_hrd (self);
|
||||
|
||||
/* notifications */
|
||||
/* update & notifications */
|
||||
update_property_uint (base, &self->prop.bitrate, bitrate, PROP_BITRATE);
|
||||
update_property_uint (base, &self->prop.min_qp, self->rc.min_qp, PROP_MIN_QP);
|
||||
update_property_uint (base, &self->prop.cpb_size,
|
||||
self->rc.cpb_size, PROP_CPB_SIZE);
|
||||
|
|
|
@ -1986,9 +1986,6 @@ _vp9_ensure_rate_control (GstVaVp9Enc * self)
|
|||
GST_VIDEO_INFO_FPS_D (&base->in_info)) / 1000;
|
||||
|
||||
GST_INFO_OBJECT (self, "target bitrate computed to %u kbps", bitrate);
|
||||
|
||||
self->prop.bitrate = bitrate;
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_BITRATE]);
|
||||
}
|
||||
|
||||
/* Adjust the setting based on RC mode. */
|
||||
|
@ -1996,6 +1993,7 @@ _vp9_ensure_rate_control (GstVaVp9Enc * self)
|
|||
case VA_RC_NONE:
|
||||
case VA_RC_ICQ:
|
||||
case VA_RC_CQP:
|
||||
bitrate = 0;
|
||||
self->rc.max_bitrate = 0;
|
||||
self->rc.target_bitrate = 0;
|
||||
self->rc.target_percentage = 0;
|
||||
|
@ -2050,7 +2048,8 @@ _vp9_ensure_rate_control (GstVaVp9Enc * self)
|
|||
|| self->rc.rc_ctrl_mode == VA_RC_QVBR)
|
||||
_vp9_calculate_bitrate_hrd (self);
|
||||
|
||||
/* notifications */
|
||||
/* update & notifications */
|
||||
update_property_uint (base, &self->prop.bitrate, bitrate, PROP_BITRATE);
|
||||
update_property_uint (base, &self->prop.cpb_size, self->rc.cpb_size,
|
||||
PROP_CPB_SIZE);
|
||||
update_property_uint (base, &self->prop.target_percentage,
|
||||
|
|
Loading…
Reference in a new issue