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