[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 1046, Thu May 29 10:19:35 2003 UTC revision 1047, Thu May 29 10:36:41 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.13 2003-05-29 10:19:35 edgomez Exp $   * $Id: plugin_2pass2.c,v 1.1.2.14 2003-05-29 10:36:41 edgomez Exp $
29   *   *
30   *****************************************************************************/   *****************************************************************************/
31    
# Line 847  Line 847 
847          int64_t target  = rc->target - rc->tot_quant;          int64_t target  = rc->target - rc->tot_quant;
848          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;
849          double scaler;          double scaler;
850          int i;          int i, num_MBs;
851            int min_size[3];
852    
853          /* Let's compute a linear scaler in order to perform curve scaling */          /* Let's compute a linear scaler in order to perform curve scaling */
854          scaler = (double)target / (double)pass1_length;          scaler = (double)target / (double)pass1_length;
# Line 863  Line 863 
863                          (int)target, (int)pass1_length, scaler);                          (int)target, (int)pass1_length, scaler);
864    
865          /*          /*
866             * Compute min frame lengths (for each frame type) according to the number
867             * of MBs. We sum all blocks count from frame 0 (should be an IFrame, so
868             * blocks[0] should be enough) to know how many MBs there are.
869             */
870            num_MBs = rc->stats[0].blks[0] + rc->stats[0].blks[1] + rc->stats[0].blks[2];
871            min_size[0] = ((num_MBs*22) + 240) / 8;
872            min_size[1] = ((num_MBs)    + 88)  / 8;
873            min_size[2] = 8;
874    
875            /*
876           * Perform an initial scale pass.           * Perform an initial scale pass.
877           * If a frame size is scaled underneath our hardcoded minimums, then we           * If a frame size is scaled underneath our hardcoded minimums, then we
878           * force the frame size to the minimum, and deduct the original & scaled           * force the frame size to the minimum, and deduct the original & scaled
879           * frame length from the original and target total lengths           * frame length from the original and target total lengths
880           */           */
   
881          for (i=0; i<rc->num_frames; i++) {          for (i=0; i<rc->num_frames; i++) {
882                  stat_t * s = &rc->stats[i];                  stat_t * s = &rc->stats[i];
                 int min_size[3];  
883                  int len;                  int len;
884    
                 /* Compute min frame lengths (oe for each frame type) */  
                 min_size[0] = ((s->blks[0]*22) + 240) / 8;  
                 min_size[1] = (s->blks[0] + 88) / 8;  
                 min_size[2] = 8;  
   
885          if (s->zone_mode == XVID_ZONE_QUANT) {          if (s->zone_mode == XVID_ZONE_QUANT) {
886              s->scaled_length = s->length;              s->scaled_length = s->length;
887                          continue;                          continue;
# Line 897  Line 900 
900                          /* Do nothing for now, we'll scale this later */                          /* Do nothing for now, we'll scale this later */
901                          s->scaled_length = 0;                          s->scaled_length = 0;
902                  }                  }
   
903          }          }
904    
905          /* Correct the scaler for all non forced frames */          /* Correct the scaler for all non forced frames */

Legend:
Removed from v.1046  
changed lines
  Added in v.1047

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