home *** CD-ROM | disk | FTP | other *** search
- //==========================================================================;
- //
- // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
- // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
- // PURPOSE.
- //
- // Copyright (c) 1992 - 1996 Microsoft Corporation. All Rights Reserved.
- //
- //--------------------------------------------------------------------------;
- //
- // Contrast
- //
- // CTransformFilter derived. Alters the contrast of the supplied video image.
-
- //
- // For performance reasons currently works on palettised data only.
-
-
-
- const signed char MaxContrastLevel = 127;
- const signed char MinContrastLevel = -127;
-
- //
- // CContrast
- //
- class CContrast : public CTransformFilter,
- public IContrast,
- public ISpecifyPropertyPages {
-
- public:
-
- //
- // --- COM Stuff ---
- //
-
- static CUnknown *CreateInstance(LPUNKNOWN punk, HRESULT *phr);
-
- // Reveals IContrast & ISpecifyPropertyPages
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv);
-
- DECLARE_IUNKNOWN;
-
-
- //
- // --- CTransformFilter Overrides --
- //
-
- HRESULT Transform(IMediaSample *pIn, IMediaSample *pOut);
- HRESULT CheckInputType(const CMediaType *mtIn);
- HRESULT CheckTransform(const CMediaType *mtIn,const CMediaType *mtOut);
- HRESULT GetMediaType(int iPosition, CMediaType *pMediaType);
- HRESULT DecideBufferSize(IMemAllocator *pAlloc,
- ALLOCATOR_PROPERTIES *pProperties);
-
-
- //
- // --- IContrast ---
- //
-
- STDMETHODIMP get_ContrastLevel(signed char *ContrastLevel);
- STDMETHODIMP put_ContrastLevel(signed char ContrastLevel, unsigned long ChangeTime);
- STDMETHODIMP put_DefaultContrastLevel(void);
-
-
- //
- // --- ISpecifyPropertyPages ---
- //
-
- STDMETHODIMP GetPages(CAUUID *pPages);
-
- // setup helper
- LPAMOVIESETUP_FILTER GetSetupData();
-
- private:
-
- CContrast(TCHAR *tszName, LPUNKNOWN punk, HRESULT *phr);
-
- BOOL CanChangeContrastLevel(const CMediaType *pMediaType) const;
-
- HRESULT Copy(IMediaSample *pSource, IMediaSample *pDest) const;
- HRESULT Transform(IMediaSample *pMediaSample);
-
- HRESULT Transform(AM_MEDIA_TYPE *pType, const signed char ContrastLevel) const;
-
- void IncreaseContrast(RGBQUAD *pElem, const int Low, const int High, const float Grad) const;
- void IncreaseContrast(BYTE *pByte, const int Low, const int High, const float Grad) const;
- void DecreaseContrast(RGBQUAD *pElem, const int Level, const float Grad) const;
- void DecreaseContrast(BYTE *pByte, const int Level, const float Grad) const;
-
- CCritSec m_ContrastLock;
-
- const signed char m_DefaultContrastLevel; // the default (no-change) level
- signed char m_ContrastLevel; // The current level to set the palette to.
- signed char m_PrevLevel; // the level the last frame's palette was set at
-
- const long m_lBufferRequest; // the number of buffers to request on the output allocator
-
- };
-