Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * Set dependency control HW scoreboard kernel for MBAFF picture
  3.  * Copyright © <2010>, Intel Corporation.
  4.  *
  5.  * Permission is hereby granted, free of charge, to any person obtaining a
  6.  * copy of this software and associated documentation files (the
  7.  * "Software"), to deal in the Software without restriction, including
  8.  * without limitation the rights to use, copy, modify, merge, publish,
  9.  * distribute, sub license, and/or sell copies of the Software, and to
  10.  * permit persons to whom the Software is furnished to do so, subject to
  11.  * the following conditions:
  12.  *
  13.  * The above copyright notice and this permission notice (including the
  14.  * next paragraph) shall be included in all copies or substantial portions
  15.  * of the Software.
  16.  *
  17.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  18.  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  19.  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
  20.  * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
  21.  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  22.  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  23.  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24.  *
  25.  * This file was originally licensed under the following license
  26.  *
  27.  *  Licensed under the Apache License, Version 2.0 (the "License");
  28.  *  you may not use this file except in compliance with the License.
  29.  *  You may obtain a copy of the License at
  30.  *
  31.  *      http://www.apache.org/licenses/LICENSE-2.0
  32.  *
  33.  *  Unless required by applicable law or agreed to in writing, software
  34.  *  distributed under the License is distributed on an "AS IS" BASIS,
  35.  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  36.  *  See the License for the specific language governing permissions and
  37.  *  limitations under the License.
  38.  *
  39.  */
  40. // Kernel name: SetHWScoreboard_MBAFF.asm
  41. //
  42. // Set dependency control HW scoreboard kernel for MBAFF picture
  43. //
  44.  
  45. // ----------------------------------------------------
  46. //  Main: SetHWScoreboard_MBAFF
  47. // ----------------------------------------------------
  48.  
  49. .kernel SetHWScoreboard_MBAFF
  50.  
  51. SETHWSCOREBOARD_MBAFF:
  52.  
  53. #ifdef _DEBUG
  54. // WA for FULSIM so we'll know which kernel is being debugged
  55. mov (1) acc0:ud 0xf1aa55a5:ud
  56. #endif
  57.  
  58. #include "header.inc"
  59. #include "SetHWScoreboard_header.inc"
  60.  
  61. //
  62. //  Now, begin source code....
  63. //
  64.  
  65. .code
  66.  
  67. //      Separate the TotalMB so TotalMB will be multiple of 8
  68. //      and RemainderMB will hold the TotalMB%8
  69. //
  70.         and.z.f0.1 (1)  RemainderMB<1>:uw       TotalMB<0;1,0>:uw       0x0007:uw       // number of %8 commands
  71.         and.z.f0.0 (1)  TotalMB<1>:uw           TotalMB<0;1,0>:uw       0xfff8:uw       // Number of 8-command blocks
  72.  
  73. //      Initialize common DAP read header
  74. //
  75.         mov (8) MRF_READ_HEADER_SRC<1>:ud       r0.0<8;8,1>:ud
  76.         shl (1) MRF_READ_HEADER_SRC.2<1>:ud     StartingMB<0;1,0>:uw    6:uw    // Byte-aligned offset being read
  77.  
  78. //      Initialize Inter DAP write header
  79.         mov (8) MRF_INTER_WRITE_HEADER<1>:ud    r0.0<8;8,1>:ud
  80.  
  81.         (f0.0) jmpi (1) SetHWScoreboard_MBAFF_Remainder                                         // Jump if TatalMB < 8
  82.  
  83. //------------------------------------------------------------------------
  84. //      Command buffer parsing loop
  85. //      Each loop will handle 8 commands
  86. //------------------------------------------------------------------------
  87. //
  88. SetHWScoreboard_MBAFF_Loop:
  89. //      Load block 0 (Commands 0/1)
  90.         mov (8) MRF_READ_HEADER0.0<1>:ud        MRF_READ_HEADER_SRC.0<8;8,1>:ud
  91.         send (16)       CMD_BUFFER_W(0)<1>      MRF_READ_HEADER0        null:uw DAPREAD RESP_LEN(4)+OWBRMSGDSC_SC+OWORD_8+BI_CMD_BUFFER
  92.  
  93. //      Load block 1  (Commands 2/3)
  94.         mov (8) MRF_READ_HEADER1.0<1>:ud        MRF_READ_HEADER_SRC.0<8;8,1>:ud
  95.         add     (1)     MRF_READ_HEADER1.2<1>:ud        MRF_READ_HEADER_SRC.2<0;1,0>:ud         128:ud          // Point to next 2-command block
  96.         send (16)       CMD_BUFFER_W(4)<1>      MRF_READ_HEADER1        null:uw DAPREAD RESP_LEN(4)+OWBRMSGDSC_SC+OWORD_8+BI_CMD_BUFFER
  97.  
  98. //      Load block 2  (Commands 4/5)
  99.         mov (8) MRF_READ_HEADER2.0<1>:ud        MRF_READ_HEADER_SRC.0<8;8,1>:ud
  100.         add     (1)     MRF_READ_HEADER2.2<1>:ud        MRF_READ_HEADER_SRC.2<0;1,0>:ud         256:ud          // Point to next 2-command block
  101.         send (16)       CMD_BUFFER_W(8)<1>      MRF_READ_HEADER2        null:uw DAPREAD RESP_LEN(4)+OWBRMSGDSC_SC+OWORD_8+BI_CMD_BUFFER
  102.  
  103. //      Load block 3  (Commands 6/7)
  104.         mov (8) MRF_READ_HEADER3.0<1>:ud        MRF_READ_HEADER_SRC.0<8;8,1>:ud
  105.         add     (1)     MRF_READ_HEADER3.2<1>:ud        MRF_READ_HEADER_SRC.2<0;1,0>:ud         384:ud          // Point to next 2-command block
  106.         send (16)       CMD_BUFFER_W(12)<1>     MRF_READ_HEADER3        null:uw DAPREAD RESP_LEN(4)+OWBRMSGDSC_SC+OWORD_8+BI_CMD_BUFFER
  107.  
  108. //      Start parsing commands
  109.    $for(0; <16; 2) {
  110. //      Adjust MB Y origin for field MBs
  111. //
  112.         mov (2) TEMP_FD_X_W<1>:uw       CMD_BUFFER_B(%1,20)<2;2,1>                                      // Initialize temp (X,Y) location
  113.         and.nz.f0.1 (8) NULLREG CMD_BUFFER_D(%1,4)<0;1,0>       IS_BOT_FD:ud            // Is it a "Bottom Field MB"?
  114.         and.nz.f0.0 (8) NULLREG CMD_BUFFER_D(%1,4)<0;1,0>       IS_FIELD_MB:ud          // Is it a "Field MB"?
  115.         mul (8) acc0<1>:w       CMD_BUFFER_B(%1,21)<0;1,0>      2:w
  116.         (-f0.1) mov (1) TEMP_FD_Y_W<1>:w        acc0<0;1,0>:w
  117.         (f0.1) add (1)  TEMP_FD_Y_W<1>:w        acc0<0;1,0>:w   1:w
  118.         (-f0.0) mov (1) TEMP_FD_Y_W<1>:w        CMD_BUFFER_B(%1,21)<0;1,0>                      // Discard field MB Y origin handling
  119.  
  120.         and.nz.f0.0 (8) NULLREG CMD_BUFFER_D(%1,4)<0;1,0>       IS_INTRA_MB:ud          // Is it an "Intra" MB?
  121.         and.nz.f0.1     (8)     NULLREG TEMP_FD_Y_W<0;1,0>:uw   BIT0                                    // Is it "Bottom MB"?
  122.         or (1)  CMD_BUFFER_D(%1,2)<1>   CMD_BUFFER_D(%1,2)<0;1,0>       BIT21           // Set "Use Scoreboard"
  123.         mov (2) CMD_BUFFER_W(%1,2)<1>   TEMP_FD_X_W<2;2,1>:uw                                   // Set scoreboard (X,Y) for inter MB
  124.         (f0.0) jmpi (1) SET_SB_MBAFF_INTRA_%1                                                                   // Jump if intra MB.
  125.  
  126. //      Inter Macroblock
  127. //      Output MEDIA_OBJECT command in raster scan order
  128.         mul (16) acc0<1>:uw     TEMP_FD_Y_W<0;1,0>:uw   PicWidthMB<0;1,0>:uw            // MB offset = Y*W
  129.         add (16) acc0<1>:uw     acc0<8;8,1>:uw                  TEMP_FD_X_W<0;1,0>:uw           // MB offset = Y*W+X
  130.         shl (1) MRF_INTER_WRITE_HEADER.2<1>:ud  acc0.2<0;1,0>:uw        6:uw            // Byte-aligned MB offset
  131.         mov (16)        MRF_INTER_WRITE_DATA0<1>:ud     CMD_BUFFER_D(%1)<8;8,1> {Compr} // Copy entire command to inter buffer
  132.         mov     (16)    CMD_BUFFER_D(%1)<1>             0:ud    {Compr}                                         // Clear original command
  133.         send (16)       NULLREGW        MRF_INTER_WRITE_HEADER  null:uw DAPWRITE        MSG_LEN(2)+OWBWMSGDSC+OWORD_4+BI_CMD_BUFFER
  134.         jmpi (1)        NEXT_MB_MBAFF_%1                        // Done for inter MB. Move to next MB.
  135.  
  136. SET_SB_MBAFF_INTRA_%1:
  137. //      Intra MB
  138. //
  139.         and.nz.f0.0 (8) NULLREG CMD_BUFFER_D(%1,4)<0;1,0>       IS_FIELD_MB:ud          // Is it an "Field" MB?
  140.         (f0.1) sel (2)  MB_MASK_D<1>:ud         BOT_FD_MASK1_D<2;2,1>:ud        TOP_FD_MASK1_D<2;2,1>:ud        // Assume field MB
  141.         mov (1) TEMP_INTRA_FLAG_W<1>:uw         CMD_BUFFER_W(%1,14)<0;1,0>                      // Don't want to alter original in-line data
  142.         (f0.0) jmpi (1) SET_SB_MBAFF_%1                                 // Jump if it's really field MB
  143.  
  144. //      Frame MB
  145. //
  146. //      Derive E'
  147.         and.nz.f0.0     (8)     NULLREG CMD_BUFFER_W(%1,14)<0;1,0>      E_FLAG          // Is "E" = 1
  148.         (f0.1) sel (2)  MB_MASK_D<1>:ud         BOT_FM_MASK1_D<2;2,1>:ud        TOP_FM_MASK1_D<2;2,1>:ud
  149.         and.z.f0.1 (8)  NULLREG CMD_BUFFER_W(%1,14)<0;1,0>      A_FLAG          // "A" = 0?
  150.         (f0.0) jmpi (1) SET_SB_MBAFF_%1                         // If "E" flag = 1, skip the rest of derivation
  151.         (f0.1) and.nz.f0.1 (8)  NULLREG CMD_BUFFER_D(%1,4)<0;1,0>       IS_INTRA8X8
  152.         (f0.1) and.nz.f0.1 (8)  NULLREG CMD_BUFFER_W(%1,14)<0;1,0>      F_FLAG
  153.         (f0.1) or (1)   TEMP_INTRA_FLAG_W<1>:uw CMD_BUFFER_W(%1,14)<0;1,0>      E_FLAG
  154.  
  155. SET_SB_MBAFF_%1:
  156.         and.nz.f0.1     (16)    NULLREGW        TEMP_INTRA_FLAG_W<0;1,0>:uw     MB_MASK_B<0;8,1>:ub
  157.         shl     (1)     CMD_BUFFER_W(%1,2)<1>   f0.1<0;1,0>:uw  12:w            // Masks 0-3
  158.         and (1) CMD_BUFFER_W(%1,3)<1>   f0.1<0;1,0>:uw  0xf000:uw       // Masks 4-7
  159.  
  160.         mov (2) CMD_BUFFER_B(%1,4)<2>   TEMP_FD_X_B<4;2,2>:ub           // Set scoreboard (X,Y) for intra MB
  161.  
  162. NEXT_MB_MBAFF_%1:
  163.         }
  164.  
  165.         add.z.f0.0 (1)  TotalMB<1>:w    TotalMB<0;1,0>:w        -8:w                            // Update remaining number of 8-command blocks
  166.  
  167. //      Output modified intra commands
  168. //      Write block 0
  169.         mov (8) MRF_INTRA_WRITE_HEADER.0<1>:ud  MRF_READ_HEADER_SRC.0<8;8,1>:ud
  170.     $for(0; <4; 2) {
  171.         mov (16)        MRF_CMD_BUF_D(%1)<1>    CMD_BUFFER_D(%1)<8;8,1> {Compr}
  172.         }
  173.         send (16)       NULLREGW        MRF_INTRA_WRITE_HEADER  null:uw DAPWRITE        MSG_LEN(4)+OWBWMSGDSC+OWORD_8+BI_CMD_BUFFER
  174.  
  175. //      Write block 1
  176.         mov (8) m1.0<1>:ud      MRF_READ_HEADER_SRC.0<8;8,1>:ud
  177.         add     (1)     m1.2<1>:ud      MRF_READ_HEADER_SRC.2<0;1,0>:ud         128:ud          // Point to next 2-command block
  178.         mov (16)        m2<1>:ud        CMD_BUFFER_D(4)<8;8,1>  {Compr}
  179.         mov (16)        m4<1>:ud        CMD_BUFFER_D(6)<8;8,1>  {Compr}
  180.         send (16)       NULLREGW        m1      null:uw DAPWRITE        MSG_LEN(4)+OWBWMSGDSC+OWORD_8+BI_CMD_BUFFER
  181.  
  182. //      Write block 2
  183.         add     (1)     MRF_INTRA_WRITE_HEADER.2<1>:ud  MRF_READ_HEADER_SRC.2<0;1,0>:ud         256:ud          // Point to next 2-command block
  184.     $for(0; <4; 2) {
  185.         mov (16)        MRF_CMD_BUF_D(%1)<1>    CMD_BUFFER_D(%1+8)<8;8,1>       {Compr}
  186.         }
  187.         send (16)       NULLREGW        MRF_INTRA_WRITE_HEADER  null:uw DAPWRITE        MSG_LEN(4)+OWBWMSGDSC+OWORD_8+BI_CMD_BUFFER
  188.  
  189. //      Write block 3
  190.         add     (1)     m1.2<1>:ud      MRF_READ_HEADER_SRC.2<0;1,0>:ud         384:ud          // Point to next 2-command block
  191.         mov (16)        m2<1>:ud        CMD_BUFFER_D(12)<8;8,1> {Compr}
  192.         mov (16)        m4<1>:ud        CMD_BUFFER_D(14)<8;8,1> {Compr}
  193.         send (16)       NULLREGW        m1      null:uw DAPWRITE        MSG_LEN(4)+OWBWMSGDSC+OWORD_8+BI_CMD_BUFFER
  194.  
  195. //      Update message header for next DAP read
  196.         add (1) MRF_READ_HEADER_SRC.2<1>:ud     MRF_READ_HEADER_SRC.2<0;1,0>:ud 512:ud  // Point to next block of 8-commands
  197.  
  198.         cmp.z.f0.1 (1)  NULLREG RemainderMB<0;1,0>:w    0:uw            // Check if remaining MB = 0
  199.         (-f0.0) jmpi (1)        SetHWScoreboard_MBAFF_Loop                      // Continue if more command blocks remain
  200.  
  201. SetHWScoreboard_MBAFF_Remainder:
  202. //      f0.1 should have been set to indicate if RemainderMB = 0
  203. //
  204.         (f0.1) jmpi (1) SetHWScoreboard_MBAFF_Done                              // Stop if all commands have been updated
  205.  
  206. //      Blindly load next 8 commands anyway
  207. //
  208. //      Load block 0 (Commands 0/1)
  209.         mov (8) MRF_READ_HEADER0.0<1>:ud        MRF_READ_HEADER_SRC.0<8;8,1>:ud
  210.         send (16)       CMD_BUFFER_W(0)<1>      MRF_READ_HEADER0        null:uw DAPREAD RESP_LEN(4)+OWBRMSGDSC_SC+OWORD_8+BI_CMD_BUFFER
  211.  
  212. //      Load block 1  (Commands 2/3)
  213.         mov (8) MRF_READ_HEADER1.0<1>:ud        MRF_READ_HEADER_SRC.0<8;8,1>:ud
  214.         add     (1)     MRF_READ_HEADER1.2<1>:ud        MRF_READ_HEADER_SRC.2<0;1,0>:ud         128:ud          // Point to next 2-command block
  215.         send (16)       CMD_BUFFER_W(4)<1>      MRF_READ_HEADER1        null:uw DAPREAD RESP_LEN(4)+OWBRMSGDSC_SC+OWORD_8+BI_CMD_BUFFER
  216.  
  217. //      Load block 2  (Commands 4/5)
  218.         mov (8) MRF_READ_HEADER2.0<1>:ud        MRF_READ_HEADER_SRC.0<8;8,1>:ud
  219.         add     (1)     MRF_READ_HEADER2.2<1>:ud        MRF_READ_HEADER_SRC.2<0;1,0>:ud         256:ud          // Point to next 2-command block
  220.         send (16)       CMD_BUFFER_W(8)<1>      MRF_READ_HEADER2        null:uw DAPREAD RESP_LEN(4)+OWBRMSGDSC_SC+OWORD_8+BI_CMD_BUFFER
  221.  
  222. //      Load block 3  (Commands 6/7)
  223.         mov (8) MRF_READ_HEADER3.0<1>:ud        MRF_READ_HEADER_SRC.0<8;8,1>:ud
  224.         add     (1)     MRF_READ_HEADER3.2<1>:ud        MRF_READ_HEADER_SRC.2<0;1,0>:ud         384:ud          // Point to next 2-command block
  225.         send (16)       CMD_BUFFER_W(12)<1>     MRF_READ_HEADER3        null:uw DAPREAD RESP_LEN(4)+OWBRMSGDSC_SC+OWORD_8+BI_CMD_BUFFER
  226.  
  227. //      Initialize necessary pointers
  228.         mov (1) a0.1<1>:ud      ((CMD_BUFFER_REG_OFF+1)*0x10000+CMD_BUFFER_REG_OFF)*32  // a0.2:w points to command buffer (first half)
  229.                                                                                                                                                         // a0.3:w points to command buffer (second half)
  230. //      Initialize Inter DAP write header
  231.         mov (8) MRF_INTER_WRITE_HEADER<1>:ud    r0.0<8;8,1>:ud
  232.  
  233. SetHWScoreboard_MBAFF_Remainder_Loop:
  234. //      Adjust MB Y origin for field MBs
  235. //
  236.         mov (2) TEMP_FD_X_W<1>:uw       r[a0.2,5*4]<2;2,1>:ub                                   // Initialize temp (X,Y) location
  237.         and.nz.f0.1 (8) NULLREG r[a0.2,4*4]<0;1,0>:ud   IS_BOT_FD:ud            // Is it a "Bottom Field MB"?
  238.         and.nz.f0.0 (8) NULLREG r[a0.2,4*4]<0;1,0>:ud   IS_FIELD_MB:ud          // Is it a "Field MB"?
  239.         mul (8) acc0<1>:w       r[a0.2,21]<0;1,0>:ub    2:w
  240.         (-f0.1) mov (1) TEMP_FD_Y_W<1>:w        acc0<0;1,0>:w
  241.         (f0.1) add (1)  TEMP_FD_Y_W<1>:w        acc0<0;1,0>:w   1:w
  242.         (-f0.0) mov (1) TEMP_FD_Y_W<1>:w        r[a0.2,5*4+1]<0;1,0>:ub                 // Discard field MB Y origin handling
  243.  
  244.         and.nz.f0.0 (8) NULLREG r[a0.2,4*4]<0;1,0>:ud   IS_INTRA_MB:ud          // Is it an "Intra" MB?
  245.         add.z.f0.1 (1)  RemainderMB<1>:w        RemainderMB<0;1,0>:w    -1:w    // Decrement MB #
  246.         or (1)  r[a0.2,2*4]<1>:ud       r[a0.2,2*4]<0;1,0>:ud   BIT21:ud                // Set "Use Scoreboard"
  247.         mov (2) r[a0.2,2*2]<1>:uw       TEMP_FD_X_W<2;2,1>:uw                                   // Set scoreboard (X,Y) for inter MB
  248.         (f0.0) jmpi (1) SET_SB_MBAFF_REM_INTRA                                                          // Jump if intra MB.
  249.  
  250. //      Inter Macroblock
  251. //      Output MEDIA_OBJECT command in raster scan order
  252.         mul (16) acc0<1>:uw     TEMP_FD_Y_W<0;1,0>:uw   PicWidthMB<0;1,0>:uw    // MB offset = Y*W
  253.         add (16) acc0<1>:uw     acc0<8;8,1>:uw                  TEMP_FD_X_W<0;1,0>:uw   // MB offset = Y*W+X
  254.         shl (1) MRF_INTER_WRITE_HEADER.2<1>:ud  acc0.2<0;1,0>:uw        6:uw    // Byte-aligned MB offset
  255.         mov (16)        MRF_INTER_WRITE_DATA0<1>:ud     r[a0.2]<8;8,1>:ud {Compr}       // Copy entire command to inter buffer
  256.         mov     (16)    r[a0.2]<1>:ud           0:ud    {Compr}                                                 // Clear original command
  257.         send (16)       NULLREGW        MRF_INTER_WRITE_HEADER  null:uw DAPWRITE        MSG_LEN(2)+OWBWMSGDSC+OWORD_4+BI_CMD_BUFFER
  258.         jmpi (1)        Output_MBAFF_Remainder_Intra                                                    // Done for inter MB. Move to dump intra MB.
  259.  
  260. SET_SB_MBAFF_REM_INTRA:
  261. //      Intra MB
  262. //
  263.         and.nz.f0.1     (8)     NULLREG TEMP_FD_Y_W<0;1,0>:uw   BIT0:ud                 // Is it "Bottom MB"?
  264.         and.nz.f0.0 (8) NULLREG r[a0.2,4*4]<0;1,0>:ud   IS_FIELD_MB:ud  // Is it "Field MB"?
  265.         mov (1) TEMP_INTRA_FLAG_W<1>:uw r[a0.2,14*2]<0;1,0>:uw                  // Don't want to alter original in-line data
  266.         (f0.1) sel (2)  MB_MASK_D<1>:ud         BOT_FD_MASK1_D<2;2,1>:ud        TOP_FD_MASK1_D<2;2,1>:ud        // Assume field MB
  267.         (f0.0) jmpi (1) SET_SB_MBAFF_REM                                        // Jump if it's really field MB
  268.  
  269. //      Frame MB
  270. //
  271. //      Derive E'
  272.         and.nz.f0.0     (8)     NULLREG r[a0.2,14*2]<0;1,0>:uw  E_FLAG          // Is "E" = 1
  273.         (f0.1) sel (2)  MB_MASK_D<1>:ud         BOT_FM_MASK1_D<2;2,1>:ud        TOP_FM_MASK1_D<2;2,1>:ud
  274.         and.z.f0.1 (8)  NULLREG r[a0.2,14*2]<0;1,0>:uw  A_FLAG          // "A" = 0?
  275.         (f0.0) jmpi (1) SET_SB_MBAFF_REM                                // If "E" flag = 1, skip the rest of derivation
  276.         (f0.1) and.nz.f0.1 (8)  NULLREG r[a0.2,4*4]<0;1,0>:ud   IS_INTRA8X8
  277.         (f0.1) and.nz.f0.1 (8)  NULLREG r[a0.2,14*2]<0;1,0>:uw  F_FLAG
  278.         (f0.1) or (1)   TEMP_INTRA_FLAG_W<1>:uw r[a0.2,14*2]<0;1,0>:uw  E_FLAG
  279.  
  280. SET_SB_MBAFF_REM:
  281.         and.nz.f0.0     (16)    NULLREGW        TEMP_INTRA_FLAG_W<0;1,0>:uw     MB_MASK_B<0;8,1>:ub
  282.         add.z.f0.1 (1)  RemainderMB<1>:w        RemainderMB<0;1,0>:w    0:w             // Check remaining MB #
  283.         shl     (1)     r[a0.2,2*2]<1>:uw       f0.0<0;1,0>:uw  12:w            // Masks 0-3
  284.         and (1) r[a0.2,3*2]<1>:uw       f0.0<0;1,0>:uw  0xf000:uw       // Masks 4-7
  285.  
  286.         mov (2) r[a0.2,4*1]<2>:ub       TEMP_FD_X_B<4;2,2>:ub           // Set scoreboard (X,Y) for intra MB
  287.  
  288. Output_MBAFF_Remainder_Intra:
  289. //      Intra MB command always output
  290.         mov (8) MRF_INTRA_WRITE_HEADER.0<1>:ud  MRF_READ_HEADER_SRC.0<8;8,1>:ud
  291.         mov (16)        MRF_CMD_BUF_D(0)<1>             r[a0.2]<8;8,1>:ud       {Compr}         // Copy entire command to intra buffer
  292.         send (16)       NULLREGW        MRF_INTRA_WRITE_HEADER  null:uw DAPWRITE        MSG_LEN(2)+OWBWMSGDSC+OWORD_4+BI_CMD_BUFFER
  293.  
  294.         add     (1)     MRF_READ_HEADER_SRC.2<1>:ud             MRF_READ_HEADER_SRC.2<0;1,0>:ud         64:ud   // Point to next command
  295.         add (1) a0.1<1>:ud      a0.1<0;1,0>:ud  0x00400040:ud                                   // Update pointers
  296.         (-f0.1) jmpi (1)        SetHWScoreboard_MBAFF_Remainder_Loop
  297.  
  298. // All MBs have been decoded. Terminate the thread now
  299. //
  300. SetHWScoreboard_MBAFF_Done:
  301.     END_THREAD
  302.  
  303. #if !defined(COMBINED_KERNEL)           // For standalone kernel only
  304. .end_code
  305.  
  306. .end_kernel
  307. #endif
  308.  
  309. // End of SetHWScoreboard_MBAFF
  310.