From d344a7e456ef9d7e262c4272b46f85ca9425fa0f Mon Sep 17 00:00:00 2001 From: cool Date: Tue, 24 Jan 2012 21:06:48 -1100 Subject: [PATCH] nscodec final color bug fix --- libfreerdp-codec/nsc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libfreerdp-codec/nsc.c b/libfreerdp-codec/nsc.c index f0fc5276f..a39bdd33e 100644 --- a/libfreerdp-codec/nsc.c +++ b/libfreerdp-codec/nsc.c @@ -149,7 +149,7 @@ void nsc_chroma_supersample(NSC_CONTEXT* context) void nsc_ycocg_rgb(NSC_CONTEXT* context) { uint8* sbitstream[2]; - uint8 bitoff, sign[2], i, val; + uint8 bitoff, sign[2], i, val, tmp; sint16 rgb[3], ycocg[3]; uint32 bytno, size; size = context->OrgByteCount[0]; @@ -176,8 +176,11 @@ void nsc_ycocg_rgb(NSC_CONTEXT* context) for (i = 0; i < 3; i++) { - if (((rgb[i] >> 8) & 0x1) == 0x1) - val = ~((uint8) rgb[i]) + 0x1; + tmp = (rgb[i] >> 8) & 0xff; + if (tmp == 0xff) + val = 0x00; + else if (tmp == 0x1) + val = 0xff; else val = (uint8) rgb[i];