From e4cec87bec4474ebd955a3801cb77fd2c4f23985 Mon Sep 17 00:00:00 2001 From: marqs Date: Tue, 9 Jul 2024 22:06:36 +0300 Subject: [PATCH] add support for 480p/576p Line3x --- software/sys_controller/ossc/controls.c | 2 +- software/sys_controller/ossc/menu.c | 13 ++++++++----- software/sys_controller/ossc/video_modes.c | 6 ++++-- software/sys_controller/ossc/video_modes.h | 2 +- software/sys_controller/ossc/video_modes_list.c | 2 ++ 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/software/sys_controller/ossc/controls.c b/software/sys_controller/ossc/controls.c index 87ac848..3fb9071 100644 --- a/software/sys_controller/ossc/controls.c +++ b/software/sys_controller/ossc/controls.c @@ -123,7 +123,7 @@ int parse_control() // one for each video_group alt_u8* pmcfg_ptr[] = { &pt_only, &tc.pm_240p, &tc.pm_240p, &tc.pm_384p, &tc.pm_480i, &tc.pm_480i, &tc.pm_480p, &tc.pm_480p, &pt_only, &tc.pm_1080i, &pt_only }; - alt_u8 valid_pm[] = { 0x1, 0x3f, 0x3f, 0x7, 0xf, 0xf, 0x3, 0x3, 0x1, 0x3, 0x1 }; + alt_u8 valid_pm[] = { 0x1, 0x3f, 0x3f, 0x7, 0xf, 0xf, 0x7, 0x7, 0x1, 0x3, 0x1 }; avinput_t next_input = (cm.avinput == AV3_YPBPR) ? AV1_RGBs : (cm.avinput+1); diff --git a/software/sys_controller/ossc/menu.c b/software/sys_controller/ossc/menu.c index 991c187..bc5ae54 100644 --- a/software/sys_controller/ossc/menu.c +++ b/software/sys_controller/ossc/menu.c @@ -62,7 +62,7 @@ static const char *l5_fmt_desc[] = { "1920x1080", "1600x1200", "1920x1200" }; static const char *pm_240p_desc[] = { LNG("Passthru","パススルー"), "Line2x", "Line3x", "Line4x", "Line5x", "Line6x" }; static const char *pm_480i_desc[] = { LNG("Passthru","パススルー"), "Line2x (bob)", "Line3x (laced)", "Line4x (bob)" }; static const char *pm_384p_desc[] = { LNG("Passthru","パススルー"), "Line2x", "Line3x Generic", "Line2x 240x360", "Line3x 240x360" }; -static const char *pm_480p_desc[] = { LNG("Passthru","パススルー"), "Line2x" }; +static const char *pm_480p_desc[] = { LNG("Passthru","パススルー"), "Line2x", "Line3x Generic" }; static const char *pm_1080i_desc[] = { LNG("Passthru","パススルー"), "Line2x (bob)" }; static const char *ar_256col_desc[] = { "Pseudo 4:3 DAR", "1:1 PAR" }; static const char *tx_mode_desc[] = { "HDMI (RGB)", "HDMI (YCbCr444)", "DVI" }; @@ -80,8 +80,9 @@ static const char *auto_input_desc[] = { "Off", "Current input", "All inputs" }; static const char *mask_color_desc[] = { "Black", "Blue", "Green", "Cyan", "Red", "Magenta", "Yellow", "White" }; static const char *av3_alt_rgb_desc[] = { "Off", "AV1", "AV2" }; static const char *shmask_mode_desc[] = { "Off", "A-Grille", "TV", "PVM" }; -static const char *lumacode_mode_desc[] = { "Off", "C64", "Spectrum", "Coleco/MSX" }; -static const char *pll_bw_desc[] = { "High", "Low" }; +static const char *lumacode_mode_desc[] = { "Off", "C64", "Spectrum", "Coleco/MSX", "NES" }; +static const char *adc_pll_bw_desc[] = { "High", "Medium", "Low", "Ultra low" }; +static const char *fpga_pll_bw_desc[] = { "High", "Low" }; static void sync_vth_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, "%d mV", (v*1127)/100); } static void intclks_to_time_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, "%u.%.2u us", (unsigned)(((1000000U*v)/(TVP_INTCLK_HZ/1000))/1000), (unsigned)((((1000000U*v)/(TVP_INTCLK_HZ/1000))%1000)/10)); } @@ -174,8 +175,8 @@ MENU(menu_sync, P99_PROTECT({ \ { LNG("Vsync threshold","Vsyncシキイチ"), OPT_AVCONFIG_NUMVALUE, { .num = { &tc.vsync_thold, OPT_NOWRAP, VSYNC_THOLD_MIN, VSYNC_THOLD_MAX, intclks_to_time_disp } } }, { "H-PLL Pre-Coast", OPT_AVCONFIG_NUMVALUE, { .num = { &tc.pre_coast, OPT_NOWRAP, 0, PLL_COAST_MAX, lines_disp } } }, { "H-PLL Post-Coast", OPT_AVCONFIG_NUMVALUE, { .num = { &tc.post_coast, OPT_NOWRAP, 0, PLL_COAST_MAX, lines_disp } } }, - { "ADC PLL BW", OPT_AVCONFIG_SELECTION, { .sel = { &tc.adc_pll_bw, OPT_WRAP, SETTING_ITEM(pll_bw_desc) } } }, - { "FPGA PLL BW", OPT_AVCONFIG_SELECTION, { .sel = { &tc.fpga_pll_bw, OPT_WRAP, SETTING_ITEM(pll_bw_desc) } } }, + { "ADC PLL BW", OPT_AVCONFIG_SELECTION, { .sel = { &tc.adc_pll_bw, OPT_WRAP, SETTING_ITEM(adc_pll_bw_desc) } } }, + { "FPGA PLL BW", OPT_AVCONFIG_SELECTION, { .sel = { &tc.fpga_pll_bw, OPT_WRAP, SETTING_ITEM(fpga_pll_bw_desc) } } }, })) MENU(menu_output, P99_PROTECT({ \ @@ -206,7 +207,9 @@ MENU(menu_scanlines, P99_PROTECT({ \ { "Sl. alternating", OPT_AVCONFIG_SELECTION, { .sel = { &tc.sl_altern, OPT_WRAP, SETTING_ITEM(off_on_desc) } } }, { LNG("Sl. alignment","スキャンラインポジション"), OPT_AVCONFIG_SELECTION, { .sel = { &tc.sl_id, OPT_WRAP, SETTING_ITEM(sl_id_desc) } } }, { LNG("Sl. type","スキャンラインルイ"), OPT_AVCONFIG_SELECTION, { .sel = { &tc.sl_type, OPT_WRAP, SETTING_ITEM(sl_type_desc) } } }, +#ifndef DEBUG { "< Custom Sl. >", OPT_SUBMENU, { .sub = { &menu_cust_sl, NULL, NULL } } }, +#endif })) MENU(menu_postproc, P99_PROTECT({ \ diff --git a/software/sys_controller/ossc/video_modes.c b/software/sys_controller/ossc/video_modes.c index a8b57e0..85a5a8a 100644 --- a/software/sys_controller/ossc/video_modes.c +++ b/software/sys_controller/ossc/video_modes.c @@ -169,7 +169,7 @@ int get_pure_lm_mode(avconfig_t *cc, mode_data_t *vm_in, mode_data_t *vm_out, vm break; case GROUP_480I: case GROUP_576I: - //fixed Line3x/4x mode for 480i + //fixed Line3x/4x mode for 480i and onwards valid_lm[2] = MODE_L3_GEN_16_9; valid_lm[3] = MODE_L4_GEN_4_3; break; @@ -399,7 +399,9 @@ int get_pure_lm_mode(avconfig_t *cc, mode_data_t *vm_in, mode_data_t *vm_out, vm } // Force TX pixel-repeat for high bandwidth modes - if (((mindiff_lm == MODE_L5_GEN_4_3) && (mode_preset->group == GROUP_288P)) || (mindiff_lm == MODE_L3_240x360) || (mindiff_lm >= MODE_L6_GEN_4_3)) + if (((mindiff_lm == MODE_L5_GEN_4_3) && (mode_preset->group == GROUP_288P)) || + ((mindiff_lm == MODE_L3_GEN_16_9) && ((mode_preset->group == GROUP_480P) || (mode_preset->group == GROUP_576P))) || + (mindiff_lm == MODE_L3_240x360) || (mindiff_lm >= MODE_L6_GEN_4_3)) vm_conf->tx_pixelrep = 1; sniprintf(vm_out->name, 11, "%s x%u", vm_in->name, vm_conf->y_rpt+1); diff --git a/software/sys_controller/ossc/video_modes.h b/software/sys_controller/ossc/video_modes.h index 14e736a..95c9a2a 100644 --- a/software/sys_controller/ossc/video_modes.h +++ b/software/sys_controller/ossc/video_modes.h @@ -108,7 +108,7 @@ typedef enum { } mode_flags; typedef enum { - VMODE_480p = 23, + VMODE_480p = 24, } vmode_t; typedef struct { diff --git a/software/sys_controller/ossc/video_modes_list.c b/software/sys_controller/ossc/video_modes_list.c index a036623..ebb5f86 100644 --- a/software/sys_controller/ossc/video_modes_list.c +++ b/software/sys_controller/ossc/video_modes_list.c @@ -54,6 +54,7 @@ const mode_data_t video_modes_plm_default[] = { { "640x384", HDMI_Unknown, { 640, 384, 5500, 800, 0, 492, 48, 63, 96, 2, 0}, DEF_PHASE, {{ 0, 0}}, VIDEO_PC, GROUP_384P, (MODE_PT | MODE_L2), }, /* ~525-line modes */ { "480i", HDMI_480i60, { 720, 240, 5994, 858, 0, 525, 57, 15, 62, 3, 1}, DEF_PHASE, {{ 0, 0}}, VIDEO_SDTV, GROUP_480I, (MODE_PT | MODE_L2 | MODE_L3_GEN_16_9 | MODE_L4_GEN_4_3), }, + { "1920x480", HDMI_Unknown, { 960, 480, 5994, 1287, 0, 525, 150, 30, 93, 6, 0}, DEF_PHASE, {{ 0, 0}}, VIDEO_EDTV, GROUP_480P, (MODE_L3_GEN_16_9), }, { "480p", HDMI_480p60, { 720, 480, 5994, 858, 0, 525, 60, 30, 62, 6, 0}, DEF_PHASE, {{ 0, 0}}, VIDEO_EDTV, GROUP_480P, (MODE_PT | MODE_L2), }, { "640x480_60", HDMI_640x480p60, { 640, 480, 6000, 800, 0, 525, 48, 33, 96, 2, 0}, DEF_PHASE, {{ 0, 0}}, VIDEO_PC, GROUP_480P, (MODE_PT | MODE_L2), }, /* 480p PSP in-game */ \ @@ -62,6 +63,7 @@ const mode_data_t video_modes_plm_default[] = { { "640x512", HDMI_Unknown, { 640, 512, 6000, 800, 0, 568, 48, 34, 96, 6, 0}, DEF_PHASE, {{ 0, 0}}, VIDEO_PC, GROUP_480P, (MODE_PT | MODE_L2), }, /* ~625-line modes */ { "576i", HDMI_576i50, { 720, 288, 5000, 864, 0, 625, 69, 19, 63, 3, 1}, DEF_PHASE, {{ 0, 0}}, VIDEO_SDTV, GROUP_576I, (MODE_PT | MODE_L2 | MODE_L3_GEN_16_9 | MODE_L4_GEN_4_3), }, + { "1920x480LB", HDMI_Unknown, { 960, 480, 5000, 1296, 0, 625, 162, 87, 96, 5, 0}, DEF_PHASE, {{ 0, 0}}, VIDEO_EDTV, GROUP_576P, (MODE_L3_GEN_16_9), }, { "576p", HDMI_576p50, { 720, 576, 5000, 864, 0, 625, 68, 39, 64, 5, 0}, DEF_PHASE, {{ 0, 0}}, VIDEO_EDTV, GROUP_576P, (MODE_PT | MODE_L2), }, { "800x600_60", HDMI_Unknown, { 800, 600, 6000, 1056, 0, 628, 88, 23, 128, 4, 0}, DEF_PHASE, {{ 0, 0}}, VIDEO_PC, GROUP_NONE, MODE_PT, }, /* CEA 720p modes */