| 1 |
/* SPDX-License-Identifier: LGPL-2.1 */ |
| 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_alpha_step; |
| 17 |
unsigned int chroma_step; |
| 18 |
/* Chroma plane subsampling */ |
| 19 |
unsigned int width_div; |
| 20 |
unsigned int height_div; |
| 21 |
unsigned int components_num; |
| 22 |
unsigned int planes_num; |
| 23 |
unsigned int pixenc; |
| 24 |
}; |
| 25 |
|
| 26 |
struct v4l2_fwht_state { |
| 27 |
const struct v4l2_fwht_pixfmt_info *info; |
| 28 |
unsigned int visible_width; |
| 29 |
unsigned int visible_height; |
| 30 |
unsigned int coded_width; |
| 31 |
unsigned int coded_height; |
| 32 |
unsigned int stride; |
| 33 |
unsigned int ref_stride; |
| 34 |
unsigned int gop_size; |
| 35 |
unsigned int gop_cnt; |
| 36 |
u16 i_frame_qp; |
| 37 |
u16 p_frame_qp; |
| 38 |
|
| 39 |
enum v4l2_colorspace colorspace; |
| 40 |
enum v4l2_ycbcr_encoding ycbcr_enc; |
| 41 |
enum v4l2_xfer_func xfer_func; |
| 42 |
enum v4l2_quantization quantization; |
| 43 |
|
| 44 |
struct fwht_raw_frame ref_frame; |
| 45 |
struct fwht_cframe_hdr header; |
| 46 |
u8 *compressed_frame; |
| 47 |
u64 ref_frame_ts; |
| 48 |
}; |
| 49 |
|
| 50 |
const struct v4l2_fwht_pixfmt_info *v4l2_fwht_find_pixfmt(u32 pixelformat); |
| 51 |
const struct v4l2_fwht_pixfmt_info *v4l2_fwht_get_pixfmt(u32 idx); |
| 52 |
bool v4l2_fwht_validate_fmt(const struct v4l2_fwht_pixfmt_info *info, |
| 53 |
u32 width_div, u32 height_div, u32 components_num, |
| 54 |
u32 pixenc); |
| 55 |
const struct v4l2_fwht_pixfmt_info *v4l2_fwht_find_nth_fmt(u32 width_div, |
| 56 |
u32 height_div, |
| 57 |
u32 components_num, |
| 58 |
u32 pixenc, |
| 59 |
unsigned int start_idx); |
| 60 |
|
| 61 |
int v4l2_fwht_encode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out); |
| 62 |
int v4l2_fwht_decode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out); |
| 63 |
|
| 64 |
#endif |