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

swscale: handle last pixel if lines have an odd width.

Fixes bug 270.
This commit is contained in:
Ronald S. Bultje 2012-04-05 17:30:19 -07:00
parent f5be7958e3
commit 9206ac80a5

View File

@ -466,7 +466,7 @@ yuv2422_X_c_template(SwsContext *c, const int16_t *lumFilter,
{
int i;
for (i = 0; i < (dstW >> 1); i++) {
for (i = 0; i < ((dstW + 1) >> 1); i++) {
int j;
int Y1 = 1 << 18;
int Y2 = 1 << 18;
@ -509,7 +509,7 @@ yuv2422_2_c_template(SwsContext *c, const int16_t *buf[2],
int uvalpha1 = 4095 - uvalpha;
int i;
for (i = 0; i < (dstW >> 1); i++) {
for (i = 0; i < ((dstW + 1) >> 1); i++) {
int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 19;
int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 19;
int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha) >> 19;
@ -534,7 +534,7 @@ yuv2422_1_c_template(SwsContext *c, const int16_t *buf0,
int i;
if (uvalpha < 2048) {
for (i = 0; i < (dstW >> 1); i++) {
for (i = 0; i < ((dstW + 1) >> 1); i++) {
int Y1 = buf0[i * 2] >> 7;
int Y2 = buf0[i * 2 + 1] >> 7;
int U = ubuf0[i] >> 7;
@ -549,7 +549,7 @@ yuv2422_1_c_template(SwsContext *c, const int16_t *buf0,
}
} else {
const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
for (i = 0; i < (dstW >> 1); i++) {
for (i = 0; i < ((dstW + 1) >> 1); i++) {
int Y1 = buf0[i * 2] >> 7;
int Y2 = buf0[i * 2 + 1] >> 7;
int U = (ubuf0[i] + ubuf1[i]) >> 8;
@ -589,7 +589,7 @@ yuv2rgb48_X_c_template(SwsContext *c, const int16_t *lumFilter,
{
int i;
for (i = 0; i < (dstW >> 1); i++) {
for (i = 0; i < ((dstW + 1) >> 1); i++) {
int j;
int Y1 = -0x40000000;
int Y2 = -0x40000000;
@ -652,7 +652,7 @@ yuv2rgb48_2_c_template(SwsContext *c, const int32_t *buf[2],
int uvalpha1 = 4095 - uvalpha;
int i;
for (i = 0; i < (dstW >> 1); i++) {
for (i = 0; i < ((dstW + 1) >> 1); i++) {
int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 14;
int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 14;
int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha + (-128 << 23)) >> 14;
@ -690,7 +690,7 @@ yuv2rgb48_1_c_template(SwsContext *c, const int32_t *buf0,
int i;
if (uvalpha < 2048) {
for (i = 0; i < (dstW >> 1); i++) {
for (i = 0; i < ((dstW + 1) >> 1); i++) {
int Y1 = (buf0[i * 2] ) >> 2;
int Y2 = (buf0[i * 2 + 1]) >> 2;
int U = (ubuf0[i] + (-128 << 11)) >> 2;
@ -718,7 +718,7 @@ yuv2rgb48_1_c_template(SwsContext *c, const int32_t *buf0,
}
} else {
const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
for (i = 0; i < (dstW >> 1); i++) {
for (i = 0; i < ((dstW + 1) >> 1); i++) {
int Y1 = (buf0[i * 2] ) >> 2;
int Y2 = (buf0[i * 2 + 1]) >> 2;
int U = (ubuf0[i] + ubuf1[i] + (-128 << 12)) >> 3;
@ -932,7 +932,7 @@ yuv2rgb_X_c_template(SwsContext *c, const int16_t *lumFilter,
{
int i;
for (i = 0; i < (dstW >> 1); i++) {
for (i = 0; i < ((dstW + 1) >> 1); i++) {
int j, A1, A2;
int Y1 = 1 << 18;
int Y2 = 1 << 18;
@ -999,7 +999,7 @@ yuv2rgb_2_c_template(SwsContext *c, const int16_t *buf[2],
int uvalpha1 = 4095 - uvalpha;
int i;
for (i = 0; i < (dstW >> 1); i++) {
for (i = 0; i < ((dstW + 1) >> 1); i++) {
int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 19;
int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 19;
int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha) >> 19;
@ -1037,7 +1037,7 @@ yuv2rgb_1_c_template(SwsContext *c, const int16_t *buf0,
int i;
if (uvalpha < 2048) {
for (i = 0; i < (dstW >> 1); i++) {
for (i = 0; i < ((dstW + 1) >> 1); i++) {
int Y1 = buf0[i * 2] >> 7;
int Y2 = buf0[i * 2 + 1] >> 7;
int U = ubuf0[i] >> 7;
@ -1064,7 +1064,7 @@ yuv2rgb_1_c_template(SwsContext *c, const int16_t *buf0,
}
} else {
const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
for (i = 0; i < (dstW >> 1); i++) {
for (i = 0; i < ((dstW + 1) >> 1); i++) {
int Y1 = buf0[i * 2] >> 7;
int Y2 = buf0[i * 2 + 1] >> 7;
int U = (ubuf0[i] + ubuf1[i]) >> 8;