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. //   22    // 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.asm
  146. // Author:              Vivek Kumar
  147. // Description: Tasks for DI only case (16x4 block)
  148.  
  149.  
  150. // End of common.inc
  151.  
  152.  
  153. // FileName:    DNDI.inc
  154. // Author:      Vivek Kumar
  155. // Description: Include file for DN, DI and DNDI
  156. // Inputs:      DI_ENABLE, DN_ENABLE, DN_PLANAR, DN_PACKED
  157.  
  158.  
  159. // End of common.inc
  160.  
  161.  
  162. //Interface:
  163. //Static Parameters:
  164. //r1
  165.  
  166.  
  167. //====================== Binding table (Explicit To DNDI)=========================================
  168.  
  169.  
  170. .declare mudMSGHDR_DNDI     Base=r18      ElementSize=4    Type=ud
  171. .declare mdMSGHDR_DNDI      Base=r18      ElementSize=4    Type=d
  172. .declare mwMSGHDR_DNDI      Base=r18      ElementSize=2    Type=w
  173.  
  174.  
  175. .declare mudMSGHDR_STMM     Base=r20      ElementSize=4    Type=ud
  176.  
  177.  
  178. .declare mudMSGHDR_HIST     Base=r22      ElementSize=4    Type=ud
  179.  
  180.  
  181. .declare mudMSGHDR_ENC_STATS Base=r24 ElementSize=4   Type=ud
  182. .declare muwMSGHDR_ENC_STATS Base=r24 ElementSize=2   Type=uw
  183. .declare mubMSGHDR_ENC_STATS Base=r24 ElementSize=1   Type=ub
  184.  
  185.  
  186. .declare mudMSGHDR_DN_OUT   Base=r31.0      ElementSize=4  Type=ud
  187. .declare mdMSGHDR_DN_OUT    Base=r31.0      ElementSize=4  Type=d
  188. .declare mubMSGHDR_DN_OUT   Base=r31.0      ElementSize=1  Type=ub
  189.  
  190.  
  191. .declare mudMSGHDR_UVCOPY   Base=r36      ElementSize=4  Type=ud
  192. .declare mdMSGHDR_UVCOPY    Base=r36      ElementSize=4  Type=d
  193. .declare mudMSGHDR_UCOPY    Base=r36       ElementSize=4  Type=ud
  194. .declare mudMSGHDR_VCOPY    Base=r38       ElementSize=4  Type=ud
  195.  
  196.  
  197. .declare mudMSGHDR_DI_OUT1  Base=r18.0      ElementSize=4     Type=ud
  198. .declare mubMSGHDR_DI_OUT1  Base=r18.0      ElementSize=1     Type=ub
  199.  
  200.  
  201. .declare mudMSGHDR_DI_OUT2  Base=r23.0      ElementSize=4     Type=ud
  202. .declare mubMSGHDR_DI_OUT2  Base=r23.0      ElementSize=1     Type=ub
  203.  
  204. //r45
  205. //Use r45 as message header, so no need to "mov" the data.
  206.  
  207. .declare mudDN_Y_OUT        Base=r45.0 ElementSize=4 SrcRegion=<8;8,1>   DstRegion=<1> Type=ud
  208.  
  209. // Message response (Denoised & DI-ed pixels & statistics); Use buffer 5
  210. .declare udDNDI_RESP        Base=r46.0 ElementSize=4 SrcRegion=<8;8,1>   DstRegion=<1> Type=ud
  211. .declare uwDNDI_RESP        Base=r46.0 ElementSize=2 SrcRegion=<16;16,1> DstRegion=<1> Type=uw
  212. .declare ubDNDI_RESP        Base=r46.0 ElementSize=1 SrcRegion=<16;16,1> DstRegion=<1> Type=ub
  213.  
  214. // Message response (UV Copy); Use buffer 5
  215. .declare udDNDI_UV_RESP     Base=r58.0 ElementSize=4 SrcRegion=<8;8,1>  DstRegion=<1> Type=ud
  216. .declare ubDNDI_UV_RESP     Base=r58.0 ElementSize=1 SrcRegion=<16;16,1>    DstRegion=<1> Type=ub
  217.  
  218. //Temp GRFs: For 42X to 422 Conversion
  219. .declare uwDNDI_UVCOPY_TEMP Base=r10.0 ElementSize=2 SrcRegion=<16;16,1>    DstRegion=<1> Type=uw       //8 GRFs
  220. .declare ubDNDI_UVCOPY_TEMP Base=r10.0 ElementSize=1 SrcRegion=<16;16,1>    DstRegion=<1> Type=ub       //8 GRFs
  221. //---------------------------------------------------------------------------
  222. // Message descriptors
  223. //---------------------------------------------------------------------------
  224. // Extended message descriptor
  225.     // Message descriptor   for sampler read
  226.     //                    = 000 0010 (message len 2) 00000 (resp len - set later, 12 or 5 or 11)
  227.     //                      1 (header present 1) 0 11 (SIMD32/64 mode)
  228.     //                      1000 (message type) 0000 (DI state index)
  229.     //                      00000000 (binding table index - set later)
  230.     //                    = 0x040b8000
  231.  
  232.  
  233. // Attention: The Message Length is The Number of GRFs with Data Only, without the Header
  234.  
  235.  
  236. //---------------------------------------------------------------------------
  237. // VDI Return Data format
  238. //---------------------------------------------------------------------------
  239. // Defines for DI enabled
  240.  
  241.  
  242. // Defines for DI disabled
  243.  
  244.  
  245. // FileName:    DNDI_Command.asm
  246. // Author:              Vivek Kumar
  247. // Description: Sends a message to the VDI to process one DN (16x8) or DNDI (16x4) block
  248.  
  249. // Prepare the DNDI send command
  250. mov (8)         mudMSGHDR_DNDI(0)<1>                    r0.0<8;8,1>:ud                                  // message header
  251. mov (1)         mwMSGHDR_DNDI(1,4)<1>                   r7.0<0;1,0>:w           { NoDDClr }             // horizontal origin    // Do we need to add offset here? -vK
  252. mov (1)         mwMSGHDR_DNDI(1,12)<1>                  r7.1<0;1,0>:w           { NoDDChk }             // vertical origin              // Can these 2 be combined? - vK
  253.  
  254. send (8)        udDNDI_RESP(0)<1>       r18     0x2     0x4AE8003:ud
  255.  
  256. // On Gen6, with VDI walker, use the XY pair returned rather than programmed above
  257. // VDI_RETURNED_XY is ordered XY in case of walker enables and the same as programmed in case of walker disabled
  258. mov (2)         r7.0<1>:w     uwDNDI_RESP(9,14)<2;2,1>  // horizontal/Vertial origin in W.14 and W.15    
  259.  
  260.  
  261. // FileName:    DI_STMM_Save.asm
  262. // Author:              Vivek Kumar
  263. // Description: Saves DI STMM Data to statistics surface in case of DI enabled (for 16x4 block)
  264.  
  265. // Write STMM to memory
  266. mov (8)     mudMSGHDR_STMM(0)<1>        r0.0<8;8,1>:ud                                                                  // message header  
  267. mov (8)     mudMSGHDR_STMM(1)<1>        udDNDI_RESP(8,0)                                                // Move STMM to MRF
  268.  
  269. shr (1)     mudMSGHDR_STMM(0,0)<1>      r7.0<0;1,0>:w            1:w     { NoDDClr }            // X origin / 2
  270. mov (1)     mudMSGHDR_STMM(0,1)<1>      r7.1<0;1,0>:w                    { NoDDClr, NoDDChk }   // Y origin
  271. mov (1)     mudMSGHDR_STMM(0,2)<1>      0x30007:ud           { NoDDChk }                // block width and height (8x4)
  272.  
  273. send (8)        null<1>:d       r20     0x5             0x40A8021:ud      
  274.  
  275.  
  276. // FileName:    DNDI_Enc_Stats_Save.asm
  277. // Author:              Vivek Kumar
  278. // Description: Saves Encoder Statistics data to statistics surface in case of DI enabled (for 16x4 block)
  279.  
  280. // Write encoder statistics to memory
  281. //Currently enable this only on Gen6 validation
  282. mov (8)         mudMSGHDR_ENC_STATS(1)<1>       0x0:ud                                          // Init payload MRF
  283. mov (8)         mudMSGHDR_ENC_STATS(0)<1>       r0.0<8;8,1>:ud                          // message header
  284.  
  285. shr (1)         mudMSGHDR_ENC_STATS(0,0)<1>             r7.0<0;1,0>:w                   1:w     { NoDDClr }                     //enable the flag after testing on si                                   { NoDDClr }     // X origin / 2
  286. mul (1)         acc0.1<1>:ud                                    r7.1<0;1,0>:w                           3:w                                                                                                                                                                                     // Y origin * 3
  287. shr (1)         mudMSGHDR_ENC_STATS(0,1)<1>             acc0.1<0;1,0>:ud                        2:w             { NoDDClr, NoDDChk }            //enable the flag after testing on si                      { NoDDClr, NoDDChk } // Y origin * 3/4
  288. mov (1)         mudMSGHDR_ENC_STATS(0,2)<1>             0x20007:ud                              { NoDDChk }                     //enable the flag after testing on si                                           { NoDDChk } // block width and height (8x3)
  289. add (2)         mudMSGHDR_ENC_STATS(0,0)<1>             mudMSGHDR_ENC_STATS(0,0)<2;2,1>         r1.12<2;2,1>:uw                                 // Add pitch to X,Y origin
  290.  
  291.  
  292.         //Data block for Encoder Statistics
  293.         //----------------------------------------------------
  294.         //|  0  |   1  |   2   |  3  |  4  |  5  |  6  |  7  | Bytes
  295.         //----------------------------------------------------
  296.         //| BNE | MCNT | FCNT | TCNT |  X  |  X  |  X  |  X  |
  297.         //----------------------------------------------------
  298.         //|   DcTpT    |     SVCM    |   DcBpT   |   DcTpB   |
  299.         //----------------------------------------------------
  300.         //|   SHCM     |     STAD    |   DcTcB   |   DcBpB   |
  301.         //----------------------------------------------------
  302.         mov (1)         mudMSGHDR_ENC_STATS(1,0)<1>             udDNDI_RESP(9,1)<0;1,0>                 { NoDDClr }                     // Move encoder statistics to MRF
  303.         mov (2)         mudMSGHDR_ENC_STATS(1,3)<2>             udDNDI_RESP(9,3)<2;2,1>                 { NoDDClr, NoDDChk }            // Move encoder statistics to MRF
  304.         mov (2)         mudMSGHDR_ENC_STATS(1,2)<2>             udDNDI_RESP(9,5)<2;2,1>                 { NoDDChk }                     // Move encoder statistics to MRF
  305.  
  306.  
  307. send (8)   null<1>:d    r24    0x5    0x40A8021:ud
  308.  
  309.  
  310.