diff options
author | Julian Scheel <julian@jusst.de> | 2008-12-22 13:38:43 +0000 |
---|---|---|
committer | Julian Scheel <julian@jusst.de> | 2008-12-22 13:38:43 +0000 |
commit | f06f61d118d95516bb92576c7ba1826e8eaa0d7f (patch) | |
tree | 67358097ac80a9b9fc4171e290e9cd78972408c4 | |
parent | a2ddf2d655168b7dfffd72b98cc800ffe7ab0965 (diff) | |
download | xine-lib-f06f61d118d95516bb92576c7ba1826e8eaa0d7f.tar.gz xine-lib-f06f61d118d95516bb92576c7ba1826e8eaa0d7f.tar.bz2 |
Fix interlaced playback on generation 3 decoders.
-rw-r--r-- | src/libvdpau/dpb.c | 8 | ||||
-rw-r--r-- | src/libvdpau/dpb.h | 4 | ||||
-rw-r--r-- | src/libvdpau/vdpau_h264.c | 4 |
3 files changed, 13 insertions, 3 deletions
diff --git a/src/libvdpau/dpb.c b/src/libvdpau/dpb.c index e397449f9..71bc1ce01 100644 --- a/src/libvdpau/dpb.c +++ b/src/libvdpau/dpb.c @@ -264,6 +264,7 @@ int dpb_add_picture(struct dpb *dpb, struct decoded_picture *pic, uint32_t num_r pic->next = dpb->pictures; dpb->pictures = pic; + dpb->num_ref_frames = num_ref_frames; dpb->used++; if(dpb->used > num_ref_frames) { @@ -318,12 +319,13 @@ void dpb_free_all( struct dpb *dpb ) printf("dpb_free_all, used: %d\n", dpb->used); } -void fill_vdpau_reference_list(struct dpb *dpb, VdpReferenceFrameH264 *reflist) +int fill_vdpau_reference_list(struct dpb *dpb, VdpReferenceFrameH264 *reflist) { struct decoded_picture *pic = dpb->pictures; struct decoded_picture *last_pic = NULL; int i = 0; + int used_refframes = 0; if (pic != NULL) do { @@ -345,6 +347,8 @@ void fill_vdpau_reference_list(struct dpb *dpb, VdpReferenceFrameH264 *reflist) last_pic = pic; } while ((pic = pic->next) != NULL && i < 16); + used_refframes = i; + // fill all other frames with invalid handles while(i < 16) { reflist[i].bottom_is_reference = VDP_FALSE; @@ -356,4 +360,6 @@ void fill_vdpau_reference_list(struct dpb *dpb, VdpReferenceFrameH264 *reflist) reflist[i].field_order_cnt[1] = 0; i++; } + + return used_refframes; } diff --git a/src/libvdpau/dpb.h b/src/libvdpau/dpb.h index 30a0da50b..3d313177c 100644 --- a/src/libvdpau/dpb.h +++ b/src/libvdpau/dpb.h @@ -46,6 +46,8 @@ struct decoded_picture { /* Decoded Picture Buffer */ struct dpb { struct decoded_picture *pictures; + + uint32_t num_ref_frames; uint32_t used; }; @@ -71,6 +73,6 @@ int dpb_add_picture(struct dpb *dpb, struct decoded_picture *pic, uint32_t num_r int dpb_flush(struct dpb *dpb); void dpb_free_all( struct dpb *dpb ); -void fill_vdpau_reference_list(struct dpb *dpb, VdpReferenceFrameH264 *reflist); +int fill_vdpau_reference_list(struct dpb *dpb, VdpReferenceFrameH264 *reflist); #endif /* DPB_H_ */ diff --git a/src/libvdpau/vdpau_h264.c b/src/libvdpau/vdpau_h264.c index 183ae2712..7fe570c40 100644 --- a/src/libvdpau/vdpau_h264.c +++ b/src/libvdpau/vdpau_h264.c @@ -390,7 +390,9 @@ static void vdpau_h264_decode_data (video_decoder_t *this_gen, memcpy(pic.scaling_lists_4x4, pps->scaling_lists_4x4, sizeof(pic.scaling_lists_4x4)); memcpy(pic.scaling_lists_8x8, pps->scaling_lists_8x8, sizeof(pic.scaling_lists_8x8)); - fill_vdpau_reference_list(&(this->nal_parser->dpb), pic.referenceFrames); + /* set num_ref_frames to the number of actually available reference frames, + * if this is not set generation 3 decoders will fail. */ + pic.num_ref_frames = fill_vdpau_reference_list(&(this->nal_parser->dpb), pic.referenceFrames); if(this->decoder_started || pic.is_reference) { if(!this->decoder_started) |