32 |
#include <stdio.h> |
#include <stdio.h> |
33 |
#include <stdlib.h> |
#include <stdlib.h> |
34 |
#include <string.h> // memcpy |
#include <string.h> // memcpy |
35 |
|
#include <math.h> // lrint |
36 |
|
|
37 |
#include "../encoder.h" |
#include "../encoder.h" |
38 |
#include "../utils/mbfunctions.h" |
#include "../utils/mbfunctions.h" |
80 |
return xb + yb; |
return xb + yb; |
81 |
} |
} |
82 |
|
|
83 |
|
static int32_t ChromaSAD2(int fx, int fy, int bx, int by, const SearchData * const data) |
84 |
|
{ |
85 |
|
int sad; |
86 |
|
const uint32_t stride = data->iEdgedWidth/2; |
87 |
|
uint8_t * f_refu = data->RefQ, |
88 |
|
* f_refv = data->RefQ + 8, |
89 |
|
* b_refu = data->RefQ + 16, |
90 |
|
* b_refv = data->RefQ + 24; |
91 |
|
|
92 |
|
switch (((fx & 1) << 1) | (fy & 1)) { |
93 |
|
case 0: |
94 |
|
fx = fx / 2; fy = fy / 2; |
95 |
|
f_refu = (uint8_t*)data->RefCU + fy * stride + fx, stride; |
96 |
|
f_refv = (uint8_t*)data->RefCV + fy * stride + fx, stride; |
97 |
|
break; |
98 |
|
case 1: |
99 |
|
fx = fx / 2; fy = (fy - 1) / 2; |
100 |
|
interpolate8x8_halfpel_v(f_refu, data->RefCU + fy * stride + fx, stride, data->rounding); |
101 |
|
interpolate8x8_halfpel_v(f_refv, data->RefCV + fy * stride + fx, stride, data->rounding); |
102 |
|
break; |
103 |
|
case 2: |
104 |
|
fx = (fx - 1) / 2; fy = fy / 2; |
105 |
|
interpolate8x8_halfpel_h(f_refu, data->RefCU + fy * stride + fx, stride, data->rounding); |
106 |
|
interpolate8x8_halfpel_h(f_refv, data->RefCV + fy * stride + fx, stride, data->rounding); |
107 |
|
break; |
108 |
|
default: |
109 |
|
fx = (fx - 1) / 2; fy = (fy - 1) / 2; |
110 |
|
interpolate8x8_halfpel_hv(f_refu, data->RefCU + fy * stride + fx, stride, data->rounding); |
111 |
|
interpolate8x8_halfpel_hv(f_refv, data->RefCV + fy * stride + fx, stride, data->rounding); |
112 |
|
break; |
113 |
|
} |
114 |
|
|
115 |
|
switch (((bx & 1) << 1) | (by & 1)) { |
116 |
|
case 0: |
117 |
|
bx = bx / 2; by = by / 2; |
118 |
|
b_refu = (uint8_t*)data->b_RefCU + by * stride + bx, stride; |
119 |
|
b_refv = (uint8_t*)data->b_RefCV + by * stride + bx, stride; |
120 |
|
break; |
121 |
|
case 1: |
122 |
|
bx = bx / 2; by = (by - 1) / 2; |
123 |
|
interpolate8x8_halfpel_v(b_refu, data->b_RefCU + by * stride + bx, stride, data->rounding); |
124 |
|
interpolate8x8_halfpel_v(b_refv, data->b_RefCV + by * stride + bx, stride, data->rounding); |
125 |
|
break; |
126 |
|
case 2: |
127 |
|
bx = (bx - 1) / 2; by = by / 2; |
128 |
|
interpolate8x8_halfpel_h(b_refu, data->b_RefCU + by * stride + bx, stride, data->rounding); |
129 |
|
interpolate8x8_halfpel_h(b_refv, data->b_RefCV + by * stride + bx, stride, data->rounding); |
130 |
|
break; |
131 |
|
default: |
132 |
|
bx = (bx - 1) / 2; by = (by - 1) / 2; |
133 |
|
interpolate8x8_halfpel_hv(b_refu, data->b_RefCU + by * stride + bx, stride, data->rounding); |
134 |
|
interpolate8x8_halfpel_hv(b_refv, data->b_RefCV + by * stride + bx, stride, data->rounding); |
135 |
|
break; |
136 |
|
} |
137 |
|
|
138 |
|
sad = sad8bi(data->CurU, b_refu, f_refu, stride); |
139 |
|
sad += sad8bi(data->CurV, b_refv, f_refv, stride); |
140 |
|
|
141 |
|
return sad; |
142 |
|
} |
143 |
|
|
144 |
|
|
145 |
static int32_t |
static int32_t |
146 |
ChromaSAD(int dx, int dy, const SearchData * const data) |
ChromaSAD(int dx, int dy, const SearchData * const data) |
147 |
{ |
{ |
380 |
static void |
static void |
381 |
CheckCandidate16no4v(const int x, const int y, const int Direction, int * const dir, const SearchData * const data) |
CheckCandidate16no4v(const int x, const int y, const int Direction, int * const dir, const SearchData * const data) |
382 |
{ |
{ |
383 |
int32_t sad; |
int32_t sad, xc, yc; |
384 |
const uint8_t * Reference; |
const uint8_t * Reference; |
385 |
uint32_t t; |
uint32_t t; |
386 |
VECTOR * current; |
VECTOR * current; |
393 |
if (data->qpel_precision) { // x and y are in 1/4 precision |
if (data->qpel_precision) { // x and y are in 1/4 precision |
394 |
Reference = Interpolate16x16qpel(x, y, 0, data); |
Reference = Interpolate16x16qpel(x, y, 0, data); |
395 |
current = data->currentQMV; |
current = data->currentQMV; |
396 |
|
xc = x/2; yc = y/2; |
397 |
} else { |
} else { |
398 |
Reference = GetReference(x, y, data); |
Reference = GetReference(x, y, data); |
399 |
current = data->currentMV; |
current = data->currentMV; |
400 |
|
xc = x; yc = y; |
401 |
} |
} |
402 |
t = d_mv_bits(x, y, data->predMV, data->iFcode, |
t = d_mv_bits(x, y, data->predMV, data->iFcode, |
403 |
data->qpel^data->qpel_precision, data->rrv); |
data->qpel^data->qpel_precision, data->rrv); |
405 |
sad = sad16(data->Cur, Reference, data->iEdgedWidth, 256*4096); |
sad = sad16(data->Cur, Reference, data->iEdgedWidth, 256*4096); |
406 |
sad += (data->lambda16 * t * sad)>>10; |
sad += (data->lambda16 * t * sad)>>10; |
407 |
|
|
408 |
|
if (data->chroma) sad += ChromaSAD((xc >> 1) + roundtab_79[xc & 0x3], |
409 |
|
(yc >> 1) + roundtab_79[yc & 0x3], data); |
410 |
|
|
411 |
|
|
412 |
if (sad < *(data->iMinSAD)) { |
if (sad < *(data->iMinSAD)) { |
413 |
*(data->iMinSAD) = sad; |
*(data->iMinSAD) = sad; |
414 |
current->x = x; current->y = y; |
current->x = x; current->y = y; |
415 |
*dir = Direction; } |
*dir = Direction; |
416 |
|
} |
417 |
} |
} |
418 |
|
|
419 |
static void |
static void |
445 |
static void |
static void |
446 |
CheckCandidateInt(const int xf, const int yf, const int Direction, int * const dir, const SearchData * const data) |
CheckCandidateInt(const int xf, const int yf, const int Direction, int * const dir, const SearchData * const data) |
447 |
{ |
{ |
448 |
int32_t sad, xb, yb; |
int32_t sad, xb, yb, xcf, ycf, xcb, ycb; |
449 |
uint32_t t; |
uint32_t t; |
450 |
const uint8_t *ReferenceF, *ReferenceB; |
const uint8_t *ReferenceF, *ReferenceB; |
451 |
VECTOR *current; |
VECTOR *current; |
458 |
xb = data->currentMV[1].x; yb = data->currentMV[1].y; |
xb = data->currentMV[1].x; yb = data->currentMV[1].y; |
459 |
ReferenceB = GetReferenceB(xb, yb, 1, data); |
ReferenceB = GetReferenceB(xb, yb, 1, data); |
460 |
current = data->currentMV; |
current = data->currentMV; |
461 |
|
xcf = xf; ycf = yf; |
462 |
|
xcb = xb; ycb = yb; |
463 |
} else { |
} else { |
464 |
ReferenceF = Interpolate16x16qpel(xf, yf, 0, data); |
ReferenceF = Interpolate16x16qpel(xf, yf, 0, data); |
465 |
xb = data->currentQMV[1].x; yb = data->currentQMV[1].y; |
xb = data->currentQMV[1].x; yb = data->currentQMV[1].y; |
466 |
current = data->currentQMV; |
current = data->currentQMV; |
467 |
ReferenceB = Interpolate16x16qpel(xb, yb, 1, data); |
ReferenceB = Interpolate16x16qpel(xb, yb, 1, data); |
468 |
|
xcf = xf/2; ycf = yf/2; |
469 |
|
xcb = xb/2; ycb = yb/2; |
470 |
} |
} |
471 |
|
|
472 |
t = d_mv_bits(xf, yf, data->predMV, data->iFcode, data->qpel^data->qpel_precision, 0) |
t = d_mv_bits(xf, yf, data->predMV, data->iFcode, data->qpel^data->qpel_precision, 0) |
475 |
sad = sad16bi(data->Cur, ReferenceF, ReferenceB, data->iEdgedWidth); |
sad = sad16bi(data->Cur, ReferenceF, ReferenceB, data->iEdgedWidth); |
476 |
sad += (data->lambda16 * t * sad)>>10; |
sad += (data->lambda16 * t * sad)>>10; |
477 |
|
|
478 |
|
if (data->chroma) sad += ChromaSAD2((xcf >> 1) + roundtab_79[xcf & 0x3], |
479 |
|
(ycf >> 1) + roundtab_79[ycf & 0x3], |
480 |
|
(xcb >> 1) + roundtab_79[xcb & 0x3], |
481 |
|
(ycb >> 1) + roundtab_79[ycb & 0x3], data); |
482 |
|
|
483 |
if (sad < *(data->iMinSAD)) { |
if (sad < *(data->iMinSAD)) { |
484 |
*(data->iMinSAD) = sad; |
*(data->iMinSAD) = sad; |
485 |
current->x = xf; current->y = yf; |
current->x = xf; current->y = yf; |
486 |
*dir = Direction; } |
*dir = Direction; |
487 |
|
} |
488 |
} |
} |
489 |
|
|
490 |
static void |
static void |
491 |
CheckCandidateDirect(const int x, const int y, const int Direction, int * const dir, const SearchData * const data) |
CheckCandidateDirect(const int x, const int y, const int Direction, int * const dir, const SearchData * const data) |
492 |
{ |
{ |
493 |
int32_t sad = 0; |
int32_t sad = 0, xcf = 0, ycf = 0, xcb = 0, ycb = 0; |
494 |
uint32_t k; |
uint32_t k; |
495 |
const uint8_t *ReferenceF; |
const uint8_t *ReferenceF; |
496 |
const uint8_t *ReferenceB; |
const uint8_t *ReferenceB; |
509 |
data->directmvB[k].y |
data->directmvB[k].y |
510 |
: mvs.y - data->referencemv[k].y); |
: mvs.y - data->referencemv[k].y); |
511 |
|
|
512 |
if (( mvs.x > data->max_dx ) || ( mvs.x < data->min_dx ) |
if ( (mvs.x > data->max_dx) | (mvs.x < data->min_dx) |
513 |
|| ( mvs.y > data->max_dy ) || ( mvs.y < data->min_dy ) |
| (mvs.y > data->max_dy) | (mvs.y < data->min_dy) |
514 |
|| ( b_mvs.x > data->max_dx ) || ( b_mvs.x < data->min_dx ) |
| (b_mvs.x > data->max_dx) | (b_mvs.x < data->min_dx) |
515 |
|| ( b_mvs.y > data->max_dy ) || ( b_mvs.y < data->min_dy )) return; |
| (b_mvs.y > data->max_dy) | (b_mvs.y < data->min_dy) ) return; |
516 |
|
|
517 |
|
if (data->qpel) { |
518 |
mvs.x *= 2 - data->qpel; mvs.y *= 2 - data->qpel; |
xcf += mvs.x/2; ycf += mvs.y/2; |
519 |
b_mvs.x *= 2 - data->qpel; b_mvs.y *= 2 - data->qpel; //we move to qpel precision anyway |
xcb += b_mvs.x/2; ycb += b_mvs.y/2; |
520 |
|
} else { |
521 |
|
xcf += mvs.x; ycf += mvs.y; |
522 |
|
xcb += b_mvs.x; ycb += b_mvs.y; |
523 |
|
mvs.x *= 2; mvs.y *= 2; //we move to qpel precision anyway |
524 |
|
b_mvs.x *= 2; b_mvs.y *= 2; |
525 |
|
} |
526 |
|
|
527 |
ReferenceF = Interpolate8x8qpel(mvs.x, mvs.y, k, 0, data); |
ReferenceF = Interpolate8x8qpel(mvs.x, mvs.y, k, 0, data); |
528 |
ReferenceB = Interpolate8x8qpel(b_mvs.x, b_mvs.y, k, 1, data); |
ReferenceB = Interpolate8x8qpel(b_mvs.x, b_mvs.y, k, 1, data); |
534 |
|
|
535 |
sad += (data->lambda16 * d_mv_bits(x, y, zeroMV, 1, 0, 0) * sad)>>10; |
sad += (data->lambda16 * d_mv_bits(x, y, zeroMV, 1, 0, 0) * sad)>>10; |
536 |
|
|
537 |
|
if (data->chroma) sad += ChromaSAD2((xcf >> 3) + roundtab_76[xcf & 0xf], |
538 |
|
(ycf >> 3) + roundtab_76[ycf & 0xf], |
539 |
|
(xcb >> 3) + roundtab_76[xcb & 0xf], |
540 |
|
(ycb >> 3) + roundtab_76[ycb & 0xf], data); |
541 |
|
|
542 |
if (sad < *(data->iMinSAD)) { |
if (sad < *(data->iMinSAD)) { |
543 |
*(data->iMinSAD) = sad; |
*(data->iMinSAD) = sad; |
544 |
data->currentMV->x = x; data->currentMV->y = y; |
data->currentMV->x = x; data->currentMV->y = y; |
545 |
*dir = Direction; } |
*dir = Direction; |
546 |
|
} |
547 |
} |
} |
548 |
|
|
549 |
static void |
static void |
550 |
CheckCandidateDirectno4v(const int x, const int y, const int Direction, int * const dir, const SearchData * const data) |
CheckCandidateDirectno4v(const int x, const int y, const int Direction, int * const dir, const SearchData * const data) |
551 |
{ |
{ |
552 |
int32_t sad; |
int32_t sad, xcf, ycf, xcb, ycb; |
553 |
const uint8_t *ReferenceF; |
const uint8_t *ReferenceF; |
554 |
const uint8_t *ReferenceB; |
const uint8_t *ReferenceB; |
555 |
VECTOR mvs, b_mvs; |
VECTOR mvs, b_mvs; |
566 |
data->directmvB[0].y |
data->directmvB[0].y |
567 |
: mvs.y - data->referencemv[0].y); |
: mvs.y - data->referencemv[0].y); |
568 |
|
|
569 |
if (( mvs.x > data->max_dx ) || ( mvs.x < data->min_dx ) |
if ( (mvs.x > data->max_dx) | (mvs.x < data->min_dx) |
570 |
|| ( mvs.y > data->max_dy ) || ( mvs.y < data->min_dy ) |
| (mvs.y > data->max_dy) | (mvs.y < data->min_dy) |
571 |
|| ( b_mvs.x > data->max_dx ) || ( b_mvs.x < data->min_dx ) |
| (b_mvs.x > data->max_dx) | (b_mvs.x < data->min_dx) |
572 |
|| ( b_mvs.y > data->max_dy ) || ( b_mvs.y < data->min_dy )) return; |
| (b_mvs.y > data->max_dy) | (b_mvs.y < data->min_dy) ) return; |
573 |
|
|
574 |
mvs.x *= 2 - data->qpel; mvs.y *= 2 - data->qpel; |
if (data->qpel) { |
575 |
b_mvs.x *= 2 - data->qpel; b_mvs.y *= 2 - data->qpel; //we move to qpel precision anyway |
xcf = 4*(mvs.x/2); ycf = 4*(mvs.y/2); |
576 |
|
xcb = 4*(b_mvs.x/2); ycb = 4*(b_mvs.y/2); |
577 |
ReferenceF = Interpolate16x16qpel(mvs.x, mvs.y, 0, data); |
ReferenceF = Interpolate16x16qpel(mvs.x, mvs.y, 0, data); |
578 |
ReferenceB = Interpolate16x16qpel(b_mvs.x, b_mvs.y, 1, data); |
ReferenceB = Interpolate16x16qpel(b_mvs.x, b_mvs.y, 1, data); |
579 |
|
} else { |
580 |
|
xcf = 4*mvs.x; ycf = 4*mvs.y; |
581 |
|
xcb = 4*b_mvs.x; ycb = 4*b_mvs.y; |
582 |
|
ReferenceF = GetReference(mvs.x, mvs.y, data); |
583 |
|
ReferenceB = GetReferenceB(b_mvs.x, b_mvs.y, 1, data); |
584 |
|
} |
585 |
|
|
586 |
sad = sad16bi(data->Cur, ReferenceF, ReferenceB, data->iEdgedWidth); |
sad = sad16bi(data->Cur, ReferenceF, ReferenceB, data->iEdgedWidth); |
587 |
sad += (data->lambda16 * d_mv_bits(x, y, zeroMV, 1, 0, 0) * sad)>>10; |
sad += (data->lambda16 * d_mv_bits(x, y, zeroMV, 1, 0, 0) * sad)>>10; |
588 |
|
|
589 |
|
if (data->chroma) sad += ChromaSAD2((xcf >> 3) + roundtab_76[xcf & 0xf], |
590 |
|
(ycf >> 3) + roundtab_76[ycf & 0xf], |
591 |
|
(xcb >> 3) + roundtab_76[xcb & 0xf], |
592 |
|
(ycb >> 3) + roundtab_76[ycb & 0xf], data); |
593 |
|
|
594 |
if (sad < *(data->iMinSAD)) { |
if (sad < *(data->iMinSAD)) { |
595 |
*(data->iMinSAD) = sad; |
*(data->iMinSAD) = sad; |
596 |
data->currentMV->x = x; data->currentMV->y = y; |
data->currentMV->x = x; data->currentMV->y = y; |
597 |
*dir = Direction; } |
*dir = Direction; |
598 |
|
} |
599 |
} |
} |
600 |
|
|
601 |
static void |
static void |
611 |
else Reference = GetReference(x, y, data); |
else Reference = GetReference(x, y, data); |
612 |
|
|
613 |
sad = sad8(data->Cur, Reference, data->iEdgedWidth); |
sad = sad8(data->Cur, Reference, data->iEdgedWidth); |
614 |
t = d_mv_bits(x, y, data->predMV, data->iFcode, data->qpel && !data->qpel_precision, 0); |
t = d_mv_bits(x, y, data->predMV, data->iFcode, data->qpel^data->qpel_precision, 0); |
615 |
|
|
616 |
sad += (data->lambda8 * t * (sad+NEIGH_8X8_BIAS))>>10; |
sad += (data->lambda8 * t * (sad+NEIGH_8X8_BIAS))>>10; |
617 |
|
|
856 |
Data.iFcode = current->fcode; |
Data.iFcode = current->fcode; |
857 |
Data.rounding = pParam->m_rounding_type; |
Data.rounding = pParam->m_rounding_type; |
858 |
Data.qpel = pParam->m_quarterpel; |
Data.qpel = pParam->m_quarterpel; |
859 |
Data.chroma = current->global_flags & XVID_ME_COLOUR; |
Data.chroma = current->motion_flags & PMV_CHROMA16; |
860 |
Data.rrv = current->global_flags & XVID_REDUCED; |
Data.rrv = current->global_flags & XVID_REDUCED; |
861 |
|
|
862 |
if ((current->global_flags & XVID_REDUCED)) { |
if ((current->global_flags & XVID_REDUCED)) { |
905 |
|
|
906 |
//initial skip decision |
//initial skip decision |
907 |
/* no early skip for GMC (global vector = skip vector is unknown!) */ |
/* no early skip for GMC (global vector = skip vector is unknown!) */ |
908 |
if (current->coding_type == P_VOP) { /* no fast SKIP for S(GMC)-VOPs */ |
if (!(current->global_flags & XVID_GMC)) { /* no fast SKIP for S(GMC)-VOPs */ |
909 |
if (pMB->dquant == NO_CHANGE && sad00 < pMB->quant * INITIAL_SKIP_THRESH * (Data.rrv ? 4:1) ) |
if (pMB->dquant == NO_CHANGE && sad00 < pMB->quant * INITIAL_SKIP_THRESH * (Data.rrv ? 4:1) ) |
910 |
if (Data.chroma || SkipDecisionP(pCurrent, pRef, x, y, iEdgedWidth/2, pMB->quant, Data.rrv)) { |
if (Data.chroma || SkipDecisionP(pCurrent, pRef, x, y, iEdgedWidth/2, pMB->quant, Data.rrv)) { |
911 |
SkipMacroblockP(pMB, sad00); |
SkipMacroblockP(pMB, sad00); |
919 |
current->global_flags & XVID_INTER4V, pMB); |
current->global_flags & XVID_INTER4V, pMB); |
920 |
|
|
921 |
/* final skip decision, a.k.a. "the vector you found, really that good?" */ |
/* final skip decision, a.k.a. "the vector you found, really that good?" */ |
922 |
if (current->coding_type == P_VOP) { |
if (!(current->global_flags & XVID_GMC)) { |
923 |
if ( (pMB->dquant == NO_CHANGE) && (sad00 < pMB->quant * MAX_SAD00_FOR_SKIP) |
if ( (pMB->dquant == NO_CHANGE) && (sad00 < pMB->quant * MAX_SAD00_FOR_SKIP) |
924 |
&& ((100*pMB->sad16)/(sad00+1) > FINAL_SKIP_THRESH * (Data.rrv ? 4:1)) ) |
&& ((100*pMB->sad16)/(sad00+1) > FINAL_SKIP_THRESH * (Data.rrv ? 4:1)) ) |
925 |
if (Data.chroma || SkipDecisionP(pCurrent, pRef, x, y, iEdgedWidth/2, pMB->quant, Data.rrv)) { |
if (Data.chroma || SkipDecisionP(pCurrent, pRef, x, y, iEdgedWidth/2, pMB->quant, Data.rrv)) { |
959 |
} |
} |
960 |
} |
} |
961 |
|
|
962 |
if (current->coding_type == S_VOP) /* first GMC step only for S(GMC)-VOPs */ |
if (current->global_flags & XVID_GMC ) /* GMC only for S(GMC)-VOPs */ |
963 |
current->GMC_MV = GlobalMotionEst( pMBs, pParam, current->fcode ); |
{ |
964 |
else |
current->warp = GlobalMotionEst( pMBs, pParam, current, reference, pRefH, pRefV, pRefHV); |
965 |
current->GMC_MV = zeroMV; |
} |
966 |
|
|
967 |
return 0; |
return 0; |
968 |
} |
} |
1373 |
|
|
1374 |
/* search backward or forward */ |
/* search backward or forward */ |
1375 |
static void |
static void |
1376 |
SearchBF( const uint8_t * const pRef, |
SearchBF( const IMAGE * const pRef, |
1377 |
const uint8_t * const pRefH, |
const uint8_t * const pRefH, |
1378 |
const uint8_t * const pRefV, |
const uint8_t * const pRefV, |
1379 |
const uint8_t * const pRefHV, |
const uint8_t * const pRefHV, |
1395 |
*Data->iMinSAD = MV_MAX_ERROR; |
*Data->iMinSAD = MV_MAX_ERROR; |
1396 |
Data->iFcode = iFcode; |
Data->iFcode = iFcode; |
1397 |
Data->qpel_precision = 0; |
Data->qpel_precision = 0; |
1398 |
|
Data->temp[5] = Data->temp[6] = Data->temp[7] = 256*4096; // reset chroma-sad cache |
1399 |
|
|
1400 |
Data->Ref = pRef + (x + y * Data->iEdgedWidth) * 16; |
Data->Ref = pRef->y + (x + y * Data->iEdgedWidth) * 16; |
1401 |
Data->RefH = pRefH + (x + y * Data->iEdgedWidth) * 16; |
Data->RefH = pRefH + (x + y * Data->iEdgedWidth) * 16; |
1402 |
Data->RefV = pRefV + (x + y * Data->iEdgedWidth) * 16; |
Data->RefV = pRefV + (x + y * Data->iEdgedWidth) * 16; |
1403 |
Data->RefHV = pRefHV + (x + y * Data->iEdgedWidth) * 16; |
Data->RefHV = pRefHV + (x + y * Data->iEdgedWidth) * 16; |
1404 |
|
Data->RefCU = pRef->u + (x + y * Data->iEdgedWidth/2) * 8; |
1405 |
|
Data->RefCV = pRef->v + (x + y * Data->iEdgedWidth/2) * 8; |
1406 |
|
|
1407 |
Data->predMV = *predMV; |
Data->predMV = *predMV; |
1408 |
|
|
1542 |
Data->bRefH = b_RefH + k; |
Data->bRefH = b_RefH + k; |
1543 |
Data->bRefV = b_RefV + k; |
Data->bRefV = b_RefV + k; |
1544 |
Data->bRefHV = b_RefHV + k; |
Data->bRefHV = b_RefHV + k; |
1545 |
|
Data->RefCU = f_Ref->u + (x + (Data->iEdgedWidth/2) * y) * 8; |
1546 |
|
Data->RefCV = f_Ref->v + (x + (Data->iEdgedWidth/2) * y) * 8; |
1547 |
|
Data->b_RefCU = b_Ref->u + (x + (Data->iEdgedWidth/2) * y) * 8; |
1548 |
|
Data->b_RefCV = b_Ref->v + (x + (Data->iEdgedWidth/2) * y) * 8; |
1549 |
|
|
1550 |
k = Data->qpel ? 4 : 2; |
k = Data->qpel ? 4 : 2; |
1551 |
Data->max_dx = k * (pParam->width - x * 16); |
Data->max_dx = k * (pParam->width - x * 16); |
1584 |
(*CheckCandidate)(0, 0, 255, &k, Data); |
(*CheckCandidate)(0, 0, 255, &k, Data); |
1585 |
|
|
1586 |
// initial (fast) skip decision |
// initial (fast) skip decision |
1587 |
if (*Data->iMinSAD < pMB->quant * INITIAL_SKIP_THRESH * 2) { |
if (*Data->iMinSAD < pMB->quant * INITIAL_SKIP_THRESH * (2 + Data->chroma?1:0)) { |
1588 |
//possible skip - checking chroma |
//possible skip |
1589 |
|
if (Data->chroma) { |
1590 |
|
pMB->mode = MODE_DIRECT_NONE_MV; |
1591 |
|
return *Data->iMinSAD; // skip. |
1592 |
|
} else { |
1593 |
SkipDecisionB(pCur, f_Ref, b_Ref, pMB, x, y, Data); |
SkipDecisionB(pCur, f_Ref, b_Ref, pMB, x, y, Data); |
1594 |
if (pMB->mode == MODE_DIRECT_NONE_MV) return *Data->iMinSAD; // skip. |
if (pMB->mode == MODE_DIRECT_NONE_MV) return *Data->iMinSAD; // skip. |
1595 |
} |
} |
1596 |
|
} |
1597 |
|
|
1598 |
skip_sad = *Data->iMinSAD; |
skip_sad = *Data->iMinSAD; |
1599 |
|
|
1643 |
} |
} |
1644 |
|
|
1645 |
static void |
static void |
1646 |
SearchInterpolate(const uint8_t * const f_Ref, |
SearchInterpolate(const IMAGE * const f_Ref, |
1647 |
const uint8_t * const f_RefH, |
const uint8_t * const f_RefH, |
1648 |
const uint8_t * const f_RefV, |
const uint8_t * const f_RefV, |
1649 |
const uint8_t * const f_RefHV, |
const uint8_t * const f_RefHV, |
1650 |
const uint8_t * const b_Ref, |
const IMAGE * const b_Ref, |
1651 |
const uint8_t * const b_RefH, |
const uint8_t * const b_RefH, |
1652 |
const uint8_t * const b_RefV, |
const uint8_t * const b_RefV, |
1653 |
const uint8_t * const b_RefHV, |
const uint8_t * const b_RefHV, |
1675 |
fData->iFcode = bData.bFcode = fcode; fData->bFcode = bData.iFcode = bcode; |
fData->iFcode = bData.bFcode = fcode; fData->bFcode = bData.iFcode = bcode; |
1676 |
|
|
1677 |
i = (x + y * fData->iEdgedWidth) * 16; |
i = (x + y * fData->iEdgedWidth) * 16; |
1678 |
bData.bRef = fData->Ref = f_Ref + i; |
bData.bRef = fData->Ref = f_Ref->y + i; |
1679 |
bData.bRefH = fData->RefH = f_RefH + i; |
bData.bRefH = fData->RefH = f_RefH + i; |
1680 |
bData.bRefV = fData->RefV = f_RefV + i; |
bData.bRefV = fData->RefV = f_RefV + i; |
1681 |
bData.bRefHV = fData->RefHV = f_RefHV + i; |
bData.bRefHV = fData->RefHV = f_RefHV + i; |
1682 |
bData.Ref = fData->bRef = b_Ref + i; |
bData.Ref = fData->bRef = b_Ref->y + i; |
1683 |
bData.RefH = fData->bRefH = b_RefH + i; |
bData.RefH = fData->bRefH = b_RefH + i; |
1684 |
bData.RefV = fData->bRefV = b_RefV + i; |
bData.RefV = fData->bRefV = b_RefV + i; |
1685 |
bData.RefHV = fData->bRefHV = b_RefHV + i; |
bData.RefHV = fData->bRefHV = b_RefHV + i; |
1686 |
|
bData.b_RefCU = fData->RefCU = f_Ref->u + (x + (fData->iEdgedWidth/2) * y) * 8; |
1687 |
|
bData.b_RefCV = fData->RefCV = f_Ref->v + (x + (fData->iEdgedWidth/2) * y) * 8; |
1688 |
|
bData.RefCU = fData->b_RefCU = b_Ref->u + (x + (fData->iEdgedWidth/2) * y) * 8; |
1689 |
|
bData.RefCV = fData->b_RefCV = b_Ref->v + (x + (fData->iEdgedWidth/2) * y) * 8; |
1690 |
|
|
1691 |
|
|
1692 |
bData.bpredMV = fData->predMV = *f_predMV; |
bData.bpredMV = fData->predMV = *f_predMV; |
1693 |
fData->bpredMV = bData.predMV = *b_predMV; |
fData->bpredMV = bData.predMV = *b_predMV; |
1804 |
int32_t iMinSAD; |
int32_t iMinSAD; |
1805 |
VECTOR currentMV[3]; |
VECTOR currentMV[3]; |
1806 |
VECTOR currentQMV[3]; |
VECTOR currentQMV[3]; |
1807 |
|
int32_t temp[8]; |
1808 |
memset(&Data, 0, sizeof(SearchData)); |
memset(&Data, 0, sizeof(SearchData)); |
1809 |
Data.iEdgedWidth = pParam->edged_width; |
Data.iEdgedWidth = pParam->edged_width; |
1810 |
Data.currentMV = currentMV; Data.currentQMV = currentQMV; |
Data.currentMV = currentMV; Data.currentQMV = currentQMV; |
1811 |
Data.iMinSAD = &iMinSAD; |
Data.iMinSAD = &iMinSAD; |
1812 |
Data.lambda16 = lambda_vec16[frame->quant]; |
Data.lambda16 = lambda_vec16[frame->quant]; |
|
Data.chroma = frame->quant; |
|
1813 |
Data.qpel = pParam->m_quarterpel; |
Data.qpel = pParam->m_quarterpel; |
1814 |
Data.rounding = 0; |
Data.rounding = 0; |
1815 |
|
Data.chroma = frame->motion_flags & PMV_CHROMA8; |
1816 |
|
Data.temp = temp; |
1817 |
|
|
1818 |
Data.RefQ = f_refV->u; // a good place, also used in MC (for similar purpose) |
Data.RefQ = f_refV->u; // a good place, also used in MC (for similar purpose) |
1819 |
// note: i==horizontal, j==vertical |
// note: i==horizontal, j==vertical |
1833 |
} |
} |
1834 |
|
|
1835 |
Data.Cur = frame->image.y + (j * Data.iEdgedWidth + i) * 16; |
Data.Cur = frame->image.y + (j * Data.iEdgedWidth + i) * 16; |
1836 |
|
Data.CurU = frame->image.u + (j * Data.iEdgedWidth/2 + i) * 8; |
1837 |
|
Data.CurV = frame->image.v + (j * Data.iEdgedWidth/2 + i) * 8; |
1838 |
pMB->quant = frame->quant; |
pMB->quant = frame->quant; |
1839 |
|
|
1840 |
/* direct search comes first, because it (1) checks for SKIP-mode |
/* direct search comes first, because it (1) checks for SKIP-mode |
1853 |
if (pMB->mode == MODE_DIRECT_NONE_MV) { n_count++; continue; } |
if (pMB->mode == MODE_DIRECT_NONE_MV) { n_count++; continue; } |
1854 |
|
|
1855 |
// forward search |
// forward search |
1856 |
SearchBF(f_ref->y, f_refH->y, f_refV->y, f_refHV->y, |
SearchBF(f_ref, f_refH->y, f_refV->y, f_refHV->y, |
1857 |
&frame->image, i, j, |
&frame->image, i, j, |
1858 |
frame->motion_flags, |
frame->motion_flags, |
1859 |
frame->fcode, pParam, |
frame->fcode, pParam, |
1861 |
MODE_FORWARD, &Data); |
MODE_FORWARD, &Data); |
1862 |
|
|
1863 |
// backward search |
// backward search |
1864 |
SearchBF(b_ref->y, b_refH->y, b_refV->y, b_refHV->y, |
SearchBF(b_ref, b_refH->y, b_refV->y, b_refHV->y, |
1865 |
&frame->image, i, j, |
&frame->image, i, j, |
1866 |
frame->motion_flags, |
frame->motion_flags, |
1867 |
frame->bcode, pParam, |
frame->bcode, pParam, |
1869 |
MODE_BACKWARD, &Data); |
MODE_BACKWARD, &Data); |
1870 |
|
|
1871 |
// interpolate search comes last, because it uses data from forward and backward as prediction |
// interpolate search comes last, because it uses data from forward and backward as prediction |
1872 |
SearchInterpolate(f_ref->y, f_refH->y, f_refV->y, f_refHV->y, |
SearchInterpolate(f_ref, f_refH->y, f_refV->y, f_refHV->y, |
1873 |
b_ref->y, b_refH->y, b_refV->y, b_refHV->y, |
b_ref, b_refH->y, b_refV->y, b_refHV->y, |
1874 |
&frame->image, |
&frame->image, |
1875 |
i, j, |
i, j, |
1876 |
frame->fcode, frame->bcode, |
frame->fcode, frame->bcode, |
2031 |
} |
} |
2032 |
} |
} |
2033 |
sSAD /= (pParam->mb_height-2)*(pParam->mb_width-2); |
sSAD /= (pParam->mb_height-2)*(pParam->mb_width-2); |
2034 |
if (sSAD > IntraThresh + INTRA_BIAS) return I_VOP; |
// if (sSAD > IntraThresh + INTRA_BIAS) return I_VOP; |
2035 |
if (sSAD > InterThresh ) return P_VOP; |
if (sSAD > InterThresh ) return P_VOP; |
2036 |
emms(); |
emms(); |
2037 |
return B_VOP; |
return B_VOP; |
2038 |
|
|
2039 |
} |
} |
2040 |
|
|
2041 |
static void |
|
2042 |
CheckGMC(int x, int y, const int dir, int * iDirection, |
static WARPPOINTS |
2043 |
const MACROBLOCK * const pMBs, uint32_t * bestcount, VECTOR * GMC, |
GlobalMotionEst(const MACROBLOCK * const pMBs, |
2044 |
const MBParam * const pParam) |
const MBParam * const pParam, |
2045 |
|
const FRAMEINFO * const current, |
2046 |
|
const FRAMEINFO * const reference, |
2047 |
|
const IMAGE * const pRefH, |
2048 |
|
const IMAGE * const pRefV, |
2049 |
|
const IMAGE * const pRefHV ) |
2050 |
{ |
{ |
|
uint32_t mx, my, a, count = 0; |
|
2051 |
|
|
2052 |
for (my = 1; my < pParam->mb_height-1; my++) |
const int deltax=8; // upper bound for difference between a MV and it's neighbour MVs |
2053 |
for (mx = 1; mx < pParam->mb_width-1; mx++) { |
const int deltay=8; |
2054 |
VECTOR mv; |
const int grad=512; // lower bound for deviation in MB |
2055 |
const MACROBLOCK *pMB = &pMBs[mx + my * pParam->mb_width]; |
|
2056 |
if (pMB->mode == MODE_INTRA || pMB->mode == MODE_NOT_CODED) continue; |
WARPPOINTS gmc; |
2057 |
mv = pMB->mvs[0]; |
|
2058 |
a = ABS(mv.x - x) + ABS(mv.y - y); |
uint32_t mx, my; |
|
if (a < 6) count += 6 - a; |
|
|
} |
|
2059 |
|
|
2060 |
if (count > *bestcount) { |
int MBh = pParam->mb_height; |
2061 |
*bestcount = count; |
int MBw = pParam->mb_width; |
2062 |
*iDirection = dir; |
|
2063 |
GMC->x = x; GMC->y = y; |
int *MBmask= calloc(MBh*MBw,sizeof(int)); |
2064 |
|
double DtimesF[4] = { 0.,0., 0., 0. }; |
2065 |
|
double sol[4] = { 0., 0., 0., 0. }; |
2066 |
|
double a,b,c,n,denom; |
2067 |
|
double meanx,meany; |
2068 |
|
int num,oldnum; |
2069 |
|
|
2070 |
|
if (!MBmask) { fprintf(stderr,"Mem error\n"); return gmc;} |
2071 |
|
|
2072 |
|
// filter mask of all blocks |
2073 |
|
|
2074 |
|
for (my = 1; my < MBh-1; my++) |
2075 |
|
for (mx = 1; mx < MBw-1; mx++) |
2076 |
|
{ |
2077 |
|
const int mbnum = mx + my * MBw; |
2078 |
|
const MACROBLOCK *pMB = &pMBs[mbnum]; |
2079 |
|
const VECTOR mv = pMB->mvs[0]; |
2080 |
|
|
2081 |
|
if (pMB->mode == MODE_INTRA || pMB->mode == MODE_NOT_CODED) |
2082 |
|
continue; |
2083 |
|
|
2084 |
|
if ( ( (ABS(mv.x - (pMB-1)->mvs[0].x) < deltax) && (ABS(mv.y - (pMB-1)->mvs[0].y) < deltay) ) |
2085 |
|
&& ( (ABS(mv.x - (pMB+1)->mvs[0].x) < deltax) && (ABS(mv.y - (pMB+1)->mvs[0].y) < deltay) ) |
2086 |
|
&& ( (ABS(mv.x - (pMB-MBw)->mvs[0].x) < deltax) && (ABS(mv.y - (pMB-MBw)->mvs[0].y) < deltay) ) |
2087 |
|
&& ( (ABS(mv.x - (pMB+MBw)->mvs[0].x) < deltax) && (ABS(mv.y - (pMB+MBw)->mvs[0].y) < deltay) ) ) |
2088 |
|
MBmask[mbnum]=1; |
2089 |
} |
} |
2090 |
|
|
2091 |
|
for (my = 1; my < MBh-1; my++) |
2092 |
|
for (mx = 1; mx < MBw-1; mx++) |
2093 |
|
{ |
2094 |
|
const uint8_t *const pCur = current->image.y + 16*my*pParam->edged_width + 16*mx; |
2095 |
|
|
2096 |
|
const int mbnum = mx + my * MBw; |
2097 |
|
if (!MBmask[mbnum]) |
2098 |
|
continue; |
2099 |
|
|
2100 |
|
if (sad16 ( pCur, pCur+1 , pParam->edged_width, 65536) <= grad ) |
2101 |
|
MBmask[mbnum] = 0; |
2102 |
|
if (sad16 ( pCur, pCur+pParam->edged_width, pParam->edged_width, 65536) <= grad ) |
2103 |
|
MBmask[mbnum] = 0; |
2104 |
|
|
2105 |
} |
} |
2106 |
|
|
2107 |
|
emms(); |
2108 |
|
|
2109 |
static VECTOR |
do { /* until convergence */ |
|
GlobalMotionEst(const MACROBLOCK * const pMBs, const MBParam * const pParam, const uint32_t iFcode) |
|
|
{ |
|
2110 |
|
|
2111 |
uint32_t count, bestcount = 0; |
a = b = c = n = 0; |
2112 |
int x, y; |
DtimesF[0] = DtimesF[1] = DtimesF[2] = DtimesF[3] = 0.; |
2113 |
VECTOR gmc = {0,0}; |
for (my = 0; my < MBh; my++) |
2114 |
int step, min_x, max_x, min_y, max_y; |
for (mx = 0; mx < MBw; mx++) |
2115 |
uint32_t mx, my; |
{ |
2116 |
int iDirection, bDirection; |
const int mbnum = mx + my * MBw; |
2117 |
|
const MACROBLOCK *pMB = &pMBs[mbnum]; |
2118 |
|
const VECTOR mv = pMB->mvs[0]; |
2119 |
|
|
2120 |
min_x = min_y = -32<<iFcode; |
if (!MBmask[mbnum]) |
2121 |
max_x = max_y = 32<<iFcode; |
continue; |
2122 |
|
|
2123 |
//step1: let's find a rough camera panning |
n++; |
2124 |
for (step = 32; step >= 2; step /= 2) { |
a += 16*mx+8; |
2125 |
bestcount = 0; |
b += 16*my+8; |
2126 |
for (y = min_y; y <= max_y; y += step) |
c += (16*mx+8)*(16*mx+8)+(16*my+8)*(16*my+8); |
2127 |
for (x = min_x ; x <= max_x; x += step) { |
|
2128 |
count = 0; |
DtimesF[0] += (double)mv.x; |
2129 |
//for all macroblocks |
DtimesF[1] += (double)mv.x*(16*mx+8) + (double)mv.y*(16*my+8); |
2130 |
for (my = 1; my < pParam->mb_height-1; my++) |
DtimesF[2] += (double)mv.x*(16*my+8) - (double)mv.y*(16*mx+8); |
2131 |
for (mx = 1; mx < pParam->mb_width-1; mx++) { |
DtimesF[3] += (double)mv.y; |
2132 |
const MACROBLOCK *pMB = &pMBs[mx + my * pParam->mb_width]; |
} |
2133 |
VECTOR mv; |
|
2134 |
|
denom = a*a+b*b-c*n; |
2135 |
|
|
2136 |
|
/* Solve the system: sol = (D'*E*D)^{-1} D'*E*F */ |
2137 |
|
/* D'*E*F has been calculated in the same loop as matrix */ |
2138 |
|
|
2139 |
|
sol[0] = -c*DtimesF[0] + a*DtimesF[1] + b*DtimesF[2]; |
2140 |
|
sol[1] = a*DtimesF[0] - n*DtimesF[1] + b*DtimesF[3]; |
2141 |
|
sol[2] = b*DtimesF[0] - n*DtimesF[2] - a*DtimesF[3]; |
2142 |
|
sol[3] = b*DtimesF[1] - a*DtimesF[2] - c*DtimesF[3]; |
2143 |
|
|
2144 |
|
sol[0] /= denom; |
2145 |
|
sol[1] /= denom; |
2146 |
|
sol[2] /= denom; |
2147 |
|
sol[3] /= denom; |
2148 |
|
|
2149 |
|
meanx = meany = 0.; |
2150 |
|
oldnum = 0; |
2151 |
|
for (my = 0; my < MBh; my++) |
2152 |
|
for (mx = 0; mx < MBw; mx++) |
2153 |
|
{ |
2154 |
|
const int mbnum = mx + my * MBw; |
2155 |
|
const MACROBLOCK *pMB = &pMBs[mbnum]; |
2156 |
|
const VECTOR mv = pMB->mvs[0]; |
2157 |
|
|
2158 |
if (pMB->mode == MODE_INTRA || pMB->mode == MODE_NOT_CODED) |
if (!MBmask[mbnum]) |
2159 |
continue; |
continue; |
2160 |
|
|
2161 |
mv = pMB->mvs[0]; |
oldnum++; |
2162 |
if ( ABS(mv.x - x) <= step && ABS(mv.y - y) <= step ) /* GMC translation is always halfpel-res */ |
meanx += ABS(( sol[0] + (16*mx+8)*sol[1] + (16*my+8)*sol[2] ) - mv.x ); |
2163 |
count++; |
meany += ABS(( sol[3] - (16*mx+8)*sol[2] + (16*my+8)*sol[1] ) - mv.y ); |
2164 |
} |
} |
2165 |
if (count >= bestcount) { bestcount = count; gmc.x = x; gmc.y = y; } |
|
2166 |
} |
if (4*meanx > oldnum) /* better fit than 0.25 is useless */ |
2167 |
min_x = gmc.x - step; |
meanx /= oldnum; |
2168 |
max_x = gmc.x + step; |
else |
2169 |
min_y = gmc.y - step; |
meanx = 0.25; |
2170 |
max_y = gmc.y + step; |
|
2171 |
|
if (4*meany > oldnum) |
2172 |
|
meany /= oldnum; |
2173 |
|
else |
2174 |
|
meany = 0.25; |
2175 |
|
|
2176 |
|
/* fprintf(stderr,"sol = (%8.5f, %8.5f, %8.5f, %8.5f)\n",sol[0],sol[1],sol[2],sol[3]); |
2177 |
|
fprintf(stderr,"meanx = %8.5f meany = %8.5f %d\n",meanx,meany, oldnum); |
2178 |
|
*/ |
2179 |
|
num = 0; |
2180 |
|
for (my = 0; my < MBh; my++) |
2181 |
|
for (mx = 0; mx < MBw; mx++) |
2182 |
|
{ |
2183 |
|
const int mbnum = mx + my * MBw; |
2184 |
|
const MACROBLOCK *pMB = &pMBs[mbnum]; |
2185 |
|
const VECTOR mv = pMB->mvs[0]; |
2186 |
|
|
2187 |
|
if (!MBmask[mbnum]) |
2188 |
|
continue; |
2189 |
|
|
2190 |
|
if ( ( ABS(( sol[0] + (16*mx+8)*sol[1] + (16*my+8)*sol[2] ) - mv.x ) > meanx ) |
2191 |
|
|| ( ABS(( sol[3] - (16*mx+8)*sol[2] + (16*my+8)*sol[1] ) - mv.y ) > meany ) ) |
2192 |
|
MBmask[mbnum]=0; |
2193 |
|
else |
2194 |
|
num++; |
2195 |
} |
} |
2196 |
|
|
2197 |
if (bestcount < (pParam->mb_height-2)*(pParam->mb_width-2)/10) |
} while ( (oldnum != num) && (num>=4) ); |
|
gmc.x = gmc.y = 0; //no camara pan, no GMC |
|
2198 |
|
|
2199 |
// step2: let's refine camera panning using gradiend-descent approach |
if (num < 4) |
2200 |
// TODO: more warping points may be evaluated here (like in interpolate mode search - two vectors in one diamond) |
{ |
2201 |
bestcount = 0; |
gmc.duv[0].x= gmc.duv[0].y= gmc.duv[1].x= gmc.duv[1].y= gmc.duv[2].x= gmc.duv[2].y=0; |
2202 |
CheckGMC(gmc.x, gmc.y, 255, &iDirection, pMBs, &bestcount, &gmc, pParam); |
} else { |
|
do { |
|
|
x = gmc.x; y = gmc.y; |
|
|
bDirection = iDirection; iDirection = 0; |
|
|
if (bDirection & 1) CheckGMC(x - 1, y, 1+4+8, &iDirection, pMBs, &bestcount, &gmc, pParam); |
|
|
if (bDirection & 2) CheckGMC(x + 1, y, 2+4+8, &iDirection, pMBs, &bestcount, &gmc, pParam); |
|
|
if (bDirection & 4) CheckGMC(x, y - 1, 1+2+4, &iDirection, pMBs, &bestcount, &gmc, pParam); |
|
|
if (bDirection & 8) CheckGMC(x, y + 1, 1+2+8, &iDirection, pMBs, &bestcount, &gmc, pParam); |
|
2203 |
|
|
2204 |
} while (iDirection); |
gmc.duv[0].x=(int)(sol[0]+0.5); |
2205 |
|
gmc.duv[0].y=(int)(sol[3]+0.5); |
2206 |
|
|
2207 |
|
gmc.duv[1].x=(int)(sol[1]*pParam->width+0.5); |
2208 |
|
gmc.duv[1].y=(int)(-sol[2]*pParam->width+0.5); |
2209 |
|
|
2210 |
if (pParam->m_quarterpel) { |
gmc.duv[2].x=0; |
2211 |
gmc.x *= 2; |
gmc.duv[2].y=0; |
|
gmc.y *= 2; /* we store the halfpel value as pseudo-qpel to make comparison easier */ |
|
2212 |
} |
} |
2213 |
|
// fprintf(stderr,"wp1 = ( %4d, %4d) wp2 = ( %4d, %4d) \n", gmc.duv[0].x, gmc.duv[0].y, gmc.duv[1].x, gmc.duv[1].y); |
2214 |
|
|
2215 |
|
free(MBmask); |
2216 |
|
|
2217 |
return gmc; |
return gmc; |
2218 |
} |
} |