Mercurial > libavcodec.hg
annotate vdpauvideo.c @ 8538:35f1b87d908f libavcodec
Factorise setting of avctx->pix_fmt.
author | cehoyos |
---|---|
date | Tue, 06 Jan 2009 15:16:33 +0000 |
parents | 598a77fbc614 |
children | 6ce9f5616a57 |
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 * |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
5 * Copyright (c) 2008 NVIDIA. |
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" |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
27 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
28 #undef NDEBUG |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
29 #include <assert.h> |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
30 |
8532 | 31 #include "vdpau.h" |
8522
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
32 #include "vdpau_internal.h" |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
33 |
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 * \addtogroup VDPAU_Decoding |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
36 * |
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 static void VDPAU_h264_set_reference_frames(H264Context *h) |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
41 { |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
42 MpegEncContext * s = &h->s; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
43 struct vdpau_render_state * render, * render_ref; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
44 VdpReferenceFrameH264 * rf, * rf2; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
45 Picture * pic; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
46 int i, list, pic_frame_idx; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
47 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
48 render = (struct vdpau_render_state*)s->current_picture_ptr->data[0]; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
49 assert(render); |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
50 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
51 rf = &render->info.h264.referenceFrames[0]; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
52 #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
|
53 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
54 for (list = 0; list < 2; ++list) { |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
55 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
|
56 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
|
57 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
58 for (i = 0; i < ls; ++i) { |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
59 pic = lp[i]; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
60 if (!pic || !pic->reference) |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
61 continue; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
62 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
|
63 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
64 render_ref = (struct vdpau_render_state*)pic->data[0]; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
65 assert(render_ref); |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
66 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
67 rf2 = &render->info.h264.referenceFrames[0]; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
68 while (rf2 != rf) { |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
69 if ( |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
70 (rf2->surface == render_ref->surface) |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
71 && (rf2->is_long_term == pic->long_ref) |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
72 && (rf2->frame_idx == pic_frame_idx) |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
73 ) |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
74 break; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
75 ++rf2; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
76 } |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
77 if (rf2 != rf) { |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
78 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
|
79 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
|
80 continue; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
81 } |
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 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
|
84 continue; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
85 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
86 rf->surface = render_ref->surface; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
87 rf->is_long_term = pic->long_ref; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
88 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
|
89 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
|
90 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
|
91 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
|
92 rf->frame_idx = pic_frame_idx; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
93 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
94 ++rf; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
95 } |
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 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
|
99 rf->surface = VDP_INVALID_HANDLE; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
100 rf->is_long_term = 0; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
101 rf->top_is_reference = 0; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
102 rf->bottom_is_reference = 0; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
103 rf->field_order_cnt[0] = 0; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
104 rf->field_order_cnt[1] = 0; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
105 rf->frame_idx = 0; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
106 } |
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 void ff_VDPAU_h264_add_data_chunk(H264Context *h, const uint8_t *buf, int buf_size) |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
110 { |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
111 MpegEncContext * s = &h->s; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
112 struct vdpau_render_state * render; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
113 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
114 render = (struct vdpau_render_state*)s->current_picture_ptr->data[0]; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
115 assert(render); |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
116 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
117 if (!render->bitstreamBuffersUsed) |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
118 VDPAU_h264_set_reference_frames(h); |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
119 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
120 render->bitstreamBuffers= av_fast_realloc( |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
121 render->bitstreamBuffers, |
8529
1cb8c8e14a0a
Ministry of English Composition treatment: s/Alloced/Allocated
cehoyos
parents:
8522
diff
changeset
|
122 &render->bitstreamBuffersAllocated, |
8522
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
123 sizeof(*render->bitstreamBuffers)*(render->bitstreamBuffersUsed + 1) |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
124 ); |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
125 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
126 render->bitstreamBuffers[render->bitstreamBuffersUsed].struct_version = VDP_BITSTREAM_BUFFER_VERSION; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
127 render->bitstreamBuffers[render->bitstreamBuffersUsed].bitstream = buf; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
128 render->bitstreamBuffers[render->bitstreamBuffersUsed].bitstream_bytes = buf_size; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
129 render->bitstreamBuffersUsed++; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
130 } |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
131 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
132 void ff_VDPAU_h264_picture_complete(H264Context *h) |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
133 { |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
134 MpegEncContext * s = &h->s; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
135 struct vdpau_render_state * render; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
136 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
137 render = (struct vdpau_render_state*)s->current_picture_ptr->data[0]; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
138 assert(render); |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
139 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
140 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
|
141 if (render->info.h264.slice_count < 1) |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
142 return; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
143 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
144 for (int i = 0; i < 2; ++i) { |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
145 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
|
146 if (foc == INT_MAX) |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
147 foc = 0; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
148 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
|
149 } |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
150 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
151 render->info.h264.is_reference = s->current_picture_ptr->reference ? VDP_TRUE : VDP_FALSE; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
152 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
|
153 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
|
154 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
|
155 render->info.h264.num_ref_frames = h->sps.ref_frame_count; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
156 render->info.h264.mb_adaptive_frame_field_flag = h->sps.mb_aff; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
157 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
|
158 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
|
159 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
|
160 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
|
161 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
|
162 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
|
163 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
|
164 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
|
165 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
|
166 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
|
167 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
|
168 render->info.h264.pic_order_cnt_type = h->sps.poc_type; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
169 render->info.h264.log2_max_pic_order_cnt_lsb_minus4 = h->sps.log2_max_poc_lsb - 4; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
170 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
|
171 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
|
172 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
|
173 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
|
174 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
|
175 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
|
176 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
|
177 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
|
178 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
179 ff_draw_horiz_band(s, 0, s->avctx->height); |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
180 render->bitstreamBuffersUsed = 0; |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
181 } |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
182 |
f8c091bb5779
Add VDPAU hardware accelerated decoding for H264 which can be used by
cehoyos
parents:
diff
changeset
|
183 /* @}*/ |