summaryrefslogtreecommitdiff
path: root/libavcodec/dxva2_h264.c
diff options
context:
space:
mode:
authorLaurent Aimar <fenrir@videolan.org>2010-05-14 23:08:23 +0000
committerLaurent Aimar <fenrir@videolan.org>2010-05-14 23:08:23 +0000
commitefb816ef64fc2d65fa75254d504f39ab00422fa4 (patch)
tree1d1ca65d71c6bd1dcc76814ed4179dbe7689f5a4 /libavcodec/dxva2_h264.c
parent58edb075f0469814911b7bdabcb664701e1a885a (diff)
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
Diffstat (limited to 'libavcodec/dxva2_h264.c')
-rw-r--r--libavcodec/dxva2_h264.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c
index 22c76df601..b0b126a70a 100644
--- a/libavcodec/dxva2_h264.c
+++ b/libavcodec/dxva2_h264.c
@@ -46,7 +46,7 @@ static void fill_picture_parameters(struct dxva_context *ctx, const H264Context
{
const MpegEncContext *s = &h->s;
const Picture *current_picture = s->current_picture_ptr;
- int i;
+ int i, j;
memset(pp, 0, sizeof(*pp));
/* Configure current picture */
@@ -56,16 +56,16 @@ static void fill_picture_parameters(struct dxva_context *ctx, const H264Context
/* Configure the set of references */
pp->UsedForReferenceFlags = 0;
pp->NonExistingFrameFlags = 0;
- for (i = 0; i < FF_ARRAY_ELEMS(pp->RefFrameList); i++) {
- if (i < h->short_ref_count + h->long_ref_count) {
+ for (i = 0, j = 0; i < FF_ARRAY_ELEMS(pp->RefFrameList); i++) {
const Picture *r;
- if (i < h->short_ref_count) {
- r = h->short_ref[i];
- assert(!r->long_ref);
+ if (j < h->short_ref_count) {
+ r = h->short_ref[j++];
} else {
- r = h->long_ref[i - h->short_ref_count];
- assert(r->long_ref);
+ r = NULL;
+ 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],
ff_dxva2_get_surface_index(ctx, r),
r->long_ref != 0);