ffmpeg: optimize ffmpeg_postprocess #116309
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#116309
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "aras_p/blender:ffmpeg-threaded-decode-conv"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
After doing regular movie frame decoding, there's a "postprocess" step for each incoming frame, that does deinterlacing if needed, then YUV->RGB conversion, then vertical image flip and additional interlace filtering if needed. While this postprocess step is not the "heavy" part of movie playback, it still takes 2-3ms per each 1080p resolution input frame that is being played.
This PR does two things:
sws_scale
to do YUV->RGB conversion.2ed73fc97e
due to issues on arm64 platform, and theory that negative strides passed to sws_scale is not an officially supported usage.My take on the last point: negative strides to sws_scale is a fine and supported usage, just ffmpeg had a bug specifically on arm64 where they were accidentally not respected. They fixed that for ffmpeg 6.0, and backported it to all versions back to 3.4.13 -- you would not backport something to 10 releases unless that was an actual bug fix!
I have tested the
glitch_480p.mp4
that was originally attached to the bug report #94237 back then, and it works fine both on x64 (Windows) and arm64 (Mac).Timings,
ffmpeg_postprocess
cost for a single 1920x1080 resolution movie strip inside VSE:@blender-bot build
WIP: ffmpeg: optimize ffmpeg_postprocessto ffmpeg: optimize ffmpeg_postprocessMaybe not heaviest part, but 8K playback downscaled to 1080p is 25fps vs 11fps. Pretty good IMO. Or 9fps vs 6fps at original resolution.
@ -75,1 +77,4 @@
SwsContext *BKE_ffmpeg_sws_get_context(
int width, int height, int av_src_format, int av_dst_format, int sws_flags);
void BKE_ffmpeg_sws_scale_frame(SwsContext *ctx, AVFrame *dst, const AVFrame *src);
I am bit sad, that you can't use
AVPixelFormat
type. You should be able to add include file with the type toBKE_writeffmpeg.hh
but it says, that it can't find the file, which is weird to me.That's because at least
blenloader
library that includesBKE_writeffmpeg.hh
does not setup FFMPEG include directories for itself. I'd rather keep it that way, i.e. sure it would be nicer to useAVPixelFormat
here, but the downside is that any users of this header file would now need to take care of setting up FFMPEG directories. Sounds like a larger hassle.Thanks for checking this. IMO
FFMpegCodecData::type
enum belongs to DNA. I would say, that BLO code should have no business caring about libs we build with, unless it uses them to process some data.