Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /*
  2.  *  Copyright 2000-2011 Intel Corporation All Rights Reserved
  3.  *
  4.  *  Licensed under the Apache License, Version 2.0 (the "License");
  5.  *  you may not use this file except in compliance with the License.
  6.  *  You may obtain a copy of the License at
  7.  *
  8.  *      http://www.apache.org/licenses/LICENSE-2.0
  9.  *
  10.  *  Unless required by applicable law or agreed to in writing, software
  11.  *  distributed under the License is distributed on an "AS IS" BASIS,
  12.  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13.  *  See the License for the specific language governing permissions and
  14.  *  limitations under the License.
  15.  */
  16. //   33    // Total instruction count
  17. //    1    // Total kernel count
  18.  
  19.  
  20. // Module name: common.inc
  21. //
  22. // Common header file for all Video-Processing kernels
  23. //
  24.  
  25. .default_execution_size (16)
  26. .default_register_type  :ub
  27.  
  28. .reg_count_total        128
  29. .reg_count_payload      7
  30.  
  31. //========== Common constants ==========
  32.  
  33.  
  34. //========== Macros ==========
  35.  
  36.  
  37. //Fast Jump, For more details see "Set_Layer_N.asm"
  38.  
  39.  
  40. //========== Defines ====================
  41.  
  42. //========== Static Parameters (Common To All) ==========
  43. //r1
  44.  
  45.  
  46. //r2
  47.  
  48.                                     //  e.g.            byte0   byte1  byte2
  49.                                     // YUYV               0       1      3
  50.                                     // YVYU               0       3      1
  51.  
  52. //Color Pipe (IECP) parameters
  53.  
  54.  
  55. //r4
  56.  
  57.                                     //  e.g.              byte0           byte1           byte2
  58.                                     // YUYV                 0               1               3
  59.                                     // YVYU                 0               3               1
  60.  
  61.  
  62. //========== Inline parameters (Common To All) ===========
  63.  
  64.  
  65. //============== Binding Index Table===========
  66. //Common between DNDI and DNUV
  67.  
  68.  
  69. //================= Common Message Descriptor =====
  70. // Message descriptor for thread spawning
  71. // Message Descriptors
  72. //                = 000 0001 (min message len 1 ) 0,0000 (resp len 0   -add later)
  73. //                  0000,0000,0000
  74. //                  0001(Spawn a root thread),0001 (Root thread spawn thread)
  75. //                = 0x02000011
  76. // Thread Spawner Message Descriptor
  77.  
  78.  
  79. // Message descriptor for atomic operation add
  80. // Message Descriptors
  81. //                = 000 0110 (min message len 6 ) 0,0000 (resp len 0   -add later)
  82. //                  1(header present)001,10(typed atomic operation)0(return enabled)0(slot group, low 8 bits),0111 (AOP_Add)
  83. //                  0000,0000 (Binding table index, added later)
  84. //                = 0x02000011
  85.  
  86. // Atomic Operation Add Message Descriptor
  87.  
  88.  
  89. // Message descriptor for dataport media write
  90.         // Message Descriptors
  91.                 //                = 000 0001 (min message len 1 - add later) 00000 (resp len 0)
  92.                 //                  1 (header present 1) 0 1010 (media block write) 000000
  93.                 //                  00000000 (binding table index - set later)
  94.                 //                = 0x020A8000
  95.  
  96.  
  97. // Message Length defines
  98.  
  99.  
  100. // Response Length defines
  101.  
  102.  
  103. // Block Width and Height Size defines
  104.  
  105.  
  106. // Extended Message Descriptors
  107.  
  108.  
  109. // Common message descriptors:
  110.  
  111.  
  112. //===================== Math Function Control ===================================
  113.  
  114.  
  115. //============ Message Registers ===============
  116.                              // buf4 starts from r28
  117.  
  118.  
  119. //#define mMSGHDR_EOT  r43    // Dummy Message Register for EOT
  120.  
  121.  
  122. .declare    mubMSGPAYLOAD  Base=r30 ElementSize=1 SrcRegion=<16;16,1> Type=ub
  123. .declare    muwMSGPAYLOAD  Base=r30 ElementSize=2 SrcRegion=<16;16,1> Type=uw
  124. .declare    mudMSGPAYLOAD  Base=r30 ElementSize=4 SrcRegion=<8;8,1> Type=ud
  125. .declare    mfMSGPAYLOAD   Base=r30 ElementSize=4 SrcRegion=<8;8,1> Type=f
  126.  
  127. //=================== End of thread instruction ===========================
  128.  
  129.  
  130. //=====================Pointers Used=====================================
  131.  
  132.  
  133. //=======================================================================
  134.  
  135.  
  136. //r9-r17
  137. // Define temp space for any usages
  138.  
  139.  
  140. // Common Buffers
  141.  
  142.  
  143. // End of common.inc
  144.  
  145. // FileName:    DI_Save_PA_16x4.asm
  146. // Author:      Vivek Kumar
  147. // Description: Save two 16x4 blocks of DI output in Packed format
  148.  
  149.  
  150. // FileName:    DNDI.inc
  151. // Author:      Vivek Kumar
  152. // Description: Include file for DN, DI and DNDI
  153. // Inputs:      DI_ENABLE, DN_ENABLE, DN_PLANAR, DN_PACKED
  154.  
  155.  
  156. // End of common.inc
  157.  
  158.  
  159. //Interface:
  160. //Static Parameters:
  161. //r1
  162.  
  163.  
  164. //====================== Binding table (Explicit To DNDI)=========================================
  165.  
  166.  
  167. .declare mudMSGHDR_DNDI     Base=r18      ElementSize=4    Type=ud
  168. .declare mdMSGHDR_DNDI      Base=r18      ElementSize=4    Type=d
  169. .declare mwMSGHDR_DNDI      Base=r18      ElementSize=2    Type=w
  170.  
  171.  
  172. .declare mudMSGHDR_STMM     Base=r20      ElementSize=4    Type=ud
  173.  
  174.  
  175. .declare mudMSGHDR_HIST     Base=r22      ElementSize=4    Type=ud
  176.  
  177.  
  178. .declare mudMSGHDR_ENC_STATS Base=r24 ElementSize=4   Type=ud
  179. .declare muwMSGHDR_ENC_STATS Base=r24 ElementSize=2   Type=uw
  180. .declare mubMSGHDR_ENC_STATS Base=r24 ElementSize=1   Type=ub
  181.  
  182.  
  183. .declare mudMSGHDR_DN_OUT   Base=r31.0      ElementSize=4  Type=ud
  184. .declare mdMSGHDR_DN_OUT    Base=r31.0      ElementSize=4  Type=d
  185. .declare mubMSGHDR_DN_OUT   Base=r31.0      ElementSize=1  Type=ub
  186.  
  187.  
  188. .declare mudMSGHDR_UVCOPY   Base=r36      ElementSize=4  Type=ud
  189. .declare mdMSGHDR_UVCOPY    Base=r36      ElementSize=4  Type=d
  190. .declare mudMSGHDR_UCOPY    Base=r36       ElementSize=4  Type=ud
  191. .declare mudMSGHDR_VCOPY    Base=r38       ElementSize=4  Type=ud
  192.  
  193.  
  194. .declare mudMSGHDR_DI_OUT1  Base=r18.0      ElementSize=4     Type=ud
  195. .declare mubMSGHDR_DI_OUT1  Base=r18.0      ElementSize=1     Type=ub
  196.  
  197.  
  198. .declare mudMSGHDR_DI_OUT2  Base=r23.0      ElementSize=4     Type=ud
  199. .declare mubMSGHDR_DI_OUT2  Base=r23.0      ElementSize=1     Type=ub
  200.  
  201. //r45
  202. //Use r45 as message header, so no need to "mov" the data.
  203.  
  204. .declare mudDN_Y_OUT        Base=r45.0 ElementSize=4 SrcRegion=<8;8,1>   DstRegion=<1> Type=ud
  205.  
  206. // Message response (Denoised & DI-ed pixels & statistics); Use buffer 5
  207. .declare udDNDI_RESP        Base=r46.0 ElementSize=4 SrcRegion=<8;8,1>   DstRegion=<1> Type=ud
  208. .declare uwDNDI_RESP        Base=r46.0 ElementSize=2 SrcRegion=<16;16,1> DstRegion=<1> Type=uw
  209. .declare ubDNDI_RESP        Base=r46.0 ElementSize=1 SrcRegion=<16;16,1> DstRegion=<1> Type=ub
  210.  
  211. // Message response (UV Copy); Use buffer 5
  212. .declare udDNDI_UV_RESP     Base=r58.0 ElementSize=4 SrcRegion=<8;8,1>  DstRegion=<1> Type=ud
  213. .declare ubDNDI_UV_RESP     Base=r58.0 ElementSize=1 SrcRegion=<16;16,1>    DstRegion=<1> Type=ub
  214.  
  215. //Temp GRFs: For 42X to 422 Conversion
  216. .declare uwDNDI_UVCOPY_TEMP Base=r10.0 ElementSize=2 SrcRegion=<16;16,1>    DstRegion=<1> Type=uw       //8 GRFs
  217. .declare ubDNDI_UVCOPY_TEMP Base=r10.0 ElementSize=1 SrcRegion=<16;16,1>    DstRegion=<1> Type=ub       //8 GRFs
  218. //---------------------------------------------------------------------------
  219. // Message descriptors
  220. //---------------------------------------------------------------------------
  221. // Extended message descriptor
  222.     // Message descriptor   for sampler read
  223.     //                    = 000 0010 (message len 2) 00000 (resp len - set later, 12 or 5 or 11)
  224.     //                      1 (header present 1) 0 11 (SIMD32/64 mode)
  225.     //                      1000 (message type) 0000 (DI state index)
  226.     //                      00000000 (binding table index - set later)
  227.     //                    = 0x040b8000
  228.  
  229.  
  230. // Attention: The Message Length is The Number of GRFs with Data Only, without the Header
  231.  
  232.  
  233. //---------------------------------------------------------------------------
  234. // VDI Return Data format
  235. //---------------------------------------------------------------------------
  236. // Defines for DI enabled
  237.  
  238.  
  239. // Defines for DI disabled
  240.  
  241.  
  242. add (4) a0.4<1>:uw   r2.28<4;4,1>:ub   608:w               // Initial Y,U,V offset in YUV422 block; it starts at m20
  243.  
  244. mov (8) r27.0<1>:ud     r0.0<8;8,1>:ud
  245. shl (1) r27.0<1>:d      r7.0<0;1,0>:w            1:w  { NoDDClr }          // H. block origin need to be doubled
  246. mov (1) r27.1<1>:d      r7.1<0;1,0>:w                 { NoDDClr, NoDDChk }       // Block origin
  247. mov (1) r27.2<1>:ud     0x3001F:ud          { NoDDChk }          // Block width and height (32x8)
  248.  
  249. //prepare the message headers
  250. mov (8) r18.0<1>:ud       r27<8;8,1>:ud
  251. mov (8) r23.0<1>:ud       r27<8;8,1>:ud
  252.  
  253. // Pack 2nd field Y
  254.     mov (16)    r[a0.4, 0]<2>      ubDNDI_RESP(0,0)               { NoDDClr }
  255.     mov (16)    r[a0.4, 32]<2>      ubDNDI_RESP(0,16)               { NoDDClr }
  256.     mov (16)    r[a0.4, 64]<2>      ubDNDI_RESP(0,32)               { NoDDClr }
  257.     mov (16)    r[a0.4, 96]<2>      ubDNDI_RESP(0,48)               { NoDDClr }
  258. // Pack 2nd field U
  259.     mov (8)     r[a0.5, 0]<4>      ubDNDI_RESP(2,1)<16;8,2>   { NoDDClr, NoDDChk }  //U pixels
  260.     mov (8)     r[a0.5, 32]<4>      ubDNDI_RESP(2,17)<16;8,2>   { NoDDClr, NoDDChk }  //U pixels
  261.     mov (8)     r[a0.5, 64]<4>      ubDNDI_RESP(2,33)<16;8,2>   { NoDDClr, NoDDChk }  //U pixels
  262.     mov (8)     r[a0.5, 96]<4>      ubDNDI_RESP(2,49)<16;8,2>   { NoDDClr, NoDDChk }  //U pixels
  263. // Pack 2nd field V
  264.     mov (8)     r[a0.6, 0]<4>      ubDNDI_RESP(2,0)<16;8,2>     { NoDDChk }     //Vpixels
  265.     mov (8)     r[a0.6, 32]<4>      ubDNDI_RESP(2,16)<16;8,2>     { NoDDChk }     //Vpixels
  266.     mov (8)     r[a0.6, 64]<4>      ubDNDI_RESP(2,32)<16;8,2>     { NoDDChk }     //Vpixels
  267.     mov (8)     r[a0.6, 96]<4>      ubDNDI_RESP(2,48)<16;8,2>     { NoDDChk }     //Vpixels
  268.  
  269. // Pack 1st field Y
  270.     mov (16)    r[a0.4, 160]<2>    ubDNDI_RESP(4,0)               { NoDDClr }
  271.     mov (16)    r[a0.4, 192]<2>    ubDNDI_RESP(4,16)               { NoDDClr }
  272.     mov (16)    r[a0.4, 224]<2>    ubDNDI_RESP(4,32)               { NoDDClr }
  273.     mov (16)    r[a0.4, 256]<2>    ubDNDI_RESP(4,48)               { NoDDClr }
  274. // Pack 1st field U
  275.     mov (8)     r[a0.5, 160]<4>    ubDNDI_RESP(6,1)<16;8,2>   { NoDDClr, NoDDChk }  //U pixels
  276.     mov (8)     r[a0.5, 192]<4>    ubDNDI_RESP(6,17)<16;8,2>   { NoDDClr, NoDDChk }  //U pixels
  277.     mov (8)     r[a0.5, 224]<4>    ubDNDI_RESP(6,33)<16;8,2>   { NoDDClr, NoDDChk }  //U pixels
  278.     mov (8)     r[a0.5, 256]<4>    ubDNDI_RESP(6,49)<16;8,2>   { NoDDClr, NoDDChk }  //U pixels
  279. // Pack 1st field V
  280.     mov (8)     r[a0.6, 160]<4>    ubDNDI_RESP(6,0)<16;8,2>     { NoDDChk }     //Vpixels
  281.     mov (8)     r[a0.6, 192]<4>    ubDNDI_RESP(6,16)<16;8,2>     { NoDDChk }     //Vpixels
  282.     mov (8)     r[a0.6, 224]<4>    ubDNDI_RESP(6,32)<16;8,2>     { NoDDChk }     //Vpixels
  283.     mov (8)     r[a0.6, 256]<4>    ubDNDI_RESP(6,48)<16;8,2>     { NoDDChk }     //Vpixels
  284.  
  285. //save the previous frame
  286. send (8)    null<1>:d    r18.0     0x5     0xA0A801B:ud
  287.  
  288. //save the current frame
  289. send (8)    null<1>:d    r23.0     0x5     0xA0A801E:ud
  290.