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 #include "vpx_config.h"
     17 #include "vpx_rtcd.h"
     18 
     19 #define MAX_LOOP_FILTER             63
     20 /* fraction of total macroblock rows to be used in fast filter level picking */
     21 /* has to be > 2 */
     22 #define PARTIAL_FRAME_FRACTION      8
     23 
     24 typedef enum
     25 {
     26     NORMAL_LOOPFILTER = 0,
     27     SIMPLE_LOOPFILTER = 1
     28 } LOOPFILTERTYPE;
     29 
     30 #if ARCH_ARM
     31 #define SIMD_WIDTH 1
     32 #else
     33 #define SIMD_WIDTH 16
     34 #endif
     35 
     36 /* Need to align this structure so when it is declared and
     37  * passed it can be loaded into vector registers.
     38  */
     39 typedef struct
     40 {
     41     DECLARE_ALIGNED(SIMD_WIDTH, unsigned char, mblim[MAX_LOOP_FILTER + 1][SIMD_WIDTH]);
     42     DECLARE_ALIGNED(SIMD_WIDTH, unsigned char, blim[MAX_LOOP_FILTER + 1][SIMD_WIDTH]);
     43     DECLARE_ALIGNED(SIMD_WIDTH, unsigned char, lim[MAX_LOOP_FILTER + 1][SIMD_WIDTH]);
     44     DECLARE_ALIGNED(SIMD_WIDTH, unsigned char, hev_thr[4][SIMD_WIDTH]);
     45     unsigned char lvl[4][4][4];
     46     unsigned char hev_thr_lut[2][MAX_LOOP_FILTER + 1];
     47     unsigned char mode_lf_lut[10];
     48 } loop_filter_info_n;
     49 
     50 typedef struct loop_filter_info
     51 {
     52     const unsigned char * mblim;
     53     const unsigned char * blim;
     54     const unsigned char * lim;
     55     const unsigned char * hev_thr;
     56 } loop_filter_info;
     57 
     58 
     59 typedef void loop_filter_uvfunction
     60 (
     61     unsigned char *u,   /* source pointer */
     62     int p,              /* pitch */
     63     const unsigned char *blimit,
     64     const unsigned char *limit,
     65     const unsigned char *thresh,
     66     unsigned char *v
     67 );
     68 
     69 /* assorted loopfilter functions which get used elsewhere */
     70 struct VP8Common;
     71 struct macroblockd;
     72 struct modeinfo;
     73 
     74 void vp8_loop_filter_init(struct VP8Common *cm);
     75 
     76 void vp8_loop_filter_frame_init(struct VP8Common *cm,
     77                                 struct macroblockd *mbd,
     78                                 int default_filt_lvl);
     79 
     80 void vp8_loop_filter_frame(struct VP8Common *cm, struct macroblockd *mbd,
     81                            int frame_type);
     82 
     83 void vp8_loop_filter_partial_frame(struct VP8Common *cm,
     84                                    struct macroblockd *mbd,
     85                                    int default_filt_lvl);
     86 
     87 void vp8_loop_filter_frame_yonly(struct VP8Common *cm,
     88                                  struct macroblockd *mbd,
     89                                  int default_filt_lvl);
     90 
     91 void vp8_loop_filter_update_sharpness(loop_filter_info_n *lfi,
     92                                       int sharpness_lvl);
     93 
     94 void vp8_loop_filter_row_normal(struct VP8Common *cm,
     95                                 struct modeinfo *mode_info_context,
     96                                 int mb_row, int post_ystride, int post_uvstride,
     97                                 unsigned char *y_ptr, unsigned char *u_ptr,
     98                                 unsigned char *v_ptr);
     99 
    100 void vp8_loop_filter_row_simple(struct VP8Common *cm,
    101                                 struct modeinfo *mode_info_context,
    102                                 int mb_row, int post_ystride, int post_uvstride,
    103                                 unsigned char *y_ptr, unsigned char *u_ptr,
    104                                 unsigned char *v_ptr);
    105 #endif
    106