aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Zabel <p.zabel@pengutronix.de>2014-10-02 13:08:33 -0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-10-28 13:38:37 -0400
commit5269aed0f82e703533b7831a49ab76b955b01b6b (patch)
treecda0caf73e6ee8af1c198213e7c429100a80a6ad
parent7cbb105feff82722206613f3e4cee3e98df827d9 (diff)
[media] coda: pad input stream for JPEG decoder
Before starting a PIC_RUN, pad the bitstream with 0xff until 256 bytes past the next multiple of 256 bytes, if the buffer to be decoded is the last buffer in the bitstream. 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>
-rw-r--r--drivers/media/platform/coda/coda-bit.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c
index d1ecda54666e..27e0764e3ac5 100644
--- a/drivers/media/platform/coda/coda-bit.c
+++ b/drivers/media/platform/coda/coda-bit.c
@@ -1625,6 +1625,26 @@ static int coda_prepare_decode(struct coda_ctx *ctx)
1625 coda_write(dev, ctx->iram_info.axi_sram_use, 1625 coda_write(dev, ctx->iram_info.axi_sram_use,
1626 CODA7_REG_BIT_AXI_SRAM_USE); 1626 CODA7_REG_BIT_AXI_SRAM_USE);
1627 1627
1628 if (ctx->codec->src_fourcc == V4L2_PIX_FMT_JPEG) {
1629 struct coda_buffer_meta *meta;
1630
1631 /* If this is the last buffer in the bitstream, add padding */
1632 meta = list_first_entry(&ctx->buffer_meta_list,
1633 struct coda_buffer_meta, list);
1634 if (meta->end == (ctx->bitstream_fifo.kfifo.in &
1635 ctx->bitstream_fifo.kfifo.mask)) {
1636 static unsigned char buf[512];
1637 unsigned int pad;
1638
1639 /* Pad to multiple of 256 and then add 256 more */
1640 pad = ((0 - meta->end) & 0xff) + 256;
1641
1642 memset(buf, 0xff, sizeof(buf));
1643
1644 kfifo_in(&ctx->bitstream_fifo, buf, pad);
1645 }
1646 }
1647
1628 coda_kfifo_sync_to_device_full(ctx); 1648 coda_kfifo_sync_to_device_full(ctx);
1629 1649
1630 coda_command_async(ctx, CODA_COMMAND_PIC_RUN); 1650 coda_command_async(ctx, CODA_COMMAND_PIC_RUN);