Speed up h265 binary decoding by ~5%

This commit is contained in:
Theelgirl 2021-02-26 10:49:04 -08:00
parent 4affd7bf51
commit 6a80201c18
1 changed files with 2 additions and 9 deletions

View File

@ -198,15 +198,8 @@ def get_bits_from_image(image: Image, use_h265: bool) -> str:
else:
for y in range(height):
for x in range(width):
pixel = px[x, y]
pixel_bin_rep = "0"
# pixel is either 0 or 255, black or white
if pixel == 255:
pixel_bin_rep = "1"
# adding bits
bits += pixel_bin_rep
# 1 if it's a white pixel, otherwise it's black so 0
bits += "1" if px[x, y] == 255 else "0"
return bits