mirror of https://github.com/AlfredoSequeida/fvid
Speed up h265 binary decoding by ~5%
This commit is contained in:
parent
4affd7bf51
commit
6a80201c18
11
fvid/fvid.py
11
fvid/fvid.py
|
@ -198,15 +198,8 @@ def get_bits_from_image(image: Image, use_h265: bool) -> str:
|
||||||
else:
|
else:
|
||||||
for y in range(height):
|
for y in range(height):
|
||||||
for x in range(width):
|
for x in range(width):
|
||||||
pixel = px[x, y]
|
# 1 if it's a white pixel, otherwise it's black so 0
|
||||||
pixel_bin_rep = "0"
|
bits += "1" if px[x, y] == 255 else "0"
|
||||||
|
|
||||||
# pixel is either 0 or 255, black or white
|
|
||||||
if pixel == 255:
|
|
||||||
pixel_bin_rep = "1"
|
|
||||||
|
|
||||||
# adding bits
|
|
||||||
bits += pixel_bin_rep
|
|
||||||
|
|
||||||
return bits
|
return bits
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue