[FFmpeg-cvslog] lavc: put remaining bits of vdpau-in-decoder under FF_API_CAP_VDPAU.
Ronald S. Bultje
git at videolan.org
Tue Aug 18 22:06:05 CEST 2015
ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Sun Aug 16 19:35:59 2015 -0400| [030b5a4f777b59066f1766030db082a53682994d] | committer: Ronald S. Bultje
lavc: put remaining bits of vdpau-in-decoder under FF_API_CAP_VDPAU.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=030b5a4f777b59066f1766030db082a53682994d
---
libavcodec/error_resilience.c | 2 ++
libavcodec/h263dec.c | 2 ++
libavcodec/h264.c | 4 ++++
libavcodec/h264_picture.c | 4 ++++
libavcodec/h264_slice.c | 16 ++++++++++++----
libavcodec/mpeg12dec.c | 20 +++++++++++++++++---
libavcodec/mpegpicture.c | 6 +++++-
libavcodec/mpegvideo.c | 11 +++++++++--
libavcodec/utils.c | 2 ++
libavcodec/vc1dec.c | 28 +++++++++++++++++++++-------
10 files changed, 78 insertions(+), 17 deletions(-)
diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c
index b3b46d1..2c741a4 100644
--- a/libavcodec/error_resilience.c
+++ b/libavcodec/error_resilience.c
@@ -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
)
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 7fa7090..8f28a94 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -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,
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index d55231c..1b29c8c 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -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++;
}
diff --git a/libavcodec/h264_picture.c b/libavcodec/h264_picture.c
index 04bbf02..731d780 100644
--- a/libavcodec/h264_picture.c
+++ b/libavcodec/h264_picture.c
@@ -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);
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 48f501b..e330489 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -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;
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index c7a5701..bd8ccfd 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -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_MPEG2_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) &&
diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c
index 49cd6f0..bb822b6 100644
--- a/libavcodec/mpegpicture.c
+++ b/libavcodec/mpegpicture.c
@@ -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) {
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 991c0fd..f28f7e8 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -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;
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 22dcc82..4da16ee 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -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;
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index abaa0b4..7b96ede 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -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;
More information about the ffmpeg-cvslog
mailing list