List Info

Thread: CR: ColorKey and Color Controls fixes/work.




CR: ColorKey and Color Controls fixes/work.
country flaguser name
United States
2007-03-08 15:44:42
Project
=======
Atlas and presentation features demo.

Synopsis
========
The new presentation features demo (complicated SMIL) was
having
trouble showing the video sometimes if overlays where on.

Also, I added some support for addition color control work.
This
will be used by my diffs to splay to add keyboard support
for
color controls.

Fix
===
Unix has never used the FillColorKey() routine used by
other
platforms since XVideo will automatically fill in the color
key
for you. However, it appears that with very complicated
presentations,
it can sometimes get confused and do the wrong thing. So, I
am turning
on usage of that routine for unix now. This should not
affect performance
since we do not fill the color key except when we really
have to.

I removed some debug printfs that are now noisy because of
the above
change.

I fixed a problem when we checked for hardware color
controls. There is
still some work to be done here. It all works fine for
simple video,
but for the presentation feature demo, it is hard to
determine which
YUV site is going to get the overlay and hardware color
controls. I
can still looking into that, but with this diff it is still
better then
it was.


Files Modified
==============
video/sitelib/basesurf.cpp
video/sitelib/platform/unix/unixsite.cpp
video/sitelib/platform/unix/unixsurf.cpp

Branch(s)
=========
HEAD only.


--greg.





Index: basesurf.cpp
============================================================
=======
RCS file: /cvsroot/video/sitelib/basesurf.cpp,v
retrieving revision 1.30
diff -u -w -r1.30 basesurf.cpp
--- basesurf.cpp	27 Jan 2007 00:42:57 -0000	1.30
+++ basesurf.cpp	8 Mar 2007 21:34:21 -0000
 -3720,12
+3720,22 
          return;

      m_bNeedColorKeyFilled = FALSE;
+
      //XXXgfw, this is not needed on unix because our
overlay support
      //automatically fills the window with the color
key....

+    //XXXgfw Well, this turns out to be mostly true. With
our new fancy
+    //presentation-feature SMIL demo we have a problem
where the video can not
+    //be seen until you see the player. This is the only
case I have seen where
+    //the automatic drawing of the color key by X11 is not
sufficient. So, I am
+    //enabling the color-key rectangle-fill code below. I
may also turn off the
+    //auto-color-key-fill code in XVideo so that we don't
have 2 different
+    //pieces of code blt'ing the color key at the same
time.
+
+
  //XXXgfw when we have time we should make this work in a
more
  //cross platform way.
-#if !defined(_UNIX) || defined(_MAC_UNIX)
+//#if !defined(_UNIX) || defined(_MAC_UNIX)
      CBaseRootSurface* pSurface =
m_pSite->GetRootSurface();

      pSurface->LockCompMutex();
 -3747,10
+3757,10 
          FillColorKey(hdc);
          _ReleaseDC(pWindow, hdc);
      }
-#else
+//#else
      //Unix fillcolorkey here....
      //_UnixFillColorKey();
-#endif
+//#endif
  }

  INT32 CBaseSurface::GetOverlayColor()
Index: platform/unix/unixsite.cpp
============================================================
=======
RCS file:
/cvsroot/video/sitelib/platform/unix/unixsite.cpp,v
retrieving revision 1.15
diff -u -w -r1.15 unixsite.cpp
--- platform/unix/unixsite.cpp	26 Feb 2007 10:10:15
-0000	1.15
+++ platform/unix/unixsite.cpp	8 Mar 2007 21:34:21 -0000
 -1328,7
+1328,6 
  #if !defined(HELIX_FEATURE_HARDWARE_COLOR_CONTROLS)
      CHXBaseSite::CheckColorSettings();
  #else
-
      CUnixSurf* pSurf = (CUnixSurf*)m_pVideoSurface;
      if( !pSurf->HasHWColorConrols() )
      {
 -1336,12
+1335,6 
      }
      else
      {
-        if (m_pParentSite)
-        {
-            m_pParentSite->CheckColorSettings();
-        }
-        else
-        {
              pSurf->SetHWColorControls();

              //We do all color stuff except sharpmess in
hardware.
 -1354,7
+1347,6 
                 
zm_pColorAcc->SetSharpnessAdjustments(m_fSharpness,
FALSE);
              }
          }
-    }
  #endif
  }

Index: platform/unix/unixsurf.cpp
============================================================
=======
RCS file:
/cvsroot/video/sitelib/platform/unix/unixsurf.cpp,v
retrieving revision 1.9
diff -u -w -r1.9 unixsurf.cpp
--- platform/unix/unixsurf.cpp	7 Mar 2007 20:27:37
-0000	1.9
+++ platform/unix/unixsurf.cpp	8 Mar 2007 21:34:21 -0000
 -64,6
+64,7 
  #include "unixsite.h"
  #include "basesite.h"
  #include "shmhelp.h"
+#include "hxprefutil.h"

  #if defined(_LINUX) && defined(_OVERLAY)
  #include "hxprefs.h"
 -661,6
+662,7 
                  m_atomContrast   = XInternAtom(m_display,
"XV_CONTRAST", True);
                  m_atomHue        = XInternAtom(m_display,
"XV_HUE", True);
                  m_atomSaturation = XInternAtom(m_display,
"XV_SATURATION", True);
+
                  //Get the min and max values for each
settable atom.
                  int nNumAttributes = 0;
                  XvAttribute* pPAList =
XvQueryPortAttributes( m_display,
 -752,9
+754,6 

  void CUnixSurf::_SetupDCObjects(HXxDC hxxDC, void**
phOldBrush, void** phOldPen)
  {
-#ifdef _DEBUG
-    fprintf( stderr, "CUnixSurf::_SetupDCObjects needs
to be written.n" );
-#endif
  }

  void CUnixSurf::_FillRectangle(HXxDC hxxDC,
 -776,9
+775,6 

  void CUnixSurf::_RestoreDCObjects(HXxDC hxxDC, void*
hOldBrush, void* hOldPen)
  {
-#ifdef _DEBUG
-    fprintf( stderr, "CUnixSurf::_RestoreDCObjects
needs to be written.n" );
-#endif
  }

  void CUnixSurf::_GetCompositionSurfaceHXxDC(HXxDC *hdc)
 -834,7
+830,7 
  #if defined(HELIX_FEATURE_HARDWARE_COLOR_CONTROLS)
  inline int _scaleIt( float v, stPortAttribute at )
  {
-    int nRetVal =
(int)(((v+1)*(at.nMaxValue-at.nMinValue))/2+at.nMinValue);
+    int nRetVal =
(int)((v+1.0f/2.0f)*(at.nMaxValue-at.nMinValue))+at.nMinValu
e;
      if( nRetVal < at.nMinValue )
          nRetVal = at.nMinValue;
      if( nRetVal > at.nMaxValue )
 -862,6
+858,25 
      float fContrast   = m_pSite->GetContrast();
      float fHue        = m_pSite->GetHue();
      float fSaturation = m_pSite->GetSaturation();
+
+    //Set this pref to force all of the above values back
to some 'normal'
+    //state. This is useful if you have a player, like
splay, the does not
+    //provide controls to adjust these values. All values
are in [-1,1].  A good
+    //rule of thumb is to set them all to zero except hue,
which you set to 1.
+    //But, this could change just depending on graphics
card and driver. To see
+    //what current settings are or to see what you driver
supports, just type
+    //'xvinfo' at a prompt.
+    HXBOOL bResetCC = FALSE;
+    ReadPrefBOOL( m_pContext,
"ResetColorControls", bResetCC );
+    if( bResetCC )
+    {
+        ReadPrefFLOAT(m_pContext, "Brightness",
fBright );
+        ReadPrefFLOAT(m_pContext, "Contrast",  
fContrast );
+        ReadPrefFLOAT(m_pContext, "Hue",       
fHue );
+        ReadPrefFLOAT(m_pContext, "Saturation",
fSaturation );
+    }
+
+
      if( None != m_atomBrightness )
      {
          int nVal = _scaleIt( fBright, paBrightness);
 -1123,9
+1138,6 

  void CUnixSurf::_ReleaseDC(HXxWindow*, HXxDC)
  {
-#ifdef _DEBUG
-    fprintf( stderr, "CUnixSurf::_ReleaseDC needs to
be written.n" );
-#endif
  }

  void CUnixSurf::_GetWindowDeviceCords(HXxRect* rect )

_______________________________________________
Video-dev mailing list
Video-devhelixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/video
-dev

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )