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 POSTPROC_H
     13 #define POSTPROC_H
     14 
     15 #define prototype_postproc_inplace(sym)\
     16     void sym (unsigned char *dst, int pitch, int rows, int cols,int flimit)
     17 
     18 #define prototype_postproc(sym)\
     19     void sym (unsigned char *src, unsigned char *dst, int src_pitch,\
     20               int dst_pitch, int rows, int cols, int flimit)
     21 
     22 #define prototype_postproc_addnoise(sym) \
     23     void sym (unsigned char *s, char *noise, char blackclamp[16],\
     24               char whiteclamp[16], char bothclamp[16],\
     25               unsigned int w, unsigned int h, int pitch)
     26 
     27 #define prototype_postproc_blend_mb_inner(sym)\
     28     void sym (unsigned char *y, unsigned char *u, unsigned char *v,\
     29               int y1, int u1, int v1, int alpha, int stride)
     30 
     31 #define prototype_postproc_blend_mb_outer(sym)\
     32     void sym (unsigned char *y, unsigned char *u, unsigned char *v,\
     33               int y1, int u1, int v1, int alpha, int stride)
     34 
     35 #define prototype_postproc_blend_b(sym)\
     36     void sym (unsigned char *y, unsigned char *u, unsigned char *v,\
     37               int y1, int u1, int v1, int alpha, int stride)
     38 
     39 #if ARCH_X86 || ARCH_X86_64
     40 #include "x86/postproc_x86.h"
     41 #endif
     42 
     43 #ifndef vp8_postproc_down
     44 #define vp8_postproc_down vp8_mbpost_proc_down_c
     45 #endif
     46 extern prototype_postproc_inplace(vp8_postproc_down);
     47 
     48 #ifndef vp8_postproc_across
     49 #define vp8_postproc_across vp8_mbpost_proc_across_ip_c
     50 #endif
     51 extern prototype_postproc_inplace(vp8_postproc_across);
     52 
     53 #ifndef vp8_postproc_downacross
     54 #define vp8_postproc_downacross vp8_post_proc_down_and_across_c
     55 #endif
     56 extern prototype_postproc(vp8_postproc_downacross);
     57 
     58 #ifndef vp8_postproc_addnoise
     59 #define vp8_postproc_addnoise vp8_plane_add_noise_c
     60 #endif
     61 extern prototype_postproc_addnoise(vp8_postproc_addnoise);
     62 
     63 #ifndef vp8_postproc_blend_mb_inner
     64 #define vp8_postproc_blend_mb_inner vp8_blend_mb_inner_c
     65 #endif
     66 extern prototype_postproc_blend_mb_inner(vp8_postproc_blend_mb_inner);
     67 
     68 #ifndef vp8_postproc_blend_mb_outer
     69 #define vp8_postproc_blend_mb_outer vp8_blend_mb_outer_c
     70 #endif
     71 extern prototype_postproc_blend_mb_outer(vp8_postproc_blend_mb_outer);
     72 
     73 #ifndef vp8_postproc_blend_b
     74 #define vp8_postproc_blend_b vp8_blend_b_c
     75 #endif
     76 extern prototype_postproc_blend_b(vp8_postproc_blend_b);
     77 
     78 typedef prototype_postproc((*vp8_postproc_fn_t));
     79 typedef prototype_postproc_inplace((*vp8_postproc_inplace_fn_t));
     80 typedef prototype_postproc_addnoise((*vp8_postproc_addnoise_fn_t));
     81 typedef prototype_postproc_blend_mb_inner((*vp8_postproc_blend_mb_inner_fn_t));
     82 typedef prototype_postproc_blend_mb_outer((*vp8_postproc_blend_mb_outer_fn_t));
     83 typedef prototype_postproc_blend_b((*vp8_postproc_blend_b_fn_t));
     84 typedef struct
     85 {
     86     vp8_postproc_inplace_fn_t           down;
     87     vp8_postproc_inplace_fn_t           across;
     88     vp8_postproc_fn_t                   downacross;
     89     vp8_postproc_addnoise_fn_t          addnoise;
     90     vp8_postproc_blend_mb_inner_fn_t    blend_mb_inner;
     91     vp8_postproc_blend_mb_outer_fn_t    blend_mb_outer;
     92     vp8_postproc_blend_b_fn_t           blend_b;
     93 } vp8_postproc_rtcd_vtable_t;
     94 
     95 #if CONFIG_RUNTIME_CPU_DETECT
     96 #define POSTPROC_INVOKE(ctx,fn) (ctx)->fn
     97 #else
     98 #define POSTPROC_INVOKE(ctx,fn) vp8_postproc_##fn
     99 #endif
    100 
    101 #include "vpx_ports/mem.h"
    102 struct postproc_state
    103 {
    104     int           last_q;
    105     int           last_noise;
    106     char          noise[3072];
    107     DECLARE_ALIGNED(16, char, blackclamp[16]);
    108     DECLARE_ALIGNED(16, char, whiteclamp[16]);
    109     DECLARE_ALIGNED(16, char, bothclamp[16]);
    110 };
    111 #include "onyxc_int.h"
    112 #include "ppflags.h"
    113 int vp8_post_proc_frame(struct VP8Common *oci, YV12_BUFFER_CONFIG *dest,
    114                         int deblock_level, int noise_level, int flags);
    115 
    116 
    117 void vp8_de_noise(YV12_BUFFER_CONFIG         *source,
    118                   YV12_BUFFER_CONFIG         *post,
    119                   int                         q,
    120                   int                         low_var_thresh,
    121                   int                         flag,
    122                   vp8_postproc_rtcd_vtable_t *rtcd);
    123 
    124 void vp8_deblock(YV12_BUFFER_CONFIG         *source,
    125                  YV12_BUFFER_CONFIG         *post,
    126                  int                         q,
    127                  int                         low_var_thresh,
    128                  int                         flag,
    129                  vp8_postproc_rtcd_vtable_t *rtcd);
    130 #endif
    131