]> granicus.if.org Git - libvpx/blob - vp8/common/vp8_loopfilter.c
Rename vp8 loopfilter[_neon.c]
[libvpx] / vp8 / common / vp8_loopfilter.c
1 /*
2  *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10
11
12 #include "vpx_config.h"
13 #include "vp8_rtcd.h"
14 #include "loopfilter.h"
15 #include "onyxc_int.h"
16 #include "vpx_mem/vpx_mem.h"
17
18
19 static void lf_init_lut(loop_filter_info_n *lfi)
20 {
21     int filt_lvl;
22
23     for (filt_lvl = 0; filt_lvl <= MAX_LOOP_FILTER; filt_lvl++)
24     {
25         if (filt_lvl >= 40)
26         {
27             lfi->hev_thr_lut[KEY_FRAME][filt_lvl] = 2;
28             lfi->hev_thr_lut[INTER_FRAME][filt_lvl] = 3;
29         }
30         else if (filt_lvl >= 20)
31         {
32             lfi->hev_thr_lut[KEY_FRAME][filt_lvl] = 1;
33             lfi->hev_thr_lut[INTER_FRAME][filt_lvl] = 2;
34         }
35         else if (filt_lvl >= 15)
36         {
37             lfi->hev_thr_lut[KEY_FRAME][filt_lvl] = 1;
38             lfi->hev_thr_lut[INTER_FRAME][filt_lvl] = 1;
39         }
40         else
41         {
42             lfi->hev_thr_lut[KEY_FRAME][filt_lvl] = 0;
43             lfi->hev_thr_lut[INTER_FRAME][filt_lvl] = 0;
44         }
45     }
46
47     lfi->mode_lf_lut[DC_PRED] = 1;
48     lfi->mode_lf_lut[V_PRED] = 1;
49     lfi->mode_lf_lut[H_PRED] = 1;
50     lfi->mode_lf_lut[TM_PRED] = 1;
51     lfi->mode_lf_lut[B_PRED]  = 0;
52
53     lfi->mode_lf_lut[ZEROMV]  = 1;
54     lfi->mode_lf_lut[NEARESTMV] = 2;
55     lfi->mode_lf_lut[NEARMV] = 2;
56     lfi->mode_lf_lut[NEWMV] = 2;
57     lfi->mode_lf_lut[SPLITMV] = 3;
58
59 }
60
61 void vp8_loop_filter_update_sharpness(loop_filter_info_n *lfi,
62                                       int sharpness_lvl)
63 {
64     int i;
65
66     /* For each possible value for the loop filter fill out limits */
67     for (i = 0; i <= MAX_LOOP_FILTER; i++)
68     {
69         int filt_lvl = i;
70         int block_inside_limit = 0;
71
72         /* Set loop filter paramaeters that control sharpness. */
73         block_inside_limit = filt_lvl >> (sharpness_lvl > 0);
74         block_inside_limit = block_inside_limit >> (sharpness_lvl > 4);
75
76         if (sharpness_lvl > 0)
77         {
78             if (block_inside_limit > (9 - sharpness_lvl))
79                 block_inside_limit = (9 - sharpness_lvl);
80         }
81
82         if (block_inside_limit < 1)
83             block_inside_limit = 1;
84
85         memset(lfi->lim[i], block_inside_limit, SIMD_WIDTH);
86         memset(lfi->blim[i], (2 * filt_lvl + block_inside_limit), SIMD_WIDTH);
87         memset(lfi->mblim[i], (2 * (filt_lvl + 2) + block_inside_limit),
88                SIMD_WIDTH);
89     }
90 }
91
92 void vp8_loop_filter_init(VP8_COMMON *cm)
93 {
94     loop_filter_info_n *lfi = &cm->lf_info;
95     int i;
96
97     /* init limits for given sharpness*/
98     vp8_loop_filter_update_sharpness(lfi, cm->sharpness_level);
99     cm->last_sharpness_level = cm->sharpness_level;
100
101     /* init LUT for lvl  and hev thr picking */
102     lf_init_lut(lfi);
103
104     /* init hev threshold const vectors */
105     for(i = 0; i < 4 ; i++)
106     {
107         memset(lfi->hev_thr[i], i, SIMD_WIDTH);
108     }
109 }
110
111 void vp8_loop_filter_frame_init(VP8_COMMON *cm,
112                                 MACROBLOCKD *mbd,
113                                 int default_filt_lvl)
114 {
115     int seg,  /* segment number */
116         ref,  /* index in ref_lf_deltas */
117         mode; /* index in mode_lf_deltas */
118
119     loop_filter_info_n *lfi = &cm->lf_info;
120
121     /* update limits if sharpness has changed */
122     if(cm->last_sharpness_level != cm->sharpness_level)
123     {
124         vp8_loop_filter_update_sharpness(lfi, cm->sharpness_level);
125         cm->last_sharpness_level = cm->sharpness_level;
126     }
127
128     for(seg = 0; seg < MAX_MB_SEGMENTS; seg++)
129     {
130         int lvl_seg = default_filt_lvl;
131         int lvl_ref, lvl_mode;
132
133         /* Note the baseline filter values for each segment */
134         if (mbd->segmentation_enabled)
135         {
136             /* Abs value */
137             if (mbd->mb_segement_abs_delta == SEGMENT_ABSDATA)
138             {
139                 lvl_seg = mbd->segment_feature_data[MB_LVL_ALT_LF][seg];
140             }
141             else  /* Delta Value */
142             {
143                 lvl_seg += mbd->segment_feature_data[MB_LVL_ALT_LF][seg];
144                 lvl_seg = (lvl_seg > 0) ? ((lvl_seg > 63) ? 63: lvl_seg) : 0;
145             }
146         }
147
148         if (!mbd->mode_ref_lf_delta_enabled)
149         {
150             /* we could get rid of this if we assume that deltas are set to
151              * zero when not in use; encoder always uses deltas
152              */
153             memset(lfi->lvl[seg][0], lvl_seg, 4 * 4 );
154             continue;
155         }
156
157         /* INTRA_FRAME */
158         ref = INTRA_FRAME;
159
160         /* Apply delta for reference frame */
161         lvl_ref = lvl_seg + mbd->ref_lf_deltas[ref];
162
163         /* Apply delta for Intra modes */
164         mode = 0; /* B_PRED */
165         /* Only the split mode BPRED has a further special case */
166         lvl_mode = lvl_ref + mbd->mode_lf_deltas[mode];
167         /* clamp */
168         lvl_mode = (lvl_mode > 0) ? (lvl_mode > 63 ? 63 : lvl_mode) : 0;
169
170         lfi->lvl[seg][ref][mode] = lvl_mode;
171
172         mode = 1; /* all the rest of Intra modes */
173         /* clamp */
174         lvl_mode = (lvl_ref > 0) ? (lvl_ref > 63 ? 63 : lvl_ref) : 0;
175         lfi->lvl[seg][ref][mode] = lvl_mode;
176
177         /* LAST, GOLDEN, ALT */
178         for(ref = 1; ref < MAX_REF_FRAMES; ref++)
179         {
180             /* Apply delta for reference frame */
181             lvl_ref = lvl_seg + mbd->ref_lf_deltas[ref];
182
183             /* Apply delta for Inter modes */
184             for (mode = 1; mode < 4; mode++)
185             {
186                 lvl_mode = lvl_ref + mbd->mode_lf_deltas[mode];
187                 /* clamp */
188                 lvl_mode = (lvl_mode > 0) ? (lvl_mode > 63 ? 63 : lvl_mode) : 0;
189
190                 lfi->lvl[seg][ref][mode] = lvl_mode;
191             }
192         }
193     }
194 }
195
196
197 void vp8_loop_filter_row_normal(VP8_COMMON *cm, MODE_INFO *mode_info_context,
198                          int mb_row, int post_ystride, int post_uvstride,
199                          unsigned char *y_ptr, unsigned char *u_ptr,
200                          unsigned char *v_ptr)
201 {
202     int mb_col;
203     int filter_level;
204     loop_filter_info_n *lfi_n = &cm->lf_info;
205     loop_filter_info lfi;
206     FRAME_TYPE frame_type = cm->frame_type;
207
208     for (mb_col = 0; mb_col < cm->mb_cols; mb_col++)
209     {
210         int skip_lf = (mode_info_context->mbmi.mode != B_PRED &&
211                         mode_info_context->mbmi.mode != SPLITMV &&
212                         mode_info_context->mbmi.mb_skip_coeff);
213
214         const int mode_index = lfi_n->mode_lf_lut[mode_info_context->mbmi.mode];
215         const int seg = mode_info_context->mbmi.segment_id;
216         const int ref_frame = mode_info_context->mbmi.ref_frame;
217
218         filter_level = lfi_n->lvl[seg][ref_frame][mode_index];
219
220         if (filter_level)
221         {
222             const int hev_index = lfi_n->hev_thr_lut[frame_type][filter_level];
223             lfi.mblim = lfi_n->mblim[filter_level];
224             lfi.blim = lfi_n->blim[filter_level];
225             lfi.lim = lfi_n->lim[filter_level];
226             lfi.hev_thr = lfi_n->hev_thr[hev_index];
227
228             if (mb_col > 0)
229                 vp8_loop_filter_mbv
230                 (y_ptr, u_ptr, v_ptr, post_ystride, post_uvstride, &lfi);
231
232             if (!skip_lf)
233                 vp8_loop_filter_bv
234                 (y_ptr, u_ptr, v_ptr, post_ystride, post_uvstride, &lfi);
235
236             /* don't apply across umv border */
237             if (mb_row > 0)
238                 vp8_loop_filter_mbh
239                 (y_ptr, u_ptr, v_ptr, post_ystride, post_uvstride, &lfi);
240
241             if (!skip_lf)
242                 vp8_loop_filter_bh
243                 (y_ptr, u_ptr, v_ptr, post_ystride, post_uvstride, &lfi);
244         }
245
246         y_ptr += 16;
247         u_ptr += 8;
248         v_ptr += 8;
249
250         mode_info_context++;     /* step to next MB */
251     }
252
253 }
254
255 void vp8_loop_filter_row_simple(VP8_COMMON *cm, MODE_INFO *mode_info_context,
256                          int mb_row, int post_ystride, int post_uvstride,
257                          unsigned char *y_ptr, unsigned char *u_ptr,
258                          unsigned char *v_ptr)
259 {
260     int mb_col;
261     int filter_level;
262     loop_filter_info_n *lfi_n = &cm->lf_info;
263     (void)post_uvstride;
264
265     for (mb_col = 0; mb_col < cm->mb_cols; mb_col++)
266     {
267         int skip_lf = (mode_info_context->mbmi.mode != B_PRED &&
268                         mode_info_context->mbmi.mode != SPLITMV &&
269                         mode_info_context->mbmi.mb_skip_coeff);
270
271         const int mode_index = lfi_n->mode_lf_lut[mode_info_context->mbmi.mode];
272         const int seg = mode_info_context->mbmi.segment_id;
273         const int ref_frame = mode_info_context->mbmi.ref_frame;
274
275         filter_level = lfi_n->lvl[seg][ref_frame][mode_index];
276
277         if (filter_level)
278         {
279             if (mb_col > 0)
280                 vp8_loop_filter_simple_mbv
281                 (y_ptr, post_ystride, lfi_n->mblim[filter_level]);
282
283             if (!skip_lf)
284                 vp8_loop_filter_simple_bv
285                 (y_ptr, post_ystride, lfi_n->blim[filter_level]);
286
287             /* don't apply across umv border */
288             if (mb_row > 0)
289                 vp8_loop_filter_simple_mbh
290                 (y_ptr, post_ystride, lfi_n->mblim[filter_level]);
291
292             if (!skip_lf)
293                 vp8_loop_filter_simple_bh
294                 (y_ptr, post_ystride, lfi_n->blim[filter_level]);
295         }
296
297         y_ptr += 16;
298         u_ptr += 8;
299         v_ptr += 8;
300
301         mode_info_context++;     /* step to next MB */
302     }
303
304 }
305 void vp8_loop_filter_frame(VP8_COMMON *cm,
306                            MACROBLOCKD *mbd,
307                            int frame_type)
308 {
309     YV12_BUFFER_CONFIG *post = cm->frame_to_show;
310     loop_filter_info_n *lfi_n = &cm->lf_info;
311     loop_filter_info lfi;
312
313     int mb_row;
314     int mb_col;
315     int mb_rows = cm->mb_rows;
316     int mb_cols = cm->mb_cols;
317
318     int filter_level;
319
320     unsigned char *y_ptr, *u_ptr, *v_ptr;
321
322     /* Point at base of Mb MODE_INFO list */
323     const MODE_INFO *mode_info_context = cm->mi;
324     int post_y_stride = post->y_stride;
325     int post_uv_stride = post->uv_stride;
326
327     /* Initialize the loop filter for this frame. */
328     vp8_loop_filter_frame_init(cm, mbd, cm->filter_level);
329
330     /* Set up the buffer pointers */
331     y_ptr = post->y_buffer;
332     u_ptr = post->u_buffer;
333     v_ptr = post->v_buffer;
334
335     /* vp8_filter each macro block */
336     if (cm->filter_type == NORMAL_LOOPFILTER)
337     {
338         for (mb_row = 0; mb_row < mb_rows; mb_row++)
339         {
340             for (mb_col = 0; mb_col < mb_cols; mb_col++)
341             {
342                 int skip_lf = (mode_info_context->mbmi.mode != B_PRED &&
343                                 mode_info_context->mbmi.mode != SPLITMV &&
344                                 mode_info_context->mbmi.mb_skip_coeff);
345
346                 const int mode_index = lfi_n->mode_lf_lut[mode_info_context->mbmi.mode];
347                 const int seg = mode_info_context->mbmi.segment_id;
348                 const int ref_frame = mode_info_context->mbmi.ref_frame;
349
350                 filter_level = lfi_n->lvl[seg][ref_frame][mode_index];
351
352                 if (filter_level)
353                 {
354                     const int hev_index = lfi_n->hev_thr_lut[frame_type][filter_level];
355                     lfi.mblim = lfi_n->mblim[filter_level];
356                     lfi.blim = lfi_n->blim[filter_level];
357                     lfi.lim = lfi_n->lim[filter_level];
358                     lfi.hev_thr = lfi_n->hev_thr[hev_index];
359
360                     if (mb_col > 0)
361                         vp8_loop_filter_mbv
362                         (y_ptr, u_ptr, v_ptr, post_y_stride, post_uv_stride, &lfi);
363
364                     if (!skip_lf)
365                         vp8_loop_filter_bv
366                         (y_ptr, u_ptr, v_ptr, post_y_stride, post_uv_stride, &lfi);
367
368                     /* don't apply across umv border */
369                     if (mb_row > 0)
370                         vp8_loop_filter_mbh
371                         (y_ptr, u_ptr, v_ptr, post_y_stride, post_uv_stride, &lfi);
372
373                     if (!skip_lf)
374                         vp8_loop_filter_bh
375                         (y_ptr, u_ptr, v_ptr, post_y_stride, post_uv_stride, &lfi);
376                 }
377
378                 y_ptr += 16;
379                 u_ptr += 8;
380                 v_ptr += 8;
381
382                 mode_info_context++;     /* step to next MB */
383             }
384             y_ptr += post_y_stride  * 16 - post->y_width;
385             u_ptr += post_uv_stride *  8 - post->uv_width;
386             v_ptr += post_uv_stride *  8 - post->uv_width;
387
388             mode_info_context++;         /* Skip border mb */
389
390         }
391     }
392     else /* SIMPLE_LOOPFILTER */
393     {
394         for (mb_row = 0; mb_row < mb_rows; mb_row++)
395         {
396             for (mb_col = 0; mb_col < mb_cols; mb_col++)
397             {
398                 int skip_lf = (mode_info_context->mbmi.mode != B_PRED &&
399                                 mode_info_context->mbmi.mode != SPLITMV &&
400                                 mode_info_context->mbmi.mb_skip_coeff);
401
402                 const int mode_index = lfi_n->mode_lf_lut[mode_info_context->mbmi.mode];
403                 const int seg = mode_info_context->mbmi.segment_id;
404                 const int ref_frame = mode_info_context->mbmi.ref_frame;
405
406                 filter_level = lfi_n->lvl[seg][ref_frame][mode_index];
407                 if (filter_level)
408                 {
409                     const unsigned char * mblim = lfi_n->mblim[filter_level];
410                     const unsigned char * blim = lfi_n->blim[filter_level];
411
412                     if (mb_col > 0)
413                         vp8_loop_filter_simple_mbv
414                         (y_ptr, post_y_stride, mblim);
415
416                     if (!skip_lf)
417                         vp8_loop_filter_simple_bv
418                         (y_ptr, post_y_stride, blim);
419
420                     /* don't apply across umv border */
421                     if (mb_row > 0)
422                         vp8_loop_filter_simple_mbh
423                         (y_ptr, post_y_stride, mblim);
424
425                     if (!skip_lf)
426                         vp8_loop_filter_simple_bh
427                         (y_ptr, post_y_stride, blim);
428                 }
429
430                 y_ptr += 16;
431                 u_ptr += 8;
432                 v_ptr += 8;
433
434                 mode_info_context++;     /* step to next MB */
435             }
436             y_ptr += post_y_stride  * 16 - post->y_width;
437             u_ptr += post_uv_stride *  8 - post->uv_width;
438             v_ptr += post_uv_stride *  8 - post->uv_width;
439
440             mode_info_context++;         /* Skip border mb */
441
442         }
443     }
444 }
445
446 void vp8_loop_filter_frame_yonly
447 (
448     VP8_COMMON *cm,
449     MACROBLOCKD *mbd,
450     int default_filt_lvl
451 )
452 {
453     YV12_BUFFER_CONFIG *post = cm->frame_to_show;
454
455     unsigned char *y_ptr;
456     int mb_row;
457     int mb_col;
458
459     loop_filter_info_n *lfi_n = &cm->lf_info;
460     loop_filter_info lfi;
461
462     int filter_level;
463     FRAME_TYPE frame_type = cm->frame_type;
464
465     /* Point at base of Mb MODE_INFO list */
466     const MODE_INFO *mode_info_context = cm->mi;
467
468 #if 0
469     if(default_filt_lvl == 0) /* no filter applied */
470         return;
471 #endif
472
473     /* Initialize the loop filter for this frame. */
474     vp8_loop_filter_frame_init( cm, mbd, default_filt_lvl);
475
476     /* Set up the buffer pointers */
477     y_ptr = post->y_buffer;
478
479     /* vp8_filter each macro block */
480     for (mb_row = 0; mb_row < cm->mb_rows; mb_row++)
481     {
482         for (mb_col = 0; mb_col < cm->mb_cols; mb_col++)
483         {
484             int skip_lf = (mode_info_context->mbmi.mode != B_PRED &&
485                             mode_info_context->mbmi.mode != SPLITMV &&
486                             mode_info_context->mbmi.mb_skip_coeff);
487
488             const int mode_index = lfi_n->mode_lf_lut[mode_info_context->mbmi.mode];
489             const int seg = mode_info_context->mbmi.segment_id;
490             const int ref_frame = mode_info_context->mbmi.ref_frame;
491
492             filter_level = lfi_n->lvl[seg][ref_frame][mode_index];
493
494             if (filter_level)
495             {
496                 if (cm->filter_type == NORMAL_LOOPFILTER)
497                 {
498                     const int hev_index = lfi_n->hev_thr_lut[frame_type][filter_level];
499                     lfi.mblim = lfi_n->mblim[filter_level];
500                     lfi.blim = lfi_n->blim[filter_level];
501                     lfi.lim = lfi_n->lim[filter_level];
502                     lfi.hev_thr = lfi_n->hev_thr[hev_index];
503
504                     if (mb_col > 0)
505                         vp8_loop_filter_mbv
506                         (y_ptr, 0, 0, post->y_stride, 0, &lfi);
507
508                     if (!skip_lf)
509                         vp8_loop_filter_bv
510                         (y_ptr, 0, 0, post->y_stride, 0, &lfi);
511
512                     /* don't apply across umv border */
513                     if (mb_row > 0)
514                         vp8_loop_filter_mbh
515                         (y_ptr, 0, 0, post->y_stride, 0, &lfi);
516
517                     if (!skip_lf)
518                         vp8_loop_filter_bh
519                         (y_ptr, 0, 0, post->y_stride, 0, &lfi);
520                 }
521                 else
522                 {
523                     if (mb_col > 0)
524                         vp8_loop_filter_simple_mbv
525                         (y_ptr, post->y_stride, lfi_n->mblim[filter_level]);
526
527                     if (!skip_lf)
528                         vp8_loop_filter_simple_bv
529                         (y_ptr, post->y_stride, lfi_n->blim[filter_level]);
530
531                     /* don't apply across umv border */
532                     if (mb_row > 0)
533                         vp8_loop_filter_simple_mbh
534                         (y_ptr, post->y_stride, lfi_n->mblim[filter_level]);
535
536                     if (!skip_lf)
537                         vp8_loop_filter_simple_bh
538                         (y_ptr, post->y_stride, lfi_n->blim[filter_level]);
539                 }
540             }
541
542             y_ptr += 16;
543             mode_info_context ++;        /* step to next MB */
544
545         }
546
547         y_ptr += post->y_stride  * 16 - post->y_width;
548         mode_info_context ++;            /* Skip border mb */
549     }
550
551 }
552
553 void vp8_loop_filter_partial_frame
554 (
555     VP8_COMMON *cm,
556     MACROBLOCKD *mbd,
557     int default_filt_lvl
558 )
559 {
560     YV12_BUFFER_CONFIG *post = cm->frame_to_show;
561
562     unsigned char *y_ptr;
563     int mb_row;
564     int mb_col;
565     int mb_cols = post->y_width >> 4;
566     int mb_rows = post->y_height >> 4;
567
568     int linestocopy;
569
570     loop_filter_info_n *lfi_n = &cm->lf_info;
571     loop_filter_info lfi;
572
573     int filter_level;
574     FRAME_TYPE frame_type = cm->frame_type;
575
576     const MODE_INFO *mode_info_context;
577
578 #if 0
579     if(default_filt_lvl == 0) /* no filter applied */
580         return;
581 #endif
582
583     /* Initialize the loop filter for this frame. */
584     vp8_loop_filter_frame_init( cm, mbd, default_filt_lvl);
585
586     /* number of MB rows to use in partial filtering */
587     linestocopy = mb_rows / PARTIAL_FRAME_FRACTION;
588     linestocopy = linestocopy ? linestocopy << 4 : 16;     /* 16 lines per MB */
589
590     /* Set up the buffer pointers; partial image starts at ~middle of frame */
591     y_ptr = post->y_buffer + ((post->y_height >> 5) * 16) * post->y_stride;
592     mode_info_context = cm->mi + (post->y_height >> 5) * (mb_cols + 1);
593
594     /* vp8_filter each macro block */
595     for (mb_row = 0; mb_row<(linestocopy >> 4); mb_row++)
596     {
597         for (mb_col = 0; mb_col < mb_cols; mb_col++)
598         {
599             int skip_lf = (mode_info_context->mbmi.mode != B_PRED &&
600                            mode_info_context->mbmi.mode != SPLITMV &&
601                            mode_info_context->mbmi.mb_skip_coeff);
602
603             const int mode_index =
604                 lfi_n->mode_lf_lut[mode_info_context->mbmi.mode];
605             const int seg = mode_info_context->mbmi.segment_id;
606             const int ref_frame = mode_info_context->mbmi.ref_frame;
607
608             filter_level = lfi_n->lvl[seg][ref_frame][mode_index];
609
610             if (filter_level)
611             {
612                 if (cm->filter_type == NORMAL_LOOPFILTER)
613                 {
614                     const int hev_index = lfi_n->hev_thr_lut[frame_type][filter_level];
615                     lfi.mblim = lfi_n->mblim[filter_level];
616                     lfi.blim = lfi_n->blim[filter_level];
617                     lfi.lim = lfi_n->lim[filter_level];
618                     lfi.hev_thr = lfi_n->hev_thr[hev_index];
619
620                     if (mb_col > 0)
621                         vp8_loop_filter_mbv
622                         (y_ptr, 0, 0, post->y_stride, 0, &lfi);
623
624                     if (!skip_lf)
625                         vp8_loop_filter_bv
626                         (y_ptr, 0, 0, post->y_stride, 0, &lfi);
627
628                     vp8_loop_filter_mbh
629                         (y_ptr, 0, 0, post->y_stride, 0, &lfi);
630
631                     if (!skip_lf)
632                         vp8_loop_filter_bh
633                         (y_ptr, 0, 0, post->y_stride, 0, &lfi);
634                 }
635                 else
636                 {
637                     if (mb_col > 0)
638                         vp8_loop_filter_simple_mbv
639                         (y_ptr, post->y_stride, lfi_n->mblim[filter_level]);
640
641                     if (!skip_lf)
642                         vp8_loop_filter_simple_bv
643                         (y_ptr, post->y_stride, lfi_n->blim[filter_level]);
644
645                     vp8_loop_filter_simple_mbh
646                         (y_ptr, post->y_stride, lfi_n->mblim[filter_level]);
647
648                     if (!skip_lf)
649                         vp8_loop_filter_simple_bh
650                         (y_ptr, post->y_stride, lfi_n->blim[filter_level]);
651                 }
652             }
653
654             y_ptr += 16;
655             mode_info_context += 1;      /* step to next MB */
656         }
657
658         y_ptr += post->y_stride  * 16 - post->y_width;
659         mode_info_context += 1;          /* Skip border mb */
660     }
661 }