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
This commit is contained in:
marqs 2020-02-09 20:21:53 +02:00
parent aa1e9eb60c
commit 8006cad1f2
5 changed files with 37 additions and 7 deletions

View File

@ -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) {

View File

@ -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()

View File

@ -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;

View File

@ -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

View File

@ -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) ? "<empty>" : target_profile_name); }
static void alc_v_filter_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, LNG("%u lines","%u ライン"), (1<<v)); }
static void alc_h_filter_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, LNG("%u pixels","%u ドット"), (1<<(v+1))); }
//static void coarse_gain_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, "%u.%u", ((v*10)+50)/100, (((v*10)+50)%100)/10); }
static const arg_info_t vm_arg_info = {&vm_sel, VIDEO_MODES_CNT-1, vm_display_name};
@ -138,6 +143,9 @@ MENU(menu_vinputproc, P99_PROTECT({ \
{ LNG("G/Y gain","G/Y ゲイン"), OPT_AVCONFIG_NUMVALUE, { .num = { &tc.col.g_f_gain, OPT_NOWRAP, 0, 0xFF, value_disp } } },
{ LNG("B/Pb gain","B/Pb ゲイン"), OPT_AVCONFIG_NUMVALUE, { .num = { &tc.col.b_f_gain, OPT_NOWRAP, 0, 0xFF, value_disp } } },
{ LNG("Pre-ADC Gain","Pre-ADC Gain"), OPT_AVCONFIG_NUMVALUE, { .num = { &tc.col.c_gain, OPT_NOWRAP, 0, COARSE_GAIN_MAX, value_disp } } },
{ "Clamp/ALC offset", OPT_AVCONFIG_NUMVALUE, { .num = { &tc.clamp_offset, OPT_NOWRAP, CLAMP_OFFSET_MIN, CLAMP_OFFSET_MAX, signed_disp } } },
{ "ALC V filter", OPT_AVCONFIG_NUMVALUE, { .num = { &tc.alc_v_filter, OPT_NOWRAP, 0, ALC_V_FILTER_MAX, alc_v_filter_disp } } },
{ "ALC H filter", OPT_AVCONFIG_NUMVALUE, { .num = { &tc.alc_h_filter, OPT_NOWRAP, 0, ALC_H_FILTER_MAX, alc_h_filter_disp } } },
}))
MENU(menu_sampling, P99_PROTECT({ \
@ -150,6 +158,7 @@ MENU(menu_sampling, P99_PROTECT({ \
MENU(menu_sync, P99_PROTECT({ \
{ LNG("Analog sync LPF","アナログドウキ LPF"), OPT_AVCONFIG_SELECTION, { .sel = { &tc.sync_lpf, OPT_WRAP, SETTING_ITEM(sync_lpf_desc) } } },
{ "Analog STC LPF", OPT_AVCONFIG_SELECTION, { .sel = { &tc.stc_lpf, OPT_WRAP, SETTING_ITEM(stc_lpf_desc) } } },
{ LNG("Analog sync Vth","アナログドウキ Vth"), OPT_AVCONFIG_NUMVALUE, { .num = { &tc.sync_vth, OPT_NOWRAP, 0, SYNC_VTH_MAX, sync_vth_disp } } },
{ LNG("Hsync tolerance","Hsyncコウサ"), OPT_AVCONFIG_NUMVALUE, { .num = { &tc.linelen_tol, OPT_NOWRAP, 0, 0xFF, intclks_to_time_disp } } },
{ LNG("Vsync threshold","Vsyncシキイチ"), OPT_AVCONFIG_NUMVALUE, { .num = { &tc.vsync_thold, OPT_NOWRAP, VSYNC_THOLD_MIN, VSYNC_THOLD_MAX, intclks_to_time_disp } } },
@ -197,7 +206,7 @@ MENU(menu_postproc, P99_PROTECT({ \
MENU(menu_compatibility, P99_PROTECT({ \
{ LNG("Full TX setup","フルTXセットアップ"), OPT_AVCONFIG_SELECTION, { .sel = { &tc.full_tx_setup, OPT_WRAP, SETTING_ITEM(off_on_desc) } } },
{ LNG("AV3 interlacefix","AV3インターレースシュウセイ"), OPT_AVCONFIG_SELECTION, { .sel = { &tc.vga_ilace_fix, OPT_WRAP, SETTING_ITEM(off_on_desc) } } },
{ "AV3 use AV1 RGB", OPT_AVCONFIG_SELECTION, { .sel = { &tc.av3_alt_rgb, OPT_WRAP, SETTING_ITEM(off_on_desc) } } },
{ "AV3 use alt. RGB", OPT_AVCONFIG_SELECTION, { .sel = { &tc.av3_alt_rgb, OPT_WRAP, SETTING_ITEM(av3_alt_rgb_desc) } } },
{ "Default HDMI VIC", OPT_AVCONFIG_NUMVALUE, { .num = { &tc.default_vic, OPT_NOWRAP, 0, HDMI_1080p50, value_disp } } },
{ "Panasonic hack", OPT_AVCONFIG_SELECTION, { .sel = { &tc.panasonic_hack, OPT_WRAP, SETTING_ITEM(off_on_desc) } } },
}))