Revision e4833b5d libavcodec/dxva2_h264.c
libavcodec/dxva2_h264.c | ||
---|---|---|
37 | 37 |
unsigned bitstream_size; |
38 | 38 |
}; |
39 | 39 |
|
40 |
static void *get_surface(const Picture *picture) |
|
40 |
static void *ff_dxva2_get_surface(const Picture *picture)
|
|
41 | 41 |
{ |
42 | 42 |
return picture->data[3]; |
43 | 43 |
} |
44 |
static unsigned get_surface_index(const struct dxva_context *ctx, |
|
45 |
const Picture *picture) |
|
44 |
static unsigned ff_dxva2_get_surface_index(const struct dxva_context *ctx,
|
|
45 |
const Picture *picture)
|
|
46 | 46 |
{ |
47 |
void *surface = get_surface(picture); |
|
47 |
void *surface = ff_dxva2_get_surface(picture);
|
|
48 | 48 |
unsigned i; |
49 | 49 |
|
50 | 50 |
for (i = 0; i < ctx->surface_count; i++) |
... | ... | |
72 | 72 |
memset(pp, 0, sizeof(*pp)); |
73 | 73 |
/* Configure current picture */ |
74 | 74 |
fill_picture_entry(&pp->CurrPic, |
75 |
get_surface_index(ctx, current_picture), |
|
75 |
ff_dxva2_get_surface_index(ctx, current_picture),
|
|
76 | 76 |
s->picture_structure == PICT_BOTTOM_FIELD); |
77 | 77 |
/* Configure the set of references */ |
78 | 78 |
pp->UsedForReferenceFlags = 0; |
... | ... | |
88 | 88 |
assert(r->long_ref); |
89 | 89 |
} |
90 | 90 |
fill_picture_entry(&pp->RefFrameList[i], |
91 |
get_surface_index(ctx, r), |
|
91 |
ff_dxva2_get_surface_index(ctx, r),
|
|
92 | 92 |
r->long_ref != 0); |
93 | 93 |
|
94 | 94 |
if ((r->reference & PICT_TOP_FIELD) && r->field_poc[0] != INT_MAX) |
... | ... | |
236 | 236 |
const Picture *r = &h->ref_list[list][i]; |
237 | 237 |
unsigned plane; |
238 | 238 |
fill_picture_entry(&slice->RefPicList[list][i], |
239 |
get_surface_index(ctx, r), |
|
239 |
ff_dxva2_get_surface_index(ctx, r),
|
|
240 | 240 |
r->reference == PICT_BOTTOM_FIELD); |
241 | 241 |
for (plane = 0; plane < 3; plane++) { |
242 | 242 |
int w, o; |
... | ... | |
277 | 277 |
slice->slice_id = h->current_slice - 1; |
278 | 278 |
} |
279 | 279 |
|
280 |
static int commit_buffer(AVCodecContext *avctx, |
|
281 |
struct dxva_context *ctx, |
|
282 |
DXVA2_DecodeBufferDesc *dsc, |
|
283 |
unsigned type, const void *data, unsigned size, |
|
284 |
unsigned mb_count) |
|
280 |
static int ff_dxva2_commit_buffer(AVCodecContext *avctx,
|
|
281 |
struct dxva_context *ctx,
|
|
282 |
DXVA2_DecodeBufferDesc *dsc,
|
|
283 |
unsigned type, const void *data, unsigned size,
|
|
284 |
unsigned mb_count)
|
|
285 | 285 |
{ |
286 | 286 |
void *dxva_data; |
287 | 287 |
unsigned dxva_size; |
... | ... | |
404 | 404 |
slice_size = ctx_pic->slice_count * sizeof(*ctx_pic->slice_long); |
405 | 405 |
} |
406 | 406 |
assert((bs->DataSize & 127) == 0); |
407 |
return commit_buffer(avctx, ctx, sc, |
|
408 |
DXVA2_SliceControlBufferType, |
|
409 |
slice_data, slice_size, mb_count); |
|
407 |
return ff_dxva2_commit_buffer(avctx, ctx, sc,
|
|
408 |
DXVA2_SliceControlBufferType,
|
|
409 |
slice_data, slice_size, mb_count);
|
|
410 | 410 |
} |
411 | 411 |
|
412 | 412 |
|
... | ... | |
478 | 478 |
int result; |
479 | 479 |
|
480 | 480 |
if (FAILED(IDirectXVideoDecoder_BeginFrame(ctx->decoder, |
481 |
get_surface(s->current_picture_ptr), |
|
481 |
ff_dxva2_get_surface(s->current_picture_ptr),
|
|
482 | 482 |
NULL))) { |
483 | 483 |
av_log(avctx, AV_LOG_ERROR, "Failed to begin frame\n"); |
484 | 484 |
return -1; |
485 | 485 |
} |
486 | 486 |
|
487 |
result = commit_buffer(avctx, ctx, &buffer[buffer_count], |
|
488 |
DXVA2_PictureParametersBufferType, |
|
489 |
pp, pp_size, 0); |
|
487 |
result = ff_dxva2_commit_buffer(avctx, ctx, &buffer[buffer_count],
|
|
488 |
DXVA2_PictureParametersBufferType,
|
|
489 |
pp, pp_size, 0);
|
|
490 | 490 |
if (result) { |
491 | 491 |
av_log(avctx, AV_LOG_ERROR, |
492 | 492 |
"Failed to add picture parameter buffer\n"); |
... | ... | |
495 | 495 |
buffer_count++; |
496 | 496 |
|
497 | 497 |
if (qm_size > 0) { |
498 |
result = commit_buffer(avctx, ctx, &buffer[buffer_count], |
|
499 |
DXVA2_InverseQuantizationMatrixBufferType, |
|
500 |
qm, qm_size, 0); |
|
498 |
result = ff_dxva2_commit_buffer(avctx, ctx, &buffer[buffer_count],
|
|
499 |
DXVA2_InverseQuantizationMatrixBufferType,
|
|
500 |
qm, qm_size, 0);
|
|
501 | 501 |
if (result) { |
502 | 502 |
av_log(avctx, AV_LOG_ERROR, |
503 | 503 |
"Failed to add inverse quantization matrix buffer\n"); |
Also available in: Unified diff