1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-24 13:56:33 +02:00

Fixed h264 long term support with dxva2 AVHWAccel.

Based on a commit for vaapi(r22869).

Originally committed as revision 23140 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Laurent Aimar 2010-05-14 23:08:23 +00:00
parent 58edb075f0
commit efb816ef64

View File

@ -46,7 +46,7 @@ static void fill_picture_parameters(struct dxva_context *ctx, const H264Context
{ {
const MpegEncContext *s = &h->s; const MpegEncContext *s = &h->s;
const Picture *current_picture = s->current_picture_ptr; const Picture *current_picture = s->current_picture_ptr;
int i; int i, j;
memset(pp, 0, sizeof(*pp)); memset(pp, 0, sizeof(*pp));
/* Configure current picture */ /* Configure current picture */
@ -56,16 +56,16 @@ static void fill_picture_parameters(struct dxva_context *ctx, const H264Context
/* Configure the set of references */ /* Configure the set of references */
pp->UsedForReferenceFlags = 0; pp->UsedForReferenceFlags = 0;
pp->NonExistingFrameFlags = 0; pp->NonExistingFrameFlags = 0;
for (i = 0; i < FF_ARRAY_ELEMS(pp->RefFrameList); i++) { for (i = 0, j = 0; i < FF_ARRAY_ELEMS(pp->RefFrameList); i++) {
if (i < h->short_ref_count + h->long_ref_count) {
const Picture *r; const Picture *r;
if (i < h->short_ref_count) { if (j < h->short_ref_count) {
r = h->short_ref[i]; r = h->short_ref[j++];
assert(!r->long_ref);
} else { } else {
r = h->long_ref[i - h->short_ref_count]; r = NULL;
assert(r->long_ref); while (!r && j < h->short_ref_count + 16)
r = h->long_ref[j++ - h->short_ref_count];
} }
if (r) {
fill_picture_entry(&pp->RefFrameList[i], fill_picture_entry(&pp->RefFrameList[i],
ff_dxva2_get_surface_index(ctx, r), ff_dxva2_get_surface_index(ctx, r),
r->long_ref != 0); r->long_ref != 0);