FFmpeg
dxva2_vc1.c
Go to the documentation of this file.
1 /*
2  * DXVA2 WMV3/VC-1 HW acceleration.
3  *
4  * copyright (c) 2010 Laurent Aimar
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 "dxva2_internal.h"
26 #include "hwaccel_internal.h"
27 #include "mpegutils.h"
28 #include "mpegvideodec.h"
29 #include "vc1.h"
30 #include "vc1data.h"
31 
32 #define MAX_SLICES 1024
33 
34 struct dxva2_picture_context {
35  DXVA_PictureParameters pp;
36  unsigned slice_count;
37  DXVA_SliceInfo slice[MAX_SLICES];
38 
39  const uint8_t *bitstream;
40  unsigned bitstream_size;
41 };
42 
44  AVDXVAContext *ctx, const VC1Context *v,
45  DXVA_PictureParameters *pp)
46 {
47  const MpegEncContext *s = &v->s;
48  const Picture *current_picture = s->current_picture_ptr;
49  int intcomp = 0;
50 
51  // determine if intensity compensation is needed
52  if (s->pict_type == AV_PICTURE_TYPE_P) {
53  if ((v->fcm == ILACE_FRAME && v->intcomp) || (v->fcm != ILACE_FRAME && v->mv_mode == MV_PMODE_INTENSITY_COMP)) {
54  if (v->lumscale != 32 || v->lumshift != 0 || (s->picture_structure != PICT_FRAME && (v->lumscale2 != 32 || v->lumshift2 != 0)))
55  intcomp = 1;
56  }
57  }
58 
59  memset(pp, 0, sizeof(*pp));
60  pp->wDecodedPictureIndex =
61  pp->wDeblockedPictureIndex = ff_dxva2_get_surface_index(avctx, ctx, current_picture->f);
62  if (s->pict_type != AV_PICTURE_TYPE_I && !v->bi_type)
63  pp->wForwardRefPictureIndex = ff_dxva2_get_surface_index(avctx, ctx, s->last_picture.f);
64  else
65  pp->wForwardRefPictureIndex = 0xffff;
66  if (s->pict_type == AV_PICTURE_TYPE_B && !v->bi_type)
67  pp->wBackwardRefPictureIndex = ff_dxva2_get_surface_index(avctx, ctx, s->next_picture.f);
68  else
69  pp->wBackwardRefPictureIndex = 0xffff;
70  if (v->profile == PROFILE_ADVANCED) {
71  /* It is the cropped width/height -1 of the frame */
72  pp->wPicWidthInMBminus1 = avctx->width - 1;
73  pp->wPicHeightInMBminus1= avctx->height - 1;
74  } else {
75  /* It is the coded width/height in macroblock -1 of the frame */
76  pp->wPicWidthInMBminus1 = s->mb_width - 1;
77  pp->wPicHeightInMBminus1= s->mb_height - 1;
78  }
79  pp->bMacroblockWidthMinus1 = 15;
80  pp->bMacroblockHeightMinus1 = 15;
81  pp->bBlockWidthMinus1 = 7;
82  pp->bBlockHeightMinus1 = 7;
83  pp->bBPPminus1 = 7;
84  if (s->picture_structure & PICT_TOP_FIELD)
85  pp->bPicStructure |= 0x01;
86  if (s->picture_structure & PICT_BOTTOM_FIELD)
87  pp->bPicStructure |= 0x02;
88  pp->bSecondField = v->interlace && v->fcm == ILACE_FIELD && v->second_field;
89  pp->bPicIntra = s->pict_type == AV_PICTURE_TYPE_I || v->bi_type;
90  pp->bPicBackwardPrediction = s->pict_type == AV_PICTURE_TYPE_B && !v->bi_type;
91  pp->bBidirectionalAveragingMode = (1 << 7) |
92  ((DXVA_CONTEXT_CFG_INTRARESID(avctx, ctx) != 0) << 6) |
93  ((DXVA_CONTEXT_CFG_RESIDACCEL(avctx, ctx) != 0) << 5) |
94  (intcomp << 4) |
95  ((v->profile == PROFILE_ADVANCED) << 3);
96  pp->bMVprecisionAndChromaRelation = ((v->mv_mode == MV_PMODE_1MV_HPEL_BILIN) << 3) |
97  (1 << 2) |
98  (0 << 1) |
99  (!s->quarter_sample );
100  pp->bChromaFormat = v->chromaformat;
101  DXVA_CONTEXT_REPORT_ID(avctx, ctx)++;
102  if (DXVA_CONTEXT_REPORT_ID(avctx, ctx) >= (1 << 16))
103  DXVA_CONTEXT_REPORT_ID(avctx, ctx) = 1;
104  pp->bPicScanFixed = DXVA_CONTEXT_REPORT_ID(avctx, ctx) >> 8;
105  pp->bPicScanMethod = DXVA_CONTEXT_REPORT_ID(avctx, ctx) & 0xff;
106  pp->bPicReadbackRequests = 0;
107  pp->bRcontrol = v->rnd;
108  pp->bPicSpatialResid8 = (v->panscanflag << 7) |
109  (v->refdist_flag << 6) |
110  (s->loop_filter << 5) |
111  (v->fastuvmc << 4) |
112  (v->extended_mv << 3) |
113  (v->dquant << 1) |
114  (v->vstransform );
115  pp->bPicOverflowBlocks = (v->quantizer_mode << 6) |
116  (v->multires << 5) |
117  (v->resync_marker << 4) |
118  (v->rangered << 3) |
119  (s->max_b_frames );
120  pp->bPicExtrapolation = (!v->interlace || v->fcm == PROGRESSIVE) ? 1 : 2;
121  pp->bPicDeblocked = ((!pp->bPicBackwardPrediction && v->overlap) << 6) |
122  ((v->profile != PROFILE_ADVANCED && v->rangeredfrm) << 5) |
123  (s->loop_filter << 1);
124  pp->bPicDeblockConfined = (v->postprocflag << 7) |
125  (v->broadcast << 6) |
126  (v->interlace << 5) |
127  (v->tfcntrflag << 4) |
128  (v->finterpflag << 3) |
129  ((s->pict_type != AV_PICTURE_TYPE_B) << 2) |
130  (v->psf << 1) |
131  (v->extended_dmv );
132  if (s->pict_type != AV_PICTURE_TYPE_I)
133  pp->bPic4MVallowed = v->mv_mode == MV_PMODE_MIXED_MV ||
136  if (v->profile == PROFILE_ADVANCED)
137  pp->bPicOBMC = (v->range_mapy_flag << 7) |
138  (v->range_mapy << 4) |
139  (v->range_mapuv_flag << 3) |
140  (v->range_mapuv );
141  pp->bPicBinPB = 0;
142  pp->bMV_RPS = (v->fcm == ILACE_FIELD && pp->bPicBackwardPrediction) ? v->refdist + 9 : 0;
143  pp->bReservedBits = v->pq;
144  if (s->picture_structure == PICT_FRAME) {
145  if (intcomp) {
146  pp->wBitstreamFcodes = v->lumscale;
147  pp->wBitstreamPCEelements = v->lumshift;
148  } else {
149  pp->wBitstreamFcodes = 32;
150  pp->wBitstreamPCEelements = 0;
151  }
152  } else {
153  /* Syntax: (top_field_param << 8) | bottom_field_param */
154  if (intcomp) {
155  pp->wBitstreamFcodes = (v->lumscale << 8) | v->lumscale2;
156  pp->wBitstreamPCEelements = (v->lumshift << 8) | v->lumshift2;
157  } else {
158  pp->wBitstreamFcodes = (32 << 8) | 32;
159  pp->wBitstreamPCEelements = 0;
160  }
161  }
162  pp->bBitstreamConcealmentNeed = 0;
163  pp->bBitstreamConcealmentMethod = 0;
164 }
165 
166 static void fill_slice(AVCodecContext *avctx, DXVA_SliceInfo *slice,
167  unsigned position, unsigned size)
168 {
169  const VC1Context *v = avctx->priv_data;
170  const MpegEncContext *s = &v->s;
171 
172  memset(slice, 0, sizeof(*slice));
173  slice->wHorizontalPosition = 0;
174  slice->wVerticalPosition = s->mb_y;
175  slice->dwSliceBitsInBuffer = 8 * size;
176  slice->dwSliceDataLocation = position;
177  slice->bStartCodeBitOffset = 0;
178  slice->bReservedBits = (s->pict_type == AV_PICTURE_TYPE_B && !v->bi_type) ? v->bfraction_lut_index + 9 : 0;
179  slice->wMBbitOffset = v->p_frame_skipped ? 0xffff : get_bits_count(&s->gb) + (avctx->codec_id == AV_CODEC_ID_VC1 ? 32 : 0);
180  /* XXX We store the index of the first MB and it will be fixed later */
181  slice->wNumberMBsInSlice = (s->mb_y >> v->field_mode) * s->mb_width + s->mb_x;
182  slice->wQuantizerScaleCode = v->pq;
183  slice->wBadSliceChopping = 0;
184 }
185 
189 {
190  const VC1Context *v = avctx->priv_data;
191  AVDXVAContext *ctx = DXVA_CONTEXT(avctx);
192  const MpegEncContext *s = &v->s;
193  struct dxva2_picture_context *ctx_pic = s->current_picture_ptr->hwaccel_picture_private;
194 
195  static const uint8_t start_code[] = { 0, 0, 1, 0x0d };
196  const unsigned start_code_size = avctx->codec_id == AV_CODEC_ID_VC1 ? sizeof(start_code) : 0;
197  const unsigned mb_count = s->mb_width * (s->mb_height >> v->field_mode);
198  DXVA_SliceInfo *slice = NULL;
199  void *dxva_data_ptr;
200  uint8_t *dxva_data, *current, *end;
201  unsigned dxva_size;
202  unsigned padding;
203  unsigned i;
204  unsigned type;
205 
206 #if CONFIG_D3D11VA
207  if (ff_dxva2_is_d3d11(avctx)) {
208  type = D3D11_VIDEO_DECODER_BUFFER_BITSTREAM;
209  if (FAILED(ID3D11VideoContext_GetDecoderBuffer(D3D11VA_CONTEXT(ctx)->video_context,
211  type,
212  &dxva_size, &dxva_data_ptr)))
213  return -1;
214  }
215 #endif
216 #if CONFIG_DXVA2
217  if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD) {
218  type = DXVA2_BitStreamDateBufferType;
219  if (FAILED(IDirectXVideoDecoder_GetBuffer(DXVA2_CONTEXT(ctx)->decoder,
220  type,
221  &dxva_data_ptr, &dxva_size)))
222  return -1;
223  }
224 #endif
225 
226  dxva_data = dxva_data_ptr;
227  current = dxva_data;
228  end = dxva_data + dxva_size;
229 
230  for (i = 0; i < ctx_pic->slice_count; i++) {
231  unsigned position, size;
232  slice = &ctx_pic->slice[i];
233  position = slice->dwSliceDataLocation;
234  size = slice->dwSliceBitsInBuffer / 8;
235  if (start_code_size + size > end - current) {
236  av_log(avctx, AV_LOG_ERROR, "Failed to build bitstream");
237  break;
238  }
239  slice->dwSliceDataLocation = current - dxva_data;
240 
241  if (i < ctx_pic->slice_count - 1)
242  slice->wNumberMBsInSlice =
243  slice[1].wNumberMBsInSlice - slice[0].wNumberMBsInSlice;
244  else
245  slice->wNumberMBsInSlice =
246  mb_count - slice[0].wNumberMBsInSlice;
247 
248  /* write the appropriate frame, field or slice start code */
249  if (start_code_size) {
250  memcpy(current, start_code, start_code_size);
251  if (i == 0 && v->second_field)
252  current[3] = 0x0c;
253  else if (i > 0)
254  current[3] = 0x0b;
255 
256  current += start_code_size;
257  slice->dwSliceBitsInBuffer += start_code_size * 8;
258  }
259 
260  memcpy(current, &ctx_pic->bitstream[position], size);
261  current += size;
262  }
263  padding = FFMIN(128 - ((current - dxva_data) & 127), end - current);
264  if (slice && padding > 0) {
265  memset(current, 0, padding);
266  current += padding;
267  slice->dwSliceBitsInBuffer += padding * 8;
268  }
269 
270 #if CONFIG_D3D11VA
271  if (ff_dxva2_is_d3d11(avctx))
272  if (FAILED(ID3D11VideoContext_ReleaseDecoderBuffer(D3D11VA_CONTEXT(ctx)->video_context, D3D11VA_CONTEXT(ctx)->decoder, type)))
273  return -1;
274 #endif
275 #if CONFIG_DXVA2
276  if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD)
277  if (FAILED(IDirectXVideoDecoder_ReleaseBuffer(DXVA2_CONTEXT(ctx)->decoder, type)))
278  return -1;
279 #endif
280  if (i < ctx_pic->slice_count)
281  return -1;
282 
283 #if CONFIG_D3D11VA
284  if (ff_dxva2_is_d3d11(avctx)) {
285  D3D11_VIDEO_DECODER_BUFFER_DESC *dsc11 = bs;
286  memset(dsc11, 0, sizeof(*dsc11));
287  dsc11->BufferType = type;
288  dsc11->DataSize = current - dxva_data;
289  dsc11->NumMBsInBuffer = mb_count;
290 
291  type = D3D11_VIDEO_DECODER_BUFFER_SLICE_CONTROL;
292  }
293 #endif
294 #if CONFIG_DXVA2
295  if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD) {
296  DXVA2_DecodeBufferDesc *dsc2 = bs;
297  memset(dsc2, 0, sizeof(*dsc2));
298  dsc2->CompressedBufferType = type;
299  dsc2->DataSize = current - dxva_data;
300  dsc2->NumMBsInBuffer = mb_count;
301 
302  type = DXVA2_SliceControlBufferType;
303  }
304 #endif
305 
306  return ff_dxva2_commit_buffer(avctx, ctx, sc,
307  type,
308  ctx_pic->slice,
309  ctx_pic->slice_count * sizeof(*ctx_pic->slice),
310  mb_count);
311 }
312 
314  av_unused const uint8_t *buffer,
315  av_unused uint32_t size)
316 {
317  const VC1Context *v = avctx->priv_data;
318  AVDXVAContext *ctx = DXVA_CONTEXT(avctx);
320 
321  if (!DXVA_CONTEXT_VALID(avctx, ctx))
322  return -1;
323  assert(ctx_pic);
324 
325  fill_picture_parameters(avctx, ctx, v, &ctx_pic->pp);
326 
327  ctx_pic->slice_count = 0;
328  ctx_pic->bitstream_size = 0;
329  ctx_pic->bitstream = NULL;
330  return 0;
331 }
332 
334  const uint8_t *buffer,
335  uint32_t size)
336 {
337  const VC1Context *v = avctx->priv_data;
338  const Picture *current_picture = v->s.current_picture_ptr;
339  struct dxva2_picture_context *ctx_pic = current_picture->hwaccel_picture_private;
340  unsigned position;
341 
342  if (ctx_pic->slice_count >= MAX_SLICES) {
343  avpriv_request_sample(avctx, "%d slices in dxva2",
344  ctx_pic->slice_count);
345  return -1;
346  }
347 
348  if (avctx->codec_id == AV_CODEC_ID_VC1 &&
349  size >= 4 && IS_MARKER(AV_RB32(buffer))) {
350  buffer += 4;
351  size -= 4;
352  }
353 
354  if (!ctx_pic->bitstream)
355  ctx_pic->bitstream = buffer;
356  ctx_pic->bitstream_size += size;
357 
358  position = buffer - ctx_pic->bitstream;
359  fill_slice(avctx, &ctx_pic->slice[ctx_pic->slice_count++], position, size);
360  return 0;
361 }
362 
364 {
365  VC1Context *v = avctx->priv_data;
367  int ret;
368 
369  if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0)
370  return -1;
371 
373  &ctx_pic->pp, sizeof(ctx_pic->pp),
374  NULL, 0,
376  return ret;
377 }
378 
379 #if CONFIG_WMV3_DXVA2_HWACCEL
381  .p.name = "wmv3_dxva2",
382  .p.type = AVMEDIA_TYPE_VIDEO,
383  .p.id = AV_CODEC_ID_WMV3,
384  .p.pix_fmt = AV_PIX_FMT_DXVA2_VLD,
385  .init = ff_dxva2_decode_init,
386  .uninit = ff_dxva2_decode_uninit,
387  .start_frame = dxva2_vc1_start_frame,
388  .decode_slice = dxva2_vc1_decode_slice,
389  .end_frame = dxva2_vc1_end_frame,
390  .frame_params = ff_dxva2_common_frame_params,
391  .frame_priv_data_size = sizeof(struct dxva2_picture_context),
392  .priv_data_size = sizeof(FFDXVASharedContext),
393 };
394 #endif
395 
396 #if CONFIG_VC1_DXVA2_HWACCEL
398  .p.name = "vc1_dxva2",
399  .p.type = AVMEDIA_TYPE_VIDEO,
400  .p.id = AV_CODEC_ID_VC1,
401  .p.pix_fmt = AV_PIX_FMT_DXVA2_VLD,
402  .init = ff_dxva2_decode_init,
403  .uninit = ff_dxva2_decode_uninit,
404  .start_frame = dxva2_vc1_start_frame,
405  .decode_slice = dxva2_vc1_decode_slice,
406  .end_frame = dxva2_vc1_end_frame,
407  .frame_params = ff_dxva2_common_frame_params,
408  .frame_priv_data_size = sizeof(struct dxva2_picture_context),
409  .priv_data_size = sizeof(FFDXVASharedContext),
410 };
411 #endif
412 
413 #if CONFIG_WMV3_D3D11VA_HWACCEL
415  .p.name = "wmv3_d3d11va",
416  .p.type = AVMEDIA_TYPE_VIDEO,
417  .p.id = AV_CODEC_ID_WMV3,
418  .p.pix_fmt = AV_PIX_FMT_D3D11VA_VLD,
419  .init = ff_dxva2_decode_init,
420  .uninit = ff_dxva2_decode_uninit,
421  .start_frame = dxva2_vc1_start_frame,
422  .decode_slice = dxva2_vc1_decode_slice,
423  .end_frame = dxva2_vc1_end_frame,
424  .frame_params = ff_dxva2_common_frame_params,
425  .frame_priv_data_size = sizeof(struct dxva2_picture_context),
426  .priv_data_size = sizeof(FFDXVASharedContext),
427 };
428 #endif
429 
430 #if CONFIG_WMV3_D3D11VA2_HWACCEL
432  .p.name = "wmv3_d3d11va2",
433  .p.type = AVMEDIA_TYPE_VIDEO,
434  .p.id = AV_CODEC_ID_WMV3,
435  .p.pix_fmt = AV_PIX_FMT_D3D11,
436  .init = ff_dxva2_decode_init,
437  .uninit = ff_dxva2_decode_uninit,
438  .start_frame = dxva2_vc1_start_frame,
439  .decode_slice = dxva2_vc1_decode_slice,
440  .end_frame = dxva2_vc1_end_frame,
441  .frame_params = ff_dxva2_common_frame_params,
442  .frame_priv_data_size = sizeof(struct dxva2_picture_context),
443  .priv_data_size = sizeof(FFDXVASharedContext),
444 };
445 #endif
446 
447 #if CONFIG_VC1_D3D11VA_HWACCEL
449  .p.name = "vc1_d3d11va",
450  .p.type = AVMEDIA_TYPE_VIDEO,
451  .p.id = AV_CODEC_ID_VC1,
452  .p.pix_fmt = AV_PIX_FMT_D3D11VA_VLD,
453  .init = ff_dxva2_decode_init,
454  .uninit = ff_dxva2_decode_uninit,
455  .start_frame = dxva2_vc1_start_frame,
456  .decode_slice = dxva2_vc1_decode_slice,
457  .end_frame = dxva2_vc1_end_frame,
458  .frame_params = ff_dxva2_common_frame_params,
459  .frame_priv_data_size = sizeof(struct dxva2_picture_context),
460  .priv_data_size = sizeof(FFDXVASharedContext),
461 };
462 #endif
463 
464 #if CONFIG_VC1_D3D11VA2_HWACCEL
466  .p.name = "vc1_d3d11va2",
467  .p.type = AVMEDIA_TYPE_VIDEO,
468  .p.id = AV_CODEC_ID_VC1,
469  .p.pix_fmt = AV_PIX_FMT_D3D11,
470  .init = ff_dxva2_decode_init,
471  .uninit = ff_dxva2_decode_uninit,
472  .start_frame = dxva2_vc1_start_frame,
473  .decode_slice = dxva2_vc1_decode_slice,
474  .end_frame = dxva2_vc1_end_frame,
475  .frame_params = ff_dxva2_common_frame_params,
476  .frame_priv_data_size = sizeof(struct dxva2_picture_context),
477  .priv_data_size = sizeof(FFDXVASharedContext),
478 };
479 #endif
PICT_FRAME
#define PICT_FRAME
Definition: mpegutils.h:38
VC1Context::lumscale2
uint8_t lumscale2
for interlaced field P picture
Definition: vc1.h:335
VC1Context
The VC1 Context.
Definition: vc1.h:173
PROGRESSIVE
@ PROGRESSIVE
in the bitstream is reported as 00b
Definition: vc1.h:149
VC1Context::intcomp
int intcomp
Definition: vc1.h:334
VC1Context::overlap
int overlap
overlapped transforms in use
Definition: vc1.h:224
VC1Context::interlace
int interlace
Progressive/interlaced (RPTFTM syntax element)
Definition: vc1.h:199
vc1.h
ILACE_FRAME
@ ILACE_FRAME
in the bitstream is reported as 10b
Definition: vc1.h:150
dxva2_vc1_start_frame
static int dxva2_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
Definition: dxva2_vc1.c:313
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
MV_PMODE_1MV_HPEL_BILIN
@ MV_PMODE_1MV_HPEL_BILIN
Definition: vc1.h:79
start_code
static const uint8_t start_code[]
Definition: videotoolboxenc.c:218
ff_dxva2_common_end_frame
int ff_dxva2_common_end_frame(AVCodecContext *avctx, AVFrame *frame, const void *pp, unsigned pp_size, const void *qm, unsigned qm_size, int(*commit_bs_si)(AVCodecContext *, DECODER_BUFFER_DESC *bs, DECODER_BUFFER_DESC *slice))
Definition: dxva2.c:886
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
AV_PIX_FMT_D3D11VA_VLD
@ AV_PIX_FMT_D3D11VA_VLD
HW decoding through Direct3D11 via old API, Picture.data[3] contains a ID3D11VideoDecoderOutputView p...
Definition: pixfmt.h:247
dxva2_picture_context::pp
DXVA_PicParams_H264 pp
Definition: dxva2_h264.c:35
PICT_BOTTOM_FIELD
#define PICT_BOTTOM_FIELD
Definition: mpegutils.h:37
Picture
Picture.
Definition: mpegpicture.h:46
mpegutils.h
ff_wmv3_d3d11va_hwaccel
const struct FFHWAccel ff_wmv3_d3d11va_hwaccel
decoder
static const chunk_decoder decoder[8]
Definition: dfa.c:331
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
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
dxva2_vc1_end_frame
static int dxva2_vc1_end_frame(AVCodecContext *avctx)
Definition: dxva2_vc1.c:363
VC1Context::dquant
int dquant
How qscale varies with MBs, 2 bits (not in Simple)
Definition: vc1.h:222
VC1Context::refdist
int refdist
distance of the current picture from reference
Definition: vc1.h:352
mpegvideodec.h
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
DXVA2_CONTEXT
#define DXVA2_CONTEXT(ctx)
Definition: dxva2_internal.h:102
AV_PIX_FMT_DXVA2_VLD
@ AV_PIX_FMT_DXVA2_VLD
HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer.
Definition: pixfmt.h:127
s
#define s(width, name)
Definition: cbs_vp9.c:198
VC1Context::range_mapuv_flag
uint8_t range_mapuv_flag
Definition: vc1.h:326
VC1Context::postprocflag
int postprocflag
Per-frame processing suggestion flag present.
Definition: vc1.h:197
DXVA_CONTEXT
#define DXVA_CONTEXT(avctx)
Definition: dxva2_internal.h:99
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
ctx
AVFormatContext * ctx
Definition: movenc.c:48
PICT_TOP_FIELD
#define PICT_TOP_FIELD
Definition: mpegutils.h:36
VC1Context::rnd
int rnd
rounding control
Definition: vc1.h:296
Picture::hwaccel_picture_private
void * hwaccel_picture_private
RefStruct reference for hardware accelerator private data.
Definition: mpegpicture.h:70
AVCodecContext::codec_id
enum AVCodecID codec_id
Definition: avcodec.h:451
dxva2_internal.h
VC1Context::mv_mode
uint8_t mv_mode
Frame decoding info for all profiles.
Definition: vc1.h:231
if
if(ret)
Definition: filter_design.txt:179
VC1Context::pq
uint8_t pq
Definition: vc1.h:236
AV_CODEC_ID_WMV3
@ AV_CODEC_ID_WMV3
Definition: codec_id.h:123
NULL
#define NULL
Definition: coverity.c:32
VC1Context::range_mapy_flag
uint8_t range_mapy_flag
Definition: vc1.h:325
ff_dxva2_decode_init
int ff_dxva2_decode_init(AVCodecContext *avctx)
Definition: dxva2.c:655
hwaccel_internal.h
VC1Context::lumscale
uint8_t lumscale
Luma compensation parameters.
Definition: vc1.h:267
VC1Context::field_mode
int field_mode
1 for interlaced field pictures
Definition: vc1.h:349
VC1Context::panscanflag
int panscanflag
NUMPANSCANWIN, TOPLEFT{X,Y}, BOTRIGHT{X,Y} present.
Definition: vc1.h:201
VC1Context::range_mapuv
uint8_t range_mapuv
Definition: vc1.h:328
AV_PICTURE_TYPE_I
@ AV_PICTURE_TYPE_I
Intra.
Definition: avutil.h:279
IS_MARKER
#define IS_MARKER(state)
Definition: dca_parser.c:51
VC1Context::resync_marker
int resync_marker
could this stream contain resync markers
Definition: vc1.h:398
FFDXVASharedContext
Definition: dxva2_internal.h:67
dxva2_picture_context
Definition: dxva2_h264.c:34
VC1Context::refdist_flag
int refdist_flag
REFDIST syntax element present in II, IP, PI or PP field picture headers.
Definition: vc1.h:202
VC1Context::mv_mode2
uint8_t mv_mode2
Secondary MV coding mode (B-frames)
Definition: vc1.h:232
dxva2_picture_context::slice_count
unsigned slice_count
Definition: dxva2_h264.c:37
MV_PMODE_MIXED_MV
@ MV_PMODE_MIXED_MV
Definition: vc1.h:82
size
int size
Definition: twinvq_data.h:10344
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
VC1Context::rangeredfrm
uint8_t rangeredfrm
Frame decoding info for S/M profiles only.
Definition: vc1.h:301
AVDXVAContext
Definition: dxva2_internal.h:58
VC1Context::chromaformat
int chromaformat
2 bits, 2=4:2:0, only defined
Definition: vc1.h:196
DECODER_BUFFER_DESC
void DECODER_BUFFER_DESC
Definition: dxva2_internal.h:56
vc1data.h
AV_PIX_FMT_D3D11
@ AV_PIX_FMT_D3D11
Hardware surfaces for Direct3D11.
Definition: pixfmt.h:333
VC1Context::tfcntrflag
int tfcntrflag
TFCNTR present.
Definition: vc1.h:200
AVHWAccel::name
const char * name
Name of the hardware accelerated codec.
Definition: avcodec.h:2135
MpegEncContext::current_picture_ptr
Picture * current_picture_ptr
pointer to the current picture
Definition: mpegvideo.h:173
D3D11VA_CONTEXT
#define D3D11VA_CONTEXT(ctx)
Definition: dxva2_internal.h:101
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
VC1Context::s
MpegEncContext s
Definition: vc1.h:174
ff_vc1_d3d11va2_hwaccel
const struct FFHWAccel ff_vc1_d3d11va2_hwaccel
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
VC1Context::extended_mv
int extended_mv
Ext MV in P/B (not in Simple)
Definition: vc1.h:221
ff_dxva2_commit_buffer
int ff_dxva2_commit_buffer(AVCodecContext *avctx, AVDXVAContext *ctx, DECODER_BUFFER_DESC *dsc, unsigned type, const void *data, unsigned size, unsigned mb_count)
Definition: dxva2.c:797
AV_CODEC_ID_VC1
@ AV_CODEC_ID_VC1
Definition: codec_id.h:122
fill_picture_parameters
static void fill_picture_parameters(AVCodecContext *avctx, AVDXVAContext *ctx, const VC1Context *v, DXVA_PictureParameters *pp)
Definition: dxva2_vc1.c:43
AVCodecContext::height
int height
Definition: avcodec.h:621
AVCodecContext::pix_fmt
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:658
ff_wmv3_d3d11va2_hwaccel
const struct FFHWAccel ff_wmv3_d3d11va2_hwaccel
ff_dxva2_get_surface_index
unsigned ff_dxva2_get_surface_index(const AVCodecContext *avctx, const AVDXVAContext *ctx, const AVFrame *frame)
Definition: dxva2.c:770
ff_dxva2_common_frame_params
int ff_dxva2_common_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
Definition: dxva2.c:592
ff_wmv3_dxva2_hwaccel
const struct FFHWAccel ff_wmv3_dxva2_hwaccel
VC1Context::second_field
int second_field
Definition: vc1.h:351
ret
ret
Definition: filter_design.txt:187
dxva2_picture_context::slice
DXVA_SliceInfo slice[MAX_SLICES]
Definition: dxva2_mpeg2.c:37
dxva2_picture_context::bitstream
const uint8_t * bitstream
Definition: dxva2_h264.c:40
AVCodecContext
main external API structure.
Definition: avcodec.h:441
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
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
ff_dxva2_is_d3d11
int ff_dxva2_is_d3d11(const AVCodecContext *avctx)
Definition: dxva2.c:1051
Picture::f
struct AVFrame * f
Definition: mpegpicture.h:47
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::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
ff_dxva2_decode_uninit
int ff_dxva2_decode_uninit(AVCodecContext *avctx)
Definition: dxva2.c:730
VC1Context::psf
int psf
Progressive Segmented Frame.
Definition: vc1.h:209
avpriv_request_sample
#define avpriv_request_sample(...)
Definition: tableprint_vlc.h:36
VC1Context::lumshift
uint8_t lumshift
Definition: vc1.h:268
ff_vc1_d3d11va_hwaccel
const struct FFHWAccel ff_vc1_d3d11va_hwaccel
commit_bitstream_and_slice_buffer
static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx, DECODER_BUFFER_DESC *bs, DECODER_BUFFER_DESC *sc)
Definition: dxva2_vc1.c:186
VC1Context::broadcast
int broadcast
TFF/RFF present.
Definition: vc1.h:198
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:468
ff_vc1_dxva2_hwaccel
const struct FFHWAccel ff_vc1_dxva2_hwaccel
dxva2_vc1_decode_slice
static int dxva2_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
Definition: dxva2_vc1.c:333
AVCodecContext::width
int width
picture width / height.
Definition: avcodec.h:621
VC1Context::finterpflag
int finterpflag
INTERPFRM present.
Definition: vc1.h:226
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
VC1Context::quantizer_mode
int quantizer_mode
2 bits, quantizer mode used for sequence, see QUANT_*
Definition: vc1.h:225
MAX_SLICES
#define MAX_SLICES
Definition: dxva2_vc1.c:32
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
fill_slice
static void fill_slice(AVCodecContext *avctx, DXVA_SliceInfo *slice, unsigned position, unsigned size)
Definition: dxva2_vc1.c:166
dxva2_picture_context::bitstream_size
unsigned bitstream_size
Definition: dxva2_h264.c:41