#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/videodev2.h>
#include "codec-fwht.h"
#define OVERFLOW_BIT …
#define PFRAME_BIT …
#define DUPS_MASK …
#define PBLOCK …
#define IBLOCK …
#define ALL_ZEROS …
static const uint8_t zigzag[64] = …;
static int noinline_for_stack
rlc(const s16 *in, __be16 *output, int blocktype)
{ … }
static noinline_for_stack u16
derlc(const __be16 **rlc_in, s16 *dwht_out, const __be16 *end_of_input)
{ … }
static const int quant_table[] = …;
static const int quant_table_p[] = …;
static void quantize_intra(s16 *coeff, s16 *de_coeff, u16 qp)
{ … }
static void dequantize_intra(s16 *coeff)
{ … }
static void quantize_inter(s16 *coeff, s16 *de_coeff, u16 qp)
{ … }
static void dequantize_inter(s16 *coeff)
{ … }
static void noinline_for_stack fwht(const u8 *block, s16 *output_block,
unsigned int stride,
unsigned int input_step, bool intra)
{ … }
static void noinline_for_stack
fwht16(const s16 *block, s16 *output_block, int stride, int intra)
{ … }
static noinline_for_stack void
ifwht(const s16 *block, s16 *output_block, int intra)
{ … }
static void fill_encoder_block(const u8 *input, s16 *dst,
unsigned int stride, unsigned int input_step)
{ … }
static int var_intra(const s16 *input)
{ … }
static int var_inter(const s16 *old, const s16 *new)
{ … }
static noinline_for_stack int
decide_blocktype(const u8 *cur, const u8 *reference, s16 *deltablock,
unsigned int stride, unsigned int input_step)
{ … }
static void fill_decoder_block(u8 *dst, const s16 *input, int stride,
unsigned int dst_step)
{ … }
static void add_deltas(s16 *deltas, const u8 *ref, int stride,
unsigned int ref_step)
{ … }
static u32 encode_plane(u8 *input, u8 *refp, __be16 **rlco, __be16 *rlco_max,
struct fwht_cframe *cf, u32 height, u32 width,
u32 stride, unsigned int input_step,
bool is_intra, bool next_is_intra)
{ … }
u32 fwht_encode_frame(struct fwht_raw_frame *frm,
struct fwht_raw_frame *ref_frm,
struct fwht_cframe *cf,
bool is_intra, bool next_is_intra,
unsigned int width, unsigned int height,
unsigned int stride, unsigned int chroma_stride)
{ … }
static bool decode_plane(struct fwht_cframe *cf, const __be16 **rlco,
u32 height, u32 width, const u8 *ref, u32 ref_stride,
unsigned int ref_step, u8 *dst,
unsigned int dst_stride, unsigned int dst_step,
bool uncompressed, const __be16 *end_of_rlco_buf)
{ … }
bool fwht_decode_frame(struct fwht_cframe *cf, u32 hdr_flags,
unsigned int components_num, unsigned int width,
unsigned int height, const struct fwht_raw_frame *ref,
unsigned int ref_stride, unsigned int ref_chroma_stride,
struct fwht_raw_frame *dst, unsigned int dst_stride,
unsigned int dst_chroma_stride)
{ … }