#8988 closed patch
New IFF parser
Reported by: | peres | Owned by: | peres |
---|---|---|---|
Priority: | normal | Component: | --Other-- |
Version: | Keywords: | ||
Cc: | Game: |
Description
I was extending the ILBM format decoder for Big Red Adventure when I ran into a better implementation of the underlying IFF parser (in Kyra).
The current IFF parser only allows sequential access to the chunks, whereas the one in the patch doesn't have this limitation. As a result, client code can effectively search for the chunks it needs instead of scanning all the file accumulating state.
The ILBM decoder I was working on came out so much better without switch()'s, that I ended up ditching the whole current IFFParser and adapted its users: ILBMDecoder, PBMDecoder and A8SVXDecoder.
The patch contains the related changes, together with adaptations to Parallaction (for A8SVXDecoder), and a one-liner in Saga (for PBMDecoder).
Ticket imported from: #2704062. Ticket imported from: patches/1093.
Attachments (2)
Change History (14)
by , 16 years ago
Attachment: | iff001.patch added |
---|
comment:1 by , 16 years ago
While being able to arbitrarily switch between chunks certainly simplifies the parsing code, the drawback is that now you suddenly must read from a seekable stream. This can affect performance quite negatively. Esp. on low end devices. It is also annoying if one wants to read data from a compressed stream.
comment:2 by , 16 years ago
If being able to read a seekable stream is not acceptable for the parser, I can switch it back to work on a ReadStream.
I am going to submit another patch based a bit on the iffparse library in AmigaOS. This shouldn't require more than a ReadStream, but also provide an interface that looks like the one in the patch.
comment:3 by , 16 years ago
The patch looks good to me, apart from the issue that fingolfin pointed out already. The new code looks cleaner and more organized. Something quite minor: there are a lot of newlnes at the end of graphics/iff.cpp
comment:4 by , 16 years ago
Here is a new implementation of the parser. I changed the underlying stream to a ReadStream, as it is currently in trunk.
The client has to tell the parser which chunks are needed before the process starts. The parser will then scan the file and store the requested chunk in memory, from where they can be retrieved by the client when parsing is over.
The client can also instruct the parser to pause when a certain chunk is found, and obtain a ReadStream* to the data. This may be useful when a big chunk of data must be analyzed, but can't used verbatim (e.g., a packed bitmap).
The usage is shown in the ILBMDecoder included in the zip file.
by , 16 years ago
Attachment: | iff-002.zip added |
---|
A IFF parser using a ReadStream, and its ILBMDecoder companion.
comment:5 by , 15 years ago
Peres, please, commit it. I can provide you the ITE demo which makes use of PBM images, so you can doublecheck it works well.
Only remark: As I understand, we are talking about moving this parser from common/parallacion to graphics/? Because your last patch contained files from engines/parallaction directory only.
comment:6 by , 15 years ago
Owner: | set to |
---|
comment:7 by , 15 years ago
Thank you for the feedback. As you understood, although the attached patch is on engine/parallaction, the parser will be moved into common/, with changes to related iff files in graphics/ and sound/. I'm working to adapt the current patch and will post a followup and commit as soon as it's done.
About the ITE demo, I have one; I just need to know where I have to go to trigger the loading of a PBM resource.
comment:8 by , 15 years ago
- Skip intro. - Leave the tent (click either of the sites) - Follow the yellow road until you leave the village. The path is straight - You fill wind yourself on the world map - Then all but one location display static PBM images: o Boar castle, right down o Elk's forest, on the left o Rat's cave left top o Tycho's house, top right o Ferret's village, down o Sanctuary, in the center, slightly right
comment:9 by , 15 years ago
What's the status of this item? I thought it was (at least partially) committed?
comment:10 by , 15 years ago
The parser was committed and related code updated. I'm thus closing the ticket.
comment:11 by , 15 years ago
Status: | new → closed |
---|
comment:12 by , 6 years ago
Component: | → --Other-- |
---|
New IFF parser and related classes.