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 horizontal Mbaff UV ///////////////////////////////////////////////////////
  40. //
  41. //      This filter code prepares the src data and control data for ILDB filtering on all horizontal edges of UV.
  42. //
  43. //      It sssumes the data for horizontal de-blocking is already transposed.  
  44. //
  45. //              Chroma:
  46. //
  47. //              +-------+-------+               H0 Edge
  48. //              |               |               |
  49. //              |               |               |
  50. //              |               |               |
  51. //              +-------+-------+               H1 Edge
  52. //              |               |               |
  53. //              |               |               |
  54. //              |               |               |
  55. //              +-------+-------+
  56. //
  57. /////////////////////////////////////////////////////////////////////////////
  58.  
  59. #if defined(_DEBUG)
  60.         mov             (1)             EntrySignatureC:w                       0xBBBC:w
  61. #endif 
  62.  
  63. //=============== Chroma deblocking ================
  64.  
  65. //---------- Deblock UV external top edge ----------
  66.  
  67.         and.z.f0.0  (1) null:w          r[ECM_AddrReg, BitFlags]:ub             FilterTopMbEdgeFlag:w           // Check for FilterTopMbEdgeFlag
  68.  
  69.         mov     (1)     f0.1:w          DualFieldMode:w         // Check for dual field mode
  70.  
  71.         // Get Luma maskA and maskB    
  72.         shr (16)        TempRow0(0)<1>          r[ECM_AddrReg, wEdgeCntlMapA_ExtTopHorz0]<0;1,0>:uw             RRampW(0)
  73.         shr (16)        TempRow1(0)<1>          r[ECM_AddrReg, wEdgeCntlMapB_ExtTopHorz0]<0;1,0>:uw             RRampW(0)
  74.  
  75.     (f0.0)      jmpi    H0_UV_DONE                              // Skip H0 UV edge
  76.  
  77.         (f0.1) jmpi DUAL_FIELD_UV
  78.  
  79.         // Non dual field mode 
  80.  
  81.         // Extract UV MaskA and MaskB from every other bit of Y masks
  82.         and.nz.f0.0 (8) null:w                  TempRow0(0)<16;8,2>             1:w
  83.         and.nz.f0.1 (8) null:w                  TempRow1(0)<16;8,2>             1:w
  84.  
  85.         // Ext U
  86.         //      p1 = Prev MB U row 0
  87.         //      p0 = Prev MB U row 1
  88.         //      q0 = Cur MB U row 0
  89.         //      q1 = Cur MB U row 1
  90.         mov (1) P_AddrReg:w             PREV_MB_U_BASE:w        { NoDDClr }
  91.         mov (1) Q_AddrReg:w             SRC_MB_U_BASE:w         { NoDDChk }
  92.        
  93.         mov     (8) Mbaff_ALPHA(0,0)<1>         r[ECM_AddrReg, bAlphaTop0_Cb]<0;1,0>:ub
  94.         mov     (8) Mbaff_BETA(0,0)<1>          r[ECM_AddrReg, bBetaTop0_Cb]<0;1,0>:ub
  95.         mov (8) Mbaff_TC0(0,0)<1>               r[ECM_AddrReg, bTc0_h00_0_Cb]<1;2,0>:ub
  96.  
  97.         // Store UV MaskA and MaskB
  98.         mov (2)         MaskA<1>:uw                     f0.0<2;2,1>:uw
  99.  
  100.         CALL(FILTER_UV_MBAFF, 1)       
  101.  
  102.         // Ext V
  103.         mov (1) P_AddrReg:w             PREV_MB_V_BASE:w        { NoDDClr }
  104.         mov (1) Q_AddrReg:w             SRC_MB_V_BASE:w         { NoDDChk }
  105.  
  106.         mov     (8) Mbaff_ALPHA(0,0)<1>         r[ECM_AddrReg, bAlphaTop0_Cr]<0;1,0>:ub
  107.         mov     (8) Mbaff_BETA(0,0)<1>          r[ECM_AddrReg, bBetaTop0_Cr]<0;1,0>:ub
  108.         mov (8) Mbaff_TC0(0,0)<1>               r[ECM_AddrReg, bTc0_h00_0_Cr]<1;2,0>:ub
  109.  
  110.         // Set UV MaskA and MaskB
  111.         mov (2)         f0.0<1>:uw              MaskA<2;2,1>:uw
  112.  
  113.         CALL(FILTER_UV_MBAFF, 1)       
  114.  
  115.         jmpi H0_UV_DONE
  116.        
  117. DUAL_FIELD_UV:
  118.         // Dual field mode, FieldModeCurrentMbFlag=0 && FieldModeAboveMbFlag=1
  119.  
  120.         //===== Ext U, Top field
  121.  
  122.         // Extract UV MaskA and MaskB from every other bit of Y masks
  123.         and.nz.f0.0 (8) null:w                  TempRow0(0)<16;8,2>             1:w
  124.         and.nz.f0.1 (8) null:w                  TempRow1(0)<16;8,2>             1:w
  125.  
  126.         mov (1) P_AddrReg:w             ABOVE_CUR_MB_BASE:w                     { NoDDClr }
  127.         mov (1) Q_AddrReg:w             ABOVE_CUR_MB_BASE+32:w          { NoDDChk }
  128.  
  129.         mov (16) ABOVE_CUR_MB_UW(0)<1>  PREV_MB_UW(0, 0)<16;8,1>        // Copy p1, p0
  130.         mov (16) ABOVE_CUR_MB_UW(1)<1>  SRC_UW(0, 0)<16;8,1>            // Copy q1, q0
  131.  
  132.         //===== Ext U, top field
  133.         mov     (8) Mbaff_ALPHA(0,0)<1>         r[ECM_AddrReg, bAlphaTop0_Cb]<0;1,0>:ub
  134.         mov     (8) Mbaff_BETA(0,0)<1>          r[ECM_AddrReg, bBetaTop0_Cb]<0;1,0>:ub
  135.         mov (8) Mbaff_TC0(0,0)<1>               r[ECM_AddrReg, bTc0_h00_0_Cb]<1;2,0>:ub
  136.  
  137.         // Store UV MaskA and MaskB
  138.         mov (2)         MaskA<1>:uw                     f0.0<2;2,1>:uw
  139.  
  140.         CALL(FILTER_UV_MBAFF, 1)        // Ext U, top field
  141.  
  142.         //===== Ext V, top field
  143.         mov (1) P_AddrReg:w             ABOVE_CUR_MB_BASE+1:w           { NoDDClr }
  144.         mov (1) Q_AddrReg:w             ABOVE_CUR_MB_BASE+33:w          { NoDDChk }
  145.  
  146.         mov     (8) Mbaff_ALPHA(0,0)<1>         r[ECM_AddrReg, bAlphaTop0_Cr]<0;1,0>:ub
  147.         mov     (8) Mbaff_BETA(0,0)<1>          r[ECM_AddrReg, bBetaTop0_Cr]<0;1,0>:ub
  148.         mov (8) Mbaff_TC0(0,0)<1>               r[ECM_AddrReg, bTc0_h00_0_Cr]<1;2,0>:ub
  149.  
  150.         // Set UV MaskA and MaskB
  151.         mov (2)         f0.0<1>:uw              MaskA<2;2,1>:uw
  152.  
  153.         CALL(FILTER_UV_MBAFF, 1)        // Ext U, top field
  154.  
  155.         // Prefetch for bottom field
  156.         // Get bot field Luma maskA and maskB  
  157.         shr (16)        TempRow0(0)<1>          r[ECM_AddrReg, wEdgeCntlMapA_ExtTopHorz1]<0;1,0>:uw             RRampW(0)
  158.         shr (16)        TempRow1(0)<1>          r[ECM_AddrReg, wEdgeCntlMapB_ExtTopHorz1]<0;1,0>:uw             RRampW(0)
  159.  
  160.         // Save deblocked top field rows
  161.         mov (8) PREV_MB_UW(1, 0)<1>             ABOVE_CUR_MB_UW(0, 8)   // Copy p0
  162.         mov (8) SRC_UW(0, 0)<1>                 ABOVE_CUR_MB_UW(1, 0)   // Copy q0
  163.         //==========================================================================
  164.  
  165.         //===== Ext U, Bot field
  166.        
  167.         // Extract UV MaskA and MaskB from every other bit of Y masks
  168.         and.nz.f0.0 (8) null:w                  TempRow0(0)<16;8,2>             1:w
  169.         and.nz.f0.1 (8) null:w                  TempRow1(0)<16;8,2>             1:w
  170.  
  171.         mov (1) P_AddrReg:w             ABOVE_CUR_MB_BASE:w                     { NoDDClr }
  172.         mov (1) Q_AddrReg:w             ABOVE_CUR_MB_BASE+32:w          { NoDDChk }
  173.  
  174.         mov (16) ABOVE_CUR_MB_UW(0)<1>  PREV_MB_UW(0, 8)<16;8,1>        // Copy p1, p0
  175.         mov (16) ABOVE_CUR_MB_UW(1)<1>  SRC_UW(0, 8)<16;8,1>            // Copy q1, q0
  176.  
  177.         //===== Ext U, bottom field
  178.         mov     (8) Mbaff_ALPHA(0,0)<1>         r[ECM_AddrReg, bAlphaTop1_Cb]<0;1,0>:ub
  179.         mov     (8) Mbaff_BETA(0,0)<1>          r[ECM_AddrReg, bBetaTop1_Cb]<0;1,0>:ub
  180.         mov (8) Mbaff_TC0(0,0)<1>               r[ECM_AddrReg, bTc0_h00_1_Cb]<1;2,0>:ub
  181.  
  182.         // Store UV MaskA and MaskB
  183.         mov (2)         MaskA<1>:uw                     f0.0<2;2,1>:uw
  184.  
  185.         CALL(FILTER_UV_MBAFF, 1)        // Ext U, bottom field
  186.  
  187.         //===== Ext V, bot field
  188.         mov (1) P_AddrReg:w             ABOVE_CUR_MB_BASE+1:w           { NoDDClr }
  189.         mov (1) Q_AddrReg:w             ABOVE_CUR_MB_BASE+33:w          { NoDDChk }
  190.  
  191.         mov     (8) Mbaff_ALPHA(0,0)<1>         r[ECM_AddrReg, bAlphaTop1_Cr]<0;1,0>:ub
  192.         mov     (8) Mbaff_BETA(0,0)<1>          r[ECM_AddrReg, bBetaTop1_Cr]<0;1,0>:ub
  193.         mov (8) Mbaff_TC0(0,0)<1>               r[ECM_AddrReg, bTc0_h00_1_Cr]<1;2,0>:ub
  194.  
  195.         // Set UV MaskA and MaskB
  196.         mov (2)         f0.0<1>:uw              MaskA<2;2,1>:uw
  197.  
  198.         CALL(FILTER_UV_MBAFF, 1)        // Ext V, bottom field
  199.        
  200.         // Save deblocked bot field rows
  201.         mov (8) PREV_MB_UW(1, 8)<1>             ABOVE_CUR_MB_UW(0, 8)   // Copy p0
  202.         mov (8) SRC_UW(0, 8)<1>                 ABOVE_CUR_MB_UW(1, 0)   // Copy q0
  203.         //========================================
  204.  
  205. H0_UV_DONE:
  206.  
  207. //---------- Deblock U internal horz middle edge ----------
  208.  
  209.         //***** Need to take every other bit to form U maskA in core
  210.         shr (16)        TempRow0(0)<1>          r[ECM_AddrReg, wEdgeCntlMap_IntMidHorz]<0;1,0>:uw               RRampW(0)
  211.  
  212.         //      p1 = Cur MB U row 2
  213.         //      p0 = Cur MB U row 3
  214.         //      q0 = Cur MB U row 4
  215.         //      q1 = Cur MB U row 5
  216.         mov (1) P_AddrReg:w             4*UV_ROW_WIDTH+SRC_MB_U_BASE:w          { NoDDClr }
  217.         mov (1) Q_AddrReg:w             8*UV_ROW_WIDTH+SRC_MB_U_BASE:w          { NoDDChk }
  218.  
  219.         mov     (8) Mbaff_ALPHA(0,0)<1>         r[ECM_AddrReg, bAlphaInternal_Cb]<0;1,0>:ub
  220.         mov     (8) Mbaff_BETA(0,0)<1>          r[ECM_AddrReg, bBetaInternal_Cb]<0;1,0>:ub
  221.         mov (8) Mbaff_TC0(0,0)<1>               r[ECM_AddrReg, bTc0_h20_Cb]<1;2,0>:ub
  222.  
  223.         and.nz.f0.0 (8) null:w                  TempRow0(0)<16;8,2>             1:w
  224.  
  225.         // Store UV MaskA and MaskB
  226.         mov (1) f0.1:uw         0:w
  227.         mov (1) MaskB:uw        0:w                     { NoDDClr }
  228.         mov (1) MaskA:uw        f0.0:uw         { NoDDChk }
  229.  
  230.         CALL(FILTER_UV_MBAFF, 1)       
  231. //-----------------------------------------------
  232.  
  233.  
  234. //---------- Deblock V internal horz middle edge ----------
  235.  
  236.         //      p1 = Cur MB V row 2
  237.         //      p0 = Cur MB V row 3
  238.         //      q0 = Cur MB V row 4
  239.         //      q1 = Cur MB V row 5
  240.         mov (1) P_AddrReg:w             4*UV_ROW_WIDTH+SRC_MB_V_BASE:w          { NoDDClr }
  241.         mov (1) Q_AddrReg:w             8*UV_ROW_WIDTH+SRC_MB_V_BASE:w          { NoDDChk }
  242.  
  243.         mov     (8) Mbaff_ALPHA(0,0)<1>         r[ECM_AddrReg, bAlphaInternal_Cr]<0;1,0>:ub
  244.         mov     (8) Mbaff_BETA(0,0)<1>          r[ECM_AddrReg, bBetaInternal_Cr]<0;1,0>:ub
  245.         mov (8) Mbaff_TC0(0,0)<1>               r[ECM_AddrReg, bTc0_h20_Cr]<1;2,0>:ub
  246.  
  247.         // Set UV MaskA and MaskB
  248.         mov (2)         f0.0<1>:uw              MaskA<2;2,1>:uw
  249.  
  250.         CALL(FILTER_UV_MBAFF, 1)       
  251. //-----------------------------------------------
  252.  
  253.  
  254.