media: coda: pad first buffer with repeated MPEG headers to fix sequence init
authorPhilipp Zabel <p.zabel@pengutronix.de>
Tue, 18 Jun 2019 16:45:19 +0000 (12:45 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Mon, 24 Jun 2019 18:30:59 +0000 (14:30 -0400)
commit2719ef7d1b1107892923a1f5b7cbc28cccbdea3d
tree766f9f8eebeca0d55a33973ae74893d1feaa189f
parentccb901196ec5298458f2cd2c4c43652c3c0d5032
media: coda: pad first buffer with repeated MPEG headers to fix sequence init

If the first buffer contains only headers, the sequence initialization
command fails. On CodaHx4 the buffer must be padded to at least 512
bytes, on CODA960 it seems to be enough to just repeat the sequence and
extension headers (MPEG-2) or the VOS and VO headers (MPEG-4) once for
for sequence initialization to succeed without further bitstream data.
On CodaHx4 the headers can be repeated multiple times until the 512 byte
mark is reached.

A similar issue was solved for h.264 by padding with a filler NAL in
commit 0eef89403ece ("[media] coda: pad first h.264 buffer to 512
bytes").

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/platform/coda/coda-bit.c
drivers/media/platform/coda/coda-mpeg2.c
drivers/media/platform/coda/coda-mpeg4.c
drivers/media/platform/coda/coda.h