[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 632, Thu Nov 7 10:34:14 2002 UTC revision 670, Thu Nov 21 12:51:28 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 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 610  Line 615 
615          {          {
616                  return ICERR_ERROR;                  return ICERR_ERROR;
617          }          }
 /* --- yv12 --- */  
         if (inhdr->biCompression == FOURCC_YV12) {  
                 return ICERR_OK;  
         }  
 /* --- yv12 --- */  
618    
619          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)
620          {          {
621                  return ICERR_BADFORMAT;                  return ICERR_BADFORMAT;
622          }          }
# Line 650  Line 650 
650    
651          /* --- yv12 --- */          /* --- yv12 --- */
652    
653          if (lpbiInput->bmiHeader.biCompression == FOURCC_YV12) {          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 ??
656                  return ICERR_OK;                  return ICERR_OK;
657          }          }
658          /* --- yv12 --- */          /* --- yv12 --- */
# Line 732  Line 733 
733          frame.stride = (((icd->lpbiOutput->biWidth * icd->lpbiOutput->biBitCount) + 31) & ~31) >> 3;          frame.stride = (((icd->lpbiOutput->biWidth * icd->lpbiOutput->biBitCount) + 31) & ~31) >> 3;
734    
735          /* --- yv12 --- */          /* --- yv12 --- */
736          if (icd->lpbiInput->biCompression == FOURCC_YV12) {          if (icd->lpbiInput->biCompression != FOURCC_XVID &&
737                     icd->lpbiInput->biCompression != FOURCC_DIVX &&
738                     icd->lpbiInput->biCompression != FOURCC_DX50)
739            {
740                    XVID_INIT_CONVERTINFO convert;
741                    DEBUGFOURCC("input", icd->lpbiInput->biCompression);
742                  DEBUGFOURCC("output", icd->lpbiOutput->biCompression);                  DEBUGFOURCC("output", icd->lpbiOutput->biCompression);
743                  if (icd->lpbiOutput->biCompression == FOURCC_YV12) {                  convert.input.colorspace = get_colorspace(icd->lpbiInput);
744                          memcpy(frame.image,codec->dhandle,icd->lpbiInput->biSizeImage);                  convert.input.y = icd->lpInput;
745                    convert.input.y_stride = (((icd->lpbiInput->biWidth *icd->lpbiInput->biBitCount) + 31) & ~31) >> 3;
746                    convert.output.colorspace = get_colorspace(icd->lpbiOutput);
747                    convert.output.y = icd->lpOutput;
748                    convert.output.y_stride = (((icd->lpbiOutput->biWidth *icd->lpbiOutput->biBitCount) + 31) & ~31) >> 3;
749                    convert.width = icd->lpbiInput->biWidth;
750                    convert.height = icd->lpbiInput->biHeight;
751                    convert.interlacing = 0;
752                    if (convert.input.colorspace == XVID_CSP_NULL ||
753                            convert.output.colorspace == XVID_CSP_NULL ||
754                            xvid_init(NULL, XVID_INIT_CONVERT, &convert, NULL) != XVID_ERR_OK)
755                    {
756                             return ICERR_BADFORMAT;
757                  }                  }
758                  return ICERR_OK;                  return ICERR_OK;
759          }          }

Legend:
Removed from v.632  
changed lines
  Added in v.670

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