History

vaapi: streamline public context structure.

Move libavcodec managed objects from the public struct vaapi_context to a new privately owned FFVAContext. This is done so that to clean up and streamline the public structure, but also to prepare for new codec support, thus requiring new internal data to be added in there. The AVCodecContext.hwaccel_context, that holds the public vaapi_context, shall no longer be accessed from within vaapi_*.c codec support files.

Gwenole Beauchesne committed 11 years ago

Commit babd3401 parent 9f8e57e9 files · +123 −26Browse files

Unified · Split

9 files
  1. doc/APIchanges +4 −0
  2. libavcodec/vaapi.c +31 −9
  3. libavcodec/vaapi.h +16 −0
  4. libavcodec/vaapi_h264.c +7 −3
  5. libavcodec/vaapi_internal.h +36 −6
  6. libavcodec/vaapi_mpeg2.c +6 −2
  7. libavcodec/vaapi_mpeg4.c +9 −2
  8. libavcodec/vaapi_vc1.c +9 −2
  9. libavcodec/version.h +5 −2
doc/APIchanges+4−0
@@ -15,6 +15,10 @@ libavutil: 2014-08-09 · 14 unmodified lines
15 15
16API changes, most recent first:16API changes, most recent first:
17 17
182015-xx-xx - lavc 56.58.100 - vaapi.h
19 Deprecate old VA-API context (vaapi_context) fields that were only
20 set and used by libavcodec. They are all managed internally now.
21
182015-xx-xx - lavu 54.31.100 - pixfmt.h222015-xx-xx - lavu 54.31.100 - pixfmt.h
19 Add a unique pixel format for VA-API (AV_PIX_FMT_VAAPI) that23 Add a unique pixel format for VA-API (AV_PIX_FMT_VAAPI) that
20 indicates the nature of the underlying storage: a VA surface. This24 indicates the nature of the underlying storage: a VA surface. This
libavcodec/vaapi.c+31−9
@@ -21,6 +21,7 @@ · 20 unmodified lines
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */22 */
23 23
24#include "libavutil/log.h"
24#include "h264.h"25#include "h264.h"
25#include "vaapi_internal.h"26#include "vaapi_internal.h"
26 27
@@ -41,7 +42,28 @@ static void destroy_buffers(VADisplay display, VABufferID *buffers, unsigned int · 14 unmodified lines
41 }42 }
42}43}
43 44
44int ff_vaapi_render_picture(struct vaapi_context *vactx, VASurfaceID surface)45int ff_vaapi_context_init(AVCodecContext *avctx)
46{
47 FFVAContext * const vactx = ff_vaapi_get_context(avctx);
48 const struct vaapi_context * const user_vactx = avctx->hwaccel_context;
49
50 if (!user_vactx) {
51 av_log(avctx, AV_LOG_ERROR, "Hardware acceleration context (hwaccel_context) does not exist.\n");
52 return AVERROR(ENOSYS);
53 }
54
55 vactx->display = user_vactx->display;
56 vactx->config_id = user_vactx->config_id;
57 vactx->context_id = user_vactx->context_id;
58 return 0;
59}
60
61int ff_vaapi_context_fini(AVCodecContext *avctx)
62{
63 return 0;
64}
65
66int ff_vaapi_render_picture(FFVAContext *vactx, VASurfaceID surface)
45{67{
46 VABufferID va_buffers[3];68 VABufferID va_buffers[3];
47 unsigned int n_va_buffers = 0;69 unsigned int n_va_buffers = 0;
@@ -81,7 +103,7 @@ int ff_vaapi_render_picture(struct vaapi_context *vactx, VASurfaceID surface) · 33 unmodified lines
81 return 0;103 return 0;
82}104}
83 105
84int ff_vaapi_commit_slices(struct vaapi_context *vactx)106int ff_vaapi_commit_slices(FFVAContext *vactx)
85{107{
86 VABufferID *slice_buf_ids;108 VABufferID *slice_buf_ids;
87 VABufferID slice_param_buf_id, slice_data_buf_id;109 VABufferID slice_param_buf_id, slice_data_buf_id;
@@ -121,7 +143,7 @@ int ff_vaapi_commit_slices(struct vaapi_context *vactx) · 33 unmodified lines
121 return 0;143 return 0;
122}144}
123 145
124static void *alloc_buffer(struct vaapi_context *vactx, int type, unsigned int size, uint32_t *buf_id)146static void *alloc_buffer(FFVAContext *vactx, int type, unsigned int size, uint32_t *buf_id)
125{147{
126 void *data = NULL;148 void *data = NULL;
127 149
@@ -133,22 +155,22 @@ static void *alloc_buffer(struct vaapi_context *vactx, int type, unsigned int si · 5 unmodified lines
133 return data;155 return data;
134}156}
135 157
136void *ff_vaapi_alloc_pic_param(struct vaapi_context *vactx, unsigned int size)158void *ff_vaapi_alloc_pic_param(FFVAContext *vactx, unsigned int size)
137{159{
138 return alloc_buffer(vactx, VAPictureParameterBufferType, size, &vactx->pic_param_buf_id);160 return alloc_buffer(vactx, VAPictureParameterBufferType, size, &vactx->pic_param_buf_id);
139}161}
140 162
141void *ff_vaapi_alloc_iq_matrix(struct vaapi_context *vactx, unsigned int size)163void *ff_vaapi_alloc_iq_matrix(FFVAContext *vactx, unsigned int size)
142{164{
143 return alloc_buffer(vactx, VAIQMatrixBufferType, size, &vactx->iq_matrix_buf_id);165 return alloc_buffer(vactx, VAIQMatrixBufferType, size, &vactx->iq_matrix_buf_id);
144}166}
145 167
146uint8_t *ff_vaapi_alloc_bitplane(struct vaapi_context *vactx, uint32_t size)168uint8_t *ff_vaapi_alloc_bitplane(FFVAContext *vactx, uint32_t size)
147{169{
148 return alloc_buffer(vactx, VABitPlaneBufferType, size, &vactx->bitplane_buf_id);170 return alloc_buffer(vactx, VABitPlaneBufferType, size, &vactx->bitplane_buf_id);
149}171}
150 172
151VASliceParameterBufferBase *ff_vaapi_alloc_slice(struct vaapi_context *vactx, const uint8_t *buffer, uint32_t size)173VASliceParameterBufferBase *ff_vaapi_alloc_slice(FFVAContext *vactx, const uint8_t *buffer, uint32_t size)
152{174{
153 uint8_t *slice_params;175 uint8_t *slice_params;
154 VASliceParameterBufferBase *slice_param;176 VASliceParameterBufferBase *slice_param;
@@ -181,7 +203,7 @@ VASliceParameterBufferBase *ff_vaapi_alloc_slice(struct vaapi_context *vactx, co · 26 unmodified lines
181 203
182void ff_vaapi_common_end_frame(AVCodecContext *avctx)204void ff_vaapi_common_end_frame(AVCodecContext *avctx)
183{205{
184 struct vaapi_context * const vactx = avctx->hwaccel_context;206 FFVAContext * const vactx = ff_vaapi_get_context(avctx);
185 207
186 ff_dlog(avctx, "ff_vaapi_common_end_frame()\n");208 ff_dlog(avctx, "ff_vaapi_common_end_frame()\n");
187 209
@@ -202,7 +224,7 @@ void ff_vaapi_common_end_frame(AVCodecContext *avctx) · 14 unmodified lines
202 CONFIG_VC1_VAAPI_HWACCEL || CONFIG_WMV3_VAAPI_HWACCEL224 CONFIG_VC1_VAAPI_HWACCEL || CONFIG_WMV3_VAAPI_HWACCEL
203int ff_vaapi_mpeg_end_frame(AVCodecContext *avctx)225int ff_vaapi_mpeg_end_frame(AVCodecContext *avctx)
204{226{
205 struct vaapi_context * const vactx = avctx->hwaccel_context;227 FFVAContext * const vactx = ff_vaapi_get_context(avctx);
206 MpegEncContext *s = avctx->priv_data;228 MpegEncContext *s = avctx->priv_data;
207 int ret;229 int ret;
208 230
libavcodec/vaapi.h+16−0
@@ -31,6 +31,8 @@ · 30 unmodified lines
31 */31 */
32 32
33#include <stdint.h>33#include <stdint.h>
34#include <libavutil/attributes.h>
35#include "version.h"
34 36
35/**37/**
36 * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding38 * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding
@@ -72,12 +74,14 @@ struct vaapi_context { · 35 unmodified lines
72 */74 */
73 uint32_t context_id;75 uint32_t context_id;
74 76
77#if FF_API_VAAPI_CONTEXT
75 /**78 /**
76 * VAPictureParameterBuffer ID79 * VAPictureParameterBuffer ID
77 *80 *
78 * - encoding: unused81 * - encoding: unused
79 * - decoding: Set by libavcodec82 * - decoding: Set by libavcodec
80 */83 */
84 attribute_deprecated
81 uint32_t pic_param_buf_id;85 uint32_t pic_param_buf_id;
82 86
83 /**87 /**
@@ -86,6 +90,7 @@ struct vaapi_context { · 2 unmodified lines
86 * - encoding: unused90 * - encoding: unused
87 * - decoding: Set by libavcodec91 * - decoding: Set by libavcodec
88 */92 */
93 attribute_deprecated
89 uint32_t iq_matrix_buf_id;94 uint32_t iq_matrix_buf_id;
90 95
91 /**96 /**
@@ -94,6 +99,7 @@ struct vaapi_context { · 2 unmodified lines
94 * - encoding: unused99 * - encoding: unused
95 * - decoding: Set by libavcodec100 * - decoding: Set by libavcodec
96 */101 */
102 attribute_deprecated
97 uint32_t bitplane_buf_id;103 uint32_t bitplane_buf_id;
98 104
99 /**105 /**
@@ -102,6 +108,7 @@ struct vaapi_context { · 2 unmodified lines
102 * - encoding: unused108 * - encoding: unused
103 * - decoding: Set by libavcodec109 * - decoding: Set by libavcodec
104 */110 */
111 attribute_deprecated
105 uint32_t *slice_buf_ids;112 uint32_t *slice_buf_ids;
106 113
107 /**114 /**
@@ -110,6 +117,7 @@ struct vaapi_context { · 2 unmodified lines
110 * - encoding: unused117 * - encoding: unused
111 * - decoding: Set by libavcodec118 * - decoding: Set by libavcodec
112 */119 */
120 attribute_deprecated
113 unsigned int n_slice_buf_ids;121 unsigned int n_slice_buf_ids;
114 122
115 /**123 /**
@@ -118,6 +126,7 @@ struct vaapi_context { · 2 unmodified lines
118 * - encoding: unused126 * - encoding: unused
119 * - decoding: Set by libavcodec127 * - decoding: Set by libavcodec
120 */128 */
129 attribute_deprecated
121 unsigned int slice_buf_ids_alloc;130 unsigned int slice_buf_ids_alloc;
122 131
123 /**132 /**
@@ -126,6 +135,7 @@ struct vaapi_context { · 2 unmodified lines
126 * - encoding: unused135 * - encoding: unused
127 * - decoding: Set by libavcodec136 * - decoding: Set by libavcodec
128 */137 */
138 attribute_deprecated
129 void *slice_params;139 void *slice_params;
130 140
131 /**141 /**
@@ -134,6 +144,7 @@ struct vaapi_context { · 2 unmodified lines
134 * - encoding: unused144 * - encoding: unused
135 * - decoding: Set by libavcodec145 * - decoding: Set by libavcodec
136 */146 */
147 attribute_deprecated
137 unsigned int slice_param_size;148 unsigned int slice_param_size;
138 149
139 /**150 /**
@@ -142,6 +153,7 @@ struct vaapi_context { · 2 unmodified lines
142 * - encoding: unused153 * - encoding: unused
143 * - decoding: Set by libavcodec154 * - decoding: Set by libavcodec
144 */155 */
156 attribute_deprecated
145 unsigned int slice_params_alloc;157 unsigned int slice_params_alloc;
146 158
147 /**159 /**
@@ -150,6 +162,7 @@ struct vaapi_context { · 2 unmodified lines
150 * - encoding: unused162 * - encoding: unused
151 * - decoding: Set by libavcodec163 * - decoding: Set by libavcodec
152 */164 */
165 attribute_deprecated
153 unsigned int slice_count;166 unsigned int slice_count;
154 167
155 /**168 /**
@@ -157,6 +170,7 @@ struct vaapi_context { · 1 unmodified line
157 * - encoding: unused170 * - encoding: unused
158 * - decoding: Set by libavcodec171 * - decoding: Set by libavcodec
159 */172 */
173 attribute_deprecated
160 const uint8_t *slice_data;174 const uint8_t *slice_data;
161 175
162 /**176 /**
@@ -165,7 +179,9 @@ struct vaapi_context { · 2 unmodified lines
165 * - encoding: unused179 * - encoding: unused
166 * - decoding: Set by libavcodec180 * - decoding: Set by libavcodec
167 */181 */
182 attribute_deprecated
168 uint32_t slice_data_size;183 uint32_t slice_data_size;
184#endif
169};185};
170 186
171/* @} */187/* @} */
libavcodec/vaapi_h264.c+7−3
@@ -227,7 +227,7 @@ static int vaapi_h264_start_frame(AVCodecContext *avctx, · 226 unmodified lines
227 av_unused uint32_t size)227 av_unused uint32_t size)
228{228{
229 H264Context * const h = avctx->priv_data;229 H264Context * const h = avctx->priv_data;
230 struct vaapi_context * const vactx = avctx->hwaccel_context;230 FFVAContext * const vactx = ff_vaapi_get_context(avctx);
231 VAPictureParameterBufferH264 *pic_param;231 VAPictureParameterBufferH264 *pic_param;
232 VAIQMatrixBufferH264 *iq_matrix;232 VAIQMatrixBufferH264 *iq_matrix;
233 233
@@ -292,7 +292,7 @@ static int vaapi_h264_start_frame(AVCodecContext *avctx, · 58 unmodified lines
292/** End a hardware decoding based frame. */292/** End a hardware decoding based frame. */
293static int vaapi_h264_end_frame(AVCodecContext *avctx)293static int vaapi_h264_end_frame(AVCodecContext *avctx)
294{294{
295 struct vaapi_context * const vactx = avctx->hwaccel_context;295 FFVAContext * const vactx = ff_vaapi_get_context(avctx);
296 H264Context * const h = avctx->priv_data;296 H264Context * const h = avctx->priv_data;
297 H264SliceContext *sl = &h->slice_ctx[0];297 H264SliceContext *sl = &h->slice_ctx[0];
298 int ret;298 int ret;
@@ -318,6 +318,7 @@ static int vaapi_h264_decode_slice(AVCodecContext *avctx, · 19 unmodified lines
318 const uint8_t *buffer,318 const uint8_t *buffer,
319 uint32_t size)319 uint32_t size)
320{320{
321 FFVAContext * const vactx = ff_vaapi_get_context(avctx);
321 H264Context * const h = avctx->priv_data;322 H264Context * const h = avctx->priv_data;
322 H264SliceContext *sl = &h->slice_ctx[0];323 H264SliceContext *sl = &h->slice_ctx[0];
323 VASliceParameterBufferH264 *slice_param;324 VASliceParameterBufferH264 *slice_param;
@@ -326,7 +327,7 @@ static int vaapi_h264_decode_slice(AVCodecContext *avctx, · 2 unmodified lines
326 buffer, size);327 buffer, size);
327 328
328 /* Fill in VASliceParameterBufferH264. */329 /* Fill in VASliceParameterBufferH264. */
329 slice_param = (VASliceParameterBufferH264 *)ff_vaapi_alloc_slice(avctx->hwaccel_context, buffer, size);330 slice_param = (VASliceParameterBufferH264 *)ff_vaapi_alloc_slice(vactx, buffer, size);
330 if (!slice_param)331 if (!slice_param)
331 return -1;332 return -1;
332 slice_param->slice_data_bit_offset = get_bits_count(&sl->gb) + 8; /* bit buffer started beyond nal_unit_type */333 slice_param->slice_data_bit_offset = get_bits_count(&sl->gb) + 8; /* bit buffer started beyond nal_unit_type */
@@ -363,4 +364,7 @@ AVHWAccel ff_h264_vaapi_hwaccel = { · 30 unmodified lines
363 .start_frame = vaapi_h264_start_frame,364 .start_frame = vaapi_h264_start_frame,
364 .end_frame = vaapi_h264_end_frame,365 .end_frame = vaapi_h264_end_frame,
365 .decode_slice = vaapi_h264_decode_slice,366 .decode_slice = vaapi_h264_decode_slice,
367 .init = ff_vaapi_context_init,
368 .uninit = ff_vaapi_context_fini,
369 .priv_data_size = sizeof(FFVAContext),
366};370};
libavcodec/vaapi_internal.h+36−6
@@ -35,23 +35,53 @@ · 34 unmodified lines
35 * @{35 * @{
36 */36 */
37 37
38typedef struct {
39 VADisplay display; ///< Windowing system dependent handle
40 VAConfigID config_id; ///< Configuration ID
41 VAContextID context_id; ///< Context ID (video decode pipeline)
42 VABufferID pic_param_buf_id; ///< Picture parameter buffer
43 VABufferID iq_matrix_buf_id; ///< Inverse quantiser matrix buffer
44 VABufferID bitplane_buf_id; ///< Bitplane buffer (for VC-1 decoding)
45 VABufferID *slice_buf_ids; ///< Slice parameter/data buffers
46 unsigned int n_slice_buf_ids; ///< Number of effective slice buffers
47 unsigned int slice_buf_ids_alloc; ///< Number of allocated slice buffers
48 void *slice_params; ///< Pointer to slice parameter buffers
49 unsigned int slice_param_size; ///< Size of a slice parameter element
50 unsigned int slice_params_alloc; ///< Number of allocated slice parameters
51 unsigned int slice_count; ///< Number of slices currently filled in
52 const uint8_t *slice_data; ///< Pointer to slice data buffer base
53 unsigned int slice_data_size; ///< Current size of slice data
54} FFVAContext;
55
56/** Extract vaapi_context from an AVCodecContext */
57static inline FFVAContext *ff_vaapi_get_context(AVCodecContext *avctx)
58{
59 return avctx->internal->hwaccel_priv_data;
60}
61
38/** Extract VASurfaceID from an AVFrame */62/** Extract VASurfaceID from an AVFrame */
39static inline VASurfaceID ff_vaapi_get_surface_id(AVFrame *pic)63static inline VASurfaceID ff_vaapi_get_surface_id(AVFrame *pic)
40{64{
41 return (uintptr_t)pic->data[3];65 return (uintptr_t)pic->data[3];
42}66}
43 67
68/** Common AVHWAccel.init() implementation */
69int ff_vaapi_context_init(AVCodecContext *avctx);
70
71/** Common AVHWAccel.uninit() implementation */
72int ff_vaapi_context_fini(AVCodecContext *avctx);
73
44/** Common AVHWAccel.end_frame() implementation */74/** Common AVHWAccel.end_frame() implementation */
45void ff_vaapi_common_end_frame(AVCodecContext *avctx);75void ff_vaapi_common_end_frame(AVCodecContext *avctx);
46 76
47/** Allocate a new picture parameter buffer */77/** Allocate a new picture parameter buffer */
48void *ff_vaapi_alloc_pic_param(struct vaapi_context *vactx, unsigned int size);78void *ff_vaapi_alloc_pic_param(FFVAContext *vactx, unsigned int size);
49 79
50/** Allocate a new IQ matrix buffer */80/** Allocate a new IQ matrix buffer */
51void *ff_vaapi_alloc_iq_matrix(struct vaapi_context *vactx, unsigned int size);81void *ff_vaapi_alloc_iq_matrix(FFVAContext *vactx, unsigned int size);
52 82
53/** Allocate a new bit-plane buffer */83/** Allocate a new bit-plane buffer */
54uint8_t *ff_vaapi_alloc_bitplane(struct vaapi_context *vactx, uint32_t size);84uint8_t *ff_vaapi_alloc_bitplane(FFVAContext *vactx, uint32_t size);
55 85
56/**86/**
57 * Allocate a new slice descriptor for the input slice.87 * Allocate a new slice descriptor for the input slice.
@@ -61,11 +91,11 @@ uint8_t *ff_vaapi_alloc_bitplane(struct vaapi_context *vactx, uint32_t size); · 3 unmodified lines
61 * @param size the size of the slice in bytes91 * @param size the size of the slice in bytes
62 * @return the newly allocated slice parameter92 * @return the newly allocated slice parameter
63 */93 */
64VASliceParameterBufferBase *ff_vaapi_alloc_slice(struct vaapi_context *vactx, const uint8_t *buffer, uint32_t size);94VASliceParameterBufferBase *ff_vaapi_alloc_slice(FFVAContext *vactx, const uint8_t *buffer, uint32_t size);
65 95
66int ff_vaapi_mpeg_end_frame(AVCodecContext *avctx);96int ff_vaapi_mpeg_end_frame(AVCodecContext *avctx);
67int ff_vaapi_commit_slices(struct vaapi_context *vactx);97int ff_vaapi_commit_slices(FFVAContext *vactx);
68int ff_vaapi_render_picture(struct vaapi_context *vactx, VASurfaceID surface);98int ff_vaapi_render_picture(FFVAContext *vactx, VASurfaceID surface);
69 99
70/* @} */100/* @} */
71 101
libavcodec/vaapi_mpeg2.c+6−2
@@ -40,7 +40,7 @@ static inline int mpeg2_get_is_frame_start(MpegEncContext *s) · 39 unmodified lines
40static int vaapi_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)40static int vaapi_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
41{41{
42 struct MpegEncContext * const s = avctx->priv_data;42 struct MpegEncContext * const s = avctx->priv_data;
43 struct vaapi_context * const vactx = avctx->hwaccel_context;43 FFVAContext * const vactx = ff_vaapi_get_context(avctx);
44 VAPictureParameterBufferMPEG2 *pic_param;44 VAPictureParameterBufferMPEG2 *pic_param;
45 VAIQMatrixBufferMPEG2 *iq_matrix;45 VAIQMatrixBufferMPEG2 *iq_matrix;
46 int i;46 int i;
@@ -103,6 +103,7 @@ static int vaapi_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint8_ · 56 unmodified lines
103static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)103static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
104{104{
105 MpegEncContext * const s = avctx->priv_data;105 MpegEncContext * const s = avctx->priv_data;
106 FFVAContext * const vactx = ff_vaapi_get_context(avctx);
106 VASliceParameterBufferMPEG2 *slice_param;107 VASliceParameterBufferMPEG2 *slice_param;
107 GetBitContext gb;108 GetBitContext gb;
108 uint32_t quantiser_scale_code, intra_slice_flag, macroblock_offset;109 uint32_t quantiser_scale_code, intra_slice_flag, macroblock_offset;
@@ -123,7 +124,7 @@ static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer · 14 unmodified lines
123 macroblock_offset = get_bits_count(&gb);124 macroblock_offset = get_bits_count(&gb);
124 125
125 /* Fill in VASliceParameterBufferMPEG2 */126 /* Fill in VASliceParameterBufferMPEG2 */
126 slice_param = (VASliceParameterBufferMPEG2 *)ff_vaapi_alloc_slice(avctx->hwaccel_context, buffer, size);127 slice_param = (VASliceParameterBufferMPEG2 *)ff_vaapi_alloc_slice(vactx, buffer, size);
127 if (!slice_param)128 if (!slice_param)
128 return -1;129 return -1;
129 slice_param->macroblock_offset = macroblock_offset;130 slice_param->macroblock_offset = macroblock_offset;
@@ -142,4 +143,7 @@ AVHWAccel ff_mpeg2_vaapi_hwaccel = { · 12 unmodified lines
142 .start_frame = vaapi_mpeg2_start_frame,143 .start_frame = vaapi_mpeg2_start_frame,
143 .end_frame = ff_vaapi_mpeg_end_frame,144 .end_frame = ff_vaapi_mpeg_end_frame,
144 .decode_slice = vaapi_mpeg2_decode_slice,145 .decode_slice = vaapi_mpeg2_decode_slice,
146 .init = ff_vaapi_context_init,
147 .uninit = ff_vaapi_context_fini,
148 .priv_data_size = sizeof(FFVAContext),
145};149};
libavcodec/vaapi_mpeg4.c+9−2
@@ -45,7 +45,7 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_ · 44 unmodified lines
45{45{
46 Mpeg4DecContext *ctx = avctx->priv_data;46 Mpeg4DecContext *ctx = avctx->priv_data;
47 MpegEncContext * const s = &ctx->m;47 MpegEncContext * const s = &ctx->m;
48 struct vaapi_context * const vactx = avctx->hwaccel_context;48 FFVAContext * const vactx = ff_vaapi_get_context(avctx);
49 VAPictureParameterBufferMPEG4 *pic_param;49 VAPictureParameterBufferMPEG4 *pic_param;
50 VAIQMatrixBufferMPEG4 *iq_matrix;50 VAIQMatrixBufferMPEG4 *iq_matrix;
51 int i;51 int i;
@@ -121,12 +121,13 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_ · 69 unmodified lines
121static int vaapi_mpeg4_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)121static int vaapi_mpeg4_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
122{122{
123 MpegEncContext * const s = avctx->priv_data;123 MpegEncContext * const s = avctx->priv_data;
124 FFVAContext * const vactx = ff_vaapi_get_context(avctx);
124 VASliceParameterBufferMPEG4 *slice_param;125 VASliceParameterBufferMPEG4 *slice_param;
125 126
126 ff_dlog(avctx, "vaapi_mpeg4_decode_slice(): buffer %p, size %d\n", buffer, size);127 ff_dlog(avctx, "vaapi_mpeg4_decode_slice(): buffer %p, size %d\n", buffer, size);
127 128
128 /* Fill in VASliceParameterBufferMPEG4 */129 /* Fill in VASliceParameterBufferMPEG4 */
129 slice_param = (VASliceParameterBufferMPEG4 *)ff_vaapi_alloc_slice(avctx->hwaccel_context, buffer, size);130 slice_param = (VASliceParameterBufferMPEG4 *)ff_vaapi_alloc_slice(vactx, buffer, size);
130 if (!slice_param)131 if (!slice_param)
131 return -1;132 return -1;
132 slice_param->macroblock_offset = get_bits_count(&s->gb) % 8;133 slice_param->macroblock_offset = get_bits_count(&s->gb) % 8;
@@ -145,6 +146,9 @@ AVHWAccel ff_mpeg4_vaapi_hwaccel = { · 12 unmodified lines
145 .start_frame = vaapi_mpeg4_start_frame,146 .start_frame = vaapi_mpeg4_start_frame,
146 .end_frame = ff_vaapi_mpeg_end_frame,147 .end_frame = ff_vaapi_mpeg_end_frame,
147 .decode_slice = vaapi_mpeg4_decode_slice,148 .decode_slice = vaapi_mpeg4_decode_slice,
149 .init = ff_vaapi_context_init,
150 .uninit = ff_vaapi_context_fini,
151 .priv_data_size = sizeof(FFVAContext),
148};152};
149#endif153#endif
150 154
@@ -157,5 +161,8 @@ AVHWAccel ff_h263_vaapi_hwaccel = { · 6 unmodified lines
157 .start_frame = vaapi_mpeg4_start_frame,161 .start_frame = vaapi_mpeg4_start_frame,
158 .end_frame = ff_vaapi_mpeg_end_frame,162 .end_frame = ff_vaapi_mpeg_end_frame,
159 .decode_slice = vaapi_mpeg4_decode_slice,163 .decode_slice = vaapi_mpeg4_decode_slice,
164 .init = ff_vaapi_context_init,
165 .uninit = ff_vaapi_context_fini,
166 .priv_data_size = sizeof(FFVAContext),
160};167};
161#endif168#endif
libavcodec/vaapi_vc1.c+9−2
@@ -148,7 +148,7 @@ static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t · 147 unmodified lines
148{148{
149 VC1Context * const v = avctx->priv_data;149 VC1Context * const v = avctx->priv_data;
150 MpegEncContext * const s = &v->s;150 MpegEncContext * const s = &v->s;
151 struct vaapi_context * const vactx = avctx->hwaccel_context;151 FFVAContext * const vactx = ff_vaapi_get_context(avctx);
152 VAPictureParameterBufferVC1 *pic_param;152 VAPictureParameterBufferVC1 *pic_param;
153 153
154 ff_dlog(avctx, "vaapi_vc1_start_frame()\n");154 ff_dlog(avctx, "vaapi_vc1_start_frame()\n");
@@ -315,6 +315,7 @@ static int vaapi_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, · 160 unmodified lines
315{315{
316 VC1Context * const v = avctx->priv_data;316 VC1Context * const v = avctx->priv_data;
317 MpegEncContext * const s = &v->s;317 MpegEncContext * const s = &v->s;
318 FFVAContext * const vactx = ff_vaapi_get_context(avctx);
318 VASliceParameterBufferVC1 *slice_param;319 VASliceParameterBufferVC1 *slice_param;
319 320
320 ff_dlog(avctx, "vaapi_vc1_decode_slice(): buffer %p, size %d\n", buffer, size);321 ff_dlog(avctx, "vaapi_vc1_decode_slice(): buffer %p, size %d\n", buffer, size);
@@ -326,7 +327,7 @@ static int vaapi_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, · 5 unmodified lines
326 }327 }
327 328
328 /* Fill in VASliceParameterBufferVC1 */329 /* Fill in VASliceParameterBufferVC1 */
329 slice_param = (VASliceParameterBufferVC1 *)ff_vaapi_alloc_slice(avctx->hwaccel_context, buffer, size);330 slice_param = (VASliceParameterBufferVC1 *)ff_vaapi_alloc_slice(vactx, buffer, size);
330 if (!slice_param)331 if (!slice_param)
331 return -1;332 return -1;
332 slice_param->macroblock_offset = get_bits_count(&s->gb);333 slice_param->macroblock_offset = get_bits_count(&s->gb);
@@ -343,6 +344,9 @@ AVHWAccel ff_wmv3_vaapi_hwaccel = { · 10 unmodified lines
343 .start_frame = vaapi_vc1_start_frame,344 .start_frame = vaapi_vc1_start_frame,
344 .end_frame = ff_vaapi_mpeg_end_frame,345 .end_frame = ff_vaapi_mpeg_end_frame,
345 .decode_slice = vaapi_vc1_decode_slice,346 .decode_slice = vaapi_vc1_decode_slice,
347 .init = ff_vaapi_context_init,
348 .uninit = ff_vaapi_context_fini,
349 .priv_data_size = sizeof(FFVAContext),
346};350};
347#endif351#endif
348 352
@@ -354,4 +358,7 @@ AVHWAccel ff_vc1_vaapi_hwaccel = { · 5 unmodified lines
354 .start_frame = vaapi_vc1_start_frame,358 .start_frame = vaapi_vc1_start_frame,
355 .end_frame = ff_vaapi_mpeg_end_frame,359 .end_frame = ff_vaapi_mpeg_end_frame,
356 .decode_slice = vaapi_vc1_decode_slice,360 .decode_slice = vaapi_vc1_decode_slice,
361 .init = ff_vaapi_context_init,
362 .uninit = ff_vaapi_context_fini,
363 .priv_data_size = sizeof(FFVAContext),
357};364};
libavcodec/version.h+5−2
@@ -29,8 +29,8 @@ · 28 unmodified lines
29#include "libavutil/version.h"29#include "libavutil/version.h"
30 30
31#define LIBAVCODEC_VERSION_MAJOR 5631#define LIBAVCODEC_VERSION_MAJOR 56
32#define LIBAVCODEC_VERSION_MINOR 5732#define LIBAVCODEC_VERSION_MINOR 58
33#define LIBAVCODEC_VERSION_MICRO 10133#define LIBAVCODEC_VERSION_MICRO 100
34 34
35#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \35#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
36 LIBAVCODEC_VERSION_MINOR, \36 LIBAVCODEC_VERSION_MINOR, \
@@ -181,6 +181,9 @@ · 144 unmodified lines
181#ifndef FF_API_AUDIOENC_DELAY181#ifndef FF_API_AUDIOENC_DELAY
182#define FF_API_AUDIOENC_DELAY (LIBAVCODEC_VERSION_MAJOR < 58)182#define FF_API_AUDIOENC_DELAY (LIBAVCODEC_VERSION_MAJOR < 58)
183#endif183#endif
184#ifndef FF_API_VAAPI_CONTEXT
185#define FF_API_VAAPI_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 58)
186#endif
184#ifndef FF_API_AVCTX_TIMEBASE187#ifndef FF_API_AVCTX_TIMEBASE
185#define FF_API_AVCTX_TIMEBASE (LIBAVCODEC_VERSION_MAJOR < 59)188#define FF_API_AVCTX_TIMEBASE (LIBAVCODEC_VERSION_MAJOR < 59)
186#endif189#endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t