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.  * Authors:
  10.  *    Halley Zhao <halley.zhao@intel.com>
  11.  */
  12.  
  13. // Module name: RGB_to_YUV_Coef.asm
  14. //----------------------------------------------------------------
  15.  
  16. // is src surface |R|G|B|X| layout? otherwise it is |B|G|R|X|
  17. and.nz.f0.1 (1) dNULLREG     r1.1:ud         0xFF000000:ud      
  18. #ifdef FIX_POINT_CONVERSION
  19.         // Y = ( (  66 * R + 129 * G +  25 * B + 128 ) >> 8) +  16
  20.     (-f0.1) mov (1) REG2(r, nTEMP0, 0):ud       0x00428119:ud      // used as unsigned byte
  21.     ( f0.1) mov (1) REG2(r, nTEMP0, 0):ud       0x00198142:ud      // used as unsigned byte
  22.         // U = ( ( -38 * R -  74 * G + 112 * B + 128 ) >> 8) + 128
  23.     (-f0.1) mov (1) REG2(r, nTEMP0, 1):ud       0x00DAB670:ud      // used as signed byte
  24.     ( f0.1) mov (1) REG2(r, nTEMP0, 1):ud       0x0070B6DA:ud      // used as signed byte
  25.         // V = ( ( 112 * R -  94 * G -  18 * B + 128 ) >> 8) + 128
  26.     (-f0.1) mov (1) REG2(r, nTEMP0, 2):ud       0x0070A2EEud      // used as signed byte
  27.     ( f0.1) mov (1) REG2(r, nTEMP0, 2):ud       0x00EEA270ud      // used as signed byte
  28.  
  29.     #define ubRGB_to_Y_Coef_Fix        REG2(r, nTEMP0, 0)
  30.     #define  bRGB_to_U_Coef_Fix        REG2(r, nTEMP0, 4)
  31.     #define  bRGB_to_V_Coef_Fix        REG2(r, nTEMP0, 8)
  32. #else
  33.         // Y =  0.299R + 0.587G + 0.114B
  34.     (-f0.1) mov (1) REG2(r, nTEMP8, 0):f       0.114f       // B coef
  35.     ( f0.1) mov (1) REG2(r, nTEMP8, 2):f       0.114f       // R coef
  36.             mov (1) REG2(r, nTEMP8, 1):f       0.587f       // G coef
  37.     (-f0.1) mov (1) REG2(r, nTEMP8, 2):f       0.299f       // R coef
  38.     ( f0.1) mov (1) REG2(r, nTEMP8, 0):f       0.299f       // B coef
  39.             mov (1) REG2(r, nTEMP8, 3):f       0.000f       // A coef
  40.    
  41.     // Cb= -0.169R - 0.331G + 0.499B + 128
  42.         // U = -0.147R - 0.289G + 0.436B + 128
  43.     (-f0.1) mov (1) REG2(r, nTEMP8, 4):f       0.436f       // B coef
  44.     ( f0.1) mov (1) REG2(r, nTEMP8, 6):f       0.436f       // R coef
  45.             mov (1) REG2(r, nTEMP8, 5):f      -0.289f       // G coef
  46.     (-f0.1) mov (1) REG2(r, nTEMP8, 6):f      -0.147f       // R coef
  47.     ( f0.1) mov (1) REG2(r, nTEMP8, 4):f      -0.147f       // B coef
  48.             mov (1) REG2(r, nTEMP8, 7):f       0.000f       // A coef
  49.  
  50.         // Cr= 0.499R - 0.418G - 0.0813B+ 128
  51.         // V = 0.615R - 0.515G - 0.100B + 128
  52.     (-f0.1) mov (1) REG2(r, nTEMP10, 0):f      -0.100f       // B coef
  53.     ( f0.1) mov (1) REG2(r, nTEMP10, 2):f      -0.100f       // R coef
  54.             mov (1) REG2(r, nTEMP10, 1):f      -0.515f       // G coef
  55.     (-f0.1) mov (1) REG2(r, nTEMP10, 2):f       0.615f       // R coef
  56.     ( f0.1) mov (1) REG2(r, nTEMP10, 0):f       0.615f       // B coef
  57.             mov (1) REG2(r, nTEMP10, 3):f       0.000f       // A coef
  58.  
  59.     #define fRGB_to_Y_Coef_Float        REG2(r, nTEMP8, 0)
  60.     #define fRGB_to_U_Coef_Float        REG2(r, nTEMP8, 4)
  61.     #define fRGB_to_V_Coef_Float        REG2(r, nTEMP10, 0)
  62.     .declare fROW_BGRX       Base=REG(r,nTEMP0) ElementSize=4 SrcRegion=REGION(8,8) Type=f    // r nTEMP0 - r nTEMP7
  63. #endif
  64.  
  65.