Home > other >  WPF do feel caton animation display
WPF do feel caton animation display

Time:09-21

Good bosses,
Recently in change of a function, the network transmission real-time picture frames, refresh the flash interface formation,
Binding in the Model View of Image, every time after receiving the ImageSource change Model,
Test the receiving efficiency, basic can reach 35 + frame can meet the requirements, but when the refresh is obviously not smooth, display refresh only ten to frame,
Excuse me is there any other better implementation scheme?

CodePudding user response:

Changes each time a picture, if the image is very big, of course, at this time of rendering will be very card

One way is to build images and display images in different threads, this can improve some performance

To the construction of a BitmapImage EndInit on another thread, pay attention to call Freeze method, and then on the main thread, according to this time will be able to use two threads to parse and display images, is expected to improve some performance, the other for image resolution, most of the graphics card has to the acceleration of JPG, WPF is just can use this part on accelerating, from the perspective of performance improvement, if can return to the JPG will be better, second, if every time is not the whole picture to refresh, also can improve some speed, join every time just return the incremental part, through the way of WriteableBitmap refresh part, also can achieve better performance, I was in the form of a WriteableBitmap flush the contents of a garbage manufacturer for camera, easy on the junk CPU refresh to 60 hz

CodePudding user response:

reference 1st floor lindexi_gd response:
change every time a picture, if the image is very big, of course, at this time of the rendering will be very card

One way is to build images and display images in different threads, this can improve some performance

To the construction of a BitmapImage EndInit on another thread, pay attention to call Freeze method, and then on the main thread, according to this time will be able to use two threads to parse and display images, is expected to improve some performance, the other for image resolution, most of the graphics card has to the acceleration of JPG, WPF is just can use this part on accelerating, from the perspective of performance improvement, if can return to the JPG will be better, second, if every time is not the whole picture to refresh, also can improve some speed, join every time just return the incremental part, through the way of WriteableBitmap refresh part, also can achieve better performance, I was in the form of a WriteableBitmap flush the contents of a garbage manufacturer for camera, easy on the junk CPU refresh to 60 hz


Thank you,
First of all, I was transformed by synchronously, because the format is more wonderful work, can only use bitmap receiving first, and then use the Image loaded, Endint and Freeze release space, again through the event delegation upload the Image on the binding parameters of memory, after the Freeze, I calculated the frame rate, is the title, 35 ~ 45 frames, looks is not the bottleneck, I tend to mishandling when loading the images or has reached the bottleneck/no discrete graphics hardware,

1, here said the "return to JPG" I don't quite understand what meaning be? Interface is saying?
2, the full amount of all picture refresh as animation acquisition is fixed quantity, if I still do the image contrast calculation, might not be suitable for larger workload,
3, about using the WriteableBitmap, meaning do not use binding, loaded into the picture, after WriteableBitmap filling interface through pictures?

CodePudding user response:

In receive Bitmap can be placed in another thread, this part can reduce the main thread caton
2. Return to JPG because rendering performance of JPG relatively faster
3. Use WriteableBitmap is to refresh the need to change the place, by modifying pixels and the same problem, need you to calculate what needs to be refreshed

CodePudding user response:

reference lindexi_gd reply: 3/f
1. Use Bitmap receiver can be placed in another thread, this part can reduce the main thread caton
2. Return to JPG because rendering performance of JPG relatively faster
3. Use WriteableBitmap is to refresh the need to change the place, by modifying pixels with the same problem, need you to calculate what need to refresh


And may I say not clear, the animation is a binary code, I handle the way is to use the format of the bitmap, and then into can display the imagesource, return to the JPG I didn't quite understand what mean?
The remaining two points I try, thank you

CodePudding user response:

reference moonk, 4/f, z response:
Quote: refer to the third floor lindexi_gd response:

In receive Bitmap can be placed in another thread, this part can reduce the main thread caton
2. Return to JPG because rendering performance of JPG relatively faster
3. Use WriteableBitmap is to refresh the need to change the place, by modifying pixels with the same problem, need you to calculate what need to refresh


And may I say not clear, the animation is a binary code, I handle the way is to use the format of the bitmap, and then into can display the imagesource, return to the JPG I didn't quite understand what mean?
The remaining two points I try, thank you


But Jpg are binary, that is, the binary format is returned by the server Jpg file

CodePudding user response:

Try the Image WritePixels method,

CodePudding user response:

If the transmission protocol of binary content must be compressed GZipStream large belch fart
  • Related