diff options
author | Philipp Zabel <p.zabel@pengutronix.de> | 2014-07-11 09:36:38 (GMT) |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-07-22 15:12:47 (GMT) |
commit | 7c3df78953ca62c0713eae3d6b7cbc55b58cd9d5 (patch) | |
tree | 4462f93b044f2cf35b147c2958293cb504acd3d0 /drivers/media | |
parent | 1b0ed7be67f84b5381efb1b97740b2f66e0ecbfb (diff) | |
download | linux-7c3df78953ca62c0713eae3d6b7cbc55b58cd9d5.tar.xz |
[media] coda: round up internal frames to multiples of macroblock size for h.264
CODA7541 only supports encoding h.264 frames with width and height that are
multiples of the macroblock size.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/platform/coda.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c index 05419f4..aa80020 100644 --- a/drivers/media/platform/coda.c +++ b/drivers/media/platform/coda.c @@ -1744,15 +1744,21 @@ static void coda_free_framebuffers(struct coda_ctx *ctx) static int coda_alloc_framebuffers(struct coda_ctx *ctx, struct coda_q_data *q_data, u32 fourcc) { struct coda_dev *dev = ctx->dev; - int height = q_data->height; + int width, height; dma_addr_t paddr; int ysize; int ret; int i; - if (ctx->codec && ctx->codec->src_fourcc == V4L2_PIX_FMT_H264) - height = round_up(height, 16); - ysize = round_up(q_data->width, 8) * height; + if (ctx->codec && (ctx->codec->src_fourcc == V4L2_PIX_FMT_H264 || + ctx->codec->dst_fourcc == V4L2_PIX_FMT_H264)) { + width = round_up(q_data->width, 16); + height = round_up(q_data->height, 16); + } else { + width = round_up(q_data->width, 8); + height = q_data->height; + } + ysize = width * height; /* Allocate frame buffers */ for (i = 0; i < ctx->num_internal_frames; i++) { @@ -2377,7 +2383,16 @@ static int coda_start_encoding(struct coda_ctx *ctx) value = (q_data_src->width & CODADX6_PICWIDTH_MASK) << CODADX6_PICWIDTH_OFFSET; value |= (q_data_src->height & CODADX6_PICHEIGHT_MASK) << CODA_PICHEIGHT_OFFSET; break; - default: + case CODA_7541: + if (dst_fourcc == V4L2_PIX_FMT_H264) { + value = (round_up(q_data_src->width, 16) & + CODA7_PICWIDTH_MASK) << CODA7_PICWIDTH_OFFSET; + value |= (round_up(q_data_src->height, 16) & + CODA7_PICHEIGHT_MASK) << CODA_PICHEIGHT_OFFSET; + break; + } + /* fallthrough */ + case CODA_960: value = (q_data_src->width & CODA7_PICWIDTH_MASK) << CODA7_PICWIDTH_OFFSET; value |= (q_data_src->height & CODA7_PICHEIGHT_MASK) << CODA_PICHEIGHT_OFFSET; } |