Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
df3cbd54
Commit
df3cbd54
authored
Jul 08, 2011
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
codec/avcodec/vaapi: cleanup
Cleanup no longer needed variables.
parent
76a2372f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
41 deletions
+6
-41
modules/codec/avcodec/vaapi.c
modules/codec/avcodec/vaapi.c
+3
-27
modules/codec/avcodec/vaapi.h
modules/codec/avcodec/vaapi.h
+1
-8
modules/codec/avcodec/vaapi_x11.c
modules/codec/avcodec/vaapi_x11.c
+2
-6
No files found.
modules/codec/avcodec/vaapi.c
View file @
df3cbd54
...
@@ -179,7 +179,6 @@ static void DestroySurfaces( vlc_va_vaapi_t *p_va )
...
@@ -179,7 +179,6 @@ static void DestroySurfaces( vlc_va_vaapi_t *p_va )
for
(
int
i
=
0
;
i
<
p_va
->
i_surface_count
&&
p_va
->
p_surface
;
i
++
)
for
(
int
i
=
0
;
i
<
p_va
->
i_surface_count
&&
p_va
->
p_surface
;
i
++
)
{
{
vlc_va_surface_t
*
p_surface
=
&
p_va
->
p_surface
[
i
];
vlc_va_surface_t
*
p_surface
=
&
p_va
->
p_surface
[
i
];
p_surface
->
i_state
=
FREE
;
if
(
p_surface
->
i_id
!=
VA_INVALID_SURFACE
)
if
(
p_surface
->
i_id
!=
VA_INVALID_SURFACE
)
vaDestroySurfaces
(
p_va
->
conn
->
p_display
,
&
p_surface
->
i_id
,
1
);
vaDestroySurfaces
(
p_va
->
conn
->
p_display
,
&
p_surface
->
i_id
,
1
);
}
}
...
@@ -224,8 +223,6 @@ static int CreateSurfaces( vlc_va_vaapi_t *p_va, void **pp_hw_ctx, vlc_fourcc_t
...
@@ -224,8 +223,6 @@ static int CreateSurfaces( vlc_va_vaapi_t *p_va, void **pp_hw_ctx, vlc_fourcc_t
p_surface
->
i_id
=
pi_surface_id
[
i
];
p_surface
->
i_id
=
pi_surface_id
[
i
];
p_surface
->
i_refcount
=
0
;
p_surface
->
i_refcount
=
0
;
p_surface
->
i_order
=
0
;
p_surface
->
i_order
=
0
;
p_surface
->
i_state
=
FREE
;
p_surface
->
i_cache
=
VA_INVALID_ID
;
}
}
/* Create a context */
/* Create a context */
...
@@ -416,11 +413,8 @@ static void Put(vlc_va_t *p_external, AVFrame *p_ff, picture_t *p_picture )
...
@@ -416,11 +413,8 @@ static void Put(vlc_va_t *p_external, AVFrame *p_ff, picture_t *p_picture )
if
(
!
p_picture
->
p_sys
)
if
(
!
p_picture
->
p_sys
)
abort
();
abort
();
assert
(
p_picture
->
p_sys
->
i_state
==
FREE
);
picture_sys_t
*
p_surface
=
p_picture
->
p_sys
;
picture_sys_t
*
p_surface
=
p_picture
->
p_sys
;
p_surface
->
i_state
=
DECODE
;
assert
(
p_surface
->
i_refcount
==
1
);
p_surface
->
i_order
=
p_va
->
i_surface_order
++
;
/* */
/* */
for
(
int
i
=
0
;
i
<
4
;
i
++
)
for
(
int
i
=
0
;
i
<
4
;
i
++
)
...
@@ -453,10 +447,6 @@ static int DisplayPicture( vlc_va_t *p_external, picture_t *p_picture )
...
@@ -453,10 +447,6 @@ static int DisplayPicture( vlc_va_t *p_external, picture_t *p_picture )
#endif
#endif
goto
error
;
goto
error
;
assert
(
p_picture
->
p_sys
->
i_state
==
DECODE
);
p_picture
->
p_sys
->
i_state
=
DISPLAY
;
p_va
->
conn
->
unlock
();
p_va
->
conn
->
unlock
();
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
...
@@ -478,28 +468,21 @@ static int Get( vlc_va_t *p_external, AVFrame *p_ff )
...
@@ -478,28 +468,21 @@ static int Get( vlc_va_t *p_external, AVFrame *p_ff )
{
{
vlc_va_surface_t
*
p_surface
=
&
p_va
->
p_surface
[
i
];
vlc_va_surface_t
*
p_surface
=
&
p_va
->
p_surface
[
i
];
if
(
p_surface
->
i_refcount
==
0
&&
if
(
p_surface
->
i_refcount
==
0
)
p_surface
->
i_state
==
FREE
)
break
;
break
;
if
(
p_surface
->
i_order
<
p_va
->
p_surface
[
i_old
].
i_order
)
if
(
p_surface
->
i_order
<
p_va
->
p_surface
[
i_old
].
i_order
)
i_old
=
i
;
i_old
=
i
;
}
}
if
(
i
>=
p_va
->
i_surface_count
)
if
(
i
>=
p_va
->
i_surface_count
)
{
vlc_va_surface_t
*
p_surface
=
&
p_va
->
p_surface
[
i
];
if
(
p_surface
->
i_state
!=
FREE
)
return
VLC_EGENERIC
;
i
=
i_old
;
i
=
i_old
;
}
vlc_va_surface_t
*
p_surface
=
&
p_va
->
p_surface
[
i
];
vlc_va_surface_t
*
p_surface
=
&
p_va
->
p_surface
[
i
];
assert
(
p_surface
->
i_state
==
FREE
);
/* NOTE: reset surface refcount otherwise they will be leaked and
/* NOTE: reset surface refcount otherwise they will be leaked and
* mayhem may happen down the road.
* mayhem may happen down the road.
*/
*/
p_surface
->
i_refcount
=
1
;
p_surface
->
i_refcount
=
1
;
p_surface
->
i_state
=
DECODE
;
p_surface
->
i_order
=
p_va
->
i_surface_order
++
;
p_surface
->
i_order
=
p_va
->
i_surface_order
++
;
/* */
/* */
...
@@ -528,13 +511,6 @@ static void Release( vlc_va_t *p_external, AVFrame *p_ff )
...
@@ -528,13 +511,6 @@ static void Release( vlc_va_t *p_external, AVFrame *p_ff )
{
{
if
(
p_surface
->
i_refcount
>
0
)
if
(
p_surface
->
i_refcount
>
0
)
p_surface
->
i_refcount
--
;
p_surface
->
i_refcount
--
;
if
(
p_surface
->
i_state
==
DECODE
)
{
assert
(
p_surface
->
i_refcount
==
0
);
p_surface
->
i_state
=
FREE
;
}
else
if
(
p_surface
->
i_state
==
DISPLAY
)
p_surface
->
i_refcount
=
1
;
}
}
}
}
}
}
...
...
modules/codec/avcodec/vaapi.h
View file @
df3cbd54
...
@@ -30,16 +30,11 @@ struct vlc_va_conn_t
...
@@ -30,16 +30,11 @@ struct vlc_va_conn_t
void
(
*
unlock
)(
void
);
void
(
*
unlock
)(
void
);
};
};
typedef
enum
{
FREE
=
0
,
DECODE
=
1
,
DISPLAY
=
2
}
vlc_va_state_t
;
typedef
struct
typedef
struct
{
{
VASurfaceID
i_id
;
VASurfaceID
i_id
;
int
i_refcount
;
int
i_refcount
;
unsigned
int
i_order
;
unsigned
int
i_order
;
vlc_va_state_t
i_state
;
/* subpicture */
unsigned
int
i_cache
;
}
vlc_va_surface_t
;
}
vlc_va_surface_t
;
struct
picture_sys_t
struct
picture_sys_t
...
@@ -49,9 +44,7 @@ struct picture_sys_t
...
@@ -49,9 +44,7 @@ struct picture_sys_t
/* Link surface with picture_sys_t permanently */
/* Link surface with picture_sys_t permanently */
VASurfaceID
i_id
;
VASurfaceID
i_id
;
int
i_refcount
;
/* no longer needed */
int
i_refcount
;
unsigned
int
i_order
;
/* no longer needed */
vlc_va_state_t
i_state
;
/* no longer needed */
/* subpicture */
/* subpicture */
unsigned
int
i_cache
;
unsigned
int
i_cache
;
...
...
modules/codec/avcodec/vaapi_x11.c
View file @
df3cbd54
...
@@ -1189,8 +1189,7 @@ static void DisplayPicture(vout_display_t *vd, picture_t *pic, subpicture_t *sub
...
@@ -1189,8 +1189,7 @@ static void DisplayPicture(vout_display_t *vd, picture_t *pic, subpicture_t *sub
picture_sys_t
*
surface
=
pic
->
p_sys
;
picture_sys_t
*
surface
=
pic
->
p_sys
;
if
(
surface
->
i_state
==
DISPLAY
)
DisplayVASurface
(
vd
,
surface
->
i_id
,
pic
);
DisplayVASurface
(
vd
,
surface
->
i_id
,
pic
);
/* Check if we still need this subpicture cache */
/* Check if we still need this subpicture cache */
if
(
subpicture
&&
if
(
subpicture
&&
...
@@ -1283,7 +1282,6 @@ static void PictureUnlock(picture_t *picture)
...
@@ -1283,7 +1282,6 @@ static void PictureUnlock(picture_t *picture)
//assert(surface->i_refcount == 0);
//assert(surface->i_refcount == 0);
surface
->
i_refcount
=
0
;
surface
->
i_refcount
=
0
;
surface
->
i_cache
=
VA_INVALID_ID
;
surface
->
i_cache
=
VA_INVALID_ID
;
surface
->
i_state
=
FREE
;
}
}
/**
/**
...
@@ -1317,9 +1315,7 @@ static picture_pool_t *Pool (vout_display_t *vd, unsigned requested_count)
...
@@ -1317,9 +1315,7 @@ static picture_pool_t *Pool (vout_display_t *vd, unsigned requested_count)
pic
->
format
.
i_chroma
=
VLC_CODEC_VAAPI_SURFACE
;
pic
->
format
.
i_chroma
=
VLC_CODEC_VAAPI_SURFACE
;
pic_sys
->
i_id
=
VA_INVALID_SURFACE
;
pic_sys
->
i_id
=
VA_INVALID_SURFACE
;
pic_sys
->
i_refcount
=
0
;
/* No longer needed ? */
pic_sys
->
i_refcount
=
0
;
pic_sys
->
i_order
=
0
;
/* No longer needed ? */
pic_sys
->
i_state
=
FREE
;
/* No longer needed ? */
pic_sys
->
i_cache
=
VA_INVALID_ID
;
pic_sys
->
i_cache
=
VA_INVALID_ID
;
pic_sys
->
obj
=
VLC_OBJECT
(
vd
);
pic_sys
->
obj
=
VLC_OBJECT
(
vd
);
...
...
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