media: vicodec: split off v4l2 specific parts for the codec
[linux-block.git] / drivers / media / platform / vicodec / codec-v4l2-fwht.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright 2018 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
4  */
5
6 #ifndef CODEC_V4L2_FWHT_H
7 #define CODEC_V4L2_FWHT_H
8
9 #include "codec-fwht.h"
10
11 struct v4l2_fwht_pixfmt_info {
12         u32 id;
13         unsigned int bytesperline_mult;
14         unsigned int sizeimage_mult;
15         unsigned int sizeimage_div;
16         unsigned int luma_step;
17         unsigned int chroma_step;
18         /* Chroma plane subsampling */
19         unsigned int width_div;
20         unsigned int height_div;
21 };
22
23 struct v4l2_fwht_state {
24         const struct v4l2_fwht_pixfmt_info *info;
25         unsigned int width;
26         unsigned int height;
27         unsigned int gop_size;
28         unsigned int gop_cnt;
29         u16 i_frame_qp;
30         u16 p_frame_qp;
31
32         enum v4l2_colorspace colorspace;
33         enum v4l2_ycbcr_encoding ycbcr_enc;
34         enum v4l2_xfer_func xfer_func;
35         enum v4l2_quantization quantization;
36
37         struct fwht_raw_frame ref_frame;
38         u8 *compressed_frame;
39 };
40
41 const struct v4l2_fwht_pixfmt_info *v4l2_fwht_find_pixfmt(u32 pixelformat);
42 const struct v4l2_fwht_pixfmt_info *v4l2_fwht_get_pixfmt(u32 idx);
43
44 unsigned int v4l2_fwht_encode(struct v4l2_fwht_state *state,
45                               u8 *p_in, u8 *p_out);
46
47 int v4l2_fwht_decode(struct v4l2_fwht_state *state,
48                      u8 *p_in, u8 *p_out);
49
50 #endif