You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
Added ff_dxva2_ prefix to get_surface(_index) and commit_buffer functions.
Originally committed as revision 21403 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
@@ -37,14 +37,14 @@ struct dxva2_picture_context {
|
|||||||
unsigned bitstream_size;
|
unsigned bitstream_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void *get_surface(const Picture *picture)
|
static void *ff_dxva2_get_surface(const Picture *picture)
|
||||||
{
|
{
|
||||||
return picture->data[3];
|
return picture->data[3];
|
||||||
}
|
}
|
||||||
static unsigned get_surface_index(const struct dxva_context *ctx,
|
static unsigned ff_dxva2_get_surface_index(const struct dxva_context *ctx,
|
||||||
const Picture *picture)
|
const Picture *picture)
|
||||||
{
|
{
|
||||||
void *surface = get_surface(picture);
|
void *surface = ff_dxva2_get_surface(picture);
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
for (i = 0; i < ctx->surface_count; i++)
|
for (i = 0; i < ctx->surface_count; i++)
|
||||||
@@ -72,7 +72,7 @@ static void fill_picture_parameters(struct dxva_context *ctx, const H264Context
|
|||||||
memset(pp, 0, sizeof(*pp));
|
memset(pp, 0, sizeof(*pp));
|
||||||
/* Configure current picture */
|
/* Configure current picture */
|
||||||
fill_picture_entry(&pp->CurrPic,
|
fill_picture_entry(&pp->CurrPic,
|
||||||
get_surface_index(ctx, current_picture),
|
ff_dxva2_get_surface_index(ctx, current_picture),
|
||||||
s->picture_structure == PICT_BOTTOM_FIELD);
|
s->picture_structure == PICT_BOTTOM_FIELD);
|
||||||
/* Configure the set of references */
|
/* Configure the set of references */
|
||||||
pp->UsedForReferenceFlags = 0;
|
pp->UsedForReferenceFlags = 0;
|
||||||
@@ -88,7 +88,7 @@ static void fill_picture_parameters(struct dxva_context *ctx, const H264Context
|
|||||||
assert(r->long_ref);
|
assert(r->long_ref);
|
||||||
}
|
}
|
||||||
fill_picture_entry(&pp->RefFrameList[i],
|
fill_picture_entry(&pp->RefFrameList[i],
|
||||||
get_surface_index(ctx, r),
|
ff_dxva2_get_surface_index(ctx, r),
|
||||||
r->long_ref != 0);
|
r->long_ref != 0);
|
||||||
|
|
||||||
if ((r->reference & PICT_TOP_FIELD) && r->field_poc[0] != INT_MAX)
|
if ((r->reference & PICT_TOP_FIELD) && r->field_poc[0] != INT_MAX)
|
||||||
@@ -236,7 +236,7 @@ static void fill_slice_long(AVCodecContext *avctx, DXVA_Slice_H264_Long *slice,
|
|||||||
const Picture *r = &h->ref_list[list][i];
|
const Picture *r = &h->ref_list[list][i];
|
||||||
unsigned plane;
|
unsigned plane;
|
||||||
fill_picture_entry(&slice->RefPicList[list][i],
|
fill_picture_entry(&slice->RefPicList[list][i],
|
||||||
get_surface_index(ctx, r),
|
ff_dxva2_get_surface_index(ctx, r),
|
||||||
r->reference == PICT_BOTTOM_FIELD);
|
r->reference == PICT_BOTTOM_FIELD);
|
||||||
for (plane = 0; plane < 3; plane++) {
|
for (plane = 0; plane < 3; plane++) {
|
||||||
int w, o;
|
int w, o;
|
||||||
@@ -277,11 +277,11 @@ static void fill_slice_long(AVCodecContext *avctx, DXVA_Slice_H264_Long *slice,
|
|||||||
slice->slice_id = h->current_slice - 1;
|
slice->slice_id = h->current_slice - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int commit_buffer(AVCodecContext *avctx,
|
static int ff_dxva2_commit_buffer(AVCodecContext *avctx,
|
||||||
struct dxva_context *ctx,
|
struct dxva_context *ctx,
|
||||||
DXVA2_DecodeBufferDesc *dsc,
|
DXVA2_DecodeBufferDesc *dsc,
|
||||||
unsigned type, const void *data, unsigned size,
|
unsigned type, const void *data, unsigned size,
|
||||||
unsigned mb_count)
|
unsigned mb_count)
|
||||||
{
|
{
|
||||||
void *dxva_data;
|
void *dxva_data;
|
||||||
unsigned dxva_size;
|
unsigned dxva_size;
|
||||||
@@ -404,9 +404,9 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx,
|
|||||||
slice_size = ctx_pic->slice_count * sizeof(*ctx_pic->slice_long);
|
slice_size = ctx_pic->slice_count * sizeof(*ctx_pic->slice_long);
|
||||||
}
|
}
|
||||||
assert((bs->DataSize & 127) == 0);
|
assert((bs->DataSize & 127) == 0);
|
||||||
return commit_buffer(avctx, ctx, sc,
|
return ff_dxva2_commit_buffer(avctx, ctx, sc,
|
||||||
DXVA2_SliceControlBufferType,
|
DXVA2_SliceControlBufferType,
|
||||||
slice_data, slice_size, mb_count);
|
slice_data, slice_size, mb_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -478,15 +478,15 @@ static int ff_dxva2_common_end_frame(AVCodecContext *avctx, MpegEncContext *s,
|
|||||||
int result;
|
int result;
|
||||||
|
|
||||||
if (FAILED(IDirectXVideoDecoder_BeginFrame(ctx->decoder,
|
if (FAILED(IDirectXVideoDecoder_BeginFrame(ctx->decoder,
|
||||||
get_surface(s->current_picture_ptr),
|
ff_dxva2_get_surface(s->current_picture_ptr),
|
||||||
NULL))) {
|
NULL))) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Failed to begin frame\n");
|
av_log(avctx, AV_LOG_ERROR, "Failed to begin frame\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = commit_buffer(avctx, ctx, &buffer[buffer_count],
|
result = ff_dxva2_commit_buffer(avctx, ctx, &buffer[buffer_count],
|
||||||
DXVA2_PictureParametersBufferType,
|
DXVA2_PictureParametersBufferType,
|
||||||
pp, pp_size, 0);
|
pp, pp_size, 0);
|
||||||
if (result) {
|
if (result) {
|
||||||
av_log(avctx, AV_LOG_ERROR,
|
av_log(avctx, AV_LOG_ERROR,
|
||||||
"Failed to add picture parameter buffer\n");
|
"Failed to add picture parameter buffer\n");
|
||||||
@@ -495,9 +495,9 @@ static int ff_dxva2_common_end_frame(AVCodecContext *avctx, MpegEncContext *s,
|
|||||||
buffer_count++;
|
buffer_count++;
|
||||||
|
|
||||||
if (qm_size > 0) {
|
if (qm_size > 0) {
|
||||||
result = commit_buffer(avctx, ctx, &buffer[buffer_count],
|
result = ff_dxva2_commit_buffer(avctx, ctx, &buffer[buffer_count],
|
||||||
DXVA2_InverseQuantizationMatrixBufferType,
|
DXVA2_InverseQuantizationMatrixBufferType,
|
||||||
qm, qm_size, 0);
|
qm, qm_size, 0);
|
||||||
if (result) {
|
if (result) {
|
||||||
av_log(avctx, AV_LOG_ERROR,
|
av_log(avctx, AV_LOG_ERROR,
|
||||||
"Failed to add inverse quantization matrix buffer\n");
|
"Failed to add inverse quantization matrix buffer\n");
|
||||||
|
Reference in New Issue
Block a user