FFmpeg
Loading...
Searching...
No Matches
palette.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Björn Ottosson
3 * Copyright (c) 2022 Clément Bœsch <u pkh me>
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#ifndef AVFILTER_PALETTE_H
23#define AVFILTER_PALETTE_H
24
25#include <math.h>
26#include <stdint.h>
27
29
30struct Lab {
32};
33
34/**
35 * Map a 16-bit linear value to a sRGB 8-bit color component (gamma
36 * compressed from optical to electrical value).
37 */
39
40/**
41 * sRGB (non-linear) to OkLab conversion
42 * @see https://bottosson.github.io/posts/oklab/
43 */
44struct Lab ff_srgb_u8_to_oklab_int(uint32_t srgb);
45
46/**
47 * OkLab to sRGB (non-linear) conversion
48 * @see https://bottosson.github.io/posts/oklab/
49 */
50uint32_t ff_oklab_int_to_srgb_u8(struct Lab c);
51
52/*
53 * lowbias32 hashing from https://nullprogram.com/blog/2018/07/31/
54 */
55uint32_t ff_lowbias32(uint32_t x);
56
57#endif /* AVFILTER_PALETTE_H */
int32_t
Macro definitions for various function/variable attributes.
struct Lab ff_srgb_u8_to_oklab_int(uint32_t srgb)
sRGB (non-linear) to OkLab conversion
Definition palette.c:165
uint32_t ff_lowbias32(uint32_t x)
Definition palette.c:206
uint8_t ff_linear_int_to_srgb_u8(int32_t x)
Map a 16-bit linear value to a sRGB 8-bit color component (gamma compressed from optical to electrica...
Definition palette.c:113
uint32_t ff_oklab_int_to_srgb_u8(struct Lab c)
OkLab to sRGB (non-linear) conversion.
Definition palette.c:189
Definition palette.h:30
int32_t a
Definition palette.h:31
int32_t L
Definition palette.h:31
int32_t b
Definition palette.h:31
static double c[64]