1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

Merge commit '982b596ea6640bfe218a31f6c3fc542d9fe61c31'

* commit '982b596ea6640bfe218a31f6c3fc542d9fe61c31':
  h264: avoid undefined behavior in chroma motion compensation

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-02-20 22:48:00 +01:00
commit 4d943cec68

View File

@ -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;\
}\
}\
}