Commit 4d943cec authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '982b596e'

* commit '982b596e':
  h264: avoid undefined behavior in chroma motion compensation
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 0c803eba 982b596e
......@@ -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;\
}\
}\
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment