diff options
author | Clément Bœsch <u@pkh.me> | 2014-11-15 22:53:55 +0300 |
---|---|---|
committer | Clément Bœsch <u@pkh.me> | 2014-11-15 23:01:40 +0300 |
commit | fda209b74179832794bb0b8620a858992b33c98e (patch) | |
tree | 84bc9bbae10df27429860a2f3ca34b5d77e6c388 /libavfilter | |
parent | a3c3ee6973989c5a62b33f4cc28281d4563768a4 (diff) |
avfilter/xbr: simplify left/up conditions
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/vf_xbr.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/libavfilter/vf_xbr.c b/libavfilter/vf_xbr.c index 6b608a350b..74fe4764b9 100644 --- a/libavfilter/vf_xbr.c +++ b/libavfilter/vf_xbr.c @@ -159,17 +159,17 @@ static uint32_t pixel_diff(uint32_t x, uint32_t y, const uint32_t *r2y) || eq(PE,PG) || eq(PE,PC))) { \ const unsigned ke = df(PF,PG); \ const unsigned ki = df(PH,PC); \ - const unsigned ex2 = PE != PC && PB != PC; \ - const unsigned ex3 = PE != PG && PD != PG; \ + const int left = ke<<1 <= ki && PE != PG && PD != PG; \ + const int up = ke >= ki<<1 && PE != PC && PB != PC; \ const unsigned px = df(PE,PF) <= df(PE,PH) ? PF : PH; \ - if (ke<<1 <= ki && ex3 && ke >= ki<<1 && ex2) { /* left-up */ \ + if (left && up) { \ ALPHA_BLEND_224_W(E[N3], px); \ ALPHA_BLEND_64_W( E[N2], px); \ E[N1] = E[N2]; \ - } else if (ke<<1 <= ki && ex3) { /* left */ \ + } else if (left) { \ ALPHA_BLEND_192_W(E[N3], px); \ ALPHA_BLEND_64_W( E[N2], px); \ - } else if (ke >= ki<<1 && ex2) { /* up */ \ + } else if (up) { \ ALPHA_BLEND_192_W(E[N3], px); \ ALPHA_BLEND_64_W( E[N1], px); \ } else { /* diagonal */ \ @@ -220,21 +220,21 @@ static void xbr2x(AVFrame * input, AVFrame * output, const uint32_t * r2y) || eq(PE,PG) || eq(PE,PC))) { \ const unsigned ke = df(PF,PG); \ const unsigned ki = df(PH,PC); \ - const unsigned ex2 = PE != PC && PB != PC; \ - const unsigned ex3 = PE != PG && PD != PG; \ + const int left = ke<<1 <= ki && PE != PG && PD != PG; \ + const int up = ke >= ki<<1 && PE != PC && PB != PC; \ const unsigned px = df(PE,PF) <= df(PE,PH) ? PF : PH; \ - if (ke<<1 <= ki && ex3 && ke >= ki<<1 && ex2) { /* left-up */ \ + if (left && up) { \ ALPHA_BLEND_192_W(E[N7], px); \ ALPHA_BLEND_64_W( E[N6], px); \ E[N5] = E[N7]; \ E[N2] = E[N6]; \ E[N8] = px; \ - } else if (ke<<1 <= ki && ex3) { /* left */ \ + } else if (left) { \ ALPHA_BLEND_192_W(E[N7], px); \ ALPHA_BLEND_64_W( E[N5], px); \ ALPHA_BLEND_64_W( E[N6], px); \ E[N8] = px; \ - } else if (ke >= ki<<1 && ex2) { /* up */ \ + } else if (up) { \ ALPHA_BLEND_192_W(E[N5], px); \ ALPHA_BLEND_64_W( E[N7], px); \ ALPHA_BLEND_64_W( E[N2], px); \ @@ -292,23 +292,23 @@ static void xbr3x(AVFrame *input, AVFrame *output, const uint32_t *r2y) || eq(PE,PG) || eq(PE,PC))) { \ const unsigned ke = df(PF,PG); \ const unsigned ki = df(PH,PC); \ - const unsigned ex2 = PE != PC && PB != PC; \ - const unsigned ex3 = PE != PG && PD != PG; \ + const int left = ke<<1 <= ki && PE != PG && PD != PG; \ + const int up = ke >= ki<<1 && PE != PC && PB != PC; \ const unsigned px = df(PE,PF) <= df(PE,PH) ? PF : PH; \ - if (ke<<1 <= ki && ex3 && ke >= ki<<1 && ex2) { /* left-up */ \ + if (left && up) { \ ALPHA_BLEND_192_W(E[N13], px); \ ALPHA_BLEND_64_W( E[N12], px); \ E[N15] = E[N14] = E[N11] = px; \ E[N10] = E[N3] = E[N12]; \ E[N7] = E[N13]; \ - } else if (ke<<1 <= ki && ex3) { /* left */ \ + } else if (left) { \ ALPHA_BLEND_192_W(E[N11], px); \ ALPHA_BLEND_192_W(E[N13], px); \ ALPHA_BLEND_64_W( E[N10], px); \ ALPHA_BLEND_64_W( E[N12], px); \ E[N14] = px; \ E[N15] = px; \ - } else if (ke >= ki<<1 && ex2) { /* up */ \ + } else if (up) { \ ALPHA_BLEND_192_W(E[N14], px); \ ALPHA_BLEND_192_W(E[N7 ], px); \ ALPHA_BLEND_64_W( E[N10], px); \ |