Fix nsc server side after color conversion.

We use new color format system and PIXEL_FORMAT_BGRX32 is the unified buffer color format. Add support for PIXEL_FORMAT_BGRX32 in nsc
This commit is contained in:
zihao.jiang 2016-10-11 23:31:12 +08:00
parent bd1ec5fe53
commit 5e1f745868
3 changed files with 39 additions and 1 deletions

View File

@ -373,7 +373,7 @@ BOOL interleaved_compress(BITMAP_INTERLEAVED_CONTEXT* interleaved,
}
if (bpp == 24)
DstFormat = PIXEL_FORMAT_XRGB32;
DstFormat = PIXEL_FORMAT_BGRX32;
else if (bpp == 16)
DstFormat = PIXEL_FORMAT_RGB16;
else if (bpp == 15)

View File

@ -126,6 +126,14 @@ static void nsc_encode_argb_to_aycocg(NSC_CONTEXT* context, const BYTE* data,
{
switch (context->pixel_format)
{
case PIXEL_FORMAT_BGRX32:
b_val = *src++;
g_val = *src++;
r_val = *src++;
src++;
a_val = 0xFF;
break;
case PIXEL_FORMAT_BGRA32:
b_val = *src++;
g_val = *src++;
@ -133,6 +141,14 @@ static void nsc_encode_argb_to_aycocg(NSC_CONTEXT* context, const BYTE* data,
a_val = *src++;
break;
case PIXEL_FORMAT_RGBX32:
r_val = *src++;
g_val = *src++;
b_val = *src++;
src++;
a_val = 0xFF;
break;
case PIXEL_FORMAT_RGBA32:
r_val = *src++;
g_val = *src++;

View File

@ -76,6 +76,17 @@ static void nsc_encode_argb_to_aycocg_sse2(NSC_CONTEXT* context,
{
switch (context->pixel_format)
{
case PIXEL_FORMAT_BGRX32:
b_val = _mm_set_epi16(*(src + 28), *(src + 24), *(src + 20), *(src + 16),
*(src + 12), *(src + 8), *(src + 4), *src);
g_val = _mm_set_epi16(*(src + 29), *(src + 25), *(src + 21), *(src + 17),
*(src + 13), *(src + 9), *(src + 5), *(src + 1));
r_val = _mm_set_epi16(*(src + 30), *(src + 26), *(src + 22), *(src + 18),
*(src + 14), *(src + 10), *(src + 6), *(src + 2));
a_val = _mm_set1_epi16(0xFF);
src += 32;
break;
case PIXEL_FORMAT_BGRA32:
b_val = _mm_set_epi16(*(src + 28), *(src + 24), *(src + 20), *(src + 16),
*(src + 12), *(src + 8), *(src + 4), *src);
@ -88,6 +99,17 @@ static void nsc_encode_argb_to_aycocg_sse2(NSC_CONTEXT* context,
src += 32;
break;
case PIXEL_FORMAT_RGBX32:
r_val = _mm_set_epi16(*(src + 28), *(src + 24), *(src + 20), *(src + 16),
*(src + 12), *(src + 8), *(src + 4), *src);
g_val = _mm_set_epi16(*(src + 29), *(src + 25), *(src + 21), *(src + 17),
*(src + 13), *(src + 9), *(src + 5), *(src + 1));
b_val = _mm_set_epi16(*(src + 30), *(src + 26), *(src + 22), *(src + 18),
*(src + 14), *(src + 10), *(src + 6), *(src + 2));
a_val = _mm_set1_epi16(0xFF);
src += 32;
break;
case PIXEL_FORMAT_RGBA32:
r_val = _mm_set_epi16(*(src + 28), *(src + 24), *(src + 20), *(src + 16),
*(src + 12), *(src + 8), *(src + 4), *src);