Closed Bug 195223 Opened 22 years ago Closed 12 years ago

Make some GIF Frames non-mutable

Categories

(Core Graveyard :: Image: Painting, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: paper, Assigned: alfredkayser)

Details

(Keywords: perf)

Attachments

(1 file, 2 obsolete files)

We can now set GIF frames to non-mutable if they are never going to be accessed again by the current implementations of BlackenFrame, SetMaskInvisibility, CopyImageFrame, and nsImage::DrawToImage (or gfxImageFrame::DrawTo) That leaves not very many cases where the frame can be set to non-mutable, but enough to warrant a little patch, since when the circumstances do occur, CPU usage seems to drop by at least 1/2. This appears to be the cause of slow animated GIFs on some (particularly some nVidia) video cards. Once the above mentioned imgContainerGIF functions are moved to nsIImage, all frames can be set non-mutable (although there should be some limit, like only the first 15 frames, so that we don't run out of resources). That's not this bug. I'll file a new bug for that.
This one from http://bugzilla.mozilla.org/show_bug.cgi?id=195044#c9 rocks! 0% CPU usage. Athlon 1.8, WinXP, GeForce4 Great work Arron!
Attached patch Set some GIF frames as NonMutable (obsolete) (deleted) — Splinter Review
If we never need the frame's bits, then we can SetMutable(PR_FALSE), which optimizes the frame and makes it go vroom vroom on nVidia cards. :) Eventually I'll be able to set all the frames as non-mutable, but that won't happen for a long while.
Attached patch Set some GIF frames as NonMutable (obsolete) (deleted) — Splinter Review
More context
Attachment #116349 - Attachment is obsolete: true
Attachment #116350 - Flags: review?(cbiesinger)
-> me
Assignee: jdunn → paper
Comment on attachment 116350 [details] [diff] [review] Set some GIF frames as NonMutable Found a nasty crasher with this code. Marking Obselete and removing review request.
Attachment #116350 - Attachment is obsolete: true
Attachment #116350 - Flags: review?(cbiesinger)
This patch does the following: * Helper function to only optimize if not allready optimized * For each added frame, + check if the this frame is full, and its disposal is clear then current may be optimized + check if this frame does not need previous to be restored, and is not transparent, than previous may be optimized. * When a frame is composited and is not needed, instead of copy whole frame into 'nextFrame' replace the object nextFrame with it in the array, and optimize the prevFrame (because displosal is CLEAR_ALL) This patch is tested and works with all of the tests of: http://mozilla.animecity.nu/IMGTest http://jogi.austin.ibm.com/animatedgif.html
QA Contact: tpreston → image.gfx
Alfred in comment #6) > Created an attachment (id=173357) [details] > Updated version, doing more with less code, and tested with current build Alfred is the patch suitable to ask for approvals and checkin? > This patch is tested and works with all of the tests of: > http://mozilla.animecity.nu/IMGTest > http://jogi.austin.ibm.com/animatedgif.html these URLs are dead
I need first to check to if this patch is still valid, and there are currently other patches pending for this code...
Taking this bug, but the large part of it is not relevant anymore. So, this needs to be checked first...
Assignee: paper → alfredkayser
Product: Core → Core Graveyard
This is no longer relevant, as image data is treated in completely different way now.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: