Graphics performance optimization issue

Here's the problem :

I need to scroll a huge image of a wave form that has been rendered previously, WPF didn't let me assign that huge (80000*256) picture to an Image, it works for smaller (30000*256) images but it's so slow animating it that it's unpractical.

So what I decided was to use a WriteableBitmap that I assign to my Image.Source, and then I only have to update say 1920*256 (or only the width of the screen). It works much better now but after some profiling, it seems that the actual copying process takes quite some time and it's not 60 fps everytime.

I am already writing to the bitmap by locking it and using pointers.

My question is :

Do you know any (faster) way to update a bitmap ?

These pixels are already in memory in the huge bitmap, reading straight from here seems a wise idea; well, get rid of the WriteableBitmap between my Image.Source and my BitmapData.

Thanks for your help :)

-------------Problems Reply------------

You can try using BitmapSource.CopyPixels to extract the bytes with color information from the image (not sure if you need that) and BitmapSource.Create that creates a bitmap from a byte array (or its overload which can grab color information directly from unmanaged memory).

You can try using InteropBitmap to update the pixels as WriteableBitmap is kind of slow with its CPU bound internal operations. I have some code here that uses it: http://silverlightviewport.codeplex.com/SourceControl/changeset/view/57274#1534506

It's hardcoded for Bgra32, which is the only color space supported by InteropBitmap in 3.5 SP1. In 4.0 it should support 24 bit color spaces.

I have fixed it, using GC.Collect; still can't believe it fixed the problem. Don't know if it's a good practice but it works ...

That gave me headaches and nightmares the last few days but now most is sorted. The funny conclusion I'll have about this, is that GCCollectionMode.Optimized, thinks it's never the time to collect memory, it went up to use 2Gb, destabilizing the whole system (Windows) up to the point it freezes the mouse, lol ...

Thanks for your help :-)

Category:wpf Views:0 Time:2010-09-09
Tags: wpf graphics

Related post

  • Solved: Skyrim Mods and graphics/performance optimization 2014-06-23

    I tried out skyrim with a few mods. I can do ultra with no mods on 1920 X 1080 and really smooth. but i tried putting on just a few mods some of which i know tax the graphic and others i am not sure if they do or not and i had to drop to medium setti

  • Sharepoint Web performance optimization 2010-06-09

    We are running on SSL on following server topology: 1 ISA (SSL Terminate/cache/proxy+AD authentication) 1 Sharepoint 1 IBM DB2 Database as enterprise/corporate DB 1 MS SQL Server as local DB We have recently optimized the caching, compression, minifi

  • Windows Form graphics performance 2011-02-06

    I have a Windows Forms application in C#/.NET 4 that needs to repaint an area very rapidly (upwards of 60 FPS). The form is double buffered, and using the standard Invalidate() call works beautifully when I only update at 30FPS or less, but above 30

  • How-to's for MySQL InnoDB (insert) performance optimization? 2011-09-28

    I'm still struggling with the performance of my MySQL database using the InnoDB engine. Especially the performance of data insertion, minor the performance of running queries. I've been googling for information, how-to's and so on, but I found most i

  • Windows 8 under VMWare Player : better graphics performance possible? 2012-01-05

    Hi, I'm running an updated Windows 8 CDP under VMWare Player. Navigating around 8 is not as snappy as I would have hoped, and the graphics performance is horrible. Is this because I'm running as a virtual machine? Is my only hope of using the full ca

  • will a bad battery in a tablet cause performance speed issues 2012-07-08

    will a bad battery in a tablet cause performance speed issue --------------Solutions------------- Hi, Sometimes it may cause a performance issue, visit the following link to monitor how to take care of the battery: Taking care of your laptop's batter

  • How to improve graphic performance on my computer? 2012-12-19

    Original Title: grahic pblm I have got a dell inspiron N5010 with 4GB ran,Intel core I5 and windows 7 32-bit. I want to play games like NFS most wanted bt the graphics are poor,,,as i am playing this game in my friends laptop and in tat it work smoot

  • How can i increase my desktop graphics performance? 2013-04-24

    my new Asus A56 series laptop with a windows 8. It have a dedicated graphic card memory of 2 GB, with an inter core i7 3537 (2 GHz) and 4GB DDR3 RAM with an SSD hard disk. i was expecting it will hit the top (a score of at least 8 in assessment) but

  • Graphic performance terrible Win7 x64 and ATI FireMV 2400 Quad Port 2014-02-22

    Hi, I've got a new Lenovo desktop PC running Win7 x64 and an ATI FireMV 2400 PCIE. The graphics card was moved from an older Lenovo PC that ran Vista x32. On the Vista box the graphic card ran 3 x 30" screens without issue. On the Win7 x64 PC it's ki

  • How to improve desktop graphics performance? 2014-07-16

    Original title Question about desktop graphics performance Hi, I have a MSI GE70 laptop which has a Nvidia GTX 660M graphics card with 2GB of memory. Still I am getting only a 6,9 score in Desktop Graphic Performance. How can I improve my desktop gra

  • Desktop Graphics Performance Score Drops 2014-07-28

    Installed an AMD Radeon HD 5450 Graphics card with 2gb memory and my graphics performance score dropped from 5.3 to 4.0. I was expecting it to go up. Was previously running graphics from motherboard Intel HD graphics adapter. Dell Inspiron 600 64 bit

  • Why did my desktop graphics performance drop 0,9 after upgrading to windows 8? 2014-09-25

    I recently bought a samsung NP900X3C-A01AU, and after upgrading it to windows 8 the desktop graphics performance score in the windows experience index dropped from 6.4 to 5.5 while all other scores remained the same. why and how can i fix this? my co

  • How does C# 3.0 jagged array performance optimization vs. rectangular arrays work? 2009-12-31

    In the Apress book "Illustrated C# 2008", pg. 343 notes: "One-dimensional arrays have specific instructions in the CIL that allow them to be optimized for performance. Rectangular arrays do not have these instructions...Because of this, it can someti

  • Performance Optimization for Matrix Rotation 2010-06-03

    I'm now trapped by a performance optimization lab in the book "Computer System from a Programmer's Perspective" described as following: In a N*N matrix M, where N is multiple of 32, the rotate operation can be represented as: Transpose: interchange e

  • Simple to advanced SQL queries examples to practice MySQL query performance optimization 2010-07-03

    Looking for websites/books SQL queries from simple to advance (queries optimization and performanance etc.. ) questions and examples to exam for MySQL Job. Thanks --------------Solutions------------- For simple material coverage the online MySQL docs

  • Does Delphi compiler perform optimization? 2010-11-03

    I am using Delphi 7 IDE. Does Delphi compiler optimize codes, just like what the C++ compiler is doing in this following link? http://msdn.microsoft.com/en-us/library/aa366877(VS.85).aspx WCHAR szPassword[MAX_PATH]; // Retrieve the password if (GetPa

  • Do compute tasks running on the GPU negatively affect graphics performance? 2010-11-17

    I have never done GPU programming, but have finally acquired an Nvidia card to experiment with. However, the said card also drives my monitor. My question is whether running general purpose computing tasks on the card will negatively affect graphics

  • Recommended Books for ASP.NET performance optimization and testing 2011-08-29

    What would be a recommended book for ASP.NET performance optimization and testing? tks in advance! --------------Solutions------------- Packtpub.ASP.NET.Site.Performance.Secrets Here is table of content: http://www.packtpub.com/toc/aspnet-site-perfor

  • mysqltuner report for performance optimization 2011-10-29

    Very new to MySQL optimization techniques. Please find the below report of mysqltuner.pl and suggest what variables in my.cnf should I change for performance optimization. One more question - I'm not able to find few variables like query_cache_size,

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.690 (s). 11 q(s)