Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5361 serge 1
/*
2
 * Copyright © <2010>, Intel Corporation.
3
 *
4
 * This program is licensed under the terms and conditions of the
5
 * Eclipse Public License (EPL), version 1.0.  The full text of the EPL is at
6
 * http://www.opensource.org/licenses/eclipse-1.0.php.
7
 *
8
 */
9
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
10
// AVC Child Kernel (Vertical and horizontal de-block a 4:2:0 MB Y comp)
11
//
12
// First, de-block vertical edges from left to right.
13
// Second, de-block horizontal edge from top to bottom.
14
//
15
//	***** MBAFF Mode *****
16
//	This version deblocks top MB first, followed by bottom MB.
17
//
18
//	Need variable CurMB	to indicate top MB or bottom MB (CurMB = 0 or 1).
19
//	We can use BotFieldFlag in BitFields to represent it.
20
//
21
//  Usage:
22
// 	1) Access control data for top
23
//		CntrlDataOffsetY + CurMB  * Control data block size		(64 DWs for CL, 16 DWs for BLC)
24
//
25
// 	2) Load frame/field video data based on flags: FieldModeCurrentMbFlag, FieldModeLeftMbFlag, FieldModeaboveMbFlag,
26
//
27
//	E.g.
28
//	if (pCntlData->BitField & FieldModeCurrentMbFlag)
29
//		cur_y = ORIX_CUR.y + CurMB * 1;				// Add field vertical offset for bot field MB .
30
//	else
31
//		cur_y = ORIX_CUR.y + CurMB * MB_Rows_Y;		// Add bottom MB vertical offset for bot MB
32
//
33
//
34
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
35
#define AVC_ILDB
36
 
37
.kernel AVC_ILDB_CHILD_MBAFF_Y
38
#if defined(COMBINED_KERNEL)
39
ILDB_LABEL(AVC_ILDB_CHILD_Y):
40
#endif
41
 
42
#include "SetupVPKernel.asm"
43
#include "AVC_ILDB.inc"
44
 
45
#if defined(_DEBUG)
46
	mov		(1)		EntrySignatureC:w			0xE998:w
47
#endif
48
 
49
	// Setup temp buf used by load and save code
50
	#define BUF_B		RTempB
51
	#define BUF_D		RTempD
52
 
53
	// Init local variables
54
	// These coordinates are in progressive fashion
55
	mul (4)		ORIX_CUR<2>:w		ORIX<0;1,0>:w		16:w	{ NoDDClr }		// Expand X addr to bytes, repeat 4 times
56
	mul (4)		ORIY_CUR<2>:w		ORIY<0;1,0>:w		32:w	{ NoDDChk }		// Expand Y addr to bytes, repeat 4 times
57
 
58
	mov (2)		f0.0<1>:w		0:w
59
 
60
	mov	(1)		GateWayOffsetC:uw	ORIY:uw						// Use row # as Gateway offset
61
 
62
	//=== Null Kernel ===============================================================
63
//	jmpi POST_ILDB
64
	//===============================================================================
65
 
66
	//====================================================================================
67
	// Assuming the MB control data is laid out in scan line order in a rectangle with width = 16 bytes.
68
	// Control data has dimension of X x Y = 16 x N bytes, where N = W x H / 16
69
	// Each MB has 256 bytes of control data
70
 
71
	// For CRESTLINE, 256 bytes are stored in memory and fetched into GRF.
72
	// MB_offset = MBsCntX * CurRow + CurCol
73
	// Byte_offset = MB_offset * (256 << Mbaff_flag),	Mbaff_flag = 0 or 1.
74
	// Base address of a control data block = (x, y) = (0, y'=y/x), region width is 16 bytes
75
	// where y' = Byte_offset / 16 = MB_offset * (16 << Mbaff_flag)
76
	// MBCntrlDataOffsetY holds y'.
77
 
78
	// For BearLake-C, 64 bytes are stored in memory and dataport expands to 256 bytes.  Need to use a special read command on BL-C.
79
	// MB_offset = MBsCntX * CurRow + CurCol
80
	// Byte_offset = MB_offset * (64 << Mbaff_flag),	Mbaff_flag = 0 or 1.
81
	// MBCntrlDataOffsetY holds globel byte offset.
82
 
83
#if !defined(DEV_CL)
84
	mul (1) CntrlDataOffsetY:ud		MBsCntX:w 				ORIY:w
85
	add (1) CntrlDataOffsetY:ud		CntrlDataOffsetY:ud		ORIX:w
86
	mul (1) CntrlDataOffsetY:ud		CntrlDataOffsetY:ud		128:uw
87
#endif
88
 
89
	//====================================================================================
90
 
91
	add (1)		ORIX_LEFT:w			ORIX_LEFT:w			-4:w
92
	add (1)		ORIY_TOP:w			ORIY_TOP:w			-4:w
93
 
94
 
95
	//=========== Process Top MB ============
96
    and (1)  	BitFields:w  		BitFields:w		TopFieldFlag:w	// Reset BotFieldFlag
97
 
98
RE_ENTRY:	// for bootom field
99
 
100
	// Load current MB control data
101
#if defined(DEV_CL)
102
	#include "Load_ILDB_Cntrl_Data_64DW.asm"	// Crestline
103
#else
104
	#include "Load_ILDB_Cntrl_Data_16DW.asm"	// Cantiga and beyond
105
#endif
106
 
107
	// Init addr register for vertical control data
108
	mov (1)		ECM_AddrReg<1>:w	CNTRL_DATA_BASE:w			// Init edge control map AddrReg
109
 
110
	// Check loaded control data
111
	and.z.f0.1  (16) null<1>:uw	r[ECM_AddrReg, wEdgeCntlMap_IntLeftVert]<16;16,1>:uw	0xFFFF:uw		// Skip ILDB?
112
	and.nz.f0.0  (1) null:w		r[ECM_AddrReg, ExtBitFlags]:ub		DISABLE_ILDB_FLAG:w		// Skip ILDB?
113
 
114
	// Use free cycles here
115
	// Set DualFieldMode for all data read, write and deblocking
116
	and	(1)	CTemp1_W:uw		r[ECM_AddrReg, BitFlags]:ub		FieldModeAboveMbFlag+FieldModeCurrentMbFlag:uw
117
 
118
	// Get Vert Edge Pattern (frame vs. field MBs)
119
	and	(1)	VertEdgePattern:uw		r[ECM_AddrReg, BitFlags]:ub		FieldModeLeftMbFlag+FieldModeCurrentMbFlag:uw
120
 
121
	(f0.1.all16h)	jmpi 	SKIP_ILDB						// Skip ILDB
122
	(f0.0)			jmpi 	SKIP_ILDB						// Skip ILDB
123
 
124
	// Set DualFieldMode for all data read, write and deblocking
125
//	and	(1)	CTemp1_W:uw		r[ECM_AddrReg, BitFlags]:ub		FieldModeAboveMbFlag+FieldModeCurrentMbFlag:uw
126
	cmp.z.f0.0	(1)	null:w	CTemp1_W:uw		ABOVE_FIELD_CUR_FRAME:w
127
	and (1)		DualFieldMode:w		f0.0:w		0x0001:w
128
 
129
	// Load current MB 				// DDD1
130
	#include "load_Cur_Y_16x16T_Mbaff.asm"				// Load cur Y, 16x16, transpose
131
	#include "load_Left_Y_4x16T_Mbaff.asm"				// Load left MB (4x16) Y data from memory if exists
132
 
133
	#include "Transpose_Cur_Y_16x16.asm"
134
	#include "Transpose_Left_Y_4x16.asm"
135
 
136
	//---------- Perform vertical ILDB filting on Y----------
137
	#include "AVC_ILDB_Filter_Mbaff_Y_v.asm"
138
	//-------------------------------------------------------
139
 
140
	#include "save_Left_Y_16x4T_Mbaff.asm"				// Write left MB (4x16) Y data to memory if exists
141
	#include "load_Top_Y_16x4_Mbaff.asm"				// Load top MB (16x4) Y data from memory if exists
142
	#include "Transpose_Cur_Y_16x16.asm"				// Transpose a MB for horizontal edge de-blocking
143
 
144
	//---------- Perform horizontal ILDB filting on Y ----------
145
	#include "AVC_ILDB_Filter_Mbaff_Y_h.asm"
146
	//----------------------------------------------------------
147
 
148
	#include "save_Cur_Y_16x16_Mbaff.asm"					// Write cur MB (16x16)
149
	#include "save_Top_Y_16x4_Mbaff.asm"					// Write top MB (16x4) if not the top row
150
 
151
SKIP_ILDB:
152
	//----------------------------------------------------------
153
	and.z.f0.0 (1) 	null:w		BitFields:w		BotFieldFlag:w
154
 
155
	//=========== Process Bottom MB ============
156
    or (1)  	BitFields:w  	BitFields:w		BotFieldFlag:w	// Set BotFieldFlag to 1
157
	(f0.0) jmpi		RE_ENTRY								// Loop back for bottom deblocking
158
 
159
	// Fall through to finish
160
 
161
	//=========== Check write commit of the last write ============
162
    mov (8)	WritebackResponse(0)<1>		WritebackResponse(0)
163
 
164
POST_ILDB:
165
 
166
	//---------------------------------------------------------------------------
167
	// Send notification thru Gateway to root thread, update luma Status[CurRow]
168
 
169
	#include "AVC_ILDB_ForwardMsg.asm"
170
 
171
#if !defined(GW_DCN)		// For non-ILK chipsets
172
	//child send EOT : Request type = 1
173
	END_CHILD_THREAD
174
#endif	// !defined(DEV_ILK)
175
 
176
	// The thread finishs here
177
	//------------------------------------------------------------------------------
178
 
179
 
180
	////////////////////////////////////////////////////////////////////////////////
181
	// Include other subrutines being called
182
	#include "AVC_ILDB_Luma_Core_Mbaff.asm"
183
 
184
#if !defined(COMBINED_KERNEL)		// For standalone kernel only
185
.end_code
186
 
187
.end_kernel
188
#endif