Go to the documentation of this file.
66 const int a = (1 <<
shift) - x;
82 int Rf,
int Gf,
int Bf)
110 }
else if (Bf > Rf) {
128 const int Rf =
rgb.x & ((1 <<
shift) - 1);
129 const int Gf =
rgb.y & ((1 <<
shift) - 1);
130 const int Bf =
rgb.z & ((1 <<
shift) - 1);
136 static_assert(
INPUT_LUT_BITS <= 8,
"INPUT_LUT_BITS must be <= 8");
141 const int Rf =
rgb.x & ((1 <<
shift) - 1);
142 const int Gf =
rgb.y & ((1 <<
shift) - 1);
143 const int Bf =
rgb.z & ((1 <<
shift) - 1);
156 const int xi = (1 <<
shift) - x;
165 const int xi = (1 <<
shift) - x;
177 const int Ix = ipt.
x >> Ishift;
178 const int Px = ipt.
y >> Cshift;
179 const int Tx = ipt.
z >> Cshift;
180 const int If = ipt.
x & ((1 << Ishift) - 1);
181 const int Pf = ipt.
y & ((1 << Cshift) - 1);
182 const int Tf = ipt.
z & ((1 << Cshift) - 1);
209 const int Ix = ipt.
x >>
shift;
210 const int If = ipt.
x & ((1 <<
shift) - 1);
216 const int base = (1 << 15) -
w.y;
219 ipt.
y =
base + (ipt.
y *
w.y >> 15);
220 ipt.
z =
base + (ipt.
z *
w.y >> 15);
254 if (!new_src || !lut3d->
dynamic)
264 uint8_t *
out,
int out_stride,
int w,
int h)
267 const uint16_t *in16 = (
const uint16_t *) in;
268 uint16_t *out16 = (uint16_t *)
out;
270 for (
int x = 0; x <
w; x++) {
271 v3u16_t c = { in16[0], in16[1], in16[2] };
AVPixelFormat
Pixel format.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
void sws_lut3d_update(SwsLut3D *lut3d, const SwsColor *new_src)
Update the tone mapping state.
SwsLut3D * sws_lut3d_alloc(void)
v3u16_t output[OUTPUT_LUT_SIZE_PT][OUTPUT_LUT_SIZE_PT][OUTPUT_LUT_SIZE_I]
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce output
v2u16_t tone_map[TONE_LUT_SIZE]
static av_always_inline v3u16_t lookup_input16(const SwsLut3D *lut3d, v3u16_t rgb)
enum AVPixelFormat sws_lut3d_pick_pixfmt(SwsFormat fmt, int output)
Pick the best compatible pixfmt for a given SwsFormat.
static av_always_inline v3u16_t apply_tone_map(const SwsLut3D *lut3d, v3u16_t ipt)
int sws_color_map_generate_static(v3u16_t *lut, int size, const SwsColorMap *map)
Generates a single end-to-end color mapping 3DLUT embedding a static tone mapping curve.
static av_always_inline v2u16_t lerp2u16(v2u16_t a, v2u16_t b, int x, int shift)
Note: These functions are scaled such that x == (1 << shift) corresponds to a value of 1....
int sws_color_map_generate_dynamic(v3u16_t *input, v3u16_t *output, int size_input, int size_I, int size_PT, const SwsColorMap *map)
Generates a split pair of 3DLUTS, going to IPT and back, allowing an arbitrary dynamic EETF to be nes...
#define xi(width, name, var, range_min, range_max, subs,...)
static av_always_inline v3u16_t lookup_output(const SwsLut3D *lut3d, v3u16_t ipt)
static av_always_inline v3u16_t lerp3u16(v3u16_t a, v3u16_t b, int x, int shift)
#define AV_PIX_FMT_RGBA64
void sws_lut3d_apply(const SwsLut3D *lut3d, const uint8_t *in, int in_stride, uint8_t *out, int out_stride, int w, int h)
Applies a color transformation to a plane.
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
v3u16_t input[INPUT_LUT_SIZE][INPUT_LUT_SIZE][INPUT_LUT_SIZE]
static int shift(int a, int b)
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
static av_always_inline v3u16_t barycentric(int shift, int x, int y, int z, v3u16_t v0, v3u16_t v1, v3u16_t v2, v3u16_t v3)
v0 and v1 are 'black' and 'white' v2 and v3 are closest RGB/CMY vertices x >= y >= z are relative wei...
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
void sws_lut3d_free(SwsLut3D **plut3d)
static av_always_inline v3u16_t tetrahedral(const SwsLut3D *lut3d, int Rx, int Gx, int Bx, int Rf, int Gf, int Bf)
int sws_lut3d_generate(SwsLut3D *lut3d, enum AVPixelFormat fmt_in, enum AVPixelFormat fmt_out, const SwsColorMap *map)
Recalculate the (static) 3DLUT state with new settings.
void sws_tone_map_generate(v2u16_t *lut, int size, const SwsColorMap *map)
Generate a 1D LUT of size size adapting intensity (I) levels from the source to the destination color...
static av_always_inline v3u16_t lookup_input8(const SwsLut3D *lut3d, v3u8_t rgb)
const VDPAUPixFmtMap * map
bool sws_lut3d_test_fmt(enum AVPixelFormat fmt, int output)
Test to see if a given format is supported by the 3DLUT input/output code.