2011-10-02 23:26:33 +04:00
|
|
|
/**
|
2012-10-09 07:02:04 +04:00
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
2011-10-03 05:07:07 +04:00
|
|
|
* NSCodec Codec
|
|
|
|
*
|
|
|
|
* Copyright 2011 Samsung, Author Jiten Pathy
|
2012-03-06 14:52:28 +04:00
|
|
|
* Copyright 2012 Vic Lee
|
2011-10-03 05:07:07 +04:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
2011-10-03 04:52:17 +04:00
|
|
|
|
2012-08-15 01:09:01 +04:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2011-10-03 04:52:17 +04:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2012-11-20 08:49:08 +04:00
|
|
|
|
2012-10-02 10:48:11 +04:00
|
|
|
#ifdef HAVE_STDINT_H
|
2011-10-03 04:52:17 +04:00
|
|
|
#include <stdint.h>
|
2012-10-02 10:48:11 +04:00
|
|
|
#endif
|
2012-08-15 01:09:01 +04:00
|
|
|
|
2012-11-20 08:49:08 +04:00
|
|
|
#include <winpr/crt.h>
|
|
|
|
|
2011-10-03 04:52:17 +04:00
|
|
|
#include <freerdp/codec/nsc.h>
|
2011-10-02 23:26:33 +04:00
|
|
|
|
2012-03-06 16:06:08 +04:00
|
|
|
#include "nsc_types.h"
|
2012-03-16 08:04:38 +04:00
|
|
|
#include "nsc_encode.h"
|
2011-10-03 05:07:07 +04:00
|
|
|
|
2012-03-18 19:25:07 +04:00
|
|
|
#include "nsc_sse2.h"
|
|
|
|
|
2012-03-06 16:06:08 +04:00
|
|
|
#ifndef NSC_INIT_SIMD
|
|
|
|
#define NSC_INIT_SIMD(_nsc_context) do { } while (0)
|
|
|
|
#endif
|
|
|
|
|
2012-03-06 14:52:28 +04:00
|
|
|
static void nsc_decode(NSC_CONTEXT* context)
|
2011-10-02 23:26:33 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
UINT16 x;
|
|
|
|
UINT16 y;
|
|
|
|
UINT16 rw;
|
|
|
|
BYTE shift;
|
|
|
|
BYTE* yplane;
|
|
|
|
BYTE* coplane;
|
|
|
|
BYTE* cgplane;
|
|
|
|
BYTE* aplane;
|
|
|
|
INT16 y_val;
|
|
|
|
INT16 co_val;
|
|
|
|
INT16 cg_val;
|
|
|
|
INT16 r_val;
|
|
|
|
INT16 g_val;
|
|
|
|
INT16 b_val;
|
|
|
|
BYTE* bmpdata;
|
2012-03-06 14:52:28 +04:00
|
|
|
|
2013-08-15 07:16:13 +04:00
|
|
|
bmpdata = context->BitmapData;
|
2012-03-06 14:52:28 +04:00
|
|
|
rw = ROUND_UP_TO(context->width, 8);
|
|
|
|
shift = context->nsc_stream.ColorLossLevel - 1; /* colorloss recovery + YCoCg shift */
|
|
|
|
|
2013-10-09 04:40:58 +04:00
|
|
|
WLog_Print(context->priv->log, WLOG_DEBUG, "NscDecode: width: %d height: %d ChromaSubSamplingLevel: %d",
|
|
|
|
context->width, context->height, context->nsc_stream.ChromaSubSamplingLevel);
|
|
|
|
|
2012-03-06 14:52:28 +04:00
|
|
|
for (y = 0; y < context->height; y++)
|
2011-10-02 23:26:33 +04:00
|
|
|
{
|
2012-03-06 14:52:28 +04:00
|
|
|
if (context->nsc_stream.ChromaSubSamplingLevel > 0)
|
2011-10-02 23:26:33 +04:00
|
|
|
{
|
2013-08-15 07:16:13 +04:00
|
|
|
yplane = context->priv->PlaneBuffers[0] + y * rw; /* Y */
|
|
|
|
coplane = context->priv->PlaneBuffers[1] + (y >> 1) * (rw >> 1); /* Co, supersampled */
|
|
|
|
cgplane = context->priv->PlaneBuffers[2] + (y >> 1) * (rw >> 1); /* Cg, supersampled */
|
2011-10-02 23:26:33 +04:00
|
|
|
}
|
2012-03-06 14:52:28 +04:00
|
|
|
else
|
2011-10-02 23:26:33 +04:00
|
|
|
{
|
2013-08-15 07:16:13 +04:00
|
|
|
yplane = context->priv->PlaneBuffers[0] + y * context->width; /* Y */
|
|
|
|
coplane = context->priv->PlaneBuffers[1] + y * context->width; /* Co */
|
|
|
|
cgplane = context->priv->PlaneBuffers[2] + y * context->width; /* Cg */
|
2011-10-02 23:26:33 +04:00
|
|
|
}
|
2013-08-15 04:57:16 +04:00
|
|
|
|
2013-08-15 07:16:13 +04:00
|
|
|
aplane = context->priv->PlaneBuffers[3] + y * context->width; /* A */
|
2013-08-15 04:57:16 +04:00
|
|
|
|
2012-03-06 14:52:28 +04:00
|
|
|
for (x = 0; x < context->width; x++)
|
2011-10-02 23:26:33 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
y_val = (INT16) *yplane;
|
|
|
|
co_val = (INT16) (INT8) (*coplane << shift);
|
|
|
|
cg_val = (INT16) (INT8) (*cgplane << shift);
|
2012-03-06 14:52:28 +04:00
|
|
|
r_val = y_val + co_val - cg_val;
|
|
|
|
g_val = y_val + cg_val;
|
|
|
|
b_val = y_val - co_val - cg_val;
|
|
|
|
*bmpdata++ = MINMAX(b_val, 0, 0xFF);
|
|
|
|
*bmpdata++ = MINMAX(g_val, 0, 0xFF);
|
|
|
|
*bmpdata++ = MINMAX(r_val, 0, 0xFF);
|
|
|
|
*bmpdata++ = *aplane;
|
|
|
|
yplane++;
|
|
|
|
coplane += (context->nsc_stream.ChromaSubSamplingLevel > 0 ? x % 2 : 1);
|
|
|
|
cgplane += (context->nsc_stream.ChromaSubSamplingLevel > 0 ? x % 2 : 1);
|
|
|
|
aplane++;
|
2011-10-02 23:26:33 +04:00
|
|
|
}
|
2011-10-03 05:07:07 +04:00
|
|
|
}
|
2011-10-02 23:26:33 +04:00
|
|
|
}
|
|
|
|
|
2013-08-15 04:57:16 +04:00
|
|
|
static void nsc_rle_decode(BYTE* in, BYTE* out, UINT32 originalSize)
|
2011-10-02 23:26:33 +04:00
|
|
|
{
|
2012-10-09 11:26:39 +04:00
|
|
|
UINT32 len;
|
|
|
|
UINT32 left;
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE value;
|
2011-10-03 05:07:07 +04:00
|
|
|
|
2013-08-15 04:57:16 +04:00
|
|
|
left = originalSize;
|
|
|
|
|
2012-03-06 14:52:28 +04:00
|
|
|
while (left > 4)
|
2011-10-02 23:26:33 +04:00
|
|
|
{
|
2012-03-06 14:52:28 +04:00
|
|
|
value = *in++;
|
2011-10-03 05:07:07 +04:00
|
|
|
|
2012-03-06 14:52:28 +04:00
|
|
|
if (left == 5)
|
2011-10-02 23:26:33 +04:00
|
|
|
{
|
2012-03-06 14:52:28 +04:00
|
|
|
*out++ = value;
|
|
|
|
left--;
|
2011-10-02 23:26:33 +04:00
|
|
|
}
|
2012-03-06 14:52:28 +04:00
|
|
|
else if (value == *in)
|
2011-10-02 23:26:33 +04:00
|
|
|
{
|
2012-03-06 14:52:28 +04:00
|
|
|
in++;
|
2013-08-15 04:57:16 +04:00
|
|
|
|
2012-03-06 14:52:28 +04:00
|
|
|
if (*in < 0xFF)
|
2011-10-02 23:26:33 +04:00
|
|
|
{
|
2012-10-09 11:26:39 +04:00
|
|
|
len = (UINT32) *in++;
|
2012-03-06 14:52:28 +04:00
|
|
|
len += 2;
|
2011-10-02 23:26:33 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-03-06 14:52:28 +04:00
|
|
|
in++;
|
2012-10-09 11:26:39 +04:00
|
|
|
len = *((UINT32*) in);
|
2012-03-06 14:52:28 +04:00
|
|
|
in += 4;
|
2011-10-02 23:26:33 +04:00
|
|
|
}
|
2013-08-15 04:57:16 +04:00
|
|
|
|
|
|
|
FillMemory(out, len, value);
|
2012-03-07 07:42:37 +04:00
|
|
|
out += len;
|
2012-03-06 14:52:28 +04:00
|
|
|
left -= len;
|
2011-10-02 23:26:33 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-03-06 14:52:28 +04:00
|
|
|
*out++ = value;
|
|
|
|
left--;
|
2011-10-02 23:26:33 +04:00
|
|
|
}
|
|
|
|
}
|
2011-10-03 05:07:07 +04:00
|
|
|
|
2012-10-09 11:26:39 +04:00
|
|
|
*((UINT32*)out) = *((UINT32*)in);
|
2011-10-02 23:26:33 +04:00
|
|
|
}
|
|
|
|
|
2012-03-06 14:52:28 +04:00
|
|
|
static void nsc_rle_decompress_data(NSC_CONTEXT* context)
|
2011-10-02 23:26:33 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
UINT16 i;
|
|
|
|
BYTE* rle;
|
2013-08-15 04:57:16 +04:00
|
|
|
UINT32 planeSize;
|
|
|
|
UINT32 originalSize;
|
2012-03-05 14:34:29 +04:00
|
|
|
|
2012-03-06 14:52:28 +04:00
|
|
|
rle = context->nsc_stream.Planes;
|
2011-10-03 05:07:07 +04:00
|
|
|
|
|
|
|
for (i = 0; i < 4; i++)
|
2011-10-02 23:26:33 +04:00
|
|
|
{
|
2013-08-15 04:57:16 +04:00
|
|
|
originalSize = context->OrgByteCount[i];
|
|
|
|
planeSize = context->nsc_stream.PlaneByteCount[i];
|
2011-10-03 05:07:07 +04:00
|
|
|
|
2013-08-15 04:57:16 +04:00
|
|
|
if (planeSize == 0)
|
2013-08-15 07:16:13 +04:00
|
|
|
FillMemory(context->priv->PlaneBuffers[i], originalSize, 0xFF);
|
2013-08-15 04:57:16 +04:00
|
|
|
else if (planeSize < originalSize)
|
2013-08-15 07:16:13 +04:00
|
|
|
nsc_rle_decode(rle, context->priv->PlaneBuffers[i], originalSize);
|
2011-10-02 23:26:33 +04:00
|
|
|
else
|
2013-08-15 07:16:13 +04:00
|
|
|
CopyMemory(context->priv->PlaneBuffers[i], rle, originalSize);
|
2011-10-03 05:07:07 +04:00
|
|
|
|
2013-08-15 04:57:16 +04:00
|
|
|
rle += planeSize;
|
2011-10-02 23:26:33 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
static void nsc_stream_initialize(NSC_CONTEXT* context, wStream* s)
|
2011-10-02 23:26:33 +04:00
|
|
|
{
|
|
|
|
int i;
|
2011-10-03 05:07:07 +04:00
|
|
|
|
|
|
|
for (i = 0; i < 4; i++)
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT32(s, context->nsc_stream.PlaneByteCount[i]);
|
2011-10-03 05:07:07 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, context->nsc_stream.ColorLossLevel);
|
|
|
|
Stream_Read_UINT8(s, context->nsc_stream.ChromaSubSamplingLevel);
|
2013-04-30 06:35:15 +04:00
|
|
|
Stream_Seek(s, 2);
|
2011-10-03 05:07:07 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
context->nsc_stream.Planes = Stream_Pointer(s);
|
2011-10-02 23:26:33 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
static void nsc_context_initialize(NSC_CONTEXT* context, wStream* s)
|
2011-10-02 23:26:33 +04:00
|
|
|
{
|
|
|
|
int i;
|
2012-10-09 11:26:39 +04:00
|
|
|
UINT32 length;
|
|
|
|
UINT32 tempWidth;
|
|
|
|
UINT32 tempHeight;
|
2012-03-05 13:32:14 +04:00
|
|
|
|
2011-10-02 23:26:33 +04:00
|
|
|
nsc_stream_initialize(context, s);
|
2012-03-05 13:32:14 +04:00
|
|
|
length = context->width * context->height * 4;
|
2013-08-15 04:57:16 +04:00
|
|
|
|
2013-08-15 07:16:13 +04:00
|
|
|
if (!context->BitmapData)
|
2012-03-05 13:32:14 +04:00
|
|
|
{
|
2013-08-15 07:16:13 +04:00
|
|
|
context->BitmapData = malloc(length + 16);
|
|
|
|
ZeroMemory(context->BitmapData, length + 16);
|
|
|
|
context->BitmapDataLength = length;
|
2012-03-05 13:32:14 +04:00
|
|
|
}
|
2013-08-15 07:16:13 +04:00
|
|
|
else if (length > context->BitmapDataLength)
|
2012-03-05 13:32:14 +04:00
|
|
|
{
|
2013-08-15 07:16:13 +04:00
|
|
|
context->BitmapData = realloc(context->BitmapData, length + 16);
|
|
|
|
context->BitmapDataLength = length;
|
2012-03-05 13:32:14 +04:00
|
|
|
}
|
2011-10-03 05:07:07 +04:00
|
|
|
|
2012-03-06 14:52:28 +04:00
|
|
|
tempWidth = ROUND_UP_TO(context->width, 8);
|
|
|
|
tempHeight = ROUND_UP_TO(context->height, 2);
|
2013-08-15 04:57:16 +04:00
|
|
|
|
2012-03-06 14:52:28 +04:00
|
|
|
/* The maximum length a decoded plane can reach in all cases */
|
|
|
|
length = tempWidth * tempHeight;
|
2013-08-15 04:57:16 +04:00
|
|
|
|
2013-08-15 07:16:13 +04:00
|
|
|
if (length > context->priv->PlaneBuffersLength)
|
2012-03-06 14:52:28 +04:00
|
|
|
{
|
|
|
|
for (i = 0; i < 4; i++)
|
2013-08-15 07:16:13 +04:00
|
|
|
context->priv->PlaneBuffers[i] = (BYTE*) realloc(context->priv->PlaneBuffers[i], length);
|
2013-08-15 04:57:16 +04:00
|
|
|
|
2013-08-15 07:16:13 +04:00
|
|
|
context->priv->PlaneBuffersLength = length;
|
2012-03-06 14:52:28 +04:00
|
|
|
}
|
|
|
|
|
2011-10-03 05:07:07 +04:00
|
|
|
for (i = 0; i < 4; i++)
|
2013-08-15 07:16:13 +04:00
|
|
|
{
|
|
|
|
context->OrgByteCount[i] = context->width * context->height;
|
|
|
|
}
|
2011-10-03 05:07:07 +04:00
|
|
|
|
2012-03-05 14:34:29 +04:00
|
|
|
if (context->nsc_stream.ChromaSubSamplingLevel > 0) /* [MS-RDPNSC] 2.2 */
|
2011-10-02 23:26:33 +04:00
|
|
|
{
|
|
|
|
context->OrgByteCount[0] = tempWidth * context->height;
|
2012-03-06 14:52:28 +04:00
|
|
|
context->OrgByteCount[1] = (tempWidth >> 1) * (tempHeight >> 1);
|
|
|
|
context->OrgByteCount[2] = context->OrgByteCount[1];
|
2011-10-02 23:26:33 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-06 18:42:57 +04:00
|
|
|
static void nsc_profiler_print(NSC_CONTEXT* context)
|
|
|
|
{
|
|
|
|
PROFILER_PRINT_HEADER;
|
|
|
|
|
|
|
|
PROFILER_PRINT(context->priv->prof_nsc_rle_decompress_data);
|
|
|
|
PROFILER_PRINT(context->priv->prof_nsc_decode);
|
|
|
|
PROFILER_PRINT(context->priv->prof_nsc_rle_compress_data);
|
|
|
|
PROFILER_PRINT(context->priv->prof_nsc_encode);
|
|
|
|
|
|
|
|
PROFILER_PRINT_FOOTER;
|
|
|
|
}
|
|
|
|
|
2013-08-15 07:16:13 +04:00
|
|
|
NSC_CONTEXT* nsc_context_new(void)
|
|
|
|
{
|
|
|
|
UINT8 i;
|
|
|
|
NSC_CONTEXT* context;
|
|
|
|
|
|
|
|
context = (NSC_CONTEXT*) calloc(1, sizeof(NSC_CONTEXT));
|
|
|
|
context->priv = (NSC_CONTEXT_PRIV*) calloc(1, sizeof(NSC_CONTEXT_PRIV));
|
|
|
|
|
2013-10-09 04:40:58 +04:00
|
|
|
WLog_Init();
|
|
|
|
|
|
|
|
context->priv->log = WLog_Get("com.freerdp.codec.nsc");
|
|
|
|
WLog_OpenAppender(context->priv->log);
|
|
|
|
|
2013-08-15 07:16:13 +04:00
|
|
|
for (i = 0; i < 5; ++i)
|
|
|
|
{
|
|
|
|
context->priv->PlaneBuffers[i] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
context->BitmapData = NULL;
|
|
|
|
|
|
|
|
context->decode = nsc_decode;
|
|
|
|
context->encode = nsc_encode;
|
|
|
|
|
|
|
|
context->priv->PlanePool = BufferPool_New(TRUE, 0, 16);
|
|
|
|
|
|
|
|
PROFILER_CREATE(context->priv->prof_nsc_rle_decompress_data, "nsc_rle_decompress_data");
|
|
|
|
PROFILER_CREATE(context->priv->prof_nsc_decode, "nsc_decode");
|
|
|
|
PROFILER_CREATE(context->priv->prof_nsc_rle_compress_data, "nsc_rle_compress_data");
|
|
|
|
PROFILER_CREATE(context->priv->prof_nsc_encode, "nsc_encode");
|
|
|
|
|
|
|
|
/* Default encoding parameters */
|
|
|
|
context->nsc_stream.ColorLossLevel = 3;
|
|
|
|
context->nsc_stream.ChromaSubSamplingLevel = 1;
|
|
|
|
|
|
|
|
/* init optimized methods */
|
|
|
|
NSC_INIT_SIMD(context);
|
|
|
|
|
|
|
|
return context;
|
|
|
|
}
|
|
|
|
|
2012-03-05 13:32:14 +04:00
|
|
|
void nsc_context_free(NSC_CONTEXT* context)
|
2011-10-02 23:26:33 +04:00
|
|
|
{
|
2012-03-06 14:52:28 +04:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
{
|
2013-08-15 07:16:13 +04:00
|
|
|
if (context->priv->PlaneBuffers[i])
|
2013-01-23 17:30:31 +04:00
|
|
|
{
|
2013-08-15 07:16:13 +04:00
|
|
|
free(context->priv->PlaneBuffers[i]);
|
|
|
|
context->priv->PlaneBuffers[i] = NULL;
|
2013-01-23 17:30:31 +04:00
|
|
|
}
|
2012-03-06 14:52:28 +04:00
|
|
|
}
|
2013-08-15 04:57:16 +04:00
|
|
|
|
2013-08-15 07:16:13 +04:00
|
|
|
if (context->BitmapData)
|
|
|
|
free(context->BitmapData);
|
|
|
|
|
|
|
|
BufferPool_Free(context->priv->PlanePool);
|
2012-03-06 18:42:57 +04:00
|
|
|
|
|
|
|
nsc_profiler_print(context);
|
|
|
|
PROFILER_FREE(context->priv->prof_nsc_rle_decompress_data);
|
|
|
|
PROFILER_FREE(context->priv->prof_nsc_decode);
|
|
|
|
PROFILER_FREE(context->priv->prof_nsc_rle_compress_data);
|
|
|
|
PROFILER_FREE(context->priv->prof_nsc_encode);
|
|
|
|
|
2012-10-09 07:21:26 +04:00
|
|
|
free(context->priv);
|
|
|
|
free(context);
|
2012-03-06 16:06:08 +04:00
|
|
|
}
|
|
|
|
|
2012-03-15 12:55:29 +04:00
|
|
|
void nsc_context_set_pixel_format(NSC_CONTEXT* context, RDP_PIXEL_FORMAT pixel_format)
|
|
|
|
{
|
|
|
|
context->pixel_format = pixel_format;
|
2013-08-15 04:57:16 +04:00
|
|
|
|
2012-03-15 12:55:29 +04:00
|
|
|
switch (pixel_format)
|
|
|
|
{
|
|
|
|
case RDP_PIXEL_FORMAT_B8G8R8A8:
|
|
|
|
case RDP_PIXEL_FORMAT_R8G8B8A8:
|
2012-03-16 08:04:38 +04:00
|
|
|
context->bpp = 32;
|
2012-03-15 12:55:29 +04:00
|
|
|
break;
|
2013-08-15 04:57:16 +04:00
|
|
|
|
2012-03-15 12:55:29 +04:00
|
|
|
case RDP_PIXEL_FORMAT_B8G8R8:
|
|
|
|
case RDP_PIXEL_FORMAT_R8G8B8:
|
2012-03-16 08:04:38 +04:00
|
|
|
context->bpp = 24;
|
2012-03-15 12:55:29 +04:00
|
|
|
break;
|
2013-08-15 04:57:16 +04:00
|
|
|
|
2012-03-15 12:55:29 +04:00
|
|
|
case RDP_PIXEL_FORMAT_B5G6R5_LE:
|
|
|
|
case RDP_PIXEL_FORMAT_R5G6B5_LE:
|
2012-03-16 08:04:38 +04:00
|
|
|
context->bpp = 16;
|
2012-03-15 12:55:29 +04:00
|
|
|
break;
|
2013-08-15 04:57:16 +04:00
|
|
|
|
2012-03-15 12:55:29 +04:00
|
|
|
case RDP_PIXEL_FORMAT_P4_PLANER:
|
2012-03-16 08:04:38 +04:00
|
|
|
context->bpp = 4;
|
2012-03-15 12:55:29 +04:00
|
|
|
break;
|
2013-08-15 04:57:16 +04:00
|
|
|
|
2012-03-15 12:55:29 +04:00
|
|
|
case RDP_PIXEL_FORMAT_P8:
|
2012-03-16 08:04:38 +04:00
|
|
|
context->bpp = 8;
|
2012-03-15 12:55:29 +04:00
|
|
|
break;
|
2013-08-15 04:57:16 +04:00
|
|
|
|
2012-03-15 12:55:29 +04:00
|
|
|
default:
|
2012-03-16 08:04:38 +04:00
|
|
|
context->bpp = 0;
|
2012-03-15 12:55:29 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-15 04:57:16 +04:00
|
|
|
void nsc_process_message(NSC_CONTEXT* context, UINT16 bpp, UINT16 width, UINT16 height, BYTE* data, UINT32 length)
|
2011-10-02 23:26:33 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2012-03-05 13:32:14 +04:00
|
|
|
|
2013-05-09 01:48:30 +04:00
|
|
|
s = Stream_New(data, length);
|
2012-03-05 13:32:14 +04:00
|
|
|
context->bpp = bpp;
|
|
|
|
context->width = width;
|
|
|
|
context->height = height;
|
2011-10-02 23:26:33 +04:00
|
|
|
nsc_context_initialize(context, s);
|
2013-05-09 01:48:30 +04:00
|
|
|
Stream_Free(s, FALSE);
|
2011-10-02 23:26:33 +04:00
|
|
|
|
|
|
|
/* RLE decode */
|
2012-03-06 18:42:57 +04:00
|
|
|
PROFILER_ENTER(context->priv->prof_nsc_rle_decompress_data);
|
2011-10-02 23:26:33 +04:00
|
|
|
nsc_rle_decompress_data(context);
|
2012-03-06 18:42:57 +04:00
|
|
|
PROFILER_EXIT(context->priv->prof_nsc_rle_decompress_data);
|
2011-10-02 23:26:33 +04:00
|
|
|
|
2012-03-06 14:52:28 +04:00
|
|
|
/* Colorloss recover, Chroma supersample and AYCoCg to ARGB Conversion in one step */
|
2012-03-06 18:42:57 +04:00
|
|
|
PROFILER_ENTER(context->priv->prof_nsc_decode);
|
2012-03-06 16:06:08 +04:00
|
|
|
context->decode(context);
|
2012-03-06 18:42:57 +04:00
|
|
|
PROFILER_EXIT(context->priv->prof_nsc_decode);
|
2011-10-02 23:26:33 +04:00
|
|
|
}
|