summaryrefslogtreecommitdiffstats
path: root/dec_video.c
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-09-24 21:07:12 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-09-24 21:07:12 +0000
commite52171e1df77b095201204cec4546a12757769d2 (patch)
tree5c961f1d7d4f0fbeab503bab500be7fdaaab6cae /dec_video.c
parent9d4682c79006886dd3310b3b85b17eb45a1d2e5f (diff)
downloadmpv-e52171e1df77b095201204cec4546a12757769d2.tar.bz2
mpv-e52171e1df77b095201204cec4546a12757769d2.tar.xz
rle 15,16bpp support (palette conversion)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1950 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'dec_video.c')
-rw-r--r--dec_video.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/dec_video.c b/dec_video.c
index 333602e3ac..76937e5b91 100644
--- a/dec_video.c
+++ b/dec_video.c
@@ -357,6 +357,24 @@ switch(sh_video->codec->driver){
case VFM_RLE: {
int bpp=((out_fmt&255)+7)/8; // RGB only
sh_video->our_out_buffer = memalign(64,sh_video->disp_w*sh_video->disp_h*bpp); // FIXME!!!
+ if(bpp==2){ // 15 or 16 bpp ==> palette conversion!
+ unsigned int* pal=(unsigned int*)(((char*)sh_video->bih)+40);
+ //int cols=(sh_video->bih->biSize-40)/4;
+ int cols=1<<(sh_video->bih->biBitCount);
+ int i;
+ if(cols>256) cols=256;
+ printf("RLE: converting palette for %d colors.\n",cols);
+ for(i=0;i<cols;i++){
+ unsigned int c=pal[i];
+ unsigned int b=c&255;
+ unsigned int g=(c>>8)&255;
+ unsigned int r=(c>>16)&255;
+ if((out_fmt&255)==15)
+ pal[i]=((r>>3)<<10)|((g>>3)<<5)|((b>>3));
+ else
+ pal[i]=((r>>3)<<11)|((g>>2)<<5)|((b>>3));
+ }
+ }
break;
}
}