[svn] / branches / dev-api-4 / xvidcore / examples / xvid_encraw.c Repository:
ViewVC logotype

Diff of /branches/dev-api-4/xvidcore/examples/xvid_encraw.c

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

revision 937, Sat Mar 22 14:04:48 2003 UTC revision 938, Sun Mar 23 04:03:01 2003 UTC
# Line 19  Line 19 
19   *  along with this program; if not, write to the Free Software   *  along with this program; if not, write to the Free Software
20   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21   *   *
22   * $Id: xvid_encraw.c,v 1.11.2.10 2003-03-20 17:59:07 edgomez Exp $   * $Id: xvid_encraw.c,v 1.11.2.11 2003-03-23 04:01:32 suxen_drol Exp $
23   *   *
24   ****************************************************************************/   ****************************************************************************/
25    
# Line 88  Line 88 
88  static int ARG_STATS = 0;  static int ARG_STATS = 0;
89  static int ARG_DUMP = 0;  static int ARG_DUMP = 0;
90  static int ARG_LUMIMASKING = 0;  static int ARG_LUMIMASKING = 0;
91  static int ARG_BITRATE = 900;  static int ARG_BITRATE = 0;
92    static char * ARG_PASS1 = 0;
93  static int ARG_QUANTI = 0;  static int ARG_QUANTI = 0;
94  static int ARG_QUALITY = 5;  static int ARG_QUALITY = 5;
95  static float ARG_FRAMERATE = 25.00f;  static float ARG_FRAMERATE = 25.00f;
# Line 206  Line 207 
207                  } else if (strcmp("-bitrate", argv[i]) == 0 && i < argc - 1) {                  } else if (strcmp("-bitrate", argv[i]) == 0 && i < argc - 1) {
208                          i++;                          i++;
209                          ARG_BITRATE = atoi(argv[i]);                          ARG_BITRATE = atoi(argv[i]);
210                    } else if (strcmp("-pass1", argv[i]) == 0 && i < argc - 1) {
211                            i++;
212                            ARG_PASS1 = argv[i];
213                  } else if (strcmp("-max_bframes", argv[i]) == 0 && i < argc - 1) {                  } else if (strcmp("-max_bframes", argv[i]) == 0 && i < argc - 1) {
214                          i++;                          i++;
215                          ARG_MAXBFRAMES = atoi(argv[i]);                          ARG_MAXBFRAMES = atoi(argv[i]);
# Line 273  Line 277 
277                  return (-1);                  return (-1);
278          }          }
279    
         if (ARG_BITRATE <= 0 && ARG_QUANTI == 0) {  
                 fprintf(stderr, "Wrong Bitrate\n");  
                 return (-1);  
         }  
   
280          if (ARG_FRAMERATE <= 0) {          if (ARG_FRAMERATE <= 0) {
281                  fprintf(stderr, "Wrong Framerate %s \n", argv[5]);                  fprintf(stderr, "Wrong Framerate %s \n", argv[5]);
282                  return (-1);                  return (-1);
# Line 385  Line 384 
384    
385                  /* Write the Frame statistics */                  /* Write the Frame statistics */
386    
387                  printf("%5d: key=%i, time(ms)=%6.1f, length=%7d",                  printf("%5d: key=%i, time=%6.0f, length=%7d",
388                             !result ? input_num : -1,                             !result ? input_num : -1,
389                             key,                             key,
390                             (float) enctime,                             (float) enctime,
# Line 567  Line 566 
566          fprintf(stderr, " -bquant_ratio  integer: bframe quantizer ratio (default=150)\n");          fprintf(stderr, " -bquant_ratio  integer: bframe quantizer ratio (default=150)\n");
567          fprintf(stderr, " -bquant_offset integer: bframe quantizer offset (default=100)\n");          fprintf(stderr, " -bquant_offset integer: bframe quantizer offset (default=100)\n");
568          fprintf(stderr, " -framerate     float  : target framerate (>0)\n");          fprintf(stderr, " -framerate     float  : target framerate (>0)\n");
569        fprintf(stderr,     " -pass1         string: fisrt pass stats file\n");
570          fprintf(stderr, "\n");          fprintf(stderr, "\n");
571          fprintf(stderr, "Other options\n");          fprintf(stderr, "Other options\n");
572          fprintf(stderr, " -asm            : use assembly optmized code\n");          fprintf(stderr, " -asm            : use assembly optmized code\n");
# Line 703  Line 703 
703    
704  #define FRAMERATE_INCR 1001  #define FRAMERATE_INCR 1001
705    
706    
707  /* Initialize encoder for first use, pass all needed parameters to the codec */  /* Initialize encoder for first use, pass all needed parameters to the codec */
708  static int  static int
709  enc_init(int use_assembler)  enc_init(int use_assembler)
710  {  {
711          int xerr;          int xerr;
712        xvid_plugin_cbr_t cbr;
713          xvid_enc_plugin_t plugins[3];      xvid_plugin_2pass1_t rc2pass1;
714        xvid_enc_plugin_t plugins[5];
715          xvid_gbl_init_t xvid_gbl_init;          xvid_gbl_init_t xvid_gbl_init;
716          xvid_enc_create_t xvid_enc_create;          xvid_enc_create_t xvid_enc_create;
717    
# Line 755  Line 756 
756          xvid_enc_create.plugins = plugins;          xvid_enc_create.plugins = plugins;
757          xvid_enc_create.num_plugins = 0;          xvid_enc_create.num_plugins = 0;
758    
759        if (ARG_BITRATE) {
760            cbr.version = XVID_VERSION;
761            memset(&cbr, 0, sizeof(xvid_plugin_cbr_t));
762            cbr.bitrate = ARG_BITRATE;
763    
764            plugins[xvid_enc_create.num_plugins].func = xvid_plugin_cbr;
765                    plugins[xvid_enc_create.num_plugins].param = &cbr;
766                    xvid_enc_create.num_plugins++;
767        }
768    
769        if (ARG_PASS1) {
770            rc2pass1.version = XVID_VERSION;
771            memset(&rc2pass1, 0, sizeof(xvid_plugin_2pass1_t));
772            rc2pass1.filename = ARG_PASS1;
773    
774            plugins[xvid_enc_create.num_plugins].func = xvid_plugin_2pass1;
775                    plugins[xvid_enc_create.num_plugins].param = &rc2pass1;
776                    xvid_enc_create.num_plugins++;
777        }
778    
779          if (ARG_LUMIMASKING) {          if (ARG_LUMIMASKING) {
780                  plugins[xvid_enc_create.num_plugins].func = xvid_plugin_lumimasking;                  plugins[xvid_enc_create.num_plugins].func = xvid_plugin_lumimasking;
781                  plugins[xvid_enc_create.num_plugins].param = NULL;                  plugins[xvid_enc_create.num_plugins].param = NULL;

Legend:
Removed from v.937  
changed lines
  Added in v.938

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