enc->pic.rate_ctrl.rate_ctrl_method != pic->rate_ctrl.rate_ctrl_method ||
enc->pic.quant_i_frames != pic->quant_i_frames ||
enc->pic.quant_p_frames != pic->quant_p_frames ||
- enc->pic.quant_b_frames != pic->quant_b_frames;
+ enc->pic.quant_b_frames != pic->quant_b_frames ||
+ enc->pic.rate_ctrl.target_bitrate != pic->rate_ctrl.target_bitrate;
enc->pic = *pic;
si_get_pic_param(enc, pic);
{
struct radeon_encoder *enc = (struct radeon_encoder*)encoder;
struct vl_video_buffer *vid_buf = (struct vl_video_buffer *)source;
+ bool need_rate_control = false;
+
+ if (u_reduce_video_profile(enc->base.profile) == PIPE_VIDEO_FORMAT_MPEG4_AVC) {
+ struct pipe_h264_enc_picture_desc *pic = (struct pipe_h264_enc_picture_desc *)picture;
+ need_rate_control =
+ enc->enc_pic.rc_layer_init.target_bit_rate != pic->rate_ctrl.target_bitrate;
+ } else if (u_reduce_video_profile(picture->profile) == PIPE_VIDEO_FORMAT_HEVC) {
+ struct pipe_h265_enc_picture_desc *pic = (struct pipe_h265_enc_picture_desc *)picture;
+ need_rate_control =
+ enc->enc_pic.rc_layer_init.target_bit_rate != pic->rc.target_bitrate;
+ }
radeon_vcn_enc_get_param(enc, picture);
flush(enc);
si_vid_destroy_buffer(&fb);
}
+ if (need_rate_control) {
+ enc->begin(enc);
+ flush(enc);
+ }
}
static void radeon_enc_encode_bitstream(struct pipe_video_codec *encoder,