Mercurial > libavcodec.hg
comparison dxva2_h264.c @ 11734:f85c4e46272e libavcodec
Fixed h264 long term support with dxva2 AVHWAccel.
Based on a commit for vaapi(r22869).
author | fenrir |
---|---|
date | Fri, 14 May 2010 23:08:23 +0000 |
parents | 8a4984c5cacc |
children | 9434d9083b94 |
comparison
equal
deleted
inserted
replaced
11733:0c1f5ab77b36 | 11734:f85c4e46272e |
---|---|
44 static void fill_picture_parameters(struct dxva_context *ctx, const H264Context *h, | 44 static void fill_picture_parameters(struct dxva_context *ctx, const H264Context *h, |
45 DXVA_PicParams_H264 *pp) | 45 DXVA_PicParams_H264 *pp) |
46 { | 46 { |
47 const MpegEncContext *s = &h->s; | 47 const MpegEncContext *s = &h->s; |
48 const Picture *current_picture = s->current_picture_ptr; | 48 const Picture *current_picture = s->current_picture_ptr; |
49 int i; | 49 int i, j; |
50 | 50 |
51 memset(pp, 0, sizeof(*pp)); | 51 memset(pp, 0, sizeof(*pp)); |
52 /* Configure current picture */ | 52 /* Configure current picture */ |
53 fill_picture_entry(&pp->CurrPic, | 53 fill_picture_entry(&pp->CurrPic, |
54 ff_dxva2_get_surface_index(ctx, current_picture), | 54 ff_dxva2_get_surface_index(ctx, current_picture), |
55 s->picture_structure == PICT_BOTTOM_FIELD); | 55 s->picture_structure == PICT_BOTTOM_FIELD); |
56 /* Configure the set of references */ | 56 /* Configure the set of references */ |
57 pp->UsedForReferenceFlags = 0; | 57 pp->UsedForReferenceFlags = 0; |
58 pp->NonExistingFrameFlags = 0; | 58 pp->NonExistingFrameFlags = 0; |
59 for (i = 0; i < FF_ARRAY_ELEMS(pp->RefFrameList); i++) { | 59 for (i = 0, j = 0; i < FF_ARRAY_ELEMS(pp->RefFrameList); i++) { |
60 if (i < h->short_ref_count + h->long_ref_count) { | |
61 const Picture *r; | 60 const Picture *r; |
62 if (i < h->short_ref_count) { | 61 if (j < h->short_ref_count) { |
63 r = h->short_ref[i]; | 62 r = h->short_ref[j++]; |
64 assert(!r->long_ref); | |
65 } else { | 63 } else { |
66 r = h->long_ref[i - h->short_ref_count]; | 64 r = NULL; |
67 assert(r->long_ref); | 65 while (!r && j < h->short_ref_count + 16) |
66 r = h->long_ref[j++ - h->short_ref_count]; | |
68 } | 67 } |
68 if (r) { | |
69 fill_picture_entry(&pp->RefFrameList[i], | 69 fill_picture_entry(&pp->RefFrameList[i], |
70 ff_dxva2_get_surface_index(ctx, r), | 70 ff_dxva2_get_surface_index(ctx, r), |
71 r->long_ref != 0); | 71 r->long_ref != 0); |
72 | 72 |
73 if ((r->reference & PICT_TOP_FIELD) && r->field_poc[0] != INT_MAX) | 73 if ((r->reference & PICT_TOP_FIELD) && r->field_poc[0] != INT_MAX) |