linux/drivers/media/test-drivers/vicodec/codec-fwht.c

// SPDX-License-Identifier: LGPL-2.1+
/*
 * Copyright 2016 Tom aan de Wiel
 * Copyright 2018 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
 *
 * 8x8 Fast Walsh Hadamard Transform in sequency order based on the paper:
 *
 * A Recursive Algorithm for Sequency-Ordered Fast Walsh Transforms,
 * R.D. Brown, 1977
 */

#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/videodev2.h>
#include "codec-fwht.h"

#define OVERFLOW_BIT

/*
 * Note: bit 0 of the header must always be 0. Otherwise it cannot
 * be guaranteed that the magic 8 byte sequence (see below) can
 * never occur in the rlc output.
 */
#define PFRAME_BIT
#define DUPS_MASK

#define PBLOCK
#define IBLOCK

#define ALL_ZEROS

static const uint8_t zigzag[64] =;

/*
 * noinline_for_stack to work around
 * https://llvm.org/pr38809
 */
static int noinline_for_stack
rlc(const s16 *in, __be16 *output, int blocktype)
{}

/*
 * This function will worst-case increase rlc_in by 65*2 bytes:
 * one s16 value for the header and 8 * 8 coefficients of type s16.
 */
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)
{}

/*
 * Not the nicest way of doing it, but P-blocks get twice the range of
 * that of the I-blocks. Therefore we need a type bigger than 8 bits.
 * Furthermore values can be negative... This is just a version that
 * works with 16 signed data
 */
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)
{}