badvideo: Rename videoconvert functions to prevent conflicts with static linking

https://bugzilla.gnome.org/show_bug.cgi?id=728443
This commit is contained in:
Sebastian Dröge 2014-06-28 17:01:52 +02:00
parent 133c67a6a6
commit 286a80ab18
6 changed files with 241 additions and 237 deletions

View file

@ -1,11 +1,11 @@
.function video_convert_orc_memcpy_2d .function bad_video_convert_orc_memcpy_2d
.flags 2d .flags 2d
.dest 1 d1 guint8 .dest 1 d1 guint8
.source 1 s1 guint8 .source 1 s1 guint8
copyb d1, s1 copyb d1, s1
.function video_convert_orc_convert_I420_UYVY .function bad_video_convert_orc_convert_I420_UYVY
.dest 4 d1 guint8 .dest 4 d1 guint8
.dest 4 d2 guint8 .dest 4 d2 guint8
.source 2 y1 guint8 .source 2 y1 guint8
@ -19,7 +19,7 @@ x2 mergebw d1, uv, y1
x2 mergebw d2, uv, y2 x2 mergebw d2, uv, y2
.function video_convert_orc_convert_I420_YUY2 .function bad_video_convert_orc_convert_I420_YUY2
.dest 4 d1 guint8 .dest 4 d1 guint8
.dest 4 d2 guint8 .dest 4 d2 guint8
.source 2 y1 guint8 .source 2 y1 guint8
@ -34,7 +34,7 @@ x2 mergebw d2, y2, uv
.function video_convert_orc_convert_I420_AYUV .function bad_video_convert_orc_convert_I420_AYUV
.dest 4 d1 guint8 .dest 4 d1 guint8
.dest 4 d2 guint8 .dest 4 d2 guint8
.source 1 y1 guint8 .source 1 y1 guint8
@ -56,7 +56,7 @@ mergebw ay, c255, y2
mergewl d2, ay, uv mergewl d2, ay, uv
.function video_convert_orc_convert_YUY2_I420 .function bad_video_convert_orc_convert_YUY2_I420
.dest 2 y1 guint8 .dest 2 y1 guint8
.dest 2 y2 guint8 .dest 2 y2 guint8
.dest 1 u guint8 .dest 1 u guint8
@ -75,7 +75,7 @@ x2 avgub t1, t1, t2
splitwb v, u, t1 splitwb v, u, t1
.function video_convert_orc_convert_UYVY_YUY2 .function bad_video_convert_orc_convert_UYVY_YUY2
.flags 2d .flags 2d
.dest 4 yuy2 guint8 .dest 4 yuy2 guint8
.source 4 uyvy guint8 .source 4 uyvy guint8
@ -83,7 +83,7 @@ splitwb v, u, t1
x2 swapw yuy2, uyvy x2 swapw yuy2, uyvy
.function video_convert_orc_planar_chroma_420_422 .function bad_video_convert_orc_planar_chroma_420_422
.flags 2d .flags 2d
.dest 1 d1 guint8 .dest 1 d1 guint8
.dest 1 d2 guint8 .dest 1 d2 guint8
@ -93,7 +93,7 @@ copyb d1, s
copyb d2, s copyb d2, s
.function video_convert_orc_planar_chroma_420_444 .function bad_video_convert_orc_planar_chroma_420_444
.flags 2d .flags 2d
.dest 2 d1 guint8 .dest 2 d1 guint8
.dest 2 d2 guint8 .dest 2 d2 guint8
@ -105,7 +105,7 @@ storew d1, t
storew d2, t storew d2, t
.function video_convert_orc_planar_chroma_422_444 .function bad_video_convert_orc_planar_chroma_422_444
.flags 2d .flags 2d
.dest 2 d1 guint8 .dest 2 d1 guint8
.source 1 s guint8 .source 1 s guint8
@ -115,7 +115,7 @@ splatbw t, s
storew d1, t storew d1, t
.function video_convert_orc_planar_chroma_444_422 .function bad_video_convert_orc_planar_chroma_444_422
.flags 2d .flags 2d
.dest 1 d guint8 .dest 1 d guint8
.source 2 s guint8 .source 2 s guint8
@ -126,7 +126,7 @@ splitwb t1, t2, s
avgub d, t1, t2 avgub d, t1, t2
.function video_convert_orc_planar_chroma_444_420 .function bad_video_convert_orc_planar_chroma_444_420
.flags 2d .flags 2d
.dest 1 d guint8 .dest 1 d guint8
.source 2 s1 guint8 .source 2 s1 guint8
@ -140,7 +140,7 @@ splitwb t1, t2, t
avgub d, t1, t2 avgub d, t1, t2
.function video_convert_orc_planar_chroma_422_420 .function bad_video_convert_orc_planar_chroma_422_420
.flags 2d .flags 2d
.dest 1 d guint8 .dest 1 d guint8
.source 1 s1 guint8 .source 1 s1 guint8
@ -149,7 +149,7 @@ avgub d, t1, t2
avgub d, s1, s2 avgub d, s1, s2
.function video_convert_orc_convert_YUY2_AYUV .function bad_video_convert_orc_convert_YUY2_AYUV
.flags 2d .flags 2d
.dest 8 ayuv guint8 .dest 8 ayuv guint8
.source 4 yuy2 guint8 .source 4 yuy2 guint8
@ -165,7 +165,7 @@ mergewl uvuv, uv, uv
x2 mergewl ayuv, ayay, uvuv x2 mergewl ayuv, ayay, uvuv
.function video_convert_orc_convert_UYVY_AYUV .function bad_video_convert_orc_convert_UYVY_AYUV
.flags 2d .flags 2d
.dest 8 ayuv guint8 .dest 8 ayuv guint8
.source 4 uyvy guint8 .source 4 uyvy guint8
@ -181,7 +181,7 @@ mergewl uvuv, uv, uv
x2 mergewl ayuv, ayay, uvuv x2 mergewl ayuv, ayay, uvuv
.function video_convert_orc_convert_YUY2_Y42B .function bad_video_convert_orc_convert_YUY2_Y42B
.flags 2d .flags 2d
.dest 2 y guint8 .dest 2 y guint8
.dest 1 u guint8 .dest 1 u guint8
@ -193,7 +193,7 @@ x2 splitwb uv, y, yuy2
splitwb v, u, uv splitwb v, u, uv
.function video_convert_orc_convert_UYVY_Y42B .function bad_video_convert_orc_convert_UYVY_Y42B
.flags 2d .flags 2d
.dest 2 y guint8 .dest 2 y guint8
.dest 1 u guint8 .dest 1 u guint8
@ -205,7 +205,7 @@ x2 splitwb y, uv, uyvy
splitwb v, u, uv splitwb v, u, uv
.function video_convert_orc_convert_YUY2_Y444 .function bad_video_convert_orc_convert_YUY2_Y444
.flags 2d .flags 2d
.dest 2 y guint8 .dest 2 y guint8
.dest 2 uu guint8 .dest 2 uu guint8
@ -221,7 +221,7 @@ splatbw uu, u
splatbw vv, v splatbw vv, v
.function video_convert_orc_convert_UYVY_Y444 .function bad_video_convert_orc_convert_UYVY_Y444
.flags 2d .flags 2d
.dest 2 y guint8 .dest 2 y guint8
.dest 2 uu guint8 .dest 2 uu guint8
@ -237,7 +237,7 @@ splatbw uu, u
splatbw vv, v splatbw vv, v
.function video_convert_orc_convert_UYVY_I420 .function bad_video_convert_orc_convert_UYVY_I420
.dest 2 y1 guint8 .dest 2 y1 guint8
.dest 2 y2 guint8 .dest 2 y2 guint8
.dest 1 u guint8 .dest 1 u guint8
@ -257,7 +257,7 @@ splitwb v, u, t1
.function video_convert_orc_convert_AYUV_I420 .function bad_video_convert_orc_convert_AYUV_I420
.flags 2d .flags 2d
.dest 2 y1 guint8 .dest 2 y1 guint8
.dest 2 y2 guint8 .dest 2 y2 guint8
@ -287,7 +287,7 @@ avgub v, t1, t2
.function video_convert_orc_convert_AYUV_YUY2 .function bad_video_convert_orc_convert_AYUV_YUY2
.flags 2d .flags 2d
.dest 4 yuy2 guint8 .dest 4 yuy2 guint8
.source 8 ayuv guint8 .source 8 ayuv guint8
@ -304,7 +304,7 @@ x2 select1wb yy, ayay
x2 mergebw yuy2, yy, uv1 x2 mergebw yuy2, yy, uv1
.function video_convert_orc_convert_AYUV_UYVY .function bad_video_convert_orc_convert_AYUV_UYVY
.flags 2d .flags 2d
.dest 4 yuy2 guint8 .dest 4 yuy2 guint8
.source 8 ayuv guint8 .source 8 ayuv guint8
@ -322,7 +322,7 @@ x2 mergebw yuy2, uv1, yy
.function video_convert_orc_convert_AYUV_Y42B .function bad_video_convert_orc_convert_AYUV_Y42B
.flags 2d .flags 2d
.dest 2 y guint8 .dest 2 y guint8
.dest 1 u guint8 .dest 1 u guint8
@ -340,7 +340,7 @@ splitwb v, u, uv1
x2 select1wb y, ayay x2 select1wb y, ayay
.function video_convert_orc_convert_AYUV_Y444 .function bad_video_convert_orc_convert_AYUV_Y444
.flags 2d .flags 2d
.dest 1 y guint8 .dest 1 y guint8
.dest 1 u guint8 .dest 1 u guint8
@ -354,7 +354,7 @@ splitwb v, u, uv
select1wb y, ay select1wb y, ay
.function video_convert_orc_convert_Y42B_YUY2 .function bad_video_convert_orc_convert_Y42B_YUY2
.flags 2d .flags 2d
.dest 4 yuy2 guint8 .dest 4 yuy2 guint8
.source 2 y guint8 .source 2 y guint8
@ -366,7 +366,7 @@ mergebw uv, u, v
x2 mergebw yuy2, y, uv x2 mergebw yuy2, y, uv
.function video_convert_orc_convert_Y42B_UYVY .function bad_video_convert_orc_convert_Y42B_UYVY
.flags 2d .flags 2d
.dest 4 uyvy guint8 .dest 4 uyvy guint8
.source 2 y guint8 .source 2 y guint8
@ -378,7 +378,7 @@ mergebw uv, u, v
x2 mergebw uyvy, uv, y x2 mergebw uyvy, uv, y
.function video_convert_orc_convert_Y42B_AYUV .function bad_video_convert_orc_convert_Y42B_AYUV
.flags 2d .flags 2d
.dest 8 ayuv guint8 .dest 8 ayuv guint8
.source 2 yy guint8 .source 2 yy guint8
@ -396,7 +396,7 @@ mergewl uvuv, uv, uv
x2 mergewl ayuv, ayay, uvuv x2 mergewl ayuv, ayay, uvuv
.function video_convert_orc_convert_Y444_YUY2 .function bad_video_convert_orc_convert_Y444_YUY2
.flags 2d .flags 2d
.dest 4 yuy2 guint8 .dest 4 yuy2 guint8
.source 2 y guint8 .source 2 y guint8
@ -413,7 +413,7 @@ x2 avgub uv, uv1, uv2
x2 mergebw yuy2, y, uv x2 mergebw yuy2, y, uv
.function video_convert_orc_convert_Y444_UYVY .function bad_video_convert_orc_convert_Y444_UYVY
.flags 2d .flags 2d
.dest 4 uyvy guint8 .dest 4 uyvy guint8
.source 2 y guint8 .source 2 y guint8
@ -430,7 +430,7 @@ x2 avgub uv, uv1, uv2
x2 mergebw uyvy, uv, y x2 mergebw uyvy, uv, y
.function video_convert_orc_convert_Y444_AYUV .function bad_video_convert_orc_convert_Y444_AYUV
.flags 2d .flags 2d
.dest 4 ayuv guint8 .dest 4 ayuv guint8
.source 1 yy guint8 .source 1 yy guint8
@ -446,7 +446,7 @@ mergewl ayuv, ay, uv
.function video_convert_orc_convert_AYUV_ARGB .function bad_video_convert_orc_convert_AYUV_ARGB
.flags 2d .flags 2d
.dest 4 argb guint8 .dest 4 argb guint8
.source 4 ayuv guint8 .source 4 ayuv guint8
@ -502,7 +502,7 @@ mergebw wb, g, b
mergewl x, wr, wb mergewl x, wr, wb
x4 addb argb, x, c128 x4 addb argb, x, c128
.function video_convert_orc_convert_AYUV_BGRA .function bad_video_convert_orc_convert_AYUV_BGRA
.flags 2d .flags 2d
.dest 4 bgra guint8 .dest 4 bgra guint8
.source 4 ayuv guint8 .source 4 ayuv guint8
@ -559,7 +559,7 @@ mergewl x, wb, wr
x4 addb bgra, x, c128 x4 addb bgra, x, c128
.function video_convert_orc_convert_AYUV_ABGR .function bad_video_convert_orc_convert_AYUV_ABGR
.flags 2d .flags 2d
.dest 4 argb guint8 .dest 4 argb guint8
.source 4 ayuv guint8 .source 4 ayuv guint8
@ -615,7 +615,7 @@ mergebw wr, g, r
mergewl x, wb, wr mergewl x, wb, wr
x4 addb argb, x, c128 x4 addb argb, x, c128
.function video_convert_orc_convert_AYUV_RGBA .function bad_video_convert_orc_convert_AYUV_RGBA
.flags 2d .flags 2d
.dest 4 argb guint8 .dest 4 argb guint8
.source 4 ayuv guint8 .source 4 ayuv guint8
@ -673,7 +673,7 @@ x4 addb argb, x, c128
.function video_convert_orc_convert_I420_BGRA .function bad_video_convert_orc_convert_I420_BGRA
.dest 4 argb guint8 .dest 4 argb guint8
.source 1 y guint8 .source 1 y guint8
.source 1 u guint8 .source 1 u guint8

View file

@ -33,7 +33,7 @@
/* our simple CMS */ /* our simple CMS */
void void
color_xyY_to_XYZ (Color * c) bad_color_xyY_to_XYZ (Color * c)
{ {
if (c->v[1] == 0) { if (c->v[1] == 0) {
c->v[0] = 0; c->v[0] = 0;
@ -51,7 +51,7 @@ color_xyY_to_XYZ (Color * c)
} }
void void
color_XYZ_to_xyY (Color * c) bad_color_XYZ_to_xyY (Color * c)
{ {
double d; double d;
d = c->v[0] + c->v[1] + c->v[2]; d = c->v[0] + c->v[1] + c->v[2];
@ -71,7 +71,7 @@ color_XYZ_to_xyY (Color * c)
} }
void void
color_set (Color * c, double x, double y, double z) bad_color_set (Color * c, double x, double y, double z)
{ {
c->v[0] = x; c->v[0] = x;
c->v[1] = y; c->v[1] = y;
@ -79,7 +79,7 @@ color_set (Color * c, double x, double y, double z)
} }
void void
color_matrix_set_identity (ColorMatrix * m) bad_color_matrix_set_identity (ColorMatrix * m)
{ {
int i, j; int i, j;
@ -92,7 +92,7 @@ color_matrix_set_identity (ColorMatrix * m)
/* Prettyprint a 4x4 matrix @m@ */ /* Prettyprint a 4x4 matrix @m@ */
void void
color_matrix_dump (ColorMatrix * m) bad_color_matrix_dump (ColorMatrix * m)
{ {
int i, j; int i, j;
@ -112,7 +112,7 @@ color_matrix_dump (ColorMatrix * m)
* - @dst@ may be a pointer to @a@ andor @b@ * - @dst@ may be a pointer to @a@ andor @b@
*/ */
void void
color_matrix_multiply (ColorMatrix * dst, ColorMatrix * a, ColorMatrix * b) bad_color_matrix_multiply (ColorMatrix * dst, ColorMatrix * a, ColorMatrix * b)
{ {
ColorMatrix tmp; ColorMatrix tmp;
int i, j, k; int i, j, k;
@ -131,7 +131,7 @@ color_matrix_multiply (ColorMatrix * dst, ColorMatrix * a, ColorMatrix * b)
} }
void void
color_matrix_apply (ColorMatrix * m, Color * dest, Color * src) bad_color_matrix_apply (ColorMatrix * m, Color * dest, Color * src)
{ {
int i; int i;
Color tmp; Color tmp;
@ -148,32 +148,33 @@ color_matrix_apply (ColorMatrix * m, Color * dest, Color * src)
} }
void void
color_matrix_offset_components (ColorMatrix * m, double a1, double a2, bad_color_matrix_offset_components (ColorMatrix * m, double a1, double a2,
double a3) double a3)
{ {
ColorMatrix a; ColorMatrix a;
color_matrix_set_identity (&a); bad_color_matrix_set_identity (&a);
a.m[0][3] = a1; a.m[0][3] = a1;
a.m[1][3] = a2; a.m[1][3] = a2;
a.m[2][3] = a3; a.m[2][3] = a3;
color_matrix_multiply (m, &a, m); bad_color_matrix_multiply (m, &a, m);
} }
void void
color_matrix_scale_components (ColorMatrix * m, double a1, double a2, double a3) bad_color_matrix_scale_components (ColorMatrix * m, double a1, double a2,
double a3)
{ {
ColorMatrix a; ColorMatrix a;
color_matrix_set_identity (&a); bad_color_matrix_set_identity (&a);
a.m[0][0] = a1; a.m[0][0] = a1;
a.m[1][1] = a2; a.m[1][1] = a2;
a.m[2][2] = a3; a.m[2][2] = a3;
color_matrix_multiply (m, &a, m); bad_color_matrix_multiply (m, &a, m);
} }
void void
color_matrix_YCbCr_to_RGB (ColorMatrix * m, double Kr, double Kb) bad_color_matrix_YCbCr_to_RGB (ColorMatrix * m, double Kr, double Kb)
{ {
double Kg = 1.0 - Kr - Kb; double Kg = 1.0 - Kr - Kb;
ColorMatrix k = { ColorMatrix k = {
@ -185,11 +186,11 @@ color_matrix_YCbCr_to_RGB (ColorMatrix * m, double Kr, double Kb)
} }
}; };
color_matrix_multiply (m, &k, m); bad_color_matrix_multiply (m, &k, m);
} }
void void
color_matrix_RGB_to_YCbCr (ColorMatrix * m, double Kr, double Kb) bad_color_matrix_RGB_to_YCbCr (ColorMatrix * m, double Kr, double Kb)
{ {
double Kg = 1.0 - Kr - Kb; double Kg = 1.0 - Kr - Kb;
ColorMatrix k; ColorMatrix k;
@ -217,27 +218,28 @@ color_matrix_RGB_to_YCbCr (ColorMatrix * m, double Kr, double Kb)
k.m[3][2] = 0; k.m[3][2] = 0;
k.m[3][3] = 1; k.m[3][3] = 1;
color_matrix_multiply (m, &k, m); bad_color_matrix_multiply (m, &k, m);
} }
void void
color_matrix_build_yuv_to_rgb_601 (ColorMatrix * dst) bad_color_matrix_build_yuv_to_rgb_601 (ColorMatrix * dst)
{ {
/* /*
* At this point, everything is in YCbCr * At this point, everything is in YCbCr
* All components are in the range [0,255] * All components are in the range [0,255]
*/ */
color_matrix_set_identity (dst); bad_color_matrix_set_identity (dst);
/* offset required to get input video black to (0.,0.,0.) */ /* offset required to get input video black to (0.,0.,0.) */
color_matrix_offset_components (dst, -16, -128, -128); bad_color_matrix_offset_components (dst, -16, -128, -128);
/* scale required to get input video black to (0.,0.,0.) */ /* scale required to get input video black to (0.,0.,0.) */
color_matrix_scale_components (dst, (1 / 219.0), (1 / 224.0), (1 / 224.0)); bad_color_matrix_scale_components (dst, (1 / 219.0), (1 / 224.0),
(1 / 224.0));
/* colour matrix, YCbCr -> RGB */ /* colour matrix, YCbCr -> RGB */
/* Requires Y in [0,1.0], Cb&Cr in [-0.5,0.5] */ /* Requires Y in [0,1.0], Cb&Cr in [-0.5,0.5] */
color_matrix_YCbCr_to_RGB (dst, 0.2990, 0.1140); /* SD */ bad_color_matrix_YCbCr_to_RGB (dst, 0.2990, 0.1140); /* SD */
/* /*
* We are now in RGB space * We are now in RGB space
@ -245,72 +247,73 @@ color_matrix_build_yuv_to_rgb_601 (ColorMatrix * dst)
#if 0 #if 0
/* scale to output range. */ /* scale to output range. */
color_matrix_scale_components (dst, 255.0, 255.0, 255.0); bad_color_matrix_scale_components (dst, 255.0, 255.0, 255.0);
#endif #endif
} }
void void
color_matrix_build_bt709_to_bt601 (ColorMatrix * dst) bad_color_matrix_build_bt709_to_bt601 (ColorMatrix * dst)
{ {
color_matrix_set_identity (dst); bad_color_matrix_set_identity (dst);
/* offset required to get input video black to (0.,0.,0.) */ /* offset required to get input video black to (0.,0.,0.) */
color_matrix_offset_components (dst, -16, -128, -128); bad_color_matrix_offset_components (dst, -16, -128, -128);
/* scale required to get input video black to (0.,0.,0.) */ /* scale required to get input video black to (0.,0.,0.) */
color_matrix_scale_components (dst, (1 / 219.0), (1 / 224.0), (1 / 224.0)); bad_color_matrix_scale_components (dst, (1 / 219.0), (1 / 224.0),
(1 / 224.0));
/* colour matrix, YCbCr -> RGB */ /* colour matrix, YCbCr -> RGB */
/* Requires Y in [0,1.0], Cb&Cr in [-0.5,0.5] */ /* Requires Y in [0,1.0], Cb&Cr in [-0.5,0.5] */
color_matrix_YCbCr_to_RGB (dst, 0.2126, 0.0722); /* HD */ bad_color_matrix_YCbCr_to_RGB (dst, 0.2126, 0.0722); /* HD */
color_matrix_RGB_to_YCbCr (dst, 0.2990, 0.1140); /* SD */ bad_color_matrix_RGB_to_YCbCr (dst, 0.2990, 0.1140); /* SD */
color_matrix_scale_components (dst, 219.0, 224.0, 224.0); bad_color_matrix_scale_components (dst, 219.0, 224.0, 224.0);
color_matrix_offset_components (dst, 16, 128, 128); bad_color_matrix_offset_components (dst, 16, 128, 128);
} }
void void
color_matrix_build_rgb_to_yuv_601 (ColorMatrix * dst) bad_color_matrix_build_rgb_to_yuv_601 (ColorMatrix * dst)
{ {
color_matrix_set_identity (dst); bad_color_matrix_set_identity (dst);
color_matrix_RGB_to_YCbCr (dst, 0.2990, 0.1140); /* SD */ bad_color_matrix_RGB_to_YCbCr (dst, 0.2990, 0.1140); /* SD */
color_matrix_scale_components (dst, 219.0, 224.0, 224.0); bad_color_matrix_scale_components (dst, 219.0, 224.0, 224.0);
color_matrix_offset_components (dst, 16, 128, 128); bad_color_matrix_offset_components (dst, 16, 128, 128);
{ {
Color c; Color c;
int i; int i;
for (i = 7; i >= 0; i--) { for (i = 7; i >= 0; i--) {
color_set (&c, (i & 2) ? 0.75 : 0.0, (i & 4) ? 0.75 : 0.0, bad_color_set (&c, (i & 2) ? 0.75 : 0.0, (i & 4) ? 0.75 : 0.0,
(i & 1) ? 0.75 : 0.0); (i & 1) ? 0.75 : 0.0);
color_matrix_apply (dst, &c, &c); bad_color_matrix_apply (dst, &c, &c);
g_print (" { %g, %g, %g },\n", rint (c.v[0]), rint (c.v[1]), g_print (" { %g, %g, %g },\n", rint (c.v[0]), rint (c.v[1]),
rint (c.v[2])); rint (c.v[2]));
} }
color_set (&c, -0.075, -0.075, -0.075); bad_color_set (&c, -0.075, -0.075, -0.075);
color_matrix_apply (dst, &c, &c); bad_color_matrix_apply (dst, &c, &c);
g_print (" { %g, %g, %g },\n", rint (c.v[0]), rint (c.v[1]), g_print (" { %g, %g, %g },\n", rint (c.v[0]), rint (c.v[1]),
rint (c.v[2])); rint (c.v[2]));
color_set (&c, 0.075, 0.075, 0.075); bad_color_set (&c, 0.075, 0.075, 0.075);
color_matrix_apply (dst, &c, &c); bad_color_matrix_apply (dst, &c, &c);
g_print (" { %g, %g, %g },\n", rint (c.v[0]), rint (c.v[1]), g_print (" { %g, %g, %g },\n", rint (c.v[0]), rint (c.v[1]),
rint (c.v[2])); rint (c.v[2]));
} }
} }
void void
color_matrix_invert (ColorMatrix * m) bad_color_matrix_invert (ColorMatrix * m)
{ {
ColorMatrix tmp; ColorMatrix tmp;
int i, j; int i, j;
double det; double det;
color_matrix_set_identity (&tmp); bad_color_matrix_set_identity (&tmp);
for (j = 0; j < 3; j++) { for (j = 0; j < 3; j++) {
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
tmp.m[j][i] = tmp.m[j][i] =
@ -330,18 +333,18 @@ color_matrix_invert (ColorMatrix * m)
} }
void void
color_matrix_copy (ColorMatrix * dest, ColorMatrix * src) bad_color_matrix_copy (ColorMatrix * dest, ColorMatrix * src)
{ {
memcpy (dest, src, sizeof (ColorMatrix)); memcpy (dest, src, sizeof (ColorMatrix));
} }
void void
color_matrix_transpose (ColorMatrix * m) bad_color_matrix_transpose (ColorMatrix * m)
{ {
int i, j; int i, j;
ColorMatrix tmp; ColorMatrix tmp;
color_matrix_set_identity (&tmp); bad_color_matrix_set_identity (&tmp);
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) { for (j = 0; j < 3; j++) {
tmp.m[i][j] = m->m[j][i]; tmp.m[i][j] = m->m[j][i];
@ -351,23 +354,23 @@ color_matrix_transpose (ColorMatrix * m)
} }
void void
color_matrix_build_XYZ (ColorMatrix * dst, bad_color_matrix_build_XYZ (ColorMatrix * dst,
double rx, double ry, double rx, double ry,
double gx, double gy, double bx, double by, double wx, double wy) double gx, double gy, double bx, double by, double wx, double wy)
{ {
Color r, g, b, w, scale; Color r, g, b, w, scale;
ColorMatrix m; ColorMatrix m;
color_set (&r, rx, ry, 1.0); bad_color_set (&r, rx, ry, 1.0);
color_xyY_to_XYZ (&r); bad_color_xyY_to_XYZ (&r);
color_set (&g, gx, gy, 1.0); bad_color_set (&g, gx, gy, 1.0);
color_xyY_to_XYZ (&g); bad_color_xyY_to_XYZ (&g);
color_set (&b, bx, by, 1.0); bad_color_set (&b, bx, by, 1.0);
color_xyY_to_XYZ (&b); bad_color_xyY_to_XYZ (&b);
color_set (&w, wx, wy, 1.0); bad_color_set (&w, wx, wy, 1.0);
color_xyY_to_XYZ (&w); bad_color_xyY_to_XYZ (&w);
color_matrix_set_identity (dst); bad_color_matrix_set_identity (dst);
dst->m[0][0] = r.v[0]; dst->m[0][0] = r.v[0];
dst->m[0][1] = r.v[1]; dst->m[0][1] = r.v[1];
@ -379,13 +382,13 @@ color_matrix_build_XYZ (ColorMatrix * dst,
dst->m[2][1] = b.v[1]; dst->m[2][1] = b.v[1];
dst->m[2][2] = b.v[2]; dst->m[2][2] = b.v[2];
color_matrix_dump (dst); bad_color_matrix_dump (dst);
color_matrix_copy (&m, dst); bad_color_matrix_copy (&m, dst);
color_matrix_invert (&m); bad_color_matrix_invert (&m);
color_matrix_dump (&m); bad_color_matrix_dump (&m);
color_matrix_transpose (&m); bad_color_matrix_transpose (&m);
color_matrix_apply (&m, &scale, &w); bad_color_matrix_apply (&m, &scale, &w);
g_print ("%g %g %g\n", scale.v[0], scale.v[1], scale.v[2]); g_print ("%g %g %g\n", scale.v[0], scale.v[1], scale.v[2]);
dst->m[0][0] = r.v[0] * scale.v[0]; dst->m[0][0] = r.v[0] * scale.v[0];
@ -398,54 +401,54 @@ color_matrix_build_XYZ (ColorMatrix * dst,
dst->m[2][1] = b.v[1] * scale.v[2]; dst->m[2][1] = b.v[1] * scale.v[2];
dst->m[2][2] = b.v[2] * scale.v[2]; dst->m[2][2] = b.v[2] * scale.v[2];
color_matrix_transpose (dst); bad_color_matrix_transpose (dst);
color_matrix_dump (dst); bad_color_matrix_dump (dst);
color_set (&scale, 1, 1, 1); bad_color_set (&scale, 1, 1, 1);
color_matrix_apply (dst, &scale, &scale); bad_color_matrix_apply (dst, &scale, &scale);
color_XYZ_to_xyY (&scale); bad_color_XYZ_to_xyY (&scale);
g_print ("white %g %g %g\n", scale.v[0], scale.v[1], scale.v[2]); g_print ("white %g %g %g\n", scale.v[0], scale.v[1], scale.v[2]);
} }
void void
color_matrix_build_rgb_to_XYZ_601 (ColorMatrix * dst) bad_color_matrix_build_rgb_to_XYZ_601 (ColorMatrix * dst)
{ {
/* SMPTE C primaries, SMPTE 170M-2004 */ /* SMPTE C primaries, SMPTE 170M-2004 */
color_matrix_build_XYZ (dst, bad_color_matrix_build_XYZ (dst,
0.630, 0.340, 0.310, 0.595, 0.155, 0.070, 0.3127, 0.3290); 0.630, 0.340, 0.310, 0.595, 0.155, 0.070, 0.3127, 0.3290);
#if 0 #if 0
/* NTSC 1953 primaries, SMPTE 170M-2004 */ /* NTSC 1953 primaries, SMPTE 170M-2004 */
color_matrix_build_XYZ (dst, bad_color_matrix_build_XYZ (dst,
0.67, 0.33, 0.21, 0.71, 0.14, 0.08, 0.3127, 0.3290); 0.67, 0.33, 0.21, 0.71, 0.14, 0.08, 0.3127, 0.3290);
#endif #endif
} }
void void
color_matrix_build_XYZ_to_rgb_709 (ColorMatrix * dst) bad_color_matrix_build_XYZ_to_rgb_709 (ColorMatrix * dst)
{ {
/* Rec. ITU-R BT.709-5 */ /* Rec. ITU-R BT.709-5 */
color_matrix_build_XYZ (dst, bad_color_matrix_build_XYZ (dst,
0.640, 0.330, 0.300, 0.600, 0.150, 0.060, 0.3127, 0.3290); 0.640, 0.330, 0.300, 0.600, 0.150, 0.060, 0.3127, 0.3290);
} }
void void
color_matrix_build_XYZ_to_rgb_dell (ColorMatrix * dst) bad_color_matrix_build_XYZ_to_rgb_dell (ColorMatrix * dst)
{ {
/* Dell monitor */ /* Dell monitor */
#if 1 #if 1
color_matrix_build_XYZ (dst, bad_color_matrix_build_XYZ (dst,
0.662, 0.329, 0.205, 0.683, 0.146, 0.077, 0.3135, 0.3290); 0.662, 0.329, 0.205, 0.683, 0.146, 0.077, 0.3135, 0.3290);
#endif #endif
#if 0 #if 0
color_matrix_build_XYZ (dst, bad_color_matrix_build_XYZ (dst,
0.630, 0.340, 0.310, 0.595, 0.155, 0.070, 0.3127, 0.3290); 0.630, 0.340, 0.310, 0.595, 0.155, 0.070, 0.3127, 0.3290);
#endif #endif
color_matrix_invert (dst); bad_color_matrix_invert (dst);
} }
void void
color_transfer_function_apply (Color * dest, Color * src) bad_color_transfer_function_apply (Color * dest, Color * src)
{ {
int i; int i;
@ -459,7 +462,7 @@ color_transfer_function_apply (Color * dest, Color * src)
} }
void void
color_transfer_function_unapply (Color * dest, Color * src) bad_color_transfer_function_unapply (Color * dest, Color * src)
{ {
int i; int i;
@ -473,7 +476,7 @@ color_transfer_function_unapply (Color * dest, Color * src)
} }
void void
color_gamut_clamp (Color * dest, Color * src) bad_color_gamut_clamp (Color * dest, Color * src)
{ {
dest->v[0] = CLAMP (src->v[0], 0.0, 1.0); dest->v[0] = CLAMP (src->v[0], 0.0, 1.0);
dest->v[1] = CLAMP (src->v[1], 0.0, 1.0); dest->v[1] = CLAMP (src->v[1], 0.0, 1.0);
@ -482,12 +485,12 @@ color_gamut_clamp (Color * dest, Color * src)
#if 0 #if 0
static guint8 * static guint8 *
get_color_transform_table (void) get_bad_color_transform_table (void)
{ {
static guint8 *color_transform_table = NULL; static guint8 *bad_color_transform_table = NULL;
#if 1 #if 1
if (!color_transform_table) { if (!bad_color_transform_table) {
ColorMatrix bt601_to_rgb; ColorMatrix bt601_to_rgb;
ColorMatrix bt601_to_yuv; ColorMatrix bt601_to_yuv;
ColorMatrix bt601_rgb_to_XYZ; ColorMatrix bt601_rgb_to_XYZ;
@ -497,16 +500,16 @@ get_color_transform_table (void)
guint8 *table_v; guint8 *table_v;
int y, u, v; int y, u, v;
color_matrix_build_yuv_to_rgb_601 (&bt601_to_rgb); bad_color_matrix_build_yuv_to_rgb_601 (&bt601_to_rgb);
color_matrix_build_rgb_to_yuv_601 (&bt601_to_yuv); bad_color_matrix_build_rgb_to_yuv_601 (&bt601_to_yuv);
color_matrix_build_rgb_to_XYZ_601 (&bt601_rgb_to_XYZ); bad_color_matrix_build_rgb_to_XYZ_601 (&bt601_rgb_to_XYZ);
color_matrix_build_XYZ_to_rgb_dell (&dell_XYZ_to_rgb); bad_color_matrix_build_XYZ_to_rgb_dell (&dell_XYZ_to_rgb);
color_transform_table = g_malloc (0x1000000 * 3); bad_color_transform_table = g_malloc (0x1000000 * 3);
table_y = COG_OFFSET (color_transform_table, 0 * 0x1000000); table_y = COG_OFFSET (bad_color_transform_table, 0 * 0x1000000);
table_u = COG_OFFSET (color_transform_table, 1 * 0x1000000); table_u = COG_OFFSET (bad_color_transform_table, 1 * 0x1000000);
table_v = COG_OFFSET (color_transform_table, 2 * 0x1000000); table_v = COG_OFFSET (bad_color_transform_table, 2 * 0x1000000);
for (y = 0; y < 256; y++) { for (y = 0; y < 256; y++) {
for (u = 0; u < 256; u++) { for (u = 0; u < 256; u++) {
@ -516,14 +519,14 @@ get_color_transform_table (void)
c.v[0] = y; c.v[0] = y;
c.v[1] = u; c.v[1] = u;
c.v[2] = v; c.v[2] = v;
color_matrix_apply (&bt601_to_rgb, &c, &c); bad_color_matrix_apply (&bt601_to_rgb, &c, &c);
color_gamut_clamp (&c, &c); bad_color_gamut_clamp (&c, &c);
color_transfer_function_apply (&c, &c); bad_color_transfer_function_apply (&c, &c);
color_matrix_apply (&bt601_rgb_to_XYZ, &c, &c); bad_color_matrix_apply (&bt601_rgb_to_XYZ, &c, &c);
color_matrix_apply (&dell_XYZ_to_rgb, &c, &c); bad_color_matrix_apply (&dell_XYZ_to_rgb, &c, &c);
color_transfer_function_unapply (&c, &c); bad_color_transfer_function_unapply (&c, &c);
color_gamut_clamp (&c, &c); bad_color_gamut_clamp (&c, &c);
color_matrix_apply (&bt601_to_yuv, &c, &c); bad_color_matrix_apply (&bt601_to_yuv, &c, &c);
table_y[(y << 16) | (u << 8) | (v)] = rint (c.v[0]); table_y[(y << 16) | (u << 8) | (v)] = rint (c.v[0]);
table_u[(y << 16) | (u << 8) | (v)] = rint (c.v[1]); table_u[(y << 16) | (u << 8) | (v)] = rint (c.v[1]);
@ -534,20 +537,20 @@ get_color_transform_table (void)
} }
#endif #endif
#if 0 #if 0
if (!color_transform_table) { if (!bad_color_transform_table) {
ColorMatrix bt709_to_bt601; ColorMatrix bt709_to_bt601;
guint8 *table_y; guint8 *table_y;
guint8 *table_u; guint8 *table_u;
guint8 *table_v; guint8 *table_v;
int y, u, v; int y, u, v;
color_matrix_build_bt709_to_bt601 (&bt709_to_bt601); bad_color_matrix_build_bt709_to_bt601 (&bt709_to_bt601);
color_transform_table = g_malloc (0x1000000 * 3); bad_color_transform_table = g_malloc (0x1000000 * 3);
table_y = COG_OFFSET (color_transform_table, 0 * 0x1000000); table_y = COG_OFFSET (bad_color_transform_table, 0 * 0x1000000);
table_u = COG_OFFSET (color_transform_table, 1 * 0x1000000); table_u = COG_OFFSET (bad_color_transform_table, 1 * 0x1000000);
table_v = COG_OFFSET (color_transform_table, 2 * 0x1000000); table_v = COG_OFFSET (bad_color_transform_table, 2 * 0x1000000);
for (y = 0; y < 256; y++) { for (y = 0; y < 256; y++) {
for (u = 0; u < 256; u++) { for (u = 0; u < 256; u++) {
@ -557,7 +560,7 @@ get_color_transform_table (void)
c.v[0] = y; c.v[0] = y;
c.v[1] = u; c.v[1] = u;
c.v[2] = v; c.v[2] = v;
color_matrix_apply (&bt709_to_bt601, &c, &c); bad_color_matrix_apply (&bt709_to_bt601, &c, &c);
table_y[(y << 16) | (u << 8) | (v)] = rint (c.v[0]); table_y[(y << 16) | (u << 8) | (v)] = rint (c.v[0]);
table_u[(y << 16) | (u << 8) | (v)] = rint (c.v[1]); table_u[(y << 16) | (u << 8) | (v)] = rint (c.v[1]);
@ -568,6 +571,6 @@ get_color_transform_table (void)
} }
#endif #endif
return color_transform_table; return bad_color_transform_table;
} }
#endif #endif

View file

@ -37,33 +37,33 @@ struct _ColorMatrix
double m[4][4]; double m[4][4];
}; };
void color_xyY_to_XYZ (Color * c); void bad_color_xyY_to_XYZ (Color * c);
void color_XYZ_to_xyY (Color * c); void bad_color_XYZ_to_xyY (Color * c);
void color_set (Color * c, double x, double y, double z); void bad_color_set (Color * c, double x, double y, double z);
void color_matrix_set_identity (ColorMatrix * m); void bad_color_matrix_set_identity (ColorMatrix * m);
void color_matrix_dump (ColorMatrix * m); void bad_color_matrix_dump (ColorMatrix * m);
void color_matrix_multiply (ColorMatrix * dst, ColorMatrix * a, ColorMatrix * b); void bad_color_matrix_multiply (ColorMatrix * dst, ColorMatrix * a, ColorMatrix * b);
void color_matrix_apply (ColorMatrix * m, Color * dest, Color * src); void bad_color_matrix_apply (ColorMatrix * m, Color * dest, Color * src);
void color_matrix_offset_components (ColorMatrix * m, double a1, double a2, void bad_color_matrix_offset_components (ColorMatrix * m, double a1, double a2,
double a3); double a3);
void color_matrix_scale_components (ColorMatrix * m, double a1, double a2, double a3); void bad_color_matrix_scale_components (ColorMatrix * m, double a1, double a2, double a3);
void color_matrix_YCbCr_to_RGB (ColorMatrix * m, double Kr, double Kb); void bad_color_matrix_YCbCr_to_RGB (ColorMatrix * m, double Kr, double Kb);
void color_matrix_RGB_to_YCbCr (ColorMatrix * m, double Kr, double Kb); void bad_color_matrix_RGB_to_YCbCr (ColorMatrix * m, double Kr, double Kb);
void color_matrix_build_yuv_to_rgb_601 (ColorMatrix * dst); void bad_color_matrix_build_yuv_to_rgb_601 (ColorMatrix * dst);
void color_matrix_build_bt709_to_bt601 (ColorMatrix * dst); void bad_color_matrix_build_bt709_to_bt601 (ColorMatrix * dst);
void color_matrix_build_rgb_to_yuv_601 (ColorMatrix * dst); void bad_color_matrix_build_rgb_to_yuv_601 (ColorMatrix * dst);
void color_matrix_invert (ColorMatrix * m); void bad_color_matrix_invert (ColorMatrix * m);
void color_matrix_copy (ColorMatrix * dest, ColorMatrix * src); void bad_color_matrix_copy (ColorMatrix * dest, ColorMatrix * src);
void color_matrix_transpose (ColorMatrix * m); void bad_color_matrix_transpose (ColorMatrix * m);
void color_matrix_build_XYZ (ColorMatrix * dst, void bad_color_matrix_build_XYZ (ColorMatrix * dst,
double rx, double ry, double rx, double ry,
double gx, double gy, double bx, double by, double wx, double wy); double gx, double gy, double bx, double by, double wx, double wy);
void color_matrix_build_rgb_to_XYZ_601 (ColorMatrix * dst); void bad_color_matrix_build_rgb_to_XYZ_601 (ColorMatrix * dst);
void color_matrix_build_XYZ_to_rgb_709 (ColorMatrix * dst); void bad_color_matrix_build_XYZ_to_rgb_709 (ColorMatrix * dst);
void color_matrix_build_XYZ_to_rgb_dell (ColorMatrix * dst); void bad_color_matrix_build_XYZ_to_rgb_dell (ColorMatrix * dst);
void color_transfer_function_apply (Color * dest, Color * src); void bad_color_transfer_function_apply (Color * dest, Color * src);
void color_transfer_function_unapply (Color * dest, Color * src); void bad_color_transfer_function_unapply (Color * dest, Color * src);
void color_gamut_clamp (Color * dest, Color * src); void bad_color_gamut_clamp (Color * dest, Color * src);
G_END_DECLS G_END_DECLS

View file

@ -139,7 +139,7 @@ gst_videoaggregator_pad_finalize (GObject * o)
GstVideoAggregatorPad *vaggpad = GST_VIDEO_AGGREGATOR_PAD (o); GstVideoAggregatorPad *vaggpad = GST_VIDEO_AGGREGATOR_PAD (o);
if (vaggpad->priv->convert) if (vaggpad->priv->convert)
videoconvert_convert_free (vaggpad->priv->convert); badvideoconvert_convert_free (vaggpad->priv->convert);
vaggpad->priv->convert = NULL; vaggpad->priv->convert = NULL;
G_OBJECT_CLASS (gst_videoaggregator_pad_parent_class)->finalize (o); G_OBJECT_CLASS (gst_videoaggregator_pad_parent_class)->finalize (o);
@ -433,7 +433,7 @@ gst_videoaggregator_update_converters (GstVideoAggregator * vagg)
continue; continue;
if (pad->priv->convert) if (pad->priv->convert)
videoconvert_convert_free (pad->priv->convert); badvideoconvert_convert_free (pad->priv->convert);
pad->priv->convert = NULL; pad->priv->convert = NULL;
@ -446,7 +446,7 @@ gst_videoaggregator_update_converters (GstVideoAggregator * vagg)
GST_DEBUG_OBJECT (pad, "This pad will be converted from %d to %d", GST_DEBUG_OBJECT (pad, "This pad will be converted from %d to %d",
GST_VIDEO_INFO_FORMAT (&pad->info), GST_VIDEO_INFO_FORMAT (&pad->info),
GST_VIDEO_INFO_FORMAT (&best_info)); GST_VIDEO_INFO_FORMAT (&best_info));
pad->priv->convert = videoconvert_convert_new (&pad->info, &best_info); pad->priv->convert = badvideoconvert_convert_new (&pad->info, &best_info);
pad->need_conversion_update = TRUE; pad->need_conversion_update = TRUE;
if (!pad->priv->convert) { if (!pad->priv->convert) {
g_free (colorimetry); g_free (colorimetry);
@ -1059,7 +1059,8 @@ prepare_frames (GstVideoAggregator * vagg, GstVideoAggregatorPad * pad)
return FALSE; return FALSE;
} }
videoconvert_convert_convert (pad->priv->convert, converted_frame, frame); badvideoconvert_convert_convert (pad->priv->convert, converted_frame,
frame);
pad->converted_buffer = converted_buf; pad->converted_buffer = converted_buf;
gst_video_frame_unmap (frame); gst_video_frame_unmap (frame);
} else { } else {

View file

@ -47,7 +47,7 @@ static void videoconvert_dither_halftone (VideoConvert * convert,
VideoConvert * VideoConvert *
videoconvert_convert_new (GstVideoInfo * in_info, GstVideoInfo * out_info) badvideoconvert_convert_new (GstVideoInfo * in_info, GstVideoInfo * out_info)
{ {
VideoConvert *convert; VideoConvert *convert;
gint width; gint width;
@ -80,13 +80,13 @@ videoconvert_convert_new (GstVideoInfo * in_info, GstVideoInfo * out_info)
/* ERRORS */ /* ERRORS */
no_convert: no_convert:
{ {
videoconvert_convert_free (convert); badvideoconvert_convert_free (convert);
return NULL; return NULL;
} }
} }
void void
videoconvert_convert_free (VideoConvert * convert) badvideoconvert_convert_free (VideoConvert * convert)
{ {
gint i; gint i;
@ -104,7 +104,7 @@ videoconvert_convert_free (VideoConvert * convert)
} }
void void
videoconvert_convert_set_dither (VideoConvert * convert, int type) badvideoconvert_convert_set_dither (VideoConvert * convert, int type)
{ {
switch (type) { switch (type) {
case 0: case 0:
@ -121,7 +121,7 @@ videoconvert_convert_set_dither (VideoConvert * convert, int type)
} }
void void
videoconvert_convert_convert (VideoConvert * convert, badvideoconvert_convert_convert (VideoConvert * convert,
GstVideoFrame * dest, const GstVideoFrame * src) GstVideoFrame * dest, const GstVideoFrame * src)
{ {
convert->convert (convert, dest, src); convert->convert (convert, dest, src);
@ -271,20 +271,20 @@ videoconvert_convert_compute_matrix (VideoConvert * convert)
convert->matrix = videoconvert_convert_matrix8; convert->matrix = videoconvert_convert_matrix8;
} }
color_matrix_set_identity (&dst); bad_color_matrix_set_identity (&dst);
/* 1, bring color components to [0..1.0] range */ /* 1, bring color components to [0..1.0] range */
gst_video_color_range_offsets (in_info->colorimetry.range, suinfo, offset, gst_video_color_range_offsets (in_info->colorimetry.range, suinfo, offset,
scale); scale);
color_matrix_offset_components (&dst, -offset[0], -offset[1], -offset[2]); bad_color_matrix_offset_components (&dst, -offset[0], -offset[1], -offset[2]);
color_matrix_scale_components (&dst, 1 / ((float) scale[0]), bad_color_matrix_scale_components (&dst, 1 / ((float) scale[0]),
1 / ((float) scale[1]), 1 / ((float) scale[2])); 1 / ((float) scale[1]), 1 / ((float) scale[2]));
/* 2. bring components to R'G'B' space */ /* 2. bring components to R'G'B' space */
if (get_Kr_Kb (in_info->colorimetry.matrix, &Kr, &Kb)) if (get_Kr_Kb (in_info->colorimetry.matrix, &Kr, &Kb))
color_matrix_YCbCr_to_RGB (&dst, Kr, Kb); bad_color_matrix_YCbCr_to_RGB (&dst, Kr, Kb);
/* 3. inverse transfer function. R'G'B' to linear RGB */ /* 3. inverse transfer function. R'G'B' to linear RGB */
@ -296,19 +296,19 @@ videoconvert_convert_compute_matrix (VideoConvert * convert)
/* 7. bring components to YCbCr space */ /* 7. bring components to YCbCr space */
if (get_Kr_Kb (out_info->colorimetry.matrix, &Kr, &Kb)) if (get_Kr_Kb (out_info->colorimetry.matrix, &Kr, &Kb))
color_matrix_RGB_to_YCbCr (&dst, Kr, Kb); bad_color_matrix_RGB_to_YCbCr (&dst, Kr, Kb);
/* 8, bring color components to nominal range */ /* 8, bring color components to nominal range */
gst_video_color_range_offsets (out_info->colorimetry.range, duinfo, offset, gst_video_color_range_offsets (out_info->colorimetry.range, duinfo, offset,
scale); scale);
color_matrix_scale_components (&dst, (float) scale[0], (float) scale[1], bad_color_matrix_scale_components (&dst, (float) scale[0], (float) scale[1],
(float) scale[2]); (float) scale[2]);
color_matrix_offset_components (&dst, offset[0], offset[1], offset[2]); bad_color_matrix_offset_components (&dst, offset[0], offset[1], offset[2]);
/* because we're doing fixed point matrix coefficients */ /* because we're doing fixed point matrix coefficients */
color_matrix_scale_components (&dst, SCALE_F, SCALE_F, SCALE_F); bad_color_matrix_scale_components (&dst, SCALE_F, SCALE_F, SCALE_F);
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
for (j = 0; j < 4; j++) for (j = 0; j < 4; j++)
@ -674,7 +674,7 @@ convert_I420_YUY2 (VideoConvert * convert, GstVideoFrame * dest,
for (i = 0; i < GST_ROUND_DOWN_2 (height); i += 2) { for (i = 0; i < GST_ROUND_DOWN_2 (height); i += 2) {
GET_LINE_OFFSETS (interlaced, i, l1, l2); GET_LINE_OFFSETS (interlaced, i, l1, l2);
video_convert_orc_convert_I420_YUY2 (FRAME_GET_LINE (dest, l1), bad_video_convert_orc_convert_I420_YUY2 (FRAME_GET_LINE (dest, l1),
FRAME_GET_LINE (dest, l2), FRAME_GET_LINE (dest, l2),
FRAME_GET_Y_LINE (src, l1), FRAME_GET_Y_LINE (src, l1),
FRAME_GET_Y_LINE (src, l2), FRAME_GET_Y_LINE (src, l2),
@ -702,7 +702,7 @@ convert_I420_UYVY (VideoConvert * convert, GstVideoFrame * dest,
for (i = 0; i < GST_ROUND_DOWN_2 (height); i += 2) { for (i = 0; i < GST_ROUND_DOWN_2 (height); i += 2) {
GET_LINE_OFFSETS (interlaced, i, l1, l2); GET_LINE_OFFSETS (interlaced, i, l1, l2);
video_convert_orc_convert_I420_UYVY (FRAME_GET_LINE (dest, l1), bad_video_convert_orc_convert_I420_UYVY (FRAME_GET_LINE (dest, l1),
FRAME_GET_LINE (dest, l2), FRAME_GET_LINE (dest, l2),
FRAME_GET_Y_LINE (src, l1), FRAME_GET_Y_LINE (src, l1),
FRAME_GET_Y_LINE (src, l2), FRAME_GET_Y_LINE (src, l2),
@ -730,7 +730,7 @@ convert_I420_AYUV (VideoConvert * convert, GstVideoFrame * dest,
for (i = 0; i < GST_ROUND_DOWN_2 (height); i += 2) { for (i = 0; i < GST_ROUND_DOWN_2 (height); i += 2) {
GET_LINE_OFFSETS (interlaced, i, l1, l2); GET_LINE_OFFSETS (interlaced, i, l1, l2);
video_convert_orc_convert_I420_AYUV (FRAME_GET_LINE (dest, l1), bad_video_convert_orc_convert_I420_AYUV (FRAME_GET_LINE (dest, l1),
FRAME_GET_LINE (dest, l2), FRAME_GET_LINE (dest, l2),
FRAME_GET_Y_LINE (src, l1), FRAME_GET_Y_LINE (src, l1),
FRAME_GET_Y_LINE (src, l2), FRAME_GET_Y_LINE (src, l2),
@ -751,16 +751,16 @@ convert_I420_Y42B (VideoConvert * convert, GstVideoFrame * dest,
gint width = convert->width; gint width = convert->width;
gint height = convert->height; gint height = convert->height;
video_convert_orc_memcpy_2d (FRAME_GET_Y_LINE (dest, 0), bad_video_convert_orc_memcpy_2d (FRAME_GET_Y_LINE (dest, 0),
FRAME_GET_Y_STRIDE (dest), FRAME_GET_Y_LINE (src, 0), FRAME_GET_Y_STRIDE (dest), FRAME_GET_Y_LINE (src, 0),
FRAME_GET_Y_STRIDE (src), width, height); FRAME_GET_Y_STRIDE (src), width, height);
video_convert_orc_planar_chroma_420_422 (FRAME_GET_U_LINE (dest, 0), bad_video_convert_orc_planar_chroma_420_422 (FRAME_GET_U_LINE (dest, 0),
2 * FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (dest, 1), 2 * FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (dest, 1),
2 * FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (src, 0), 2 * FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (src, 0),
FRAME_GET_U_STRIDE (src), (width + 1) / 2, height / 2); FRAME_GET_U_STRIDE (src), (width + 1) / 2, height / 2);
video_convert_orc_planar_chroma_420_422 (FRAME_GET_V_LINE (dest, 0), bad_video_convert_orc_planar_chroma_420_422 (FRAME_GET_V_LINE (dest, 0),
2 * FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (dest, 1), 2 * FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (dest, 1),
2 * FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (src, 0), 2 * FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (src, 0),
FRAME_GET_V_STRIDE (src), (width + 1) / 2, height / 2); FRAME_GET_V_STRIDE (src), (width + 1) / 2, height / 2);
@ -773,16 +773,16 @@ convert_I420_Y444 (VideoConvert * convert, GstVideoFrame * dest,
gint width = convert->width; gint width = convert->width;
gint height = convert->height; gint height = convert->height;
video_convert_orc_memcpy_2d (FRAME_GET_Y_LINE (dest, 0), bad_video_convert_orc_memcpy_2d (FRAME_GET_Y_LINE (dest, 0),
FRAME_GET_Y_STRIDE (dest), FRAME_GET_Y_LINE (src, 0), FRAME_GET_Y_STRIDE (dest), FRAME_GET_Y_LINE (src, 0),
FRAME_GET_Y_STRIDE (src), width, height); FRAME_GET_Y_STRIDE (src), width, height);
video_convert_orc_planar_chroma_420_444 (FRAME_GET_U_LINE (dest, 0), bad_video_convert_orc_planar_chroma_420_444 (FRAME_GET_U_LINE (dest, 0),
2 * FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (dest, 1), 2 * FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (dest, 1),
2 * FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (src, 0), 2 * FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (src, 0),
FRAME_GET_U_STRIDE (src), (width + 1) / 2, height / 2); FRAME_GET_U_STRIDE (src), (width + 1) / 2, height / 2);
video_convert_orc_planar_chroma_420_444 (FRAME_GET_V_LINE (dest, 0), bad_video_convert_orc_planar_chroma_420_444 (FRAME_GET_V_LINE (dest, 0),
2 * FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (dest, 1), 2 * FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (dest, 1),
2 * FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (src, 0), 2 * FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (src, 0),
FRAME_GET_V_STRIDE (src), (width + 1) / 2, height / 2); FRAME_GET_V_STRIDE (src), (width + 1) / 2, height / 2);
@ -807,7 +807,7 @@ convert_YUY2_I420 (VideoConvert * convert, GstVideoFrame * dest,
for (i = 0; i < GST_ROUND_DOWN_2 (height); i += 2) { for (i = 0; i < GST_ROUND_DOWN_2 (height); i += 2) {
GET_LINE_OFFSETS (interlaced, i, l1, l2); GET_LINE_OFFSETS (interlaced, i, l1, l2);
video_convert_orc_convert_YUY2_I420 (FRAME_GET_Y_LINE (dest, l1), bad_video_convert_orc_convert_YUY2_I420 (FRAME_GET_Y_LINE (dest, l1),
FRAME_GET_Y_LINE (dest, l2), FRAME_GET_Y_LINE (dest, l2),
FRAME_GET_U_LINE (dest, i >> 1), FRAME_GET_U_LINE (dest, i >> 1),
FRAME_GET_V_LINE (dest, i >> 1), FRAME_GET_V_LINE (dest, i >> 1),
@ -828,7 +828,7 @@ convert_YUY2_AYUV (VideoConvert * convert, GstVideoFrame * dest,
gint width = convert->width; gint width = convert->width;
gint height = convert->height; gint height = convert->height;
video_convert_orc_convert_YUY2_AYUV (FRAME_GET_LINE (dest, 0), bad_video_convert_orc_convert_YUY2_AYUV (FRAME_GET_LINE (dest, 0),
FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0), FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0),
FRAME_GET_STRIDE (src), (width + 1) / 2, height); FRAME_GET_STRIDE (src), (width + 1) / 2, height);
} }
@ -840,7 +840,7 @@ convert_YUY2_Y42B (VideoConvert * convert, GstVideoFrame * dest,
gint width = convert->width; gint width = convert->width;
gint height = convert->height; gint height = convert->height;
video_convert_orc_convert_YUY2_Y42B (FRAME_GET_Y_LINE (dest, 0), bad_video_convert_orc_convert_YUY2_Y42B (FRAME_GET_Y_LINE (dest, 0),
FRAME_GET_Y_STRIDE (dest), FRAME_GET_U_LINE (dest, 0), FRAME_GET_Y_STRIDE (dest), FRAME_GET_U_LINE (dest, 0),
FRAME_GET_U_STRIDE (dest), FRAME_GET_V_LINE (dest, 0), FRAME_GET_U_STRIDE (dest), FRAME_GET_V_LINE (dest, 0),
FRAME_GET_V_STRIDE (dest), FRAME_GET_LINE (src, 0), FRAME_GET_V_STRIDE (dest), FRAME_GET_LINE (src, 0),
@ -854,7 +854,7 @@ convert_YUY2_Y444 (VideoConvert * convert, GstVideoFrame * dest,
gint width = convert->width; gint width = convert->width;
gint height = convert->height; gint height = convert->height;
video_convert_orc_convert_YUY2_Y444 (FRAME_GET_COMP_LINE (dest, 0, 0), bad_video_convert_orc_convert_YUY2_Y444 (FRAME_GET_COMP_LINE (dest, 0, 0),
FRAME_GET_COMP_STRIDE (dest, 0), FRAME_GET_COMP_LINE (dest, 1, 0), FRAME_GET_COMP_STRIDE (dest, 0), FRAME_GET_COMP_LINE (dest, 1, 0),
FRAME_GET_COMP_STRIDE (dest, 1), FRAME_GET_COMP_LINE (dest, 2, 0), FRAME_GET_COMP_STRIDE (dest, 1), FRAME_GET_COMP_LINE (dest, 2, 0),
FRAME_GET_COMP_STRIDE (dest, 2), FRAME_GET_LINE (src, 0), FRAME_GET_COMP_STRIDE (dest, 2), FRAME_GET_LINE (src, 0),
@ -875,7 +875,7 @@ convert_UYVY_I420 (VideoConvert * convert, GstVideoFrame * dest,
for (i = 0; i < GST_ROUND_DOWN_2 (height); i += 2) { for (i = 0; i < GST_ROUND_DOWN_2 (height); i += 2) {
GET_LINE_OFFSETS (interlaced, i, l1, l2); GET_LINE_OFFSETS (interlaced, i, l1, l2);
video_convert_orc_convert_UYVY_I420 (FRAME_GET_COMP_LINE (dest, 0, l1), bad_video_convert_orc_convert_UYVY_I420 (FRAME_GET_COMP_LINE (dest, 0, l1),
FRAME_GET_COMP_LINE (dest, 0, l2), FRAME_GET_COMP_LINE (dest, 0, l2),
FRAME_GET_COMP_LINE (dest, 1, i >> 1), FRAME_GET_COMP_LINE (dest, 1, i >> 1),
FRAME_GET_COMP_LINE (dest, 2, i >> 1), FRAME_GET_COMP_LINE (dest, 2, i >> 1),
@ -896,7 +896,7 @@ convert_UYVY_AYUV (VideoConvert * convert, GstVideoFrame * dest,
gint width = convert->width; gint width = convert->width;
gint height = convert->height; gint height = convert->height;
video_convert_orc_convert_UYVY_AYUV (FRAME_GET_LINE (dest, 0), bad_video_convert_orc_convert_UYVY_AYUV (FRAME_GET_LINE (dest, 0),
FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0), FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0),
FRAME_GET_STRIDE (src), (width + 1) / 2, height); FRAME_GET_STRIDE (src), (width + 1) / 2, height);
} }
@ -908,7 +908,7 @@ convert_UYVY_YUY2 (VideoConvert * convert, GstVideoFrame * dest,
gint width = convert->width; gint width = convert->width;
gint height = convert->height; gint height = convert->height;
video_convert_orc_convert_UYVY_YUY2 (FRAME_GET_LINE (dest, 0), bad_video_convert_orc_convert_UYVY_YUY2 (FRAME_GET_LINE (dest, 0),
FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0), FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0),
FRAME_GET_STRIDE (src), (width + 1) / 2, height); FRAME_GET_STRIDE (src), (width + 1) / 2, height);
} }
@ -920,7 +920,7 @@ convert_UYVY_Y42B (VideoConvert * convert, GstVideoFrame * dest,
gint width = convert->width; gint width = convert->width;
gint height = convert->height; gint height = convert->height;
video_convert_orc_convert_UYVY_Y42B (FRAME_GET_Y_LINE (dest, 0), bad_video_convert_orc_convert_UYVY_Y42B (FRAME_GET_Y_LINE (dest, 0),
FRAME_GET_Y_STRIDE (dest), FRAME_GET_U_LINE (dest, 0), FRAME_GET_Y_STRIDE (dest), FRAME_GET_U_LINE (dest, 0),
FRAME_GET_U_STRIDE (dest), FRAME_GET_V_LINE (dest, 0), FRAME_GET_U_STRIDE (dest), FRAME_GET_V_LINE (dest, 0),
FRAME_GET_V_STRIDE (dest), FRAME_GET_LINE (src, 0), FRAME_GET_V_STRIDE (dest), FRAME_GET_LINE (src, 0),
@ -934,7 +934,7 @@ convert_UYVY_Y444 (VideoConvert * convert, GstVideoFrame * dest,
gint width = convert->width; gint width = convert->width;
gint height = convert->height; gint height = convert->height;
video_convert_orc_convert_UYVY_Y444 (FRAME_GET_Y_LINE (dest, 0), bad_video_convert_orc_convert_UYVY_Y444 (FRAME_GET_Y_LINE (dest, 0),
FRAME_GET_Y_STRIDE (dest), FRAME_GET_U_LINE (dest, 0), FRAME_GET_Y_STRIDE (dest), FRAME_GET_U_LINE (dest, 0),
FRAME_GET_U_STRIDE (dest), FRAME_GET_V_LINE (dest, 0), FRAME_GET_U_STRIDE (dest), FRAME_GET_V_LINE (dest, 0),
FRAME_GET_V_STRIDE (dest), FRAME_GET_LINE (src, 0), FRAME_GET_V_STRIDE (dest), FRAME_GET_LINE (src, 0),
@ -949,7 +949,7 @@ convert_AYUV_I420 (VideoConvert * convert, GstVideoFrame * dest,
gint height = convert->height; gint height = convert->height;
/* only for even width/height */ /* only for even width/height */
video_convert_orc_convert_AYUV_I420 (FRAME_GET_Y_LINE (dest, 0), bad_video_convert_orc_convert_AYUV_I420 (FRAME_GET_Y_LINE (dest, 0),
2 * FRAME_GET_Y_STRIDE (dest), FRAME_GET_Y_LINE (dest, 1), 2 * FRAME_GET_Y_STRIDE (dest), FRAME_GET_Y_LINE (dest, 1),
2 * FRAME_GET_Y_STRIDE (dest), FRAME_GET_U_LINE (dest, 0), 2 * FRAME_GET_Y_STRIDE (dest), FRAME_GET_U_LINE (dest, 0),
FRAME_GET_U_STRIDE (dest), FRAME_GET_V_LINE (dest, 0), FRAME_GET_U_STRIDE (dest), FRAME_GET_V_LINE (dest, 0),
@ -966,7 +966,7 @@ convert_AYUV_YUY2 (VideoConvert * convert, GstVideoFrame * dest,
gint height = convert->height; gint height = convert->height;
/* only for even width */ /* only for even width */
video_convert_orc_convert_AYUV_YUY2 (FRAME_GET_LINE (dest, 0), bad_video_convert_orc_convert_AYUV_YUY2 (FRAME_GET_LINE (dest, 0),
FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0), FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0),
FRAME_GET_STRIDE (src), width / 2, height); FRAME_GET_STRIDE (src), width / 2, height);
} }
@ -979,7 +979,7 @@ convert_AYUV_UYVY (VideoConvert * convert, GstVideoFrame * dest,
gint height = convert->height; gint height = convert->height;
/* only for even width */ /* only for even width */
video_convert_orc_convert_AYUV_UYVY (FRAME_GET_LINE (dest, 0), bad_video_convert_orc_convert_AYUV_UYVY (FRAME_GET_LINE (dest, 0),
FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0), FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0),
FRAME_GET_STRIDE (src), width / 2, height); FRAME_GET_STRIDE (src), width / 2, height);
} }
@ -992,7 +992,7 @@ convert_AYUV_Y42B (VideoConvert * convert, GstVideoFrame * dest,
gint height = convert->height; gint height = convert->height;
/* only works for even width */ /* only works for even width */
video_convert_orc_convert_AYUV_Y42B (FRAME_GET_Y_LINE (dest, 0), bad_video_convert_orc_convert_AYUV_Y42B (FRAME_GET_Y_LINE (dest, 0),
FRAME_GET_Y_STRIDE (dest), FRAME_GET_U_LINE (dest, 0), FRAME_GET_Y_STRIDE (dest), FRAME_GET_U_LINE (dest, 0),
FRAME_GET_U_STRIDE (dest), FRAME_GET_V_LINE (dest, 0), FRAME_GET_U_STRIDE (dest), FRAME_GET_V_LINE (dest, 0),
FRAME_GET_V_STRIDE (dest), FRAME_GET_LINE (src, 0), FRAME_GET_V_STRIDE (dest), FRAME_GET_LINE (src, 0),
@ -1006,7 +1006,7 @@ convert_AYUV_Y444 (VideoConvert * convert, GstVideoFrame * dest,
gint width = convert->width; gint width = convert->width;
gint height = convert->height; gint height = convert->height;
video_convert_orc_convert_AYUV_Y444 (FRAME_GET_Y_LINE (dest, 0), bad_video_convert_orc_convert_AYUV_Y444 (FRAME_GET_Y_LINE (dest, 0),
FRAME_GET_Y_STRIDE (dest), FRAME_GET_U_LINE (dest, 0), FRAME_GET_Y_STRIDE (dest), FRAME_GET_U_LINE (dest, 0),
FRAME_GET_U_STRIDE (dest), FRAME_GET_V_LINE (dest, 0), FRAME_GET_U_STRIDE (dest), FRAME_GET_V_LINE (dest, 0),
FRAME_GET_V_STRIDE (dest), FRAME_GET_LINE (src, 0), FRAME_GET_V_STRIDE (dest), FRAME_GET_LINE (src, 0),
@ -1020,16 +1020,16 @@ convert_Y42B_I420 (VideoConvert * convert, GstVideoFrame * dest,
gint width = convert->width; gint width = convert->width;
gint height = convert->height; gint height = convert->height;
video_convert_orc_memcpy_2d (FRAME_GET_Y_LINE (dest, 0), bad_video_convert_orc_memcpy_2d (FRAME_GET_Y_LINE (dest, 0),
FRAME_GET_Y_STRIDE (dest), FRAME_GET_Y_LINE (src, 0), FRAME_GET_Y_STRIDE (dest), FRAME_GET_Y_LINE (src, 0),
FRAME_GET_Y_STRIDE (src), width, height); FRAME_GET_Y_STRIDE (src), width, height);
video_convert_orc_planar_chroma_422_420 (FRAME_GET_U_LINE (dest, 0), bad_video_convert_orc_planar_chroma_422_420 (FRAME_GET_U_LINE (dest, 0),
FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (src, 0), FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (src, 0),
2 * FRAME_GET_U_STRIDE (src), FRAME_GET_U_LINE (src, 1), 2 * FRAME_GET_U_STRIDE (src), FRAME_GET_U_LINE (src, 1),
2 * FRAME_GET_U_STRIDE (src), (width + 1) / 2, height / 2); 2 * FRAME_GET_U_STRIDE (src), (width + 1) / 2, height / 2);
video_convert_orc_planar_chroma_422_420 (FRAME_GET_V_LINE (dest, 0), bad_video_convert_orc_planar_chroma_422_420 (FRAME_GET_V_LINE (dest, 0),
FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (src, 0), FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (src, 0),
2 * FRAME_GET_V_STRIDE (src), FRAME_GET_V_LINE (src, 1), 2 * FRAME_GET_V_STRIDE (src), FRAME_GET_V_LINE (src, 1),
2 * FRAME_GET_V_STRIDE (src), (width + 1) / 2, height / 2); 2 * FRAME_GET_V_STRIDE (src), (width + 1) / 2, height / 2);
@ -1048,15 +1048,15 @@ convert_Y42B_Y444 (VideoConvert * convert, GstVideoFrame * dest,
gint width = convert->width; gint width = convert->width;
gint height = convert->height; gint height = convert->height;
video_convert_orc_memcpy_2d (FRAME_GET_Y_LINE (dest, 0), bad_video_convert_orc_memcpy_2d (FRAME_GET_Y_LINE (dest, 0),
FRAME_GET_Y_STRIDE (dest), FRAME_GET_Y_LINE (src, 0), FRAME_GET_Y_STRIDE (dest), FRAME_GET_Y_LINE (src, 0),
FRAME_GET_Y_STRIDE (src), width, height); FRAME_GET_Y_STRIDE (src), width, height);
video_convert_orc_planar_chroma_422_444 (FRAME_GET_U_LINE (dest, 0), bad_video_convert_orc_planar_chroma_422_444 (FRAME_GET_U_LINE (dest, 0),
FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (src, 0), FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (src, 0),
FRAME_GET_U_STRIDE (src), (width + 1) / 2, height); FRAME_GET_U_STRIDE (src), (width + 1) / 2, height);
video_convert_orc_planar_chroma_422_444 (FRAME_GET_V_LINE (dest, 0), bad_video_convert_orc_planar_chroma_422_444 (FRAME_GET_V_LINE (dest, 0),
FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (src, 0), FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (src, 0),
FRAME_GET_V_STRIDE (src), (width + 1) / 2, height); FRAME_GET_V_STRIDE (src), (width + 1) / 2, height);
} }
@ -1068,7 +1068,7 @@ convert_Y42B_YUY2 (VideoConvert * convert, GstVideoFrame * dest,
gint width = convert->width; gint width = convert->width;
gint height = convert->height; gint height = convert->height;
video_convert_orc_convert_Y42B_YUY2 (FRAME_GET_LINE (dest, 0), bad_video_convert_orc_convert_Y42B_YUY2 (FRAME_GET_LINE (dest, 0),
FRAME_GET_STRIDE (dest), FRAME_GET_Y_LINE (src, 0), FRAME_GET_STRIDE (dest), FRAME_GET_Y_LINE (src, 0),
FRAME_GET_Y_STRIDE (src), FRAME_GET_U_LINE (src, 0), FRAME_GET_Y_STRIDE (src), FRAME_GET_U_LINE (src, 0),
FRAME_GET_U_STRIDE (src), FRAME_GET_V_LINE (src, 0), FRAME_GET_U_STRIDE (src), FRAME_GET_V_LINE (src, 0),
@ -1082,7 +1082,7 @@ convert_Y42B_UYVY (VideoConvert * convert, GstVideoFrame * dest,
gint width = convert->width; gint width = convert->width;
gint height = convert->height; gint height = convert->height;
video_convert_orc_convert_Y42B_UYVY (FRAME_GET_LINE (dest, 0), bad_video_convert_orc_convert_Y42B_UYVY (FRAME_GET_LINE (dest, 0),
FRAME_GET_STRIDE (dest), FRAME_GET_Y_LINE (src, 0), FRAME_GET_STRIDE (dest), FRAME_GET_Y_LINE (src, 0),
FRAME_GET_Y_STRIDE (src), FRAME_GET_U_LINE (src, 0), FRAME_GET_Y_STRIDE (src), FRAME_GET_U_LINE (src, 0),
FRAME_GET_U_STRIDE (src), FRAME_GET_V_LINE (src, 0), FRAME_GET_U_STRIDE (src), FRAME_GET_V_LINE (src, 0),
@ -1097,7 +1097,7 @@ convert_Y42B_AYUV (VideoConvert * convert, GstVideoFrame * dest,
gint height = convert->height; gint height = convert->height;
/* only for even width */ /* only for even width */
video_convert_orc_convert_Y42B_AYUV (FRAME_GET_LINE (dest, 0), bad_video_convert_orc_convert_Y42B_AYUV (FRAME_GET_LINE (dest, 0),
FRAME_GET_STRIDE (dest), FRAME_GET_Y_LINE (src, 0), FRAME_GET_STRIDE (dest), FRAME_GET_Y_LINE (src, 0),
FRAME_GET_Y_STRIDE (src), FRAME_GET_U_LINE (src, 0), FRAME_GET_Y_STRIDE (src), FRAME_GET_U_LINE (src, 0),
FRAME_GET_U_STRIDE (src), FRAME_GET_V_LINE (src, 0), FRAME_GET_U_STRIDE (src), FRAME_GET_V_LINE (src, 0),
@ -1111,16 +1111,16 @@ convert_Y444_I420 (VideoConvert * convert, GstVideoFrame * dest,
gint width = convert->width; gint width = convert->width;
gint height = convert->height; gint height = convert->height;
video_convert_orc_memcpy_2d (FRAME_GET_Y_LINE (dest, 0), bad_video_convert_orc_memcpy_2d (FRAME_GET_Y_LINE (dest, 0),
FRAME_GET_Y_STRIDE (dest), FRAME_GET_Y_LINE (src, 0), FRAME_GET_Y_STRIDE (dest), FRAME_GET_Y_LINE (src, 0),
FRAME_GET_Y_STRIDE (src), width, height); FRAME_GET_Y_STRIDE (src), width, height);
video_convert_orc_planar_chroma_444_420 (FRAME_GET_U_LINE (dest, 0), bad_video_convert_orc_planar_chroma_444_420 (FRAME_GET_U_LINE (dest, 0),
FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (src, 0), FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (src, 0),
2 * FRAME_GET_U_STRIDE (src), FRAME_GET_U_LINE (src, 1), 2 * FRAME_GET_U_STRIDE (src), FRAME_GET_U_LINE (src, 1),
2 * FRAME_GET_U_STRIDE (src), width / 2, height / 2); 2 * FRAME_GET_U_STRIDE (src), width / 2, height / 2);
video_convert_orc_planar_chroma_444_420 (FRAME_GET_V_LINE (dest, 0), bad_video_convert_orc_planar_chroma_444_420 (FRAME_GET_V_LINE (dest, 0),
FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (src, 0), FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (src, 0),
2 * FRAME_GET_V_STRIDE (src), FRAME_GET_V_LINE (src, 1), 2 * FRAME_GET_V_STRIDE (src), FRAME_GET_V_LINE (src, 1),
2 * FRAME_GET_V_STRIDE (src), width / 2, height / 2); 2 * FRAME_GET_V_STRIDE (src), width / 2, height / 2);
@ -1139,15 +1139,15 @@ convert_Y444_Y42B (VideoConvert * convert, GstVideoFrame * dest,
gint width = convert->width; gint width = convert->width;
gint height = convert->height; gint height = convert->height;
video_convert_orc_memcpy_2d (FRAME_GET_Y_LINE (dest, 0), bad_video_convert_orc_memcpy_2d (FRAME_GET_Y_LINE (dest, 0),
FRAME_GET_Y_STRIDE (dest), FRAME_GET_Y_LINE (src, 0), FRAME_GET_Y_STRIDE (dest), FRAME_GET_Y_LINE (src, 0),
FRAME_GET_Y_STRIDE (src), width, height); FRAME_GET_Y_STRIDE (src), width, height);
video_convert_orc_planar_chroma_444_422 (FRAME_GET_U_LINE (dest, 0), bad_video_convert_orc_planar_chroma_444_422 (FRAME_GET_U_LINE (dest, 0),
FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (src, 0), FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (src, 0),
FRAME_GET_U_STRIDE (src), width / 2, height); FRAME_GET_U_STRIDE (src), width / 2, height);
video_convert_orc_planar_chroma_444_422 (FRAME_GET_V_LINE (dest, 0), bad_video_convert_orc_planar_chroma_444_422 (FRAME_GET_V_LINE (dest, 0),
FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (src, 0), FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (src, 0),
FRAME_GET_V_STRIDE (src), width / 2, height); FRAME_GET_V_STRIDE (src), width / 2, height);
} }
@ -1159,7 +1159,7 @@ convert_Y444_YUY2 (VideoConvert * convert, GstVideoFrame * dest,
gint width = convert->width; gint width = convert->width;
gint height = convert->height; gint height = convert->height;
video_convert_orc_convert_Y444_YUY2 (FRAME_GET_LINE (dest, 0), bad_video_convert_orc_convert_Y444_YUY2 (FRAME_GET_LINE (dest, 0),
FRAME_GET_STRIDE (dest), FRAME_GET_Y_LINE (src, 0), FRAME_GET_STRIDE (dest), FRAME_GET_Y_LINE (src, 0),
FRAME_GET_Y_STRIDE (src), FRAME_GET_U_LINE (src, 0), FRAME_GET_Y_STRIDE (src), FRAME_GET_U_LINE (src, 0),
FRAME_GET_U_STRIDE (src), FRAME_GET_V_LINE (src, 0), FRAME_GET_U_STRIDE (src), FRAME_GET_V_LINE (src, 0),
@ -1173,7 +1173,7 @@ convert_Y444_UYVY (VideoConvert * convert, GstVideoFrame * dest,
gint width = convert->width; gint width = convert->width;
gint height = convert->height; gint height = convert->height;
video_convert_orc_convert_Y444_UYVY (FRAME_GET_LINE (dest, 0), bad_video_convert_orc_convert_Y444_UYVY (FRAME_GET_LINE (dest, 0),
FRAME_GET_STRIDE (dest), FRAME_GET_Y_LINE (src, 0), FRAME_GET_STRIDE (dest), FRAME_GET_Y_LINE (src, 0),
FRAME_GET_Y_STRIDE (src), FRAME_GET_U_LINE (src, 0), FRAME_GET_Y_STRIDE (src), FRAME_GET_U_LINE (src, 0),
FRAME_GET_U_STRIDE (src), FRAME_GET_V_LINE (src, 0), FRAME_GET_U_STRIDE (src), FRAME_GET_V_LINE (src, 0),
@ -1187,7 +1187,7 @@ convert_Y444_AYUV (VideoConvert * convert, GstVideoFrame * dest,
gint width = convert->width; gint width = convert->width;
gint height = convert->height; gint height = convert->height;
video_convert_orc_convert_Y444_AYUV (FRAME_GET_LINE (dest, 0), bad_video_convert_orc_convert_Y444_AYUV (FRAME_GET_LINE (dest, 0),
FRAME_GET_STRIDE (dest), FRAME_GET_Y_LINE (src, 0), FRAME_GET_STRIDE (dest), FRAME_GET_Y_LINE (src, 0),
FRAME_GET_Y_STRIDE (src), FRAME_GET_U_LINE (src, 0), FRAME_GET_Y_STRIDE (src), FRAME_GET_U_LINE (src, 0),
FRAME_GET_U_STRIDE (src), FRAME_GET_V_LINE (src, 0), FRAME_GET_U_STRIDE (src), FRAME_GET_V_LINE (src, 0),
@ -1202,7 +1202,7 @@ convert_AYUV_ARGB (VideoConvert * convert, GstVideoFrame * dest,
gint width = convert->width; gint width = convert->width;
gint height = convert->height; gint height = convert->height;
video_convert_orc_convert_AYUV_ARGB (FRAME_GET_LINE (dest, 0), bad_video_convert_orc_convert_AYUV_ARGB (FRAME_GET_LINE (dest, 0),
FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0), FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0),
FRAME_GET_STRIDE (src), convert->cmatrix[0][0], convert->cmatrix[0][2], FRAME_GET_STRIDE (src), convert->cmatrix[0][0], convert->cmatrix[0][2],
convert->cmatrix[2][1], convert->cmatrix[1][1], convert->cmatrix[1][2], convert->cmatrix[2][1], convert->cmatrix[1][1], convert->cmatrix[1][2],
@ -1216,7 +1216,7 @@ convert_AYUV_BGRA (VideoConvert * convert, GstVideoFrame * dest,
gint width = convert->width; gint width = convert->width;
gint height = convert->height; gint height = convert->height;
video_convert_orc_convert_AYUV_BGRA (FRAME_GET_LINE (dest, 0), bad_video_convert_orc_convert_AYUV_BGRA (FRAME_GET_LINE (dest, 0),
FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0), FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0),
FRAME_GET_STRIDE (src), convert->cmatrix[0][0], convert->cmatrix[0][2], FRAME_GET_STRIDE (src), convert->cmatrix[0][0], convert->cmatrix[0][2],
convert->cmatrix[2][1], convert->cmatrix[1][1], convert->cmatrix[1][2], convert->cmatrix[2][1], convert->cmatrix[1][1], convert->cmatrix[1][2],
@ -1230,7 +1230,7 @@ convert_AYUV_ABGR (VideoConvert * convert, GstVideoFrame * dest,
gint width = convert->width; gint width = convert->width;
gint height = convert->height; gint height = convert->height;
video_convert_orc_convert_AYUV_ABGR (FRAME_GET_LINE (dest, 0), bad_video_convert_orc_convert_AYUV_ABGR (FRAME_GET_LINE (dest, 0),
FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0), FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0),
FRAME_GET_STRIDE (src), convert->cmatrix[0][0], convert->cmatrix[0][2], FRAME_GET_STRIDE (src), convert->cmatrix[0][0], convert->cmatrix[0][2],
convert->cmatrix[2][1], convert->cmatrix[1][1], convert->cmatrix[1][2], convert->cmatrix[2][1], convert->cmatrix[1][1], convert->cmatrix[1][2],
@ -1244,7 +1244,7 @@ convert_AYUV_RGBA (VideoConvert * convert, GstVideoFrame * dest,
gint width = convert->width; gint width = convert->width;
gint height = convert->height; gint height = convert->height;
video_convert_orc_convert_AYUV_RGBA (FRAME_GET_LINE (dest, 0), bad_video_convert_orc_convert_AYUV_RGBA (FRAME_GET_LINE (dest, 0),
FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0), FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0),
FRAME_GET_STRIDE (src), convert->cmatrix[0][0], convert->cmatrix[0][2], FRAME_GET_STRIDE (src), convert->cmatrix[0][0], convert->cmatrix[0][2],
convert->cmatrix[2][1], convert->cmatrix[1][1], convert->cmatrix[1][2], convert->cmatrix[2][1], convert->cmatrix[1][1], convert->cmatrix[1][2],
@ -1260,7 +1260,7 @@ convert_I420_BGRA (VideoConvert * convert, GstVideoFrame * dest,
gint height = convert->height; gint height = convert->height;
for (i = 0; i < height; i++) { for (i = 0; i < height; i++) {
video_convert_orc_convert_I420_BGRA (FRAME_GET_LINE (dest, i), bad_video_convert_orc_convert_I420_BGRA (FRAME_GET_LINE (dest, i),
FRAME_GET_Y_LINE (src, i), FRAME_GET_Y_LINE (src, i),
FRAME_GET_U_LINE (src, i >> 1), FRAME_GET_V_LINE (src, i >> 1), FRAME_GET_U_LINE (src, i >> 1), FRAME_GET_V_LINE (src, i >> 1),
convert->cmatrix[0][0], convert->cmatrix[0][2], convert->cmatrix[0][0], convert->cmatrix[0][2],
@ -1280,9 +1280,9 @@ typedef struct
GstVideoColorMatrix in_matrix; GstVideoColorMatrix in_matrix;
GstVideoFormat out_format; GstVideoFormat out_format;
GstVideoColorMatrix out_matrix; GstVideoColorMatrix out_matrix;
gboolean keeps_color_matrix; gboolean keeps_bad_color_matrix;
gboolean keeps_interlaced; gboolean keeps_interlaced;
gboolean needs_color_matrix; gboolean needs_bad_color_matrix;
gint width_align, height_align; gint width_align, height_align;
void (*convert) (VideoConvert * convert, GstVideoFrame * dest, void (*convert) (VideoConvert * convert, GstVideoFrame * dest,
const GstVideoFrame * src); const GstVideoFrame * src);
@ -1476,14 +1476,14 @@ videoconvert_convert_lookup_fastpath (VideoConvert * convert)
for (i = 0; i < sizeof (transforms) / sizeof (transforms[0]); i++) { for (i = 0; i < sizeof (transforms) / sizeof (transforms[0]); i++) {
if (transforms[i].in_format == in_format && if (transforms[i].in_format == in_format &&
transforms[i].out_format == out_format && transforms[i].out_format == out_format &&
(transforms[i].keeps_color_matrix || (transforms[i].keeps_bad_color_matrix ||
(transforms[i].in_matrix == in_matrix && (transforms[i].in_matrix == in_matrix &&
transforms[i].out_matrix == out_matrix)) && transforms[i].out_matrix == out_matrix)) &&
(transforms[i].keeps_interlaced || !interlaced) && (transforms[i].keeps_interlaced || !interlaced) &&
(transforms[i].width_align & width) == 0 && (transforms[i].width_align & width) == 0 &&
(transforms[i].height_align & height) == 0) { (transforms[i].height_align & height) == 0) {
GST_DEBUG ("using fastpath"); GST_DEBUG ("using fastpath");
if (transforms[i].needs_color_matrix) if (transforms[i].needs_bad_color_matrix)
if (!videoconvert_convert_compute_matrix (convert)) if (!videoconvert_convert_compute_matrix (convert))
goto no_convert; goto no_convert;
convert->convert = transforms[i].convert; convert->convert = transforms[i].convert;

View file

@ -65,13 +65,13 @@ struct _VideoConvert {
}; };
VideoConvert * videoconvert_convert_new (GstVideoInfo *in_info, VideoConvert * badvideoconvert_convert_new (GstVideoInfo *in_info,
GstVideoInfo *out_info); GstVideoInfo *out_info);
void videoconvert_convert_free (VideoConvert * convert); void badvideoconvert_convert_free (VideoConvert * convert);
void videoconvert_convert_set_dither (VideoConvert * convert, int type); void badvideoconvert_convert_set_dither (VideoConvert * convert, int type);
void videoconvert_convert_convert (VideoConvert * convert, void badvideoconvert_convert_convert (VideoConvert * convert,
GstVideoFrame *dest, const GstVideoFrame *src); GstVideoFrame *dest, const GstVideoFrame *src);