1
0
mirror of https://github.com/marqs85/ossc.git synced 2024-06-20 03:29:35 +00:00

misc fixes

* fix phase adjustment
* fix HDMI AVI infoframe checksum calculation
* reduce passthru OSD size
This commit is contained in:
marqs 2023-10-08 00:31:43 +03:00
parent c0dae3da36
commit edb300e03a
9 changed files with 8492 additions and 8541 deletions

View File

@ -3326,7 +3326,7 @@ SetAVIInfoFrame(AVI_InfoFrame *pAVIInfoFrame)
Switch_HDMITX_Bank(1) ; Switch_HDMITX_Bank(1) ;
for(i = 0,ucData = 0; i < AVI_INFOFRAME_LEN ; i++) for(i = 0,ucData = 0; i < AVI_INFOFRAME_LEN ; i++)
{ {
HDMITX_WriteI2C_Byte(REG_TX_AVIINFO_DB1+i,pAVIInfoFrame->pktbyte.AVI_DB[i]); HDMITX_WriteI2C_Byte(REG_TX_AVIINFO_DB1+i+(i>=5),pAVIInfoFrame->pktbyte.AVI_DB[i]);
ucData -= pAVIInfoFrame->pktbyte.AVI_DB[i] ; ucData -= pAVIInfoFrame->pktbyte.AVI_DB[i] ;
} }
ErrorF("SetAVIInfo(): ") ; ErrorF("SetAVIInfo(): ") ;

View File

@ -326,8 +326,8 @@ typedef union _HDR_InfoFrame {
BYTE Ver ; BYTE Ver ;
BYTE Len ; BYTE Len ;
BYTE TF ; // vendor name character in 7bit ascii characters BYTE TF ;
BYTE DESC_ID ; // product description character in 7bit ascii characters BYTE DESC_ID ;
BYTE DESC[24] ; BYTE DESC[24] ;
} info ; } info ;
struct { struct {

File diff suppressed because it is too large Load Diff

View File

@ -184,7 +184,9 @@ inline void TX_enable(tx_mode_t mode)
if (mode != TX_DVI) { if (mode != TX_DVI) {
HDMITX_SetAVIInfoFrame(vmode_out.vic, (mode == TX_HDMI_RGB) ? F_MODE_RGB444 : F_MODE_YUV444, 0, 0, tc.hdmi_itc, vm_conf.hdmitx_pixr_ifr); HDMITX_SetAVIInfoFrame(vmode_out.vic, (mode == TX_HDMI_RGB) ? F_MODE_RGB444 : F_MODE_YUV444, 0, 0, tc.hdmi_itc, vm_conf.hdmitx_pixr_ifr);
HDMITX_SetHDRInfoFrame(tc.hdmi_hdr ? 3 : 0);
cm.cc.hdmi_itc = tc.hdmi_itc; cm.cc.hdmi_itc = tc.hdmi_itc;
cm.cc.hdmi_hdr = tc.hdmi_hdr;
} }
#ifdef ENABLE_AUDIO #ifdef ENABLE_AUDIO
@ -287,27 +289,6 @@ inline int check_linecnt(alt_u8 progressive, alt_u32 totlines) {
return (totlines >= MIN_LINES_INTERLACED); return (totlines >= MIN_LINES_INTERLACED);
} }
void set_sampler_phase(uint8_t sampler_phase) {
uint32_t sample_rng_x1000;
uint8_t tvp_phase;
vmode_in.sampler_phase = sampler_phase;
if (vm_conf.h_skip == 0) {
vm_conf.h_sample_sel = 0;
tvp_phase = sampler_phase;
} else {
sample_rng_x1000 = 360000 / (vm_conf.h_skip+1);
vm_conf.h_sample_sel = (sampler_phase*11250)/sample_rng_x1000;
tvp_phase = ((((sampler_phase*11250) % sample_rng_x1000)*32)/sample_rng_x1000);
}
if (vm_conf.h_skip > 0)
printf("Sample sel: %u/%u\n", (vm_conf.h_sample_sel+1), (vm_conf.h_skip+1));
tvp_set_hpll_phase(tvp_phase);
}
// Check if input video status / target configuration has changed // Check if input video status / target configuration has changed
status_t get_status(tvp_sync_input_t syncinput) status_t get_status(tvp_sync_input_t syncinput)
{ {
@ -636,7 +617,7 @@ void program_mode()
set_lpf(cm.cc.video_lpf); set_lpf(cm.cc.video_lpf);
set_csc(cm.cc.ypbpr_cs); set_csc(cm.cc.ypbpr_cs);
set_sampler_phase(video_modes_plm[cm.id].sampler_phase); set_sampler_phase(video_modes_plm[cm.id].sampler_phase, 0);
pll_reconfig->pll_config_status.reset = (vm_conf.si_pclk_mult <= 1); pll_reconfig->pll_config_status.reset = (vm_conf.si_pclk_mult <= 1);
@ -651,7 +632,7 @@ void program_mode()
} }
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl); IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl);
update_osd_size(&vmode_out, &vm_conf); update_osd_size(&vmode_out);
update_sc_config(&vmode_in, &vmode_out, &vm_conf, &cm.cc); update_sc_config(&vmode_in, &vmode_out, &vm_conf, &cm.cc);
@ -680,6 +661,30 @@ void program_mode()
} }
} }
void set_sampler_phase(uint8_t sampler_phase, uint8_t update_sc) {
uint32_t sample_rng_x1000;
uint8_t tvp_phase;
vmode_in.sampler_phase = sampler_phase;
if (vm_conf.h_skip == 0) {
vm_conf.h_sample_sel = 0;
tvp_phase = sampler_phase;
} else {
sample_rng_x1000 = 360000 / (vm_conf.h_skip+1);
vm_conf.h_sample_sel = (sampler_phase*11250)/sample_rng_x1000;
tvp_phase = ((((sampler_phase*11250) % sample_rng_x1000)*32)/sample_rng_x1000);
}
if (vm_conf.h_skip > 0)
printf("Sample sel: %u/%u\n", (vm_conf.h_sample_sel+1), (vm_conf.h_skip+1));
tvp_set_hpll_phase(tvp_phase);
if (update_sc)
update_sc_config(&vmode_in, &vmode_out, &vm_conf, &cm.cc);
}
int load_profile() { int load_profile() {
int retval; int retval;

View File

@ -92,7 +92,7 @@ typedef struct {
void ui_disp_menu(alt_u8 osd_mode); void ui_disp_menu(alt_u8 osd_mode);
void ui_disp_status(alt_u8 refresh_osd_timer); void ui_disp_status(alt_u8 refresh_osd_timer);
void set_sampler_phase(uint8_t sampler_phase); void set_sampler_phase(uint8_t sampler_phase, uint8_t update_sc);
int load_profile(); int load_profile();
int save_profile(); int save_profile();

View File

@ -123,7 +123,7 @@ int parse_control()
// one for each video_group // 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* 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, 0x1f, 0x1f, 0x7, 0xf, 0xf, 0x3, 0x3, 0x1, 0x3, 0x1 }; alt_u8 valid_pm[] = { 0x1, 0x3f, 0x3f, 0x7, 0xf, 0xf, 0x3, 0x3, 0x1, 0x3, 0x1 };
avinput_t next_input = (cm.avinput == AV3_YPBPR) ? AV1_RGBs : (cm.avinput+1); avinput_t next_input = (cm.avinput == AV3_YPBPR) ? AV1_RGBs : (cm.avinput+1);
@ -216,7 +216,7 @@ int parse_control()
break; break;
case RC_LM_MODE: case RC_LM_MODE:
strncpy(menu_row1, "Linemult mode:", LCD_ROW_LEN+1); strncpy(menu_row1, "Linemult mode:", LCD_ROW_LEN+1);
strncpy(menu_row2, "press 1-5", LCD_ROW_LEN+1); strncpy(menu_row2, "press 1-6", LCD_ROW_LEN+1);
osd->osd_config.menu_active = 1; osd->osd_config.menu_active = 1;
ui_disp_menu(1); ui_disp_menu(1);
@ -232,7 +232,7 @@ int parse_control()
break; break;
} }
if (i <= RC_BTN5) { if (i <= RC_BTN6) {
if ((1<<i) & valid_pm[video_modes_plm[cm.id].group]) { if ((1<<i) & valid_pm[video_modes_plm[cm.id].group]) {
*pmcfg_ptr[video_modes_plm[cm.id].group] = i; *pmcfg_ptr[video_modes_plm[cm.id].group] = i;
} else { } else {
@ -262,7 +262,7 @@ int parse_control()
if (cm.id == vm_edit) if (cm.id == vm_edit)
tc_sampler_phase = video_modes_plm[cm.id].sampler_phase; tc_sampler_phase = video_modes_plm[cm.id].sampler_phase;
set_sampler_phase(video_modes_plm[cm.id].sampler_phase); set_sampler_phase(video_modes_plm[cm.id].sampler_phase, 1);
if (!menu_active) { if (!menu_active) {
strncpy((char*)osd->osd_array.data[0][0], menu_advtiming.items[8].name, OSD_CHAR_COLS); strncpy((char*)osd->osd_array.data[0][0], menu_advtiming.items[8].name, OSD_CHAR_COLS);

View File

@ -24,7 +24,7 @@
#include "sysconfig.h" #include "sysconfig.h"
#define FW_VER_MAJOR 1 #define FW_VER_MAJOR 1
#define FW_VER_MINOR 06 #define FW_VER_MINOR 07
#define PROFILE_VER_MAJOR 1 #define PROFILE_VER_MAJOR 1
#define PROFILE_VER_MINOR 06 #define PROFILE_VER_MINOR 06

View File

@ -475,23 +475,18 @@ void display_menu(alt_u8 forcedisp)
ui_disp_menu(0); ui_disp_menu(0);
} }
void update_osd_size(mode_data_t *vm_out, vm_proc_config_t *vm_conf) { void update_osd_size(mode_data_t *vm_out) {
uint8_t osd_size = vm_out->timings.v_active / 700; uint8_t osd_size = vm_out->timings.v_active / 700;
uint8_t par = (((100*vm_out->timings.h_active*vm_out->ar.v)/((vm_out->timings.v_active<<vm_out->timings.interlaced)*vm_out->ar.h))+50)/100; uint8_t par_x4 = (((400*vm_out->timings.h_active*vm_out->ar.v)/((vm_out->timings.v_active<<vm_out->timings.interlaced)*vm_out->ar.h))+50)/100;
uint8_t par_log2 = 0; int8_t xadj_log2 = -2;
while (par > 1) { while (par_x4 > 1) {
par >>= 1; par_x4 >>= 1;
par_log2++; xadj_log2++;
} }
osd->osd_config.x_size = osd_size + vm_out->timings.interlaced + par_log2; osd->osd_config.x_size = ((osd_size + vm_out->timings.interlaced + xadj_log2) >= 0) ? (osd_size + vm_out->timings.interlaced + xadj_log2) : 0;
osd->osd_config.y_size = osd_size; osd->osd_config.y_size = osd_size;
if (vm_conf->hdmitx_pixr_ifr)
osd->osd_config.x_size += (vm_conf->hdmitx_pixr_ifr+1)/2;
if (vm_conf->tx_pixelrep)
osd->osd_config.x_size -= (vm_conf->tx_pixelrep+1)/2;
} }
static void vm_select() { static void vm_select() {
@ -525,7 +520,7 @@ static void vm_tweak(uint16_t *v) {
(video_modes_plm[cm.id].mask.v != tc_v_mask)) (video_modes_plm[cm.id].mask.v != tc_v_mask))
update_cur_vm = 1; update_cur_vm = 1;
if (video_modes_plm[cm.id].sampler_phase != tc_sampler_phase) if (video_modes_plm[cm.id].sampler_phase != tc_sampler_phase)
set_sampler_phase(tc_sampler_phase); set_sampler_phase(tc_sampler_phase, 1);
} }
video_modes_plm[vm_edit].timings.h_total = tc_h_samplerate; video_modes_plm[vm_edit].timings.h_total = tc_h_samplerate;
video_modes_plm[vm_edit].timings.h_total_adj = (uint8_t)tc_h_samplerate_adj; video_modes_plm[vm_edit].timings.h_total_adj = (uint8_t)tc_h_samplerate_adj;

View File

@ -127,7 +127,7 @@ void init_menu();
void render_osd_page(); void render_osd_page();
void display_menu(alt_u8 forcedisp); void display_menu(alt_u8 forcedisp);
void sampler_phase_disp(alt_u8 v); void sampler_phase_disp(alt_u8 v);
void update_osd_size(mode_data_t *vm_out, vm_proc_config_t *vm_conf); void update_osd_size(mode_data_t *vm_out);
static void vm_select(); static void vm_select();
static void vm_tweak(alt_u16 *v); static void vm_tweak(alt_u16 *v);