Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce GIF frame window from 30ms to 20ms #3886

Merged
merged 2 commits into from Jul 31, 2022

Conversation

TroyKomodo
Copy link
Contributor

@TroyKomodo TroyKomodo commented Jul 30, 2022

Pull request checklist:

  • CHANGELOG.md was updated, if applicable

Description

Currently the check for the next animated frame is every 30ms which happens to be too slow for the gif standard, the maximum speed of a gif is 20ms per frame.

An edge case would be when a gif only has 2 frames

Frame Number Frame delay
1 20ms
2 20ms

The total frame duration is 40ms

In the current implementation, if we start at a 0 offset

Offset Offset mod 40 Time Passed Frame Displayed
0 0 0ms 1
33 33 30ms 2
66 26 60ms 2
99 19 90ms 1
132 12 120ms 1

As you can see the frames are duplicated when they shouldn't be.

Its like a train station with trains ever 30ms and we are only ready to board every 20ms, and since we are impatient we miss our train.

Perhaps a smarter way of detecting which frame to select is a more performant approach however I haven't thought of how to do that. Or we could just say that 30ms is the min frame timing instead of 20ms

fixes SevenTV#85

@pajlada pajlada changed the title Adjust animated emote frame timings Reduce GIF frame window from 30ms to 20ms Jul 31, 2022
Copy link
Member

@pajlada pajlada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please apply the following patch, then make your PR up-to-date with the latest main branch

diff --git a/CHANGELOG.md b/CHANGELOG.md
index f37e9b4b..6f6a0949 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,7 +2,6 @@

 ## Unversioned

-- Minor: Fixed Animated emote frame delays (#3886)
 - Major: Added multi-channel searching to search dialog via keyboard shortcut. (Ctrl+Shift+F by default) (#3694, #3875)
 - Minor: Added option to display tabs on the right and bottom. (#3847)
 - Minor: Added `is:first-msg` search option. (#3700)
@@ -25,6 +24,7 @@
 - Minor: Added `/copy` command. Usage: `/copy <text>`. Copies provided text to clipboard - can be useful with custom commands. (#3763)
 - Minor: Removed total views from the usercard, as Twitch no longer updates the number. (#3792)
 - Minor: Add Quick Switcher item to open a channel in a new popup window. (#3828)
+- Minor: Reduced GIF frame window from 30ms to 20ms, causing fewer frame skips in animated emotes. (#3886)
 - Bugfix: Fix crash that can occur when closing and quickly reopening a split, then running a command. (#3852)
 - Bugfix: Connection to Twitch PubSub now recovers more reliably. (#3643, #3716)
 - Bugfix: Fix crash that can occur when changing channels. (#3799)

@Felanbird Felanbird enabled auto-merge (squash) July 31, 2022 19:27
@TroyKomodo
Copy link
Contributor Author

Unsure why ci fails.

@Mm2PL
Copy link
Collaborator

Mm2PL commented Jul 31, 2022

New clang-tide change that seems to have broken

@Felanbird Felanbird disabled auto-merge July 31, 2022 22:12
@Felanbird
Copy link
Collaborator

Felanbird commented Jul 31, 2022

This PR will be in limbo for a little bit while clang-tidy fixes are looked into
i forgot it's a PR only check

@pajlada pajlada merged commit ebc7852 into Chatterino:master Jul 31, 2022
@badoge badoge mentioned this pull request Aug 1, 2022
4 tasks
@TroyKomodo TroyKomodo deleted the troy/fix-frame-timings branch August 1, 2022 02:33
Felanbird added a commit to Felanbird/chatterino2 that referenced this pull request Aug 3, 2022
This reverts commit ebc7852 which broke emote speed on windows
pajlada added a commit that referenced this pull request Aug 6, 2022
@pajlada
Copy link
Member

pajlada commented Aug 6, 2022

Heads up @TroyKomodo - Since this PR ended up causing more issues than intended we reverted it in 76a891c

I'm happy to have this fix in eventually, but we need to test it better on different platforms.

@TroyKomodo
Copy link
Contributor Author

Sure, sorry i have been unable to debug this since i dont have a windows build env, ive been setting one up however.

@TroyKomodo
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Some emotes are different speed in Chatterino and on 7TV
4 participants