diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-02-20 22:48:00 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-02-20 23:02:38 +0100 |
commit | 4d943cec68f31ff9cee7536ca699edc8de1eb74e (patch) | |
tree | 8f0860a672272116e8082e5a0e6f43d3b0f6336e /libavcodec | |
parent | 0c803eba2f56ce000ba2546124c246a71cb27266 (diff) | |
parent | 982b596ea6640bfe218a31f6c3fc542d9fe61c31 (diff) | |
download | ffmpeg-4d943cec68f31ff9cee7536ca699edc8de1eb74e.tar.gz |
Merge commit '982b596ea6640bfe218a31f6c3fc542d9fe61c31'
* commit '982b596ea6640bfe218a31f6c3fc542d9fe61c31':
h264: avoid undefined behavior in chroma motion compensation
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/h264chroma_template.c | 43 |
1 files changed, 39 insertions, 4 deletions
diff --git a/libavcodec/h264chroma_template.c b/libavcodec/h264chroma_template.c index b64172aadf..072b5e03f7 100644 --- a/libavcodec/h264chroma_template.c +++ b/libavcodec/h264chroma_template.c @@ -42,7 +42,7 @@ static void FUNCC(OPNAME ## h264_chroma_mc1)(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<h; i++){\ @@ -50,6 +50,12 @@ static void FUNCC(OPNAME ## h264_chroma_mc1)(uint8_t *_dst/*align 8*/, uint8_t * dst+= stride;\ src+= stride;\ }\ + } else {\ + for(i=0; i<h; i++){\ + OP(dst[0], (A*src[0]));\ + dst+= stride;\ + src+= stride;\ + }\ }\ }\ static void FUNCC(OPNAME ## h264_chroma_mc2)(uint8_t *_dst/*align 8*/, uint8_t *_src/*align 1*/, int stride, int h, int x, int y){\ @@ -71,7 +77,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<h; i++){\ @@ -80,6 +86,13 @@ static void FUNCC(OPNAME ## h264_chroma_mc2)(uint8_t *_dst/*align 8*/, uint8_t * dst+= stride;\ src+= stride;\ }\ + } else {\ + for ( i = 0; i < h; i++){\ + OP(dst[0], A * src[0]);\ + OP(dst[1], A * src[1]);\ + dst += stride;\ + src += stride;\ + }\ }\ }\ \ @@ -104,7 +117,7 @@ static void FUNCC(OPNAME ## h264_chroma_mc4)(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<h; i++){\ @@ -115,6 +128,15 @@ static void FUNCC(OPNAME ## h264_chroma_mc4)(uint8_t *_dst/*align 8*/, uint8_t * dst+= stride;\ src+= stride;\ }\ + } else {\ + for ( i = 0; i < h; i++){\ + OP(dst[0], A * src[0]);\ + OP(dst[1], A * src[1]);\ + OP(dst[2], A * src[2]);\ + OP(dst[3], A * src[3]);\ + dst += stride;\ + src += stride;\ + }\ }\ }\ \ @@ -143,7 +165,7 @@ static void FUNCC(OPNAME ## h264_chroma_mc8)(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<h; i++){\ @@ -158,6 +180,19 @@ static void FUNCC(OPNAME ## h264_chroma_mc8)(uint8_t *_dst/*align 8*/, uint8_t * dst+= stride;\ src+= stride;\ }\ + } else {\ + for ( i = 0; i < h; i++){\ + OP(dst[0], A * src[0]);\ + OP(dst[1], A * src[1]);\ + OP(dst[2], A * src[2]);\ + OP(dst[3], A * src[3]);\ + OP(dst[4], A * src[4]);\ + OP(dst[5], A * src[5]);\ + OP(dst[6], A * src[6]);\ + OP(dst[7], A * src[7]);\ + dst += stride;\ + src += stride;\ + }\ }\ } |