Created
June 18, 2024 18:53
-
-
Save devarsht/15f5cac304c5d01186dd4e7d4215414e to your computer and use it in GitHub Desktop.
v14_rangediff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1: 1f6db302af73 = 1: 9313538dee9c media: dt-bindings: Add Imagination E5010 JPEG Encoder | |
2: d90daa3c1aff ! 2: aad27a70bff2 media: imagination: Add E5010 JPEG Encoder driver | |
@@ drivers/media/platform/imagination/e5010-jpeg-enc.c (new) | |
+ return ret; | |
+} | |
+ | |
-+static int e5010_remove(struct platform_device *pdev) | |
++static void e5010_remove(struct platform_device *pdev) | |
+{ | |
+ struct e5010_dev *e5010 = platform_get_drvdata(pdev); | |
+ | |
@@ drivers/media/platform/imagination/e5010-jpeg-enc.c (new) | |
+ video_unregister_device(e5010->vdev); | |
+ v4l2_m2m_release(e5010->m2m_dev); | |
+ v4l2_device_unregister(&e5010->v4l2_dev); | |
-+ | |
-+ return 0; | |
+} | |
+ | |
+static void e5010_vb2_buffers_return(struct vb2_queue *q, enum vb2_buffer_state state) | |
3: 24a789a03cc9 ! 3: 10c016eb0d22 media: v4l2-jpeg: Export reference quantization and huffman tables | |
@@ Commit message | |
Signed-off-by: Devarsh Thakkar <devarsht@ti.com> | |
## drivers/media/v4l2-core/v4l2-jpeg.c ## | |
-@@ | |
- #include <linux/types.h> | |
- #include <media/v4l2-jpeg.h> | |
- | |
--MODULE_DESCRIPTION("V4L2 JPEG header parser helpers"); | |
-+MODULE_DESCRIPTION("V4L2 JPEG helpers"); | |
- MODULE_AUTHOR("Philipp Zabel <kernel@pengutronix.de>"); | |
- MODULE_LICENSE("GPL"); | |
- | |
@@ drivers/media/v4l2-core/v4l2-jpeg.c: MODULE_LICENSE("GPL"); | |
#define COM 0xfffe /* comment */ | |
#define TEM 0xff01 /* temporary */ | |
@@ drivers/media/v4l2-core/v4l2-jpeg.c: MODULE_LICENSE("GPL"); | |
+/* Luma and chroma qp tables to achieve 50% compression quality | |
+ * This is as per example in Annex K.1 of ITU-T.81 | |
+ */ | |
-+static const u8 luma_qt[] = { | |
++const u8 v4l2_jpeg_ref_table_luma_qt[V4L2_JPEG_PIXELS_IN_BLOCK] = { | |
+ 16, 11, 10, 16, 24, 40, 51, 61, | |
+ 12, 12, 14, 19, 26, 58, 60, 55, | |
+ 14, 13, 16, 24, 40, 57, 69, 56, | |
@@ drivers/media/v4l2-core/v4l2-jpeg.c: MODULE_LICENSE("GPL"); | |
+ 49, 64, 78, 87, 103, 121, 120, 101, | |
+ 72, 92, 95, 98, 112, 100, 103, 99 | |
+}; | |
++EXPORT_SYMBOL_GPL(v4l2_jpeg_ref_table_luma_qt); | |
+ | |
-+static const u8 chroma_qt[] = { | |
++const u8 v4l2_jpeg_ref_table_chroma_qt[V4L2_JPEG_PIXELS_IN_BLOCK] = { | |
+ 17, 18, 24, 47, 99, 99, 99, 99, | |
+ 18, 21, 26, 66, 99, 99, 99, 99, | |
+ 24, 26, 56, 99, 99, 99, 99, 99, | |
@@ drivers/media/v4l2-core/v4l2-jpeg.c: MODULE_LICENSE("GPL"); | |
+ 99, 99, 99, 99, 99, 99, 99, 99, | |
+ 99, 99, 99, 99, 99, 99, 99, 99 | |
+}; | |
++EXPORT_SYMBOL_GPL(v4l2_jpeg_ref_table_chroma_qt); | |
+ | |
-+/* Zigzag scan pattern */ | |
-+static const u8 zigzag[] = { | |
++/* Zigzag scan pattern indexes */ | |
++const u8 v4l2_jpeg_zigzag_scan_index[V4L2_JPEG_PIXELS_IN_BLOCK] = { | |
+ 0, 1, 8, 16, 9, 2, 3, 10, | |
+ 17, 24, 32, 25, 18, 11, 4, 5, | |
+ 12, 19, 26, 33, 40, 48, 41, 34, | |
@@ drivers/media/v4l2-core/v4l2-jpeg.c: MODULE_LICENSE("GPL"); | |
+ 58, 59, 52, 45, 38, 31, 39, 46, | |
+ 53, 60, 61, 54, 47, 55, 62, 63 | |
+}; | |
++EXPORT_SYMBOL_GPL(v4l2_jpeg_zigzag_scan_index); | |
+ | |
+/* | |
+ * Contains the data that needs to be sent in the marker segment of an | |
@@ drivers/media/v4l2-core/v4l2-jpeg.c: MODULE_LICENSE("GPL"); | |
+ * data stream. Specifies the huffman table used for encoding the luminance DC | |
+ * coefficient differences. The table represents Table K.3 of ITU-T.81 | |
+ */ | |
-+static const u8 luma_dc_ht[] = { | |
++const u8 v4l2_jpeg_ref_table_luma_dc_ht[V4L2_JPEG_REF_HT_DC_LEN] = { | |
+ 0x00, 0x01, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01, | |
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B | |
+}; | |
++EXPORT_SYMBOL_GPL(v4l2_jpeg_ref_table_luma_dc_ht); | |
+ | |
+/* | |
+ * Contains the data that needs to be sent in the marker segment of an | |
@@ drivers/media/v4l2-core/v4l2-jpeg.c: MODULE_LICENSE("GPL"); | |
+ * data stream. Specifies the huffman table used for encoding the luminance AC | |
+ * coefficients. The table represents Table K.5 of ITU-T.81 | |
+ */ | |
-+static const u8 luma_ac_ht[] = { | |
++const u8 v4l2_jpeg_ref_table_luma_ac_ht[V4L2_JPEG_REF_HT_AC_LEN] = { | |
+ 0x00, 0x02, 0x01, 0x03, 0x03, 0x02, 0x04, 0x03, 0x05, 0x05, 0x04, 0x04, | |
+ 0x00, 0x00, 0x01, 0x7D, 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, | |
+ 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07, 0x22, 0x71, 0x14, 0x32, | |
@@ drivers/media/v4l2-core/v4l2-jpeg.c: MODULE_LICENSE("GPL"); | |
+ 0xD9, 0xDA, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, | |
+ 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA | |
+}; | |
++EXPORT_SYMBOL_GPL(v4l2_jpeg_ref_table_luma_ac_ht); | |
+ | |
+/* | |
+ * Contains the data that needs to be sent in the marker segment of an interchange format JPEG | |
@@ drivers/media/v4l2-core/v4l2-jpeg.c: MODULE_LICENSE("GPL"); | |
+ * Specifies the huffman table used for encoding the chrominance DC coefficient differences. | |
+ * The table represents Table K.4 of ITU-T.81 | |
+ */ | |
-+static const u8 chroma_dc_ht[] = { | |
++const u8 v4l2_jpeg_ref_table_chroma_dc_ht[V4L2_JPEG_REF_HT_DC_LEN] = { | |
+ 0x00, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, | |
+ 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, | |
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B | |
+}; | |
++EXPORT_SYMBOL_GPL(v4l2_jpeg_ref_table_chroma_dc_ht); | |
+ | |
+/* | |
+ * Contains the data that needs to be sent in the marker segment of an | |
@@ drivers/media/v4l2-core/v4l2-jpeg.c: MODULE_LICENSE("GPL"); | |
+ * data stream. Specifies the huffman table used for encoding the chrominance | |
+ * AC coefficients. The table represents Table K.6 of ITU-T.81 | |
+ */ | |
-+static const u8 chroma_ac_ht[] = { | |
++const u8 v4l2_jpeg_ref_table_chroma_ac_ht[V4L2_JPEG_REF_HT_AC_LEN] = { | |
+ 0x00, 0x02, 0x01, 0x02, 0x04, 0x04, 0x03, 0x04, 0x07, 0x05, 0x04, 0x04, | |
+ 0x00, 0x01, 0x02, 0x77, 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, | |
+ 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71, 0x13, 0x22, 0x32, 0x81, | |
@@ drivers/media/v4l2-core/v4l2-jpeg.c: MODULE_LICENSE("GPL"); | |
+ 0xD7, 0xD8, 0xD9, 0xDA, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, | |
+ 0xEA, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA | |
+}; | |
++EXPORT_SYMBOL_GPL(v4l2_jpeg_ref_table_chroma_ac_ht); | |
+ | |
/** | |
* struct jpeg_stream - JPEG byte stream | |
* @curr: current position in stream | |
-@@ drivers/media/v4l2-core/v4l2-jpeg.c: int v4l2_jpeg_parse_huffman_tables(void *buf, size_t len, | |
- return jpeg_parse_huffman_tables(&stream, huffman_tables); | |
- } | |
- EXPORT_SYMBOL_GPL(v4l2_jpeg_parse_huffman_tables); | |
-+ | |
-+/** | |
-+ * v4l2_jpeg_get_reference_quantization_tables - Get reference quantization | |
-+ * tables as defined in ITU-T.81 | |
-+ * @ref_luma_qt: Output variable pointing to luma quantization table | |
-+ * @ref_chroma_qt: Output variable pointing to chroma quantization table | |
-+ */ | |
-+void v4l2_jpeg_get_reference_quantization_tables(const u8 **ref_luma_qt, const | |
-+ u8 **ref_chroma_qt) | |
-+{ | |
-+ if (ref_luma_qt) | |
-+ *ref_luma_qt = luma_qt; | |
-+ if (ref_chroma_qt) | |
-+ *ref_chroma_qt = chroma_qt; | |
-+} | |
-+EXPORT_SYMBOL_GPL(v4l2_jpeg_get_reference_quantization_tables); | |
-+ | |
-+/** | |
-+ * v4l2_jpeg_get_zig_zag_scan - Get zigzag scan table as defined in ITU-T.81 | |
-+ * @ref_zigzag: Output variable pointing to zigzag scan table | |
-+ */ | |
-+void v4l2_jpeg_get_zig_zag_scan(const u8 **ref_zigzag) | |
-+{ | |
-+ if (ref_zigzag) | |
-+ *ref_zigzag = zigzag; | |
-+} | |
-+EXPORT_SYMBOL_GPL(v4l2_jpeg_get_zig_zag_scan); | |
-+ | |
-+/** | |
-+ * v4l2_jpeg_get_reference_huffman_tables - Get reference huffman tables as | |
-+ * defined in ITU-T.81 | |
-+ * @ref_luma_dc_ht : Output variable pointing to huffman table for luma DC | |
-+ * @ref_luma_ac_ht : Output variable pointing to huffman table for luma AC | |
-+ * @ref_chroma_dc_ht : Output variable pointing to huffman table for chroma DC | |
-+ * @ref_chroma_ac_ht : Output variable pointing to huffman table for chroma AC | |
-+ */ | |
-+void v4l2_jpeg_get_reference_huffman_tables(const u8 **ref_luma_dc_ht, | |
-+ const u8 **ref_luma_ac_ht, | |
-+ const u8 **ref_chroma_dc_ht, | |
-+ const u8 **ref_chroma_ac_ht) | |
-+{ | |
-+ if (ref_luma_dc_ht) | |
-+ *ref_luma_dc_ht = luma_dc_ht; | |
-+ if (ref_luma_ac_ht) | |
-+ *ref_luma_ac_ht = luma_ac_ht; | |
-+ if (ref_chroma_dc_ht) | |
-+ *ref_chroma_dc_ht = chroma_dc_ht; | |
-+ if (ref_chroma_ac_ht) | |
-+ *ref_chroma_ac_ht = chroma_ac_ht; | |
-+} | |
-+EXPORT_SYMBOL_GPL(v4l2_jpeg_get_reference_huffman_tables); | |
## include/media/v4l2-jpeg.h ## | |
@@ | |
@@ include/media/v4l2-jpeg.h: int v4l2_jpeg_parse_quantization_tables(void *buf, si | |
int v4l2_jpeg_parse_huffman_tables(void *buf, size_t len, | |
struct v4l2_jpeg_reference *huffman_tables); | |
-+void v4l2_jpeg_get_reference_quantization_tables(const u8 **luma_qt, const u8 **chroma_qt); | |
-+void v4l2_jpeg_get_zig_zag_scan(const u8 **zigzag); | |
-+void v4l2_jpeg_get_reference_huffman_tables(const u8 **luma_dc_ht, const u8 **luma_ac_ht, | |
-+ const u8 **chroma_dc_ht, const u8 **chroma_ac_ht); | |
++extern const u8 v4l2_jpeg_zigzag_scan_index[V4L2_JPEG_PIXELS_IN_BLOCK]; | |
++extern const u8 v4l2_jpeg_ref_table_luma_qt[V4L2_JPEG_PIXELS_IN_BLOCK]; | |
++extern const u8 v4l2_jpeg_ref_table_chroma_qt[V4L2_JPEG_PIXELS_IN_BLOCK]; | |
++extern const u8 v4l2_jpeg_ref_table_luma_dc_ht[V4L2_JPEG_REF_HT_DC_LEN]; | |
++extern const u8 v4l2_jpeg_ref_table_luma_ac_ht[V4L2_JPEG_REF_HT_AC_LEN]; | |
++extern const u8 v4l2_jpeg_ref_table_chroma_dc_ht[V4L2_JPEG_REF_HT_DC_LEN]; | |
++extern const u8 v4l2_jpeg_ref_table_chroma_ac_ht[V4L2_JPEG_REF_HT_AC_LEN]; | |
++ | |
#endif | |
4: f6fba95efdff = 4: 79299d865b3d media: Documentation: Document v4l2-jpeg helper functions | |
5: 9e031045a960 ! 5: 17bc6a9a243f media: imagination: Use exported tables from v4l2-jpeg core | |
@@ drivers/media/platform/imagination/e5010-jpeg-enc.c | |
/* forward declarations */ | |
static const struct of_device_id e5010_of_match[]; | |
-@@ drivers/media/platform/imagination/e5010-jpeg-enc.c: static void calculate_qp_tables(struct e5010_context *ctx) | |
- { | |
- long long luminosity, contrast; | |
- int quality, i; | |
-+ const u8 *luma_q_table, *chroma_q_table; | |
-+ | |
-+ v4l2_jpeg_get_reference_quantization_tables(&luma_q_table, &chroma_q_table); | |
- | |
- quality = 50 - ctx->quality; | |
- | |
@@ drivers/media/platform/imagination/e5010-jpeg-enc.c: static void calculate_qp_tables(struct e5010_context *ctx) | |
contrast *= INCREASE; | |
} | |
- for (i = 0; i < ARRAY_SIZE(luma_q_table); i++) { | |
+- long long delta = chroma_q_table[i] * contrast + luminosity; | |
+- int val = (int)(chroma_q_table[i] + delta); | |
+ for (i = 0; i < V4L2_JPEG_PIXELS_IN_BLOCK; i++) { | |
- long long delta = chroma_q_table[i] * contrast + luminosity; | |
- int val = (int)(chroma_q_table[i] + delta); | |
++ long long delta = v4l2_jpeg_ref_table_chroma_qt[i] * contrast + luminosity; | |
++ int val = (int)(v4l2_jpeg_ref_table_chroma_qt[i] + delta); | |
-@@ drivers/media/platform/imagination/e5010-jpeg-enc.c: static void encode_marker_segment(struct e5010_context *ctx, void *addr, unsigne | |
- { | |
- u8 *buffer = (u8 *)addr; | |
- int i; | |
-+ const u8 *luma_dc_table, *chroma_dc_table, *luma_ac_table, *chroma_ac_table, *zigzag; | |
-+ | |
-+ v4l2_jpeg_get_reference_huffman_tables(&luma_dc_table, &luma_ac_table, &chroma_dc_table, | |
-+ &chroma_ac_table); | |
-+ v4l2_jpeg_get_zig_zag_scan(&zigzag); | |
+ clamp(val, 1, 255); | |
+ ctx->chroma_qp[i] = quality == -50 ? 1 : val; | |
+- delta = luma_q_table[i] * contrast + luminosity; | |
+- val = (int)(luma_q_table[i] + delta); | |
++ delta = v4l2_jpeg_ref_table_luma_qt[i] * contrast + luminosity; | |
++ val = (int)(v4l2_jpeg_ref_table_luma_qt[i] + delta); | |
+ clamp(val, 1, 255); | |
+ ctx->luma_qp[i] = quality == -50 ? 1 : val; | |
+ } | |
+@@ drivers/media/platform/imagination/e5010-jpeg-enc.c: static void encode_marker_segment(struct e5010_context *ctx, void *addr, unsigne | |
header_write(ctx, buffer, offset, 2, START_OF_IMAGE); | |
header_write(ctx, buffer, offset, 2, DQT_MARKER); | |
header_write(ctx, buffer, offset, 3, LQPQ << 4); | |
- for (i = 0; i < PELS_IN_BLOCK; i++) | |
+- header_write(ctx, buffer, offset, 1, ctx->luma_qp[zigzag[i]]); | |
+ for (i = 0; i < V4L2_JPEG_PIXELS_IN_BLOCK; i++) | |
- header_write(ctx, buffer, offset, 1, ctx->luma_qp[zigzag[i]]); | |
++ header_write(ctx, buffer, offset, 1, ctx->luma_qp[v4l2_jpeg_zigzag_scan_index[i]]); | |
header_write(ctx, buffer, offset, 2, DQT_MARKER); | |
header_write(ctx, buffer, offset, 3, (LQPQ << 4) | 1); | |
- for (i = 0; i < PELS_IN_BLOCK; i++) | |
+- header_write(ctx, buffer, offset, 1, ctx->chroma_qp[zigzag[i]]); | |
+ for (i = 0; i < V4L2_JPEG_PIXELS_IN_BLOCK; i++) | |
- header_write(ctx, buffer, offset, 1, ctx->chroma_qp[zigzag[i]]); | |
++ header_write(ctx, buffer, offset, 1, | |
++ ctx->chroma_qp[v4l2_jpeg_zigzag_scan_index[i]]); | |
/* Huffman tables */ | |
header_write(ctx, buffer, offset, 2, DHT_MARKER); | |
header_write(ctx, buffer, offset, 2, LH_DC); | |
- header_write(ctx, buffer, offset, 1, JPEG_LUM_HT | JPEG_DC_HT); | |
- for (i = 0 ; i < ARRAY_SIZE(luma_dc_table); i++) | |
+- header_write(ctx, buffer, offset, 1, luma_dc_table[i]); | |
+ header_write(ctx, buffer, offset, 1, V4L2_JPEG_LUM_HT | V4L2_JPEG_DC_HT); | |
+ for (i = 0 ; i < V4L2_JPEG_REF_HT_DC_LEN; i++) | |
- header_write(ctx, buffer, offset, 1, luma_dc_table[i]); | |
++ header_write(ctx, buffer, offset, 1, v4l2_jpeg_ref_table_luma_dc_ht[i]); | |
header_write(ctx, buffer, offset, 2, DHT_MARKER); | |
header_write(ctx, buffer, offset, 2, LH_AC); | |
- header_write(ctx, buffer, offset, 1, JPEG_LUM_HT | JPEG_AC_HT); | |
- for (i = 0 ; i < ARRAY_SIZE(luma_ac_table); i++) | |
+- header_write(ctx, buffer, offset, 1, luma_ac_table[i]); | |
+ header_write(ctx, buffer, offset, 1, V4L2_JPEG_LUM_HT | V4L2_JPEG_AC_HT); | |
+ for (i = 0 ; i < V4L2_JPEG_REF_HT_AC_LEN; i++) | |
- header_write(ctx, buffer, offset, 1, luma_ac_table[i]); | |
++ header_write(ctx, buffer, offset, 1, v4l2_jpeg_ref_table_luma_ac_ht[i]); | |
header_write(ctx, buffer, offset, 2, DHT_MARKER); | |
header_write(ctx, buffer, offset, 2, LH_DC); | |
- header_write(ctx, buffer, offset, 1, JPEG_CHR_HT | JPEG_DC_HT); | |
- for (i = 0 ; i < ARRAY_SIZE(chroma_dc_table); i++) | |
+- header_write(ctx, buffer, offset, 1, chroma_dc_table[i]); | |
+ header_write(ctx, buffer, offset, 1, V4L2_JPEG_CHR_HT | V4L2_JPEG_DC_HT); | |
+ for (i = 0 ; i < V4L2_JPEG_REF_HT_DC_LEN; i++) | |
- header_write(ctx, buffer, offset, 1, chroma_dc_table[i]); | |
++ header_write(ctx, buffer, offset, 1, v4l2_jpeg_ref_table_chroma_dc_ht[i]); | |
header_write(ctx, buffer, offset, 2, DHT_MARKER); | |
header_write(ctx, buffer, offset, 2, LH_AC); | |
- header_write(ctx, buffer, offset, 1, JPEG_CHR_HT | JPEG_AC_HT); | |
- for (i = 0 ; i < ARRAY_SIZE(chroma_ac_table); i++) | |
+- header_write(ctx, buffer, offset, 1, chroma_ac_table[i]); | |
+ header_write(ctx, buffer, offset, 1, V4L2_JPEG_CHR_HT | V4L2_JPEG_AC_HT); | |
+ for (i = 0 ; i < V4L2_JPEG_REF_HT_AC_LEN; i++) | |
- header_write(ctx, buffer, offset, 1, chroma_ac_table[i]); | |
++ header_write(ctx, buffer, offset, 1, v4l2_jpeg_ref_table_chroma_ac_ht[i]); | |
} | |
+ static void encode_frame_header(struct e5010_context *ctx, void *addr, unsigned int *offset) | |
6: a26c7d287ff9 ! 6: f8fa7583fe94 media: verisilicon : Use exported tables from v4l2-jpeg for hantro codec | |
@@ drivers/media/platform/verisilicon/hantro_jpeg.c: static const u32 hw_reorder[] | |
* and we'll use fixed offsets to change the width, height | |
* quantization tables, etc. | |
@@ drivers/media/platform/verisilicon/hantro_jpeg.c: jpeg_scale_quant_table(unsigned char *file_q_tab, | |
- const unsigned char *tab, int scale) | |
{ | |
int i; | |
-+ const u8 *zigzag; | |
- BUILD_BUG_ON(ARRAY_SIZE(zigzag) != JPEG_QUANT_SIZE); | |
++ BUILD_BUG_ON(ARRAY_SIZE(v4l2_jpeg_zigzag_scan_index) != JPEG_QUANT_SIZE); | |
BUILD_BUG_ON(ARRAY_SIZE(hw_reorder) != JPEG_QUANT_SIZE); | |
-+ v4l2_jpeg_get_zig_zag_scan(&zigzag); | |
for (i = 0; i < JPEG_QUANT_SIZE; i++) { | |
- file_q_tab[i] = jpeg_scale_qp(tab[zigzag[i]], scale); | |
+- file_q_tab[i] = jpeg_scale_qp(tab[zigzag[i]], scale); | |
++ file_q_tab[i] = jpeg_scale_qp(tab[v4l2_jpeg_zigzag_scan_index[i]], scale); | |
reordered_q_tab[i] = jpeg_scale_qp(tab[hw_reorder[i]], scale); | |
+ } | |
+ } | |
@@ drivers/media/platform/verisilicon/hantro_jpeg.c: jpeg_scale_quant_table(unsigned char *file_q_tab, | |
static void jpeg_set_quality(struct hantro_jpeg_ctx *ctx) | |
{ | |
int scale; | |
-+ const u8 *luma_q_table, *chroma_q_table; | |
- | |
+- | |
/* | |
* Non-linear scaling factor: | |
+ * [5,50] -> [1000..100], [51,100] -> [98..0] | |
@@ drivers/media/platform/verisilicon/hantro_jpeg.c: static void jpeg_set_quality(struct hantro_jpeg_ctx *ctx) | |
else | |
scale = 200 - 2 * ctx->quality; | |
- BUILD_BUG_ON(ARRAY_SIZE(luma_q_table) != JPEG_QUANT_SIZE); | |
- BUILD_BUG_ON(ARRAY_SIZE(chroma_q_table) != JPEG_QUANT_SIZE); | |
++ BUILD_BUG_ON(ARRAY_SIZE(v4l2_jpeg_ref_table_luma_qt) != JPEG_QUANT_SIZE); | |
++ BUILD_BUG_ON(ARRAY_SIZE(v4l2_jpeg_ref_table_chroma_qt) != JPEG_QUANT_SIZE); | |
BUILD_BUG_ON(ARRAY_SIZE(ctx->hw_luma_qtable) != JPEG_QUANT_SIZE); | |
BUILD_BUG_ON(ARRAY_SIZE(ctx->hw_chroma_qtable) != JPEG_QUANT_SIZE); | |
-+ v4l2_jpeg_get_reference_quantization_tables(&luma_q_table, &chroma_q_table); | |
jpeg_scale_quant_table(ctx->buffer + LUMA_QUANT_OFF, | |
- ctx->hw_luma_qtable, luma_q_table, scale); | |
-+ ctx->hw_luma_qtable, (const unsigned char *)luma_q_table, scale); | |
++ ctx->hw_luma_qtable, | |
++ (const unsigned char *)v4l2_jpeg_ref_table_luma_qt, scale); | |
jpeg_scale_quant_table(ctx->buffer + CHROMA_QUANT_OFF, | |
- ctx->hw_chroma_qtable, chroma_q_table, scale); | |
-+ ctx->hw_chroma_qtable, (const unsigned char *)chroma_q_table, scale); | |
++ ctx->hw_chroma_qtable, | |
++ (const unsigned char *)v4l2_jpeg_ref_table_chroma_qt, scale); | |
} | |
void hantro_jpeg_header_assemble(struct hantro_jpeg_ctx *ctx) | |
- { | |
- char *buf = ctx->buffer; | |
-+ const u8 *luma_dc_table, *chroma_dc_table, *luma_ac_table, *chroma_ac_table; | |
- | |
-+ v4l2_jpeg_get_reference_huffman_tables(&luma_dc_table, &luma_ac_table, &chroma_dc_table, | |
-+ &chroma_ac_table); | |
- memcpy(buf, hantro_jpeg_header, | |
- sizeof(hantro_jpeg_header)); | |
- | |
@@ drivers/media/platform/verisilicon/hantro_jpeg.c: void hantro_jpeg_header_assemble(struct hantro_jpeg_ctx *ctx) | |
buf[WIDTH_OFF + 0] = ctx->width >> 8; | |
buf[WIDTH_OFF + 1] = ctx->width; | |
@@ drivers/media/platform/verisilicon/hantro_jpeg.c: void hantro_jpeg_header_assemb | |
- sizeof(chroma_dc_table)); | |
- memcpy(buf + HUFF_CHROMA_AC_OFF, chroma_ac_table, | |
- sizeof(chroma_ac_table)); | |
-+ memcpy(buf + HUFF_LUMA_DC_OFF, luma_dc_table, V4L2_JPEG_REF_HT_DC_LEN); | |
-+ memcpy(buf + HUFF_LUMA_AC_OFF, luma_ac_table, V4L2_JPEG_REF_HT_AC_LEN); | |
-+ memcpy(buf + HUFF_CHROMA_DC_OFF, chroma_dc_table, V4L2_JPEG_REF_HT_DC_LEN); | |
-+ memcpy(buf + HUFF_CHROMA_AC_OFF, chroma_ac_table, V4L2_JPEG_REF_HT_AC_LEN); | |
++ memcpy(buf + HUFF_LUMA_DC_OFF, v4l2_jpeg_ref_table_luma_dc_ht, V4L2_JPEG_REF_HT_DC_LEN); | |
++ memcpy(buf + HUFF_LUMA_AC_OFF, v4l2_jpeg_ref_table_luma_ac_ht, V4L2_JPEG_REF_HT_AC_LEN); | |
++ memcpy(buf + HUFF_CHROMA_DC_OFF, v4l2_jpeg_ref_table_chroma_dc_ht, V4L2_JPEG_REF_HT_DC_LEN); | |
++ memcpy(buf + HUFF_CHROMA_AC_OFF, v4l2_jpeg_ref_table_chroma_ac_ht, V4L2_JPEG_REF_HT_AC_LEN); | |
jpeg_set_quality(ctx); | |
} | |
7: 953bf1e26e13 < -: ------------ math.h: Add macros for rounding to closest value | |
8: 8eb6bcff529c < -: ------------ math.h: Use kernel-doc syntax for divison macros | |
9: 464f1a316593 < -: ------------ Documentation: core-api: Add math.h macros and functions | |
10: 2eb1ccb7840c < -: ------------ lib: add basic KUnit test for lib/math | |
11: 83a8a1bb3fbf < -: ------------ lib: math_kunit: Add tests for new macros related to rounding to nearest value | |
12: cf94918283ab < -: ------------ media: imagination: Round to closest multiple for cropping region | |
13: 4f831d6bae56 < -: ------------ gpu: ipu-v3: Use generic macro for rounding closest to specified value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment