Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | 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. // Module name: PL8x4_Save_IMC3.asm
  12. //
  13. // Save planar YUV420 frame data block of size 16x8
  14.  
  15. #include "PL8x4_Save_IMC3.inc"
  16.  
  17. //Use the mask to determine which pixels shouldn't be over-written
  18.    and (1)        acc0.0<1>:ud udBLOCK_MASK<0;1,0>:ud   0x00FFFFFF:ud
  19.    cmp.ge.f0.0(1) dNULLREG     acc0.0<0;1,0>:ud         0x00FFFFFF:ud   //Check if all pixels in the block need to be modified
  20.    (f0.0)  jmpi WritePlanarToDataPort
  21.  
  22.    //If mask is not all 1's, then load the entire 16x8 block
  23.     //so that only those bytes may be modified that need to be (using the mask)
  24.  
  25.     // Load 16x8 planar Y ----------------------------------------------------------
  26.     mov  (2) rMSGSRC.0<1>:d     wORIX<2;2,1>:w          // Block origin
  27.     mov  (1) rMSGSRC.2<1>:ud    nDPW_BLOCK_SIZE_Y:ud    // Block width and height (16x8)
  28.     mov  (8) mMSGHDR<1>:ud      rMSGSRC<8;8,1>:ud
  29.     send (8) udSRC_Y(0)<1>      mMSGHDR     udDUMMY_NULL    nDATAPORT_READ    nDPMR_MSGDSC+nDPR_MSG_SIZE_Y+nBI_DESTINATION_Y:ud
  30.     // Load 8x4 planar U and V -----------------------------------------------------
  31.     asr  (2) rMSGSRC.0<1>:d     wORIX<2;2,1>:w    1:w   // U/V block origin should be half of Y's
  32.     mov  (1) rMSGSRC.2<1>:ud    nDPW_BLOCK_SIZE_UV:ud   // Block width and height (8x4)
  33.     mov  (8) mMSGHDR<1>:ud      rMSGSRC<8;8,1>:ud
  34.     send (8) udSRC_U(0)<1>      mMSGHDR     udDUMMY_NULL    nDATAPORT_READ    nDPMR_MSGDSC+nDPR_MSG_SIZE_UV+nBI_DESTINATION_U:ud
  35.     mov  (8) mMSGHDR<1>:ud      rMSGSRC<8;8,1>:ud
  36.     send (8) udSRC_V(0)<1>      mMSGHDR     udDUMMY_NULL    nDATAPORT_READ    nDPMR_MSGDSC+nDPR_MSG_SIZE_UV+nBI_DESTINATION_V:ud
  37.  
  38.     //expand U and V to be aligned on word boundary - Y remains in bytes
  39.     $for (nUV_NUM_OF_ROWS/2-1; >-1; -1) {
  40.         mov (16)  uwSRC_U(0, %1*16)<1>    ubSRC_U(0, %1*16)
  41.         mov (16)  uwSRC_V(0, %1*16)<1>    ubSRC_V(0, %1*16)
  42.     }
  43.  
  44.     //Merge the data
  45.     mov (1)           f0.0:uw             ubBLOCK_MASK_V:ub    //Load the mask on flag reg
  46.     (f0.0)  mov (8)   rMASK_TEMP<1>:uw    uwBLOCK_MASK_H:uw
  47.     (-f0.0) mov (8)   rMASK_TEMP<1>:uw    0:uw
  48.  
  49.     // Destination is Word aligned
  50.     $for(0; <nY_NUM_OF_ROWS; 2) {
  51.         mov (1)             f0.1:uw                   uwMASK_TEMP(0,%1)<0;1,0>
  52.         (-f0.1) mov (16)    ub2DEST_Y(0, %1*32)<2>    ubSRC_Y(0, %1*16)
  53.         (-f0.1) mov (16)    ub2DEST_U(0, %1*8)<1>     ubSRC_U(0, %1*8)    //only works for Word aligned Byte data
  54.         (-f0.1) mov (16)    ub2DEST_V(0, %1*8)<1>     ubSRC_V(0, %1*8)    //only works for Word aligned Byte data
  55.  
  56.         mov (1)             f0.1:uw                   uwMASK_TEMP(0,1+%1)<0;1,0>
  57.         (-f0.1) mov (16)    ub2DEST_Y(0, 1+%1*32)<2>  ubSRC_Y(0, 1+%1*16)
  58.     }
  59.  
  60. WritePlanarToDataPort:
  61. #if !defined(SAVE_UV_ONLY)
  62. // Save current planar frame Y block data (16x8) -------------------------------
  63.     mov (2)     rMSGSRC.0<1>:d     wORIX<2;2,1>:w          // Block origin
  64.     mov (1)     rMSGSRC.2<1>:ud    nDPW_BLOCK_SIZE_Y:ud    // Block width and height (16x8)
  65.     mov (8)     mMSGHDR<1>:ud      rMSGSRC<8;8,1>:ud
  66.     $for(0,0; <nY_NUM_OF_ROWS; 2,1) {
  67.         mov(16) mubMSGPAYLOAD(%2,0)<1>     ub2DEST_Y(%1)REGION(16,2)
  68.         mov(16) mubMSGPAYLOAD(%2,16)<1>    ub2DEST_Y(%1+1)REGION(16,2)
  69.     }
  70.     send (8)    dNULLREG    mMSGHDR   udDUMMY_NULL    nDATAPORT_WRITE    nDPMW_MSGDSC+nDPW_MSG_SIZE_Y+nBI_DESTINATION_Y:ud
  71. #endif
  72. // Save U/V data block in planar format (8x4) ----------------------------------
  73.     asr  (2)    rMSGSRC.0<1>:d     wORIX<2;2,1>:w    1:w   // U/V block origin should be half of Y's
  74.     mov  (1)    rMSGSRC.2<1>:ud    nDPW_BLOCK_SIZE_UV:ud   // Block width and height (8x4)
  75.     mov  (8)    mMSGHDR<1>:ud      rMSGSRC<8;8,1>:ud
  76.  
  77. // Save U picture data ---------------------------------------------------------
  78.     mov (16)    mubMSGPAYLOAD(0,0)<1>      ub2DEST_U(0)REGION(16,2)   // U rows 0,1
  79.     mov (16)    mubMSGPAYLOAD(0,16)<1>     ub2DEST_U(1)REGION(16,2)   // U rows 2,3
  80.     send (8)    dNULLREG    mMSGHDR   udDUMMY_NULL    nDATAPORT_WRITE    nDPMW_MSGDSC+nDPW_MSG_SIZE_UV+nBI_DESTINATION_U:ud
  81.     mov  (8)    mMSGHDR<1>:ud      rMSGSRC<8;8,1>:ud
  82.  
  83. // Save V picture data ---------------------------------------------------------
  84.     mov  (16)   mubMSGPAYLOAD(0,0)<1>      ub2DEST_V(0)REGION(16,2)   // V rows 0,1
  85.     mov  (16)   mubMSGPAYLOAD(0,16)<1>     ub2DEST_V(1)REGION(16,2)   // V rows 2,3
  86.     send (8)    dNULLREG    mMSGHDR   udDUMMY_NULL    nDATAPORT_WRITE    nDPMW_MSGDSC+nDPW_MSG_SIZE_UV+nBI_DESTINATION_V:ud
  87.  
  88. // End of PL8x4_Save_IMC3
  89.