25 |
* along with this program; if not, write to the Free Software |
* along with this program; if not, write to the Free Software |
26 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
27 |
* |
* |
28 |
* $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 $ |
29 |
* |
* |
30 |
*****************************************************************************/ |
*****************************************************************************/ |
31 |
|
|
333 |
/* Compute the target filesize */ |
/* Compute the target filesize */ |
334 |
if (rc->param.bitrate<0) { |
if (rc->param.bitrate<0) { |
335 |
/* if negative, bitrate equals the target (in kbytes) */ |
/* if negative, bitrate equals the target (in kbytes) */ |
336 |
rc->target = (-rc->param.bitrate) * 1024; |
rc->target = ((uint64_t)(-rc->param.bitrate)) * 1024; |
337 |
} else if (rc->num_frames < create->fbase/create->fincr) { |
} else if (rc->num_frames < create->fbase/create->fincr) { |
338 |
/* Source sequence is less than 1s long, we do as if it was 1s long */ |
/* Source sequence is less than 1s long, we do as if it was 1s long */ |
339 |
rc->target = rc->param.bitrate / 8; |
rc->target = rc->param.bitrate / 8; |
436 |
if (data->quant > 0) |
if (data->quant > 0) |
437 |
return(0); |
return(0); |
438 |
|
|
439 |
/* Second case: We are in a Quant zone */ |
/* Second case: insufficent stats data */ |
440 |
|
if (data->frame_num >= rc->num_frames) { |
441 |
|
DPRINTF(XVID_DEBUG_RC,"[xvid rc] -- stats file too short (now processing frame %d)", |
442 |
|
data->frame_num); |
443 |
|
return(0); |
444 |
|
} |
445 |
|
|
446 |
|
/* Third case: We are in a Quant zone */ |
447 |
if (s->zone_mode == XVID_ZONE_QUANT) { |
if (s->zone_mode == XVID_ZONE_QUANT) { |
448 |
rc->fq_error += s->weight; |
rc->fq_error += s->weight; |
449 |
data->quant = (int)rc->fq_error; |
data->quant = (int)rc->fq_error; |
454 |
return(0); |
return(0); |
455 |
} |
} |
456 |
|
|
|
/* Third case: insufficent stats data */ |
|
|
if (data->frame_num >= rc->num_frames) |
|
|
return(0); |
|
457 |
|
|
458 |
/*************************************************************************/ |
/*************************************************************************/ |
459 |
/*************************************************************************/ |
/*************************************************************************/ |