yadif: Fix illegal memory access

When applying the spatial prediction, there is an illegal access of -1 index of array.
Hence adding a condition to avoid this.

https://bugzilla.gnome.org/show_bug.cgi?id=759518
This commit is contained in:
Vineeth TM 2015-12-16 08:25:19 +09:00 committed by Sebastian Dröge
parent eb7deb4418
commit 50978ccd1a

View file

@ -56,12 +56,15 @@
int temporal_diff2 =(FFABS(next[mrefs] - c) + FFABS(next[prefs] - e) )>>1; \
int diff = FFMAX3(temporal_diff0 >> 1, temporal_diff1, temporal_diff2); \
int spatial_pred = (c+e) >> 1; \
int spatial_score = FFABS(cur[mrefs - 1] - cur[prefs - 1]) + FFABS(c-e) \
+ FFABS(cur[mrefs + 1] - cur[prefs + 1]) - 1; \
int spatial_score = -1; \
\
CHECK(-1) CHECK(-2) }} }} \
CHECK( 1) CHECK( 2) }} }} \
if (mrefs > 0 && prefs > 0) { \
spatial_score = FFABS(cur[mrefs - 1] - cur[prefs - 1]) + FFABS(c-e) \
+ FFABS(cur[mrefs + 1] - cur[prefs + 1]) - 1; \
\
CHECK(-1) CHECK(-2) }} }} \
CHECK( 1) CHECK( 2) }} }} \
} \
if (mode < 2) { \
int b = (prev2[2 * mrefs] + next2[2 * mrefs])>>1; \
int f = (prev2[2 * prefs] + next2[2 * prefs])>>1; \