⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cresizer.h

📁 视频放大或缩小的滤波器
💻 H
字号:
 #include <math.h>

class CResizer : public CTransformFilter,
		  public IResizer,
		  public ISpecifyPropertyPages
{
public:

	static CUnknown * WINAPI CreateInstance(LPUNKNOWN punk, HRESULT *phr);

	STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv);

	DECLARE_IUNKNOWN;

    HRESULT Transform(IMediaSample *pIn, IMediaSample *pOut);
    HRESULT CheckInputType(const CMediaType *mtIn);
	HRESULT CheckOutputType (const CMediaType* mtOut);
    HRESULT CheckTransform(const CMediaType *mtIn,const CMediaType *mtOut);
    HRESULT GetMediaType(int iPosition, CMediaType *pMediaType);
    HRESULT DecideBufferSize(IMemAllocator *pAlloc,
                             ALLOCATOR_PROPERTIES *pProperties);
		// Informs when the media type is established for the connection. 
	virtual HRESULT SetMediaType (PIN_DIRECTION direction, const CMediaType* mediaType);

	STDMETHODIMP set_VideoSize(int nWidth,int nHeight);
	STDMETHODIMP get_VideoSize(int &nWidth,int &nHeight);
    STDMETHODIMP notuse2(void);
/*	
	STDMETHODIMP GetFormat(AM_MEDIA_TYPE **pmt);
	STDMETHODIMP SetFormat(AM_MEDIA_TYPE *pmt);
	STDMETHODIMP GetNumberOfCapabilities(int *piCount, int *piSize);
	STDMETHODIMP GetStreamCaps(int iIndex, AM_MEDIA_TYPE **pmt, BYTE *pSCC);
*/
	// ISpecifyPropertyPages method
	STDMETHODIMP GetPages(CAUUID *pPages);

	int	m_width_set;
	int m_height_set;

private:

	// set input media type
	HRESULT SetInputMediaType (const CMediaType* mediaType);

	// set output media type
	HRESULT SetOutputMediaType (const CMediaType* mediaType);

	// Prepares the output sample
	HRESULT PrepareOutputSample (IMediaSample* inSample, IMediaSample* outSample);
	
// secret

	// describe incoming video

	// describe outgoing video
	CMediaType			outputMediaType;

    // Constructor
    CResizer(TCHAR *tszName, LPUNKNOWN punk, HRESULT *phr);
	~CResizer();
	int output_width , output_height;
	int input_width , input_height ;
};

class TriangleFilter //: public ResamplingFunction 
{
public:
  double f(double x) {
    x = fabs(x);
    return (x<1.0) ? 1.0-x : 0.0;
  }
  double support() { return 1.0; }
};

class FilteredResizeH 
{
  int* /*const*/ pattern_luma;
  int* /*const*/ pattern_chroma;
  int original_width;
  unsigned char *tempY, *tempUV;
  int width;
  int height;
  int m_YUV;
public:
  FilteredResizeH(int isYUV, int wi, int he, double subrange_left, double subrange_width, int target_width, TriangleFilter* func);
  void ResizeFrame(unsigned char* srcp, unsigned char* dstp, int src_pitch, int dst_pitch); 
  ~FilteredResizeH();
};

class FilteredResizeV  
{
  int* resampling_pattern;
  int *yOfs;
  int width;
  int height;
  int m_YUV;
public:
  FilteredResizeV(int isYUV,int wi, int he, int subrange_top, int subrange_height, int target_height, TriangleFilter* func);
  void ResizeFrame(unsigned char* srcp, unsigned char* dstp, int src_pitch, int dst_pitch, int row_size);
  ~FilteredResizeV();
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -