1/* 2 * Copyright © 2009 Intel Corporation 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice (including the next 12 * paragraph) shall be included in all copies or substantial portions of the 13 * Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 * SOFTWARE. 22 * 23 * Author: 24 * Zou Nan hai <nanhai.zou@intel.com> 25 * Yan Li <li.l.yan@intel.com> 26 * Liu Xi bin<xibin.liu@intel.com> 27 */ 28/* GRF allocation: 29 g1~g30: constant buffer 30 g1~g2:intra IQ matrix in UB format 31 g3~g4:non intra IQ matrix in UB format 32 g5~g20:IDCT table 33 g32~g55:DCT data before IQ 34 g56~g79:DCT data after IQ 35 g82: thread payload backup 36 g109: g109.0:q_scale_code, g109.4:intra_dc_mult, 37 g110: q_scale_code 38 g111: intra DC coefficient 39 g112~g115: intra IQ matrix in UW format (in order to use instruction compress), copys from g1~g2 40 g125: ip before jump 41*/ 42and (1) g109.0<1>UW g82.8<1,1,1>UW 0x1fUW {align1}; //q_scale_code 43 44and (1) g109.4<1>UW g82.8<1,1,1>UW 0x6000UW {align1}; //intra_dc_presion 45shr (1) g109.4<1>UW g109.4<1,1,1>UW 13UW {align1}; 46mov (1) g109.6<1>UW 0x8UW {align1}; 47shr (1) g109.4<1>UW g109.6<1,1,1>UW g109.4<1,1,1>UW {align1}; //intra_dc_mult 48 49and.z (1) null g82.8<1,1,1>UW 0x20UW {align1}; //if(q_scale_type==0) q_scale=q_scale_code*2; 50(f0) jmpi Q_SCALE_TYPE_0; 51 52cmp.l (1) null g109.0<1,1,1>UW 9UW {align1}; //if(q_scale_type!=0) calculate q_scale 53(f0) jmpi DO_IQ; 54cmp.l (1) null g109.0<1,1,1>UW 17UW {align1}; 55(f0) jmpi RANG_9_16; 56cmp.l (1) null g109.0<1,1,1>UW 25UW {align1}; 57(f0) jmpi RANG_17_24; 58 59RANG_25_31: 60add (1) g109.0<1>UW g109.0<1,1,1>UW -25W {align1}; 61shl (1) g109.0<1>UW g109.0<1,1,1>UW 3UW {align1}; 62add (1) g109.0<1>UW g109.0<1,1,1>UW 64UW {align1}; 63jmpi DO_IQ; 64 65RANG_9_16: 66add (1) g109.0<1>UW g109.0<1,1,1>UW -9W {align1}; 67shl (1) g109.0<1>UW g109.0<1,1,1>UW 1UW {align1}; 68add (1) g109.0<1>UW g109.0<1,1,1>UW 10UW {align1}; 69jmpi DO_IQ; 70 71RANG_17_24: 72add (1) g109.0<1>UW g109.0<1,1,1>UW -17W {align1}; 73shl (1) g109.0<1>UW g109.0<1,1,1>UW 2UW {align1}; 74add (1) g109.0<1>UW g109.0<1,1,1>UW 28UW {align1}; 75jmpi DO_IQ; 76 77Q_SCALE_TYPE_0: 78shl (1) g109.0<1>UW g109.0<1,1,1>UW 1UD {align1}; 79 80DO_IQ: 81mov (1) g110.0<1>UW g109.0<1,1,1>UW {align1}; 82 83mov (16) g112.0<1>UW g1.0<16,16,1>UB {align1}; 84mov (16) g113.0<1>UW g1.16<16,16,1>UB {align1}; 85mov (16) g114.0<1>UW g2.0<16,16,1>UB {align1}; 86mov (16) g115.0<1>UW g2.16<16,16,1>UB {align1}; 87 88mov (1) a0.0<1>UD 0x03F003E0UD {align1}; 89 90mov (1) g125.0<1>UD ip {align1}; 91jmpi DO_IQ_INTRA; 92mov (16) g56.0<1>W g116.0<16,8,2>W {align1}; 93mov (16) g57.0<1>W g118.0<16,8,2>W {align1}; 94mov (16) g58.0<1>W g120.0<16,8,2>W {align1}; 95mov (16) g59.0<1>W g122.0<16,8,2>W {align1}; 96 97mov (1) g125.0<1>UD ip {align1}; 98jmpi DO_IQ_INTRA; 99mov (16) g60.0<1>W g116.0<16,8,2>W {align1}; 100mov (16) g61.0<1>W g118.0<16,8,2>W {align1}; 101mov (16) g62.0<1>W g120.0<16,8,2>W {align1}; 102mov (16) g63.0<1>W g122.0<16,8,2>W {align1}; 103 104mov (1) g125.0<1>UD ip {align1}; 105jmpi DO_IQ_INTRA; 106mov (16) g64.0<1>W g116.0<16,8,2>W {align1}; 107mov (16) g65.0<1>W g118.0<16,8,2>W {align1}; 108mov (16) g66.0<1>W g120.0<16,8,2>W {align1}; 109mov (16) g67.0<1>W g122.0<16,8,2>W {align1}; 110 111mov (1) g125.0<1>UD ip {align1}; 112jmpi DO_IQ_INTRA; 113mov (16) g68.0<1>W g116.0<16,8,2>W {align1}; 114mov (16) g69.0<1>W g118.0<16,8,2>W {align1}; 115mov (16) g70.0<1>W g120.0<16,8,2>W {align1}; 116mov (16) g71.0<1>W g122.0<16,8,2>W {align1}; 117 118mov (1) g125.0<1>UD ip {align1}; 119jmpi DO_IQ_INTRA; 120mov (16) g72.0<1>W g116.0<16,8,2>W {align1}; 121mov (16) g73.0<1>W g118.0<16,8,2>W {align1}; 122mov (16) g74.0<1>W g120.0<16,8,2>W {align1}; 123mov (16) g75.0<1>W g122.0<16,8,2>W {align1}; 124 125mov (1) g125.0<1>UD ip {align1}; 126jmpi DO_IQ_INTRA; 127mov (16) g76.0<1>W g116.0<16,8,2>W {align1}; 128mov (16) g77.0<1>W g118.0<16,8,2>W {align1}; 129mov (16) g78.0<1>W g120.0<16,8,2>W {align1}; 130mov (16) g79.0<1>W g122.0<16,8,2>W {align1}; 131 132