--- trunk/xvidcore/src/encoder.c 2002/07/18 23:52:40 313 +++ trunk/xvidcore/src/encoder.c 2002/07/20 22:30:30 322 @@ -39,7 +39,7 @@ * MinChen * 14.04.2002 added FrameCodeB() * - * $Id: encoder.c,v 1.56 2002-07-18 23:52:40 chl Exp $ + * $Id: encoder.c,v 1.59 2002-07-20 22:30:30 albeu Exp $ * ****************************************************************************/ @@ -421,6 +421,7 @@ pEnc->mbParam.m_seconds = 0; pEnc->mbParam.m_ticks = 0; pEnc->m_framenum = 0; + pEnc->last_pframe = 1; #endif pParam->handle = (void *) pEnc; @@ -1723,6 +1724,11 @@ *pBits = BitstreamPos(bs) - *pBits; +#ifdef BFRAMES + pEnc->time_pp = ((int32_t)pEnc->mbParam.fbase - (int32_t)pEnc->last_pframe + (int32_t)pEnc->mbParam.m_ticks) % (int32_t)pEnc->mbParam.fbase; + + pEnc->last_pframe = pEnc->mbParam.m_ticks; +#endif return 0; // inter } @@ -1778,7 +1784,10 @@ stop_inter_timer(); start_timer(); - MotionEstimationBVOP(&pEnc->mbParam, frame, pEnc->reference->mbs, f_ref, + MotionEstimationBVOP(&pEnc->mbParam, frame, + ((int32_t)pEnc->mbParam.fbase + (int32_t)pEnc->mbParam.m_ticks + 1 - (int32_t)pEnc->last_pframe) % pEnc->mbParam.fbase, + pEnc->time_pp, + pEnc->reference->mbs, f_ref, &pEnc->f_refh, &pEnc->f_refv, &pEnc->f_refhv, pEnc->current->mbs, b_ref, &pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV);