Welcome to mirror list, hosted at ThFree Co, Russian Federation.

uberblit_interlace.h « h « Kasumi « VirtualDub « thirdparty « src - github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 23adaa76b3578fbd718d57b528415ae6de058468 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
//	VirtualDub - Video processing and capture application
//	Graphics support library
//	Copyright (C) 1998-2009 Avery Lee
//
//	This program is free software; you can redistribute it and/or modify
//	it under the terms of the GNU General Public License as published by
//	the Free Software Foundation; either version 2 of the License, or
//	(at your option) any later version.
//
//	This program is distributed in the hope that it will be useful,
//	but WITHOUT ANY WARRANTY; without even the implied warranty of
//	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//	GNU General Public License for more details.
//
//	You should have received a copy of the GNU General Public License
//	along with this program; if not, write to the Free Software
//	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

#ifndef f_VD2_KASUMI_UBERBLIT_INTERLACE_H
#define f_VD2_KASUMI_UBERBLIT_INTERLACE_H

#include "uberblit_base.h"

class VDPixmapGen_SplitFields : public IVDPixmapGen {
public:
	void AddWindowRequest(int minDY, int maxDY) {
		mpSrc->AddWindowRequest(minDY*2, maxDY*2+1);
	}

	void Start() {
		mpSrc->Start();
	}

	sint32 GetWidth(int) const { return mWidth; }
	sint32 GetHeight(int idx) const { return mHeight[idx]; }

	bool IsStateful() const {
		return false;
	}

	uint32 GetType(uint32 output) const {
		return mpSrc->GetType(mSrcIndex);
	}

	const void *GetRow(sint32 y, uint32 index) {
		return mpSrc->GetRow(y+y+index, mSrcIndex);
	}

	void ProcessRow(void *dst, sint32 y) {
		memcpy(dst, GetRow(y, 0), mBpr);
	}

	void Init(IVDPixmapGen *src, uint32 srcindex, uint32 bpr) {
		mpSrc = src;
		mSrcIndex = srcindex;
		mBpr = bpr;
		mWidth = src->GetWidth(srcindex);

		uint32 h = src->GetHeight(srcindex);
		mHeight[0] = (h + 1) >> 1;
		mHeight[1] = h >> 1;
	}

protected:
	IVDPixmapGen *mpSrc;
	uint32 mSrcIndex;
	sint32 mWidth;
	sint32 mHeight[2];
	uint32 mBpr;
};

class VDPixmapGen_MergeFields : public IVDPixmapGen {
public:
	void AddWindowRequest(int minDY, int maxDY) {
		mpSrc[0]->AddWindowRequest(minDY >> 1, maxDY >> 1);
		mpSrc[1]->AddWindowRequest(minDY >> 1, maxDY >> 1);
	}

	void Start() {
		mpSrc[0]->Start();
		mpSrc[1]->Start();
	}

	sint32 GetWidth(int) const { return mWidth; }
	sint32 GetHeight(int) const { return mHeight; }

	bool IsStateful() const {
		return false;
	}

	uint32 GetType(uint32 output) const {
		return mpSrc[0]->GetType(mSrcIndex[0]);
	}

	const void *GetRow(sint32 y, uint32 index) {
		int srcIndex = y & 1;
		return mpSrc[srcIndex]->GetRow(y >> 1, mSrcIndex[srcIndex]);
	}

	void ProcessRow(void *dst, sint32 y) {
		memcpy(dst, GetRow(y, 0), mBpr);
	}

	void Init(IVDPixmapGen *src1, uint32 srcindex1, IVDPixmapGen *src2, uint32 srcindex2, uint32 w, uint32 h, uint32 bpr) {
		mpSrc[0] = src1;
		mpSrc[1] = src2;
		mSrcIndex[0] = srcindex1;
		mSrcIndex[1] = srcindex2;

		mWidth = w;
		mHeight = h;
		mBpr = bpr;
	}

protected:
	IVDPixmapGen *mpSrc[2];
	uint32 mSrcIndex[2];
	sint32 mWidth;
	sint32 mHeight;
	uint32 mBpr;
};

#endif