This patch corrects the bug, that if padbottom IS NOT specified and
authorCalcium <calcium@nurs.or.jp>
Sun, 27 Feb 2005 01:46:24 +0000 (01:46 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 27 Feb 2005 01:46:24 +0000 (01:46 +0000)
padright IS specified
patch by (Calcium <calcium nurs.or jp>)

Originally committed as revision 3987 to svn://svn.ffmpeg.org/ffmpeg/trunk

ffmpeg.c

index 6728ab7..46687f4 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -661,15 +661,15 @@ static void fill_pad_region(AVPicture* img, int height, int width,
             optr = img->data[i] + (img->linesize[i] * (padtop >> shift)) +
                 (img->linesize[i] - (padright >> shift));
 
-            for (y = 0; y < ((height - (padtop + padbottom)) >> shift); y++) {
+            for (y = 0; y < ((height - (padtop + padbottom) - 1) >> shift); y++) {
                 memset(optr, color[i], (padleft + padright) >> shift);
                 optr += img->linesize[i];
             }
         }
       
-        if (padbottom) {
-            optr = img->data[i] + (img->linesize[i] * ((height - padbottom) >> shift));
-            memset(optr, color[i], ((img->linesize[i] * padbottom) >> shift));
+        if (padbottom || padright) {
+            optr = img->data[i] + (((img->linesize[i] * (height - padbottom)) - padright) >> shift);
+            memset(optr, color[i], (((img->linesize[i] * padbottom) + padright) >> shift));
         }
     }
 }