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.20 2006-02-25 01:20:41 syskin Exp $ |
* $Id: estimation_pvop.c,v 1.21 2006-02-27 00:24:02 syskin Exp $ |
25 |
* |
* |
26 |
****************************************************************************/ |
****************************************************************************/ |
27 |
|
|
1016 |
(current->vop_flags & XVID_VOP_MODEDECISION_RD ? 2:1); |
(current->vop_flags & XVID_VOP_MODEDECISION_RD ? 2:1); |
1017 |
int block = start_y*mb_width; |
int block = start_y*mb_width; |
1018 |
int * complete_count_self = h->complete_count_self; |
int * complete_count_self = h->complete_count_self; |
1019 |
const int * complete_count_above = h->complete_count_above; |
const volatile int * complete_count_above = h->complete_count_above; |
1020 |
int max_mbs; |
int max_mbs; |
1021 |
int current_mb = 0; |
int current_mb = 0; |
1022 |
|
|
1047 |
MACROBLOCK *pMB, *prevMB; |
MACROBLOCK *pMB, *prevMB; |
1048 |
int skip; |
int skip; |
1049 |
|
|
|
pMB = &pMBs[block]; |
|
|
prevMB = &reference->mbs[block]; |
|
|
|
|
|
pMB->sad16 = |
|
|
sad16v(pCurrent->y + (x + y * iEdgedWidth) * 16, |
|
|
pRef->y + (x + y * iEdgedWidth) * 16, |
|
|
pParam->edged_width, pMB->sad8); |
|
|
|
|
|
sad00 = 4*MAX(MAX(pMB->sad8[0], pMB->sad8[1]), MAX(pMB->sad8[2], pMB->sad8[3])); |
|
|
|
|
|
if (Data.chroma) { |
|
|
Data.chromaSAD = sad8(pCurrent->u + x*8 + y*(iEdgedWidth/2)*8, |
|
|
pRef->u + x*8 + y*(iEdgedWidth/2)*8, iEdgedWidth/2) |
|
|
+ sad8(pCurrent->v + (x + y*(iEdgedWidth/2))*8, |
|
|
pRef->v + (x + y*(iEdgedWidth/2))*8, iEdgedWidth/2); |
|
|
pMB->sad16 += Data.chromaSAD; |
|
|
sad00 += Data.chromaSAD; |
|
|
} |
|
|
|
|
1050 |
if (current_mb >= max_mbs) { |
if (current_mb >= max_mbs) { |
1051 |
/* we ME-ed all macroblocks we safely could. grab next portion */ |
/* we ME-ed all macroblocks we safely could. grab next portion */ |
1052 |
int above_count = *complete_count_above; /* sync point */ |
int above_count = *complete_count_above; /* sync point */ |
1069 |
} |
} |
1070 |
} |
} |
1071 |
|
|
|
skip = InitialSkipDecisionP(sad00, pParam, current, pMB, prevMB, x, y, &Data, pGMC, |
|
|
pCurrent, pRef, MotionFlags); |
|
|
if (current_mb >= max_mbs) { |
|
|
/* we ME-ed all macroblocks we safely could. grab next portion */ |
|
|
int above_count = *complete_count_above; /* sync point */ |
|
|
if (above_count == mb_width) { |
|
|
/* full line above is ready */ |
|
|
above_count = mb_width+1; |
|
|
if (y < mb_height-y_step) { |
|
|
/* this is not last line, grab a portion of MBs from the next line too */ |
|
|
above_count += MAX(0, complete_count_above[1] - 1); |
|
|
} |
|
|
} |
|
1072 |
|
|
1073 |
max_mbs = current_mb + above_count - x - 1; |
pMB = &pMBs[block]; |
1074 |
|
prevMB = &reference->mbs[block]; |
1075 |
|
|
1076 |
if (current_mb >= max_mbs) { |
pMB->sad16 = |
1077 |
/* current workload is zero */ |
sad16v(pCurrent->y + (x + y * iEdgedWidth) * 16, |
1078 |
x--; |
pRef->y + (x + y * iEdgedWidth) * 16, |
1079 |
sched_yield(); |
pParam->edged_width, pMB->sad8); |
1080 |
continue; |
|
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) { |
if (skip) { |
1096 |
current_mb++; |
current_mb++; |
1097 |
block++; |
block++; |