Round the result in ConvertColor

This commit is contained in:
Star Brilliant 2014-06-11 19:12:57 +08:00
parent d0e5fd8b90
commit f20f92e3bd

View File

@ -712,7 +712,7 @@ def ConvertColor(RGB, width=1280, height=576):
if width < 1280 and height < 576: if width < 1280 and height < 576:
return '%02X%02X%02X' % (B, G, R) return '%02X%02X%02X' % (B, G, R)
else: # VobSub always uses BT.601 colorspace, convert to BT.709 else: # VobSub always uses BT.601 colorspace, convert to BT.709
ClipByte = lambda x: 255 if x > 255 else 0 if x < 0 else x; ClipByte = lambda x: 255 if x > 255 else 0 if x < 0 else round(x);
return '%02X%02X%02X' % ( return '%02X%02X%02X' % (
ClipByte(R*0.00956384088080656+G*0.03217254540203729+B*0.95826361371715607), ClipByte(R*0.00956384088080656+G*0.03217254540203729+B*0.95826361371715607),
ClipByte(R*-0.10493933142075390+G*1.17231478191855154+B*-0.06737545049779757), ClipByte(R*-0.10493933142075390+G*1.17231478191855154+B*-0.06737545049779757),