[media] coda: try to only queue a single JPEG into the bitstream
authorPhilipp Zabel <p.zabel@pengutronix.de>
Thu, 2 Oct 2014 17:08:34 +0000 (14:08 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 28 Oct 2014 17:39:01 +0000 (15:39 -0200)
With bitstream padding, it is possible to decode a single JPEG in the bitstream
immediately. This allows us to only ever queue a single JPEG into the bitstream
buffer, except to increase payload over 512 bytes or to back out of hold state.
This is a measure to decrease JPEG decoder latency.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/platform/coda/coda-bit.c

index 27e0764e3ac5293b075a12c11e316af82255c7ed..2a6810e47a5c42b614b161fc307336384dbb85f5 100644 (file)
@@ -221,6 +221,14 @@ void coda_fill_bitstream(struct coda_ctx *ctx)
        u32 start;
 
        while (v4l2_m2m_num_src_bufs_ready(ctx->fh.m2m_ctx) > 0) {
+               /*
+                * Only queue a single JPEG into the bitstream buffer, except
+                * to increase payload over 512 bytes or if in hold state.
+                */
+               if (ctx->codec->src_fourcc == V4L2_PIX_FMT_JPEG &&
+                   (coda_get_bitstream_payload(ctx) >= 512) && !ctx->hold)
+                       break;
+
                src_buf = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
 
                /* Buffer start position */