[FFmpeg-devel] [PATCH]Assume the avi palette as being opaque

Carl Eugen Hoyos cehoyos at ag.or.at
Thu Dec 15 01:12:54 CET 2011


Hi!

If I understand MSDN correctly, at least the changing palette uses 8 bytes to 
flag something (that we do not interpret afaiu) so it makes no sense to me not 
to assume an opaque palette.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index c74aa10..408f06d 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -618,12 +618,8 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
 
                         pal_size = FFMIN(pal_size, st->codec->extradata_size);
                         pal_src = st->codec->extradata + st->codec->extradata_size - pal_size;
-#if HAVE_BIGENDIAN
                         for (i = 0; i < pal_size/4; i++)
-                            ast->pal[i] = AV_RL32(pal_src+4*i);
+                            ast->pal[i] = 0xFF<<24 | AV_RL32(pal_src+4*i);
-#else
-                        memcpy(ast->pal, pal_src, pal_size);
-#endif
                         ast->has_pal = 1;
                     }
 
@@ -966,7 +962,7 @@ start_sync:
                 avio_rl16(pb); //flags
 
                 for (; k <= last; k++)
-                    ast->pal[k] = avio_rb32(pb)>>8;// b + (g << 8) + (r << 16);
+                    ast->pal[k] = 0xFF<<24 | avio_rb32(pb)>>8;// b + (g << 8) + (r << 16);
                 ast->has_pal= 1;
                 goto start_sync;
             } else if(   ((ast->prefix_count<5 || sync+9 > i) && d[2]<128 && d[3]<128) ||


More information about the ffmpeg-devel mailing list