annotate vdpau.c @ 12383:6a59d8a22c57 libavcodec

remove b4_stride/mb_stride. correct mb_xy to use mb_width. tighten allocations. reduce the number of zeroing.
author skal
date Wed, 11 Aug 2010 08:27:38 +0000
parents e603f624b03f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
11491
63837bcce840 Cosmetics: Fix a comment.
cehoyos
parents: 11333
diff changeset
3 * HW decode acceleration for MPEG-1/2, MPEG-4 ASP, H.264 and VC-1.
8522
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
92bd4156f0f1 Revert adding a _pixfmt to vdpau/xvmc header names.
diego
parents: 8808
diff changeset
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
6687083ec76a Remove H264Context from vdpau_internal.h.
cehoyos
parents: 8563
diff changeset
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
6687083ec76a Remove H264Context from vdpau_internal.h.
cehoyos
parents: 8563
diff changeset
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;
11554
30f5bf824f04 Fix VDPAU for H.264 streams with long reference frames.
cehoyos
parents: 11491
diff changeset
57 int ls = list ? 16 : h->short_ref_count;
8522
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
6ce9f5616a57 Rename bitstreamBuffers* as bitstream_buffers*
cehoyos
parents: 8532
diff changeset
118 render->bitstream_buffers= av_fast_realloc(
6ce9f5616a57 Rename bitstreamBuffers* as bitstream_buffers*
cehoyos
parents: 8532
diff changeset
119 render->bitstream_buffers,
6ce9f5616a57 Rename bitstreamBuffers* as bitstream_buffers*
cehoyos
parents: 8532
diff changeset
120 &render->bitstream_buffers_allocated,
6ce9f5616a57 Rename bitstreamBuffers* as bitstream_buffers*
cehoyos
parents: 8532
diff changeset
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
6ce9f5616a57 Rename bitstreamBuffers* as bitstream_buffers*
cehoyos
parents: 8532
diff changeset
124 render->bitstream_buffers[render->bitstream_buffers_used].struct_version = VDP_BITSTREAM_BUFFER_VERSION;
6ce9f5616a57 Rename bitstreamBuffers* as bitstream_buffers*
cehoyos
parents: 8532
diff changeset
125 render->bitstream_buffers[render->bitstream_buffers_used].bitstream = buf;
6ce9f5616a57 Rename bitstreamBuffers* as bitstream_buffers*
cehoyos
parents: 8532
diff changeset
126 render->bitstream_buffers[render->bitstream_buffers_used].bitstream_bytes = buf_size;
6ce9f5616a57 Rename bitstreamBuffers* as bitstream_buffers*
cehoyos
parents: 8532
diff changeset
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
11555
e603f624b03f Set VDPAU H264 picture parameter field_order_cnt and frame_num at the
cehoyos
parents: 11554
diff changeset
130 void ff_vdpau_h264_picture_start(MpegEncContext *s)
8522
f8c091bb5779 Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff changeset
131 {
8565
6687083ec76a Remove H264Context from vdpau_internal.h.
cehoyos
parents: 8563
diff changeset
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
9013
b54938038170 100l, always declare variables at the top of a block, not inside a for ()
reimar
parents: 8968
diff changeset
139 for (i = 0; i < 2; ++i) {
8522
f8c091bb5779 Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff changeset
140 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
141 if (foc == INT_MAX)
f8c091bb5779 Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff changeset
142 foc = 0;
f8c091bb5779 Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff changeset
143 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
144 }
f8c091bb5779 Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff changeset
145
11555
e603f624b03f Set VDPAU H264 picture parameter field_order_cnt and frame_num at the
cehoyos
parents: 11554
diff changeset
146 render->info.h264.frame_num = h->frame_num;
e603f624b03f Set VDPAU H264 picture parameter field_order_cnt and frame_num at the
cehoyos
parents: 11554
diff changeset
147 }
e603f624b03f Set VDPAU H264 picture parameter field_order_cnt and frame_num at the
cehoyos
parents: 11554
diff changeset
148
e603f624b03f Set VDPAU H264 picture parameter field_order_cnt and frame_num at the
cehoyos
parents: 11554
diff changeset
149 void ff_vdpau_h264_picture_complete(MpegEncContext *s)
e603f624b03f Set VDPAU H264 picture parameter field_order_cnt and frame_num at the
cehoyos
parents: 11554
diff changeset
150 {
e603f624b03f Set VDPAU H264 picture parameter field_order_cnt and frame_num at the
cehoyos
parents: 11554
diff changeset
151 H264Context *h = s->avctx->priv_data;
e603f624b03f Set VDPAU H264 picture parameter field_order_cnt and frame_num at the
cehoyos
parents: 11554
diff changeset
152 struct vdpau_render_state *render;
e603f624b03f Set VDPAU H264 picture parameter field_order_cnt and frame_num at the
cehoyos
parents: 11554
diff changeset
153
e603f624b03f Set VDPAU H264 picture parameter field_order_cnt and frame_num at the
cehoyos
parents: 11554
diff changeset
154 render = (struct vdpau_render_state *)s->current_picture_ptr->data[0];
e603f624b03f Set VDPAU H264 picture parameter field_order_cnt and frame_num at the
cehoyos
parents: 11554
diff changeset
155 assert(render);
e603f624b03f Set VDPAU H264 picture parameter field_order_cnt and frame_num at the
cehoyos
parents: 11554
diff changeset
156
e603f624b03f Set VDPAU H264 picture parameter field_order_cnt and frame_num at the
cehoyos
parents: 11554
diff changeset
157 render->info.h264.slice_count = h->slice_num;
e603f624b03f Set VDPAU H264 picture parameter field_order_cnt and frame_num at the
cehoyos
parents: 11554
diff changeset
158 if (render->info.h264.slice_count < 1)
e603f624b03f Set VDPAU H264 picture parameter field_order_cnt and frame_num at the
cehoyos
parents: 11554
diff changeset
159 return;
e603f624b03f Set VDPAU H264 picture parameter field_order_cnt and frame_num at the
cehoyos
parents: 11554
diff changeset
160
9049
16d0dfacd6c2 Do not set h264.is_reference for pictures that are delayed, but not
cehoyos
parents: 9048
diff changeset
161 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
162 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
163 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
164 render->info.h264.num_ref_frames = h->sps.ref_frame_count;
8959
07b5c9735954 Fix MBAFF/PAFF samples.
cehoyos
parents: 8919
diff changeset
165 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
166 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
167 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
168 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
169 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
170 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
171 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
172 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
173 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
174 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
175 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
176 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
177 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
178 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
179 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
180 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
181 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
182 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
183 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
184 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
185 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
186 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
187
f8c091bb5779 Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff changeset
188 ff_draw_horiz_band(s, 0, s->avctx->height);
8553
6ce9f5616a57 Rename bitstreamBuffers* as bitstream_buffers*
cehoyos
parents: 8532
diff changeset
189 render->bitstream_buffers_used = 0;
8522
f8c091bb5779 Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff changeset
190 }
f8c091bb5779 Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff changeset
191
8601
8b80f8285b1b Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents: 8565
diff changeset
192 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
193 int buf_size, int slice_count)
8b80f8285b1b Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents: 8565
diff changeset
194 {
8919
2dc78db4de26 Place spaces consistently in pointer types in vdpau.c
reimar
parents: 8829
diff changeset
195 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
196 int i;
8b80f8285b1b Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents: 8565
diff changeset
197
8968
b123ed268953 Instead of crashing, return from ff_vdpau_mpeg_picture_complete()
cehoyos
parents: 8959
diff changeset
198 if (!s->current_picture_ptr) return;
b123ed268953 Instead of crashing, return from ff_vdpau_mpeg_picture_complete()
cehoyos
parents: 8959
diff changeset
199
8919
2dc78db4de26 Place spaces consistently in pointer types in vdpau.c
reimar
parents: 8829
diff changeset
200 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
201 assert(render);
8b80f8285b1b Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents: 8565
diff changeset
202
8b80f8285b1b Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents: 8565
diff changeset
203 /* fill VdpPictureInfoMPEG1Or2 struct */
8b80f8285b1b Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents: 8565
diff changeset
204 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
205 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
206 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
207 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
208 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
209 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
210 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
211 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
212 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
213 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
214 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
215 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
216 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
217 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
218 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
219 for (i = 0; i < 64; ++i) {
8b80f8285b1b Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents: 8565
diff changeset
220 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
221 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
222 }
8b80f8285b1b Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents: 8565
diff changeset
223
8b80f8285b1b Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents: 8565
diff changeset
224 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
225 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
226
8b80f8285b1b Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents: 8565
diff changeset
227 switch(s->pict_type){
8b80f8285b1b Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents: 8565
diff changeset
228 case FF_B_TYPE:
8919
2dc78db4de26 Place spaces consistently in pointer types in vdpau.c
reimar
parents: 8829
diff changeset
229 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
230 assert(next);
8b80f8285b1b Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents: 8565
diff changeset
231 render->info.mpeg.backward_reference = next->surface;
8b80f8285b1b Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents: 8565
diff changeset
232 // 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
233 case FF_P_TYPE:
8919
2dc78db4de26 Place spaces consistently in pointer types in vdpau.c
reimar
parents: 8829
diff changeset
234 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
235 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
236 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
237 render->info.mpeg.forward_reference = last->surface;
8b80f8285b1b Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents: 8565
diff changeset
238 }
8b80f8285b1b Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents: 8565
diff changeset
239
8b80f8285b1b Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents: 8565
diff changeset
240 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
241
8b80f8285b1b Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents: 8565
diff changeset
242 render->info.mpeg.slice_count = slice_count;
8b80f8285b1b Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents: 8565
diff changeset
243
8b80f8285b1b Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents: 8565
diff changeset
244 if (slice_count)
8b80f8285b1b Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents: 8565
diff changeset
245 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
246 render->bitstream_buffers_used = 0;
8b80f8285b1b Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents: 8565
diff changeset
247 }
8b80f8285b1b Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which can
cehoyos
parents: 8565
diff changeset
248
8631
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
249 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
250 int buf_size)
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
251 {
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
252 VC1Context *v = s->avctx->priv_data;
8919
2dc78db4de26 Place spaces consistently in pointer types in vdpau.c
reimar
parents: 8829
diff changeset
253 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
254
8919
2dc78db4de26 Place spaces consistently in pointer types in vdpau.c
reimar
parents: 8829
diff changeset
255 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
256 assert(render);
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
257
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
258 /* fill LvPictureInfoVC1 struct */
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
259 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
260 render->info.vc1.postprocflag = v->postprocflag;
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
261 render->info.vc1.pulldown = v->broadcast;
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
262 render->info.vc1.interlace = v->interlace;
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
263 render->info.vc1.tfcntrflag = v->tfcntrflag;
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
264 render->info.vc1.finterpflag = v->finterpflag;
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
265 render->info.vc1.psf = v->psf;
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
266 render->info.vc1.dquant = v->dquant;
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
267 render->info.vc1.panscan_flag = v->panscanflag;
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
268 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
269 render->info.vc1.quantizer = v->quantizer_mode;
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
270 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
271 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
272 render->info.vc1.overlap = v->overlap;
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
273 render->info.vc1.vstransform = v->vstransform;
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
274 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
275 render->info.vc1.fastuvmc = v->fastuvmc;
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
276 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
277 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
278 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
279 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
280 /* Specific to simple/main profile only */
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
281 render->info.vc1.multires = v->multires;
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
282 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
283 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
284 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
285
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
286 render->info.vc1.deblockEnable = v->postprocflag & 1;
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
287 render->info.vc1.pquant = v->pq;
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
288
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
289 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
290 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
291
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
292 if (v->bi_type)
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
293 render->info.vc1.picture_type = 4;
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
294 else
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
295 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
296
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
297 switch(s->pict_type){
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
298 case FF_B_TYPE:
8919
2dc78db4de26 Place spaces consistently in pointer types in vdpau.c
reimar
parents: 8829
diff changeset
299 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
300 assert(next);
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
301 render->info.vc1.backward_reference = next->surface;
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
302 // 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
303 case FF_P_TYPE:
8919
2dc78db4de26 Place spaces consistently in pointer types in vdpau.c
reimar
parents: 8829
diff changeset
304 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
305 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
306 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
307 render->info.vc1.forward_reference = last->surface;
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
308 }
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
309
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
310 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
311
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
312 render->info.vc1.slice_count = 1;
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
313
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
314 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
315 render->bitstream_buffers_used = 0;
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
316 }
2d7269e13a8d Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
cehoyos
parents: 8629
diff changeset
317
10509
cdf5b1ed3500 Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents: 9148
diff changeset
318 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
319 int buf_size)
cdf5b1ed3500 Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents: 9148
diff changeset
320 {
cdf5b1ed3500 Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents: 9148
diff changeset
321 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
322 int i;
cdf5b1ed3500 Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents: 9148
diff changeset
323
cdf5b1ed3500 Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents: 9148
diff changeset
324 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
325
cdf5b1ed3500 Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents: 9148
diff changeset
326 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
327 assert(render);
cdf5b1ed3500 Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents: 9148
diff changeset
328
cdf5b1ed3500 Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents: 9148
diff changeset
329 /* fill VdpPictureInfoMPEG4Part2 struct */
11333
e7c30cba2c7b Support B-frames when decoding MPEG-4 with VDPAU hardware acceleration.
cehoyos
parents: 10509
diff changeset
330 render->info.mpeg4.trd[0] = s->pp_time;
e7c30cba2c7b Support B-frames when decoding MPEG-4 with VDPAU hardware acceleration.
cehoyos
parents: 10509
diff changeset
331 render->info.mpeg4.trb[0] = s->pb_time;
e7c30cba2c7b Support B-frames when decoding MPEG-4 with VDPAU hardware acceleration.
cehoyos
parents: 10509
diff changeset
332 render->info.mpeg4.trd[1] = s->pp_field_time >> 1;
e7c30cba2c7b Support B-frames when decoding MPEG-4 with VDPAU hardware acceleration.
cehoyos
parents: 10509
diff changeset
333 render->info.mpeg4.trb[1] = s->pb_field_time >> 1;
10509
cdf5b1ed3500 Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents: 9148
diff changeset
334 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
335 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
336 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
337 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
338 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
339 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
340 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
341 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
342 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
343 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
344 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
345 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
346 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
347 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
348 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
349 }
cdf5b1ed3500 Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents: 9148
diff changeset
350 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
351 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
352
cdf5b1ed3500 Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents: 9148
diff changeset
353 switch (s->pict_type) {
cdf5b1ed3500 Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents: 9148
diff changeset
354 case FF_B_TYPE:
cdf5b1ed3500 Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents: 9148
diff changeset
355 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
356 assert(next);
cdf5b1ed3500 Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents: 9148
diff changeset
357 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
358 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
359 // 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
360 case FF_P_TYPE:
cdf5b1ed3500 Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents: 9148
diff changeset
361 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
362 assert(last);
cdf5b1ed3500 Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents: 9148
diff changeset
363 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
364 }
cdf5b1ed3500 Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents: 9148
diff changeset
365
cdf5b1ed3500 Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents: 9148
diff changeset
366 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
367
cdf5b1ed3500 Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents: 9148
diff changeset
368 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
369 render->bitstream_buffers_used = 0;
cdf5b1ed3500 Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents: 9148
diff changeset
370 }
cdf5b1ed3500 Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
cehoyos
parents: 9148
diff changeset
371
8522
f8c091bb5779 Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff changeset
372 /* @}*/