[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 625, Sun Nov 3 03:22:03 2002 UTC revision 660, Tue Nov 19 13:23:17 2002 UTC
# Line 172  Line 172 
172          }          }
173    
174          if (inhdr->biWidth != outhdr->biWidth || inhdr->biHeight != outhdr->biHeight ||          if (inhdr->biWidth != outhdr->biWidth || inhdr->biHeight != outhdr->biHeight ||
175                  (outhdr->biCompression != FOURCC_XVID && outhdr->biCompression != FOURCC_DIVX))                  (outhdr->biCompression != FOURCC_XVID && outhdr->biCompression != FOURCC_DIVX && outhdr->biCompression != FOURCC_DX50))
176          {          {
177                  return ICERR_BADFORMAT;                  return ICERR_BADFORMAT;
178          }          }
# Line 309  Line 309 
309          if (codec->config.debug) param.global |= XVID_GLOBAL_DEBUG;          if (codec->config.debug) param.global |= XVID_GLOBAL_DEBUG;
310          param.max_bframes = codec->config.max_bframes;          param.max_bframes = codec->config.max_bframes;
311          param.bquant_ratio = codec->config.bquant_ratio;          param.bquant_ratio = codec->config.bquant_ratio;
312            param.bquant_offset = codec->config.bquant_offset;
313          param.frame_drop_ratio = codec->config.frame_drop_ratio;          param.frame_drop_ratio = codec->config.frame_drop_ratio;
314  #endif  #endif
315    
# Line 400  Line 401 
401          if (codec->config.interlacing)          if (codec->config.interlacing)
402                  frame.general |= XVID_INTERLACING;                  frame.general |= XVID_INTERLACING;
403    
404            if (codec->config.qpel) {
405                    frame.general |= XVID_QUARTERPEL;
406                    frame.motion |= PMV_QUARTERPELREFINE16 | PMV_QUARTERPELREFINE8;
407    
408            }
409    
410            if (codec->config.gmc)
411                    frame.general |= XVID_GMC;
412    
413            if (codec->config.chromame)
414                    frame.general |= XVID_ME_COLOUR;
415    
416  // added by koepi for credits greyscale  // added by koepi for credits greyscale
417    
# Line 447  Line 459 
459                  }                  }
460          }          }
461    
462          frame.motion = pmvfast_presets[codec->config.motion_search];          frame.motion |= pmvfast_presets[codec->config.motion_search];
463    
464          frame.image = icc->lpInput;          frame.image = icc->lpInput;
465          // dev-api-3 frame.stride = (((icc->lpbiInput->biWidth * icc->lpbiInput->biBitCount) + 31) & ~31) >> 3;          // dev-api-3
466            frame.stride = (((icc->lpbiInput->biWidth * icc->lpbiInput->biBitCount) + 31) & ~31) >> 3;
467    
468          if ((frame.colorspace = get_colorspace(inhdr)) == XVID_CSP_NULL)          if ((frame.colorspace = get_colorspace(inhdr)) == XVID_CSP_NULL)
469                  return ICERR_BADFORMAT;                  return ICERR_BADFORMAT;
# Line 548  Line 561 
561                  return ICERR_BADFORMAT;                  return ICERR_BADFORMAT;
562          }          }
563    
564          if (frame.intra)          if (frame.intra==1)
565          {          {
566                  codec->keyspacing = 0;                  codec->keyspacing = 0;
567                  *icc->lpdwFlags = AVIIF_KEYFRAME;                  *icc->lpdwFlags = AVIIF_KEYFRAME;
# Line 587  Line 600 
600                  }                  }
601          }          }
602    
603    //quick fix for delayed frames
604    //      if (frame.intra != 5)
605          codec_2pass_update(codec, &frame, &stats);          codec_2pass_update(codec, &frame, &stats);
606    
607          ++codec->framenum;          ++codec->framenum;
# Line 608  Line 623 
623          {          {
624                  return ICERR_ERROR;                  return ICERR_ERROR;
625          }          }
 /* --- yv12 --- */  
         if (inhdr->biCompression == FOURCC_YV12) {  
                 return ICERR_OK;  
         }  
 /* --- yv12 --- */  
626    
627          if (inhdr->biCompression != FOURCC_XVID && inhdr->biCompression != FOURCC_DIVX)          if (inhdr->biCompression != FOURCC_XVID && inhdr->biCompression != FOURCC_DIVX && inhdr->biCompression != FOURCC_DX50 && get_colorspace(inhdr) == XVID_CSP_NULL)
628          {          {
629                  return ICERR_BADFORMAT;                  return ICERR_BADFORMAT;
630          }          }
# Line 648  Line 658 
658    
659          /* --- yv12 --- */          /* --- yv12 --- */
660    
661          if (lpbiInput->bmiHeader.biCompression == FOURCC_YV12) {          if (get_colorspace(inhdr) != XVID_CSP_NULL) {
662                  memcpy(outhdr, inhdr, sizeof(BITMAPINFOHEADER));                  memcpy(outhdr, inhdr, sizeof(BITMAPINFOHEADER));
663                    // XXX: should we set outhdr->biSize ??
664                  return ICERR_OK;                  return ICERR_OK;
665          }          }
666          /* --- yv12 --- */          /* --- yv12 --- */
# Line 725  Line 736 
736          frame.length = icd->lpbiInput->biSizeImage;          frame.length = icd->lpbiInput->biSizeImage;
737    
738          frame.image = icd->lpOutput;          frame.image = icd->lpOutput;
739          frame.stride = icd->lpbiOutput->biWidth;  //      frame.stride = icd->lpbiOutput->biWidth;
740          // dev-api-3: frame.stride = (((icd->lpbiOutput->biWidth * icd->lpbiOutput->biBitCount) + 31) & ~31) >> 3;          // dev-api-3:
741            frame.stride = (((icd->lpbiOutput->biWidth * icd->lpbiOutput->biBitCount) + 31) & ~31) >> 3;
742    
743          /* --- yv12 --- */          /* --- yv12 --- */
744          if (icd->lpbiInput->biCompression == FOURCC_YV12) {          if (icd->lpbiInput->biCompression != FOURCC_XVID &&
745                     icd->lpbiInput->biCompression != FOURCC_DIVX &&
746                     icd->lpbiInput->biCompression != FOURCC_DX50)
747            {
748                    XVID_INIT_CONVERTINFO convert;
749                    DEBUGFOURCC("input", icd->lpbiInput->biCompression);
750                  DEBUGFOURCC("output", icd->lpbiOutput->biCompression);                  DEBUGFOURCC("output", icd->lpbiOutput->biCompression);
751                  if (icd->lpbiOutput->biCompression == FOURCC_YV12) {                  convert.input.colorspace = get_colorspace(icd->lpbiInput);
752                          memcpy(frame.image,codec->dhandle,icd->lpbiInput->biSizeImage);                  convert.input.y = icd->lpInput;
753                    convert.input.y_stride = (((icd->lpbiInput->biWidth *icd->lpbiInput->biBitCount) + 31) & ~31) >> 3;
754                    convert.output.colorspace = get_colorspace(icd->lpbiOutput);
755                    convert.output.y = icd->lpOutput;
756                    convert.output.y_stride = (((icd->lpbiOutput->biWidth *icd->lpbiOutput->biBitCount) + 31) & ~31) >> 3;
757                    convert.width = icd->lpbiInput->biWidth;
758                    convert.height = icd->lpbiInput->biHeight;
759                    convert.interlacing = 0;
760                    if (convert.input.colorspace == XVID_CSP_NULL ||
761                            convert.output.colorspace == XVID_CSP_NULL ||
762                            xvid_init(NULL, XVID_INIT_CONVERT, &convert, NULL) != XVID_ERR_OK)
763                    {
764                             return ICERR_BADFORMAT;
765                  }                  }
766                  return ICERR_OK;                  return ICERR_OK;
767          }          }

Legend:
Removed from v.625  
changed lines
  Added in v.660

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