From 982b596ea6640bfe218a31f6c3fc542d9fe61c31 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Fri, 14 Feb 2014 17:00:06 +0100 Subject: h264: avoid undefined behavior in chroma motion compensation Makes fate-h264 pass under valgrind --undef-value-errors=yes with -cpuflags none. {avg,put}_h264_chroma_mc8_8 approximately 5% faster, {avg,put}_h264_chroma_mc4_8 2% faster both on x86 and arm. --- libavcodec/h264chroma_template.c | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'libavcodec/h264chroma_template.c') diff --git a/libavcodec/h264chroma_template.c b/libavcodec/h264chroma_template.c index 351d9d2f2e..028ed132cf 100644 --- a/libavcodec/h264chroma_template.c +++ b/libavcodec/h264chroma_template.c @@ -43,7 +43,7 @@ static void FUNCC(OPNAME ## h264_chroma_mc2)(uint8_t *_dst/*align 8*/, uint8_t * dst+= stride;\ src+= stride;\ }\ - }else{\ + } else if (B + C) {\ const int E= B+C;\ const int step= C ? stride : 1;\ for(i=0; i