Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
6f0caee4
Commit
6f0caee4
authored
Mar 17, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
transform: non functional changes to support more than 8-bits
parent
9dfcc9e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
35 deletions
+42
-35
modules/video_filter/transform.c
modules/video_filter/transform.c
+42
-35
No files found.
modules/video_filter/transform.c
View file @
6f0caee4
...
@@ -100,7 +100,7 @@ static void R270(int *sx, int *sy, int w, int h, int dx, int dy)
...
@@ -100,7 +100,7 @@ static void R270(int *sx, int *sy, int w, int h, int dx, int dy)
typedef
void
(
*
convert_t
)(
int
*
,
int
*
,
int
,
int
,
int
,
int
);
typedef
void
(
*
convert_t
)(
int
*
,
int
*
,
int
,
int
,
int
,
int
);
#define PLANAR(f) \
#define PLANAR(f) \
static void Plan
ar
##f(plane_t *restrict dst, const plane_t *restrict src) \
static void Plan
e8_
##f(plane_t *restrict dst, const plane_t *restrict src) \
{ \
{ \
for (int y = 0; y < dst->i_visible_lines; y++) { \
for (int y = 0; y < dst->i_visible_lines; y++) { \
for (int x = 0; x < dst->i_visible_pitch; x++) { \
for (int x = 0; x < dst->i_visible_pitch; x++) { \
...
@@ -123,22 +123,27 @@ typedef struct {
...
@@ -123,22 +123,27 @@ typedef struct {
bool
is_rotated
;
bool
is_rotated
;
convert_t
convert
;
convert_t
convert
;
convert_t
iconvert
;
convert_t
iconvert
;
void
(
*
plan
ar
)(
plane_t
*
dst
,
const
plane_t
*
src
);
void
(
*
plan
e8
)(
plane_t
*
dst
,
const
plane_t
*
src
);
}
transform_description_t
;
}
transform_description_t
;
static
const
transform_description_t
descriptions
[]
=
{
#define DESC(str, rotated, f, invf) \
{
"90"
,
true
,
R90
,
R270
,
PlanarR90
,
},
{ str, rotated, f, invf, Plane8_##f, }
{
"180"
,
false
,
R180
,
R180
,
PlanarR180
,
},
{
"270"
,
true
,
R270
,
R90
,
PlanarR270
,
},
{
"hflip"
,
false
,
HFlip
,
HFlip
,
PlanarHFlip
,
},
{
"vflip"
,
false
,
VFlip
,
VFlip
,
PlanarVFlip
,
},
{
""
,
false
,
NULL
,
NULL
,
NULL
,
}
static
const
transform_description_t
descriptions
[]
=
{
DESC
(
"90"
,
true
,
R90
,
R270
),
DESC
(
"180"
,
false
,
R180
,
R180
),
DESC
(
"270"
,
true
,
R270
,
R90
),
DESC
(
"hflip"
,
false
,
HFlip
,
HFlip
),
DESC
(
"vflip"
,
false
,
VFlip
,
VFlip
),
};
};
static
const
size_t
n_transforms
=
sizeof
(
descriptions
)
/
sizeof
(
descriptions
[
0
]);
struct
filter_sys_t
{
struct
filter_sys_t
{
const
transform_description_t
*
dsc
;
const
vlc_chroma_description_t
*
chroma
;
const
vlc_chroma_description_t
*
chroma
;
void
(
*
plane
)(
plane_t
*
,
const
plane_t
*
);
convert_t
convert
;
};
};
static
picture_t
*
Filter
(
filter_t
*
filter
,
picture_t
*
src
)
static
picture_t
*
Filter
(
filter_t
*
filter
,
picture_t
*
src
)
...
@@ -152,12 +157,8 @@ static picture_t *Filter(filter_t *filter, picture_t *src)
...
@@ -152,12 +157,8 @@ static picture_t *Filter(filter_t *filter, picture_t *src)
}
}
const
vlc_chroma_description_t
*
chroma
=
sys
->
chroma
;
const
vlc_chroma_description_t
*
chroma
=
sys
->
chroma
;
if
(
chroma
->
plane_count
<
3
)
{
for
(
unsigned
i
=
0
;
i
<
chroma
->
plane_count
;
i
++
)
/* TODO */
sys
->
plane
(
&
dst
->
p
[
i
],
&
src
->
p
[
i
]);
}
else
{
for
(
unsigned
i
=
0
;
i
<
chroma
->
plane_count
;
i
++
)
sys
->
dsc
->
planar
(
&
dst
->
p
[
i
],
&
src
->
p
[
i
]);
}
picture_CopyProperties
(
dst
,
src
);
picture_CopyProperties
(
dst
,
src
);
picture_Release
(
src
);
picture_Release
(
src
);
...
@@ -169,12 +170,13 @@ static int Mouse(filter_t *filter, vlc_mouse_t *mouse,
...
@@ -169,12 +170,13 @@ static int Mouse(filter_t *filter, vlc_mouse_t *mouse,
{
{
VLC_UNUSED
(
mold
);
VLC_UNUSED
(
mold
);
const
video_format_t
*
fmt
=
&
filter
->
fmt_out
.
video
;
const
video_format_t
*
fmt
=
&
filter
->
fmt_out
.
video
;
const
transform_description_t
*
dsc
=
filter
->
p_sys
->
dsc
;
const
filter_sys_t
*
sys
=
filter
->
p_sys
;
*
mouse
=
*
mnew
;
*
mouse
=
*
mnew
;
dsc
->
convert
(
&
mouse
->
i_x
,
&
mouse
->
i_y
,
sys
->
convert
(
&
mouse
->
i_x
,
&
mouse
->
i_y
,
fmt
->
i_visible_width
,
fmt
->
i_visible_height
,
mouse
->
i_x
,
mouse
->
i_y
);
fmt
->
i_visible_width
,
fmt
->
i_visible_height
,
mouse
->
i_x
,
mouse
->
i_y
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -215,24 +217,27 @@ static int Open(vlc_object_t *object)
...
@@ -215,24 +217,27 @@ static int Open(vlc_object_t *object)
sys
->
chroma
=
chroma
;
sys
->
chroma
=
chroma
;
char
*
type_name
=
var_InheritString
(
filter
,
CFG_PREFIX
"type"
);
char
*
type_name
=
var_InheritString
(
filter
,
CFG_PREFIX
"type"
);
const
transform_description_t
*
dsc
=
NULL
;
sys
->
dsc
=
NULL
;
for
(
size_t
i
=
0
;
i
<
n_transforms
;
i
++
)
for
(
int
i
=
0
;
!
sys
->
dsc
&&
*
descriptions
[
i
].
name
;
i
++
)
{
if
(
type_name
&&
!
strcmp
(
descriptions
[
i
].
name
,
type_name
))
{
if
(
type_name
&&
*
type_name
&&
!
strcmp
(
descriptions
[
i
].
name
,
type_name
))
dsc
=
&
descriptions
[
i
];
sys
->
dsc
=
&
descriptions
[
i
];
break
;
}
}
if
(
!
sys
->
dsc
)
{
if
(
dsc
==
NULL
)
{
sys
->
dsc
=
&
descriptions
[
0
];
dsc
=
&
descriptions
[
0
];
msg_Warn
(
filter
,
"No valid transform mode provided, using '%s'"
,
sys
->
dsc
->
name
);
msg_Warn
(
filter
,
"No valid transform mode provided, using '%s'"
,
dsc
->
name
);
}
}
free
(
type_name
);
free
(
type_name
);
if
(
sys
->
dsc
->
is_rotated
)
{
sys
->
plane
=
dsc
->
plane8
;
sys
->
convert
=
dsc
->
convert
;
if
(
dsc
->
is_rotated
)
{
if
(
!
filter
->
b_allow_fmt_out_change
)
{
if
(
!
filter
->
b_allow_fmt_out_change
)
{
msg_Err
(
filter
,
"Format change is not allowed"
);
msg_Err
(
filter
,
"Format change is not allowed"
);
free
(
sys
);
goto
error
;
return
VLC_EGENERIC
;
}
}
dst
->
i_width
=
src
->
i_height
;
dst
->
i_width
=
src
->
i_height
;
...
@@ -247,10 +252,9 @@ static int Open(vlc_object_t *object)
...
@@ -247,10 +252,9 @@ static int Open(vlc_object_t *object)
dst
->
i_y_offset
=
INT_MAX
;
dst
->
i_y_offset
=
INT_MAX
;
for
(
int
i
=
0
;
i
<
2
;
i
++
)
{
for
(
int
i
=
0
;
i
<
2
;
i
++
)
{
int
tx
,
ty
;
int
tx
,
ty
;
sys
->
dsc
->
iconvert
(
&
tx
,
&
ty
,
dsc
->
iconvert
(
&
tx
,
&
ty
,
src
->
i_width
,
src
->
i_height
,
src
->
i_width
,
src
->
i_height
,
src
->
i_x_offset
+
i
*
(
src
->
i_visible_width
-
1
),
src
->
i_x_offset
+
i
*
(
src
->
i_visible_width
-
1
),
src
->
i_y_offset
+
i
*
(
src
->
i_visible_height
-
1
));
src
->
i_y_offset
+
i
*
(
src
->
i_visible_height
-
1
));
dst
->
i_x_offset
=
__MIN
(
dst
->
i_x_offset
,
(
unsigned
)(
1
+
tx
));
dst
->
i_x_offset
=
__MIN
(
dst
->
i_x_offset
,
(
unsigned
)(
1
+
tx
));
dst
->
i_y_offset
=
__MIN
(
dst
->
i_y_offset
,
(
unsigned
)(
1
+
ty
));
dst
->
i_y_offset
=
__MIN
(
dst
->
i_y_offset
,
(
unsigned
)(
1
+
ty
));
}
}
...
@@ -259,6 +263,9 @@ static int Open(vlc_object_t *object)
...
@@ -259,6 +263,9 @@ static int Open(vlc_object_t *object)
filter
->
pf_video_filter
=
Filter
;
filter
->
pf_video_filter
=
Filter
;
filter
->
pf_video_mouse
=
Mouse
;
filter
->
pf_video_mouse
=
Mouse
;
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
error:
free
(
sys
);
return
VLC_EGENERIC
;
}
}
static
void
Close
(
vlc_object_t
*
object
)
static
void
Close
(
vlc_object_t
*
object
)
...
...
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