162306a36Sopenharmony_ci/* SPDX-License-Identifier: LGPL-2.1 */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright 2018 Cisco Systems, Inc. and/or its affiliates. All rights reserved. 462306a36Sopenharmony_ci */ 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci#ifndef CODEC_V4L2_FWHT_H 762306a36Sopenharmony_ci#define CODEC_V4L2_FWHT_H 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#include "codec-fwht.h" 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_cistruct v4l2_fwht_pixfmt_info { 1262306a36Sopenharmony_ci u32 id; 1362306a36Sopenharmony_ci unsigned int bytesperline_mult; 1462306a36Sopenharmony_ci unsigned int sizeimage_mult; 1562306a36Sopenharmony_ci unsigned int sizeimage_div; 1662306a36Sopenharmony_ci unsigned int luma_alpha_step; 1762306a36Sopenharmony_ci unsigned int chroma_step; 1862306a36Sopenharmony_ci /* Chroma plane subsampling */ 1962306a36Sopenharmony_ci unsigned int width_div; 2062306a36Sopenharmony_ci unsigned int height_div; 2162306a36Sopenharmony_ci unsigned int components_num; 2262306a36Sopenharmony_ci unsigned int planes_num; 2362306a36Sopenharmony_ci unsigned int pixenc; 2462306a36Sopenharmony_ci}; 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_cistruct v4l2_fwht_state { 2762306a36Sopenharmony_ci const struct v4l2_fwht_pixfmt_info *info; 2862306a36Sopenharmony_ci unsigned int visible_width; 2962306a36Sopenharmony_ci unsigned int visible_height; 3062306a36Sopenharmony_ci unsigned int coded_width; 3162306a36Sopenharmony_ci unsigned int coded_height; 3262306a36Sopenharmony_ci unsigned int stride; 3362306a36Sopenharmony_ci unsigned int ref_stride; 3462306a36Sopenharmony_ci unsigned int gop_size; 3562306a36Sopenharmony_ci unsigned int gop_cnt; 3662306a36Sopenharmony_ci u16 i_frame_qp; 3762306a36Sopenharmony_ci u16 p_frame_qp; 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci enum v4l2_colorspace colorspace; 4062306a36Sopenharmony_ci enum v4l2_ycbcr_encoding ycbcr_enc; 4162306a36Sopenharmony_ci enum v4l2_xfer_func xfer_func; 4262306a36Sopenharmony_ci enum v4l2_quantization quantization; 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ci struct fwht_raw_frame ref_frame; 4562306a36Sopenharmony_ci struct fwht_cframe_hdr header; 4662306a36Sopenharmony_ci u8 *compressed_frame; 4762306a36Sopenharmony_ci u64 ref_frame_ts; 4862306a36Sopenharmony_ci}; 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ciconst struct v4l2_fwht_pixfmt_info *v4l2_fwht_find_pixfmt(u32 pixelformat); 5162306a36Sopenharmony_ciconst struct v4l2_fwht_pixfmt_info *v4l2_fwht_get_pixfmt(u32 idx); 5262306a36Sopenharmony_cibool v4l2_fwht_validate_fmt(const struct v4l2_fwht_pixfmt_info *info, 5362306a36Sopenharmony_ci u32 width_div, u32 height_div, u32 components_num, 5462306a36Sopenharmony_ci u32 pixenc); 5562306a36Sopenharmony_ciconst struct v4l2_fwht_pixfmt_info *v4l2_fwht_find_nth_fmt(u32 width_div, 5662306a36Sopenharmony_ci u32 height_div, 5762306a36Sopenharmony_ci u32 components_num, 5862306a36Sopenharmony_ci u32 pixenc, 5962306a36Sopenharmony_ci unsigned int start_idx); 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ciint v4l2_fwht_encode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out); 6262306a36Sopenharmony_ciint v4l2_fwht_decode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out); 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci#endif 65