Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * Copyright © <2010>, Intel Corporation.
  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.  */
  39. //////////////////////////////////////////////////////////////////////////////////////////////////////////////
  40. // AVC Child Kernel (Vertical and horizontal de-block a 4:2:0 MB Y comp)
  41. //
  42. // First, de-block vertical edges from left to right.
  43. // Second, de-block horizontal edge from top to bottom.
  44. //
  45. // If transform_size_8x8_flag = 1, luma is de-blocked at 8x8.  Otherwise, luma is de-blocked at 4x4.
  46. //
  47. //////////////////////////////////////////////////////////////////////////////////////////////////////////////
  48. #define AVC_ILDB
  49.  
  50. .kernel AVC_ILDB_CHILD_Y
  51. #if defined(COMBINED_KERNEL)
  52. ILDB_LABEL(AVC_ILDB_CHILD_Y):
  53. #endif
  54.  
  55. #include "SetupVPKernel.asm"
  56. #include "AVC_ILDB.inc"
  57.  
  58. #if defined(_DEBUG)
  59.         mov             (1)             EntrySignatureC:w                       0x9998:w
  60. #endif
  61.  
  62.         // Init local variables
  63.         shl (8)         ORIX_CUR<1>:w           ORIX<0;2,1>:w           4:w             // Expand addr to bytes, repeat (x,y) 4 times
  64.  
  65.         // Init addr register for vertical control data
  66.         mov (1)         ECM_AddrReg<1>:w        CNTRL_DATA_BASE:w                       // Init edge control map AddrReg
  67.  
  68.         //=== Null Kernel ===============================================================
  69. //      jmpi ILDB_LABEL(POST_ILDB_Y)
  70.         //===============================================================================
  71.  
  72.         mul     (1)             URBOffsetC:uw   ORIY:uw         4:w    
  73.        
  74. #if !defined(DEV_CL)   
  75.         //====================================================================================
  76.         // For BearLake-C, 64 bytes are stored in memory and dataport expands to 256 bytes.  Need to use a special read command on BL-C.
  77.         // MB_offset = MBsCntX * CurRow + CurCol
  78.         // MBCntrlDataOffsetY = globel_byte_offset = MB_offset * 64
  79.         mul (1) CntrlDataOffsetY:ud             MBsCntX:w                               ORIY:w
  80.         add (1) CntrlDataOffsetY:ud             CntrlDataOffsetY:ud             ORIX:w
  81.                
  82.         // Assign to MSGSRC.2:ud for memory access
  83.         // mul (1) CntrlDataOffsetY:ud          CntrlDataOffsetY:ud             64:uw
  84.         mul (1) MSGSRC.2:ud             CntrlDataOffsetY:ud             64:uw          
  85.        
  86. #endif
  87.  
  88.         // Load current MB control data
  89. #if defined(DEV_CL)
  90.         #if defined(_APPLE)
  91.                 #include "Load_ILDB_Cntrl_Data_22DW.asm"        // Crestline for Apple, progressive only
  92.         #else
  93.                 #include "Load_ILDB_Cntrl_Data_64DW.asm"        // Crestline
  94.         #endif 
  95. #else
  96.         #include "Load_ILDB_Cntrl_Data_16DW.asm"        // Cantiga and beyond
  97. #endif
  98.  
  99.         // Check loaded control data
  100.         #if defined(_APPLE)
  101.                 and.z.f0.1  (8) null<1>:uw      r[ECM_AddrReg, wEdgeCntlMap_IntLeftVert]<8;8,1>:uw              0xFFFF:uw               // Skip ILDB?
  102.                 (f0.1) and.z.f0.1 (2) null<1>:uw        r[ECM_AddrReg, wEdgeCntlMapA_ExtTopHorz0]<2;2,1>:uw             0xFFFF:uw               // Skip ILDB?
  103.         #else
  104.                 and.z.f0.1  (16) null<1>:uw     r[ECM_AddrReg, wEdgeCntlMap_IntLeftVert]<16;16,1>:uw    0xFFFF:uw               // Skip ILDB?          
  105.         #endif 
  106.  
  107.         and.nz.f0.0  (1) null:w         r[ECM_AddrReg, ExtBitFlags]:ub          DISABLE_ILDB_FLAG:w             // Skip ILDB?
  108.  
  109.         // Use free cycles here
  110.         add (1)         ORIX_LEFT:w                     ORIX_LEFT:w                     -4:w
  111. //      add (1)         ORIY_TOP:w                      ORIY_TOP:w                      -4:w
  112.         mov     (1)             GateWayOffsetC:uw       ORIY:uw                                         // Use row # as Gateway offset
  113.  
  114.         #if defined(_APPLE)
  115.                 (f0.1.all8h)    jmpi    ILDB_LABEL(READ_FOR_URB_Y)                              // Skip ILDB
  116.         #else
  117.                 (f0.1.all16h)   jmpi    ILDB_LABEL(READ_FOR_URB_Y)                              // Skip ILDB
  118.         #endif
  119.  
  120.         (f0.0)                  jmpi    ILDB_LABEL(READ_FOR_URB_Y)                                      // Skip ILDB
  121.  
  122.         add (1)         ORIY_TOP:w                      ORIY_TOP:w                      -4:w
  123.  
  124.         // Bettr performance is observed if boundary MBs are not checked and skipped.
  125.        
  126.         #include "load_Cur_Y_16x16T.asm"                                // Load cur MB Y, 16x16, transpose
  127. //      #include "load_Left_Y_4x16T.asm"                                // Load left MB (4x16) Y data from memory
  128.         #include "load_Top_Y_16x4.asm"                                  // Load top MB (16x4) Y data from memory
  129.  
  130.         #include "Transpose_Cur_Y_16x16.asm"
  131. //      #include "Transpose_Left_Y_4x16.asm"
  132.  
  133.         //---------- Perform vertical ILDB filting on Y ---------
  134.         #include "AVC_ILDB_Filter_Y_v.asm"     
  135.         //-------------------------------------------------------
  136.  
  137.         #include "save_Left_Y_16x4T.asm"                                // Write left MB (4x16) Y data to memory
  138.         #include "Transpose_Cur_Y_16x16.asm"                    // Transpose a MB for horizontal edge de-blocking
  139.  
  140.         //---------- Perform horizontal ILDB filting on Y -------
  141.         #include "AVC_ILDB_Filter_Y_h.asm"     
  142.         //-------------------------------------------------------
  143.  
  144.         #include "save_Cur_Y_16x16.asm"                                 // Write cur MB (16x16)
  145.         #include "save_Top_Y_16x4.asm"                                  // Write top MB (16x4)
  146.  
  147.         //---------- Write right most 4 columns of cur MB to URB ----------
  148.         // Transpose the right most 4 cols 4x16 in GRF to 16x4 in LEFT_TEMP_B.  It is 4 left most cols in cur MB.      
  149.         #include "Transpose_Cur_Y_4x16.asm"                                            
  150.        
  151. ILDB_LABEL(WRITE_URB_Y):
  152.         // Note: LEFT_TEMP_B(2) = TOP_TEMP_B(0), TOP_TEMP_B must be avail
  153.         mov (16)        m1<1>:ud                LEFT_TEMP_D(2)<8;8,1>           // Copy 2 GRFs to 2 URB entries (Y)
  154.        
  155.         #include "writeURB_Y_Child.asm"
  156.         //-----------------------------------------------------------------
  157.  
  158.         //=========== Check write commit of the last write ============
  159.     mov (8)     WritebackResponse(0)<1>         WritebackResponse(0)   
  160.  
  161. ILDB_LABEL(POST_ILDB_Y):
  162.         // Send notification thru Gateway to root thread, update luma Status[CurRow]
  163.         #include "AVC_ILDB_ForwardMsg.asm"     
  164.  
  165. #if !defined(GW_DCN)            // For non-ILK chipsets
  166.         //child send EOT : Request type = 1
  167.         END_CHILD_THREAD
  168. #endif  // !defined(DEV_ILK)
  169.        
  170.         // The thread finishs here
  171.         //------------------------------------------------------------------------------
  172.  
  173. ILDB_LABEL(READ_FOR_URB_Y):
  174.         // Still need to prepare URB data for the right neighbor MB
  175.         #include "load_Cur_Y_Right_Most_4x16.asm"               // Load cur MB ( right most 4x16) Y data from memory
  176.         #include "Transpose_Cur_Y_Right_Most_4x16.asm"                                         
  177. //      jmpi ILDB_LABEL(WRITE_URB_Y)
  178.  
  179.         // Note: LEFT_TEMP_B(2) = TOP_TEMP_B(0), TOP_TEMP_B must be avail
  180.         mov (16)        m1<1>:ud                LEFT_TEMP_D(2)<8;8,1>           // Copy 2 GRFs to 2 URB entries (Y)
  181.        
  182.         #include "writeURB_Y_Child.asm"
  183.         //-----------------------------------------------------------------
  184.  
  185.         // Send notification thru Gateway to root thread, update luma Status[CurRow]
  186.         #include "AVC_ILDB_ForwardMsg.asm"     
  187.  
  188. #if !defined(GW_DCN)            // For non-ILK chipsets
  189.         //child send EOT : Request type = 1
  190.         END_CHILD_THREAD
  191. #endif  // !defined(DEV_ILK)
  192.        
  193.         // The thread finishs here
  194.         //------------------------------------------------------------------------------
  195.        
  196.         ////////////////////////////////////////////////////////////////////////////////
  197.         // Include other subrutines being called
  198.         #include "AVC_ILDB_Luma_Core.asm"
  199. //      #include "AVC_ILDB_Chroma_Core.asm"
  200.  
  201.        
  202. #if !defined(COMBINED_KERNEL)           // For standalone kernel only
  203. .end_code
  204.  
  205. .end_kernel
  206. #endif
  207.