OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 ) | 560 ) |
561 { | 561 { |
562 YV12_BUFFER_CONFIG *post = cm->frame_to_show; | 562 YV12_BUFFER_CONFIG *post = cm->frame_to_show; |
563 | 563 |
564 unsigned char *y_ptr; | 564 unsigned char *y_ptr; |
565 int mb_row; | 565 int mb_row; |
566 int mb_col; | 566 int mb_col; |
567 int mb_cols = post->y_width >> 4; | 567 int mb_cols = post->y_width >> 4; |
568 int mb_rows = post->y_height >> 4; | 568 int mb_rows = post->y_height >> 4; |
569 | 569 |
570 int linestocopy, i; | 570 int linestocopy; |
571 | 571 |
572 loop_filter_info_n *lfi_n = &cm->lf_info; | 572 loop_filter_info_n *lfi_n = &cm->lf_info; |
573 loop_filter_info lfi; | 573 loop_filter_info lfi; |
574 | 574 |
575 int filter_level; | 575 int filter_level; |
576 int alt_flt_enabled = mbd->segmentation_enabled; | |
577 FRAME_TYPE frame_type = cm->frame_type; | 576 FRAME_TYPE frame_type = cm->frame_type; |
578 | 577 |
579 const MODE_INFO *mode_info_context; | 578 const MODE_INFO *mode_info_context; |
580 | 579 |
581 int lvl_seg[MAX_MB_SEGMENTS]; | 580 #if 0 |
| 581 if(default_filt_lvl == 0) /* no filter applied */ |
| 582 return; |
| 583 #endif |
| 584 |
| 585 /* Initialize the loop filter for this frame. */ |
| 586 vp8_loop_filter_frame_init( cm, mbd, default_filt_lvl); |
582 | 587 |
583 /* number of MB rows to use in partial filtering */ | 588 /* number of MB rows to use in partial filtering */ |
584 linestocopy = mb_rows / PARTIAL_FRAME_FRACTION; | 589 linestocopy = mb_rows / PARTIAL_FRAME_FRACTION; |
585 linestocopy = linestocopy ? linestocopy << 4 : 16; /* 16 lines per MB */ | 590 linestocopy = linestocopy ? linestocopy << 4 : 16; /* 16 lines per MB */ |
586 | 591 |
587 /* Note the baseline filter values for each segment */ | |
588 /* See vp8_loop_filter_frame_init. Rather than call that for each change | |
589 * to default_filt_lvl, copy the relevant calculation here. | |
590 */ | |
591 if (alt_flt_enabled) | |
592 { | |
593 for (i = 0; i < MAX_MB_SEGMENTS; i++) | |
594 { /* Abs value */ | |
595 if (mbd->mb_segement_abs_delta == SEGMENT_ABSDATA) | |
596 { | |
597 lvl_seg[i] = mbd->segment_feature_data[MB_LVL_ALT_LF][i]; | |
598 } | |
599 /* Delta Value */ | |
600 else | |
601 { | |
602 lvl_seg[i] = default_filt_lvl | |
603 + mbd->segment_feature_data[MB_LVL_ALT_LF][i]; | |
604 lvl_seg[i] = (lvl_seg[i] > 0) ? | |
605 ((lvl_seg[i] > 63) ? 63: lvl_seg[i]) : 0; | |
606 } | |
607 } | |
608 } | |
609 | |
610 /* Set up the buffer pointers; partial image starts at ~middle of frame */ | 592 /* Set up the buffer pointers; partial image starts at ~middle of frame */ |
611 y_ptr = post->y_buffer + ((post->y_height >> 5) * 16) * post->y_stride; | 593 y_ptr = post->y_buffer + ((post->y_height >> 5) * 16) * post->y_stride; |
612 mode_info_context = cm->mi + (post->y_height >> 5) * (mb_cols + 1); | 594 mode_info_context = cm->mi + (post->y_height >> 5) * (mb_cols + 1); |
613 | 595 |
614 /* vp8_filter each macro block */ | 596 /* vp8_filter each macro block */ |
615 for (mb_row = 0; mb_row<(linestocopy >> 4); mb_row++) | 597 for (mb_row = 0; mb_row<(linestocopy >> 4); mb_row++) |
616 { | 598 { |
617 for (mb_col = 0; mb_col < mb_cols; mb_col++) | 599 for (mb_col = 0; mb_col < mb_cols; mb_col++) |
618 { | 600 { |
619 int skip_lf = (mode_info_context->mbmi.mode != B_PRED && | 601 int skip_lf = (mode_info_context->mbmi.mode != B_PRED && |
620 mode_info_context->mbmi.mode != SPLITMV && | 602 mode_info_context->mbmi.mode != SPLITMV && |
621 mode_info_context->mbmi.mb_skip_coeff); | 603 mode_info_context->mbmi.mb_skip_coeff); |
622 | 604 |
623 if (alt_flt_enabled) | 605 const int mode_index = |
624 filter_level = lvl_seg[mode_info_context->mbmi.segment_id]; | 606 lfi_n->mode_lf_lut[mode_info_context->mbmi.mode]; |
625 else | 607 const int seg = mode_info_context->mbmi.segment_id; |
626 filter_level = default_filt_lvl; | 608 const int ref_frame = mode_info_context->mbmi.ref_frame; |
| 609 |
| 610 filter_level = lfi_n->lvl[seg][ref_frame][mode_index]; |
627 | 611 |
628 if (filter_level) | 612 if (filter_level) |
629 { | 613 { |
630 if (cm->filter_type == NORMAL_LOOPFILTER) | 614 if (cm->filter_type == NORMAL_LOOPFILTER) |
631 { | 615 { |
632 const int hev_index = lfi_n->hev_thr_lut[frame_type][filter_
level]; | 616 const int hev_index = lfi_n->hev_thr_lut[frame_type][filter_
level]; |
633 lfi.mblim = lfi_n->mblim[filter_level]; | 617 lfi.mblim = lfi_n->mblim[filter_level]; |
634 lfi.blim = lfi_n->blim[filter_level]; | 618 lfi.blim = lfi_n->blim[filter_level]; |
635 lfi.lim = lfi_n->lim[filter_level]; | 619 lfi.lim = lfi_n->lim[filter_level]; |
636 lfi.hev_thr = lfi_n->hev_thr[hev_index]; | 620 lfi.hev_thr = lfi_n->hev_thr[hev_index]; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 } | 654 } |
671 | 655 |
672 y_ptr += 16; | 656 y_ptr += 16; |
673 mode_info_context += 1; /* step to next MB */ | 657 mode_info_context += 1; /* step to next MB */ |
674 } | 658 } |
675 | 659 |
676 y_ptr += post->y_stride * 16 - post->y_width; | 660 y_ptr += post->y_stride * 16 - post->y_width; |
677 mode_info_context += 1; /* Skip border mb */ | 661 mode_info_context += 1; /* Skip border mb */ |
678 } | 662 } |
679 } | 663 } |
OLD | NEW |