Browse code

lagarith: fix alignment on buffers passed into prediction dsp code.

This should fix issues with direct rendering

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2012/08/24 02:03:57
Showing 1 changed files
... ...
@@ -250,8 +250,8 @@ static void lag_pred_line(LagarithContext *l, uint8_t *buf,
250 250
 
251 251
     if (!line) {
252 252
         /* Left prediction only for first line */
253
-        L = l->dsp.add_hfyu_left_prediction(buf + 1, buf + 1,
254
-                                            width - 1, buf[0]);
253
+        L = l->dsp.add_hfyu_left_prediction(buf, buf,
254
+                                            width, 0);
255 255
     } else {
256 256
         /* Left pixel is actually prev_row[width] */
257 257
         L = buf[width - stride - 1];
... ...
@@ -277,11 +277,12 @@ static void lag_pred_line_yuy2(LagarithContext *l, uint8_t *buf,
277 277
     int L, TL;
278 278
 
279 279
     if (!line) {
280
-        if (is_luma) {
281
-            buf++;
282
-            width--;
283
-        }
284
-        l->dsp.add_hfyu_left_prediction(buf + 1, buf + 1, width - 1, buf[0]);
280
+        L= buf[0];
281
+        if (is_luma)
282
+            buf[0] = 0;
283
+        l->dsp.add_hfyu_left_prediction(buf, buf, width, 0);
284
+        if (is_luma)
285
+            buf[0] = L;
285 286
         return;
286 287
     }
287 288
     if (line == 1) {
... ...
@@ -294,14 +295,17 @@ static void lag_pred_line_yuy2(LagarithContext *l, uint8_t *buf,
294 294
             L += buf[i];
295 295
             buf[i] = L;
296 296
         }
297
-        buf   += HEAD;
298
-        width -= HEAD;
297
+        for (; i<width; i++) {
298
+            L     = mid_pred(L&0xFF, buf[i-stride], (L + buf[i-stride] - TL)&0xFF) + buf[i];
299
+            TL    = buf[i-stride];
300
+            buf[i]= L;
301
+        }
299 302
     } else {
300 303
         TL = buf[width - (2 * stride) - 1];
301 304
         L  = buf[width - stride - 1];
305
+        l->dsp.add_hfyu_median_prediction(buf, buf - stride, buf, width,
306
+                                        &L, &TL);
302 307
     }
303
-    l->dsp.add_hfyu_median_prediction(buf, buf - stride, buf, width,
304
-                                      &L, &TL);
305 308
 }
306 309
 
307 310
 static int lag_decode_line(LagarithContext *l, lag_rac *rac,