vah264enc: Set the trellis only when HW supports it

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6663>
This commit is contained in:
He Junyan 2024-04-16 23:50:58 +08:00 committed by GStreamer Marge Bot
parent 5b27aff33b
commit 5706e3566c

View file

@ -178,6 +178,7 @@ struct _GstVaH264Enc
guint min_cr; guint min_cr;
gboolean use_cabac; gboolean use_cabac;
gboolean use_dct8x8; gboolean use_dct8x8;
gboolean support_trellis;
gboolean use_trellis; gboolean use_trellis;
gboolean aud; gboolean aud;
gboolean cc; gboolean cc;
@ -767,9 +768,9 @@ _validate_parameters (GstVaH264Enc * self)
self->num_slices, PROP_NUM_SLICES); self->num_slices, PROP_NUM_SLICES);
/* Ensure trellis. */ /* Ensure trellis. */
if (self->use_trellis && self->support_trellis = gst_va_encoder_has_trellis (base->encoder,
!gst_va_encoder_has_trellis (base->encoder, base->profile, base->profile, GST_VA_BASE_ENC_ENTRYPOINT (base));
GST_VA_BASE_ENC_ENTRYPOINT (base))) { if (self->use_trellis && !self->support_trellis) {
GST_INFO_OBJECT (self, "The trellis is not supported"); GST_INFO_OBJECT (self, "The trellis is not supported");
self->use_trellis = FALSE; self->use_trellis = FALSE;
} }
@ -1516,6 +1517,7 @@ gst_va_h264_enc_reset_state (GstVaBaseEnc * base)
self->level_str = NULL; self->level_str = NULL;
self->mb_width = 0; self->mb_width = 0;
self->mb_height = 0; self->mb_height = 0;
self->support_trellis = FALSE;
self->gop.i_period = 0; self->gop.i_period = 0;
self->gop.total_idr_count = 0; self->gop.total_idr_count = 0;
@ -3009,8 +3011,8 @@ _encode_one_frame (GstVaH264Enc * self, GstVideoCodecFrame * gst_frame)
self->rc.rc_ctrl_mode, self->rc.cpb_length_bits)) self->rc.rc_ctrl_mode, self->rc.cpb_length_bits))
return FALSE; return FALSE;
if (!gst_va_base_enc_add_trellis_parameter (base, frame->base.picture, if (self->support_trellis && !gst_va_base_enc_add_trellis_parameter (base,
self->use_trellis)) frame->base.picture, self->use_trellis))
return FALSE; return FALSE;
_fill_sequence_param (self, &sequence); _fill_sequence_param (self, &sequence);