Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
db6d4f7d
Commit
db6d4f7d
authored
Jan 18, 2000
by
Vincent Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
YUV en couleurs.
parent
ba2a0abb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
184 additions
and
98 deletions
+184
-98
include/video_output.h
include/video_output.h
+2
-2
src/video_output/video_output.c
src/video_output/video_output.c
+10
-10
src/video_output/video_yuv.c
src/video_output/video_yuv.c
+172
-86
No files found.
include/video_output.h
View file @
db6d4f7d
...
@@ -22,7 +22,6 @@ typedef struct vout_tables_s
...
@@ -22,7 +22,6 @@ typedef struct vout_tables_s
struct
{
u16
*
p_gray
;
}
gray16
;
/* gray 15, 16 bpp */
struct
{
u16
*
p_gray
;
}
gray16
;
/* gray 15, 16 bpp */
struct
{
u32
*
p_gray
;
}
gray32
;
/* gray 24, 32 bpp */
struct
{
u32
*
p_gray
;
}
gray32
;
/* gray 24, 32 bpp */
}
yuv
;
}
yuv
;
void
*
p_trans_optimized
;
/* optimized (all colors) */
}
vout_tables_t
;
}
vout_tables_t
;
/*******************************************************************************
/*******************************************************************************
...
@@ -39,6 +38,7 @@ typedef struct vout_tables_s
...
@@ -39,6 +38,7 @@ typedef struct vout_tables_s
* i_eol number of Y samples to reach the next line
* i_eol number of Y samples to reach the next line
* i_pic_eol number or pixels to reach the next line
* i_pic_eol number or pixels to reach the next line
* i_scale if non 0, vertical scaling is 1 - 1/i_scale
* i_scale if non 0, vertical scaling is 1 - 1/i_scale
* i_matrix_coefficients matrix coefficients
* Conditions:
* Conditions:
* start x + i_width < picture width
* start x + i_width < picture width
* start y + i_height * (scaling factor) < picture height
* start y + i_height * (scaling factor) < picture height
...
@@ -47,7 +47,7 @@ typedef struct vout_tables_s
...
@@ -47,7 +47,7 @@ typedef struct vout_tables_s
typedef
void
(
vout_convert_t
)(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
typedef
void
(
vout_convert_t
)(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
);
int
i_scale
,
int
i_matrix_coefficients
);
/*******************************************************************************
/*******************************************************************************
* vout_scale_t: scaling function
* vout_scale_t: scaling function
...
...
src/video_output/video_output.c
View file @
db6d4f7d
...
@@ -227,7 +227,7 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout, int i_type,
...
@@ -227,7 +227,7 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout, int i_type,
int
i_width
,
int
i_height
)
int
i_width
,
int
i_height
)
{
{
int
i_picture
;
/* picture index */
int
i_picture
;
/* picture index */
int
i_chroma_width
;
/* chroma width */
int
i_chroma_width
=
0
;
/* chroma width */
picture_t
*
p_free_picture
=
NULL
;
/* first free picture */
picture_t
*
p_free_picture
=
NULL
;
/* first free picture */
picture_t
*
p_destroyed_picture
=
NULL
;
/* first destroyed picture */
picture_t
*
p_destroyed_picture
=
NULL
;
/* first destroyed picture */
...
@@ -294,25 +294,25 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout, int i_type,
...
@@ -294,25 +294,25 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout, int i_type,
switch
(
i_type
)
switch
(
i_type
)
{
{
case
YUV_420_PICTURE
:
/* YUV 420: 1,1/4,1/4 samples per pixel */
case
YUV_420_PICTURE
:
/* YUV 420: 1,1/4,1/4 samples per pixel */
i_chroma_width
=
i_width
/
4
;
i_chroma_width
=
i_width
/
2
;
p_free_picture
->
p_data
=
malloc
(
i_height
*
i_chroma_width
*
6
*
sizeof
(
yuv_data_t
)
);
p_free_picture
->
p_data
=
malloc
(
i_height
*
i_chroma_width
*
3
*
sizeof
(
yuv_data_t
)
);
p_free_picture
->
p_y
=
(
yuv_data_t
*
)
p_free_picture
->
p_data
;
p_free_picture
->
p_y
=
(
yuv_data_t
*
)
p_free_picture
->
p_data
;
p_free_picture
->
p_u
=
(
yuv_data_t
*
)
p_free_picture
->
p_data
+
i_height
*
i_chroma_width
*
4
;
p_free_picture
->
p_u
=
(
yuv_data_t
*
)
p_free_picture
->
p_data
+
i_height
*
i_chroma_width
*
4
/
2
;
p_free_picture
->
p_v
=
(
yuv_data_t
*
)
p_free_picture
->
p_data
+
i_height
*
i_chroma_width
*
5
;
p_free_picture
->
p_v
=
(
yuv_data_t
*
)
p_free_picture
->
p_data
+
i_height
*
i_chroma_width
*
5
/
2
;
break
;
break
;
case
YUV_422_PICTURE
:
/* YUV 422: 1,1/2,1/2 samples per pixel */
case
YUV_422_PICTURE
:
/* YUV 422: 1,1/2,1/2 samples per pixel */
i_chroma_width
=
i_width
/
2
;
i_chroma_width
=
i_width
/
2
;
p_free_picture
->
p_data
=
malloc
(
i_height
*
i_chroma_width
*
4
*
sizeof
(
yuv_data_t
)
);
p_free_picture
->
p_data
=
malloc
(
i_height
*
i_chroma_width
*
4
*
sizeof
(
yuv_data_t
)
);
p_free_picture
->
p_y
=
(
yuv_data_t
*
)
p_free_picture
->
p_data
;
p_free_picture
->
p_y
=
(
yuv_data_t
*
)
p_free_picture
->
p_data
;
p_free_picture
->
p_u
=
(
yuv_data_t
*
)
p_free_picture
->
p_data
+
i_height
*
i_chroma_width
*
2
;
p_free_picture
->
p_u
=
(
yuv_data_t
*
)
p_free_picture
->
p_data
+
i_height
*
i_chroma_width
*
2
;
p_free_picture
->
p_v
=
(
yuv_data_t
*
)
p_free_picture
->
p_data
+
i_height
*
i_chroma_width
*
3
;
p_free_picture
->
p_v
=
(
yuv_data_t
*
)
p_free_picture
->
p_data
+
i_height
*
i_chroma_width
*
3
;
break
;
break
;
case
YUV_444_PICTURE
:
/* YUV 444: 1,1,1 samples per pixel */
case
YUV_444_PICTURE
:
/* YUV 444: 1,1,1 samples per pixel */
i_chroma_width
=
i_width
;
i_chroma_width
=
i_width
;
p_free_picture
->
p_data
=
malloc
(
i_height
*
i_chroma_width
*
3
*
sizeof
(
yuv_data_t
)
);
p_free_picture
->
p_data
=
malloc
(
i_height
*
i_chroma_width
*
3
*
sizeof
(
yuv_data_t
)
);
p_free_picture
->
p_y
=
(
yuv_data_t
*
)
p_free_picture
->
p_data
;
p_free_picture
->
p_y
=
(
yuv_data_t
*
)
p_free_picture
->
p_data
;
p_free_picture
->
p_u
=
(
yuv_data_t
*
)
p_free_picture
->
p_data
+
i_height
*
i_chroma_width
;
p_free_picture
->
p_u
=
(
yuv_data_t
*
)
p_free_picture
->
p_data
+
i_height
*
i_chroma_width
;
p_free_picture
->
p_v
=
(
yuv_data_t
*
)
p_free_picture
->
p_data
+
i_height
*
i_chroma_width
*
2
;
p_free_picture
->
p_v
=
(
yuv_data_t
*
)
p_free_picture
->
p_data
+
i_height
*
i_chroma_width
*
2
;
break
;
break
;
#ifdef DEBUG
#ifdef DEBUG
default:
default:
...
@@ -743,7 +743,7 @@ static void RenderPicture( vout_thread_t *p_vout, picture_t *p_pic )
...
@@ -743,7 +743,7 @@ static void RenderPicture( vout_thread_t *p_vout, picture_t *p_pic )
p_vout
->
p_ConvertYUV420
(
p_vout
,
vout_SysGetPicture
(
p_vout
),
p_vout
->
p_ConvertYUV420
(
p_vout
,
vout_SysGetPicture
(
p_vout
),
p_pic
->
p_y
,
p_pic
->
p_u
,
p_pic
->
p_v
,
p_pic
->
p_y
,
p_pic
->
p_u
,
p_pic
->
p_v
,
p_pic
->
i_width
,
p_pic
->
i_height
,
0
,
0
,
p_pic
->
i_width
,
p_pic
->
i_height
,
0
,
0
,
4
);
4
,
p_pic
->
i_matrix_coefficients
);
break
;
break
;
case
YUV_422_PICTURE
:
case
YUV_422_PICTURE
:
/* ??? p_vout->p_convert_yuv_420( p_vout,
/* ??? p_vout->p_convert_yuv_420( p_vout,
...
...
src/video_output/video_yuv.c
View file @
db6d4f7d
...
@@ -52,29 +52,29 @@ static void MaskToShift ( int *pi_right, int *pi_left, u32 i_mask );
...
@@ -52,29 +52,29 @@ static void MaskToShift ( int *pi_right, int *pi_left, u32 i_mask );
static
void
SetTables
(
vout_thread_t
*
p_vout
);
static
void
SetTables
(
vout_thread_t
*
p_vout
);
static
void
ConvertY4Gray16
(
p_vout_thread_t
p_vout
,
u16
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
static
void
ConvertY4Gray16
(
p_vout_thread_t
p_vout
,
u16
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
);
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
,
int
i_matrix_coefficients
);
static
void
ConvertY4Gray24
(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
static
void
ConvertY4Gray24
(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
);
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
,
int
i_matrix_coefficients
);
static
void
ConvertY4Gray32
(
p_vout_thread_t
p_vout
,
u32
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
static
void
ConvertY4Gray32
(
p_vout_thread_t
p_vout
,
u32
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
);
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
,
int
i_matrix_coefficients
);
static
void
ConvertYUV420RGB16
(
p_vout_thread_t
p_vout
,
u16
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
static
void
ConvertYUV420RGB16
(
p_vout_thread_t
p_vout
,
u16
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
);
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
,
int
i_matrix_coefficients
);
static
void
ConvertYUV422RGB16
(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
static
void
ConvertYUV422RGB16
(
p_vout_thread_t
p_vout
,
u16
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
);
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
,
int
i_matrix_coefficients
);
static
void
ConvertYUV444RGB16
(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
static
void
ConvertYUV444RGB16
(
p_vout_thread_t
p_vout
,
u16
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
);
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
,
int
i_matrix_coefficients
);
static
void
ConvertYUV420RGB24
(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
static
void
ConvertYUV420RGB24
(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
);
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
,
int
i_matrix_coefficients
);
static
void
ConvertYUV422RGB24
(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
static
void
ConvertYUV422RGB24
(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
);
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
,
int
i_matrix_coefficients
);
static
void
ConvertYUV444RGB24
(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
static
void
ConvertYUV444RGB24
(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
);
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
,
int
i_matrix_coefficients
);
static
void
ConvertYUV420RGB32
(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
static
void
ConvertYUV420RGB32
(
p_vout_thread_t
p_vout
,
u32
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
);
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
,
int
i_matrix_coefficients
);
static
void
ConvertYUV422RGB32
(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
static
void
ConvertYUV422RGB32
(
p_vout_thread_t
p_vout
,
u32
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
);
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
,
int
i_matrix_coefficients
);
static
void
ConvertYUV444RGB32
(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
static
void
ConvertYUV444RGB32
(
p_vout_thread_t
p_vout
,
u32
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
);
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
,
int
i_matrix_coefficients
);
static
void
Scale16
(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
void
*
p_buffer
,
static
void
Scale16
(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
void
*
p_buffer
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
float
f_alpha
,
float
f_beta
);
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
float
f_alpha
,
float
f_beta
);
static
void
Scale24
(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
void
*
p_buffer
,
static
void
Scale24
(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
void
*
p_buffer
,
...
@@ -130,13 +130,6 @@ for( i_x = 0; i_x < i_width; i_x+=16 ) \
...
@@ -130,13 +130,6 @@ for( i_x = 0; i_x < i_width; i_x+=16 ) \
* p_gray gray translation table
* p_gray gray translation table
*******************************************************************************/
*******************************************************************************/
#define CONVERT_YUV_GRAY \
#define CONVERT_YUV_GRAY \
/* Set scale factor to be ignored if it is 0 */
\
if( !i_scale ) \
{ \
i_scale = i_height; \
} \
\
/* Main loop */
\
for (i_y = 0; i_y < i_height ; i_y++) \
for (i_y = 0; i_y < i_height ; i_y++) \
{ \
{ \
for (i_x = 0; i_x < i_width; i_x += 16) \
for (i_x = 0; i_x < i_width; i_x += 16) \
...
@@ -161,7 +154,7 @@ for (i_y = 0; i_y < i_height ; i_y++) \
...
@@ -161,7 +154,7 @@ for (i_y = 0; i_y < i_height ; i_y++) \
} \
} \
\
\
/* Handle scale factor */
\
/* Handle scale factor */
\
if(
! (i_y % i_scale) )
\
if(
i_scale && ! (i_y % i_scale) )
\
{ \
{ \
if( i_scale < 0 ) \
if( i_scale < 0 ) \
{ \
{ \
...
@@ -198,18 +191,12 @@ for (i_y = 0; i_y < i_height ; i_y++) \
...
@@ -198,18 +191,12 @@ for (i_y = 0; i_y < i_height ; i_y++) \
* p_red red translation table
* p_red red translation table
* p_green green translation table
* p_green green translation table
* p_blue blue translation table
* p_blue blue translation table
* i_crv, i_cgu, i_cgv, i_cbu matrix coefficients
*******************************************************************************/
*******************************************************************************/
#define CONVERT_YUV_RGB \
#define CONVERT_YUV_RGB( CHROMA ) \
/* Set scale factor to be ignored if it is 0 */
\
if( !i_scale ) \
{ \
i_scale = i_height; \
} \
\
/* Main loop */
\
for (i_y = 0; i_y < i_height ; i_y++) \
for (i_y = 0; i_y < i_height ; i_y++) \
{ \
{ \
for (i_x
=0; i_x < i_width; i_x += 2 )
\
for (i_x
= 0; i_x < i_width; i_x += 2 )
\
{ \
{ \
/* First sample (complete) */
\
/* First sample (complete) */
\
i_yval = 76309 * *p_y++ - 1188177; \
i_yval = 76309 * *p_y++ - 1188177; \
...
@@ -232,20 +219,15 @@ for (i_y = 0; i_y < i_height ; i_y++) \
...
@@ -232,20 +219,15 @@ for (i_y = 0; i_y < i_height ; i_y++) \
p_blue [(i_yval+i_cbu*i_uval) >>16]; \
p_blue [(i_yval+i_cbu*i_uval) >>16]; \
} \
} \
\
\
/* Handle scale factor
*/
\
/* Handle scale factor
and rewind in 4:2:0 */
\
if(
! (i_y % i_scale) )
\
if(
i_scale && ! (i_y % i_scale) )
\
{ \
{ \
if( i_scale < 0 ) \
if( i_scale < 0 ) \
{ \
{ \
/* Copy previous line
*/
\
/* Copy previous line
, rewind if required */
\
p_pic_src = p_pic - i_width; \
p_pic_src = p_pic - i_width; \
p_pic += i_pic_eol; \
p_pic += i_pic_eol; \
LINE_COPY \
LINE_COPY \
} \
else \
{ \
/* Ignore next line, rewind if in 4:2:0 */
\
p_y += i_eol + i_width; \
if( (CHROMA == 420) && !(i_y & 0x1) ) \
if( (CHROMA == 420) && !(i_y & 0x1) ) \
{ \
{ \
p_u -= i_chroma_width; \
p_u -= i_chroma_width; \
...
@@ -256,12 +238,17 @@ for (i_y = 0; i_y < i_height ; i_y++) \
...
@@ -256,12 +238,17 @@ for (i_y = 0; i_y < i_height ; i_y++) \
p_u += i_chroma_eol; \
p_u += i_chroma_eol; \
p_v += i_chroma_eol; \
p_v += i_chroma_eol; \
} \
} \
} \
else \
{ \
/* Ignore next line */
\
p_y += i_eol + i_width; \
p_u += i_chroma_eol; \
p_v += i_chroma_eol; \
i_y++; \
i_y++; \
} \
} \
} \
} \
\
else if( (CHROMA == 420) && !(i_y & 0x1) ) \
/* Rewind u and v values in 4:2:0, or skip until next line */
\
if( (CHROMA == 420) && !(i_y & 0x1) ) \
{ \
{ \
p_u -= i_chroma_width; \
p_u -= i_chroma_width; \
p_v -= i_chroma_width; \
p_v -= i_chroma_width; \
...
@@ -277,6 +264,7 @@ for (i_y = 0; i_y < i_height ; i_y++) \
...
@@ -277,6 +264,7 @@ for (i_y = 0; i_y < i_height ; i_y++) \
p_y += i_eol; \
p_y += i_eol; \
}
}
/*******************************************************************************
/*******************************************************************************
* vout_InitTables: allocate and initialize translations tables
* vout_InitTables: allocate and initialize translations tables
*******************************************************************************
*******************************************************************************
...
@@ -285,10 +273,14 @@ for (i_y = 0; i_y < i_height ; i_y++) \
...
@@ -285,10 +273,14 @@ for (i_y = 0; i_y < i_height ; i_y++) \
*******************************************************************************/
*******************************************************************************/
int
vout_InitTables
(
vout_thread_t
*
p_vout
)
int
vout_InitTables
(
vout_thread_t
*
p_vout
)
{
{
/* Allocate memory and set pointers */
size_t
tables_size
;
/* tables size, in bytes */
p_vout
->
tables
.
p_base
=
malloc
(
(
3
*
1024
)
*
(
p_vout
->
i_bytes_per_pixel
!=
3
?
/* Computes tables size */
p_vout
->
i_bytes_per_pixel
:
4
));
//??
tables_size
=
4
*
4
*
1024
;
/* Allocate memory */
p_vout
->
tables
.
p_base
=
malloc
(
tables_size
);
if
(
p_vout
->
tables
.
p_base
==
NULL
)
if
(
p_vout
->
tables
.
p_base
==
NULL
)
{
{
intf_ErrMsg
(
"error: %s
\n
"
,
strerror
(
ENOMEM
));
intf_ErrMsg
(
"error: %s
\n
"
,
strerror
(
ENOMEM
));
...
@@ -560,7 +552,7 @@ static void SetTables( vout_thread_t *p_vout )
...
@@ -560,7 +552,7 @@ static void SetTables( vout_thread_t *p_vout )
static
void
ConvertY4Gray16
(
p_vout_thread_t
p_vout
,
u16
*
p_pic
,
static
void
ConvertY4Gray16
(
p_vout_thread_t
p_vout
,
u16
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
)
int
i_scale
,
int
i_matrix_coefficients
)
{
{
u16
*
p_pic_src
;
/* source pointer in case of copy */
u16
*
p_pic_src
;
/* source pointer in case of copy */
u16
*
p_gray
;
/* gray table */
u16
*
p_gray
;
/* gray table */
...
@@ -576,7 +568,7 @@ static void ConvertY4Gray16( p_vout_thread_t p_vout, u16 *p_pic,
...
@@ -576,7 +568,7 @@ static void ConvertY4Gray16( p_vout_thread_t p_vout, u16 *p_pic,
static
void
ConvertY4Gray24
(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
static
void
ConvertY4Gray24
(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
)
int
i_scale
,
int
i_matrix_coefficients
)
{
{
//??
//??
}
}
...
@@ -587,7 +579,7 @@ static void ConvertY4Gray24( p_vout_thread_t p_vout, void *p_pic,
...
@@ -587,7 +579,7 @@ static void ConvertY4Gray24( p_vout_thread_t p_vout, void *p_pic,
static
void
ConvertY4Gray32
(
p_vout_thread_t
p_vout
,
u32
*
p_pic
,
static
void
ConvertY4Gray32
(
p_vout_thread_t
p_vout
,
u32
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
)
int
i_scale
,
int
i_matrix_coefficients
)
{
{
u32
*
p_pic_src
;
/* source pointer in case of copy */
u32
*
p_pic_src
;
/* source pointer in case of copy */
u32
*
p_gray
;
/* gray table */
u32
*
p_gray
;
/* gray table */
...
@@ -603,7 +595,7 @@ static void ConvertY4Gray32( p_vout_thread_t p_vout, u32 *p_pic,
...
@@ -603,7 +595,7 @@ static void ConvertY4Gray32( p_vout_thread_t p_vout, u32 *p_pic,
static
void
ConvertYUV420RGB16
(
p_vout_thread_t
p_vout
,
u16
*
p_pic
,
static
void
ConvertYUV420RGB16
(
p_vout_thread_t
p_vout
,
u16
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
)
int
i_scale
,
int
i_matrix_coefficients
)
{
{
u16
*
p_pic_src
;
/* source pointer in case of copy */
u16
*
p_pic_src
;
/* source pointer in case of copy */
u16
*
p_red
;
/* red table */
u16
*
p_red
;
/* red table */
...
@@ -612,36 +604,76 @@ static void ConvertYUV420RGB16( p_vout_thread_t p_vout, u16 *p_pic,
...
@@ -612,36 +604,76 @@ static void ConvertYUV420RGB16( p_vout_thread_t p_vout, u16 *p_pic,
int
i_uval
,
i_yval
,
i_vval
;
/* samples */
int
i_uval
,
i_yval
,
i_vval
;
/* samples */
int
i_x
,
i_y
;
/* picture coordinates */
int
i_x
,
i_y
;
/* picture coordinates */
int
i_chroma_width
,
i_chroma_eol
;
/* width and eol for chroma */
int
i_chroma_width
,
i_chroma_eol
;
/* width and eol for chroma */
int
i_crv
;
int
i_crv
,
i_cbu
,
i_cgu
,
i_cgv
;
/* transformation coefficients */
/* p_red = p_vout->tables.yuv.rgb16.p_red;
i_crv
=
MATRIX_COEFFICIENTS_TABLE
[
i_matrix_coefficients
][
0
];
i_cbu
=
MATRIX_COEFFICIENTS_TABLE
[
i_matrix_coefficients
][
1
];
i_cgu
=
MATRIX_COEFFICIENTS_TABLE
[
i_matrix_coefficients
][
2
];
i_cgv
=
MATRIX_COEFFICIENTS_TABLE
[
i_matrix_coefficients
][
3
];
p_red
=
p_vout
->
tables
.
yuv
.
rgb16
.
p_red
;
p_green
=
p_vout
->
tables
.
yuv
.
rgb16
.
p_green
;
p_green
=
p_vout
->
tables
.
yuv
.
rgb16
.
p_green
;
p_blue
=
p_vout
->
tables
.
yuv
.
rgb16
.
p_blue
;
p_blue
=
p_vout
->
tables
.
yuv
.
rgb16
.
p_blue
;
i_chroma_width = i_width /
4
;
i_chroma_width
=
i_width
/
2
;
i_chroma_eol = i_eol /
4
;
i_chroma_eol
=
i_eol
/
2
;
CONVERT_YUV_RGB
*/
CONVERT_YUV_RGB
(
420
)
}
}
/*******************************************************************************
/*******************************************************************************
* ConvertYUV422RGB16: color YUV 4:2:2 to RGB 15 or 16 bpp
* ConvertYUV422RGB16: color YUV 4:2:2 to RGB 15 or 16 bpp
*******************************************************************************/
*******************************************************************************/
static
void
ConvertYUV422RGB16
(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
static
void
ConvertYUV422RGB16
(
p_vout_thread_t
p_vout
,
u16
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
)
int
i_scale
,
int
i_matrix_coefficients
)
{
{
//??
u16
*
p_pic_src
;
/* source pointer in case of copy */
u16
*
p_red
;
/* red table */
u16
*
p_green
;
/* green table */
u16
*
p_blue
;
/* blue table */
int
i_uval
,
i_yval
,
i_vval
;
/* samples */
int
i_x
,
i_y
;
/* picture coordinates */
int
i_chroma_width
,
i_chroma_eol
;
/* width and eol for chroma */
int
i_crv
,
i_cbu
,
i_cgu
,
i_cgv
;
/* transformation coefficients */
i_crv
=
MATRIX_COEFFICIENTS_TABLE
[
i_matrix_coefficients
][
0
];
i_cbu
=
MATRIX_COEFFICIENTS_TABLE
[
i_matrix_coefficients
][
1
];
i_cgu
=
MATRIX_COEFFICIENTS_TABLE
[
i_matrix_coefficients
][
2
];
i_cgv
=
MATRIX_COEFFICIENTS_TABLE
[
i_matrix_coefficients
][
3
];
p_red
=
p_vout
->
tables
.
yuv
.
rgb16
.
p_red
;
p_green
=
p_vout
->
tables
.
yuv
.
rgb16
.
p_green
;
p_blue
=
p_vout
->
tables
.
yuv
.
rgb16
.
p_blue
;
i_chroma_width
=
i_width
/
2
;
i_chroma_eol
=
i_eol
/
2
;
CONVERT_YUV_RGB
(
422
)
}
}
/*******************************************************************************
/*******************************************************************************
* ConvertYUV444RGB16: color YUV 4:4:4 to RGB 15 or 16 bpp
* ConvertYUV444RGB16: color YUV 4:4:4 to RGB 15 or 16 bpp
*******************************************************************************/
*******************************************************************************/
static
void
ConvertYUV444RGB16
(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
static
void
ConvertYUV444RGB16
(
p_vout_thread_t
p_vout
,
u16
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
)
int
i_scale
,
int
i_matrix_coefficients
)
{
{
//??
u16
*
p_pic_src
;
/* source pointer in case of copy */
u16
*
p_red
;
/* red table */
u16
*
p_green
;
/* green table */
u16
*
p_blue
;
/* blue table */
int
i_uval
,
i_yval
,
i_vval
;
/* samples */
int
i_x
,
i_y
;
/* picture coordinates */
int
i_chroma_width
,
i_chroma_eol
;
/* width and eol for chroma */
int
i_crv
,
i_cbu
,
i_cgu
,
i_cgv
;
/* transformation coefficients */
i_crv
=
MATRIX_COEFFICIENTS_TABLE
[
i_matrix_coefficients
][
0
];
i_cbu
=
MATRIX_COEFFICIENTS_TABLE
[
i_matrix_coefficients
][
1
];
i_cgu
=
MATRIX_COEFFICIENTS_TABLE
[
i_matrix_coefficients
][
2
];
i_cgv
=
MATRIX_COEFFICIENTS_TABLE
[
i_matrix_coefficients
][
3
];
p_red
=
p_vout
->
tables
.
yuv
.
rgb16
.
p_red
;
p_green
=
p_vout
->
tables
.
yuv
.
rgb16
.
p_green
;
p_blue
=
p_vout
->
tables
.
yuv
.
rgb16
.
p_blue
;
i_chroma_width
=
i_width
;
i_chroma_eol
=
i_eol
;
CONVERT_YUV_RGB
(
444
)
}
}
/*******************************************************************************
/*******************************************************************************
...
@@ -650,7 +682,7 @@ static void ConvertYUV444RGB16( p_vout_thread_t p_vout, void *p_pic,
...
@@ -650,7 +682,7 @@ static void ConvertYUV444RGB16( p_vout_thread_t p_vout, void *p_pic,
static
void
ConvertYUV420RGB24
(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
static
void
ConvertYUV420RGB24
(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
)
int
i_scale
,
int
i_matrix_coefficients
)
{
{
//???
//???
}
}
...
@@ -661,7 +693,7 @@ static void ConvertYUV420RGB24( p_vout_thread_t p_vout, void *p_pic,
...
@@ -661,7 +693,7 @@ static void ConvertYUV420RGB24( p_vout_thread_t p_vout, void *p_pic,
static
void
ConvertYUV422RGB24
(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
static
void
ConvertYUV422RGB24
(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
)
int
i_scale
,
int
i_matrix_coefficients
)
{
{
//???
//???
}
}
...
@@ -672,7 +704,7 @@ static void ConvertYUV422RGB24( p_vout_thread_t p_vout, void *p_pic,
...
@@ -672,7 +704,7 @@ static void ConvertYUV422RGB24( p_vout_thread_t p_vout, void *p_pic,
static
void
ConvertYUV444RGB24
(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
static
void
ConvertYUV444RGB24
(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
)
int
i_scale
,
int
i_matrix_coefficients
)
{
{
//???
//???
}
}
...
@@ -680,34 +712,88 @@ static void ConvertYUV444RGB24( p_vout_thread_t p_vout, void *p_pic,
...
@@ -680,34 +712,88 @@ static void ConvertYUV444RGB24( p_vout_thread_t p_vout, void *p_pic,
/*******************************************************************************
/*******************************************************************************
* ConvertYUV420RGB32: color YUV 4:2:0 to RGB 32 bpp
* ConvertYUV420RGB32: color YUV 4:2:0 to RGB 32 bpp
*******************************************************************************/
*******************************************************************************/
static
void
ConvertYUV420RGB32
(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
static
void
ConvertYUV420RGB32
(
p_vout_thread_t
p_vout
,
u32
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
)
int
i_scale
,
int
i_matrix_coefficients
)
{
{
//???
u32
*
p_pic_src
;
/* source pointer in case of copy */
u32
*
p_red
;
/* red table */
u32
*
p_green
;
/* green table */
u32
*
p_blue
;
/* blue table */
int
i_uval
,
i_yval
,
i_vval
;
/* samples */
int
i_x
,
i_y
;
/* picture coordinates */
int
i_chroma_width
,
i_chroma_eol
;
/* width and eol for chroma */
int
i_crv
,
i_cbu
,
i_cgu
,
i_cgv
;
/* transformation coefficients */
i_crv
=
MATRIX_COEFFICIENTS_TABLE
[
i_matrix_coefficients
][
0
];
i_cbu
=
MATRIX_COEFFICIENTS_TABLE
[
i_matrix_coefficients
][
1
];
i_cgu
=
MATRIX_COEFFICIENTS_TABLE
[
i_matrix_coefficients
][
2
];
i_cgv
=
MATRIX_COEFFICIENTS_TABLE
[
i_matrix_coefficients
][
3
];
p_red
=
p_vout
->
tables
.
yuv
.
rgb32
.
p_red
;
p_green
=
p_vout
->
tables
.
yuv
.
rgb32
.
p_green
;
p_blue
=
p_vout
->
tables
.
yuv
.
rgb32
.
p_blue
;
i_chroma_width
=
i_width
/
2
;
i_chroma_eol
=
i_eol
/
2
;
CONVERT_YUV_RGB
(
420
)
}
}
/*******************************************************************************
/*******************************************************************************
* ConvertYUV422RGB32: color YUV 4:2:2 to RGB 32 bpp
* ConvertYUV422RGB32: color YUV 4:2:2 to RGB 32 bpp
*******************************************************************************/
*******************************************************************************/
static
void
ConvertYUV422RGB32
(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
static
void
ConvertYUV422RGB32
(
p_vout_thread_t
p_vout
,
u32
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
)
int
i_scale
,
int
i_matrix_coefficients
)
{
{
//???
u32
*
p_pic_src
;
/* source pointer in case of copy */
u32
*
p_red
;
/* red table */
u32
*
p_green
;
/* green table */
u32
*
p_blue
;
/* blue table */
int
i_uval
,
i_yval
,
i_vval
;
/* samples */
int
i_x
,
i_y
;
/* picture coordinates */
int
i_chroma_width
,
i_chroma_eol
;
/* width and eol for chroma */
int
i_crv
,
i_cbu
,
i_cgu
,
i_cgv
;
/* transformation coefficients */
i_crv
=
MATRIX_COEFFICIENTS_TABLE
[
i_matrix_coefficients
][
0
];
i_cbu
=
MATRIX_COEFFICIENTS_TABLE
[
i_matrix_coefficients
][
1
];
i_cgu
=
MATRIX_COEFFICIENTS_TABLE
[
i_matrix_coefficients
][
2
];
i_cgv
=
MATRIX_COEFFICIENTS_TABLE
[
i_matrix_coefficients
][
3
];
p_red
=
p_vout
->
tables
.
yuv
.
rgb32
.
p_red
;
p_green
=
p_vout
->
tables
.
yuv
.
rgb32
.
p_green
;
p_blue
=
p_vout
->
tables
.
yuv
.
rgb32
.
p_blue
;
i_chroma_width
=
i_width
/
2
;
i_chroma_eol
=
i_eol
/
2
;
CONVERT_YUV_RGB
(
422
)
}
}
/*******************************************************************************
/*******************************************************************************
* ConvertYUV444RGB32: color YUV 4:4:4 to RGB 32 bpp
* ConvertYUV444RGB32: color YUV 4:4:4 to RGB 32 bpp
*******************************************************************************/
*******************************************************************************/
static
void
ConvertYUV444RGB32
(
p_vout_thread_t
p_vout
,
void
*
p_pic
,
static
void
ConvertYUV444RGB32
(
p_vout_thread_t
p_vout
,
u32
*
p_pic
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
yuv_data_t
*
p_y
,
yuv_data_t
*
p_u
,
yuv_data_t
*
p_v
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_width
,
int
i_height
,
int
i_eol
,
int
i_pic_eol
,
int
i_scale
)
int
i_scale
,
int
i_matrix_coefficients
)
{
{
//???
u32
*
p_pic_src
;
/* source pointer in case of copy */
u32
*
p_red
;
/* red table */
u32
*
p_green
;
/* green table */
u32
*
p_blue
;
/* blue table */
int
i_uval
,
i_yval
,
i_vval
;
/* samples */
int
i_x
,
i_y
;
/* picture coordinates */
int
i_chroma_width
,
i_chroma_eol
;
/* width and eol for chroma */
int
i_crv
,
i_cbu
,
i_cgu
,
i_cgv
;
/* transformation coefficients */
i_crv
=
MATRIX_COEFFICIENTS_TABLE
[
i_matrix_coefficients
][
0
];
i_cbu
=
MATRIX_COEFFICIENTS_TABLE
[
i_matrix_coefficients
][
1
];
i_cgu
=
MATRIX_COEFFICIENTS_TABLE
[
i_matrix_coefficients
][
2
];
i_cgv
=
MATRIX_COEFFICIENTS_TABLE
[
i_matrix_coefficients
][
3
];
p_red
=
p_vout
->
tables
.
yuv
.
rgb32
.
p_red
;
p_green
=
p_vout
->
tables
.
yuv
.
rgb32
.
p_green
;
p_blue
=
p_vout
->
tables
.
yuv
.
rgb32
.
p_blue
;
i_chroma_width
=
i_width
;
i_chroma_eol
=
i_eol
;
CONVERT_YUV_RGB
(
444
)
}
}
/*******************************************************************************
/*******************************************************************************
...
...
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