Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
46fb150a
Commit
46fb150a
authored
Jun 23, 2018
by
Mark Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/colorspace: Add namespace prefix to global functions
parent
07987404
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
25 deletions
+28
-25
colorspace.c
libavfilter/colorspace.c
+7
-6
colorspace.h
libavfilter/colorspace.h
+6
-4
vf_colorspace.c
libavfilter/vf_colorspace.c
+11
-11
vf_tonemap_opencl.c
libavfilter/vf_tonemap_opencl.c
+4
-4
No files found.
libavfilter/colorspace.c
View file @
46fb150a
...
...
@@ -20,7 +20,7 @@
#include "colorspace.h"
void
invert_matrix
3x3
(
const
double
in
[
3
][
3
],
double
out
[
3
][
3
])
void
ff_matrix_invert_
3x3
(
const
double
in
[
3
][
3
],
double
out
[
3
][
3
])
{
double
m00
=
in
[
0
][
0
],
m01
=
in
[
0
][
1
],
m02
=
in
[
0
][
2
],
m10
=
in
[
1
][
0
],
m11
=
in
[
1
][
1
],
m12
=
in
[
1
][
2
],
...
...
@@ -47,7 +47,8 @@ void invert_matrix3x3(const double in[3][3], double out[3][3])
}
}
void
mul3x3
(
double
dst
[
3
][
3
],
const
double
src1
[
3
][
3
],
const
double
src2
[
3
][
3
])
void
ff_matrix_mul_3x3
(
double
dst
[
3
][
3
],
const
double
src1
[
3
][
3
],
const
double
src2
[
3
][
3
])
{
int
m
,
n
;
...
...
@@ -60,9 +61,9 @@ void mul3x3(double dst[3][3], const double src1[3][3], const double src2[3][3])
/*
* see e.g. http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
*/
void
fill_rgb2xyz_table
(
const
struct
PrimaryCoefficients
*
coeffs
,
const
struct
WhitepointCoefficients
*
wp
,
double
rgb2xyz
[
3
][
3
])
void
f
f_f
ill_rgb2xyz_table
(
const
struct
PrimaryCoefficients
*
coeffs
,
const
struct
WhitepointCoefficients
*
wp
,
double
rgb2xyz
[
3
][
3
])
{
double
i
[
3
][
3
],
sr
,
sg
,
sb
,
zw
;
...
...
@@ -73,7 +74,7 @@ void fill_rgb2xyz_table(const struct PrimaryCoefficients *coeffs,
rgb2xyz
[
2
][
0
]
=
(
1
.
0
-
coeffs
->
xr
-
coeffs
->
yr
)
/
coeffs
->
yr
;
rgb2xyz
[
2
][
1
]
=
(
1
.
0
-
coeffs
->
xg
-
coeffs
->
yg
)
/
coeffs
->
yg
;
rgb2xyz
[
2
][
2
]
=
(
1
.
0
-
coeffs
->
xb
-
coeffs
->
yb
)
/
coeffs
->
yb
;
invert_matrix
3x3
(
rgb2xyz
,
i
);
ff_matrix_invert_
3x3
(
rgb2xyz
,
i
);
zw
=
1
.
0
-
wp
->
xw
-
wp
->
yw
;
sr
=
i
[
0
][
0
]
*
wp
->
xw
+
i
[
0
][
1
]
*
wp
->
yw
+
i
[
0
][
2
]
*
zw
;
sg
=
i
[
1
][
0
]
*
wp
->
xw
+
i
[
1
][
1
]
*
wp
->
yw
+
i
[
1
][
2
]
*
zw
;
...
...
libavfilter/colorspace.h
View file @
46fb150a
...
...
@@ -34,8 +34,10 @@ struct WhitepointCoefficients {
double
xw
,
yw
;
};
void
invert_matrix3x3
(
const
double
in
[
3
][
3
],
double
out
[
3
][
3
]);
void
mul3x3
(
double
dst
[
3
][
3
],
const
double
src1
[
3
][
3
],
const
double
src2
[
3
][
3
]);
void
fill_rgb2xyz_table
(
const
struct
PrimaryCoefficients
*
coeffs
,
const
struct
WhitepointCoefficients
*
wp
,
double
rgb2xyz
[
3
][
3
]);
void
ff_matrix_invert_3x3
(
const
double
in
[
3
][
3
],
double
out
[
3
][
3
]);
void
ff_matrix_mul_3x3
(
double
dst
[
3
][
3
],
const
double
src1
[
3
][
3
],
const
double
src2
[
3
][
3
]);
void
ff_fill_rgb2xyz_table
(
const
struct
PrimaryCoefficients
*
coeffs
,
const
struct
WhitepointCoefficients
*
wp
,
double
rgb2xyz
[
3
][
3
]);
#endif
libavfilter/vf_colorspace.c
View file @
46fb150a
...
...
@@ -371,7 +371,7 @@ static void fill_whitepoint_conv_table(double out[3][3], enum WhitepointAdaptati
double
mai
[
3
][
3
],
fac
[
3
][
3
],
tmp
[
3
][
3
];
double
rs
,
gs
,
bs
,
rd
,
gd
,
bd
;
invert_matrix
3x3
(
ma
,
mai
);
ff_matrix_invert_
3x3
(
ma
,
mai
);
rs
=
ma
[
0
][
0
]
*
wp_src
->
xw
+
ma
[
0
][
1
]
*
wp_src
->
yw
+
ma
[
0
][
2
]
*
zw_src
;
gs
=
ma
[
1
][
0
]
*
wp_src
->
xw
+
ma
[
1
][
1
]
*
wp_src
->
yw
+
ma
[
1
][
2
]
*
zw_src
;
bs
=
ma
[
2
][
0
]
*
wp_src
->
xw
+
ma
[
2
][
1
]
*
wp_src
->
yw
+
ma
[
2
][
2
]
*
zw_src
;
...
...
@@ -382,8 +382,8 @@ static void fill_whitepoint_conv_table(double out[3][3], enum WhitepointAdaptati
fac
[
1
][
1
]
=
gd
/
gs
;
fac
[
2
][
2
]
=
bd
/
bs
;
fac
[
0
][
1
]
=
fac
[
0
][
2
]
=
fac
[
1
][
0
]
=
fac
[
1
][
2
]
=
fac
[
2
][
0
]
=
fac
[
2
][
1
]
=
0
.
0
;
mul
3x3
(
tmp
,
ma
,
fac
);
mul
3x3
(
out
,
tmp
,
mai
);
ff_matrix_mul_
3x3
(
tmp
,
ma
,
fac
);
ff_matrix_mul_
3x3
(
out
,
tmp
,
mai
);
}
static
void
apply_lut
(
int16_t
*
buf
[
3
],
ptrdiff_t
stride
,
...
...
@@ -588,19 +588,19 @@ static int create_filtergraph(AVFilterContext *ctx,
wp_out
=
&
whitepoint_coefficients
[
s
->
out_primaries
->
wp
];
wp_in
=
&
whitepoint_coefficients
[
s
->
in_primaries
->
wp
];
fill_rgb2xyz_table
(
&
s
->
out_primaries
->
coeff
,
wp_out
,
rgb2xyz
);
invert_matrix
3x3
(
rgb2xyz
,
xyz2rgb
);
fill_rgb2xyz_table
(
&
s
->
in_primaries
->
coeff
,
wp_in
,
rgb2xyz
);
f
f_f
ill_rgb2xyz_table
(
&
s
->
out_primaries
->
coeff
,
wp_out
,
rgb2xyz
);
ff_matrix_invert_
3x3
(
rgb2xyz
,
xyz2rgb
);
f
f_f
ill_rgb2xyz_table
(
&
s
->
in_primaries
->
coeff
,
wp_in
,
rgb2xyz
);
if
(
s
->
out_primaries
->
wp
!=
s
->
in_primaries
->
wp
&&
s
->
wp_adapt
!=
WP_ADAPT_IDENTITY
)
{
double
wpconv
[
3
][
3
],
tmp
[
3
][
3
];
fill_whitepoint_conv_table
(
wpconv
,
s
->
wp_adapt
,
s
->
in_primaries
->
wp
,
s
->
out_primaries
->
wp
);
mul
3x3
(
tmp
,
rgb2xyz
,
wpconv
);
mul
3x3
(
rgb2rgb
,
tmp
,
xyz2rgb
);
ff_matrix_mul_
3x3
(
tmp
,
rgb2xyz
,
wpconv
);
ff_matrix_mul_
3x3
(
rgb2rgb
,
tmp
,
xyz2rgb
);
}
else
{
mul
3x3
(
rgb2rgb
,
rgb2xyz
,
xyz2rgb
);
ff_matrix_mul_
3x3
(
rgb2rgb
,
rgb2xyz
,
xyz2rgb
);
}
for
(
m
=
0
;
m
<
3
;
m
++
)
for
(
n
=
0
;
n
<
3
;
n
++
)
{
...
...
@@ -725,7 +725,7 @@ static int create_filtergraph(AVFilterContext *ctx,
for
(
n
=
0
;
n
<
8
;
n
++
)
s
->
yuv_offset
[
0
][
n
]
=
off
;
fill_rgb2yuv_table
(
s
->
in_lumacoef
,
rgb2yuv
);
invert_matrix
3x3
(
rgb2yuv
,
yuv2rgb
);
ff_matrix_invert_
3x3
(
rgb2yuv
,
yuv2rgb
);
bits
=
1
<<
(
in_desc
->
comp
[
0
].
depth
-
1
);
for
(
n
=
0
;
n
<
3
;
n
++
)
{
for
(
in_rng
=
s
->
in_y_rng
,
m
=
0
;
m
<
3
;
m
++
,
in_rng
=
s
->
in_uv_rng
)
{
...
...
@@ -781,7 +781,7 @@ static int create_filtergraph(AVFilterContext *ctx,
double
yuv2yuv
[
3
][
3
];
int
in_rng
,
out_rng
;
mul
3x3
(
yuv2yuv
,
yuv2rgb
,
rgb2yuv
);
ff_matrix_mul_
3x3
(
yuv2yuv
,
yuv2rgb
,
rgb2yuv
);
for
(
out_rng
=
s
->
out_y_rng
,
m
=
0
;
m
<
3
;
m
++
,
out_rng
=
s
->
out_uv_rng
)
{
for
(
in_rng
=
s
->
in_y_rng
,
n
=
0
;
n
<
3
;
n
++
,
in_rng
=
s
->
in_uv_rng
)
{
s
->
yuv2yuv_coeffs
[
m
][
n
][
0
]
=
...
...
libavfilter/vf_tonemap_opencl.c
View file @
46fb150a
...
...
@@ -124,10 +124,10 @@ static void get_rgb2rgb_matrix(enum AVColorPrimaries in, enum AVColorPrimaries o
double
rgb2rgb
[
3
][
3
])
{
double
rgb2xyz
[
3
][
3
],
xyz2rgb
[
3
][
3
];
fill_rgb2xyz_table
(
&
primaries_table
[
out
],
&
whitepoint_table
[
out
],
rgb2xyz
);
invert_matrix
3x3
(
rgb2xyz
,
xyz2rgb
);
fill_rgb2xyz_table
(
&
primaries_table
[
in
],
&
whitepoint_table
[
in
],
rgb2xyz
);
mul
3x3
(
rgb2rgb
,
rgb2xyz
,
xyz2rgb
);
f
f_f
ill_rgb2xyz_table
(
&
primaries_table
[
out
],
&
whitepoint_table
[
out
],
rgb2xyz
);
ff_matrix_invert_
3x3
(
rgb2xyz
,
xyz2rgb
);
f
f_f
ill_rgb2xyz_table
(
&
primaries_table
[
in
],
&
whitepoint_table
[
in
],
rgb2xyz
);
ff_matrix_mul_
3x3
(
rgb2rgb
,
rgb2xyz
,
xyz2rgb
);
}
#define OPENCL_SOURCE_NB 3
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment