[vlc-devel] [PATCH] adding yuv420 10b support to color extraction
victorien.lecouviour.tuffet at gmail.com
victorien.lecouviour.tuffet at gmail.com
Tue Apr 4 13:01:44 CEST 2017
From: Psilokos <victorien.lecouviour-tuffet at epitech.eu>
---
modules/video_filter/extract.c | 373 ++++++++++++++++++++++++++++++++++-------
1 file changed, 309 insertions(+), 64 deletions(-)
diff --git a/modules/video_filter/extract.c b/modules/video_filter/extract.c
index 87da7c7b5d..acb903c022 100644
--- a/modules/video_filter/extract.c
+++ b/modules/video_filter/extract.c
@@ -50,11 +50,15 @@ static int ExtractCallback( vlc_object_t *, char const *,
static void get_red_from_yuv420( picture_t *, picture_t *, int, int, int );
static void get_green_from_yuv420( picture_t *, picture_t *, int, int, int );
static void get_blue_from_yuv420( picture_t *, picture_t *, int, int, int );
+static void get_red_from_yuv10( picture_t *, picture_t *, int, int, int );
+static void get_green_from_yuv10( picture_t *, picture_t *, int, int, int );
+static void get_blue_from_yuv10( picture_t *, picture_t *, int, int, int );
static void get_red_from_yuv422( picture_t *, picture_t *, int, int, int );
static void get_green_from_yuv422( picture_t *, picture_t *, int, int, int );
static void get_blue_from_yuv422( picture_t *, picture_t *, int, int, int );
static void make_projection_matrix( filter_t *, int color, int *matrix );
static void get_custom_from_yuv420( picture_t *, picture_t *, int, int, int, int * );
+static void get_custom_from_yuv10( picture_t *, picture_t *, int, int, int, int * );
static void get_custom_from_yuv422( picture_t *, picture_t *, int, int, int, int * );
static void get_custom_from_packedyuv422( picture_t *, picture_t *, int * );
@@ -107,6 +111,8 @@ static int Create( vlc_object_t *p_this )
switch( p_filter->fmt_in.video.i_chroma )
{
case VLC_CODEC_I420:
+ case VLC_CODEC_I420_10L:
+ case VLC_CODEC_I420_10B:
case VLC_CODEC_J420:
case VLC_CODEC_YV12:
@@ -235,6 +241,30 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
}
break;
+ case VLC_CODEC_I420_10L:
+ case VLC_CODEC_I420_10B:
+ switch( p_filter->p_sys->i_color )
+ {
+ case RED:
+ get_red_from_yuv10( p_pic, p_outpic,
+ Y_PLANE, U_PLANE, V_PLANE );
+ break;
+ case GREEN:
+ get_green_from_yuv10( p_pic, p_outpic,
+ Y_PLANE, U_PLANE, V_PLANE );
+ break;
+ case BLUE:
+ get_blue_from_yuv10( p_pic, p_outpic,
+ Y_PLANE, U_PLANE, V_PLANE );
+ break;
+ default:
+ get_custom_from_yuv10( p_pic, p_outpic,
+ Y_PLANE, U_PLANE, V_PLANE,
+ p_sys->projection_matrix);
+ break;
+ }
+ break;
+
CASE_PACKED_YUV_422
get_custom_from_packedyuv422( p_pic, p_outpic,
p_sys->projection_matrix );
@@ -252,8 +282,11 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
return CopyInfoAndRelease( p_outpic, p_pic );
}
-#define U 128
-#define V 128
+#define U8 128 // 2^8 / 2
+#define V8 128
+
+#define U10 512 // 2^10 / 2
+#define V10 512
static void mmult( double *res, double *a, double *b )
{
@@ -339,17 +372,17 @@ static void get_custom_from_yuv420( picture_t *p_inpic, picture_t *p_outpic,
y2out = y1out + i_out_pitch;
while( y1in < y1end )
{
- *uout++ = vlc_uint8( (*y1in * m[3] + (*uin-U) * m[4] + (*vin-V) * m[5])
- / 65536 + U );
- *vout++ = vlc_uint8( (*y1in * m[6] + (*uin-U) * m[7] + (*vin-V) * m[8])
- / 65536 + V );
- *y1out++ = vlc_uint8( (*y1in++ * m[0] + (*uin-U) * m[1] + (*vin-V) * m[2])
+ *uout++ = vlc_uint8( (*y1in * m[3] + (*uin-U8) * m[4] + (*vin-V8) * m[5])
+ / 65536 + U8 );
+ *vout++ = vlc_uint8( (*y1in * m[6] + (*uin-U8) * m[7] + (*vin-V8) * m[8])
+ / 65536 + V8 );
+ *y1out++ = vlc_uint8( (*y1in++ * m[0] + (*uin-U8) * m[1] + (*vin-V8) * m[2])
/ 65536 );
- *y1out++ = vlc_uint8( (*y1in++ * m[0] + (*uin-U) * m[1] + (*vin-V) * m[2])
+ *y1out++ = vlc_uint8( (*y1in++ * m[0] + (*uin-U8) * m[1] + (*vin-V8) * m[2])
/ 65536 );
- *y2out++ = vlc_uint8( (*y2in++ * m[0] + (*uin-U) * m[1] + (*vin-V) * m[2])
+ *y2out++ = vlc_uint8( (*y2in++ * m[0] + (*uin-U8) * m[1] + (*vin-V8) * m[2])
/ 65536 );
- *y2out++ = vlc_uint8( (*y2in++ * m[0] + (*uin++ - U) * m[1] + (*vin++ -V) * m[2])
+ *y2out++ = vlc_uint8( (*y2in++ * m[0] + (*uin++ - U8) * m[1] + (*vin++ -V8) * m[2])
/ 65536 );
}
y1in += 2*i_in_pitch - i_visible_pitch;
@@ -360,6 +393,57 @@ static void get_custom_from_yuv420( picture_t *p_inpic, picture_t *p_outpic,
vout += p_outpic->p[vp].i_pitch - i_uv_visible_pitch;
}
}
+
+static void get_custom_from_yuv10( picture_t *p_inpic, picture_t *p_outpic,
+ int yp, int up, int vp, int *m )
+{
+ uint16_t *y1in = p_inpic->p[yp].p_pixels;
+ uint16_t *y2in;
+ uint16_t *uin = p_inpic->p[up].p_pixels;
+ uint16_t *vin = p_inpic->p[vp].p_pixels;
+
+ uint16_t *y1out = p_outpic->p[yp].p_pixels;
+ uint16_t *y2out;
+ uint16_t *uout = p_outpic->p[up].p_pixels;
+ uint16_t *vout = p_outpic->p[vp].p_pixels;
+
+ const int i_in_pitch = p_inpic->p[yp].i_pitch;
+ const int i_out_pitch = p_outpic->p[yp].i_pitch;
+
+ const int i_visible_pitch = p_inpic->p[yp].i_visible_pitch;
+ const int i_visible_lines = p_inpic->p[yp].i_visible_lines;
+ const int i_uv_visible_pitch = p_inpic->p[up].i_visible_pitch;
+
+ const uint16_t *yend = (uint8_t*)y1in + i_visible_lines * i_in_pitch;
+ while( y1in < yend )
+ {
+ const uint16_t *y1end = (uint8_t*)y1in + i_visible_pitch;
+ y2in = (uint8_t*)y1in + i_in_pitch;
+ y2out = (uint8_t*)y1out + i_out_pitch;
+ while( y1in < y1end )
+ {
+ *uout++ = vlc_uint10( (*y1in * m[3] + (*uin-U10) * m[4] + (*vin-V10) * m[5])
+ / 65536 + U10 );
+ *vout++ = vlc_uint10( (*y1in * m[6] + (*uin-U10) * m[7] + (*vin-V10) * m[8])
+ / 65536 + V10);
+ *y1out++ = vlc_uint10( (*y1in++ * m[0] + (*uin-U10) * m[1] + (*vin-V10) * m[2])
+ / 65536 );
+ *y1out++ = vlc_uint10( (*y1in++ * m[0] + (*uin-U10) * m[1] + (*vin-V10) * m[2])
+ / 65536 );
+ *y2out++ = vlc_uint10( (*y2in++ * m[0] + (*uin-U10) * m[1] + (*vin-V10) * m[2])
+ / 65536 );
+ *y2out++ = vlc_uint10( (*y2in++ * m[0] + (*uin++ - U10) * m[1] + (*vin++ -V10) * m[2])
+ / 65536 );
+ }
+ y1in = (uint8_t*)y1in + (2*i_in_pitch - i_visible_pitch);
+ y1out = (uint8_t*)y1out + (2*i_out_pitch - i_visible_pitch);
+ uin = (uint8_t*)uin + (p_inpic->p[up].i_pitch - i_uv_visible_pitch);
+ uout = (uint8_t*)uout + (p_outpic->p[up].i_pitch - i_uv_visible_pitch);
+ vin = (uint8_t*)vin + (p_inpic->p[vp].i_pitch - i_uv_visible_pitch);
+ vout = (uint8_t*)vout + (p_outpic->p[vp].i_pitch - i_uv_visible_pitch);
+ }
+}
+
static void get_custom_from_yuv422( picture_t *p_inpic, picture_t *p_outpic,
int yp, int up, int vp, int *m )
{
@@ -384,13 +468,13 @@ static void get_custom_from_yuv422( picture_t *p_inpic, picture_t *p_outpic,
const uint8_t *y1end = y1in + i_visible_pitch;
while( y1in < y1end )
{
- *uout++ = vlc_uint8( (*y1in * m[3] + (*uin-U) * m[4] + (*vin-V) * m[5])
- / 65536 + U );
- *vout++ = vlc_uint8( (*y1in * m[6] + (*uin-U) * m[7] + (*vin-V) * m[8])
- / 65536 + V );
- *y1out++ = vlc_uint8( (*y1in++ * m[0] + (*uin-U) * m[1] + (*vin-V) * m[2])
+ *uout++ = vlc_uint8( (*y1in * m[3] + (*uin-U8) * m[4] + (*vin-V8) * m[5])
+ / 65536 + U8 );
+ *vout++ = vlc_uint8( (*y1in * m[6] + (*uin-U8) * m[7] + (*vin-V8) * m[8])
+ / 65536 + V8 );
+ *y1out++ = vlc_uint8( (*y1in++ * m[0] + (*uin-U8) * m[1] + (*vin-V8) * m[2])
/ 65536 );
- *y1out++ = vlc_uint8( (*y1in++ * m[0] + (*uin++ -U) * m[1] + (*vin++ -V) * m[2])
+ *y1out++ = vlc_uint8( (*y1in++ * m[0] + (*uin++ -U8) * m[1] + (*vin++ -V8) * m[2])
/ 65536 );
}
y1in += i_in_pitch - i_visible_pitch;
@@ -430,17 +514,17 @@ static void get_custom_from_packedyuv422( picture_t *p_inpic,
const uint8_t *ylend = yin + i_visible_pitch;
while( yin < ylend )
{
- *uout = vlc_uint8( (*yin * m[3] + (*uin-U) * m[4] + (*vin-V) * m[5])
- / 65536 + U );
+ *uout = vlc_uint8( (*yin * m[3] + (*uin-U8) * m[4] + (*vin-V8) * m[5])
+ / 65536 + U8 );
uout += 4;
- *vout = vlc_uint8( (*yin * m[6] + (*uin-U) * m[7] + (*vin-V) * m[8])
- / 65536 + V );
+ *vout = vlc_uint8( (*yin * m[6] + (*uin-U8) * m[7] + (*vin-V8) * m[8])
+ / 65536 + V8 );
vout += 4;
- *yout = vlc_uint8( (*yin * m[0] + (*uin-U) * m[1] + (*vin-V) * m[2])
+ *yout = vlc_uint8( (*yin * m[0] + (*uin-U8) * m[1] + (*vin-V8) * m[2])
/ 65536 );
yin += 2;
yout += 2;
- *yout = vlc_uint8( (*yin * m[0] + (*uin-U) * m[1] + (*vin-V) * m[2])
+ *yout = vlc_uint8( (*yin * m[0] + (*uin-U8) * m[1] + (*vin-V8) * m[2])
/ 65536 );
yin += 2;
yout += 2;
@@ -488,17 +572,17 @@ static void get_red_from_yuv420( picture_t *p_inpic, picture_t *p_outpic,
-11058 0 -15504
32768 0 45941
*/
- *uout++ = vlc_uint8( (*y1in * -11058 + (*vin - V) * -15504)
- / 65536 + U );
- *vout++ = vlc_uint8( (*y1in * 32768 + (*vin - V) * 45941)
- / 65536 + V );
- *y1out++ = vlc_uint8( (*y1in++ * 19595 + (*vin - V) * 27473)
+ *uout++ = vlc_uint8( (*y1in * -11058 + (*vin - V8) * -15504)
+ / 65536 + U8 );
+ *vout++ = vlc_uint8( (*y1in * 32768 + (*vin - V8) * 45941)
+ / 65536 + V8 );
+ *y1out++ = vlc_uint8( (*y1in++ * 19595 + (*vin - V8) * 27473)
/ 65536 );
- *y1out++ = vlc_uint8( (*y1in++ * 19595 + (*vin - V) * 27473)
+ *y1out++ = vlc_uint8( (*y1in++ * 19595 + (*vin - V8) * 27473)
/ 65536 );
- *y2out++ = vlc_uint8( (*y2in++ * 19594 + (*vin - V) * 27473)
+ *y2out++ = vlc_uint8( (*y2in++ * 19594 + (*vin - V8) * 27473)
/ 65536 );
- *y2out++ = vlc_uint8( (*y2in++ * 19594 + (*vin++ - V) * 27473)
+ *y2out++ = vlc_uint8( (*y2in++ * 19594 + (*vin++ - V8) * 27473)
/ 65536 );
}
y1in += 2*i_in_pitch - i_visible_pitch;
@@ -543,17 +627,17 @@ static void get_green_from_yuv420( picture_t *p_inpic, picture_t *p_outpic,
-21710 7471 15504
-27439 9443 19595
*/
- *uout++ = vlc_uint8( (*y1in * -21710 + (*uin-U) * 7471 + (*vin-V) * 15504)
- / 65536 + U );
- *vout++ = vlc_uint8( (*y1in * -27439 + (*uin-U) * 9443 + (*vin-V) * 19595)
- / 65536 + V );
- *y1out++ = vlc_uint8( (*y1in++ * 38470 + (*uin-U) * -13239 + (*vin-V) * -27473)
+ *uout++ = vlc_uint8( (*y1in * -21710 + (*uin-U8) * 7471 + (*vin-V8) * 15504)
+ / 65536 + U8 );
+ *vout++ = vlc_uint8( (*y1in * -27439 + (*uin-U8) * 9443 + (*vin-V8) * 19595)
+ / 65536 + V8 );
+ *y1out++ = vlc_uint8( (*y1in++ * 38470 + (*uin-U8) * -13239 + (*vin-V8) * -27473)
/ 65536 );
- *y1out++ = vlc_uint8( (*y1in++ * 38470 + (*uin-U) * -13239 + (*vin-V) * -27473)
+ *y1out++ = vlc_uint8( (*y1in++ * 38470 + (*uin-U8) * -13239 + (*vin-V8) * -27473)
/ 65536 );
- *y2out++ = vlc_uint8( (*y2in++ * 38470 + (*uin-U) * -13239 + (*vin-V) * -27473)
+ *y2out++ = vlc_uint8( (*y2in++ * 38470 + (*uin-U8) * -13239 + (*vin-V8) * -27473)
/ 65536 );
- *y2out++ = vlc_uint8( (*y2in++ * 38470 + (*uin++ - U) * -13239 + (*vin++ -V) * -27473)
+ *y2out++ = vlc_uint8( (*y2in++ * 38470 + (*uin++ - U8) * -13239 + (*vin++ -V8) * -27473)
/ 65536 );
}
y1in += 2*i_in_pitch - i_visible_pitch;
@@ -597,17 +681,17 @@ static void get_blue_from_yuv420( picture_t *p_inpic, picture_t *p_outpic,
32768 58065 0
-5329 -9443 0
*/
- *uout++ = vlc_uint8( (*y1in* 32768 + (*uin - U) * 58065 )
- / 65536 + U );
- *vout++ = vlc_uint8( (*y1in * -5329 + (*uin - U) * -9443 )
- / 65536 + V );
- *y1out++ = vlc_uint8( (*y1in++ * 7471 + (*uin - U) * 13239 )
+ *uout++ = vlc_uint8( (*y1in* 32768 + (*uin - U8) * 58065 )
+ / 65536 + U8 );
+ *vout++ = vlc_uint8( (*y1in * -5329 + (*uin - U8) * -9443 )
+ / 65536 + V8 );
+ *y1out++ = vlc_uint8( (*y1in++ * 7471 + (*uin - U8) * 13239 )
/ 65536 );
- *y1out++ = vlc_uint8( (*y1in++ * 7471 + (*uin - U) * 13239 )
+ *y1out++ = vlc_uint8( (*y1in++ * 7471 + (*uin - U8) * 13239 )
/ 65536 );
- *y2out++ = vlc_uint8( (*y2in++ * 7471 + (*uin - U) * 13239 )
+ *y2out++ = vlc_uint8( (*y2in++ * 7471 + (*uin - U8) * 13239 )
/ 65536 );
- *y2out++ = vlc_uint8( (*y2in++ * 7471 + (*uin++ - U) * 13239 )
+ *y2out++ = vlc_uint8( (*y2in++ * 7471 + (*uin++ - U8) * 13239 )
/ 65536 );
}
y1in += 2*i_in_pitch - i_visible_pitch;
@@ -618,6 +702,167 @@ static void get_blue_from_yuv420( picture_t *p_inpic, picture_t *p_outpic,
}
}
+static void get_red_from_yuv10( picture_t *p_inpic, picture_t *p_outpic,
+ int yp, int up, int vp )
+{
+ uint16_t *y1in = p_inpic->p[yp].p_pixels;
+ uint16_t *y2in;
+ uint16_t *vin = p_inpic->p[vp].p_pixels;
+
+ uint16_t *y1out = p_outpic->p[yp].p_pixels;
+ uint16_t *y2out;
+ uint16_t *uout = p_outpic->p[up].p_pixels;
+ uint16_t *vout = p_outpic->p[vp].p_pixels;
+
+ const int i_in_pitch = p_inpic->p[yp].i_pitch;
+ const int i_out_pitch = p_outpic->p[yp].i_pitch;
+
+ const int i_visible_pitch = p_inpic->p[yp].i_visible_pitch;
+ const int i_visible_lines = p_inpic->p[yp].i_visible_lines;
+ const int i_uv_visible_pitch = p_inpic->p[up].i_visible_pitch;
+
+ const uint16_t *yend = (uint8_t*)y1in + i_visible_lines * i_in_pitch;
+ while( y1in < yend )
+ {
+ const uint16_t *y1end = (uint8_t*)y1in + i_visible_pitch;
+ y2in = (uint8_t*)y1in + i_in_pitch;
+ y2out = (uint8_t*)y1out + i_out_pitch;
+ while( y1in < y1end )
+ {
+/*
+19595 0 27473
+-11058 0 -15504
+32768 0 45941
+*/
+ *uout++ = vlc_uint10( (*y1in * -11058 + (*vin - V10) * -15504)
+ / 65536 + U10 );
+ *vout++ = vlc_uint10( (*y1in * 32768 + (*vin - V10) * 45941)
+ / 65536 + V10 );
+ *y1out++ = vlc_uint10( (*y1in++ * 19595 + (*vin - V10) * 27473)
+ / 65536 );
+ *y1out++ = vlc_uint10( (*y1in++ * 19595 + (*vin - V10) * 27473)
+ / 65536 );
+ *y2out++ = vlc_uint10( (*y2in++ * 19594 + (*vin - V10) * 27473)
+ / 65536 );
+ *y2out++ = vlc_uint10( (*y2in++ * 19594 + (*vin++ - V10) * 27473)
+ / 65536 );
+ }
+ y1in = (uint8_t*)y1in + (2*i_in_pitch - i_visible_pitch);
+ y1out = (uint8_t*)y1out + (2*i_out_pitch - i_visible_pitch);
+ uout = (uint8_t*)uout + (p_outpic->p[up].i_pitch - i_uv_visible_pitch);
+ vin = (uint8_t*)vin + (p_inpic->p[vp].i_pitch - i_uv_visible_pitch);
+ vout = (uint8_t*)vout + (p_outpic->p[vp].i_pitch - i_uv_visible_pitch);
+ }
+}
+
+static void get_green_from_yuv10( picture_t *p_inpic, picture_t *p_outpic,
+ int yp, int up, int vp )
+{
+ uint16_t *y1in = p_inpic->p[yp].p_pixels;
+ uint16_t *y2in;
+ uint16_t *uin = p_inpic->p[up].p_pixels;
+ uint16_t *vin = p_inpic->p[vp].p_pixels;
+
+ uint16_t *y1out = p_outpic->p[yp].p_pixels;
+ uint16_t *y2out;
+ uint16_t *uout = p_outpic->p[up].p_pixels;
+ uint16_t *vout = p_outpic->p[vp].p_pixels;
+
+ const int i_in_pitch = p_inpic->p[yp].i_pitch;
+ const int i_out_pitch = p_outpic->p[yp].i_pitch;
+
+ const int i_visible_pitch = p_inpic->p[yp].i_visible_pitch;
+ const int i_visible_lines = p_inpic->p[yp].i_visible_lines;
+ const int i_uv_visible_pitch = p_inpic->p[up].i_visible_pitch;
+
+ const uint16_t *yend = (uint8_t*)y1in + i_visible_lines * i_in_pitch;
+ while( y1in < yend )
+ {
+ const uint16_t *y1end = (uint8_t*)y1in + i_visible_pitch;
+ y2in = (uint8_t*)y1in + i_in_pitch;
+ y2out = (uint8_t*)y1out + i_out_pitch;
+ while( y1in < y1end )
+ {
+/*
+19595 0 27473
+-11058 0 -15504
+32768 0 45941
+*/
+ *uout++ = vlc_uint10( (*y1in * -21710 + (*uin - U10) * 7471 + (*vin - V10) * 15504)
+ / 65536 + U10 );
+ *vout++ = vlc_uint10( (*y1in * -27439 + (*uin - U10) * 9443 + (*vin - V10) * 19595)
+ / 65536 + V10 );
+ *y1out++ = vlc_uint10( (*y1in++ * 38470 + (*uin - U10) * -13239 + (*vin - V10) * -27473)
+ / 65536 );
+ *y1out++ = vlc_uint10( (*y1in++ * 38470 + (*uin - U10) * -13239 + (*vin - V10) * -27473)
+ / 65536 );
+ *y2out++ = vlc_uint10( (*y2in++ * 38470 + (*uin - U10) * -13239 + (*vin - V10) * -27473)
+ / 65536 );
+ *y2out++ = vlc_uint10( (*y2in++ * 38470 + (*uin++ - U10) * -13239 + (*vin++ - V10) * -27473)
+ / 65536 );
+
+}
+ y1in = (uint8_t*)y1in + (2*i_in_pitch - i_visible_pitch);
+ y1out = (uint8_t*)y1out + (2*i_out_pitch - i_visible_pitch);
+ uin = (uint8_t*)uin + (p_inpic->p[up].i_pitch - i_uv_visible_pitch);
+ uout = (uint8_t*)uout + (p_outpic->p[up].i_pitch - i_uv_visible_pitch);
+ vin = (uint8_t*)vin + (p_inpic->p[vp].i_pitch - i_uv_visible_pitch);
+ vout = (uint8_t*)vout + (p_outpic->p[vp].i_pitch - i_uv_visible_pitch);
+ }
+}
+
+static void get_blue_from_yuv10( picture_t *p_inpic, picture_t *p_outpic,
+ int yp, int up, int vp )
+{
+ uint16_t *y1in = p_inpic->p[yp].p_pixels;
+ uint16_t *y2in;
+ uint16_t *uin = p_inpic->p[up].p_pixels;
+
+ uint16_t *y1out = p_outpic->p[yp].p_pixels;
+ uint16_t *y2out;
+ uint16_t *uout = p_outpic->p[up].p_pixels;
+ uint16_t *vout = p_outpic->p[vp].p_pixels;
+
+ const int i_in_pitch = p_inpic->p[yp].i_pitch;
+ const int i_out_pitch = p_outpic->p[yp].i_pitch;
+
+ const int i_visible_pitch = p_inpic->p[yp].i_visible_pitch;
+ const int i_visible_lines = p_inpic->p[yp].i_visible_lines;
+ const int i_uv_visible_pitch = p_inpic->p[up].i_visible_pitch;
+
+ const uint16_t *yend = (uint8_t*)y1in + i_visible_lines * i_in_pitch;
+ while( y1in < yend )
+ {
+ const uint16_t *y1end = (uint8_t*)y1in + i_visible_pitch;
+ y2in = (uint8_t*)y1in + i_in_pitch;
+ y2out = (uint8_t*)y1out + i_out_pitch;
+ while( y1in < y1end )
+ {
+/*
+19595 0 27473
+-11058 0 -15504
+32768 0 45941
+*/
+ *uout++ = vlc_uint10( (*y1in * 32768 + (*uin - V10) * 58065)
+ / 65536 + U10 );
+ *vout++ = vlc_uint10( (*y1in * -5329 + (*uin - V10) * -9443)
+ / 65536 + V10 );
+ *y1out++ = vlc_uint10( (*y1in++ * 7471 + (*uin - V10) * 13239)
+ / 65536 );
+ *y1out++ = vlc_uint10( (*y1in++ * 7471 + (*uin - V10) * 13239)
+ / 65536 );
+ *y2out++ = vlc_uint10( (*y2in++ * 7471 + (*uin - V10) * 13239)
+ / 65536 );
+ *y2out++ = vlc_uint10( (*y2in++ * 7471 + (*uin++ - V10) * 13239)
+ / 65536 );
+ }
+ y1in = (uint8_t*)y1in + (2*i_in_pitch - i_visible_pitch);
+ y1out = (uint8_t*)y1out + (2*i_out_pitch - i_visible_pitch);
+ uout = (uint8_t*)uout + (p_outpic->p[up].i_pitch - i_uv_visible_pitch);
+ vout = (uint8_t*)vout + (p_outpic->p[vp].i_pitch - i_uv_visible_pitch);
+ }
+}
+
static void get_red_from_yuv422( picture_t *p_inpic, picture_t *p_outpic,
int yp, int up, int vp )
{
@@ -646,13 +891,13 @@ static void get_red_from_yuv422( picture_t *p_inpic, picture_t *p_outpic,
-11058 0 -15504
32768 0 45941
*/
- *uout++ = vlc_uint8( (*y1in * -11058 + (*vin - V) * -15504)
- / 65536 + U );
- *vout++ = vlc_uint8( (*y1in * 32768 + (*vin - V) * 45941)
- / 65536 + V );
- *y1out++ = vlc_uint8( (*y1in++ * 19595 + (*vin - V) * 27473)
+ *uout++ = vlc_uint8( (*y1in * -11058 + (*vin - V8) * -15504)
+ / 65536 + U8 );
+ *vout++ = vlc_uint8( (*y1in * 32768 + (*vin - V8) * 45941)
+ / 65536 + V8 );
+ *y1out++ = vlc_uint8( (*y1in++ * 19595 + (*vin - V8) * 27473)
/ 65536 );
- *y1out++ = vlc_uint8( (*y1in++ * 19595 + (*vin++ - V) * 27473)
+ *y1out++ = vlc_uint8( (*y1in++ * 19595 + (*vin++ - V8) * 27473)
/ 65536 );
}
y1in += i_in_pitch - i_visible_pitch;
@@ -692,13 +937,13 @@ static void get_green_from_yuv422( picture_t *p_inpic, picture_t *p_outpic,
-21710 7471 15504
-27439 9443 19595
*/
- *uout++ = vlc_uint8( (*y1in * -21710 + (*uin-U) * 7471 + (*vin-V) * 15504)
- / 65536 + U );
- *vout++ = vlc_uint8( (*y1in * -27439 + (*uin-U) * 9443 + (*vin-V) * 19595)
- / 65536 + V );
- *y1out++ = vlc_uint8( (*y1in++ * 38470 + (*uin-U) * -13239 + (*vin-V) * -27473)
+ *uout++ = vlc_uint8( (*y1in * -21710 + (*uin-U8) * 7471 + (*vin-V8) * 15504)
+ / 65536 + U8 );
+ *vout++ = vlc_uint8( (*y1in * -27439 + (*uin-U8) * 9443 + (*vin-V8) * 19595)
+ / 65536 + V8 );
+ *y1out++ = vlc_uint8( (*y1in++ * 38470 + (*uin-U8) * -13239 + (*vin-V8) * -27473)
/ 65536 );
- *y1out++ = vlc_uint8( (*y1in++ * 38470 + (*uin++-U) * -13239 + (*vin++-V) * -27473)
+ *y1out++ = vlc_uint8( (*y1in++ * 38470 + (*uin++-U8) * -13239 + (*vin++-V8) * -27473)
/ 65536 );
}
y1in += i_in_pitch - i_visible_pitch;
@@ -738,13 +983,13 @@ static void get_blue_from_yuv422( picture_t *p_inpic, picture_t *p_outpic,
32768 58065 0
-5329 -9443 0
*/
- *uout++ = vlc_uint8( (*y1in* 32768 + (*uin - U) * 58065 )
- / 65536 + U );
- *vout++ = vlc_uint8( (*y1in * -5329 + (*uin - U) * -9443 )
- / 65536 + V );
- *y1out++ = vlc_uint8( (*y1in++ * 7471 + (*uin - U) * 13239 )
+ *uout++ = vlc_uint8( (*y1in* 32768 + (*uin - U8) * 58065 )
+ / 65536 + U8 );
+ *vout++ = vlc_uint8( (*y1in * -5329 + (*uin - U8) * -9443 )
+ / 65536 + V8 );
+ *y1out++ = vlc_uint8( (*y1in++ * 7471 + (*uin - U8) * 13239 )
/ 65536 );
- *y1out++ = vlc_uint8( (*y1in++ * 7471 + (*uin++ - U) * 13239 )
+ *y1out++ = vlc_uint8( (*y1in++ * 7471 + (*uin++ - U8) * 13239 )
/ 65536 );
}
y1in += i_in_pitch - i_visible_pitch;
--
2.12.0
More information about the vlc-devel
mailing list