// SPDX-License-Identifier: GPL-2.0 /* * V4L2 H264 helpers. * * Copyright (C) 2019 Collabora, Ltd. * * Author: Boris Brezillon <[email protected]> */ #include <linux/module.h> #include <linux/sort.h> #include <media/v4l2-h264.h> /* * Size of the tempory buffer allocated when printing reference lists. The * output will be truncated if the size is too small. */ static const int tmp_str_size = …; /** * v4l2_h264_init_reflist_builder() - Initialize a P/B0/B1 reference list * builder * * @b: the builder context to initialize * @dec_params: decode parameters control * @sps: SPS control * @dpb: DPB to use when creating the reference list */ void v4l2_h264_init_reflist_builder(struct v4l2_h264_reflist_builder *b, const struct v4l2_ctrl_h264_decode_params *dec_params, const struct v4l2_ctrl_h264_sps *sps, const struct v4l2_h264_dpb_entry dpb[V4L2_H264_NUM_DPB_ENTRIES]) { … } EXPORT_SYMBOL_GPL(…); static s32 v4l2_h264_get_poc(const struct v4l2_h264_reflist_builder *b, const struct v4l2_h264_reference *ref) { … } static int v4l2_h264_p_ref_list_cmp(const void *ptra, const void *ptrb, const void *data) { … } static int v4l2_h264_b0_ref_list_cmp(const void *ptra, const void *ptrb, const void *data) { … } static int v4l2_h264_b1_ref_list_cmp(const void *ptra, const void *ptrb, const void *data) { … } /* * The references need to be reordered so that references are alternating * between top and bottom field references starting with the current picture * parity. This has to be done for short term and long term references * separately. */ static void reorder_field_reflist(const struct v4l2_h264_reflist_builder *b, struct v4l2_h264_reference *reflist) { … } static char ref_type_to_char(u8 ref_type) { … } static const char *format_ref_list_p(const struct v4l2_h264_reflist_builder *builder, struct v4l2_h264_reference *reflist, char **out_str) { … } static void print_ref_list_p(const struct v4l2_h264_reflist_builder *builder, struct v4l2_h264_reference *reflist) { … } static const char *format_ref_list_b(const struct v4l2_h264_reflist_builder *builder, struct v4l2_h264_reference *reflist, char **out_str) { … } static void print_ref_list_b(const struct v4l2_h264_reflist_builder *builder, struct v4l2_h264_reference *reflist, u8 list_num) { … } /** * v4l2_h264_build_p_ref_list() - Build the P reference list * * @builder: reference list builder context * @reflist: 32 sized array used to store the P reference list. Each entry * is a v4l2_h264_reference structure * * This functions builds the P reference lists. This procedure is describe in * section '8.2.4 Decoding process for reference picture lists construction' * of the H264 spec. This function can be used by H264 decoder drivers that * need to pass a P reference list to the hardware. */ void v4l2_h264_build_p_ref_list(const struct v4l2_h264_reflist_builder *builder, struct v4l2_h264_reference *reflist) { … } EXPORT_SYMBOL_GPL(…); /** * v4l2_h264_build_b_ref_lists() - Build the B0/B1 reference lists * * @builder: reference list builder context * @b0_reflist: 32 sized array used to store the B0 reference list. Each entry * is a v4l2_h264_reference structure * @b1_reflist: 32 sized array used to store the B1 reference list. Each entry * is a v4l2_h264_reference structure * * This functions builds the B0/B1 reference lists. This procedure is described * in section '8.2.4 Decoding process for reference picture lists construction' * of the H264 spec. This function can be used by H264 decoder drivers that * need to pass B0/B1 reference lists to the hardware. */ void v4l2_h264_build_b_ref_lists(const struct v4l2_h264_reflist_builder *builder, struct v4l2_h264_reference *b0_reflist, struct v4l2_h264_reference *b1_reflist) { … } EXPORT_SYMBOL_GPL(…); MODULE_LICENSE(…) …; MODULE_DESCRIPTION(…) …; MODULE_AUTHOR(…) …;