From: Toni Wilen Date: Sun, 8 Mar 2026 18:43:08 +0000 (+0200) Subject: Black level calibration update X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=dfbe93e9f34f6daf21e8db4e271de3de4bb9a896;p=francis%2Fwinuae.git Black level calibration update --- diff --git a/drawing.cpp b/drawing.cpp index 9617632c..7dd044c3 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -5471,6 +5471,7 @@ void end_draw_denise(void) static uae_u8 blc_prev[3]; static void emulate_black_level_calibration(uae_u32 *b1, uae_u32 *b2, uae_u32 *db, int dtotal, int cstart, int clen) { + bool useb2 = b1 != b2 && b2; int shift = hresolution + 1; int off = cstart << shift; @@ -5493,8 +5494,11 @@ static void emulate_black_level_calibration(uae_u32 *b1, uae_u32 *b2, uae_u32 *d } } if (!cnt) { + memcpy(b1, db, (dtotal * sizeof(uae_u32)) << shift); + if (useb2) { + memcpy(b2, db, (dtotal * sizeof(uae_u32)) << shift); + } return; - } #if 1 @@ -5513,7 +5517,6 @@ static void emulate_black_level_calibration(uae_u32 *b1, uae_u32 *b2, uae_u32 *d // if (outc[0] > 10 || outc[1] > 10 || outc[2] > 10) // write_log("%02x %02x %02x\n", outc[0], outc[1], outc[2]); - bool useb2 = b1 != b2 && b2; if (outc[0] <= 3 && outc[1] <= 3 && outc[2] <= 3) { memcpy(b1, db, (dtotal * sizeof(uae_u32)) << shift); if (useb2) { @@ -5532,10 +5535,7 @@ static void emulate_black_level_calibration(uae_u32 *b1, uae_u32 *b2, uae_u32 *d if (c[j] <= outc[j]) { c[j] = 0; } else { - int cc = c[j] + outc[j]; - if (cc >= 256) { - cc = 255; - } + uae_u8 cc = c[j] - outc[j]; c[j] = cc; } } @@ -5567,7 +5567,6 @@ static uae_u32 filter_pixel(uae_u32 p1, uae_u32 p2) // ultra extreme debug pixel patterns static uint32_t decode_denise_specials_debug(uint32_t v, int inc) { - *buf_d++ = v; if (decode_specials_debug > 1) { int t = ((inc >> 1) + this_line->linear_vpos + 1) & 3; if (denise_blank_active2) { @@ -5605,6 +5604,7 @@ static uint32_t decode_denise_specials_debug(uint32_t v, int inc) } } } + *buf_d++ = v; return v; }