Comments (6)
If I understand the problem, you're trying to simply speed up the GIF decoding itself, not the displaying of the image? My GIF code is quite optimized already and I doubt that "inlining" the code will get you any benefit. The speed of decoding a GIF frame is directly proportional to how 'complex' the image is. In terms of LZW compression, this means how many unique pixel patterns have to be encoded (as opposed to repeating patterns). In simpler terms, an image which looks like a photo will compress very badly and decode very slowly while an image with lots of constant color areas will compress well and decode quickly. 480i is a relatively large size image and it doesn't surprise me that a GIF frame can take more than 50ms to decode on the ESP32. There's not much you can do to fix this problem except to change the frame size to be smaller or make the image content 'simpler'. You can't skip frames unless each frame is completely independent and that defeats some of the size benefit of animated GIF. This may not be an option for you, but the ESP32-S3 executes code about 15% faster than the ESP32-Pico D4. So, your options:
- simplify the types of images you're encoding
- Use a smaller frame size
- Use a faster CPU
from animatedgif.
Hi, @bitbank2
I got some good ideas from you.
I did think that it would be difficult to simply skip frames because of the decoding.
I hadn't thought of that idea. I was sticking to the current picture size. Your idea helped me.
I will measure the drawing time after reverting back to the original GIF animation picture size. And then I would like to revisit the specific measures.
I appreciate your assistance.
Thank you very much.
from animatedgif.
HI. @bitbank2
It's done.
I ended up reducing the picture size. As a result, the GIF drawing time is shorter and I am able to fine tune the AV sync.
Thank you very much.
https://twitter.com/riraosan_0901/status/1555919578517360640?s=20&t=vFa028rg-ECdMa_7623h0A
from animatedgif.
Hi @riraosan,
You need to provide more info for me to help you. There are several strategies depending on the MCU and how much memory you have and what type of display you're using. For example, a worst case scenario is drawing frames with lots of transparent pixels directly onto a SPI LCD by repositioning the write pointer for each group of opaque pixels. With more info I'm sure I'll be able to help you.
from animatedgif.
Hi. @bitbank2
Thank you for your reply and advice.
I am using the following in my personal project :
MCU: ESP32-PICO-D4(M5Stack ATOM Lite)
https://www.espressif.com/sites/default/files/documentation/esp32-pico-d4_datasheet_en.pdf
Digital TV : NTSC(CVBS) ([email protected])
Drawing library : LovyanGFX(M5GFX)
CVBS library : ESP32_8BIT_CVBS using ESP_8_BIT_composite Library
My project
https://github.com/riraosan/ESP32_8BIT_CVBS/tree/master/sample/01_AnimatedGIF
GIF files
https://github.com/riraosan/ESP32_8BIT_CVBS/blob/master/sample/01_AnimatedGIF/data/non5.gif
My story
Objective
I want to synchronize background music and animated GIFs and play them on a digital TV. To achieve this, I want to skip GIF frames that have drawing delays at high speed.
My Problem
I could use LovyanGFX sprites to speed up the drawing very much. However, it took more than 50ms to draw one GIF animation frame with a WAIT of less than 50ms!
My solution
I manually thinned out the frames below 50ms
I incorporated a program to thin out the frames that are delayed in rendering. (using the Ramer-Douglas-Peucker algorithm).
However, my idea did not work.
I can't control the fine delay, so I can't synchronize the background music and the GIF animation by any means.
Other ideas
I thought about inlining the AnimatedGIF library like LovyanGFX, but I don't think I have the time or skills to do that, so I am second guessing myself.
This is my story. If you don't mind, can you give me some ideas?
I would appreciate any advice you could give me.
Thank you in advance.
from animatedgif.
https://youtu.be/LADcNpvA-8U
Finally, I was able to achieve this quality.
Thanks for your advise.
from animatedgif.
Related Issues (20)
- In ESP32_LEDMatrix_I2S.ino iWidth is not intialized. HOT 1
- Issue using AnimatedGIFPanel HOT 2
- Sketch is too big HOT 1
- a example for tft_espi sd gif HOT 15
- Question, How better write text over the GIF animation ? HOT 4
- Stop a GIF mid playing HOT 1
- How to display text on GIF for every frame HOT 2
- GIF not rendering properly HOT 1
- GIF Encoder HOT 3
- Unable to loop: GIF_EMTY_FRAME after call to reset() HOT 1
- The ucLZW buffer access violaton HOT 6
- What happens when there is no palette at all? HOT 1
- Ways to improve speed on esp32-s3 HOT 38
- Suggestion: gain a little more performance by engaging the non-aligned memory access. HOT 3
- Playing a custom GIF from memory HOT 1
- GIFs look scrambled on 72x40 OLED Display HOT 4
- Memory pointer GIFFILE::pData not const HOT 4
- Problem with shifting the image output point with tft_eSPI library HOT 1
- Possibility of change GIF speed HOT 2
- turbot_t_qt_example is missing allocFrameBuf() call HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from animatedgif.