linux/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_if.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (c) 2016 MediaTek Inc.
 * Author: PC Chen <[email protected]>
 */

#include <linux/module.h>
#include <linux/slab.h>

#include "../vdec_drv_if.h"
#include "../mtk_vcodec_dec.h"
#include "../../common/mtk_vcodec_intr.h"
#include "../vdec_vpu_if.h"
#include "../vdec_drv_base.h"

#define NAL_NON_IDR_SLICE
#define NAL_IDR_SLICE
#define NAL_H264_PPS
#define NAL_TYPE(value)

#define BUF_PREDICTION_SZ

#define MB_UNIT_LEN

/* motion vector size (bytes) for every macro block */
#define HW_MB_STORE_SZ

#define H264_MAX_FB_NUM
#define HDR_PARSING_BUF_SZ

#define DEC_ERR_RET(ret)
#define H264_ERR_NOT_VALID

/**
 * struct h264_fb - h264 decode frame buffer information
 * @vdec_fb_va  : virtual address of struct vdec_fb
 * @y_fb_dma    : dma address of Y frame buffer (luma)
 * @c_fb_dma    : dma address of C frame buffer (chroma)
 * @poc         : picture order count of frame buffer
 * @reserved    : for 8 bytes alignment
 */
struct h264_fb {};

/**
 * struct h264_ring_fb_list - ring frame buffer list
 * @fb_list   : frame buffer array
 * @read_idx  : read index
 * @write_idx : write index
 * @count     : buffer count in list
 * @reserved  : for 8 bytes alignment
 */
struct h264_ring_fb_list {};

/**
 * struct vdec_h264_dec_info - decode information
 * @dpb_sz		: decoding picture buffer size
 * @resolution_changed  : resolution change happen
 * @realloc_mv_buf	: flag to notify driver to re-allocate mv buffer
 * @reserved		: for 8 bytes alignment
 * @bs_dma		: Input bit-stream buffer dma address
 * @y_fb_dma		: Y frame buffer dma address
 * @c_fb_dma		: C frame buffer dma address
 * @vdec_fb_va		: VDEC frame buffer struct virtual address
 */
struct vdec_h264_dec_info {};

/**
 * struct vdec_h264_vsi - shared memory for decode information exchange
 *                        between VPU and Host.
 *                        The memory is allocated by VPU then mapping to Host
 *                        in vpu_dec_init() and freed in vpu_dec_deinit()
 *                        by VPU.
 *                        AP-W/R : AP is writer/reader on this item
 *                        VPU-W/R: VPU is write/reader on this item
 * @hdr_buf      : Header parsing buffer (AP-W, VPU-R)
 * @pred_buf_dma : HW working prediction buffer dma address (AP-W, VPU-R)
 * @mv_buf_dma   : HW working motion vector buffer dma address (AP-W, VPU-R)
 * @list_free    : free frame buffer ring list (AP-W/R, VPU-W)
 * @list_disp    : display frame buffer ring list (AP-R, VPU-W)
 * @dec          : decode information (AP-R, VPU-W)
 * @pic          : picture information (AP-R, VPU-W)
 * @crop         : crop information (AP-R, VPU-W)
 */
struct vdec_h264_vsi {};

/**
 * struct vdec_h264_inst - h264 decoder instance
 * @num_nalu : how many nalus be decoded
 * @ctx      : point to mtk_vcodec_dec_ctx
 * @pred_buf : HW working prediction buffer
 * @mv_buf   : HW working motion vector buffer
 * @vpu      : VPU instance
 * @vsi      : VPU shared information
 */
struct vdec_h264_inst {};

static unsigned int get_mv_buf_size(unsigned int width, unsigned int height)
{}

static int allocate_prediction_buf(struct vdec_h264_inst *inst)
{}

static void free_prediction_buf(struct vdec_h264_inst *inst)
{}

static int alloc_mv_buf(struct vdec_h264_inst *inst, struct vdec_pic_info *pic)
{}

static void free_mv_buf(struct vdec_h264_inst *inst)
{}

static int check_list_validity(struct vdec_h264_inst *inst, bool disp_list)
{}

static void put_fb_to_free(struct vdec_h264_inst *inst, struct vdec_fb *fb)
{}

static void get_pic_info(struct vdec_h264_inst *inst,
			 struct vdec_pic_info *pic)
{}

static void get_crop_info(struct vdec_h264_inst *inst, struct v4l2_rect *cr)
{}

static void get_dpb_size(struct vdec_h264_inst *inst, unsigned int *dpb_sz)
{}

static int vdec_h264_init(struct mtk_vcodec_dec_ctx *ctx)
{}

static void vdec_h264_deinit(void *h_vdec)
{}

static int find_start_code(unsigned char *data, unsigned int data_sz)
{}

static int vdec_h264_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
			    struct vdec_fb *fb, bool *res_chg)
{}

static void vdec_h264_get_fb(struct vdec_h264_inst *inst,
			     struct h264_ring_fb_list *list,
			     bool disp_list, struct vdec_fb **out_fb)
{}

static int vdec_h264_get_param(void *h_vdec, enum vdec_get_param_type type,
			       void *out)
{}

const struct vdec_common_if vdec_h264_if =;