[svn] / trunk / xvidcore / examples / xvid_encraw.c Repository:
ViewVC logotype

Diff of /trunk/xvidcore/examples/xvid_encraw.c

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

revision 1382, Mon Mar 22 22:36:25 2004 UTC revision 1627, Mon Aug 1 10:53:46 2005 UTC
# Line 21  Line 21 
21   *  along with this program; if not, write to the Free Software   *  along with this program; if not, write to the Free Software
22   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
23   *   *
24   * $Id: xvid_encraw.c,v 1.13 2004-03-22 22:36:23 edgomez Exp $   * $Id: xvid_encraw.c,v 1.20 2005-08-01 10:53:46 Isibaar Exp $
25   *   *
26   ****************************************************************************/   ****************************************************************************/
27    
# Line 151  Line 151 
151  static int ARG_PACKED = 0;  static int ARG_PACKED = 0;
152  static int ARG_DEBUG = 0;  static int ARG_DEBUG = 0;
153  static int ARG_VOPDEBUG = 0;  static int ARG_VOPDEBUG = 0;
154    static int ARG_GREYSCALE = 0;
155  static int ARG_GMC = 0;  static int ARG_GMC = 0;
156    static int ARG_INTERLACING = 0;
157  static int ARG_QPEL = 0;  static int ARG_QPEL = 0;
158    static int ARG_VHQMODE = 0;
159  static int ARG_CLOSED_GOP = 0;  static int ARG_CLOSED_GOP = 0;
160    
161  #ifndef READ_PNM  #ifndef READ_PNM
# Line 237  Line 240 
240          int stats_type;          int stats_type;
241          int stats_quant;          int stats_quant;
242          int stats_length;          int stats_length;
243          int use_assembler = 0;          int use_assembler = 1;
244    
245          int input_num;          int input_num;
246          int output_num;          int output_num;
# Line 264  Line 267 
267    
268                  if (strcmp("-asm", argv[i]) == 0) {                  if (strcmp("-asm", argv[i]) == 0) {
269                          use_assembler = 1;                          use_assembler = 1;
270                    } else if (strcmp("-noasm", argv[i]) == 0) {
271                            use_assembler = 0;
272                  } else if (strcmp("-w", argv[i]) == 0 && i < argc - 1) {                  } else if (strcmp("-w", argv[i]) == 0 && i < argc - 1) {
273                          i++;                          i++;
274                          XDIM = atoi(argv[i]);                          XDIM = atoi(argv[i]);
# Line 310  Line 315 
315                  } else if (strcmp("-quality", argv[i]) == 0 && i < argc - 1) {                  } else if (strcmp("-quality", argv[i]) == 0 && i < argc - 1) {
316                          i++;                          i++;
317                          ARG_QUALITY = atoi(argv[i]);                          ARG_QUALITY = atoi(argv[i]);
318                    } else if (strcmp("-vhqmode", argv[i]) == 0 && i < argc - 1) {
319                            i++;
320                            ARG_VHQMODE = atoi(argv[i]);
321                  } else if (strcmp("-framerate", argv[i]) == 0 && i < argc - 1) {                  } else if (strcmp("-framerate", argv[i]) == 0 && i < argc - 1) {
322                          i++;                          i++;
323                          ARG_FRAMERATE = (float) atof(argv[i]);                          ARG_FRAMERATE = (float) atof(argv[i]);
# Line 343  Line 351 
351                          ARG_OUTPUTFILE = argv[i];                          ARG_OUTPUTFILE = argv[i];
352                  } else if (strcmp("-vop_debug", argv[i]) == 0) {                  } else if (strcmp("-vop_debug", argv[i]) == 0) {
353                          ARG_VOPDEBUG = 1;                          ARG_VOPDEBUG = 1;
354                    } else if (strcmp("-grey", argv[i]) == 0) {
355                            ARG_GREYSCALE = 1;
356                  } else if (strcmp("-qpel", argv[i]) == 0) {                  } else if (strcmp("-qpel", argv[i]) == 0) {
357                          ARG_QPEL = 1;                          ARG_QPEL = 1;
358                  } else if (strcmp("-gmc", argv[i]) == 0) {                  } else if (strcmp("-gmc", argv[i]) == 0) {
359                          ARG_GMC = 1;                          ARG_GMC = 1;
360                    } else if (strcmp("-interlaced", argv[i]) == 0) {
361                            ARG_INTERLACING = 1;
362                  } else if (strcmp("-closed_gop", argv[i]) == 0) {                  } else if (strcmp("-closed_gop", argv[i]) == 0) {
363                          ARG_CLOSED_GOP = 1;                          ARG_CLOSED_GOP = 1;
364                  } else if (strcmp("-help", argv[i])) {                  } else if (strcmp("-help", argv[i])) {
# Line 693  Line 705 
705      fprintf(stderr, "\n");      fprintf(stderr, "\n");
706          fprintf(stderr, "Other options\n");          fprintf(stderr, "Other options\n");
707          fprintf(stderr, " -asm            : use assembly optmized code\n");          fprintf(stderr, " -asm            : use assembly optmized code\n");
708            fprintf(stderr, " -noasm            : do not use assembly optmized code\n");
709          fprintf(stderr, " -quality integer: quality ([0..%d])\n", ME_ELEMENTS - 1);          fprintf(stderr, " -quality integer: quality ([0..%d])\n", ME_ELEMENTS - 1);
710            fprintf(stderr, " -vhqmode integer: level of Rate-Distorsion optimizations ([0..4]) (default=0)\n");
711          fprintf(stderr, " -qpel           : use quarter pixel ME\n");          fprintf(stderr, " -qpel           : use quarter pixel ME\n");
712          fprintf(stderr, " -gmc            : use global motion compensation\n");          fprintf(stderr, " -gmc            : use global motion compensation\n");
713            fprintf(stderr, " -interlaced     : use interlaced encoding (this is NOT a deinterlacer!)\n");
714          fprintf(stderr, " -packed         : packed mode\n");          fprintf(stderr, " -packed         : packed mode\n");
715          fprintf(stderr, " -closed_gop     : closed GOP mode\n");          fprintf(stderr, " -closed_gop     : closed GOP mode\n");
716            fprintf(stderr, " -grey           : grey scale coding (chroma is discarded)\n");
717          fprintf(stderr, " -lumimasking    : use lumimasking algorithm\n");          fprintf(stderr, " -lumimasking    : use lumimasking algorithm\n");
718          fprintf(stderr, " -stats          : print stats about encoded frames\n");          fprintf(stderr, " -stats          : print stats about encoded frames\n");
719          fprintf(stderr, " -debug          : activates xvidcore internal debugging output\n");          fprintf(stderr, " -debug          : activates xvidcore internal debugging output\n");
# Line 729  Line 745 
745                  return (1);                  return (1);
746    
747          fscanf(handle, "%d %d %d", &xsize, &ysize, &depth);          fscanf(handle, "%d %d %d", &xsize, &ysize, &depth);
748          if ((xsize > 1440) || (ysize > 2880) || (depth != 255)) {          if ((xsize > 4096) || (ysize > 4096*3/2) || (depth != 255)) {
749                  fprintf(stderr, "%d %d %d\n", xsize, ysize, depth);                  fprintf(stderr, "%d %d %d\n", xsize, ysize, depth);
750                  return (2);                  return (2);
751          }          }
# Line 950  Line 966 
966                  rc2pass2.filename = ARG_PASS2;                  rc2pass2.filename = ARG_PASS2;
967                  rc2pass2.bitrate = ARG_BITRATE;                  rc2pass2.bitrate = ARG_BITRATE;
968    
969    /*              An example of activating VBV could look like this
970                    rc2pass2.vbv_size     =  3145728;
971                    rc2pass2.vbv_initial  =  2359296;
972                    rc2pass2.vbv_maxrate  =  4000000;
973                    rc2pass2.vbv_peakrate = 10000000;
974    */
975    
976                  plugins[xvid_enc_create.num_plugins].func = xvid_plugin_2pass2;                  plugins[xvid_enc_create.num_plugins].func = xvid_plugin_2pass2;
977                  plugins[xvid_enc_create.num_plugins].param = &rc2pass2;                  plugins[xvid_enc_create.num_plugins].param = &rc2pass2;
978                  xvid_enc_create.num_plugins++;                  xvid_enc_create.num_plugins++;
# Line 1091  Line 1114 
1114                  xvid_enc_frame.vol_flags |= XVID_VOL_QUARTERPEL;                  xvid_enc_frame.vol_flags |= XVID_VOL_QUARTERPEL;
1115          if (ARG_GMC)          if (ARG_GMC)
1116                  xvid_enc_frame.vol_flags |= XVID_VOL_GMC;                  xvid_enc_frame.vol_flags |= XVID_VOL_GMC;
1117            if (ARG_INTERLACING)
1118                    xvid_enc_frame.vol_flags |= XVID_VOL_INTERLACING;
1119    
1120          /* Set up core's general features */          /* Set up core's general features */
1121          xvid_enc_frame.vop_flags = vop_presets[ARG_QUALITY];          xvid_enc_frame.vop_flags = vop_presets[ARG_QUALITY];
# Line 1099  Line 1124 
1124          xvid_enc_frame.vop_flags |= XVID_VOP_DEBUG;          xvid_enc_frame.vop_flags |= XVID_VOP_DEBUG;
1125      }      }
1126    
1127        if (ARG_GREYSCALE) {
1128            xvid_enc_frame.vop_flags |= XVID_VOP_GREYSCALE;
1129        }
1130    
1131          /* Frame type -- let core decide for us */          /* Frame type -- let core decide for us */
1132          xvid_enc_frame.type = XVID_TYPE_AUTO;          xvid_enc_frame.type = XVID_TYPE_AUTO;
1133    
# Line 1116  Line 1145 
1145          if (ARG_QPEL && (xvid_enc_frame.vop_flags & XVID_VOP_INTER4V))          if (ARG_QPEL && (xvid_enc_frame.vop_flags & XVID_VOP_INTER4V))
1146                  xvid_enc_frame.motion |= XVID_ME_QUARTERPELREFINE8;                  xvid_enc_frame.motion |= XVID_ME_QUARTERPELREFINE8;
1147    
1148            switch (ARG_VHQMODE) /* this is the same code as for vfw */
1149            {
1150            case 1: /* VHQ_MODE_DECISION */
1151                    xvid_enc_frame.vop_flags |= XVID_VOP_MODEDECISION_RD;
1152                    break;
1153    
1154            case 2: /* VHQ_LIMITED_SEARCH */
1155                    xvid_enc_frame.vop_flags |= XVID_VOP_MODEDECISION_RD;
1156                    xvid_enc_frame.motion |= XVID_ME_HALFPELREFINE16_RD;
1157                    xvid_enc_frame.motion |= XVID_ME_QUARTERPELREFINE16_RD;
1158                    break;
1159    
1160            case 3: /* VHQ_MEDIUM_SEARCH */
1161                    xvid_enc_frame.vop_flags |= XVID_VOP_MODEDECISION_RD;
1162                    xvid_enc_frame.motion |= XVID_ME_HALFPELREFINE16_RD;
1163                    xvid_enc_frame.motion |= XVID_ME_HALFPELREFINE8_RD;
1164                    xvid_enc_frame.motion |= XVID_ME_QUARTERPELREFINE16_RD;
1165                    xvid_enc_frame.motion |= XVID_ME_QUARTERPELREFINE8_RD;
1166                    xvid_enc_frame.motion |= XVID_ME_CHECKPREDICTION_RD;
1167                    break;
1168    
1169            case 4: /* VHQ_WIDE_SEARCH */
1170                    xvid_enc_frame.vop_flags |= XVID_VOP_MODEDECISION_RD;
1171                    xvid_enc_frame.motion |= XVID_ME_HALFPELREFINE16_RD;
1172                    xvid_enc_frame.motion |= XVID_ME_HALFPELREFINE8_RD;
1173                    xvid_enc_frame.motion |= XVID_ME_QUARTERPELREFINE16_RD;
1174                    xvid_enc_frame.motion |= XVID_ME_QUARTERPELREFINE8_RD;
1175                    xvid_enc_frame.motion |= XVID_ME_CHECKPREDICTION_RD;
1176                    xvid_enc_frame.motion |= XVID_ME_EXTSEARCH_RD;
1177                    break;
1178    
1179            default :
1180                    break;
1181            }
1182    
1183          /* We don't use special matrices */          /* We don't use special matrices */
1184          xvid_enc_frame.quant_intra_matrix = NULL;          xvid_enc_frame.quant_intra_matrix = NULL;
1185          xvid_enc_frame.quant_inter_matrix = NULL;          xvid_enc_frame.quant_inter_matrix = NULL;

Legend:
Removed from v.1382  
changed lines
  Added in v.1627

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