Revision e814817b

View differences:

libavcodec/h264_loopfilter.c
424 424
    }
425 425
}
426 426

  
427
static int check_mv(H264Context *h, long b_idx, long bn_idx, int mvy_limit){
428
    int l;
429
    int v = 0;
430

  
431
    for( l = 0; !v && l < h->list_count; l++ ) {
432
        v |= h->ref_cache[l][b_idx] != h->ref_cache[l][bn_idx] |
433
                h->mv_cache[l][b_idx][0] - h->mv_cache[l][bn_idx][0] + 3 >= 7U |
434
                FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[l][bn_idx][1] ) >= mvy_limit;
435
    }
436

  
437
    if(h->list_count==2 && v){
438
        v=0;
439
        for( l = 0; !v && l < 2; l++ ) {
440
            int ln= 1-l;
441
            v |= h->ref_cache[l][b_idx] != h->ref_cache[ln][bn_idx] |
442
                h->mv_cache[l][b_idx][0] - h->mv_cache[ln][bn_idx][0] + 3 >= 7U |
443
                FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[ln][bn_idx][1] ) >= mvy_limit;
444
        }
445
    }
446

  
447
    return v;
448
}
427 449

  
428 450
static av_always_inline void filter_mb_dir(H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize, int mb_xy, int mb_type, int mvy_limit, int first_vertical_edge_done, int dir) {
429 451
    MpegEncContext * const s = &h->s;
......
498 520
                else if( mask_par0 && ((mbm_type & (MB_TYPE_16x16 | (MB_TYPE_8x16 >> dir)))) ) {
499 521
                    int b_idx= 8 + 4;
500 522
                    int bn_idx= b_idx - (dir ? 8:1);
501
                    int v = 0;
502

  
503
                    for( l = 0; !v && l < h->list_count; l++ ) {
504
                        v |= h->ref_cache[l][b_idx] != h->ref_cache[l][bn_idx] |
505
                            h->mv_cache[l][b_idx][0] - h->mv_cache[l][bn_idx][0] + 3 >= 7U |
506
                            FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[l][bn_idx][1] ) >= mvy_limit;
507
                    }
508

  
509
                    if(h->list_count==2 && v){
510
                        v=0;
511
                        for( l = 0; !v && l < 2; l++ ) {
512
                            int ln= 1-l;
513
                            v |= h->ref_cache[l][b_idx] != h->ref_cache[ln][bn_idx] |
514
                                h->mv_cache[l][b_idx][0] - h->mv_cache[ln][bn_idx][0] + 3 >= 7U |
515
                                FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[ln][bn_idx][1] ) >= mvy_limit;
516
                        }
517
                    }
518 523

  
519
                    bS[0] = bS[1] = bS[2] = bS[3] = v;
524
                    bS[0] = bS[1] = bS[2] = bS[3] = check_mv(h, 8 + 4, bn_idx, mvy_limit);
520 525
                    mv_done = 1;
521 526
                }
522 527
                else
......
534 539
                    }
535 540
                    else if(!mv_done)
536 541
                    {
537
                        bS[i] = 0;
538
                        for( l = 0; l < h->list_count; l++ ) {
539
                            if( h->ref_cache[l][b_idx] != h->ref_cache[l][bn_idx] |
540
                                h->mv_cache[l][b_idx][0] - h->mv_cache[l][bn_idx][0] + 3 >= 7U |
541
                                FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[l][bn_idx][1] ) >= mvy_limit ) {
542
                                bS[i] = 1;
543
                                break;
544
                            }
545
                        }
546

  
547
                        if(h->list_count == 2 && bS[i]){
548
                            bS[i] = 0;
549
                            for( l = 0; l < 2; l++ ) {
550
                                int ln= 1-l;
551
                                if( h->ref_cache[l][b_idx] != h->ref_cache[ln][bn_idx] |
552
                                    h->mv_cache[l][b_idx][0] - h->mv_cache[ln][bn_idx][0] + 3 >= 7U |
553
                                    FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[ln][bn_idx][1] ) >= mvy_limit ) {
554
                                    bS[i] = 1;
555
                                    break;
556
                                }
557
                            }
558
                        }
542
                        bS[i] = check_mv(h, b_idx, bn_idx, mvy_limit);
559 543
                    }
560 544
                }
561 545
            }
......
612 596
            else if( mask_par0 ) {
613 597
                int b_idx= 8 + 4 + edge * (dir ? 8:1);
614 598
                int bn_idx= b_idx - (dir ? 8:1);
615
                int v = 0;
616

  
617
                for( l = 0; !v && l < h->list_count; l++ ) {
618
                    v |= h->ref_cache[l][b_idx] != h->ref_cache[l][bn_idx] |
619
                         h->mv_cache[l][b_idx][0] - h->mv_cache[l][bn_idx][0] + 3 >= 7U |
620
                         FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[l][bn_idx][1] ) >= mvy_limit;
621
                }
622 599

  
623
                if(h->list_count==2 && v){
624
                    v=0;
625
                    for( l = 0; !v && l < 2; l++ ) {
626
                        int ln= 1-l;
627
                        v |= h->ref_cache[l][b_idx] != h->ref_cache[ln][bn_idx] |
628
                            h->mv_cache[l][b_idx][0] - h->mv_cache[ln][bn_idx][0] + 3 >= 7U |
629
                            FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[ln][bn_idx][1] ) >= mvy_limit;
630
                    }
631
                }
632

  
633
                bS[0] = bS[1] = bS[2] = bS[3] = v;
600
                bS[0] = bS[1] = bS[2] = bS[3] = check_mv(h, b_idx, bn_idx, mvy_limit);
634 601
                mv_done = 1;
635 602
            }
636 603
            else
......
648 615
                }
649 616
                else if(!mv_done)
650 617
                {
651
                    bS[i] = 0;
652
                    for( l = 0; l < h->list_count; l++ ) {
653
                        if( h->ref_cache[l][b_idx] != h->ref_cache[l][bn_idx] |
654
                            h->mv_cache[l][b_idx][0] - h->mv_cache[l][bn_idx][0] + 3 >= 7U |
655
                            FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[l][bn_idx][1] ) >= mvy_limit ) {
656
                            bS[i] = 1;
657
                            break;
658
                        }
659
                    }
660

  
661
                    if(h->list_count == 2 && bS[i]){
662
                        bS[i] = 0;
663
                        for( l = 0; l < 2; l++ ) {
664
                            int ln= 1-l;
665
                            if( h->ref_cache[l][b_idx] != h->ref_cache[ln][bn_idx] |
666
                                h->mv_cache[l][b_idx][0] - h->mv_cache[ln][bn_idx][0] + 3 >= 7U |
667
                                FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[ln][bn_idx][1] ) >= mvy_limit ) {
668
                                bS[i] = 1;
669
                                break;
670
                            }
671
                        }
672
                    }
618
                    bS[i] = check_mv(h, b_idx, bn_idx, mvy_limit);
673 619
                }
674 620
            }
675 621

  

Also available in: Unified diff