Revision 21227514 libavcodec/cavs.c

View differences:

libavcodec/cavs.c
576 576
    vector_t *mvA = &h->mv[nP-1];
577 577
    vector_t *mvB = &h->mv[nP-4];
578 578
    vector_t *mvC = &h->mv[nC];
579
    vector_t *mvP2 = NULL;
579 580

  
580 581
    mvP->ref = ref;
581 582
    mvP->dist = h->dist[mvP->ref];
......
592 593
    }
593 594
    /* if there is only one suitable candidate, take it */
594 595
    if((mvA->ref >= 0) && (mvB->ref < 0) && (mvC->ref < 0)) {
595
        mvP->x = mvA->x;
596
        mvP->y = mvA->y;
596
        mvP2= mvA;
597 597
    } else if((mvA->ref < 0) && (mvB->ref >= 0) && (mvC->ref < 0)) {
598
        mvP->x = mvB->x;
599
        mvP->y = mvB->y;
598
        mvP2= mvB;
600 599
    } else if((mvA->ref < 0) && (mvB->ref < 0) && (mvC->ref >= 0)) {
601
        mvP->x = mvC->x;
602
        mvP->y = mvC->y;
603
    } else {
604
        switch(mode) {
605
        case MV_PRED_LEFT:
606
            if(mvA->ref == mvP->ref) {
607
                mvP->x = mvA->x;
608
                mvP->y = mvA->y;
609
            } else
610
                mv_pred_median(h, mvP, mvA, mvB, mvC);
611
            break;
612
        case MV_PRED_TOP:
613
            if(mvB->ref == mvP->ref) {
614
                mvP->x = mvB->x;
615
                mvP->y = mvB->y;
616
            } else
617
                mv_pred_median(h, mvP, mvA, mvB, mvC);
618
            break;
619
        case MV_PRED_TOPRIGHT:
620
            if(mvC->ref == mvP->ref) {
621
                mvP->x = mvC->x;
622
                mvP->y = mvC->y;
623
            } else
624
                mv_pred_median(h, mvP, mvA, mvB, mvC);
625
            break;
626
        default:
627
            mv_pred_median(h, mvP, mvA, mvB, mvC);
628
            break;
629
        }
600
        mvP2= mvC;
601
    } else if(mode == MV_PRED_LEFT     && mvA->ref == ref){
602
        mvP2= mvA;
603
    } else if(mode == MV_PRED_TOP      && mvB->ref == ref){
604
        mvP2= mvB;
605
    } else if(mode == MV_PRED_TOPRIGHT && mvC->ref == ref){
606
        mvP2= mvC;
630 607
    }
608
    if(mvP2){
609
        mvP->x = mvP2->x;
610
        mvP->y = mvP2->y;
611
    }else
612
        mv_pred_median(h, mvP, mvA, mvB, mvC);
613

  
631 614
    if(mode < MV_PRED_PSKIP) {
632 615
        mvP->x += get_se_golomb(&h->s.gb);
633 616
        mvP->y += get_se_golomb(&h->s.gb);

Also available in: Unified diff