Re: [PATCH AUTOSEL 4.19 097/158] media: coda: fix mpeg2 sequence number handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

> From: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>
> 
> [ 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



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux