lkml.org 
[lkml]   [2019]   [Jul]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH AUTOSEL 4.19 097/158] media: coda: fix mpeg2 sequence number handling
Hi!

> From: Philipp Zabel <p.zabel@pengutronix.de>
>
> [ Upstream commit 56d159a4ec6d8da7313aac6fcbb95d8fffe689ba ]
>
> Sequence number handling assumed that the BIT processor frame number
> starts counting at 1, but this is not true for the MPEG-2 decoder,
> which starts at 0. Fix the sequence counter offset detection to handle
> this.

> +++ b/drivers/media/platform/coda/coda-bit.c
> @@ -1728,6 +1728,7 @@ static int __coda_start_decoding(struct coda_ctx *ctx)
> v4l2_err(&dev->v4l2_dev, "CODA_COMMAND_SEQ_INIT timeout\n");
> return ret;
> }
> + ctx->sequence_offset = ~0U;
> ctx->initialized = 1;
>
> /* Update kfifo out pointer from coda bitstream read pointer */
> @@ -2147,7 +2148,9 @@ static void coda_finish_decode(struct coda_ctx *ctx)
> v4l2_err(&dev->v4l2_dev,
> "decoded frame index out of range: %d\n", decoded_idx);
> } else {
> - val = coda_read(dev, CODA_RET_DEC_PIC_FRAME_NUM) - 1;
> + val = coda_read(dev, CODA_RET_DEC_PIC_FRAME_NUM);
> + if (ctx->sequence_offset == -1)
> + ctx->sequence_offset = val;

For consistency, would it be better to use == ~0U here, too? Variable is unsigned...

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

\
 
 \ /
  Last update: 2019-07-26 20:08    [W:0.451 / U:0.204 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site