postproc.h 4.6 KB
Newer Older
John Koleszar's avatar
John Koleszar committed
1
/*
2
 *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
John Koleszar's avatar
John Koleszar committed
3
 *
4
 *  Use of this source code is governed by a BSD-style license
5
6
 *  that can be found in the LICENSE file in the root of the source
 *  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.
John Koleszar's avatar
John Koleszar committed
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 */


#ifndef POSTPROC_H
#define POSTPROC_H

#define prototype_postproc_inplace(sym)\
    void sym (unsigned char *dst, int pitch, int rows, int cols,int flimit)

#define prototype_postproc(sym)\
    void sym (unsigned char *src, unsigned char *dst, int src_pitch,\
              int dst_pitch, int rows, int cols, int flimit)

#define prototype_postproc_addnoise(sym) \
    void sym (unsigned char *s, char *noise, char blackclamp[16],\
              char whiteclamp[16], char bothclamp[16],\
              unsigned int w, unsigned int h, int pitch)

27
28
29
30
31
32
33
34
35
#define prototype_postproc_blend_mb_inner(sym)\
    void sym (unsigned char *y, unsigned char *u, unsigned char *v,\
              int y1, int u1, int v1, int alpha, int stride)

#define prototype_postproc_blend_mb_outer(sym)\
    void sym (unsigned char *y, unsigned char *u, unsigned char *v,\
              int y1, int u1, int v1, int alpha, int stride)

#define prototype_postproc_blend_b(sym)\
36
37
38
    void sym (unsigned char *y, unsigned char *u, unsigned char *v,\
              int y1, int u1, int v1, int alpha, int stride)

John Koleszar's avatar
John Koleszar committed
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#if ARCH_X86 || ARCH_X86_64
#include "x86/postproc_x86.h"
#endif

#ifndef vp8_postproc_down
#define vp8_postproc_down vp8_mbpost_proc_down_c
#endif
extern prototype_postproc_inplace(vp8_postproc_down);

#ifndef vp8_postproc_across
#define vp8_postproc_across vp8_mbpost_proc_across_ip_c
#endif
extern prototype_postproc_inplace(vp8_postproc_across);

#ifndef vp8_postproc_downacross
#define vp8_postproc_downacross vp8_post_proc_down_and_across_c
#endif
extern prototype_postproc(vp8_postproc_downacross);

#ifndef vp8_postproc_addnoise
#define vp8_postproc_addnoise vp8_plane_add_noise_c
#endif
extern prototype_postproc_addnoise(vp8_postproc_addnoise);

63
64
65
66
67
68
69
70
71
72
73
74
#ifndef vp8_postproc_blend_mb_inner
#define vp8_postproc_blend_mb_inner vp8_blend_mb_inner_c
#endif
extern prototype_postproc_blend_mb_inner(vp8_postproc_blend_mb_inner);

#ifndef vp8_postproc_blend_mb_outer
#define vp8_postproc_blend_mb_outer vp8_blend_mb_outer_c
#endif
extern prototype_postproc_blend_mb_outer(vp8_postproc_blend_mb_outer);

#ifndef vp8_postproc_blend_b
#define vp8_postproc_blend_b vp8_blend_b_c
75
#endif
76
extern prototype_postproc_blend_b(vp8_postproc_blend_b);
John Koleszar's avatar
John Koleszar committed
77
78
79
80

typedef prototype_postproc((*vp8_postproc_fn_t));
typedef prototype_postproc_inplace((*vp8_postproc_inplace_fn_t));
typedef prototype_postproc_addnoise((*vp8_postproc_addnoise_fn_t));
81
82
83
typedef prototype_postproc_blend_mb_inner((*vp8_postproc_blend_mb_inner_fn_t));
typedef prototype_postproc_blend_mb_outer((*vp8_postproc_blend_mb_outer_fn_t));
typedef prototype_postproc_blend_b((*vp8_postproc_blend_b_fn_t));
John Koleszar's avatar
John Koleszar committed
84
85
typedef struct
{
86
87
88
89
90
91
92
    vp8_postproc_inplace_fn_t           down;
    vp8_postproc_inplace_fn_t           across;
    vp8_postproc_fn_t                   downacross;
    vp8_postproc_addnoise_fn_t          addnoise;
    vp8_postproc_blend_mb_inner_fn_t    blend_mb_inner;
    vp8_postproc_blend_mb_outer_fn_t    blend_mb_outer;
    vp8_postproc_blend_b_fn_t           blend_b;
John Koleszar's avatar
John Koleszar committed
93
94
95
96
97
98
99
100
101
102
103
104
105
106
} vp8_postproc_rtcd_vtable_t;

#if CONFIG_RUNTIME_CPU_DETECT
#define POSTPROC_INVOKE(ctx,fn) (ctx)->fn
#else
#define POSTPROC_INVOKE(ctx,fn) vp8_postproc_##fn
#endif

#include "vpx_ports/mem.h"
struct postproc_state
{
    int           last_q;
    int           last_noise;
    char          noise[3072];
107
    int           last_base_qindex;
John Koleszar's avatar
John Koleszar committed
108
109
110
111
112
113
114
    DECLARE_ALIGNED(16, char, blackclamp[16]);
    DECLARE_ALIGNED(16, char, whiteclamp[16]);
    DECLARE_ALIGNED(16, char, bothclamp[16]);
};
#include "onyxc_int.h"
#include "ppflags.h"
int vp8_post_proc_frame(struct VP8Common *oci, YV12_BUFFER_CONFIG *dest,
115
                        vp8_ppflags_t *flags);
John Koleszar's avatar
John Koleszar committed
116
117
118
119
120
121
122
123


void vp8_de_noise(YV12_BUFFER_CONFIG         *source,
                  YV12_BUFFER_CONFIG         *post,
                  int                         q,
                  int                         low_var_thresh,
                  int                         flag,
                  vp8_postproc_rtcd_vtable_t *rtcd);
Luca Barbato's avatar
Luca Barbato committed
124
125
126
127
128
129
130

void vp8_deblock(YV12_BUFFER_CONFIG         *source,
                 YV12_BUFFER_CONFIG         *post,
                 int                         q,
                 int                         low_var_thresh,
                 int                         flag,
                 vp8_postproc_rtcd_vtable_t *rtcd);
John Koleszar's avatar
John Koleszar committed
131
#endif