Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * All Video Processing kernels
  3.  * Copyright © <2010>, Intel Corporation.
  4.  *
  5.  * This program is licensed under the terms and conditions of the
  6.  * Eclipse Public License (EPL), version 1.0.  The full text of the EPL is at
  7.  * http://www.opensource.org/licenses/eclipse-1.0.php.
  8.  *
  9.  */
  10.  
  11. //---------- RGB_Scaling.asm ----------
  12. #include "Scaling.inc"
  13.  
  14.         // Build 16 elements ramp in float32 and normalized it
  15. //      mov (8)         SAMPLER_RAMP(0)<1>              0x76543210:v
  16. //      add     (8)             SAMPLER_RAMP(1)<1>              SAMPLER_RAMP(0) 8.0:f
  17. mov (4) SAMPLER_RAMP(0)<1> 0x48403000:vf                //3, 2, 1, 0 in float vector
  18. mov (4) SAMPLER_RAMP(0,4)<1> 0x5C585450:vf      //7, 6, 5, 4 in float vector
  19. add     (8)             SAMPLER_RAMP(1)<1>              SAMPLER_RAMP(0) 8.0:f
  20.  
  21. //Module: PrepareScaleCoord.asm
  22.  
  23.         // Setup for sampler msg hdr
  24.     mov (2)             rMSGSRC.0<1>:ud                 0:ud                                            { NoDDClr }     // Unused fields
  25.     mov (1)             rMSGSRC.2<1>:ud                 0:ud                                            { NoDDChk }     // Write and offset
  26.  
  27.         // Calculate 16 v based on the step Y and vertical origin
  28.         mov     (16)    mfMSGPAYLOAD(2)<1>              fSRC_VID_V_ORI<0;1,0>:f
  29.         mov     (16)    SCALE_COORD_Y<1>:f              fSRC_VID_V_ORI<0;1,0>:f
  30.  
  31.         // Calculate 16 u based on the step X and hori origin
  32. //      line (16)       mfMSGPAYLOAD(0)<1>              SCALE_STEP_X<0;1,0>:f           SAMPLER_RAMP(0)         // Assign to mrf directly
  33.         mov     (16)    acc0:f                                                  fSRC_VID_H_ORI<0;1,0>:f                                                                                 { Compr }
  34.         mac     (16)    mfMSGPAYLOAD(0)<1>      fVIDEO_STEP_X<0;1,0>:f  SAMPLER_RAMP(0)                 { Compr }                      
  35.  
  36.         //Setup the constants for line instruction
  37.         mov     (1)             SCALE_LINE_P255<1>:f            255.0:f                         { NoDDClr }     //{ NoDDClr, NoDDChk }
  38.         mov     (1)             SCALE_LINE_P0_5<1>:f            0.5:f                           { NoDDChk }
  39.  
  40.        
  41. //------------------------------------------------------------------------------
  42.  
  43. $for (0; <nY_NUM_OF_ROWS; 1) {
  44.  
  45.         // Read 16 sampled pixels and store them in float32 in 8 GRFs in the order of BGRA (VYUA).
  46.   mov (8)       MSGHDR_SCALE.0:ud      rMSGSRC.0<8;8,1>:ud    // Copy msg header and payload mirrors to MRFs
  47.         send (16)       SCALE_RESPONSE_YW(0)<1>         MSGHDR_SCALE    udDUMMY_NULL    nSMPL_ENGINE SMPLR_MSG_DSC+nSI_SRC_SIMD16_RGB+nBI_CURRENT_SRC_RGB
  48.  
  49.         // Calculate 16 v for next line
  50.         add (16)        mfMSGPAYLOAD(2)<1>              SCALE_COORD_Y<8;8,1>:f          fVIDEO_STEP_Y<0;1,0>:f  // Assign to mrf directly
  51.         add (16)        SCALE_COORD_Y<1>:f              SCALE_COORD_Y<8;8,1>:f          fVIDEO_STEP_Y<0;1,0>:f  // Assign to mrf directly
  52.  
  53.         // Scale back to [0, 255], convert f to ud
  54.         line (16)       acc0:f          SCALE_LINE_P255<0;1,0>:f        SCALE_RESPONSE_YF(0)    { Compr }                       // Process B, V
  55.         mov  (16) SCALE_RESPONSE_YD(0)<1>       acc0:f                                                                                                          { Compr }
  56.  
  57.         line (16)       acc0:f          SCALE_LINE_P255<0;1,0>:f        SCALE_RESPONSE_YF(2)    { Compr }                       // Process B, V
  58.         mov  (16) SCALE_RESPONSE_YD(2)<1>       acc0:f                                                                                                          { Compr }
  59.  
  60.         line (16)       acc0:f          SCALE_LINE_P255<0;1,0>:f        SCALE_RESPONSE_YF(4)    { Compr }                       // Process B, V
  61.         mov  (16) SCALE_RESPONSE_YD(4)<1>       acc0:f                                                                                                          { Compr }
  62.  
  63. //#if defined(SAVE_ARGB)        //Only needed if Alpha value is written to the destination
  64.         line (16)       acc0:f          SCALE_LINE_P255<0;1,0>:f        SCALE_RESPONSE_YF(6)    { Compr }                       // Process B, V
  65.         mov  (16) SCALE_RESPONSE_YD(6)<1>       acc0:f                                                                                                          { Compr }
  66. //#endif
  67.  
  68.         mov      (16)   DEST_R(%1)<1>                           SCALE_RESPONSE_YB(0)                                                                                    //possible error due to truncation - vK
  69.         mov      (16)   DEST_G(%1)<1>                           SCALE_RESPONSE_YB(2)                                                                                    //possible error due to truncation - vK
  70.         mov      (16)   DEST_B(%1)<1>                           SCALE_RESPONSE_YB(4)                                                                                    //possible error due to truncation - vK
  71.         mov      (16)   DEST_A(%1)<1>                           SCALE_RESPONSE_YB(6)                                                                                    //possible error due to truncation - vK
  72. }
  73.