Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGanesh Ajjanagadde <gajjanagadde@gmail.com>2015-09-16 21:48:16 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2015-09-18 23:42:38 +0300
commit0fe1c50e505125cf2b026d810458bc5cbc242792 (patch)
tree50569c6d05c686c15aca5415cda7587da77ce296 /libavfilter/vf_xbr.c
parente47564828b9b351f874f24d66306294b7741b768 (diff)
all: do standards compliant absdiff computation
This resolves implementation defined behavior, and also silences -Wabsolute-value in clang 3.5+. Moreover, the generated asm is identical to before modulo nop padding. Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavfilter/vf_xbr.c')
-rw-r--r--libavfilter/vf_xbr.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavfilter/vf_xbr.c b/libavfilter/vf_xbr.c
index 858660873c..c92e9a8230 100644
--- a/libavfilter/vf_xbr.c
+++ b/libavfilter/vf_xbr.c
@@ -65,13 +65,14 @@ static uint32_t pixel_diff(uint32_t x, uint32_t y, const uint32_t *r2y)
#define YMASK 0xff0000
#define UMASK 0x00ff00
#define VMASK 0x0000ff
+#define ABSDIFF(a,b) (abs((int)(a)-(int)(b)))
uint32_t yuv1 = r2y[x & 0xffffff];
uint32_t yuv2 = r2y[y & 0xffffff];
- return (abs((yuv1 & YMASK) - (yuv2 & YMASK)) >> 16) +
- (abs((yuv1 & UMASK) - (yuv2 & UMASK)) >> 8) +
- abs((yuv1 & VMASK) - (yuv2 & VMASK));
+ return (ABSDIFF(yuv1 & YMASK, yuv2 & YMASK) >> 16) +
+ (ABSDIFF(yuv1 & UMASK, yuv2 & UMASK) >> 8) +
+ ABSDIFF(yuv1 & VMASK, yuv2 & VMASK);
}
#define ALPHA_BLEND_128_W(a, b) ((((a) & LB_MASK) >> 1) + (((b) & LB_MASK) >> 1))