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

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

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

revision 977, Tue Apr 8 14:01:35 2003 UTC revision 1216, Wed Nov 19 15:42:38 2003 UTC
# Line 3  Line 3 
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 Edouard Gomez <ed.gomez@wanadoo.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.
# Line 22  Line 22 
22   * along with this program; if not, write to the Free Software   * along with this program; if not, write to the Free Software
23   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24   *   *
25   * $Id: plugin_2pass1.c,v 1.1.2.2 2003-04-08 14:01:09 suxen_drol Exp $   * $Id: plugin_2pass1.c,v 1.1.2.9 2003-11-19 15:42:38 syskin Exp $
26   *   *
27   *****************************************************************************/   *****************************************************************************/
28    
# Line 36  Line 36 
36  typedef struct  typedef struct
37  {  {
38          FILE * stat_file;          FILE * stat_file;
39    
40        double fq_error;
41  } rc_2pass1_t;  } rc_2pass1_t;
42    
43    
# Line 46  Line 48 
48          rc_2pass1_t * rc;          rc_2pass1_t * rc;
49    
50      /* check filename */      /* check filename */
51      if (param->filename == NULL || param->filename[0] == '\0')      if ((param->filename == NULL) ||
52                    (param->filename != NULL && param->filename[0] == '\0'))
53          return XVID_ERR_FAIL;          return XVID_ERR_FAIL;
54    
55      /* allocate context struct */      /* allocate context struct */
# Line 57  Line 60 
60      rc->stat_file = NULL;      rc->stat_file = NULL;
61    
62          /* Open the 1st pass file */          /* Open the 1st pass file */
63          if((rc->stat_file = fopen(param->filename, "w+")) == NULL)          if((rc->stat_file = fopen(param->filename, "w+b")) == NULL)
64                  return(XVID_ERR_FAIL);                  return(XVID_ERR_FAIL);
65    
66          /*          /*
67           * The File Header           * The File Header
68           */           */
69          /* fprintf(rc->stat_file, "# XviD 2pass stat file\n");          fprintf(rc->stat_file, "# XviD 2pass stat file (core version %d.%d.%d)\n",
70      fprintf(rc->stat_file, "version %i.%i.%i\n",XVID_MAJOR(XVID_VERSION), XVID_MINOR(XVID_VERSION), XVID_PATCH(XVID_VERSION));                          XVID_VERSION_MAJOR(XVID_VERSION),
71          fprintf(rc->stat_file, "start\n");                          XVID_VERSION_MINOR(XVID_VERSION),
72      fprintf(rc->stat_file, "type quantizer length kblocks mblocks ublocks\n");  */                          XVID_VERSION_PATCH(XVID_VERSION));
73            fprintf(rc->stat_file, "# Please do not modify this file\n\n");
74    
75        rc->fq_error = 0;
76    
77      *handle = rc;      *handle = rc;
78          return(0);          return(0);
# Line 75  Line 81 
81    
82  static int rc_2pass1_destroy(rc_2pass1_t * rc, xvid_plg_destroy_t * destroy)  static int rc_2pass1_destroy(rc_2pass1_t * rc, xvid_plg_destroy_t * destroy)
83  {  {
     //fprintf(rc->stat_file, "stop\n");  
84          fclose(rc->stat_file);          fclose(rc->stat_file);
   
85          free(rc);          free(rc);
86          return(0);          return(0);
87  }  }
# Line 85  Line 89 
89    
90  static int rc_2pass1_before(rc_2pass1_t * rc, xvid_plg_data_t * data)  static int rc_2pass1_before(rc_2pass1_t * rc, xvid_plg_data_t * data)
91  {  {
92         if (data->quant <= 0) {
93            if (data->zone && data->zone->mode == XVID_ZONE_QUANT) {
94                rc->fq_error += (double)data->zone->increment / (double)data->zone->base;
95                data->quant = (int)rc->fq_error;
96                rc->fq_error -= data->quant;
97    
98            }else {
99      data->quant = 2;      data->quant = 2;
100      data->type = XVID_TYPE_AUTO;          }
101        }
102      return 0;      return 0;
103  }  }
104    
# Line 133  Line 145 
145      switch(opt)      switch(opt)
146      {      {
147      case XVID_PLG_INFO :      case XVID_PLG_INFO :
148            case XVID_PLG_FRAME :
149          return 0;          return 0;
150    
151      case XVID_PLG_CREATE :      case XVID_PLG_CREATE :

Legend:
Removed from v.977  
changed lines
  Added in v.1216

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