[Mesa-dev] [PATCH 3/5] radeon/vce: use vce structures for encoding
Boyuan Zhang
boyuan.zhang at amd.com
Tue Jun 14 20:14:30 UTC 2016
Signed-off-by: Boyuan Zhang <boyuan.zhang at amd.com>
---
src/gallium/drivers/radeon/radeon_vce.c | 180 ++++++++++-
src/gallium/drivers/radeon/radeon_vce.h | 2 +-
src/gallium/drivers/radeon/radeon_vce_40_2_2.c | 425 +++++++++++++------------
src/gallium/drivers/radeon/radeon_vce_50.c | 183 ++++++-----
src/gallium/drivers/radeon/radeon_vce_52.c | 171 +++++-----
5 files changed, 603 insertions(+), 358 deletions(-)
diff --git a/src/gallium/drivers/radeon/radeon_vce.c b/src/gallium/drivers/radeon/radeon_vce.c
index e16e0cf..549d999 100644
--- a/src/gallium/drivers/radeon/radeon_vce.c
+++ b/src/gallium/drivers/radeon/radeon_vce.c
@@ -139,6 +139,176 @@ static void sort_cpb(struct rvce_encoder *enc)
}
}
+static void get_rate_control_param(struct rvce_encoder *enc, struct pipe_h264_enc_picture_desc *pic)
+{
+ enc->pic.rc.rc_method = pic->rate_ctrl.rate_ctrl_method;
+ enc->pic.rc.target_bitrate = pic->rate_ctrl.target_bitrate;
+ enc->pic.rc.peak_bitrate = pic->rate_ctrl.peak_bitrate;
+ enc->pic.rc.quant_i_frames = pic->quant_i_frames;
+ enc->pic.rc.quant_p_frames = pic->quant_p_frames;
+ enc->pic.rc.quant_b_frames = pic->quant_b_frames;
+ enc->pic.rc.gop_size = pic->gop_size;
+ enc->pic.rc.frame_rate_num = pic->rate_ctrl.frame_rate_num;
+ enc->pic.rc.frame_rate_den = pic->rate_ctrl.frame_rate_den;
+ enc->pic.rc.max_qp = 51;
+
+ if (pic->enable_low_level_control == true) {
+ enc->pic.rc.vbv_buffer_size = 20000000;
+ if (pic->rate_ctrl.frame_rate_num == 0)
+ enc->pic.rc.frame_rate_num = 30;
+ if (pic->rate_ctrl.frame_rate_den == 0)
+ enc->pic.rc.frame_rate_den = 1;
+ enc->pic.rc.vbv_buf_lv = 48;
+ enc->pic.rc.fill_data_enable = 1;
+ enc->pic.rc.enforce_hrd = 1;
+ enc->pic.rc.target_bits_picture = enc->pic.rc.target_bitrate / enc->pic.rc.frame_rate_num;
+ enc->pic.rc.peak_bits_picture_integer = enc->pic.rc.peak_bitrate / enc->pic.rc.frame_rate_num;
+ enc->pic.rc.peak_bits_picture_fraction = 0;
+ } else {
+ enc->pic.rc.vbv_buffer_size = pic->rate_ctrl.vbv_buffer_size;
+ enc->pic.rc.vbv_buf_lv = 0;
+ enc->pic.rc.fill_data_enable = 0;
+ enc->pic.rc.enforce_hrd = 0;
+ enc->pic.rc.target_bits_picture = pic->rate_ctrl.target_bits_picture;
+ enc->pic.rc.peak_bits_picture_integer = pic->rate_ctrl.peak_bits_picture_integer;
+ enc->pic.rc.peak_bits_picture_fraction = pic->rate_ctrl.peak_bits_picture_fraction;
+ }
+}
+
+static void get_motion_estimation_param(struct rvce_encoder *enc, struct pipe_h264_enc_picture_desc *pic)
+{
+ if (pic->enable_low_level_control == true) {
+ enc->pic.me.motion_est_quarter_pixel = 0x00000001;
+ enc->pic.me.enc_disable_sub_mode = 0x00000078;
+ enc->pic.me.lsmvert = 0x00000002;
+ enc->pic.me.enc_en_ime_overw_dis_subm = 0x00000001;
+ enc->pic.me.enc_ime_overw_dis_subm_no = 0x00000001;
+ enc->pic.me.enc_ime2_search_range_x = 0x00000004;
+ enc->pic.me.enc_ime2_search_range_y = 0x00000004;
+ enc->pic.me.enc_ime_decimation_search = 0x00000001;
+ enc->pic.me.motion_est_half_pixel = 0x00000001;
+ enc->pic.me.enc_search_range_x = 0x00000010;
+ enc->pic.me.enc_search_range_y = 0x00000010;
+ enc->pic.me.enc_search1_range_x = 0x00000010;
+ enc->pic.me.enc_search1_range_y = 0x00000010;
+ } else {
+ enc->pic.me.motion_est_quarter_pixel = 0x00000000;
+ enc->pic.me.enc_disable_sub_mode = 0x000000fe;
+ enc->pic.me.lsmvert = 0x00000000;
+ enc->pic.me.enc_en_ime_overw_dis_subm = 0x00000000;
+ enc->pic.me.enc_ime_overw_dis_subm_no = 0x00000000;
+ enc->pic.me.enc_ime2_search_range_x = 0x00000001;
+ enc->pic.me.enc_ime2_search_range_y = 0x00000001;
+ enc->pic.me.enc_ime_decimation_search = 0x00000001;
+ enc->pic.me.motion_est_half_pixel = 0x00000001;
+ enc->pic.me.enc_search_range_x = 0x00000010;
+ enc->pic.me.enc_search_range_y = 0x00000010;
+ enc->pic.me.enc_search1_range_x = 0x00000010;
+ enc->pic.me.enc_search1_range_y = 0x00000010;
+ }
+}
+
+static void get_pic_control_param(struct rvce_encoder *enc, struct pipe_h264_enc_picture_desc *pic)
+{
+ unsigned encNumMBsPerSlice;
+ encNumMBsPerSlice = align(enc->base.width, 16) / 16;
+ encNumMBsPerSlice *= align(enc->base.height, 16) / 16;
+ enc->pic.pc.enc_crop_right_offset = (align(enc->base.width, 16) - enc->base.width) >> 1;
+ enc->pic.pc.enc_crop_bottom_offset = (align(enc->base.height, 16) - enc->base.height) >> 1;
+ enc->pic.pc.enc_num_mbs_per_slice = encNumMBsPerSlice;
+ enc->pic.pc.enc_b_pic_pattern = MAX2(enc->base.max_references, 1) - 1;
+ enc->pic.pc.enc_number_of_reference_frames = MIN2(enc->base.max_references, 2);
+ enc->pic.pc.enc_max_num_ref_frames = enc->base.max_references + 1;
+ enc->pic.pc.enc_num_default_active_ref_l0 = 0x00000001;
+ enc->pic.pc.enc_num_default_active_ref_l1 = 0x00000001;
+ if (pic->enable_low_level_control == true) {
+ enc->pic.pc.enc_cabac_enable = 0x00000001;
+ enc->pic.pc.enc_constraint_set_flags = 0x00000040;
+ enc->pic.pc.enc_num_default_active_ref_l0 = 0x00000001;
+ enc->pic.pc.enc_num_default_active_ref_l1 = 0x00000001;
+ } else {
+ enc->pic.pc.enc_cabac_enable = 0x00000000;
+ enc->pic.pc.enc_constraint_set_flags = 0x00000040;
+ enc->pic.pc.enc_num_default_active_ref_l0 = 0x00000001;
+ enc->pic.pc.enc_num_default_active_ref_l1 = 0x00000001;
+ }
+}
+
+static void get_task_info_param(struct rvce_encoder *enc)
+{
+ enc->pic.ti.offset_of_next_task_info = 0xffffffff;
+}
+
+static void get_feedback_buffer_param(struct rvce_encoder *enc)
+{
+ enc->pic.fb.feedback_ring_size = 0x00000001;
+}
+
+static void get_config_ext_param(struct rvce_encoder *enc)
+{
+ enc->pic.ce.enc_enable_perf_logging = 0x00000003;
+}
+
+static void get_vui_param(struct rvce_encoder *enc, struct pipe_h264_enc_picture_desc *pic)
+{
+ if (pic->enable_low_level_control == true)
+ enc->pic.enable_vui = 0;
+ else
+ enc->pic.enable_vui = (pic->rate_ctrl.frame_rate_num != 0);
+ enc->pic.vui.video_format = 0x00000005;
+ enc->pic.vui.color_prim = 0x00000002;
+ enc->pic.vui.transfer_char = 0x00000002;
+ enc->pic.vui.matrix_coef = 0x00000002;
+ enc->pic.vui.timing_info_present_flag = 0x00000001;
+ enc->pic.vui.num_units_in_tick = pic->rate_ctrl.frame_rate_den;
+ enc->pic.vui.time_scale = pic->rate_ctrl.frame_rate_num * 2;
+ enc->pic.vui.fixed_frame_rate_flag = 0x00000001;
+ enc->pic.vui.bit_rate_scale = 0x00000004;
+ enc->pic.vui.cpb_size_scale = 0x00000006;
+ enc->pic.vui.initial_cpb_removal_delay_length_minus1 = 0x00000017;
+ enc->pic.vui.cpb_removal_delay_length_minus1 = 0x00000017;
+ enc->pic.vui.dpb_output_delay_length_minus1 = 0x00000017;
+ enc->pic.vui.time_offset_length = 0x00000018;
+ enc->pic.vui.motion_vectors_over_pic_boundaries_flag = 0x00000001;
+ enc->pic.vui.max_bytes_per_pic_denom = 0x00000002;
+ enc->pic.vui.max_bits_per_mb_denom = 0x00000001;
+ enc->pic.vui.log2_max_mv_length_hori = 0x00000010;
+ enc->pic.vui.log2_max_mv_length_vert = 0x00000010;
+ enc->pic.vui.num_reorder_frames = 0x00000003;
+ enc->pic.vui.max_dec_frame_buffering = 0x00000003;
+}
+
+static void get_pic_param(struct rvce_encoder *enc, struct pipe_h264_enc_picture_desc *pic)
+{
+ if (pic->enable_low_level_control == true)
+ enc->pic.ref_pic_mode = 0x01000201;
+ get_rate_control_param(enc, pic);
+ get_motion_estimation_param(enc, pic);
+ get_pic_control_param(enc, pic);
+ get_task_info_param(enc);
+ get_feedback_buffer_param(enc);
+ get_vui_param(enc, pic);
+ get_config_ext_param(enc);
+
+ enc->pic.picture_type = pic->picture_type;
+ enc->pic.frame_num = pic->frame_num;
+ enc->pic.frame_num_cnt = pic->frame_num_cnt;
+ enc->pic.p_remain = pic->p_remain;
+ enc->pic.i_remain = pic->i_remain;
+ enc->pic.gop_cnt = pic->gop_cnt;
+ enc->pic.pic_order_cnt = pic->pic_order_cnt;
+ enc->pic.ref_idx_l0 = pic->ref_idx_l0;
+ enc->pic.ref_idx_l1 = pic->ref_idx_l1;
+ enc->pic.not_referenced = pic->not_referenced;
+ enc->pic.is_idr = pic->is_idr;
+ enc->pic.has_ref_pic_list = pic->has_ref_pic_list;
+ for (int i = 0; i < 32 ; i++) {
+ enc->pic.ref_pic_list_0[i] = pic->ref_pic_list_0[i];
+ enc->pic.ref_pic_list_1[i] = pic->ref_pic_list_1[i];
+ enc->pic.frame_idx[i] = pic->frame_idx[i];
+ }
+}
+
/**
* get number of cpbs based on dpb
*/
@@ -261,12 +431,12 @@ static void rvce_begin_frame(struct pipe_video_codec *encoder,
struct pipe_h264_enc_picture_desc *pic = (struct pipe_h264_enc_picture_desc *)picture;
bool need_rate_control =
- 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.rc.rc_method != pic->rate_ctrl.rate_ctrl_method ||
+ enc->pic.rc.quant_i_frames != pic->quant_i_frames ||
+ enc->pic.rc.quant_p_frames != pic->quant_p_frames ||
+ enc->pic.rc.quant_b_frames != pic->quant_b_frames;
- enc->pic = *pic;
+ get_pic_param(enc, pic);
enc->get_buffer(vid_buf->resources[0], &enc->handle, &enc->luma);
enc->get_buffer(vid_buf->resources[1], NULL, &enc->chroma);
diff --git a/src/gallium/drivers/radeon/radeon_vce.h b/src/gallium/drivers/radeon/radeon_vce.h
index da61285..af93f69 100644
--- a/src/gallium/drivers/radeon/radeon_vce.h
+++ b/src/gallium/drivers/radeon/radeon_vce.h
@@ -404,7 +404,7 @@ struct rvce_encoder {
struct rvid_buffer *fb;
struct rvid_buffer cpb;
- struct pipe_h264_enc_picture_desc pic;
+ struct rvce_h264_enc_pic pic;
unsigned task_info_idx;
unsigned bs_idx;
diff --git a/src/gallium/drivers/radeon/radeon_vce_40_2_2.c b/src/gallium/drivers/radeon/radeon_vce_40_2_2.c
index 2906ad0..d893ebc 100644
--- a/src/gallium/drivers/radeon/radeon_vce_40_2_2.c
+++ b/src/gallium/drivers/radeon/radeon_vce_40_2_2.c
@@ -65,12 +65,16 @@ static void task_info(struct rvce_encoder *enc, uint32_t op,
}
enc->task_info_idx = enc->cs->current.cdw;
}
- RVCE_CS(0xffffffff); // offsetOfNextTaskInfo
- RVCE_CS(op); // taskOperation
- RVCE_CS(dep); // referencePictureDependency
- RVCE_CS(0x00000000); // collocateFlagDependency
- RVCE_CS(fb_idx); // feedbackIndex
- RVCE_CS(ring_idx); // videoBitstreamRingIndex
+ enc->pic.ti.task_operation = op;
+ enc->pic.ti.reference_picture_dependency = dep;
+ enc->pic.ti.feedback_index = fb_idx;
+ enc->pic.ti.video_bitstream_ring_index = ring_idx;
+ RVCE_CS(enc->pic.ti.offset_of_next_task_info); // offsetOfNextTaskInfo
+ RVCE_CS(enc->pic.ti.task_operation); // taskOperation
+ RVCE_CS(enc->pic.ti.reference_picture_dependency); // referencePictureDependency
+ RVCE_CS(enc->pic.ti.collocate_flag_dependency); // collocateFlagDependency
+ RVCE_CS(enc->pic.ti.feedback_index); // feedbackIndex
+ RVCE_CS(enc->pic.ti.video_bitstream_ring_index); // videoBitstreamRingIndex
RVCE_END();
}
@@ -78,7 +82,7 @@ static void feedback(struct rvce_encoder *enc)
{
RVCE_BEGIN(0x05000005); // feedback buffer
RVCE_WRITE(enc->fb->res->buf, enc->fb->res->domains, 0x0); // feedbackRingAddressHi/Lo
- RVCE_CS(0x00000001); // feedbackRingSize
+ RVCE_CS(enc->pic.fb.feedback_ring_size); // feedbackRingSize
RVCE_END();
}
@@ -87,145 +91,140 @@ static void create(struct rvce_encoder *enc)
enc->task_info(enc, 0x00000000, 0, 0, 0);
RVCE_BEGIN(0x01000001); // create cmd
- RVCE_CS(0x00000000); // encUseCircularBuffer
+ RVCE_CS(enc->pic.ec.enc_use_circular_buffer); // encUseCircularBuffer
RVCE_CS(profiles[enc->base.profile -
PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE]); // encProfile
RVCE_CS(enc->base.level); // encLevel
- RVCE_CS(0x00000000); // encPicStructRestriction
+ RVCE_CS(enc->pic.ec.enc_pic_struct_restriction); // encPicStructRestriction
RVCE_CS(enc->base.width); // encImageWidth
RVCE_CS(enc->base.height); // encImageHeight
RVCE_CS(enc->luma->level[0].pitch_bytes); // encRefPicLumaPitch
RVCE_CS(enc->chroma->level[0].pitch_bytes); // encRefPicChromaPitch
RVCE_CS(align(enc->luma->npix_y, 16) / 8); // encRefYHeightInQw
- RVCE_CS(0x00000000); // encRefPic(Addr|Array)Mode, encPicStructRestriction, disableRDO
+ RVCE_CS(enc->pic.ref_pic_mode); // encRefPic(Addr|Array)Mode, encPicStructRestriction, disableRDO
RVCE_END();
}
static void rate_control(struct rvce_encoder *enc)
{
RVCE_BEGIN(0x04000005); // rate control
- RVCE_CS(enc->pic.rate_ctrl.rate_ctrl_method); // encRateControlMethod
- RVCE_CS(enc->pic.rate_ctrl.target_bitrate); // encRateControlTargetBitRate
- RVCE_CS(enc->pic.rate_ctrl.peak_bitrate); // encRateControlPeakBitRate
- RVCE_CS(enc->pic.rate_ctrl.frame_rate_num); // encRateControlFrameRateNum
- RVCE_CS(0x00000000); // encGOPSize
- RVCE_CS(enc->pic.quant_i_frames); // encQP_I
- RVCE_CS(enc->pic.quant_p_frames); // encQP_P
- RVCE_CS(enc->pic.quant_b_frames); // encQP_B
- RVCE_CS(enc->pic.rate_ctrl.vbv_buffer_size); // encVBVBufferSize
- RVCE_CS(enc->pic.rate_ctrl.frame_rate_den); // encRateControlFrameRateDen
- RVCE_CS(0x00000000); // encVBVBufferLevel
- RVCE_CS(0x00000000); // encMaxAUSize
- RVCE_CS(0x00000000); // encQPInitialMode
- RVCE_CS(enc->pic.rate_ctrl.target_bits_picture); // encTargetBitsPerPicture
- RVCE_CS(enc->pic.rate_ctrl.peak_bits_picture_integer); // encPeakBitsPerPictureInteger
- RVCE_CS(enc->pic.rate_ctrl.peak_bits_picture_fraction); // encPeakBitsPerPictureFractional
- RVCE_CS(0x00000000); // encMinQP
- RVCE_CS(0x00000033); // encMaxQP
- RVCE_CS(0x00000000); // encSkipFrameEnable
- RVCE_CS(0x00000000); // encFillerDataEnable
- RVCE_CS(0x00000000); // encEnforceHRD
- RVCE_CS(0x00000000); // encBPicsDeltaQP
- RVCE_CS(0x00000000); // encReferenceBPicsDeltaQP
- RVCE_CS(0x00000000); // encRateControlReInitDisable
+ RVCE_CS(enc->pic.rc.rc_method); // encRateControlMethod
+ RVCE_CS(enc->pic.rc.target_bitrate); // encRateControlTargetBitRate
+ RVCE_CS(enc->pic.rc.peak_bitrate); // encRateControlPeakBitRate
+ RVCE_CS(enc->pic.rc.frame_rate_num); // encRateControlFrameRateNum
+ RVCE_CS(enc->pic.rc.gop_size); // encGOPSize
+ RVCE_CS(enc->pic.rc.quant_i_frames); // encQP_I
+ RVCE_CS(enc->pic.rc.quant_p_frames); // encQP_P
+ RVCE_CS(enc->pic.rc.quant_b_frames); // encQP_B
+ RVCE_CS(enc->pic.rc.vbv_buffer_size); // encVBVBufferSize
+ RVCE_CS(enc->pic.rc.frame_rate_den); // encRateControlFrameRateDen
+ RVCE_CS(enc->pic.rc.vbv_buf_lv); // encVBVBufferLevel
+ RVCE_CS(enc->pic.rc.max_au_size); // encMaxAUSize
+ RVCE_CS(enc->pic.rc.qp_initial_mode); // encQPInitialMode
+ RVCE_CS(enc->pic.rc.target_bits_picture); // encTargetBitsPerPicture
+ RVCE_CS(enc->pic.rc.peak_bits_picture_integer); // encPeakBitsPerPictureInteger
+ RVCE_CS(enc->pic.rc.peak_bits_picture_fraction); // encPeakBitsPerPictureFractional
+ RVCE_CS(enc->pic.rc.min_qp); // encMinQP
+ RVCE_CS(enc->pic.rc.max_qp); // encMaxQP
+ RVCE_CS(enc->pic.rc.skip_frame_enable); // encSkipFrameEnable
+ RVCE_CS(enc->pic.rc.fill_data_enable); // encFillerDataEnable
+ RVCE_CS(enc->pic.rc.enforce_hrd); // encEnforceHRD
+ RVCE_CS(enc->pic.rc.b_pics_delta_qp); // encBPicsDeltaQP
+ RVCE_CS(enc->pic.rc.ref_b_pics_delta_qp); // encReferenceBPicsDeltaQP
+ RVCE_CS(enc->pic.rc.rc_reinit_disable); // encRateControlReInitDisable
RVCE_END();
}
static void config_extension(struct rvce_encoder *enc)
{
RVCE_BEGIN(0x04000001); // config extension
- RVCE_CS(0x00000003); // encEnablePerfLogging
+ RVCE_CS(enc->pic.ce.enc_enable_perf_logging); // encEnablePerfLogging
RVCE_END();
}
static void pic_control(struct rvce_encoder *enc)
{
- unsigned encNumMBsPerSlice;
-
- encNumMBsPerSlice = align(enc->base.width, 16) / 16;
- encNumMBsPerSlice *= align(enc->base.height, 16) / 16;
-
RVCE_BEGIN(0x04000002); // pic control
- RVCE_CS(0x00000000); // encUseConstrainedIntraPred
- RVCE_CS(0x00000000); // encCABACEnable
- RVCE_CS(0x00000000); // encCABACIDC
- RVCE_CS(0x00000000); // encLoopFilterDisable
- RVCE_CS(0x00000000); // encLFBetaOffset
- RVCE_CS(0x00000000); // encLFAlphaC0Offset
- RVCE_CS(0x00000000); // encCropLeftOffset
- RVCE_CS((align(enc->base.width, 16) - enc->base.width) >> 1); // encCropRightOffset
- RVCE_CS(0x00000000); // encCropTopOffset
- RVCE_CS((align(enc->base.height, 16) - enc->base.height) >> 1); // encCropBottomOffset
- RVCE_CS(encNumMBsPerSlice); // encNumMBsPerSlice
- RVCE_CS(0x00000000); // encIntraRefreshNumMBsPerSlot
- RVCE_CS(0x00000000); // encForceIntraRefresh
- RVCE_CS(0x00000000); // encForceIMBPeriod
- RVCE_CS(0x00000000); // encPicOrderCntType
- RVCE_CS(0x00000000); // log2_max_pic_order_cnt_lsb_minus4
- RVCE_CS(0x00000000); // encSPSID
- RVCE_CS(0x00000000); // encPPSID
- RVCE_CS(0x00000040); // encConstraintSetFlags
- RVCE_CS(MAX2(enc->base.max_references, 1) - 1); // encBPicPattern
- RVCE_CS(0x00000000); // weightPredModeBPicture
- RVCE_CS(MIN2(enc->base.max_references, 2)); // encNumberOfReferenceFrames
- RVCE_CS(enc->base.max_references + 1); // encMaxNumRefFrames
- RVCE_CS(0x00000001); // encNumDefaultActiveRefL0
- RVCE_CS(0x00000001); // encNumDefaultActiveRefL1
- RVCE_CS(0x00000000); // encSliceMode
- RVCE_CS(0x00000000); // encMaxSliceSize
+ RVCE_CS(enc->pic.pc.enc_use_constrained_intra_pred); // encUseConstrainedIntraPred
+ RVCE_CS(enc->pic.pc.enc_cabac_enable); // encCABACEnable
+ RVCE_CS(enc->pic.pc.enc_cabac_idc); // encCABACIDC
+ RVCE_CS(enc->pic.pc.enc_loop_filter_disable); // encLoopFilterDisable
+ RVCE_CS(enc->pic.pc.enc_lf_beta_offset); // encLFBetaOffset
+ RVCE_CS(enc->pic.pc.enc_lf_alpha_c0_offset); // encLFAlphaC0Offset
+ RVCE_CS(enc->pic.pc.enc_crop_left_offset); // encCropLeftOffset
+ RVCE_CS(enc->pic.pc.enc_crop_right_offset); // encCropRightOffset
+ RVCE_CS(enc->pic.pc.enc_crop_top_offset); // encCropTopOffset
+ RVCE_CS(enc->pic.pc.enc_crop_bottom_offset); // encCropBottomOffset
+ RVCE_CS(enc->pic.pc.enc_num_mbs_per_slice); // encNumMBsPerSlice
+ RVCE_CS(enc->pic.pc.enc_intra_refresh_num_mbs_per_slot); // encIntraRefreshNumMBsPerSlot
+ RVCE_CS(enc->pic.pc.enc_force_intra_refresh); // encForceIntraRefresh
+ RVCE_CS(enc->pic.pc.enc_force_imb_period); // encForceIMBPeriod
+ RVCE_CS(enc->pic.pc.enc_pic_order_cnt_type); // encPicOrderCntType
+ RVCE_CS(enc->pic.pc.log2_max_pic_order_cnt_lsb_minus4); // log2_max_pic_order_cnt_lsb_minus4
+ RVCE_CS(enc->pic.pc.enc_sps_id); // encSPSID
+ RVCE_CS(enc->pic.pc.enc_pps_id); // encPPSID
+ RVCE_CS(enc->pic.pc.enc_constraint_set_flags); // encConstraintSetFlags
+ RVCE_CS(enc->pic.pc.enc_b_pic_pattern); // encBPicPattern
+ RVCE_CS(enc->pic.pc.weight_pred_mode_b_picture); // weightPredModeBPicture
+ RVCE_CS(enc->pic.pc.enc_number_of_reference_frames); // encNumberOfReferenceFrames
+ RVCE_CS(enc->pic.pc.enc_max_num_ref_frames); // encMaxNumRefFrames
+ RVCE_CS(enc->pic.pc.enc_num_default_active_ref_l0); // encNumDefaultActiveRefL0
+ RVCE_CS(enc->pic.pc.enc_num_default_active_ref_l1); // encNumDefaultActiveRefL1
+ RVCE_CS(enc->pic.pc.enc_slice_mode); // encSliceMode
+ RVCE_CS(enc->pic.pc.enc_max_slice_size); // encMaxSliceSize
RVCE_END();
}
static void motion_estimation(struct rvce_encoder *enc)
{
RVCE_BEGIN(0x04000007); // motion estimation
- RVCE_CS(0x00000001); // encIMEDecimationSearch
- RVCE_CS(0x00000001); // motionEstHalfPixel
- RVCE_CS(0x00000000); // motionEstQuarterPixel
- RVCE_CS(0x00000000); // disableFavorPMVPoint
- RVCE_CS(0x00000000); // forceZeroPointCenter
- RVCE_CS(0x00000000); // LSMVert
- RVCE_CS(0x00000010); // encSearchRangeX
- RVCE_CS(0x00000010); // encSearchRangeY
- RVCE_CS(0x00000010); // encSearch1RangeX
- RVCE_CS(0x00000010); // encSearch1RangeY
- RVCE_CS(0x00000000); // disable16x16Frame1
- RVCE_CS(0x00000000); // disableSATD
- RVCE_CS(0x00000000); // enableAMD
- RVCE_CS(0x000000fe); // encDisableSubMode
- RVCE_CS(0x00000000); // encIMESkipX
- RVCE_CS(0x00000000); // encIMESkipY
- RVCE_CS(0x00000000); // encEnImeOverwDisSubm
- RVCE_CS(0x00000000); // encImeOverwDisSubmNo
- RVCE_CS(0x00000001); // encIME2SearchRangeX
- RVCE_CS(0x00000001); // encIME2SearchRangeY
- RVCE_CS(0x00000000); // parallelModeSpeedupEnable
- RVCE_CS(0x00000000); // fme0_encDisableSubMode
- RVCE_CS(0x00000000); // fme1_encDisableSubMode
- RVCE_CS(0x00000000); // imeSWSpeedupEnable
+ RVCE_CS(enc->pic.me.enc_ime_decimation_search); // encIMEDecimationSearch
+ RVCE_CS(enc->pic.me.motion_est_half_pixel); // motionEstHalfPixel
+ RVCE_CS(enc->pic.me.motion_est_quarter_pixel); // motionEstQuarterPixel
+ RVCE_CS(enc->pic.me.disable_favor_pmv_point); // disableFavorPMVPoint
+ RVCE_CS(enc->pic.me.force_zero_point_center); // forceZeroPointCenter
+ RVCE_CS(enc->pic.me.lsmvert); // LSMVert
+ RVCE_CS(enc->pic.me.enc_search_range_x); // encSearchRangeX
+ RVCE_CS(enc->pic.me.enc_search_range_y); // encSearchRangeY
+ RVCE_CS(enc->pic.me.enc_search1_range_x); // encSearch1RangeX
+ RVCE_CS(enc->pic.me.enc_search1_range_y); // encSearch1RangeY
+ RVCE_CS(enc->pic.me.disable_16x16_frame1); // disable16x16Frame1
+ RVCE_CS(enc->pic.me.disable_satd); // disableSATD
+ RVCE_CS(enc->pic.me.enable_amd); // enableAMD
+ RVCE_CS(enc->pic.me.enc_disable_sub_mode); // encDisableSubMode
+ RVCE_CS(enc->pic.me.enc_ime_skip_x); // encIMESkipX
+ RVCE_CS(enc->pic.me.enc_ime_skip_y); // encIMESkipY
+ RVCE_CS(enc->pic.me.enc_en_ime_overw_dis_subm); // encEnImeOverwDisSubm
+ RVCE_CS(enc->pic.me.enc_ime_overw_dis_subm_no); // encImeOverwDisSubmNo
+ RVCE_CS(enc->pic.me.enc_ime2_search_range_x); // encIME2SearchRangeX
+ RVCE_CS(enc->pic.me.enc_ime2_search_range_y); // encIME2SearchRangeY
+ RVCE_CS(enc->pic.me.parallel_mode_speedup_enable); // parallelModeSpeedupEnable
+ RVCE_CS(enc->pic.me.fme0_enc_disable_sub_mode); // fme0_encDisableSubMode
+ RVCE_CS(enc->pic.me.fme1_enc_disable_sub_mode); // fme1_encDisableSubMode
+ RVCE_CS(enc->pic.me.ime_sw_speedup_enable); // imeSWSpeedupEnable
RVCE_END();
}
static void rdo(struct rvce_encoder *enc)
{
RVCE_BEGIN(0x04000008); // rdo
- RVCE_CS(0x00000000); // encDisableTbePredIFrame
- RVCE_CS(0x00000000); // encDisableTbePredPFrame
- RVCE_CS(0x00000000); // useFmeInterpolY
- RVCE_CS(0x00000000); // useFmeInterpolUV
- RVCE_CS(0x00000000); // useFmeIntrapolY
- RVCE_CS(0x00000000); // useFmeIntrapolUV
- RVCE_CS(0x00000000); // useFmeInterpolY_1
- RVCE_CS(0x00000000); // useFmeInterpolUV_1
- RVCE_CS(0x00000000); // useFmeIntrapolY_1
- RVCE_CS(0x00000000); // useFmeIntrapolUV_1
- RVCE_CS(0x00000000); // enc16x16CostAdj
- RVCE_CS(0x00000000); // encSkipCostAdj
- RVCE_CS(0x00000000); // encForce16x16skip
- RVCE_CS(0x00000000); // encDisableThresholdCalcA
- RVCE_CS(0x00000000); // encLumaCoeffCost
- RVCE_CS(0x00000000); // encLumaMBCoeffCost
- RVCE_CS(0x00000000); // encChromaCoeffCost
+ RVCE_CS(enc->pic.rdo.enc_disable_tbe_pred_i_frame); // encDisableTbePredIFrame
+ RVCE_CS(enc->pic.rdo.enc_disable_tbe_pred_p_frame); // encDisableTbePredPFrame
+ RVCE_CS(enc->pic.rdo.use_fme_interpol_y); // useFmeInterpolY
+ RVCE_CS(enc->pic.rdo.use_fme_interpol_uv); // useFmeInterpolUV
+ RVCE_CS(enc->pic.rdo.use_fme_intrapol_y); // useFmeIntrapolY
+ RVCE_CS(enc->pic.rdo.use_fme_intrapol_uv); // useFmeIntrapolUV
+ RVCE_CS(enc->pic.rdo.use_fme_interpol_y_1); // useFmeInterpolY_1
+ RVCE_CS(enc->pic.rdo.use_fme_interpol_uv_1); // useFmeInterpolUV_1
+ RVCE_CS(enc->pic.rdo.use_fme_intrapol_y_1); // useFmeIntrapolY_1
+ RVCE_CS(enc->pic.rdo.use_fme_intrapol_uv_1); // useFmeIntrapolUV_1
+ RVCE_CS(enc->pic.rdo.enc_16x16_cost_adj); // enc16x16CostAdj
+ RVCE_CS(enc->pic.rdo.enc_skip_cost_adj); // encSkipCostAdj
+ RVCE_CS(enc->pic.rdo.enc_force_16x16_skip); // encForce16x16skip
+ RVCE_CS(enc->pic.rdo.enc_disable_threshold_calc_a); // encDisableThresholdCalcA
+ RVCE_CS(enc->pic.rdo.enc_luma_coeff_cost); // encLumaCoeffCost
+ RVCE_CS(enc->pic.rdo.enc_luma_mb_coeff_cost); // encLumaMBCoeffCost
+ RVCE_CS(enc->pic.rdo.enc_chroma_coeff_cost); // encChromaCoeffCost
RVCE_END();
}
@@ -233,53 +232,53 @@ static void vui(struct rvce_encoder *enc)
{
int i;
- if (!enc->pic.rate_ctrl.frame_rate_num)
+ if (!enc->pic.enable_vui)
return;
RVCE_BEGIN(0x04000009); // vui
- RVCE_CS(0x00000000); //aspectRatioInfoPresentFlag
- RVCE_CS(0x00000000); //aspectRatioInfo.aspectRatioIdc
- RVCE_CS(0x00000000); //aspectRatioInfo.sarWidth
- RVCE_CS(0x00000000); //aspectRatioInfo.sarHeight
- RVCE_CS(0x00000000); //overscanInfoPresentFlag
- RVCE_CS(0x00000000); //overScanInfo.overscanAppropFlag
- RVCE_CS(0x00000000); //videoSignalTypePresentFlag
- RVCE_CS(0x00000005); //videoSignalTypeInfo.videoFormat
- RVCE_CS(0x00000000); //videoSignalTypeInfo.videoFullRangeFlag
- RVCE_CS(0x00000000); //videoSignalTypeInfo.colorDescriptionPresentFlag
- RVCE_CS(0x00000002); //videoSignalTypeInfo.colorPrim
- RVCE_CS(0x00000002); //videoSignalTypeInfo.transferChar
- RVCE_CS(0x00000002); //videoSignalTypeInfo.matrixCoef
- RVCE_CS(0x00000000); //chromaLocInfoPresentFlag
- RVCE_CS(0x00000000); //chromaLocInfo.chromaLocTop
- RVCE_CS(0x00000000); //chromaLocInfo.chromaLocBottom
- RVCE_CS(0x00000001); //timingInfoPresentFlag
- RVCE_CS(enc->pic.rate_ctrl.frame_rate_den); //timingInfo.numUnitsInTick
- RVCE_CS(enc->pic.rate_ctrl.frame_rate_num * 2); //timingInfo.timeScale;
- RVCE_CS(0x00000001); //timingInfo.fixedFrameRateFlag
- RVCE_CS(0x00000000); //nalHRDParametersPresentFlag
- RVCE_CS(0x00000000); //hrdParam.cpbCntMinus1
- RVCE_CS(0x00000004); //hrdParam.bitRateScale
- RVCE_CS(0x00000006); //hrdParam.cpbSizeScale
+ RVCE_CS(enc->pic.vui.aspect_ratio_info_present_flag); //aspectRatioInfoPresentFlag
+ RVCE_CS(enc->pic.vui.aspect_ratio_idc); //aspectRatioInfo.aspectRatioIdc
+ RVCE_CS(enc->pic.vui.sar_width); //aspectRatioInfo.sarWidth
+ RVCE_CS(enc->pic.vui.sar_height); //aspectRatioInfo.sarHeight
+ RVCE_CS(enc->pic.vui.overscan_info_present_flag); //overscanInfoPresentFlag
+ RVCE_CS(enc->pic.vui.overscan_Approp_flag); //overScanInfo.overscanAppropFlag
+ RVCE_CS(enc->pic.vui.video_signal_type_present_flag); //videoSignalTypePresentFlag
+ RVCE_CS(enc->pic.vui.video_format); //videoSignalTypeInfo.videoFormat
+ RVCE_CS(enc->pic.vui.video_full_range_flag); //videoSignalTypeInfo.videoFullRangeFlag
+ RVCE_CS(enc->pic.vui.color_description_present_flag); //videoSignalTypeInfo.colorDescriptionPresentFlag
+ RVCE_CS(enc->pic.vui.color_prim); //videoSignalTypeInfo.colorPrim
+ RVCE_CS(enc->pic.vui.transfer_char); //videoSignalTypeInfo.transferChar
+ RVCE_CS(enc->pic.vui.matrix_coef); //videoSignalTypeInfo.matrixCoef
+ RVCE_CS(enc->pic.vui.chroma_loc_info_present_flag); //chromaLocInfoPresentFlag
+ RVCE_CS(enc->pic.vui.chroma_loc_top); //chromaLocInfo.chromaLocTop
+ RVCE_CS(enc->pic.vui.chroma_loc_bottom); //chromaLocInfo.chromaLocBottom
+ RVCE_CS(enc->pic.vui.timing_info_present_flag); //timingInfoPresentFlag
+ RVCE_CS(enc->pic.vui.num_units_in_tick); //timingInfo.numUnitsInTick
+ RVCE_CS(enc->pic.vui.time_scale); //timingInfo.timeScale;
+ RVCE_CS(enc->pic.vui.fixed_frame_rate_flag); //timingInfo.fixedFrameRateFlag
+ RVCE_CS(enc->pic.vui.nal_hrd_parameters_present_flag); //nalHRDParametersPresentFlag
+ RVCE_CS(enc->pic.vui.cpb_cnt_minus1); //hrdParam.cpbCntMinus1
+ RVCE_CS(enc->pic.vui.bit_rate_scale); //hrdParam.bitRateScale
+ RVCE_CS(enc->pic.vui.cpb_size_scale); //hrdParam.cpbSizeScale
for (i = 0; i < 32; i++) {
- RVCE_CS(0x00000000); //hrdParam.bitRateValueMinus
- RVCE_CS(0x00000000); //hrdParam.cpbSizeValueMinus
- RVCE_CS(0x00000000); //hrdParam.cbrFlag
+ RVCE_CS(enc->pic.vui.bit_rate_value_minus); //hrdParam.bitRateValueMinus
+ RVCE_CS(enc->pic.vui.cpb_size_value_minus); //hrdParam.cpbSizeValueMinus
+ RVCE_CS(enc->pic.vui.cbr_flag); //hrdParam.cbrFlag
}
- RVCE_CS(0x00000017); //hrdParam.initialCpbRemovalDelayLengthMinus1
- RVCE_CS(0x00000017); //hrdParam.cpbRemovalDelayLengthMinus1
- RVCE_CS(0x00000017); //hrdParam.dpbOutputDelayLengthMinus1
- RVCE_CS(0x00000018); //hrdParam.timeOffsetLength
- RVCE_CS(0x00000000); //lowDelayHRDFlag
- RVCE_CS(0x00000000); //picStructPresentFlag
- RVCE_CS(0x00000000); //bitstreamRestrictionPresentFlag
- RVCE_CS(0x00000001); //bitstreamRestrictions.motionVectorsOverPicBoundariesFlag
- RVCE_CS(0x00000002); //bitstreamRestrictions.maxBytesPerPicDenom
- RVCE_CS(0x00000001); //bitstreamRestrictions.maxBitsPerMbDenom
- RVCE_CS(0x00000010); //bitstreamRestrictions.log2MaxMvLengthHori
- RVCE_CS(0x00000010); //bitstreamRestrictions.log2MaxMvLengthVert
- RVCE_CS(0x00000003); //bitstreamRestrictions.numReorderFrames
- RVCE_CS(0x00000003); //bitstreamRestrictions.maxDecFrameBuffering
+ RVCE_CS(enc->pic.vui.initial_cpb_removal_delay_length_minus1); //hrdParam.initialCpbRemovalDelayLengthMinus1
+ RVCE_CS(enc->pic.vui.cpb_removal_delay_length_minus1); //hrdParam.cpbRemovalDelayLengthMinus1
+ RVCE_CS(enc->pic.vui.dpb_output_delay_length_minus1); //hrdParam.dpbOutputDelayLengthMinus1
+ RVCE_CS(enc->pic.vui.time_offset_length); //hrdParam.timeOffsetLength
+ RVCE_CS(enc->pic.vui.low_delay_hrd_flag); //lowDelayHRDFlag
+ RVCE_CS(enc->pic.vui.pic_struct_present_flag); //picStructPresentFlag
+ RVCE_CS(enc->pic.vui.bitstream_restriction_present_flag); //bitstreamRestrictionPresentFlag
+ RVCE_CS(enc->pic.vui.motion_vectors_over_pic_boundaries_flag); //bitstreamRestrictions.motionVectorsOverPicBoundariesFlag
+ RVCE_CS(enc->pic.vui.max_bytes_per_pic_denom); //bitstreamRestrictions.maxBytesPerPicDenom
+ RVCE_CS(enc->pic.vui.max_bits_per_mb_denom); //bitstreamRestrictions.maxBitsPerMbDenom
+ RVCE_CS(enc->pic.vui.log2_max_mv_length_hori); //bitstreamRestrictions.log2MaxMvLengthHori
+ RVCE_CS(enc->pic.vui.log2_max_mv_length_vert); //bitstreamRestrictions.log2MaxMvLengthVert
+ RVCE_CS(enc->pic.vui.num_reorder_frames); //bitstreamRestrictions.numReorderFrames
+ RVCE_CS(enc->pic.vui.max_dec_frame_buffering); //bitstreamRestrictions.maxDecFrameBuffering
RVCE_END();
}
@@ -312,13 +311,13 @@ static void encode(struct rvce_encoder *enc)
RVCE_END();
RVCE_BEGIN(0x03000001); // encode
- RVCE_CS(0x00000000); // insertHeaders
- RVCE_CS(0x00000000); // pictureStructure
+ RVCE_CS(enc->pic.eo.insert_headers); // insertHeaders
+ RVCE_CS(enc->pic.eo.picture_structure); // pictureStructure
RVCE_CS(enc->bs_size); // allowedMaxBitstreamSize
- RVCE_CS(0x00000000); // forceRefreshMap
- RVCE_CS(0x00000000); // insertAUD
- RVCE_CS(0x00000000); // endOfSequence
- RVCE_CS(0x00000000); // endOfStream
+ RVCE_CS(enc->pic.eo.force_refresh_map); // forceRefreshMap
+ RVCE_CS(enc->pic.eo.insert_aud); // insertAUD
+ RVCE_CS(enc->pic.eo.end_of_sequence); // endOfSequence
+ RVCE_CS(enc->pic.eo.end_of_stream); // endOfStream
RVCE_READ(enc->handle, RADEON_DOMAIN_VRAM,
enc->luma->level[0].offset); // inputPictureLumaAddressHi/Lo
RVCE_READ(enc->handle, RADEON_DOMAIN_VRAM,
@@ -326,37 +325,43 @@ static void encode(struct rvce_encoder *enc)
RVCE_CS(align(enc->luma->npix_y, 16)); // encInputFrameYPitch
RVCE_CS(enc->luma->level[0].pitch_bytes); // encInputPicLumaPitch
RVCE_CS(enc->chroma->level[0].pitch_bytes); // encInputPicChromaPitch
- RVCE_CS(0x00000000); // encInputPic(Addr|Array)Mode
- RVCE_CS(0x00000000); // encInputPicTileConfig
+ RVCE_CS(enc->pic.eo.enc_input_pic_addr_array); // encInputPic(Addr|Array)Mode
+ RVCE_CS(enc->pic.eo.enc_input_pic_tile_config); // encInputPicTileConfig
RVCE_CS(enc->pic.picture_type); // encPicType
RVCE_CS(enc->pic.picture_type == PIPE_H264_ENC_PICTURE_TYPE_IDR); // encIdrFlag
- RVCE_CS(0x00000000); // encIdrPicId
- RVCE_CS(0x00000000); // encMGSKeyPic
+ RVCE_CS(enc->pic.eo.enc_idr_pic_id); // encIdrPicId
+ RVCE_CS(enc->pic.eo.enc_mgs_key_pic); // encMGSKeyPic
RVCE_CS(!enc->pic.not_referenced); // encReferenceFlag
- RVCE_CS(0x00000000); // encTemporalLayerIndex
- RVCE_CS(0x00000000); // num_ref_idx_active_override_flag
- RVCE_CS(0x00000000); // num_ref_idx_l0_active_minus1
- RVCE_CS(0x00000000); // num_ref_idx_l1_active_minus1
+ RVCE_CS(enc->pic.eo.enc_temporal_layer_index); // encTemporalLayerIndex
+ RVCE_CS(enc->pic.eo.num_ref_idx_active_override_flag); // num_ref_idx_active_override_flag
+ RVCE_CS(enc->pic.eo.num_ref_idx_l0_active_minus1); // num_ref_idx_l0_active_minus1
+ RVCE_CS(enc->pic.eo.num_ref_idx_l1_active_minus1); // num_ref_idx_l1_active_minus1
i = enc->pic.frame_num - enc->pic.ref_idx_l0;
if (i > 1 && enc->pic.picture_type == PIPE_H264_ENC_PICTURE_TYPE_P) {
- RVCE_CS(0x00000001); // encRefListModificationOp
- RVCE_CS(i - 1); // encRefListModificationNum
+ enc->pic.eo.enc_ref_list_modification_op = 0x00000001;
+ enc->pic.eo.enc_ref_list_modification_num = i - 1;
+ RVCE_CS(enc->pic.eo.enc_ref_list_modification_op); // encRefListModificationOp
+ RVCE_CS(enc->pic.eo.enc_ref_list_modification_num); // encRefListModificationNum
} else {
- RVCE_CS(0x00000000); // encRefListModificationOp
- RVCE_CS(0x00000000); // encRefListModificationNum
+ enc->pic.eo.enc_ref_list_modification_op = 0x00000000;
+ enc->pic.eo.enc_ref_list_modification_num = 0x00000000;
+ RVCE_CS(enc->pic.eo.enc_ref_list_modification_op); // encRefListModificationOp
+ RVCE_CS(enc->pic.eo.enc_ref_list_modification_num); // encRefListModificationNum
}
for (i = 0; i < 3; ++i) {
- RVCE_CS(0x00000000); // encRefListModificationOp
- RVCE_CS(0x00000000); // encRefListModificationNum
+ enc->pic.eo.enc_ref_list_modification_op = 0x00000000;
+ enc->pic.eo.enc_ref_list_modification_num = 0x00000000;
+ RVCE_CS(enc->pic.eo.enc_ref_list_modification_op); // encRefListModificationOp
+ RVCE_CS(enc->pic.eo.enc_ref_list_modification_num); // encRefListModificationNum
}
for (i = 0; i < 4; ++i) {
- RVCE_CS(0x00000000); // encDecodedPictureMarkingOp
- RVCE_CS(0x00000000); // encDecodedPictureMarkingNum
- RVCE_CS(0x00000000); // encDecodedPictureMarkingIdx
- RVCE_CS(0x00000000); // encDecodedRefBasePictureMarkingOp
- RVCE_CS(0x00000000); // encDecodedRefBasePictureMarkingNum
+ RVCE_CS(enc->pic.eo.enc_decoded_picture_marking_op); // encDecodedPictureMarkingOp
+ RVCE_CS(enc->pic.eo.enc_decoded_picture_marking_num); // encDecodedPictureMarkingNum
+ RVCE_CS(enc->pic.eo.enc_decoded_picture_marking_idx); // encDecodedPictureMarkingIdx
+ RVCE_CS(enc->pic.eo.enc_decoded_ref_base_picture_marking_op); // encDecodedRefBasePictureMarkingOp
+ RVCE_CS(enc->pic.eo.enc_decoded_ref_base_picture_marking_num); // encDecodedRefBasePictureMarkingNum
}
// encReferencePictureL0[0]
@@ -371,20 +376,31 @@ static void encode(struct rvce_encoder *enc)
RVCE_CS(luma_offset); // lumaOffset
RVCE_CS(chroma_offset); // chromaOffset
} else {
- RVCE_CS(0x00000000); // encPicType
- RVCE_CS(0x00000000); // frameNumber
- RVCE_CS(0x00000000); // pictureOrderCount
- RVCE_CS(0xffffffff); // lumaOffset
- RVCE_CS(0xffffffff); // chromaOffset
+ enc->pic.eo.l0_enc_pic_type = 0x00000000;
+ enc->pic.eo.l0_frame_number = 0x00000000;
+ enc->pic.eo.l0_picture_order_count = 0x00000000;
+ enc->pic.eo.l0_luma_offset = 0xffffffff;
+ enc->pic.eo.l0_chroma_offset = 0xffffffff;
+ RVCE_CS(enc->pic.eo.l0_enc_pic_type); // encPicType
+ RVCE_CS(enc->pic.eo.l0_frame_number); // frameNumber
+ RVCE_CS(enc->pic.eo.l0_picture_order_count); // pictureOrderCount
+ RVCE_CS(enc->pic.eo.l0_luma_offset); // lumaOffset
+ RVCE_CS(enc->pic.eo.l0_chroma_offset); // chromaOffset
}
// encReferencePictureL0[1]
- RVCE_CS(0x00000000); // pictureStructure
- RVCE_CS(0x00000000); // encPicType
- RVCE_CS(0x00000000); // frameNumber
- RVCE_CS(0x00000000); // pictureOrderCount
- RVCE_CS(0xffffffff); // lumaOffset
- RVCE_CS(0xffffffff); // chromaOffset
+ enc->pic.eo.l0_picture_structure = 0x00000000;
+ enc->pic.eo.l0_enc_pic_type = 0x00000000;
+ enc->pic.eo.l0_frame_number = 0x00000000;
+ enc->pic.eo.l0_picture_order_count = 0x00000000;
+ enc->pic.eo.l0_luma_offset = 0xffffffff;
+ enc->pic.eo.l0_chroma_offset = 0xffffffff;
+ RVCE_CS(enc->pic.eo.l0_picture_structure); // pictureStructure
+ RVCE_CS(enc->pic.eo.l0_enc_pic_type); // encPicType
+ RVCE_CS(enc->pic.eo.l0_frame_number); // frameNumber
+ RVCE_CS(enc->pic.eo.l0_picture_order_count); // pictureOrderCount
+ RVCE_CS(enc->pic.eo.l0_luma_offset); // lumaOffset
+ RVCE_CS(enc->pic.eo.l0_chroma_offset); // chromaOffset
// encReferencePictureL1[0]
RVCE_CS(0x00000000); // pictureStructure
@@ -397,29 +413,34 @@ static void encode(struct rvce_encoder *enc)
RVCE_CS(luma_offset); // lumaOffset
RVCE_CS(chroma_offset); // chromaOffset
} else {
- RVCE_CS(0x00000000); // encPicType
- RVCE_CS(0x00000000); // frameNumber
- RVCE_CS(0x00000000); // pictureOrderCount
- RVCE_CS(0xffffffff); // lumaOffset
- RVCE_CS(0xffffffff); // chromaOffset
+ enc->pic.eo.l1_enc_pic_type = 0x00000000;
+ enc->pic.eo.l1_frame_number = 0x00000000;
+ enc->pic.eo.l1_picture_order_count = 0x00000000;
+ enc->pic.eo.l1_luma_offset = 0xffffffff;
+ enc->pic.eo.l1_chroma_offset = 0xffffffff;
+ RVCE_CS(enc->pic.eo.l1_enc_pic_type); // encPicType
+ RVCE_CS(enc->pic.eo.l1_frame_number); // frameNumber
+ RVCE_CS(enc->pic.eo.l1_picture_order_count); // pictureOrderCount
+ RVCE_CS(enc->pic.eo.l1_luma_offset); // lumaOffset
+ RVCE_CS(enc->pic.eo.l1_chroma_offset); // chromaOffset
}
rvce_frame_offset(enc, current_slot(enc), &luma_offset, &chroma_offset);
RVCE_CS(luma_offset); // encReconstructedLumaOffset
RVCE_CS(chroma_offset); // encReconstructedChromaOffset
- RVCE_CS(0x00000000); // encColocBufferOffset
- RVCE_CS(0x00000000); // encReconstructedRefBasePictureLumaOffset
- RVCE_CS(0x00000000); // encReconstructedRefBasePictureChromaOffset
- RVCE_CS(0x00000000); // encReferenceRefBasePictureLumaOffset
- RVCE_CS(0x00000000); // encReferenceRefBasePictureChromaOffset
- RVCE_CS(0x00000000); // pictureCount
+ RVCE_CS(enc->pic.eo.enc_coloc_buffer_offset); // encColocBufferOffset
+ RVCE_CS(enc->pic.eo.enc_reconstructed_ref_base_picture_luma_offset); // encReconstructedRefBasePictureLumaOffset
+ RVCE_CS(enc->pic.eo.enc_reconstructed_ref_base_picture_chroma_offset); // encReconstructedRefBasePictureChromaOffset
+ RVCE_CS(enc->pic.eo.enc_reference_ref_base_picture_luma_offset); // encReferenceRefBasePictureLumaOffset
+ RVCE_CS(enc->pic.eo.enc_reference_ref_base_picture_chroma_offset); // encReferenceRefBasePictureChromaOffset
+ RVCE_CS(enc->pic.eo.picture_count); // pictureCount
RVCE_CS(enc->pic.frame_num); // frameNumber
RVCE_CS(enc->pic.pic_order_cnt); // pictureOrderCount
- RVCE_CS(0x00000000); // numIPicRemainInRCGOP
- RVCE_CS(0x00000000); // numPPicRemainInRCGOP
- RVCE_CS(0x00000000); // numBPicRemainInRCGOP
- RVCE_CS(0x00000000); // numIRPicRemainInRCGOP
- RVCE_CS(0x00000000); // enableIntraRefresh
+ RVCE_CS(enc->pic.eo.num_i_pic_remain_in_rcgop); // numIPicRemainInRCGOP
+ RVCE_CS(enc->pic.eo.num_p_pic_remain_in_rcgop); // numPPicRemainInRCGOP
+ RVCE_CS(enc->pic.eo.num_b_pic_remain_in_rcgop); // numBPicRemainInRCGOP
+ RVCE_CS(enc->pic.eo.num_ir_pic_remain_in_rcgop); // numIRPicRemainInRCGOP
+ RVCE_CS(enc->pic.eo.enable_intra_refresh); // enableIntraRefresh
RVCE_END();
}
diff --git a/src/gallium/drivers/radeon/radeon_vce_50.c b/src/gallium/drivers/radeon/radeon_vce_50.c
index 82e7ad2..4492bbc 100644
--- a/src/gallium/drivers/radeon/radeon_vce_50.c
+++ b/src/gallium/drivers/radeon/radeon_vce_50.c
@@ -47,32 +47,32 @@
static void rate_control(struct rvce_encoder *enc)
{
RVCE_BEGIN(0x04000005); // rate control
- RVCE_CS(enc->pic.rate_ctrl.rate_ctrl_method); // encRateControlMethod
- RVCE_CS(enc->pic.rate_ctrl.target_bitrate); // encRateControlTargetBitRate
- RVCE_CS(enc->pic.rate_ctrl.peak_bitrate); // encRateControlPeakBitRate
- RVCE_CS(enc->pic.rate_ctrl.frame_rate_num); // encRateControlFrameRateNum
- RVCE_CS(0x00000000); // encGOPSize
- RVCE_CS(enc->pic.quant_i_frames); // encQP_I
- RVCE_CS(enc->pic.quant_p_frames); // encQP_P
- RVCE_CS(enc->pic.quant_b_frames); // encQP_B
- RVCE_CS(enc->pic.rate_ctrl.vbv_buffer_size); // encVBVBufferSize
- RVCE_CS(enc->pic.rate_ctrl.frame_rate_den); // encRateControlFrameRateDen
- RVCE_CS(0x00000000); // encVBVBufferLevel
- RVCE_CS(0x00000000); // encMaxAUSize
- RVCE_CS(0x00000000); // encQPInitialMode
- RVCE_CS(enc->pic.rate_ctrl.target_bits_picture); // encTargetBitsPerPicture
- RVCE_CS(enc->pic.rate_ctrl.peak_bits_picture_integer); // encPeakBitsPerPictureInteger
- RVCE_CS(enc->pic.rate_ctrl.peak_bits_picture_fraction); // encPeakBitsPerPictureFractional
- RVCE_CS(0x00000000); // encMinQP
- RVCE_CS(0x00000033); // encMaxQP
- RVCE_CS(0x00000000); // encSkipFrameEnable
- RVCE_CS(0x00000000); // encFillerDataEnable
- RVCE_CS(0x00000000); // encEnforceHRD
- RVCE_CS(0x00000000); // encBPicsDeltaQP
- RVCE_CS(0x00000000); // encReferenceBPicsDeltaQP
- RVCE_CS(0x00000000); // encRateControlReInitDisable
- RVCE_CS(0x00000000); // encLCVBRInitQPFlag
- RVCE_CS(0x00000000); // encLCVBRSATDBasedNonlinearBitBudgetFlag
+ RVCE_CS(enc->pic.rc.rc_method); // encRateControlMethod
+ RVCE_CS(enc->pic.rc.target_bitrate); // encRateControlTargetBitRate
+ RVCE_CS(enc->pic.rc.peak_bitrate); // encRateControlPeakBitRate
+ RVCE_CS(enc->pic.rc.frame_rate_num); // encRateControlFrameRateNum
+ RVCE_CS(enc->pic.rc.gop_size); // encGOPSize
+ RVCE_CS(enc->pic.rc.quant_i_frames); // encQP_I
+ RVCE_CS(enc->pic.rc.quant_p_frames); // encQP_P
+ RVCE_CS(enc->pic.rc.quant_b_frames); // encQP_B
+ RVCE_CS(enc->pic.rc.vbv_buffer_size); // encVBVBufferSize
+ RVCE_CS(enc->pic.rc.frame_rate_den); // encRateControlFrameRateDen
+ RVCE_CS(enc->pic.rc.vbv_buf_lv); // encVBVBufferLevel
+ RVCE_CS(enc->pic.rc.max_au_size); // encMaxAUSize
+ RVCE_CS(enc->pic.rc.qp_initial_mode); // encQPInitialMode
+ RVCE_CS(enc->pic.rc.target_bits_picture); // encTargetBitsPerPicture
+ RVCE_CS(enc->pic.rc.peak_bits_picture_integer); // encPeakBitsPerPictureInteger
+ RVCE_CS(enc->pic.rc.peak_bits_picture_fraction); // encPeakBitsPerPictureFractional
+ RVCE_CS(enc->pic.rc.min_qp); // encMinQP
+ RVCE_CS(enc->pic.rc.max_qp); // encMaxQP
+ RVCE_CS(enc->pic.rc.skip_frame_enable); // encSkipFrameEnable
+ RVCE_CS(enc->pic.rc.fill_data_enable); // encFillerDataEnable
+ RVCE_CS(enc->pic.rc.enforce_hrd); // encEnforceHRD
+ RVCE_CS(enc->pic.rc.b_pics_delta_qp); // encBPicsDeltaQP
+ RVCE_CS(enc->pic.rc.ref_b_pics_delta_qp); // encReferenceBPicsDeltaQP
+ RVCE_CS(enc->pic.rc.rc_reinit_disable); // encRateControlReInitDisable
+ RVCE_CS(enc->pic.rc.enc_lcvbr_init_qp_flag); // encLCVBRInitQPFlag
+ RVCE_CS(enc->pic.rc.lcvbrsatd_based_nonlinear_bit_budget_flag); // encLCVBRSATDBasedNonlinearBitBudgetFlag
RVCE_END();
}
@@ -120,12 +120,12 @@ static void encode(struct rvce_encoder *enc)
RVCE_BEGIN(0x03000001); // encode
RVCE_CS(enc->pic.frame_num ? 0x0 : 0x11); // insertHeaders
- RVCE_CS(0x00000000); // pictureStructure
+ RVCE_CS(enc->pic.eo.picture_structure); // pictureStructure
RVCE_CS(enc->bs_size); // allowedMaxBitstreamSize
- RVCE_CS(0x00000000); // forceRefreshMap
- RVCE_CS(0x00000000); // insertAUD
- RVCE_CS(0x00000000); // endOfSequence
- RVCE_CS(0x00000000); // endOfStream
+ RVCE_CS(enc->pic.eo.force_refresh_map); // forceRefreshMap
+ RVCE_CS(enc->pic.eo.insert_aud); // insertAUD
+ RVCE_CS(enc->pic.eo.end_of_sequence); // endOfSequence
+ RVCE_CS(enc->pic.eo.end_of_stream); // endOfStream
RVCE_READ(enc->handle, RADEON_DOMAIN_VRAM,
enc->luma->level[0].offset); // inputPictureLumaAddressHi/Lo
RVCE_READ(enc->handle, RADEON_DOMAIN_VRAM,
@@ -134,39 +134,50 @@ static void encode(struct rvce_encoder *enc)
RVCE_CS(enc->luma->level[0].pitch_bytes); // encInputPicLumaPitch
RVCE_CS(enc->chroma->level[0].pitch_bytes); // encInputPicChromaPitch
if (enc->dual_pipe)
- RVCE_CS(0x00000000); // encInputPic(Addr|Array)Mode,encDisable(TwoPipeMode|MBOffloading)
+ enc->pic.eo.enc_input_pic_addr_array_disable2pipe_disablemboffload = 0x00000000;
else
- RVCE_CS(0x00010000); // encInputPic(Addr|Array)Mode,encDisable(TwoPipeMode|MBOffloading)
- RVCE_CS(0x00000000); // encInputPicTileConfig
+ enc->pic.eo.enc_input_pic_addr_array_disable2pipe_disablemboffload = 0x00010000;
+ RVCE_CS(enc->pic.eo.enc_input_pic_addr_array_disable2pipe_disablemboffload); // encInputPic(Addr|Array)Mode,encDisable(TwoPipeMode|MBOffloading)
+ RVCE_CS(enc->pic.eo.enc_input_pic_tile_config); // encInputPicTileConfig
RVCE_CS(enc->pic.picture_type); // encPicType
RVCE_CS(enc->pic.picture_type == PIPE_H264_ENC_PICTURE_TYPE_IDR); // encIdrFlag
- RVCE_CS(0x00000000); // encIdrPicId
- RVCE_CS(0x00000000); // encMGSKeyPic
+ if ((enc->pic.picture_type == PIPE_H264_ENC_PICTURE_TYPE_IDR) && (enc->pic.eo.enc_idr_pic_id !=0))
+ enc->pic.eo.enc_idr_pic_id = enc->pic.idr_pic_id - 1;
+ else
+ enc->pic.eo.enc_idr_pic_id = 0x00000000;
+ RVCE_CS(enc->pic.eo.enc_idr_pic_id); // encIdrPicId
+ RVCE_CS(enc->pic.eo.enc_mgs_key_pic); // encMGSKeyPic
RVCE_CS(!enc->pic.not_referenced); // encReferenceFlag
- RVCE_CS(0x00000000); // encTemporalLayerIndex
- RVCE_CS(0x00000000); // num_ref_idx_active_override_flag
- RVCE_CS(0x00000000); // num_ref_idx_l0_active_minus1
- RVCE_CS(0x00000000); // num_ref_idx_l1_active_minus1
+ RVCE_CS(enc->pic.eo.enc_temporal_layer_index); // encTemporalLayerIndex
+ RVCE_CS(enc->pic.eo.num_ref_idx_active_override_flag); // num_ref_idx_active_override_flag
+ RVCE_CS(enc->pic.eo.num_ref_idx_l0_active_minus1); // num_ref_idx_l0_active_minus1
+ RVCE_CS(enc->pic.eo.num_ref_idx_l1_active_minus1); // num_ref_idx_l1_active_minus1
i = enc->pic.frame_num - enc->pic.ref_idx_l0;
if (i > 1 && enc->pic.picture_type == PIPE_H264_ENC_PICTURE_TYPE_P) {
- RVCE_CS(0x00000001); // encRefListModificationOp
- RVCE_CS(i - 1); // encRefListModificationNum
+ enc->pic.eo.enc_ref_list_modification_op = 0x00000001;
+ enc->pic.eo.enc_ref_list_modification_num = i - 1;
+ RVCE_CS(enc->pic.eo.enc_ref_list_modification_op); // encRefListModificationOp
+ RVCE_CS(enc->pic.eo.enc_ref_list_modification_num); // encRefListModificationNum
} else {
- RVCE_CS(0x00000000); // encRefListModificationOp
- RVCE_CS(0x00000000); // encRefListModificationNum
+ enc->pic.eo.enc_ref_list_modification_op = 0x00000000;
+ enc->pic.eo.enc_ref_list_modification_num = 0x00000000;
+ RVCE_CS(enc->pic.eo.enc_ref_list_modification_op); // encRefListModificationOp
+ RVCE_CS(enc->pic.eo.enc_ref_list_modification_num); // encRefListModificationNum
}
for (i = 0; i < 3; ++i) {
- RVCE_CS(0x00000000); // encRefListModificationOp
- RVCE_CS(0x00000000); // encRefListModificationNum
+ enc->pic.eo.enc_ref_list_modification_op = 0x00000000;
+ enc->pic.eo.enc_ref_list_modification_num = 0x00000000;
+ RVCE_CS(enc->pic.eo.enc_ref_list_modification_op); // encRefListModificationOp
+ RVCE_CS(enc->pic.eo.enc_ref_list_modification_num); // encRefListModificationNum
}
for (i = 0; i < 4; ++i) {
- RVCE_CS(0x00000000); // encDecodedPictureMarkingOp
- RVCE_CS(0x00000000); // encDecodedPictureMarkingNum
- RVCE_CS(0x00000000); // encDecodedPictureMarkingIdx
- RVCE_CS(0x00000000); // encDecodedRefBasePictureMarkingOp
- RVCE_CS(0x00000000); // encDecodedRefBasePictureMarkingNum
+ RVCE_CS(enc->pic.eo.enc_decoded_picture_marking_op); // encDecodedPictureMarkingOp
+ RVCE_CS(enc->pic.eo.enc_decoded_picture_marking_num); // encDecodedPictureMarkingNum
+ RVCE_CS(enc->pic.eo.enc_decoded_picture_marking_idx); // encDecodedPictureMarkingIdx
+ RVCE_CS(enc->pic.eo.enc_decoded_ref_base_picture_marking_op); // encDecodedRefBasePictureMarkingOp
+ RVCE_CS(enc->pic.eo.enc_decoded_ref_base_picture_marking_num); // encDecodedRefBasePictureMarkingNum
}
// encReferencePictureL0[0]
@@ -181,20 +192,31 @@ static void encode(struct rvce_encoder *enc)
RVCE_CS(luma_offset); // lumaOffset
RVCE_CS(chroma_offset); // chromaOffset
} else {
- RVCE_CS(0x00000000); // encPicType
- RVCE_CS(0x00000000); // frameNumber
- RVCE_CS(0x00000000); // pictureOrderCount
- RVCE_CS(0xffffffff); // lumaOffset
- RVCE_CS(0xffffffff); // chromaOffset
+ enc->pic.eo.l0_enc_pic_type = 0x00000000;
+ enc->pic.eo.l0_frame_number = 0x00000000;
+ enc->pic.eo.l0_picture_order_count = 0x00000000;
+ enc->pic.eo.l0_luma_offset = 0xffffffff;
+ enc->pic.eo.l0_chroma_offset = 0xffffffff;
+ RVCE_CS(enc->pic.eo.l0_enc_pic_type); // encPicType
+ RVCE_CS(enc->pic.eo.l0_frame_number); // frameNumber
+ RVCE_CS(enc->pic.eo.l0_picture_order_count); // pictureOrderCount
+ RVCE_CS(enc->pic.eo.l0_luma_offset); // lumaOffset
+ RVCE_CS(enc->pic.eo.l0_chroma_offset); // chromaOffset
}
// encReferencePictureL0[1]
- RVCE_CS(0x00000000); // pictureStructure
- RVCE_CS(0x00000000); // encPicType
- RVCE_CS(0x00000000); // frameNumber
- RVCE_CS(0x00000000); // pictureOrderCount
- RVCE_CS(0xffffffff); // lumaOffset
- RVCE_CS(0xffffffff); // chromaOffset
+ enc->pic.eo.l0_picture_structure = 0x00000000;
+ enc->pic.eo.l0_enc_pic_type = 0x00000000;
+ enc->pic.eo.l0_frame_number = 0x00000000;
+ enc->pic.eo.l0_picture_order_count = 0x00000000;
+ enc->pic.eo.l0_luma_offset = 0xffffffff;
+ enc->pic.eo.l0_chroma_offset = 0xffffffff;
+ RVCE_CS(enc->pic.eo.l0_picture_structure); // pictureStructure
+ RVCE_CS(enc->pic.eo.l0_enc_pic_type); // encPicType
+ RVCE_CS(enc->pic.eo.l0_frame_number); // frameNumber
+ RVCE_CS(enc->pic.eo.l0_picture_order_count); // pictureOrderCount
+ RVCE_CS(enc->pic.eo.l0_luma_offset); // lumaOffset
+ RVCE_CS(enc->pic.eo.l0_chroma_offset); // chromaOffset
// encReferencePictureL1[0]
RVCE_CS(0x00000000); // pictureStructure
@@ -207,29 +229,34 @@ static void encode(struct rvce_encoder *enc)
RVCE_CS(luma_offset); // lumaOffset
RVCE_CS(chroma_offset); // chromaOffset
} else {
- RVCE_CS(0x00000000); // encPicType
- RVCE_CS(0x00000000); // frameNumber
- RVCE_CS(0x00000000); // pictureOrderCount
- RVCE_CS(0xffffffff); // lumaOffset
- RVCE_CS(0xffffffff); // chromaOffset
+ enc->pic.eo.l1_enc_pic_type = 0x00000000;
+ enc->pic.eo.l1_frame_number = 0x00000000;
+ enc->pic.eo.l1_picture_order_count = 0x00000000;
+ enc->pic.eo.l1_luma_offset = 0xffffffff;
+ enc->pic.eo.l1_chroma_offset = 0xffffffff;
+ RVCE_CS(enc->pic.eo.l1_enc_pic_type); // encPicType
+ RVCE_CS(enc->pic.eo.l1_frame_number); // frameNumber
+ RVCE_CS(enc->pic.eo.l1_picture_order_count); // pictureOrderCount
+ RVCE_CS(enc->pic.eo.l1_luma_offset); // lumaOffset
+ RVCE_CS(enc->pic.eo.l1_chroma_offset); // chromaOffset
}
rvce_frame_offset(enc, current_slot(enc), &luma_offset, &chroma_offset);
RVCE_CS(luma_offset); // encReconstructedLumaOffset
RVCE_CS(chroma_offset); // encReconstructedChromaOffset
- RVCE_CS(0x00000000); // encColocBufferOffset
- RVCE_CS(0x00000000); // encReconstructedRefBasePictureLumaOffset
- RVCE_CS(0x00000000); // encReconstructedRefBasePictureChromaOffset
- RVCE_CS(0x00000000); // encReferenceRefBasePictureLumaOffset
- RVCE_CS(0x00000000); // encReferenceRefBasePictureChromaOffset
- RVCE_CS(0x00000000); // pictureCount
+ RVCE_CS(enc->pic.eo.enc_coloc_buffer_offset); // encColocBufferOffset
+ RVCE_CS(enc->pic.eo.enc_reconstructed_ref_base_picture_luma_offset); // encReconstructedRefBasePictureLumaOffset
+ RVCE_CS(enc->pic.eo.enc_reconstructed_ref_base_picture_chroma_offset); // encReconstructedRefBasePictureChromaOffset
+ RVCE_CS(enc->pic.eo.enc_reference_ref_base_picture_luma_offset); // encReferenceRefBasePictureLumaOffset
+ RVCE_CS(enc->pic.eo.enc_reference_ref_base_picture_chroma_offset); // encReferenceRefBasePictureChromaOffset
+ RVCE_CS(enc->pic.frame_num_cnt-1); // pictureCount
RVCE_CS(enc->pic.frame_num); // frameNumber
RVCE_CS(enc->pic.pic_order_cnt); // pictureOrderCount
- RVCE_CS(0x00000000); // numIPicRemainInRCGOP
- RVCE_CS(0x00000000); // numPPicRemainInRCGOP
- RVCE_CS(0x00000000); // numBPicRemainInRCGOP
- RVCE_CS(0x00000000); // numIRPicRemainInRCGOP
- RVCE_CS(0x00000000); // enableIntraRefresh
+ RVCE_CS(enc->pic.i_remain); // numIPicRemainInRCGOP
+ RVCE_CS(enc->pic.p_remain); // numPPicRemainInRCGOP
+ RVCE_CS(enc->pic.eo.num_b_pic_remain_in_rcgop); // numBPicRemainInRCGOP
+ RVCE_CS(enc->pic.eo.num_ir_pic_remain_in_rcgop); // numIRPicRemainInRCGOP
+ RVCE_CS(enc->pic.eo.enable_intra_refresh); // enableIntraRefresh
RVCE_END();
}
diff --git a/src/gallium/drivers/radeon/radeon_vce_52.c b/src/gallium/drivers/radeon/radeon_vce_52.c
index 3894eea..e4034c7 100644
--- a/src/gallium/drivers/radeon/radeon_vce_52.c
+++ b/src/gallium/drivers/radeon/radeon_vce_52.c
@@ -45,22 +45,22 @@ static void create(struct rvce_encoder *enc)
enc->task_info(enc, 0x00000000, 0, 0, 0);
RVCE_BEGIN(0x01000001); // create cmd
- RVCE_CS(0x00000000); // encUseCircularBuffer
+ RVCE_CS(enc->pic.ec.enc_use_circular_buffer); // encUseCircularBuffer
RVCE_CS(profiles[enc->base.profile -
PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE]); // encProfile
RVCE_CS(enc->base.level); // encLevel
- RVCE_CS(0x00000000); // encPicStructRestriction
+ RVCE_CS(enc->pic.ec.enc_pic_struct_restriction); // encPicStructRestriction
RVCE_CS(enc->base.width); // encImageWidth
RVCE_CS(enc->base.height); // encImageHeight
RVCE_CS(enc->luma->level[0].pitch_bytes); // encRefPicLumaPitch
RVCE_CS(enc->chroma->level[0].pitch_bytes); // encRefPicChromaPitch
RVCE_CS(align(enc->luma->npix_y, 16) / 8); // encRefYHeightInQw
- RVCE_CS(0x00000000); // encRefPic(Addr|Array)Mode, encPicStructRestriction, disableRDO
+ RVCE_CS(enc->pic.ref_pic_mode); // encRefPic(Addr|Array)Mode, encPicStructRestriction, disableRDO
- RVCE_CS(0x00000000); // encPreEncodeContextBufferOffset
- RVCE_CS(0x00000000); // encPreEncodeInputLumaBufferOffset
- RVCE_CS(0x00000000); // encPreEncodeInputChromaBufferOffs
- RVCE_CS(0x00000000); // encPreEncodeMode|ChromaFlag|VBAQMode|SceneChangeSensitivity
+ RVCE_CS(enc->pic.ec.enc_pre_encode_context_buffer_offset); // encPreEncodeContextBufferOffset
+ RVCE_CS(enc->pic.ec.enc_pre_encode_input_luma_buffer_offset); // encPreEncodeInputLumaBufferOffset
+ RVCE_CS(enc->pic.ec.enc_pre_encode_input_chroma_buffer_offset); // encPreEncodeInputChromaBufferOffs
+ RVCE_CS(enc->pic.ec.enc_pre_encode_mode_chromaflag_vbaqmode_scenechangesensitivity); // encPreEncodeMode|ChromaFlag|VBAQMode|SceneChangeSensitivity
RVCE_END();
}
@@ -108,12 +108,12 @@ static void encode(struct rvce_encoder *enc)
RVCE_BEGIN(0x03000001); // encode
RVCE_CS(enc->pic.frame_num ? 0x0 : 0x11); // insertHeaders
- RVCE_CS(0x00000000); // pictureStructure
+ RVCE_CS(enc->pic.eo.picture_structure); // pictureStructure
RVCE_CS(enc->bs_size); // allowedMaxBitstreamSize
- RVCE_CS(0x00000000); // forceRefreshMap
- RVCE_CS(0x00000000); // insertAUD
- RVCE_CS(0x00000000); // endOfSequence
- RVCE_CS(0x00000000); // endOfStream
+ RVCE_CS(enc->pic.eo.force_refresh_map); // forceRefreshMap
+ RVCE_CS(enc->pic.eo.insert_aud); // insertAUD
+ RVCE_CS(enc->pic.eo.end_of_sequence); // endOfSequence
+ RVCE_CS(enc->pic.eo.end_of_stream); // endOfStream
RVCE_READ(enc->handle, RADEON_DOMAIN_VRAM,
enc->luma->level[0].offset); // inputPictureLumaAddressHi/Lo
RVCE_READ(enc->handle, RADEON_DOMAIN_VRAM,
@@ -122,45 +122,56 @@ static void encode(struct rvce_encoder *enc)
RVCE_CS(enc->luma->level[0].pitch_bytes); // encInputPicLumaPitch
RVCE_CS(enc->chroma->level[0].pitch_bytes); // encInputPicChromaPitch
if (enc->dual_pipe)
- RVCE_CS(0x00000000); // encInputPic(Addr|Array)Mode,encDisable(TwoPipeMode|MBOffloading)
+ enc->pic.eo.enc_input_pic_addr_array_disable2pipe_disablemboffload = 0x00000000;
else
- RVCE_CS(0x00010000); // encInputPic(Addr|Array)Mode,encDisable(TwoPipeMode|MBOffloading)
- RVCE_CS(0x00000000); // encInputPicTileConfig
+ enc->pic.eo.enc_input_pic_addr_array_disable2pipe_disablemboffload = 0x00010000;
+ RVCE_CS(enc->pic.eo.enc_input_pic_addr_array_disable2pipe_disablemboffload); // encInputPic(Addr|Array)Mode,encDisable(TwoPipeMode|MBOffloading)
+ RVCE_CS(enc->pic.eo.enc_input_pic_tile_config); // encInputPicTileConfig
RVCE_CS(enc->pic.picture_type); // encPicType
RVCE_CS(enc->pic.picture_type == PIPE_H264_ENC_PICTURE_TYPE_IDR); // encIdrFlag
- RVCE_CS(0x00000000); // encIdrPicId
- RVCE_CS(0x00000000); // encMGSKeyPic
+ if ((enc->pic.picture_type == PIPE_H264_ENC_PICTURE_TYPE_IDR) && (enc->pic.eo.enc_idr_pic_id !=0))
+ enc->pic.eo.enc_idr_pic_id = enc->pic.idr_pic_id - 1;
+ else
+ enc->pic.eo.enc_idr_pic_id = 0x00000000;
+ RVCE_CS(enc->pic.eo.enc_idr_pic_id); // encIdrPicId
+ RVCE_CS(enc->pic.eo.enc_mgs_key_pic); // encMGSKeyPic
RVCE_CS(!enc->pic.not_referenced); // encReferenceFlag
- RVCE_CS(0x00000000); // encTemporalLayerIndex
- RVCE_CS(0x00000000); // num_ref_idx_active_override_flag
- RVCE_CS(0x00000000); // num_ref_idx_l0_active_minus1
- RVCE_CS(0x00000000); // num_ref_idx_l1_active_minus1
+ RVCE_CS(enc->pic.eo.enc_temporal_layer_index); // encTemporalLayerIndex
+ RVCE_CS(enc->pic.eo.num_ref_idx_active_override_flag); // num_ref_idx_active_override_flag
+ RVCE_CS(enc->pic.eo.num_ref_idx_l0_active_minus1); // num_ref_idx_l0_active_minus1
+ RVCE_CS(enc->pic.eo.num_ref_idx_l1_active_minus1); // num_ref_idx_l1_active_minus1
i = enc->pic.frame_num - enc->pic.ref_idx_l0;
if (i > 1 && enc->pic.picture_type == PIPE_H264_ENC_PICTURE_TYPE_P) {
- RVCE_CS(0x00000001); // encRefListModificationOp
- RVCE_CS(i - 1); // encRefListModificationNum
+ enc->pic.eo.enc_ref_list_modification_op = 0x00000001;
+ enc->pic.eo.enc_ref_list_modification_num = i - 1;
+ RVCE_CS(enc->pic.eo.enc_ref_list_modification_op); // encRefListModificationOp
+ RVCE_CS(enc->pic.eo.enc_ref_list_modification_num); // encRefListModificationNum
} else {
- RVCE_CS(0x00000000); // encRefListModificationOp
- RVCE_CS(0x00000000); // encRefListModificationNum
+ enc->pic.eo.enc_ref_list_modification_op = 0x00000000;
+ enc->pic.eo.enc_ref_list_modification_num = 0x00000000;
+ RVCE_CS(enc->pic.eo.enc_ref_list_modification_op); // encRefListModificationOp
+ RVCE_CS(enc->pic.eo.enc_ref_list_modification_num); // encRefListModificationNum
}
for (i = 0; i < 3; ++i) {
- RVCE_CS(0x00000000); // encRefListModificationOp
- RVCE_CS(0x00000000); // encRefListModificationNum
+ enc->pic.eo.enc_ref_list_modification_op = 0x00000000;
+ enc->pic.eo.enc_ref_list_modification_num = 0x00000000;
+ RVCE_CS(enc->pic.eo.enc_ref_list_modification_op); // encRefListModificationOp
+ RVCE_CS(enc->pic.eo.enc_ref_list_modification_num); // encRefListModificationNum
}
for (i = 0; i < 4; ++i) {
- RVCE_CS(0x00000000); // encDecodedPictureMarkingOp
- RVCE_CS(0x00000000); // encDecodedPictureMarkingNum
- RVCE_CS(0x00000000); // encDecodedPictureMarkingIdx
- RVCE_CS(0x00000000); // encDecodedRefBasePictureMarkingOp
- RVCE_CS(0x00000000); // encDecodedRefBasePictureMarkingNum
+ RVCE_CS(enc->pic.eo.enc_decoded_picture_marking_op); // encDecodedPictureMarkingOp
+ RVCE_CS(enc->pic.eo.enc_decoded_picture_marking_num); // encDecodedPictureMarkingNum
+ RVCE_CS(enc->pic.eo.enc_decoded_picture_marking_idx); // encDecodedPictureMarkingIdx
+ RVCE_CS(enc->pic.eo.enc_decoded_ref_base_picture_marking_op); // encDecodedRefBasePictureMarkingOp
+ RVCE_CS(enc->pic.eo.enc_decoded_ref_base_picture_marking_num); // encDecodedRefBasePictureMarkingNum
}
// encReferencePictureL0[0]
RVCE_CS(0x00000000); // pictureStructure
if(enc->pic.picture_type == PIPE_H264_ENC_PICTURE_TYPE_P ||
- enc->pic.picture_type == PIPE_H264_ENC_PICTURE_TYPE_B) {
+ enc->pic.picture_type == PIPE_H264_ENC_PICTURE_TYPE_B) {
struct rvce_cpb_slot *l0 = l0_slot(enc);
rvce_frame_offset(enc, l0, &luma_offset, &chroma_offset);
RVCE_CS(l0->picture_type); // encPicType
@@ -169,20 +180,31 @@ static void encode(struct rvce_encoder *enc)
RVCE_CS(luma_offset); // lumaOffset
RVCE_CS(chroma_offset); // chromaOffset
} else {
- RVCE_CS(0x00000000); // encPicType
- RVCE_CS(0x00000000); // frameNumber
- RVCE_CS(0x00000000); // pictureOrderCount
- RVCE_CS(0xffffffff); // lumaOffset
- RVCE_CS(0xffffffff); // chromaOffset
+ enc->pic.eo.l0_enc_pic_type = 0x00000000;
+ enc->pic.eo.l0_frame_number = 0x00000000;
+ enc->pic.eo.l0_picture_order_count = 0x00000000;
+ enc->pic.eo.l0_luma_offset = 0xffffffff;
+ enc->pic.eo.l0_chroma_offset = 0xffffffff;
+ RVCE_CS(enc->pic.eo.l0_enc_pic_type); // encPicType
+ RVCE_CS(enc->pic.eo.l0_frame_number); // frameNumber
+ RVCE_CS(enc->pic.eo.l0_picture_order_count); // pictureOrderCount
+ RVCE_CS(enc->pic.eo.l0_luma_offset); // lumaOffset
+ RVCE_CS(enc->pic.eo.l0_chroma_offset); // chromaOffset
}
// encReferencePictureL0[1]
- RVCE_CS(0x00000000); // pictureStructure
- RVCE_CS(0x00000000); // encPicType
- RVCE_CS(0x00000000); // frameNumber
- RVCE_CS(0x00000000); // pictureOrderCount
- RVCE_CS(0xffffffff); // lumaOffset
- RVCE_CS(0xffffffff); // chromaOffset
+ enc->pic.eo.l0_picture_structure = 0x00000000;
+ enc->pic.eo.l0_enc_pic_type = 0x00000000;
+ enc->pic.eo.l0_frame_number = 0x00000000;
+ enc->pic.eo.l0_picture_order_count = 0x00000000;
+ enc->pic.eo.l0_luma_offset = 0xffffffff;
+ enc->pic.eo.l0_chroma_offset = 0xffffffff;
+ RVCE_CS(enc->pic.eo.l0_picture_structure); // pictureStructure
+ RVCE_CS(enc->pic.eo.l0_enc_pic_type); // encPicType
+ RVCE_CS(enc->pic.eo.l0_frame_number); // frameNumber
+ RVCE_CS(enc->pic.eo.l0_picture_order_count); // pictureOrderCount
+ RVCE_CS(enc->pic.eo.l0_luma_offset); // lumaOffset
+ RVCE_CS(enc->pic.eo.l0_chroma_offset); // chromaOffset
// encReferencePictureL1[0]
RVCE_CS(0x00000000); // pictureStructure
@@ -195,41 +217,46 @@ static void encode(struct rvce_encoder *enc)
RVCE_CS(luma_offset); // lumaOffset
RVCE_CS(chroma_offset); // chromaOffset
} else {
- RVCE_CS(0x00000000); // encPicType
- RVCE_CS(0x00000000); // frameNumber
- RVCE_CS(0x00000000); // pictureOrderCount
- RVCE_CS(0xffffffff); // lumaOffset
- RVCE_CS(0xffffffff); // chromaOffset
+ enc->pic.eo.l1_enc_pic_type = 0x00000000;
+ enc->pic.eo.l1_frame_number = 0x00000000;
+ enc->pic.eo.l1_picture_order_count = 0x00000000;
+ enc->pic.eo.l1_luma_offset = 0xffffffff;
+ enc->pic.eo.l1_chroma_offset = 0xffffffff;
+ RVCE_CS(enc->pic.eo.l1_enc_pic_type); // encPicType
+ RVCE_CS(enc->pic.eo.l1_frame_number); // frameNumber
+ RVCE_CS(enc->pic.eo.l1_picture_order_count); // pictureOrderCount
+ RVCE_CS(enc->pic.eo.l1_luma_offset); // lumaOffset
+ RVCE_CS(enc->pic.eo.l1_chroma_offset); // chromaOffset
}
rvce_frame_offset(enc, current_slot(enc), &luma_offset, &chroma_offset);
RVCE_CS(luma_offset); // encReconstructedLumaOffset
RVCE_CS(chroma_offset); // encReconstructedChromaOffset
- RVCE_CS(0x00000000); // encColocBufferOffset
- RVCE_CS(0x00000000); // encReconstructedRefBasePictureLumaOffset
- RVCE_CS(0x00000000); // encReconstructedRefBasePictureChromaOffset
- RVCE_CS(0x00000000); // encReferenceRefBasePictureLumaOffset
- RVCE_CS(0x00000000); // encReferenceRefBasePictureChromaOffset
- RVCE_CS(0x00000000); // pictureCount
+ RVCE_CS(enc->pic.eo.enc_coloc_buffer_offset); // encColocBufferOffset
+ RVCE_CS(enc->pic.eo.enc_reconstructed_ref_base_picture_luma_offset); // encReconstructedRefBasePictureLumaOffset
+ RVCE_CS(enc->pic.eo.enc_reconstructed_ref_base_picture_chroma_offset); // encReconstructedRefBasePictureChromaOffset
+ RVCE_CS(enc->pic.eo.enc_reference_ref_base_picture_luma_offset); // encReferenceRefBasePictureLumaOffset
+ RVCE_CS(enc->pic.eo.enc_reference_ref_base_picture_chroma_offset); // encReferenceRefBasePictureChromaOffset
+ RVCE_CS(enc->pic.frame_num_cnt-1); // pictureCount
RVCE_CS(enc->pic.frame_num); // frameNumber
RVCE_CS(enc->pic.pic_order_cnt); // pictureOrderCount
- RVCE_CS(0x00000000); // numIPicRemainInRCGOP
- RVCE_CS(0x00000000); // numPPicRemainInRCGOP
- RVCE_CS(0x00000000); // numBPicRemainInRCGOP
- RVCE_CS(0x00000000); // numIRPicRemainInRCGOP
- RVCE_CS(0x00000000); // enableIntraRefresh
-
- RVCE_CS(0x00000000); // aq_variance_en
- RVCE_CS(0x00000000); // aq_block_size
- RVCE_CS(0x00000000); // aq_mb_variance_sel
- RVCE_CS(0x00000000); // aq_frame_variance_sel
- RVCE_CS(0x00000000); // aq_param_a
- RVCE_CS(0x00000000); // aq_param_b
- RVCE_CS(0x00000000); // aq_param_c
- RVCE_CS(0x00000000); // aq_param_d
- RVCE_CS(0x00000000); // aq_param_e
-
- RVCE_CS(0x00000000); // contextInSFB
+ RVCE_CS(enc->pic.i_remain); // numIPicRemainInRCGOP
+ RVCE_CS(enc->pic.p_remain); // numPPicRemainInRCGOP
+ RVCE_CS(enc->pic.eo.num_b_pic_remain_in_rcgop); // numBPicRemainInRCGOP
+ RVCE_CS(enc->pic.eo.num_ir_pic_remain_in_rcgop); // numIRPicRemainInRCGOP
+ RVCE_CS(enc->pic.eo.enable_intra_refresh); // enableIntraRefresh
+
+ RVCE_CS(enc->pic.eo.aq_variance_en); // aq_variance_en
+ RVCE_CS(enc->pic.eo.aq_block_size); // aq_block_size
+ RVCE_CS(enc->pic.eo.aq_mb_variance_sel); // aq_mb_variance_sel
+ RVCE_CS(enc->pic.eo.aq_frame_variance_sel); // aq_frame_variance_sel
+ RVCE_CS(enc->pic.eo.aq_param_a); // aq_param_a
+ RVCE_CS(enc->pic.eo.aq_param_b); // aq_param_b
+ RVCE_CS(enc->pic.eo.aq_param_c); // aq_param_c
+ RVCE_CS(enc->pic.eo.aq_param_d); // aq_param_d
+ RVCE_CS(enc->pic.eo.aq_param_e); // aq_param_e
+
+ RVCE_CS(enc->pic.eo.context_in_sfb); // contextInSFB
RVCE_END();
}
--
1.9.1
More information about the mesa-dev
mailing list