mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-11-06 05:17:42 +00:00
swscale/output: write the last partial byte in the mono error-diffusion paths
The SWS_DITHER_ED branches of yuv2mono_1_c_template() and yuv2mono_2_c_template() only store a byte when (i & 7) == 6, so for widths whose last pixel pair does not end a byte the final partial byte of each row is never written and keeps whatever the destination held. Converting a white 100x8 frame with -sws_flags +error_diffusion -pix_fmt monob leaves the last 4 pixels of rows 1-7 black (0x00 instead of 0xf0). Write the pending bits after the loop, shifted into the high bits as monob expects, like the non-ED paths. Signed-off-by: Martin Mirchev <mmirchev@comp.nus.edu.sg>
This commit is contained in:
1 parent
3c5ad12adf
commit
beb7168452
1 file changed
+4
@@ -749,6 +749,8 @@ yuv2mono_2_c_template(SwsInternal *c, const int16_t *buf[2],
|
||||
output_pixel(*dest++, acc);
|
||||
}
|
||||
c->dither_error[0][i] = err;
|
||||
if (i & 6)
|
||||
output_pixel(*dest, acc << (8 - (i & 7)));
|
||||
} else {
|
||||
for (i = 0; i < dstW; i += 8) {
|
||||
int Y;
|
||||
@@ -807,6 +809,8 @@ yuv2mono_1_c_template(SwsInternal *c, const int16_t *buf0,
|
||||
output_pixel(*dest++, acc);
|
||||
}
|
||||
c->dither_error[0][i] = err;
|
||||
if (i & 6)
|
||||
output_pixel(*dest, acc << (8 - (i & 7)));
|
||||
} else {
|
||||
for (i = 0; i < dstW; i += 8) {
|
||||
unsigned acc = 0;
|
||||
|
||||
Reference in new issue
Block a user