Flutter Engine
The Flutter Engine
Classes | Macros | Typedefs | Functions | Variables
skcms_internals.h File Reference
#include <stdbool.h>
#include <stdint.h>

Go to the source code of this file.

Classes

struct  skcms_ICCTag
 

Macros

#define ARRAY_COUNT(arr)   (int)(sizeof((arr)) / sizeof(*(arr)))
 
#define SKCMS_FALLTHROUGH
 
#define SKCMS_HAS_MUSTTAIL   0
 
#define SKCMS_MAYBE_UNUSED
 
#define SAFE_SIZEOF(x)   ((uint64_t)sizeof(x))
 
#define SAFE_FIXED_SIZE(type)   ((uint64_t)offsetof(type, variable))
 
#define SKCMS_PORTABLE   1
 
#define SKCMS_DISABLE_HSW   1
 
#define SKCMS_DISABLE_SKX   1
 

Typedefs

typedef struct skcms_ICCTag skcms_ICCTag
 
typedef struct skcms_ICCProfile skcms_ICCProfile
 
typedef struct skcms_TransferFunction skcms_TransferFunction
 
typedef union skcms_Curve skcms_Curve
 

Functions

void skcms_GetTagByIndex (const skcms_ICCProfile *, uint32_t idx, skcms_ICCTag *)
 
bool skcms_GetTagBySignature (const skcms_ICCProfile *, uint32_t sig, skcms_ICCTag *)
 
float skcms_MaxRoundtripError (const skcms_Curve *curve, const skcms_TransferFunction *inv_tf)
 
static float floorf_ (float x)
 
static float fabsf_ (float x)
 
float powf_ (float, float)
 

Variables

const uint8_t skcms_252_random_bytes [252]
 

Macro Definition Documentation

◆ ARRAY_COUNT

#define ARRAY_COUNT (   arr)    (int)(sizeof((arr)) / sizeof(*(arr)))

Definition at line 22 of file skcms_internals.h.

◆ SAFE_FIXED_SIZE

#define SAFE_FIXED_SIZE (   type)    ((uint64_t)offsetof(type, variable))

Definition at line 83 of file skcms_internals.h.

◆ SAFE_SIZEOF

#define SAFE_SIZEOF (   x)    ((uint64_t)sizeof(x))

Definition at line 80 of file skcms_internals.h.

◆ SKCMS_DISABLE_HSW

#define SKCMS_DISABLE_HSW   1

Definition at line 97 of file skcms_internals.h.

◆ SKCMS_DISABLE_SKX

#define SKCMS_DISABLE_SKX   1

Definition at line 102 of file skcms_internals.h.

◆ SKCMS_FALLTHROUGH

#define SKCMS_FALLTHROUGH

Definition at line 58 of file skcms_internals.h.

◆ SKCMS_HAS_MUSTTAIL

#define SKCMS_HAS_MUSTTAIL   0

Definition at line 61 of file skcms_internals.h.

◆ SKCMS_MAYBE_UNUSED

#define SKCMS_MAYBE_UNUSED

Definition at line 72 of file skcms_internals.h.

◆ SKCMS_PORTABLE

#define SKCMS_PORTABLE   1

Definition at line 89 of file skcms_internals.h.

Typedef Documentation

◆ skcms_Curve

typedef union skcms_Curve skcms_Curve

Definition at line 116 of file skcms_internals.h.

◆ skcms_ICCProfile

Definition at line 114 of file skcms_internals.h.

◆ skcms_ICCTag

typedef struct skcms_ICCTag skcms_ICCTag

◆ skcms_TransferFunction

Definition at line 115 of file skcms_internals.h.

Function Documentation

◆ fabsf_()

static float fabsf_ ( float  x)
inlinestatic

Definition at line 133 of file skcms_internals.h.

133{ return x < 0 ? -x : x; }
double x

◆ floorf_()

static float floorf_ ( float  x)
inlinestatic

Definition at line 129 of file skcms_internals.h.

129 {
130 float roundtrip = (float)((int)x);
131 return roundtrip > x ? roundtrip - 1 : roundtrip;
132}

◆ powf_()

float powf_ ( float  x,
float  y 
)

Definition at line 93 of file skcms.cc.

93 {
94 if (x <= 0.f) {
95 return 0.f;
96 }
97 if (x == 1.f) {
98 return 1.f;
99 }
100 return exp2f_(log2f_(x) * y);
101}
double y
static float log2f_(float x)
Definition: skcms.cc:44
static float exp2f_(float x)
Definition: skcms.cc:65

◆ skcms_GetTagByIndex()

void skcms_GetTagByIndex ( const skcms_ICCProfile profile,
uint32_t  idx,
skcms_ICCTag tag 
)

Definition at line 1211 of file skcms.cc.

1211 {
1212 if (!profile || !profile->buffer || !tag) { return; }
1213 if (idx > profile->tag_count) { return; }
1214 const tag_Layout* tags = get_tag_table(profile);
1215 tag->signature = read_big_u32(tags[idx].signature);
1216 tag->size = read_big_u32(tags[idx].size);
1217 tag->buf = read_big_u32(tags[idx].offset) + profile->buffer;
1218 tag->type = read_big_u32(tag->buf);
1219}
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
static uint32_t read_big_u32(const uint8_t *ptr)
Definition: skcms.cc:334
static const tag_Layout * get_tag_table(const skcms_ICCProfile *profile)
Definition: skcms.cc:384
SeparatedVector2 offset
uint32_t signature
const uint8_t * buf

◆ skcms_GetTagBySignature()

bool skcms_GetTagBySignature ( const skcms_ICCProfile profile,
uint32_t  sig,
skcms_ICCTag tag 
)

Definition at line 1221 of file skcms.cc.

1221 {
1222 if (!profile || !profile->buffer || !tag) { return false; }
1223 const tag_Layout* tags = get_tag_table(profile);
1224 for (uint32_t i = 0; i < profile->tag_count; ++i) {
1225 if (read_big_u32(tags[i].signature) == sig) {
1226 tag->signature = sig;
1227 tag->size = read_big_u32(tags[i].size);
1228 tag->buf = read_big_u32(tags[i].offset) + profile->buffer;
1229 tag->type = read_big_u32(tag->buf);
1230 return true;
1231 }
1232 }
1233 return false;
1234}

◆ skcms_MaxRoundtripError()

float skcms_MaxRoundtripError ( const skcms_Curve curve,
const skcms_TransferFunction inv_tf 
)

Definition at line 273 of file skcms.cc.

273 {
274 uint32_t N = curve->table_entries > 256 ? curve->table_entries : 256;
275 const float dx = 1.0f / static_cast<float>(N - 1);
276 float err = 0;
277 for (uint32_t i = 0; i < N; i++) {
278 float x = static_cast<float>(i) * dx,
279 y = eval_curve(curve, x);
280 err = fmaxf_(err, fabsf_(x - skcms_TransferFunction_eval(inv_tf, y)));
281 }
282 return err;
283}
#define N
Definition: beziers.cpp:19
skia_private::AutoTArray< sk_sp< SkImageFilter > > filters TypedMatrix matrix TypedMatrix matrix SkScalar dx
Definition: SkRecords.h:208
static float eval_curve(const skcms_Curve *curve, float x)
Definition: skcms.cc:247
float skcms_TransferFunction_eval(const skcms_TransferFunction *tf, float x)
Definition: skcms.cc:212
static float fmaxf_(float x, float y)
Definition: skcms.cc:108
static float fabsf_(float x)
uint32_t table_entries
Definition: skcms_public.h:112

Variable Documentation

◆ skcms_252_random_bytes

const uint8_t skcms_252_random_bytes[252]
extern

Definition at line 1602 of file skcms.cc.