Lines Matching refs:ctx

120     JpegeVpu720HalCtx *ctx = (JpegeVpu720HalCtx *)hal;  in hal_jpege_vpu720_init()  local
126 ctx->regs = mpp_calloc(JpegeVpu720Reg, 1); in hal_jpege_vpu720_init()
127 ctx->cfg = cfg->cfg; in hal_jpege_vpu720_init()
129 ctx->frame_cnt = 0; in hal_jpege_vpu720_init()
130 ctx->enc_mode = JPEG_VPU720_ENC_MODE_ONE_FRAME; in hal_jpege_vpu720_init()
138 ctx->dev = cfg->dev; in hal_jpege_vpu720_init()
139 jpege_bits_init(&ctx->bits); in hal_jpege_vpu720_init()
140 mpp_assert(ctx->bits); in hal_jpege_vpu720_init()
141 if (ctx->group == NULL) { in hal_jpege_vpu720_init()
142 ret = mpp_buffer_group_get_internal(&ctx->group, MPP_BUFFER_TYPE_ION); in hal_jpege_vpu720_init()
149 ret = mpp_buffer_get(ctx->group, &ctx->qtbl_buffer, JPEGE_VPU720_QTABLE_SIZE * sizeof(RK_U16)); in hal_jpege_vpu720_init()
150 mpp_buffer_attach_dev(ctx->qtbl_buffer, ctx->dev); in hal_jpege_vpu720_init()
151 ctx->qtbl_sw_buf = (RK_U16 *)mpp_calloc(RK_U16, JPEGE_VPU720_QTABLE_SIZE); in hal_jpege_vpu720_init()
152 hal_jpege_rc_init(&ctx->hal_rc); in hal_jpege_vpu720_init()
161 JpegeVpu720HalCtx *ctx = (JpegeVpu720HalCtx *)hal; in hal_jpege_vpu720_deinit() local
164 jpege_bits_deinit(ctx->bits); in hal_jpege_vpu720_deinit()
166 MPP_FREE(ctx->regs); in hal_jpege_vpu720_deinit()
167 MPP_FREE(ctx->qtbl_sw_buf); in hal_jpege_vpu720_deinit()
169 if (ctx->dev) { in hal_jpege_vpu720_deinit()
170 mpp_dev_deinit(ctx->dev); in hal_jpege_vpu720_deinit()
171 ctx->dev = NULL; in hal_jpege_vpu720_deinit()
174 if (ctx->qtbl_buffer) { in hal_jpege_vpu720_deinit()
175 ret = mpp_buffer_put(ctx->qtbl_buffer); in hal_jpege_vpu720_deinit()
181 if (ctx->group) { in hal_jpege_vpu720_deinit()
182 ret = mpp_buffer_group_put(ctx->group); in hal_jpege_vpu720_deinit()
194 JpegeVpu720HalCtx *ctx = (JpegeVpu720HalCtx *) hal; in jpege_vpu720_setup_format() local
195 MppFrameFormat in_fmt = ctx->cfg->prep.format & MPP_FRAME_FMT_MASK; in jpege_vpu720_setup_format()
196 JpegeVpu720FmtCfg *fmt_cfg = &ctx->fmt_cfg; in jpege_vpu720_setup_format()
197 JpegeSyntax *syntax = &ctx->syntax; in jpege_vpu720_setup_format()
206 if (MPP_FRAME_FMT_IS_TILE(ctx->cfg->prep.format)) { in jpege_vpu720_setup_format()
320 ctx->fmt_cfg.out_format = JPEGE_VPU720_OUT_FMT_400; in jpege_vpu720_setup_format()
323 ctx->fmt_cfg.out_format = JPEGE_VPU720_OUT_FMT_420; in jpege_vpu720_setup_format()
326 ctx->fmt_cfg.out_format = JPEGE_VPU720_OUT_FMT_422; in jpege_vpu720_setup_format()
329 ctx->fmt_cfg.out_format = JPEGE_VPU720_OUT_FMT_444; in jpege_vpu720_setup_format()
332 ctx->fmt_cfg.out_format = JPEGE_VPU720_OUT_FMT_420; in jpege_vpu720_setup_format()
335 ctx->fmt_cfg.out_nb_comp = ctx->syntax.nb_components; in jpege_vpu720_setup_format()
337 switch (ctx->cfg->prep.chroma_ds_mode) { in jpege_vpu720_setup_format()
339 ctx->fmt_cfg.chroma_ds_mode = JPEG_VPU720_CHROMA_DOWN_SAMPLE_MODE_Average; in jpege_vpu720_setup_format()
342 ctx->fmt_cfg.chroma_ds_mode = JPEG_VPU720_CHROMA_DOWN_SAMPLE_MODE_Discard; in jpege_vpu720_setup_format()
345 ctx->fmt_cfg.chroma_ds_mode = JPEG_VPU720_CHROMA_DOWN_SAMPLE_MODE_Average; in jpege_vpu720_setup_format()
350 ctx->cfg->prep.format, ctx->cfg->prep.format_out, in jpege_vpu720_setup_format()
351 ctx->fmt_cfg.input_format, ctx->fmt_cfg.out_format, in jpege_vpu720_setup_format()
352 ctx->fmt_cfg.chroma_ds_mode); in jpege_vpu720_setup_format()
354 if (ctx->cfg->prep.mirroring) in jpege_vpu720_setup_format()
355 ctx->fmt_cfg.mirror = 1; in jpege_vpu720_setup_format()
357 if (ctx->cfg->prep.fix_chroma_en) { in jpege_vpu720_setup_format()
358 ctx->fmt_cfg.fix_chroma_en = 1; in jpege_vpu720_setup_format()
359 ctx->fmt_cfg.fix_chroma_u = ctx->cfg->prep.fix_chroma_u & 0xff; in jpege_vpu720_setup_format()
360 ctx->fmt_cfg.fix_chroma_v = ctx->cfg->prep.fix_chroma_v & 0xff; in jpege_vpu720_setup_format()
363 ctx->fmt_cfg.src_range = (ctx->cfg->prep.range == MPP_FRAME_RANGE_UNSPECIFIED) ? in jpege_vpu720_setup_format()
364 MPP_FRAME_RANGE_JPEG : ctx->cfg->prep.range; in jpege_vpu720_setup_format()
365 ctx->fmt_cfg.dst_range = (ctx->cfg->prep.range_out == MPP_FRAME_RANGE_UNSPECIFIED) ? in jpege_vpu720_setup_format()
366 MPP_FRAME_RANGE_JPEG : ctx->cfg->prep.range_out; in jpege_vpu720_setup_format()
374 JpegeVpu720HalCtx *ctx = (JpegeVpu720HalCtx *) hal; in hal_jpege_vpu720_gen_regs() local
375 JpegeVpu720Reg *regs = ctx->regs; in hal_jpege_vpu720_gen_regs()
377 JpegeBits bits = ctx->bits; in hal_jpege_vpu720_gen_regs()
381 JpegeSyntax *syntax = &ctx->syntax; in hal_jpege_vpu720_gen_regs()
382 RK_U8 *qtbl_base = (RK_U8 *)mpp_buffer_get_ptr(ctx->qtbl_buffer); in hal_jpege_vpu720_gen_regs()
398 hal_jpege_rc_update(&ctx->hal_rc, syntax); in hal_jpege_vpu720_gen_regs()
403 write_jpeg_header(bits, syntax, &ctx->hal_rc); in hal_jpege_vpu720_gen_regs()
412 reg_base->reg001_enc_strt.vepu_cmd = ctx->enc_mode; in hal_jpege_vpu720_gen_regs()
459 ctx->qtbl_sw_buf[i * 8 + j] = 0x8000 / ctx->hal_rc.qtables[0][j * 8 + i]; in hal_jpege_vpu720_gen_regs()
460 ctx->qtbl_sw_buf[64 + i * 8 + j] = 0x8000 / ctx->hal_rc.qtables[1][j * 8 + i]; in hal_jpege_vpu720_gen_regs()
464 memcpy(&ctx->qtbl_sw_buf[64 * 2], &ctx->qtbl_sw_buf[64], sizeof(RK_U16) * 64); in hal_jpege_vpu720_gen_regs()
473 reg_base->reg032_sw_src_fmt.src_fmt = ctx->fmt_cfg.input_format; in hal_jpege_vpu720_gen_regs()
474 reg_base->reg032_sw_src_fmt.out_fmt = ctx->fmt_cfg.out_format; in hal_jpege_vpu720_gen_regs()
475 reg_base->reg032_sw_src_fmt.rbuv_swap_jpeg = ctx->fmt_cfg.uv_swap; in hal_jpege_vpu720_gen_regs()
476 reg_base->reg032_sw_src_fmt.chroma_ds_mode = ctx->fmt_cfg.chroma_ds_mode; in hal_jpege_vpu720_gen_regs()
477 reg_base->reg032_sw_src_fmt.src_mirr_jpeg = ctx->fmt_cfg.mirror; in hal_jpege_vpu720_gen_regs()
478 reg_base->reg032_sw_src_fmt.chroma_force_en = ctx->fmt_cfg.fix_chroma_en; in hal_jpege_vpu720_gen_regs()
479 reg_base->reg032_sw_src_fmt.u_force_value = ctx->fmt_cfg.fix_chroma_u; in hal_jpege_vpu720_gen_regs()
480 reg_base->reg032_sw_src_fmt.v_force_value = ctx->fmt_cfg.fix_chroma_v; in hal_jpege_vpu720_gen_regs()
482 if (ctx->fmt_cfg.src_range != ctx->fmt_cfg.dst_range) { in hal_jpege_vpu720_gen_regs()
484 if (ctx->fmt_cfg.src_range == MPP_FRAME_RANGE_MPEG) in hal_jpege_vpu720_gen_regs()
493 reg_base->reg034_sw_src_strd_0.src_strd_0 = ctx->fmt_cfg.y_stride; in hal_jpege_vpu720_gen_regs()
494 reg_base->reg035_sw_src_strd_1.src_strd_1 = ctx->fmt_cfg.uv_stride; in hal_jpege_vpu720_gen_regs()
509 reg_base->reg016_adr_qtbl = mpp_buffer_get_fd(ctx->qtbl_buffer); in hal_jpege_vpu720_gen_regs()
510 memcpy(qtbl_base, ctx->qtbl_sw_buf, JPEGE_VPU720_QTABLE_SIZE * sizeof(RK_U16)); in hal_jpege_vpu720_gen_regs()
511 mpp_buffer_sync_end(ctx->qtbl_buffer); in hal_jpege_vpu720_gen_regs()
513 mpp_dev_set_reg_offset(ctx->dev, 20, mpp_packet_get_length(task->packet)); in hal_jpege_vpu720_gen_regs()
514 mpp_dev_set_reg_offset(ctx->dev, 17, mpp_buffer_get_size(task->output)); in hal_jpege_vpu720_gen_regs()
515 mpp_dev_set_reg_offset(ctx->dev, 23, ctx->fmt_cfg.u_offset); in hal_jpege_vpu720_gen_regs()
516 mpp_dev_set_reg_offset(ctx->dev, 24, ctx->fmt_cfg.v_offset); in hal_jpege_vpu720_gen_regs()
518 ctx->frame_num++; in hal_jpege_vpu720_gen_regs()
527 JpegeVpu720HalCtx *ctx = (JpegeVpu720HalCtx *) hal; in hal_jpege_vpu720_start() local
528 JpegeVpu720Reg *regs = ctx->regs; in hal_jpege_vpu720_start()
552 ret = mpp_dev_ioctl(ctx->dev, MPP_DEV_REG_WR, &cfg_base); in hal_jpege_vpu720_start()
561 ret = mpp_dev_ioctl(ctx->dev, MPP_DEV_REG_RD, &cfg_st); in hal_jpege_vpu720_start()
569 ret = mpp_dev_ioctl(ctx->dev, MPP_DEV_REG_RD, &cfg_st); in hal_jpege_vpu720_start()
575 ret = mpp_dev_ioctl(ctx->dev, MPP_DEV_CMD_SEND, NULL); in hal_jpege_vpu720_start()
587 JpegeVpu720HalCtx *ctx = (JpegeVpu720HalCtx *) hal; in hal_jpege_vpu720_wait() local
588 JpegeVpu720Reg *regs = (JpegeVpu720Reg *)ctx->regs; in hal_jpege_vpu720_wait()
599 ret = mpp_dev_ioctl(ctx->dev, MPP_DEV_CMD_POLL, NULL); in hal_jpege_vpu720_wait()
621 JpegeVpu720HalCtx *ctx = (JpegeVpu720HalCtx *) hal; in hal_jpege_vpu720_get_task() local
625 memcpy(&ctx->syntax, syntax, sizeof(ctx->syntax)); in hal_jpege_vpu720_get_task()
627 if (ctx->cfg->jpeg.update) { in hal_jpege_vpu720_get_task()
628 hal_jpege_rc_update(&ctx->hal_rc, syntax); in hal_jpege_vpu720_get_task()
629 ctx->cfg->jpeg.update = 0; in hal_jpege_vpu720_get_task()