Debian Codegraph @

src/shaders/post_processing/gen5_6/Common/RGBX_to_YUV_Coef.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 * Authors:
40 * Halley Zhao <[email protected]>
41 */
42
43 // Module name: RGB_to_YUV_Coef.asm
44 //----------------------------------------------------------------
45
46 // is src surface |R|G|B|X| layout? otherwise it is |B|G|R|X|
47 and.nz.f0.1 (1) dNULLREG r1.1:ud 0xFF000000:ud
48 #ifdef FIX_POINT_CONVERSION
49 // Y = ( ( 66 * R + 129 * G + 25 * B + 128 ) >> 8) + 16
50 (-f0.1) mov (1) REG2(r, nTEMP0, 0):ud 0x00428119:ud // used as unsigned byte
51 ( f0.1) mov (1) REG2(r, nTEMP0, 0):ud 0x00198142:ud // used as unsigned byte
52 // U = ( ( -38 * R - 74 * G + 112 * B + 128 ) >> 8) + 128
53 (-f0.1) mov (1) REG2(r, nTEMP0, 1):ud 0x00DAB670:ud // used as signed byte
54 ( f0.1) mov (1) REG2(r, nTEMP0, 1):ud 0x0070B6DA:ud // used as signed byte
55 // V = ( ( 112 * R - 94 * G - 18 * B + 128 ) >> 8) + 128
56 (-f0.1) mov (1) REG2(r, nTEMP0, 2):ud 0x0070A2EEud // used as signed byte
57 ( f0.1) mov (1) REG2(r, nTEMP0, 2):ud 0x00EEA270ud // used as signed byte
58
59 #define ubRGB_to_Y_Coef_Fix REG2(r, nTEMP0, 0)
60 #define bRGB_to_U_Coef_Fix REG2(r, nTEMP0, 4)
61 #define bRGB_to_V_Coef_Fix REG2(r, nTEMP0, 8)
62 #else
63 // Y = 0.299R + 0.587G + 0.114B
64 (-f0.1) mov (1) REG2(r, nTEMP8, 0):f 0.114f // B coef
65 ( f0.1) mov (1) REG2(r, nTEMP8, 2):f 0.114f // R coef
66 mov (1) REG2(r, nTEMP8, 1):f 0.587f // G coef
67 (-f0.1) mov (1) REG2(r, nTEMP8, 2):f 0.299f // R coef
68 ( f0.1) mov (1) REG2(r, nTEMP8, 0):f 0.299f // B coef
69 mov (1) REG2(r, nTEMP8, 3):f 0.000f // A coef
70
71 // Cb= -0.169R - 0.331G + 0.499B + 128
72 // U = -0.147R - 0.289G + 0.436B + 128
73 (-f0.1) mov (1) REG2(r, nTEMP8, 4):f 0.436f // B coef
74 ( f0.1) mov (1) REG2(r, nTEMP8, 6):f 0.436f // R coef
75 mov (1) REG2(r, nTEMP8, 5):f -0.289f // G coef
76 (-f0.1) mov (1) REG2(r, nTEMP8, 6):f -0.147f // R coef
77 ( f0.1) mov (1) REG2(r, nTEMP8, 4):f -0.147f // B coef
78 mov (1) REG2(r, nTEMP8, 7):f 0.000f // A coef
79
80 // Cr= 0.499R - 0.418G - 0.0813B+ 128
81 // V = 0.615R - 0.515G - 0.100B + 128
82 (-f0.1) mov (1) REG2(r, nTEMP10, 0):f -0.100f // B coef
83 ( f0.1) mov (1) REG2(r, nTEMP10, 2):f -0.100f // R coef
84 mov (1) REG2(r, nTEMP10, 1):f -0.515f // G coef
85 (-f0.1) mov (1) REG2(r, nTEMP10, 2):f 0.615f // R coef
86 ( f0.1) mov (1) REG2(r, nTEMP10, 0):f 0.615f // B coef
87 mov (1) REG2(r, nTEMP10, 3):f 0.000f // A coef
88
89 #define fRGB_to_Y_Coef_Float REG2(r, nTEMP8, 0)
90 #define fRGB_to_U_Coef_Float REG2(r, nTEMP8, 4)
91 #define fRGB_to_V_Coef_Float REG2(r, nTEMP10, 0)
92 .declare fROW_BGRX Base=REG(r,nTEMP0) ElementSize=4 SrcRegion=REGION(8,8) Type=f // r nTEMP0 - r nTEMP7
93 #endif
94