Mercurial > libavcodec.hg
annotate vdpau.c @ 10795:342c2dbe0f94 libavcodec
More doxy
author | michael |
---|---|
date | Thu, 07 Jan 2010 15:12:31 +0000 |
parents | cdf5b1ed3500 |
children | e7c30cba2c7b |
rev | line source |
---|---|
8522
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
1 /* |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
2 * Video Decode and Presentation API for UNIX (VDPAU) is used for |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
3 * HW decode acceleration for MPEG-1/2, H.264 and VC-1. |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
4 * |
8629
04423b2f6e0b
cosmetics: Remove pointless period after copyright statement non-sentences.
diego
parents:
8601
diff
changeset
|
5 * Copyright (c) 2008 NVIDIA |
8522
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
6 * |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
7 * This file is part of FFmpeg. |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
8 * |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
9 * FFmpeg is free software; you can redistribute it and/or |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
10 * modify it under the terms of the GNU Lesser General Public |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
11 * License as published by the Free Software Foundation; either |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
12 * version 2.1 of the License, or (at your option) any later version. |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
13 * |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
14 * FFmpeg is distributed in the hope that it will be useful, |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
17 * Lesser General Public License for more details. |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
18 * |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
19 * You should have received a copy of the GNU Lesser General Public |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
20 * License along with FFmpeg; if not, write to the Free Software |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
22 */ |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
23 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
24 #include <limits.h> |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
25 #include "avcodec.h" |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
26 #include "h264.h" |
8631
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
27 #include "vc1.h" |
8522
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
28 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
29 #undef NDEBUG |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
30 #include <assert.h> |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
31 |
8829 | 32 #include "vdpau.h" |
8522
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
33 #include "vdpau_internal.h" |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
34 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
35 /** |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
36 * \addtogroup VDPAU_Decoding |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
37 * |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
38 * @{ |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
39 */ |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
40 |
8565 | 41 void ff_vdpau_h264_set_reference_frames(MpegEncContext *s) |
8522
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
42 { |
8565 | 43 H264Context *h = s->avctx->priv_data; |
8919
2dc78db4de26
Place spaces consistently in pointer types in vdpau.c
reimar
parents:
8829
diff
changeset
|
44 struct vdpau_render_state *render, *render_ref; |
2dc78db4de26
Place spaces consistently in pointer types in vdpau.c
reimar
parents:
8829
diff
changeset
|
45 VdpReferenceFrameH264 *rf, *rf2; |
2dc78db4de26
Place spaces consistently in pointer types in vdpau.c
reimar
parents:
8829
diff
changeset
|
46 Picture *pic; |
8522
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
47 int i, list, pic_frame_idx; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
48 |
8919
2dc78db4de26
Place spaces consistently in pointer types in vdpau.c
reimar
parents:
8829
diff
changeset
|
49 render = (struct vdpau_render_state *)s->current_picture_ptr->data[0]; |
8522
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
50 assert(render); |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
51 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
52 rf = &render->info.h264.referenceFrames[0]; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
53 #define H264_RF_COUNT FF_ARRAY_ELEMS(render->info.h264.referenceFrames) |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
54 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
55 for (list = 0; list < 2; ++list) { |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
56 Picture **lp = list ? h->long_ref : h->short_ref; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
57 int ls = list ? h->long_ref_count : h->short_ref_count; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
58 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
59 for (i = 0; i < ls; ++i) { |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
60 pic = lp[i]; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
61 if (!pic || !pic->reference) |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
62 continue; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
63 pic_frame_idx = pic->long_ref ? pic->pic_id : pic->frame_num; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
64 |
8919
2dc78db4de26
Place spaces consistently in pointer types in vdpau.c
reimar
parents:
8829
diff
changeset
|
65 render_ref = (struct vdpau_render_state *)pic->data[0]; |
8522
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
66 assert(render_ref); |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
67 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
68 rf2 = &render->info.h264.referenceFrames[0]; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
69 while (rf2 != rf) { |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
70 if ( |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
71 (rf2->surface == render_ref->surface) |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
72 && (rf2->is_long_term == pic->long_ref) |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
73 && (rf2->frame_idx == pic_frame_idx) |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
74 ) |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
75 break; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
76 ++rf2; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
77 } |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
78 if (rf2 != rf) { |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
79 rf2->top_is_reference |= (pic->reference & PICT_TOP_FIELD) ? VDP_TRUE : VDP_FALSE; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
80 rf2->bottom_is_reference |= (pic->reference & PICT_BOTTOM_FIELD) ? VDP_TRUE : VDP_FALSE; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
81 continue; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
82 } |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
83 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
84 if (rf >= &render->info.h264.referenceFrames[H264_RF_COUNT]) |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
85 continue; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
86 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
87 rf->surface = render_ref->surface; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
88 rf->is_long_term = pic->long_ref; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
89 rf->top_is_reference = (pic->reference & PICT_TOP_FIELD) ? VDP_TRUE : VDP_FALSE; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
90 rf->bottom_is_reference = (pic->reference & PICT_BOTTOM_FIELD) ? VDP_TRUE : VDP_FALSE; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
91 rf->field_order_cnt[0] = pic->field_poc[0]; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
92 rf->field_order_cnt[1] = pic->field_poc[1]; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
93 rf->frame_idx = pic_frame_idx; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
94 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
95 ++rf; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
96 } |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
97 } |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
98 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
99 for (; rf < &render->info.h264.referenceFrames[H264_RF_COUNT]; ++rf) { |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
100 rf->surface = VDP_INVALID_HANDLE; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
101 rf->is_long_term = 0; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
102 rf->top_is_reference = 0; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
103 rf->bottom_is_reference = 0; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
104 rf->field_order_cnt[0] = 0; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
105 rf->field_order_cnt[1] = 0; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
106 rf->frame_idx = 0; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
107 } |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
108 } |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
109 |
8563
b59279494d84
Cosmetics: Rename ff_vdpau_h264_add_data_chunk as ff_vdpau_add_data_chunk.
cehoyos
parents:
8562
diff
changeset
|
110 void ff_vdpau_add_data_chunk(MpegEncContext *s, |
b59279494d84
Cosmetics: Rename ff_vdpau_h264_add_data_chunk as ff_vdpau_add_data_chunk.
cehoyos
parents:
8562
diff
changeset
|
111 const uint8_t *buf, int buf_size) |
8522
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
112 { |
8919
2dc78db4de26
Place spaces consistently in pointer types in vdpau.c
reimar
parents:
8829
diff
changeset
|
113 struct vdpau_render_state *render; |
8522
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
114 |
8919
2dc78db4de26
Place spaces consistently in pointer types in vdpau.c
reimar
parents:
8829
diff
changeset
|
115 render = (struct vdpau_render_state *)s->current_picture_ptr->data[0]; |
8522
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
116 assert(render); |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
117 |
8553 | 118 render->bitstream_buffers= av_fast_realloc( |
119 render->bitstream_buffers, | |
120 &render->bitstream_buffers_allocated, | |
121 sizeof(*render->bitstream_buffers)*(render->bitstream_buffers_used + 1) | |
8522
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
122 ); |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
123 |
8553 | 124 render->bitstream_buffers[render->bitstream_buffers_used].struct_version = VDP_BITSTREAM_BUFFER_VERSION; |
125 render->bitstream_buffers[render->bitstream_buffers_used].bitstream = buf; | |
126 render->bitstream_buffers[render->bitstream_buffers_used].bitstream_bytes = buf_size; | |
127 render->bitstream_buffers_used++; | |
8522
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
128 } |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
129 |
8565 | 130 void ff_vdpau_h264_picture_complete(MpegEncContext *s) |
8522
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
131 { |
8565 | 132 H264Context *h = s->avctx->priv_data; |
8919
2dc78db4de26
Place spaces consistently in pointer types in vdpau.c
reimar
parents:
8829
diff
changeset
|
133 struct vdpau_render_state *render; |
9013
b54938038170
100l, always declare variables at the top of a block, not inside a for ()
reimar
parents:
8968
diff
changeset
|
134 int i; |
8522
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
135 |
8919
2dc78db4de26
Place spaces consistently in pointer types in vdpau.c
reimar
parents:
8829
diff
changeset
|
136 render = (struct vdpau_render_state *)s->current_picture_ptr->data[0]; |
8522
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
137 assert(render); |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
138 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
139 render->info.h264.slice_count = h->slice_num; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
140 if (render->info.h264.slice_count < 1) |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
141 return; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
142 |
9013
b54938038170
100l, always declare variables at the top of a block, not inside a for ()
reimar
parents:
8968
diff
changeset
|
143 for (i = 0; i < 2; ++i) { |
8522
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
144 int foc = s->current_picture_ptr->field_poc[i]; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
145 if (foc == INT_MAX) |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
146 foc = 0; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
147 render->info.h264.field_order_cnt[i] = foc; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
148 } |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
149 |
9049
16d0dfacd6c2
Do not set h264.is_reference for pictures that are delayed, but not
cehoyos
parents:
9048
diff
changeset
|
150 render->info.h264.is_reference = (s->current_picture_ptr->reference & 3) ? VDP_TRUE : VDP_FALSE; |
8522
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
151 render->info.h264.frame_num = h->frame_num; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
152 render->info.h264.field_pic_flag = s->picture_structure != PICT_FRAME; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
153 render->info.h264.bottom_field_flag = s->picture_structure == PICT_BOTTOM_FIELD; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
154 render->info.h264.num_ref_frames = h->sps.ref_frame_count; |
8959 | 155 render->info.h264.mb_adaptive_frame_field_flag = h->sps.mb_aff && !render->info.h264.field_pic_flag; |
8522
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
156 render->info.h264.constrained_intra_pred_flag = h->pps.constrained_intra_pred; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
157 render->info.h264.weighted_pred_flag = h->pps.weighted_pred; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
158 render->info.h264.weighted_bipred_idc = h->pps.weighted_bipred_idc; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
159 render->info.h264.frame_mbs_only_flag = h->sps.frame_mbs_only_flag; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
160 render->info.h264.transform_8x8_mode_flag = h->pps.transform_8x8_mode; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
161 render->info.h264.chroma_qp_index_offset = h->pps.chroma_qp_index_offset[0]; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
162 render->info.h264.second_chroma_qp_index_offset = h->pps.chroma_qp_index_offset[1]; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
163 render->info.h264.pic_init_qp_minus26 = h->pps.init_qp - 26; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
164 render->info.h264.num_ref_idx_l0_active_minus1 = h->pps.ref_count[0] - 1; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
165 render->info.h264.num_ref_idx_l1_active_minus1 = h->pps.ref_count[1] - 1; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
166 render->info.h264.log2_max_frame_num_minus4 = h->sps.log2_max_frame_num - 4; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
167 render->info.h264.pic_order_cnt_type = h->sps.poc_type; |
9148
8216b935aa9d
Fix H.264 bitstream field log2_max_pic_order_cnt_lsb_minus4
cehoyos
parents:
9049
diff
changeset
|
168 render->info.h264.log2_max_pic_order_cnt_lsb_minus4 = h->sps.poc_type ? 0 : h->sps.log2_max_poc_lsb - 4; |
8522
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
169 render->info.h264.delta_pic_order_always_zero_flag = h->sps.delta_pic_order_always_zero_flag; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
170 render->info.h264.direct_8x8_inference_flag = h->sps.direct_8x8_inference_flag; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
171 render->info.h264.entropy_coding_mode_flag = h->pps.cabac; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
172 render->info.h264.pic_order_present_flag = h->pps.pic_order_present; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
173 render->info.h264.deblocking_filter_control_present_flag = h->pps.deblocking_filter_parameters_present; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
174 render->info.h264.redundant_pic_cnt_present_flag = h->pps.redundant_pic_cnt_present; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
175 memcpy(render->info.h264.scaling_lists_4x4, h->pps.scaling_matrix4, sizeof(render->info.h264.scaling_lists_4x4)); |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
176 memcpy(render->info.h264.scaling_lists_8x8, h->pps.scaling_matrix8, sizeof(render->info.h264.scaling_lists_8x8)); |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
177 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
178 ff_draw_horiz_band(s, 0, s->avctx->height); |
8553 | 179 render->bitstream_buffers_used = 0; |
8522
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
180 } |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
181 |
8601
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
182 void ff_vdpau_mpeg_picture_complete(MpegEncContext *s, const uint8_t *buf, |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
183 int buf_size, int slice_count) |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
184 { |
8919
2dc78db4de26
Place spaces consistently in pointer types in vdpau.c
reimar
parents:
8829
diff
changeset
|
185 struct vdpau_render_state *render, *last, *next; |
8601
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
186 int i; |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
187 |
8968
b123ed268953
Instead of crashing, return from ff_vdpau_mpeg_picture_complete()
cehoyos
parents:
8959
diff
changeset
|
188 if (!s->current_picture_ptr) return; |
b123ed268953
Instead of crashing, return from ff_vdpau_mpeg_picture_complete()
cehoyos
parents:
8959
diff
changeset
|
189 |
8919
2dc78db4de26
Place spaces consistently in pointer types in vdpau.c
reimar
parents:
8829
diff
changeset
|
190 render = (struct vdpau_render_state *)s->current_picture_ptr->data[0]; |
8601
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
191 assert(render); |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
192 |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
193 /* fill VdpPictureInfoMPEG1Or2 struct */ |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
194 render->info.mpeg.picture_structure = s->picture_structure; |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
195 render->info.mpeg.picture_coding_type = s->pict_type; |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
196 render->info.mpeg.intra_dc_precision = s->intra_dc_precision; |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
197 render->info.mpeg.frame_pred_frame_dct = s->frame_pred_frame_dct; |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
198 render->info.mpeg.concealment_motion_vectors = s->concealment_motion_vectors; |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
199 render->info.mpeg.intra_vlc_format = s->intra_vlc_format; |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
200 render->info.mpeg.alternate_scan = s->alternate_scan; |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
201 render->info.mpeg.q_scale_type = s->q_scale_type; |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
202 render->info.mpeg.top_field_first = s->top_field_first; |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
203 render->info.mpeg.full_pel_forward_vector = s->full_pel[0]; // MPEG-1 only. Set 0 for MPEG-2 |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
204 render->info.mpeg.full_pel_backward_vector = s->full_pel[1]; // MPEG-1 only. Set 0 for MPEG-2 |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
205 render->info.mpeg.f_code[0][0] = s->mpeg_f_code[0][0]; // For MPEG-1 fill both horiz. & vert. |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
206 render->info.mpeg.f_code[0][1] = s->mpeg_f_code[0][1]; |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
207 render->info.mpeg.f_code[1][0] = s->mpeg_f_code[1][0]; |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
208 render->info.mpeg.f_code[1][1] = s->mpeg_f_code[1][1]; |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
209 for (i = 0; i < 64; ++i) { |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
210 render->info.mpeg.intra_quantizer_matrix[i] = s->intra_matrix[i]; |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
211 render->info.mpeg.non_intra_quantizer_matrix[i] = s->inter_matrix[i]; |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
212 } |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
213 |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
214 render->info.mpeg.forward_reference = VDP_INVALID_HANDLE; |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
215 render->info.mpeg.backward_reference = VDP_INVALID_HANDLE; |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
216 |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
217 switch(s->pict_type){ |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
218 case FF_B_TYPE: |
8919
2dc78db4de26
Place spaces consistently in pointer types in vdpau.c
reimar
parents:
8829
diff
changeset
|
219 next = (struct vdpau_render_state *)s->next_picture.data[0]; |
8601
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
220 assert(next); |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
221 render->info.mpeg.backward_reference = next->surface; |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
222 // no return here, going to set forward prediction |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
223 case FF_P_TYPE: |
8919
2dc78db4de26
Place spaces consistently in pointer types in vdpau.c
reimar
parents:
8829
diff
changeset
|
224 last = (struct vdpau_render_state *)s->last_picture.data[0]; |
8601
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
225 if (!last) // FIXME: Does this test make sense? |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
226 last = render; // predict second field from the first |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
227 render->info.mpeg.forward_reference = last->surface; |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
228 } |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
229 |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
230 ff_vdpau_add_data_chunk(s, buf, buf_size); |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
231 |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
232 render->info.mpeg.slice_count = slice_count; |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
233 |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
234 if (slice_count) |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
235 ff_draw_horiz_band(s, 0, s->avctx->height); |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
236 render->bitstream_buffers_used = 0; |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
237 } |
8b80f8285b1b
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents:
8565
diff
changeset
|
238 |
8631
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
239 void ff_vdpau_vc1_decode_picture(MpegEncContext *s, const uint8_t *buf, |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
240 int buf_size) |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
241 { |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
242 VC1Context *v = s->avctx->priv_data; |
8919
2dc78db4de26
Place spaces consistently in pointer types in vdpau.c
reimar
parents:
8829
diff
changeset
|
243 struct vdpau_render_state *render, *last, *next; |
8631
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
244 |
8919
2dc78db4de26
Place spaces consistently in pointer types in vdpau.c
reimar
parents:
8829
diff
changeset
|
245 render = (struct vdpau_render_state *)s->current_picture.data[0]; |
8631
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
246 assert(render); |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
247 |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
248 /* fill LvPictureInfoVC1 struct */ |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
249 render->info.vc1.frame_coding_mode = v->fcm; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
250 render->info.vc1.postprocflag = v->postprocflag; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
251 render->info.vc1.pulldown = v->broadcast; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
252 render->info.vc1.interlace = v->interlace; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
253 render->info.vc1.tfcntrflag = v->tfcntrflag; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
254 render->info.vc1.finterpflag = v->finterpflag; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
255 render->info.vc1.psf = v->psf; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
256 render->info.vc1.dquant = v->dquant; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
257 render->info.vc1.panscan_flag = v->panscanflag; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
258 render->info.vc1.refdist_flag = v->refdist_flag; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
259 render->info.vc1.quantizer = v->quantizer_mode; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
260 render->info.vc1.extended_mv = v->extended_mv; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
261 render->info.vc1.extended_dmv = v->extended_dmv; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
262 render->info.vc1.overlap = v->overlap; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
263 render->info.vc1.vstransform = v->vstransform; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
264 render->info.vc1.loopfilter = v->s.loop_filter; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
265 render->info.vc1.fastuvmc = v->fastuvmc; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
266 render->info.vc1.range_mapy_flag = v->range_mapy_flag; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
267 render->info.vc1.range_mapy = v->range_mapy; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
268 render->info.vc1.range_mapuv_flag = v->range_mapuv_flag; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
269 render->info.vc1.range_mapuv = v->range_mapuv; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
270 /* Specific to simple/main profile only */ |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
271 render->info.vc1.multires = v->multires; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
272 render->info.vc1.syncmarker = v->s.resync_marker; |
9048
058e47a00893
The field rangered in VDPAU's VdpPictureInfoVC1 now also contains
cehoyos
parents:
9013
diff
changeset
|
273 render->info.vc1.rangered = v->rangered | (v->rangeredfrm << 1); |
8631
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
274 render->info.vc1.maxbframes = v->s.max_b_frames; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
275 |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
276 render->info.vc1.deblockEnable = v->postprocflag & 1; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
277 render->info.vc1.pquant = v->pq; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
278 |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
279 render->info.vc1.forward_reference = VDP_INVALID_HANDLE; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
280 render->info.vc1.backward_reference = VDP_INVALID_HANDLE; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
281 |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
282 if (v->bi_type) |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
283 render->info.vc1.picture_type = 4; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
284 else |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
285 render->info.vc1.picture_type = s->pict_type - 1 + s->pict_type / 3; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
286 |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
287 switch(s->pict_type){ |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
288 case FF_B_TYPE: |
8919
2dc78db4de26
Place spaces consistently in pointer types in vdpau.c
reimar
parents:
8829
diff
changeset
|
289 next = (struct vdpau_render_state *)s->next_picture.data[0]; |
8631
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
290 assert(next); |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
291 render->info.vc1.backward_reference = next->surface; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
292 // no break here, going to set forward prediction |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
293 case FF_P_TYPE: |
8919
2dc78db4de26
Place spaces consistently in pointer types in vdpau.c
reimar
parents:
8829
diff
changeset
|
294 last = (struct vdpau_render_state *)s->last_picture.data[0]; |
8631
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
295 if (!last) // FIXME: Does this test make sense? |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
296 last = render; // predict second field from the first |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
297 render->info.vc1.forward_reference = last->surface; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
298 } |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
299 |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
300 ff_vdpau_add_data_chunk(s, buf, buf_size); |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
301 |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
302 render->info.vc1.slice_count = 1; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
303 |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
304 ff_draw_horiz_band(s, 0, s->avctx->height); |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
305 render->bitstream_buffers_used = 0; |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
306 } |
2d7269e13a8d
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents:
8629
diff
changeset
|
307 |
10509
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
308 void ff_vdpau_mpeg4_decode_picture(MpegEncContext *s, const uint8_t *buf, |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
309 int buf_size) |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
310 { |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
311 struct vdpau_render_state *render, *last, *next; |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
312 int i; |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
313 |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
314 if (!s->current_picture_ptr) return; |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
315 |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
316 render = (struct vdpau_render_state *)s->current_picture_ptr->data[0]; |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
317 assert(render); |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
318 |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
319 /* fill VdpPictureInfoMPEG4Part2 struct */ |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
320 render->info.mpeg4.vop_time_increment_resolution = s->avctx->time_base.den; |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
321 render->info.mpeg4.vop_coding_type = 0; |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
322 render->info.mpeg4.vop_fcode_forward = s->f_code; |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
323 render->info.mpeg4.vop_fcode_backward = s->b_code; |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
324 render->info.mpeg4.resync_marker_disable = !s->resync_marker; |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
325 render->info.mpeg4.interlaced = !s->progressive_sequence; |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
326 render->info.mpeg4.quant_type = s->mpeg_quant; |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
327 render->info.mpeg4.quarter_sample = s->quarter_sample; |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
328 render->info.mpeg4.short_video_header = s->avctx->codec->id == CODEC_ID_H263; |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
329 render->info.mpeg4.rounding_control = s->no_rounding; |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
330 render->info.mpeg4.alternate_vertical_scan_flag = s->alternate_scan; |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
331 render->info.mpeg4.top_field_first = s->top_field_first; |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
332 for (i = 0; i < 64; ++i) { |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
333 render->info.mpeg4.intra_quantizer_matrix[i] = s->intra_matrix[i]; |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
334 render->info.mpeg4.non_intra_quantizer_matrix[i] = s->inter_matrix[i]; |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
335 } |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
336 render->info.mpeg4.forward_reference = VDP_INVALID_HANDLE; |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
337 render->info.mpeg4.backward_reference = VDP_INVALID_HANDLE; |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
338 |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
339 switch (s->pict_type) { |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
340 case FF_B_TYPE: |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
341 next = (struct vdpau_render_state *)s->next_picture.data[0]; |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
342 assert(next); |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
343 render->info.mpeg4.backward_reference = next->surface; |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
344 render->info.mpeg4.vop_coding_type = 2; |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
345 // no break here, going to set forward prediction |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
346 case FF_P_TYPE: |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
347 last = (struct vdpau_render_state *)s->last_picture.data[0]; |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
348 assert(last); |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
349 render->info.mpeg4.forward_reference = last->surface; |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
350 } |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
351 |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
352 ff_vdpau_add_data_chunk(s, buf, buf_size); |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
353 |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
354 ff_draw_horiz_band(s, 0, s->avctx->height); |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
355 render->bitstream_buffers_used = 0; |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
356 } |
cdf5b1ed3500
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents:
9148
diff
changeset
|
357 |
8522
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
358 /* @}*/ |