4 |
* - Motion Estimation for P- and S- VOPs - |
* - Motion Estimation for P- and S- VOPs - |
5 |
* |
* |
6 |
* Copyright(C) 2002 Christoph Lampert <gruel@web.de> |
* Copyright(C) 2002 Christoph Lampert <gruel@web.de> |
7 |
* 2002 Michael Militzer <michael@xvid.org> |
* 2002-2010 Michael Militzer <michael@xvid.org> |
8 |
* 2002-2003 Radoslaw Czyz <xvid@syskin.cjb.net> |
* 2002-2003 Radoslaw Czyz <xvid@syskin.cjb.net> |
9 |
* |
* |
10 |
* This program is free software ; you can redistribute it and/or modify |
* This program is free software ; you can redistribute it and/or modify |
21 |
* along with this program ; if not, write to the Free Software |
* along with this program ; if not, write to the Free Software |
22 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
23 |
* |
* |
24 |
* $Id: estimation_pvop.c,v 1.17 2005-03-31 22:14:20 Isibaar Exp $ |
* $Id: estimation_pvop.c,v 1.23 2010-11-28 15:18:21 Isibaar Exp $ |
25 |
* |
* |
26 |
****************************************************************************/ |
****************************************************************************/ |
27 |
|
|
39 |
#include "motion.h" |
#include "motion.h" |
40 |
#include "sad.h" |
#include "sad.h" |
41 |
#include "motion_inlines.h" |
#include "motion_inlines.h" |
42 |
|
#include "motion_smp.h" |
43 |
|
|
44 |
|
|
45 |
static const int xvid_me_lambda_vec8[32] = |
static const int xvid_me_lambda_vec8[32] = |
46 |
{ 0 ,(int)(1.0 * NEIGH_TEND_8X8 + 0.5), |
{ 0 ,(int)(1.0 * NEIGH_TEND_8X8 + 0.5), |
296 |
|
|
297 |
/* 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?" */ |
298 |
if (skip_possible && (skip_sad < (int)iQuant * MAX_SAD00_FOR_SKIP)) |
if (skip_possible && (skip_sad < (int)iQuant * MAX_SAD00_FOR_SKIP)) |
299 |
if ( (100*skip_sad)/(pMB->sad16+1) > FINAL_SKIP_THRESH) |
if ( (100*skip_sad)/(pMB->sad16+1) < FINAL_SKIP_THRESH) |
300 |
if (Data->chroma || xvid_me_SkipDecisionP(pCurrent, pRef, x, y, Data->iEdgedWidth/2, iQuant)) { |
if (Data->chroma || xvid_me_SkipDecisionP(pCurrent, pRef, x, y, Data->iEdgedWidth/2, iQuant)) { |
301 |
mode = MODE_NOT_CODED; |
mode = MODE_NOT_CODED; |
302 |
sad = 0; |
sad = 0; |
707 |
} else Data->iMinSAD[1] = 4096*256; |
} else Data->iMinSAD[1] = 4096*256; |
708 |
} |
} |
709 |
|
|
710 |
|
static int |
711 |
|
InitialSkipDecisionP(int sad00, |
712 |
|
const MBParam * pParam, |
713 |
|
const FRAMEINFO * current, |
714 |
|
MACROBLOCK * pMB, |
715 |
|
const MACROBLOCK * prevMB, |
716 |
|
int x, int y, |
717 |
|
const SearchData * Data, |
718 |
|
const IMAGE * const pGMC, |
719 |
|
const IMAGE * const pCurrent, |
720 |
|
const IMAGE * const pRef, |
721 |
|
const uint32_t MotionFlags) |
722 |
|
{ |
723 |
|
const unsigned int iEdgedWidth = pParam->edged_width; |
724 |
|
|
725 |
|
int skip_thresh = INITIAL_SKIP_THRESH * \ |
726 |
|
(current->vop_flags & XVID_VOP_MODEDECISION_RD ? 2:1); |
727 |
|
int stat_thresh = 0; |
728 |
|
|
729 |
|
/* initial skip decision */ |
730 |
|
if (current->coding_type != S_VOP) { /* no fast SKIP for S(GMC)-VOPs */ |
731 |
|
if (pMB->dquant == 0 && sad00 < pMB->quant * skip_thresh) |
732 |
|
if (Data->chroma || xvid_me_SkipDecisionP(pCurrent, pRef, x, y, iEdgedWidth/2, pMB->quant)) { |
733 |
|
ZeroMacroblockP(pMB, sad00); |
734 |
|
pMB->mode = MODE_NOT_CODED; |
735 |
|
return 1; |
736 |
|
} |
737 |
|
} |
738 |
|
|
739 |
|
if(MotionFlags & XVID_ME_DETECT_STATIC_MOTION) { |
740 |
|
VECTOR *cmpMV; |
741 |
|
VECTOR staticMV = { 0, 0 }; |
742 |
|
const MACROBLOCK * pMBs = current->mbs; |
743 |
|
|
744 |
|
if (current->coding_type == S_VOP) |
745 |
|
cmpMV = &pMB->amv; |
746 |
|
else |
747 |
|
cmpMV = &staticMV; |
748 |
|
|
749 |
|
if(x > 0 && y > 0 && x < pParam->mb_width) { |
750 |
|
if(MVequal((&pMBs[(x-1) + y * pParam->mb_width])->mvs[0], *cmpMV) && |
751 |
|
MVequal((&pMBs[x + (y-1) * pParam->mb_width])->mvs[0], *cmpMV) && |
752 |
|
MVequal((&pMBs[(x+1) + (y-1) * pParam->mb_width])->mvs[0], *cmpMV) && |
753 |
|
MVequal(prevMB->mvs[0], *cmpMV)) { |
754 |
|
stat_thresh = MAX((&pMBs[(x-1) + y * pParam->mb_width])->sad16, |
755 |
|
MAX((&pMBs[x + (y-1) * pParam->mb_width])->sad16, |
756 |
|
MAX((&pMBs[(x+1) + (y-1) * pParam->mb_width])->sad16, |
757 |
|
prevMB->sad16))); |
758 |
|
} else { |
759 |
|
stat_thresh = MIN((&pMBs[(x-1) + y * pParam->mb_width])->sad16, |
760 |
|
MIN((&pMBs[x + (y-1) * pParam->mb_width])->sad16, |
761 |
|
MIN((&pMBs[(x+1) + (y-1) * pParam->mb_width])->sad16, |
762 |
|
prevMB->sad16))); |
763 |
|
} |
764 |
|
} |
765 |
|
} |
766 |
|
|
767 |
|
/* favorize (0,0) or global vector for cartoons */ |
768 |
|
if (current->vop_flags & XVID_VOP_CARTOON) { |
769 |
|
if (current->coding_type == S_VOP) { |
770 |
|
int32_t iSAD = sad16(pCurrent->y + (x + y * iEdgedWidth) * 16, |
771 |
|
pGMC->y + 16*y*iEdgedWidth + 16*x, iEdgedWidth, 65536); |
772 |
|
|
773 |
|
if (Data->chroma) { |
774 |
|
iSAD += sad8(pCurrent->u + x*8 + y*(iEdgedWidth/2)*8, pGMC->u + 8*y*(iEdgedWidth/2) + 8*x, iEdgedWidth/2); |
775 |
|
iSAD += sad8(pCurrent->v + (x + y*(iEdgedWidth/2))*8, pGMC->v + 8*y*(iEdgedWidth/2) + 8*x, iEdgedWidth/2); |
776 |
|
} |
777 |
|
|
778 |
|
if (iSAD <= stat_thresh) { /* mode decision GMC */ |
779 |
|
pMB->mode = MODE_INTER; |
780 |
|
pMB->sad16 = pMB->sad8[0] = pMB->sad8[1] = pMB->sad8[2] = pMB->sad8[3] = iSAD; |
781 |
|
pMB->mcsel = 1; |
782 |
|
if (Data->qpel) { |
783 |
|
pMB->qmvs[0] = pMB->qmvs[1] = pMB->qmvs[2] = pMB->qmvs[3] = pMB->amv; |
784 |
|
pMB->mvs[0].x = pMB->mvs[1].x = pMB->mvs[2].x = pMB->mvs[3].x = pMB->amv.x/2; |
785 |
|
pMB->mvs[0].y = pMB->mvs[1].y = pMB->mvs[2].y = pMB->mvs[3].y = pMB->amv.y/2; |
786 |
|
} else |
787 |
|
pMB->mvs[0] = pMB->mvs[1] = pMB->mvs[2] = pMB->mvs[3] = pMB->amv; |
788 |
|
|
789 |
|
return 1; |
790 |
|
} |
791 |
|
} |
792 |
|
else if (sad00 < stat_thresh) { |
793 |
|
VECTOR predMV; |
794 |
|
if (Data->qpel) |
795 |
|
predMV = get_qpmv2(current->mbs, pParam->mb_width, 0, x, y, 0); |
796 |
|
else |
797 |
|
predMV = get_pmv2(current->mbs, pParam->mb_width, 0, x, y, 0); |
798 |
|
|
799 |
|
ZeroMacroblockP(pMB, sad00); |
800 |
|
pMB->cbp = 0x3f; |
801 |
|
pMB->pmvs[0].x = - predMV.x; |
802 |
|
pMB->pmvs[0].y = - predMV.y; |
803 |
|
return 1; |
804 |
|
} |
805 |
|
} |
806 |
|
|
807 |
|
return 0; |
808 |
|
} |
809 |
|
|
810 |
static __inline uint32_t |
static __inline uint32_t |
811 |
MakeGoodMotionFlags(const uint32_t MotionFlags, const uint32_t VopFlags, const uint32_t VolFlags) |
MakeGoodMotionFlags(const uint32_t MotionFlags, const uint32_t VopFlags, const uint32_t VolFlags) |
812 |
{ |
{ |
886 |
} |
} |
887 |
} |
} |
888 |
|
|
889 |
bool |
void |
890 |
MotionEstimation(MBParam * const pParam, |
MotionEstimation(MBParam * const pParam, |
891 |
FRAMEINFO * const current, |
FRAMEINFO * const current, |
892 |
FRAMEINFO * const reference, |
FRAMEINFO * const reference, |
908 |
int MVmax = 0, mvSum = 0, mvCount = 0; |
int MVmax = 0, mvSum = 0, mvCount = 0; |
909 |
|
|
910 |
uint32_t x, y; |
uint32_t x, y; |
911 |
int32_t sad00; |
int sad00; |
912 |
int skip_thresh = INITIAL_SKIP_THRESH * \ |
int skip_thresh = INITIAL_SKIP_THRESH * \ |
913 |
(current->vop_flags & XVID_VOP_MODEDECISION_RD ? 2:1); |
(current->vop_flags & XVID_VOP_MODEDECISION_RD ? 2:1); |
914 |
|
int block = 0; |
915 |
|
|
916 |
/* some pre-initialized thingies for SearchP */ |
/* some pre-initialized thingies for SearchP */ |
917 |
DECLARE_ALIGNED_MATRIX(dct_space, 3, 64, int16_t, CACHE_LINE); |
DECLARE_ALIGNED_MATRIX(dct_space, 3, 64, int16_t, CACHE_LINE); |
931 |
|
|
932 |
for (y = 0; y < mb_height; y++) { |
for (y = 0; y < mb_height; y++) { |
933 |
for (x = 0; x < mb_width; x++) { |
for (x = 0; x < mb_width; x++) { |
934 |
MACROBLOCK *pMB = &pMBs[x + y * pParam->mb_width]; |
MACROBLOCK *pMB = &pMBs[block]; |
935 |
MACROBLOCK *prevMB = &reference->mbs[x + y * pParam->mb_width]; |
MACROBLOCK *prevMB = &reference->mbs[block]; |
936 |
|
int skip; |
937 |
|
block++; |
938 |
|
|
939 |
pMB->sad16 = |
pMB->sad16 = |
940 |
sad16v(pCurrent->y + (x + y * iEdgedWidth) * 16, |
sad16v(pCurrent->y + (x + y * iEdgedWidth) * 16, |
952 |
sad00 += Data.chromaSAD; |
sad00 += Data.chromaSAD; |
953 |
} |
} |
954 |
|
|
955 |
/* initial skip decision */ |
skip = InitialSkipDecisionP(sad00, pParam, current, pMB, prevMB, x, y, &Data, pGMC, |
956 |
if (current->coding_type != S_VOP) { /* no fast SKIP for S(GMC)-VOPs */ |
pCurrent, pRef, MotionFlags); |
957 |
if (pMB->dquant == 0 && sad00 < pMB->quant * skip_thresh) |
if (skip) continue; |
|
if (Data.chroma || xvid_me_SkipDecisionP(pCurrent, pRef, x, y, iEdgedWidth/2, pMB->quant)) { |
|
|
ZeroMacroblockP(pMB, sad00); |
|
|
pMB->mode = MODE_NOT_CODED; |
|
|
continue; |
|
|
} |
|
|
} |
|
958 |
|
|
959 |
if(MotionFlags & XVID_ME_DETECT_STATIC_MOTION) { |
SearchP(pRef, pRefH->y, pRefV->y, pRefHV->y, pCurrent, x, |
960 |
VECTOR *cmpMV; |
y, MotionFlags, current->vop_flags, |
961 |
VECTOR staticMV = { 0, 0 }; |
&Data, pParam, pMBs, reference->mbs, pMB); |
962 |
|
|
963 |
if (current->coding_type == S_VOP) |
if (current->vop_flags & XVID_VOP_MODEDECISION_RD) |
964 |
cmpMV = &pMB->amv; |
xvid_me_ModeDecision_RD(&Data, pMB, pMBs, x, y, pParam, |
965 |
|
MotionFlags, current->vop_flags, current->vol_flags, |
966 |
|
pCurrent, pRef, pGMC, current->coding_type); |
967 |
|
|
968 |
|
else if (current->vop_flags & XVID_VOP_FAST_MODEDECISION_RD) |
969 |
|
xvid_me_ModeDecision_Fast(&Data, pMB, pMBs, x, y, pParam, |
970 |
|
MotionFlags, current->vop_flags, current->vol_flags, |
971 |
|
pCurrent, pRef, pGMC, current->coding_type); |
972 |
else |
else |
973 |
cmpMV = &staticMV; |
ModeDecision_SAD(&Data, pMB, pMBs, x, y, pParam, |
974 |
|
MotionFlags, current->vop_flags, current->vol_flags, |
975 |
|
pCurrent, pRef, pGMC, current->coding_type, sad00); |
976 |
|
|
977 |
if(x > 0 && y > 0 && x < pParam->mb_width) { |
|
978 |
if(MVequal((&pMBs[(x-1) + y * pParam->mb_width])->mvs[0], *cmpMV) && |
motionStatsPVOP(&MVmax, &mvCount, &mvSum, pMB, Data.qpel); |
|
MVequal((&pMBs[x + (y-1) * pParam->mb_width])->mvs[0], *cmpMV) && |
|
|
MVequal((&pMBs[(x+1) + (y-1) * pParam->mb_width])->mvs[0], *cmpMV) && |
|
|
MVequal(prevMB->mvs[0], *cmpMV)) { |
|
|
stat_thresh = MAX((&pMBs[(x-1) + y * pParam->mb_width])->sad16, |
|
|
MAX((&pMBs[x + (y-1) * pParam->mb_width])->sad16, |
|
|
MAX((&pMBs[(x+1) + (y-1) * pParam->mb_width])->sad16, |
|
|
prevMB->sad16))); |
|
|
} else { |
|
|
stat_thresh = MIN((&pMBs[(x-1) + y * pParam->mb_width])->sad16, |
|
|
MIN((&pMBs[x + (y-1) * pParam->mb_width])->sad16, |
|
|
MIN((&pMBs[(x+1) + (y-1) * pParam->mb_width])->sad16, |
|
|
prevMB->sad16))); |
|
979 |
} |
} |
980 |
} |
} |
981 |
|
|
982 |
|
current->fcode = getMinFcode(MVmax); |
983 |
|
current->sStat.iMvSum = mvSum; |
984 |
|
current->sStat.iMvCount = mvCount; |
985 |
} |
} |
986 |
|
|
987 |
/* favorize (0,0) or global vector for cartoons */ |
void |
988 |
if (current->vop_flags & XVID_VOP_CARTOON) { |
MotionEstimateSMP(SMPmotionData * h) |
989 |
if (current->coding_type == S_VOP) { |
{ |
990 |
int32_t iSAD = sad16(pCurrent->y + (x + y * iEdgedWidth) * 16, |
const MBParam * const pParam = h->pParam; |
991 |
pGMC->y + 16*y*iEdgedWidth + 16*x, iEdgedWidth, 65536); |
const FRAMEINFO * const current = h->current; |
992 |
|
const FRAMEINFO * const reference = h->reference; |
993 |
|
const IMAGE * const pRefH = h->pRefH; |
994 |
|
const IMAGE * const pRefV = h->pRefV; |
995 |
|
const IMAGE * const pRefHV = h->pRefHV; |
996 |
|
const IMAGE * const pGMC = h->pGMC; |
997 |
|
uint32_t MotionFlags = MakeGoodMotionFlags(current->motion_flags, |
998 |
|
current->vop_flags, |
999 |
|
current->vol_flags); |
1000 |
|
|
1001 |
if (Data.chroma) { |
MACROBLOCK *const pMBs = current->mbs; |
1002 |
iSAD += sad8(pCurrent->u + x*8 + y*(iEdgedWidth/2)*8, pGMC->u + 8*y*(iEdgedWidth/2) + 8*x, iEdgedWidth/2); |
const IMAGE *const pCurrent = ¤t->image; |
1003 |
iSAD += sad8(pCurrent->v + (x + y*(iEdgedWidth/2))*8, pGMC->v + 8*y*(iEdgedWidth/2) + 8*x, iEdgedWidth/2); |
const IMAGE *const pRef = &reference->image; |
|
} |
|
1004 |
|
|
1005 |
if (iSAD <= stat_thresh) { /* mode decision GMC */ |
const uint32_t mb_width = pParam->mb_width; |
1006 |
pMB->mode = MODE_INTER; |
const uint32_t mb_height = pParam->mb_height; |
1007 |
pMB->sad16 = pMB->sad8[0] = pMB->sad8[1] = pMB->sad8[2] = pMB->sad8[3] = iSAD; |
const uint32_t iEdgedWidth = pParam->edged_width; |
1008 |
pMB->mcsel = 1; |
int stat_thresh = 0; |
1009 |
if (Data.qpel) { |
int y_step = h->y_step; |
1010 |
pMB->qmvs[0] = pMB->qmvs[1] = pMB->qmvs[2] = pMB->qmvs[3] = pMB->amv; |
int start_y = h->start_y; |
1011 |
pMB->mvs[0].x = pMB->mvs[1].x = pMB->mvs[2].x = pMB->mvs[3].x = pMB->amv.x/2; |
int MVmax = 0, mvSum = 0, mvCount = 0; |
|
pMB->mvs[0].y = pMB->mvs[1].y = pMB->mvs[2].y = pMB->mvs[3].y = pMB->amv.y/2; |
|
|
} else |
|
|
pMB->mvs[0] = pMB->mvs[1] = pMB->mvs[2] = pMB->mvs[3] = pMB->amv; |
|
1012 |
|
|
1013 |
continue; |
uint32_t x, y; |
1014 |
|
int sad00; |
1015 |
|
int skip_thresh = INITIAL_SKIP_THRESH * \ |
1016 |
|
(current->vop_flags & XVID_VOP_MODEDECISION_RD ? 2:1); |
1017 |
|
int block = start_y*mb_width; |
1018 |
|
int * complete_count_self = h->complete_count_self; |
1019 |
|
const volatile int * complete_count_above = h->complete_count_above; |
1020 |
|
int max_mbs; |
1021 |
|
int current_mb = 0; |
1022 |
|
|
1023 |
|
/* some pre-initialized thingies for SearchP */ |
1024 |
|
DECLARE_ALIGNED_MATRIX(dct_space, 3, 64, int16_t, CACHE_LINE); |
1025 |
|
SearchData Data; |
1026 |
|
memset(&Data, 0, sizeof(SearchData)); |
1027 |
|
Data.iEdgedWidth = iEdgedWidth; |
1028 |
|
Data.iFcode = current->fcode; |
1029 |
|
Data.rounding = pParam->m_rounding_type; |
1030 |
|
Data.qpel = (current->vol_flags & XVID_VOL_QUARTERPEL ? 1:0); |
1031 |
|
Data.chroma = MotionFlags & XVID_ME_CHROMA_PVOP; |
1032 |
|
Data.dctSpace = dct_space; |
1033 |
|
Data.quant_type = !(pParam->vol_flags & XVID_VOL_MPEGQUANT); |
1034 |
|
Data.mpeg_quant_matrices = pParam->mpeg_quant_matrices; |
1035 |
|
|
1036 |
|
/* todo: sort out temp memory space */ |
1037 |
|
Data.RefQ = h->RefQ; |
1038 |
|
if (sadInit) (*sadInit) (); |
1039 |
|
|
1040 |
|
max_mbs = 0; |
1041 |
|
|
1042 |
|
for (y = start_y; y < mb_height; y += y_step) { |
1043 |
|
if (y == 0) max_mbs = mb_width; /* we can process all blocks of the first row */ |
1044 |
|
|
1045 |
|
for (x = 0; x < mb_width; x++) { |
1046 |
|
|
1047 |
|
MACROBLOCK *pMB, *prevMB; |
1048 |
|
int skip; |
1049 |
|
|
1050 |
|
if (current_mb >= max_mbs) { |
1051 |
|
/* we ME-ed all macroblocks we safely could. grab next portion */ |
1052 |
|
int above_count = *complete_count_above; /* sync point */ |
1053 |
|
if (above_count == mb_width) { |
1054 |
|
/* full line above is ready */ |
1055 |
|
above_count = mb_width+1; |
1056 |
|
if (y < mb_height-y_step) { |
1057 |
|
/* this is not last line, grab a portion of MBs from the next line too */ |
1058 |
|
above_count += MAX(0, complete_count_above[1] - 1); |
1059 |
} |
} |
1060 |
} |
} |
|
else if (sad00 < stat_thresh) { |
|
|
VECTOR predMV; |
|
|
if (current->vol_flags & XVID_VOL_QUARTERPEL) |
|
|
predMV = get_qpmv2(current->mbs, mb_width, 0, x, y, 0); |
|
|
else |
|
|
predMV = get_pmv2(current->mbs, mb_width, 0, x, y, 0); |
|
1061 |
|
|
1062 |
ZeroMacroblockP(pMB, sad00); |
max_mbs = current_mb + above_count - x - 1; |
1063 |
pMB->cbp = 0x3f; |
|
1064 |
pMB->pmvs[0].x = - predMV.x; |
if (current_mb >= max_mbs) { |
1065 |
pMB->pmvs[0].y = - predMV.y; |
/* current workload is zero */ |
1066 |
|
x--; |
1067 |
|
sched_yield(); |
1068 |
continue; |
continue; |
1069 |
} |
} |
1070 |
} |
} |
1071 |
|
|
1072 |
|
|
1073 |
|
pMB = &pMBs[block]; |
1074 |
|
prevMB = &reference->mbs[block]; |
1075 |
|
|
1076 |
|
pMB->sad16 = |
1077 |
|
sad16v(pCurrent->y + (x + y * iEdgedWidth) * 16, |
1078 |
|
pRef->y + (x + y * iEdgedWidth) * 16, |
1079 |
|
pParam->edged_width, pMB->sad8); |
1080 |
|
|
1081 |
|
sad00 = 4*MAX(MAX(pMB->sad8[0], pMB->sad8[1]), MAX(pMB->sad8[2], pMB->sad8[3])); |
1082 |
|
|
1083 |
|
if (Data.chroma) { |
1084 |
|
Data.chromaSAD = sad8(pCurrent->u + x*8 + y*(iEdgedWidth/2)*8, |
1085 |
|
pRef->u + x*8 + y*(iEdgedWidth/2)*8, iEdgedWidth/2) |
1086 |
|
+ sad8(pCurrent->v + (x + y*(iEdgedWidth/2))*8, |
1087 |
|
pRef->v + (x + y*(iEdgedWidth/2))*8, iEdgedWidth/2); |
1088 |
|
pMB->sad16 += Data.chromaSAD; |
1089 |
|
sad00 += Data.chromaSAD; |
1090 |
|
} |
1091 |
|
|
1092 |
|
skip = InitialSkipDecisionP(sad00, pParam, current, pMB, prevMB, x, y, &Data, pGMC, |
1093 |
|
pCurrent, pRef, MotionFlags); |
1094 |
|
|
1095 |
|
if (skip) { |
1096 |
|
current_mb++; |
1097 |
|
block++; |
1098 |
|
*complete_count_self = x+1; |
1099 |
|
continue; |
1100 |
|
} |
1101 |
|
|
1102 |
SearchP(pRef, pRefH->y, pRefV->y, pRefHV->y, pCurrent, x, |
SearchP(pRef, pRefH->y, pRefV->y, pRefHV->y, pCurrent, x, |
1103 |
y, MotionFlags, current->vop_flags, |
y, MotionFlags, current->vop_flags, |
1104 |
&Data, pParam, pMBs, reference->mbs, pMB); |
&Data, pParam, pMBs, reference->mbs, pMB); |
1117 |
MotionFlags, current->vop_flags, current->vol_flags, |
MotionFlags, current->vop_flags, current->vol_flags, |
1118 |
pCurrent, pRef, pGMC, current->coding_type, sad00); |
pCurrent, pRef, pGMC, current->coding_type, sad00); |
1119 |
|
|
1120 |
|
*complete_count_self = x+1; |
1121 |
|
|
1122 |
|
current_mb++; |
1123 |
|
block++; |
1124 |
|
|
1125 |
motionStatsPVOP(&MVmax, &mvCount, &mvSum, pMB, Data.qpel); |
motionStatsPVOP(&MVmax, &mvCount, &mvSum, pMB, Data.qpel); |
1126 |
|
|
1127 |
} |
} |
1128 |
|
block += (y_step-1)*pParam->mb_width; |
1129 |
|
complete_count_self++; |
1130 |
|
complete_count_above++; |
1131 |
} |
} |
1132 |
|
|
1133 |
current->fcode = getMinFcode(MVmax); |
h->minfcode = getMinFcode(MVmax); |
|
current->sStat.iMvSum = mvSum; |
|
|
current->sStat.iMvCount = mvCount; |
|
1134 |
|
|
1135 |
return 0; |
h->MVmax = MVmax; |
1136 |
|
h->mvSum = mvSum; |
1137 |
|
h->mvCount = mvCount; |
1138 |
} |
} |
1139 |
|
|
1140 |
|
|