Commit ec4f021d authored by Philipp Zabel's avatar Philipp Zabel Committed by Mauro Carvalho Chehab

media: coda: jpeg: merge Huffman table bits and values

The Huffman bits tables are always 16 bytes long, and they are always
followed directly by the values tables, both in hardware and in JPEG
files. Just merge the two tables.
Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent eed569c4
...@@ -19,32 +19,29 @@ ...@@ -19,32 +19,29 @@
* chrominance from JPEG ITU-T.81 (ISO/IEC 10918-1) Annex K.3 * chrominance from JPEG ITU-T.81 (ISO/IEC 10918-1) Annex K.3
*/ */
static const unsigned char luma_dc_bits[16] = { static const unsigned char luma_dc[16 + 12] = {
/* bits */
0x00, 0x01, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}; /* values */
static const unsigned char luma_dc_value[12] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x08, 0x09, 0x0a, 0x0b,
}; };
static const unsigned char chroma_dc_bits[16] = { static const unsigned char chroma_dc[16 + 12] = {
/* bits */
0x00, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
}; /* values */
static const unsigned char chroma_dc_value[12] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x08, 0x09, 0x0a, 0x0b,
}; };
static const unsigned char luma_ac_bits[16] = { static const unsigned char luma_ac[16 + 162 + 2] = {
/* bits */
0x00, 0x02, 0x01, 0x03, 0x03, 0x02, 0x04, 0x03, 0x00, 0x02, 0x01, 0x03, 0x03, 0x02, 0x04, 0x03,
0x05, 0x05, 0x04, 0x04, 0x00, 0x00, 0x01, 0x7d, 0x05, 0x05, 0x04, 0x04, 0x00, 0x00, 0x01, 0x7d,
}; /* values */
static const unsigned char luma_ac_value[162 + 2] = {
0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12,
0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07, 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07,
0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08, 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08,
...@@ -68,12 +65,11 @@ static const unsigned char luma_ac_value[162 + 2] = { ...@@ -68,12 +65,11 @@ static const unsigned char luma_ac_value[162 + 2] = {
0xf9, 0xfa, /* padded to 32-bit */ 0xf9, 0xfa, /* padded to 32-bit */
}; };
static const unsigned char chroma_ac_bits[16] = { static const unsigned char chroma_ac[16 + 162 + 2] = {
/* bits */
0x00, 0x02, 0x01, 0x02, 0x04, 0x04, 0x03, 0x04, 0x00, 0x02, 0x01, 0x02, 0x04, 0x04, 0x03, 0x04,
0x07, 0x05, 0x04, 0x04, 0x00, 0x01, 0x02, 0x77, 0x07, 0x05, 0x04, 0x04, 0x00, 0x01, 0x02, 0x77,
}; /* values */
static const unsigned char chroma_ac_value[162 + 2] = {
0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21,
0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71, 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71,
0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91, 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91,
...@@ -148,14 +144,10 @@ int coda_jpeg_write_tables(struct coda_ctx *ctx) ...@@ -148,14 +144,10 @@ int coda_jpeg_write_tables(struct coda_ctx *ctx)
{ {
int i; int i;
static const struct coda_memcpy_desc huff[8] = { static const struct coda_memcpy_desc huff[8] = {
{ 0, luma_dc_bits, sizeof(luma_dc_bits) }, { 0, luma_dc, sizeof(luma_dc) },
{ 16, luma_dc_value, sizeof(luma_dc_value) }, { 32, luma_ac, sizeof(luma_ac) },
{ 32, luma_ac_bits, sizeof(luma_ac_bits) }, { 216, chroma_dc, sizeof(chroma_dc) },
{ 48, luma_ac_value, sizeof(luma_ac_value) }, { 248, chroma_ac, sizeof(chroma_ac) },
{ 216, chroma_dc_bits, sizeof(chroma_dc_bits) },
{ 232, chroma_dc_value, sizeof(chroma_dc_value) },
{ 248, chroma_ac_bits, sizeof(chroma_ac_bits) },
{ 264, chroma_ac_value, sizeof(chroma_ac_value) },
}; };
struct coda_memcpy_desc qmat[3] = { struct coda_memcpy_desc qmat[3] = {
{ 512, ctx->params.jpeg_qmat_tab[0], 64 }, { 512, ctx->params.jpeg_qmat_tab[0], 64 },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment