summaryrefslogtreecommitdiff
path: root/drivers/media/platform/vicodec/codec-v4l2-fwht.h
blob: 1a0d2a9f931ab07ba28d37a9dfddf23d38dbde33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* SPDX-License-Identifier: LGPL-2.1 */
/*
 * Copyright 2018 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
 */

#ifndef CODEC_V4L2_FWHT_H
#define CODEC_V4L2_FWHT_H

#include "codec-fwht.h"

struct v4l2_fwht_pixfmt_info {
	u32 id;
	unsigned int bytesperline_mult;
	unsigned int sizeimage_mult;
	unsigned int sizeimage_div;
	unsigned int luma_alpha_step;
	unsigned int chroma_step;
	/* Chroma plane subsampling */
	unsigned int width_div;
	unsigned int height_div;
	unsigned int components_num;
	unsigned int planes_num;
	unsigned int pixenc;
};

struct v4l2_fwht_state {
	const struct v4l2_fwht_pixfmt_info *info;
	unsigned int visible_width;
	unsigned int visible_height;
	unsigned int coded_width;
	unsigned int coded_height;
	unsigned int stride;
	unsigned int ref_stride;
	unsigned int gop_size;
	unsigned int gop_cnt;
	u16 i_frame_qp;
	u16 p_frame_qp;

	enum v4l2_colorspace colorspace;
	enum v4l2_ycbcr_encoding ycbcr_enc;
	enum v4l2_xfer_func xfer_func;
	enum v4l2_quantization quantization;

	struct fwht_raw_frame ref_frame;
	struct fwht_cframe_hdr header;
	u8 *compressed_frame;
	u64 ref_frame_ts;
};

const struct v4l2_fwht_pixfmt_info *v4l2_fwht_find_pixfmt(u32 pixelformat);
const struct v4l2_fwht_pixfmt_info *v4l2_fwht_get_pixfmt(u32 idx);
bool v4l2_fwht_validate_fmt(const struct v4l2_fwht_pixfmt_info *info,
			    u32 width_div, u32 height_div, u32 components_num,
			    u32 pixenc);
const struct v4l2_fwht_pixfmt_info *v4l2_fwht_find_nth_fmt(u32 width_div,
							  u32 height_div,
							  u32 components_num,
							  u32 pixenc,
							  unsigned int start_idx);

int v4l2_fwht_encode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out);
int v4l2_fwht_decode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out);

#endif