1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-07 23:51:49 +00:00
mpv/video/out/gpu/lcms.h
Niklas Haas 40de03fdba vo_gpu: vo_gpu_next: support --icc-3dlut-size=auto
And make it the default. In libplacebo, this uses internal heuristics to
pick a good size based on the actual ICC characteristics. This is
significantly less wasteful than always generating a 64x64x64 3DLUT (the
old status quo).

In vo_gpu, for simplicity, just default to 65x65x65. Note that this
provides slightly better accuracy than the old default of 64x64x64 for
technical reasons, and matches what libplacebo defaults to for typical
display profiles.
2023-09-15 10:58:37 +02:00

62 lines
1.6 KiB
C

#ifndef MP_GL_LCMS_H
#define MP_GL_LCMS_H
#include <stddef.h>
#include <stdbool.h>
#include "misc/bstr.h"
#include "video/csputils.h"
#include <libavutil/buffer.h>
extern const struct m_sub_options mp_icc_conf;
struct mp_icc_opts {
bool use_embedded;
char *profile;
bool profile_auto;
bool cache;
char *cache_dir;
char *size_str;
int intent;
int contrast;
bool icc_use_luma;
};
struct lut3d {
uint16_t *data;
int size[3];
};
struct mp_log;
struct mpv_global;
struct gl_lcms;
struct gl_lcms *gl_lcms_init(void *talloc_ctx, struct mp_log *log,
struct mpv_global *global,
struct mp_icc_opts *opts);
void gl_lcms_update_options(struct gl_lcms *p);
bool gl_lcms_set_memory_profile(struct gl_lcms *p, bstr profile);
bool gl_lcms_has_profile(struct gl_lcms *p);
bool gl_lcms_get_lut3d(struct gl_lcms *p, struct lut3d **,
enum mp_csp_prim prim, enum mp_csp_trc trc,
struct AVBufferRef *vid_profile);
bool gl_lcms_has_changed(struct gl_lcms *p, enum mp_csp_prim prim,
enum mp_csp_trc trc, struct AVBufferRef *vid_profile);
static inline bool gl_parse_3dlut_size(const char *arg, int *p1, int *p2, int *p3)
{
if (!strcmp(arg, "auto")) {
*p1 = *p2 = *p3 = 0;
return true;
}
if (sscanf(arg, "%dx%dx%d", p1, p2, p3) != 3)
return false;
for (int n = 0; n < 3; n++) {
int s = ((int[]) { *p1, *p2, *p3 })[n];
if (s < 2 || s > 512)
return false;
}
return true;
}
#endif