summaryrefslogtreecommitdiff
path: root/libhwjpeg
diff options
context:
space:
mode:
authorCho KyongHo <pullip.cho@samsung.com>2019-03-12 19:21:30 +0900
committerCho KyongHo <pullip.cho@samsung.com>2020-02-20 21:34:34 -0800
commitff443ff3513e734e69271182c573f32985223f33 (patch)
tree01b9d4e39dcdf81b3b22fcd4fa726f0e23c01c20 /libhwjpeg
parent035f1563cc5ef2c5e779229665fcbeb5f055b537 (diff)
libhwjpeg: change the order of quantization table
ExynosJpegEncoder::setQuality() allows users to specify two quantization tables for Luma and Chroma planes. It requires the quantizers in the talble shoud be specified in raster-scan order when it is first instroduced because it is natural to human. But CHWJpegCompressor::SetQuality() requires the quantization table to be specified in zigzag scan order because it is natural to the people familiar with HWJPEG and the JPEG specifications (ITU-t81). The DQT in JPEG also specifies the quantizers in zig-zag scan order. Now we decided to change the arrangement of quantizers to ExynosJpegEncoder::setQuality() not to confuse the users of libhwjpeg. Both ExynosJpegEncoder::setQuality() and CHWJpegCompressor::SetQuality() now need the quantizers to be specified in zig-zag scan order. Change-Id: I284f36d9dcc1f5af0dec92fdc0e1a3430e09e3a2 Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
Diffstat (limited to 'libhwjpeg')
-rw-r--r--libhwjpeg/ExynosJpegEncoder.cpp24
1 files changed, 1 insertions, 23 deletions
diff --git a/libhwjpeg/ExynosJpegEncoder.cpp b/libhwjpeg/ExynosJpegEncoder.cpp
index 9a4ca3d..39e7a2e 100644
--- a/libhwjpeg/ExynosJpegEncoder.cpp
+++ b/libhwjpeg/ExynosJpegEncoder.cpp
@@ -224,28 +224,6 @@ bool ExynosJpegEncoder::__EnsureFormatIsApplied() {
return true;
}
-static unsigned char jpeg_zigzagorder[] = {
- 0, 1, 8, 16, 9, 2, 3, 10,
- 17, 24, 32, 25, 18, 11, 4, 5,
- 12, 19, 26, 33, 40, 48, 41, 34,
- 27, 20, 13, 6, 7, 14, 21, 28,
- 35, 42, 49, 56, 57, 50, 43, 36,
- 29, 22, 15, 23, 30, 37, 44, 51,
- 58, 59, 52, 45, 38, 31, 39, 46,
- 53, 60, 61, 54, 47, 55, 62, 63
-};
-
int ExynosJpegEncoder::setQuality(const unsigned char q_table[]) {
- unsigned char qtbl[128];
-
- for (unsigned int i = 0; i < ARRSIZE(jpeg_zigzagorder); i++)
- qtbl[i] = q_table[jpeg_zigzagorder[i]];
-
- for (unsigned int i = 0; i < ARRSIZE(jpeg_zigzagorder); i++)
- qtbl[i + 64] = q_table[jpeg_zigzagorder[i] + 64];
-
- if (!m_hwjpeg.SetQuality(qtbl))
- return -1;
-
- return 0;
+ return m_hwjpeg.SetQuality(q_table) ? 0 : -1;
}