Merge pull request #485 from llyzs/nsc

NSCodec decoder improvement
This commit is contained in:
Marc-André Moreau 2012-03-06 19:46:32 -08:00
commit 98514568d6
12 changed files with 631 additions and 323 deletions

View File

@ -457,16 +457,14 @@ void wf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits
}
else if (surface_bits_command->codecID == CODEC_ID_NSCODEC)
{
nsc_context->width = surface_bits_command->width;
nsc_context->height = surface_bits_command->height;
nsc_process_message(nsc_context, surface_bits_command->bitmapData, surface_bits_command->bitmapDataLength);
nsc_process_message(nsc_context, surface_bits_command->bpp, surface_bits_command->width, surface_bits_command->height,
surface_bits_command->bitmapData, surface_bits_command->bitmapDataLength);
wfi->image->_bitmap.width = surface_bits_command->width;
wfi->image->_bitmap.height = surface_bits_command->height;
wfi->image->_bitmap.bpp = surface_bits_command->bpp;
wfi->image->_bitmap.data = (uint8*) xrealloc(wfi->image->_bitmap.data, wfi->image->_bitmap.width * wfi->image->_bitmap.height * 4);
freerdp_image_flip(nsc_context->bmpdata, wfi->image->_bitmap.data, wfi->image->_bitmap.width, wfi->image->_bitmap.height, 32);
BitBlt(wfi->primary->hdc, surface_bits_command->destLeft, surface_bits_command->destTop, surface_bits_command->width, surface_bits_command->height, wfi->image->hdc, 0, 0, GDI_SRCCOPY);
nsc_context_destroy(nsc_context);
}
else if (surface_bits_command->codecID == CODEC_ID_NONE)
{

View File

@ -928,9 +928,8 @@ void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits
}
else if (surface_bits_command->codecID == CODEC_ID_NSCODEC)
{
nsc_context->width = surface_bits_command->width;
nsc_context->height = surface_bits_command->height;
nsc_process_message(nsc_context, surface_bits_command->bitmapData, surface_bits_command->bitmapDataLength);
nsc_process_message(nsc_context, surface_bits_command->bpp, surface_bits_command->width, surface_bits_command->height,
surface_bits_command->bitmapData, surface_bits_command->bitmapDataLength);
XSetFunction(xfi->display, xfi->gc, GXcopy);
XSetFillStyle(xfi->display, xfi->gc, FillSolid);
@ -959,7 +958,6 @@ void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits
surface_bits_command->width, surface_bits_command->height);
XSetClipMask(xfi->display, xfi->gc, None);
nsc_context_destroy(nsc_context);
}
else if (surface_bits_command->codecID == CODEC_ID_NONE)
{

View File

@ -641,11 +641,13 @@ uint32 xf_detect_cpu()
*/
boolean xf_post_connect(freerdp* instance)
{
uint32 cpu;
xfInfo* xfi;
XGCValues gcv;
rdpCache* cache;
rdpChannels* channels;
RFX_CONTEXT* rfx_context = NULL;
NSC_CONTEXT* nsc_context = NULL;
xfi = ((xfContext*) instance->context)->xfi;
cache = instance->context->cache;
@ -688,16 +690,20 @@ boolean xf_post_connect(freerdp* instance)
}
if (instance->settings->ns_codec)
xfi->nsc_context = (void*) nsc_context_new();
{
nsc_context = (void*) nsc_context_new();
xfi->nsc_context = nsc_context;
}
}
if (rfx_context)
{
#ifdef WITH_SSE2
/* detect only if needed */
rfx_context_set_cpu_opt(rfx_context, xf_detect_cpu());
/* detect only if needed */
cpu = xf_detect_cpu();
if (rfx_context)
rfx_context_set_cpu_opt(rfx_context, cpu);
if (nsc_context)
nsc_context_set_cpu_opt(nsc_context, cpu);
#endif
}
xfi->width = instance->settings->width;
xfi->height = instance->settings->height;
@ -1003,6 +1009,12 @@ void xf_window_free(xfInfo* xfi)
xfi->rfx_context = NULL;
}
if (xfi->nsc_context)
{
nsc_context_free(xfi->nsc_context);
xfi->nsc_context = NULL;
}
freerdp_clrconv_free(xfi->clrconv);
if (xfi->hdc)

View File

@ -62,6 +62,8 @@ add_executable(test_freerdp
test_drdynvc.h
test_rfx.c
test_rfx.h
test_nsc.c
test_nsc.h
test_sspi.c
test_sspi.h
test_freerdp.c

View File

@ -37,6 +37,7 @@
#include "test_cliprdr.h"
#include "test_drdynvc.h"
#include "test_rfx.h"
#include "test_nsc.h"
#include "test_freerdp.h"
#include "test_rail.h"
#include "test_pcap.h"
@ -138,6 +139,7 @@ static test_suite suites[] =
{ "per", add_per_suite },
{ "rail", add_rail_suite },
{ "rfx", add_rfx_suite },
{ "nsc", add_nsc_suite },
{ "sspi", add_sspi_suite },
{ "stream", add_stream_suite },
{ "utils", add_utils_suite },

314
cunit/test_nsc.c Normal file
View File

@ -0,0 +1,314 @@
/**
* FreeRDP: A Remote Desktop Protocol Client
* NSCodec Library Unit Tests
*
* Copyright 2012 Vic Lee
*
* 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.
*/
/**
* The sample data comes from [MS-RDPRFX] 4.2.3, which is decoded into three
* vertical bands in red (21x64), green (23x64) and blue(20x64) color.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <freerdp/types.h>
#include <freerdp/constants.h>
#include <freerdp/utils/print.h>
#include <freerdp/utils/memory.h>
#include <freerdp/utils/hexdump.h>
#include <freerdp/codec/nsc.h>
#include "test_nsc.h"
static const uint8 nsc_data[] =
{
0x71, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
0x03, 0x01, 0x00, 0x00, 0x63, 0x63, 0x01, 0x64, 0x64, 0x00, 0x63, 0x63, 0x02, 0x64, 0x64, 0x00,
0x63, 0x63, 0x00, 0x64, 0x64, 0x01, 0x63, 0x63, 0x01, 0x64, 0x64, 0x01, 0x63, 0x63, 0x01, 0x64,
0x64, 0x00, 0x63, 0x63, 0x00, 0x64, 0x64, 0x01, 0x63, 0x63, 0x00, 0x64, 0x64, 0x0c, 0x63, 0x63,
0x00, 0x64, 0x64, 0x0c, 0x63, 0x63, 0x00, 0x64, 0x64, 0x0c, 0x63, 0x63, 0x00, 0x64, 0x64, 0x0c,
0x63, 0x64, 0x64, 0x04, 0x63, 0x64, 0x63, 0x63, 0x00, 0x64, 0x64, 0x03, 0x63, 0x64, 0x64, 0x03,
0x63, 0x63, 0x00, 0x64, 0x63, 0x63, 0x00, 0x64, 0x64, 0x03, 0x65, 0x63, 0x64, 0x64, 0x01, 0x63,
0x64, 0x64, 0x00, 0x65, 0x64, 0x64, 0x06, 0x63, 0x64, 0x64, 0x00, 0x63, 0x63, 0x00, 0x64, 0x64,
0x04, 0x64, 0x65, 0x65, 0x65, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x37, 0x37, 0x19, 0x36,
0x37, 0x37, 0x06, 0x37, 0x37, 0x37, 0x37, 0xff, 0xff, 0x90, 0xff, 0xff, 0xff, 0xff
};
static const uint8 nsc_stress_data[] =
{
0xec, 0x04, 0x00, 0x00, 0xfb, 0x04, 0x00, 0x00, 0x74, 0x03, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00
, 0x03, 0x00, 0x00, 0x00, 0x94, 0x94, 0x0f, 0xa2, 0xb2, 0x8e, 0x61, 0x62, 0x82, 0x9b, 0xa8, 0xb0
, 0xb3, 0xb3, 0x00, 0xb0, 0xa8, 0x9b, 0x82, 0x62, 0x61, 0x8e, 0xb2, 0xa3, 0x94, 0x94, 0x1e, 0x98
, 0xae, 0x98, 0x61, 0x73, 0x93, 0x9b, 0xa0, 0xa5, 0xaa, 0xad, 0xaf, 0xaf, 0x00, 0xad, 0xaa, 0xa5
, 0xa0, 0x9b, 0x93, 0x73, 0x61, 0x98, 0xae, 0x98, 0x94, 0x94, 0x1b, 0x9c, 0xaf, 0x72, 0x62, 0x8b
, 0x89, 0x8a, 0x92, 0x9c, 0xa2, 0xa8, 0xab, 0xac, 0xac, 0x00, 0xab, 0xa8, 0xa2, 0x9c, 0x92, 0x8a
, 0x89, 0x8b, 0x63, 0x72, 0xaf, 0x9c, 0x94, 0x94, 0x19, 0x9f, 0xab, 0x63, 0x73, 0x7d, 0x79, 0x82
, 0x89, 0x8f, 0x98, 0x9f, 0xa4, 0xa6, 0xa7, 0xa7, 0x00, 0xa6, 0xa4, 0x9f, 0x98, 0x8f, 0x89, 0x82
, 0x79, 0x7d, 0x73, 0x63, 0xab, 0x9f, 0x94, 0x94, 0x17, 0x9c, 0xad, 0x58, 0x71, 0x6a, 0x6f, 0x7a
, 0x81, 0x86, 0x8b, 0x92, 0x99, 0x9e, 0xa1, 0xa2, 0xa2, 0x00, 0x9f, 0x9c, 0x97, 0x91, 0x8b, 0x86
, 0x81, 0x7a, 0x6f, 0x6a, 0x72, 0x58, 0xad, 0x9c, 0x94, 0x94, 0x15, 0x98, 0xb0, 0x61, 0x68, 0x5a
, 0x64, 0x70, 0x78, 0x7f, 0x84, 0x87, 0x8c, 0x92, 0x97, 0x97, 0x00, 0x91, 0x8a, 0x82, 0x7e, 0x7a
, 0x79, 0x79, 0x00, 0x7c, 0x7d, 0x78, 0x70, 0x64, 0x5a, 0x68, 0x61, 0xb0, 0x98, 0x94, 0x94, 0x14
, 0xae, 0x71, 0x5f, 0x51, 0x5a, 0x65, 0x6f, 0x78, 0x7e, 0x83, 0x86, 0x88, 0x8a, 0x88, 0x7d, 0x76
, 0x80, 0x8a, 0x8d, 0x8a, 0x83, 0x77, 0x6c, 0x70, 0x75, 0x6f, 0x65, 0x5a, 0x51, 0x5f, 0x71, 0xae
, 0x94, 0x94, 0x13, 0xa3, 0x98, 0x54, 0x4d, 0x4f, 0x5a, 0x65, 0x6f, 0x77, 0x7d, 0x81, 0x83, 0x82
, 0x7f, 0x77, 0x87, 0x9f, 0xa1, 0x9e, 0x9b, 0x97, 0x94, 0x90, 0x8b, 0x7b, 0x6e, 0x6f, 0x65, 0x5b
, 0x4f, 0x4d, 0x54, 0x98, 0xa3, 0x94, 0x94, 0x11, 0x96, 0xb2, 0x5c, 0x51, 0x44, 0x4d, 0x50, 0x59
, 0x66, 0x70, 0x75, 0x76, 0x73, 0x6b, 0x6e, 0x70, 0xae,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a2, 0x94, 0x94, 0x0e, 0x9a, 0xaa, 0x68, 0x93, 0x74, 0x6d, 0x6b, 0x6e
, 0x71, 0x6c, 0x61, 0x65, 0x71, 0x7e, 0x88, 0x90, 0x96, 0x99, 0x9b, 0x8c, 0x64, 0xaa, 0xa8, 0xa0
, 0x97, 0x8b, 0x7f, 0x75, 0x6c, 0x62, 0x6c, 0x5c, 0x6b, 0x74, 0x93, 0x69, 0xaa, 0x9a, 0x94, 0x94
, 0x0f, 0xaf, 0x59, 0xab, 0x83, 0x79, 0x73, 0x74, 0x75, 0x75, 0x00, 0x64, 0x61, 0x66, 0x73, 0x7d
, 0x85, 0x8a, 0x8d, 0x8e, 0x8d, 0x68, 0x93, 0x9c, 0x92, 0x88, 0x7d, 0x72, 0x6c, 0x63, 0x5c, 0x6e
, 0x64, 0x75, 0x83, 0xab, 0x59, 0xaf, 0x94, 0x94, 0x10, 0xa2, 0x8e, 0x82, 0xa1, 0x87, 0x80, 0x7d
, 0x7d, 0x01, 0x6f, 0x60, 0x5a, 0x66, 0x6f, 0x77, 0x7c, 0x80, 0x80, 0x01, 0x74, 0x80, 0x94, 0x7e
, 0x70, 0x70, 0x01, 0x6e, 0x6a, 0x64, 0x66, 0x76, 0x82, 0xa1, 0x82, 0x8e, 0xa2, 0x94, 0x94, 0x10
, 0x96, 0xb2, 0x5a, 0xba, 0x9a, 0x8f, 0x89, 0x87, 0x87, 0x00, 0x7c, 0x65, 0x4e, 0x59, 0x61, 0x68
, 0x6c, 0x70, 0x71, 0x6d, 0x75, 0x74, 0x7f, 0x7c, 0x85, 0x88, 0x88, 0x00, 0x87, 0x84, 0x7f, 0x7e
, 0x87, 0x98, 0xba, 0x5a, 0xb2, 0x96, 0x94, 0x94, 0x11, 0xa2, 0x98, 0x6e, 0xbe, 0x9f, 0x97, 0x93
, 0x91, 0x8b, 0x76, 0x54, 0x49, 0x4f, 0x57, 0x5b, 0x5d, 0x5c, 0x62, 0x76, 0x85, 0x8f, 0x90, 0x91
, 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0xd7, 0xd6, 0xd6, 0x00, 0xd7, 0xda, 0xdf, 0xe4, 0xe2, 0xc5, 0x73, 0x35
, 0x0d, 0x00, 0x00, 0x22, 0x14, 0x30, 0x51, 0x7e, 0xad, 0xcb, 0xd3, 0xd8, 0xd8, 0x00, 0xd3, 0xcb
, 0xac, 0x7c, 0x50, 0x30, 0x14, 0x00, 0x00, 0x26, 0x04, 0x16, 0x26, 0x33, 0x36, 0x41, 0x41, 0x00
, 0x36, 0x33, 0x26, 0x16, 0x04, 0x00, 0x00, 0xff, 0xf7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
, 0x3a, 0x3a, 0x0f, 0x3b, 0x3c, 0x39, 0x33, 0x2d, 0x28, 0x25, 0x23, 0x21, 0x20, 0x20, 0x00, 0x21
, 0x23, 0x25, 0x28, 0x2c, 0x32, 0x39, 0x3c, 0x3b, 0x3a, 0x3a, 0x1e, 0x3b, 0x3c, 0x3a, 0x32, 0x2b
, 0x26, 0x25, 0x24, 0x23, 0x22, 0x21, 0x20, 0x20, 0x00, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x2b
, 0x32, 0x3a, 0x3c, 0x3b, 0x3a, 0x3a, 0x1b, 0x3b, 0x3c, 0x36, 0x2d, 0x27, 0x27, 0x01, 0x25, 0x24
, 0x23, 0x22, 0x22, 0x00, 0x21, 0x21, 0x00, 0x22, 0x22, 0x00, 0x23, 0x24, 0x25, 0x27, 0x27, 0x01
, 0x2d, 0x36, 0x3c, 0x3b, 0x3a, 0x3a, 0x19, 0x3b, 0x3b, 0x00, 0x33, 0x2b, 0x29, 0x28, 0x28, 0x00
, 0x27, 0x25, 0x24, 0x23, 0x23, 0x00, 0x22, 0x22, 0x02, 0x23, 0x23, 0x00, 0x24, 0x25, 0x27, 0x28
, 0x28, 0x00, 0x29, 0x2b, 0x33, 0x3b, 0x3b, 0x00, 0x3a, 0x3a, 0x17, 0x3b, 0x3b, 0x00, 0x32, 0x2b
, 0x2c, 0x2a, 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e, 0x2e, 0x00, 0x2d, 0x2d, 0x00
, 0x2b, 0x29, 0x28, 0x31, 0x0e, 0x17, 0x17, 0x00, 0x18, 0x19, 0x1a, 0x1a, 0x02, 0x15, 0x31, 0x2b
, 0x2c, 0x2d, 0x2f, 0x30, 0x31, 0x2e, 0x39, 0x3b, 0x3a, 0x3a, 0x10, 0x3c, 0x33, 0x2f, 0x32, 0x30
, 0x31, 0x30, 0x2a, 0x2a, 0x02, 0x29, 0x28, 0x29, 0x2b, 0x31, 0x01, 0x13, 0x13, 0x00, 0x14, 0x15
, 0x18, 0x19, 0x1a, 0x1a, 0x01, 0x39, 0x2c, 0x2c, 0x00, 0x2d, 0x2f, 0x30, 0x32, 0x2f, 0x32, 0x3c
, 0x3a, 0x3a, 0x0f, 0x3b, 0x3b, 0x00, 0x2f, 0x32, 0x32, 0x00, 0x31, 0x31, 0x00, 0x32, 0x2a, 0x2b
, 0x2b, 0x00, 0x2a, 0x29, 0x2a, 0x2e, 0x30, 0x31, 0x35, 0x11, 0x0f, 0x10, 0x12, 0x14, 0x17, 0x19
, 0x1a, 0x1a, 0x00, 0x04, 0x2d, 0x2c, 0x2d, 0x2f, 0x31, 0x32, 0x32, 0x00, 0x2f, 0x3b, 0x3b, 0x00
, 0x3a, 0x3a, 0x0e, 0x3b, 0x38, 0x30, 0x33, 0x32, 0x31, 0x30, 0x31, 0x2b, 0x2b, 0x00, 0x2a, 0x29
, 0x2a, 0x2e, 0x31, 0x33, 0x32, 0x32, 0x00, 0x0e, 0x0b, 0x0d, 0x0f, 0x11, 0x13, 0x17, 0x1a, 0x1a
, 0x00, 0x11, 0x30, 0x2d, 0x2e, 0x2f, 0x31, 0x32, 0x33, 0x30, 0x38, 0x3b, 0x3a, 0x3a, 0x0e, 0x3b
, 0x35, 0x31, 0x33, 0x32, 0x31, 0x30, 0x31, 0x2e, 0x2b, 0x29, 0x29, 0x00, 0x2c, 0x30, 0x32, 0x34
, 0x35, 0x33, 0x06, 0x09, 0x0a, 0x0c, 0x0f, 0x12, 0x15, 0x19, 0x1b, 0x1a, 0x36, 0x2e, 0x2e, 0x00
, 0x30, 0x31, 0x32, 0x33, 0x31, 0x35, 0x3b, 0x3a, 0x3a, 0x0e, 0x3c, 0x33, 0x32, 0x34, 0x32, 0x31
, 0x30, 0x30, 0x01, 0x2a, 0x29, 0x2a, 0x2e, 0x32, 0x34, 0x36, 0x38, 0x34, 0x3a, 0x0a, 0x0a, 0x00
, 0x05, 0x3e, 0x39, 0x3a, 0x3f, 0x07, 0x14, 0x02, 0x2e, 0x2e, 0x00, 0x30, 0x31, 0x32, 0x34, 0x32
, 0x33, 0x3c, 0x3a, 0x3a, 0x0e, 0x3c, 0x31, 0x33, 0x34, 0x33, 0x32, 0x30, 0x30, 0x00, 0x31, 0x2a
, 0x29, 0x2b, 0x30, 0x32, 0x35, 0x37, 0x39, 0x35, 0x33, 0x05, 0x35, 0x32, 0x36, 0x3a, 0x3b, 0x3a
, 0x37, 0x36, 0x34, 0x2f, 0x2f, 0x00, 0x30, 0x32, 0x33, 0x34, 0x33, 0x31, 0x3c, 0x3a, 0x3a, 0x0e
, 0x3c, 0x31, 0x34, 0x34, 0x00, 0x33, 0x32, 0x31, 0x30, 0x31, 0x2a, 0x28, 0x2b, 0x30, 0x33, 0x36
, 0x38, 0x39, 0x38, 0x30, 0x31, 0x39, 0x03, 0x06, 0x07, 0x08, 0x09, 0x08, 0x04, 0x3e, 0x33, 0x30
, 0x31, 0x32, 0x33, 0x34, 0x34, 0x00, 0x31, 0x3c, 0x3a, 0x3a, 0x0e, 0x3c, 0x32, 0x35, 0x36, 0x34
, 0x33, 0x31, 0x30, 0x30, 0x00, 0x31, 0x2e, 0x2a, 0x2d, 0x31, 0x33, 0x34, 0x34, 0x00, 0x33, 0x30
, 0x3a, 0x06, 0x06, 0x01, 0x07, 0x08, 0x09, 0x09, 0x00, 0x08, 0x05, 0x38, 0x31, 0x31, 0x00, 0x33
, 0x34, 0x36, 0x35, 0x32, 0x3c, 0x3a, 0x3a, 0x0e, 0x3c, 0x33, 0x38, 0x38, 0x00, 0x36, 0x35, 0x33
, 0x32, 0x31, 0x3a, 0x3e, 0x36, 0x34, 0x33, 0x33, 0x01, 0x35, 0x09, 0x0a, 0x35, 0x05, 0x06, 0x07
, 0x07, 0x00, 0x08, 0x09, 0x09, 0x00, 0x07, 0x04, 0x3c, 0x33, 0x33, 0x00, 0x35, 0x36, 0x38, 0x38
, 0x00, 0x33, 0x3c, 0x3a, 0x3a, 0x0e, 0x3c, 0x34, 0x39, 0x38, 0x37, 0x36, 0x34, 0x33, 0x33, 0x00
, 0x3e, 0x16, 0x17, 0x10, 0x0b, 0x0b, 0x00, 0x11, 0x19, 0x19, 0x00, 0x15, 0x35, 0x03, 0x06, 0x07
, 0x07, 0x00, 0x08, 0x09, 0x09, 0x00, 0x06, 0x04, 0x00, 0x36, 0x35, 0x36, 0x37, 0x38, 0x39, 0x34
, 0x3c, 0x3a, 0x3a, 0x0e, 0x3b, 0x36, 0x3a, 0x39, 0x37, 0x36, 0x35, 0x34, 0x34, 0x00, 0x36, 0x11
, 0x15, 0x16, 0x17, 0x17, 0x00, 0x18, 0x18, 0x02, 0x3d, 0x3f, 0x07, 0x07, 0x00, 0x08, 0x09, 0x09
, 0x00, 0x08, 0x05, 0x03, 0x01, 0x39, 0x36, 0x36, 0x00, 0x37, 0x39, 0x39, 0x00, 0x36, 0x3b, 0x3a
, 0x3a, 0x0e, 0x3b, 0x38, 0x39, 0x39, 0x00, 0x38, 0x37, 0x36, 0x35, 0x35, 0x01, 0x09, 0x15, 0x16
, 0x16, 0x01, 0x17, 0x17, 0x00, 0x18, 0x18, 0x00, 0x07, 0x3b, 0x07, 0x08, 0x08, 0x00, 0x09, 0x09
, 0x00, 0x07, 0x04, 0x02, 0x00, 0x3c, 0x37, 0x37, 0x00, 0x38, 0x39, 0x39, 0x00, 0x38, 0x3b, 0x3a
, 0x3a, 0x0e, 0x3b, 0x3b, 0x00, 0x36, 0x3a, 0x39, 0x38, 0x37, 0x36, 0x36, 0x01, 0x01, 0x14, 0x15
, 0x16, 0x16, 0x01, 0x17, 0x17, 0x01, 0x11, 0x39, 0x06, 0x09, 0x09, 0x01, 0x07, 0x05, 0x02, 0x01
, 0x3f, 0x3f, 0x00, 0x38, 0x38, 0x00, 0x39, 0x3a, 0x36, 0x3b, 0x3b, 0x00, 0x3a, 0x3a, 0x0f, 0x3c
, 0x35, 0x3b, 0x39, 0x39, 0x00, 0x38, 0x37, 0x37, 0x00, 0x36, 0x3a, 0x13, 0x15, 0x15, 0x00, 0x16
, 0x16, 0x02, 0x17, 0x16, 0x3b, 0x03, 0x09, 0x09, 0x00, 0x06, 0x03, 0x01, 0x00, 0x00, 0x00, 0x3e
, 0x00, 0x3b, 0x39, 0x39, 0x00, 0x3b, 0x35, 0x3c, 0x3a, 0x3a, 0x10, 0x3b, 0x39, 0x38, 0x3b, 0x3a
, 0x39, 0x38, 0x38, 0x00, 0x37, 0x38, 0x0d, 0x14, 0x15, 0x15, 0x00, 0x16, 0x16, 0x03, 0x03, 0x3f
, 0x07, 0x3f, 0x3a, 0x38, 0x38, 0x01, 0x39, 0x3c, 0x3f, 0x3d, 0x3a, 0x3b, 0x38, 0x39, 0x3b, 0x3a
, 0x3a, 0x10, 0x3b, 0x3c, 0x35, 0x3c, 0x3a, 0x39, 0x39, 0x00, 0x38, 0x38, 0x01, 0x06, 0x13, 0x14
, 0x15, 0x15, 0x03, 0x16, 0x0e, 0x3a, 0x3a, 0x00, 0x38, 0x38, 0x04, 0x39, 0x39, 0x00, 0x3a, 0x3b
, 0x3c, 0x35, 0x3c, 0x3b, 0x3a, 0x3a, 0x11, 0x3b, 0x3a, 0x36, 0x3c, 0x3a, 0x3a, 0x00, 0x39, 0x39
, 0x01, 0x3e, 0x10, 0x14, 0x14, 0x01, 0x15, 0x15, 0x01, 0x11, 0x04, 0x39, 0x38, 0x38, 0x03, 0x39
, 0x39, 0x01, 0x3a, 0x3a, 0x00, 0x3c, 0x36, 0x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, 0x37, 0x3b, 0x3f
, 0x00, 0x00, 0xff, 0xf7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x3f, 0x11, 0x00, 0x01
, 0x03, 0x06, 0x09, 0x0a, 0x0c, 0x0c, 0x02, 0x0a, 0x09, 0x06, 0x03, 0x01, 0x00, 0x3f, 0x3f, 0x22
, 0x00, 0x01, 0x04, 0x07, 0x07, 0x00, 0x08, 0x09, 0x0a, 0x0b, 0x0b, 0x02, 0x0a, 0x09, 0x08, 0x07
, 0x07, 0x00, 0x04, 0x01, 0x00, 0x3f, 0x3f, 0x1f, 0x00, 0x03, 0x06, 0x05, 0x05, 0x00, 0x06, 0x08
, 0x09, 0x0a, 0x0a, 0x00, 0x0b, 0x0b, 0x00, 0x0a, 0x0a, 0x00, 0x09, 0x08, 0x06, 0x05, 0x05, 0x00
, 0x06, 0x03, 0x00, 0x3f, 0x3f, 0x1c, 0x00, 0x01, 0x04, 0x05, 0x04, 0x04, 0x00, 0x05, 0x06, 0x07
, 0x08, 0x09, 0x09, 0x00, 0x0a, 0x0a, 0x00, 0x09, 0x09, 0x00, 0x08, 0x07, 0x06, 0x05, 0x04, 0x04
, 0x00, 0x05, 0x04, 0x00, 0x00, 0x00, 0x3f, 0x3f, 0x19, 0x00, 0x01, 0x03, 0x03, 0x01, 0x04, 0x04
, 0x01, 0x05, 0x06, 0x07, 0x08, 0x09, 0x09, 0x01, 0x08, 0x08, 0x00, 0x07, 0x06, 0x05, 0x04, 0x04
, 0x01, 0x03, 0x03, 0x00, 0x04, 0x01, 0x00, 0x3f, 0x3f, 0x18, 0x01, 0x03, 0x02, 0x02, 0x00, 0x03
, 0x04, 0x04, 0x01, 0x05, 0x06, 0x07, 0x07, 0x03, 0x06, 0x06, 0x00, 0x05, 0x05, 0x00, 0x04, 0x04
, 0x02, 0x03, 0x02, 0x02, 0x00, 0x03, 0x00, 0x3f, 0x3f, 0x17, 0x00, 0x02, 0x02, 0x02, 0x03, 0x04
, 0x04, 0x02, 0x05, 0x06, 0x06, 0x00, 0x05, 0x04, 0x03, 0x03, 0x02, 0x02, 0x02, 0x01, 0x03, 0x03
, 0x01, 0x02, 0x02, 0x02, 0x00, 0x3f, 0x3f, 0x15, 0x00, 0x02, 0x02, 0x03, 0x03, 0x03, 0x00, 0x04
, 0x04, 0x02, 0x05, 0x04, 0x03, 0x04, 0x04, 0x01, 0x03, 0x03, 0x00, 0x02, 0x02, 0x01, 0x03, 0x03
, 0x01, 0x02, 0x02, 0x03, 0x00, 0x3f, 0x3f, 0x14, 0x01, 0x02, 0x01, 0x01, 0x00, 0x02, 0x02, 0x01
, 0x03, 0x03, 0x00, 0x04, 0x04, 0x00, 0x03, 0x03, 0x00, 0x04, 0x06, 0x06, 0x02, 0x05, 0x04, 0x04
, 0x00, 0x03, 0x02, 0x03, 0x02, 0x02, 0x03, 0x01, 0x02, 0x01, 0x3f, 0x3f, 0x13, 0x00, 0x01, 0x01
, 0x02, 0x02, 0x02, 0x04, 0x03, 0x03, 0x02, 0x05, 0x06, 0x06, 0x03, 0x05, 0x04, 0x03, 0x03, 0x00
, 0x02, 0x02, 0x03, 0x01, 0x01, 0x01, 0x00, 0x3f, 0x3f, 0x12, 0x01, 0x01, 0x04, 0x02, 0x02, 0x01
, 0x03, 0x03, 0x00, 0x04, 0x04, 0x00, 0x03, 0x02, 0x04, 0x04, 0x00, 0x05, 0x05, 0x01, 0x06, 0x06
, 0x00, 0x05, 0x04, 0x03, 0x02, 0x02, 0x03, 0x01, 0x01, 0x02, 0x3f, 0x3f, 0x11, 0x00, 0x01, 0x01
, 0x04, 0x02, 0x02, 0x01, 0x03, 0x04, 0x04, 0x00, 0x02, 0x01, 0x01, 0x00, 0x03, 0x04, 0x03, 0x04
, 0x04, 0x00, 0x05, 0x06, 0x06, 0x00, 0x05, 0x04, 0x02, 0x02, 0x03, 0x01, 0x01, 0x02, 0x00, 0x3f
, 0x3f, 0x10, 0x00, 0x01, 0x01, 0x04, 0x02, 0x02, 0x00, 0x03, 0x04, 0x04, 0x00, 0x02, 0x01, 0x01
, 0x00, 0x00, 0x02, 0x04, 0x03, 0x03, 0x01, 0x04, 0x05, 0x06, 0x06, 0x00, 0x05, 0x03, 0x02, 0x02
, 0x02, 0x01, 0x01, 0x02, 0x00, 0x3f, 0x3f, 0x10, 0x00, 0x01, 0x01, 0x03, 0x02, 0x02, 0x01, 0x03
, 0x04, 0x03, 0x01, 0x01, 0x01, 0x00, 0x02, 0x03, 0x02, 0x02, 0x00, 0x03, 0x03, 0x00, 0x04, 0x05
, 0x06, 0x06, 0x00, 0x04, 0x02, 0x02, 0x01, 0x01, 0x01, 0x03, 0x00, 0x3f, 0x3f, 0x10, 0x00, 0x01
, 0x01, 0x05, 0x03, 0x04, 0x04, 0x00, 0x02, 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02, 0x02, 0x0a
, 0x01, 0x01, 0x03, 0x00, 0x3f, 0x3f, 0x10, 0x01, 0x01, 0x06, 0x03, 0x04, 0x03, 0x02, 0x01, 0x01
, 0x01, 0x00, 0x01, 0x02, 0x02, 0x02, 0x03, 0x04, 0x05, 0x05, 0x00, 0x03, 0x02, 0x02, 0x02, 0x01
, 0x01, 0x04, 0x3f, 0x3f, 0x10, 0x01, 0x01, 0x06, 0x03, 0x04, 0x03, 0x01, 0x01, 0x01, 0x00, 0x00
, 0x00, 0x01, 0x02, 0x02, 0x00, 0x04, 0x06, 0x05, 0x06, 0x07, 0x08, 0x09, 0x09, 0x00, 0x06, 0x02
, 0x01, 0x01, 0x05, 0x3f, 0x3f, 0x10, 0x00, 0x01, 0x00, 0x01, 0x01, 0x04, 0x02, 0x03, 0x02, 0x01
, 0x01, 0x03, 0x02, 0x04, 0x05, 0x05, 0x01, 0x06, 0x07, 0x08, 0x09, 0x09, 0x01, 0x03, 0x01, 0x01
, 0x02, 0x00, 0x01, 0x00, 0x3f, 0x3f, 0x10, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x00, 0x3f
, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x01, 0x02, 0x05, 0x05, 0x01, 0x06, 0x07, 0x08, 0x09, 0x09
, 0x01, 0x05, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x3f, 0x3f, 0x10, 0x00, 0x00, 0x03, 0x01
, 0x01, 0x01, 0x3f, 0x3b, 0x3c, 0x3e, 0x3e, 0x00, 0x3f, 0x00, 0x03, 0x08, 0x05, 0x01, 0x05, 0x05
, 0x00, 0x06, 0x06, 0x00, 0x07, 0x09, 0x09, 0x02, 0x07, 0x01, 0x01, 0x00, 0x00, 0x00, 0x03, 0x3f
, 0x3f, 0x10, 0x00, 0x00, 0x03, 0x01, 0x01, 0x01, 0x00, 0x3b, 0x3c, 0x3f, 0x01, 0x03, 0x05, 0x06
, 0x07, 0x06, 0x00, 0x03, 0x06, 0x06, 0x00, 0x07, 0x08, 0x09, 0x09, 0x02, 0x08, 0x02, 0x01, 0x00
, 0x00, 0x03, 0x3f, 0x3f, 0x10, 0x00, 0x00, 0x04, 0x01, 0x01, 0x01, 0x3d, 0x3c, 0x3e, 0x00, 0x01
, 0x03, 0x04, 0x05, 0x06, 0x00, 0x02, 0x06, 0x07, 0x08, 0x09, 0x09, 0x04, 0x04, 0x00, 0x00, 0x04
, 0x3f, 0x3f, 0x10, 0x00, 0x00, 0x05, 0x01, 0x01, 0x00, 0x3e, 0x3b, 0x3c, 0x3e, 0x00, 0x01, 0x02
, 0x03, 0x04, 0x00, 0x01, 0x07, 0x08, 0x09, 0x09, 0x05, 0x06, 0x00, 0x00, 0x04, 0x3f, 0x3f, 0x11
, 0x00, 0x00, 0x07, 0x3a, 0x3b, 0x3c, 0x3e, 0x3f, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x05
, 0x09, 0x09, 0x00, 0x08, 0x06, 0x05, 0x06, 0x07, 0x09, 0x09, 0x00, 0x01, 0x00, 0x00, 0x02, 0x3f
, 0x3f, 0x12, 0x00, 0x00, 0x07, 0x3b, 0x39, 0x3b, 0x3c, 0x3d, 0x3e, 0x3e, 0x00, 0x3f, 0x3e, 0x3f
, 0x03, 0x08, 0x03, 0x01, 0x00, 0x00, 0x01, 0x01, 0x02, 0x04, 0x02, 0x00, 0x00, 0x02, 0x3f, 0x3f
, 0x13, 0x00, 0x00, 0x06, 0x3d, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3c, 0x03, 0x00, 0x01, 0x00, 0x00
, 0x0a, 0x3f, 0x3f, 0x14, 0x00, 0x00, 0x06, 0x3f, 0x38, 0x37, 0x38, 0x39, 0x3a, 0x3a, 0x01, 0x3b
, 0x3e, 0x00, 0x00, 0x0c, 0x3f, 0x3f, 0x15, 0x00, 0x00, 0x07, 0x3e, 0x3d, 0x3c, 0x3b, 0x3c, 0x3e
, 0x00, 0x00, 0x0d, 0x3f, 0x3f, 0x17, 0x00, 0x00, 0x1a, 0x3f, 0x3f, 0x0b, 0x00, 0x00, 0x0b, 0x3f
, 0x00, 0x00, 0x18, 0x3f, 0x00, 0x00, 0xff, 0xfd, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff
, 0xff, 0xff, 0x54, 0x06, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0f, 0xc5, 0xff, 0xff, 0x14, 0xc5, 0x0c
, 0x00, 0x00, 0x1b, 0x03, 0x97, 0xff, 0xff, 0x12, 0x97, 0x03, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00
, 0x18, 0x36, 0xd4, 0xff, 0xff, 0x0e, 0xd3, 0x36, 0x00, 0x00, 0x04, 0x01, 0x01, 0x00, 0x00, 0x00
, 0x1a, 0x51, 0xc8, 0xff, 0xff, 0x0a, 0xc6, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0x15, 0x01
, 0x00, 0x00, 0x06, 0x12, 0x5a, 0x9f, 0xd3, 0xd9, 0xfd, 0xfd, 0x00, 0xd9, 0xd3, 0x9f, 0x5a, 0x12
, 0x00, 0x00, 0xff, 0xf7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
int init_nsc_suite(void)
{
return 0;
}
int clean_nsc_suite(void)
{
return 0;
}
int add_nsc_suite(void)
{
add_test_suite(nsc);
add_test_function(nsc_decode);
add_test_function(nsc_encode);
return 0;
}
void test_nsc_decode(void)
{
int i;
NSC_CONTEXT* context;
context = nsc_context_new();
nsc_context_set_cpu_opt(context, CPU_SSE2);
nsc_process_message(context, 32, 15, 10, (uint8*) nsc_data, sizeof(nsc_data));
/*freerdp_hexdump(context->bmpdata, 15 * 10 * 4);*/
for (i = 0; i < 30000; i++)
{
nsc_process_message(context, 32, 54, 44, (uint8*) nsc_stress_data, sizeof(nsc_stress_data));
}
nsc_context_free(context);
}
void test_nsc_encode(void)
{
}

27
cunit/test_nsc.h Normal file
View File

@ -0,0 +1,27 @@
/**
* FreeRDP: A Remote Desktop Protocol Client
* NSCodec Library Unit Tests
*
* Copyright 2012 Vic Lee
*
* 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.
*/
#include "test_freerdp.h"
int init_nsc_suite(void);
int clean_nsc_suite(void);
int add_nsc_suite(void);
void test_nsc_decode(void);
void test_nsc_encode(void);

View File

@ -28,43 +28,40 @@
extern "C" {
#endif
#define BYTESUM(_bs) (_bs[0] + _bs[1] + _bs[2] + _bs[3])
#define ROUND_UP_TO(_b, _n) (_b + ((~(_b & (_n-1)) + 0x1) & (_n-1)));
/* NSCODEC_BITMAP_STREAM */
struct _NSC_STREAM
{
uint32 PlaneByteCount[4];
uint8 colorLossLevel;
uint8 ColorLossLevel;
uint8 ChromaSubSamplingLevel;
uint16 Reserved;
STREAM* pdata;
uint8* Planes;
};
typedef struct _NSC_STREAM NSC_STREAM;
typedef struct _NSC_CONTEXT_PRIV NSC_CONTEXT_PRIV;
typedef struct _NSC_CONTEXT NSC_CONTEXT;
struct _NSC_CONTEXT
{
uint32 OrgByteCount[4]; /* original byte length of luma, chroma orange, chroma green, alpha variable in order */
NSC_STREAM* nsc_stream;
NSC_STREAM nsc_stream;
uint16 bpp;
uint16 width;
uint16 height;
uint8* bmpdata; /* final argb values in little endian order */
STREAM* org_buf[4]; /* Decompressed Plane Buffers in the respective order */
uint32 bmpdata_length; /* the maximum length of the buffer that bmpdata points to */
void (*decode)(NSC_CONTEXT* context);
NSC_CONTEXT_PRIV* priv;
};
typedef struct _NSC_CONTEXT NSC_CONTEXT;
FREERDP_API NSC_CONTEXT* nsc_context_new(void);
FREERDP_API void nsc_process_message(NSC_CONTEXT* context, uint8* data, uint32 length);
FREERDP_API void nsc_context_initialize(NSC_CONTEXT* context, STREAM* s);
FREERDP_API void nsc_stream_initialize(NSC_CONTEXT* context, STREAM* s);
FREERDP_API void nsc_rle_decompress_data(NSC_CONTEXT* context);
FREERDP_API void nsc_ycocg_rgb_convert(NSC_CONTEXT* context);
FREERDP_API void nsc_rle_decode(STREAM* in, STREAM* out, uint32 origsz);
FREERDP_API void nsc_chroma_supersample(NSC_CONTEXT* context);
FREERDP_API void nsc_cl_expand(STREAM* stream, uint8 shiftcount, uint32 origsz);
FREERDP_API void nsc_colorloss_recover(NSC_CONTEXT* context);
FREERDP_API void nsc_ycocg_rgb(NSC_CONTEXT* context);
FREERDP_API void nsc_context_destroy(NSC_CONTEXT* context);
FREERDP_API void nsc_context_set_cpu_opt(NSC_CONTEXT* context, uint32 cpu_opt);
FREERDP_API void nsc_process_message(NSC_CONTEXT* context, uint16 bpp,
uint16 width, uint16 height, uint8* data, uint32 length);
FREERDP_API void nsc_context_free(NSC_CONTEXT* context);
#ifdef __cplusplus
}

View File

@ -39,6 +39,7 @@ set(FREERDP_CODEC_SRCS
rfx_types.h
rfx.c
nsc.c
nsc_types.h
)
if(WITH_SSE2)

View File

@ -3,6 +3,7 @@
* NSCodec Codec
*
* Copyright 2011 Samsung, Author Jiten Pathy
* Copyright 2012 Vic Lee
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -24,357 +25,275 @@
#include <freerdp/codec/nsc.h>
#include <freerdp/utils/memory.h>
/* we store the 9th bits at the end of stream as bitstream */
void nsc_cl_expand(STREAM* stream, uint8 shiftcount, uint32 origsz)
{
uint8* sbitstream;
uint8* temptr;
uint8 sign,bitoff;
uint32 bitno;
sbitstream = stream->data + origsz;
#include "nsc_types.h"
do
#ifndef NSC_INIT_SIMD
#define NSC_INIT_SIMD(_nsc_context) do { } while (0)
#endif
#define ROUND_UP_TO(_b, _n) (_b + ((~(_b & (_n-1)) + 0x1) & (_n-1)))
#define MINMAX(_v,_l,_h) ((_v) < (_l) ? (_l) : ((_v) > (_h) ? (_h) : (_v)))
static void nsc_decode(NSC_CONTEXT* context)
{
uint16 x;
uint16 y;
uint16 rw;
uint8 shift;
uint8* yplane;
uint8* coplane;
uint8* cgplane;
uint8* aplane;
sint16 y_val;
sint16 co_val;
sint16 cg_val;
sint16 r_val;
sint16 g_val;
sint16 b_val;
uint8* bmpdata;
bmpdata = context->bmpdata;
rw = ROUND_UP_TO(context->width, 8);
shift = context->nsc_stream.ColorLossLevel - 1; /* colorloss recovery + YCoCg shift */
for (y = 0; y < context->height; y++)
{
sign = (*(stream->p) << (shiftcount - 1)) & 0x80;
bitno = stream->p - stream->data;
*(stream->p++) <<= shiftcount;
temptr = sbitstream + ((bitno) >> 3);
bitoff = bitno % 0x8;
(*temptr) |= (sign >> bitoff);
}
while (((uint32)(stream->p - stream->data)) < origsz);
stream->p = stream->data;
}
void nsc_chroma_supersample(NSC_CONTEXT* context)
{
int i;
uint8* cur;
uint8* tptr;
uint8* nbitstream;
uint8* sbitstream;
uint8 val, bitoff, sign;
uint16 w, h, pw, row;
uint32 alloclen, orglen, bytno;
STREAM* new_s;
STREAM* temp;
w = context->width;
h = context->height;
alloclen = orglen = w * h;
pw = ROUND_UP_TO(context->width, 8);
temp = stream_new(0);
for (i = 0; i < 3; i++)
{
if (i != 0)
alloclen = orglen + ((orglen & 0x7) ? (orglen >> 3) + 0x1 : (orglen >> 3));
new_s = stream_new(alloclen);
stream_attach(temp, context->org_buf[i]->data, context->org_buf[i]->size);
sbitstream = temp->data + context->OrgByteCount[i];
nbitstream = new_s->data + orglen;
cur = new_s->p;
if (i == 1)
pw >>= 1;
while (((uint32)(temp->p - temp->data)) < context->OrgByteCount[i])
if (context->nsc_stream.ChromaSubSamplingLevel > 0)
{
bytno = temp->p - temp->data;
bitoff = bytno % 0x8;
stream_read_uint8(temp, val);
*cur = val;
row = (temp->p - temp->data) % pw;
if (i == 0)
{
cur++;
if (row >= w)
stream_seek(temp, pw-row);
}
else
{
tptr = sbitstream + ((bytno) >> 3);
sign = ((*tptr) << bitoff) & 0x80;
bytno = cur - new_s->data;
bitoff = bytno % 8;
*(nbitstream + (bytno >> 3)) |= (sign >> bitoff);
if ((bytno+w) < orglen)
{
*(cur + w) = val;
bitoff = (bytno + w) % 8;
*(nbitstream + ((bytno + w) >> 3)) |= (sign >> bitoff);
}
if ((bytno+1) % w)
{
*(cur+1) = val;
bitoff = (bytno + 1) % 8;
*(nbitstream + ((bytno + 1) >> 3)) |= (sign >> bitoff);
if ((bytno+w) < orglen)
{
*(cur+w+1) = val;
bitoff = (bytno + w + 1) % 8;
*(nbitstream + ((bytno + w + 1) >> 3)) |= (sign >> bitoff);
}
}
cur += 2;
bytno = cur - new_s->data;
if (((bytno/w) < h) && ((bytno) % w) < 2 )
{
if (w % 2)
cur += w-1;
else
cur += w;
}
if ((row*2) >= w)
stream_seek(temp, pw-row);
}
}
xfree(temp->data);
stream_detach(temp);
stream_attach(context->org_buf[i], new_s->data, new_s->size);
context->OrgByteCount[i] = orglen;
}
}
void nsc_ycocg_rgb(NSC_CONTEXT* context)
{
uint8* sbitstream[2];
uint8 bitoff, sign[2], i, val, tmp;
sint16 rgb[3], ycocg[3];
uint32 bytno, size;
size = context->OrgByteCount[0];
for (i = 1; i < 3; i++)
sbitstream[i-1] = context->org_buf[i]->data + context->OrgByteCount[i];
do
{
for (i = 0; i < 3; i++)
ycocg[i] = *(context->org_buf[i]->p);
for (i = 1; i < 3; i++)
{
bytno = context->OrgByteCount[i] - size;
bitoff = bytno % 8;
sign[i-1] = (*(sbitstream[i-1] + (bytno >> 3)) >> (7 - bitoff)) & 0x1;
ycocg[i] = (((sint16)(0 - sign[i-1])) << 8) | ycocg[i];
}
rgb[0] = ycocg[0] + (ycocg[1] >> 1) - (ycocg[2] >> 1);
rgb[1] = ycocg[0] + (ycocg[2] >> 1);
rgb[2] = ycocg[0] - (ycocg[1] >> 1) - (ycocg[2] >> 1);
for (i = 0; i < 3; i++)
{
tmp = (rgb[i] >> 8) & 0xff;
if (tmp == 0xff)
val = 0x00;
else if (tmp == 0x1)
val = 0xff;
else
val = (uint8) rgb[i];
stream_write_uint8(context->org_buf[i], val);
}
size--;
}
while (size);
for (i = 0; i < 3; i++)
context->org_buf[i]->p = context->org_buf[i]->data;
}
void nsc_colorloss_recover(NSC_CONTEXT* context)
{
int i;
uint8 cllvl;
cllvl = context->nsc_stream->colorLossLevel;
for (i = 1; i < 3; i++)
nsc_cl_expand(context->org_buf[i], cllvl, context->OrgByteCount[i]);
}
void nsc_rle_decode(STREAM* in, STREAM* out, uint32 origsz)
{
uint32 i;
uint8 value;
i = origsz;
while (i > 4)
{
stream_read_uint8(in, value);
if (i == 5)
{
stream_write_uint8(out,value);
i-=1;
}
else if (value == *(in->p))
{
stream_seek(in, 1);
if (*(in->p) < 0xFF)
{
uint8 len;
stream_read_uint8(in, len);
stream_set_byte(out, value, len+2);
i -= (len+2);
}
else
{
uint32 len;
stream_seek(in, 1);
stream_read_uint32(in, len);
stream_set_byte(out, value, len);
i -= len;
}
yplane = context->priv->plane_buf[0] + y * rw; /* Y */
coplane = context->priv->plane_buf[1] + (y >> 1) * (rw >> 1); /* Co, supersampled */
cgplane = context->priv->plane_buf[2] + (y >> 1) * (rw >> 1); /* Cg, supersampled */
}
else
{
stream_write_uint8(out, value);
i -= 1;
yplane = context->priv->plane_buf[0] + y * context->width; /* Y */
coplane = context->priv->plane_buf[1] + y * context->width; /* Co */
cgplane = context->priv->plane_buf[2] + y * context->width; /* Cg */
}
aplane = context->priv->plane_buf[3] + y * context->width; /* A */
for (x = 0; x < context->width; x++)
{
y_val = (sint16) *yplane;
co_val = (sint16) (sint8) (*coplane << shift);
cg_val = (sint16) (sint8) (*cgplane << shift);
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++;
}
}
}
static void nsc_rle_decode(uint8* in, uint8* out, uint32 origsz)
{
uint32 len;
uint32 left;
uint8 value;
left = origsz;
while (left > 4)
{
value = *in++;
if (left == 5)
{
*out++ = value;
left--;
}
else if (value == *in)
{
in++;
if (*in < 0xFF)
{
len = (uint32) *in++;
len += 2;
}
else
{
in++;
len = *((uint32*) in);
in += 4;
}
memset(out, value, len);
out += len;
left -= len;
}
else
{
*out++ = value;
left--;
}
}
stream_copy(out, in, 4);
*((uint32*)out) = *((uint32*)in);
}
void nsc_rle_decompress_data(NSC_CONTEXT* context)
static void nsc_rle_decompress_data(NSC_CONTEXT* context)
{
STREAM* rles;
uint16 i;
uint8* rle;
uint32 origsize;
rles = stream_new(0);
rles->p = rles->data = context->nsc_stream->pdata->p;
rles->size = context->nsc_stream->pdata->size;
uint32 planesize;
rle = context->nsc_stream.Planes;
for (i = 0; i < 4; i++)
{
origsize = context->OrgByteCount[i];
planesize = context->nsc_stream.PlaneByteCount[i];
if (i == 3 && context->nsc_stream->PlaneByteCount[i] == 0)
stream_set_byte(context->org_buf[i], 0xff, origsize);
else if (context->nsc_stream->PlaneByteCount[i] < origsize)
nsc_rle_decode(rles, context->org_buf[i], origsize);
if (planesize == 0)
memset(context->priv->plane_buf[i], 0xff, origsize);
else if (planesize < origsize)
nsc_rle_decode(rle, context->priv->plane_buf[i], origsize);
else
stream_copy(context->org_buf[i], rles, origsize);
memcpy(context->priv->plane_buf[i], rle, origsize);
context->org_buf[i]->p = context->org_buf[i]->data;
rle += planesize;
}
}
void nsc_combine_argb(NSC_CONTEXT* context)
{
int i;
uint8* bmp;
bmp = context->bmpdata;
for (i = 0; i < (context->width * context->height); i++)
{
stream_read_uint8(context->org_buf[2], *bmp++);
stream_read_uint8(context->org_buf[1], *bmp++);
stream_read_uint8(context->org_buf[0], *bmp++);
stream_read_uint8(context->org_buf[3], *bmp++);
}
}
void nsc_stream_initialize(NSC_CONTEXT* context, STREAM* s)
static void nsc_stream_initialize(NSC_CONTEXT* context, STREAM* s)
{
int i;
for (i = 0; i < 4; i++)
stream_read_uint32(s, context->nsc_stream->PlaneByteCount[i]);
stream_read_uint32(s, context->nsc_stream.PlaneByteCount[i]);
stream_read_uint8(s, context->nsc_stream->colorLossLevel);
stream_read_uint8(s, context->nsc_stream->ChromaSubSamplingLevel);
stream_read_uint8(s, context->nsc_stream.ColorLossLevel);
stream_read_uint8(s, context->nsc_stream.ChromaSubSamplingLevel);
stream_seek(s, 2);
context->nsc_stream->pdata = stream_new(0);
stream_attach(context->nsc_stream->pdata, s->p, BYTESUM(context->nsc_stream->PlaneByteCount));
context->nsc_stream.Planes = stream_get_tail(s);
}
void nsc_context_initialize(NSC_CONTEXT* context, STREAM* s)
static void nsc_context_initialize(NSC_CONTEXT* context, STREAM* s)
{
int i;
uint32 tempsz;
uint32 length;
uint32 tempWidth;
uint32 tempHeight;
nsc_stream_initialize(context, s);
context->bmpdata = xzalloc(context->width * context->height * 4);
length = context->width * context->height * 4;
if (context->bmpdata == NULL)
{
context->bmpdata = xzalloc(length + 16);
context->bmpdata_length = length;
}
else if (length > context->bmpdata_length)
{
context->bmpdata = xrealloc(context->bmpdata, length + 16);
context->bmpdata_length = length;
}
tempWidth = ROUND_UP_TO(context->width, 8);
tempHeight = ROUND_UP_TO(context->height, 2);
/* The maximum length a decoded plane can reach in all cases */
length = tempWidth * tempHeight;
if (length > context->priv->plane_buf_length)
{
for (i = 0; i < 4; i++)
context->priv->plane_buf[i] = (uint8*) xrealloc(context->priv->plane_buf[i], length);
context->priv->plane_buf_length = length;
}
for (i = 0; i < 4; i++)
context->OrgByteCount[i]=context->width * context->height;
if (context->nsc_stream->ChromaSubSamplingLevel > 0) /* [MS-RDPNSC] 2.2 */
if (context->nsc_stream.ChromaSubSamplingLevel > 0) /* [MS-RDPNSC] 2.2 */
{
uint32 tempWidth,tempHeight;
tempWidth = ROUND_UP_TO(context->width, 8);
context->OrgByteCount[0] = tempWidth * context->height;
tempWidth = tempWidth >> 1 ;
tempHeight = ROUND_UP_TO(context->height, 2);
tempHeight = tempHeight >> 1;
context->OrgByteCount[1] = tempWidth * tempHeight;
context->OrgByteCount[2] = tempWidth * tempHeight;
}
for (i = 0; i < 4; i++)
{
tempsz = context->OrgByteCount[i];
if (i == 1 || i == 2)
tempsz += (tempsz & 0x7) ? (tempsz >> 3) + 0x1 : (tempsz >> 3); /* extra bytes/8 bytes for bitstream to store the 9th bit after colorloss recover */
context->org_buf[i] = stream_new(tempsz);
context->OrgByteCount[1] = (tempWidth >> 1) * (tempHeight >> 1);
context->OrgByteCount[2] = context->OrgByteCount[1];
}
}
void nsc_context_destroy(NSC_CONTEXT* context)
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;
}
void nsc_context_free(NSC_CONTEXT* context)
{
int i;
for (i = 0;i < 4; i++)
stream_free(context->org_buf[i]);
for (i = 0; i < 4; i++)
{
if (context->priv->plane_buf[i])
xfree(context->priv->plane_buf[i]);
}
if (context->bmpdata)
xfree(context->bmpdata);
stream_detach(context->nsc_stream->pdata);
xfree(context->bmpdata);
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);
xfree(context->priv);
xfree(context);
}
NSC_CONTEXT* nsc_context_new(void)
{
NSC_CONTEXT* nsc_context;
nsc_context = xnew(NSC_CONTEXT);
nsc_context->nsc_stream = xnew(NSC_STREAM);
nsc_context->priv = xnew(NSC_CONTEXT_PRIV);
nsc_context->decode = nsc_decode;
PROFILER_CREATE(nsc_context->priv->prof_nsc_rle_decompress_data, "nsc_rle_decompress_data");
PROFILER_CREATE(nsc_context->priv->prof_nsc_decode, "nsc_decode");
PROFILER_CREATE(nsc_context->priv->prof_nsc_rle_compress_data, "nsc_rle_compress_data");
PROFILER_CREATE(nsc_context->priv->prof_nsc_encode, "nsc_encode");
return nsc_context;
}
void nsc_process_message(NSC_CONTEXT* context, uint8* data, uint32 length)
void nsc_context_set_cpu_opt(NSC_CONTEXT* context, uint32 cpu_opt)
{
if (cpu_opt)
NSC_INIT_SIMD(context);
}
void nsc_process_message(NSC_CONTEXT* context, uint16 bpp,
uint16 width, uint16 height, uint8* data, uint32 length)
{
STREAM* s;
s = stream_new(0);
stream_attach(s, data, length);
context->bpp = bpp;
context->width = width;
context->height = height;
nsc_context_initialize(context, s);
stream_detach(s);
stream_free(s);
/* RLE decode */
PROFILER_ENTER(context->priv->prof_nsc_rle_decompress_data);
nsc_rle_decompress_data(context);
PROFILER_EXIT(context->priv->prof_nsc_rle_decompress_data);
/* colorloss recover */
nsc_colorloss_recover(context);
/* Chroma supersample */
if (context->nsc_stream->ChromaSubSamplingLevel > 0)
nsc_chroma_supersample(context);
/* YCoCg to RGB Convert */
nsc_ycocg_rgb(context);
/* Combine ARGB planes */
nsc_combine_argb(context);
/* Colorloss recover, Chroma supersample and AYCoCg to ARGB Conversion in one step */
PROFILER_ENTER(context->priv->prof_nsc_decode);
context->decode(context);
PROFILER_EXIT(context->priv->prof_nsc_decode);
}

View File

@ -0,0 +1,40 @@
/**
* FreeRDP: A Remote Desktop Protocol client.
* NSCodec Library
*
* Copyright 2011 Samsung, Author Jiten Pathy
* Copyright 2012 Vic Lee
*
* 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.
*/
#ifndef __NSC_TYPES_H
#define __NSC_TYPES_H
#include "config.h"
#include <freerdp/utils/debug.h>
#include <freerdp/utils/profiler.h>
struct _NSC_CONTEXT_PRIV
{
uint8* plane_buf[4]; /* Decompressed Plane Buffers in the respective order */
uint32 plane_buf_length; /* Lengths of each plane buffer */
/* profilers */
PROFILER_DEFINE(prof_nsc_rle_decompress_data);
PROFILER_DEFINE(prof_nsc_decode);
PROFILER_DEFINE(prof_nsc_rle_compress_data);
PROFILER_DEFINE(prof_nsc_encode);
};
#endif /* __NSC_TYPES_H */

View File

@ -737,9 +737,8 @@ void gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits_co
}
else if (surface_bits_command->codecID == CODEC_ID_NSCODEC)
{
nsc_context->width = surface_bits_command->width;
nsc_context->height = surface_bits_command->height;
nsc_process_message(nsc_context, surface_bits_command->bitmapData, surface_bits_command->bitmapDataLength);
nsc_process_message(nsc_context, surface_bits_command->bpp, surface_bits_command->width, surface_bits_command->height,
surface_bits_command->bitmapData, surface_bits_command->bitmapDataLength);
gdi->image->bitmap->width = surface_bits_command->width;
gdi->image->bitmap->height = surface_bits_command->height;
gdi->image->bitmap->bitsPerPixel = surface_bits_command->bpp;
@ -747,7 +746,6 @@ void gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits_co
gdi->image->bitmap->data = (uint8*) xrealloc(gdi->image->bitmap->data, gdi->image->bitmap->width * gdi->image->bitmap->height * 4);
freerdp_image_flip(nsc_context->bmpdata, gdi->image->bitmap->data, gdi->image->bitmap->width, gdi->image->bitmap->height, 32);
gdi_BitBlt(gdi->primary->hdc, surface_bits_command->destLeft, surface_bits_command->destTop, surface_bits_command->width, surface_bits_command->height, gdi->image->hdc, 0, 0, GDI_SRCCOPY);
nsc_context_destroy(nsc_context);
}
else if (surface_bits_command->codecID == CODEC_ID_NONE)
{