Skip to content

Commit

Permalink
Add optimization to slideshow fading by adding convert_alpha() to old…
Browse files Browse the repository at this point in the history
…Background, and update README to reflect new FPS
  • Loading branch information
R0NAM1 committed Apr 13, 2024
1 parent 624bbb9 commit cbb6d1b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,24 @@ Selenium may also not run well with extensions, so remove them as first step for
<img src="assets/server_link.png" alt="The open screen of the simplecast server, had the download link and the background is a tropical beach" width="800"/>

## FPS
The following are tables of FPS and Resolution data from certain hardware I tested this on, note FPS will always tank during slideshow fading.
The following are tables of FPS and Resolution data from certain hardware I tested this on, FPS used to tank until I implemented pygame.Surface.convert_alpha() (30% Increase!)

### Raspberry Pi 3B+ (BCM2837, 1GB Ram, VideoCore IV)
| Resolution | Still Image FPS | Slideshow Fading FPS |
| :--------: | :-------------: | :------------------: |
| 640x480 | ~42 | ~18 |
| 1024x768 | ~20 | ~8 |
| 1280x720 | ~17 | ~5 |
| 1920x1080 | ~7 | ~2 |
| 640x480 | ~42 | ~29 |
| 1024x768 | ~18 | ~12 |
| 1280x720 | ~17 | ~9 |
| 1920x1080 | ~6 | ~4 |

### Lenovo G50-80 (i3-4030U, 8GB Ram, Haswell-ULT)
| Resolution | Still Image FPS | Slideshow Fading FPS |
| :--------: | :-------------: | :------------------: |
| 640x480 | ~300 | ~50 |
| 1024x768 | ~155 | ~30 |
| 1280x720 | ~130 | ~24 |
| 1366x768 | ~100 | ~21 |
| 1920x1080 | ~66 | ~11 |
| 640x480 | ~300 | ~100 |
| 1024x768 | ~155 | ~73 |
| 1280x720 | ~130 | ~66 |
| 1366x768 | ~100 | ~57 |
| 1920x1080 | ~66 | ~32 |

## Config Keys & Possible Values
| Config Key | Meaning | Value Type | Value Example |
Expand Down
2 changes: 1 addition & 1 deletion receiver/slideshowObjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def drawNextSlideShowFrameTick(displayInfo):

# Make current background previous one (Cannot deepcopy, have to makes bytes)
bkBytes = pygame.image.tobytes(myGlobals.backgroundToDraw, 'RGBA')
myGlobals.oldBackground = pygame.image.frombytes(bkBytes, (myGlobals.backgroundToDraw.get_width(), myGlobals.backgroundToDraw.get_height()), 'RGBA')
myGlobals.oldBackground = (pygame.image.frombytes(bkBytes, (myGlobals.backgroundToDraw.get_width(), myGlobals.backgroundToDraw.get_height()), 'RGBA')).convert_alpha()

myGlobals.oldX = 0
myGlobals.oldY = 0
Expand Down

0 comments on commit cbb6d1b

Please sign in to comment.