summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian König <[email protected]>2013-08-28 18:55:56 +0200
committerChristian König <[email protected]>2013-08-29 08:51:12 +0200
commitaebd065a6493deb8df93d59b54452def207170fa (patch)
treeeb57494912b26fc3fa0de59af9d6de47b1cbccd7 /src
parent57684d52e9a37a73dbcb6c71d04ea776b08bd003 (diff)
radeon/uvd: fix MPEG2/4 ref frame index limit
Otherwise the first few frames have an incorrect reference index. Signed-off-by: Christian König <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/radeon/radeon_uvd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gallium/drivers/radeon/radeon_uvd.c b/src/gallium/drivers/radeon/radeon_uvd.c
index f3652a64c9c..3e00977987b 100644
--- a/src/gallium/drivers/radeon/radeon_uvd.c
+++ b/src/gallium/drivers/radeon/radeon_uvd.c
@@ -493,8 +493,8 @@ uint8_t pquant
/* extract the frame number from a referenced video buffer */
static uint32_t get_ref_pic_idx(struct ruvd_decoder *dec, struct pipe_video_buffer *ref)
{
- uint32_t min = dec->frame_number - NUM_MPEG2_REFS;
- uint32_t max = dec->frame_number - 1;
+ uint32_t min = MAX2(dec->frame_number, NUM_MPEG2_REFS) - NUM_MPEG2_REFS;
+ uint32_t max = MAX2(dec->frame_number, 1) - 1;
uintptr_t frame;
/* seems to be the most sane fallback */