--- trunk/xvidcore/src/encoder.c 2002/05/06 10:07:19 164 +++ trunk/xvidcore/src/encoder.c 2002/06/07 10:36:08 189 @@ -32,9 +32,11 @@ * * History * + * 08.05.2002 fix some problem in DEBUG mode; + * MinChen * 14.04.2002 added FrameCodeB() * - * $Id: encoder.c,v 1.35 2002-05-06 10:07:18 suxen_drol Exp $ + * $Id: encoder.c,v 1.38 2002-06-07 10:36:08 edgomez Exp $ * ***************************************************************************/ @@ -299,9 +301,14 @@ if (pParam->rc_bitrate) { - RateControlInit(pParam->rc_bitrate, pParam->rc_reaction_delay_factor, - pParam->rc_averaging_period, pParam->rc_buffer, pParam->fbase * 1000 / pParam->fincr, - pParam->max_quantizer, pParam->min_quantizer); + RateControlInit(&pEnc->rate_control, + pParam->rc_bitrate, + pParam->rc_reaction_delay_factor, + pParam->rc_averaging_period, + pParam->rc_buffer, + pParam->fbase * 1000 / pParam->fincr, + pParam->max_quantizer, + pParam->min_quantizer); } init_timer(); @@ -365,6 +372,11 @@ Bitstream bs; uint32_t bits; +#ifdef _DEBUG + float psnr; + char temp[128]; +#endif + ENC_CHECK(pEnc); ENC_CHECK(pFrame); @@ -432,7 +444,7 @@ SWAP(pEnc->current, pEnc->reference); - pEnc->current->quant = (pFrame->quant == 0) ? RateControlGetQ(0) : pFrame->quant; + pEnc->current->quant = (pFrame->quant == 0) ? RateControlGetQ(&pEnc->rate_control, 0) : pFrame->quant; if(pEnc->current->quant < 1) pEnc->current->quant = 1; @@ -457,7 +469,7 @@ stop_conv_timer(); #ifdef _DEBUG - image_copy(&pEnc->sOriginal, &pEnc->sCurrent, pEnc->mbParam.edged_width, pEnc->mbParam.height); + image_copy(&pEnc->sOriginal, &pEnc->current->image, pEnc->mbParam.edged_width, pEnc->mbParam.height); #endif @@ -569,7 +581,10 @@ if (pFrame->quant == 0) { - RateControlUpdate(pEnc->current->quant, pFrame->length, pFrame->intra); + RateControlUpdate(&pEnc->rate_control, + pEnc->current->quant, + pFrame->length, + pFrame->intra); } pEnc->iFrameNum++; @@ -630,7 +645,7 @@ if (pFrame->quant == 0) { - pEnc->current->quant = RateControlGetQ(0); + pEnc->current->quant = RateControlGetQ(&pEnc->rate_control,0); } else { @@ -723,7 +738,10 @@ if (pFrame->quant == 0) { - RateControlUpdate(pEnc->current->quant, pFrame->length, pFrame->intra); + RateControlUpdate(&pEnc->rate_control, + pEnc->current->quant, + pFrame->length, + pFrame->intra); } #ifdef _DEBUG @@ -1351,4 +1369,4 @@ *pBits = BitstreamPos(bs) - *pBits; } -#endif \ No newline at end of file +#endif