From 8006cad1f20dbd7407bb30d8ba413ef503d2a6d0 Mon Sep 17 00:00:00 2001 From: marqs Date: Sun, 9 Feb 2020 20:21:53 +0200 Subject: [PATCH] Analog frontend updates * add Clamp/ALC offset option * add ALC V+H filter options * add Analog STC LPF option * update AV3 alternative RGB compatibility option --- software/sys_controller/ossc/av_controller.c | 16 ++++++++++++---- software/sys_controller/ossc/avconfig.c | 3 +++ software/sys_controller/ossc/avconfig.h | 10 ++++++++++ software/sys_controller/ossc/firmware.h | 4 ++-- software/sys_controller/ossc/menu.c | 11 ++++++++++- 5 files changed, 37 insertions(+), 7 deletions(-) diff --git a/software/sys_controller/ossc/av_controller.c b/software/sys_controller/ossc/av_controller.c index 56d3891..a0dcc89 100644 --- a/software/sys_controller/ossc/av_controller.c +++ b/software/sys_controller/ossc/av_controller.c @@ -356,7 +356,8 @@ status_t get_status(tvp_sync_input_t syncinput) (tc.tvp_hpll2x != cm.cc.tvp_hpll2x) || (tc.upsample2x != cm.cc.upsample2x) || (tc.vga_ilace_fix != cm.cc.vga_ilace_fix) || - (tc.default_vic != cm.cc.default_vic)) + (tc.default_vic != cm.cc.default_vic) || + (tc.clamp_offset != cm.cc.clamp_offset)) status = (status < MODE_CHANGE) ? MODE_CHANGE : status; if ((tc.s480p_mode != cm.cc.s480p_mode) && (video_modes[cm.id].v_total == 525)) @@ -420,6 +421,12 @@ status_t get_status(tvp_sync_input_t syncinput) if (tc.sync_lpf != cm.cc.sync_lpf) tvp_set_sync_lpf(tc.sync_lpf); + if (tc.stc_lpf != cm.cc.stc_lpf) + tvp_set_clp_lpf(tc.stc_lpf); + + if ((tc.alc_h_filter != cm.cc.alc_h_filter) || (tc.alc_v_filter != cm.cc.alc_v_filter)) + tvp_set_alcfilt(tc.alc_v_filter, tc.alc_h_filter); + if (memcmp(&tc.col, &cm.cc.col, sizeof(color_setup_t))) tvp_set_gain_offset(&tc.col); @@ -662,7 +669,8 @@ void program_mode() cm.h_mult_total, cm.clkcnt, cm.cc.tvp_hpll2x && (video_modes[cm.id].flags & MODE_PLLDIVBY2), - (alt_u8)h_synclen_px); + (alt_u8)h_synclen_px, + (alt_8)(cm.cc.clamp_offset-SIGNED_NUMVAL_ZERO)); set_lpf(cm.cc.video_lpf); set_csc(cm.cc.ypbpr_cs); cm.sample_sel = tvp_set_hpll_phase(video_modes[cm.id].sampler_phase, cm.sample_mult); @@ -1062,10 +1070,10 @@ int main() target_tvp_sync = TVP_SOG1; target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV; - if ((target_input <= AV1_YPBPR) || (tc.av3_alt_rgb && ((target_input == AV3_RGBHV) || (target_input == AV3_RGBs)))) { + if ((target_input <= AV1_YPBPR) || (tc.av3_alt_rgb==1 && ((target_input == AV3_RGBHV) || (target_input == AV3_RGBs)))) { target_ths = THS_INPUT_B; target_pcm = PCM_INPUT4; - } else if (target_input <= AV2_RGsB) { + } else if ((target_input <= AV2_RGsB) || (tc.av3_alt_rgb==2 && ((target_input == AV3_RGBHV) || (target_input == AV3_RGBs)))) { target_ths = THS_INPUT_A; target_pcm = PCM_INPUT3; } else { // if (target_input <= AV3_YPBPR) { diff --git a/software/sys_controller/ossc/avconfig.c b/software/sys_controller/ossc/avconfig.c index ed35eec..ad38c41 100644 --- a/software/sys_controller/ossc/avconfig.c +++ b/software/sys_controller/ossc/avconfig.c @@ -62,6 +62,9 @@ const avconfig_t tc_default = { .c_gain = DEFAULT_COARSE_GAIN, }, .link_av = AV_LAST, + .clamp_offset = SIGNED_NUMVAL_ZERO, + .alc_h_filter = DEFAULT_ALC_H_FILTER, + .alc_v_filter = DEFAULT_ALC_V_FILTER, }; int set_default_avconfig() diff --git a/software/sys_controller/ossc/avconfig.h b/software/sys_controller/ossc/avconfig.h index 10f1356..bcd702b 100644 --- a/software/sys_controller/ossc/avconfig.h +++ b/software/sys_controller/ossc/avconfig.h @@ -23,6 +23,8 @@ #include "alt_types.h" #include "tvp7002.h" +#define SIGNED_NUMVAL_ZERO 128 + #define SCANLINESTR_MAX 15 #define SL_HYBRIDSTR_MAX 28 #define H_MASK_MAX 255 @@ -37,6 +39,10 @@ #define PLL_COAST_MAX 5 #define REVERSE_LPF_MAX 31 #define COARSE_GAIN_MAX 15 +#define ALC_H_FILTER_MAX 7 +#define ALC_V_FILTER_MAX 10 +#define CLAMP_OFFSET_MIN (SIGNED_NUMVAL_ZERO-100) +#define CLAMP_OFFSET_MAX (SIGNED_NUMVAL_ZERO+100) #define SL_MODE_MAX 2 #define SL_TYPE_MAX 2 @@ -104,6 +110,7 @@ typedef struct { alt_u8 linelen_tol; alt_u8 vsync_thold; alt_u8 sync_lpf; + alt_u8 stc_lpf; alt_u8 video_lpf; alt_u8 pre_coast; alt_u8 post_coast; @@ -116,6 +123,9 @@ typedef struct { alt_u8 audio_swap_lr; alt_u8 audio_gain; alt_u8 default_vic; + alt_u8 clamp_offset; + alt_u8 alc_h_filter; + alt_u8 alc_v_filter; color_setup_t col; avinput_t link_av; } __attribute__((packed)) avconfig_t; diff --git a/software/sys_controller/ossc/firmware.h b/software/sys_controller/ossc/firmware.h index 06d0061..95fb66a 100644 --- a/software/sys_controller/ossc/firmware.h +++ b/software/sys_controller/ossc/firmware.h @@ -24,10 +24,10 @@ #include "sysconfig.h" #define FW_VER_MAJOR 0 -#define FW_VER_MINOR 85 +#define FW_VER_MINOR 86 #define PROFILE_VER_MAJOR 0 -#define PROFILE_VER_MINOR 85 +#define PROFILE_VER_MINOR 86 #define INITCFG_VER_MAJOR 0 #define INITCFG_VER_MINOR 85 diff --git a/software/sys_controller/ossc/menu.c b/software/sys_controller/ossc/menu.c index eb4d5a1..0bf272c 100644 --- a/software/sys_controller/ossc/menu.c +++ b/software/sys_controller/ossc/menu.c @@ -58,6 +58,7 @@ static const char *ypbpr_cs_desc[] = { "Rec. 601", "Rec. 709", "Auto" }; static const char *s480p_mode_desc[] = { LNG("Auto","オート"), "DTV 480p", "VESA 640x480@60" }; static const char *s400p_mode_desc[] = { "VGA 640x400@70", "VGA 720x400@70" }; static const char *sync_lpf_desc[] = { LNG("2.5MHz (max)","2.5MHz (サイダイ)"), LNG("10MHz (med)","10MHz (チュウイ)"), LNG("33MHz (min)","33MHz (サイショウ)"), LNG("Off","オフ") }; +static const char *stc_lpf_desc[] = { "4.8MHz (HDTV/PC)", "0.5MHz (SDTV)", "1.7MHz (EDTV)" }; static const char *l3_mode_desc[] = { LNG("Generic 16:9","ジェネリック 16:9"), LNG("Generic 4:3","ジェネリック 4:3"), LNG("512x240 optim.","512x240 サイテキカ."), LNG("384x240 optim.","384x240 サイテキカ."), LNG("320x240 optim.","320x240 サイテキカ."), LNG("256x240 optim.","256x240 サイテキカ.") }; static const char *l2l4l5_mode_desc[] = { LNG("Generic 4:3","ジェネリック 4:3"), LNG("512x240 optim.","512x240 サイテキカ."), LNG("384x240 optim.","384x240 サイテキカ."), LNG("320x240 optim.","320x240 サイテキカ."), LNG("256x240 optim.","256x240 サイテキカ.") }; static const char *l5_fmt_desc[] = { "1920x1080", "1600x1200", "1920x1200" }; @@ -79,6 +80,7 @@ static const char *osd_status_desc[] = { "2s", "5s", "10s", "Off" }; static const char *rgsb_ypbpr_desc[] = { "RGsB", "YPbPr" }; 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 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)); } @@ -89,11 +91,14 @@ static void sl_hybr_str_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, "%u static void lines_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, LNG("%u lines","%u ライン"), v); } static void pixels_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, LNG("%u pixels","%u ドット"), v); } static void value_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, " %u", v); } +static void signed_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, " %d", (alt_8)(v-SIGNED_NUMVAL_ZERO)); } static void lt_disp(alt_u8 v) { strncpy(menu_row2, lt_desc[v], LCD_ROW_LEN+1); } static void aud_db_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, "%d dB", ((alt_8)v-AUDIO_GAIN_0DB)); } static void vm_display_name (alt_u8 v) { strncpy(menu_row2, video_modes[v].name, LCD_ROW_LEN+1); } static void link_av_desc (avinput_t v) { strncpy(menu_row2, v == AV_LAST ? "No link" : avinput_str[v], LCD_ROW_LEN+1); } static void profile_disp(alt_u8 v) { read_userdata(v, 1); sniprintf(menu_row2, LCD_ROW_LEN+1, "%u: %s", v, (target_profile_name[0] == 0) ? "" : target_profile_name); } +static void alc_v_filter_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, LNG("%u lines","%u ライン"), (1<