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. ////////// AVC ILDB filter vertical Y ///////////////////////////////////////////////////////
  40. //
  41. //      This filter code prepares the src data and control data for ILDB filtering on all vertical edges of Y.
  42. //
  43. //      It sssumes the data for vertical de-blocking is already transposed.  
  44. //
  45. //              Luma:
  46. //
  47. //              +-------+-------+-------+-------+
  48. //              |               |               |               |               |
  49. //              |               |               |               |               |
  50. //              |               |               |               |               |
  51. //              +-------+-------+-------+-------+
  52. //              |               |               |               |               |
  53. //              |               |               |               |               |
  54. //              |               |               |               |               |
  55. //              +-------+-------+-------+-------+
  56. //              |               |               |               |               |
  57. //              |               |               |               |               |
  58. //              |               |               |               |               |
  59. //              +-------+-------+-------+-------+
  60. //              |               |               |               |               |
  61. //              |               |               |               |               |
  62. //              |               |               |               |               |
  63. //              +-------+-------+-------+-------+
  64. //
  65. //              V0              V1              V2              V3
  66. //              Edge    Edge    Edge    Edge
  67. //
  68. /////////////////////////////////////////////////////////////////////////////
  69.  
  70. #if defined(_DEBUG)
  71.         mov             (1)             EntrySignatureC:w                       0xBBBB:w
  72. #endif 
  73.        
  74.  
  75. //========== Luma deblocking ==========
  76.  
  77.  
  78. //---------- Deblock Y external left edge (V0) ----------      
  79.  
  80.         // Bypass deblocking if it is left edge of the picture.  
  81.         and.z.f0.0  (1) null:w          r[ECM_AddrReg, BitFlags]:ub             FilterLeftMbEdgeFlag:w          // Check for FilterLeftMbEdgeFlag
  82.  
  83. //      and.z.f0.1 (1)  null:uw         r[ECM_AddrReg, wEdgeCntlMapA_ExtLeftVert0]:uw           0xFFFF:uw       // MaskA = 0?
  84.  
  85.         // Get (alpha >> 2) + 2
  86.         shr (1) alpha2:w                r[ECM_AddrReg, bAlphaLeft0_Y]:ub                2:w                     // alpha >> 2
  87.  
  88.         //      p3 = Prev MB Y row 0 = r[P_AddrReg, 0]<16;16,1>
  89.         //      p2 = Prev MB Y row 1 = r[P_AddrReg, 16]<16;16,1>
  90.         //      p1 = Prev MB Y row 2 = r[P_AddrReg, 32]<16;16,1>
  91.         //      p0 = Prev MB Y row 3 = r[P_AddrReg, 48]<16;16,1>
  92.         //      q0 = Cur MB Y row 0  = r[Q_AddrReg, 0]<16;16,1>
  93.         //      q1 = Cur MB Y row 1  = r[Q_AddrReg, 16]<16;16,1>
  94.         //      q2 = Cur MB Y row 2  = r[Q_AddrReg, 32]<16;16,1>
  95.         //      q3 = Cur MB Y row 3  = r[Q_AddrReg, 48]<16;16,1>
  96.         mov (1) P_AddrReg:w             PREV_MB_Y_BASE:w                { NoDDClr }
  97.         mov (1) Q_AddrReg:w             SRC_MB_Y_BASE:w                 { NoDDChk }
  98.        
  99.         // Get vertical border edge control data  
  100.         // alpha = bAlphaLeft0_Y
  101.         // beta = bBetaLeft0_Y
  102.         mov     (2)     alpha<1>:w      r[ECM_AddrReg, bAlphaLeft0_Y]<2;2,1>:ub                 { NoDDClr }             // 2 channels for alpha and beta
  103.  
  104.         mov (2) MaskA<1>:uw     r[ECM_AddrReg, wEdgeCntlMapA_ExtLeftVert0]<2;2,1>:uw    { NoDDClr, NoDDChk }
  105.        
  106.         // tc0 has bTc0_v30_0_Y | bTc0_v20_0_Y | bTc0_v10_0_Y | bTc0_v00_0_Y
  107.         mov (4) tc0<1>:ub       r[ECM_AddrReg, bTc0_v00_0_Y]<4;4,1>:ub                  { NoDDChk }
  108.  
  109. //      (f0.0)  jmpi    BYPASS_EXT_LEFT_EDGE_Y 
  110. //      (f0.0.anyv)      jmpi   BYPASS_EXT_LEFT_EDGE_Y
  111.                
  112.         add (1) alpha2:w                alpha2:w                2:w                                                             // alpha2 = (alpha >> 2) + 2  
  113.                
  114. //      CALL(FILTER_Y, 1)
  115.         PRED_CALL(-f0.0, FILTER_Y, 1)
  116.  
  117.  
  118. //BYPASS_EXT_LEFT_EDGE_Y:
  119. //------------------------------------------------------------------
  120.         // Same alpha, alpha2, beta and MaskB for all internal edges
  121.  
  122.         // Get (alpha >> 2) + 2
  123.         shr (1) alpha2:w                r[ECM_AddrReg, bAlphaInternal_Y]:ub             2:w                     // alpha >> 2
  124.  
  125.         // alpha = bAlphaInternal_Y
  126.         // beta = bBetaInternal_Y
  127.         mov     (2)     alpha<1>:w      r[ECM_AddrReg, bAlphaInternal_Y]<2;2,1>:ub              { NoDDClr }
  128.  
  129.         // Set MaskB = 0 for all 3 int edges, so it always uses bS < 4 algorithm.
  130.         mov (1) MaskB:uw        0:w                                                                                             { NoDDChk }
  131.  
  132.         add (1) alpha2:w                alpha2:w                2:w                                                             // alpha2 = (alpha >> 2) + 2  
  133.  
  134.  
  135. //---------- Deblock Y internal left edge (V1) ----------
  136.  
  137.         // Bypass deblocking if FilterInternal4x4EdgesFlag = 0  
  138.         and.z.f0.0  (1) null:w          r[ECM_AddrReg, BitFlags]:ub             FilterInternal4x4EdgesFlag:w            // Check for FilterInternal4x4EdgesFlag
  139.  
  140. //      and.z.f0.1 (1)  null:uw         r[ECM_AddrReg, wEdgeCntlMap_IntLeftVert]:uw             0xFFFF:uw       // MaskA = 0?
  141.  
  142.         //      p3 = Cur MB Y row 0 = r[P_AddrReg, 0]<16;16,1>  
  143.         //      p2 = Cur MB Y row 1 = r[P_AddrReg, 16]<16;16,1>
  144.         //      p1 = Cur MB Y row 2 = r[P_AddrReg, 32]<16;16,1>
  145.         //      p0 = Cur MB Y row 3 = r[P_AddrReg, 48]<16;16,1>
  146.         //      q0 = Cur MB Y row 4 = r[Q_AddrReg, 0]<16;16,1>
  147.         //      q1 = Cur MB Y row 5 = r[Q_AddrReg, 16]<16;16,1>
  148.         //      q2 = Cur MB Y row 6 = r[Q_AddrReg, 32]<16;16,1>
  149.         //      q3 = Cur MB Y row 7 = r[Q_AddrReg, 48]<16;16,1>
  150.         mov (1) P_AddrReg:w             SRC_MB_Y_BASE:w                                 { NoDDClr }
  151.         mov (1) Q_AddrReg:w             4*Y_ROW_WIDTH+SRC_MB_Y_BASE:w   { NoDDChk }
  152.        
  153.         mov (1) MaskA:uw        r[ECM_AddrReg, wEdgeCntlMap_IntLeftVert]:uw             { NoDDClr }
  154.  
  155.         // tc0 has bTc0_v31_Y + bTc0_v21_Y + bTc0_v11_Y + bTc0_v01_Y   
  156.         mov (4) tc0<1>:ub       r[ECM_AddrReg, bTc0_v01_Y]<4;4,1>:ub                    { NoDDChk }
  157.  
  158. //    (f0.0)    jmpi    BYPASS_4x4_DEBLOCK_V
  159. //      (f0.0.anyv)      jmpi   BYPASS_4x4_DEBLOCK_V
  160.  
  161. //      CALL(FILTER_Y, 1)
  162.         PRED_CALL(-f0.0, FILTER_Y, 1)
  163.  
  164. //BYPASS_4x4_DEBLOCK_V:
  165. //------------------------------------------------------------------
  166.  
  167.  
  168. //---------- Deblock Y internal mid vert edge (V2) ----------
  169.  
  170.         // Bypass deblocking if FilterInternal8x8EdgesFlag = 0  
  171.         and.z.f0.0      (1)     null:w  r[ECM_AddrReg, BitFlags]:ub             FilterInternal8x8EdgesFlag:w            // Check for FilterInternal4x4EdgesFlag
  172.  
  173. //      and.z.f0.1 (1)  null:uw         r[ECM_AddrReg, wEdgeCntlMap_IntMidVert]:uw              0xFFFF:uw       // MaskA = 0?
  174.  
  175.         //      p3 = Cur MB Y row 4  = r[P_AddrReg, 0]<16;16,1>  
  176.         //      p2 = Cur MB Y row 5  = r[P_AddrReg, 16]<16;16,1>
  177.         //      p1 = Cur MB Y row 6  = r[P_AddrReg, 32]<16;16,1>
  178.         //      p0 = Cur MB Y row 7  = r[P_AddrReg, 48]<16;16,1>
  179.         //      q0 = Cur MB Y row 8  = r[Q_AddrReg, 0]<16;16,1>  
  180.         //      q1 = Cur MB Y row 9  = r[Q_AddrReg, 16]<16;16,1>
  181.         //      q2 = Cur MB Y row 10 = r[Q_AddrReg, 32]<16;16,1>
  182.         //      q3 = Cur MB Y row 11 = r[Q_AddrReg, 48]<16;16,1>
  183.         mov (1) P_AddrReg:w             4*Y_ROW_WIDTH+SRC_MB_Y_BASE:w   { NoDDClr }
  184.         mov (1) Q_AddrReg:w             8*Y_ROW_WIDTH+SRC_MB_Y_BASE:w   { NoDDChk }
  185.  
  186.         mov (1) MaskA:uw        r[ECM_AddrReg, wEdgeCntlMap_IntMidVert]:uw              { NoDDClr }
  187. //      mov (1) MaskB:uw        0:w                                             // Set MaskB = 0, so it always uses bS < 4 algorithm.
  188.  
  189.         // tc0 has bTc0_v32_Y + bTc0_v22_Y + bTc0_v12_Y + bTc0_v02_Y   
  190.         mov (4) tc0<1>:ub       r[ECM_AddrReg, bTc0_v02_Y]<4;4,1>:ub                    { NoDDChk }
  191.  
  192. //    (f0.0)    jmpi    BYPASS_8x8_DEBLOCK_V
  193. //      (f0.0.anyv)      jmpi   BYPASS_8x8_DEBLOCK_V
  194.    
  195. //      CALL(FILTER_Y, 1)
  196.         PRED_CALL(-f0.0, FILTER_Y, 1)
  197.  
  198. //BYPASS_8x8_DEBLOCK_V:
  199. //-----------------------------------------------
  200.  
  201.  
  202. //---------- Deblock Y interal right edge (V3) ----------        
  203.  
  204.         // Bypass deblocking if FilterInternal4x4EdgesFlag = 0  
  205.         and.z.f0.0      (1)     null:w  r[ECM_AddrReg, BitFlags]:ub             FilterInternal4x4EdgesFlag:w            // Check for FilterInternal4x4EdgesFlag
  206.  
  207. //      and.z.f0.1 (1)  null:uw         r[ECM_AddrReg, wEdgeCntlMap_IntRightVert]:uw            0xFFFF:uw       // MaskA = 0?
  208.  
  209.         //      p3 = Cur MB Y row 8  = r[P_AddrReg, 0]<16;16,1>
  210.         //      p2 = Cur MB Y row 9  = r[P_AddrReg, 16]<16;16,1>
  211.         //      p1 = Cur MB Y row 10 = r[P_AddrReg, 32]<16;16,1>
  212.         //      p0 = Cur MB Y row 11 = r[P_AddrReg, 48]<16;16,1>
  213.         //      q0 = Cur MB Y row 12 = r[Q_AddrReg, 0]<16;16,1>
  214.         //      q1 = Cur MB Y row 13 = r[Q_AddrReg, 16]<16;16,1>
  215.         //      q2 = Cur MB Y row 14 = r[Q_AddrReg, 32]<16;16,1>
  216.         //      q3 = Cur MB Y row 15 = r[Q_AddrReg, 48]<16;16,1>
  217.         mov (1) P_AddrReg:w             8*Y_ROW_WIDTH+SRC_MB_Y_BASE:w           { NoDDClr }
  218.         mov (1) Q_AddrReg:w             12*Y_ROW_WIDTH+SRC_MB_Y_BASE:w      { NoDDChk }
  219.  
  220.         mov (1) MaskA:uw        r[ECM_AddrReg, wEdgeCntlMap_IntRightVert]:uw    { NoDDClr }
  221. //      mov (1) MaskB:uw        0:w                                             // Set MaskB = 0, so it always uses bS < 4 algorithm.
  222.  
  223.         // tc0 has bTc0_v33_Y + bTc0_v23_Y + bTc0_v13_Y + bTc0_v03_Y
  224.         mov (4) tc0<1>:ub       r[ECM_AddrReg, bTc0_v03_Y]<4;4,1>:ub                    { NoDDChk }
  225.  
  226. //    (f0.0)    jmpi    BYPASS_4x4_DEBLOCK_V2
  227. //      (f0.0.anyv)      jmpi   BYPASS_4x4_DEBLOCK_V2
  228.    
  229. //      CALL(FILTER_Y, 1)
  230.         PRED_CALL(-f0.0, FILTER_Y, 1)
  231.  
  232. //BYPASS_4x4_DEBLOCK_V2:
  233. //-----------------------------------------------
  234.