From 70ab55c1fa134797c807ae76e3a53f0bc4ba25a8 Mon Sep 17 00:00:00 2001 From: marqs Date: Sun, 15 Apr 2018 23:41:26 +0300 Subject: [PATCH] fix optimized mode mask & position offsets --- rtl/scanconverter.v | 4 ++-- software/sys_controller/ossc/av_controller.c | 11 ++++++++--- software/sys_controller/tvp7002/video_modes.c | 4 ++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/rtl/scanconverter.v b/rtl/scanconverter.v index 00e04f1..d0c7734 100644 --- a/rtl/scanconverter.v +++ b/rtl/scanconverter.v @@ -669,7 +669,7 @@ begin R_out <= {8{lt_box_enable_pp[`PP_PIPELINE_LENGTH]}}; G_out <= {8{lt_box_enable_pp[`PP_PIPELINE_LENGTH]}}; B_out <= {8{lt_box_enable_pp[`PP_PIPELINE_LENGTH]}}; - end else if (border_enable_pp[`PP_PIPELINE_LENGTH-1]) begin + end else if (border_enable_pp[`PP_PIPELINE_LENGTH]) begin R_out <= {2{X_MASK_BR}}; G_out <= {2{X_MASK_BR}}; B_out <= {2{X_MASK_BR}}; @@ -947,7 +947,7 @@ begin vcnt_2x <= 0; line_out_idx_2x <= 0; end else begin - if ((pclk_1x == 1'b0) & (line_change | frame_change)) begin //aligned with posedge of pclk_1x + if ((pclk_1x == 1'b1) & (line_change | frame_change)) begin //aligned with negedge of pclk_1x hcnt_2x <= 0; hcnt_2x_opt <= H_OPT_SAMPLE_SEL; hcnt_2x_opt_ctr <= 0; diff --git a/software/sys_controller/ossc/av_controller.c b/software/sys_controller/ossc/av_controller.c index c35a702..cd277de 100644 --- a/software/sys_controller/ossc/av_controller.c +++ b/software/sys_controller/ossc/av_controller.c @@ -339,7 +339,7 @@ status_t get_status(tvp_input_t input, video_format format) tvp_set_sync_lpf(tc.sync_lpf); if (memcmp(&tc.col, &cm.cc.col, sizeof(color_setup_t))) - tvp_set_fine_gain_offset(&cm.cc.col); + tvp_set_fine_gain_offset(&tc.col); #ifdef ENABLE_AUDIO if ((tc.audio_dw_sampl != cm.cc.audio_dw_sampl) || @@ -443,15 +443,20 @@ void set_videoinfo() if (target_type == VIDEO_HDTV) h_synclen *= 2; + // 1920x* modes need short hsync + if (h_synclen > cm.hsync_cut) + h_synclen -= cm.hsync_cut; + else + h_synclen = 1; + h_border = (((cm.sample_mult-h_opt_scale)*video_modes[cm.id].h_active)/2); h_mask = h_border + h_opt_scale*cm.cc.h_mask; h_opt_startoffs = h_border + (cm.sample_mult-h_opt_scale)*(h_synclen+(alt_u16)video_modes[cm.id].h_backporch); - h_opt_startoffs = (h_opt_startoffs/cm.sample_mult)*cm.sample_mult; printf("h_border: %u, h_opt_startoffs: %u\n", h_border, h_opt_startoffs); IOWR_ALTERA_AVALON_PIO_DATA(PIO_3_BASE, (cm.fpga_hmultmode<<30) | ((cm.cc.l5_fmt!=L5FMT_1600x1200)<<29) | - ((((cm.sample_mult*h_synclen)-cm.hsync_cut)&0xff)<<20) | + (((cm.sample_mult*h_synclen)&0xff)<<20) | (((cm.sample_mult*(alt_u16)video_modes[cm.id].h_backporch)&0x1ff)<<11) | ((cm.sample_mult*video_modes[cm.id].h_active)&0x7ff)); IOWR_ALTERA_AVALON_PIO_DATA(PIO_4_BASE, (h_mask<<19) | diff --git a/software/sys_controller/tvp7002/video_modes.c b/software/sys_controller/tvp7002/video_modes.c index b4f0a7b..120c670 100644 --- a/software/sys_controller/tvp7002/video_modes.c +++ b/software/sys_controller/tvp7002/video_modes.c @@ -187,13 +187,13 @@ alt_8 get_mode_id(alt_u32 totlines, alt_u8 progressive, alt_u32 hz, video_type t cm.fpga_vmultmode = FPGA_V_MULTMODE_5X; cm.fpga_hmultmode = FPGA_H_MULTMODE_OPTIMIZED; cm.sample_mult = 5; - cm.hsync_cut = 120; + cm.hsync_cut = 24; break; case MODE_L5_256_COL: cm.fpga_vmultmode = FPGA_V_MULTMODE_5X; cm.fpga_hmultmode = FPGA_H_MULTMODE_OPTIMIZED; cm.sample_mult = 6; - cm.hsync_cut = 120; + cm.hsync_cut = 20; break; default: printf("WARNING: invalid target_lm\n");