Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /*
  2.  *  Copyright 2000-2011 Intel Corporation All Rights Reserved
  3.  *
  4.  * Permission is hereby granted, free of charge, to any person obtaining a
  5.  * copy of this software and associated documentation files (the
  6.  * "Software"), to deal in the Software without restriction, including
  7.  * without limitation the rights to use, copy, modify, merge, publish,
  8.  * distribute, sub license, and/or sell copies of the Software, and to
  9.  * permit persons to whom the Software is furnished to do so, subject to
  10.  * the following conditions:
  11.  *
  12.  * The above copyright notice and this permission notice (including the
  13.  * next paragraph) shall be included in all copies or substantial portions
  14.  * of the Software.
  15.  *
  16.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  17.  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  18.  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
  19.  * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
  20.  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  21.  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  22.  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23.  *
  24.  * This file was originally licensed under the following license
  25.  *
  26.  *  Licensed under the Apache License, Version 2.0 (the "License");
  27.  *  you may not use this file except in compliance with the License.
  28.  *  You may obtain a copy of the License at
  29.  *
  30.  *      http://www.apache.org/licenses/LICENSE-2.0
  31.  *
  32.  *  Unless required by applicable law or agreed to in writing, software
  33.  *  distributed under the License is distributed on an "AS IS" BASIS,
  34.  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  35.  *  See the License for the specific language governing permissions and
  36.  *  limitations under the License.
  37.  */
  38. //   97    // Total instruction count
  39. //    1    // Total kernel count
  40.  
  41. .kernel PA_DNDI_PA
  42. .code
  43.  
  44.  
  45.  
  46. // FileName:    DNDI_PL_Core.asm
  47. // Author:              Tatiya, Rupesh
  48.  
  49.  
  50.  
  51. // FileName:    DNDI_Core.asm
  52. // Author:              Vivek Kumar
  53. // Description: Tasks for DN+DI case (16x4 block)
  54.  
  55.  
  56.  
  57.  
  58. // Module name: common.inc
  59. //
  60. // Common header file for all Video-Processing kernels
  61. //
  62.  
  63. .default_execution_size (16)
  64. .default_register_type  :ub
  65.  
  66. .reg_count_total        128
  67. .reg_count_payload      7
  68.  
  69. //========== Common constants ==========
  70.  
  71.  
  72. //========== Macros ==========
  73.  
  74.  
  75. //Fast Jump, For more details see "Set_Layer_N.asm"
  76.  
  77.  
  78. //========== Defines ====================
  79.  
  80. //========== Static Parameters (Common To All) ==========
  81. //r1
  82.  
  83.  
  84. //r2
  85.  
  86.                                     //  e.g.            byte0   byte1  byte2
  87.                                     // YUYV               0       1      3
  88.                                     // YVYU               0       3      1
  89.  
  90. //Color Pipe (IECP) parameters
  91.  
  92.  
  93. //ByteCopy
  94.  
  95.  
  96. //r4
  97.  
  98.                                     //  e.g.              byte0           byte1           byte2
  99.                                     // YUYV                 0               1               3
  100.                                     // YVYU                 0               3               1
  101.  
  102.  
  103. //========== Inline parameters (Common To All) ===========
  104.  
  105.  
  106. //============== Binding Index Table===========
  107. //Common between DNDI and DNUV
  108.  
  109.  
  110. //================= Common Message Descriptor =====
  111. // Message descriptor for thread spawning
  112. // Message Descriptors
  113. //                = 000 0001 (min message len 1 ) 0,0000 (resp len 0   -add later)
  114. //                  0000,0000,0000
  115. //                  0001(Spawn a root thread),0001 (Root thread spawn thread)
  116. //                = 0x02000011
  117. // Thread Spawner Message Descriptor
  118.  
  119.  
  120. // Message descriptor for atomic operation add
  121. // Message Descriptors
  122. //                = 000 0110 (min message len 6 ) 0,0000 (resp len 0   -add later)
  123. //                  1(header present)001,10(typed atomic operation)0(return enabled)0(slot group, low 8 bits),0111 (AOP_Add)
  124. //                  0000,0000 (Binding table index, added later)
  125. //                = 0x02000011
  126.  
  127. // Atomic Operation Add Message Descriptor
  128.  
  129.  
  130. // Message descriptor for dataport media write
  131.         // Message Descriptors
  132.                 //                = 000 0001 (min message len 1 - add later) 00000 (resp len 0)
  133.                 //                  1 (header present 1) 0 1010 (media block write) 000000
  134.                 //                  00000000 (binding table index - set later)
  135.                 //                = 0x020A8000
  136.  
  137.  
  138. // Message Length defines
  139.  
  140.  
  141. // Response Length defines
  142.  
  143.  
  144. // Block Width and Height Size defines
  145.  
  146.  
  147. // Extended Message Descriptors
  148.  
  149.  
  150. // Common message descriptors:
  151.  
  152.  
  153. //===================== Math Function Control ===================================
  154.  
  155.  
  156. //============ Message Registers ===============
  157.                              // buf4 starts from r28
  158.  
  159.  
  160. //#define mMSGHDR_EOT  r43    // Dummy Message Register for EOT
  161.  
  162.  
  163. .declare    mubMSGPAYLOAD  Base=r30 ElementSize=1 SrcRegion=<16;16,1> Type=ub
  164. .declare    muwMSGPAYLOAD  Base=r30 ElementSize=2 SrcRegion=<16;16,1> Type=uw
  165. .declare    mudMSGPAYLOAD  Base=r30 ElementSize=4 SrcRegion=<8;8,1> Type=ud
  166. .declare    mfMSGPAYLOAD   Base=r30 ElementSize=4 SrcRegion=<8;8,1> Type=f
  167.  
  168. //=================== End of thread instruction ===========================
  169.  
  170.  
  171. //=====================Pointers Used=====================================
  172.  
  173.  
  174. //=======================================================================
  175.  
  176.  
  177. //r11-r17
  178. // Define temp space for any usages
  179.  
  180.  
  181. // Common Buffers
  182.  
  183.  
  184. // temp space for rotation
  185.  
  186. .declare fROBUF           Base=r11.0            ElementSize=4           SrcRegion=<8;8,1>                 DstRegion=<1>         Type=f
  187.  
  188. .declare udROBUF                Base=r11.0              ElementSize=4           SrcRegion=<8;8,1>                 DstRegion=<1>         Type=ud
  189.  
  190. .declare uwROBUF                Base=r11.0              ElementSize=2           SrcRegion=<16;16,1>             DstRegion=<1>           Type=uw
  191.  
  192. .declare ubROBUF                Base=r11.0              ElementSize=1           SrcRegion=<16;16,1>             DstRegion=<1>           Type=ub
  193.  
  194. .declare ub4ROBUF       Base=r11.0              ElementSize=1           SrcRegion=<32;8,4>              DstRegion=<4>           Type=ub
  195.  
  196.  
  197. // End of common.inc
  198.  
  199.  
  200. // FileName:    DNDI.inc
  201. // Author:      Vivek Kumar
  202. // Description: Include file for DN, DI and DNDI
  203. // Inputs:      DI_ENABLE, DN_ENABLE, DN_PLANAR, DN_PACKED
  204.  
  205.  
  206.  
  207.  
  208. // End of common.inc
  209.  
  210.  
  211. //Interface:
  212. //Static Parameters:
  213. //r1
  214.  
  215.  
  216. //====================== Binding table (Explicit To DNDI)=========================================
  217.  
  218.  
  219. .declare mudMSGHDR_DNDI     Base=r18      ElementSize=4    Type=ud
  220. .declare mdMSGHDR_DNDI      Base=r18      ElementSize=4    Type=d
  221. .declare mwMSGHDR_DNDI      Base=r18      ElementSize=2    Type=w
  222.  
  223.  
  224. .declare mudMSGHDR_STMM     Base=r20      ElementSize=4    Type=ud
  225.  
  226.  
  227. .declare mudMSGHDR_HIST     Base=r22      ElementSize=4    Type=ud
  228.  
  229.  
  230. .declare mudMSGHDR_ENC_STATS Base=r24 ElementSize=4   Type=ud
  231. .declare muwMSGHDR_ENC_STATS Base=r24 ElementSize=2   Type=uw
  232. .declare mubMSGHDR_ENC_STATS Base=r24 ElementSize=1   Type=ub
  233.  
  234.  
  235. .declare mudMSGHDR_DN_OUT   Base=r31.0      ElementSize=4  Type=ud
  236. .declare mdMSGHDR_DN_OUT    Base=r31.0      ElementSize=4  Type=d
  237. .declare mubMSGHDR_DN_OUT   Base=r31.0      ElementSize=1  Type=ub
  238.  
  239.  
  240. .declare mudMSGHDR_UVCOPY   Base=r36      ElementSize=4  Type=ud
  241. .declare mdMSGHDR_UVCOPY    Base=r36      ElementSize=4  Type=d
  242. .declare mudMSGHDR_UCOPY    Base=r36       ElementSize=4  Type=ud
  243. .declare mudMSGHDR_VCOPY    Base=r38       ElementSize=4  Type=ud
  244.  
  245.  
  246. .declare mudMSGHDR_DI_OUT1  Base=r18.0      ElementSize=4     Type=ud
  247. .declare mubMSGHDR_DI_OUT1  Base=r18.0      ElementSize=1     Type=ub
  248.  
  249.  
  250. .declare mudMSGHDR_DI_OUT2  Base=r23.0      ElementSize=4     Type=ud
  251. .declare mubMSGHDR_DI_OUT2  Base=r23.0      ElementSize=1     Type=ub
  252.  
  253. //r45
  254. //Use r45 as message header, so no need to "mov" the data.
  255.  
  256. .declare mudDN_Y_OUT        Base=r45.0 ElementSize=4 SrcRegion=<8;8,1>   DstRegion=<1> Type=ud
  257.  
  258. // Message response (Denoised & DI-ed pixels & statistics); Use buffer 5
  259. .declare udDNDI_RESP        Base=r46.0 ElementSize=4 SrcRegion=<8;8,1>   DstRegion=<1> Type=ud
  260. .declare uwDNDI_RESP        Base=r46.0 ElementSize=2 SrcRegion=<16;16,1> DstRegion=<1> Type=uw
  261. .declare ubDNDI_RESP        Base=r46.0 ElementSize=1 SrcRegion=<16;16,1> DstRegion=<1> Type=ub
  262.  
  263. // Message response (UV Copy); Use buffer 5
  264. .declare udDNDI_UV_RESP     Base=r58.0 ElementSize=4 SrcRegion=<8;8,1>  DstRegion=<1> Type=ud
  265. .declare ubDNDI_UV_RESP     Base=r58.0 ElementSize=1 SrcRegion=<16;16,1>    DstRegion=<1> Type=ub
  266.  
  267. //Temp GRFs: For 42X to 422 Conversion
  268. .declare uwDNDI_UVCOPY_TEMP Base=r10.0 ElementSize=2 SrcRegion=<16;16,1>    DstRegion=<1> Type=uw       //8 GRFs
  269. .declare ubDNDI_UVCOPY_TEMP Base=r10.0 ElementSize=1 SrcRegion=<16;16,1>    DstRegion=<1> Type=ub       //8 GRFs
  270. //---------------------------------------------------------------------------
  271. // Message descriptors
  272. //---------------------------------------------------------------------------
  273. // Extended message descriptor
  274.     // Message descriptor   for sampler read
  275.     //                    = 000 0010 (message len 2) 00000 (resp len - set later, 12 or 5 or 11)
  276.     //                      1 (header present 1) 0 11 (SIMD32/64 mode)
  277.     //                      1000 (message type) 0000 (DI state index)
  278.     //                      00000000 (binding table index - set later)
  279.     //                    = 0x040b8000
  280.  
  281.  
  282. // Attention: The Message Length is The Number of GRFs with Data Only, without the Header
  283.  
  284.  
  285. //---------------------------------------------------------------------------
  286. // VDI Return Data format
  287. //---------------------------------------------------------------------------
  288. // Defines for DI enabled
  289.  
  290.  
  291. // Defines for DI disabled
  292.  
  293.  
  294.  
  295. // FileName:    DNDI_Command.asm
  296. // Author:              Vivek Kumar
  297. // Description: Sends a message to the VDI to process one DN (16x8) or DNDI (16x4) block
  298.  
  299. // Prepare the DNDI send command
  300. mov (8)         mudMSGHDR_DNDI(0)<1>                    r0.0<8;8,1>:ud                                  // message header
  301. mov (1)         mwMSGHDR_DNDI(1,4)<1>                   r9.0<0;1,0>:w           { NoDDClr }             // horizontal origin    // Do we need to add offset here? -vK
  302. mov (1)         mwMSGHDR_DNDI(1,12)<1>                  r9.1<0;1,0>:w           { NoDDChk }             // vertical origin              // Can these 2 be combined? - vK
  303.  
  304. send (8)        udDNDI_RESP(0)<1>       r18     0x2     0x4CE8003:ud
  305.  
  306. // On Gen6, with VDI walker, use the XY pair returned rather than programmed above
  307. // VDI_RETURNED_XY is ordered XY in case of walker enables and the same as programmed in case of walker disabled
  308. mov (2)         r9.0<1>:w     uwDNDI_RESP(9,14)<2;2,1>  // horizontal/Vertial origin in W.14 and W.15
  309.  
  310.  
  311.  
  312. // FileName:    DI_STMM_Save.asm
  313. // Author:              Vivek Kumar
  314. // Description: Saves DI STMM Data to statistics surface in case of DI enabled (for 16x4 block)
  315.  
  316. // Write STMM to memory
  317. mov (8)     mudMSGHDR_STMM(0)<1>        r0.0<8;8,1>:ud                                                                  // message header  
  318. mov (8)     mudMSGHDR_STMM(1)<1>        udDNDI_RESP(8,0)                                                // Move STMM to MRF
  319.  
  320. shr (1)     mudMSGHDR_STMM(0,0)<1>      r9.0<0;1,0>:w            1:w     { NoDDClr }            // X origin / 2
  321. mov (1)     mudMSGHDR_STMM(0,1)<1>      r9.1<0;1,0>:w                    { NoDDClr, NoDDChk }   // Y origin
  322. mov (1)     mudMSGHDR_STMM(0,2)<1>      0x30007:ud           { NoDDChk }                // block width and height (8x4)
  323.  
  324. send (8)        null<1>:d       r20     0x5             0x40A8021:ud      
  325.  
  326.  
  327.  
  328. // FileName:    DN_Hist_Save.asm
  329. // Author:              Vivek Kumar
  330. // Description: Saves DN history data to statistics surface
  331.  
  332. // Write denoise history to memory
  333. mov (8)    r27<1>:ud                            r0.0<8;8,1>:ud                                          // message header  
  334.  
  335.         mov (1)    mudMSGHDR_HIST(1)<1>         udDNDI_RESP(9,0)<0;1,0>         // Move denoise history to MRF (4x1)
  336.  
  337.  
  338. shr (2)    r27.0<1>:ud          r9.0<2;2,1>:w                           2:w                                     // X,Y origin / 4
  339. add (1)    r27.0<1>:ud          r27.0<0;1,0>:ud                 r1.12<0;1,0>:uw         { NoDDClr }     // Add pitch to X origin
  340. mov (1)    r27.2<1>:ud          0x3:ud                                                                  { NoDDChk }     // block width and height
  341.  
  342. mov (8)         mudMSGHDR_HIST(0)<1>            r27.0<8;8,1>:ud
  343. send (8)        null<1>:d       r22     0x5             0x40A8021:ud
  344.  
  345.  
  346.  
  347. // FileName:    DNDI_Enc_Stats_Save.asm
  348. // Author:              Vivek Kumar
  349. // Description: Saves Encoder Statistics data to statistics surface in case of DI enabled (for 16x4 block)
  350.  
  351. // Write encoder statistics to memory
  352. //Currently enable this only on Gen6 validation
  353. mov (8)         mudMSGHDR_ENC_STATS(1)<1>       0x0:ud                                          // Init payload MRF
  354. mov (8)         mudMSGHDR_ENC_STATS(0)<1>       r0.0<8;8,1>:ud                          // message header
  355.  
  356. shr (1)         mudMSGHDR_ENC_STATS(0,0)<1>             r9.0<0;1,0>:w                   1:w     { NoDDClr }                     //enable the flag after testing on si                                   { NoDDClr }     // X origin / 2
  357. mul (1)         acc0.1<1>:ud                                    r9.1<0;1,0>:w                           3:w                                                                                                                                                                                     // Y origin * 3
  358. 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
  359. mov (1)         mudMSGHDR_ENC_STATS(0,2)<1>             0x20007:ud                              { NoDDChk }                     //enable the flag after testing on si                                           { NoDDChk } // block width and height (8x3)
  360. 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
  361.  
  362.  
  363.         //Data block for Encoder Statistics
  364.         //----------------------------------------------------
  365.         //|  0  |   1  |   2   |  3  |  4  |  5  |  6  |  7  | Bytes
  366.         //----------------------------------------------------
  367.         //| BNE | MCNT | FCNT | TCNT |  X  |  X  |  X  |  X  |
  368.         //----------------------------------------------------
  369.         //|   DcTpT    |     SVCM    |   DcBpT   |   DcTpB   |
  370.         //----------------------------------------------------
  371.         //|   SHCM     |     STAD    |   DcTcB   |   DcBpB   |
  372.         //----------------------------------------------------
  373.         mov (1)         mudMSGHDR_ENC_STATS(1,0)<1>             udDNDI_RESP(9,1)<0;1,0>                 { NoDDClr }                     // Move encoder statistics to MRF
  374.         mov (2)         mudMSGHDR_ENC_STATS(1,3)<2>             udDNDI_RESP(9,3)<2;2,1>                 { NoDDClr, NoDDChk }            // Move encoder statistics to MRF
  375.         mov (2)         mudMSGHDR_ENC_STATS(1,2)<2>             udDNDI_RESP(9,5)<2;2,1>                 { NoDDChk }                     // Move encoder statistics to MRF
  376.  
  377.  
  378. send (8)   null<1>:d    r24    0x5    0x40A8021:ud
  379.  
  380.  
  381.  
  382. // FileName:    DN_Save_PA_16x4.asm
  383. // Author:              Vivek Kumar
  384. // Description: Save one 16x4 blocks of DN output in Packed format for reference
  385.  
  386.  
  387.  // check top/bottom field first
  388. cmp.e.f0.0 (1)  null<1>:w               r1.28<0;1,0>:ub     1:w
  389.  
  390. add (4)         a0.4<1>:uw   r4.0<4;4,1>:ub   1024:w    // Initial Y,U,V offset in YUV422 block; it starts at m14
  391.  
  392. mov (8)         mudMSGHDR_DN_OUT(0)<1>          r0<8;8,1>:ud                                    // message header
  393. shl (1)     mdMSGHDR_DN_OUT(0,0)<1>             r9.0<0;1,0>:w     1:w           { NoDDClr }            // X origin * 2 (422 output)
  394. mov (1)     mdMSGHDR_DN_OUT(0,1)<1>             r9.1<0;1,0>:w                   { NoDDClr, NoDDChk }   // Y origin
  395. mov (1)     mudMSGHDR_DN_OUT(0,2)<1>    0x3001F:ud      { NoDDChk }            // block width and height (32x8)
  396.  
  397. (f0.0) jmpi (1) TOP_FIELD_FIRST
  398.  
  399. BOTTOM_FIELD_FIRST:
  400.         mov (16)    r[a0.4,  0]<2>:ub     ubDNDI_RESP(10,0)     { NoDDClr }     // 2nd field luma from current frame (line 0,2)
  401.         mov (16)    r[a0.4,  32]<2>:ub   ubDNDI_RESP(4,16)              { NoDDClr }     // 1st field luma from current frame (line 1,3)
  402.         mov (16)    r[a0.4,  64]<2>:ub     ubDNDI_RESP(10,16)   { NoDDClr }     // 2nd field luma from current frame (line 0,2)
  403.         mov (16)    r[a0.4,  96]<2>:ub   ubDNDI_RESP(5,16)              { NoDDClr }     // 1st field luma from current frame (line 1,3)
  404.         mov (8)     r[a0.5,  0]<4>:ub     ubDNDI_RESP(11,1)<16;8,2> { NoDDClr, NoDDChk }        // 2nd field U from current frame (line 0,2)
  405.         mov (8)     r[a0.5,  32]<4>:ub   ubDNDI_RESP(6,17)<16;8,2>      { NoDDClr, NoDDChk }    // 1st field U from current frame (line 1,3)
  406.         mov (8)     r[a0.5,  64]<4>:ub     ubDNDI_RESP(11,17)<16;8,2> { NoDDClr, NoDDChk }      // 2nd field U from current frame (line 0,2)
  407.         mov (8)     r[a0.5,  96]<4>:ub   ubDNDI_RESP(7,17)<16;8,2>      { NoDDClr, NoDDChk }    // 1st field U from current frame (line 1,3)
  408.         mov (8)     r[a0.6,  0]<4>:ub     ubDNDI_RESP(11,0)<16;8,2>     { NoDDChk }             // 2nd field V from current frame (line 0,2)
  409.         mov (8)     r[a0.6,  32]<4>:ub   ubDNDI_RESP(6,16)<16;8,2>              { NoDDChk }             // 1st field U from current frame (line 1,3)
  410.         mov (8)     r[a0.6,  64]<4>:ub     ubDNDI_RESP(11,16)<16;8,2>   { NoDDChk }             // 2nd field V from current frame (line 0,2)
  411.         mov (8)     r[a0.6,  96]<4>:ub   ubDNDI_RESP(7,16)<16;8,2>              { NoDDChk }             // 1st field U from current frame (line 1,3)
  412. jmpi (1) SAVE_DN_CURR
  413.  
  414. TOP_FIELD_FIRST:
  415.         mov (16)    r[a0.4,  0]<2>:ub       ubDNDI_RESP(4,0)            { NoDDClr }     // 1st field luma from current frame (line 0,2)
  416.         mov (16)    r[a0.4,  32]<2>:ub     ubDNDI_RESP(10,0)    { NoDDClr }     // 2nd field luma from current frame (line 1,3)
  417.         mov (16)    r[a0.4,  64]<2>:ub       ubDNDI_RESP(5,0)           { NoDDClr }     // 1st field luma from current frame (line 0,2)
  418.         mov (16)    r[a0.4,  96]<2>:ub     ubDNDI_RESP(10,16)   { NoDDClr }     // 2nd field luma from current frame (line 1,3)
  419.         mov (8)     r[a0.5,  0]<4>:ub       ubDNDI_RESP(6,1)<16;8,2>                    { NoDDClr, NoDDChk }    // 1st field U from current frame (line 0,2)
  420.         mov (8)     r[a0.5,  32]<4>:ub     ubDNDI_RESP(11,1)<16;8,2>    { NoDDClr, NoDDChk }    // 2nd field U from current frame (line 1,3)
  421.         mov (8)     r[a0.5,  64]<4>:ub       ubDNDI_RESP(7,1)<16;8,2>                   { NoDDClr, NoDDChk }    // 1st field U from current frame (line 0,2)
  422.         mov (8)     r[a0.5,  96]<4>:ub     ubDNDI_RESP(11,17)<16;8,2>   { NoDDClr, NoDDChk }    // 2nd field U from current frame (line 1,3)
  423.         mov (8)     r[a0.6,  0]<4>:ub       ubDNDI_RESP(6,0)<16;8,2>                    { NoDDChk }     // 1st field V from current frame (line 0,2)
  424.         mov (8)     r[a0.6,  32]<4>:ub     ubDNDI_RESP(11,0)<16;8,2>    { NoDDChk }     // 2nd field V from current frame (line 1,3)
  425.         mov (8)     r[a0.6,  64]<4>:ub       ubDNDI_RESP(7,0)<16;8,2>                   { NoDDChk }     // 1st field V from current frame (line 0,2)
  426.         mov (8)     r[a0.6,  96]<4>:ub     ubDNDI_RESP(11,16)<16;8,2>   { NoDDChk }     // 2nd field V from current frame (line 1,3)
  427.  
  428. SAVE_DN_CURR:
  429. //send out data through data port
  430. send (8)    null<1>:d    r31.0          0x5    0xA0A8018:ud
  431.  
  432.  
  433.  
  434. // FileName:    DI_Save_PA_16x4.asm
  435. // Author:      Vivek Kumar
  436. // Description: Save two 16x4 blocks of DI output in Packed format
  437.  
  438.  
  439. 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
  440.  
  441. mov (8) r27.0<1>:ud     r0.0<8;8,1>:ud
  442. shl (1) r27.0<1>:d      r9.0<0;1,0>:w            1:w  { NoDDClr }          // H. block origin need to be doubled
  443. mov (1) r27.1<1>:d      r9.1<0;1,0>:w                 { NoDDClr, NoDDChk }       // Block origin
  444. mov (1) r27.2<1>:ud     0x3001F:ud          { NoDDChk }          // Block width and height (32x8)
  445.  
  446. //prepare the message headers
  447. mov (8) r18.0<1>:ud       r27<8;8,1>:ud
  448. mov (8) r23.0<1>:ud       r27<8;8,1>:ud
  449.  
  450. // Pack 2nd field Y
  451.     mov (16)    r[a0.4, 0]<2>      ubDNDI_RESP(0,0)               { NoDDClr }
  452.     mov (16)    r[a0.4, 32]<2>      ubDNDI_RESP(0,16)               { NoDDClr }
  453.     mov (16)    r[a0.4, 64]<2>      ubDNDI_RESP(0,32)               { NoDDClr }
  454.     mov (16)    r[a0.4, 96]<2>      ubDNDI_RESP(0,48)               { NoDDClr }
  455. // Pack 2nd field U
  456.     mov (8)     r[a0.5, 0]<4>      ubDNDI_RESP(2,1)<16;8,2>   { NoDDClr, NoDDChk }  //U pixels
  457.     mov (8)     r[a0.5, 32]<4>      ubDNDI_RESP(2,17)<16;8,2>   { NoDDClr, NoDDChk }  //U pixels
  458.     mov (8)     r[a0.5, 64]<4>      ubDNDI_RESP(2,33)<16;8,2>   { NoDDClr, NoDDChk }  //U pixels
  459.     mov (8)     r[a0.5, 96]<4>      ubDNDI_RESP(2,49)<16;8,2>   { NoDDClr, NoDDChk }  //U pixels
  460. // Pack 2nd field V
  461.     mov (8)     r[a0.6, 0]<4>      ubDNDI_RESP(2,0)<16;8,2>     { NoDDChk }     //Vpixels
  462.     mov (8)     r[a0.6, 32]<4>      ubDNDI_RESP(2,16)<16;8,2>     { NoDDChk }     //Vpixels
  463.     mov (8)     r[a0.6, 64]<4>      ubDNDI_RESP(2,32)<16;8,2>     { NoDDChk }     //Vpixels
  464.     mov (8)     r[a0.6, 96]<4>      ubDNDI_RESP(2,48)<16;8,2>     { NoDDChk }     //Vpixels
  465.  
  466. // Pack 1st field Y
  467.     mov (16)    r[a0.4, 160]<2>    ubDNDI_RESP(4,0)               { NoDDClr }
  468.     mov (16)    r[a0.4, 192]<2>    ubDNDI_RESP(4,16)               { NoDDClr }
  469.     mov (16)    r[a0.4, 224]<2>    ubDNDI_RESP(4,32)               { NoDDClr }
  470.     mov (16)    r[a0.4, 256]<2>    ubDNDI_RESP(4,48)               { NoDDClr }
  471. // Pack 1st field U
  472.     mov (8)     r[a0.5, 160]<4>    ubDNDI_RESP(6,1)<16;8,2>   { NoDDClr, NoDDChk }  //U pixels
  473.     mov (8)     r[a0.5, 192]<4>    ubDNDI_RESP(6,17)<16;8,2>   { NoDDClr, NoDDChk }  //U pixels
  474.     mov (8)     r[a0.5, 224]<4>    ubDNDI_RESP(6,33)<16;8,2>   { NoDDClr, NoDDChk }  //U pixels
  475.     mov (8)     r[a0.5, 256]<4>    ubDNDI_RESP(6,49)<16;8,2>   { NoDDClr, NoDDChk }  //U pixels
  476. // Pack 1st field V
  477.     mov (8)     r[a0.6, 160]<4>    ubDNDI_RESP(6,0)<16;8,2>     { NoDDChk }     //Vpixels
  478.     mov (8)     r[a0.6, 192]<4>    ubDNDI_RESP(6,16)<16;8,2>     { NoDDChk }     //Vpixels
  479.     mov (8)     r[a0.6, 224]<4>    ubDNDI_RESP(6,32)<16;8,2>     { NoDDChk }     //Vpixels
  480.     mov (8)     r[a0.6, 256]<4>    ubDNDI_RESP(6,48)<16;8,2>     { NoDDChk }     //Vpixels
  481.  
  482. //save the previous frame
  483. send (8)    null<1>:d    r18.0     0x5     0xA0A801B:ud
  484.  
  485. //save the current frame
  486. send (8)    null<1>:d    r23.0     0x5     0xA0A801E:ud
  487.  
  488.  
  489.  
  490. //End of Thread message
  491.  
  492. mov (8) r127<1>:ud r0.0<8;8,1>:ud
  493.  send (1) null<1>:d r127 0x27 0x02000010
  494.  
  495.  
  496. .end_code
  497. .end_kernel
  498.