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. //  131    // Total instruction count
  39. //    1    // Total kernel count
  40.  
  41.  
  42.  
  43. // Module name: common.inc
  44. //
  45. // Common header file for all Video-Processing kernels
  46. //
  47.  
  48. .default_execution_size (16)
  49. .default_register_type  :ub
  50.  
  51. .reg_count_total        128
  52. .reg_count_payload      7
  53.  
  54. //========== Common constants ==========
  55.  
  56.  
  57. //========== Macros ==========
  58.  
  59.  
  60. //Fast Jump, For more details see "Set_Layer_N.asm"
  61.  
  62.  
  63. //========== Defines ====================
  64.  
  65. //========== Static Parameters (Common To All) ==========
  66. //r1
  67.  
  68.  
  69. //r2
  70.  
  71.                                     //  e.g.            byte0   byte1  byte2
  72.                                     // YUYV               0       1      3
  73.                                     // YVYU               0       3      1
  74.  
  75. //Color Pipe (IECP) parameters
  76.  
  77.  
  78. //ByteCopy
  79.  
  80.  
  81. //r4
  82.  
  83.                                     //  e.g.              byte0           byte1           byte2
  84.                                     // YUYV                 0               1               3
  85.                                     // YVYU                 0               3               1
  86.  
  87.  
  88. //========== Inline parameters (Common To All) ===========
  89.  
  90.  
  91. //============== Binding Index Table===========
  92. //Common between DNDI and DNUV
  93.  
  94.  
  95. //================= Common Message Descriptor =====
  96. // Message descriptor for thread spawning
  97. // Message Descriptors
  98. //                = 000 0001 (min message len 1 ) 0,0000 (resp len 0   -add later)
  99. //                  0000,0000,0000
  100. //                  0001(Spawn a root thread),0001 (Root thread spawn thread)
  101. //                = 0x02000011
  102. // Thread Spawner Message Descriptor
  103.  
  104.  
  105. // Message descriptor for atomic operation add
  106. // Message Descriptors
  107. //                = 000 0110 (min message len 6 ) 0,0000 (resp len 0   -add later)
  108. //                  1(header present)001,10(typed atomic operation)0(return enabled)0(slot group, low 8 bits),0111 (AOP_Add)
  109. //                  0000,0000 (Binding table index, added later)
  110. //                = 0x02000011
  111.  
  112. // Atomic Operation Add Message Descriptor
  113.  
  114.  
  115. // Message descriptor for dataport media write
  116.         // Message Descriptors
  117.                 //                = 000 0001 (min message len 1 - add later) 00000 (resp len 0)
  118.                 //                  1 (header present 1) 0 1010 (media block write) 000000
  119.                 //                  00000000 (binding table index - set later)
  120.                 //                = 0x020A8000
  121.  
  122.  
  123. // Message Length defines
  124.  
  125.  
  126. // Response Length defines
  127.  
  128.  
  129. // Block Width and Height Size defines
  130.  
  131.  
  132. // Extended Message Descriptors
  133.  
  134.  
  135. // Common message descriptors:
  136.  
  137.  
  138. //===================== Math Function Control ===================================
  139.  
  140.  
  141. //============ Message Registers ===============
  142.                              // buf4 starts from r28
  143.  
  144.  
  145. //#define mMSGHDR_EOT  r43    // Dummy Message Register for EOT
  146.  
  147.  
  148. .declare    mubMSGPAYLOAD  Base=r30 ElementSize=1 SrcRegion=<16;16,1> Type=ub
  149. .declare    muwMSGPAYLOAD  Base=r30 ElementSize=2 SrcRegion=<16;16,1> Type=uw
  150. .declare    mudMSGPAYLOAD  Base=r30 ElementSize=4 SrcRegion=<8;8,1> Type=ud
  151. .declare    mfMSGPAYLOAD   Base=r30 ElementSize=4 SrcRegion=<8;8,1> Type=f
  152.  
  153. //=================== End of thread instruction ===========================
  154.  
  155.  
  156. //=====================Pointers Used=====================================
  157.  
  158.  
  159. //=======================================================================
  160.  
  161.  
  162. //r11-r17
  163. // Define temp space for any usages
  164.  
  165.  
  166. // Common Buffers
  167.  
  168.  
  169. // temp space for rotation
  170.  
  171. .declare fROBUF           Base=r11.0            ElementSize=4           SrcRegion=<8;8,1>                 DstRegion=<1>         Type=f
  172.  
  173. .declare udROBUF                Base=r11.0              ElementSize=4           SrcRegion=<8;8,1>                 DstRegion=<1>         Type=ud
  174.  
  175. .declare uwROBUF                Base=r11.0              ElementSize=2           SrcRegion=<16;16,1>             DstRegion=<1>           Type=uw
  176.  
  177. .declare ubROBUF                Base=r11.0              ElementSize=1           SrcRegion=<16;16,1>             DstRegion=<1>           Type=ub
  178.  
  179. .declare ub4ROBUF       Base=r11.0              ElementSize=1           SrcRegion=<32;8,4>              DstRegion=<4>           Type=ub
  180.  
  181.  
  182. // End of common.inc
  183.  
  184.  
  185. // Module name: Save_AVS_NV12.asm
  186. //
  187. // Save NV12 420 frame data block of size 16x16
  188. //
  189. // To save 16x16 block (16x16 bytes of Y and 16x8 bytes of interleaved UV), we need 2 send instructions with of size 16x16 and 16x8 each.
  190. //  ---------------
  191. //  |    16x16    |
  192. //  |    YUYV     |
  193. //  ---------------
  194. //  | 16x8  UV    |
  195. //  ---------------
  196.  
  197. //-----------------------------------------------------------------
  198. //The layout of data is as follows:
  199. //mMSGHDR0                      : Y data header (16x16)
  200. //mubMSGPAYLOAD0        : Y data payload (8 GRFs)
  201. //mMSGHDR1                      : U data header (16x8)
  202. //mubMSGPAYLOAD1        : U data payload (4 GRFs)
  203. //------------------------------------------------------------------
  204.  
  205.  
  206.  
  207. // Module name: Save.inc
  208.  
  209.  
  210.  
  211.  
  212. // Description: Includes all definitions explicit to Fast Composite.
  213.  
  214.  
  215.  
  216.  
  217. // End of common.inc
  218.  
  219.  
  220. //========== GRF partition ==========
  221.      // r0 header            :   r0          (1 GRF)
  222.      // Static parameters    :   r1 - r6     (6 GRFS)
  223.      // Inline parameters    :   r7 - r8     (2 GRFs)
  224.      // MSGSRC               :   r27         (1 GRF)
  225. //===================================
  226.  
  227. //Interface:
  228. //========== Static Parameters (Explicit To Fast Composite) ==========
  229. //r1
  230. //CSC Set 0
  231.  
  232.  
  233. .declare udCSC_CURBE    Base=r1.0      ElementSize=4       Type=ud
  234.  
  235. //Constant alpha
  236.  
  237.  
  238. //r2
  239.  
  240.  
  241. // Gen7 AVS WA
  242.  
  243.  
  244. // WiDi Definitions
  245.  
  246.  
  247. //Colorfill
  248.  
  249.  
  250.                                       // 0: 0-degree, 1: 90, 2: 180, 3: 270-degree, clockwise.     
  251.  
  252. .declare ubCOLOR_PIXEL_VAL      Base=r2.20      ElementSize=1       SrcRegion=<0;1,0>       DstRegion=<1>       Type=ub
  253.  
  254. //r3
  255. //Normalised Ratio of Horizontal step size with main video for all layers
  256.  
  257.  
  258.     //Normalised Ratio of Horizontal step size with main video for all layers becomes
  259.     //Normalised Horizontal step size for all layers in VP_Setup.asm
  260.  
  261.  
  262. //r4
  263. //Normalised Vertical step size for all layers
  264.  
  265.  
  266. //r5
  267. //Normalised Vertical Frame Origin for all layers
  268.  
  269.  
  270. //r6
  271. //Normalised Horizontal Frame Origin for all layers
  272.  
  273.  
  274. //========== Inline Parameters (Explicit To Fast Composite) ==========
  275.  
  276.  
  277. //Main video Step X
  278.  
  279.  
  280. //====================== Binding table (Explicit To Fast Composite)=========================================
  281.  
  282.  
  283. //Used by Interlaced Scaling Kernels
  284.  
  285.  
  286. //========== Sampler State Table Index (Explicit To Fast Composite)==========
  287. //Sampler Index for AVS/IEF messages
  288.  
  289.  
  290. //Sampler Index for SIMD16 sampler messages
  291.  
  292.  
  293. //=============================================================================
  294.  
  295. .declare fBUFFER_0      Base=r64.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
  296. .declare fBUFFER_1      Base=r80.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
  297. .declare fBUFFER_2      Base=r96.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
  298. .declare fBUFFER_3      Base=r112.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
  299. .declare fBUFFER_4      Base=r28.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
  300. .declare fBUFFER_5      Base=r46.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
  301.  
  302. .declare udBUFFER_0     Base=r64.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
  303. .declare udBUFFER_1     Base=r80.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
  304. .declare udBUFFER_2     Base=r96.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
  305. .declare udBUFFER_3     Base=r112.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
  306. .declare udBUFFER_4     Base=r28.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
  307. .declare udBUFFER_5     Base=r46.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
  308.  
  309. .declare uwBUFFER_0     Base=r64.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
  310. .declare uwBUFFER_1     Base=r80.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
  311. .declare uwBUFFER_2     Base=r96.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
  312. .declare uwBUFFER_3     Base=r112.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
  313. .declare uwBUFFER_4     Base=r28.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
  314. .declare uwBUFFER_5     Base=r46.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
  315.  
  316. .declare ubBUFFER_0     Base=r64.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
  317. .declare ubBUFFER_1     Base=r80.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
  318. .declare ubBUFFER_2     Base=r96.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
  319. .declare ubBUFFER_3     Base=r112.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
  320. .declare ubBUFFER_4     Base=r28.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
  321. .declare ubBUFFER_5     Base=r46.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
  322.  
  323. .declare ub4BUFFER_0    Base=r64.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
  324. .declare ub4BUFFER_1    Base=r80.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
  325. .declare ub4BUFFER_2    Base=r96.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
  326. .declare ub4BUFFER_3    Base=r112.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
  327. .declare ub4BUFFER_4    Base=r28.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
  328. .declare ub4BUFFER_5    Base=r46.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
  329.  
  330. //Pointer to mask reg
  331.  
  332.  
  333. //r18
  334.  
  335.  
  336. //Always keep Cannel Pointers and Offsets in same GRF, so that we can use
  337. // NODDCLR, NODDCHK flags. -rT
  338.  
  339.  
  340. .declare udCSC_COEFF_0  Base=r18.0    ElementSize=4 Type=ud       // 1 GRF
  341.  
  342. //r19
  343.  
  344.  
  345. .declare udCSC_COEFF_1  Base=r19.0    ElementSize=4 Type=ud       // 1 GRF
  346.  
  347.  
  348. //r20
  349.  
  350. .declare uwALPHA_MASK_REG_TEMP  Base=r20.0    ElementSize=2 SrcRegion=<16;16,1> Type=uw        // 1 GRF
  351.  
  352. //r21
  353.  
  354. .declare uwALPHA_MASK_REG       Base=r21.0         ElementSize=2 SrcRegion=<16;16,1> Type=uw        // 1 GRF
  355.  
  356. //r22
  357.  
  358.  
  359. //Always keep Cannel Pointers and Offsets in same GRF, so that we can use
  360. // NODDCLR, NODDCHK flags. -rT
  361.  
  362.  
  363. //Keep fORIGIN_X_NLAS, fY_OFFSET_2ND_BLOCK, fSTEP_X_NLAS, pMSGDSC_COPY, ubCONST_ALPHA_COPY as
  364. //sub registers of same GRF to enable using NODDCLR NODDCHK. -rT
  365.  
  366. //r23
  367.  
  368.  
  369. //Lumakey
  370.  
  371.  
  372. //r24
  373.  
  374.  
  375. //r25
  376.  
  377.  
  378. //r26
  379.  
  380.  
  381. //defines to generate LABELS during compile time.
  382.  
  383.  
  384. //Msg payload buffers; upto 4 full-size messages can be written
  385.  
  386.  
  387. .declare    mudMSGPAYLOAD0  Base=r29.0 ElementSize=4 SrcRegion=<8;8,1> Type=ud
  388. .declare    mudMSGPAYLOAD1  Base=r38.0 ElementSize=4 SrcRegion=<8;8,1> Type=ud
  389. .declare    mudMSGPAYLOAD2  Base=r47.0 ElementSize=4 SrcRegion=<8;8,1> Type=ud
  390. .declare    mudMSGPAYLOAD3  Base=r56.0 ElementSize=4 SrcRegion=<8;8,1> Type=ud
  391.  
  392. .declare    muwMSGPAYLOAD0  Base=r29.0 ElementSize=2 SrcRegion=<16;16,1> Type=uw
  393. .declare    muwMSGPAYLOAD1  Base=r38.0 ElementSize=2 SrcRegion=<16;16,1> Type=uw
  394. .declare    muwMSGPAYLOAD2  Base=r47.0 ElementSize=2 SrcRegion=<16;16,1> Type=uw
  395. .declare    muwMSGPAYLOAD3  Base=r56.0 ElementSize=2 SrcRegion=<16;16,1> Type=uw
  396.  
  397. .declare    mubMSGPAYLOAD0  Base=r29.0 ElementSize=1 SrcRegion=<16;16,1> Type=ub
  398. .declare    mubMSGPAYLOAD1  Base=r38.0 ElementSize=1 SrcRegion=<16;16,1> Type=ub
  399. .declare    mubMSGPAYLOAD2  Base=r47.0 ElementSize=1 SrcRegion=<16;16,1> Type=ub
  400. .declare    mubMSGPAYLOAD3  Base=r56.0 ElementSize=1 SrcRegion=<16;16,1> Type=ub
  401. .declare    mubMSGPAYLOAD4  Base=r32.0 ElementSize=1 SrcRegion=<16;16,1> Type=ub
  402. .declare    mubMSGPAYLOAD5  Base=r41.0 ElementSize=1 SrcRegion=<16;16,1> Type=ub
  403. .declare    mubMSGPAYLOAD6  Base=r50.0 ElementSize=1 SrcRegion=<16;16,1> Type=ub
  404. .declare    mubMSGPAYLOAD7  Base=r59.0 ElementSize=1 SrcRegion=<16;16,1> Type=ub
  405.  
  406.  
  407.         // the r17 register (nTEMP0) is originally defined from "Common.inc"
  408.         // instead of re-defining a nTEMP0 here, we use "SAVE_RGB" suffix for its naming
  409.  
  410.         .declare uwTemp0 Base=r17.0 ElementSize=2 Type=uw
  411.  
  412.  
  413. //_SAVE_INC_
  414.  
  415.  
  416.         // At the save module we have all 8 address sub-registers available.
  417.         // So we will use PING-PONG type of scheme to save the data using
  418.         // pointers pBUF_CHNL_TOP_8x4 and pBUF_CHNL_BOT_8x4. This will help
  419.         // reduce dependency. - rT
  420.  
  421.         //wBUFF_CHNL_PTR points to either buffer 0 or buffer 4.
  422.         //Add appropriate offsets to get pointers for all buffers (1,2,3 or 5).
  423.         //Offsets are zero for buffer 0 and buffer 4.
  424.         add   (4) a0.0:uw   r22.0<4;4,1>:w          0:uw
  425.         add   (4) a0.4:uw   r22.0<4;4,1>:w          512:uw
  426.  
  427.         //Set up header for Y,U and V data
  428.         mov  (8) r28<1>:ud      r27<8;8,1>:ud
  429.         mov  (8) r37<1>:ud      r27<8;8,1>:ud
  430.  
  431.         mov  (2) r28.0<1>:d     r9.0<2;2,1>:w                                   { NoDDClr }             //ORI Y (LUMA)  = ORI
  432.         mov  (1) r37.0<1>:d     r9.0<0;1,0>:w                                   { NoDDClr }             //H ORI (CHROMA)        = H ORI
  433.         shr  (1) r37.1<1>:d     r9.1<0;1,0>:w            1:w            { NoDDClr, NoDDChk }    //V ORI (CHROMA)        = V ORI/2
  434.  
  435.         mov  (1) r28.2<1>:ud    0xF000F:ud      { NoDDChk }  // Y Block width and height (16x16)
  436.         mov  (1) r37.2<1>:ud    0x7000F:ud      { NoDDChk }  // UV Block width and height(16x8)
  437.  
  438. // Unscramble, and pack data directly to MRFs
  439.  
  440. //      Data 16x16 block is divided as -
  441. //              ---------
  442. //              |   0   |
  443. //              ---------
  444. //              |   1   |
  445. //              ---------
  446. //              |   2   |
  447. //              ---------
  448. //              |   3   |
  449. //              ---------
  450. //              All sub-blocks are of size 16x4
  451. //              0: ubBUFFER_0
  452. //              1: ubBUFFER_1, ubBUFFER_0+16
  453. //              2: ubBUFFER_2
  454. //              3: ubBUFFER_3, ubBUFFER_2+16
  455.  
  456.         //Y Rounding 16x4 top part
  457.         add.sat (16) r[a0.1,0]<1>:uw            r[a0.1,0]<16;16,1>:uw                   0x0080:uw              
  458.         add.sat (16) r[a0.1,32]<1>:uw           r[a0.1,32]<16;16,1>:uw          0x0080:uw              
  459.         add.sat (16) r[a0.1,64]<1>:uw           r[a0.1,64]<16;16,1>:uw          0x0080:uw              
  460.         add.sat (16) r[a0.1,96]<1>:uw           r[a0.1,96]<16;16,1>:uw          0x0080:uw              
  461.  
  462.         // U Averaging and Rounding, 8x2 top part
  463.         shr   (8)       uwBUFFER_5(0,0)<2>                      r[a0.2,0]<16;8,2>:uw                    1:w
  464.         shr       (8)   uwBUFFER_5(1,0)<2>                      r[a0.2,32]<16;8,2>:uw                   1:w
  465.         shr       (8)   uwBUFFER_5(2,0)<2>                      r[a0.2,64]<16;8,2>:uw                   1:w
  466.         shr   (8)       uwBUFFER_5(3,0)<2>                      r[a0.2,96]<16;8,2>:uw                   1:w
  467.  
  468.         add       (8)   uwBUFFER_5(0,0)<2>                      uwBUFFER_5(0,0)<16;8,2>                         uwBUFFER_5(1,0)<16;8,2>
  469.         add.sat (8) r[a0.2,0]<2>:uw             uwBUFFER_5(0,0)<16;8,2>                         0x0080:uw
  470.  
  471.         add       (8)   uwBUFFER_5(2,0)<2>                      uwBUFFER_5(2,0)<16;8,2>                         uwBUFFER_5(3,0)<16;8,2>
  472.         add.sat (8) r[a0.2,64]<2>:uw            uwBUFFER_5(2,0)<16;8,2>                         0x0080:uw
  473.  
  474.         // V Averaging and Rounding, 8x2 top part
  475.         shr   (8)       uwBUFFER_5(4,0)<2>                      r[a0.0,0]<16;8,2>:uw                    1:w
  476.         shr       (8)   uwBUFFER_5(5,0)<2>                      r[a0.0,32]<16;8,2>:uw                   1:w
  477.         shr       (8)   uwBUFFER_5(6,0)<2>                      r[a0.0,64]<16;8,2>:uw                   1:w
  478.         shr   (8)       uwBUFFER_5(7,0)<2>                      r[a0.0,96]<16;8,2>:uw                   1:w
  479.  
  480.         add       (8)   uwBUFFER_5(4,0)<2>                      uwBUFFER_5(4,0)<16;8,2>                         uwBUFFER_5(5,0)<16;8,2>
  481.         add.sat (8) r[a0.0,0]<2>:uw             uwBUFFER_5(4,0)<16;8,2>                         0x0080:uw
  482.  
  483.         add       (8)   uwBUFFER_5(6,0)<2>                      uwBUFFER_5(6,0)<16;8,2>                         uwBUFFER_5(7,0)<16;8,2>
  484.         add.sat (8) r[a0.0,64]<2>:uw            uwBUFFER_5(6,0)<16;8,2>                         0x0080:uw
  485.  
  486.         add   (4) a0.0:uw                       r22.0<4;4,1>:w          1024:uw //Update Buffer 2 pointers
  487.  
  488.         //Y Rounding, 16x4 bottom part
  489.         add.sat (16) r[a0.5,0]<1>:uw            r[a0.5,0]<16;16,1>:uw                   0x0080:uw              
  490.         add.sat (16) r[a0.5,32]<1>:uw           r[a0.5,32]<16;16,1>:uw          0x0080:uw              
  491.         add.sat (16) r[a0.5,64]<1>:uw           r[a0.5,64]<16;16,1>:uw          0x0080:uw              
  492.         add.sat (16) r[a0.5,96]<1>:uw           r[a0.5,96]<16;16,1>:uw          0x0080:uw              
  493.  
  494.         // U Averaging and Rounding, 8x2 bottom part
  495.         shr   (8)       uwBUFFER_5(0,0)<2>                      r[a0.6,0]<16;8,2>:uw                    1:w
  496.         shr       (8)   uwBUFFER_5(1,0)<2>                      r[a0.6,32]<16;8,2>:uw                   1:w
  497.         shr       (8)   uwBUFFER_5(2,0)<2>                      r[a0.6,64]<16;8,2>:uw                   1:w
  498.         shr   (8)       uwBUFFER_5(3,0)<2>                      r[a0.6,96]<16;8,2>:uw                   1:w
  499.  
  500.         add       (8)   uwBUFFER_5(0,0)<2>                      uwBUFFER_5(0,0)<16;8,2>                         uwBUFFER_5(1,0)<16;8,2>
  501.         add.sat (8) r[a0.6,0]<2>:uw             uwBUFFER_5(0,0)<16;8,2>                         0x0080:uw
  502.  
  503.         add       (8)   uwBUFFER_5(2,0)<2>                      uwBUFFER_5(2,0)<16;8,2>                         uwBUFFER_5(3,0)<16;8,2>
  504.         add.sat (8) r[a0.6,64]<2>:uw            uwBUFFER_5(2,0)<16;8,2>                         0x0080:uw
  505.  
  506.         // V Averaging and Rounding, 8x2 bottom part
  507.         shr   (8)       uwBUFFER_5(4,0)<2>                      r[a0.4,0]<16;8,2>:uw                    1:w
  508.         shr       (8)   uwBUFFER_5(5,0)<2>                      r[a0.4,32]<16;8,2>:uw                   1:w
  509.         shr       (8)   uwBUFFER_5(6,0)<2>                      r[a0.4,64]<16;8,2>:uw                   1:w
  510.         shr   (8)       uwBUFFER_5(7,0)<2>                      r[a0.4,96]<16;8,2>:uw                   1:w
  511.  
  512.         add       (8)   uwBUFFER_5(4,0)<2>                      uwBUFFER_5(4,0)<16;8,2>                         uwBUFFER_5(5,0)<16;8,2>
  513.         add.sat (8) r[a0.4,0]<2>:uw             uwBUFFER_5(4,0)<16;8,2>                         0x0080:uw
  514.  
  515.         add       (8)   uwBUFFER_5(6,0)<2>                      uwBUFFER_5(6,0)<16;8,2>                         uwBUFFER_5(7,0)<16;8,2>
  516.         add.sat (8) r[a0.4,64]<2>:uw            uwBUFFER_5(6,0)<16;8,2>                         0x0080:uw
  517.  
  518.         add   (4) a0.4:uw               r22.0<4;4,1>:w          1536:uw //Update Buffer 3 pointers
  519.         //Y Rounding 16x4 top part
  520.         add.sat (16) r[a0.1,0]<1>:uw            r[a0.1,0]<16;16,1>:uw                   0x0080:uw              
  521.         add.sat (16) r[a0.1,32]<1>:uw           r[a0.1,32]<16;16,1>:uw          0x0080:uw              
  522.         add.sat (16) r[a0.1,64]<1>:uw           r[a0.1,64]<16;16,1>:uw          0x0080:uw              
  523.         add.sat (16) r[a0.1,96]<1>:uw           r[a0.1,96]<16;16,1>:uw          0x0080:uw              
  524.  
  525.         // U Averaging and Rounding, 8x2 top part
  526.         shr   (8)       uwBUFFER_5(0,0)<2>                      r[a0.2,0]<16;8,2>:uw                    1:w
  527.         shr       (8)   uwBUFFER_5(1,0)<2>                      r[a0.2,32]<16;8,2>:uw                   1:w
  528.         shr       (8)   uwBUFFER_5(2,0)<2>                      r[a0.2,64]<16;8,2>:uw                   1:w
  529.         shr   (8)       uwBUFFER_5(3,0)<2>                      r[a0.2,96]<16;8,2>:uw                   1:w
  530.  
  531.         add       (8)   uwBUFFER_5(0,0)<2>                      uwBUFFER_5(0,0)<16;8,2>                         uwBUFFER_5(1,0)<16;8,2>
  532.         add.sat (8) r[a0.2,0]<2>:uw             uwBUFFER_5(0,0)<16;8,2>                         0x0080:uw
  533.  
  534.         add       (8)   uwBUFFER_5(2,0)<2>                      uwBUFFER_5(2,0)<16;8,2>                         uwBUFFER_5(3,0)<16;8,2>
  535.         add.sat (8) r[a0.2,64]<2>:uw            uwBUFFER_5(2,0)<16;8,2>                         0x0080:uw
  536.  
  537.         // V Averaging and Rounding, 8x2 top part
  538.         shr   (8)       uwBUFFER_5(4,0)<2>                      r[a0.0,0]<16;8,2>:uw                    1:w
  539.         shr       (8)   uwBUFFER_5(5,0)<2>                      r[a0.0,32]<16;8,2>:uw                   1:w
  540.         shr       (8)   uwBUFFER_5(6,0)<2>                      r[a0.0,64]<16;8,2>:uw                   1:w
  541.         shr   (8)       uwBUFFER_5(7,0)<2>                      r[a0.0,96]<16;8,2>:uw                   1:w
  542.  
  543.         add       (8)   uwBUFFER_5(4,0)<2>                      uwBUFFER_5(4,0)<16;8,2>                         uwBUFFER_5(5,0)<16;8,2>
  544.         add.sat (8) r[a0.0,0]<2>:uw             uwBUFFER_5(4,0)<16;8,2>                         0x0080:uw
  545.  
  546.         add       (8)   uwBUFFER_5(6,0)<2>                      uwBUFFER_5(6,0)<16;8,2>                         uwBUFFER_5(7,0)<16;8,2>
  547.         add.sat (8) r[a0.0,64]<2>:uw            uwBUFFER_5(6,0)<16;8,2>                         0x0080:uw
  548.  
  549.         add   (4) a0.0:uw                       r22.0<4;4,1>:w          1024:uw //Update Buffer 2 pointers
  550.  
  551.         //Y Rounding, 16x4 bottom part
  552.         add.sat (16) r[a0.5,0]<1>:uw            r[a0.5,0]<16;16,1>:uw                   0x0080:uw              
  553.         add.sat (16) r[a0.5,32]<1>:uw           r[a0.5,32]<16;16,1>:uw          0x0080:uw              
  554.         add.sat (16) r[a0.5,64]<1>:uw           r[a0.5,64]<16;16,1>:uw          0x0080:uw              
  555.         add.sat (16) r[a0.5,96]<1>:uw           r[a0.5,96]<16;16,1>:uw          0x0080:uw              
  556.  
  557.         // U Averaging and Rounding, 8x2 bottom part
  558.         shr   (8)       uwBUFFER_5(0,0)<2>                      r[a0.6,0]<16;8,2>:uw                    1:w
  559.         shr       (8)   uwBUFFER_5(1,0)<2>                      r[a0.6,32]<16;8,2>:uw                   1:w
  560.         shr       (8)   uwBUFFER_5(2,0)<2>                      r[a0.6,64]<16;8,2>:uw                   1:w
  561.         shr   (8)       uwBUFFER_5(3,0)<2>                      r[a0.6,96]<16;8,2>:uw                   1:w
  562.  
  563.         add       (8)   uwBUFFER_5(0,0)<2>                      uwBUFFER_5(0,0)<16;8,2>                         uwBUFFER_5(1,0)<16;8,2>
  564.         add.sat (8) r[a0.6,0]<2>:uw             uwBUFFER_5(0,0)<16;8,2>                         0x0080:uw
  565.  
  566.         add       (8)   uwBUFFER_5(2,0)<2>                      uwBUFFER_5(2,0)<16;8,2>                         uwBUFFER_5(3,0)<16;8,2>
  567.         add.sat (8) r[a0.6,64]<2>:uw            uwBUFFER_5(2,0)<16;8,2>                         0x0080:uw
  568.  
  569.         // V Averaging and Rounding, 8x2 bottom part
  570.         shr   (8)       uwBUFFER_5(4,0)<2>                      r[a0.4,0]<16;8,2>:uw                    1:w
  571.         shr       (8)   uwBUFFER_5(5,0)<2>                      r[a0.4,32]<16;8,2>:uw                   1:w
  572.         shr       (8)   uwBUFFER_5(6,0)<2>                      r[a0.4,64]<16;8,2>:uw                   1:w
  573.         shr   (8)       uwBUFFER_5(7,0)<2>                      r[a0.4,96]<16;8,2>:uw                   1:w
  574.  
  575.         add       (8)   uwBUFFER_5(4,0)<2>                      uwBUFFER_5(4,0)<16;8,2>                         uwBUFFER_5(5,0)<16;8,2>
  576.         add.sat (8) r[a0.4,0]<2>:uw             uwBUFFER_5(4,0)<16;8,2>                         0x0080:uw
  577.  
  578.         add       (8)   uwBUFFER_5(6,0)<2>                      uwBUFFER_5(6,0)<16;8,2>                         uwBUFFER_5(7,0)<16;8,2>
  579.         add.sat (8) r[a0.4,64]<2>:uw            uwBUFFER_5(6,0)<16;8,2>                         0x0080:uw
  580.  
  581.         add   (4) a0.4:uw               r22.0<4;4,1>:w          1536:uw //Update Buffer 3 pointers
  582.         // restore pBUF_CHNL_TOP_8x4 and pBUF_CHNL_BOT_8x4 registers
  583.         add   (4) a0.0:uw   r22.0<4;4,1>:w          0:uw
  584.         add   (4) a0.4:uw   r22.0<4;4,1>:w          512:uw
  585.  
  586. //Buffer 0
  587. //Move Y to msg payload
  588.         mov  (16)  mubMSGPAYLOAD0(0,0)<1>                       r[a0.1, 1]<32;16,2>:ub          { NoDDClr }
  589.         mov  (16)  mubMSGPAYLOAD0(0,16)<1>                      r[a0.1, 33]<32;16,2>:ub         { NoDDChk }
  590.         mov  (16)  mubMSGPAYLOAD0(1,0)<1>                       r[a0.1, 65]<32;16,2>:ub         { NoDDClr }
  591.         mov  (16)  mubMSGPAYLOAD0(1,16)<1>                      r[a0.1, 97]<32;16,2>:ub         { NoDDChk }
  592.  
  593. //Move U to msg payload
  594.         mov  (8)  mubMSGPAYLOAD1(0,0)<2>                        r[a0.2, 1]<32;8,4>:ub           { NoDDClr }
  595.         mov  (8)  mubMSGPAYLOAD1(0,16)<2>                       r[a0.2, 65]<32;8,4>:ub          { NoDDClr, NoDDChk }
  596.  
  597. //Move V to msg payload
  598.         mov  (8)  mubMSGPAYLOAD1(0,1)<2>                        r[a0.0, 1]<32;8,4>:ub           { NoDDClr, NoDDChk }
  599.         mov  (8)  mubMSGPAYLOAD1(0,17)<2>                       r[a0.0, 65]<32;8,4>:ub          { NoDDChk }
  600.  
  601.         add   (4) a0.0:uw                       r22.0<4;4,1>:w          1024:uw //Update Buffer 2 pointers
  602.  
  603. //Buffer 1
  604.         mov  (16)  mubMSGPAYLOAD0(2,0)<1>                       r[a0.5, 1]<32;16,2>:ub          { NoDDClr }
  605.         mov  (16)  mubMSGPAYLOAD0(2,16)<1>                      r[a0.5, 33]<32;16,2>:ub         { NoDDChk }
  606.         mov  (16)  mubMSGPAYLOAD0(3,0)<1>                       r[a0.5, 65]<32;16,2>:ub         { NoDDClr }
  607.         mov  (16)  mubMSGPAYLOAD0(3,16)<1>                      r[a0.5, 97]<32;16,2>:ub         { NoDDChk }
  608.  
  609.         mov  (8)  mubMSGPAYLOAD1(1,0)<2>                        r[a0.6, 1]<32;8,4>:ub           { NoDDClr }
  610.         mov  (8)  mubMSGPAYLOAD1(1,16)<2>                       r[a0.6, 65]<32;8,4>:ub          { NoDDClr, NoDDChk }
  611.  
  612.         mov  (8)  mubMSGPAYLOAD1(1,1)<2>                        r[a0.4, 1]<32;8,4>:ub           { NoDDClr, NoDDChk }
  613.         mov  (8)  mubMSGPAYLOAD1(1,17)<2>                       r[a0.4, 65]<32;8,4>:ub          { NoDDChk }
  614.  
  615.         add   (4) a0.4:uw               r22.0<4;4,1>:w          1536:uw //Update Buffer 3 pointers
  616.  
  617. //Buffer 2
  618.         mov  (16)  mubMSGPAYLOAD0(4,0)<1>                       r[a0.1, 1]<32;16,2>:ub          { NoDDClr }
  619.         mov  (16)  mubMSGPAYLOAD0(4,16)<1>                      r[a0.1, 33]<32;16,2>:ub         { NoDDChk }
  620.         mov  (16)  mubMSGPAYLOAD0(5,0)<1>                       r[a0.1, 65]<32;16,2>:ub         { NoDDClr }
  621.         mov  (16)  mubMSGPAYLOAD0(5,16)<1>                      r[a0.1, 97]<32;16,2>:ub         { NoDDChk }
  622.  
  623.         mov  (8)  mubMSGPAYLOAD1(2,0)<2>                        r[a0.2, 1]<32;8,4>:ub           { NoDDClr }
  624.         mov  (8)  mubMSGPAYLOAD1(2,16)<2>                       r[a0.2, 65]<32;8,4>:ub          { NoDDClr, NoDDChk }
  625.  
  626.         mov  (8)  mubMSGPAYLOAD1(2,1)<2>                        r[a0.0, 1]<32;8,4>:ub           { NoDDClr, NoDDChk }
  627.         mov  (8)  mubMSGPAYLOAD1(2,17)<2>                       r[a0.0, 65]<32;8,4>:ub          { NoDDChk }
  628.  
  629. //Buffer 3
  630.         mov  (16)  mubMSGPAYLOAD0(6,0)<1>                       r[a0.5, 1]<32;16,2>:ub          { NoDDClr }
  631.         mov  (16)  mubMSGPAYLOAD0(6,16)<1>                      r[a0.5, 33]<32;16,2>:ub         { NoDDChk }
  632.         mov  (16)  mubMSGPAYLOAD0(7,0)<1>                       r[a0.5, 65]<32;16,2>:ub         { NoDDClr }
  633.         mov  (16)  mubMSGPAYLOAD0(7,16)<1>                      r[a0.5, 97]<32;16,2>:ub         { NoDDChk }
  634.  
  635.         mov  (8)  mubMSGPAYLOAD1(3,0)<2>                        r[a0.6, 1]<32;8,4>:ub           { NoDDClr }
  636.         mov  (8)  mubMSGPAYLOAD1(3,16)<2>                       r[a0.6, 65]<32;8,4>:ub          { NoDDClr, NoDDChk }
  637.  
  638.         mov  (8)  mubMSGPAYLOAD1(3,1)<2>                        r[a0.4, 1]<32;8,4>:ub           { NoDDClr, NoDDChk }
  639.         mov  (8)  mubMSGPAYLOAD1(3,17)<2>                       r[a0.4, 65]<32;8,4>:ub          { NoDDChk }
  640. //===========================================================================
  641.  
  642. send (1)    null<1>:d    r28    0x5                     0x120A8018:ud
  643. send (1)    null<1>:d    r37    0x5                     0xA0A8019:ud
  644.