aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/media/sunxi/cedrus/cedrus_dec.c
diff options
context:
space:
mode:
authorPaul Kocialkowski <paul.kocialkowski@bootlin.com>2019-01-09 12:19:20 -0200
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-01-21 15:43:42 -0200
commitcf20ae1535eb690a87c29b9cc7af51881384e967 (patch)
tree828a03870574cd050371f0464402de66402863c6 /drivers/staging/media/sunxi/cedrus/cedrus_dec.c
parent6f4b9d9a6c08f692f627700c2d0e250e406ac81f (diff)
media: cedrus: Allow using the current dst buffer as reference
It was reported that some cases of interleaved video decoding require using the current destination buffer as a reference. However, this is no longer possible after the move to vb2_find_timestamp because only dequeued and done buffers are considered. Add a helper in our driver that also considers the current destination buffer before resorting to vb2_find_timestamp and use it in MPEG-2. Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/staging/media/sunxi/cedrus/cedrus_dec.c')
-rw-r--r--drivers/staging/media/sunxi/cedrus/cedrus_dec.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_dec.c b/drivers/staging/media/sunxi/cedrus/cedrus_dec.c
index 443fb037e1cf..2c295286766c 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus_dec.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_dec.c
@@ -22,6 +22,19 @@
#include "cedrus_dec.h"
#include "cedrus_hw.h"
+int cedrus_reference_index_find(struct vb2_queue *queue,
+ struct vb2_buffer *vb2_buf, u64 timestamp)
+{
+ /*
+ * Allow using the current capture buffer as reference, which can occur
+ * for field-coded pictures.
+ */
+ if (vb2_buf->timestamp == timestamp)
+ return vb2_buf->index;
+ else
+ return vb2_find_timestamp(queue, timestamp, 0);
+}
+
void cedrus_device_run(void *priv)
{
struct cedrus_ctx *ctx = priv;

Privacy Policy