Revision 2657fd0c libavfilter/vf_yadif.c

View differences:

libavfilter/vf_yadif.c
120 120

  
121 121
static void filter_line_c_16bit(uint16_t *dst,
122 122
                                uint16_t *prev, uint16_t *cur, uint16_t *next,
123
                                int w, int refs, int parity, int mode)
123
                                int w, int prefs, int mrefs, int parity, int mode)
124 124
{
125 125
    int x;
126 126
    uint16_t *prev2 = parity ? prev : cur ;
127 127
    uint16_t *next2 = parity ? cur  : next;
128
    refs /= 2;
128
    mrefs /= 2;
129
    prefs /= 2;
129 130
    for (x = 0;  x < w; x++) {
130
        int c = cur[-refs];
131
        int c = cur[mrefs];
131 132
        int d = (prev2[0] + next2[0])>>1;
132
        int e = cur[+refs];
133
        int e = cur[prefs];
133 134
        int temporal_diff0 = FFABS(prev2[0] - next2[0]);
134
        int temporal_diff1 =(FFABS(prev[-refs] - c) + FFABS(prev[+refs] - e) )>>1;
135
        int temporal_diff2 =(FFABS(next[-refs] - c) + FFABS(next[+refs] - e) )>>1;
135
        int temporal_diff1 =(FFABS(prev[mrefs] - c) + FFABS(prev[prefs] - e) )>>1;
136
        int temporal_diff2 =(FFABS(next[mrefs] - c) + FFABS(next[prefs] - e) )>>1;
136 137
        int diff = FFMAX3(temporal_diff0>>1, temporal_diff1, temporal_diff2);
137 138
        int spatial_pred = (c+e)>>1;
138
        int spatial_score = FFABS(cur[-refs-1] - cur[+refs-1]) + FFABS(c-e)
139
                          + FFABS(cur[-refs+1] - cur[+refs+1]) - 1;
139
        int spatial_score = FFABS(cur[mrefs-1] - cur[prefs-1]) + FFABS(c-e)
140
                          + FFABS(cur[mrefs+1] - cur[prefs+1]) - 1;
140 141

  
141 142
#define CHECK(j)\
142
    {   int score = FFABS(cur[-refs-1+j] - cur[+refs-1-j])\
143
                  + FFABS(cur[-refs  +j] - cur[+refs  -j])\
144
                  + FFABS(cur[-refs+1+j] - cur[+refs+1-j]);\
143
    {   int score = FFABS(cur[mrefs-1+j] - cur[prefs-1-j])\
144
                  + FFABS(cur[mrefs  +j] - cur[prefs  -j])\
145
                  + FFABS(cur[mrefs+1+j] - cur[prefs+1-j]);\
145 146
        if (score < spatial_score) {\
146 147
            spatial_score= score;\
147
            spatial_pred= (cur[-refs  +j] + cur[+refs  -j])>>1;\
148
            spatial_pred= (cur[mrefs  +j] + cur[prefs  -j])>>1;\
148 149

  
149 150
        CHECK(-1) CHECK(-2) }} }}
150 151
        CHECK( 1) CHECK( 2) }} }}
151 152

  
152 153
        if (mode < 2) {
153
            int b = (prev2[-2*refs] + next2[-2*refs])>>1;
154
            int f = (prev2[+2*refs] + next2[+2*refs])>>1;
154
            int b = (prev2[2*mrefs] + next2[2*mrefs])>>1;
155
            int f = (prev2[2*prefs] + next2[2*prefs])>>1;
155 156
#if 0
156 157
            int a = cur[-3*refs];
157 158
            int g = cur[+3*refs];

Also available in: Unified diff