@@ -250,8 +250,8 @@ static void lag_pred_line(LagarithContext *l, uint8_t *buf,
250250
251251 if (!line ) {
252252 /* 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 );
255255 } else {
256256 /* Left pixel is actually prev_row[width] */
257257 L = buf [width - stride - 1 ];
@@ -277,11 +277,12 @@ static void lag_pred_line_yuy2(LagarithContext *l, uint8_t *buf,
277277 int L , TL ;
278278
279279 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 ;
285286 return ;
286287 }
287288 if (line == 1 ) {
@@ -294,14 +295,17 @@ static void lag_pred_line_yuy2(LagarithContext *l, uint8_t *buf,
294295 L += buf [i ];
295296 buf [i ] = L ;
296297 }
297- buf += HEAD ;
298- width -= HEAD ;
298+ for (; i < width ; i ++ ) {
299+ L = mid_pred (L & 0xFF , buf [i - stride ], (L + buf [i - stride ] - TL )& 0xFF ) + buf [i ];
300+ TL = buf [i - stride ];
301+ buf [i ]= L ;
302+ }
299303 } else {
300304 TL = buf [width - (2 * stride ) - 1 ];
301305 L = buf [width - stride - 1 ];
306+ l -> dsp .add_hfyu_median_prediction (buf , buf - stride , buf , width ,
307+ & L , & TL );
302308 }
303- l -> dsp .add_hfyu_median_prediction (buf , buf - stride , buf , width ,
304- & L , & TL );
305309}
306310
307311static int lag_decode_line (LagarithContext * l , lag_rac * rac ,
0 commit comments