[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 909, Sun Mar 9 00:28:09 2003 UTC revision 926, Sun Mar 16 12:05:09 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.1 2003-03-09 00:28:09 edgomez Exp $   * $Id: xvid_encraw.c,v 1.11.2.8 2003-03-16 12:04:13 suxen_drol Exp $
23   *   *
24   ****************************************************************************/   ****************************************************************************/
25    
26  /*****************************************************************************  /*****************************************************************************
27   *  Application notes :   *  Application notes :
28   *   *
29   *  A sequence of YUV pics in PGM file format is encoded and decoded   *  A sequence of raw YUV I420 pics or YUV I420 PGM file format is encoded
30   *  The speed is measured and PSNR of decoded picture is calculated.   *  The speed is measured and frames' PSNR are taken from core.
31   *   *
32   *  The program is plain C and needs no libraries except for libxvidcore,   *  The program is plain C and needs no libraries except for libxvidcore,
33   *  and maths-lib.   *  and maths-lib.
# Line 46  Line 46 
46    
47  #include "xvid.h"  #include "xvid.h"
48    
49    
50  /*****************************************************************************  /*****************************************************************************
51   *                            Quality presets   *                            Quality presets
52   ****************************************************************************/   ****************************************************************************/
# Line 56  Line 57 
57          PMV_HALFPELREFINE16,          PMV_HALFPELREFINE16,
58          PMV_HALFPELREFINE16 | PMV_HALFPELREFINE8,          PMV_HALFPELREFINE16 | PMV_HALFPELREFINE8,
59          PMV_HALFPELREFINE16 | PMV_HALFPELREFINE8 | PMV_EXTSEARCH16 | PMV_USESQUARES16,          PMV_HALFPELREFINE16 | PMV_HALFPELREFINE8 | PMV_EXTSEARCH16 | PMV_USESQUARES16,
60          PMV_HALFPELREFINE16 | PMV_HALFPELREFINE8 | PMV_EXTSEARCH16 | PMV_USESQUARES16,          PMV_HALFPELREFINE16 | PMV_HALFPELREFINE8 | PMV_EXTSEARCH16 | PMV_USESQUARES16 | PMV_CHROMA16 | PMV_CHROMA8,
61  };  };
62    
63  static xvid_vol_t const vol_presets[] = {  static xvid_vol_t const vol_presets[] = {
# Line 84  Line 85 
85  /* Maximum number of frames to encode */  /* Maximum number of frames to encode */
86  #define ABS_MAXFRAMENR 9999  #define ABS_MAXFRAMENR 9999
87    
88    static int   ARG_STATS = 0;
89    static int   ARG_DUMP = 0;
90    static int   ARG_LUMIMASKING = 0;
91  static int   ARG_BITRATE = 900;  static int   ARG_BITRATE = 900;
92  static int   ARG_QUANTI = 0;  static int   ARG_QUANTI = 0;
93  static int   ARG_QUALITY = 5;  static int   ARG_QUALITY = 5;
# Line 100  Line 104 
104  static int   ARG_BQRATIO = 150;  static int   ARG_BQRATIO = 150;
105  static int   ARG_BQOFFSET = 100;  static int   ARG_BQOFFSET = 100;
106  static int   ARG_MAXBFRAMES = 0;  static int   ARG_MAXBFRAMES = 0;
107    static int   ARG_PACKED = 0;
108  #define IMAGE_SIZE(x,y) ((x)*(y)*3/2)  #define IMAGE_SIZE(x,y) ((x)*(y)*3/2)
109    
110  #define MAX(A,B) ( ((A)>(B)) ? (A) : (B) )  #define MAX(A,B) ( ((A)>(B)) ? (A) : (B) )
# Line 112  Line 117 
117   *                     Nasty global vars ;-)   *                     Nasty global vars ;-)
118   ***************************************************************************/   ***************************************************************************/
119    
120  static int i,filenr = 0;  static int i;
121    
122  /* the path where to save output */  /* the path where to save output */
123  static char filepath[256] = "./";  static char filepath[256] = "./";
# Line 140  Line 145 
145  static int enc_stop();  static int enc_stop();
146  static int enc_main(unsigned char* image,  static int enc_main(unsigned char* image,
147                                          unsigned char* bitstream,                                          unsigned char* bitstream,
148                                          long *frametype);                      int *key,
149                                            int *stats_type,
150                        int *stats_quant,
151                        int *stats_length,
152                                            int stats[3]);
153    
154  /*****************************************************************************  /*****************************************************************************
155   *               Main function   *               Main function
# Line 156  Line 165 
165          double enctime;          double enctime;
166          double totalenctime=0.;          double totalenctime=0.;
167    
168          long totalsize;          int totalsize;
169          int status;          int result;
170          long frame_type;          int m4v_size;
171        int key;
172          long m4v_size;          int stats_type;
173        int stats_quant;
174        int stats_length;
175          int use_assembler=0;          int use_assembler=0;
176    
177        int input_num;
178        int output_num;
179    
180          char filename[256];          char filename[256];
181    
182          FILE *in_file = stdin;          FILE *in_file = stdin;
# Line 196  Line 210 
210                          i++;                          i++;
211                          ARG_MAXBFRAMES = atoi(argv[i]);                          ARG_MAXBFRAMES = atoi(argv[i]);
212                  }                  }
213                    else if (strcmp("-p", argv[i]) == 0) {
214                ARG_PACKED = 1;
215                    }
216                  else if (strcmp("-bqr", argv[i]) == 0 && i < argc - 1 ) {                  else if (strcmp("-bqr", argv[i]) == 0 && i < argc - 1 ) {
217                          i++;                          i++;
218                          ARG_BQRATIO = atoi(argv[i]);                          ARG_BQRATIO = atoi(argv[i]);
# Line 216  Line 233 
233                          i++;                          i++;
234                          ARG_INPUTFILE = argv[i];                          ARG_INPUTFILE = argv[i];
235                  }                  }
236                    else if (strcmp("-s", argv[i]) == 0) {
237                            ARG_STATS = 1;
238                    }
239                    else if (strcmp("-dump", argv[i]) == 0) {
240                            ARG_DUMP = 1;
241                    }
242                    else if (strcmp("-lumimasking", argv[i]) == 0) {
243                            ARG_LUMIMASKING = 1;
244                    }
245                  else if (strcmp("-t", argv[i]) == 0 && i < argc - 1 ) {                  else if (strcmp("-t", argv[i]) == 0 && i < argc - 1 ) {
246                          i++;                          i++;
247                          ARG_INPUTTYPE = atoi(argv[i]);                          ARG_INPUTTYPE = atoi(argv[i]);
# Line 228  Line 254 
254                          i++;                          i++;
255                          ARG_QUANTI = atoi(argv[i]);                          ARG_QUANTI = atoi(argv[i]);
256                  }                  }
257                  else if (strcmp("-m", argv[i]) == 0 && i < argc - 1 ) {                  else if (strcmp("-m", argv[i]) == 0) {
258                          i++;                          ARG_SAVEMPEGSTREAM = 1;
                         ARG_SAVEMPEGSTREAM = atoi(argv[i]);  
259                  }                  }
260                  else if (strcmp("-o", argv[i]) == 0 && i < argc - 1 ) {                  else if (strcmp("-o", argv[i]) == 0 && i < argc - 1 ) {
261                          i++;                          i++;
# Line 310  Line 335 
335   ****************************************************************************/   ****************************************************************************/
336    
337    
338          status = enc_init(use_assembler);          result = enc_init(use_assembler);
339          if (status)          if (result)
340          {          {
341                  fprintf(stderr, "Encore INIT problem, return value %d\n", status);                  fprintf(stderr, "Encore INIT problem, return value %d\n", result);
342                  goto release_all;                  goto release_all;
343          }          }
344    
# Line 339  Line 364 
364    
365          totalsize = 0;          totalsize = 0;
366    
367        result = 0;
368    
369        input_num = 0;  /* input frame counter */
370        output_num = 0; /* output frame counter */
371    
372          do {          do {
373    
374                  if (ARG_INPUTTYPE)                  char *type;
375                          status = read_pgmdata(in_file, in_buffer);      /* read PGM data (YUV-format) */                  int stats[3];
376                  else  
377                          status = read_yuvdata(in_file, in_buffer);      /* read raw data (YUV-format) */          if (input_num >= ARG_MAXFRAMENR)
378            {
379                result = 1;
380            }
381    
382                  if (status)          if (!result)
383                  {                  {
384                          /* Couldn't read image, most likely end-of-file */                      if(ARG_INPUTTYPE) {
385                          continue;                              /* read PGM data (YUV-format) */
386                                result = read_pgmdata(in_file, in_buffer);
387                        } else {
388                                /* read raw data (YUV-format) */
389                                result = read_yuvdata(in_file, in_buffer);
390                        }
391                  }                  }
392    
393  /*****************************************************************************  /*****************************************************************************
# Line 357  Line 395 
395   ****************************************************************************/   ****************************************************************************/
396    
397                  enctime = msecond();                  enctime = msecond();
398                  m4v_size = enc_main(in_buffer, mp4_buffer, &frame_type);          m4v_size = enc_main(!result?in_buffer:0, mp4_buffer, &key, &stats_type, &stats_quant, &stats_length, stats);
399                  enctime = msecond() - enctime;                  enctime = msecond() - enctime;
400    
401                  /* Not coded frames return 0 */                  /* Write the Frame statistics */
                 if(m4v_size == 0) goto next_frame;  
402    
403                  {                  printf("%5d: key=%i, time(ms)=%6.1f, length=%7d",
404                          char *type;              !result?input_num:-1,
405                               key,
406                               (float)enctime,
407                               (int)m4v_size);
408    
409            if (stats_type > 0) {   /* !XVID_TYPE_NOTHING */
410    
411                          switch(frame_type) {                  switch(stats_type) {
412                          case XVID_TYPE_IVOP:                          case XVID_TYPE_IVOP:
413                                  type = "I";                                  type = "I";
414                                  break;                                  break;
# Line 380  Line 422 
422                                  type = "S";                                  type = "S";
423                                  break;                                  break;
424                          default:                          default:
425                                  type = "Unknown";                          type = "U";
426                                  break;                                  break;
427                          }                          }
428    
429                          printf("Frame %5d: type = %s, enctime(ms) =%6.1f, length(bytes) =%7d\n",              printf(" | type=%s quant=%2d, length=%7d", type, stats_quant, stats_length);
430                                     (int)filenr, type, (float)enctime, (int)m4v_size);  
431                 if(ARG_STATS) {
432                            printf(", psnr y = %2.2f, psnr u = %2.2f, psnr v = %2.2f",
433                                       (stats[0] == 0)? 0.0f: 48.131f - 10*(float)log10((float)stats[0]/((float)(XDIM)*(YDIM))),
434                                       (stats[1] == 0)? 0.0f: 48.131f - 10*(float)log10((float)stats[1]/((float)(XDIM)*(YDIM)/4)),
435                                       (stats[2] == 0)? 0.0f: 48.131f - 10*(float)log10((float)stats[2]/((float)(XDIM)*(YDIM)/4)));
436                 }
437    
438                    }
439    
440                    printf("\n");
441    
442            if (m4v_size < 0) {
443                break;
444                  }                  }
445    
446                  /* Update encoding time stats */                  /* Update encoding time stats */
# Line 397  Line 451 
451   *                       Save stream to file   *                       Save stream to file
452   ****************************************************************************/   ****************************************************************************/
453    
454                  if (ARG_SAVEMPEGSTREAM)                  if (m4v_size>0 && ARG_SAVEMPEGSTREAM)
455                  {                  {
456                          /* Save single files */                          /* Save single files */
457                          if (out_file == NULL) {                          if (out_file == NULL) {
458                                  sprintf(filename, "%sframe%05d.m4v", filepath, filenr);                                  sprintf(filename, "%sframe%05d.m4v", filepath, output_num);
459                                  out_file = fopen(filename, "wb");                                  out_file = fopen(filename, "wb");
460                                  fwrite(mp4_buffer, m4v_size, 1, out_file);                                  fwrite(mp4_buffer, m4v_size, 1, out_file);
461                                  fclose(out_file);                                  fclose(out_file);
462                                  out_file = NULL;                                  out_file = NULL;
463                    output_num++;
464                          }                          }
465                          else {                          else {
466    
# Line 415  Line 470 
470                          }                          }
471                  }                  }
472    
473          next_frame:                  input_num++;
                 /* Read the header if it's pgm stream */  
                 if (ARG_INPUTTYPE)  
                         status = read_pgmheader(in_file);  
474    
475                  if(frame_type != 5) filenr++;                  /* Read the header if it's pgm stream */
476            if (!result && ARG_INPUTTYPE)
477                            result = read_pgmheader(in_file);
478    
479          } while ( (!status) && (filenr<ARG_MAXFRAMENR) );          } while (1);
480    
481    
482    
# Line 430  Line 484 
484   *         Calculate totals and averages for output, print results   *         Calculate totals and averages for output, print results
485   ****************************************************************************/   ****************************************************************************/
486    
487          totalsize    /= filenr;          printf("Tot: enctime(ms) =%7.2f,               length(bytes) = %7d\n",
488          totalenctime /= filenr;                     totalenctime, (int)totalsize);
489    
490        if (input_num > 0) {
491                totalsize    /= input_num;
492                totalenctime /= input_num;
493        }else{
494            totalsize = -1;
495            totalenctime = -1;
496        }
497    
498          printf("Avg: enctime(ms) =%7.2f, fps =%7.2f, length(bytes) = %7d\n",          printf("Avg: enctime(ms) =%7.2f, fps =%7.2f, length(bytes) = %7d\n",
499                     totalenctime, 1000/totalenctime, (int)totalsize);                     totalenctime, 1000/totalenctime, (int)totalsize);
500    
501    
502  /*****************************************************************************  /*****************************************************************************
503   *                            XviD PART  Stop   *                            XviD PART  Stop
504   ****************************************************************************/   ****************************************************************************/
# Line 444  Line 507 
507    
508          if (enc_handle)          if (enc_handle)
509          {          {
510                  status = enc_stop();                  result = enc_stop();
511                  if (status)                  if (result)
512                          fprintf(stderr, "Encore RELEASE problem return value %d\n", status);                          fprintf(stderr, "Encore RELEASE problem return value %d\n", result);
513          }          }
514    
515          if(in_file)          if(in_file)
# Line 499  Line 562 
562          fprintf(stderr, " -h integer     : frame height ([1.2048])\n");          fprintf(stderr, " -h integer     : frame height ([1.2048])\n");
563          fprintf(stderr, " -b integer     : target bitrate (>0 | default=900kbit)\n");          fprintf(stderr, " -b integer     : target bitrate (>0 | default=900kbit)\n");
564          fprintf(stderr, " -bn integer    : max bframes (default=0)\n");          fprintf(stderr, " -bn integer    : max bframes (default=0)\n");
565        fprintf(stderr, " -p             : packed mode\n");
566          fprintf(stderr, " -bqr integer   : bframe quantizer ratio (default=150)\n");          fprintf(stderr, " -bqr integer   : bframe quantizer ratio (default=150)\n");
567          fprintf(stderr, " -bqo integer   : bframe quantizer offset (default=100)\n");          fprintf(stderr, " -bqo integer   : bframe quantizer offset (default=100)\n");
568          fprintf(stderr, " -f float       : target framerate (>0)\n");          fprintf(stderr, " -f float       : target framerate (>0)\n");
569          fprintf(stderr, " -i string      : input filename (default=stdin)\n");          fprintf(stderr, " -i string      : input filename (default=stdin)\n");
570            fprintf(stderr, " -s             : print stats about encoded frames\n");
571          fprintf(stderr, " -t integer     : input data type (yuv=0, pgm=1)\n");          fprintf(stderr, " -t integer     : input data type (yuv=0, pgm=1)\n");
572          fprintf(stderr, " -n integer     : number of frames to encode\n");          fprintf(stderr, " -n integer     : number of frames to encode\n");
573          fprintf(stderr, " -q integer     : quality ([0..5])\n");          fprintf(stderr, " -q integer     : quality ([0..5])\n");
574          fprintf(stderr, " -d boolean     : save decoder output (0 False*, !=0 True)\n");          fprintf(stderr, " -dump          : save decoder output\n");
575          fprintf(stderr, " -m boolean     : save mpeg4 raw stream (0 False*, !=0 True)\n");          fprintf(stderr, " -m             : save mpeg4 raw stream\n");
576          fprintf(stderr, " -o string      : output container filename (only usefull when -m 1 is used) :\n");          fprintf(stderr, " -o string      : output container filename (only usefull when -m 1 is used) :\n");
577          fprintf(stderr, "                  When this option is not used : one file per encoded frame\n");          fprintf(stderr, "                  When this option is not used : one file per encoded frame\n");
578          fprintf(stderr, "                  When this option is used : save to 'string' file\n");          fprintf(stderr, "                  When this option is used : save to 'string' file\n");
# Line 594  Line 659 
659   *     Routines for encoding: init encoder, frame step, release encoder   *     Routines for encoding: init encoder, frame step, release encoder
660   ****************************************************************************/   ****************************************************************************/
661    
662    /* sample plugin */
663    
664    int rawenc_debug(void * handle, int opt, void * param1, void * param2)
665    {
666        switch(opt)
667        {
668        case XVID_PLG_INFO :
669            {
670            xvid_plg_info_t * info = (xvid_plg_info_t*)param1;
671            info->flags = XVID_REQDQUANTS;
672            return 0;
673            }
674    
675        case XVID_PLG_CREATE :
676        case XVID_PLG_DESTROY :
677        case XVID_PLG_BEFORE :
678            return 0;
679    
680        case XVID_PLG_AFTER :
681            {
682            xvid_plg_data_t * data = (xvid_plg_data_t*)param1;
683            int i,j;
684    
685            printf("---[ frame: %5i   quant: %2i   length: %6i ]---\n", data->frame_num, data->quant, data->length);
686            for (j=0; j<data->mb_height; j++) {
687                for (i = 0; i<data->mb_width; i++)
688                    printf("%2i ",  data->dquant[j*data->dquant_stride + i]);
689                printf("\n");
690            }
691    
692            return 0;
693            }
694        }
695    
696        return XVID_ERR_FAIL;
697    }
698    
699    
700  #define FRAMERATE_INCR 1001  #define FRAMERATE_INCR 1001
701    
702  /* Initialize encoder for first use, pass all needed parameters to the codec */  /* Initialize encoder for first use, pass all needed parameters to the codec */
# Line 601  Line 704 
704  {  {
705          int xerr;          int xerr;
706    
707        xvid_enc_plugin_t plugins[2];
708    
709          xvid_gbl_init_t   xvid_gbl_init;          xvid_gbl_init_t   xvid_gbl_init;
710          xvid_enc_create_t xvid_enc_create;          xvid_enc_create_t xvid_enc_create;
711    
# Line 609  Line 714 
714           *----------------------------------------------------------------------*/           *----------------------------------------------------------------------*/
715    
716          /* Set version -- version checking will done by xvidcore*/          /* Set version -- version checking will done by xvidcore*/
717        memset(&xvid_gbl_init, 0, sizeof(xvid_gbl_init));
718          xvid_gbl_init.version = XVID_VERSION;          xvid_gbl_init.version = XVID_VERSION;
719    
720    
721          /* Do we have to enable ASM optimizations ? */          /* Do we have to enable ASM optimizations ? */
722          if(use_assembler) {          if(use_assembler) {
723    
# Line 632  Line 739 
739           *----------------------------------------------------------------------*/           *----------------------------------------------------------------------*/
740    
741          /* Version again */          /* Version again */
742        memset(&xvid_enc_create, 0, sizeof(xvid_enc_create));
743          xvid_enc_create.version = XVID_VERSION;          xvid_enc_create.version = XVID_VERSION;
744    
745          /* Width and Height of input frames */          /* Width and Height of input frames */
746          xvid_enc_create.width = XDIM;          xvid_enc_create.width = XDIM;
747          xvid_enc_create.height = YDIM;          xvid_enc_create.height = YDIM;
748    
749        /* init plugins  */
750    
751        xvid_enc_create.plugins = plugins;
752        xvid_enc_create.num_plugins = 0;
753    
754        if (ARG_LUMIMASKING) {
755            plugins[xvid_enc_create.num_plugins].func = xvid_plugin_lumimasking;
756            plugins[xvid_enc_create.num_plugins].param = NULL;
757            xvid_enc_create.num_plugins++;
758        }
759    
760        if (ARG_DUMP) {
761            plugins[xvid_enc_create.num_plugins].func = xvid_plugin_dump;
762            plugins[xvid_enc_create.num_plugins].param = NULL;
763            xvid_enc_create.num_plugins++;
764        }
765    
766    /*   plugins[xvid_enc_create.num_plugins].func = rawenc_debug;
767         plugins[xvid_enc_create.num_plugins].param = NULL;
768         xvid_enc_create.num_plugins++; */
769    
770          /* No fancy thread tests */          /* No fancy thread tests */
771          xvid_enc_create.num_threads = 0;          xvid_enc_create.num_threads = 0;
772    
# Line 663  Line 792 
792    
793          /* Global encoder options */          /* Global encoder options */
794          xvid_enc_create.global = 0;          xvid_enc_create.global = 0;
795        if (ARG_PACKED) xvid_enc_create.global |= XVID_PACKED;
796        if (ARG_STATS) xvid_enc_create.global |= XVID_EXTRASTATS_ENABLE;
797    
798          /* I use a small value here, since will not encode whole movies, but short clips */          /* I use a small value here, since will not encode whole movies, but short clips */
799          xerr = xvid_encore(NULL, XVID_ENC_CREATE, &xvid_enc_create, NULL);          xerr = xvid_encore(NULL, XVID_ENC_CREATE, &xvid_enc_create, NULL);
# Line 685  Line 816 
816    
817  static int enc_main(unsigned char* image,  static int enc_main(unsigned char* image,
818                                          unsigned char* bitstream,                                          unsigned char* bitstream,
819                                          long *frametype)                      int * key,
820                                            int *stats_type,
821                        int *stats_quant,
822                        int *stats_length,
823                                            int stats[3])
824  {  {
825          int ret;          int ret;
826    
827          xvid_enc_frame_t xvid_enc_frame;          xvid_enc_frame_t xvid_enc_frame;
828          xvid_enc_stats_t xvid_enc_stats[2];          xvid_enc_stats_t xvid_enc_stats;
829    
830          /* Version for the frame and the stats */          /* Version for the frame and the stats */
831        memset(&xvid_enc_frame, 0, sizeof(xvid_enc_frame));
832          xvid_enc_frame.version = XVID_VERSION;          xvid_enc_frame.version = XVID_VERSION;
833          xvid_enc_stats[0].version = XVID_VERSION;  
834          xvid_enc_stats[1].version = XVID_VERSION;      memset(&xvid_enc_stats, 0, sizeof(xvid_enc_stats));
835            xvid_enc_stats.version = XVID_VERSION;
836    
837          /* Bind output buffer */          /* Bind output buffer */
838          xvid_enc_frame.bitstream = bitstream;          xvid_enc_frame.bitstream = bitstream;
839          xvid_enc_frame.length = -1;          xvid_enc_frame.length = -1;
840    
841          /* Initialize input image fields */          /* Initialize input image fields */
842        if (image) {
843          xvid_enc_frame.input.plane[0]  = image;          xvid_enc_frame.input.plane[0]  = image;
844          xvid_enc_frame.input.csp       = XVID_CSP_I420;          xvid_enc_frame.input.csp       = XVID_CSP_I420;
845          xvid_enc_frame.input.stride[0] = XDIM;          xvid_enc_frame.input.stride[0] = XDIM;
846        }else{
847            xvid_enc_frame.input.csp       = XVID_CSP_NULL;
848        }
849    
850          /* Set up core's general features */          /* Set up core's general features */
851          xvid_enc_frame.vol_flags = vol_presets[ARG_QUALITY];          xvid_enc_frame.vol_flags = vol_presets[ARG_QUALITY];
852        if (ARG_STATS) xvid_enc_frame.vol_flags |= XVID_EXTRASTATS;
853    
854          /* Set up core's general features */          /* Set up core's general features */
855          xvid_enc_frame.vop_flags = vop_presets[ARG_QUALITY];          xvid_enc_frame.vop_flags = vop_presets[ARG_QUALITY];
# Line 717  Line 859 
859    
860          /* Force the right quantizer */          /* Force the right quantizer */
861          xvid_enc_frame.quant  = ARG_QUANTI;          xvid_enc_frame.quant  = ARG_QUANTI;
         xvid_enc_frame.bquant = 0;  
862    
863          /* Set up motion estimation flags */          /* Set up motion estimation flags */
864          xvid_enc_frame.motion = motion_presets[ARG_QUALITY];          xvid_enc_frame.motion = motion_presets[ARG_QUALITY];
# Line 726  Line 867 
867          xvid_enc_frame.quant_intra_matrix = NULL;          xvid_enc_frame.quant_intra_matrix = NULL;
868          xvid_enc_frame.quant_inter_matrix = NULL;          xvid_enc_frame.quant_inter_matrix = NULL;
869    
870            /* Encode the frame */
871          ret = xvid_encore(enc_handle, XVID_ENC_ENCODE, &xvid_enc_frame, &xvid_enc_stats);          ret = xvid_encore(enc_handle, XVID_ENC_ENCODE, &xvid_enc_frame, &xvid_enc_stats);
872    
873          *frametype = xvid_enc_stats[0].type;      *key = (xvid_enc_frame.out_flags & XVID_KEYFRAME);
874            *stats_type = xvid_enc_stats.type;
875        *stats_quant = xvid_enc_stats.quant;
876        *stats_length = xvid_enc_stats.length;
877            stats[0]   = xvid_enc_stats.sse_y;
878            stats[1]   = xvid_enc_stats.sse_u;
879            stats[2]   = xvid_enc_stats.sse_v;
880    
881          return(ret);          return(ret);
882  }  }

Legend:
Removed from v.909  
changed lines
  Added in v.926

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