void test_decode(void) { RFX_CONTEXT* context; BYTE decode_buffer[4096 * 3]; STREAM* s; s = stream_new(sizeof(y_data) + sizeof(cb_data) + sizeof(cr_data)); stream_write(s, y_data, sizeof(y_data)); stream_write(s, cb_data, sizeof(cb_data)); stream_write(s, cr_data, sizeof(cr_data)); stream_set_pos(s, 0); context = rfx_context_new(); context->mode = RLGR3; rfx_context_set_pixel_format(context, RDP_PIXEL_FORMAT_R8G8B8); rfx_decode_rgb(context, s, sizeof(y_data), test_quantization_values, sizeof(cb_data), test_quantization_values, sizeof(cr_data), test_quantization_values, decode_buffer); rfx_context_free(context); stream_free(s); dump_ppm_image(decode_buffer); }
void test_message(void) { RFX_CONTEXT* context; STREAM* s; int i, j; RFX_RECT rect = {0, 0, 100, 80}; RFX_MESSAGE * message; rgb_data = (BYTE *) malloc(100 * 80 * 3); for (i = 0; i < 80; i++) memcpy(rgb_data + i * 100 * 3, rgb_scanline_data, 100 * 3); s = stream_new(65536); stream_clear(s); context = rfx_context_new(); context->mode = RLGR3; context->width = 800; context->height = 600; rfx_context_set_pixel_format(context, RDP_PIXEL_FORMAT_R8G8B8); for (i = 0; i < 1000; i++) { s = stream_new(65536); stream_clear(s); rfx_compose_message(context, s, &rect, 1, rgb_data, 100, 80, 100 * 3); stream_seal(s); /*hexdump(buffer, size);*/ stream_set_pos(s, 0); message = rfx_process_message(context, s->p, s->size); if (i == 0) { for (j = 0; j < message->num_tiles; j++) { dump_ppm_image(message->tiles[j]->data); } } rfx_message_free(context, message); stream_free(s); } rfx_context_free(context); free(rgb_data); }
void test_decode(void) { RFX_CONTEXT * context; uint8 decode_buffer[4096 * 3]; context = rfx_context_new(); context->mode = RLGR3; rfx_context_set_pixel_format(context, RFX_PIXEL_FORMAT_RGB); rfx_decode_rgb(context, y_data, sizeof(y_data), test_quantization_values, cb_data, sizeof(cb_data), test_quantization_values, cr_data, sizeof(cr_data), test_quantization_values, decode_buffer); rfx_context_free(context); dump_ppm_image(decode_buffer); }
void test_encode(void) { RFX_CONTEXT* context; STREAM* enc_stream; int y_size, cb_size, cr_size; int i; BYTE decode_buffer[4096 * 3]; rgb_data = (BYTE *) malloc(64 * 64 * 3); for (i = 0; i < 64; i++) memcpy(rgb_data + i * 64 * 3, rgb_scanline_data, 64 * 3); //freerdp_hexdump(rgb_data, 64 * 64 * 3); enc_stream = stream_new(65536); stream_clear(enc_stream); context = rfx_context_new(); context->mode = RLGR3; rfx_context_set_pixel_format(context, RDP_PIXEL_FORMAT_R8G8B8); rfx_encode_rgb(context, rgb_data, 64, 64, 64 * 3, test_quantization_values, test_quantization_values, test_quantization_values, enc_stream, &y_size, &cb_size, &cr_size); //dump_buffer(context->priv->cb_g_buffer, 4096); /*printf("*** Y ***\n"); freerdp_hexdump(stream_get_head(enc_stream), y_size); printf("*** Cb ***\n"); freerdp_hexdump(stream_get_head(enc_stream) + y_size, cb_size); printf("*** Cr ***\n"); freerdp_hexdump(stream_get_head(enc_stream) + y_size + cb_size, cr_size);*/ stream_set_pos(enc_stream, 0); rfx_decode_rgb(context, enc_stream, y_size, test_quantization_values, cb_size, test_quantization_values, cr_size, test_quantization_values, decode_buffer); dump_ppm_image(decode_buffer); rfx_context_free(context); stream_free(enc_stream); free(rgb_data); }
void test_message(void) { RFX_CONTEXT * context; uint8 buffer[1024000]; int size; int i, j; RFX_RECT rect = {0, 0, 100, 80}; RFX_MESSAGE * message; rgb_data = (uint8 *) malloc(100 * 80 * 3); for (i = 0; i < 80; i++) memcpy(rgb_data + i * 100 * 3, rgb_scanline_data, 100 * 3); context = rfx_context_new(); context->mode = RLGR3; context->width = 800; context->height = 600; rfx_context_set_pixel_format(context, RFX_PIXEL_FORMAT_RGB); size = rfx_compose_message_header(context, buffer, sizeof(buffer)); /*hexdump(buffer, size);*/ message = rfx_process_message(context, buffer, size); rfx_message_free(context, message); for (i = 0; i < 1000; i++) { size = rfx_compose_message_data(context, buffer, sizeof(buffer), &rect, 1, rgb_data, 100, 80, 100 * 3); /*hexdump(buffer, size);*/ message = rfx_process_message(context, buffer, size); if (i == 0) { for (j = 0; j < message->num_tiles; j++) { dump_ppm_image(message->tiles[j]->data); } } rfx_message_free(context, message); } rfx_context_free(context); free(rgb_data); }
void test_encode(void) { RFX_CONTEXT * context; uint8 ycbcr_buffer[1024000]; int y_size, cb_size, cr_size; int i; uint8 decode_buffer[4096 * 3]; rgb_data = (uint8 *) malloc(64 * 64 * 3); for (i = 0; i < 64; i++) memcpy(rgb_data + i * 64 * 3, rgb_scanline_data, 64 * 3); //hexdump(rgb_data, 64 * 64 * 3); context = rfx_context_new(); context->mode = RLGR3; rfx_context_set_pixel_format(context, RFX_PIXEL_FORMAT_RGB); rfx_encode_rgb(context, rgb_data, 64, 64, 64 * 3, test_quantization_values, test_quantization_values, test_quantization_values, ycbcr_buffer, sizeof(ycbcr_buffer), &y_size, &cb_size, &cr_size); //dump_buffer(context->cb_g_buffer, 4096); /*printf("*** Y ***\n"); hexdump(ycbcr_buffer, y_size); printf("*** Cb ***\n"); hexdump(ycbcr_buffer + y_size, cb_size); printf("*** Cr ***\n"); hexdump(ycbcr_buffer + y_size + cb_size, cr_size);*/ rfx_decode_rgb(context, ycbcr_buffer, y_size, test_quantization_values, ycbcr_buffer + y_size, cb_size, test_quantization_values, ycbcr_buffer + y_size + cb_size, cr_size, test_quantization_values, decode_buffer); dump_ppm_image(decode_buffer); rfx_context_free(context); free(rgb_data); }