MLK-20290: mxc-jpeg: Inject a default Huffman table for the decoder
authorMirela Rabulea <mirela.rabulea@nxp.com>
Wed, 26 Jun 2019 13:38:29 +0000 (16:38 +0300)
committerMirela Rabulea <mirela.rabulea@nxp.com>
Fri, 28 Jun 2019 12:41:11 +0000 (15:41 +0300)
commite9e47d5df75cf64561c12d9310a9bf555a875546
treefdc5f2cb1b5bb8434e5591f5a70b82b6b90797d1
parent1243603cf5b7d33abb8af2521570c5ac02e9d04e
MLK-20290: mxc-jpeg: Inject a default Huffman table for the decoder

So far, the configuration stream was used only for the encoder, but
it is actually possible to use it for the decoder too, in order to inject
a default Huffman table, because the CAST IP decoder gets stuck for jpegs
that do not contain any Huffman table.
Add dht_needed member in the context structure, and set it true when a
jpeg without any DHT marker is detected. In such case, the decoder will
also operate in 2 phases: first DHT injection, then user buffer decode;
this is done by chaining a configuration  descriptor before the decoding
descriptor. The configuration stream is set-up in the s_fmt ioctl with
the minimum resolution.

Also print an error when a jpeg smaller than the minimum size, 64x64
according to imx8qxp errata ERR050135, is detected.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
drivers/media/platform/imx8/mxc-jpeg.c
drivers/media/platform/imx8/mxc-jpeg.h