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