mirror of
https://github.com/marqs85/ossc.git
synced 2024-12-29 09:32:45 +00:00
Merge branch 'scanline_contrast' of https://github.com/paulb-nl/ossc into upstream
# Conflicts: # rtl/scanconverter.v # software/sys_controller/ossc/av_controller.c
This commit is contained in:
commit
1a405c1e2e
2
ossc.qsf
2
ossc.qsf
@ -225,7 +225,7 @@ set_global_assignment -name USE_SIGNALTAP_FILE output_files/ossc_la.stp
|
||||
|
||||
|
||||
set_global_assignment -name FITTER_EFFORT "AUTO FIT"
|
||||
set_global_assignment -name SEED 2
|
||||
set_global_assignment -name SEED 5
|
||||
|
||||
|
||||
|
||||
|
@ -42,6 +42,9 @@
|
||||
`define SCANLINES_V 2'h2
|
||||
`define SCANLINES_ALT 2'h3
|
||||
|
||||
`define SCANLINES_CONTRAST_LOW 2'h1
|
||||
`define SCANLINES_CONTRAST_HIGH 2'h2
|
||||
|
||||
`define VSYNCGEN_LEN 6
|
||||
`define VSYNCGEN_GENMID_BIT 0
|
||||
`define VSYNCGEN_CHOPMID_BIT 1
|
||||
@ -100,6 +103,8 @@ reg [7:0] R_in_L, G_in_L, B_in_L, R_in_LL, G_in_LL, B_in_LL, R_1x, G_1x, B_1x;
|
||||
reg [7:0] R_pp3, G_pp3, B_pp3, R_pp4, G_pp4, B_pp4, R_pp5, G_pp5, B_pp5, R_pp6, G_pp6, B_pp6, R_pp7, G_pp7, B_pp7;
|
||||
reg [7:0] R_prev_pp2, G_prev_pp2, B_prev_pp2, R_prev_pp3, G_prev_pp3, B_prev_pp3, R_prev_pp4, G_prev_pp4, B_prev_pp4;
|
||||
reg signed [14:0] R_diff_pp3, G_diff_pp3, B_diff_pp3, R_diff_pp4, G_diff_pp4, B_diff_pp4;
|
||||
reg [7:0] R_sl_contrast_pp4, G_sl_contrast_pp4, B_sl_contrast_pp4, R_scanline_str_pp5, G_scanline_str_pp5, B_scanline_str_pp5;
|
||||
|
||||
|
||||
//H+V syncs + data enable signals®isters
|
||||
wire HSYNC_act, VSYNC_act, DE_act;
|
||||
@ -165,8 +170,10 @@ reg X_SCANLINESTR_METHOD;
|
||||
reg [7:0] X_SCANLINESTR_SUB;
|
||||
reg [3:0] X_SCANLINESTR_MULT;
|
||||
reg [5:0] X_REV_LPF_STR;
|
||||
reg [1:0] H_SL_CONTRAST;
|
||||
reg X_REV_LPF_ENABLE;
|
||||
|
||||
|
||||
//clk27 related registers
|
||||
reg VSYNC_in_cc_L, VSYNC_in_cc_LL, VSYNC_in_cc_LLL;
|
||||
reg [21:0] clk27_ctr; // min. 6.5Hz
|
||||
@ -177,7 +184,22 @@ assign pclk_1x = PCLK_in;
|
||||
assign PCLK_out = pclk_act;
|
||||
assign pclk_lock = {pclk_2x_lock, pclk_3x_lock};
|
||||
|
||||
//Scanline contrast. Bright pixels decrease scanline strength.
|
||||
function [7:0] apply_scanline_strength;
|
||||
input [7:0] str;
|
||||
input [7:0] data;
|
||||
input [1:0] contrast;
|
||||
|
||||
begin
|
||||
if (contrast)
|
||||
apply_scanline_strength = (str > data) ? (str - data) : 8'h00;
|
||||
else
|
||||
apply_scanline_strength = str;
|
||||
end
|
||||
endfunction
|
||||
|
||||
//Scanline generation
|
||||
<<<<<<< HEAD
|
||||
wire [7:0] R_sl_mult, G_sl_mult, B_sl_mult;
|
||||
lpm_mult_4_sl R_sl_mult_u
|
||||
(
|
||||
@ -204,6 +226,28 @@ lpm_mult_4_sl B_sl_mult_u
|
||||
reg [7:0] R_sl_sub, G_sl_sub, B_sl_sub;
|
||||
reg draw_sl;
|
||||
|
||||
=======
|
||||
function [7:0] apply_scanlines;
|
||||
input [1:0] mode;
|
||||
input [7:0] data;
|
||||
input [7:0] str;
|
||||
input [4:0] mask;
|
||||
input [2:0] line_id;
|
||||
input [2:0] col_id;
|
||||
input fid;
|
||||
|
||||
begin
|
||||
if ((mode == `SCANLINES_H) && (mask & (5'h1<<line_id)))
|
||||
apply_scanlines = (data > str) ? (data-str) : 8'h00;
|
||||
else if ((mode == `SCANLINES_V) && (5'h0 == col_id))
|
||||
apply_scanlines = (data > str) ? (data-str) : 8'h00;
|
||||
else if ((mode == `SCANLINES_ALT) && (mask & (5'h1<<(line_id^fid))))
|
||||
apply_scanlines = (data > str) ? (data-str) : 8'h00;
|
||||
else
|
||||
apply_scanlines = data;
|
||||
end
|
||||
endfunction
|
||||
>>>>>>> 990bc1563eef0a5650dabcc5633d3aeb562abc38
|
||||
|
||||
//LT box / border generation
|
||||
function [7:0] apply_mask;
|
||||
@ -500,6 +544,10 @@ begin
|
||||
R_diff_pp4 <= (R_diff_pp3 * X_REV_LPF_STR);
|
||||
G_diff_pp4 <= (G_diff_pp3 * X_REV_LPF_STR);
|
||||
B_diff_pp4 <= (B_diff_pp3 * X_REV_LPF_STR);
|
||||
// Scanline contrast Low (62%) and High (87%) setting.
|
||||
R_sl_contrast_pp4 <= (H_SL_CONTRAST == `SCANLINES_CONTRAST_HIGH) ? (R_pp3 - (R_pp3 >> 3)) : ((R_pp3 >> 1) + (R_pp3 >> 3));
|
||||
G_sl_contrast_pp4 <= (H_SL_CONTRAST == `SCANLINES_CONTRAST_HIGH) ? (G_pp3 - (G_pp3 >> 3)) : ((G_pp3 >> 1) + (G_pp3 >> 3));
|
||||
B_sl_contrast_pp4 <= (H_SL_CONTRAST == `SCANLINES_CONTRAST_HIGH) ? (B_pp3 - (B_pp3 >> 3)) : ((B_pp3 >> 1) + (B_pp3 >> 3));
|
||||
|
||||
R_pp5 <= apply_reverse_lpf(X_REV_LPF_ENABLE, R_pp4, R_prev_pp4, R_diff_pp4);
|
||||
G_pp5 <= apply_reverse_lpf(X_REV_LPF_ENABLE, G_pp4, G_prev_pp4, G_diff_pp4);
|
||||
@ -511,7 +559,11 @@ begin
|
||||
col_id_pp5 <= col_id_pp4;
|
||||
border_enable_pp5 <= border_enable_pp4;
|
||||
lt_box_enable_pp5 <= lt_box_enable_pp4;
|
||||
R_scanline_str_pp5 <= apply_scanline_strength(X_SCANLINESTR, R_sl_contrast_pp4, H_SL_CONTRAST);
|
||||
G_scanline_str_pp5 <= apply_scanline_strength(X_SCANLINESTR, G_sl_contrast_pp4, H_SL_CONTRAST);
|
||||
B_scanline_str_pp5 <= apply_scanline_strength(X_SCANLINESTR, B_sl_contrast_pp4, H_SL_CONTRAST);
|
||||
|
||||
<<<<<<< HEAD
|
||||
R_pp6 <= R_pp5;
|
||||
G_pp6 <= G_pp5;
|
||||
B_pp6 <= B_pp5;
|
||||
@ -522,6 +574,11 @@ begin
|
||||
draw_sl <= |{(V_SCANLINEMODE == `SCANLINES_H) && (V_SCANLINEID & (5'h1<<line_id_pp5)),
|
||||
(V_SCANLINEMODE == `SCANLINES_V) && (5'h0 == col_id_pp5),
|
||||
(V_SCANLINEMODE == `SCANLINES_ALT) && (V_SCANLINEID & (5'h1<<(line_id_pp5^FID_1x)))};
|
||||
=======
|
||||
R_pp6 <= apply_scanlines(V_SCANLINEMODE, R_pp5, R_scanline_str_pp5, V_SCANLINEID, line_id_pp5, col_id_pp5, FID_1x);
|
||||
G_pp6 <= apply_scanlines(V_SCANLINEMODE, G_pp5, G_scanline_str_pp5, V_SCANLINEID, line_id_pp5, col_id_pp5, FID_1x);
|
||||
B_pp6 <= apply_scanlines(V_SCANLINEMODE, B_pp5, B_scanline_str_pp5, V_SCANLINEID, line_id_pp5, col_id_pp5, FID_1x);
|
||||
>>>>>>> 990bc1563eef0a5650dabcc5633d3aeb562abc38
|
||||
HSYNC_pp6 <= HSYNC_pp5;
|
||||
VSYNC_pp6 <= VSYNC_pp5;
|
||||
DE_pp6 <= DE_pp5;
|
||||
@ -712,10 +769,17 @@ begin
|
||||
H_OPT_SAMPLE_MULT <= h_info2[12:10];
|
||||
H_OPT_STARTOFF <= h_info2[9:0];
|
||||
|
||||
<<<<<<< HEAD
|
||||
X_REV_LPF_ENABLE <= (extra_info[13:9] != 5'b00000);
|
||||
X_REV_LPF_STR <= (extra_info[13:9] + 6'd16);
|
||||
|
||||
X_MASK_BR <= extra_info[8:5];
|
||||
=======
|
||||
H_SL_CONTRAST <= extra_info[14:13];
|
||||
|
||||
X_REV_LPF_ENABLE <= (extra_info[12:8] != 5'b00000);
|
||||
X_REV_LPF_STR <= (extra_info[12:8] + 6'd16);
|
||||
>>>>>>> 990bc1563eef0a5650dabcc5633d3aeb562abc38
|
||||
|
||||
X_SCANLINESTR_METHOD <= extra_info[4];
|
||||
X_SCANLINESTR_SUB <= ((extra_info[3:0]+8'h01)<<4)-1'b1;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -308,7 +308,8 @@ status_t get_status(tvp_input_t input, video_format format)
|
||||
(tc.v_mask != cm.cc.v_mask) ||
|
||||
(tc.mask_br != cm.cc.mask_br) ||
|
||||
(tc.ar_256col != cm.cc.ar_256col) ||
|
||||
(tc.reverse_lpf != cm.cc.reverse_lpf))
|
||||
(tc.reverse_lpf != cm.cc.reverse_lpf) ||
|
||||
(tc.sl_contrast != cm.cc.sl_contrast))
|
||||
status = (status < INFO_CHANGE) ? INFO_CHANGE : status;
|
||||
|
||||
if (tc.sampler_phase != cm.cc.sampler_phase) {
|
||||
@ -366,8 +367,13 @@ status_t get_status(tvp_input_t input, video_format format)
|
||||
// v_info: [31:29] [28:27] [26] [25:20] [19:17] [16:11] [10:0]
|
||||
// | V_MULTMODE[2:0] | V_SCANLINEMODE[1:0] | V_SCANLINEID | V_MASK[5:0] | V_SYNCLEN[2:0] | V_BACKPORCH[5:0] | V_ACTIVE[10:0] |
|
||||
//
|
||||
<<<<<<< HEAD
|
||||
// extra: [31:14] [13:9] [8:5] [4] [3:0]
|
||||
// | | X_REV_LPF_STR | H_MASK_BR[3:0] | H_SCANLINESTR_TYPE | H_SCANLINESTR[3:0] |
|
||||
=======
|
||||
// extra: [31:15] [14:13] [12:8] [7:4] [3:0]
|
||||
// | | H_SL_CONTRAST | X_REV_LPF_STR | H_MASK_BR[3:0] | H_SCANLINESTR[3:0] |
|
||||
>>>>>>> 990bc1563eef0a5650dabcc5633d3aeb562abc38
|
||||
//
|
||||
void set_videoinfo()
|
||||
{
|
||||
@ -462,10 +468,17 @@ void set_videoinfo()
|
||||
(video_modes[cm.id].v_synclen<<17) |
|
||||
(v_backporch<<11) |
|
||||
v_active);
|
||||
<<<<<<< HEAD
|
||||
IOWR_ALTERA_AVALON_PIO_DATA(PIO_6_BASE, (cm.cc.reverse_lpf<<9) |
|
||||
(cm.cc.mask_br<<5) |
|
||||
(cm.cc.sl_method << 4) |
|
||||
cm.cc.sl_str);
|
||||
=======
|
||||
IOWR_ALTERA_AVALON_PIO_DATA(PIO_6_BASE, (cm.cc.sl_contrast<<13) |
|
||||
(cm.cc.reverse_lpf<<8) |
|
||||
(cm.cc.mask_br<<4) |
|
||||
cm.cc.sl_str);
|
||||
>>>>>>> 990bc1563eef0a5650dabcc5633d3aeb562abc38
|
||||
}
|
||||
|
||||
// Configure TVP7002 and scan converter logic based on the video mode
|
||||
|
@ -80,6 +80,7 @@ typedef struct {
|
||||
alt_u8 full_tx_setup;
|
||||
alt_u8 vga_ilace_fix;
|
||||
alt_u8 reverse_lpf;
|
||||
alt_u8 sl_contrast;
|
||||
#ifdef ENABLE_AUDIO
|
||||
alt_u8 audio_dw_sampl;
|
||||
alt_u8 audio_swap_lr;
|
||||
|
@ -65,6 +65,7 @@ static const char *sl_type_desc[] = { LNG("Horizontal","ヨコ"), LNG("Vertical"
|
||||
static const char *sl_id_desc[] = { LNG("Top","ウエ"), LNG("Bottom","シタ") };
|
||||
static const char *audio_dw_sampl_desc[] = { LNG("Off (fs = 96kHz)","オフ (fs = 96kHz)"), "2x (fs = 48kHz)" };
|
||||
static const char *lt_desc[] = { "Top-left", "Center", "Bottom-right" };
|
||||
static const char *sl_contrast_desc[] = { LNG("Off","オフ"), "Low", "High" };
|
||||
|
||||
static void sampler_phase_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, LNG("%d deg","%d ド"), (v*1125)/100); }
|
||||
static void sync_vth_disp(alt_u8 v) { sniprintf(menu_row2, LCD_ROW_LEN+1, "%d mV", (v*1127)/100); }
|
||||
@ -143,6 +144,7 @@ MENU(menu_postproc, P99_PROTECT({ \
|
||||
{ LNG("Scanline method","Scanline method"), OPT_AVCONFIG_SELECTION, { .sel = { &tc.sl_method, OPT_WRAP, SETTING_ITEM(sl_method_desc) } } },
|
||||
{ LNG("Scanline type","スキャンラインルイ"), OPT_AVCONFIG_SELECTION, { .sel = { &tc.sl_type, OPT_WRAP, SETTING_ITEM(sl_type_desc) } } },
|
||||
{ LNG("Scanline alignm.","スキャンラインポジション"), OPT_AVCONFIG_SELECTION, { .sel = { &tc.sl_id, OPT_WRAP, SETTING_ITEM(sl_id_desc) } } },
|
||||
{ "ScanlineContrast", OPT_AVCONFIG_SELECTION, { .sel = { &tc.sl_contrast, OPT_WRAP, SETTING_ITEM(sl_contrast_desc) } } },
|
||||
{ LNG("Horizontal mask","スイヘイマスク"), OPT_AVCONFIG_NUMVALUE, { .num = { &tc.h_mask, OPT_NOWRAP, 0, HV_MASK_MAX, pixels_disp } } },
|
||||
{ LNG("Vertical mask","スイチョクマスク"), OPT_AVCONFIG_NUMVALUE, { .num = { &tc.v_mask, OPT_NOWRAP, 0, HV_MASK_MAX, pixels_disp } } },
|
||||
{ LNG("Mask brightness","マスクアカルサ"), OPT_AVCONFIG_NUMVALUE, { .num = { &tc.mask_br, OPT_NOWRAP, 0, HV_MASK_MAX_BR, value_disp } } },
|
||||
|
Loading…
Reference in New Issue
Block a user