[MPlayer-dev-eng] GIF help needed
Roberto Togni
r_togni at libero.it
Thu Jan 23 00:24:30 CET 2003
On 2003.01.22 21:47 Joey Parrish wrote:
> Hello,
>
> I submitted a patch before to add GIF demux/decode support to MPlayer.
> It was rejected because it made the decoder dependant on the demuxer
> and it didn't really decode so much as colormap and blit.
>
> On Arpi's suggestion, I made another patch where GIF demuxer colormaps
> it all into RGB24 and outputs raw RGB. (Instead of sending indexed
> values to decoder and having decoder map them to RGB24.)
>
> The problem is that so far, only the wrong way to do it actually
> works.
> The version that needs no vd_gif displays garbled colors. I have the
> feeling that I'm doing something stupid, so I would really appreciate
> it
> if someone could look at the patches and help me find my problem.
Hi Joey.
I'm looking at your patch.
I tried the right_broken version, and it displays the first frame of
the gif correctly for me. Then, the vd_raw decoder complains about
frame being too small.
If i got your vd_gif right, the next frames can be subpictures of the
first frame, overwriteing only a portion of the output picture (i'm
talking about the gif->Image.Top and gif->Image.Left stuff).
If that's true, it won't work without the vd_gif module, unless you
store the previous frame in some private area into the demuxer, update
it, and pass the complete frame to the decoder, since the vd_raw module
expects a full size frame (the same is true even if you use RGB8
format).
I'll have a deeper look at it, but i don't think i'll be able to do it
tonight.
Update: with the attached patch (copied the Top/Left stuff from vd_gif)
i was able to play gifs that don't use partial update (mostly untested)
The code also have problems with some static gifs (progressive ones?
i'll have to check).
Ciao,
Roberto
-------------- next part --------------
--- demux_gif.c Wed Jan 22 22:41:22 2003
+++ demux_gif.c.r Wed Jan 22 23:54:28 2003
@@ -115,13 +115,22 @@
if (effective_map == NULL) effective_map = gif->SColorMap;
{
- int x;
- for (x = 0; x < len; x++) {
- dp->buffer[(x * 3) + 0] = effective_map->Colors[buf[x]].Red;
- dp->buffer[(x * 3) + 1] = effective_map->Colors[buf[x]].Green;
- dp->buffer[(x * 3) + 2] = effective_map->Colors[buf[x]].Blue;
+ int x, y;
+ for (y = 0; y < gif->Image.Height; y++) {
+ unsigned char *drow = dp->buffer;
+ unsigned char *gbuf = buf + (y * gif->Image.Width);
+
+ drow += gif->Image.Width * (y + gif->Image.Top)*3;
+ drow += gif->Image.Left * 3;
+
+ for (x = 0; x < gif->Image.Width; x++) {
+ drow[(x * 3) + 0] = effective_map->Colors[gbuf[x]].Red;
+ drow[(x * 3) + 1] = effective_map->Colors[gbuf[x]].Green;
+ drow[(x * 3) + 2] = effective_map->Colors[gbuf[x]].Blue;
+ }
}
}
+
free(buf);
More information about the MPlayer-dev-eng
mailing list