--- plugin_2pass2.c 2003/12/05 14:44:35 1.1.2.28 +++ plugin_2pass2.c 2003/12/08 12:38:04 1.1.2.30 @@ -25,7 +25,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: plugin_2pass2.c,v 1.1.2.28 2003/12/05 14:44:35 edgomez Exp $ + * $Id: plugin_2pass2.c,v 1.1.2.30 2003/12/08 12:38:04 syskin Exp $ * *****************************************************************************/ @@ -333,7 +333,7 @@ /* Compute the target filesize */ if (rc->param.bitrate<0) { /* if negative, bitrate equals the target (in kbytes) */ - rc->target = (-rc->param.bitrate) * 1024; + rc->target = ((uint64_t)(-rc->param.bitrate)) * 1024; } else if (rc->num_frames < create->fbase/create->fincr) { /* Source sequence is less than 1s long, we do as if it was 1s long */ rc->target = rc->param.bitrate / 8; @@ -436,7 +436,14 @@ if (data->quant > 0) return(0); - /* Second case: We are in a Quant zone */ + /* Second case: insufficent stats data */ + if (data->frame_num >= rc->num_frames) { + DPRINTF(XVID_DEBUG_RC,"[xvid rc] -- stats file too short (now processing frame %d)", + data->frame_num); + return(0); + } + + /* Third case: We are in a Quant zone */ if (s->zone_mode == XVID_ZONE_QUANT) { rc->fq_error += s->weight; data->quant = (int)rc->fq_error; @@ -447,9 +454,6 @@ return(0); } - /* Third case: insufficent stats data */ - if (data->frame_num >= rc->num_frames) - return(0); /*************************************************************************/ /*************************************************************************/