access: bluray: check stride difference
authorFrancois Cartegnie <fcvlcdev@free.fr>
Mon, 9 Mar 2020 13:26:01 +0000 (14:26 +0100)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Mon, 9 Mar 2020 13:51:22 +0000 (14:51 +0100)
modules/access/bluray.c

index bab725f..252c625 100644 (file)
@@ -2072,11 +2072,19 @@ static void blurayDrawArgbOverlay(demux_t *p_demux, const BD_ARGB_OVERLAY* const
                            p_reg->p_picture->p[0].i_pitch * eventov->y +
                            eventov->x * 4;
 
-    for (int y = 0; y < eventov->h; y++)
+    /* always true as for now, see bd_bdj_osd_cb */
+    if(likely(eventov->stride == p_reg->p_picture->p[0].i_pitch / 4))
+    {
+        memcpy(dst0, src0, (eventov->stride * eventov->h - eventov->x)*4);
+    }
+    else
     {
-        memcpy(dst0, src0, eventov->w * 4);
-        src0 += eventov->stride;
-        dst0 += p_reg->p_picture->p[0].i_pitch;
+        for(uint16_t h = 0; h < eventov->h; h++)
+        {
+            memcpy(dst0, src0, eventov->w * 4);
+            src0 += eventov->stride;
+            dst0 += p_reg->p_picture->p[0].i_pitch;
+        }
     }
 
     vlc_mutex_unlock(&ov->lock);