--- trunk/xvidcore/src/motion/estimation_pvop.c 2006/02/27 00:22:31 1690 +++ trunk/xvidcore/src/motion/estimation_pvop.c 2006/02/27 00:24:02 1691 @@ -21,7 +21,7 @@ * along with this program ; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $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 $ * ****************************************************************************/ @@ -1016,7 +1016,7 @@ (current->vop_flags & XVID_VOP_MODEDECISION_RD ? 2:1); int block = start_y*mb_width; int * complete_count_self = h->complete_count_self; - const int * complete_count_above = h->complete_count_above; + const volatile int * complete_count_above = h->complete_count_above; int max_mbs; int current_mb = 0; @@ -1047,25 +1047,6 @@ MACROBLOCK *pMB, *prevMB; int skip; - 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; - } - if (current_mb >= max_mbs) { /* we ME-ed all macroblocks we safely could. grab next portion */ int above_count = *complete_count_above; /* sync point */ @@ -1088,30 +1069,29 @@ } } - 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); - } - } - max_mbs = current_mb + above_count - x - 1; - - if (current_mb >= max_mbs) { - /* current workload is zero */ - x--; - sched_yield(); - continue; - } + 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; } + skip = InitialSkipDecisionP(sad00, pParam, current, pMB, prevMB, x, y, &Data, pGMC, + pCurrent, pRef, MotionFlags); + if (skip) { current_mb++; block++;