[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 1334, Mon Jan 26 05:49:42 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.12 2004-01-26 05:49:42 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.nDeblock_Y, 0)
256          REG_GET_N("Deblock_UV", PPSettings.bDeblock_UV, 1)          REG_GET_N("Deblock_UV", PPSettings.nDeblock_UV, 0)
257          REG_GET_N("Dering",  PPSettings.bDering, 1)          REG_GET_N("Dering",  PPSettings.nDering, 0)
258          REG_GET_N("FilmEffect", PPSettings.bFilmEffect, 1)          REG_GET_N("FilmEffect", PPSettings.nFilmEffect, 0)
259          REG_GET_N("ForceColorspace", PPSettings.nForceColorspace, 0)          REG_GET_N("ForceColorspace", PPSettings.nForceColorspace, 0)
260            REG_GET_N("FlipVideo",  PPSettings.nFlipVideo, 0)
261    
262          RegCloseKey(hKey);          RegCloseKey(hKey);
263    
# Line 337  Line 340 
340          {          {
341                  VIDEOINFOHEADER * vih = (VIDEOINFOHEADER *) mtIn->Format();                  VIDEOINFOHEADER * vih = (VIDEOINFOHEADER *) mtIn->Format();
342                  hdr = &vih->bmiHeader;                  hdr = &vih->bmiHeader;
343                    /* PAR (x:y) is (1/ppm_X):(1/ppm_Y) where ppm is pixels-per-meter
344                       which is equal to ppm_Y:ppm_X */
345                    ar_x = vih->bmiHeader.biYPelsPerMeter*hdr->biWidth;
346                    ar_y = vih->bmiHeader.biXPelsPerMeter*hdr->biHeight;
347          }          }
348          else if (*mtIn->FormatType() == FORMAT_VideoInfo2)          else if (*mtIn->FormatType() == FORMAT_VideoInfo2)
349          {          {
350                  VIDEOINFOHEADER2 * vih2 = (VIDEOINFOHEADER2 *) mtIn->Format();                  VIDEOINFOHEADER2 * vih2 = (VIDEOINFOHEADER2 *) mtIn->Format();
351                  hdr = &vih2->bmiHeader;                  hdr = &vih2->bmiHeader;
352                    ar_x = vih2->dwPictAspectRatioX;
353                    ar_y = vih2->dwPictAspectRatioY;
354          }          }
355          else          else
356          {          {
# Line 390  Line 399 
399                  return E_UNEXPECTED;                  return E_UNEXPECTED;
400          }          }
401    
402          VIDEOINFOHEADER * vih = (VIDEOINFOHEADER *) mtOut->ReallocFormatBuffer(sizeof(VIDEOINFOHEADER));          VIDEOINFOHEADER2 * vih = (VIDEOINFOHEADER2 *) mtOut->ReallocFormatBuffer(sizeof(VIDEOINFOHEADER2));
403          if (vih == NULL)          if (vih == NULL)
404          {          {
405                  return E_OUTOFMEMORY;                  return E_OUTOFMEMORY;
# Line 409  Line 418 
418    
419          switch(iPosition)          switch(iPosition)
420          {          {
421    
422          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:  
423  if ( USE_YUY2 )  if ( USE_YUY2 )
424  {  {
425                  vih->bmiHeader.biCompression = MEDIASUBTYPE_YUY2.Data1;                  vih->bmiHeader.biCompression = MEDIASUBTYPE_YUY2.Data1;
# Line 433  Line 427 
427                  mtOut->SetSubtype(&MEDIASUBTYPE_YUY2);                  mtOut->SetSubtype(&MEDIASUBTYPE_YUY2);
428                  break;                  break;
429  }  }
430          case 3 :          case 1 :
431  if ( USE_YVYU )  if ( USE_YVYU )
432  {  {
433                  vih->bmiHeader.biCompression = MEDIASUBTYPE_YVYU.Data1;                  vih->bmiHeader.biCompression = MEDIASUBTYPE_YVYU.Data1;
# Line 441  Line 435 
435                  mtOut->SetSubtype(&MEDIASUBTYPE_YVYU);                  mtOut->SetSubtype(&MEDIASUBTYPE_YVYU);
436                  break;                  break;
437  }  }
438          case 4 :          case 2 :
439  if ( USE_UYVY )  if ( USE_UYVY )
440  {  {
441                  vih->bmiHeader.biCompression = MEDIASUBTYPE_UYVY.Data1;                  vih->bmiHeader.biCompression = MEDIASUBTYPE_UYVY.Data1;
# Line 449  Line 443 
443                  mtOut->SetSubtype(&MEDIASUBTYPE_UYVY);                  mtOut->SetSubtype(&MEDIASUBTYPE_UYVY);
444                  break;                  break;
445  }  }
446            case 3  :
447                    if ( USE_IYUV )
448    {
449                    vih->bmiHeader.biCompression = CLSID_MEDIASUBTYPE_IYUV.Data1;
450                    vih->bmiHeader.biBitCount = 12;
451                    mtOut->SetSubtype(&CLSID_MEDIASUBTYPE_IYUV);
452                    break;
453    }
454            case 4  :
455    if ( USE_YV12 )
456    {
457                    vih->bmiHeader.biCompression = MEDIASUBTYPE_YV12.Data1;
458                    vih->bmiHeader.biBitCount = 12;
459                    mtOut->SetSubtype(&MEDIASUBTYPE_YV12);
460                    break;
461    }
462          case 5 :          case 5 :
463  if ( USE_RGB32 )  if ( USE_RGB32 )
464  {  {
# Line 487  Line 497 
497    
498          vih->bmiHeader.biSizeImage = GetBitmapSize(&vih->bmiHeader);          vih->bmiHeader.biSizeImage = GetBitmapSize(&vih->bmiHeader);
499    
500            if (ar_x != 0 && ar_y != 0) {
501                    vih->dwPictAspectRatioX = ar_x;
502                    vih->dwPictAspectRatioY = ar_y;
503            } else { // just to be safe
504                    vih->dwPictAspectRatioX = m_create.width;
505                    vih->dwPictAspectRatioY = m_create.height;
506            }
507    
508          mtOut->SetType(&MEDIATYPE_Video);          mtOut->SetType(&MEDIATYPE_Video);
509          mtOut->SetFormatType(&FORMAT_VideoInfo);          mtOut->SetFormatType(&FORMAT_VideoInfo2);
510          mtOut->SetTemporalCompression(FALSE);          mtOut->SetTemporalCompression(FALSE);
511          mtOut->SetSampleSize(vih->bmiHeader.biSizeImage);          mtOut->SetSampleSize(vih->bmiHeader.biSizeImage);
512    
# Line 687  Line 705 
705          if (pIn->IsDiscontinuity() == S_OK)          if (pIn->IsDiscontinuity() == S_OK)
706                  m_frame.general = XVID_DISCONTINUITY;                  m_frame.general = XVID_DISCONTINUITY;
707    
708          if (PPSettings.bDeblock_Y)          if (PPSettings.nDeblock_Y)
709                  m_frame.general |= XVID_DEBLOCKY;                  m_frame.general |= XVID_DEBLOCKY;
710    
711          if (PPSettings.bDeblock_UV)          if (PPSettings.nDeblock_UV)
712                  m_frame.general |= XVID_DEBLOCKUV;                  m_frame.general |= XVID_DEBLOCKUV;
713  /*  /*
714          if (PPSettings.bDering)          if (PPSettings.nDering)
715                  m_frame.general |= XVID_DERING;                  m_frame.general |= XVID_DERING;
716  */  */
717          if (PPSettings.bFilmEffect)          if (PPSettings.nFilmEffect)
718                  m_frame.general |= XVID_FILMEFFECT;                  m_frame.general |= XVID_FILMEFFECT;
719    
         if (PPSettings.bFlipVideo) {  
                 if (rgb_flip)  
720                          m_frame.output.csp &= ~XVID_CSP_VFLIP;                          m_frame.output.csp &= ~XVID_CSP_VFLIP;
721                  else          m_frame.output.csp |= rgb_flip^(PPSettings.nFlipVideo ? 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;  
         }  
722    
723  repeat :  repeat :
724    

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

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