59 void (*filter_line)(uint8_t *dst,
60 uint8_t *prev, uint8_t *cur, uint8_t *next,
61 int w,
int prefs,
int mrefs,
int parity,
int mode);
67 { int score = FFABS(cur[mrefs-1+(j)] - cur[prefs-1-(j)])\
68 + FFABS(cur[mrefs +(j)] - cur[prefs -(j)])\
69 + FFABS(cur[mrefs+1+(j)] - cur[prefs+1-(j)]);\
70 if (score < spatial_score) {\
71 spatial_score= score;\
72 spatial_pred= (cur[mrefs +(j)] + cur[prefs -(j)])>>1;\
75 for (x = 0; x < w; x++) { \
77 int d = (prev2[0] + next2[0])>>1; \
79 int temporal_diff0 = FFABS(prev2[0] - next2[0]); \
80 int temporal_diff1 =(FFABS(prev[mrefs] - c) + FFABS(prev[prefs] - e) )>>1; \
81 int temporal_diff2 =(FFABS(next[mrefs] - c) + FFABS(next[prefs] - e) )>>1; \
82 int diff = FFMAX3(temporal_diff0>>1, temporal_diff1, temporal_diff2); \
83 int spatial_pred = (c+e)>>1; \
84 int spatial_score = FFABS(cur[mrefs-1] - cur[prefs-1]) + FFABS(c-e) \
85 + FFABS(cur[mrefs+1] - cur[prefs+1]) - 1; \
87 CHECK(-1) CHECK(-2) }} }} \
88 CHECK( 1) CHECK( 2) }} }} \
91 int b = (prev2[2*mrefs] + next2[2*mrefs])>>1; \
92 int f = (prev2[2*prefs] + next2[2*prefs])>>1; \
93 int max = FFMAX3(d-e, d-c, FFMIN(b-c, f-e)); \
94 int min = FFMIN3(d-e, d-c, FFMAX(b-c, f-e)); \
96 diff = FFMAX3(diff, min, -max); \
99 if (spatial_pred > d + diff) \
100 spatial_pred = d + diff; \
101 else if (spatial_pred < d - diff) \
102 spatial_pred = d - diff; \
104 dst[0] = spatial_pred; \
115 uint8_t *prev, uint8_t *cur, uint8_t *next,
116 int w,
int prefs,
int mrefs,
int parity,
int mode)
119 uint8_t *
prev2 = parity ? prev : cur ;
120 uint8_t *
next2 = parity ? cur : next;
126 uint16_t *prev, uint16_t *cur, uint16_t *next,
127 int w,
int prefs,
int mrefs,
int parity,
int mode)
130 uint16_t *
prev2 = parity ? prev : cur ;
131 uint16_t *
next2 = parity ? cur : next;
150 if (i == 1 || i == 2) {
156 for (y = 0; y < h; y++) {
157 if ((y ^ parity) & 1) {
158 uint8_t *prev = &yadif->
prev->
data[i][y*refs];
159 uint8_t *cur = &yadif->
cur ->
data[i][y*refs];
160 uint8_t *next = &yadif->
next->
data[i][y*refs];
162 int mode = y==1 || y+2==h ? 2 : yadif->
mode;
163 yadif->
filter_line(dst, prev, cur, next, w, y+1<h ? refs : -refs, y ? -refs : refs, parity ^ tff, mode);
166 &yadif->
cur->
data[i][y*refs], w*df);
171 __asm__
volatile(
"emms \n\t" : : :
"memory");
187 for (i = 0; i < 3; i++)
199 if (yadif->
parity == -1) {
218 filter(ctx, yadif->
out, tff ^ !is_second, tff);
249 yadif->
next = picref;
305 }
while (!yadif->
cur);
320 if (val==1 && !yadif->
next) {
325 assert(yadif->
next || !val);
330 return val * ((yadif->
mode&1)+1);