mirror of
https://github.com/mpv-player/mpv
synced 2025-01-31 04:02:06 +00:00
586dc5574f
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)
106 lines
3.5 KiB
C
106 lines
3.5 KiB
C
/*
|
|
* This file is part of mpv.
|
|
*
|
|
* mpv is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* mpv is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with mpv. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
#ifndef MP_GL_VIDEO_H
|
|
#define MP_GL_VIDEO_H
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include "options/m_option.h"
|
|
#include "sub/osd.h"
|
|
#include "gl_common.h"
|
|
|
|
struct lut3d {
|
|
uint16_t *data;
|
|
int size[3];
|
|
};
|
|
|
|
struct gl_video_opts {
|
|
char *scalers[3];
|
|
char *dscaler;
|
|
float gamma;
|
|
int gamma_auto;
|
|
int target_prim;
|
|
int target_trc;
|
|
float scaler_params[3][2];
|
|
float scaler_blur[3];
|
|
float scaler_radius[3];
|
|
float scaler_antiring[3];
|
|
char *scaler_window[3];
|
|
int linear_scaling;
|
|
int fancy_downscaling;
|
|
int sigmoid_upscaling;
|
|
float sigmoid_center;
|
|
float sigmoid_slope;
|
|
int scaler_resizes_only;
|
|
int npot;
|
|
int pbo;
|
|
int dither_depth;
|
|
int dither_algo;
|
|
int dither_size;
|
|
int temporal_dither;
|
|
int fbo_format;
|
|
int alpha_mode;
|
|
int chroma_location;
|
|
int use_rectangle;
|
|
struct m_color background;
|
|
int interpolation;
|
|
int blend_subs;
|
|
};
|
|
|
|
extern const struct m_sub_options gl_video_conf;
|
|
extern const struct gl_video_opts gl_video_opts_hq_def;
|
|
extern const struct gl_video_opts gl_video_opts_def;
|
|
|
|
struct gl_video;
|
|
|
|
struct gl_video *gl_video_init(GL *gl, struct mp_log *log);
|
|
void gl_video_uninit(struct gl_video *p);
|
|
void gl_video_set_osd_source(struct gl_video *p, struct osd_state *osd);
|
|
void gl_video_set_options(struct gl_video *p, struct gl_video_opts *opts,
|
|
int *queue_size);
|
|
bool gl_video_check_format(struct gl_video *p, int mp_format);
|
|
void gl_video_config(struct gl_video *p, struct mp_image_params *params);
|
|
void gl_video_set_output_depth(struct gl_video *p, int r, int g, int b);
|
|
void gl_video_set_lut3d(struct gl_video *p, struct lut3d *lut3d);
|
|
void gl_video_skip_image(struct gl_video *p, struct mp_image *mpi);
|
|
void gl_video_upload_image(struct gl_video *p, struct mp_image *img);
|
|
void gl_video_render_frame(struct gl_video *p, int fbo, struct frame_timing *t);
|
|
void gl_video_resize(struct gl_video *p, int vp_w, int vp_h,
|
|
struct mp_rect *src, struct mp_rect *dst,
|
|
struct mp_osd_res *osd);
|
|
void gl_video_get_colorspace(struct gl_video *p, struct mp_image_params *params);
|
|
struct mp_csp_equalizer;
|
|
struct mp_csp_equalizer *gl_video_eq_ptr(struct gl_video *p);
|
|
void gl_video_eq_update(struct gl_video *p);
|
|
|
|
void gl_video_set_debug(struct gl_video *p, bool enable);
|
|
void gl_video_resize_redraw(struct gl_video *p, int w, int h);
|
|
|
|
float gl_video_scale_ambient_lux(float lmin, float lmax,
|
|
float rmin, float rmax, float lux);
|
|
void gl_video_set_ambient_lux(struct gl_video *p, int lux);
|
|
|
|
void gl_video_set_gl_state(struct gl_video *p);
|
|
void gl_video_unset_gl_state(struct gl_video *p);
|
|
void gl_video_reset(struct gl_video *p);
|
|
bool gl_video_showing_interpolated_frame(struct gl_video *p);
|
|
|
|
struct gl_hwdec;
|
|
void gl_video_set_hwdec(struct gl_video *p, struct gl_hwdec *hwdec);
|
|
|
|
#endif
|