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

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

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

revision 137, Thu Apr 25 07:16:00 2002 UTC revision 361, Mon Aug 5 18:26:31 2002 UTC
# Line 23  Line 23 
23   *   *
24   *      History:   *      History:
25   *   *
26     *      12.07.2002      num_threads
27     *      23.06.2002      XVID_CPU_CHKONLY; loading speed up
28   *      25.04.2002      ICDECOMPRESS_PREROLL   *      25.04.2002      ICDECOMPRESS_PREROLL
29   *      17.04.2002      re-enabled lumi masking for 1st pass   *      17.04.2002      re-enabled lumi masking for 1st pass
30   *      15.04.2002      updated cbr support   *      15.04.2002      updated cbr support
# Line 57  Line 59 
59          PMV_EARLYSTOP16 | PMV_HALFPELREFINE16 | PMV_EARLYSTOP8 | PMV_HALFPELDIAMOND8,          PMV_EARLYSTOP16 | PMV_HALFPELREFINE16 | PMV_EARLYSTOP8 | PMV_HALFPELDIAMOND8,
60          PMV_EARLYSTOP16 | PMV_HALFPELREFINE16 | PMV_EXTSEARCH16 |          PMV_EARLYSTOP16 | PMV_HALFPELREFINE16 | PMV_EXTSEARCH16 |
61          PMV_EARLYSTOP8 | PMV_HALFPELREFINE8 | PMV_HALFPELDIAMOND8          PMV_EARLYSTOP8 | PMV_HALFPELREFINE8 | PMV_HALFPELDIAMOND8
62    //      | PMV_USESQUARES16
63  };  };
64    
65  /*      return xvid compatbile colorspace,  /*      return xvid compatbile colorspace,
# Line 218  Line 221 
221    
222  LRESULT compress_get_size(CODEC * codec, BITMAPINFO * lpbiInput, BITMAPINFO * lpbiOutput)  LRESULT compress_get_size(CODEC * codec, BITMAPINFO * lpbiInput, BITMAPINFO * lpbiOutput)
223  {  {
224          return lpbiOutput->bmiHeader.biWidth * lpbiOutput->bmiHeader.biHeight * 3;          return
225    #ifdef BFRAMES
226             2 *
227    #endif
228            lpbiOutput->bmiHeader.biWidth * lpbiOutput->bmiHeader.biHeight * 3;
229  }  }
230    
231    
# Line 289  Line 296 
296          param.max_quantizer = codec->config.max_pquant;          param.max_quantizer = codec->config.max_pquant;
297          param.max_key_interval = codec->config.max_key_interval;          param.max_key_interval = codec->config.max_key_interval;
298    
299    #ifdef _SMP
300            param.num_threads = codec->config.num_threads;
301    #endif
302    
303    #ifdef BFRAMES
304            param.global = 0;
305            if (codec->config.packed) param.global |= XVID_GLOBAL_PACKED;
306            if (codec->config.dx50bvop) param.global |= XVID_GLOBAL_DX50BVOP;
307            if (codec->config.debug) param.global |= XVID_GLOBAL_DEBUG;
308            param.max_bframes = codec->config.max_bframes;
309            param.bquant_ratio = codec->config.bquant_ratio;
310            param.frame_drop_ratio = codec->config.frame_drop_ratio;
311    #endif
312    
313          switch(xvid_encore(0, XVID_ENC_CREATE, &param, NULL))          switch(xvid_encore(0, XVID_ENC_CREATE, &param, NULL))
314          {          {
315          case XVID_ERR_FAIL :          case XVID_ERR_FAIL :
# Line 365  Line 386 
386          frame.intra = -1;          frame.intra = -1;
387    
388          frame.general |= XVID_HALFPEL;          frame.general |= XVID_HALFPEL;
389    //      frame.general |= XVID_ME_EPZS;
390    
391          if (codec->config.motion_search > 4)          if (codec->config.motion_search > 4)
392                  frame.general |= XVID_INTER4V;                  frame.general |= XVID_INTER4V;
# Line 375  Line 397 
397          if (codec->config.interlacing)          if (codec->config.interlacing)
398                  frame.general |= XVID_INTERLACING;                  frame.general |= XVID_INTERLACING;
399    
400    // added by koepi for credits greyscale
401            check_greyscale_mode(&codec->config, &frame, codec->framenum);
402    // end of koepi's addition
403    
404    // fix 1pass modes/hinted MV by koepi
405            if (codec->config.hinted_me && (codec->config.mode == DLG_MODE_CBR || codec->config.mode == DLG_MODE_VBR_QUAL || codec->config.mode == DLG_MODE_VBR_QUANT))
406            {
407                    codec->config.hinted_me = 0;
408            }
409    // end of ugly hack
410    
411          if (codec->config.hinted_me && codec->config.mode == DLG_MODE_2PASS_1)          if (codec->config.hinted_me && codec->config.mode == DLG_MODE_2PASS_1)
412          {          {
413                  frame.hint.hintstream = codec->twopass.hintstream;                  frame.hint.hintstream = codec->twopass.hintstream;
# Line 490  Line 523 
523                  frame.intra = 0;                  frame.intra = 0;
524          }          }
525    
526    #ifdef BFRAMES
527            frame.bquant = 0;
528    #endif
529    
530    //      OutputDebugString(" ");
531          switch (xvid_encore(codec->ehandle, XVID_ENC_ENCODE, &frame, &stats))          switch (xvid_encore(codec->ehandle, XVID_ENC_ENCODE, &frame, &stats))
532          {          {
533          case XVID_ERR_FAIL :          case XVID_ERR_FAIL :
# Line 702  Line 740 
740          case DLG_MODE_VBR_QUAL :          case DLG_MODE_VBR_QUAL :
741                  if (codec_is_in_credits(&codec->config, codec->framenum))                  if (codec_is_in_credits(&codec->config, codec->framenum))
742                  {                  {
743    // added by koepi for credits greyscale
744                            check_greyscale_mode(&codec->config, frame, codec->framenum);
745    // end of koepi's addition
746                          switch (codec->config.credits_mode)                          switch (codec->config.credits_mode)
747                          {                          {
748                          case CREDITS_MODE_RATE :                          case CREDITS_MODE_RATE :
# Line 719  Line 760 
760                  }                  }
761                  else                  else
762                  {                  {
763    // added by koepi for credits greyscale
764                            check_greyscale_mode(&codec->config, frame, codec->framenum);
765    // end of koepi's addition
766                          frame->quant = codec_get_vbr_quant(&codec->config, codec->config.quality);                          frame->quant = codec_get_vbr_quant(&codec->config, codec->config.quality);
767                  }                  }
768                  return ICERR_OK;                  return ICERR_OK;
# Line 726  Line 770 
770          case DLG_MODE_VBR_QUANT :          case DLG_MODE_VBR_QUANT :
771                  if (codec_is_in_credits(&codec->config, codec->framenum))                  if (codec_is_in_credits(&codec->config, codec->framenum))
772                  {                  {
773    // added by koepi for credits greyscale
774                            check_greyscale_mode(&codec->config, frame, codec->framenum);
775    // end of koepi's addition
776                          switch (codec->config.credits_mode)                          switch (codec->config.credits_mode)
777                          {                          {
778                          case CREDITS_MODE_RATE :                          case CREDITS_MODE_RATE :
# Line 745  Line 792 
792                  }                  }
793                  else                  else
794                  {                  {
795    // added by koepi for credits greyscale
796                            check_greyscale_mode(&codec->config, frame, codec->framenum);
797    // end of koepi's addition
798                          frame->quant = codec->config.quant;                          frame->quant = codec->config.quant;
799                  }                  }
800                  return ICERR_OK;                  return ICERR_OK;
801    
802          case DLG_MODE_2PASS_1 :          case DLG_MODE_2PASS_1 :
803    // added by koepi for credits greyscale
804                    check_greyscale_mode(&codec->config, frame, codec->framenum);
805    // end of koepi's addition
806                  if (codec->config.credits_mode == CREDITS_MODE_QUANT)                  if (codec->config.credits_mode == CREDITS_MODE_QUANT)
807                  {                  {
808                          if (codec_is_in_credits(&codec->config, codec->framenum))                          if (codec_is_in_credits(&codec->config, codec->framenum))
# Line 840  Line 893 
893          return quant;          return quant;
894  }  }
895    
896    // added by koepi for credits greyscale
897    int check_greyscale_mode(CONFIG* config, XVID_ENC_FRAME* frame, int framenum)
898    {
899            if ((codec_is_in_credits(config, framenum)) && (config->mode!=DLG_MODE_CBR))
900            {
901                    if (config->credits_greyscale)
902                    {
903                            if ((frame->general && XVID_GREYSCALE))  // use only if not already in greyscale
904                                    frame->general |= XVID_GREYSCALE;
905                    } else {
906                            if (!(frame->general && XVID_GREYSCALE))  // if movie is in greyscale, switch back
907                                    frame->general |= XVID_GREYSCALE;
908                    }
909            } else {
910                    if (config->greyscale)
911                    {
912                            if ((frame->general && XVID_GREYSCALE))  // use only if not already in greyscale
913                                    frame->general |= XVID_GREYSCALE;
914                    } else {
915                            if (!(frame->general && XVID_GREYSCALE))  // if credits is in greyscale, switch back
916                                    frame->general |= XVID_GREYSCALE;
917                    }
918            }
919            return 0;
920    }
921    // end of koepi's addition

Legend:
Removed from v.137  
changed lines
  Added in v.361

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