media_modules: video decode err frame drop policy [1/1]

PD#OTT-1921

Problem:
Add control node, Distinguish between the current frame error and
the error caused by the reference frame.

Solution:
vmh264,h265 Multiple instances Add control node

Verify:
s905x2

Change-Id: Ie9c6264db018009082d12a08d75cce5b6e9aeff0
Signed-off-by: Conglin Guo <conglin.guo@amlogic.com>
This commit is contained in:
Conglin Guo
2019-02-18 10:16:57 +08:00
committed by Dongjin Kim
parent 145062c623
commit 4cb94b48d9
2 changed files with 23 additions and 7 deletions

View File

@@ -193,6 +193,8 @@ static unsigned int max_get_frame_interval[H264_DEV_NUM];
static unsigned int run_count[H264_DEV_NUM];
static unsigned int input_empty[H264_DEV_NUM];
static unsigned int not_run_ready[H264_DEV_NUM];
static unsigned int ref_frame_mark_flag[H264_DEV_NUM] =
{1, 1, 1, 1, 1, 1, 1, 1, 1};
#define VDEC_CLOCK_ADJUST_FRAME 30
static unsigned int clk_adj_frame_count;
@@ -244,6 +246,7 @@ static unsigned int i_only_flag;
*/
static unsigned int error_proc_policy = 0xf36; /*0x1f14*/
/*
error_skip_count:
bit[11:0] error skip frame count
@@ -2406,6 +2409,7 @@ int prepare_display_buf(struct vdec_s *vdec, struct FrameStore *frame)
__func__, buffer_index, frame->data_flag & ERROR_FLAG,
frame->poc, hw->data_flag & ERROR_FLAG,
error_proc_policy);
if ((frame->data_flag & NODISP_FLAG) ||
(frame->data_flag & NULL_FLAG) ||
(frame->data_flag & ERROR_FLAG) ||
@@ -2418,6 +2422,7 @@ int prepare_display_buf(struct vdec_s *vdec, struct FrameStore *frame)
return 0; /*do not return -1,
otherwise flush_dpb() will not flush all dbp frames*/
}
display_frame_count[DECODE_ID(hw)]++;
if (dpb_is_debug(DECODE_ID(hw),
@@ -3076,14 +3081,14 @@ int config_decode_buf(struct vdec_h264_hw_s *hw, struct StorablePicture *pic)
/* bit[6:5] - frame/field info,
* 01 - top, 10 - bottom, 11 - frame
*/
#ifdef ERROR_CHECK
#ifdef ERROR_CHECK
if (ref == NULL) {
hw->data_flag |= ERROR_FLAG;
pic->data_flag |= ERROR_FLAG;
dpb_print(DECODE_ID(hw), PRINT_FLAG_ERRORFLAG_DBG, " ref list0 NULL\n");
return -1;
}
if (ref->data_flag & ERROR_FLAG) {
if ((ref->data_flag & ERROR_FLAG) && ref_frame_mark_flag[DECODE_ID(hw)]) {
hw->data_flag |= ERROR_FLAG;
pic->data_flag |= ERROR_FLAG;
dpb_print(DECODE_ID(hw), PRINT_FLAG_ERRORFLAG_DBG, " ref error mark1 \n");
@@ -3145,14 +3150,15 @@ int config_decode_buf(struct vdec_h264_hw_s *hw, struct StorablePicture *pic)
/* bit[6:5] - frame/field info,
* 01 - top, 10 - bottom, 11 - frame
*/
#ifdef ERROR_CHECK
#ifdef ERROR_CHECK
if (ref == NULL) {
hw->data_flag |= ERROR_FLAG;
pic->data_flag |= ERROR_FLAG;
dpb_print(DECODE_ID(hw), PRINT_FLAG_ERRORFLAG_DBG, " ref error list1 NULL\n");
return -2;
}
if (ref->data_flag & ERROR_FLAG) {
if ((ref->data_flag & ERROR_FLAG) && (ref_frame_mark_flag[DECODE_ID(hw)])) {
pic->data_flag |= ERROR_FLAG;
hw->data_flag |= ERROR_FLAG;
dpb_print(DECODE_ID(hw), PRINT_FLAG_ERRORFLAG_DBG, " ref error mark2\n");
@@ -4800,6 +4806,7 @@ static irqreturn_t vh264_isr_thread_fn(struct vdec_s *vdec, int irq)
p->data_flag |= MAYBE_ERROR_FLAG;
}
}
if (error_proc_policy & 0x400) {
int ret = dpb_check_ref_list_error(p_H264_Dpb);
if (ret != 0) {
@@ -8209,6 +8216,8 @@ module_param_array(max_get_frame_interval, uint,
module_param_array(step, uint, &max_decode_instance_num, 0664);
module_param_array(ref_frame_mark_flag, uint, &max_decode_instance_num, 0664);
module_param(disp_vframe_valve_level, uint, 0664);
MODULE_PARM_DESC(disp_vframe_valve_level, "\n disp_vframe_valve_level\n");

View File

@@ -447,7 +447,6 @@ static unsigned int force_disp_pic_index;
static unsigned int disp_vframe_valve_level;
static int pre_decode_buf_level = 0x1000;
#ifdef MULTI_INSTANCE_SUPPORT
static unsigned int max_decode_instance_num
= MAX_DECODE_INSTANCE_NUM;
@@ -458,6 +457,8 @@ static unsigned int max_get_frame_interval[MAX_DECODE_INSTANCE_NUM];
static unsigned int run_count[MAX_DECODE_INSTANCE_NUM];
static unsigned int input_empty[MAX_DECODE_INSTANCE_NUM];
static unsigned int not_run_ready[MAX_DECODE_INSTANCE_NUM];
static unsigned int ref_frame_mark_flag[MAX_DECODE_INSTANCE_NUM] =
{1, 1, 1, 1, 1, 1, 1, 1, 1};
#ifdef CONFIG_AMLOGIC_MEDIA_MULTI_DEC
static unsigned char get_idx(struct hevc_state_s *hevc);
@@ -3535,7 +3536,7 @@ static int config_mc_buffer(struct hevc_state_s *hevc, struct PIC_s *cur_pic)
pic->width, pic->height);
cur_pic->error_mark = 1;
}
if (pic->error_mark)
if (pic->error_mark && (ref_frame_mark_flag[hevc->index]))
cur_pic->error_mark = 1;
WRITE_VREG(HEVCD_MPP_ANC_CANVAS_DATA_ADDR,
(pic->mc_canvas_u_v << 16)
@@ -3570,6 +3571,7 @@ static int config_mc_buffer(struct hevc_state_s *hevc, struct PIC_s *cur_pic)
"config_mc_buffer RefNum_L1\n");
WRITE_VREG(HEVCD_MPP_ANC_CANVAS_ACCCONFIG_ADDR,
(16 << 8) | (0 << 1) | 1);
for (i = 0; i < cur_pic->RefNum_L1; i++) {
pic =
get_ref_pic_by_POC(hevc,
@@ -3586,7 +3588,7 @@ static int config_mc_buffer(struct hevc_state_s *hevc, struct PIC_s *cur_pic)
cur_pic->error_mark = 1;
}
if (pic->error_mark)
if (pic->error_mark && (ref_frame_mark_flag[hevc->index]))
cur_pic->error_mark = 1;
WRITE_VREG(HEVCD_MPP_ANC_CANVAS_DATA_ADDR,
(pic->mc_canvas_u_v << 16)
@@ -11454,6 +11456,7 @@ static void vh265_dump_state(struct vdec_s *vdec)
}
static int ammvdec_h265_probe(struct platform_device *pdev)
{
@@ -12044,6 +12047,10 @@ module_param_array(input_empty, uint,
module_param_array(not_run_ready, uint,
&max_decode_instance_num, 0664);
module_param_array(ref_frame_mark_flag, uint,
&max_decode_instance_num, 0664);
#endif
#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
module_param(dv_toggle_prov_name, uint, 0664);