kopia lustrzana https://github.com/hoglet67/RGBtoHDMI
Added OSD menu for deinterlacing
Change-Id: I8abc464a170612e36b012d113e39a7fa175cadb6pull/28/head
rodzic
b0cc71ccbd
commit
5bf1ee2850
17
src/defs.h
17
src/defs.h
|
@ -31,14 +31,15 @@
|
|||
#define BIT_MODE7 0x01
|
||||
#define BIT_PROBE 0x02
|
||||
#define BIT_CALIBRATE 0x04
|
||||
#define BIT_OSD 0x08
|
||||
#define BIT_INITIALIZE 0x10
|
||||
#define BIT_ELK 0x20
|
||||
#define BIT_SCANLINES 0x40
|
||||
#define BIT_FIELD_TYPE 0x80
|
||||
#define BIT_CLEAR 0x100
|
||||
#define BIT_VSYNC 0x200
|
||||
#define BIT_CAL_COUNT 0x400
|
||||
#define BIT_NO_DEINT 0x08
|
||||
#define BIT_DEINT_MODE 0x10
|
||||
#define BIT_INITIALIZE 0x20
|
||||
#define BIT_ELK 0x40
|
||||
#define BIT_SCANLINES 0x80
|
||||
#define BIT_FIELD_TYPE 0x100
|
||||
#define BIT_CLEAR 0x200
|
||||
#define BIT_VSYNC 0x400
|
||||
#define BIT_CAL_COUNT 0x800
|
||||
|
||||
// Note, due to a hack, bits 16, 19 and 26 are unavailale
|
||||
// as the are used for switch change detection
|
||||
|
|
51
src/osd.c
51
src/osd.c
|
@ -74,6 +74,13 @@ enum {
|
|||
NUM_INFOS
|
||||
};
|
||||
|
||||
enum {
|
||||
DEINTERLACE_NONE,
|
||||
DEINTERLACE_MA1,
|
||||
DEINTERLACE_MA2,
|
||||
NUM_DEINTERLACES
|
||||
};
|
||||
|
||||
static const char *info_names[] = {
|
||||
"Firmware Version",
|
||||
"Calibration Summary",
|
||||
|
@ -94,6 +101,12 @@ static const char *pllh_names[] = {
|
|||
"627",
|
||||
};
|
||||
|
||||
static const char *deinterlace_names[] = {
|
||||
"None",
|
||||
"Motion Adpative 1",
|
||||
"Motion Adpative 2"
|
||||
};
|
||||
|
||||
#ifdef MULTI_BUFFER
|
||||
static const char *nbuffer_names[] = {
|
||||
"Single buffered",
|
||||
|
@ -110,6 +123,7 @@ static const char *nbuffer_names[] = {
|
|||
enum {
|
||||
F_INFO,
|
||||
F_PALETTE,
|
||||
F_DEINTERLACE,
|
||||
F_SCANLINES,
|
||||
F_MUX,
|
||||
F_ELK,
|
||||
|
@ -124,6 +138,7 @@ enum {
|
|||
static param_t features[] = {
|
||||
{ "Info", 0, NUM_INFOS - 1 },
|
||||
{ "Color Palette", 0, NUM_PALETTES - 1 },
|
||||
{ "Deinterlace", 0, NUM_DEINTERLACES - 1 },
|
||||
{ "Scanlines", 0, 1 },
|
||||
{ "Input Mux", 0, 1 },
|
||||
{ "Elk", 0, 1 },
|
||||
|
@ -264,6 +279,8 @@ static int get_feature(int num) {
|
|||
return info;
|
||||
case F_PALETTE:
|
||||
return palette;
|
||||
case F_DEINTERLACE:
|
||||
return get_deinterlace();
|
||||
case F_SCANLINES:
|
||||
return get_scanlines();
|
||||
case F_MUX:
|
||||
|
@ -293,6 +310,9 @@ static void set_feature(int num, int value) {
|
|||
palette = value;
|
||||
update_palette();
|
||||
break;
|
||||
case F_DEINTERLACE:
|
||||
set_deinterlace(value);
|
||||
break;
|
||||
case F_SCANLINES:
|
||||
set_scanlines(value);
|
||||
break;
|
||||
|
@ -327,9 +347,10 @@ static void show_feature(int num) {
|
|||
int value = get_feature(num);
|
||||
// Convert that to a human readable string
|
||||
const char *valstr =
|
||||
(num == F_INFO) ? info_names[value] :
|
||||
(num == F_PALETTE) ? palette_names[value] :
|
||||
(num == F_PLLH) ? pllh_names[value] :
|
||||
(num == F_INFO) ? info_names[value] :
|
||||
(num == F_PALETTE) ? palette_names[value] :
|
||||
(num == F_DEINTERLACE) ? deinterlace_names[value] :
|
||||
(num == F_PLLH) ? pllh_names[value] :
|
||||
#ifdef MULTI_BUFFER
|
||||
(num == F_NBUFFERS)? nbuffer_names[value] :
|
||||
#endif
|
||||
|
@ -556,57 +577,63 @@ void osd_init() {
|
|||
if (prop) {
|
||||
int val = atoi(prop);
|
||||
set_feature(F_INFO, val);
|
||||
log_info("config.txt: info = %d", val);
|
||||
log_info("config.txt: info = %d", val);
|
||||
}
|
||||
prop = get_cmdline_prop("palette");
|
||||
if (prop) {
|
||||
int val = atoi(prop);
|
||||
set_feature(F_PALETTE, val);
|
||||
log_info("config.txt: palette = %d", val);
|
||||
log_info("config.txt: palette = %d", val);
|
||||
}
|
||||
prop = get_cmdline_prop("deinterlace");
|
||||
if (prop) {
|
||||
int val = atoi(prop);
|
||||
set_feature(F_DEINTERLACE, val);
|
||||
log_info("config.txt: deinterlace = %d", val);
|
||||
}
|
||||
prop = get_cmdline_prop("scanlines");
|
||||
if (prop) {
|
||||
int val = atoi(prop);
|
||||
set_feature(F_SCANLINES, val);
|
||||
log_info("config.txt: scanlines = %d", val);
|
||||
log_info("config.txt: scanlines = %d", val);
|
||||
}
|
||||
prop = get_cmdline_prop("mux");
|
||||
if (prop) {
|
||||
int val = atoi(prop);
|
||||
set_feature(F_MUX, val);
|
||||
log_info("config.txt: mux = %d", val);
|
||||
log_info("config.txt: mux = %d", val);
|
||||
}
|
||||
prop = get_cmdline_prop("elk");
|
||||
if (prop) {
|
||||
int val = atoi(prop);
|
||||
set_feature(F_ELK, val);
|
||||
log_info("config.txt: elk = %d", val);
|
||||
log_info("config.txt: elk = %d", val);
|
||||
}
|
||||
prop = get_cmdline_prop("pllh");
|
||||
if (prop) {
|
||||
int val = atoi(prop);
|
||||
set_feature(F_PLLH, val);
|
||||
log_info("config.txt: pllh = %d", val);
|
||||
log_info("config.txt: pllh = %d", val);
|
||||
}
|
||||
#ifdef MULTI_BUFFER
|
||||
prop = get_cmdline_prop("nbuffers");
|
||||
if (prop) {
|
||||
int val = atoi(prop);
|
||||
set_feature(F_NBUFFERS, val);
|
||||
log_info("config.txt: nbuffers = %d", val);
|
||||
log_info("config.txt: nbuffers = %d", val);
|
||||
}
|
||||
#endif
|
||||
prop = get_cmdline_prop("vsync");
|
||||
if (prop) {
|
||||
int val = atoi(prop);
|
||||
set_feature(F_VSYNC, val);
|
||||
log_info("config.txt: vsync = %d", val);
|
||||
log_info("config.txt: vsync = %d", val);
|
||||
}
|
||||
prop = get_cmdline_prop("debug");
|
||||
if (prop) {
|
||||
int val = atoi(prop);
|
||||
set_feature(F_DEBUG, val);
|
||||
log_info("config.txt: debug = %d", val);
|
||||
log_info("config.txt: debug = %d", val);
|
||||
}
|
||||
// Initialize the CPLD sampling points
|
||||
for (int m7 = 0; m7 <= 1; m7++) {
|
||||
|
|
|
@ -24,6 +24,8 @@ void action_calibrate();
|
|||
|
||||
void set_scanlines(int on);
|
||||
int get_scanlines();
|
||||
void set_deinterlace(int value);
|
||||
int get_deinterlace();
|
||||
void set_elk(int on);
|
||||
int get_elk();
|
||||
void set_vsync(int on);
|
||||
|
|
|
@ -282,12 +282,13 @@ process_chars_loop_7\@:
|
|||
|
||||
//*** test for calibration or OSD. If enabled branch to skip_deinterlace\@ as deinterlace code messes up the calibration
|
||||
|
||||
tst r3, #(BIT_CALIBRATE | BIT_OSD)
|
||||
tst r3, #(BIT_CALIBRATE | BIT_NO_DEINT)
|
||||
bne skip_deinterlace\@
|
||||
|
||||
cmp r10, r9 //*** is new value same as old value?
|
||||
strne r10, [r12, r1] //*** if different then overwrite other field pixel value (offset above or below in r1)
|
||||
|
||||
tstne r3, #BIT_DEINT_MODE
|
||||
addne r8, r11, r2 //*** adjust pointer to next line in comparison buffer
|
||||
strne r10, [r12,r8] //*** if pixels different overwrite next line of comparison buffer (delays end of deinterlacing)
|
||||
|
||||
|
|
|
@ -60,6 +60,7 @@ static int elk;
|
|||
static int mode7;
|
||||
static int clear;
|
||||
static int scanlines = 0;
|
||||
static int deinterlace = 0;
|
||||
static int last_mode7;
|
||||
static int result;
|
||||
static int chars_per_line;
|
||||
|
@ -796,6 +797,14 @@ int get_scanlines() {
|
|||
return scanlines;
|
||||
}
|
||||
|
||||
void set_deinterlace(int mode) {
|
||||
deinterlace = mode;
|
||||
}
|
||||
|
||||
int get_deinterlace() {
|
||||
return deinterlace;
|
||||
}
|
||||
|
||||
#ifdef MULTI_BUFFER
|
||||
int get_nbuffers() {
|
||||
return nbuffers;
|
||||
|
@ -857,8 +866,10 @@ void rgb_to_hdmi_main() {
|
|||
if (scanlines) {
|
||||
flags |= BIT_SCANLINES;
|
||||
}
|
||||
if (osd_active()) {
|
||||
flags |= BIT_OSD;
|
||||
if (osd_active() || deinterlace == 0) {
|
||||
flags |= BIT_NO_DEINT;
|
||||
} else if (deinterlace == 2) {
|
||||
flags |= BIT_DEINT_MODE;
|
||||
}
|
||||
#ifdef MULTI_BUFFER
|
||||
flags |= nbuffers << OFFSET_NBUFFERS;
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
# - 8 is Not Green
|
||||
# - 9 is Not Blue
|
||||
#
|
||||
# deinterlace: algorithm used for mode 7 deinterlacing
|
||||
# - 0 is None
|
||||
# - 1 is Motion adaptive 1
|
||||
# - 2 is Motion adaptive 2 (more aggressive)
|
||||
#
|
||||
# scalines: show visible scanlines in modes 0..6
|
||||
# - 0 is scanlines off
|
||||
# - 1 is scanlines on
|
||||
|
@ -78,4 +83,4 @@
|
|||
#
|
||||
# Important: All the properties must be on a single line, and no blank lines!
|
||||
#
|
||||
sampling06=3 sampling7=0,2,2,2,2,2,2,0 info=1 palette=0 scanlines=0 mux=0 elk=0 vsync=0 pllh=0 nbuffers=2 debug=0
|
||||
sampling06=3 sampling7=0,2,2,2,2,2,2,0 info=1 palette=0 deinterlace=1 scanlines=0 mux=0 elk=0 vsync=0 pllh=0 nbuffers=2 debug=0
|
||||
|
|
Ładowanie…
Reference in New Issue