Debian Codegraph @

src/shaders/post_processing/gen5_6/Common/Multiple_Loop.asm

raw
1 /*
2 * All Video Processing kernels
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
41 /////////////////////////////////////////////////////////////////////////////////
42 // Multiple_Loop.asm
43
44
45 // This lable is for satisfying component kernel build.
46 // DL will remove this label and reference the real one in Multiple_Loop_Head.asm.
47 #if defined(COMPONENT)
48 VIDEO_PROCESSING_LOOP:
49 #endif
50
51
52 //===== Possible build flags for component kernels
53 // 1) INC_SCALING
54 // 2) INC_BLENDING
55 // 3) INC_BLENDING and INC_SCALING
56 // 4) (no flags)
57
58
59 #define MxN_MULTIPLE_BLOCKS
60
61 //------------------------------------------------------------------------------
62 #if defined(MxN_MULTIPLE_BLOCKS)
63 // Do Multiple Block Processing ------------------------------------------------
64
65 // The 1st block has been processed before entering the loop
66
67 // Processed all blocks?
68 add.z.f0.0 (1) wNUM_BLKS:w wNUM_BLKS:w -1:w
69
70 // Reached multi-block width?
71 add (1) wORIX:w wORIX:w 16:w
72 cmp.l.f0.1 (1) null:w wORIX:w wFRAME_ENDX:w // acc0.0 has wORIX
73
74 #if defined(INC_SCALING)
75 // Update SRC_VID_H_ORI for scaling
76 mul (1) REG(r,nTEMP0):f fVIDEO_STEP_X:f 16.0:f
77 add (1) fSRC_VID_H_ORI:f REG(r,nTEMP0):f fSRC_VID_H_ORI:f
78 #endif
79
80 #if defined(INC_BLENDING)
81 // Update SRC_ALPHA_H_ORI for blending
82 mul (1) REG(r,nTEMP0):f fALPHA_STEP_X:f 16.0:f
83 add (1) fSRC_ALPHA_H_ORI:f REG(r,nTEMP0):f fSRC_ALPHA_H_ORI:f
84 #endif
85
86 (f0.0)jmpi (1) END_VIDEO_PROCESSING // All blocks are done - Exit loop
87
88 // blocks in the middle of the loop (neither the first nor the last one)?
89 // it may be on the left edge (Mx1) or not (1xN)
90 mov (1) uwBLOCK_MASK_H<1>:uw uwBLOCK_MASK_H_MIDDLE:uw
91
92 // the last block?
93 cmp.e.f0.0 (1) null:w wNUM_BLKS:w 1:w
94 (f0.0) mov (1) uwBLOCK_MASK_H<1>:uw uwBLOCK_MASK_H_RIGHT:uw
95 (f0.0) mov (1) ubBLOCK_MASK_V<1>:ub ubBLOCK_MASK_V_BOTTOM:ub
96
97 (f0.1)jmpi (1) VIDEO_PROCESSING_LOOP // If not the end of row, goto the beginning of the loop
98
99 //If end of row, restart Horizontal offset and calculate Vertical offsets next row.
100 mov (1) wORIX:w wCOPY_ORIX:w
101 add (1) wORIY:w wORIY:w 8:w
102
103 #if defined(INC_SCALING)
104 // Update SRC_VID_H_ORI and SRC_VID_V_ORI for scaling
105 mov (1) fSRC_VID_H_ORI:f fFRAME_VID_ORIX:f // Reset normalised X origin to 0 for video and alpha
106 mul (1) REG(r,nTEMP0):f fVIDEO_STEP_Y:f 8.0:f
107 add (1) fSRC_VID_V_ORI:f REG(r,nTEMP0):f fSRC_VID_V_ORI:f
108 #endif
109
110 #if defined(INC_BLENDING)
111 // Update SRC_ALPHA_H_ORI and SRC_ALPHA_V_ORI for blending
112 mov (1) fSRC_ALPHA_H_ORI:f fFRAME_ALPHA_ORIX:f // Reset normalised X origin to 0 for video and alpha
113 mul (1) REG(r,nTEMP0):f fALPHA_STEP_Y:f 8.0:f
114 add (1) fSRC_ALPHA_V_ORI:f REG(r,nTEMP0):f fSRC_ALPHA_V_ORI:f
115 #endif
116
117 jmpi (1) VIDEO_PROCESSING_LOOP // Continue Loop
118
119 END_VIDEO_PROCESSING:
120 nop
121
122 #endif
123 END_THREAD // End of Thread