linux/drivers/media/v4l2-core/v4l2-vp9.c

// SPDX-License-Identifier: GPL-2.0
/*
 * V4L2 VP9 helpers.
 *
 * Copyright (C) 2021 Collabora, Ltd.
 *
 * Author: Andrzej Pietrasiewicz <[email protected]>
 */

#include <linux/module.h>

#include <media/v4l2-vp9.h>

const u8 v4l2_vp9_kf_y_mode_prob[10][10][9] =;
EXPORT_SYMBOL_GPL();

const u8 v4l2_vp9_kf_partition_probs[16][3] =;
EXPORT_SYMBOL_GPL();

const u8 v4l2_vp9_kf_uv_mode_prob[10][9] =;
EXPORT_SYMBOL_GPL();

const struct v4l2_vp9_frame_context v4l2_vp9_default_probs =;
EXPORT_SYMBOL_GPL();

static u32 fastdiv(u32 dividend, u16 divisor)
{}

/* 6.3.6 inv_recenter_nonneg(v, m) */
static int inv_recenter_nonneg(int v, int m)
{}

/*
 * part of 6.3.5 inv_remap_prob(deltaProb, prob)
 * delta = inv_map_table[deltaProb] done by userspace
 */
static int update_prob(int delta, int prob)
{}

/* Counterpart to 6.3.2 tx_mode_probs() */
static void update_tx_probs(struct v4l2_vp9_frame_context *probs,
			    const struct v4l2_ctrl_vp9_compressed_hdr *deltas)
{}

#define BAND_6(band)

static void update_coeff(const u8 deltas[6][6][3], u8 probs[6][6][3])
{}

/* Counterpart to 6.3.7 read_coef_probs() */
static void update_coef_probs(struct v4l2_vp9_frame_context *probs,
			      const struct v4l2_ctrl_vp9_compressed_hdr *deltas,
			      const struct v4l2_ctrl_vp9_frame *dec_params)
{}

/* Counterpart to 6.3.8 read_skip_prob() */
static void update_skip_probs(struct v4l2_vp9_frame_context *probs,
			      const struct v4l2_ctrl_vp9_compressed_hdr *deltas)
{}

/* Counterpart to 6.3.9 read_inter_mode_probs() */
static void update_inter_mode_probs(struct v4l2_vp9_frame_context *probs,
				    const struct v4l2_ctrl_vp9_compressed_hdr *deltas)
{}

/* Counterpart to 6.3.10 read_interp_filter_probs() */
static void update_interp_filter_probs(struct v4l2_vp9_frame_context *probs,
				       const struct v4l2_ctrl_vp9_compressed_hdr *deltas)
{}

/* Counterpart to 6.3.11 read_is_inter_probs() */
static void update_is_inter_probs(struct v4l2_vp9_frame_context *probs,
				  const struct v4l2_ctrl_vp9_compressed_hdr *deltas)
{}

/* 6.3.12 frame_reference_mode() done entirely in userspace */

/* Counterpart to 6.3.13 frame_reference_mode_probs() */
static void
update_frame_reference_mode_probs(unsigned int reference_mode,
				  struct v4l2_vp9_frame_context *probs,
				  const struct v4l2_ctrl_vp9_compressed_hdr *deltas)
{}

/* Counterpart to 6.3.14 read_y_mode_probs() */
static void update_y_mode_probs(struct v4l2_vp9_frame_context *probs,
				const struct v4l2_ctrl_vp9_compressed_hdr *deltas)
{}

/* Counterpart to 6.3.15 read_partition_probs() */
static void update_partition_probs(struct v4l2_vp9_frame_context *probs,
				   const struct v4l2_ctrl_vp9_compressed_hdr *deltas)
{}

static inline int update_mv_prob(int delta, int prob)
{}

/* Counterpart to 6.3.16 mv_probs() */
static void update_mv_probs(struct v4l2_vp9_frame_context *probs,
			    const struct v4l2_ctrl_vp9_compressed_hdr *deltas,
			    const struct v4l2_ctrl_vp9_frame *dec_params)
{}

/* Counterpart to 6.3 compressed_header(), but parsing has been done in userspace. */
void v4l2_vp9_fw_update_probs(struct v4l2_vp9_frame_context *probs,
			      const struct v4l2_ctrl_vp9_compressed_hdr *deltas,
			      const struct v4l2_ctrl_vp9_frame *dec_params)
{}
EXPORT_SYMBOL_GPL();

u8 v4l2_vp9_reset_frame_ctx(const struct v4l2_ctrl_vp9_frame *dec_params,
			    struct v4l2_vp9_frame_context *frame_context)
{}
EXPORT_SYMBOL_GPL();

/* 8.4.1 Merge prob process */
static u8 merge_prob(u8 pre_prob, u32 ct0, u32 ct1, u16 count_sat, u32 max_update_factor)
{}

static inline u8 noncoef_merge_prob(u8 pre_prob, u32 ct0, u32 ct1)
{}

/* 8.4.2 Merge probs process */
/*
 * merge_probs() is a recursive function in the spec. We avoid recursion in the kernel.
 * That said, the "tree" parameter of merge_probs() controls how deep the recursion goes.
 * It turns out that in all cases the recursive calls boil down to a short-ish series
 * of merge_prob() invocations (note no "s").
 *
 * Variant A
 * ---------
 * merge_probs(small_token_tree, 2):
 *	merge_prob(p[1], c[0], c[1] + c[2])
 *	merge_prob(p[2], c[1], c[2])
 *
 * Variant B
 * ---------
 * merge_probs(binary_tree, 0) or
 * merge_probs(tx_size_8_tree, 0):
 *	merge_prob(p[0], c[0], c[1])
 *
 * Variant C
 * ---------
 * merge_probs(inter_mode_tree, 0):
 *	merge_prob(p[0], c[2], c[1] + c[0] + c[3])
 *	merge_prob(p[1], c[0], c[1] + c[3])
 *	merge_prob(p[2], c[1], c[3])
 *
 * Variant D
 * ---------
 * merge_probs(intra_mode_tree, 0):
 *	merge_prob(p[0], c[0], c[1] + ... + c[9])
 *	merge_prob(p[1], c[9], c[1] + ... + c[8])
 *	merge_prob(p[2], c[1], c[2] + ... + c[8])
 *	merge_prob(p[3], c[2] + c[4] + c[5], c[3] + c[8] + c[6] + c[7])
 *	merge_prob(p[4], c[2], c[4] + c[5])
 *	merge_prob(p[5], c[4], c[5])
 *	merge_prob(p[6], c[3], c[8] + c[6] + c[7])
 *	merge_prob(p[7], c[8], c[6] + c[7])
 *	merge_prob(p[8], c[6], c[7])
 *
 * Variant E
 * ---------
 * merge_probs(partition_tree, 0) or
 * merge_probs(tx_size_32_tree, 0) or
 * merge_probs(mv_joint_tree, 0) or
 * merge_probs(mv_fr_tree, 0):
 *	merge_prob(p[0], c[0], c[1] + c[2] + c[3])
 *	merge_prob(p[1], c[1], c[2] + c[3])
 *	merge_prob(p[2], c[2], c[3])
 *
 * Variant F
 * ---------
 * merge_probs(interp_filter_tree, 0) or
 * merge_probs(tx_size_16_tree, 0):
 *	merge_prob(p[0], c[0], c[1] + c[2])
 *	merge_prob(p[1], c[1], c[2])
 *
 * Variant G
 * ---------
 * merge_probs(mv_class_tree, 0):
 *	merge_prob(p[0], c[0], c[1] + ... + c[10])
 *	merge_prob(p[1], c[1], c[2] + ... + c[10])
 *	merge_prob(p[2], c[2] + c[3], c[4] + ... + c[10])
 *	merge_prob(p[3], c[2], c[3])
 *	merge_prob(p[4], c[4] + c[5], c[6] + ... + c[10])
 *	merge_prob(p[5], c[4], c[5])
 *	merge_prob(p[6], c[6], c[7] + ... + c[10])
 *	merge_prob(p[7], c[7] + c[8], c[9] + c[10])
 *	merge_prob(p[8], c[7], c[8])
 *	merge_prob(p[9], c[9], [10])
 */

static inline void merge_probs_variant_a(u8 *p, const u32 *c, u16 count_sat, u32 update_factor)
{}

static inline void merge_probs_variant_b(u8 *p, const u32 *c, u16 count_sat, u32 update_factor)
{}

static inline void merge_probs_variant_c(u8 *p, const u32 *c)
{}

static void merge_probs_variant_d(u8 *p, const u32 *c)
{}

static inline void merge_probs_variant_e(u8 *p, const u32 *c)
{}

static inline void merge_probs_variant_f(u8 *p, const u32 *c)
{}

static void merge_probs_variant_g(u8 *p, const u32 *c)
{}

/* 8.4.3 Coefficient probability adaptation process */
static inline void adapt_probs_variant_a_coef(u8 *p, const u32 *c, u32 update_factor)
{}

static inline void adapt_probs_variant_b_coef(u8 *p, const u32 *c, u32 update_factor)
{}

static void _adapt_coeff(unsigned int i, unsigned int j, unsigned int k,
			 struct v4l2_vp9_frame_context *probs,
			 const struct v4l2_vp9_frame_symbol_counts *counts,
			 u32 uf)
{}

static void _adapt_coef_probs(struct v4l2_vp9_frame_context *probs,
			      const struct v4l2_vp9_frame_symbol_counts *counts,
			      unsigned int uf)
{}

void v4l2_vp9_adapt_coef_probs(struct v4l2_vp9_frame_context *probs,
			       struct v4l2_vp9_frame_symbol_counts *counts,
			       bool use_128,
			       bool frame_is_intra)
{}
EXPORT_SYMBOL_GPL();

/* 8.4.4 Non coefficient probability adaptation process, adapt_probs() */
static inline void adapt_probs_variant_b(u8 *p, const u32 *c)
{}

static inline void adapt_probs_variant_c(u8 *p, const u32 *c)
{}

static inline void adapt_probs_variant_d(u8 *p, const u32 *c)
{}

static inline void adapt_probs_variant_e(u8 *p, const u32 *c)
{}

static inline void adapt_probs_variant_f(u8 *p, const u32 *c)
{}

static inline void adapt_probs_variant_g(u8 *p, const u32 *c)
{}

/* 8.4.4 Non coefficient probability adaptation process, adapt_prob() */
static inline u8 adapt_prob(u8 prob, const u32 counts[2])
{}

/* 8.4.4 Non coefficient probability adaptation process */
void v4l2_vp9_adapt_noncoef_probs(struct v4l2_vp9_frame_context *probs,
				  struct v4l2_vp9_frame_symbol_counts *counts,
				  u8 reference_mode, u8 interpolation_filter, u8 tx_mode,
				  u32 flags)
{}
EXPORT_SYMBOL_GPL();

bool
v4l2_vp9_seg_feat_enabled(const u8 *feature_enabled,
			  unsigned int feature,
			  unsigned int segid)
{}
EXPORT_SYMBOL_GPL();

MODULE_LICENSE();
MODULE_DESCRIPTION();
MODULE_AUTHOR();