[x264-devel] PATCH: --frames <maxframes to encode>

Tuukka Toivonen tuukkat at ee.oulu.fi
Wed Dec 22 15:29:01 CET 2004


diff -PruN x264-orig/common/common.c x264/common/common.c
--- x264-orig/common/common.c	2004-12-22 14:40:45.000000000 +0200
+++ x264/common/common.c	2004-12-22 16:19:23.000000000 +0200
@@ -42,6 +42,7 @@
  {
      /* */
      memset( param, 0, sizeof( x264_param_t ) );
+    param->i_maxframes = 0;

      /* CPU autodetect */
      param->cpu = x264_cpu_detect();
diff -PruN x264-orig/x264.c x264/x264.c
--- x264-orig/x264.c	2004-12-22 14:40:44.000000000 +0200
+++ x264/x264.c	2004-12-22 16:22:12.000000000 +0200
@@ -138,6 +138,7 @@
               "      --subme <integer>       Subpixel motion estimation quality\n"
               "\n"
               "  -s, --sar width:height      Specify Sample Aspect Ratio\n"
+             "      --frames <integer>      Maximum number of frames to encode\n"
               "  -o, --output                Specify output file\n"
               "\n"
               "      --no-asm                Disable any CPU optims\n"
@@ -184,6 +185,7 @@
  #define OPT_SCENECUT 270
  #define OPT_QBLUR 271
  #define OPT_CPLXBLUR 272
+#define OPT_FRAMES 273

          static struct option long_options[] =
          {
@@ -203,6 +205,7 @@
              { "ref",     required_argument, NULL, 'r' },
              { "no-asm",  no_argument,       NULL, 'C' },
              { "sar",     required_argument, NULL, 's' },
+            { "frames",  required_argument, NULL, OPT_FRAMES },
              { "output",  required_argument, NULL, 'o' },
              { "analyse", required_argument, NULL, 'A' },
              { "subme",   required_argument, NULL, OPT_SUBME },
@@ -293,6 +296,9 @@
              case 'C':
                  param->cpu = 0;
                  break;
+            case OPT_FRAMES:
+                param->i_maxframes = atoi( optarg );
+                break;
              case'o':
                  if( ( *p_fout = fopen( optarg, "wb" ) ) == NULL )
                  {
@@ -620,6 +626,9 @@

          int         i;

+        if (param->i_maxframes!=0 && i_frame>=param->i_maxframes)
+            break;
+
          /* read a frame */
          if( fread( pic.img.plane[0], 1, param->i_width * param->i_height, fyuv ) <= 0 ||
              fread( pic.img.plane[1], 1, param->i_width * param->i_height / 4, fyuv ) <= 0 ||
diff -PruN x264-orig/x264.h x264/x264.h
--- x264-orig/x264.h	2004-12-22 14:40:45.000000000 +0200
+++ x264/x264.h	2004-12-22 16:17:54.000000000 +0200
@@ -104,6 +104,7 @@

      int         i_fps_num;
      int         i_fps_den;
+    int         i_maxframes;        /* Maximum number of frames to read from input file and encode, 0=unlimited */

      /* Bitstream parameters */
      int         i_frame_reference;  /* Maximum number of reference frames */

-- 
This is the x264-devel mailing-list
To unsubscribe, go to: http://developers.videolan.org/lists.html



More information about the x264-devel mailing list