[FFmpeg-devel] [PATCH] Make 15-bpp MS Video 1 decoder not output 16-bpp
Kostya
kostya.shishkov
Sun Mar 8 22:31:49 CET 2009
15-bpp MS Video 1 decoder first colour high bit is used
to indicate coding mode (2 or 8-colour fill). Passing
that value as such to current swscaler disrupt bit magic
on conversion and you can see 2x2 red rectangles in
different places.
Some samples like
http://samples.mplayerhq.hu/V-codecs/CRAM/orbean.avi
manifest that problem.
Attached SwScaler patch for reference purpose only.
-------------- next part --------------
Index: libavcodec/msvideo1.c
===================================================================
--- libavcodec/msvideo1.c (revision 17881)
+++ libavcodec/msvideo1.c (working copy)
@@ -247,6 +247,7 @@
if (colors[0] & 0x8000) {
/* 8-color encoding */
CHECK_STREAM_PTR(12);
+ colors[0] &= 0x7FFF;
colors[2] = AV_RL16(&s->buf[stream_ptr]);
stream_ptr += 2;
colors[3] = AV_RL16(&s->buf[stream_ptr]);
-------------- next part --------------
Index: swscale_template.c
===================================================================
--- swscale_template.c (revision 28897)
+++ swscale_template.c (working copy)
@@ -1661,15 +1661,13 @@
int i;\
for (i=0; i<width; i++)\
{\
- int pix0= ((type*)src)[2*i+0];\
- int pix1= ((type*)src)[2*i+1];\
- int g= (pix0&(maskg|maska))+(pix1&(maskg|maska));\
- int b= ((pix0+pix1-g)&(maskb|(2*maskb)))>>shb;\
- int r= ((pix0+pix1-g)&(maskr|(2*maskr)))>>shr;\
- g&= maskg|(2*maskg);\
+ int b= (((type*)src)[2*i+0]&maskb)>>shb;\
+ int g= (((type*)src)[2*i+0]&maskg)>>shg;\
+ int r= (((type*)src)[2*i+0]&maskr)>>shr;\
+ b += (((type*)src)[2*i+1]&maskb)>>shb;\
+ g += (((type*)src)[2*i+1]&maskg)>>shg;\
+ r += (((type*)src)[2*i+1]&maskr)>>shr;\
\
- g>>=shg;\
-\
dstU[i]= ((RU)*r + (GU)*g + (BU)*b + (257<<(S)))>>((S)+1);\
dstV[i]= ((RV)*r + (GV)*g + (BV)*b + (257<<(S)))>>((S)+1);\
}\
More information about the ffmpeg-devel
mailing list