コード例 #1
0
ファイル: test_nsc.c プロジェクト: ArthurGodoy/FreeRDP
void test_nsc_encode(void)
{
	int i;
	uint8* rgb_data;
	STREAM* enc_stream;
	NSC_CONTEXT* context;

	rgb_data = (uint8 *) malloc(64 * 64 * 3);
	for (i = 0; i < 64; i++)
		memcpy(rgb_data + i * 64 * 3, rgb_scanline_data, 64 * 3);

	context = nsc_context_new();
	nsc_context_set_cpu_opt(context, CPU_SSE2);
	nsc_context_set_pixel_format(context, RDP_PIXEL_FORMAT_R8G8B8);

	enc_stream = stream_new(65536);
	stream_clear(enc_stream);

	for (i = 0; i < 30000; i++)
	{
		stream_set_pos(enc_stream, 0);
		nsc_compose_message(context, enc_stream, rgb_data, 64, 64, 64 * 3);
	}
	/*freerdp_hexdump(stream_get_head(enc_stream), stream_get_length(enc_stream));*/
	nsc_process_message(context, 32, 64, 64, stream_get_head(enc_stream), stream_get_length(enc_stream));
	/*freerdp_hexdump(context->bmpdata, 64 * 64 * 4);*/
	stream_free(enc_stream);

	nsc_context_free(context);
}
コード例 #2
0
ファイル: shadow_encoder.c プロジェクト: JunaidLoonat/FreeRDP
static int shadow_encoder_init_nsc(rdpShadowEncoder* encoder)
{
	rdpContext* context = (rdpContext*) encoder->client;
	rdpSettings* settings = context->settings;

	if (!encoder->nsc)
		encoder->nsc = nsc_context_new();

	if (!encoder->nsc)
		goto fail;

	if (!nsc_context_reset(encoder->nsc, encoder->width, encoder->height))
		goto fail;

	encoder->nsc->ColorLossLevel = settings->NSCodecColorLossLevel;
	encoder->nsc->ChromaSubsamplingLevel = settings->NSCodecAllowSubsampling ? 1 :
	                                       0;
	encoder->nsc->DynamicColorFidelity = settings->NSCodecAllowDynamicColorFidelity;
	nsc_context_set_pixel_format(encoder->nsc, PIXEL_FORMAT_BGRX32);
	encoder->codecs |= FREERDP_CODEC_NSCODEC;
	return 1;
fail:
	nsc_context_free(encoder->nsc);
	return -1;
}
コード例 #3
0
ファイル: test_nsc.c プロジェクト: 10084462/FreeRDP
void test_nsc_encode(void)
{
	int i;
	BYTE* rgb_data;
	wStream* enc_stream;
	NSC_CONTEXT* context;

	rgb_data = (BYTE *) malloc(64 * 64 * 3);
	for (i = 0; i < 64; i++)
		memcpy(rgb_data + i * 64 * 3, rgb_scanline_data, 64 * 3);

	context = nsc_context_new();
	nsc_context_set_pixel_format(context, RDP_PIXEL_FORMAT_R8G8B8);

	enc_stream = stream_new(65536);
	stream_clear(enc_stream);

	for (i = 0; i < 30000; i++)
	{
		Stream_SetPosition(enc_stream, 0);
		nsc_compose_message(context, enc_stream, rgb_data, 64, 64, 64 * 3);
	}
	/*winpr_HexDump(Stream_Buffer(enc_stream), Stream_GetPosition(enc_stream));*/
	nsc_process_message(context, 32, 64, 64, Stream_Buffer(enc_stream), Stream_GetPosition(enc_stream));
	/*winpr_HexDump(context->bmpdata, 64 * 64 * 4);*/
	stream_free(enc_stream);

	nsc_context_free(context);
}
コード例 #4
0
ファイル: shadow_encoder.c プロジェクト: Russkowski/FreeRDP
int shadow_encoder_init_nsc(rdpShadowEncoder* encoder)
{
    rdpContext* context = (rdpContext*) encoder->client;
    rdpSettings* settings = context->settings;

    if (!encoder->nsc)
        encoder->nsc = nsc_context_new();

    if (!encoder->nsc)
        return -1;

    nsc_context_set_pixel_format(encoder->nsc, RDP_PIXEL_FORMAT_B8G8R8A8);

    encoder->fps = 16;
    encoder->maxFps = 32;
    encoder->frameId = 0;
    encoder->lastAckframeId = 0;
    encoder->frameAck = settings->SurfaceFrameMarkerEnabled;

    encoder->nsc->ColorLossLevel = settings->NSCodecColorLossLevel;
    encoder->nsc->ChromaSubsamplingLevel = settings->NSCodecAllowSubsampling ? 1 : 0;
    encoder->nsc->DynamicColorFidelity = settings->NSCodecAllowDynamicColorFidelity;

    encoder->codecs |= FREERDP_CODEC_NSCODEC;

    return 1;
}
コード例 #5
0
ファイル: encoder.c プロジェクト: awakecoding/FreeRDS
int freerds_encoder_init_nsc(rdsEncoder* encoder)
{
	rdpSettings* settings = encoder->connection->settings;

	if (!encoder->nsc)
		encoder->nsc = nsc_context_new();

	if (!encoder->nsc)
		return -1;

	nsc_context_set_pixel_format(encoder->nsc, RDP_PIXEL_FORMAT_B8G8R8A8);

	if (!encoder->frameList)
	{
		encoder->fps = 16;
		encoder->maxFps = 32;
		encoder->frameId = 0;
		encoder->frameList = ListDictionary_New(TRUE);
		encoder->frameAck = settings->SurfaceFrameMarkerEnabled;
	}

	encoder->nsc->ColorLossLevel = settings->NSCodecColorLossLevel;
	encoder->nsc->ChromaSubsamplingLevel = settings->NSCodecAllowSubsampling ? 1 : 0;
	encoder->nsc->DynamicColorFidelity = settings->NSCodecAllowDynamicColorFidelity;

	encoder->codecs |= FREERDP_CODEC_NSCODEC;

	return 1;
}
コード例 #6
0
ファイル: xf_gfx.c プロジェクト: davidleake/FreeRDP
int xf_ResetGraphics(RdpgfxClientContext* context, RDPGFX_RESET_GRAPHICS_PDU* resetGraphics)
{
	xfContext* xfc = (xfContext*) context->custom;

	if (xfc->codecs->rfx)
	{
		rfx_context_free(xfc->codecs->rfx);
		xfc->codecs->rfx = NULL;
	}

	xfc->codecs->rfx = rfx_context_new(FALSE);

	xfc->codecs->rfx->width = resetGraphics->width;
	xfc->codecs->rfx->height = resetGraphics->height;
	rfx_context_set_pixel_format(xfc->codecs->rfx, RDP_PIXEL_FORMAT_B8G8R8A8);

	if (xfc->codecs->nsc)
	{
		nsc_context_free(xfc->codecs->nsc);
		xfc->codecs->nsc = NULL;
	}

	xfc->codecs->nsc = nsc_context_new();

	xfc->codecs->nsc->width = resetGraphics->width;
	xfc->codecs->nsc->height = resetGraphics->height;
	nsc_context_set_pixel_format(xfc->codecs->nsc, RDP_PIXEL_FORMAT_B8G8R8A8);

	if (xfc->codecs->clear)
	{
		clear_context_free(xfc->codecs->clear);
		xfc->codecs->clear = NULL;
	}

	xfc->codecs->clear = clear_context_new(FALSE);

	if (xfc->codecs->h264)
	{
		h264_context_free(xfc->codecs->h264);
		xfc->codecs->h264 = NULL;
	}

	xfc->codecs->h264 = h264_context_new(FALSE);

	if (xfc->codecs->progressive)
	{
		progressive_context_free(xfc->codecs->progressive);
		xfc->codecs->progressive = NULL;
	}

	xfc->codecs->progressive = progressive_context_new(TRUE);

	region16_init(&(xfc->invalidRegion));

	xfc->graphicsReset = TRUE;

	return 1;
}
コード例 #7
0
ファイル: mfreerdp.c プロジェクト: Arkantos7/FreeRDP
void mf_peer_context_new(freerdp_peer* client, mfPeerContext* context)
{
	context->rfx_context = rfx_context_new();
	context->rfx_context->mode = RLGR3;
	context->rfx_context->width = client->settings->DesktopWidth;
	context->rfx_context->height = client->settings->DesktopHeight;
	rfx_context_set_pixel_format(context->rfx_context, RDP_PIXEL_FORMAT_R8G8B8);

	context->nsc_context = nsc_context_new();
	nsc_context_set_pixel_format(context->nsc_context, RDP_PIXEL_FORMAT_R8G8B8);

	context->s = stream_new(0xFFFF);

	context->vcm = WTSCreateVirtualChannelManager(client);
}
コード例 #8
0
ファイル: sfreerdp.c プロジェクト: GHubgenius/FreeRDP
void test_peer_context_new(freerdp_peer* client, testPeerContext* context)
{
	context->rfx_context = rfx_context_new(TRUE);
	context->rfx_context->mode = RLGR3;
	context->rfx_context->width = SAMPLE_SERVER_DEFAULT_WIDTH;
	context->rfx_context->height = SAMPLE_SERVER_DEFAULT_HEIGHT;
	rfx_context_set_pixel_format(context->rfx_context, RDP_PIXEL_FORMAT_R8G8B8);

	context->nsc_context = nsc_context_new();
	nsc_context_set_pixel_format(context->nsc_context, RDP_PIXEL_FORMAT_R8G8B8);

	context->s = Stream_New(NULL, 65536);

	context->icon_x = -1;
	context->icon_y = -1;

	context->vcm = WTSOpenServerA((LPSTR) client->context);
}
コード例 #9
0
ファイル: sfreerdp.c プロジェクト: chenkaigithub/FreeRDP
void test_peer_context_new(freerdp_peer* client, testPeerContext* context)
{
	context->rfx_context = rfx_context_new();
	context->rfx_context->mode = RLGR3;
	context->rfx_context->width = SAMPLE_SERVER_DEFAULT_WIDTH;
	context->rfx_context->height = SAMPLE_SERVER_DEFAULT_HEIGHT;
	rfx_context_set_pixel_format(context->rfx_context, RDP_PIXEL_FORMAT_R8G8B8);

	context->nsc_context = nsc_context_new();
	nsc_context_set_pixel_format(context->nsc_context, RDP_PIXEL_FORMAT_R8G8B8);

	context->s = Stream_New(NULL, 65536);

	context->icon_x = -1;
	context->icon_y = -1;

	context->vcm = WTSCreateVirtualChannelManager(client);
}
コード例 #10
0
ファイル: sfreerdp.c プロジェクト: mgariepy/FreeRDP
void test_peer_context_new(freerdp_peer* client, testPeerContext* context)
{
	context->rfx_context = rfx_context_new();
	context->rfx_context->mode = RLGR3;
	context->rfx_context->width = client->settings->width;
	context->rfx_context->height = client->settings->height;
	rfx_context_set_pixel_format(context->rfx_context, RDP_PIXEL_FORMAT_R8G8B8);

	context->nsc_context = nsc_context_new();
	nsc_context_set_pixel_format(context->nsc_context, RDP_PIXEL_FORMAT_R8G8B8);

	context->s = stream_new(65536);

	context->icon_x = -1;
	context->icon_y = -1;

	context->vcm = WTSCreateVirtualChannelManager(client);
}
コード例 #11
0
ファイル: sfreerdp.c プロジェクト: shattars3d/FreeRDP-1
BOOL test_peer_context_new(freerdp_peer* client, testPeerContext* context)
{
	if (!(context->rfx_context = rfx_context_new(TRUE)))
		goto fail_rfx_context;

	context->rfx_context->mode = RLGR3;
	context->rfx_context->width = SAMPLE_SERVER_DEFAULT_WIDTH;
	context->rfx_context->height = SAMPLE_SERVER_DEFAULT_HEIGHT;
	rfx_context_set_pixel_format(context->rfx_context, RDP_PIXEL_FORMAT_R8G8B8);

	if (!(context->nsc_context = nsc_context_new()))
		goto fail_nsc_context;

	nsc_context_set_pixel_format(context->nsc_context, RDP_PIXEL_FORMAT_R8G8B8);

	if (!(context->s = Stream_New(NULL, 65536)))
		goto fail_stream_new;

	context->icon_x = -1;
	context->icon_y = -1;

	context->vcm = WTSOpenServerA((LPSTR) client->context);

	if (!context->vcm || context->vcm == INVALID_HANDLE_VALUE)
		goto fail_open_server;

	return TRUE;

fail_open_server:
	context->vcm = NULL;
	Stream_Free(context->s, TRUE);
	context->s = NULL;
fail_stream_new:
	nsc_context_free(context->nsc_context);
	context->nsc_context = NULL;
fail_nsc_context:
	rfx_context_free(context->rfx_context);
	context->rfx_context = NULL;
fail_rfx_context:
	return FALSE;
}
コード例 #12
0
ファイル: shadow_encoder.c プロジェクト: apprisi/FreeRDP
int shadow_encoder_init_nsc(rdpShadowEncoder* encoder)
{
	if (!encoder->nsc)
		encoder->nsc = nsc_context_new();

	if (!encoder->nsc)
		return -1;

	nsc_context_set_pixel_format(encoder->nsc, RDP_PIXEL_FORMAT_B8G8R8A8);

	if (!encoder->frameList)
	{
		encoder->fps = 16;
		encoder->maxFps = 32;
		encoder->frameId = 0;
		encoder->frameAck = TRUE;
		encoder->frameList = ListDictionary_New(TRUE);
	}

	encoder->codecs |= SHADOW_CODEC_NSCODEC;

	return 1;
}