From: Kostya Shishkov <[email protected]>

When using direct rendering the resulting image is otherwise garbled.

Bug-Id: vlc/9700
Signed-off-by: Luca Barbato <[email protected]>
---
 libavcodec/lagarith.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c
index ce2942a..b644cf2 100644
--- a/libavcodec/lagarith.c
+++ b/libavcodec/lagarith.c
@@ -248,9 +248,12 @@ static void lag_pred_line(LagarithContext *l, uint8_t *buf,
     int L, TL;
 
     if (!line) {
+        int i, width_minus1 = (width - 1) & ~31;
         /* Left prediction only for first line */
         L = l->dsp.add_hfyu_left_prediction(buf + 1, buf + 1,
-                                            width - 1, buf[0]);
+                                            width_minus1, buf[0]);
+        for (i = width_minus1 + 1; i < width; i++)
+            L = buf[i] += buf[i - 1];
     } else {
         /* Left pixel is actually prev_row[width] */
         L = buf[width - stride - 1];
@@ -276,11 +279,18 @@ static void lag_pred_line_yuy2(LagarithContext *l, 
uint8_t *buf,
     int L, TL;
 
     if (!line) {
+        int i, width_minus1;
         if (is_luma) {
             buf++;
             width--;
         }
-        l->dsp.add_hfyu_left_prediction(buf + 1, buf + 1, width - 1, buf[0]);
+
+        width_minus1 = (width - 1) & ~31;
+        l->dsp.add_hfyu_left_prediction(buf + 1, buf + 1, width_minus1, 
buf[0]);
+
+        for (i = width_minus1 + 1; i < width; i++)
+            L = buf[i] += buf[i - 1];
+
         return;
     }
     if (line == 1) {
-- 
1.8.5.1

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to