Home | History | Annotate | Download | only in common
      1 /*
      2  *  Copyright (c) 2010 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 
     12 #ifndef loopfilter_h
     13 #define loopfilter_h
     14 
     15 #include "vpx_ports/mem.h"
     16 
     17 #define MAX_LOOP_FILTER 63
     18 
     19 typedef enum
     20 {
     21     NORMAL_LOOPFILTER = 0,
     22     SIMPLE_LOOPFILTER = 1
     23 } LOOPFILTERTYPE;
     24 
     25 /* FRK
     26  * Need to align this structure so when it is declared and
     27  * passed it can be loaded into vector registers.
     28  */
     29 typedef struct
     30 {
     31     DECLARE_ALIGNED(16, signed char, lim[16]);
     32     DECLARE_ALIGNED(16, signed char, flim[16]);
     33     DECLARE_ALIGNED(16, signed char, thr[16]);
     34     DECLARE_ALIGNED(16, signed char, mbflim[16]);
     35     DECLARE_ALIGNED(16, signed char, mbthr[16]);
     36     DECLARE_ALIGNED(16, signed char, uvlim[16]);
     37     DECLARE_ALIGNED(16, signed char, uvflim[16]);
     38     DECLARE_ALIGNED(16, signed char, uvthr[16]);
     39     DECLARE_ALIGNED(16, signed char, uvmbflim[16]);
     40     DECLARE_ALIGNED(16, signed char, uvmbthr[16]);
     41 } loop_filter_info;
     42 
     43 
     44 #define prototype_loopfilter(sym) \
     45     void sym(unsigned char *src, int pitch, const signed char *flimit,\
     46              const signed char *limit, const signed char *thresh, int count)
     47 
     48 #define prototype_loopfilter_block(sym) \
     49     void sym(unsigned char *y, unsigned char *u, unsigned char *v,\
     50              int ystride, int uv_stride, loop_filter_info *lfi, int simpler)
     51 
     52 #if ARCH_X86 || ARCH_X86_64
     53 #include "x86/loopfilter_x86.h"
     54 #endif
     55 
     56 #if ARCH_ARM
     57 #include "arm/loopfilter_arm.h"
     58 #endif
     59 
     60 #ifndef vp8_lf_normal_mb_v
     61 #define vp8_lf_normal_mb_v vp8_loop_filter_mbv_c
     62 #endif
     63 extern prototype_loopfilter_block(vp8_lf_normal_mb_v);
     64 
     65 #ifndef vp8_lf_normal_b_v
     66 #define vp8_lf_normal_b_v vp8_loop_filter_bv_c
     67 #endif
     68 extern prototype_loopfilter_block(vp8_lf_normal_b_v);
     69 
     70 #ifndef vp8_lf_normal_mb_h
     71 #define vp8_lf_normal_mb_h vp8_loop_filter_mbh_c
     72 #endif
     73 extern prototype_loopfilter_block(vp8_lf_normal_mb_h);
     74 
     75 #ifndef vp8_lf_normal_b_h
     76 #define vp8_lf_normal_b_h vp8_loop_filter_bh_c
     77 #endif
     78 extern prototype_loopfilter_block(vp8_lf_normal_b_h);
     79 
     80 
     81 #ifndef vp8_lf_simple_mb_v
     82 #define vp8_lf_simple_mb_v vp8_loop_filter_mbvs_c
     83 #endif
     84 extern prototype_loopfilter_block(vp8_lf_simple_mb_v);
     85 
     86 #ifndef vp8_lf_simple_b_v
     87 #define vp8_lf_simple_b_v vp8_loop_filter_bvs_c
     88 #endif
     89 extern prototype_loopfilter_block(vp8_lf_simple_b_v);
     90 
     91 #ifndef vp8_lf_simple_mb_h
     92 #define vp8_lf_simple_mb_h vp8_loop_filter_mbhs_c
     93 #endif
     94 extern prototype_loopfilter_block(vp8_lf_simple_mb_h);
     95 
     96 #ifndef vp8_lf_simple_b_h
     97 #define vp8_lf_simple_b_h vp8_loop_filter_bhs_c
     98 #endif
     99 extern prototype_loopfilter_block(vp8_lf_simple_b_h);
    100 
    101 typedef prototype_loopfilter_block((*vp8_lf_block_fn_t));
    102 typedef struct
    103 {
    104     vp8_lf_block_fn_t  normal_mb_v;
    105     vp8_lf_block_fn_t  normal_b_v;
    106     vp8_lf_block_fn_t  normal_mb_h;
    107     vp8_lf_block_fn_t  normal_b_h;
    108     vp8_lf_block_fn_t  simple_mb_v;
    109     vp8_lf_block_fn_t  simple_b_v;
    110     vp8_lf_block_fn_t  simple_mb_h;
    111     vp8_lf_block_fn_t  simple_b_h;
    112 } vp8_loopfilter_rtcd_vtable_t;
    113 
    114 #if CONFIG_RUNTIME_CPU_DETECT
    115 #define LF_INVOKE(ctx,fn) (ctx)->fn
    116 #else
    117 #define LF_INVOKE(ctx,fn) vp8_lf_##fn
    118 #endif
    119 
    120 typedef void loop_filter_uvfunction
    121 (
    122     unsigned char *u,   /* source pointer */
    123     int p,              /* pitch */
    124     const signed char *flimit,
    125     const signed char *limit,
    126     const signed char *thresh,
    127     unsigned char *v
    128 );
    129 
    130 #endif
    131