aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/coda/coda-h264.c
diff options
context:
space:
mode:
authorPhilipp Zabel <p.zabel@pengutronix.de>2014-07-23 11:28:44 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-08-21 16:25:22 -0400
commit4f4ee9ee88720e27b2e90e5dc3d9c086b069a316 (patch)
tree2b46cd356ae6301dabafae249992eb49ecd5624d /drivers/media/platform/coda/coda-h264.c
parent58b7677db01585736d2175f385dcfcc313aed3de (diff)
[media] coda: move H.264 helper function into separate file
Currently there is only the coda_h264_padding function, but we will have to add more H.264 specific helpers later. 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/platform/coda/coda-h264.c')
-rw-r--r--drivers/media/platform/coda/coda-h264.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/media/platform/coda/coda-h264.c b/drivers/media/platform/coda/coda-h264.c
new file mode 100644
index 000000000000..0b2fdbeea7cb
--- /dev/null
+++ b/drivers/media/platform/coda/coda-h264.c
@@ -0,0 +1,36 @@
1/*
2 * Coda multi-standard codec IP - H.264 helper functions
3 *
4 * Copyright (C) 2012 Vista Silicon S.L.
5 * Javier Martin, <javier.martin@vista-silicon.com>
6 * Xavier Duret
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13
14#include <linux/kernel.h>
15
16static const u8 coda_filler_nal[14] = { 0x00, 0x00, 0x00, 0x01, 0x0c, 0xff,
17 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80 };
18static const u8 coda_filler_size[8] = { 0, 7, 14, 13, 12, 11, 10, 9 };
19
20int coda_h264_padding(int size, char *p)
21{
22 int nal_size;
23 int diff;
24
25 diff = size - (size & ~0x7);
26 if (diff == 0)
27 return 0;
28
29 nal_size = coda_filler_size[diff];
30 memcpy(p, coda_filler_nal, nal_size);
31
32 /* Add rbsp stop bit and trailing at the end */
33 *(p + nal_size - 1) = 0x80;
34
35 return nal_size;
36}