void test_peer_context_free(freerdp_peer* client, testPeerContext* context) { if (context) { if (context->debug_channel_thread) { SetEvent(context->stopEvent); WaitForSingleObject(context->debug_channel_thread, INFINITE); CloseHandle(context->debug_channel_thread); } Stream_Free(context->s, TRUE); free(context->icon_data); free(context->bg_data); rfx_context_free(context->rfx_context); nsc_context_free(context->nsc_context); if (context->debug_channel) WTSVirtualChannelClose(context->debug_channel); if (context->audin) audin_server_context_free(context->audin); if (context->rdpsnd) rdpsnd_server_context_free(context->rdpsnd); WTSCloseServer((HANDLE) context->vcm); } }
void test_peer_context_free(freerdp_peer* client, testPeerContext* context) { if (context) { if (context->debug_channel_thread) { freerdp_thread_stop(context->debug_channel_thread); freerdp_thread_free(context->debug_channel_thread); } stream_free(context->s); free(context->icon_data); free(context->bg_data); rfx_context_free(context->rfx_context); nsc_context_free(context->nsc_context); if (context->debug_channel) WTSVirtualChannelClose(context->debug_channel); if (context->audin) audin_server_context_free(context->audin); if (context->rdpsnd) rdpsnd_server_context_free(context->rdpsnd); WTSDestroyVirtualChannelManager(context->vcm); } }
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; }
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); }
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); }
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; }
static int shadow_encoder_uninit_nsc(rdpShadowEncoder* encoder) { if (encoder->nsc) { nsc_context_free(encoder->nsc); encoder->nsc = NULL; } encoder->codecs &= ~FREERDP_CODEC_NSCODEC; return 1; }
void test_nsc_decode(void) { int i; NSC_CONTEXT* context; context = nsc_context_new(); nsc_process_message(context, 32, 15, 10, (BYTE*) nsc_data, sizeof(nsc_data)); /*winpr_HexDump(context->bmpdata, 15 * 10 * 4);*/ for (i = 0; i < 30000; i++) { nsc_process_message(context, 32, 54, 44, (BYTE*) nsc_stress_data, sizeof(nsc_stress_data)); } nsc_context_free(context); }
void codecs_free(rdpCodecs* codecs) { if (!codecs) return; if (codecs->rfx) { rfx_context_free(codecs->rfx); codecs->rfx = NULL; } if (codecs->nsc) { nsc_context_free(codecs->nsc); codecs->nsc = NULL; } if (codecs->h264) { h264_context_free(codecs->h264); codecs->h264 = NULL; } if (codecs->clear) { clear_context_free(codecs->clear); codecs->clear = NULL; } if (codecs->progressive) { progressive_context_free(codecs->progressive); codecs->progressive = NULL; } if (codecs->planar) { freerdp_bitmap_planar_context_free(codecs->planar); codecs->planar = NULL; } if (codecs->interleaved) { bitmap_interleaved_context_free(codecs->interleaved); codecs->interleaved = NULL; } free(codecs); }
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 mf_peer_context_free(freerdp_peer* client, mfPeerContext* context) { if (context) { stream_free(context->s); rfx_context_free(context->rfx_context); nsc_context_free(context->nsc_context); if (context->audin) audin_server_context_free(context->audin); if (context->rdpsnd) rdpsnd_server_context_free(context->rdpsnd); WTSDestroyVirtualChannelManager(context->vcm); } }
int shadow_encoder_uninit_nsc(rdpShadowEncoder* encoder) { if (encoder->nsc) { nsc_context_free(encoder->nsc); encoder->nsc = NULL; } if (encoder->frameList) { ListDictionary_Free(encoder->frameList); encoder->frameList = NULL; } encoder->codecs &= ~SHADOW_CODEC_NSCODEC; return 1; }
int freerds_encoder_uninit_nsc(rdsEncoder* encoder) { if (encoder->nsc) { nsc_context_free(encoder->nsc); encoder->nsc = NULL; } if (encoder->frameList) { ListDictionary_Free(encoder->frameList); encoder->frameList = NULL; } encoder->codecs &= ~FREERDP_CODEC_NSCODEC; return 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; }