Commit Graph

1994 Commits

Author SHA1 Message Date
wm4 3823d5eb7e vo_rpi: explicitly reference MMAL VC driver
This is optional, but ensures that linking with -Wl,--as-needed does
not drop the MMAL VC driver. The driver normally "registers" itself
in the library constructor, but since no symbols are explicitly
referenced, the linker could remove it with as-needed enabled.
2015-04-13 18:35:18 +02:00
Marcin Kurczewski f43017bfe9 Update license headers
Signed-off-by: wm4 <wm4@nowhere>
2015-04-13 12:10:01 +02:00
wm4 544c56bf22 vo_opengl: slightly simplify check_gl_features()
Not sure why this was so roundabout; probably to keep spam down if the
user's OpenGL drivers are crap (but then just don't enable extended
features), or because the "Disabling..." text was so repetitious.

But there doesn't seem to be a good reason after all. Also, this could
already overflow the fixed size disabled[] array. Just print the
messages directly.
2015-04-11 19:24:54 +02:00
wm4 2b679020f7 vo_opengl: unify blend-subtitles-res and blend-subtitles 2015-04-11 19:22:10 +02:00
wm4 3bfdc20aa1 vo_opengl: fix blend-subtitles-res=video & anamorphic video
Since scaling the video changes the aspect ratio, we have to compensate
for this when rendering subtitles.
2015-04-11 15:53:00 +02:00
Niklas Haas 6f46bafbd0
vo_opengl: add blend-subtitles-res
This can be used to draw the subtitles at the video's native res, which
can make them look more natural and increases performance.
2015-04-10 22:22:55 +02:00
wm4 37a71e57d4 mp_image: remove redundant flags field
Because gcc (and clang) is a goddamn PITA and unnecessarily warns if
the universal initializer for structs is used (like mp_image x = {})
and the first member of the struct is also a struct, move the w/h
fields to the top.
2015-04-10 21:06:25 +02:00
wm4 41151122e7 mp_image: remove redundant chroma_x/y_shift fields 2015-04-10 21:02:16 +02:00
wm4 b3495d9ccf mp_image: remove redundant plane_w/h fields
Seems relatively painful in this case, but they are morally wrong.
2015-04-10 20:58:26 +02:00
wm4 6efd095dfd vo_opengl: use correct texture coordinates for nv12 2015-04-10 19:10:07 +02:00
wm4 8fe640c47d mp_image: fix build 2015-04-09 21:46:28 +02:00
wm4 be259be15c mp_image: get rid of chroma_width/height fields
They are redundant. They were used by draw_bmp.c only, and only in a
special code path that 1. used fixed image formats, and 2. had image
sized perfectly aligned to chroma boundaries (so computing the chroma
width/height is trivial).
2015-04-09 21:11:20 +02:00
wm4 d737939f1f screenshots: drop some useless jpeg writer options 2015-04-09 21:05:26 +02:00
wm4 8d3c826ad8 screenshots: write jpg files with original subsampling
A screenshot from a 4:2:0 video will use 4:2:0, RGB will use 4:4:4, and
so on. (The image data still goes through RGB conversion always.)
2015-04-09 21:01:34 +02:00
Avi Halachmi (:avih) 843bc822a8 opengl: win32 - add option 'dwmflush' to sync in DWM
This could help in cases where the DWM (Windows desktop compositor) adds another
layer of bufferring and therefore the SwapBuffers timing could get messed up.

Signed-off-by: wm4 <wm4@nowhere>
2015-04-09 20:36:35 +02:00
Avi Halachmi (:avih) c97f014576 opengl: smoothmotion: wake up for next vsync a bit earlier
on my windows system this allows smoothmotion to work perfectly also in windowed
mode. There's no real right or wrong here, with the the only goal being to
always hit the next vsync. however, on cases where vsync timing is jittery (as
could happen with DWM), this patch tries to aim to the middle of the vsync cycle
to get as least affected as possible by such jitter.
2015-04-09 20:34:56 +02:00
Avi Halachmi (:avih) f1746741de opengl: drop less frames when clip and display have similar fps
adds 1 vsync interval "slack" before deciding to drop the first frame. it should
help on cases of timing jitter (sleep duration, container timestamps, compositor
vsync timing, etc). once the drop threshold has been crossed, it will keep
dropping until perfect timing alignment. this prevents crossing the drop
threshold back and forth repeatedly and therefore more resilient to frame drops
2015-04-09 20:34:56 +02:00
wm4 e76f6929e5 vo_opengl_cb: deprecate mpv_opengl_cb_render()
Its vp parameter made no sense anymore. Introduce a new one.
2015-04-09 19:31:01 +02:00
wm4 8dc7156bc0 vo_opengl_cb: add a function to report vsync time
And also let vo.c know of it.

Currently, this does not help much, but will facilitate future
improvements.
2015-04-09 19:30:26 +02:00
wm4 4e8ee522f4 vo_opengl_cb: fix video timing somewhat
Increase the default queue size. This helps with "missed" frames due to
the asynchronous nature of the API. All the other VOs are synchronous,
so if rendering and displaying takes a while, the common code in vo.c
will be blocked until it can continue. But with opengl-cb, vo.c might
immediately push the next ready frame, which causes the current frame
to be dropped _if_ it wasn't rendered yet.

One could fix this by making vo.c wait a while (until the API user calls
the render function, which pulls the frame). But setting the default
queue size to 2 seems much simpler: instead of dropping the frame, it
will be pushed to the API user once the next renderer call finishes.

(This is still a bit strange, and will hopefully be cleaned up when
video scheduling is redone, but for now this appears to deliver
relatively good results.)
2015-04-09 19:22:54 +02:00
wm4 11556e0530 vo_opengl: log used GLXFBConfig
Now don't ask me why the GLXFBConfig type is a pointer, but stores an
integer ID.
2015-04-09 14:38:43 +02:00
wm4 db7d56b19f vo_opengl: remove unused function 2015-04-09 14:37:37 +02:00
wm4 f6b2325c2a video/out: fix screenshot image formats
Use variants without alpha.

I skipped vo_sdl, because format selection seems a bit more complicated
here, and nobody cares about vo_sdl anymore.
2015-04-07 11:43:03 +02:00
wm4 efae88e521 vdpau: don't use a transparent image format for screenshots
Fixes #1779.
2015-04-07 10:18:48 +02:00
wm4 7d116a979b screenshots: select best image format the encoder supports
This matters for png screenshots. We used to hardcode rgb24, but
libavformat's png encoder can do much more. Use the image format list
provided by the encoder, and select the best format from it (according
to the source format).

As a consequence, rgb48 (i.e. 16 bit per component) will be selected if
the source format is e.g. 10 bit yuv. This happens in accordance to
FFmpeg's avcodec_find_best_pix_fmt_of_list() function, which assumes
that 16 bit rgb should be preferred for 10 bit yuv.

This also causes it to print this message in this case:

[ffmpeg] swscaler: full chroma interpolation for destination format 'rgb48be' not yet implemented

I'm not 100% sure whether this is a problem.
2015-04-06 20:34:50 +02:00
wm4 a18dc01655 vaapi: fight with Intel's broken video decoding GL interop
Use texture-from-pixmap instead of vaapi's "native" GLX support.
Apparently the latter is unused by other projects. Possibly it's broken
due that, and Intel's inability to provide anything non-broken in
relation to video.

The new code basically uses the X11 output method on a in-memory pixmap,
and maps this pixmap as texture using standard GLX mechanisms. This
requires a lot of X11 and GLX boilerplate, so the code grows. (I don't
know why libva's GLX interop doesn't just do the same under the hood,
instead of bothering the world with their broken/unmaintained "old"
method, whatever it did. I suspect that Intel programmers are just
genuine sadists.)

This change was suggested in issue #1765.

The old GLX support is removed, as it's redundant and broken anyway.

One remaining issue is that the first vaPutSurface() call fails with an
unknown error. It returns -1, which is pretty strange, because vaapi
error codes are normally positive. It happened with the old GLX code
too, but does not happen with vo_vaapi. I couldn't find out why.
2015-04-05 22:48:40 +02:00
Niklas Haas 717e7a5baa vf_format: add gamma override option 2015-04-04 15:48:38 +02:00
Niklas Haas 51bb5e8194 vo_opengl: make csp options consistent with vf_format 2015-04-04 15:47:23 +02:00
Niklas Haas bfbe1342f7
csputils: add some missing colorspaces
With target-prim and target-trc it makes sense to include some common
colorspaces that aren't strictly speaking used for video.
2015-04-04 15:47:14 +02:00
Niklas Haas b51ff8702b vo_opengl: minor cleanup of gamma-related functions 2015-04-04 15:41:15 +02:00
Niklas Haas 27d57af450 vo_opengl: blend-subtitles in non-linear light 2015-04-04 15:41:15 +02:00
Niklas Haas 8876572e2c
vo_opengl: make jinc presets resizable
No real reason this is disabled with the new configuration API.
2015-04-04 15:36:26 +02:00
Niklas Haas 34caa8b01c vo_opengl: add scale-wparam option
This lets us tune the window parameter
2015-04-04 15:36:14 +02:00
Niklas Haas 6bd673c1d2 filter_kernels: add haasnsoft
This is a peculiar filter I stumbled upon while playing around with
windows, it removes aliasing almost completely while not ringing at all.
The downside is that it's quite blurry, but at high resolutions it's not
so noticeable.
2015-04-04 15:36:14 +02:00
Niklas Haas 1984e31706 filter_kernels: remove hermite window
Will have to find a source before re-adding.
2015-04-04 15:36:14 +02:00
Niklas Haas 13efec228b filter_kernels: add bartlett, blackman and welch windows 2015-04-04 15:36:14 +02:00
Niklas Haas 068ff812e4 vo_opengl: refactor scaler configuration
This merges all of the scaler-related options into a single
configuration struct, and also cleans up the way they're passed through
the code. (For example, the scaler index is no longer threaded through
pass_sample, just the scaler configuration itself, and there's no longer
duplication of the params etc.)

In addition, this commit makes scale-down more principled, and turns it
into a scaler in its own right - so there's no longer an ugly separation
between scale and scale-down in the code.

Finally, the radius stuff has been made more proper - filters always
have a radius now (there's no more radius -1), and get a new .resizable
attribute instead for when it's tunable.

User-visible changes:

1. scale-down has been renamed dscale and now has its own set of config
   options (dscale-param1, dscale-radius) etc., instead of reusing
   scale-param1 (which was arguably a bug).

2. The default radius is no longer fixed at 3, but instead uses that
   filter's preferred radius by default. (Scalers with a default radius
   other than 3 include sinc, gaussian, box and triangle)

3. scale-radius etc. now goes down to 0.5, rather than 1.0. 0.5 is the
   smallest radius that theoretically makes sense, and indeed it's used
   by at least one filter (nearest).

Apart from that, it should just be internal changes only.

Note that this sets up for the refactor discussed in #1720, which would
be to merge scaler and window configurations (include parameters etc.)
into a single, simplified string. In the code, this would now basically
just mean getting rid of all the OPT_FLOATRANGE etc. lines related to
scalers and replacing them by a single function that parses a string and
updates the struct scaler_config as appropriate.
2015-04-04 15:36:14 +02:00
Niklas Haas 586dc5574f vo_opengl: separate kernel and window
This makes the core much more elegant, reusable, reconfigurable and also
allows us to more easily add aliases for specific configurations.

Furthermore, this lets us apply a generic blur factor / window function
to arbitrary filters, so we can finally "mix and match" in order to
fine-tune windowing functions.

A few notes are in order:

1. The current system for configuring scalers is ugly and rapidly
   getting unwieldy. I modified the man page to make it a bit more
   bearable, but long-term we have to do something about it; especially
   since..

2. There's currently no way to affect the blur factor or parameters of
   the window functions themselves. For example, I can't actually
   fine-tune the kaiser window's param1, since there's simply no way to
   do so in the current API - even though filter_kernels.c supports it
   just fine!

3. This removes some lesser used filters (especially those which are
   purely window functions to begin with). If anybody asks, you can get
   eg. the old behavior of scale=hanning by using
   scale=box:scale-window=hanning:scale-radius=1 (and yes, the result is
   just as terrible as that sounds - which is why nobody should have
   been using them in the first place).

4. This changes the semantics of the "triangle" scaler slightly - it now
   has an arbitrary radius. This can possibly produce weird results for
   people who were previously using scale-down=triangle, especially if
   in combination with scale-radius (for the usual upscaling). The
   correct fix for this is to use scale-down=bilinear_slow instead,
   which is an alias for triangle at radius 1.

In regards to the last point, in future I want to make it so that
filters have a filter-specific "preferred radius" (for the ones that
are arbitrarily tunable), once the configuration system for filters has
been redesigned (in particular in a way that will let us separate scale
and scale-down cleanly). That way, "triangle" can simply have the
preferred radius of 1 by default, while still being tunable. (Rather
than the default radius being hard-coded to 3 always)
2015-04-04 15:36:13 +02:00
wm4 8fbc64f74e vf_format: allow forcing aspect ratio
Makes vf_dsize completely useless. Unfortunately, even our "official"
encoding profiles still use it.
2015-04-03 00:14:45 +02:00
wm4 8585845c64 vf_format: allow forcing display size 2015-04-03 00:13:41 +02:00
wm4 3d17b12d9c vo_opengl: remove chroma-location suboption
Terribly obscure, and vf_format can do this for all VOs.
2015-04-03 00:12:32 +02:00
wm4 28fa17dac6 vf_format: allow forcing rotation flags 2015-04-03 00:12:30 +02:00
wm4 14a530f474 vf_format: allow forcing stereo mode parameters 2015-04-03 00:11:10 +02:00
wm4 5a2825ec35 video: cleanup stereo mode parsing
Use OPT_CHOICE_C() instead of the custom parser. The functionality is
pretty much equivalent.

(On a side note, it seems --video-stereo-mode can't be removed, because
it controls whether to "reduce" stereo video to mono, which is also the
default. In fact I'm not sure how this should be handled at all.)
2015-04-02 23:54:08 +02:00
Dan Oscarsson 33d587ffa9 vdpau: fix preemption handling
Signed-off-by: wm4 <wm4@nowhere>
2015-03-31 14:48:34 +02:00
wm4 8f0f73e591 video/out: remove unused colorspace reporting
Rarely used and essentially useless. The only VO for which this was
implemented correctly and for which this did anything was vo_xv, but you
shouldn't use vo_xv anyway (plus it support BT.601 only, plus a vendor
specific extension for BT.709, whose presence this function essentially
reported - use xvinfo instead).
2015-03-31 00:09:03 +02:00
wm4 27715b7dd1 video: move colorspace overrides to vf_format, simplify
Remove the colorspace-related top-level options, add them to vf_format.
They are rather obscure and not needed often, so it's better to get them
out of the way. In particular, this gets rid of the semi-complicated
logic in command.c (most of which was needed for OSD display and the
direct feedback from the VO). It removes the duplicated color-related
name mappings.

This removes the ability to write the colormatrix and related
properties. Since filters can be changed at runtime, there's no loss of
functionality, except that you can't cycle automatically through the
color constants anymore (but who needs to do this).

This also changes the type of the mp_csp_names and related variables, so
they can directly be used with OPT_CHOICE. This probably ended up a bit
awkward, for the sake of not adding a new option type which would have
used the previous format.
2015-03-31 00:09:03 +02:00
wm4 273afdc3a4 vf_format: don't crash if nonsense parameters are passed
It was "by design" possible to make mpv crash if the parameters didn't
make enough sense, like "format=rgb24:yuv420p". While forcing the format
has some minor (rather questionable) use for debugging, allowing it to
crash is just stupid.
2015-03-31 00:09:03 +02:00
wm4 1164dc572c vf_format: by default, pass through video without change
Instead of forcing a useless format (packed YUV??) by default.

Also cleanup.
2015-03-31 00:09:03 +02:00
wm4 205a2ef169 csputils: unify names for colorspace/etc. names 2015-03-31 00:09:03 +02:00