From 9628a10ef165e817353e2723c3d320348a4584e9 Mon Sep 17 00:00:00 2001 From: Julian Scheel Date: Mon, 29 Dec 2008 12:00:38 +0000 Subject: Properly calculate the needed ref-frame count. --- src/libvdpau/vdpau_h264.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src') diff --git a/src/libvdpau/vdpau_h264.c b/src/libvdpau/vdpau_h264.c index d69aa0b5c..cbbe9b009 100644 --- a/src/libvdpau/vdpau_h264.c +++ b/src/libvdpau/vdpau_h264.c @@ -312,6 +312,21 @@ static void vdpau_h264_decode_data (video_decoder_t *this_gen, break; } + // Level 4.1 limits: + int ref_frames = 0; + if(this->nal_parser->current_nal->sps->num_ref_frames) { + ref_frames = this->nal_parser->current_nal->sps->num_ref_frames; + } else { + uint32_t round_width = (this->width + 15) & ~15; + uint32_t round_height = (this->height + 15) & ~15; + uint32_t surf_size = (round_width * round_height * 3) / 2; + ref_frames = (12 * 1024 * 1024) / surf_size; + } + + if (ref_frames > 16) { + ref_frames = 16; + } + /* get the vdpau context from vo */ //(this->stream->video_out->open) (this->stream->video_out, this->stream); img = this->stream->video_out->get_frame (this->stream->video_out, -- cgit v1.2.3