2013-03-01 20:19:20 +00:00
|
|
|
#ifndef MP_GL_LCMS_H
|
|
|
|
#define MP_GL_LCMS_H
|
|
|
|
|
2015-01-07 17:47:27 +00:00
|
|
|
#include <stddef.h>
|
2014-02-24 23:04:30 +00:00
|
|
|
#include <stdbool.h>
|
2015-01-07 17:47:27 +00:00
|
|
|
#include "misc/bstr.h"
|
2017-08-10 19:36:57 +00:00
|
|
|
#include "video/csputils.h"
|
2017-07-25 21:17:04 +00:00
|
|
|
#include <libavutil/buffer.h>
|
2014-02-24 23:04:30 +00:00
|
|
|
|
2013-03-01 20:19:20 +00:00
|
|
|
extern const struct m_sub_options mp_icc_conf;
|
|
|
|
|
|
|
|
struct mp_icc_opts {
|
2023-02-20 03:32:50 +00:00
|
|
|
bool use_embedded;
|
2013-03-01 20:19:20 +00:00
|
|
|
char *profile;
|
2023-02-20 03:32:50 +00:00
|
|
|
bool profile_auto;
|
2023-05-03 00:42:23 +00:00
|
|
|
bool cache;
|
2015-04-29 16:09:22 +00:00
|
|
|
char *cache_dir;
|
2013-03-01 20:19:20 +00:00
|
|
|
char *size_str;
|
|
|
|
int intent;
|
2016-05-03 19:58:03 +00:00
|
|
|
int contrast;
|
2023-04-23 20:49:33 +00:00
|
|
|
bool icc_use_luma;
|
2013-03-01 20:19:20 +00:00
|
|
|
};
|
|
|
|
|
2016-06-03 18:06:29 +00:00
|
|
|
struct lut3d {
|
|
|
|
uint16_t *data;
|
|
|
|
int size[3];
|
|
|
|
};
|
|
|
|
|
2013-09-11 23:28:14 +00:00
|
|
|
struct mp_log;
|
2013-12-21 16:51:20 +00:00
|
|
|
struct mpv_global;
|
2015-01-07 17:47:27 +00:00
|
|
|
struct gl_lcms;
|
|
|
|
|
|
|
|
struct gl_lcms *gl_lcms_init(void *talloc_ctx, struct mp_log *log,
|
2016-09-06 09:11:36 +00:00
|
|
|
struct mpv_global *global,
|
|
|
|
struct mp_icc_opts *opts);
|
|
|
|
void gl_lcms_update_options(struct gl_lcms *p);
|
2016-06-04 15:52:10 +00:00
|
|
|
bool gl_lcms_set_memory_profile(struct gl_lcms *p, bstr profile);
|
|
|
|
bool gl_lcms_has_profile(struct gl_lcms *p);
|
2016-02-13 14:33:00 +00:00
|
|
|
bool gl_lcms_get_lut3d(struct gl_lcms *p, struct lut3d **,
|
2023-11-04 02:55:38 +00:00
|
|
|
enum pl_color_primaries prim, enum pl_color_transfer trc,
|
2017-07-25 21:17:04 +00:00
|
|
|
struct AVBufferRef *vid_profile);
|
2023-11-04 02:55:38 +00:00
|
|
|
bool gl_lcms_has_changed(struct gl_lcms *p, enum pl_color_primaries prim,
|
|
|
|
enum pl_color_transfer trc, struct AVBufferRef *vid_profile);
|
2013-03-01 20:19:20 +00:00
|
|
|
|
2021-04-18 09:48:35 +00:00
|
|
|
static inline bool gl_parse_3dlut_size(const char *arg, int *p1, int *p2, int *p3)
|
|
|
|
{
|
2024-05-09 19:00:34 +00:00
|
|
|
if (!arg)
|
|
|
|
return false;
|
2023-09-14 18:31:57 +00:00
|
|
|
if (!strcmp(arg, "auto")) {
|
|
|
|
*p1 = *p2 = *p3 = 0;
|
|
|
|
return true;
|
|
|
|
}
|
2021-04-18 09:48:35 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2013-03-01 20:19:20 +00:00
|
|
|
#endif
|