Home | History | Annotate | Download | only in common
      1 /*
      2  *  Copyright (c) 2011 The WebM project authors. All Rights Reserved.
      3  *
      4  *  Use of this source code is governed by a BSD-style license
      5  *  that can be found in the LICENSE file in the root of the source
      6  *  tree. An additional intellectual property rights grant can be found
      7  *  in the file PATENTS.  All contributing project authors may
      8  *  be found in the AUTHORS file in the root of the source tree.
      9  */
     10 
     11 #ifndef VP9_COMMON_VP9_FILTER_H_
     12 #define VP9_COMMON_VP9_FILTER_H_
     13 
     14 #include "./vpx_config.h"
     15 #include "vpx/vpx_integer.h"
     16 #include "vpx_ports/mem.h"
     17 
     18 
     19 #ifdef __cplusplus
     20 extern "C" {
     21 #endif
     22 
     23 #define FILTER_BITS 7
     24 
     25 #define SUBPEL_BITS 4
     26 #define SUBPEL_MASK ((1 << SUBPEL_BITS) - 1)
     27 #define SUBPEL_SHIFTS (1 << SUBPEL_BITS)
     28 #define SUBPEL_TAPS 8
     29 
     30 typedef enum {
     31   EIGHTTAP = 0,
     32   EIGHTTAP_SMOOTH = 1,
     33   EIGHTTAP_SHARP = 2,
     34   BILINEAR = 3,
     35   SWITCHABLE = 4  /* should be the last one */
     36 } INTERP_FILTER;
     37 
     38 typedef int16_t InterpKernel[SUBPEL_TAPS];
     39 
     40 const InterpKernel *vp9_get_interp_kernel(INTERP_FILTER filter);
     41 
     42 DECLARE_ALIGNED(256, extern const InterpKernel,
     43                 vp9_bilinear_filters[SUBPEL_SHIFTS]);
     44 DECLARE_ALIGNED(256, extern const InterpKernel,
     45                 vp9_sub_pel_filters_8[SUBPEL_SHIFTS]);
     46 DECLARE_ALIGNED(256, extern const InterpKernel,
     47                 vp9_sub_pel_filters_8s[SUBPEL_SHIFTS]);
     48 DECLARE_ALIGNED(256, extern const InterpKernel,
     49                 vp9_sub_pel_filters_8lp[SUBPEL_SHIFTS]);
     50 
     51 // The VP9_BILINEAR_FILTERS_2TAP macro returns a pointer to the bilinear
     52 // filter kernel as a 2 tap filter.
     53 #define BILINEAR_FILTERS_2TAP(x) \
     54   (vp9_bilinear_filters[(x)] + SUBPEL_TAPS/2 - 1)
     55 
     56 #ifdef __cplusplus
     57 }  // extern "C"
     58 #endif
     59 
     60 #endif  // VP9_COMMON_VP9_FILTER_H_
     61