diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2012-04-04 21:50:29 +0400 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2012-04-04 21:55:50 +0400 |
commit | bc0bdda77b8df4c963dde55793dcecb65232c21a (patch) | |
tree | dae7c492a57b45cb896719b0106fee162d19b0ac /libswscale | |
parent | e484265c9712dd108c61f21bbc7644a2b791f36f (diff) |
swscale: handle complete dimensions for monoblack/white.
Fixes bug 269.
Diffstat (limited to 'libswscale')
-rw-r--r-- | libswscale/input.c | 6 | ||||
-rw-r--r-- | libswscale/output.c | 10 |
2 files changed, 11 insertions, 5 deletions
diff --git a/libswscale/input.c b/libswscale/input.c index e636eac1f6..b4855093a0 100644 --- a/libswscale/input.c +++ b/libswscale/input.c @@ -309,7 +309,8 @@ static void monowhite2Y_c(uint8_t *dst, const uint8_t *src, int width, uint32_t *unused) { int i, j; - for (i=0; i<width/8; i++) { + width = (width + 7) >> 3; + for (i = 0; i < width; i++) { int d= ~src[i]; for(j=0; j<8; j++) dst[8*i+j]= ((d>>(7-j))&1)*255; @@ -320,7 +321,8 @@ static void monoblack2Y_c(uint8_t *dst, const uint8_t *src, int width, uint32_t *unused) { int i, j; - for (i=0; i<width/8; i++) { + width = (width + 7) >> 3; + for (i = 0; i < width; i++) { int d= src[i]; for(j=0; j<8; j++) dst[8*i+j]= ((d>>(7-j))&1)*255; diff --git a/libswscale/output.c b/libswscale/output.c index 533fcd945d..f1acf9ec92 100644 --- a/libswscale/output.c +++ b/libswscale/output.c @@ -317,7 +317,7 @@ yuv2mono_X_c_template(SwsContext *c, const int16_t *lumFilter, int i; unsigned acc = 0; - for (i = 0; i < dstW - 1; i += 2) { + for (i = 0; i < dstW; i += 2) { int j; int Y1 = 1 << 18; int Y2 = 1 << 18; @@ -338,6 +338,10 @@ yuv2mono_X_c_template(SwsContext *c, const int16_t *lumFilter, output_pixel(*dest++, acc); } } + + if (i & 6) { + output_pixel(*dest, acc); + } } static av_always_inline void @@ -352,7 +356,7 @@ yuv2mono_2_c_template(SwsContext *c, const int16_t *buf[2], int yalpha1 = 4095 - yalpha; int i; - for (i = 0; i < dstW - 7; i += 8) { + for (i = 0; i < dstW; i += 8) { int Y, acc = 0; Y = (buf0[i + 0] * yalpha1 + buf1[i + 0] * yalpha) >> 19; @@ -385,7 +389,7 @@ yuv2mono_1_c_template(SwsContext *c, const int16_t *buf0, const uint8_t * const d128 = dither_8x8_220[y & 7]; int i; - for (i = 0; i < dstW - 7; i += 8) { + for (i = 0; i < dstW; i += 8) { int acc = 0; accumulate_bit(acc, (buf0[i + 0] >> 7) + d128[0]); |