From 6476ff4cf112788878cb07778ca707d70766d22f Mon Sep 17 00:00:00 2001 From: IanSB Date: Mon, 16 Aug 2021 04:59:50 +0100 Subject: [PATCH] Swap B1 and R1 for 9/12bpp into 16bit frame buffer --- src/macros.S | 12 +++++++++--- src/osd.c | 19 +++++++++---------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/macros.S b/src/macros.S index ed27d26c..ac19b364 100644 --- a/src/macros.S +++ b/src/macros.S @@ -669,14 +669,20 @@ wait_wr\@: .macro BIT_SHIFT_EIGHT_BITS - and r9, r8, #(0xCE << PIXEL_BASE) // extract 0,G3,G2,0,0,B3,B2,B1,x,x,x (shifted left by PIXEL_BASE + 1 to put red lsb rather than green msb in top bit) + and r9, r8, #(0xCC << PIXEL_BASE) // extract 0,G3,G2,0,0,B3,B2,0,x,x,x (shifted left by PIXEL_BASE + 1 to put red lsb rather than green msb in top bit) + tst r8, #(0x02 << PIXEL_BASE) // move B1 + orrne r9, r9, #(0x100 << PIXEL_BASE) tst r8, #(0x800 << PIXEL_BASE) // move R3 orrne r9, r9, #(0x20 << PIXEL_BASE) tst r8, #(0x400 << PIXEL_BASE) // move R2 orrne r9, r9, #(0x10 << PIXEL_BASE) tst r8, #(0x200 << PIXEL_BASE) // move R1 - orrne r9, r9, #(0x100 << PIXEL_BASE) // order is now R1,G3,G2,R3,R2,B3,B2,B1,x,x,x - and r9, r9, r14 // mask out top bit if OSD is on (R1) + orrne r9, r9, #(0x02 << PIXEL_BASE) // order is now B1,G3,G2,R3,R2,B3,B2,R1,x,x,x + and r9, r9, r14 // mask out top bit if OSD is on (B1) +// tst r3, #BITDUP_ENABLE_FFOSD // potential code for FFOSD in 8bpp mode but also requires dynamic palette reprogramming +// tstne r8, #MUX_MASK +// orrne r3, r3, #BITDUP_FFOSD_DETECTED +// orrne r9, r9, #(0x100 << PIXEL_BASE) .endm .macro CAPTURE_EIGHT_BITS_8BPP_0 reg diff --git a/src/osd.c b/src/osd.c index ba58fe29..06b7a697 100644 --- a/src/osd.c +++ b/src/osd.c @@ -3904,15 +3904,14 @@ void osd_update_palette() { int i_adj = i; if (capinfo->bpp == 8 && capinfo->sample_width >= SAMPLE_WIDTH_9LO) { //if capturing 9 or 12bpp to an 8bpp frame buffer bits are captured in the wrong order so rearrange the palette order to match - //convert R1,G3,G2,R3,R2,B3,B2,B1 + //convert B1,G3,G2,R3,R2,B3,B2,R1 //to B1,R1,B2,G2,R2,B3,G3,R3 - i_adj = ((i & 0x01) << 7) + i_adj = ((i & 0x01) << 6) | ((i & 0x02) << 4) - | (i & 0x0c) + | (i & 0x8c) | ((i & 0x10) >> 4) | ((i & 0x20) >> 1) - | ((i & 0x40) >> 5) - | ((i & 0x80) >> 1); + | ((i & 0x40) >> 5); } if(design_type == DESIGN_ATOM) { @@ -4023,12 +4022,12 @@ void osd_update_palette() { } if (active) { if (i >= (num_colours >> 1)) { - palette_data[i] = 0xFFFFFFFF; + palette_data[i] = 0xFFFFFFFF; } else { - if (!inhibit_palette_dimming) { - r >>= 1; g >>= 1; b >>= 1; - } - palette_data[i] = 0xFF000000 | (b << 16) | (g << 8) | r; + if (!inhibit_palette_dimming) { + r >>= 1; g >>= 1; b >>= 1; + } + palette_data[i] = 0xFF000000 | (b << 16) | (g << 8) | r; } } else { if ((i >= (num_colours >> 1)) && get_feature(F_SCANLINES)) {