Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  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:   q_scale_code
  37.    g110:   q_scale_code
  38.    g112~g115: non intra IQ matrix in UW format (in order to use instruction compress), copys from g3~g4
  39.    g125:   ip before jump
  40. */
  41. and (1) g109.0<1>UW g82.8<1,1,1>UW 0x1fUW {align1}; //q_scale_code
  42.  
  43. and.z (1) null g82.8<1,1,1>UW 0x20UW {align1};   //if(q_scale_type==0) q_scale=q_scale_code*2;
  44. (f0) jmpi Q_SCALE_TYPE_0;
  45.  
  46. cmp.l (1) null g109.0<1,1,1>UW 9UW {align1};      //if(q_scale_type!=0) calculate q_scale
  47. (f0) jmpi DO_IQ;
  48. cmp.l (1) null g109.0<1,1,1>UW 17UW {align1};
  49. (f0) jmpi RANG_9_16;
  50. cmp.l (1) null g109.0<1,1,1>UW 25UW {align1};
  51. (f0) jmpi RANG_17_24;
  52.  
  53. RANG_25_31:
  54. add (1) g109.0<1>UW g109.0<1,1,1>UW -25W {align1};
  55. shl (1) g109.0<1>UW g109.0<1,1,1>UW 3UW {align1};
  56. add (1) g109.0<1>UW g109.0<1,1,1>UW 64UW {align1};
  57. jmpi DO_IQ;
  58.  
  59. RANG_9_16:
  60. add (1) g109.0<1>UW g109.0<1,1,1>UW -9W {align1};
  61. shl (1) g109.0<1>UW g109.0<1,1,1>UW 1UW {align1};
  62. add (1) g109.0<1>UW g109.0<1,1,1>UW 10UW {align1};
  63. jmpi DO_IQ;
  64.  
  65. RANG_17_24:
  66. add (1) g109.0<1>UW g109.0<1,1,1>UW -17W {align1};
  67. shl (1) g109.0<1>UW g109.0<1,1,1>UW 2UW {align1};
  68. add (1) g109.0<1>UW g109.0<1,1,1>UW 28UW {align1};
  69. jmpi DO_IQ;
  70.  
  71. Q_SCALE_TYPE_0:
  72. shl (1) g109.0<1>UW g109.0<1,1,1>UW 1UD {align1};
  73.  
  74. DO_IQ:
  75. mov (1) g110.0<1>UW g109.0<1,1,1>UW {align1};
  76.  
  77. mov (16) g112.0<1>UW g3.0<16,16,1>UB {align1};
  78. mov (16) g113.0<1>UW g3.16<16,16,1>UB {align1};
  79. mov (16) g114.0<1>UW g4.0<16,16,1>UB {align1};
  80. mov (16) g115.0<1>UW g4.16<16,16,1>UB {align1};
  81.  
  82. mov (1) a0.0<1>UD 0x03F003E0UD {align1};
  83.  
  84. //Y0
  85. iq_non_intra_y0:
  86. and.z (1) null g82.8<1,1,1>UW 0x800UW {align1};
  87. (f0) jmpi iq_non_intra_y1;
  88. mov (1) g125.0<1>UD ip {align1};
  89. jmpi DO_IQ_NON_INTRA;
  90. mov (16) g56.0<1>W g116.0<16,8,2>W {align1};
  91. mov (16) g57.0<1>W g118.0<16,8,2>W {align1};
  92. mov (16) g58.0<1>W g120.0<16,8,2>W {align1};
  93. mov (16) g59.0<1>W g122.0<16,8,2>W {align1};
  94.  
  95. //Y1
  96. iq_non_intra_y1:
  97. and.z (1) null g82.8<1,1,1>UW 0x400UW {align1};
  98. (f0) jmpi iq_non_intra_y2;
  99. mov (1) g125.0<1>UD ip {align1};
  100. jmpi DO_IQ_NON_INTRA;
  101. mov (16) g60.0<1>W g116.0<16,8,2>W {align1};
  102. mov (16) g61.0<1>W g118.0<16,8,2>W {align1};
  103. mov (16) g62.0<1>W g120.0<16,8,2>W {align1};
  104. mov (16) g63.0<1>W g122.0<16,8,2>W {align1};
  105.  
  106. //Y2
  107. iq_non_intra_y2:
  108. and.z (1) null g82.8<1,1,1>UW 0x200UW {align1};
  109. (f0) jmpi iq_non_intra_y3;
  110. mov (1) g125.0<1>UD ip {align1};
  111. jmpi DO_IQ_NON_INTRA;
  112. mov (16) g64.0<1>W g116.0<16,8,2>W {align1};
  113. mov (16) g65.0<1>W g118.0<16,8,2>W {align1};
  114. mov (16) g66.0<1>W g120.0<16,8,2>W {align1};
  115. mov (16) g67.0<1>W g122.0<16,8,2>W {align1};
  116.  
  117. //Y3
  118. iq_non_intra_y3:
  119. and.z (1) null g82.8<1,1,1>UW 0x100UW {align1};
  120. (f0) jmpi iq_non_intra_u;
  121. mov (1) g125.0<1>UD ip {align1};
  122. jmpi DO_IQ_NON_INTRA;
  123. mov (16) g68.0<1>W g116.0<16,8,2>W {align1};
  124. mov (16) g69.0<1>W g118.0<16,8,2>W {align1};
  125. mov (16) g70.0<1>W g120.0<16,8,2>W {align1};
  126. mov (16) g71.0<1>W g122.0<16,8,2>W {align1};
  127.  
  128. //U
  129. iq_non_intra_u:
  130. and.z (1) null g82.8<1,1,1>UW 0x80UW {align1};
  131. (f0) jmpi iq_non_intra_v;
  132. mov (1) g125.0<1>UD ip {align1};
  133. jmpi DO_IQ_NON_INTRA;
  134. mov (16) g72.0<1>W g116.0<16,8,2>W {align1};
  135. mov (16) g73.0<1>W g118.0<16,8,2>W {align1};
  136. mov (16) g74.0<1>W g120.0<16,8,2>W {align1};
  137. mov (16) g75.0<1>W g122.0<16,8,2>W {align1};
  138.  
  139. //V
  140. iq_non_intra_v:
  141. and.z (1) null g82.8<1,1,1>UW 0x40UW {align1};
  142. (f0) jmpi iq_non_intra_end;
  143. mov (1) g125.0<1>UD ip {align1};
  144. jmpi DO_IQ_NON_INTRA;
  145. mov (16) g76.0<1>W g116.0<16,8,2>W {align1};
  146. mov (16) g77.0<1>W g118.0<16,8,2>W {align1};
  147. mov (16) g78.0<1>W g120.0<16,8,2>W {align1};
  148. mov (16) g79.0<1>W g122.0<16,8,2>W {align1};
  149.  
  150. iq_non_intra_end:
  151.