annotate vaapi.c @ 11048:9db9a81cc220 libavcodec

Move variable declaration to block where it is used and simplify code. Avoids a (incorrect) "possibly used uninitialized" warning, no measurable speed difference.
author reimar
date Thu, 28 Jan 2010 21:01:50 +0000
parents de8d07d87c45
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9225
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
1 /*
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
2 * Video Acceleration API (video decoding)
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
3 * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
4 *
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
5 * Copyright (C) 2008-2009 Splitted-Desktop Systems
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
6 *
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
7 * This file is part of FFmpeg.
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
8 *
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
9 * FFmpeg is free software; you can redistribute it and/or
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
10 * modify it under the terms of the GNU Lesser General Public
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
11 * License as published by the Free Software Foundation; either
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
12 * version 2.1 of the License, or (at your option) any later version.
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
13 *
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
14 * FFmpeg is distributed in the hope that it will be useful,
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
17 * Lesser General Public License for more details.
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
18 *
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
19 * You should have received a copy of the GNU Lesser General Public
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
20 * License along with FFmpeg; if not, write to the Free Software
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
22 */
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
23
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
24 #include "vaapi_internal.h"
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
25
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
26 /**
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
27 * \addtogroup VAAPI_Decoding
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
28 *
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
29 * @{
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
30 */
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
31
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
32 static void destroy_buffers(VADisplay display, VABufferID *buffers, unsigned int n_buffers)
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
33 {
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
34 unsigned int i;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
35 for (i = 0; i < n_buffers; i++) {
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
36 if (buffers[i]) {
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
37 vaDestroyBuffer(display, buffers[i]);
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
38 buffers[i] = 0;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
39 }
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
40 }
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
41 }
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
42
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
43 static int render_picture(struct vaapi_context *vactx, VASurfaceID surface)
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
44 {
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
45 VABufferID va_buffers[3];
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
46 unsigned int n_va_buffers = 0;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
47
9292
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
48 vaUnmapBuffer(vactx->display, vactx->pic_param_buf_id);
9225
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
49 va_buffers[n_va_buffers++] = vactx->pic_param_buf_id;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
50
9292
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
51 if (vactx->iq_matrix_buf_id) {
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
52 vaUnmapBuffer(vactx->display, vactx->iq_matrix_buf_id);
9225
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
53 va_buffers[n_va_buffers++] = vactx->iq_matrix_buf_id;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
54 }
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
55
9292
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
56 if (vactx->bitplane_buf_id) {
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
57 vaUnmapBuffer(vactx->display, vactx->bitplane_buf_id);
9225
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
58 va_buffers[n_va_buffers++] = vactx->bitplane_buf_id;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
59 }
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
60
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
61 if (vaBeginPicture(vactx->display, vactx->context_id,
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
62 surface) != VA_STATUS_SUCCESS)
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
63 return -1;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
64
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
65 if (vaRenderPicture(vactx->display, vactx->context_id,
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
66 va_buffers, n_va_buffers) != VA_STATUS_SUCCESS)
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
67 return -1;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
68
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
69 if (vaRenderPicture(vactx->display, vactx->context_id,
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
70 vactx->slice_buf_ids,
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
71 vactx->n_slice_buf_ids) != VA_STATUS_SUCCESS)
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
72 return -1;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
73
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
74 if (vaEndPicture(vactx->display, vactx->context_id) != VA_STATUS_SUCCESS)
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
75 return -1;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
76
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
77 return 0;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
78 }
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
79
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
80 static int commit_slices(struct vaapi_context *vactx)
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
81 {
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
82 VABufferID *slice_buf_ids;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
83 VABufferID slice_param_buf_id, slice_data_buf_id;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
84
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
85 if (vactx->slice_count == 0)
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
86 return 0;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
87
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
88 slice_buf_ids =
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
89 av_fast_realloc(vactx->slice_buf_ids,
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
90 &vactx->slice_buf_ids_alloc,
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
91 (vactx->n_slice_buf_ids + 2) * sizeof(slice_buf_ids[0]));
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
92 if (!slice_buf_ids)
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
93 return -1;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
94 vactx->slice_buf_ids = slice_buf_ids;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
95
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
96 slice_param_buf_id = 0;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
97 if (vaCreateBuffer(vactx->display, vactx->context_id,
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
98 VASliceParameterBufferType,
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
99 vactx->slice_param_size,
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
100 vactx->slice_count, vactx->slice_params,
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
101 &slice_param_buf_id) != VA_STATUS_SUCCESS)
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
102 return -1;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
103 vactx->slice_count = 0;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
104
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
105 slice_data_buf_id = 0;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
106 if (vaCreateBuffer(vactx->display, vactx->context_id,
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
107 VASliceDataBufferType,
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
108 vactx->slice_data_size,
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
109 1, (void *)vactx->slice_data,
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
110 &slice_data_buf_id) != VA_STATUS_SUCCESS)
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
111 return -1;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
112 vactx->slice_data = NULL;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
113 vactx->slice_data_size = 0;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
114
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
115 slice_buf_ids[vactx->n_slice_buf_ids++] = slice_param_buf_id;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
116 slice_buf_ids[vactx->n_slice_buf_ids++] = slice_data_buf_id;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
117 return 0;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
118 }
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
119
9292
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
120 static void *alloc_buffer(struct vaapi_context *vactx, int type, unsigned int size, uint32_t *buf_id)
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
121 {
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
122 void *data = NULL;
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
123
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
124 *buf_id = 0;
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
125 if (vaCreateBuffer(vactx->display, vactx->context_id,
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
126 type, size, 1, NULL, buf_id) == VA_STATUS_SUCCESS)
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
127 vaMapBuffer(vactx->display, *buf_id, &data);
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
128
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
129 return data;
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
130 }
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
131
10724
de8d07d87c45 Rename ff_vaapi_alloc_picture() to ff_vaapi_alloc_pic_param().
gb
parents: 10723
diff changeset
132 void *ff_vaapi_alloc_pic_param(struct vaapi_context *vactx, unsigned int size)
9292
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
133 {
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
134 return alloc_buffer(vactx, VAPictureParameterBufferType, size, &vactx->pic_param_buf_id);
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
135 }
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
136
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
137 void *ff_vaapi_alloc_iq_matrix(struct vaapi_context *vactx, unsigned int size)
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
138 {
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
139 return alloc_buffer(vactx, VAIQMatrixBufferType, size, &vactx->iq_matrix_buf_id);
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
140 }
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
141
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
142 uint8_t *ff_vaapi_alloc_bitplane(struct vaapi_context *vactx, uint32_t size)
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
143 {
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
144 return alloc_buffer(vactx, VABitPlaneBufferType, size, &vactx->bitplane_buf_id);
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
145 }
f0732d44f655 Improve VA API buffers allocation logic. This also reduces struct vaapi_context
gb
parents: 9225
diff changeset
146
9225
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
147 VASliceParameterBufferBase *ff_vaapi_alloc_slice(struct vaapi_context *vactx, const uint8_t *buffer, uint32_t size)
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
148 {
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
149 uint8_t *slice_params;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
150 VASliceParameterBufferBase *slice_param;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
151
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
152 if (!vactx->slice_data)
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
153 vactx->slice_data = buffer;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
154 if (vactx->slice_data + vactx->slice_data_size != buffer) {
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
155 if (commit_slices(vactx) < 0)
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
156 return NULL;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
157 vactx->slice_data = buffer;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
158 }
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
159
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
160 slice_params =
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
161 av_fast_realloc(vactx->slice_params,
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
162 &vactx->slice_params_alloc,
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
163 (vactx->slice_count + 1) * vactx->slice_param_size);
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
164 if (!slice_params)
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
165 return NULL;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
166 vactx->slice_params = slice_params;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
167
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
168 slice_param = (VASliceParameterBufferBase *)(slice_params + vactx->slice_count * vactx->slice_param_size);
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
169 slice_param->slice_data_size = size;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
170 slice_param->slice_data_offset = vactx->slice_data_size;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
171 slice_param->slice_data_flag = VA_SLICE_DATA_FLAG_ALL;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
172
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
173 vactx->slice_count++;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
174 vactx->slice_data_size += size;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
175 return slice_param;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
176 }
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
177
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
178 int ff_vaapi_common_end_frame(MpegEncContext *s)
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
179 {
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
180 struct vaapi_context * const vactx = s->avctx->hwaccel_context;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
181 int ret = -1;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
182
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
183 dprintf(s->avctx, "ff_vaapi_common_end_frame()\n");
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
184
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
185 if (commit_slices(vactx) < 0)
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
186 goto done;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
187 if (vactx->n_slice_buf_ids > 0) {
10723
3f08c340020f Rename ff_vaapi_get_surface() to ff_vaapi_get_surface_id().
gb
parents: 9292
diff changeset
188 if (render_picture(vactx, ff_vaapi_get_surface_id(s->current_picture_ptr)) < 0)
9225
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
189 goto done;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
190 ff_draw_horiz_band(s, 0, s->avctx->height);
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
191 }
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
192 ret = 0;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
193
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
194 done:
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
195 destroy_buffers(vactx->display, &vactx->pic_param_buf_id, 1);
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
196 destroy_buffers(vactx->display, &vactx->iq_matrix_buf_id, 1);
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
197 destroy_buffers(vactx->display, &vactx->bitplane_buf_id, 1);
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
198 destroy_buffers(vactx->display, vactx->slice_buf_ids, vactx->n_slice_buf_ids);
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
199 av_freep(&vactx->slice_buf_ids);
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
200 av_freep(&vactx->slice_params);
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
201 vactx->n_slice_buf_ids = 0;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
202 vactx->slice_buf_ids_alloc = 0;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
203 vactx->slice_count = 0;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
204 vactx->slice_params_alloc = 0;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
205 return ret;
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
206 }
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
207
85c7a028316d Add common VA API data structures and helpers.
gb
parents:
diff changeset
208 /* @} */