Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
030b5a4f
Commit
030b5a4f
authored
Aug 16, 2015
by
Ronald S. Bultje
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavc: put remaining bits of vdpau-in-decoder under FF_API_CAP_VDPAU.
parent
7a629186
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
78 additions
and
17 deletions
+78
-17
error_resilience.c
libavcodec/error_resilience.c
+2
-0
h263dec.c
libavcodec/h263dec.c
+2
-0
h264.c
libavcodec/h264.c
+4
-0
h264_picture.c
libavcodec/h264_picture.c
+4
-0
h264_slice.c
libavcodec/h264_slice.c
+12
-4
mpeg12dec.c
libavcodec/mpeg12dec.c
+17
-3
mpegpicture.c
libavcodec/mpegpicture.c
+5
-1
mpegvideo.c
libavcodec/mpegvideo.c
+9
-2
utils.c
libavcodec/utils.c
+2
-0
vc1dec.c
libavcodec/vc1dec.c
+21
-7
No files found.
libavcodec/error_resilience.c
View file @
030b5a4f
...
...
@@ -777,7 +777,9 @@ void ff_er_frame_start(ERContext *s)
static
int
er_supported
(
ERContext
*
s
)
{
if
(
s
->
avctx
->
hwaccel
&&
s
->
avctx
->
hwaccel
->
decode_slice
||
#if FF_API_CAP_VDPAU
s
->
avctx
->
codec
->
capabilities
&
AV_CODEC_CAP_HWACCEL_VDPAU
||
#endif
!
s
->
cur_pic
.
f
||
s
->
cur_pic
.
field_picture
)
...
...
libavcodec/h263dec.c
View file @
030b5a4f
...
...
@@ -603,10 +603,12 @@ retry:
if
(
!
s
->
divx_packed
&&
!
avctx
->
hwaccel
)
ff_thread_finish_setup
(
avctx
);
#if FF_API_CAP_VDPAU
if
(
CONFIG_MPEG4_VDPAU_DECODER
&&
(
s
->
avctx
->
codec
->
capabilities
&
AV_CODEC_CAP_HWACCEL_VDPAU
))
{
ff_vdpau_mpeg4_decode_picture
(
avctx
->
priv_data
,
s
->
gb
.
buffer
,
s
->
gb
.
buffer_end
-
s
->
gb
.
buffer
);
goto
frame_end
;
}
#endif
if
(
avctx
->
hwaccel
)
{
ret
=
avctx
->
hwaccel
->
start_frame
(
avctx
,
s
->
gb
.
buffer
,
...
...
libavcodec/h264.c
View file @
030b5a4f
...
...
@@ -1561,9 +1561,11 @@ again:
if
(
h
->
avctx
->
hwaccel
&&
(
ret
=
h
->
avctx
->
hwaccel
->
start_frame
(
h
->
avctx
,
buf
,
buf_size
))
<
0
)
goto
end
;
#if FF_API_CAP_VDPAU
if
(
CONFIG_H264_VDPAU_DECODER
&&
h
->
avctx
->
codec
->
capabilities
&
AV_CODEC_CAP_HWACCEL_VDPAU
)
ff_vdpau_h264_picture_start
(
h
);
#endif
}
if
(
sl
->
redundant_pic_count
==
0
)
{
...
...
@@ -1573,6 +1575,7 @@ again:
consumed
);
if
(
ret
<
0
)
goto
end
;
#if FF_API_CAP_VDPAU
}
else
if
(
CONFIG_H264_VDPAU_DECODER
&&
h
->
avctx
->
codec
->
capabilities
&
AV_CODEC_CAP_HWACCEL_VDPAU
)
{
ff_vdpau_add_data_chunk
(
h
->
cur_pic_ptr
->
f
->
data
[
0
],
...
...
@@ -1581,6 +1584,7 @@ again:
ff_vdpau_add_data_chunk
(
h
->
cur_pic_ptr
->
f
->
data
[
0
],
&
buf
[
buf_index
-
consumed
],
consumed
);
#endif
}
else
context_count
++
;
}
...
...
libavcodec/h264_picture.c
View file @
030b5a4f
...
...
@@ -157,9 +157,11 @@ int ff_h264_field_end(H264Context *h, H264SliceContext *sl, int in_setup)
int
err
=
0
;
h
->
mb_y
=
0
;
#if FF_API_CAP_VDPAU
if
(
CONFIG_H264_VDPAU_DECODER
&&
h
->
avctx
->
codec
->
capabilities
&
AV_CODEC_CAP_HWACCEL_VDPAU
)
ff_vdpau_h264_set_reference_frames
(
h
);
#endif
if
(
in_setup
||
!
(
avctx
->
active_thread_type
&
FF_THREAD_FRAME
))
{
if
(
!
h
->
droppable
)
{
...
...
@@ -178,9 +180,11 @@ int ff_h264_field_end(H264Context *h, H264SliceContext *sl, int in_setup)
"hardware accelerator failed to decode picture
\n
"
);
}
#if FF_API_CAP_VDPAU
if
(
CONFIG_H264_VDPAU_DECODER
&&
h
->
avctx
->
codec
->
capabilities
&
AV_CODEC_CAP_HWACCEL_VDPAU
)
ff_vdpau_h264_picture_complete
(
h
);
#endif
#if CONFIG_ERROR_RESILIENCE
av_assert0
(
sl
==
h
->
slice_ctx
);
...
...
libavcodec/h264_slice.c
View file @
030b5a4f
...
...
@@ -612,8 +612,11 @@ static int h264_frame_start(H264Context *h)
if
((
ret
=
alloc_picture
(
h
,
pic
))
<
0
)
return
ret
;
if
(
!
h
->
frame_recovered
&&
!
h
->
avctx
->
hwaccel
&&
!
(
h
->
avctx
->
codec
->
capabilities
&
AV_CODEC_CAP_HWACCEL_VDPAU
))
if
(
!
h
->
frame_recovered
&&
!
h
->
avctx
->
hwaccel
#if FF_API_CAP_VDPAU
&&
!
(
h
->
avctx
->
codec
->
capabilities
&
AV_CODEC_CAP_HWACCEL_VDPAU
)
#endif
)
avpriv_color_frame
(
pic
->
f
,
c
);
h
->
cur_pic_ptr
=
pic
;
...
...
@@ -1048,6 +1051,7 @@ static int h264_slice_header_init(H264Context *h)
goto
fail
;
}
#if FF_API_CAP_VDPAU
if
(
h
->
avctx
->
codec
&&
h
->
avctx
->
codec
->
capabilities
&
AV_CODEC_CAP_HWACCEL_VDPAU
&&
(
h
->
sps
.
bit_depth_luma
!=
8
||
h
->
sps
.
chroma_format_idc
>
1
))
{
...
...
@@ -1056,6 +1060,7 @@ static int h264_slice_header_init(H264Context *h)
ret
=
AVERROR_INVALIDDATA
;
goto
fail
;
}
#endif
if
(
h
->
sps
.
bit_depth_luma
<
8
||
h
->
sps
.
bit_depth_luma
>
14
||
h
->
sps
.
bit_depth_luma
==
11
||
h
->
sps
.
bit_depth_luma
==
13
...
...
@@ -2533,8 +2538,11 @@ int ff_h264_execute_decode_slices(H264Context *h, unsigned context_count)
h
->
slice_ctx
[
0
].
next_slice_idx
=
INT_MAX
;
if
(
h
->
avctx
->
hwaccel
||
h
->
avctx
->
codec
->
capabilities
&
AV_CODEC_CAP_HWACCEL_VDPAU
)
if
(
h
->
avctx
->
hwaccel
#if FF_API_CAP_VDPAU
||
h
->
avctx
->
codec
->
capabilities
&
AV_CODEC_CAP_HWACCEL_VDPAU
#endif
)
return
0
;
if
(
context_count
==
1
)
{
int
ret
;
...
...
libavcodec/mpeg12dec.c
View file @
030b5a4f
...
...
@@ -1186,8 +1186,10 @@ static const enum AVPixelFormat mpeg1_hwaccel_pixfmt_list_420[] = {
#if CONFIG_MPEG1_XVMC_HWACCEL
AV_PIX_FMT_XVMC
,
#endif
#if CONFIG_MPEG1_VDPAU_
HWACCEL
#if CONFIG_MPEG1_VDPAU_
DECODER
AV_PIX_FMT_VDPAU_MPEG1
,
#endif
#if CONFIG_MPEG1_VDPAU_HWACCEL
AV_PIX_FMT_VDPAU
,
#endif
AV_PIX_FMT_YUV420P
,
...
...
@@ -1198,8 +1200,10 @@ static const enum AVPixelFormat mpeg2_hwaccel_pixfmt_list_420[] = {
#if CONFIG_MPEG2_XVMC_HWACCEL
AV_PIX_FMT_XVMC
,
#endif
#if CONFIG_MPEG
2_VDPAU_HWACCEL
#if CONFIG_MPEG
_VDPAU_DECODER
AV_PIX_FMT_VDPAU_MPEG2
,
#endif
#if CONFIG_MPEG2_VDPAU_HWACCEL
AV_PIX_FMT_VDPAU
,
#endif
#if CONFIG_MPEG2_DXVA2_HWACCEL
...
...
@@ -1228,9 +1232,11 @@ static const enum AVPixelFormat mpeg12_pixfmt_list_444[] = {
AV_PIX_FMT_NONE
};
#if FF_API_VDPAU
static
inline
int
uses_vdpau
(
AVCodecContext
*
avctx
)
{
return
avctx
->
pix_fmt
==
AV_PIX_FMT_VDPAU_MPEG1
||
avctx
->
pix_fmt
==
AV_PIX_FMT_VDPAU_MPEG2
;
}
#endif
static
enum
AVPixelFormat
mpeg_get_pixelformat
(
AVCodecContext
*
avctx
)
{
...
...
@@ -1256,7 +1262,11 @@ static enum AVPixelFormat mpeg_get_pixelformat(AVCodecContext *avctx)
static
void
setup_hwaccel_for_pixfmt
(
AVCodecContext
*
avctx
)
{
// until then pix_fmt may be changed right after codec init
if
(
avctx
->
hwaccel
||
uses_vdpau
(
avctx
))
if
(
avctx
->
hwaccel
#if FF_API_VDPAU
||
uses_vdpau
(
avctx
)
#endif
)
if
(
avctx
->
idct_algo
==
FF_IDCT_AUTO
)
avctx
->
idct_algo
=
FF_IDCT_SIMPLE
;
...
...
@@ -2460,9 +2470,11 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture,
s2
->
er
.
error_count
+=
s2
->
thread_context
[
i
]
->
er
.
error_count
;
}
#if FF_API_VDPAU
if
((
CONFIG_MPEG_VDPAU_DECODER
||
CONFIG_MPEG1_VDPAU_DECODER
)
&&
uses_vdpau
(
avctx
))
ff_vdpau_mpeg_picture_complete
(
s2
,
buf
,
buf_size
,
s
->
slice_count
);
#endif
ret
=
slice_end
(
avctx
,
picture
);
if
(
ret
<
0
)
...
...
@@ -2711,10 +2723,12 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture,
return
AVERROR_INVALIDDATA
;
}
#if FF_API_VDPAU
if
(
uses_vdpau
(
avctx
))
{
s
->
slice_count
++
;
break
;
}
#endif
if
(
HAVE_THREADS
&&
(
avctx
->
active_thread_type
&
FF_THREAD_SLICE
)
&&
...
...
libavcodec/mpegpicture.c
View file @
030b5a4f
...
...
@@ -58,7 +58,11 @@ int ff_mpeg_framesize_alloc(AVCodecContext *avctx, MotionEstContext *me,
{
int
alloc_size
=
FFALIGN
(
FFABS
(
linesize
)
+
64
,
32
);
if
(
avctx
->
hwaccel
||
avctx
->
codec
->
capabilities
&
AV_CODEC_CAP_HWACCEL_VDPAU
)
if
(
avctx
->
hwaccel
#if FF_API_CAP_VDPAU
||
avctx
->
codec
->
capabilities
&
AV_CODEC_CAP_HWACCEL_VDPAU
#endif
)
return
0
;
if
(
linesize
<
24
)
{
...
...
libavcodec/mpegvideo.c
View file @
030b5a4f
...
...
@@ -1307,7 +1307,11 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx)
return
-
1
;
}
if
(
!
avctx
->
hwaccel
&&
!
(
avctx
->
codec
->
capabilities
&
AV_CODEC_CAP_HWACCEL_VDPAU
))
{
if
(
!
avctx
->
hwaccel
#if FF_API_CAP_VDPAU
&&
!
(
avctx
->
codec
->
capabilities
&
AV_CODEC_CAP_HWACCEL_VDPAU
)
#endif
)
{
for
(
i
=
0
;
i
<
avctx
->
height
;
i
++
)
memset
(
s
->
last_picture_ptr
->
f
->
data
[
0
]
+
s
->
last_picture_ptr
->
f
->
linesize
[
0
]
*
i
,
0x80
,
avctx
->
width
);
...
...
@@ -1652,7 +1656,10 @@ void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, uint8_t *mbskip_
/* TODO: export all the following to make them accessible for users (and filters) */
if
(
avctx
->
hwaccel
||
!
mbtype_table
||
(
avctx
->
codec
->
capabilities
&
AV_CODEC_CAP_HWACCEL_VDPAU
))
#if FF_API_CAP_VDPAU
||
(
avctx
->
codec
->
capabilities
&
AV_CODEC_CAP_HWACCEL_VDPAU
)
#endif
)
return
;
...
...
libavcodec/utils.c
View file @
030b5a4f
...
...
@@ -1243,8 +1243,10 @@ int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
if
(
!
(
desc
->
flags
&
AV_PIX_FMT_FLAG_HWACCEL
))
break
;
#if FF_API_CAP_VDPAU
if
(
avctx
->
codec
->
capabilities
&
AV_CODEC_CAP_HWACCEL_VDPAU
)
break
;
#endif
if
(
!
setup_hwaccel
(
avctx
,
ret
,
desc
->
name
))
break
;
...
...
libavcodec/vc1dec.c
View file @
030b5a4f
...
...
@@ -647,12 +647,14 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
return
buf_size
;
}
#if FF_API_CAP_VDPAU
if
(
s
->
avctx
->
codec
->
capabilities
&
AV_CODEC_CAP_HWACCEL_VDPAU
)
{
if
(
v
->
profile
<
PROFILE_ADVANCED
)
avctx
->
pix_fmt
=
AV_PIX_FMT_VDPAU_WMV3
;
else
avctx
->
pix_fmt
=
AV_PIX_FMT_VDPAU_VC1
;
}
#endif
//for advanced profile we may need to parse and unescape data
if
(
avctx
->
codec_id
==
AV_CODEC_ID_VC1
||
avctx
->
codec_id
==
AV_CODEC_ID_VC1IMAGE
)
{
...
...
@@ -672,15 +674,21 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
if
(
size
<=
0
)
continue
;
switch
(
AV_RB32
(
start
))
{
case
VC1_CODE_FRAME
:
if
(
avctx
->
hwaccel
||
s
->
avctx
->
codec
->
capabilities
&
AV_CODEC_CAP_HWACCEL_VDPAU
)
if
(
avctx
->
hwaccel
#if FF_API_CAP_VDPAU
||
s
->
avctx
->
codec
->
capabilities
&
AV_CODEC_CAP_HWACCEL_VDPAU
#endif
)
buf_start
=
start
;
buf_size2
=
vc1_unescape_buffer
(
start
+
4
,
size
,
buf2
);
break
;
case
VC1_CODE_FIELD
:
{
int
buf_size3
;
if
(
avctx
->
hwaccel
||
s
->
avctx
->
codec
->
capabilities
&
AV_CODEC_CAP_HWACCEL_VDPAU
)
if
(
avctx
->
hwaccel
#if FF_API_CAP_VDPAU
||
s
->
avctx
->
codec
->
capabilities
&
AV_CODEC_CAP_HWACCEL_VDPAU
#endif
)
buf_start_second_field
=
start
;
tmp
=
av_realloc_array
(
slices
,
sizeof
(
*
slices
),
(
n_slices
+
1
));
if
(
!
tmp
)
{
...
...
@@ -742,8 +750,11 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
ret
=
AVERROR_INVALIDDATA
;
goto
err
;
}
else
{
// found field marker, unescape second field
if
(
avctx
->
hwaccel
||
s
->
avctx
->
codec
->
capabilities
&
AV_CODEC_CAP_HWACCEL_VDPAU
)
if
(
avctx
->
hwaccel
#if FF_API_CAP_VDPAU
||
s
->
avctx
->
codec
->
capabilities
&
AV_CODEC_CAP_HWACCEL_VDPAU
#endif
)
buf_start_second_field
=
divider
;
tmp
=
av_realloc_array
(
slices
,
sizeof
(
*
slices
),
(
n_slices
+
1
));
if
(
!
tmp
)
{
...
...
@@ -890,6 +901,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
s
->
me
.
qpel_put
=
s
->
qdsp
.
put_qpel_pixels_tab
;
s
->
me
.
qpel_avg
=
s
->
qdsp
.
avg_qpel_pixels_tab
;
#if FF_API_CAP_VDPAU
if
((
CONFIG_VC1_VDPAU_DECODER
)
&&
s
->
avctx
->
codec
->
capabilities
&
AV_CODEC_CAP_HWACCEL_VDPAU
)
{
if
(
v
->
field_mode
&&
buf_start_second_field
)
{
...
...
@@ -898,7 +910,9 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
}
else
{
ff_vdpau_vc1_decode_picture
(
s
,
buf_start
,
(
buf
+
buf_size
)
-
buf_start
);
}
}
else
if
(
avctx
->
hwaccel
)
{
}
else
#endif
if
(
avctx
->
hwaccel
)
{
if
(
v
->
field_mode
&&
buf_start_second_field
)
{
// decode first field
s
->
picture_structure
=
PICT_BOTTOM_FIELD
-
v
->
tff
;
...
...
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