FFmpeg
Loading...
Searching...
No Matches
vaapi_vc1.c
Go to the documentation of this file.
1/*
2 * VC-1 HW decode acceleration through VA API
3 *
4 * Copyright (C) 2008-2009 Splitted-Desktop Systems
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#include "config_components.h"
24
26#include "libavutil/mem.h"
27#include "hwaccel_internal.h"
28#include "mpegvideodec.h"
29#include "vaapi_decode.h"
30#include "vc1.h"
31
32/** Translate FFmpeg MV modes to VA API */
33static int get_VAMvModeVC1(enum MVModes mv_mode)
34{
35 switch (mv_mode) {
36 case MV_PMODE_1MV_HPEL_BILIN: return VAMvMode1MvHalfPelBilinear;
37 case MV_PMODE_1MV: return VAMvMode1Mv;
38 case MV_PMODE_1MV_HPEL: return VAMvMode1MvHalfPel;
39 case MV_PMODE_MIXED_MV: return VAMvModeMixedMv;
40 case MV_PMODE_INTENSITY_COMP: return VAMvModeIntensityCompensation;
41 }
42 return 0;
43}
44
45/** Check whether the MVTYPEMB bitplane is present */
46static inline int vc1_has_MVTYPEMB_bitplane(const VC1Context *v)
47{
48 if (v->mv_type_is_raw)
49 return 0;
50 return v->fcm == PROGRESSIVE &&
55}
56
57/** Check whether the SKIPMB bitplane is present */
58static inline int vc1_has_SKIPMB_bitplane(const VC1Context *v)
59{
60 if (v->skip_is_raw)
61 return 0;
62 return (v->fcm == PROGRESSIVE || v->fcm == ILACE_FRAME) &&
64 (v->s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type));
65}
66
67/** Check whether the DIRECTMB bitplane is present */
68static inline int vc1_has_DIRECTMB_bitplane(const VC1Context *v)
69{
70 if (v->dmb_is_raw)
71 return 0;
72 return (v->fcm == PROGRESSIVE || v->fcm == ILACE_FRAME) &&
73 (v->s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type);
74}
75
76/** Check whether the ACPRED bitplane is present */
77static inline int vc1_has_ACPRED_bitplane(const VC1Context *v)
78{
79 if (v->acpred_is_raw)
80 return 0;
81 return v->profile == PROFILE_ADVANCED &&
83 (v->s.pict_type == AV_PICTURE_TYPE_B && v->bi_type));
84}
85
86/** Check whether the OVERFLAGS bitplane is present */
87static inline int vc1_has_OVERFLAGS_bitplane(const VC1Context *v)
88{
89 if (v->overflg_is_raw)
90 return 0;
91 return v->profile == PROFILE_ADVANCED &&
93 (v->s.pict_type == AV_PICTURE_TYPE_B && v->bi_type)) &&
94 (v->overlap && v->pq <= 8) &&
96}
97
98/** Check whether the FIELDTX bitplane is present */
99static inline int vc1_has_FIELDTX_bitplane(const VC1Context *v)
100{
101 if (v->fieldtx_is_raw)
102 return 0;
103 return v->fcm == ILACE_FRAME &&
105 (v->s.pict_type == AV_PICTURE_TYPE_B && v->bi_type));
106}
107
108/** Check whether the FORWARDMB bitplane is present */
109static inline int vc1_has_FORWARDMB_bitplane(const VC1Context *v)
110{
111 if (v->fmb_is_raw)
112 return 0;
113 return v->fcm == ILACE_FIELD &&
114 (v->s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type);
115}
116
117/** Reconstruct bitstream PTYPE (7.1.1.4, index into Table-35) */
118static int vc1_get_PTYPE(const VC1Context *v)
119{
120 const MpegEncContext *s = &v->s;
121 switch (s->pict_type) {
122 case AV_PICTURE_TYPE_I: return 0;
123 case AV_PICTURE_TYPE_P: return v->p_frame_skipped ? 4 : 1;
124 case AV_PICTURE_TYPE_B: return v->bi_type ? 3 : 2;
125 }
126 return 0;
127}
128
129/** Reconstruct bitstream FPTYPE (9.1.1.42, index into Table-105) */
130static int vc1_get_FPTYPE(const VC1Context *v)
131{
132 const MpegEncContext *s = &v->s;
133 switch (s->pict_type) {
134 case AV_PICTURE_TYPE_I: return 0;
135 case AV_PICTURE_TYPE_P: return 3;
136 case AV_PICTURE_TYPE_B: return v->bi_type ? 7 : 4;
137 }
138 return 0;
139}
140
141/** Reconstruct bitstream MVMODE (7.1.1.32) */
142static inline VAMvModeVC1 vc1_get_MVMODE(const VC1Context *v)
143{
144 if ((v->fcm == PROGRESSIVE || v->fcm == ILACE_FIELD) &&
146 (v->s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type)))
147 return get_VAMvModeVC1(v->mv_mode);
148 return 0;
149}
150
151/** Reconstruct bitstream MVMODE2 (7.1.1.33) */
152static inline VAMvModeVC1 vc1_get_MVMODE2(const VC1Context *v)
153{
154 if ((v->fcm == PROGRESSIVE || v->fcm == ILACE_FIELD) &&
157 return get_VAMvModeVC1(v->mv_mode2);
158 return 0;
159}
160
161av_unused static inline int vc1_get_INTCOMPFIELD(const VC1Context *v)
162{
163 if ((v->s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) &&
164 v->fcm == ILACE_FIELD &&
166 switch (v->intcompfield) {
167 case 1: return 1;
168 case 2: return 2;
169 case 3: return 0;
170 }
171 return 0;
172}
173
174static inline int vc1_get_LUMSCALE(const VC1Context *v)
175{
176 if (v->s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) {
177 if ((v->fcm == PROGRESSIVE && v->mv_mode == MV_PMODE_INTENSITY_COMP) ||
178 (v->fcm == ILACE_FRAME && v->intcomp))
179 return v->lumscale;
180 else if (v->fcm == ILACE_FIELD && v->mv_mode == MV_PMODE_INTENSITY_COMP)
181 switch (v->intcompfield) {
182 case 1: return v->lumscale;
183 case 2: return v->lumscale2;
184 case 3: return v->lumscale;
185 }
186 }
187 return 0;
188}
189
190static inline int vc1_get_LUMSHIFT(const VC1Context *v)
191{
192 if (v->s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) {
193 if ((v->fcm == PROGRESSIVE && v->mv_mode == MV_PMODE_INTENSITY_COMP) ||
194 (v->fcm == ILACE_FRAME && v->intcomp))
195 return v->lumshift;
196 else if (v->fcm == ILACE_FIELD && v->mv_mode == MV_PMODE_INTENSITY_COMP)
197 switch (v->intcompfield) {
198 case 1: return v->lumshift;
199 case 2: return v->lumshift2;
200 case 3: return v->lumshift;
201 }
202 }
203 return 0;
204}
205
206av_unused static inline int vc1_get_LUMSCALE2(const VC1Context *v)
207{
208 if ((v->s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) &&
209 v->fcm == ILACE_FIELD &&
211 v->intcompfield == 3)
212 return v->lumscale2;
213 return 0;
214}
215
216av_unused static inline int vc1_get_LUMSHIFT2(const VC1Context *v)
217{
218 if ((v->s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) &&
219 v->fcm == ILACE_FIELD &&
221 v->intcompfield == 3)
222 return v->lumshift2;
223 return 0;
224}
225
226/** Reconstruct bitstream TTFRM (7.1.1.41, Table-53) */
227static inline int vc1_get_TTFRM(const VC1Context *v)
228{
229 switch (v->ttfrm) {
230 case TT_8X8: return 0;
231 case TT_8X4: return 1;
232 case TT_4X8: return 2;
233 case TT_4X4: return 3;
234 }
235 return 0;
236}
237
238/** Pack FFmpeg bitplanes into a VABitPlaneBuffer element */
239static inline void vc1_pack_bitplanes(uint8_t *bitplane, int n, const uint8_t *ff_bp[3], int x, int y, int stride)
240{
241 const int bitplane_index = n / 2;
242 const int ff_bp_index = y * stride + x;
243 uint8_t v = 0;
244 if (ff_bp[0])
245 v = ff_bp[0][ff_bp_index];
246 if (ff_bp[1])
247 v |= ff_bp[1][ff_bp_index] << 1;
248 if (ff_bp[2])
249 v |= ff_bp[2][ff_bp_index] << 2;
250 bitplane[bitplane_index] = (bitplane[bitplane_index] << 4) | v;
251}
252
254 av_unused const AVBufferRef *buffer_ref,
255 av_unused const uint8_t *buffer,
256 av_unused uint32_t size)
257{
258 const VC1Context *v = avctx->priv_data;
259 const MpegEncContext *s = &v->s;
260 VAAPIDecodePicture *pic = s->cur_pic.ptr->hwaccel_picture_private;
261 VAPictureParameterBufferVC1 pic_param;
262 int err;
263
264 pic->output_surface = ff_vaapi_get_surface_id(s->cur_pic.ptr->f);
265
266 pic_param = (VAPictureParameterBufferVC1) {
267 .forward_reference_picture = VA_INVALID_ID,
268 .backward_reference_picture = VA_INVALID_ID,
269 .inloop_decoded_picture = VA_INVALID_ID,
270 .sequence_fields.bits = {
271 .pulldown = v->broadcast,
272 .interlace = v->interlace,
273 .tfcntrflag = v->tfcntrflag,
274 .finterpflag = v->finterpflag,
275 .psf = v->psf,
276 .multires = v->multires,
277 .overlap = v->overlap,
278 .syncmarker = v->resync_marker,
279 .rangered = v->rangered,
280 .max_b_frames = s->avctx->max_b_frames,
281 .profile = v->profile,
282 },
283 .coded_width = s->avctx->coded_width,
284 .coded_height = s->avctx->coded_height,
285 .entrypoint_fields.bits = {
286 .broken_link = v->broken_link,
287 .closed_entry = v->closed_entry,
288 .panscan_flag = v->panscanflag,
289 .loopfilter = v->loop_filter,
290 },
291 .conditional_overlap_flag = v->condover,
292 .fast_uvmc_flag = v->fastuvmc,
293 .range_mapping_fields.bits = {
294 .luma_flag = v->range_mapy_flag,
295 .luma = v->range_mapy,
296 .chroma_flag = v->range_mapuv_flag,
297 .chroma = v->range_mapuv,
298 },
299 .b_picture_fraction = v->bfraction_lut_index,
300 .cbp_table = (v->fcm == PROGRESSIVE ? v->cbptab : v->icbptab),
301 .mb_mode_table = v->mbmodetab,
302 .range_reduction_frame = v->rangeredfrm,
303 .rounding_control = v->rnd,
304 .post_processing = v->postproc,
305 .picture_resolution_index = v->respic,
306 .picture_fields.bits = {
307 .picture_type = (v->fcm == ILACE_FIELD ? vc1_get_FPTYPE(v) : vc1_get_PTYPE(v)),
308 .frame_coding_mode = v->fcm,
309 .top_field_first = v->tff,
310 .is_first_field = !v->second_field,
311 .intensity_compensation = v->intcomp,
312 },
313 .luma_scale = vc1_get_LUMSCALE(v),
314 .luma_shift = vc1_get_LUMSHIFT(v),
315#if VA_CHECK_VERSION(1, 1, 0)
316 .luma_scale2 = vc1_get_LUMSCALE2(v),
317 .luma_shift2 = vc1_get_LUMSHIFT2(v),
318 .intensity_compensation_field = vc1_get_INTCOMPFIELD(v),
319#endif
320 .raw_coding.flags = {
321 .mv_type_mb = v->mv_type_is_raw,
322 .direct_mb = v->dmb_is_raw,
323 .skip_mb = v->skip_is_raw,
324 .field_tx = v->fieldtx_is_raw,
325 .forward_mb = v->fmb_is_raw,
326 .ac_pred = v->acpred_is_raw,
327 .overflags = v->overflg_is_raw,
328 },
329 .bitplane_present.flags = {
330 .bp_mv_type_mb = vc1_has_MVTYPEMB_bitplane(v),
331 .bp_direct_mb = vc1_has_DIRECTMB_bitplane(v),
332 .bp_skip_mb = vc1_has_SKIPMB_bitplane(v),
333 .bp_field_tx = vc1_has_FIELDTX_bitplane(v),
334 .bp_forward_mb = vc1_has_FORWARDMB_bitplane(v),
335 .bp_ac_pred = vc1_has_ACPRED_bitplane(v),
336 .bp_overflags = vc1_has_OVERFLAGS_bitplane(v),
337 },
338 .reference_fields.bits = {
339 .reference_distance_flag = v->refdist_flag,
340 .reference_distance = v->refdist,
341 .num_reference_pictures = v->numref,
342 .reference_field_pic_indicator = v->reffield,
343 },
344 .mv_fields.bits = {
345 .mv_mode = vc1_get_MVMODE(v),
346 .mv_mode2 = vc1_get_MVMODE2(v),
347 .mv_table = (v->fcm == PROGRESSIVE ? v->mv_table_index : v->imvtab),
348 .two_mv_block_pattern_table = v->twomvbptab,
349 .four_mv_switch = v->fourmvswitch,
350 .four_mv_block_pattern_table = v->fourmvbptab,
351 .extended_mv_flag = v->extended_mv,
352 .extended_mv_range = v->mvrange,
353 .extended_dmv_flag = v->extended_dmv,
354 .extended_dmv_range = v->dmvrange,
355 },
356 .pic_quantizer_fields.bits = {
357 .dquant = v->dquant,
358 .quantizer = v->quantizer_mode,
359 .half_qp = v->halfpq,
360 .pic_quantizer_scale = v->pq,
361 .pic_quantizer_type = v->pquantizer,
362 .dq_frame = v->dquantfrm,
363 .dq_profile = v->dqprofile,
364 .dq_sb_edge = v->dqprofile == DQPROFILE_SINGLE_EDGE ? v->dqsbedge : 0,
365 .dq_db_edge = v->dqprofile == DQPROFILE_DOUBLE_EDGES ? v->dqsbedge : 0,
366 .dq_binary_level = v->dqbilevel,
367 .alt_pic_quantizer = v->altpq,
368 },
369 .transform_fields.bits = {
370 .variable_sized_transform_flag = v->vstransform,
371 .mb_level_transform_type_flag = v->ttmbf,
372 .frame_level_transform_type = vc1_get_TTFRM(v),
373 .transform_ac_codingset_idx1 = v->c_ac_table_index,
374 .transform_ac_codingset_idx2 = v->y_ac_table_index,
375 .intra_transform_dc_table = v->dc_table_index,
376 },
377 };
378
379 switch (s->pict_type) {
381 if (s->next_pic.ptr)
382 pic_param.backward_reference_picture = ff_vaapi_get_surface_id(s->next_pic.ptr->f);
385 if (s->last_pic.ptr)
386 pic_param.forward_reference_picture = ff_vaapi_get_surface_id(s->last_pic.ptr->f);
387 break;
388 }
389
390 err = ff_vaapi_decode_make_param_buffer(avctx, pic,
391 VAPictureParameterBufferType,
392 &pic_param, sizeof(pic_param));
393 if (err)
394 goto fail;
395
396 if (pic_param.bitplane_present.value & 0x7f) {
397 uint8_t *bitplane;
398 const uint8_t *ff_bp[3];
399 int x, y, n;
400 size_t size = (s->mb_width * s->mb_height + 1) / 2;
401
402 bitplane = av_mallocz(size);
403 if (!bitplane) {
404 err = AVERROR(ENOMEM);
405 goto fail;
406 }
407
408 switch (s->pict_type) {
410 ff_bp[0] = pic_param.bitplane_present.flags.bp_direct_mb ? v->direct_mb_plane : NULL;
411 ff_bp[1] = pic_param.bitplane_present.flags.bp_skip_mb ? s->mbskip_table : NULL;
412 ff_bp[2] = pic_param.bitplane_present.flags.bp_mv_type_mb ? v->mv_type_mb_plane : NULL;
413 break;
415 if (!v->bi_type) {
416 ff_bp[0] = pic_param.bitplane_present.flags.bp_direct_mb ? v->direct_mb_plane : NULL;
417 ff_bp[1] = pic_param.bitplane_present.flags.bp_skip_mb ? s->mbskip_table : NULL;
418 ff_bp[2] = pic_param.bitplane_present.flags.bp_forward_mb ? v->forward_mb_plane : NULL;
419 break;
420 }
421 av_fallthrough; // (BI-type)
423 ff_bp[0] = pic_param.bitplane_present.flags.bp_field_tx ? v->fieldtx_plane : NULL;
424 ff_bp[1] = pic_param.bitplane_present.flags.bp_ac_pred ? v->acpred_plane : NULL;
425 ff_bp[2] = pic_param.bitplane_present.flags.bp_overflags ? v->over_flags_plane : NULL;
426 break;
427 default:
428 ff_bp[0] = NULL;
429 ff_bp[1] = NULL;
430 ff_bp[2] = NULL;
431 break;
432 }
433
434 n = 0;
435 for (y = 0; y < s->mb_height; y++)
436 for (x = 0; x < s->mb_width; x++, n++)
437 vc1_pack_bitplanes(bitplane, n, ff_bp, x, y, s->mb_stride);
438 if (n & 1) /* move last nibble to the high order */
439 bitplane[n/2] <<= 4;
440
441 err = ff_vaapi_decode_make_param_buffer(avctx, pic,
442 VABitPlaneBufferType,
443 bitplane, size);
444 av_free(bitplane);
445 if (err)
446 goto fail;
447 }
448 return 0;
449
450fail:
451 ff_vaapi_decode_cancel(avctx, pic);
452 return err;
453}
454
456{
457 VC1Context *v = avctx->priv_data;
458 MpegEncContext *s = &v->s;
459 VAAPIDecodePicture *pic = s->cur_pic.ptr->hwaccel_picture_private;
460 int ret;
461
462 ret = ff_vaapi_decode_issue(avctx, pic);
463 if (ret < 0)
464 goto fail;
465
466fail:
467 return ret;
468}
469
470static int vaapi_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
471{
472 const VC1Context *v = avctx->priv_data;
473 const MpegEncContext *s = &v->s;
474 VAAPIDecodePicture *pic = s->cur_pic.ptr->hwaccel_picture_private;
475 VASliceParameterBufferVC1 slice_param;
476 int mb_height;
477 int err;
478
479 /* Current bit buffer is beyond any marker for VC-1, so skip it */
480 if (avctx->codec_id == AV_CODEC_ID_VC1 && IS_MARKER(AV_RB32(buffer))) {
481 buffer += 4;
482 size -= 4;
483 }
484
485 if (v->fcm == ILACE_FIELD)
486 mb_height = avctx->coded_height + 31 >> 5;
487 else
488 mb_height = avctx->coded_height + 15 >> 4;
489
490 slice_param = (VASliceParameterBufferVC1) {
491 .slice_data_size = size,
492 .slice_data_offset = 0,
493 .slice_data_flag = VA_SLICE_DATA_FLAG_ALL,
494 .macroblock_offset = get_bits_count(&v->gb),
495 .slice_vertical_position = s->mb_y % mb_height,
496 };
497
498 err = ff_vaapi_decode_make_slice_buffer(avctx, pic,
499 &slice_param, 1, sizeof(slice_param),
500 buffer, size);
501 if (err < 0) {
502 ff_vaapi_decode_cancel(avctx, pic);
503 return err;
504 }
505
506 return 0;
507}
508
509#if CONFIG_WMV3_VAAPI_HWACCEL
511 .p.name = "wmv3_vaapi",
512 .p.type = AVMEDIA_TYPE_VIDEO,
513 .p.id = AV_CODEC_ID_WMV3,
514 .p.pix_fmt = AV_PIX_FMT_VAAPI,
515 .start_frame = &vaapi_vc1_start_frame,
516 .end_frame = &vaapi_vc1_end_frame,
517 .decode_slice = &vaapi_vc1_decode_slice,
518 .frame_priv_data_size = sizeof(VAAPIDecodePicture),
521 .frame_params = &ff_vaapi_common_frame_params,
522 .priv_data_size = sizeof(VAAPIDecodeContext),
523 .caps_internal = HWACCEL_CAP_ASYNC_SAFE,
524};
525#endif
526
528 .p.name = "vc1_vaapi",
529 .p.type = AVMEDIA_TYPE_VIDEO,
530 .p.id = AV_CODEC_ID_VC1,
531 .p.pix_fmt = AV_PIX_FMT_VAAPI,
532 .start_frame = &vaapi_vc1_start_frame,
533 .end_frame = &vaapi_vc1_end_frame,
534 .decode_slice = &vaapi_vc1_decode_slice,
535 .frame_priv_data_size = sizeof(VAAPIDecodePicture),
538 .frame_params = &ff_vaapi_common_frame_params,
539 .priv_data_size = sizeof(VAAPIDecodeContext),
540 .caps_internal = HWACCEL_CAP_ASYNC_SAFE,
541};
#define s(width, name)
Definition cbs_vp9.c:198
#define NULL
Definition coverity.c:32
#define IS_MARKER(state)
Definition dca_parser.c:52
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
static int get_bits_count(const GetBitContext *s)
Definition get_bits.h:254
#define fail
Definition test.h:479
@ AV_CODEC_ID_VC1
Definition codec_id.h:120
@ AV_CODEC_ID_WMV3
Definition codec_id.h:121
#define AVERROR(e)
Definition error.h:45
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
@ AV_PICTURE_TYPE_I
Intra.
Definition avutil.h:278
@ AV_PICTURE_TYPE_P
Predicted.
Definition avutil.h:279
@ AV_PICTURE_TYPE_B
Bi-dir predicted.
Definition avutil.h:280
#define HWACCEL_CAP_ASYNC_SAFE
Header providing the internals of AVHWAccel.
const struct FFHWAccel ff_vc1_vaapi_hwaccel
Definition vaapi_vc1.c:527
const struct FFHWAccel ff_wmv3_vaapi_hwaccel
#define AV_RB32(p)
static av_cold void uninit(AVBitStreamFilterContext *ctx)
Macro definitions for various function/variable attributes.
#define av_fallthrough
Definition attributes.h:67
#define av_unused
Definition attributes.h:164
Memory handling functions.
mpegvideo decoder header.
@ AV_PIX_FMT_VAAPI
Hardware acceleration through VA-API, data[3] contains a VASurfaceID.
Definition pixfmt.h:126
A reference to a data buffer.
Definition buffer.h:82
main external API structure.
Definition avcodec.h:443
enum AVCodecID codec_id
Definition avcodec.h:453
void * priv_data
Definition avcodec.h:470
MpegEncContext.
Definition mpegvideo.h:67
enum AVPictureType pict_type
AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
Definition mpegvideo.h:154
VASurfaceID output_surface
The VC1 Context.
Definition vc1.h:176
int loop_filter
Definition vc1.h:223
uint8_t lumshift2
Definition vc1.h:343
int tfcntrflag
TFCNTR present.
Definition vc1.h:204
int twomvbptab
Definition vc1.h:376
int profile
Sequence header data for all Profiles TODO: choose between ints, uint8_ts and monobit flags.
Definition vc1.h:220
int imvtab
Definition vc1.h:375
int cbptab
Definition vc1.h:308
uint8_t bfraction_lut_index
Index for BFRACTION value (see Table 40, reproduced into ff_vc1_bfraction_lut[])
Definition vc1.h:397
uint8_t lumshift
Definition vc1.h:277
int p_frame_skipped
Definition vc1.h:388
int skip_is_raw
skip mb plane is not coded
Definition vc1.h:300
int dquant
How qscale varies with MBs, 2 bits (not in Simple)
Definition vc1.h:227
uint8_t tff
Definition vc1.h:321
int reffield
if numref = 0 (1 reference) then reffield decides which
Definition vc1.h:362
int multires
frame-level RESPIC syntax element present
Definition vc1.h:188
uint8_t ttmbf
Transform type flag.
Definition vc1.h:265
int fieldtx_is_raw
Definition vc1.h:351
int finterpflag
INTERPFRM present.
Definition vc1.h:232
uint8_t range_mapuv_flag
Definition vc1.h:333
int extended_mv
Ext MV in P/B (not in Simple)
Definition vc1.h:226
uint8_t range_mapy_flag
Definition vc1.h:332
uint8_t pquantizer
Uniform (over sequence) quantizer in use.
Definition vc1.h:290
int bi_type
Definition vc1.h:389
int acpred_is_raw
Definition vc1.h:328
int icbptab
Definition vc1.h:374
int second_field
Definition vc1.h:358
int fourmvswitch
Definition vc1.h:340
uint8_t range_mapy
Definition vc1.h:334
uint8_t pq
Definition vc1.h:242
uint8_t altpq
Current/alternate frame quantizer scale.
Definition vc1.h:242
int extended_dmv
Additional extended dmv range at P/B-frame-level.
Definition vc1.h:207
uint8_t dqbilevel
Definition vc1.h:252
int panscanflag
NUMPANSCANWIN, TOPLEFT{X,Y}, BOTRIGHT{X,Y} present.
Definition vc1.h:205
uint8_t mv_mode2
Secondary MV coding mode (B-frames)
Definition vc1.h:238
int psf
Progressive Segmented Frame.
Definition vc1.h:213
int refdist
distance of the current picture from reference
Definition vc1.h:359
uint8_t broken_link
Broken link flag (BROKEN_LINK syntax element)
Definition vc1.h:398
uint8_t rangeredfrm
Frame decoding info for S/M profiles only.
Definition vc1.h:312
int quantizer_mode
2 bits, quantizer mode used for sequence, see QUANT_*
Definition vc1.h:231
int broadcast
TFF/RFF present.
Definition vc1.h:202
int refdist_flag
REFDIST syntax element present in II, IP, PI or PP field picture headers.
Definition vc1.h:206
MpegEncContext s
Definition vc1.h:177
int dc_table_index
Definition vc1.h:254
int overlap
overlapped transforms in use
Definition vc1.h:229
int fmb_is_raw
forward mb plane is raw
Definition vc1.h:299
GetBitContext gb
Definition vc1.h:178
uint8_t closed_entry
Closed entry point flag (CLOSED_ENTRY syntax element)
Definition vc1.h:399
int fourmvbptab
Definition vc1.h:377
int rnd
rounding control
Definition vc1.h:307
uint8_t mvrange
Ranges:
Definition vc1.h:289
int intcompfield
which of the two fields to be intensity compensated
Definition vc1.h:364
uint8_t dmvrange
Frame decoding info for interlaced picture.
Definition vc1.h:339
uint8_t range_mapuv
Definition vc1.h:335
uint8_t mv_mode
Frame decoding info for all profiles.
Definition vc1.h:237
uint8_t dquantfrm
pquant parameters
Definition vc1.h:249
int dmb_is_raw
direct mb plane is raw
Definition vc1.h:298
enum FrameCodingMode fcm
Frame decoding info for Advanced profile.
Definition vc1.h:318
int interlace
Progressive/interlaced (RPTFTM syntax element)
Definition vc1.h:203
uint8_t lumscale
Luma compensation parameters.
Definition vc1.h:276
int c_ac_table_index
AC coding set indexes.
Definition vc1.h:259
uint8_t lumscale2
for interlaced field P picture
Definition vc1.h:342
int mbmodetab
Definition vc1.h:373
int resync_marker
could this stream contain resync markers
Definition vc1.h:404
int ttfrm
Transform type info present at frame level.
Definition vc1.h:264
uint8_t dqprofile
Definition vc1.h:250
int y_ac_table_index
Luma index from AC2FRM element.
Definition vc1.h:260
uint8_t halfpq
Uniform quant over image and qp+.5.
Definition vc1.h:280
int mv_table_index
Definition vc1.h:293
uint8_t condover
Definition vc1.h:331
uint8_t respic
Frame-level flag for resized images.
Definition vc1.h:281
int fastuvmc
Rounding of qpel vector to hpel ? (not in Simple)
Definition vc1.h:225
int overflg_is_raw
Definition vc1.h:330
uint8_t dqsbedge
Definition vc1.h:251
int mv_type_is_raw
mv type mb plane is not coded
Definition vc1.h:297
uint8_t postproc
Definition vc1.h:323
int numref
number of past field pictures used as reference
Definition vc1.h:360
int intcomp
Definition vc1.h:341
int rangered
RANGEREDFRM (range reduction) syntax element present at frame level.
Definition vc1.h:191
int vstransform
variable-size [48]x[48] transform type + info
Definition vc1.h:228
#define stride
#define av_free(p)
#define av_mallocz(s)
static char buffer[20]
Definition seek.c:32
int size
int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx, VAAPIDecodePicture *pic, int type, const void *data, size_t size)
int ff_vaapi_common_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
int ff_vaapi_decode_issue(AVCodecContext *avctx, VAAPIDecodePicture *pic)
int ff_vaapi_decode_init(AVCodecContext *avctx)
int ff_vaapi_decode_uninit(AVCodecContext *avctx)
int ff_vaapi_decode_cancel(AVCodecContext *avctx, VAAPIDecodePicture *pic)
int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx, VAAPIDecodePicture *pic, const void *params_data, int nb_params, size_t params_size, const void *slice_data, size_t slice_size)
static VASurfaceID ff_vaapi_get_surface_id(AVFrame *pic)
static int get_VAMvModeVC1(enum MVModes mv_mode)
Translate FFmpeg MV modes to VA API.
Definition vaapi_vc1.c:33
static int vc1_get_LUMSCALE(const VC1Context *v)
Definition vaapi_vc1.c:174
static int vc1_has_OVERFLAGS_bitplane(const VC1Context *v)
Check whether the OVERFLAGS bitplane is present.
Definition vaapi_vc1.c:87
static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const AVBufferRef *buffer_ref, av_unused const uint8_t *buffer, av_unused uint32_t size)
Definition vaapi_vc1.c:253
static int vc1_get_PTYPE(const VC1Context *v)
Reconstruct bitstream PTYPE (7.1.1.4, index into Table-35)
Definition vaapi_vc1.c:118
static int vaapi_vc1_end_frame(AVCodecContext *avctx)
Definition vaapi_vc1.c:455
static av_unused int vc1_get_LUMSHIFT2(const VC1Context *v)
Definition vaapi_vc1.c:216
static av_unused int vc1_get_LUMSCALE2(const VC1Context *v)
Definition vaapi_vc1.c:206
static int vc1_has_SKIPMB_bitplane(const VC1Context *v)
Check whether the SKIPMB bitplane is present.
Definition vaapi_vc1.c:58
static av_unused int vc1_get_INTCOMPFIELD(const VC1Context *v)
Definition vaapi_vc1.c:161
static VAMvModeVC1 vc1_get_MVMODE2(const VC1Context *v)
Reconstruct bitstream MVMODE2 (7.1.1.33)
Definition vaapi_vc1.c:152
static int vaapi_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
Definition vaapi_vc1.c:470
static int vc1_get_TTFRM(const VC1Context *v)
Reconstruct bitstream TTFRM (7.1.1.41, Table-53)
Definition vaapi_vc1.c:227
static void vc1_pack_bitplanes(uint8_t *bitplane, int n, const uint8_t *ff_bp[3], int x, int y, int stride)
Pack FFmpeg bitplanes into a VABitPlaneBuffer element.
Definition vaapi_vc1.c:239
static int vc1_has_MVTYPEMB_bitplane(const VC1Context *v)
Check whether the MVTYPEMB bitplane is present.
Definition vaapi_vc1.c:46
static int vc1_has_DIRECTMB_bitplane(const VC1Context *v)
Check whether the DIRECTMB bitplane is present.
Definition vaapi_vc1.c:68
static int vc1_has_ACPRED_bitplane(const VC1Context *v)
Check whether the ACPRED bitplane is present.
Definition vaapi_vc1.c:77
static int vc1_has_FORWARDMB_bitplane(const VC1Context *v)
Check whether the FORWARDMB bitplane is present.
Definition vaapi_vc1.c:109
static int vc1_get_LUMSHIFT(const VC1Context *v)
Definition vaapi_vc1.c:190
static VAMvModeVC1 vc1_get_MVMODE(const VC1Context *v)
Reconstruct bitstream MVMODE (7.1.1.32)
Definition vaapi_vc1.c:142
static int vc1_get_FPTYPE(const VC1Context *v)
Reconstruct bitstream FPTYPE (9.1.1.42, index into Table-105)
Definition vaapi_vc1.c:130
static int vc1_has_FIELDTX_bitplane(const VC1Context *v)
Check whether the FIELDTX bitplane is present.
Definition vaapi_vc1.c:99
@ CONDOVER_SELECT
Definition vc1.h:142
@ TT_4X8
Definition vc1.h:121
@ TT_8X4
Definition vc1.h:118
@ TT_8X8
Definition vc1.h:115
@ TT_4X4
Definition vc1.h:122
@ PROGRESSIVE
in the bitstream is reported as 00b
Definition vc1.h:152
@ ILACE_FIELD
in the bitstream is reported as 11b
Definition vc1.h:154
@ ILACE_FRAME
in the bitstream is reported as 10b
Definition vc1.h:153
MVModes
MV modes for P-frames.
Definition vc1.h:81
@ MV_PMODE_INTENSITY_COMP
Definition vc1.h:86
@ MV_PMODE_1MV_HPEL
Definition vc1.h:84
@ MV_PMODE_1MV
Definition vc1.h:83
@ MV_PMODE_1MV_HPEL_BILIN
Definition vc1.h:82
@ MV_PMODE_MIXED_MV
Definition vc1.h:85
@ DQPROFILE_DOUBLE_EDGES
Definition vc1.h:52
@ DQPROFILE_SINGLE_EDGE
Definition vc1.h:53
@ PROFILE_ADVANCED
Definition vc1_common.h:52