--- branches/dev-api-4/xvidcore/src/plugins/plugin_2pass2.c 2003/11/09 20:49:21 1202 +++ branches/dev-api-4/xvidcore/src/plugins/plugin_2pass2.c 2003/11/19 15:59:41 1219 @@ -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.24 2003-11-09 20:49:21 edgomez Exp $ + * $Id: plugin_2pass2.c,v 1.1.2.27 2003-11-19 15:59:41 edgomez Exp $ * *****************************************************************************/ @@ -220,6 +220,7 @@ { switch(opt) { case XVID_PLG_INFO : + case XVID_PLG_FRAME : return 0; case XVID_PLG_CREATE : @@ -616,7 +617,7 @@ b_ref--; /* Compute the original quant */ - s->quant = 100*s->quant - data->bquant_offset; + s->quant = 2*(100*s->quant - data->bquant_offset); s->quant += data->bquant_ratio - 1; /* to avoid rouding issues */ s->quant = s->quant/data->bquant_ratio - b_ref->quant; } @@ -823,26 +824,24 @@ char *ptr; char type; - int fields, nouse; + int fields; lines++; /* We skip spaces */ ptr = skipspaces(line); - /* Skip coment lines */ - if(iscomment(ptr)) { + /* Skip coment lines or empty lines */ + if(iscomment(ptr) || *ptr == '\0') { free(line); continue; } /* Read the stat line from buffer */ - fields = sscanf(ptr, - "%c %d %d %d %d %d", - &type, &nouse, &nouse, &nouse, &nouse, &nouse); + fields = sscanf(ptr, "%c", &type); /* Valid stats files have at least 6 fields */ - if (fields == 6) { + if (fields == 1) { switch(type) { case 'i': case 'I': @@ -901,8 +900,8 @@ /* We skip spaces */ ptr = skipspaces(line); - /* Skip comment lines */ - if(iscomment(ptr)) { + /* Skip comment lines or empty lines */ + if(iscomment(ptr) || *ptr == '\0') { free(line); continue; } @@ -1278,7 +1277,7 @@ } else { rc->avg_length[i] = rc->tot_scaled_length[i]; - if (i == XVID_TYPE_IVOP) { + if (i == (XVID_TYPE_IVOP-1)) { /* I Frames total has to be added the boost total */ rc->avg_length[i] += ivop_boost_total; } else {