[PATCH v5 11/14] media: mtk-vcodec: vdec: support stateless H.264 decoding
Alexandre Courbot
acourbot at chromium.org
Thu May 27 03:10:34 PDT 2021
On Fri, May 21, 2021 at 10:38 PM Tzung-Bi Shih <tzungbi at google.com> wrote:
>
> On Wed, May 19, 2021 at 10:31 PM Alexandre Courbot
> <acourbot at chromium.org> wrote:
> > +#include "../vdec_drv_if.h"
> > +#include "../mtk_vcodec_util.h"
> > +#include "../mtk_vcodec_dec.h"
> > +#include "../mtk_vcodec_intr.h"
> > +#include "../vdec_vpu_if.h"
> > +#include "../vdec_drv_base.h"
>
> Would be good practice to sort them.
Done as much as possible.
>
> > +static int allocate_predication_buf(struct vdec_h264_slice_inst *inst)
> > +{
> > + int err = 0;
>
> No need to initialize. It will be overridden soon.
Done.
>
> > +static void free_predication_buf(struct vdec_h264_slice_inst *inst)
> > +{
> > + struct mtk_vcodec_mem *mem = NULL;
> > +
> > + mtk_vcodec_debug_enter(inst);
> > +
> > + inst->vsi_ctx.pred_buf_dma = 0;
> > + mem = &inst->pred_buf;
>
> Is it possible to inline to the variable declaration? Or mem no need
> to initialize.
Indeed - done (also done all other suggestions in this email).
>
> > +static int alloc_mv_buf(struct vdec_h264_slice_inst *inst,
> > + struct vdec_pic_info *pic)
> > +{
> > + int i;
> > + int err;
> > + struct mtk_vcodec_mem *mem = NULL;
>
> No need to initialize. It will be overridden soon.
>
> > +static void free_mv_buf(struct vdec_h264_slice_inst *inst)
> > +{
> > + int i;
> > + struct mtk_vcodec_mem *mem = NULL;
>
> No need to initialize. It will be overridden soon.
>
> > +static int vdec_h264_slice_init(struct mtk_vcodec_ctx *ctx)
> > +{
> > + struct vdec_h264_slice_inst *inst = NULL;
>
> No need to initialize. It will be overridden soon.
>
> > +static void vdec_h264_slice_deinit(void *h_vdec)
> > +{
> > + struct vdec_h264_slice_inst *inst =
> > + (struct vdec_h264_slice_inst *)h_vdec;
>
> No need to cast from void *.
>
> > +static int vdec_h264_slice_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
> > + struct vdec_fb *fb, bool *res_chg)
> > +{
> > + struct vdec_h264_slice_inst *inst =
> > + (struct vdec_h264_slice_inst *)h_vdec;
>
> No need to cast from void *.
>
> > + const struct v4l2_ctrl_h264_decode_params *dec_params =
> > + get_ctrl_ptr(inst->ctx, V4L2_CID_STATELESS_H264_DECODE_PARAMS);
> > + struct vdec_vpu_inst *vpu = &inst->vpu;
> > + uint32_t data[2];
> > + uint64_t y_fb_dma;
> > + uint64_t c_fb_dma;
> > + int err;
> > +
> > + /* bs NULL means flush decoder */
> > + if (bs == NULL)
>
> To neat, !bs.
>
> > +static int vdec_h264_slice_get_param(void *h_vdec,
> > + enum vdec_get_param_type type, void *out)
> > +{
> > + struct vdec_h264_slice_inst *inst =
> > + (struct vdec_h264_slice_inst *)h_vdec;
>
> No need to cast from void *.
More information about the Linux-mediatek
mailing list