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. // Module name: DI.inc
  12.  
  13. #ifdef GT
  14. // GT DI Kernel
  15. #else // ILK
  16. // ILK DI Kernel
  17. #endif
  18.  
  19. #include "undefall.inc"
  20.  
  21. //---------------------------------------------------------------------------
  22. // Message descriptors
  23. //---------------------------------------------------------------------------
  24. // Extended message descriptor
  25.           // Message descriptor for sampler read
  26. //        //                      = 000 0010 (message len 2) 00000 (resp len - set later, 12 or 5 or 11)  
  27. //        //                        1 (header present 1) 0 11 (SIMD32/64 mode)
  28. //        //                        1000 (message type) 0000 (DI state index)
  29. //        //                        00000000 (binding table index - set later)
  30. //        //                      = 0x040b8000
  31. #define nSMPL_DI_MSGDSC           0x040b8000
  32.  
  33. #define nSMPL_RESP_LEN_DNDI      nRESLEN_12      // 12 - for DN + DI Alg
  34. #define nSMPL_RESP_LEN_DN_PL     nRESLEN_5       // 5  - for DN Planar Alg
  35. #define nSMPL_RESP_LEN_DN_PA     nRESLEN_9       // 9  - for DN Packed Alg
  36. #define nSMPL_RESP_LEN_DI        nRESLEN_9       // 9  - for DI Only Alg
  37. #define nSMPL_RESP_LEN_PDI       nRESLEN_11      // 11 - for Partial DI Alg
  38.  
  39. // Attention: The Message Length is The Number of GRFs with Data Only, without the Header
  40. #define nDPMW_MSG_LEN_STMM       nMSGLEN_1       // 1 - For STMM Save
  41. #define nDPMW_MSG_LEN_HIST       nMSGLEN_1       // 1 - For Denoise History Save
  42. #define nDPMW_MSG_LEN_PA_DN_DI   nMSGLEN_4       // 4 - For DN Curr Save
  43. #define nDPMW_MSG_LEN_PA_DN_NODI nMSGLEN_8       // 8 - For DN Curr Save (denoise only - DI disabled)
  44. #define nDPMW_MSG_LEN_PL_DN_DI   nMSGLEN_2       // 2 - For DN Curr Save
  45. #define nDPMW_MSG_LEN_PL_DN_NODI nMSGLEN_4       // 4 - For DN Curr Save (denoise only - DI disabled)
  46.  
  47. #define nDPW_BLOCK_SIZE_STMM   nBLOCK_WIDTH_8+nBLOCK_HEIGHT_4   // Y block size 8x4
  48.  
  49. #undef  nDPW_BLOCK_SIZE_DI
  50. #undef  nDPW_MSG_SIZE_DI
  51. #define nDPW_BLOCK_SIZE_DI  nBLOCK_WIDTH_32+nBLOCK_HEIGHT_4    
  52. #define nDPW_MSG_SIZE_DI    nMSGLEN_4
  53.  
  54.  
  55. //---------------------------------------------------------------------------
  56. // Kernel GRF variables
  57. //---------------------------------------------------------------------------
  58. // Defines for DI enabled
  59. #define nDI_PREV_FRAME_LUMA_OFFSET          0
  60. #define nDI_PREV_FRAME_CHROMA_OFFSET        2
  61. #define nDI_CURR_FRAME_LUMA_OFFSET          4
  62. #define nDI_CURR_FRAME_CHROMA_OFFSET        6
  63. #define nDI_STMM_OFFSET                     8
  64. #define nDI_HIST_OFFSET                     9
  65. #define nDI_CURR_2ND_FIELD_LUMA_OFFSET     10
  66. #define nDI_CURR_2ND_FIELD_CHROMA_OFFSET   11
  67.  
  68. // Defines for DI disabled
  69. #define nNODI_LUMA_OFFSET                   0
  70. #define nNODI_HIST_OFFSET                   4
  71. #define nNODI_CHROMA_OFFSET                 5
  72.  
  73. #ifdef DI_ENABLE
  74.     #define nHIST_OFFSET    nDI_HIST_OFFSET
  75.     #undef  nY_NUM_OF_ROWS
  76.     #define nY_NUM_OF_ROWS      8       // Number of Y rows per block (4 rows for each frame)
  77.     #undef  nUV_NUM_OF_ROWS
  78.     #define nUV_NUM_OF_ROWS     8       // Number of U/V rows per block
  79.        
  80. #endif
  81.  
  82. #ifdef DI_DISABLE
  83.     #define nHIST_OFFSET    nNODI_HIST_OFFSET
  84. #endif
  85.  
  86. #if (nSRC_REGION==nREGION_2)
  87.     #define ub2SRC_Y      ub2BOT_Y
  88.     #define ub2SRC_U      ub2BOT_U
  89.     #define ub2SRC_V      ub2BOT_V
  90.     #define uwDEST_Y      uwBOT_Y
  91.     #define uwDEST_U      uwBOT_U
  92.     #define uwDEST_V      uwBOT_V
  93.     #define nDEST_YUV_REG nTOP_Y
  94.     #define udDEST_YUV    udTOP_Y_IO
  95.  
  96.     #define nRESP         nTEMP0         // DI return message requires 12 GRFs
  97.     #define nDN_YUV       nTOP_Y         // Space for Packing DN for next run requires 8 GRFs
  98.  
  99.     #undef  nSRC_REGION
  100.     #define nSRC_REGION   nREGION_2
  101.  
  102. #else
  103.     #define ub2SRC_Y      ub2TOP_Y
  104.     #define ub2SRC_U      ub2TOP_U
  105.     #define ub2SRC_V      ub2TOP_V
  106.     #define uwDEST_Y      uwTOP_Y
  107.     #define uwDEST_U      uwTOP_U
  108.     #define uwDEST_V      uwTOP_V
  109.     #define nDEST_YUV_REG nBOT_Y
  110.     #define udDEST_YUV    udBOT_Y_IO
  111.     #define nRESP         nTEMP0         // DI return message requires 12 GRFs
  112.     #define nDN_YUV       nBOT_Y         // Space for Packing DN for next run requires 8 GRFs
  113.  
  114.     #undef  nSRC_REGION
  115.     #define nSRC_REGION   nREGION_1    // REGION_1 will be the source region for first kernel
  116.  
  117. #endif
  118.  
  119.  
  120.    
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127. // Message response (Denoised & DI-ed pixels & statistics)
  128. .declare udRESP      Base=REG(r,nRESP) ElementSize=4 SrcRegion=REGION(8,1) DstRegion=<1> Type=ud
  129. .declare ubRESP      Base=REG(r,nRESP) ElementSize=1 SrcRegion=REGION(16,1) DstRegion=<1> Type=ub
  130.  
  131. // For Denoised Curr Output (Used as Priv in Next Run)
  132. .declare ubDN_YUV           Base=REG(r,nDN_YUV)    ElementSize=1 Type=ub
  133. .declare udDN_YUV           Base=REG(r,nDN_YUV)    ElementSize=4 Type=ud
  134. #define  npDN_YUV           nDN_YUV*nGRFWIB                                
  135.  
  136. // For DI Process Output (1st and 2nd Frames Output)
  137. //.declare udDI_YUV_PRIV      Base=REG(r,nTEMP0)    ElementSize=4 Type=ud   // Previous frame DI output
  138. //.declare udDI_YUV_CURR      Base=REG(r,nTEMP0)    ElementSize=4 Type=ud   // Current frame DI output
  139. //#define  npDI_YUV           nTEMP0*nGRFWIB                                  
  140.  
  141. //---------------------------------------------------------------------------
  142. // Kernel MRF variables
  143. //---------------------------------------------------------------------------
  144. #define  mMSG_SMPL           m1                                              // Sampler Command is in: m1~m2
  145. .declare mudMSG_SMPL         Base=mMSG_SMPL         ElementSize=4 Type=ud
  146. .declare muwMSG_SMPL         Base=mMSG_SMPL         ElementSize=2 Type=uw
  147.  
  148. #define mMSGHDR_DN           m1                                              // Denoise Output: m1~m9 for PA, m3~m5 for PL
  149. .declare mudMSGHDR_DN        Base=mMSGHDR_DN        ElementSize=4 Type=ud
  150. .declare mubMSGHDR_DN        Base=mMSGHDR_DN        ElementSize=1 Type=ub
  151.  
  152. #define mMSGHDR_STMM         m11                                             // STMM Output: m11~m12
  153. .declare mudMSGHDR_STMM      Base=mMSGHDR_STMM      ElementSize=4 Type=ud
  154. #define mMSGHDR_HIST         m13                                             // HIST Output: m13~m14
  155. .declare mudMSGHDR_HIST      Base=mMSGHDR_HIST      ElementSize=1 Type=ud
  156.  
  157. #define mMSGHDR_DI_1ST       m1                                              // DI output: m1~m5
  158. .declare mudMSGHDR_DI_1ST    Base=mMSGHDR_DI_1ST    ElementSize=4 Type=ud
  159. #define mMSGHDR_DI_2ND       m6                                              // DI output: m6~m10
  160. .declare mudMSGHDR_DI_2ND    Base=mMSGHDR_DI_2ND    ElementSize=4 Type=ud
  161.  
  162. // end of DNDI.inc
  163.