[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 1019, Wed May 14 11:53:16 2003 UTC revision 1034, Sun May 18 12:24:55 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.22 2003-05-14 11:53:16 suxen_drol Exp $   * $Id: xvid_encraw.c,v 1.11.2.26 2003-05-18 12:24:55 edgomez Exp $
23   *   *
24   ****************************************************************************/   ****************************************************************************/
25    
# Line 87  Line 87 
87          0,          0,
88    
89          /* quality 1 */          /* quality 1 */
90          XVID_VOP_DYNAMIC_BFRAMES,          0,
91    
92          /* quality 2 */          /* quality 2 */
93          XVID_VOP_DYNAMIC_BFRAMES | XVID_VOP_HALFPEL,          XVID_VOP_HALFPEL,
94    
95          /* quality 3 */          /* quality 3 */
96          XVID_VOP_DYNAMIC_BFRAMES | XVID_VOP_HALFPEL |          XVID_VOP_HALFPEL | XVID_VOP_INTER4V,
         XVID_VOP_INTER4V,  
97    
98          /* quality 4 */          /* quality 4 */
99          XVID_VOP_DYNAMIC_BFRAMES | XVID_VOP_HALFPEL |          XVID_VOP_HALFPEL | XVID_VOP_INTER4V,
         XVID_VOP_INTER4V,  
100    
101          /* quality 5 */          /* quality 5 */
102          XVID_VOP_DYNAMIC_BFRAMES | XVID_VOP_HALFPEL |          XVID_VOP_HALFPEL | XVID_VOP_INTER4V |
103          XVID_VOP_INTER4V | XVID_VOP_TRELLISQUANT,          XVID_VOP_TRELLISQUANT,
104    
105          /* quality 6 */          /* quality 6 */
106          XVID_VOP_DYNAMIC_BFRAMES | XVID_VOP_HALFPEL |          XVID_VOP_HALFPEL | XVID_VOP_INTER4V |
107          XVID_VOP_INTER4V | XVID_VOP_TRELLISQUANT |          XVID_VOP_TRELLISQUANT | XVID_VOP_HQACPRED,
         XVID_VOP_HQACPRED,  
108    
109  };  };
110  #define VOP_ELEMENTS (sizeof(vop_presets)/sizeof(vop_presets[0]))  #define VOP_ELEMENTS (sizeof(vop_presets)/sizeof(vop_presets[0]))
# Line 131  Line 128 
128  static int ARG_SINGLE = 0;  static int ARG_SINGLE = 0;
129  static char *ARG_PASS1 = 0;  static char *ARG_PASS1 = 0;
130  static char *ARG_PASS2 = 0;  static char *ARG_PASS2 = 0;
131  static int ARG_QUALITY = 3;  static int ARG_QUALITY = ME_ELEMENTS - 1;
132  static float ARG_FRAMERATE = 25.00f;  static float ARG_FRAMERATE = 25.00f;
133  static int ARG_MAXFRAMENR = ABS_MAXFRAMENR;  static int ARG_MAXFRAMENR = ABS_MAXFRAMENR;
134    static int ARG_MAXKEYINTERVAL = 0;
135  static char *ARG_INPUTFILE = NULL;  static char *ARG_INPUTFILE = NULL;
136  static int ARG_INPUTTYPE = 0;  static int ARG_INPUTTYPE = 0;
137  static int ARG_SAVEMPEGSTREAM = 0;  static int ARG_SAVEMPEGSTREAM = 0;
# Line 145  Line 143 
143  static int ARG_MAXBFRAMES = 0;  static int ARG_MAXBFRAMES = 0;
144  static int ARG_PACKED = 0;  static int ARG_PACKED = 0;
145  static int ARG_DEBUG = 0;  static int ARG_DEBUG = 0;
146    static int ARG_VOPDEBUG = 0;
147    
148  #define IMAGE_SIZE(x,y) ((x)*(y)*3/2)  #define IMAGE_SIZE(x,y) ((x)*(y)*3/2)
149    
# Line 294  Line 293 
293                  } else if (strcmp("-framerate", argv[i]) == 0 && i < argc - 1) {                  } else if (strcmp("-framerate", argv[i]) == 0 && i < argc - 1) {
294                          i++;                          i++;
295                          ARG_FRAMERATE = (float) atof(argv[i]);                          ARG_FRAMERATE = (float) atof(argv[i]);
296                    } else if (strcmp("-max_key_interval", argv[i]) == 0 && i < argc - 1) {
297                            i++;
298                            ARG_MAXKEYINTERVAL = atoi(argv[i]);
299                  } else if (strcmp("-i", argv[i]) == 0 && i < argc - 1) {                  } else if (strcmp("-i", argv[i]) == 0 && i < argc - 1) {
300                          i++;                          i++;
301                          ARG_INPUTFILE = argv[i];                          ARG_INPUTFILE = argv[i];
# Line 312  Line 314 
314                  } else if (strcmp("-save", argv[i]) == 0) {                  } else if (strcmp("-save", argv[i]) == 0) {
315                          ARG_SAVEMPEGSTREAM = 1;                          ARG_SAVEMPEGSTREAM = 1;
316                  } else if (strcmp("-debug", argv[i]) == 0) {                  } else if (strcmp("-debug", argv[i]) == 0) {
317                          ARG_DEBUG = 1;                          i++;
318                if (sscanf(argv[i],"0x%x", &ARG_DEBUG) || sscanf(argv[i],"%d", &ARG_DEBUG)) ;
319                  } else if (strcmp("-o", argv[i]) == 0 && i < argc - 1) {                  } else if (strcmp("-o", argv[i]) == 0 && i < argc - 1) {
320                          i++;                          i++;
321                          ARG_OUTPUTFILE = argv[i];                          ARG_OUTPUTFILE = argv[i];
322                    } else if (strcmp("-vop_debug", argv[i]) == 0) {
323                            ARG_VOPDEBUG = 1;
324                  } else if (strcmp("-help", argv[i])) {                  } else if (strcmp("-help", argv[i])) {
325                          usage();                          usage();
326                          return (0);                          return (0);
# Line 449  Line 454 
454    
455                  /* Write the Frame statistics */                  /* Write the Frame statistics */
456    
457                  printf("%5d: key=%i, time= %6.0f, length= %7d", !result ? input_num : -1,                  printf("%5d: key=%i, time= %6.0f, len= %7d", !result ? input_num : -1,
458                             key, (float) enctime, (int) m4v_size);                             key, (float) enctime, (int) m4v_size);
459    
460                  if (stats_type > 0) {   /* !XVID_TYPE_NOTHING */                  if (stats_type > 0) {   /* !XVID_TYPE_NOTHING */
# Line 472  Line 477 
477                                  break;                                  break;
478                          }                          }
479    
480                          printf(" | type=%s, quant= %2d, length= %7d", type, stats_quant,                          printf(" | type=%s, quant= %2d, len= %7d", type, stats_quant,
481                                     stats_length);                                     stats_length);
482    
483  #define SSE2PSNR(sse, width, height) ((!(sse))?0.0f : 48.131f - 10*(float)log10((float)(sse)/((float)((width)*(height)))))  #define SSE2PSNR(sse, width, height) ((!(sse))?0.0f : 48.131f - 10*(float)log10((float)(sse)/((float)((width)*(height)))))
# Line 643  Line 648 
648      fprintf(stderr,     " -single                        : single pass mode\n");      fprintf(stderr,     " -single                        : single pass mode\n");
649          fprintf(stderr, " -pass1     filename            : twopass mode (first pass)\n");          fprintf(stderr, " -pass1     filename            : twopass mode (first pass)\n");
650          fprintf(stderr, " -pass2     filename            : twopass mode (2nd pass)\n");          fprintf(stderr, " -pass2     filename            : twopass mode (2nd pass)\n");
651      fprintf(stderr,     " -zq frame float               : bitrate zone; quant\n");          fprintf(stderr, " -zq starting_frame float       : bitrate zone; quant\n");
652      fprintf(stderr,     " -zw frame float               : bitrate zone; weight\n");          fprintf(stderr, " -zw starting_frame float       : bitrate zone; weight\n");
653        fprintf(stderr, " -max_key_interval integer      : maximum keyframe interval\n");
654          fprintf(stderr, "\n");          fprintf(stderr, "\n");
655          fprintf(stderr, "Other options\n");          fprintf(stderr, "Other options\n");
656          fprintf(stderr, " -asm            : use assembly optmized code\n");          fprintf(stderr, " -asm            : use assembly optmized code\n");
# Line 652  Line 658 
658          fprintf(stderr, " -packed         : packed mode\n");          fprintf(stderr, " -packed         : packed mode\n");
659          fprintf(stderr, " -lumimasking    : use lumimasking algorithm\n");          fprintf(stderr, " -lumimasking    : use lumimasking algorithm\n");
660          fprintf(stderr, " -stats          : print stats about encoded frames\n");          fprintf(stderr, " -stats          : print stats about encoded frames\n");
661          fprintf(stderr, " -debug          : print all MB dquants\n");          fprintf(stderr, " -debug          : activates xvidcore internal debugging output\n");
662            fprintf(stderr, " -vop_debug      : print some info directly into encoded frames\n");
663          fprintf(stderr, " -help           : prints this help message\n");          fprintf(stderr, " -help           : prints this help message\n");
664            fprintf(stderr, "\n");
665            fprintf(stderr, "NB: You can define %d zones repeating the -z[qw] option as many times as needed.\n", MAX_ZONES);
666            fprintf(stderr, "\n");
667  }  }
668    
669  /*****************************************************************************  /*****************************************************************************
# Line 803  Line 813 
813          /* Set version -- version checking will done by xvidcore */          /* Set version -- version checking will done by xvidcore */
814          memset(&xvid_gbl_init, 0, sizeof(xvid_gbl_init));          memset(&xvid_gbl_init, 0, sizeof(xvid_gbl_init));
815          xvid_gbl_init.version = XVID_VERSION;          xvid_gbl_init.version = XVID_VERSION;
816        xvid_gbl_init.debug = ARG_DEBUG;
817    
818    
819          /* Do we have to enable ASM optimizations ? */          /* Do we have to enable ASM optimizations ? */
# Line 882  Line 893 
893                  xvid_enc_create.num_plugins++;                  xvid_enc_create.num_plugins++;
894          }          }
895    
896    #if 0
897          if (ARG_DEBUG) {          if (ARG_DEBUG) {
898                  plugins[xvid_enc_create.num_plugins].func = rawenc_debug;                  plugins[xvid_enc_create.num_plugins].func = rawenc_debug;
899                  plugins[xvid_enc_create.num_plugins].param = NULL;                  plugins[xvid_enc_create.num_plugins].param = NULL;
900                  xvid_enc_create.num_plugins++;                  xvid_enc_create.num_plugins++;
901          }          }
902    #endif
903    
904          /* No fancy thread tests */          /* No fancy thread tests */
905          xvid_enc_create.num_threads = 0;          xvid_enc_create.num_threads = 0;
# Line 901  Line 914 
914          }          }
915    
916          /* Maximum key frame interval */          /* Maximum key frame interval */
917        if (ARG_MAXKEYINTERVAL > 0) {
918            xvid_enc_create.max_key_interval = ARG_MAXKEYINTERVAL;
919        }else {
920          xvid_enc_create.max_key_interval = (int) ARG_FRAMERATE *10;          xvid_enc_create.max_key_interval = (int) ARG_FRAMERATE *10;
921        }
922    
923          /* Bframes settings */          /* Bframes settings */
924          xvid_enc_create.max_bframes = ARG_MAXBFRAMES;          xvid_enc_create.max_bframes = ARG_MAXBFRAMES;
# Line 981  Line 998 
998    
999          /* Set up core's general features */          /* Set up core's general features */
1000          xvid_enc_frame.vop_flags = vop_presets[ARG_QUALITY];          xvid_enc_frame.vop_flags = vop_presets[ARG_QUALITY];
1001        if (ARG_VOPDEBUG) {
1002            xvid_enc_frame.vop_flags |= XVID_VOP_DEBUG;
1003        }
1004    
1005          /* Frame type -- let core decide for us */          /* Frame type -- let core decide for us */
1006          xvid_enc_frame.type = XVID_TYPE_AUTO;          xvid_enc_frame.type = XVID_TYPE_AUTO;

Legend:
Removed from v.1019  
changed lines
  Added in v.1034

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