--- encoder.c 2004/04/04 02:27:50 1.102.2.3 +++ encoder.c 2004/07/18 12:02:46 1.107 @@ -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: encoder.c,v 1.102.2.3 2004/04/04 02:27:50 syskin Exp $ + * $Id: encoder.c,v 1.107 2004/07/18 12:02:46 edgomez Exp $ * ****************************************************************************/ @@ -100,11 +100,22 @@ i--; } - /* if neccessary, round to 65535 accuracy */ - if (*base > 65535) { - float div = (float) *base / 65535; - *base = (int) (*base / div); - *inc = (int) (*inc / div); + if (*base > 65535 || *inc > 65535) { + int *biggest; + int *other; + float div; + + if (*base > *inc) { + biggest = base; + other = inc; + } else { + biggest = inc; + other = base; + } + + div = ((float)*biggest)/((float)65535); + *biggest = (int)(((float)*biggest)/div); + *other = (int)(((float)*other)/div); } } @@ -1857,7 +1868,7 @@ #endif if (current->sStat.kblks + current->sStat.mblks <= (pParam->frame_drop_ratio * mb_width * mb_height) / 100 && - ((pEnc->bframenum_tail == 0) || !(pEnc->mbParam.global_flags & XVID_GLOBAL_CLOSED_GOP)) ) + ( (pEnc->bframenum_head >= pEnc->bframenum_tail) || !(pEnc->mbParam.global_flags & XVID_GLOBAL_CLOSED_GOP)) ) { current->sStat.kblks = current->sStat.mblks = 0; current->sStat.ublks = mb_width * mb_height;