drivers/media/v4l2-core/v4l2-vp9.c
Source file repositories/reference/linux-study-clean/drivers/media/v4l2-core/v4l2-vp9.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/v4l2-core/v4l2-vp9.c- Extension
.c- Size
- 53356 bytes
- Lines
- 1851
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hmedia/v4l2-vp9.h
Detected Declarations
function fastdivfunction inv_recenter_nonnegfunction update_probfunction update_tx_probsfunction update_coefffunction update_coef_probsfunction update_skip_probsfunction update_inter_mode_probsfunction update_interp_filter_probsfunction update_is_inter_probsfunction update_frame_reference_mode_probsfunction update_y_mode_probsfunction update_partition_probsfunction update_mv_probfunction update_mv_probsfunction v4l2_vp9_fw_update_probsfunction v4l2_vp9_reset_frame_ctxfunction merge_probfunction noncoef_merge_probfunction merge_probsfunction merge_probs_variant_bfunction merge_probs_variant_cfunction merge_probs_variant_dfunction merge_probs_variant_efunction merge_probs_variant_ffunction merge_probs_variant_gfunction adapt_probs_variant_a_coeffunction adapt_probs_variant_b_coeffunction _adapt_coefffunction _adapt_coef_probsfunction v4l2_vp9_adapt_coef_probsfunction adapt_probs_variant_bfunction adapt_probs_variant_cfunction adapt_probs_variant_dfunction adapt_probs_variant_efunction adapt_probs_variant_ffunction adapt_probs_variant_gfunction adapt_probfunction v4l2_vp9_adapt_noncoef_probsfunction v4l2_vp9_seg_feat_enabledexport v4l2_vp9_kf_y_mode_probexport v4l2_vp9_kf_partition_probsexport v4l2_vp9_kf_uv_mode_probexport v4l2_vp9_default_probsexport v4l2_vp9_fw_update_probsexport v4l2_vp9_reset_frame_ctxexport v4l2_vp9_adapt_coef_probsexport v4l2_vp9_adapt_noncoef_probs
Annotated Snippet
if (dec_params->flags & V4L2_VP9_FRAME_FLAG_ALLOW_HIGH_PREC_MV) {
p = probs->mv.class0_hp;
d = deltas->mv.class0_hp;
p[i] = update_mv_prob(d[i], p[i]);
p = probs->mv.hp;
d = deltas->mv.hp;
p[i] = update_mv_prob(d[i], p[i]);
}
}
}
/* 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)
{
if (deltas->tx_mode == V4L2_VP9_TX_MODE_SELECT)
update_tx_probs(probs, deltas);
update_coef_probs(probs, deltas, dec_params);
update_skip_probs(probs, deltas);
if (dec_params->flags & V4L2_VP9_FRAME_FLAG_KEY_FRAME ||
dec_params->flags & V4L2_VP9_FRAME_FLAG_INTRA_ONLY)
return;
update_inter_mode_probs(probs, deltas);
if (dec_params->interpolation_filter == V4L2_VP9_INTERP_FILTER_SWITCHABLE)
update_interp_filter_probs(probs, deltas);
update_is_inter_probs(probs, deltas);
update_frame_reference_mode_probs(dec_params->reference_mode, probs, deltas);
update_y_mode_probs(probs, deltas);
update_partition_probs(probs, deltas);
update_mv_probs(probs, deltas, dec_params);
}
EXPORT_SYMBOL_GPL(v4l2_vp9_fw_update_probs);
u8 v4l2_vp9_reset_frame_ctx(const struct v4l2_ctrl_vp9_frame *dec_params,
struct v4l2_vp9_frame_context *frame_context)
{
int i;
u8 fctx_idx = dec_params->frame_context_idx;
if (dec_params->flags & V4L2_VP9_FRAME_FLAG_KEY_FRAME ||
dec_params->flags & V4L2_VP9_FRAME_FLAG_INTRA_ONLY ||
dec_params->flags & V4L2_VP9_FRAME_FLAG_ERROR_RESILIENT) {
/*
* setup_past_independence()
* We do nothing here. Instead of storing default probs in some intermediate
* location and then copying from that location to appropriate contexts
* in save_probs() below, we skip that step and save default probs directly
* to appropriate contexts.
*/
if (dec_params->flags & V4L2_VP9_FRAME_FLAG_KEY_FRAME ||
dec_params->flags & V4L2_VP9_FRAME_FLAG_ERROR_RESILIENT ||
dec_params->reset_frame_context == V4L2_VP9_RESET_FRAME_CTX_ALL)
for (i = 0; i < 4; ++i)
/* save_probs(i) */
memcpy(&frame_context[i], &v4l2_vp9_default_probs,
sizeof(v4l2_vp9_default_probs));
else if (dec_params->reset_frame_context == V4L2_VP9_RESET_FRAME_CTX_SPEC)
/* save_probs(fctx_idx) */
memcpy(&frame_context[fctx_idx], &v4l2_vp9_default_probs,
sizeof(v4l2_vp9_default_probs));
fctx_idx = 0;
}
return fctx_idx;
}
EXPORT_SYMBOL_GPL(v4l2_vp9_reset_frame_ctx);
/* 8.4.1 Merge prob process */
static u8 merge_prob(u8 pre_prob, u32 ct0, u32 ct1, u16 count_sat, u32 max_update_factor)
{
u32 den, prob, count, factor;
den = ct0 + ct1;
if (!den) {
/*
* prob = 128, count = 0, update_factor = 0
* Round2's argument: pre_prob * 256
Annotation
- Immediate include surface: `linux/module.h`, `media/v4l2-vp9.h`.
- Detected declarations: `function fastdiv`, `function inv_recenter_nonneg`, `function update_prob`, `function update_tx_probs`, `function update_coeff`, `function update_coef_probs`, `function update_skip_probs`, `function update_inter_mode_probs`, `function update_interp_filter_probs`, `function update_is_inter_probs`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: integration implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.