[svn] / branches / dev-api-4 / xvidcore / vfw / src / codec.c Repository:
ViewVC logotype

Diff of /branches/dev-api-4/xvidcore/vfw/src/codec.c

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

revision 1053, Mon Jun 9 01:25:19 2003 UTC revision 1202, Sun Nov 9 20:49:21 2003 UTC
# Line 54  Line 54 
54  #include <xvid.h>  #include <xvid.h>
55  #include "debug.h"  #include "debug.h"
56  #include "codec.h"  #include "codec.h"
57    #include "status.h"
58    
59    
60  static const int pmvfast_presets[7] = {  static const int pmvfast_presets[7] = {
# Line 207  Line 208 
208    
209          if (lpbiOutput == NULL)          if (lpbiOutput == NULL)
210          {          {
211                  return sizeof(BITMAPV4HEADER);                  return sizeof(BITMAPINFOHEADER);
212          }          }
213    
214          memcpy(outhdr, inhdr, sizeof(BITMAPINFOHEADER));          memcpy(outhdr, inhdr, sizeof(BITMAPINFOHEADER));
# Line 362  Line 363 
363          case RC_MODE_2PASS2 :          case RC_MODE_2PASS2 :
364          memset(&pass2, 0, sizeof(pass2));          memset(&pass2, 0, sizeof(pass2));
365              pass2.version = XVID_VERSION;              pass2.version = XVID_VERSION;
366            if (codec->config.use_2pass_bitrate) {
367          pass2.bitrate = codec->config.bitrate * CONFIG_KBPS;          pass2.bitrate = codec->config.bitrate * CONFIG_KBPS;
368            }else{
369                pass2.bitrate = -codec->config.desired_size;    /* kilobytes */
370            }
371                  pass2.filename = codec->config.stats;                  pass2.filename = codec->config.stats;
372    
373          pass2.keyframe_boost = codec->config.keyframe_boost;   /* keyframe boost percentage: [0..100...]; */          pass2.keyframe_boost = codec->config.keyframe_boost;   /* keyframe boost percentage: [0..100...]; */
         pass2.payback_method = codec->config.bitrate_payback_method;  
         pass2.bitrate_payback_delay = codec->config.bitrate_payback_delay;  
374          pass2.curve_compression_high = codec->config.curve_compression_high;          pass2.curve_compression_high = codec->config.curve_compression_high;
375          pass2.curve_compression_low = codec->config.curve_compression_low;          pass2.curve_compression_low = codec->config.curve_compression_low;
376                    pass2.overflow_control_strength = codec->config.overflow_control_strength;
377          pass2.max_overflow_improvement = codec->config.twopass_max_overflow_improvement;          pass2.max_overflow_improvement = codec->config.twopass_max_overflow_improvement;
378          pass2.max_overflow_degradation = codec->config.twopass_max_overflow_degradation;          pass2.max_overflow_degradation = codec->config.twopass_max_overflow_degradation;
         pass2.kftreshold = codec->config.kftreshold;  
379              pass2.kfreduction = codec->config.kfreduction;              pass2.kfreduction = codec->config.kfreduction;
380          pass2.min_key_interval = codec->config.min_key_interval;          pass2.min_key_interval = codec->config.min_key_interval;
381          pass2.container_frame_overhead = 24;    /* AVI */          pass2.container_frame_overhead = 24;    /* AVI */
# Line 451  Line 454 
454          codec->framenum = 0;          codec->framenum = 0;
455          codec->keyspacing = 0;          codec->keyspacing = 0;
456    
457        if (codec->config.display_status) {
458            status_destroy_always(&codec->status);
459            status_create(&codec->status, codec->fincr, codec->fbase);
460        }
461    
462          return ICERR_OK;          return ICERR_OK;
463  }  }
464    
465    
466  LRESULT compress_end(CODEC * codec)  LRESULT compress_end(CODEC * codec)
467  {  {
468          if (codec->ehandle != NULL)      if (codec->ehandle != NULL) {
         {  
469                  xvid_encore(codec->ehandle, XVID_ENC_DESTROY, NULL, NULL);                  xvid_encore(codec->ehandle, XVID_ENC_DESTROY, NULL, NULL);
470                  codec->ehandle = NULL;                  codec->ehandle = NULL;
471          }          }
472    
473        if (codec->config.display_status)
474            status_destroy(&codec->status);
475    
476          return ICERR_OK;          return ICERR_OK;
477  }  }
478    
# Line 474  Line 484 
484      for (i=0; i<config->num_zones && config->zones[i].frame <= framenum; i++) ;      for (i=0; i<config->num_zones && config->zones[i].frame <= framenum; i++) ;
485      i--;      i--;
486    
487        frame->type = config->zones[i].type;
488    
489      if (config->zones[i].greyscale) {      if (config->zones[i].greyscale) {
490          frame->vop_flags |= XVID_VOP_GREYSCALE;          frame->vop_flags |= XVID_VOP_GREYSCALE;
491      }      }
# Line 528  Line 540 
540                  frame.motion |= XVID_ME_QUARTERPELREFINE16 | XVID_ME_QUARTERPELREFINE8;                  frame.motion |= XVID_ME_QUARTERPELREFINE16 | XVID_ME_QUARTERPELREFINE8;
541          }          }
542    
543          if ((profiles[codec->config.profile].flags & PROFILE_GMC) && codec->config.gmc)          if ((profiles[codec->config.profile].flags & PROFILE_GMC) && codec->config.gmc) {
544                  frame.vol_flags |= XVID_VOL_GMC;                  frame.vol_flags |= XVID_VOL_GMC;
545                    frame.motion |= XVID_ME_GME_REFINE;
546            }
547    
548          if ((profiles[codec->config.profile].flags & PROFILE_INTERLACE) && codec->config.interlacing)          if ((profiles[codec->config.profile].flags & PROFILE_INTERLACE) && codec->config.interlacing)
549                  frame.vol_flags |= XVID_VOL_INTERLACING;                  frame.vol_flags |= XVID_VOL_INTERLACING;
# Line 550  Line 564 
564                  frame.vop_flags |= XVID_VOP_INTER4V;                  frame.vop_flags |= XVID_VOP_INTER4V;
565    
566          if (codec->config.chromame)          if (codec->config.chromame)
567                  frame.vop_flags |= XVID_ME_CHROMA16 + XVID_ME_CHROMA8;                  frame.motion |= XVID_ME_CHROMA_PVOP + XVID_ME_CHROMA_BVOP;
568    
569            if (codec->config.cartoon_mode) {
570                    frame.vop_flags |= XVID_VOP_CARTOON;
571    #if 0 /* Seems to cause crashes with P4 cpus */
572                    frame.motion |= XVID_ME_DETECT_STATIC_MOTION;
573    #endif
574            }
575    
576          frame.motion |= pmvfast_presets[codec->config.motion_search];          frame.motion |= pmvfast_presets[codec->config.motion_search];
577    
578          switch (codec->config.vhq_mode)          switch (codec->config.vhq_mode)
579          {          {
580          case VHQ_MODE_DECISION :          case VHQ_MODE_DECISION :
581                  frame.vop_flags |= XVID_VOP_MODEDECISION_BITS;                  frame.vop_flags |= XVID_VOP_MODEDECISION_RD;
582                  break;                  break;
583    
584          case VHQ_LIMITED_SEARCH :          case VHQ_LIMITED_SEARCH :
585                  frame.vop_flags |= XVID_VOP_MODEDECISION_BITS;                  frame.vop_flags |= XVID_VOP_MODEDECISION_RD;
586                  frame.motion |= XVID_ME_HALFPELREFINE16_BITS;                  frame.motion |= XVID_ME_HALFPELREFINE16_RD;
587                  frame.motion |= XVID_ME_QUARTERPELREFINE16_BITS;                  frame.motion |= XVID_ME_QUARTERPELREFINE16_RD;
588                  break;                  break;
589    
590          case VHQ_MEDIUM_SEARCH :          case VHQ_MEDIUM_SEARCH :
591                  frame.vop_flags |= XVID_VOP_MODEDECISION_BITS;                  frame.vop_flags |= XVID_VOP_MODEDECISION_RD;
592                  frame.motion |= XVID_ME_HALFPELREFINE16_BITS;                  frame.motion |= XVID_ME_HALFPELREFINE16_RD;
593                  frame.motion |= XVID_ME_HALFPELREFINE8_BITS;                  frame.motion |= XVID_ME_HALFPELREFINE8_RD;
594                  frame.motion |= XVID_ME_QUARTERPELREFINE16_BITS;                  frame.motion |= XVID_ME_QUARTERPELREFINE16_RD;
595                  frame.motion |= XVID_ME_QUARTERPELREFINE8_BITS;                  frame.motion |= XVID_ME_QUARTERPELREFINE8_RD;
596                  frame.motion |= XVID_ME_CHECKPREDICTION_BITS;                  frame.motion |= XVID_ME_CHECKPREDICTION_RD;
597                  break;                  break;
598    
599          case VHQ_WIDE_SEARCH :          case VHQ_WIDE_SEARCH :
600                  frame.vop_flags |= XVID_VOP_MODEDECISION_BITS;                  frame.vop_flags |= XVID_VOP_MODEDECISION_RD;
601                  frame.motion |= XVID_ME_HALFPELREFINE16_BITS;                  frame.motion |= XVID_ME_HALFPELREFINE16_RD;
602                  frame.motion |= XVID_ME_HALFPELREFINE8_BITS;                  frame.motion |= XVID_ME_HALFPELREFINE8_RD;
603                  frame.motion |= XVID_ME_QUARTERPELREFINE16_BITS;                  frame.motion |= XVID_ME_QUARTERPELREFINE16_RD;
604                  frame.motion |= XVID_ME_QUARTERPELREFINE8_BITS;                  frame.motion |= XVID_ME_QUARTERPELREFINE8_RD;
605                  frame.motion |= XVID_ME_CHECKPREDICTION_BITS;                  frame.motion |= XVID_ME_CHECKPREDICTION_RD;
606                  frame.motion |= XVID_ME_EXTSEARCH_BITS;                  frame.motion |= XVID_ME_EXTSEARCH_RD;
607                  break;                  break;
608    
609          default :          default :
# Line 644  Line 665 
665                  return ICERR_UNSUPPORTED;                  return ICERR_UNSUPPORTED;
666          }          }
667    
668        if (codec->config.display_status && stats.type>0) {
669            status_update(&codec->status, stats.type, stats.length, stats.quant);
670        }
671    
672          DPRINTF("{type=%i len=%i} length=%i", stats.type, stats.length, length);          DPRINTF("{type=%i len=%i} length=%i", stats.type, stats.length, length);
673    
674      if (length == 0)    /* no encoder output */      if (length == 0)    /* no encoder output */

Legend:
Removed from v.1053  
changed lines
  Added in v.1202

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