Closed Bug 1194058 Opened 9 years ago Closed 9 years ago

Add downscale-during-decode support for the GIF decoder

Categories

(Core :: Graphics: ImageLib, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla43
Tracking Status
firefox43 --- fixed

People

(Reporter: seth, Assigned: seth)

References

(Blocks 1 open bug)

Details

(Whiteboard: [gfx-noted])

Attachments

(2 files)

No description provided.
Depends on: 1194059
Whiteboard: [gfx-noted]
This is a preliminary patch that adds a helper class, Deinterlacer, which buffers decoded rows of an image until an interlacing pass is over and can then send them to a Downscaler for downscaling. Obviously this boils down to buffering an un-downscaled copy of the image. This means that for interlaced images that use Deinterlacer, DDD doesn't offer any memory savings during decoding, but the Downscaler can be discarded afterwards, so memory savings will continue as usual once the decode is complete. Something similar to this is somewhat inevitable when interlacing is involved. Conveniently, libpng does this for us internally, but since we implemented the GIF decoder ourselves, we have to add buffering manually using Deinterlacer.
Attachment #8662246 - Flags: review?(tnikkel)
Assignee: nobody → seth
Status: NEW → ASSIGNED
This patch adds DDD support for the GIF decoder. The approach is very simple to the one used for the PNG decoder. The new wrinkles are: - GIFs can have first frame padding, which means we need to compute a scaled version of the frame rect when allocating a frame. - GIFs can have interlacing, and we don't currently do any extra buffering to perform deinterlacing. Part 1 added Deinterlacer, which serves as that extra buffer. If we determine that the GIF is interlaced, we create a Deinterlacer and write rows into it until an interlaced pass is complete. Then we use Deinterlacer::PropagatePassToDownscaler() to downscale all the rows from that pass at once. All of this means that when we want to write a decoded row of the image into a buffer, there are now three possible destinations: mImageData, if we're not downscaling; our Downscaler's buffer, if we're downscaling but not deinterlacing; and our Deinterlacer's buffer, if we're downscaling *and* deinterlacing. GetCurrentRowBuffer() hides this complexity from most of the GIF decoder code.
Attachment #8662251 - Flags: review?(tnikkel)
(Woot, after this lands all the decoders will support DDD!)
Attachment #8662246 - Flags: review?(tnikkel) → review+
Attachment #8662251 - Flags: review?(tnikkel) → review+
Thanks for the review!
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
Depends on: 1207378
Depends on: 1208764
Depends on: 1208935
Depends on: 1213744
Depends on: 1231121
Depends on: 1229825
Depends on: 1235605
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: