HEVC Test Model (HM)  HM-16.18
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TComInterpolationFilter.cpp
Go to the documentation of this file.
1 /* The copyright in this software is being made available under the BSD
2  * License, included below. This software may be subject to other third party
3  * and contributor rights, including patent rights, and no such rights are
4  * granted under this license.
5  *
6  * Copyright (c) 2010-2017, ITU/ISO/IEC
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions are met:
11  *
12  * * Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above copyright notice,
15  * this list of conditions and the following disclaimer in the documentation
16  * and/or other materials provided with the distribution.
17  * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
18  * be used to endorse or promote products derived from this software without
19  * specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
25  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31  * THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
39 // ====================================================================================================================
40 // Includes
41 // ====================================================================================================================
42 
43 #include "TComRom.h"
45 #include <assert.h>
46 
47 #include "TComChromaFormat.h"
48 
49 #if VECTOR_CODING__INTERPOLATION_FILTER && (RExt__HIGH_BIT_DEPTH_SUPPORT==0)
50 #include <emmintrin.h>
51 #endif
52 
55 
56 // ====================================================================================================================
57 // Tables
58 // ====================================================================================================================
59 
61 {
62  { 0, 0, 0, 64, 0, 0, 0, 0 },
63  { -1, 4, -10, 58, 17, -5, 1, 0 },
64  { -1, 4, -11, 40, 40, -11, 4, -1 },
65  { 0, 1, -5, 17, 58, -10, 4, -1 }
66 };
67 
69 {
70  { 0, 64, 0, 0 },
71  { -2, 58, 10, -2 },
72  { -4, 54, 16, -2 },
73  { -6, 46, 28, -4 },
74  { -4, 36, 36, -4 },
75  { -4, 28, 46, -6 },
76  { -2, 16, 54, -4 },
77  { -2, 10, 58, -2 }
78 };
79 
80 #if VECTOR_CODING__INTERPOLATION_FILTER && (RExt__HIGH_BIT_DEPTH_SUPPORT==0)
81 inline __m128i simdInterpolateLuma4( Short const *src , Int srcStride , __m128i *mmCoeff , const __m128i & mmOffset , Int shift )
82 {
83  __m128i sumHi = _mm_setzero_si128();
84  __m128i sumLo = _mm_setzero_si128();
85  for( Int n = 0 ; n < 8 ; n++ )
86  {
87  __m128i mmPix = _mm_loadl_epi64( ( __m128i* )src );
88  __m128i hi = _mm_mulhi_epi16( mmPix , mmCoeff[n] );
89  __m128i lo = _mm_mullo_epi16( mmPix , mmCoeff[n] );
90  sumHi = _mm_add_epi32( sumHi , _mm_unpackhi_epi16( lo , hi ) );
91  sumLo = _mm_add_epi32( sumLo , _mm_unpacklo_epi16( lo , hi ) );
92  src += srcStride;
93  }
94  sumHi = _mm_srai_epi32( _mm_add_epi32( sumHi , mmOffset ) , shift );
95  sumLo = _mm_srai_epi32( _mm_add_epi32( sumLo , mmOffset ) , shift );
96  return( _mm_packs_epi32( sumLo , sumHi ) );
97 }
98 
99 inline __m128i simdInterpolateChroma4( Short const *src , Int srcStride , __m128i *mmCoeff , const __m128i & mmOffset , Int shift )
100 {
101  __m128i sumHi = _mm_setzero_si128();
102  __m128i sumLo = _mm_setzero_si128();
103  for( Int n = 0 ; n < 4 ; n++ )
104  {
105  __m128i mmPix = _mm_loadl_epi64( ( __m128i* )src );
106  __m128i hi = _mm_mulhi_epi16( mmPix , mmCoeff[n] );
107  __m128i lo = _mm_mullo_epi16( mmPix , mmCoeff[n] );
108  sumHi = _mm_add_epi32( sumHi , _mm_unpackhi_epi16( lo , hi ) );
109  sumLo = _mm_add_epi32( sumLo , _mm_unpacklo_epi16( lo , hi ) );
110  src += srcStride;
111  }
112  sumHi = _mm_srai_epi32( _mm_add_epi32( sumHi , mmOffset ) , shift );
113  sumLo = _mm_srai_epi32( _mm_add_epi32( sumLo , mmOffset ) , shift );
114  return( _mm_packs_epi32( sumLo , sumHi ) );
115 }
116 
117 inline __m128i simdInterpolateLuma8( Short const *src , Int srcStride , __m128i *mmCoeff , const __m128i & mmOffset , Int shift )
118 {
119  __m128i sumHi = _mm_setzero_si128();
120  __m128i sumLo = _mm_setzero_si128();
121  for( Int n = 0 ; n < 8 ; n++ )
122  {
123  __m128i mmPix = _mm_loadu_si128( ( __m128i* )src );
124  __m128i hi = _mm_mulhi_epi16( mmPix , mmCoeff[n] );
125  __m128i lo = _mm_mullo_epi16( mmPix , mmCoeff[n] );
126  sumHi = _mm_add_epi32( sumHi , _mm_unpackhi_epi16( lo , hi ) );
127  sumLo = _mm_add_epi32( sumLo , _mm_unpacklo_epi16( lo , hi ) );
128  src += srcStride;
129  }
130  sumHi = _mm_srai_epi32( _mm_add_epi32( sumHi , mmOffset ) , shift );
131  sumLo = _mm_srai_epi32( _mm_add_epi32( sumLo , mmOffset ) , shift );
132  return( _mm_packs_epi32( sumLo , sumHi ) );
133 }
134 
135 inline __m128i simdInterpolateLuma2P8( Short const *src , Int srcStride , __m128i *mmCoeff , const __m128i & mmOffset , Int shift )
136 {
137  __m128i sumHi = _mm_setzero_si128();
138  __m128i sumLo = _mm_setzero_si128();
139  for( Int n = 0 ; n < 2 ; n++ )
140  {
141  __m128i mmPix = _mm_loadu_si128( ( __m128i* )src );
142  __m128i hi = _mm_mulhi_epi16( mmPix , mmCoeff[n] );
143  __m128i lo = _mm_mullo_epi16( mmPix , mmCoeff[n] );
144  sumHi = _mm_add_epi32( sumHi , _mm_unpackhi_epi16( lo , hi ) );
145  sumLo = _mm_add_epi32( sumLo , _mm_unpacklo_epi16( lo , hi ) );
146  src += srcStride;
147  }
148  sumHi = _mm_srai_epi32( _mm_add_epi32( sumHi , mmOffset ) , shift );
149  sumLo = _mm_srai_epi32( _mm_add_epi32( sumLo , mmOffset ) , shift );
150  return( _mm_packs_epi32( sumLo , sumHi ) );
151 }
152 
153 inline __m128i simdInterpolateLuma2P4( Short const *src , Int srcStride , __m128i *mmCoeff , const __m128i & mmOffset , Int shift )
154 {
155  __m128i sumHi = _mm_setzero_si128();
156  __m128i sumLo = _mm_setzero_si128();
157  for( Int n = 0 ; n < 2 ; n++ )
158  {
159  __m128i mmPix = _mm_loadl_epi64( ( __m128i* )src );
160  __m128i hi = _mm_mulhi_epi16( mmPix , mmCoeff[n] );
161  __m128i lo = _mm_mullo_epi16( mmPix , mmCoeff[n] );
162  sumHi = _mm_add_epi32( sumHi , _mm_unpackhi_epi16( lo , hi ) );
163  sumLo = _mm_add_epi32( sumLo , _mm_unpacklo_epi16( lo , hi ) );
164  src += srcStride;
165  }
166  sumHi = _mm_srai_epi32( _mm_add_epi32( sumHi , mmOffset ) , shift );
167  sumLo = _mm_srai_epi32( _mm_add_epi32( sumLo , mmOffset ) , shift );
168  return( _mm_packs_epi32( sumLo , sumHi ) );
169 }
170 
171 inline __m128i simdClip3( __m128i mmMin , __m128i mmMax , __m128i mmPix )
172 {
173  __m128i mmMask = _mm_cmpgt_epi16( mmPix , mmMin );
174  mmPix = _mm_or_si128( _mm_and_si128( mmMask , mmPix ) , _mm_andnot_si128( mmMask , mmMin ) );
175  mmMask = _mm_cmplt_epi16( mmPix , mmMax );
176  mmPix = _mm_or_si128( _mm_and_si128( mmMask , mmPix ) , _mm_andnot_si128( mmMask , mmMax ) );
177  return( mmPix );
178 }
179 #endif
180 
181 // ====================================================================================================================
182 // Private member functions
183 // ====================================================================================================================
184 
198 Void TComInterpolationFilter::filterCopy(Int bitDepth, const Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Bool isFirst, Bool isLast)
199 {
200  Int row, col;
201 
202  if ( isFirst == isLast )
203  {
204  for (row = 0; row < height; row++)
205  {
206  for (col = 0; col < width; col++)
207  {
208  dst[col] = src[col];
209  }
210 
211  src += srcStride;
212  dst += dstStride;
213  }
214  }
215  else if ( isFirst )
216  {
217  const Int shift = std::max<Int>(2, (IF_INTERNAL_PREC - bitDepth));
218 
219  for (row = 0; row < height; row++)
220  {
221  for (col = 0; col < width; col++)
222  {
223  Pel val = leftShift_round(src[col], shift);
224  dst[col] = val - (Pel)IF_INTERNAL_OFFS;
225  }
226 
227  src += srcStride;
228  dst += dstStride;
229  }
230  }
231  else
232  {
233  const Int shift = std::max<Int>(2, (IF_INTERNAL_PREC - bitDepth));
234 
235  Pel maxVal = (1 << bitDepth) - 1;
236  Pel minVal = 0;
237  for (row = 0; row < height; row++)
238  {
239  for (col = 0; col < width; col++)
240  {
241  Pel val = src[ col ];
242  val = rightShift_round((val + IF_INTERNAL_OFFS), shift);
243  if (val < minVal)
244  {
245  val = minVal;
246  }
247  if (val > maxVal)
248  {
249  val = maxVal;
250  }
251  dst[col] = val;
252  }
253 
254  src += srcStride;
255  dst += dstStride;
256  }
257  }
258 }
259 
276 template<Int N, Bool isVertical, Bool isFirst, Bool isLast>
277 Void TComInterpolationFilter::filter(Int bitDepth, Pel const *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, TFilterCoeff const *coeff)
278 {
279  Int row, col;
280 
281  Pel c[8];
282  c[0] = coeff[0];
283  c[1] = coeff[1];
284  if ( N >= 4 )
285  {
286  c[2] = coeff[2];
287  c[3] = coeff[3];
288  }
289  if ( N >= 6 )
290  {
291  c[4] = coeff[4];
292  c[5] = coeff[5];
293  }
294  if ( N == 8 )
295  {
296  c[6] = coeff[6];
297  c[7] = coeff[7];
298  }
299 
300  Int cStride = ( isVertical ) ? srcStride : 1;
301  src -= ( N/2 - 1 ) * cStride;
302 
303  Int offset;
304  Pel maxVal;
305  Int headRoom = std::max<Int>(2, (IF_INTERNAL_PREC - bitDepth));
306  Int shift = IF_FILTER_PREC;
307  // with the current settings (IF_INTERNAL_PREC = 14 and IF_FILTER_PREC = 6), though headroom can be
308  // negative for bit depths greater than 14, shift will remain non-negative for bit depths of 8->20
309  assert(shift >= 0);
310 
311  if ( isLast )
312  {
313  shift += (isFirst) ? 0 : headRoom;
314  offset = 1 << (shift - 1);
315  offset += (isFirst) ? 0 : IF_INTERNAL_OFFS << IF_FILTER_PREC;
316  maxVal = (1 << bitDepth) - 1;
317  }
318  else
319  {
320  shift -= (isFirst) ? headRoom : 0;
321  offset = (isFirst) ? -IF_INTERNAL_OFFS << shift : 0;
322  maxVal = 0;
323  }
324 
325 #if VECTOR_CODING__INTERPOLATION_FILTER && (RExt__HIGH_BIT_DEPTH_SUPPORT==0)
326  if( bitDepth <= 10 )
327  {
328  if( N == 8 && !( width & 0x07 ) )
329  {
330  Short minVal = 0;
331  __m128i mmOffset = _mm_set1_epi32( offset );
332  __m128i mmCoeff[8];
333  __m128i mmMin = _mm_set1_epi16( minVal );
334  __m128i mmMax = _mm_set1_epi16( maxVal );
335  for( Int n = 0 ; n < 8 ; n++ )
336  mmCoeff[n] = _mm_set1_epi16( c[n] );
337  for( row = 0 ; row < height ; row++ )
338  {
339  for( col = 0 ; col < width ; col += 8 )
340  {
341  __m128i mmFiltered = simdInterpolateLuma8( src + col , cStride , mmCoeff , mmOffset , shift );
342  if( isLast )
343  {
344  mmFiltered = simdClip3( mmMin , mmMax , mmFiltered );
345  }
346  _mm_storeu_si128( ( __m128i * )( dst + col ) , mmFiltered );
347  }
348  src += srcStride;
349  dst += dstStride;
350  }
351  return;
352  }
353  else if( N == 8 && !( width & 0x03 ) )
354  {
355  Short minVal = 0;
356  __m128i mmOffset = _mm_set1_epi32( offset );
357  __m128i mmCoeff[8];
358  __m128i mmMin = _mm_set1_epi16( minVal );
359  __m128i mmMax = _mm_set1_epi16( maxVal );
360  for( Int n = 0 ; n < 8 ; n++ )
361  mmCoeff[n] = _mm_set1_epi16( c[n] );
362  for( row = 0 ; row < height ; row++ )
363  {
364  for( col = 0 ; col < width ; col += 4 )
365  {
366  __m128i mmFiltered = simdInterpolateLuma4( src + col , cStride , mmCoeff , mmOffset , shift );
367  if( isLast )
368  {
369  mmFiltered = simdClip3( mmMin , mmMax , mmFiltered );
370  }
371  _mm_storel_epi64( ( __m128i * )( dst + col ) , mmFiltered );
372  }
373  src += srcStride;
374  dst += dstStride;
375  }
376  return;
377  }
378  else if( N == 4 && !( width & 0x03 ) )
379  {
380  Short minVal = 0;
381  __m128i mmOffset = _mm_set1_epi32( offset );
382  __m128i mmCoeff[8];
383  __m128i mmMin = _mm_set1_epi16( minVal );
384  __m128i mmMax = _mm_set1_epi16( maxVal );
385  for( Int n = 0 ; n < 4 ; n++ )
386  mmCoeff[n] = _mm_set1_epi16( c[n] );
387  for( row = 0 ; row < height ; row++ )
388  {
389  for( col = 0 ; col < width ; col += 4 )
390  {
391  __m128i mmFiltered = simdInterpolateChroma4( src + col , cStride , mmCoeff , mmOffset , shift );
392  if( isLast )
393  {
394  mmFiltered = simdClip3( mmMin , mmMax , mmFiltered );
395  }
396  _mm_storel_epi64( ( __m128i * )( dst + col ) , mmFiltered );
397  }
398  src += srcStride;
399  dst += dstStride;
400  }
401  return;
402  }
403  else if( N == 2 && !( width & 0x07 ) )
404  {
405  Short minVal = 0;
406  __m128i mmOffset = _mm_set1_epi32( offset );
407  __m128i mmCoeff[2];
408  __m128i mmMin = _mm_set1_epi16( minVal );
409  __m128i mmMax = _mm_set1_epi16( maxVal );
410  for( Int n = 0 ; n < 2 ; n++ )
411  mmCoeff[n] = _mm_set1_epi16( c[n] );
412  for( row = 0 ; row < height ; row++ )
413  {
414  for( col = 0 ; col < width ; col += 8 )
415  {
416  __m128i mmFiltered = simdInterpolateLuma2P8( src + col , cStride , mmCoeff , mmOffset , shift );
417  if( isLast )
418  {
419  mmFiltered = simdClip3( mmMin , mmMax , mmFiltered );
420  }
421  _mm_storeu_si128( ( __m128i * )( dst + col ) , mmFiltered );
422  }
423  src += srcStride;
424  dst += dstStride;
425  }
426  return;
427  }
428  else if( N == 2 && !( width & 0x03 ) )
429  {
430  Short minVal = 0;
431  __m128i mmOffset = _mm_set1_epi32( offset );
432  __m128i mmCoeff[8];
433  __m128i mmMin = _mm_set1_epi16( minVal );
434  __m128i mmMax = _mm_set1_epi16( maxVal );
435  for( Int n = 0 ; n < 2 ; n++ )
436  mmCoeff[n] = _mm_set1_epi16( c[n] );
437  for( row = 0 ; row < height ; row++ )
438  {
439  for( col = 0 ; col < width ; col += 4 )
440  {
441  __m128i mmFiltered = simdInterpolateLuma2P4( src + col , cStride , mmCoeff , mmOffset , shift );
442  if( isLast )
443  {
444  mmFiltered = simdClip3( mmMin , mmMax , mmFiltered );
445  }
446  _mm_storel_epi64( ( __m128i * )( dst + col ) , mmFiltered );
447  }
448  src += srcStride;
449  dst += dstStride;
450  }
451  return;
452  }
453  }
454 #endif
455 
456  for (row = 0; row < height; row++)
457  {
458  for (col = 0; col < width; col++)
459  {
460  Int sum;
461 
462  sum = src[ col + 0 * cStride] * c[0];
463  sum += src[ col + 1 * cStride] * c[1];
464  if ( N >= 4 )
465  {
466  sum += src[ col + 2 * cStride] * c[2];
467  sum += src[ col + 3 * cStride] * c[3];
468  }
469  if ( N >= 6 )
470  {
471  sum += src[ col + 4 * cStride] * c[4];
472  sum += src[ col + 5 * cStride] * c[5];
473  }
474  if ( N == 8 )
475  {
476  sum += src[ col + 6 * cStride] * c[6];
477  sum += src[ col + 7 * cStride] * c[7];
478  }
479 
480  Pel val = ( sum + offset ) >> shift;
481  if ( isLast )
482  {
483  val = ( val < 0 ) ? 0 : val;
484  val = ( val > maxVal ) ? maxVal : val;
485  }
486  dst[col] = val;
487  }
488 
489  src += srcStride;
490  dst += dstStride;
491  }
492 }
493 
508 template<Int N>
509 Void TComInterpolationFilter::filterHor(Int bitDepth, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Bool isLast, TFilterCoeff const *coeff)
510 {
511  if ( isLast )
512  {
513  filter<N, false, true, true>(bitDepth, src, srcStride, dst, dstStride, width, height, coeff);
514  }
515  else
516  {
517  filter<N, false, true, false>(bitDepth, src, srcStride, dst, dstStride, width, height, coeff);
518  }
519 }
520 
536 template<Int N>
537 Void TComInterpolationFilter::filterVer(Int bitDepth, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Bool isFirst, Bool isLast, TFilterCoeff const *coeff)
538 {
539  if ( isFirst && isLast )
540  {
541  filter<N, true, true, true>(bitDepth, src, srcStride, dst, dstStride, width, height, coeff);
542  }
543  else if ( isFirst && !isLast )
544  {
545  filter<N, true, true, false>(bitDepth, src, srcStride, dst, dstStride, width, height, coeff);
546  }
547  else if ( !isFirst && isLast )
548  {
549  filter<N, true, false, true>(bitDepth, src, srcStride, dst, dstStride, width, height, coeff);
550  }
551  else
552  {
553  filter<N, true, false, false>(bitDepth, src, srcStride, dst, dstStride, width, height, coeff);
554  }
555 }
556 
557 // ====================================================================================================================
558 // Public member functions
559 // ====================================================================================================================
560 
576 Void TComInterpolationFilter::filterHor(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast, const ChromaFormat fmt, const Int bitDepth )
577 {
578  if ( frac == 0 )
579  {
580  filterCopy(bitDepth, src, srcStride, dst, dstStride, width, height, true, isLast );
581  }
582  else if (isLuma(compID))
583  {
584  assert(frac >= 0 && frac < LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS);
585  filterHor<NTAPS_LUMA>(bitDepth, src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilter[frac]);
586  }
587  else
588  {
589  const UInt csx = getComponentScaleX(compID, fmt);
590  assert(frac >=0 && csx<2 && (frac<<(1-csx)) < CHROMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS);
591  filterHor<NTAPS_CHROMA>(bitDepth, src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilter[frac<<(1-csx)]);
592  }
593 }
594 
595 
612 Void TComInterpolationFilter::filterVer(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast, const ChromaFormat fmt, const Int bitDepth )
613 {
614  if ( frac == 0 )
615  {
616  filterCopy(bitDepth, src, srcStride, dst, dstStride, width, height, isFirst, isLast );
617  }
618  else if (isLuma(compID))
619  {
620  assert(frac >= 0 && frac < LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS);
621  filterVer<NTAPS_LUMA>(bitDepth, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilter[frac]);
622  }
623  else
624  {
625  const UInt csy = getComponentScaleY(compID, fmt);
626  assert(frac >=0 && csy<2 && (frac<<(1-csy)) < CHROMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS);
627  filterVer<NTAPS_CHROMA>(bitDepth, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilter[frac<<(1-csy)]);
628  }
629 }
630 
#define IF_FILTER_PREC
Log2 of sum of filter taps.
static Void filterCopy(Int bitDepth, const Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Bool isFirst, Bool isLast)
Apply unit FIR filter to a block of samples.
Short TFilterCoeff
filter coefficient
Definition: TypeDef.h:252
static const Int LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS
Definition: CommonDef.h:200
void Void
Definition: TypeDef.h:203
static const TFilterCoeff m_lumaFilter[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][8]
Luma filter taps.
ValueType leftShift_round(const ValueType value, const Int shift)
Definition: CommonDef.h:282
global variables &amp; functions (header)
Declaration of TComInterpolationFilter class.
static UInt getComponentScaleY(const ComponentID id, const ChromaFormat fmt)
unsigned int UInt
Definition: TypeDef.h:212
static UInt getComponentScaleX(const ComponentID id, const ChromaFormat fmt)
#define IF_INTERNAL_OFFS
Offset used internally.
Short Pel
pixel type
Definition: TypeDef.h:249
short Short
Definition: TypeDef.h:209
static const Int CHROMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS
Definition: CommonDef.h:201
#define IF_INTERNAL_PREC
Number of bits for internal precision.
bool Bool
Definition: TypeDef.h:204
ValueType rightShift_round(const ValueType value, const Int shift)
Definition: CommonDef.h:283
ChromaFormat
chroma formats (according to semantics of chroma_format_idc)
Definition: TypeDef.h:292
static Void filterVer(Int bitDepth, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Bool isFirst, Bool isLast, TFilterCoeff const *coeff)
Filter a block of samples (vertical)
static Void filter(Int bitDepth, Pel const *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, TFilterCoeff const *coeff)
Apply FIR filter to a block of samples.
int Int
Definition: TypeDef.h:211
ComponentID
Definition: TypeDef.h:308
#define NTAPS_LUMA
Number of taps for luma.
static Bool isLuma(const ComponentID id)
#define NTAPS_CHROMA
Number of taps for chroma.
static Void filterHor(Int bitDepth, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Bool isLast, TFilterCoeff const *coeff)
Filter a block of samples (horizontal)
static const TFilterCoeff m_chromaFilter[CHROMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][4]
Chroma filter taps.