Skip to content

Commit

Permalink
Add PSP sampling preset
Browse files Browse the repository at this point in the history
  • Loading branch information
marqs committed Mar 22, 2024
1 parent 22b45fc commit 17d48ec
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions software/sys_controller/inc/video_modes.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ typedef enum {
SM_OPT_N64_640COL,
SM_OPT_NG_320COL,
SM_OPT_GBI_240COL,
SM_OPT_PSP_480COL,
SM_OPT_PC98_640COL,
SM_OPT_DC_640COL,
SM_OPT_PS2_512COL,
Expand Down
4 changes: 2 additions & 2 deletions software/sys_controller/src/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static const char *pm_ad_1080p_desc[] = { "1920x1080 (Passthru)", "1920x1080i (L
static const char *sm_ad_240p_288p_desc[] = { "Generic 4:3", "SNES 256col", "SNES 512col", "MD 256col", "MD 320col", "PSX 256col", "PSX 320col", "PSX 384col", "PSX 512col", "PSX 640col", "SAT 320col", "SAT 352col", "SAT 640col", "SAT 704col", "N64 320col", "N64 640col", "Neo Geo 320col", "X68k 512col", "C64 4XXcol" };
static const char *sm_ad_384p_desc[] = { "Generic 4:3", "VGA 640x350", "VGA 720x350", "VGA 640x400", "VGA 720x400", "GBI 240x360", "PC98 640x400" };
static const char *sm_ad_480i_576i_desc[] = { "Generic 4:3", "Generic 16:9", "DTV 480i/576i 4:3", "DTV 480i/576i 16:9", "SNES 512col", "MD 320col", "PSX 512col", "PSX 640col", "SAT 640col", "SAT 704col", "N64 640col", "DC/PS2/GC 640col" };
static const char *sm_ad_480p_desc[] = { "Generic 4:3", "Generic 16:9", "DTV 480p 4:3", "DTV 480p 16:9", "VESA 640x480", "DC/PS2/GC 640col", "PS2-GSM 512col", "X68k 512col", "X68k 768col" };
static const char *sm_ad_480p_desc[] = { "Generic 4:3", "Generic 16:9", "DTV 480p 4:3", "DTV 480p 16:9", "VESA 640x480", "DC/PS2/GC 640col", "PS2-GSM 512col", "PSP 480x272", "X68k 512col", "X68k 768col" };
static const char *sm_ad_576p_desc[] = { "Generic 4:3", "Generic 16:9", "DTV 576p 4:3", "DTV 576p 16:9" };
static const char *lm_deint_mode_desc[] = { "Bob", "Noninterlace restore" };
static const char *ar_256col_desc[] = { "Pseudo 4:3 DAR", "1:1 PAR" };
Expand Down Expand Up @@ -145,7 +145,7 @@ static const char *scl_dil_alg_desc[] = { "Bob", "Weave", "Motion adaptive" };
static const char *sm_scl_240p_288p_desc[] = { "Generic", "SNES 256col", "SNES 512col", "MD 256col", "MD 320col", "PSX 256col", "PSX 320col", "PSX 384col", "PSX 512col", "PSX 640col", "SAT 320col", "SAT 352col", "SAT 640col", "SAT 704col", "N64 320col", "N64 640col", "Neo Geo 320col", "X68k 512col", "C64 4XXcol" };
static const char *sm_scl_384p_desc[] = { "Generic", "VGA 640x350", "VGA 720x350", "VGA 640x400", "VGA 720x400", "GBI 240x360", "PC98 640x400" };
static const char *sm_scl_480i_576i_desc[] = { "Generic", "DTV 480i/576i", "SNES 512col", "MD 320col", "PSX 512col", "PSX 640col", "SAT 640col", "SAT 704col", "N64 640col", "DC/PS2/GC 640col" };
static const char *sm_scl_480p_desc[] = { "Generic", "DTV 480p", "VESA 640x480", "DC/PS2/GC 640col", "PS2-GSM 512col", "X68k 512col", "X68k 768col" };
static const char *sm_scl_480p_desc[] = { "Generic", "DTV 480p", "VESA 640x480", "DC/PS2/GC 640col", "PS2-GSM 512col", "PSP 480x272", "X68k 512col", "X68k 768col" };
static const char *sm_scl_576p_desc[] = { "Generic", "DTV 576p", "GC 640col" };
static const char *timing_1080p120_desc[] = { "CVT-RB", "Min. blank", "CEA-861", "CEA-861 PR2x" };
static const char *timing_2160p60_desc[] = { "CVT-RB PR2x", "Min. blank PR2x" };
Expand Down
4 changes: 2 additions & 2 deletions software/sys_controller/src/userdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const ude_item_map ude_profile_items[] = {
UDE_ITEM(34, 67, tc.sm_ad_240p_288p),
UDE_ITEM(35, 58, tc.sm_ad_384p),
UDE_ITEM(36, 58, tc.sm_ad_480i_576i),
UDE_ITEM(37, 58, tc.sm_ad_480p),
UDE_ITEM(37, 74, tc.sm_ad_480p),
UDE_ITEM(38, 58, tc.sm_ad_576p),
UDE_ITEM(39, 58, tc.lm_mode),
UDE_ITEM(40, 58, tc.oper_mode),
Expand Down Expand Up @@ -138,7 +138,7 @@ const ude_item_map ude_profile_items[] = {
UDE_ITEM(69, 67, tc.sm_scl_240p_288p),
UDE_ITEM(70, 58, tc.sm_scl_384p),
UDE_ITEM(71, 58, tc.sm_scl_480i_576i),
UDE_ITEM(72, 60, tc.sm_scl_480p),
UDE_ITEM(72, 74, tc.sm_scl_480p),
UDE_ITEM(73, 74, tc.sm_scl_576p),
#endif
#ifdef INC_THS7353
Expand Down
12 changes: 10 additions & 2 deletions software/sys_controller/src/video_modes.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ int get_scaler_mode(avconfig_t *cc, mode_data_t *vm_in, mode_data_t *vm_out, vm_
SM_OPT_SAT_640COL, SM_OPT_SAT_704COL,
SM_OPT_N64_640COL,
SM_OPT_DC_640COL};
const smp_mode_t sm_480p_map[] = {SM_GEN_4_3, SM_OPT_DTV480P, SM_OPT_VESA_640x480, SM_OPT_DC_640COL, SM_OPT_PS2_512COL, SM_OPT_X68K_512COL, SM_OPT_X68K_768COL};
const smp_mode_t sm_480p_map[] = {SM_GEN_4_3, SM_OPT_DTV480P, SM_OPT_VESA_640x480, SM_OPT_DC_640COL, SM_OPT_PS2_512COL, SM_OPT_PSP_480COL, SM_OPT_X68K_512COL, SM_OPT_X68K_768COL};
const smp_mode_t sm_576p_map[] = {SM_GEN_4_3, SM_OPT_DTV576P, SM_OPT_DC_640COL};

unsigned aspect_map[][2] = {{4, 3},
Expand Down Expand Up @@ -609,7 +609,7 @@ int get_adaptive_lm_mode(avconfig_t *cc, mode_data_t *vm_in, mode_data_t *vm_out
SM_OPT_SAT_640COL, SM_OPT_SAT_704COL,
SM_OPT_N64_640COL,
SM_OPT_DC_640COL};
const smp_mode_t sm_480p_map[] = {SM_GEN_4_3, SM_GEN_16_9, SM_OPT_DTV480P, SM_OPT_DTV480P_WS, SM_OPT_VESA_640x480, SM_OPT_DC_640COL, SM_OPT_PS2_512COL, SM_OPT_X68K_512COL, SM_OPT_X68K_768COL};
const smp_mode_t sm_480p_map[] = {SM_GEN_4_3, SM_GEN_16_9, SM_OPT_DTV480P, SM_OPT_DTV480P_WS, SM_OPT_VESA_640x480, SM_OPT_DC_640COL, SM_OPT_PS2_512COL, SM_OPT_PSP_480COL, SM_OPT_X68K_512COL, SM_OPT_X68K_768COL};
const smp_mode_t sm_576p_map[] = {SM_GEN_4_3, SM_GEN_16_9, SM_OPT_DTV576P, SM_OPT_DTV576P_WS};

ad_mode_t ad_mode_list[] = { {-1, 0}, // GROUP_NONE
Expand Down Expand Up @@ -676,6 +676,10 @@ int get_adaptive_lm_mode(avconfig_t *cc, mode_data_t *vm_in, mode_data_t *vm_out
vm_conf->x_rpt = 0;
vm_conf->y_rpt = ad_mode_list[vm_in->group].y_rpt;

// Double existing vertical multiply for PSP
if (target_sm_list[vm_in->group] == SM_OPT_PSP_480COL)
vm_conf->y_rpt = 2*(vm_conf->y_rpt+1)-1;

// Calculate x_rpt for optimal modes based on output mode, sampling preset and y_rpt
switch (ad_mode_list[vm_in->group].stdmode_id) {
case STDMODE_240p_CRT:
Expand Down Expand Up @@ -744,6 +748,8 @@ int get_adaptive_lm_mode(avconfig_t *cc, mode_data_t *vm_in, mode_data_t *vm_out
vm_conf->x_rpt++;
else if (target_sm_list[vm_in->group] == SM_OPT_GBI_240COL)
vm_conf->x_rpt = 5;
else if (target_sm_list[vm_in->group] == SM_OPT_PSP_480COL)
vm_conf->x_rpt = 3;
break;
case STDMODE_1920x1440_50:
case STDMODE_1920x1440_60:
Expand All @@ -766,6 +772,8 @@ int get_adaptive_lm_mode(avconfig_t *cc, mode_data_t *vm_in, mode_data_t *vm_out
vm_conf->x_rpt++;
else if (target_sm_list[vm_in->group] == SM_OPT_GBI_240COL)
vm_conf->x_rpt = 7;
else if (target_sm_list[vm_in->group] == SM_OPT_PSP_480COL)
vm_conf->x_rpt = 4;
break;
default:
break;
Expand Down
2 changes: 2 additions & 0 deletions software/sys_controller/src/video_modes_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ const smp_preset_t smp_presets_default[] = {
{ "NeoGeo 320x224", SM_OPT_NG_320COL, { 320, 224, 0, 384, 0, 264, 28, 21, 29, 3, 0}, 1, 0, { 4, 3}, VIDEO_SDTV, GROUP_240P },
/* GBI */
{ "GBI 240x360", SM_OPT_GBI_240COL, { 240, 360, 0, 300, 0, 375, 32, 10, 18, 3, 0}, 1, 0, { 4, 3}, VIDEO_EDTV, GROUP_384P },
/* PSP */
{ "PSP 480x272", SM_OPT_PSP_480COL, { 480, 272, 0, 858, 0, 525, 177,134, 62, 6, 0}, 0, 0, {16, 9}, VIDEO_EDTV, GROUP_480P },
/* DC/PS2/GC 640col AR-correct modes */
{ "DC 640x480i", SM_OPT_DC_640COL, { 640, 240, 0, 858, 0, 525, 95, 15, 62, 3, 1}, 0, 0, {56, 45}, VIDEO_SDTV, GROUP_480I },
{ "DC 640x480", SM_OPT_DC_640COL, { 640, 480, 0, 858, 0, 525, 95, 30, 62, 6, 0}, 0, 0, {56, 45}, VIDEO_EDTV, GROUP_480P },
Expand Down

0 comments on commit 17d48ec

Please sign in to comment.