-
Notifications
You must be signed in to change notification settings - Fork 278
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
Fix none double scaling #797
base: develop
Are you sure you want to change the base?
Conversation
Note that the Clip::Reader() setter also needs to set the reader_type, but every time I tried to run this the QtImageReader or FFmpegReader passed to the clip is replaced by a FrameMapper by the time the scaling occurs so the image/video is always scaled twice. See: https://github.com/OpenShot/libopenshot/pull/797/files#diff-915ea951ee9b3b1e674b479f5b0f014be1a80f95268a021cbac74906d70c4518R270 |
Codecov Report
@@ Coverage Diff @@
## develop #797 +/- ##
===========================================
+ Coverage 48.97% 49.00% +0.02%
===========================================
Files 184 184
Lines 15702 15712 +10
===========================================
+ Hits 7690 7699 +9
- Misses 8012 8013 +1
Continue to review full report at Codecov.
|
*sigh* There is so much scaling littered throughout the code. For the record, I personally believe much of the ad-hoc scaling is unnecessary, even misguided. (Particularly in FFmpegReader, which employs FFmpeg's swscale algorithms — algorithms designed and geared towards the scaling of
|
The other issue here, now that I think about it, is that There are two problems with that:
IMHO the "parent Clip", "parent Timeline" stuff in the Readers is still upside-down. It's not as bad as Settings::max_width / max_height was, but it's still overcomplicating the wrong things for the wrong reasons. If we want to retrieve scaled frames from Readers, then
The dimension-accepting I still feel like that would work out better for all libopenshot users — including OpenShot, which mostly wouldn't really have to worry about it anyway. It's OpenShot would just need to supply Timeline with both its target profile dimensions (the "real" output size), and either its current preview dimensions, or just a single floating-point multiplier for the real dimensions. Either of the latter options would be updated whenever the preview resizes, but the former wouldn't. Currently |
@jeffski When I pulled this code and tested with it, I wasn't seeing a difference when I loaded an image and scaled it under different settings, and compared that to the develop branch. Here's what I found: |
@JacksonRG - Is that a QtImageReader handling that image? Does it work with an FfmpegReader video file>? I checked ImageReader and it doesn't seem to have any scaling going on. Only QtImageReader and FfmpegReader are currently skipped from the 2nd scale as other Readers need it. I'm nor familiar with the front end, just the library. |
Thanks @ferdnyc for your extensive analysis. Sounds like an extensive task to try and refactor and optimise all of that. |
@jeffski Oops, I'll put a |
@jeffski I took another stab at testing this. Taking screenshot at a list of scale settings ( |
Just having another look at this issue as this patch seems to introduce a new issue anyway - for some reason when @JacksonRG - I'm not familiar with how the OpenShot GUI works as I only use the library, but here is some code to recreate and test the issue using just the library:
|
Merge conflicts have been detected on this PR, please resolve. |
This PR attempts to resolve the following issue: #754
There is a problem where QtImageReader and FFmpegReader scale the image or video. The scaling is then done again in the Clip. When the scale type is set to SCALE_NONE, the image or video appears to be scaled twice when it shouldn't be scaled. The issue description demonstrates this.
Also note that other readers, like QtHtmlReader, TextReader, etc.. do not have any scaling functionality so the scaling in the Clip still needs to be applied.
The new code adds a check to see if the scale type is SCALE_NONE and the reader type is QtImageReader or FFmpegReader. If so, it skips the scaling step.
The code resolves the issue but not sure if this is the best approach or the code is particularly clean. It might highlight the issue and give clues to where this could be improved.