Commit 221f902f authored by Michael Niedermayer's avatar Michael Niedermayer

avfilter/vf_yadif: fix race condition

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent fe99b1d5
...@@ -111,6 +111,7 @@ static void filter_line_c(void *dst1, ...@@ -111,6 +111,7 @@ static void filter_line_c(void *dst1,
FILTER(0, w, 1) FILTER(0, w, 1)
} }
#define MAX_ALIGN 8
static void filter_edges(void *dst1, void *prev1, void *cur1, void *next1, static void filter_edges(void *dst1, void *prev1, void *cur1, void *next1,
int w, int prefs, int mrefs, int parity, int mode) int w, int prefs, int mrefs, int parity, int mode)
{ {
...@@ -126,13 +127,14 @@ static void filter_edges(void *dst1, void *prev1, void *cur1, void *next1, ...@@ -126,13 +127,14 @@ static void filter_edges(void *dst1, void *prev1, void *cur1, void *next1,
* for is_not_edge should let the compiler ignore the whole branch. */ * for is_not_edge should let the compiler ignore the whole branch. */
FILTER(0, 3, 0) FILTER(0, 3, 0)
dst = (uint8_t*)dst1 + w - 3; dst = (uint8_t*)dst1 + w - (MAX_ALIGN-1);
prev = (uint8_t*)prev1 + w - 3; prev = (uint8_t*)prev1 + w - (MAX_ALIGN-1);
cur = (uint8_t*)cur1 + w - 3; cur = (uint8_t*)cur1 + w - (MAX_ALIGN-1);
next = (uint8_t*)next1 + w - 3; next = (uint8_t*)next1 + w - (MAX_ALIGN-1);
prev2 = (uint8_t*)(parity ? prev : cur); prev2 = (uint8_t*)(parity ? prev : cur);
next2 = (uint8_t*)(parity ? cur : next); next2 = (uint8_t*)(parity ? cur : next);
FILTER(w - (MAX_ALIGN-1), w - 3, 1)
FILTER(w - 3, w, 0) FILTER(w - 3, w, 0)
} }
...@@ -170,13 +172,14 @@ static void filter_edges_16bit(void *dst1, void *prev1, void *cur1, void *next1, ...@@ -170,13 +172,14 @@ static void filter_edges_16bit(void *dst1, void *prev1, void *cur1, void *next1,
FILTER(0, 3, 0) FILTER(0, 3, 0)
dst = (uint16_t*)dst1 + w - 3; dst = (uint16_t*)dst1 + w - (MAX_ALIGN/2-1);
prev = (uint16_t*)prev1 + w - 3; prev = (uint16_t*)prev1 + w - (MAX_ALIGN/2-1);
cur = (uint16_t*)cur1 + w - 3; cur = (uint16_t*)cur1 + w - (MAX_ALIGN/2-1);
next = (uint16_t*)next1 + w - 3; next = (uint16_t*)next1 + w - (MAX_ALIGN/2-1);
prev2 = (uint16_t*)(parity ? prev : cur); prev2 = (uint16_t*)(parity ? prev : cur);
next2 = (uint16_t*)(parity ? cur : next); next2 = (uint16_t*)(parity ? cur : next);
FILTER(w - (MAX_ALIGN/2-1), w - 3, 1)
FILTER(w - 3, w, 0) FILTER(w - 3, w, 0)
} }
...@@ -203,7 +206,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) ...@@ -203,7 +206,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
uint8_t *dst = &td->frame->data[td->plane][y * td->frame->linesize[td->plane]]; uint8_t *dst = &td->frame->data[td->plane][y * td->frame->linesize[td->plane]];
int mode = y == 1 || y + 2 == td->h ? 2 : s->mode; int mode = y == 1 || y + 2 == td->h ? 2 : s->mode;
s->filter_line(dst + pix_3, prev + pix_3, cur + pix_3, s->filter_line(dst + pix_3, prev + pix_3, cur + pix_3,
next + pix_3, td->w - 6, next + pix_3, td->w - (3 + MAX_ALIGN/df-1),
y + 1 < td->h ? refs : -refs, y + 1 < td->h ? refs : -refs,
y ? -refs : refs, y ? -refs : refs,
td->parity ^ td->tff, mode); td->parity ^ td->tff, mode);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment