mirror of
https://github.com/mpv-player/mpv
synced 2025-03-11 04:44:32 +01:00
100l fix for paletted 8bpp files, I committed an old version
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10714 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
1f6287474f
commit
9f0de88e6d
@ -84,8 +84,6 @@ static int init(sh_video_t *sh)
|
||||
int vo_ret; // Video output init ret value
|
||||
qt8bps_context_t *hc; // Decoder context
|
||||
BITMAPINFOHEADER *bih = sh->bih;
|
||||
int i;
|
||||
unsigned char *psrc, *pdest;
|
||||
|
||||
if ((hc = malloc(sizeof(qt8bps_context_t))) == NULL) {
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Can't allocate memory for 8BPS decoder context.\n");
|
||||
@ -99,16 +97,10 @@ static int init(sh_video_t *sh)
|
||||
case 8:
|
||||
hc->planes = 1;
|
||||
hc->planemap[0] = 0; // 1st plane is palette indexes
|
||||
if (bih->biSize > sizeof(BITMAPINFOHEADER)) {
|
||||
psrc = (unsigned char*)bih + sizeof(BITMAPINFOHEADER);
|
||||
pdest = hc->palette = (unsigned char *)malloc(256*3);
|
||||
for (i = 0; i < 256; i++) {
|
||||
*pdest++ = *psrc++;
|
||||
*pdest++ = *psrc++;
|
||||
*pdest++ = *psrc++;
|
||||
psrc++;
|
||||
}
|
||||
}
|
||||
if (bih->biSize > sizeof(BITMAPINFOHEADER)) {
|
||||
hc->palette = (unsigned char *)malloc(256*4);
|
||||
memcpy(hc->palette, (unsigned char*)bih + sizeof(BITMAPINFOHEADER), 256*4);
|
||||
}
|
||||
break;
|
||||
case 24:
|
||||
hc->planes = 3;
|
||||
|
Loading…
x
Reference in New Issue
Block a user