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 } loop_filter_info;
     36 
     37 
     38 #define prototype_loopfilter(sym) \
     39     void sym(unsigned char *src, int pitch, const signed char *flimit,\
     40              const signed char *limit, const signed char *thresh, int count)
     41 
     42 #define prototype_loopfilter_block(sym) \
     43     void sym(unsigned char *y, unsigned char *u, unsigned char *v,\
     44              int ystride, int uv_stride, loop_filter_info *lfi, int simpler)
     45 
     46 #if ARCH_X86 || ARCH_X86_64
     47 #include "x86/loopfilter_x86.h"
     48 #endif
     49 
     50 #if ARCH_ARM
     51 #include "arm/loopfilter_arm.h"
     52 #endif
     53 
     54 #ifndef vp8_lf_normal_mb_v
     55 #define vp8_lf_normal_mb_v vp8_loop_filter_mbv_c
     56 #endif
     57 extern prototype_loopfilter_block(vp8_lf_normal_mb_v);
     58 
     59 #ifndef vp8_lf_normal_b_v
     60 #define vp8_lf_normal_b_v vp8_loop_filter_bv_c
     61 #endif
     62 extern prototype_loopfilter_block(vp8_lf_normal_b_v);
     63 
     64 #ifndef vp8_lf_normal_mb_h
     65 #define vp8_lf_normal_mb_h vp8_loop_filter_mbh_c
     66 #endif
     67 extern prototype_loopfilter_block(vp8_lf_normal_mb_h);
     68 
     69 #ifndef vp8_lf_normal_b_h
     70 #define vp8_lf_normal_b_h vp8_loop_filter_bh_c
     71 #endif
     72 extern prototype_loopfilter_block(vp8_lf_normal_b_h);
     73 
     74 
     75 #ifndef vp8_lf_simple_mb_v
     76 #define vp8_lf_simple_mb_v vp8_loop_filter_mbvs_c
     77 #endif
     78 extern prototype_loopfilter_block(vp8_lf_simple_mb_v);
     79 
     80 #ifndef vp8_lf_simple_b_v
     81 #define vp8_lf_simple_b_v vp8_loop_filter_bvs_c
     82 #endif
     83 extern prototype_loopfilter_block(vp8_lf_simple_b_v);
     84 
     85 #ifndef vp8_lf_simple_mb_h
     86 #define vp8_lf_simple_mb_h vp8_loop_filter_mbhs_c
     87 #endif
     88 extern prototype_loopfilter_block(vp8_lf_simple_mb_h);
     89 
     90 #ifndef vp8_lf_simple_b_h
     91 #define vp8_lf_simple_b_h vp8_loop_filter_bhs_c
     92 #endif
     93 extern prototype_loopfilter_block(vp8_lf_simple_b_h);
     94 
     95 typedef prototype_loopfilter_block((*vp8_lf_block_fn_t));
     96 typedef struct
     97 {
     98     vp8_lf_block_fn_t  normal_mb_v;
     99     vp8_lf_block_fn_t  normal_b_v;
    100     vp8_lf_block_fn_t  normal_mb_h;
    101     vp8_lf_block_fn_t  normal_b_h;
    102     vp8_lf_block_fn_t  simple_mb_v;
    103     vp8_lf_block_fn_t  simple_b_v;
    104     vp8_lf_block_fn_t  simple_mb_h;
    105     vp8_lf_block_fn_t  simple_b_h;
    106 } vp8_loopfilter_rtcd_vtable_t;
    107 
    108 #if CONFIG_RUNTIME_CPU_DETECT
    109 #define LF_INVOKE(ctx,fn) (ctx)->fn
    110 #else
    111 #define LF_INVOKE(ctx,fn) vp8_lf_##fn
    112 #endif
    113 
    114 typedef void loop_filter_uvfunction
    115 (
    116     unsigned char *u,   /* source pointer */
    117     int p,              /* pitch */
    118     const signed char *flimit,
    119     const signed char *limit,
    120     const signed char *thresh,
    121     unsigned char *v
    122 );
    123 
    124 #endif
    125