void gdi_graphics_pipeline_init(rdpGdi* gdi, RdpgfxClientContext* gfx) { gdi->gfx = gfx; gfx->custom = (void*) gdi; gfx->ResetGraphics = gdi_ResetGraphics; gfx->StartFrame = gdi_StartFrame; gfx->EndFrame = gdi_EndFrame; gfx->SurfaceCommand = gdi_SurfaceCommand; gfx->DeleteEncodingContext = gdi_DeleteEncodingContext; gfx->CreateSurface = gdi_CreateSurface; gfx->DeleteSurface = gdi_DeleteSurface; gfx->SolidFill = gdi_SolidFill; gfx->SurfaceToSurface = gdi_SurfaceToSurface; gfx->SurfaceToCache = gdi_SurfaceToCache; gfx->CacheToSurface = gdi_CacheToSurface; gfx->CacheImportReply = gdi_CacheImportReply; gfx->EvictCacheEntry = gdi_EvictCacheEntry; gfx->MapSurfaceToOutput = gdi_MapSurfaceToOutput; gfx->MapSurfaceToWindow = gdi_MapSurfaceToWindow; gfx->UpdateSurfaces = gdi_UpdateSurfaces; PROFILER_CREATE(gfx->SurfaceProfiler, "GFX-PROFILER"); }
static void rfx_profiler_create(RFX_CONTEXT* context) { PROFILER_CREATE(context->priv->prof_rfx_decode_rgb, "rfx_decode_rgb"); PROFILER_CREATE(context->priv->prof_rfx_decode_component, "rfx_decode_component"); PROFILER_CREATE(context->priv->prof_rfx_rlgr_decode, "rfx_rlgr_decode"); PROFILER_CREATE(context->priv->prof_rfx_differential_decode, "rfx_differential_decode"); PROFILER_CREATE(context->priv->prof_rfx_quantization_decode, "rfx_quantization_decode"); PROFILER_CREATE(context->priv->prof_rfx_dwt_2d_decode, "rfx_dwt_2d_decode"); PROFILER_CREATE(context->priv->prof_rfx_ycbcr_to_rgb, "prims->yCbCrToRGB"); PROFILER_CREATE(context->priv->prof_rfx_decode_format_rgb, "rfx_decode_format_rgb"); PROFILER_CREATE(context->priv->prof_rfx_encode_rgb, "rfx_encode_rgb"); PROFILER_CREATE(context->priv->prof_rfx_encode_component, "rfx_encode_component"); PROFILER_CREATE(context->priv->prof_rfx_rlgr_encode, "rfx_rlgr_encode"); PROFILER_CREATE(context->priv->prof_rfx_differential_encode, "rfx_differential_encode"); PROFILER_CREATE(context->priv->prof_rfx_quantization_encode, "rfx_quantization_encode"); PROFILER_CREATE(context->priv->prof_rfx_dwt_2d_encode, "rfx_dwt_2d_encode"); PROFILER_CREATE(context->priv->prof_rfx_rgb_to_ycbcr, "prims->RGBToYCbCr"); PROFILER_CREATE(context->priv->prof_rfx_encode_format_rgb, "rfx_encode_format_rgb"); }
/* ------------------------------------------------------------------------- */ static BOOL test_YCoCgRToRGB_8u_AC4R_func(UINT32 width, UINT32 height) { pstatus_t status = -1; BYTE* out_sse = NULL; BYTE* in = NULL; BYTE* out_c = NULL; UINT32 i, x; const UINT32 srcStride = width * 4; const UINT32 size = srcStride * height; const UINT32 formats[] = { PIXEL_FORMAT_ARGB32, PIXEL_FORMAT_ABGR32, PIXEL_FORMAT_RGBA32, PIXEL_FORMAT_RGBX32, PIXEL_FORMAT_BGRA32, PIXEL_FORMAT_BGRX32 }; PROFILER_DEFINE(genericProf); PROFILER_DEFINE(optProf); in = _aligned_malloc(size, 16); out_c = _aligned_malloc(size, 16); out_sse = _aligned_malloc(size, 16); if (!in || !out_c || !out_sse) goto fail; winpr_RAND(in, size); for (x = 0; x < sizeof(formats) / sizeof(formats[0]); x++) { const UINT32 format = formats[x]; const UINT32 dstStride = width * GetBytesPerPixel(format); const char* formatName = GetColorFormatName(format); PROFILER_CREATE(genericProf, "YCoCgRToRGB_8u_AC4R-GENERIC"); PROFILER_CREATE(optProf, "YCoCgRToRGB_8u_AC4R-OPT"); PROFILER_ENTER(genericProf); status = generic->YCoCgToRGB_8u_AC4R( in, srcStride, out_c, format, dstStride, width, height, 2, TRUE); PROFILER_EXIT(genericProf); if (status != PRIMITIVES_SUCCESS) goto loop_fail; PROFILER_ENTER(optProf); status = optimized->YCoCgToRGB_8u_AC4R( in, srcStride, out_sse, format, dstStride, width, height, 2, TRUE); PROFILER_EXIT(optProf); if (status != PRIMITIVES_SUCCESS) goto loop_fail; if (memcmp(out_c, out_sse, dstStride * height) != 0) { for (i = 0; i < width * height; ++i) { const UINT32 c = ReadColor(out_c + 4 * i, format); const UINT32 sse = ReadColor(out_sse + 4 * i, format); if (c != sse) { printf("optimized->YCoCgRToRGB FAIL[%s] [%"PRIu32"]: 0x%08"PRIx32" -> C 0x%08"PRIx32" vs optimized 0x%08"PRIx32"\n", formatName, i, in[i + 1], c, sse); status = -1; } } } printf("--------------------------- [%s] [%"PRIu32"x%"PRIu32"] ---------------------------\n", formatName, width, height); PROFILER_PRINT_HEADER; PROFILER_PRINT(genericProf); PROFILER_PRINT(optProf); PROFILER_PRINT_FOOTER; loop_fail: PROFILER_FREE(genericProf); PROFILER_FREE(optProf); if (status != PRIMITIVES_SUCCESS) goto fail; } fail: _aligned_free(in); _aligned_free(out_c); _aligned_free(out_sse); return status == PRIMITIVES_SUCCESS; }