-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
webm/theora/yuv2rgb/libsimplewebm: Fix colour issues I could find. #26051
Conversation
We usually do not modify thirparty libraries, and when we do, it is via patches or carefully delimited area. |
CC @zaps166 |
Ah, thank you. I'm a bit worried about upstream because the changes needed for handling the various different VP9 modes (including, say, the RGBA modes) essentially mean that libsimplewebm has to output RGBA for consistency between all the different flavours of VP9, which of course breaks API compatibility. It also means yuv2rgb becomes a dependency of libsimplewebm, at least the way I've set things up; I feel it'd be better if yuv2rgb was treated as shared code between both to reduce duplication, but that has other potential problems... |
modules/webm/video_stream_webm.cpp
Outdated
image.h = webm->getHeight(); | ||
image.data = w.ptr(); | ||
err = video->getImage(image); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiousity, what's with the extra set of { }
brackets in this section? The if
statement just above this already has its own {
opening bracket.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind, I misread the comment included at the beginning of this section. Woops!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't thing that simple webm library should convert the image. Almost every video uses YUV planar format, so it should be converted later, before displaying the image (especially on GPU e.g. via GLSL).
How fast is applying alpha? Isn't it slow for large video frames (depends on what compiler do with this)?
|
||
private: | ||
vpx_codec_ctx *m_ctx; | ||
const void *m_iter; | ||
int m_delay; | ||
int last_space; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int last_space; | |
int m_last_space; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'use YUV so GLSL can be later used' makes sense, but that means libsimplewebm will have to expose the RGB flag to Godot. Should I go with this? (It sounds like a solution that'll keep API compatibility, at least.)
If so, I'll PR directly to libsimplewebm. (Again, API compatibility seems like it'll be preserved with that solution, so a PR upstream is a non-issue.)
Also, as for applying alpha, it only matters if it's a format that supports alpha, and I've been having trouble making a WEBM file of that kind in the first place, so if I go through with this I'm dropping alpha support from the plan under untestability grounds.
With upstream now containing the necessary feature, should I have a separate PR for the thirdparty update, or should I perform it as part of this one? |
You can use this PR directly by rebasing it. Maybe make a first commit with only the sync from upstream (also update the hash documented in |
It appears 'OpusVorbisDecoder::getPCMF' is a function that for some reason has been removed or was not contributed to libsimplewebm...? |
@20kdc |
...Ok, so... getting the resulting diff shows there's a lot of unmarked changes. Biggest is that it looks like the
|
This is to get the colourspace information commit in, but it also performs a bit of cleanup regarding the entry in the thirdparty README. The reason libwebm wasn't synced is because it has a bunch of unmarked changes, and it'd be better if the person responsible untangled that as they may know what they did and why they did it. Given this, it might be a good idea to disconnect libwebm from the libsimplewebm code.
…ling. (Now clang-format friendly.) This should fix the various issues with colours in Ogg Theora and WEBM playback. (A reference project is attached to PR #26051, which this commit should be part of.) This version of the commit, rather than moving x->RGBA handling into libsimplewebm, uses a colourspace field added to libsimplewebm by a PR there. Thus, the commit that precedes this should be the synchronization & cleanup commit for that. Also, this version is now clang-format friendly. I hope.
...force-pushed again in line with the clang-format checker. |
So, er... should I do another rebase to keep up, or... I've lost track of what next to do here. |
@akien-mga hi |
Thanks! |
* [TileMapEditor] Improve tool picking usability When KEY_CONTROL is released, go back to the last tool. Also add a tooltip for paint button with shortcuts for line draw and rectangle paint. * Make buttons that trigger popups have the same scale * Make 'Line/TextEdit's context menus hide their editing options when in readonly mode Fixes godotengine#28243. * Renames captions of Scalar/VectorInterp in Visual Shaders * Warn when opening imported anim in AnimationPlayer * C#: Support resource type hint in exported arrays - Elements of types like PackedScene will display with the special editor for such type. * Fixed GLES2 transparency order * Added an is_valid function to FuncRef so script can check if it is safe to call it. * issue-28446 - disable higlighting all occurences of string in editor if only whitespaces are selected * Set range for line spacing * Fixed a few issues with the bezier animation track editor, fixed the Travis CI errors, added TTR to bezier value labels and rounded them to 3 decimal points * Add and expose to Font a function to get the rect size needed to draw a word-wraped text * Fix build error after godotengine#27294 * SCons: Always use env.Prepend for CPPPATH Include paths are processed from left to right, so we use Prepend to ensure that paths to bundled thirdparty files will have precedence over system paths (e.g. `/usr/include` should have lowest priority). * Properly expose PhysicsServer methods * Forgot a parameter in the ARVR gdnative bindings for notifications * Fix sign-compare error from godotengine#26051 * doc: Sync classref with current source * GridMap editor fixes and improvements This change fixes a few outstanding issues and greatly improves the usability of the GridMap editor through the following changes: - Copied mesh now gets displayed during pasting (also renamed the related identifiers accordingly) - Duplication/paste indicator now gets rotated around the correct pivot point (duplication worked properly before, but the indicator was shown misplaced when rotated) - Selected mesh library item cursor is no longer shown during selection and duplication/pasting - Back rotate X/Y/Z is now working during duplication/pasting - Added true cut operation thanks to now having a proper clipboard (clear operation got remapped to the DEL key) - Got rid of some weird workarounds in the duplication code - Fill and clear operations now correctly make the selection marker inactive as this was broken partly due to the workarounds mentioned above (duplication continues to keep the selection marker active to allow subsequent duplications) - Clear current selection on RMB, but treat selection as an action so previous selection can be restored on undo - Separated selection and paste indicator data as it's prone to error and confusion and it's anyway needed now that selection is treated as an action - Added support for cancelling paste, selection, and even unselect the currently selected mesh library item with the ESC key (previously there wasn't a way to unselect) - Changed the key binding of fill/clear/duplicate operations to use Ctrl as a modifier - Changed erase to use RMB instead of Shift+RMB (free look is available through Shift+F anyway, so no need to occupy RMB for it during gridmap editing) - Removed unused area, external connector, and configure menu items (there's also the non-functional clip mode menu items, but I'm not sure whether there are any plans with that, I suppose it's meant to be an editor aid) - Renamed INPUT_COPY to INPUT_PICK to better reflect its purpose - Added support for using Shift+Q and Shift+E to select multiple floors/planes without actually changing the current floor/plane as it happens when using e.g. the mouse wheel Fixes godotengine#25373 and godotengine#15883 * Fix script dialog path validation to handle spaces correctly * fixes bug when setting projection matrix * Make "decimal" functions more consistent In GDScript, rename "decimals" to "step_decimals". In C#, add "StepDecimals", but keep the old functionality in a method called "DecimalCount". * Fix missing argument for vsnprintf_s * fixes 27543, adds a copy button for the editor log * Fix regression on 'PopupMenu's minimal size * Fixed game crash, regression of godotengine#26977 Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com> * Small documentation improvements * Fix pvrtc encoder Always resize image to square of power2 Enable mipmaps only if original texture has it enabled Fix godotengine#28534, godotengine#28541 * Support Mac OS default move cursor hotkeys Add missing FALLTHROUGH define * Fix Remove Missing Project projects on Windows * Revert "Update libwebsockets to 3.1 (plus UWP patch)" This reverts commit 90210c4. * Added missed inputs for other modes in visual shaders * Change order of Visual Script Search. Previously: * vs nodes * properties * methods Now: * properties * methods * vs nodes * VS: Better ux * In VS functions' put the current node type first. * Cleanup and merge property and method sections. * VS: Give the generic search the current base type. * Freetype clone env for no-SMID single file Fix freetype build issue for javascript platform. When disabling optimizations (SMID) in specific freetype, source files, we need to make sure to copy all other CPPFLAGS, not just override them. * Fix First Ctrl+R and Ctrl+F not showing long name variables correctly * Add a property hint for DynamicFont size This caps its size to reasonable values in the Inspector. This closes godotengine#22581. * Fix input entries when switching to new visual shader * Locales: Add some missing locale names * Ignore a warning in _get_socket_error (-Wlogical-op). drivers/unix/net_socket_posix.cpp: In member function 'NetSocketPosix::NetError NetSocketPosix::_get_socket_error()': drivers/unix/net_socket_posix.cpp:197:22: warning: logical 'or' of equal expressions [-Wlogical-op] 197 | if (errno == EAGAIN || errno == EWOULDBLOCK) | ^ and: modules/mono/utils/string_utils.cpp: In function 'int {anonymous}::sfind(const String&, int)': modules/mono/utils/string_utils.cpp:68:48: error: logical 'or' of collectively exhaustive tests is always true [-Werror=logical-op] found = src[read_pos] == 's' || (c >= '0' || c <= '4'); ~~~~~~~~~^~~~~~~~~~~ * Fix typed arrays and dictionaries getting their values shared * Document CollisionObject2D pickable requires collision_layer Documents CollisionObject2D mouse_entered, mouse_exited and input_event requiring at least one collision_layer to be set. * Fix slight issues with autocompletion and member lists in GDScript Fixes godotengine#27152 Fixes godotengine#28591 * Fix regression in 'PopupMenu' when icons have different values for width and height * Fix script dialog asking for correct inheritance when not needed * Make small changes to the script dialog * Add "disabled" icon for 'CheckButton' * Hide "Built-in Script" option in the script creation dialog when not possible * Fix Mac OS move cursor behaviour * added MSAA to GLES backend * Make "Find in Files" always available in the script editor * Fix build visual_shader_editor_plugin * Remove unused `panelf` and `panelnc` styles Fixes godotengine/godot-docs#2426 * Fix collapse visual shader tree * Fix navmesh not finding optimal paths Addresses part of godotengine#17885 * Update of RigidBody2D class description Added a hint in the RigidBody2D class description regarding the transformation issue mentioned in godotengine#5734 * Make 'TabContainer' update when icon/title is changed Fixes godotengine#28655. * Fixes VideostreamGDNative crash on audio_channel=0. Added an if case to check if the mix_callback exists before running any of the audio code. Fixes: godotengine#28644 * Support Mac OS default delete char hotkeys * Document dictionary erase return value * Fix ParallaxBackground breaking when moving it out the scene tree * fix CollisonShape changing shape cause crash when not in a tree * Fix generation of Mono Glue for Visual Studio 2017+ vsnprintf definition should only be changed when MSC version is older than 2013. The version check and fix is taken from StringUtils.h of assimp. * Fix 'TabContainer' not updating its tab titles when locale is changed * Make editor close empty scene when creating an inherited one Fixes godotengine#28654. * Update AUTHORS and DONORS list New contributors added to AUTHORS: @Kanabenki, @KoBeWi Thanks to all contributors and donors for making Godot possible! * Remove reduz from some autorequested code reviews He's still one of the main architects of some of these code branches, but quite often PRs that modify one or two files in such folders don't necessarily need his input, and he has enough backlog to handle. PR triagers will ask for his review manually whenever relevant. He's left as code owner for physics/visual servers and rendering backends. * Center shape according to logic Bullet applies * Add transform support to deal with Bullets centering of shapes * Fix SHADOWS_DISABLED flag in GLES2 Signed-off-by: Guilherme Souza <gdsdsilva@inf.ufpel.edu.br> * Improved the AnimatedSprite docs; added description to speed_scale. * Revert "Merge pull request godotengine#28715 from YeldhamDev/inherent_scene_close_empty" This reverts commit 0f8356d, reversing changes made to 7b7a664. * Change empty scene closing on new inherented scene to a better approach * Fix texture resource reload bug If a non-imported texture resource file (e.g. DDS) gets updated the editor doesn't reload it. The cause of the problem is two-fold: First, the code of ImageTexture assumes that textures are always imported from an image, but that's not the case for e.g. DDS. This change thus adds code to issue a resource reload in case an image reload is not possible (which is the case for non-imported texture resources). Second, the code is filled with bogus calls to Image::get_image_data_size() to determine the mipmap offset when that should be done using Image::get_image_mipmap_offset(). Previous code literally passed the integer mip level value to Image::get_image_data_size() where that actually expects a boolean. Thus this part of the change might actually solve some other issues as well. To be pedantic, the texture_get_data() funciton of the rasterizer drivers is still quite a mess, as it only ever returns the whole mipchain when GLES_OVER_GL is set (practically only on desktop builds) but this change does not attempt to resolve that. * Docs: Add tutorials for KinematicBody2D * Revert "Merge pull request godotengine#26053 from qarmin/back_scroll_to_start" This reverts commit b5deb1d, reversing changes made to 2cc8848. This change causes unwanted regression. It's too risky to have scroll back to top in ItemList.clear() * Scroll back to top when changing directory in FileSystem dock Fix godotengine#26041 * [EditorSpatialGizmo] Fix error in intersect_ray * Avoid _can_call_mode resetting error message in MultiplayerAPI * Change "ID" to lowercase "id" Reasoning: ID is not an acronym, it is simply short for identification, so it logically should not be capitalized. But even if it was an acronym, other acronyms in Godot are not capitalized, like p_rid, p_ip, and p_json. * Fix AudioEffectRecord messing up the effect stack by not writing to dst_frames * X11: Check if "_NET_FRAME_EXTENTS" atom is supported. * Fixes to ClippedCamera This work has been kindly sponsored by IMVU. * Allow or_greater for most properties of NavMesh Closes godotengine#28624 * Open selected folder when pressing the "Open" option in the menu An attempt to fix godotengine#28798 * Add RegEx substitution testcase and fix relevant docs (cherry picked from commit a31bbb4) * Make possible to create inherited scenes via the RMB menu in the FileSystem dock * Fix orientation of generated navmeshes Fixes godotengine#23817 * Apply sprite frames editor FPS value correctly upon _animation_select * updated description of Array.shuffle to properly describe that it uses the same common seed at every runtime, thus being reproducible in general * AnimatedSprite: Add from spritesheets now work as expected. Fix godotengine#28030 * Better handle some self-RSET/RPC in MultiplayerAPI Allow calling yourself via RPC/RSET if the mode allows it. Better error messages when you are not allowed to call yourself. * Fix GDNative library resource loading. Store general properties in ConfigFile too when modifying them. Additionally set config_file property as internal as it's not editable from inspector. It also does not appear to get saved in a meaningful way (saved as Object(ConfigFile, ...)) * added radiance when using clear color and fixed brdf * Properly update script button when undoing a script addition Fixes godotengine#28870. * Improve the CanvasItem documentation This makes it clear that line width and antialiasing in `draw_multiline()` aren't implemented yet (see godotengine#16448). * Make Xcode recursive search frameworks in project dir * fix lighting bug introduced in clear color changes * Fix NaN with get_action_strength * doc: Sync classref with current source * doc: Fix issues found by the parser * Update GDNativeLibrarySingletonEditor. Moved GDNative singletons discoverer from register_types to GDNativeSingletonEditor. Fix enable/disable switch in GDNativeLibrarySingletonEditor. Separate `gdnative/singletons` and `gdnative/singletons_disabled` project settings, keeping "on by default" behavior. * Fix OS_Javascript execute method Signature was changed in OS via: cd4449e * Fix indexing failure in NativeScriptLanguage::unregister_binding_functions. binding_functions.size() and an instance's binding_data.size() can get out of sync. They sync up when an instance's bindings are requested. When binding functions are registered after creating an instance's bindings, the instance's bindings are out of sync until requested again. If they're never requested, they're never synced. unregister_binding_functions indexes into binding_data, but only checks that its safe to index into binding_functions. When they're out of sync, indexing fails. This revision checks that it's safe to index into binding_data. * Fix OS_UWP::execute's signature after cd4449e Same as godotengine#28919. * Revert "Revert "Implemented terrain raycast acceleration""
Modifies yuv2rgb to remove endian-dependency in one of the functions, correctly orders RGBA, and deduplicates the macros.
The Theora and WEBM video players, rather than using reordered UV inputs to fix the yuv2rgb issue (which produces some distortion), now use the correct YUV order, since yuv2rgb is outputting correctly.
Modifies libsimplewebm to output RGBA so it can support the full range of RGBA formats in future.
libsimplewebm is now dependent on yuv2rgb as a result.
NOTE: This is by no means a complete solution for all WEBM formats.
The library is still limited to planar formats.
The following test project contains the WEBM and Theora files I made for testing.
They display correctly in VLC, so I am assuming they are correct.
VideoColourLab.zip
It'd be a good idea to test this on more WEBM files before continuing.
Additional note: The side effects shown when U/V gets swapped suggests issue 18208 may be caused by this, but don't rely on it.
Here's the screenshots from v3.1-beta4, Arch Linux x86_64:
(To my knowledge, master looks the same. This PR shows them all correctly, but of course that's my own test-cases, so please do test with more WEBMs.)