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
3173ecbb
Commit
3173ecbb
authored
Aug 01, 2007
by
Sam Hocevar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* Simple grayscale -> yuv conversions.
parent
3a9ae14c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
186 additions
and
1 deletion
+186
-1
configure.ac
configure.ac
+1
-1
modules/video_chroma/Modules.am
modules/video_chroma/Modules.am
+4
-0
modules/video_chroma/grey_yuv.c
modules/video_chroma/grey_yuv.c
+181
-0
No files found.
configure.ac
View file @
3173ecbb
...
...
@@ -1201,7 +1201,7 @@ VLC_ADD_PLUGINS([converter_fixed mono])
VLC_ADD_PLUGINS([trivial_resampler ugly_resampler])
VLC_ADD_PLUGINS([trivial_channel_mixer trivial_mixer])
VLC_ADD_PLUGINS([playlist export sgimb nsc xtag])
VLC_ADD_PLUGINS([i420_rgb rawvideo blend scale image logo magnify puzzle colorthres])
VLC_ADD_PLUGINS([i420_rgb
grey_yuv
rawvideo blend scale image logo magnify puzzle colorthres])
VLC_ADD_PLUGINS([wav araw subtitle vobsub adpcm a52sys dtssys au ty voc xa nuv])
VLC_ADD_PLUGINS([access_directory access_file access_udp access_tcp])
VLC_ADD_PLUGINS([access_http access_mms access_ftp])
...
...
modules/video_chroma/Modules.am
View file @
3173ecbb
...
...
@@ -58,3 +58,7 @@ SOURCES_i420_ymga_mmx = \
i420_ymga.c \
$(NULL)
SOURCES_grey_yuv = \
grey_yuv.c \
$(NULL)
modules/video_chroma/grey_yuv.c
0 → 100644
View file @
3173ecbb
/*****************************************************************************
* grey_yuv.c : grayscale to others conversion module for vlc
*****************************************************************************
* Copyright (C) 2007 the VideoLAN team
* $Id$
*
* Authors: Sam Hocevar <sam@zoy.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <string.h>
/* strerror() */
#include <stdlib.h>
/* malloc(), free() */
#include <vlc/vlc.h>
#include <vlc_vout.h>
#define SRC_FOURCC "GREY"
#define DEST_FOURCC "I420,YUY2"
/*****************************************************************************
* Local and extern prototypes.
*****************************************************************************/
static
int
Activate
(
vlc_object_t
*
);
static
void
GREY_I420
(
vout_thread_t
*
,
picture_t
*
,
picture_t
*
);
static
void
GREY_YUY2
(
vout_thread_t
*
,
picture_t
*
,
picture_t
*
);
/*****************************************************************************
* Module descriptor.
*****************************************************************************/
vlc_module_begin
();
set_description
(
_
(
"Conversions from "
SRC_FOURCC
" to "
DEST_FOURCC
)
);
set_capability
(
"chroma"
,
80
);
set_callbacks
(
Activate
,
NULL
);
vlc_module_end
();
/*****************************************************************************
* Activate: allocate a chroma function
*****************************************************************************
* This function allocates and initializes a chroma function
*****************************************************************************/
static
int
Activate
(
vlc_object_t
*
p_this
)
{
vout_thread_t
*
p_vout
=
(
vout_thread_t
*
)
p_this
;
if
(
p_vout
->
render
.
i_width
&
1
||
p_vout
->
render
.
i_height
&
1
)
{
return
-
1
;
}
switch
(
p_vout
->
render
.
i_chroma
)
{
case
VLC_FOURCC
(
'G'
,
'R'
,
'E'
,
'Y'
):
switch
(
p_vout
->
output
.
i_chroma
)
{
case
VLC_FOURCC
(
'I'
,
'4'
,
'2'
,
'0'
):
p_vout
->
chroma
.
pf_convert
=
GREY_I420
;
break
;
case
VLC_FOURCC
(
'Y'
,
'U'
,
'Y'
,
'2'
):
p_vout
->
chroma
.
pf_convert
=
GREY_YUY2
;
break
;
default:
return
-
1
;
}
break
;
default:
return
-
1
;
}
return
0
;
}
/* Following functions are local */
/*****************************************************************************
* GREY_I420: 8-bit grayscale to planar YUV 4:2:0
*****************************************************************************/
static
void
GREY_I420
(
vout_thread_t
*
p_vout
,
picture_t
*
p_source
,
picture_t
*
p_dest
)
{
uint8_t
*
p_line
=
p_source
->
p
->
p_pixels
;
uint8_t
*
p_y
=
p_dest
->
Y_PIXELS
;
uint8_t
*
p_u
=
p_dest
->
U_PIXELS
;
uint8_t
*
p_v
=
p_dest
->
V_PIXELS
;
int
i_x
,
i_y
;
const
int
i_source_margin
=
p_source
->
p
->
i_pitch
-
p_source
->
p
->
i_visible_pitch
;
const
int
i_dest_margin
=
p_dest
->
p
[
0
].
i_pitch
-
p_dest
->
p
[
0
].
i_visible_pitch
;
const
int
i_dest_margin_c
=
p_dest
->
p
[
1
].
i_pitch
-
p_dest
->
p
[
1
].
i_visible_pitch
;
for
(
i_y
=
p_vout
->
render
.
i_height
/
2
;
i_y
--
;
)
{
memset
(
p_u
,
0x80
,
p_dest
->
p
[
1
].
i_visible_pitch
);
p_u
+=
i_dest_margin_c
;
memset
(
p_v
,
0x80
,
p_dest
->
p
[
1
].
i_visible_pitch
);
p_v
+=
i_dest_margin_c
;
}
for
(
i_y
=
p_vout
->
render
.
i_height
;
i_y
--
;
)
{
for
(
i_x
=
p_vout
->
render
.
i_width
/
8
;
i_x
--
;
)
{
*
p_y
++
=
*
p_line
++
;
*
p_y
++
=
*
p_line
++
;
*
p_y
++
=
*
p_line
++
;
*
p_y
++
=
*
p_line
++
;
*
p_y
++
=
*
p_line
++
;
*
p_y
++
=
*
p_line
++
;
*
p_y
++
=
*
p_line
++
;
*
p_y
++
=
*
p_line
++
;
}
for
(
i_x
=
p_vout
->
render
.
i_width
%
8
;
i_x
--
;
)
{
*
p_y
++
=
*
p_line
++
;
}
p_line
+=
i_source_margin
;
p_y
+=
i_dest_margin
;
}
}
/*****************************************************************************
* GREY_YUY2: 8-bit grayscale to packed YUY2
*****************************************************************************/
static
void
GREY_YUY2
(
vout_thread_t
*
p_vout
,
picture_t
*
p_source
,
picture_t
*
p_dest
)
{
uint8_t
*
p_in
=
p_source
->
p
->
p_pixels
;
uint8_t
*
p_out
=
p_dest
->
p
->
p_pixels
;
int
i_x
,
i_y
;
const
int
i_source_margin
=
p_source
->
p
->
i_pitch
-
p_source
->
p
->
i_visible_pitch
;
const
int
i_dest_margin
=
p_dest
->
p
->
i_pitch
-
p_dest
->
p
->
i_visible_pitch
;
for
(
i_y
=
p_vout
->
render
.
i_height
;
i_y
--
;
)
{
for
(
i_x
=
p_vout
->
render
.
i_width
/
8
;
i_x
--
;
)
{
*
p_out
++
=
*
p_in
++
;
*
p_out
++
=
0x80
;
*
p_out
++
=
*
p_in
++
;
*
p_out
++
=
0x80
;
*
p_out
++
=
*
p_in
++
;
*
p_out
++
=
0x80
;
*
p_out
++
=
*
p_in
++
;
*
p_out
++
=
0x80
;
*
p_out
++
=
*
p_in
++
;
*
p_out
++
=
0x80
;
*
p_out
++
=
*
p_in
++
;
*
p_out
++
=
0x80
;
*
p_out
++
=
*
p_in
++
;
*
p_out
++
=
0x80
;
*
p_out
++
=
*
p_in
++
;
*
p_out
++
=
0x80
;
}
for
(
i_x
=
(
p_vout
->
render
.
i_width
%
8
)
/
2
;
i_x
--
;
)
{
*
p_out
++
=
*
p_in
++
;
*
p_out
++
=
0x80
;
*
p_out
++
=
*
p_in
++
;
*
p_out
++
=
0x80
;
}
p_in
+=
i_source_margin
;
p_out
+=
i_dest_margin
;
}
}
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