__s32 BSP_disp_set_output_csc(__u32 sel, __disp_output_type_t type) { __disp_color_range_t out_color_range = DISP_COLOR_RANGE_0_255; __u32 out_csc = 0; if(type == DISP_OUTPUT_TYPE_HDMI) { __s32 ret = 0; __s32 value = 0; out_color_range = DISP_COLOR_RANGE_16_255; ret = OSAL_Script_FetchParser_Data("disp_init", "screen0_out_color_range", &value, 1); if(ret < 0) { DE_INF("fetch script data disp_init.screen0_out_color_range fail\n"); } else { out_color_range = value; DE_INF("screen0_out_color_range = %d\n", value); } out_csc = 2; } else if(type == DISP_OUTPUT_TYPE_TV) { out_csc = 1; } DE_BE_Output_Cfg_Csc_Coeff(sel, out_csc, out_color_range); return DIS_SUCCESS; }
__s32 Disp_drc_init(__u32 sel) { __u32 scn_width, scn_height; scn_width = BSP_disp_get_screen_width(sel); scn_height = BSP_disp_get_screen_height(sel); if (sel == 0) { /* to prevent BE OUTCSC output YUV when IEP CSC not ready */ //BSP_disp_cfg_start(sel); /* IEP clk */ iep_clk_open(sel); /* another module */ /* when running drc mode, debe must output yuv format */ #if 0 DE_BE_Output_Cfg_Csc_Coeff(sel, DISP_OUTPUT_TYPE_TV, 0); BSP_disp_set_output_csc(sel, gdisp.screen[sel].output_type, 1); #endif /* IEP module */ DE_IEP_Set_Mode(sel, 2); DE_IEP_Set_Display_Size(sel, scn_width, scn_height); //DE_IEP_Set_Csc_Coeff(sel, 3); DE_IEP_Drc_Set_Spa_Coeff(sel, spatial_coeff); DE_IEP_Drc_Set_Int_Coeff(sel, intensity_coeff); /* default: no adjust */ DE_IEP_Drc_Adjust_Enable(sel, 0); /* default: autoload enable */ DE_IEP_Drc_Set_Lgc_Autoload_Disable(sel, 0); DE_IEP_Lh_Set_Mode(sel, 0); /* default: histogram normal mode */ //DE_IEP_Lh_Set_Mode(sel, 1); /* histogram average mode */ //DE_IEP_Lh_Set_Thres(sel, hist_thres_drc); DE_IEP_Lh_Set_Thres(sel, hist_thres_pwrsv); //gpwrsv[sel].user_bl = gdisp.screen[sel].lcd_bright; memset(gpwrsv[sel].min_adj_index_hist, 255, sizeof(__u8) * IEP_LH_PWRSV_NUM); //giep[sel].drc_en = 1; giep[sel].drc_win_en = 1; #if 0 giep[sel].drc_win.x = 0; giep[sel].drc_win.y = 0; giep[sel].drc_win.width = scn_width; /* * will clear when drc enable actually, but apps dont know when, * so delete it. */ giep[sel].drc_win.height = scn_height; #endif /* set 1 to make sure first frame wont get a random lgc table */ giep[sel].waitframe = 1; giep[sel].runframe = 0; /* to prevent BE OUTCSC output YUV when IEP CSC not ready */ //BSP_disp_cfg_finish(sel); return 0; } else { return -1; } }