[svn] / branches / dev-api-4 / xvidcore / src / plugins / plugin_2pass2.c Repository:
ViewVC logotype

Diff of /branches/dev-api-4/xvidcore/src/plugins/plugin_2pass2.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1048, Thu May 29 11:37:20 2003 UTC revision 1050, Thu May 29 13:53:17 2003 UTC
# Line 25  Line 25 
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.15 2003-05-29 11:37:20 edgomez Exp $   * $Id: plugin_2pass2.c,v 1.1.2.17 2003-05-29 13:53:17 edgomez Exp $
29   *   *
30   *****************************************************************************/   *****************************************************************************/
31    
# Line 600  Line 600 
600          if (capped_to_max_framesize == 0)          if (capped_to_max_framesize == 0)
601                  rc->last_quant[s->type-1] = data->quant;                  rc->last_quant[s->type-1] = data->quant;
602    
603            /* Force frame type */
604            data->type = s->type;
605    
606          return 0;          return 0;
607  }  }
608    
# Line 873  Line 876 
876          int64_t pass1_length = rc->tot_length[0] + rc->tot_length[1] + rc->tot_length[2] - rc->tot_quant;          int64_t pass1_length = rc->tot_length[0] + rc->tot_length[1] + rc->tot_length[2] - rc->tot_quant;
877          double scaler;          double scaler;
878          int i, num_MBs;          int i, num_MBs;
         int min_size[3];  
879    
880          /* Let's compute a linear scaler in order to perform curve scaling */          /* Let's compute a linear scaler in order to perform curve scaling */
881          scaler = (double)target / (double)pass1_length;          scaler = (double)target / (double)pass1_length;
# Line 891  Line 893 
893           * Compute min frame lengths (for each frame type) according to the number           * Compute min frame lengths (for each frame type) according to the number
894           * of MBs. We sum all blocks count from frame 0 (should be an IFrame, so           * of MBs. We sum all blocks count from frame 0 (should be an IFrame, so
895           * blocks[0] should be enough) to know how many MBs there are.           * blocks[0] should be enough) to know how many MBs there are.
896             *
897             * We compare these hardcoded values with observed values in first pass
898             * (determined in pre_process0).Then we keep the real minimum.
899           */           */
900          num_MBs = rc->stats[0].blks[0] + rc->stats[0].blks[1] + rc->stats[0].blks[2];          num_MBs = rc->stats[0].blks[0] + rc->stats[0].blks[1] + rc->stats[0].blks[2];
901          min_size[0] = ((num_MBs*22) + 240) / 8;  
902          min_size[1] = ((num_MBs)    + 88)  / 8;          if(rc->min_length[0] > ((num_MBs*22) + 240) / 8)
903          min_size[2] = 8;                  rc->min_length[0] = ((num_MBs*22) + 240) / 8;
904    
905            if(rc->min_length[1] > ((num_MBs) + 88)  / 8)
906                    rc->min_length[1] = ((num_MBs) + 88)  / 8;
907    
908            if(rc->min_length[2] > 8)
909                    rc->min_length[2] = 8;
910    
911          /*          /*
912           * Perform an initial scale pass.           * Perform an initial scale pass.
# Line 916  Line 927 
927                  len = (int)((double)s->length * scaler * s->weight / rc->avg_weight);                  len = (int)((double)s->length * scaler * s->weight / rc->avg_weight);
928    
929                  /* Compare with the computed minimum */                  /* Compare with the computed minimum */
930                  if (len < min_size[s->type-1]) {                  if (len < rc->min_length[s->type-1]) {
931                          /* force frame size to our computed minimum */                          /* force frame size to our computed minimum */
932                          s->scaled_length = min_size[s->type-1];                          s->scaled_length = rc->min_length[s->type-1];
933                          target -= s->scaled_length;                          target -= s->scaled_length;
934                          pass1_length -= s->length;                          pass1_length -= s->length;
935                  } else {                  } else {

Legend:
Removed from v.1048  
changed lines
  Added in v.1050

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4