aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-12-25 20:22:06 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2016-12-25 21:04:32 +0100
commitd5ecffbac69543185a2f6d91414dbe097645f62c (patch)
treee7d9ab2013c8c34ce45a0238758d0eca976b157e
parentcafc72bd7bc4fb7672717e0e599405dbc59f3b5d (diff)
downloadffmpeg-d5ecffbac69543185a2f6d91414dbe097645f62c.tar.gz
avcodec/error_resilience: Merge surrounding status checks
Simplifies code and is also faster Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/error_resilience.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c
index 79ac75a58a..741a9c8329 100644
--- a/libavcodec/error_resilience.c
+++ b/libavcodec/error_resilience.c
@@ -376,7 +376,7 @@ static void v_block_filter(ERContext *s, uint8_t *dst, int w, int h,
static void guess_mv(ERContext *s)
{
uint8_t *fixed = s->er_temp_buffer;
-#define MV_FROZEN 3
+#define MV_FROZEN 4
#define MV_CHANGED 2
#define MV_UNCHANGED 1
const int mb_stride = s->mb_stride;
@@ -467,27 +467,19 @@ static void guess_mv(ERContext *s)
av_assert1(s->last_pic.f && s->last_pic.f->data[0]);
j = 0;
- if (mb_x > 0 && fixed[mb_xy - 1] == MV_FROZEN)
- j = 1;
- if (mb_x + 1 < mb_width && fixed[mb_xy + 1] == MV_FROZEN)
- j = 1;
- if (mb_y > 0 && fixed[mb_xy - mb_stride] == MV_FROZEN)
- j = 1;
- if (mb_y + 1 < mb_height && fixed[mb_xy + mb_stride] == MV_FROZEN)
- j = 1;
- if (j == 0)
+ if (mb_x > 0)
+ j |= fixed[mb_xy - 1];
+ if (mb_x + 1 < mb_width)
+ j |= fixed[mb_xy + 1];
+ if (mb_y > 0)
+ j |= fixed[mb_xy - mb_stride];
+ if (mb_y + 1 < mb_height)
+ j |= fixed[mb_xy + mb_stride];
+
+ if (!(j & MV_FROZEN))
continue;
- j = 0;
- if (mb_x > 0 && fixed[mb_xy - 1 ] == MV_CHANGED)
- j = 1;
- if (mb_x + 1 < mb_width && fixed[mb_xy + 1 ] == MV_CHANGED)
- j = 1;
- if (mb_y > 0 && fixed[mb_xy - mb_stride] == MV_CHANGED)
- j = 1;
- if (mb_y + 1 < mb_height && fixed[mb_xy + mb_stride] == MV_CHANGED)
- j = 1;
- if (j == 0 && pass > 1)
+ if (!(j & MV_CHANGED) && pass > 1)
continue;
none_left = 0;