mirror of https://github.com/mpv-player/mpv
Simplify gif demuxer by using memcpy_pic
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21903 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
d359f1537c
commit
16c183be83
|
@ -17,6 +17,7 @@
|
||||||
#include "stheader.h"
|
#include "stheader.h"
|
||||||
|
|
||||||
#include <gif_lib.h>
|
#include <gif_lib.h>
|
||||||
|
#include "libvo/fastmemcpy.h"
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int current_pts;
|
int current_pts;
|
||||||
unsigned char *palette;
|
unsigned char *palette;
|
||||||
|
@ -125,6 +126,7 @@ static int demux_gif_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds)
|
||||||
int t = FFMAX(FFMIN(gif->Image.Top, priv->h), 0);
|
int t = FFMAX(FFMIN(gif->Image.Top, priv->h), 0);
|
||||||
int w = FFMAX(FFMIN(gif->Image.Width, priv->w - l), 0);
|
int w = FFMAX(FFMIN(gif->Image.Width, priv->w - l), 0);
|
||||||
int h = FFMAX(FFMIN(gif->Image.Height, priv->h - t), 0);
|
int h = FFMAX(FFMIN(gif->Image.Height, priv->h - t), 0);
|
||||||
|
unsigned char *dest = dp->buffer + priv->w * t + l;
|
||||||
|
|
||||||
// copy the palette
|
// copy the palette
|
||||||
for (y = 0; y < cnt; y++) {
|
for (y = 0; y < cnt; y++) {
|
||||||
|
@ -134,14 +136,7 @@ static int demux_gif_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds)
|
||||||
priv->palette[(y * 4) + 3] = 0;
|
priv->palette[(y * 4) + 3] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (y = 0; y < h; y++) {
|
memcpy_pic(dest, buf, w, h, priv->w, gif->Image.Width);
|
||||||
unsigned char *drow = dp->buffer;
|
|
||||||
unsigned char *gbuf = buf + (y * gif->Image.Width);
|
|
||||||
|
|
||||||
drow += priv->w * (y + t) + l;
|
|
||||||
|
|
||||||
memcpy(drow, gbuf, w);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
|
|
Loading…
Reference in New Issue