Signed-off-by: Diego Biurrun <diego@biurrun.de>
Rémi Denis-Courmont authored on 2013/01/13 00:53:47... | ... |
@@ -1623,9 +1623,11 @@ vc1_dxva2_hwaccel_deps="dxva2api_h" |
1623 | 1623 |
vc1_dxva2_hwaccel_select="dxva2 vc1_decoder" |
1624 | 1624 |
vc1_vaapi_hwaccel_select="vaapi vc1_decoder" |
1625 | 1625 |
vc1_vdpau_decoder_select="vdpau vc1_decoder" |
1626 |
+vc1_vdpau_hwaccel_select="vdpau vc1_decoder" |
|
1626 | 1627 |
wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel" |
1627 | 1628 |
wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel" |
1628 | 1629 |
wmv3_vdpau_decoder_select="vc1_vdpau_decoder" |
1630 |
+wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel" |
|
1629 | 1631 |
|
1630 | 1632 |
# parsers |
1631 | 1633 |
h264_parser_select="error_resilience golomb h264dsp h264pred mpegvideo" |
... | ... |
@@ -383,6 +383,7 @@ OBJS-$(CONFIG_VC1_DECODER) += vc1dec.o vc1.o vc1data.o vc1dsp.o \ |
383 | 383 |
intrax8.o intrax8dsp.o |
384 | 384 |
OBJS-$(CONFIG_VC1_DXVA2_HWACCEL) += dxva2_vc1.o |
385 | 385 |
OBJS-$(CONFIG_VC1_VAAPI_HWACCEL) += vaapi_vc1.o |
386 |
+OBJS-$(CONFIG_VC1_VDPAU_HWACCEL) += vdpau_vc1.o |
|
386 | 387 |
OBJS-$(CONFIG_VCR1_DECODER) += vcr1.o |
387 | 388 |
OBJS-$(CONFIG_VCR1_ENCODER) += vcr1.o |
388 | 389 |
OBJS-$(CONFIG_VMDAUDIO_DECODER) += vmdav.o |
... | ... |
@@ -87,8 +87,10 @@ void avcodec_register_all(void) |
87 | 87 |
REGISTER_HWACCEL(MPEG4_VDPAU, mpeg4_vdpau); |
88 | 88 |
REGISTER_HWACCEL(VC1_DXVA2, vc1_dxva2); |
89 | 89 |
REGISTER_HWACCEL(VC1_VAAPI, vc1_vaapi); |
90 |
+ REGISTER_HWACCEL(VC1_VDPAU, vc1_vdpau); |
|
90 | 91 |
REGISTER_HWACCEL(WMV3_DXVA2, wmv3_dxva2); |
91 | 92 |
REGISTER_HWACCEL(WMV3_VAAPI, wmv3_vaapi); |
93 |
+ REGISTER_HWACCEL(WMV3_VDPAU, wmv3_vdpau); |
|
92 | 94 |
|
93 | 95 |
/* video codecs */ |
94 | 96 |
REGISTER_ENCODER(A64MULTI, a64multi); |
95 | 97 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,128 @@ |
0 |
+/* |
|
1 |
+ * VC-1 decode acceleration through VDPAU |
|
2 |
+ * |
|
3 |
+ * Copyright (c) 2008 NVIDIA |
|
4 |
+ * Copyright (c) 2013 Rémi Denis-Courmont |
|
5 |
+ * |
|
6 |
+ * This file is part of Libav. |
|
7 |
+ * |
|
8 |
+ * Libav is free software; you can redistribute it and/or |
|
9 |
+ * modify it under the terms of the GNU Lesser General Public |
|
10 |
+ * License as published by the Free Software Foundation; either |
|
11 |
+ * version 2.1 of the License, or (at your option) any later version. |
|
12 |
+ * |
|
13 |
+ * Libav is distributed in the hope that it will be useful, |
|
14 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
16 |
+ * Lesser General Public License for more details. |
|
17 |
+ * |
|
18 |
+ * You should have received a copy of the GNU Lesser General Public |
|
19 |
+ * License along with Libav; if not, write to the Free Software Foundation, |
|
20 |
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
21 |
+ */ |
|
22 |
+ |
|
23 |
+#include <vdpau/vdpau.h> |
|
24 |
+ |
|
25 |
+#include "avcodec.h" |
|
26 |
+#include "vc1.h" |
|
27 |
+#include "vdpau.h" |
|
28 |
+#include "vdpau_internal.h" |
|
29 |
+ |
|
30 |
+static int vdpau_vc1_start_frame(AVCodecContext *avctx, |
|
31 |
+ const uint8_t *buffer, uint32_t size) |
|
32 |
+{ |
|
33 |
+ VC1Context * const v = avctx->priv_data; |
|
34 |
+ AVVDPAUContext *hwctx = avctx->hwaccel_context; |
|
35 |
+ MpegEncContext * const s = &v->s; |
|
36 |
+ VdpPictureInfoVC1 *info = &hwctx->info.vc1; |
|
37 |
+ VdpVideoSurface ref; |
|
38 |
+ |
|
39 |
+ /* fill LvPictureInfoVC1 struct */ |
|
40 |
+ info->forward_reference = VDP_INVALID_HANDLE; |
|
41 |
+ info->backward_reference = VDP_INVALID_HANDLE; |
|
42 |
+ |
|
43 |
+ switch (s->pict_type) { |
|
44 |
+ case AV_PICTURE_TYPE_B: |
|
45 |
+ ref = ff_vdpau_get_surface_id(&s->next_picture); |
|
46 |
+ assert(ref != VDP_INVALID_HANDLE); |
|
47 |
+ info->backward_reference = ref; |
|
48 |
+ /* fall-through */ |
|
49 |
+ case AV_PICTURE_TYPE_P: |
|
50 |
+ ref = ff_vdpau_get_surface_id(&s->last_picture); |
|
51 |
+ assert(ref != VDP_INVALID_HANDLE); |
|
52 |
+ info->forward_reference = ref; |
|
53 |
+ } |
|
54 |
+ |
|
55 |
+ info->slice_count = 0; |
|
56 |
+ if (v->bi_type) |
|
57 |
+ info->picture_type = 4; |
|
58 |
+ else |
|
59 |
+ info->picture_type = s->pict_type - 1 + s->pict_type / 3; |
|
60 |
+ |
|
61 |
+ info->frame_coding_mode = v->fcm; |
|
62 |
+ info->postprocflag = v->postprocflag; |
|
63 |
+ info->pulldown = v->broadcast; |
|
64 |
+ info->interlace = v->interlace; |
|
65 |
+ info->tfcntrflag = v->tfcntrflag; |
|
66 |
+ info->finterpflag = v->finterpflag; |
|
67 |
+ info->psf = v->psf; |
|
68 |
+ info->dquant = v->dquant; |
|
69 |
+ info->panscan_flag = v->panscanflag; |
|
70 |
+ info->refdist_flag = v->refdist_flag; |
|
71 |
+ info->quantizer = v->quantizer_mode; |
|
72 |
+ info->extended_mv = v->extended_mv; |
|
73 |
+ info->extended_dmv = v->extended_dmv; |
|
74 |
+ info->overlap = v->overlap; |
|
75 |
+ info->vstransform = v->vstransform; |
|
76 |
+ info->loopfilter = v->s.loop_filter; |
|
77 |
+ info->fastuvmc = v->fastuvmc; |
|
78 |
+ info->range_mapy_flag = v->range_mapy_flag; |
|
79 |
+ info->range_mapy = v->range_mapy; |
|
80 |
+ info->range_mapuv_flag = v->range_mapuv_flag; |
|
81 |
+ info->range_mapuv = v->range_mapuv; |
|
82 |
+ /* Specific to simple/main profile only */ |
|
83 |
+ info->multires = v->multires; |
|
84 |
+ info->syncmarker = v->s.resync_marker; |
|
85 |
+ info->rangered = v->rangered | (v->rangeredfrm << 1); |
|
86 |
+ info->maxbframes = v->s.max_b_frames; |
|
87 |
+ info->deblockEnable = v->postprocflag & 1; |
|
88 |
+ info->pquant = v->pq; |
|
89 |
+ |
|
90 |
+ return ff_vdpau_common_start_frame(avctx, buffer, size); |
|
91 |
+} |
|
92 |
+ |
|
93 |
+static int vdpau_vc1_decode_slice(AVCodecContext *avctx, |
|
94 |
+ const uint8_t *buffer, uint32_t size) |
|
95 |
+{ |
|
96 |
+ AVVDPAUContext *hwctx = avctx->hwaccel_context; |
|
97 |
+ int val; |
|
98 |
+ |
|
99 |
+ val = ff_vdpau_add_buffer(avctx, buffer, size); |
|
100 |
+ if (val < 0) |
|
101 |
+ return val; |
|
102 |
+ |
|
103 |
+ hwctx->info.vc1.slice_count++; |
|
104 |
+ return 0; |
|
105 |
+} |
|
106 |
+ |
|
107 |
+#if CONFIG_WMV3_VDPAU_HWACCEL |
|
108 |
+AVHWAccel ff_wmv3_vdpau_hwaccel = { |
|
109 |
+ .name = "wm3_vdpau", |
|
110 |
+ .type = AVMEDIA_TYPE_VIDEO, |
|
111 |
+ .id = AV_CODEC_ID_WMV3, |
|
112 |
+ .pix_fmt = AV_PIX_FMT_VDPAU, |
|
113 |
+ .start_frame = vdpau_vc1_start_frame, |
|
114 |
+ .end_frame = ff_vdpau_common_end_frame, |
|
115 |
+ .decode_slice = vdpau_vc1_decode_slice, |
|
116 |
+}; |
|
117 |
+#endif |
|
118 |
+ |
|
119 |
+AVHWAccel ff_vc1_vdpau_hwaccel = { |
|
120 |
+ .name = "vc1_vdpau", |
|
121 |
+ .type = AVMEDIA_TYPE_VIDEO, |
|
122 |
+ .id = AV_CODEC_ID_VC1, |
|
123 |
+ .pix_fmt = AV_PIX_FMT_VDPAU, |
|
124 |
+ .start_frame = vdpau_vc1_start_frame, |
|
125 |
+ .end_frame = ff_vdpau_common_end_frame, |
|
126 |
+ .decode_slice = vdpau_vc1_decode_slice, |
|
127 |
+}; |