Example #1
0
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;
}
Example #2
0
BOOL freerdp_client_codecs_prepare(rdpCodecs* codecs, UINT32 flags)
{
	if ((flags & FREERDP_CODEC_INTERLEAVED) && !codecs->interleaved)
	{
		if (!(codecs->interleaved = bitmap_interleaved_context_new(FALSE)))
		{
			WLog_ERR(TAG, "Failed to create interleaved codec context");
			return FALSE;
		}
	}

	if ((flags & FREERDP_CODEC_PLANAR) && !codecs->planar)
	{
		if (!(codecs->planar = freerdp_bitmap_planar_context_new(FALSE, 64, 64)))
		{
			WLog_ERR(TAG, "Failed to create planar bitmap codec context");
			return FALSE;
		}
	}

	if ((flags & FREERDP_CODEC_NSCODEC) && !codecs->nsc)
	{
		if (!(codecs->nsc = nsc_context_new()))
		{
			WLog_ERR(TAG, "Failed to create nsc codec context");
			return FALSE;
		}
	}

	if ((flags & FREERDP_CODEC_REMOTEFX) && !codecs->rfx)
	{
		if (!(codecs->rfx = rfx_context_new(FALSE)))
		{
			WLog_ERR(TAG, "Failed to create rfx codec context");
			return FALSE;
		}
	}

	if ((flags & FREERDP_CODEC_CLEARCODEC) && !codecs->clear)
	{
		if (!(codecs->clear = clear_context_new(FALSE)))
		{
			WLog_ERR(TAG, "Failed to create clear codec context");
			return FALSE;
		}
	}

	if (flags & FREERDP_CODEC_ALPHACODEC)
	{

	}

	if ((flags & FREERDP_CODEC_PROGRESSIVE) && !codecs->progressive)
	{
		if (!(codecs->progressive = progressive_context_new(FALSE)))
		{
			WLog_ERR(TAG, "Failed to create progressive codec context");
			return FALSE;
		}
	}

	if ((flags & (FREERDP_CODEC_AVC420 | FREERDP_CODEC_AVC444)) && !codecs->h264)
	{
		if (!(codecs->h264 = h264_context_new(FALSE)))
		{
			WLog_ERR(TAG, "Failed to create h264 codec context");
			return FALSE;
		}
	}

	return TRUE;
}
int test_progressive_ms_sample(char* ms_sample_path)
{
	int count;
	int status;
	EGFX_SAMPLE_FILE files[3][4][4];
	EGFX_SAMPLE_FILE bitmaps[3][4][4];
	PROGRESSIVE_CONTEXT* progressive;

	g_Width = 1920;
	g_Height = 1080;
	g_DstStep = g_Width * 4;

	ZeroMemory(files, sizeof(files));
	ZeroMemory(bitmaps, sizeof(bitmaps));

	status = test_progressive_load_files(ms_sample_path, files);

	if (status < 0)
		return -1;

	status = test_progressive_load_bitmaps(ms_sample_path, bitmaps);

	if (status < 0)
		return -1;

	count = 4;

	progressive = progressive_context_new(FALSE);

	g_DstData = _aligned_malloc(g_DstStep * g_Height, 16);

	progressive_create_surface_context(progressive, 0, g_Width, g_Height);

	/* image 1 */

	if (1)
	{
		printf("\nSample Image 1\n");
		test_image_fill(g_DstData, g_DstStep, 0, 0, g_Width, g_Height, 0xFF000000);
		test_progressive_decode(progressive, files[0][0], bitmaps[0][0], 0, count);
		test_progressive_decode(progressive, files[0][1], bitmaps[0][1], 1, count);
		test_progressive_decode(progressive, files[0][2], bitmaps[0][2], 2, count);
		test_progressive_decode(progressive, files[0][3], bitmaps[0][3], 3, count);
	}

	/* image 2 */

	if (0)
	{
		printf("\nSample Image 2\n"); /* sample data is in incorrect order */
		test_image_fill(g_DstData, g_DstStep, 0, 0, g_Width, g_Height, 0xFF000000);
		test_progressive_decode(progressive, files[1][0], bitmaps[1][0], 0, count);
		test_progressive_decode(progressive, files[1][1], bitmaps[1][1], 1, count);
		test_progressive_decode(progressive, files[1][2], bitmaps[1][2], 2, count);
		test_progressive_decode(progressive, files[1][3], bitmaps[1][3], 3, count);
	}

	/* image 3 */

	if (0)
	{
		printf("\nSample Image 3\n"); /* sample data is in incorrect order */
		test_image_fill(g_DstData, g_DstStep, 0, 0, g_Width, g_Height, 0xFF000000);
		test_progressive_decode(progressive, files[2][0], bitmaps[2][0], 0, count);
		test_progressive_decode(progressive, files[2][1], bitmaps[2][1], 1, count);
		test_progressive_decode(progressive, files[2][2], bitmaps[2][2], 2, count);
		test_progressive_decode(progressive, files[2][3], bitmaps[2][3], 3, count);
	}

	progressive_context_free(progressive);

	_aligned_free(g_DstData);

	return 0;
}