Merge RGB and YUV sampling file formats so profiles are interchangeable between CPLDs

pull/154/head
IanSB 2020-07-27 04:19:49 +01:00
rodzic 03bae32680
commit eb439e7cdb
3 zmienionych plików z 73 dodań i 9 usunięć

Wyświetl plik

@ -21,6 +21,11 @@ typedef struct {
int half_px_delay; // 0 = off, 1 = on, all modes int half_px_delay; // 0 = off, 1 = on, all modes
int divider; // cpld divider, 6 or 8 int divider; // cpld divider, 6 or 8
int full_px_delay; // 0..15 int full_px_delay; // 0..15
int filter_l;
int sub_c;
int alt_r;
int edge;
int clamptype;
int mux; // 0 = direct, 1 = via the 74LS08 buffer int mux; // 0 = direct, 1 = via the 74LS08 buffer
int rate; // 0 = normal psync rate (3 bpp), 1 = double psync rate (6 bpp), 2 = sub-sample (odd), 3=sub-sample(even) int rate; // 0 = normal psync rate (3 bpp), 1 = double psync rate (6 bpp), 2 = sub-sample (odd), 3=sub-sample(even)
int terminate; int terminate;
@ -110,6 +115,11 @@ enum {
HALF, HALF,
DIVIDER, DIVIDER,
DELAY, DELAY,
FILTER_L,
SUB_C,
ALT_R,
EDGE,
CLAMPTYPE,
MUX, MUX,
RATE, RATE,
TERMINATE, TERMINATE,
@ -187,6 +197,13 @@ static param_t params[] = {
{ HALF, "Half", "half", 0, 1, 1 }, { HALF, "Half", "half", 0, 1, 1 },
{ DIVIDER, "Divider", "divider", 6, 8, 2 }, { DIVIDER, "Divider", "divider", 6, 8, 2 },
{ DELAY, "Delay", "delay", 0, 15, 1 }, { DELAY, "Delay", "delay", 0, 15, 1 },
//block of hidden YUV options for file compatibility
{ FILTER_L, "Filter Y", "l_filter", 0, 1, 1 },
{ SUB_C, "Subsample UV", "sub_c", 0, 1, 1 },
{ ALT_R, "PAL switch", "alt_r", 0, 1, 1 },
{ EDGE, "Sync Edge", "edge", 0, 1, 1 },
{ CLAMPTYPE, "Clamp Type", "clamptype", 0, 4, 1 },
//end of hidden block
{ MUX, "Sync on G/V", "input_mux", 0, 1, 1 }, { MUX, "Sync on G/V", "input_mux", 0, 1, 1 },
{ RATE, "Sample Mode", "sample_mode", 0, 3, 1 }, { RATE, "Sample Mode", "sample_mode", 0, 3, 1 },
{ TERMINATE, "75R Termination", "termination", 0, NUM_RGB_TERM-1, 1 }, { TERMINATE, "75R Termination", "termination", 0, NUM_RGB_TERM-1, 1 },
@ -531,6 +548,13 @@ static void log_sp(config_t *config) {
// ============================================================= // =============================================================
static void cpld_init(int version) { static void cpld_init(int version) {
// hide YUV lines included for file compatibility
params[FILTER_L].hidden = 1;
params[SUB_C].hidden = 1;
params[ALT_R].hidden = 1;
params[EDGE].hidden = 1;
params[CLAMPTYPE].hidden = 1;
cpld_version = version; cpld_version = version;
// Setup default frame buffer params // Setup default frame buffer params
// //
@ -598,12 +622,18 @@ static void cpld_init(int version) {
//******************************************************************************************************************************* //*******************************************************************************************************************************
// Remove analog frontend parameters by. This is more drastic than simply // Hide analog frontend parameters by.
// hiding them, as it also affects the parsing/serializing of profiles.
// This is necessary as RGB(TTL) and RGB(Analog) have separate profile
// directories with differening numbers of parameters.
if (!supports_analog) { if (!supports_analog) {
params[TERMINATE].key = -1; params[TERMINATE].hidden = 1;
params[COUPLING].hidden = 1;
params[DAC_A].hidden = 1;
params[DAC_B].hidden = 1;
params[DAC_C].hidden = 1;
params[DAC_D].hidden = 1;
params[DAC_E].hidden = 1;
params[DAC_F].hidden = 1;
params[DAC_G].hidden = 1;
params[DAC_H].hidden = 1;
} }
if (major > 2) { if (major > 2) {

Wyświetl plik

@ -23,6 +23,9 @@
typedef struct { typedef struct {
int cpld_setup_mode; int cpld_setup_mode;
int sp_offset; int sp_offset;
int dummy_offsets[NUM_OFFSETS - 1];
int half_px_delay; // 0 = off, 1 = on, all modes
int divider; // cpld divider, 6 or 8
int delay; int delay;
int filter_l; int filter_l;
int sub_c; int sub_c;
@ -44,6 +47,7 @@ typedef struct {
} config_t; } config_t;
enum { enum {
YUV_RATE_UNUSED,
YUV_RATE_6, YUV_RATE_6,
YUV_RATE_6_LEVEL_4, YUV_RATE_6_LEVEL_4,
}; };
@ -89,6 +93,14 @@ static int invert = 0;
enum { enum {
CPLD_SETUP_MODE, CPLD_SETUP_MODE,
OFFSET, OFFSET,
A_OFFSET,
B_OFFSET,
C_OFFSET,
D_OFFSET,
E_OFFSET,
F_OFFSET,
HALF,
DIVIDER,
DELAY, DELAY,
FILTER_L, FILTER_L,
SUB_C, SUB_C,
@ -136,6 +148,7 @@ static const char *level_names[] = {
}; };
static const char *rate_names[] = { static const char *rate_names[] = {
"Unused",
"6 Bits Per Pixel", "6 Bits Per Pixel",
"6 Bits (4 Level)", "6 Bits (4 Level)",
}; };
@ -175,6 +188,16 @@ enum {
static param_t params[] = { static param_t params[] = {
{ CPLD_SETUP_MODE, "Setup Mode", "setup_mode", 0, NUM_CPLD_SETUP-1, 1 }, { CPLD_SETUP_MODE, "Setup Mode", "setup_mode", 0, NUM_CPLD_SETUP-1, 1 },
{ OFFSET, "Offset", "offset", 0, 15, 1 }, { OFFSET, "Offset", "offset", 0, 15, 1 },
//block of hidden RGB options for file compatibility
{ A_OFFSET, "A Offset", "a_offset", 0, 0, 1 },
{ B_OFFSET, "B Offset", "b_offset", 0, 0, 1 },
{ C_OFFSET, "C Offset", "c_offset", 0, 0, 1 },
{ D_OFFSET, "D Offset", "d_offset", 0, 0, 1 },
{ E_OFFSET, "E Offset", "e_offset", 0, 0, 1 },
{ F_OFFSET, "F Offset", "f_offset", 0, 0, 1 },
{ HALF, "Half", "half", 0, 1, 1 },
{ DIVIDER, "Divider", "divider", 6, 8, 2 },
//end of hidden block
{ DELAY, "Delay", "delay", 0, 15, 1 }, { DELAY, "Delay", "delay", 0, 15, 1 },
{ FILTER_L, "Filter Y", "l_filter", 0, 1, 1 }, { FILTER_L, "Filter Y", "l_filter", 0, 1, 1 },
{ SUB_C, "Subsample UV", "sub_c", 0, 1, 1 }, { SUB_C, "Subsample UV", "sub_c", 0, 1, 1 },
@ -182,7 +205,7 @@ static param_t params[] = {
{ EDGE, "Sync Edge", "edge", 0, 1, 1 }, { EDGE, "Sync Edge", "edge", 0, 1, 1 },
{ CLAMPTYPE, "Clamp Type", "clamptype", 0, NUM_CLAMPTYPE-1, 1 }, { CLAMPTYPE, "Clamp Type", "clamptype", 0, NUM_CLAMPTYPE-1, 1 },
{ MUX, "Sync on Y/V", "input_mux", 0, 1, 1 }, { MUX, "Sync on Y/V", "input_mux", 0, 1, 1 },
{ RATE, "Sample Mode", "sample_mode", 0, 1, 1 }, { RATE, "Sample Mode", "sample_mode", 1, 2, 1 },
{ TERMINATE, "75R Termination", "termination", 0, NUM_YUV_TERM-1, 1 }, { TERMINATE, "75R Termination", "termination", 0, NUM_YUV_TERM-1, 1 },
{ COUPLING, "Y Coupling", "coupling", 0, NUM_YUV_COUPLING-1, 1 }, { COUPLING, "Y Coupling", "coupling", 0, NUM_YUV_COUPLING-1, 1 },
{ DAC_A, "DAC-A: Y Hi", "dac_a", 0, 255, 1 }, { DAC_A, "DAC-A: Y Hi", "dac_a", 0, 255, 1 },
@ -315,7 +338,7 @@ static void write_config(config_t *config) {
scan_len += 2; scan_len += 2;
} }
sp |= config->rate << scan_len; sp |= ((config->rate - 1) & 1) << scan_len;
scan_len++; scan_len++;
sp |= config->filter_l << scan_len; sp |= config->filter_l << scan_len;
@ -460,10 +483,19 @@ static void log_sp(config_t *config) {
// ============================================================= // =============================================================
static void cpld_init(int version) { static void cpld_init(int version) {
params[A_OFFSET].hidden = 1;
params[B_OFFSET].hidden = 1;
params[C_OFFSET].hidden = 1;
params[D_OFFSET].hidden = 1;
params[E_OFFSET].hidden = 1;
params[F_OFFSET].hidden = 1;
params[HALF].hidden = 1;
params[DIVIDER].hidden = 1;
cpld_version = version; cpld_version = version;
config->sp_offset = 0; config->sp_offset = 0;
config->rate = YUV_RATE_6; config->rate = YUV_RATE_6;
config->filter_l = 1; config->filter_l = 1;
config->divider = 8;
for (int i = 0; i < RANGE_MAX; i++) { for (int i = 0; i < RANGE_MAX; i++) {
sum_metrics[i] = -1; sum_metrics[i] = -1;
} }
@ -514,7 +546,7 @@ static void cpld_init(int version) {
if (!eight_bit_detected()) { if (!eight_bit_detected()) {
params[RATE].max = 0; // four level YUV won't work on 6 bit boards params[RATE].max = 0; // four level YUV won't work on 6 bit boards
params[DAC_H].hidden = 1; params[DAC_H].hidden = 1;
config->rate = 0; config->rate = YUV_RATE_6;
supports_four_level = 0; supports_four_level = 0;
} }
} }

Wyświetl plik

@ -2436,6 +2436,7 @@ void rgb_to_hdmi_main() {
int ncapture; int ncapture;
int last_profile = -1; int last_profile = -1;
int last_subprofile = -1; int last_subprofile = -1;
int last_divider = -1;
int wait_keyrelease = 0; int wait_keyrelease = 0;
int powerup = 1; int powerup = 1;
int refresh_osd = 0; int refresh_osd = 0;
@ -2504,6 +2505,7 @@ void rgb_to_hdmi_main() {
log_info("Autoswitch: No profile matched"); log_info("Autoswitch: No profile matched");
} }
} }
last_divider = cpld->get_divider();
last_profile = profile; last_profile = profile;
last_subprofile = subprofile; last_subprofile = subprofile;
log_debug("Setting up frame buffer"); log_debug("Setting up frame buffer");
@ -2714,7 +2716,7 @@ void rgb_to_hdmi_main() {
mode_changed = mode7 != last_mode7 || capinfo->vsync_type != last_capinfo.vsync_type || capinfo->sync_type != last_capinfo.sync_type || capinfo->border != last_capinfo.border mode_changed = mode7 != last_mode7 || capinfo->vsync_type != last_capinfo.vsync_type || capinfo->sync_type != last_capinfo.sync_type || capinfo->border != last_capinfo.border
|| capinfo->video_type != last_capinfo.video_type || capinfo->px_sampling != last_capinfo.px_sampling || capinfo->video_type != last_capinfo.video_type || capinfo->px_sampling != last_capinfo.px_sampling
|| profile != last_profile || last_subprofile != subprofile || (result & RET_SYNC_TIMING_CHANGED); || profile != last_profile || last_subprofile != subprofile || cpld->get_divider() != last_divider || (result & RET_SYNC_TIMING_CHANGED);
if (active_size_changed) { if (active_size_changed) {
clear = BIT_CLEAR; clear = BIT_CLEAR;