[cvs] / xvidcore / src / plugins / plugin_2pass1.c Repository:
ViewVC logotype

Diff of /xvidcore/src/plugins/plugin_2pass1.c

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

revision 1.1.2.13, Sat Dec 20 15:38:13 2003 UTC revision 1.4, Tue Mar 9 10:00:14 2010 UTC
# Line 1  Line 1 
1  /******************************************************************************  /******************************************************************************
2   *   *
3   *  XviD Bit Rate Controller Library   *  Xvid Bit Rate Controller Library
4   *  - VBR 2 pass bitrate controler implementation -   *  - VBR 2 pass bitrate controler implementation -
5   *   *
6   *  Copyright (C) 2002-2003 Edouard Gomez <ed.gomez@free.fr>   *  Copyright (C) 2002-2003 Edouard Gomez <ed.gomez@free.fr>
7   *   *
8   *  The curve treatment algorithm is the one implemented by Foxer <email?> and   *  The curve treatment algorithm is the one implemented by Foxer <email?> and
9   *  Dirk Knop <dknop@gwdg.de> for the XviD vfw dynamic library.   *  Dirk Knop <dknop@gwdg.de> for the Xvid vfw dynamic library.
10   *   *
11   *  This program is free software; you can redistribute it and/or modify   *  This program is free software; you can redistribute it and/or modify
12   *  it under the terms of the GNU General Public License as published by   *  it under the terms of the GNU General Public License as published by
# Line 34  Line 34 
34  #include "../image/image.h"  #include "../image/image.h"
35    
36    
37    /* This preprocessor constant controls wheteher or not, first pass is done
38     * using fast ME routines to speed up the 2pass process at the expense of
39     * less precise first pass stats */
40  #define FAST1PASS  #define FAST1PASS
41    #define FAST1PASS_QPEL_TOO
42    
43    
44  /* context struct */  /* context struct */
# Line 128  Line 132 
132  {  {
133           if (data->quant <= 0) {           if (data->quant <= 0) {
134                  if (data->zone && data->zone->mode == XVID_ZONE_QUANT) {                  if (data->zone && data->zone->mode == XVID_ZONE_QUANT) {
135                            /* We disable no options in quant zones, as their implementation is
136                             * based on the fact we do first pass exactly the same way as the
137                             * second one to have exact zone size */
138                          rc->fq_error += (double)data->zone->increment / (double)data->zone->base;                          rc->fq_error += (double)data->zone->increment / (double)data->zone->base;
139                          data->quant = (int)rc->fq_error;                          data->quant = (int)rc->fq_error;
140                          rc->fq_error -= data->quant;                          rc->fq_error -= data->quant;
# Line 135  Line 142 
142                          data->quant = 2;                          data->quant = 2;
143    
144  #ifdef FAST1PASS  #ifdef FAST1PASS
145                            /* Given the fact our 2pass algorithm is based on very simple
146                          data->motion_flags &= ~(XVID_ME_CHROMA_PVOP + XVID_ME_CHROMA_BVOP + XVID_ME_USESQUARES16                           * rules, we can disable some options that are too CPU intensive
147                                                                          + XVID_ME_ADVANCEDDIAMOND16 + XVID_ME_EXTSEARCH16);                           * and do not provide the 2nd pass any benefit */
148    
149                          data->motion_flags |= XVID_ME_FAST_MODEINTERPOLATE + XVID_ME_SKIP_DELTASEARCH                          /* First disable some motion flags */
150                                                                          + XVID_ME_FASTREFINE16 + XVID_ME_BFRAME_EARLYSTOP;                          data->motion_flags &= ~XVID_ME_CHROMA_PVOP;
151                            data->motion_flags &= ~XVID_ME_CHROMA_BVOP;
152                          data->vop_flags &= ~(XVID_VOP_MODEDECISION_RD + XVID_VOP_FAST_MODEDECISION_RD                          data->motion_flags &= ~XVID_ME_USESQUARES16;
153                                                                  + XVID_VOP_TRELLISQUANT + XVID_VOP_INTER4V + XVID_VOP_HQACPRED);                          data->motion_flags &= ~XVID_ME_ADVANCEDDIAMOND16;
154                            data->motion_flags &= ~XVID_ME_EXTSEARCH16;
155    
156                            /* And enable fast replacements */
157                            data->motion_flags |= XVID_ME_FAST_MODEINTERPOLATE;
158                            data->motion_flags |= XVID_ME_SKIP_DELTASEARCH;
159                            data->motion_flags |= XVID_ME_FASTREFINE16;
160                            data->motion_flags |= XVID_ME_BFRAME_EARLYSTOP;
161    
162                            /* Now VOP flags (no fast replacements) */
163                            data->vop_flags &= ~XVID_VOP_MODEDECISION_RD;
164                            data->vop_flags &= ~XVID_VOP_RD_BVOP;
165                            data->vop_flags &= ~XVID_VOP_FAST_MODEDECISION_RD;
166                            data->vop_flags &= ~XVID_VOP_TRELLISQUANT;
167                            data->vop_flags &= ~XVID_VOP_INTER4V;
168                            data->vop_flags &= ~XVID_VOP_HQACPRED;
169    
170                            /* Finnaly VOL flags
171                             *
172                             * NB: Qpel cannot be disable because this option really changes
173                             *     too much the texture data compressibility, and thus the
174                             *     second pass gets confused by too much impredictability
175                             *     of frame sizes, and actually hurts quality */
176    #ifdef FAST1PASS_QPEL_TOO
177                            /* or maybe we can disable it after all? */
178                            data->vol_flags &= ~XVID_VOL_QUARTERPEL;
179    #endif
180                          data->vol_flags &= ~XVID_VOL_GMC;                          data->vol_flags &= ~XVID_VOL_GMC;
181  #endif  #endif
182                  }                  }

Legend:
Removed from v.1.1.2.13  
changed lines
  Added in v.1.4

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