// SPDX-License-Identifier: GPL-2.0 /* * Hantro VPU codec driver * * Copyright (C) 2018 Rockchip Electronics Co., Ltd. * * JPEG encoder * ------------ * The VPU JPEG encoder produces JPEG baseline sequential format. * The quantization coefficients are 8-bit values, complying with * the baseline specification. Therefore, it requires * luma and chroma quantization tables. The hardware does entropy * encoding using internal Huffman tables, as specified in the JPEG * specification. * * In other words, only the luma and chroma quantization tables are * required for the encoding operation. * * Quantization luma table values are written to registers * VEPU_swreg_0-VEPU_swreg_15, and chroma table values to * VEPU_swreg_16-VEPU_swreg_31. A special order is needed, neither * zigzag, nor linear. */ #include <asm/unaligned.h> #include <media/v4l2-mem2mem.h> #include "hantro_jpeg.h" #include "hantro.h" #include "hantro_v4l2.h" #include "hantro_hw.h" #include "rockchip_vpu2_regs.h" #define VEPU_JPEG_QUANT_TABLE_COUNT … static void rockchip_vpu2_set_src_img_ctrl(struct hantro_dev *vpu, struct hantro_ctx *ctx) { … } static void rockchip_vpu2_jpeg_enc_set_buffers(struct hantro_dev *vpu, struct hantro_ctx *ctx, struct vb2_buffer *src_buf, struct vb2_buffer *dst_buf) { … } static void rockchip_vpu2_jpeg_enc_set_qtable(struct hantro_dev *vpu, unsigned char *luma_qtable, unsigned char *chroma_qtable) { … } int rockchip_vpu2_jpeg_enc_run(struct hantro_ctx *ctx) { … } void rockchip_vpu2_jpeg_enc_done(struct hantro_ctx *ctx) { … }