Debian Codegraph @

src/shaders/h264/mc/initialize_MBPara.asm

raw
1 /*
2 * Initialize parameters
3 * Copyright © <2010>, Intel Corporation.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sub license, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial portions
15 * of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
20 * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
21 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 *
25 * This file was originally licensed under the following license
26 *
27 * Licensed under the Apache License, Version 2.0 (the "License");
28 * you may not use this file except in compliance with the License.
29 * You may obtain a copy of the License at
30 *
31 * http://www.apache.org/licenses/LICENSE-2.0
32 *
33 * Unless required by applicable law or agreed to in writing, software
34 * distributed under the License is distributed on an "AS IS" BASIS,
35 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
36 * See the License for the specific language governing permissions and
37 * limitations under the License.
38 *
39 */
40 // Kernel name: Initialize_MBPara.asm
41 //
42
43
44 //#if !defined(__INITIALIZE_MBPARA__) // Make sure this is only included once
45 //#define __INITIALIZE_MBPARA__
46
47
48 // WA for weighted prediction - 2007/09/06 // shlee
49 // mov (1) guwW128(0)<1> guwR1(0)<0;1,0> // Copy the unique number indicating weight/offset=(128,0)
50
51
52
53 // MB Type Category
54 // 1 B_L0_16x16
55 // 2 B_L1_16x16
56 // 3 B_Bi_16x16
57 // 4 B_L0_L0_16x8
58 // 5 B_L0_L0_8x16
59 // 6 B_L1_L1_16x8
60 // 7 B_L1_L1_8x16
61 // 8 B_L0_L1_16x8
62 // 9 B_L0_L1_8x16
63 // 10 B_L1_L0_16x8
64 // 11 B_L1_L0_8x16
65 // 12 B_L0_Bi_16x8
66 // 13 B_L0_Bi_8x16
67 // 14 B_L1_Bi_16x8
68 // 15 B_L1_Bi_8x16
69 // 16 B_Bi_L0_16x8
70 // 17 B_Bi_L0_8x16
71 // 18 B_Bi_L1_16x8
72 // 19 B_Bi_L1_8x16
73 // 20 B_Bi_Bi_16x8
74 // 21 B_Bi_Bi_8x16
75 // 22 B_8x8
76
77 // TODO:
78 // Initialize interpolation area to eliminate uninitialized registers making the results of mac instructions XX.
79 // This issue was reported by Sharath on 5/25/2006, and why multiplication by zero still yields XX has not been understood yet.
80 #if 0
81 mov (16) gudINTPY0(0)<1> 0:ud {Compr}
82 mov (16) gudINTPY0(2)<1> 0:ud {Compr}
83 mov (16) gudINTPY1(0)<1> 0:ud {Compr}
84 mov (16) gudINTPY1(2)<1> 0:ud {Compr}
85 mov (16) gudINTPC0(0)<1> 0:ud {Compr}
86 mov (16) gudINTPC1(0)<1> 0:ud {Compr}
87 #endif
88
89 mov (1) gMVSTEP:w 0:w // Address increament for MV read
90
91 cmp.e.f0.0 (1) null:w gwMBTYPE<0;1,0> 22:w
92 (-f0.0) jmpi INTERLABEL(NOT_8x8_MODE)
93
94 //--- 8x8 mode
95
96 // Starting address of error data blocks
97 cmp.e.f0.1 (2) null<1>:w gSUBMB_SHAPE<0;1,0>:ub 0:w
98 (f0.1) jmpi INTERLABEL(CONVERT_MVS)
99
100 // Note: MVs and Weights/Offsets are already expanded by HW or driver
101
102 // MV conversion - Convert each MV to absolute coord. (= MV + MB org. + block offset)
103 shl (16) gwTEMP(0)<1> gX<0;2,1>:w 2:w // Convert MB origin to 1/4-pel unit
104 mov (1) gMVSTEP:w 24:w // Address increament for MV read
105 add (2) gwTEMP(0,4)<2> gwTEMP(0,4)<4;2,2> 16:w
106 add (2) gwTEMP(0,9)<2> gwTEMP(0,9)<4;2,2> 16:w
107 add (4) gwTEMP(0,12)<1> gwTEMP(0,12)<4;4,1> 16:w
108
109 add (16) gMV<1>:w gMV<16;16,1>:w gwTEMP(0)<16;16,1>
110 add (8) gwTEMP(0)<2> gwTEMP(0)<16;8,2> 32:w
111 add (16) gwMV(1,0)<1> gwMV(1,0)<16;16,1> gwTEMP(0)<16;16,1>
112 add (8) gwTEMP(0,1)<2> gwTEMP(0,1)<16;8,2> 32:w
113 add (16) gwMV(3,0)<1> gwMV(3,0)<16;16,1> gwTEMP(0)<16;16,1>
114 add (8) gwTEMP(0)<2> gwTEMP(0)<16;8,2> -32:w
115 add (16) gwMV(2,0)<1> gwMV(2,0)<16;16,1> gwTEMP(0)<16;16,1>
116
117 jmpi INTERLABEL(INIT_ADDRESS_REGS)
118
119 INTERLABEL(NOT_8x8_MODE):
120
121 //--- !8x8 mode (16x16, 16x8, 8x16)
122
123 // MVs and Weights/Offsets are expanded
124 cmp.le.f0.1 (8) null<1>:w gwMBTYPE<0;1,0> 3:w // Check 16x16
125 mov (1) gSUBMB_SHAPE:ub 0:uw // subMB shape
126 (f0.1) mov (8) gMV<1>:d gMV<0;2,1>:d
127 (f0.1) mov (8) gdWGT(1,0)<1> gWGT<0;4,1>:d
128 (f0.1) mov (4) gdWGT(0,4)<1> gWGT<4;4,1>:d
129
130 INTERLABEL(CONVERT_MVS):
131 // MV conversion - Convert each MV to absolute coord. (= MV + MB org. + block offset)
132 shl (2) gwTEMP(0)<1> gX<2;2,1>:w 2:w // Convert MB origin to 1/4-pel unit
133 add (16) gMV<1>:w gMV<16;16,1>:w gwTEMP(0)<0;2,1>
134 add (2) gwMV(0,4)<2> gwMV(0,4)<4;2,2> 32:w //{NoDDClr}
135 add (2) gwMV(0,9)<2> gwMV(0,9)<4;2,2> 32:w //{NoDDChk,NoDDClr}
136 add (4) gwMV(0,12)<1> gwMV(0,12)<4;4,1> 32:w //{NoDDChk}
137
138 INTERLABEL(INIT_ADDRESS_REGS):
139 // Initialize the address registers
140 mov (2) pERRORYC:ud nOFFSET_ERROR:ud {NoDDClr} // Address of Y and C error blocks
141 mov (1) pRECON_MV:ud nOFFSET_RECON_MV:ud {NoDDChk,NoDDClr} // Address of recon area and motion vectors
142 mov (1) pWGT_BIDX:ud nOFFSET_WGT_BIDX:ud {NoDDChk} // Address of weights/offsets and binding tbl idx
143
144 // Read the parity of the current field (gPARITY - 0:top, 1:bottom, 3:frame)
145 // and set message descriptor for frame/field write
146 #if defined(MBAFF)
147 and.nz.f0.0 (1) null:uw gFIELDMBFLAG:ub nFIELDMB_MASK:uw
148 (f0.0) and (1) gPARITY:uw gMBPARITY:ub nMBPARITY_MASK:uw
149 (-f0.0) mov (1) gPARITY:uw 3:uw
150 #elif defined(FIELD)
151 and (1) gPARITY:uw gMBPARITY:ub nMBPARITY_MASK:uw
152 #endif
153
154
155 //#endif // !defined(__INITIALIZE_MBPARA__)