Ignore:
Timestamp:
1 Sep 2013, 22:47:26 (12 years ago)
Author:
tech
Message:

Merged DEV-2.0-dev0@604.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibCommon/TComInterpolationFilter.cpp

    r443 r608  
    44 * granted under this license. 
    55 *
    6  * Copyright (c) 2010-2012, ITU/ISO/IEC
     6 * Copyright (c) 2010-2013, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    7272  { -2, 10, 58, -2 }
    7373};
    74 #if QC_ARP_D0177
     74
     75#if H_3D_ARP
    7576const Short TComInterpolationFilter::m_lumaFilterARP[4][NTAPS_LUMA_ARP] =
    7677{
     
    9293};
    9394#endif
     95
    9496// ====================================================================================================================
    9597// Private member functions
     
    99101 * \brief Apply unit FIR filter to a block of samples
    100102 *
     103 * \param bitDepth   bitDepth of samples
    101104 * \param src        Pointer to source samples
    102105 * \param srcStride  Stride of source samples
     
    108111 * \param isLast     Flag indicating whether it is the last filtering operation
    109112 */
    110 Void TComInterpolationFilter::filterCopy(const Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Bool isFirst, Bool isLast)
     113Void TComInterpolationFilter::filterCopy(Int bitDepth, const Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Bool isFirst, Bool isLast)
    111114{
    112115  Int row, col;
     
    127130  else if ( isFirst )
    128131  {
    129     Int shift = IF_INTERNAL_PREC - ( g_uiBitDepth + g_uiBitIncrement );
     132    Int shift = IF_INTERNAL_PREC - bitDepth;
    130133   
    131134    for (row = 0; row < height; row++)
     
    143146  else
    144147  {
    145     Int shift = IF_INTERNAL_PREC - ( g_uiBitDepth + g_uiBitIncrement );
    146     Short offset = IF_INTERNAL_OFFS + (1 << (shift - 1));
    147     Short maxVal = g_uiIBDI_MAX;
     148    Int shift = IF_INTERNAL_PREC - bitDepth;
     149    Short offset = IF_INTERNAL_OFFS;
     150    offset += shift?(1 << (shift - 1)):0;
     151    Short maxVal = (1 << bitDepth) - 1;
    148152    Short minVal = 0;
    149153    for (row = 0; row < height; row++)
     
    171175 * \tparam isFirst    Flag indicating whether it is the first filtering operation
    172176 * \tparam isLast     Flag indicating whether it is the last filtering operation
     177 * \param  bitDepth   Bit depth of samples
    173178 * \param  src        Pointer to source samples
    174179 * \param  srcStride  Stride of source samples
     
    179184 * \param  coeff      Pointer to filter taps
    180185 */
    181 template<int N, bool isVertical, bool isFirst, bool isLast>
    182 Void TComInterpolationFilter::filter(Short const *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Short const *coeff)
     186template<Int N, Bool isVertical, Bool isFirst, Bool isLast>
     187Void TComInterpolationFilter::filter(Int bitDepth, Short const *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Short const *coeff)
    183188{
    184189  Int row, col;
     
    208213  Int offset;
    209214  Short maxVal;
    210   Int headRoom = IF_INTERNAL_PREC - (g_uiBitDepth + g_uiBitIncrement);
     215  Int headRoom = IF_INTERNAL_PREC - bitDepth;
    211216  Int shift = IF_FILTER_PREC;
    212217  if ( isLast )
     
    215220    offset = 1 << (shift - 1);
    216221    offset += (isFirst) ? 0 : IF_INTERNAL_OFFS << IF_FILTER_PREC;
    217     maxVal = g_uiIBDI_MAX;
     222    maxVal = (1 << bitDepth) - 1;
    218223  }
    219224  else
     
    266271 *
    267272 * \tparam N          Number of taps
     273 * \param  bitDepth   Bit depth of samples
    268274 * \param  src        Pointer to source samples
    269275 * \param  srcStride  Stride of source samples
     
    275281 * \param  coeff      Pointer to filter taps
    276282 */
    277 template<int N>
    278 Void TComInterpolationFilter::filterHor(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Bool isLast, Short const *coeff)
     283template<Int N>
     284Void TComInterpolationFilter::filterHor(Int bitDepth, Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Bool isLast, Short const *coeff)
    279285{
    280286  if ( isLast )
    281287  {
    282     filter<N, false, true, true>(src, srcStride, dst, dstStride, width, height, coeff);
    283   }
    284   else
    285   {
    286     filter<N, false, true, false>(src, srcStride, dst, dstStride, width, height, coeff);
     288    filter<N, false, true, true>(bitDepth, src, srcStride, dst, dstStride, width, height, coeff);
     289  }
     290  else
     291  {
     292    filter<N, false, true, false>(bitDepth, src, srcStride, dst, dstStride, width, height, coeff);
    287293  }
    288294}
     
    292298 *
    293299 * \tparam N          Number of taps
     300 * \param  bitDpeth   Sample bit depth
    294301 * \param  src        Pointer to source samples
    295302 * \param  srcStride  Stride of source samples
     
    302309 * \param  coeff      Pointer to filter taps
    303310 */
    304 template<int N>
    305 Void TComInterpolationFilter::filterVer(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Bool isFirst, Bool isLast, Short const *coeff)
     311template<Int N>
     312Void TComInterpolationFilter::filterVer(Int bitDepth, Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Bool isFirst, Bool isLast, Short const *coeff)
    306313{
    307314  if ( isFirst && isLast )
    308315  {
    309     filter<N, true, true, true>(src, srcStride, dst, dstStride, width, height, coeff);
     316    filter<N, true, true, true>(bitDepth, src, srcStride, dst, dstStride, width, height, coeff);
    310317  }
    311318  else if ( isFirst && !isLast )
    312319  {
    313     filter<N, true, true, false>(src, srcStride, dst, dstStride, width, height, coeff);
     320    filter<N, true, true, false>(bitDepth, src, srcStride, dst, dstStride, width, height, coeff);
    314321  }
    315322  else if ( !isFirst && isLast )
    316323  {
    317     filter<N, true, false, true>(src, srcStride, dst, dstStride, width, height, coeff);
    318   }
    319   else
    320   {
    321     filter<N, true, false, false>(src, srcStride, dst, dstStride, width, height, coeff);   
     324    filter<N, true, false, true>(bitDepth, src, srcStride, dst, dstStride, width, height, coeff);
     325  }
     326  else
     327  {
     328    filter<N, true, false, false>(bitDepth, src, srcStride, dst, dstStride, width, height, coeff);
    322329  }     
    323330}
     
    340347 */
    341348Void TComInterpolationFilter::filterHorLuma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast
    342 #if QC_ARP_D0177
    343     ,
    344     Bool filterType
    345 #endif
    346     )
     349#if H_3D_ARP
     350    , Bool filterType
     351#endif
     352  )
    347353{
    348354  assert(frac >= 0 && frac < 4);
     
    350356  if ( frac == 0 )
    351357  {
    352     filterCopy( src, srcStride, dst, dstStride, width, height, true, isLast );
    353   }
    354   else
    355   {
    356 #if QC_ARP_D0177
     358    filterCopy(g_bitDepthY, src, srcStride, dst, dstStride, width, height, true, isLast );
     359  }
     360  else
     361  {
     362#if H_3D_ARP
    357363    if(filterType)
    358       filterHor<NTAPS_LUMA_ARP>(src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilterARP[frac]);
     364    {
     365      filterHor<NTAPS_LUMA_ARP>(g_bitDepthY, src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilterARP[frac]);
     366    }
    359367    else
    360 #endif
    361       filterHor<NTAPS_LUMA>(src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilter[frac]);
     368    {
     369#endif
     370    filterHor<NTAPS_LUMA>(g_bitDepthY, src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilter[frac]);
     371#if H_3D_ARP
     372    }
     373#endif
    362374  }
    363375}
     
    376388 * \param  isLast     Flag indicating whether it is the last filtering operation
    377389 */
    378 Void TComInterpolationFilter::filterVerLuma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast
    379 #if QC_ARP_D0177
    380     ,
    381     Bool filterType
    382 #endif
    383     )
     390Void TComInterpolationFilter::filterVerLuma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast
     391#if H_3D_ARP
     392    , Bool filterType
     393#endif
     394  )
    384395{
    385396  assert(frac >= 0 && frac < 4);
     
    387398  if ( frac == 0 )
    388399  {
    389     filterCopy( src, srcStride, dst, dstStride, width, height, isFirst, isLast );
    390   }
    391   else
    392   {
    393 #if QC_ARP_D0177
     400    filterCopy(g_bitDepthY, src, srcStride, dst, dstStride, width, height, isFirst, isLast );
     401  }
     402  else
     403  {
     404#if H_3D_ARP
    394405    if(filterType)
    395       filterVer<NTAPS_LUMA_ARP>(src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilterARP[frac]);   
     406    {
     407      filterVer<NTAPS_LUMA_ARP>(g_bitDepthY, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilterARP[frac]);   
     408    }
    396409    else
    397 #endif
    398       filterVer<NTAPS_LUMA>(src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilter[frac]);   
     410    {
     411#endif
     412    filterVer<NTAPS_LUMA>(g_bitDepthY, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilter[frac]);
     413#if H_3D_ARP
     414    }
     415#endif
    399416  }
    400417}
     
    412429 * \param  isLast     Flag indicating whether it is the last filtering operation
    413430 */
    414 Void TComInterpolationFilter::filterHorChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast
    415 #if QC_ARP_D0177
    416     ,
    417     Bool filterType
    418 #endif
    419     )
     431Void TComInterpolationFilter::filterHorChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast
     432#if H_3D_ARP
     433    , Bool filterType
     434#endif
     435  )
    420436{
    421437  assert(frac >= 0 && frac < 8);
     
    423439  if ( frac == 0 )
    424440  {
    425     filterCopy( src, srcStride, dst, dstStride, width, height, true, isLast );
    426   }
    427   else
    428   {
    429 #if QC_ARP_D0177
     441    filterCopy(g_bitDepthC, src, srcStride, dst, dstStride, width, height, true, isLast );
     442  }
     443  else
     444  {
     445#if H_3D_ARP
    430446    if(filterType)
    431       filterHor<NTAPS_CHROMA_ARP>(src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilterARP[frac]);   
     447    {
     448      filterHor<NTAPS_CHROMA_ARP>(g_bitDepthC, src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilterARP[frac]);
     449    }
    432450    else
    433 #endif
    434     filterHor<NTAPS_CHROMA>(src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilter[frac]);
     451    {
     452#endif
     453    filterHor<NTAPS_CHROMA>(g_bitDepthC, src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilter[frac]);
     454#if H_3D_ARP
     455    }
     456#endif
    435457  }
    436458}
     
    449471 * \param  isLast     Flag indicating whether it is the last filtering operation
    450472 */
    451 Void TComInterpolationFilter::filterVerChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast
    452 #if QC_ARP_D0177
    453     ,
    454     Bool filterType
    455 #endif
    456     )
     473Void TComInterpolationFilter::filterVerChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast
     474#if H_3D_ARP
     475    , Bool filterType
     476#endif
     477  )
    457478{
    458479  assert(frac >= 0 && frac < 8);
     
    460481  if ( frac == 0 )
    461482  {
    462     filterCopy( src, srcStride, dst, dstStride, width, height, isFirst, isLast );
    463   }
    464   else
    465   {
    466 #if QC_ARP_D0177
     483    filterCopy(g_bitDepthC, src, srcStride, dst, dstStride, width, height, isFirst, isLast );
     484  }
     485  else
     486  {
     487#if H_3D_ARP
    467488    if(filterType)
    468       filterVer<NTAPS_CHROMA_ARP>(src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilterARP[frac]); 
     489    {
     490      filterVer<NTAPS_CHROMA_ARP>(g_bitDepthC, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilterARP[frac]);
     491    }
    469492    else
    470 #endif
    471       filterVer<NTAPS_CHROMA>(src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilter[frac]);   
     493    {
     494#endif
     495    filterVer<NTAPS_CHROMA>(g_bitDepthC, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilter[frac]);
     496#if H_3D_ARP
     497    }
     498#endif
    472499  }
    473500}
Note: See TracChangeset for help on using the changeset viewer.