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.7 2003-05-22 10:57:33 edgomez Exp $ |
* $Id: plugin_2pass2.c,v 1.1.2.8 2003-05-22 16:36:07 edgomez Exp $ |
29 |
* |
* |
30 |
*****************************************************************************/ |
*****************************************************************************/ |
31 |
|
|
174 |
}else if (type == 'b') { |
}else if (type == 'b') { |
175 |
s->type = XVID_TYPE_BVOP; |
s->type = XVID_TYPE_BVOP; |
176 |
}else{ /* unknown type */ |
}else{ /* unknown type */ |
177 |
DPRINTF(XVID_DEBUG_RC, "unknown stats frame type; assuming pvop"); |
DPRINTF(XVID_DEBUG_RC, "unknown stats frame type; assuming pvop\n"); |
178 |
s->type = XVID_TYPE_PVOP; |
s->type = XVID_TYPE_PVOP; |
179 |
} |
} |
180 |
|
|
539 |
|
|
540 |
/* special info for alt curve: bias bonus and quantizer thresholds */ |
/* special info for alt curve: bias bonus and quantizer thresholds */ |
541 |
|
|
542 |
DPRINTF(XVID_DEBUG_RC, "avg scaled framesize:%i", (int)rc->avg_length[XVID_TYPE_PVOP-1]); |
DPRINTF(XVID_DEBUG_RC, "avg scaled framesize:%i\n", (int)rc->avg_length[XVID_TYPE_PVOP-1]); |
543 |
DPRINTF(XVID_DEBUG_RC, "bias bonus:%i bytes", (int)rc->alt_curve_curve_bias_bonus); |
DPRINTF(XVID_DEBUG_RC, "bias bonus:%i bytes\n", (int)rc->alt_curve_curve_bias_bonus); |
544 |
|
|
545 |
for (i=1; i <= (int)(rc->alt_curve_high*2)+1; i++) { |
for (i=1; i <= (int)(rc->alt_curve_high*2)+1; i++) { |
546 |
double curve_temp, dbytes; |
double curve_temp, dbytes; |
589 |
if (newquant != oldquant) { |
if (newquant != oldquant) { |
590 |
int percent = (int)((i - rc->avg_length[XVID_TYPE_PVOP-1]) * 100.0 / rc->avg_length[XVID_TYPE_PVOP-1]); |
int percent = (int)((i - rc->avg_length[XVID_TYPE_PVOP-1]) * 100.0 / rc->avg_length[XVID_TYPE_PVOP-1]); |
591 |
oldquant = newquant; |
oldquant = newquant; |
592 |
DPRINTF(XVID_DEBUG_RC, "quant:%i threshold at %i : %i percent", newquant, i, percent); |
DPRINTF(XVID_DEBUG_RC, "quant:%i threshold at %i : %i percent\n", newquant, i, percent); |
593 |
} |
} |
594 |
} |
} |
595 |
} |
} |
1047 |
|
|
1048 |
if (data->quant > rc->last_quant[s->type-1] + 2) { |
if (data->quant > rc->last_quant[s->type-1] + 2) { |
1049 |
data->quant = rc->last_quant[s->type-1] + 2; |
data->quant = rc->last_quant[s->type-1] + 2; |
1050 |
DPRINTF(XVID_DEBUG_RC, "p/b-frame quantizer prevented from rising too steeply"); |
DPRINTF(XVID_DEBUG_RC, "p/b-frame quantizer prevented from rising too steeply\n"); |
1051 |
} |
} |
1052 |
if (data->quant < rc->last_quant[s->type-1] - 2) { |
if (data->quant < rc->last_quant[s->type-1] - 2) { |
1053 |
data->quant = rc->last_quant[s->type-1] - 2; |
data->quant = rc->last_quant[s->type-1] - 2; |
1054 |
DPRINTF(XVID_DEBUG_RC, "p/b-frame quantizer prevented from falling too steeply"); |
DPRINTF(XVID_DEBUG_RC, "p/b-frame quantizer prevented from falling too steeply\n"); |
1055 |
} |
} |
1056 |
} |
} |
1057 |
|
|