[FFmpeg-cvslog] ffplay: fix greenish line on the right edge with some xv sizes

Marton Balint git at videolan.org
Tue Dec 25 16:43:01 CET 2012


ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Fri Dec  7 00:44:17 2012 +0100| [cf0c63d99ae47b838b439f365994e599d056b351] | committer: Marton Balint

ffplay: fix greenish line on the right edge with some xv sizes

If the XV image linesize was different from the width, SDL would create an
overlay wider than the actually requested one. This causes a greenish line on
the right, because the rightmost texel is blended with unset data.  This patch
introduces a function which duplicates the rightmost texel to the unset space,
that way the blending will be done with duplicated border texels.

Signed-off-by: Marton Balint <cus at passwd.hu>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cf0c63d99ae47b838b439f365994e599d056b351
---

 ffplay.c |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/ffplay.c b/ffplay.c
index b69b503..38673b5 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -1478,6 +1478,24 @@ static void alloc_picture(VideoState *is)
     SDL_UnlockMutex(is->pictq_mutex);
 }
 
+static void duplicate_right_border_pixels(SDL_Overlay *bmp) {
+    int i, width, height;
+    Uint8 *p, *maxp;
+    for (i = 0; i < 3; i++) {
+        width  = bmp->w;
+        height = bmp->h;
+        if (i > 0) {
+            width  >>= 1;
+            height >>= 1;
+        }
+        if (bmp->pitches[i] > width) {
+            maxp = bmp->pixels[i] + bmp->pitches[i] * height - 1;
+            for (p = bmp->pixels[i] + width - 1; p < maxp; p += bmp->pitches[i])
+                *(p+1) = *p;
+        }
+    }
+}
+
 static int queue_picture(VideoState *is, AVFrame *src_frame, double pts1, int64_t pos, int serial)
 {
     VideoPicture *vp;
@@ -1593,6 +1611,8 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts1, int64_
         sws_scale(is->img_convert_ctx, src_frame->data, src_frame->linesize,
                   0, vp->height, pict.data, pict.linesize);
 #endif
+        /* workaround SDL PITCH_WORKAROUND */
+        duplicate_right_border_pixels(vp->bmp);
         /* update the bitmap content */
         SDL_UnlockYUVOverlay(vp->bmp);
 



More information about the ffmpeg-cvslog mailing list