X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fdxva2_h264.c;h=332a76302be4b7e0c72797471c39b5ddab194a21;hb=b06855f18a79d45b5ca212be89d84df3ee130cf7;hp=9262bb89575793a69bc113f195cf657828b1c016;hpb=6c389ddbd32d0e08d3db8510d55fc2d3924ea495;p=ffmpeg diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c index 9262bb89575..332a76302be 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) { - const Picture *r; - if (i < h->short_ref_count) { - r = h->short_ref[i]; - assert(!r->long_ref); - } else { - r = h->long_ref[i - h->short_ref_count]; - assert(r->long_ref); - } + for (i = 0, j = 0; i < FF_ARRAY_ELEMS(pp->RefFrameList); i++) { + const Picture *r; + if (j < h->short_ref_count) { + r = h->short_ref[j++]; + } else { + 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); @@ -425,7 +425,7 @@ static int end_frame(AVCodecContext *avctx) AVHWAccel h264_dxva2_hwaccel = { .name = "h264_dxva2", - .type = CODEC_TYPE_VIDEO, + .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_H264, .pix_fmt = PIX_FMT_DXVA2_VLD, .capabilities = 0,