[svn] / branches / dev-api-4 / xvidcore / dshow / src / CXvidDecoder.cpp Repository:
ViewVC logotype

Diff of /branches/dev-api-4/xvidcore/dshow/src/CXvidDecoder.cpp

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

revision 1301, Fri Jan 2 13:18:28 2004 UTC revision 1314, Wed Jan 21 04:26:21 2004 UTC
# Line 19  Line 19 
19   *  along with this program ; if not, write to the Free Software   *  along with this program ; if not, write to the Free Software
20   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21   *   *
22   * $Id: CXvidDecoder.cpp,v 1.1.2.8 2004-01-02 13:18:28 syskin Exp $   * $Id: CXvidDecoder.cpp,v 1.1.2.11 2004-01-21 04:26:21 syskin Exp $
23   *   *
24   ****************************************************************************/   ****************************************************************************/
25    
# Line 212  Line 212 
212          memset(&init, 0, sizeof(init));          memset(&init, 0, sizeof(init));
213          init.version = XVID_VERSION;          init.version = XVID_VERSION;
214    
215            ar_x = ar_y = 0;
216    
217          m_hdll = LoadLibrary(XVID_DLL_NAME);          m_hdll = LoadLibrary(XVID_DLL_NAME);
218          if (m_hdll == NULL) {          if (m_hdll == NULL) {
219                  DPRINTF("dll load failed");                  DPRINTF("dll load failed");
# Line 250  Line 252 
252    
253          // Set the default post-processing settings          // Set the default post-processing settings
254          REG_GET_N("Brightness", PPSettings.nBrightness, 25)          REG_GET_N("Brightness", PPSettings.nBrightness, 25)
255          REG_GET_N("Deblock_Y",  PPSettings.bDeblock_Y, 1)          REG_GET_N("Deblock_Y",  PPSettings.bDeblock_Y, 0)
256          REG_GET_N("Deblock_UV", PPSettings.bDeblock_UV, 1)          REG_GET_N("Deblock_UV", PPSettings.bDeblock_UV, 0)
257          REG_GET_N("Dering",  PPSettings.bDering, 1)          REG_GET_N("Dering",  PPSettings.bDering, 0)
258          REG_GET_N("FilmEffect", PPSettings.bFilmEffect, 1)          REG_GET_N("FilmEffect", PPSettings.bFilmEffect, 0)
259          REG_GET_N("ForceColorspace", PPSettings.nForceColorspace, 0)          REG_GET_N("ForceColorspace", PPSettings.nForceColorspace, 0)
260    
261          RegCloseKey(hKey);          RegCloseKey(hKey);
# Line 337  Line 339 
339          {          {
340                  VIDEOINFOHEADER * vih = (VIDEOINFOHEADER *) mtIn->Format();                  VIDEOINFOHEADER * vih = (VIDEOINFOHEADER *) mtIn->Format();
341                  hdr = &vih->bmiHeader;                  hdr = &vih->bmiHeader;
342                    /* PAR (x:y) is (1/ppm_X):(1/ppm_Y) where ppm is pixels-per-meter
343                       which is equal to ppm_Y:ppm_X */
344                    ar_x = vih->bmiHeader.biYPelsPerMeter*hdr->biWidth;
345                    ar_y = vih->bmiHeader.biXPelsPerMeter*hdr->biHeight;
346          }          }
347          else if (*mtIn->FormatType() == FORMAT_VideoInfo2)          else if (*mtIn->FormatType() == FORMAT_VideoInfo2)
348          {          {
349                  VIDEOINFOHEADER2 * vih2 = (VIDEOINFOHEADER2 *) mtIn->Format();                  VIDEOINFOHEADER2 * vih2 = (VIDEOINFOHEADER2 *) mtIn->Format();
350                  hdr = &vih2->bmiHeader;                  hdr = &vih2->bmiHeader;
351                    ar_x = vih2->dwPictAspectRatioX;
352                    ar_y = vih2->dwPictAspectRatioY;
353          }          }
354          else          else
355          {          {
# Line 390  Line 398 
398                  return E_UNEXPECTED;                  return E_UNEXPECTED;
399          }          }
400    
401          VIDEOINFOHEADER * vih = (VIDEOINFOHEADER *) mtOut->ReallocFormatBuffer(sizeof(VIDEOINFOHEADER));          VIDEOINFOHEADER2 * vih = (VIDEOINFOHEADER2 *) mtOut->ReallocFormatBuffer(sizeof(VIDEOINFOHEADER2));
402          if (vih == NULL)          if (vih == NULL)
403          {          {
404                  return E_OUTOFMEMORY;                  return E_OUTOFMEMORY;
# Line 409  Line 417 
417    
418          switch(iPosition)          switch(iPosition)
419          {          {
420    
421          case 0  :          case 0  :
 if ( USE_IYUV )  
 {  
                 vih->bmiHeader.biCompression = CLSID_MEDIASUBTYPE_IYUV.Data1;  
                 vih->bmiHeader.biBitCount = 12;  
                 mtOut->SetSubtype(&CLSID_MEDIASUBTYPE_IYUV);  
                 break;  
 }  
         case 1  :  
 if ( USE_YV12 )  
 {  
                 vih->bmiHeader.biCompression = MEDIASUBTYPE_YV12.Data1;  
                 vih->bmiHeader.biBitCount = 12;  
                 mtOut->SetSubtype(&MEDIASUBTYPE_YV12);  
                 break;  
 }  
         case 2:  
422  if ( USE_YUY2 )  if ( USE_YUY2 )
423  {  {
424                  vih->bmiHeader.biCompression = MEDIASUBTYPE_YUY2.Data1;                  vih->bmiHeader.biCompression = MEDIASUBTYPE_YUY2.Data1;
# Line 433  Line 426 
426                  mtOut->SetSubtype(&MEDIASUBTYPE_YUY2);                  mtOut->SetSubtype(&MEDIASUBTYPE_YUY2);
427                  break;                  break;
428  }  }
429          case 3 :          case 1 :
430  if ( USE_YVYU )  if ( USE_YVYU )
431  {  {
432                  vih->bmiHeader.biCompression = MEDIASUBTYPE_YVYU.Data1;                  vih->bmiHeader.biCompression = MEDIASUBTYPE_YVYU.Data1;
# Line 441  Line 434 
434                  mtOut->SetSubtype(&MEDIASUBTYPE_YVYU);                  mtOut->SetSubtype(&MEDIASUBTYPE_YVYU);
435                  break;                  break;
436  }  }
437          case 4 :          case 2 :
438  if ( USE_UYVY )  if ( USE_UYVY )
439  {  {
440                  vih->bmiHeader.biCompression = MEDIASUBTYPE_UYVY.Data1;                  vih->bmiHeader.biCompression = MEDIASUBTYPE_UYVY.Data1;
# Line 449  Line 442 
442                  mtOut->SetSubtype(&MEDIASUBTYPE_UYVY);                  mtOut->SetSubtype(&MEDIASUBTYPE_UYVY);
443                  break;                  break;
444  }  }
445            case 3  :
446                    if ( USE_IYUV )
447    {
448                    vih->bmiHeader.biCompression = CLSID_MEDIASUBTYPE_IYUV.Data1;
449                    vih->bmiHeader.biBitCount = 12;
450                    mtOut->SetSubtype(&CLSID_MEDIASUBTYPE_IYUV);
451                    break;
452    }
453            case 4  :
454    if ( USE_YV12 )
455    {
456                    vih->bmiHeader.biCompression = MEDIASUBTYPE_YV12.Data1;
457                    vih->bmiHeader.biBitCount = 12;
458                    mtOut->SetSubtype(&MEDIASUBTYPE_YV12);
459                    break;
460    }
461          case 5 :          case 5 :
462  if ( USE_RGB32 )  if ( USE_RGB32 )
463  {  {
# Line 487  Line 496 
496    
497          vih->bmiHeader.biSizeImage = GetBitmapSize(&vih->bmiHeader);          vih->bmiHeader.biSizeImage = GetBitmapSize(&vih->bmiHeader);
498    
499            if (ar_x != 0 && ar_y != 0) {
500                    vih->dwPictAspectRatioX = ar_x;
501                    vih->dwPictAspectRatioY = ar_y;
502            } else { // just to be safe
503                    vih->dwPictAspectRatioX = m_create.width;
504                    vih->dwPictAspectRatioY = m_create.height;
505            }
506    
507          mtOut->SetType(&MEDIATYPE_Video);          mtOut->SetType(&MEDIATYPE_Video);
508          mtOut->SetFormatType(&FORMAT_VideoInfo);          mtOut->SetFormatType(&FORMAT_VideoInfo2);
509          mtOut->SetTemporalCompression(FALSE);          mtOut->SetTemporalCompression(FALSE);
510          mtOut->SetSampleSize(vih->bmiHeader.biSizeImage);          mtOut->SetSampleSize(vih->bmiHeader.biSizeImage);
511    
# Line 699  Line 716 
716          if (PPSettings.bFilmEffect)          if (PPSettings.bFilmEffect)
717                  m_frame.general |= XVID_FILMEFFECT;                  m_frame.general |= XVID_FILMEFFECT;
718    
         if (PPSettings.bFlipVideo) {  
                 if (rgb_flip)  
719                          m_frame.output.csp &= ~XVID_CSP_VFLIP;                          m_frame.output.csp &= ~XVID_CSP_VFLIP;
720                  else          m_frame.output.csp |= rgb_flip^(PPSettings.bFlipVideo ? XVID_CSP_VFLIP : 0);
                         m_frame.output.csp |= XVID_CSP_VFLIP;  
         }  
         else {  
                 if (rgb_flip)  
                         m_frame.output.csp |= XVID_CSP_VFLIP;  
                 else  
                         m_frame.output.csp &= ~XVID_CSP_VFLIP;  
         }  
721    
722  repeat :  repeat :
723    

Legend:
Removed from v.1301  
changed lines
  Added in v.1314

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