[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 634, Fri Nov 8 10:11:48 2002 UTC revision 707, Thu Dec 12 10:38:28 2002 UTC
# Line 223  Line 223 
223    
224  LRESULT compress_get_size(CODEC * codec, BITMAPINFO * lpbiInput, BITMAPINFO * lpbiOutput)  LRESULT compress_get_size(CODEC * codec, BITMAPINFO * lpbiInput, BITMAPINFO * lpbiOutput)
225  {  {
226          return          return 2 * lpbiOutput->bmiHeader.biWidth * lpbiOutput->bmiHeader.biHeight * 3;
 #ifdef BFRAMES  
          2 *  
 #endif  
         lpbiOutput->bmiHeader.biWidth * lpbiOutput->bmiHeader.biHeight * 3;  
227  }  }
228    
229    
# Line 302  Line 298 
298          param.num_threads = codec->config.num_threads;          param.num_threads = codec->config.num_threads;
299  #endif  #endif
300    
 #ifdef BFRAMES  
301          param.global = 0;          param.global = 0;
302          if (codec->config.packed) param.global |= XVID_GLOBAL_PACKED;          if (codec->config.packed) param.global |= XVID_GLOBAL_PACKED;
303          if (codec->config.dx50bvop) param.global |= XVID_GLOBAL_DX50BVOP;          if (codec->config.dx50bvop) param.global |= XVID_GLOBAL_DX50BVOP;
304          if (codec->config.debug) param.global |= XVID_GLOBAL_DEBUG;          if (codec->config.debug) param.global |= XVID_GLOBAL_DEBUG;
305          param.max_bframes = codec->config.max_bframes;          param.max_bframes = codec->config.max_bframes;
306          param.bquant_ratio = codec->config.bquant_ratio;          param.bquant_ratio = codec->config.bquant_ratio;
307            param.bquant_offset = codec->config.bquant_offset;
308          param.frame_drop_ratio = codec->config.frame_drop_ratio;          param.frame_drop_ratio = codec->config.frame_drop_ratio;
 #endif  
309    
310          switch(xvid_encore(0, XVID_ENC_CREATE, &param, NULL))          switch(xvid_encore(0, XVID_ENC_CREATE, &param, NULL))
311          {          {
# Line 400  Line 395 
395          if (codec->config.interlacing)          if (codec->config.interlacing)
396                  frame.general |= XVID_INTERLACING;                  frame.general |= XVID_INTERLACING;
397    
398            if (codec->config.qpel) {
399                    frame.general |= XVID_QUARTERPEL;
400                    frame.motion |= PMV_QUARTERPELREFINE16 | PMV_QUARTERPELREFINE8;
401    
402            }
403    
404            if (codec->config.gmc)
405                    frame.general |= XVID_GMC;
406    
407            if (codec->config.chromame)
408                    frame.general |= XVID_ME_COLOUR;
409    
410  // added by koepi for credits greyscale  // added by koepi for credits greyscale
411    
# Line 448  Line 453 
453                  }                  }
454          }          }
455    
456          frame.motion = pmvfast_presets[codec->config.motion_search];          frame.motion |= pmvfast_presets[codec->config.motion_search];
457    
458          frame.image = icc->lpInput;          frame.image = icc->lpInput;
459          // dev-api-3          // dev-api-3
# Line 533  Line 538 
538                  frame.intra = 0;                  frame.intra = 0;
539          }          }
540    
 #ifdef BFRAMES  
541          frame.bquant = 0;          frame.bquant = 0;
 #endif  
542    
543  //      OutputDebugString(" ");  //      OutputDebugString(" ");
544          switch (xvid_encore(codec->ehandle, XVID_ENC_ENCODE, &frame, &stats))          switch (xvid_encore(codec->ehandle, XVID_ENC_ENCODE, &frame, &stats))
# Line 550  Line 553 
553                  return ICERR_BADFORMAT;                  return ICERR_BADFORMAT;
554          }          }
555    
556          if (frame.intra)          if (frame.intra==1)
557          {          {
558                  codec->keyspacing = 0;                  codec->keyspacing = 0;
559                  *icc->lpdwFlags = AVIIF_KEYFRAME;                  *icc->lpdwFlags = AVIIF_KEYFRAME;
# Line 589  Line 592 
592                  }                  }
593          }          }
594    
595    //quick fix for delayed frames
596    //      if (frame.intra != 5)
597          codec_2pass_update(codec, &frame, &stats);          codec_2pass_update(codec, &frame, &stats);
598    
599          ++codec->framenum;          ++codec->framenum;
# Line 611  Line 616 
616                  return ICERR_ERROR;                  return ICERR_ERROR;
617          }          }
618    
619          if (inhdr->biCompression != FOURCC_XVID &&          if (inhdr->biCompression != FOURCC_XVID && inhdr->biCompression != FOURCC_DIVX && inhdr->biCompression != FOURCC_DX50 && get_colorspace(inhdr) == XVID_CSP_NULL)
                 inhdr->biCompression != FOURCC_DIVX &&  
                 inhdr->biCompression != FOURCC_DX50 &&  
                 get_colorspace(inhdr) == XVID_CSP_NULL)  
620          {          {
621                  return ICERR_BADFORMAT;                  return ICERR_BADFORMAT;
622          }          }
# Line 647  Line 649 
649          }          }
650    
651          /* --- yv12 --- */          /* --- yv12 --- */
652    
653          if (get_colorspace(inhdr) != XVID_CSP_NULL) {          if (get_colorspace(inhdr) != XVID_CSP_NULL) {
654                  memcpy(outhdr, inhdr, sizeof(BITMAPINFOHEADER));                  memcpy(outhdr, inhdr, sizeof(BITMAPINFOHEADER));
655                  // XXX: should we set outhdr->biSize ??                  // XXX: should we set outhdr->biSize ??
# Line 723  Line 726 
726    
727          frame.bitstream = icd->lpInput;          frame.bitstream = icd->lpInput;
728          frame.length = icd->lpbiInput->biSizeImage;          frame.length = icd->lpbiInput->biSizeImage;
729            frame.general = XVID_DEC_LOWDELAY;      /* force low_delay_default mode */
730          frame.image = icd->lpOutput;          frame.image = icd->lpOutput;
731          //frame.stride = icd->lpbiOutput->biWidth;          //frame.stride = icd->lpbiOutput->biWidth;
732          // dev-api-3:          // dev-api-3:
# Line 735  Line 738 
738                  icd->lpbiInput->biCompression != FOURCC_DX50)                  icd->lpbiInput->biCompression != FOURCC_DX50)
739          {          {
740                  XVID_INIT_CONVERTINFO convert;                  XVID_INIT_CONVERTINFO convert;
   
741                  DEBUGFOURCC("input", icd->lpbiInput->biCompression);                  DEBUGFOURCC("input", icd->lpbiInput->biCompression);
742                  DEBUGFOURCC("output", icd->lpbiOutput->biCompression);                  DEBUGFOURCC("output", icd->lpbiOutput->biCompression);
   
743                  convert.input.colorspace = get_colorspace(icd->lpbiInput);                  convert.input.colorspace = get_colorspace(icd->lpbiInput);
744                  convert.input.y = icd->lpInput;                  convert.input.y = icd->lpInput;
745                  convert.input.y_stride = (((icd->lpbiInput->biWidth * icd->lpbiInput->biBitCount) + 31) & ~31) >> 3;                  convert.input.y_stride = (((icd->lpbiInput->biWidth * icd->lpbiInput->biBitCount) + 31) & ~31) >> 3;
   
746                  convert.output.colorspace = get_colorspace(icd->lpbiOutput);                  convert.output.colorspace = get_colorspace(icd->lpbiOutput);
747                  convert.output.y = icd->lpOutput;                  convert.output.y = icd->lpOutput;
748                  convert.output.y_stride = (((icd->lpbiOutput->biWidth * icd->lpbiOutput->biBitCount) + 31) & ~31) >> 3;                  convert.output.y_stride = (((icd->lpbiOutput->biWidth * icd->lpbiOutput->biBitCount) + 31) & ~31) >> 3;
   
749                  convert.width = icd->lpbiInput->biWidth;                  convert.width = icd->lpbiInput->biWidth;
750                  convert.height = icd->lpbiInput->biHeight;                  convert.height = icd->lpbiInput->biHeight;
751                  convert.interlacing = 0;                  convert.interlacing = 0;
   
752                  if (convert.input.colorspace == XVID_CSP_NULL ||                  if (convert.input.colorspace == XVID_CSP_NULL ||
753                          convert.output.colorspace == XVID_CSP_NULL ||                          convert.output.colorspace == XVID_CSP_NULL ||
754                          xvid_init(NULL, XVID_INIT_CONVERT, &convert, NULL) != XVID_ERR_OK)                          xvid_init(NULL, XVID_INIT_CONVERT, &convert, NULL) != XVID_ERR_OK)
755                  {                  {
756                          return ICERR_BADFORMAT;                          return ICERR_BADFORMAT;
757                  }                  }
   
758                  return ICERR_OK;                  return ICERR_OK;
759          }          }
760          /* --- yv12 --- */          /* --- yv12 --- */

Legend:
Removed from v.634  
changed lines
  Added in v.707

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