Lines Matching refs:p

204 static RK_S32 get_mdinfo_size(MpiEncTestData *p, MppCodingType type)  in get_mdinfo_size()  argument
208 RK_U32 w = p->hor_stride, h = p->ver_stride; in get_mdinfo_size()
228 MpiEncTestData *p = &info->ctx; in kmpp_cfg_init() local
237 p->init_kcfg = init_kcfg; in kmpp_cfg_init()
240 mpp_venc_kcfg_set_u32(init_kcfg, "coding", p->type); in kmpp_cfg_init()
246 mpp_venc_kcfg_set_u32(init_kcfg, "smart_en", p->rc_mode == MPP_ENC_RC_MODE_SMTRC); in kmpp_cfg_init()
247 mpp_venc_kcfg_set_u32(init_kcfg, "max_width", p->width); in kmpp_cfg_init()
248 mpp_venc_kcfg_set_u32(init_kcfg, "max_height", p->height); in kmpp_cfg_init()
250 mpp_venc_kcfg_set_u32(init_kcfg, "qpmap_en", p->deblur_en); in kmpp_cfg_init()
259 ret = p->mpi->control(p->ctx, MPP_SET_VENC_INIT_KCFG, init_kcfg); in kmpp_cfg_init()
269 MpiEncTestData *p = &info->ctx; in test_ctx_init() local
273 p->width = cmd->width; in test_ctx_init()
274 p->height = cmd->height; in test_ctx_init()
275 p->hor_stride = (cmd->hor_stride) ? (cmd->hor_stride) : in test_ctx_init()
277 p->ver_stride = (cmd->ver_stride) ? (cmd->ver_stride) : in test_ctx_init()
279 p->fmt = cmd->format; in test_ctx_init()
280 p->type = cmd->type; in test_ctx_init()
281 p->bps = cmd->bps_target; in test_ctx_init()
282 p->bps_min = cmd->bps_min; in test_ctx_init()
283 p->bps_max = cmd->bps_max; in test_ctx_init()
284 p->rc_mode = cmd->rc_mode; in test_ctx_init()
285 p->frame_num = cmd->frame_num; in test_ctx_init()
286 if (cmd->type == MPP_VIDEO_CodingMJPEG && p->frame_num == 0) { in test_ctx_init()
288 p->frame_num = 1; in test_ctx_init()
291 p->frm_step = cmd->frm_step; in test_ctx_init()
292 p->gop_mode = cmd->gop_mode; in test_ctx_init()
293 p->gop_len = cmd->gop_len; in test_ctx_init()
294 p->vi_len = cmd->vi_len; in test_ctx_init()
295 p->fps_in_flex = cmd->fps_in_flex; in test_ctx_init()
296 p->fps_in_den = cmd->fps_in_den; in test_ctx_init()
297 p->fps_in_num = cmd->fps_in_num; in test_ctx_init()
298 p->fps_out_flex = cmd->fps_out_flex; in test_ctx_init()
299 p->fps_out_den = cmd->fps_out_den; in test_ctx_init()
300 p->fps_out_num = cmd->fps_out_num; in test_ctx_init()
301 p->scene_mode = cmd->scene_mode; in test_ctx_init()
302 p->deblur_en = cmd->deblur_en; in test_ctx_init()
303 p->cu_qp_delta_depth = cmd->cu_qp_delta_depth; in test_ctx_init()
304 p->anti_flicker_str = cmd->anti_flicker_str; in test_ctx_init()
305 p->atr_str_i = cmd->atr_str_i; in test_ctx_init()
306 p->atr_str_p = cmd->atr_str_p; in test_ctx_init()
307 p->atl_str = cmd->atl_str; in test_ctx_init()
308 p->sao_str_i = cmd->sao_str_i; in test_ctx_init()
309 p->sao_str_p = cmd->sao_str_p; in test_ctx_init()
310 p->mdinfo_size = get_mdinfo_size(p, cmd->type); in test_ctx_init()
315 p->cam_ctx = camera_source_init(cmd->file_input, 4, p->width, p->height, p->fmt); in test_ctx_init()
317 if (p->cam_ctx == NULL) in test_ctx_init()
320 p->fp_input = fopen(cmd->file_input, "rb"); in test_ctx_init()
321 if (NULL == p->fp_input) { in test_ctx_init()
329 p->fp_output = fopen(cmd->file_output, "w+b"); in test_ctx_init()
330 if (NULL == p->fp_output) { in test_ctx_init()
337 p->fp_verify = fopen(cmd->file_slt, "wt"); in test_ctx_init()
338 if (!p->fp_verify) in test_ctx_init()
343 switch (p->fmt & MPP_FRAME_FMT_MASK) { in test_ctx_init()
346 p->frame_size = MPP_ALIGN(p->hor_stride, 64) * MPP_ALIGN(p->ver_stride, 64) * 3 / 2; in test_ctx_init()
355 p->frame_size = MPP_ALIGN(p->hor_stride, 64) * MPP_ALIGN(p->ver_stride, 64) * 2; in test_ctx_init()
372 p->frame_size = MPP_ALIGN(p->hor_stride, 64) * MPP_ALIGN(p->ver_stride, 64); in test_ctx_init()
376 p->frame_size = MPP_ALIGN(p->hor_stride, 64) * MPP_ALIGN(p->ver_stride, 64) * 4; in test_ctx_init()
380 if (MPP_FRAME_FMT_IS_FBC(p->fmt)) { in test_ctx_init()
381 if ((p->fmt & MPP_FRAME_FBC_MASK) == MPP_FRAME_FBC_AFBC_V1) in test_ctx_init()
382p->header_size = MPP_ALIGN(MPP_ALIGN(p->width, 16) * MPP_ALIGN(p->height, 16) / 16, SZ_4K); in test_ctx_init()
384 p->header_size = MPP_ALIGN(p->width, 16) * MPP_ALIGN(p->height, 16) / 16; in test_ctx_init()
386 p->header_size = 0; in test_ctx_init()
392 MPP_RET test_ctx_deinit(MpiEncTestData *p) in test_ctx_deinit() argument
394 if (p) { in test_ctx_deinit()
395 if (p->cam_ctx) { in test_ctx_deinit()
396 camera_source_deinit(p->cam_ctx); in test_ctx_deinit()
397 p->cam_ctx = NULL; in test_ctx_deinit()
399 if (p->fp_input) { in test_ctx_deinit()
400 fclose(p->fp_input); in test_ctx_deinit()
401 p->fp_input = NULL; in test_ctx_deinit()
403 if (p->fp_output) { in test_ctx_deinit()
404 fclose(p->fp_output); in test_ctx_deinit()
405 p->fp_output = NULL; in test_ctx_deinit()
407 if (p->fp_verify) { in test_ctx_deinit()
408 fclose(p->fp_verify); in test_ctx_deinit()
409 p->fp_verify = NULL; in test_ctx_deinit()
418 MpiEncTestData *p = &info->ctx; in test_mpp_enc_cfg_setup() local
419 MppApi *mpi = p->mpi; in test_mpp_enc_cfg_setup()
420 MppCtx ctx = p->ctx; in test_mpp_enc_cfg_setup()
421 MppEncCfg cfg = p->cfg; in test_mpp_enc_cfg_setup()
427 RK_U32 gop_mode = p->gop_mode; in test_mpp_enc_cfg_setup()
431 if (p->fps_in_den == 0) in test_mpp_enc_cfg_setup()
432 p->fps_in_den = 1; in test_mpp_enc_cfg_setup()
433 if (p->fps_in_num == 0) in test_mpp_enc_cfg_setup()
434 p->fps_in_num = 30; in test_mpp_enc_cfg_setup()
435 if (p->fps_out_den == 0) in test_mpp_enc_cfg_setup()
436 p->fps_out_den = 1; in test_mpp_enc_cfg_setup()
437 if (p->fps_out_num == 0) in test_mpp_enc_cfg_setup()
438 p->fps_out_num = 30; in test_mpp_enc_cfg_setup()
440 if (!p->bps) in test_mpp_enc_cfg_setup()
441 p->bps = p->width * p->height / 8 * (p->fps_out_num / p->fps_out_den); in test_mpp_enc_cfg_setup()
443 mpp_enc_cfg_set_s32(cfg, "codec:type", p->type); in test_mpp_enc_cfg_setup()
446 mpp_enc_cfg_set_s32(cfg, "prep:width", p->width); in test_mpp_enc_cfg_setup()
447 mpp_enc_cfg_set_s32(cfg, "prep:height", p->height); in test_mpp_enc_cfg_setup()
448 mpp_enc_cfg_set_s32(cfg, "prep:hor_stride", p->hor_stride); in test_mpp_enc_cfg_setup()
449 mpp_enc_cfg_set_s32(cfg, "prep:ver_stride", p->ver_stride); in test_mpp_enc_cfg_setup()
450 mpp_enc_cfg_set_s32(cfg, "prep:format", p->fmt); in test_mpp_enc_cfg_setup()
462 mpp_enc_cfg_set_s32(cfg, "rc:mode", p->rc_mode); in test_mpp_enc_cfg_setup()
467 mpp_enc_cfg_set_s32(cfg, "rc:fps_in_flex", p->fps_in_flex); in test_mpp_enc_cfg_setup()
468 mpp_enc_cfg_set_s32(cfg, "rc:fps_in_num", p->fps_in_num); in test_mpp_enc_cfg_setup()
469 mpp_enc_cfg_set_s32(cfg, "rc:fps_in_denom", p->fps_in_den); in test_mpp_enc_cfg_setup()
470 mpp_enc_cfg_set_s32(cfg, "rc:fps_out_flex", p->fps_out_flex); in test_mpp_enc_cfg_setup()
471 mpp_enc_cfg_set_s32(cfg, "rc:fps_out_num", p->fps_out_num); in test_mpp_enc_cfg_setup()
472 mpp_enc_cfg_set_s32(cfg, "rc:fps_out_denom", p->fps_out_den); in test_mpp_enc_cfg_setup()
480 mpp_enc_cfg_set_s32(cfg, "rc:bps_target", p->bps); in test_mpp_enc_cfg_setup()
481 switch (p->rc_mode) { in test_mpp_enc_cfg_setup()
487 mpp_enc_cfg_set_s32(cfg, "rc:bps_max", p->bps_max ? p->bps_max : p->bps * 17 / 16); in test_mpp_enc_cfg_setup()
488 mpp_enc_cfg_set_s32(cfg, "rc:bps_min", p->bps_min ? p->bps_min : p->bps * 15 / 16); in test_mpp_enc_cfg_setup()
493 mpp_enc_cfg_set_s32(cfg, "rc:bps_max", p->bps_max ? p->bps_max : p->bps * 17 / 16); in test_mpp_enc_cfg_setup()
494 mpp_enc_cfg_set_s32(cfg, "rc:bps_min", p->bps_min ? p->bps_min : p->bps * 1 / 16); in test_mpp_enc_cfg_setup()
498 mpp_enc_cfg_set_s32(cfg, "rc:bps_max", p->bps_max ? p->bps_max : p->bps * 17 / 16); in test_mpp_enc_cfg_setup()
499 mpp_enc_cfg_set_s32(cfg, "rc:bps_min", p->bps_min ? p->bps_min : p->bps * 15 / 16); in test_mpp_enc_cfg_setup()
504 switch (p->type) { in test_mpp_enc_cfg_setup()
507 switch (p->rc_mode) { in test_mpp_enc_cfg_setup()
538 mpp_err_f("unsupport encoder rc mode %d\n", p->rc_mode); in test_mpp_enc_cfg_setup()
562 mpp_enc_cfg_set_s32(cfg, "codec:type", p->type); in test_mpp_enc_cfg_setup()
563 switch (p->type) { in test_mpp_enc_cfg_setup()
592 mpp_enc_cfg_set_s32(cfg, "h265:diff_cu_qp_delta_depth", p->cu_qp_delta_depth); in test_mpp_enc_cfg_setup()
598 mpp_err_f("unsupport encoder coding type %d\n", p->type); in test_mpp_enc_cfg_setup()
602 p->split_mode = 0; in test_mpp_enc_cfg_setup()
603 p->split_arg = 0; in test_mpp_enc_cfg_setup()
604 p->split_out = 0; in test_mpp_enc_cfg_setup()
606 mpp_env_get_u32("split_mode", &p->split_mode, MPP_ENC_SPLIT_NONE); in test_mpp_enc_cfg_setup()
607 mpp_env_get_u32("split_arg", &p->split_arg, 0); in test_mpp_enc_cfg_setup()
608 mpp_env_get_u32("split_out", &p->split_out, 0); in test_mpp_enc_cfg_setup()
610 if (p->split_mode) { in test_mpp_enc_cfg_setup()
612 p->split_mode, p->split_arg, p->split_out); in test_mpp_enc_cfg_setup()
613 mpp_enc_cfg_set_s32(cfg, "split:mode", p->split_mode); in test_mpp_enc_cfg_setup()
614 mpp_enc_cfg_set_s32(cfg, "split:arg", p->split_arg); in test_mpp_enc_cfg_setup()
615 mpp_enc_cfg_set_s32(cfg, "split:out", p->split_out); in test_mpp_enc_cfg_setup()
619 mpp_enc_cfg_set_s32(cfg, "rc:gop", p->gop_len ? p->gop_len : p->fps_out_num * 2); in test_mpp_enc_cfg_setup()
625 if (p->gop_mode < 4) in test_mpp_enc_cfg_setup()
628 mpi_enc_gen_smart_gop_ref_cfg(ref, p->gop_len, p->vi_len); in test_mpp_enc_cfg_setup()
634 mpp_enc_cfg_set_s32(cfg, "tune:anti_flicker_str", p->anti_flicker_str); in test_mpp_enc_cfg_setup()
636 mpp_enc_cfg_set_s32(cfg, "tune:atr_str_i", p->atr_str_i); in test_mpp_enc_cfg_setup()
637 mpp_enc_cfg_set_s32(cfg, "tune:atr_str_p", p->atr_str_p); in test_mpp_enc_cfg_setup()
638 mpp_enc_cfg_set_s32(cfg, "tune:atl_str", p->atl_str); in test_mpp_enc_cfg_setup()
641 mpp_enc_cfg_set_s32(cfg, "tune:sao_str_i", p->sao_str_i); in test_mpp_enc_cfg_setup()
642 mpp_enc_cfg_set_s32(cfg, "tune:sao_str_p", p->sao_str_p); in test_mpp_enc_cfg_setup()
646 mpp_enc_cfg_set_s32(cfg, "tune:scene_mode", p->scene_mode); in test_mpp_enc_cfg_setup()
668 if (p->type == MPP_VIDEO_CodingAVC) { in test_mpp_enc_cfg_setup()
670 } else if (p->type == MPP_VIDEO_CodingHEVC) { in test_mpp_enc_cfg_setup()
705 p->sei_mode = sei_mode; in test_mpp_enc_cfg_setup()
706 ret = mpi->control(ctx, MPP_ENC_SET_SEI_CFG, &p->sei_mode); in test_mpp_enc_cfg_setup()
713 if (p->type == MPP_VIDEO_CodingAVC || p->type == MPP_VIDEO_CodingHEVC) { in test_mpp_enc_cfg_setup()
714 p->header_mode = MPP_ENC_HEADER_MODE_EACH_IDR; in test_mpp_enc_cfg_setup()
715 ret = mpi->control(ctx, MPP_ENC_SET_HEADER_MODE, &p->header_mode); in test_mpp_enc_cfg_setup()
723 mpp_env_get_u32("osd_enable", &p->osd_enable, 0); in test_mpp_enc_cfg_setup()
724 mpp_env_get_u32("roi_jpeg_enable", &p->roi_jpeg_enable, 0); in test_mpp_enc_cfg_setup()
725 mpp_env_get_u32("jpeg_osd_case", &p->jpeg_osd_case, 0); in test_mpp_enc_cfg_setup()
726 mpp_env_get_u32("osd_mode", &p->osd_mode, MPP_ENC_OSD_PLT_TYPE_DEFAULT); in test_mpp_enc_cfg_setup()
727 mpp_env_get_u32("roi_enable", &p->roi_enable, 0); in test_mpp_enc_cfg_setup()
728 mpp_env_get_u32("user_data_enable", &p->user_data_enable, 0); in test_mpp_enc_cfg_setup()
730 if (p->roi_enable) { in test_mpp_enc_cfg_setup()
731 mpp_enc_roi_init(&p->roi_ctx, p->width, p->height, p->type, 4); in test_mpp_enc_cfg_setup()
732 mpp_assert(p->roi_ctx); in test_mpp_enc_cfg_setup()
742 MpiEncTestData *p = &info->ctx; in test_mpp_run() local
743 MppApi *mpi = p->mpi; in test_mpp_run()
744 MppCtx ctx = p->ctx; in test_mpp_run()
758 if (p->type == MPP_VIDEO_CodingAVC || p->type == MPP_VIDEO_CodingHEVC) { in test_mpp_run()
766 mpp_packet_init_with_buffer(&packet, p->pkt_buf); in test_mpp_run()
780 if (p->fp_output) in test_mpp_run()
781 fwrite(ptr, 1, len, p->fp_output); in test_mpp_run()
786 sse_unit_in_pixel = p->type == MPP_VIDEO_CodingAVC ? 16 : 8; in test_mpp_run()
787 psnr_const = (16 + log2(MPP_ALIGN(p->width, sse_unit_in_pixel) * in test_mpp_run()
788 MPP_ALIGN(p->height, sse_unit_in_pixel))); in test_mpp_run()
790 while (!p->pkt_eos) { in test_mpp_run()
794 void *buf = mpp_buffer_get_ptr(p->frm_buf); in test_mpp_run()
799 if (p->fp_input) { in test_mpp_run()
800 mpp_buffer_sync_begin(p->frm_buf); in test_mpp_run()
801 ret = read_image(buf, p->fp_input, p->width, p->height, in test_mpp_run()
802 p->hor_stride, p->ver_stride, p->fmt); in test_mpp_run()
803 if (ret == MPP_NOK || feof(p->fp_input)) { in test_mpp_run()
804 p->frm_eos = 1; in test_mpp_run()
806 if (p->frame_num < 0) { in test_mpp_run()
807 clearerr(p->fp_input); in test_mpp_run()
808 rewind(p->fp_input); in test_mpp_run()
809 p->frm_eos = 0; in test_mpp_run()
810 mpp_log_q(quiet, "chn %d loop times %d\n", chn, ++p->loop_times); in test_mpp_run()
813 mpp_log_q(quiet, "chn %d found last frame. feof %d\n", chn, feof(p->fp_input)); in test_mpp_run()
816 mpp_buffer_sync_end(p->frm_buf); in test_mpp_run()
818 if (p->cam_ctx == NULL) { in test_mpp_run()
819 mpp_buffer_sync_begin(p->frm_buf); in test_mpp_run()
820 ret = fill_image(buf, p->width, p->height, p->hor_stride, in test_mpp_run()
821 p->ver_stride, p->fmt, p->frame_count * p->frm_step); in test_mpp_run()
824 mpp_buffer_sync_end(p->frm_buf); in test_mpp_run()
826 cam_frm_idx = camera_source_get_frame(p->cam_ctx); in test_mpp_run()
831 camera_source_put_frame(p->cam_ctx, cam_frm_idx); in test_mpp_run()
835 cam_buf = camera_frame_to_buf(p->cam_ctx, cam_frm_idx); in test_mpp_run()
846 mpp_frame_set_width(frame, p->width); in test_mpp_run()
847 mpp_frame_set_height(frame, p->height); in test_mpp_run()
848 mpp_frame_set_hor_stride(frame, p->hor_stride); in test_mpp_run()
849 mpp_frame_set_ver_stride(frame, p->ver_stride); in test_mpp_run()
850 mpp_frame_set_fmt(frame, p->fmt); in test_mpp_run()
851 mpp_frame_set_eos(frame, p->frm_eos); in test_mpp_run()
853 if (p->fp_input && feof(p->fp_input)) in test_mpp_run()
858 mpp_frame_set_buffer(frame, p->frm_buf); in test_mpp_run()
861 mpp_packet_init_with_buffer(&packet, p->pkt_buf); in test_mpp_run()
865 mpp_meta_set_buffer(meta, KEY_MOTION_INFO, p->md_info); in test_mpp_run()
867 if (p->osd_enable || p->user_data_enable || p->roi_enable || p->roi_jpeg_enable) { in test_mpp_run()
868 if (p->user_data_enable) { in test_mpp_run()
872 if ((p->frame_count & 10) == 0) { in test_mpp_run()
900 if (p->osd_enable) { in test_mpp_run()
904 if (!p->osd_pattern) { in test_mpp_run()
905 osd3_gen_smpte_bar_argb(&p->osd_pattern); in test_mpp_run()
908 if (p->type == MPP_VIDEO_CodingMJPEG) { in test_mpp_run()
909 osd_case = p->jpeg_osd_case; in test_mpp_run()
911 osd_case = p->frame_count; in test_mpp_run()
914 osd3_get_test_case(&p->osd_data3, p->osd_pattern, in test_mpp_run()
915 (RK_U32)osd_case % OSD_CASE_BUTT, &p->osd_buffer); in test_mpp_run()
917 mpp_meta_set_ptr(meta, KEY_OSD_DATA3, (void*)&p->osd_data3); in test_mpp_run()
920 mpi_enc_gen_osd_plt(&p->osd_plt, p->frame_count); in test_mpp_run()
922 p->osd_plt_cfg.change = MPP_ENC_OSD_PLT_CFG_CHANGE_ALL; in test_mpp_run()
923 p->osd_plt_cfg.type = MPP_ENC_OSD_PLT_TYPE_USERDEF; in test_mpp_run()
924 p->osd_plt_cfg.plt = &p->osd_plt; in test_mpp_run()
926 ret = mpi->control(ctx, MPP_ENC_SET_OSD_PLT_CFG, &p->osd_plt_cfg); in test_mpp_run()
933 mpi_enc_gen_osd_data(&p->osd_data, p->buf_grp, p->width, in test_mpp_run()
934 p->height, p->frame_count); in test_mpp_run()
935 mpp_meta_set_ptr(meta, KEY_OSD_DATA, (void*)&p->osd_data); in test_mpp_run()
939 if (p->roi_enable) { in test_mpp_run()
940 RoiRegionCfg *region = &p->roi_region; in test_mpp_run()
943 region->x = MPP_ALIGN(p->width / 8, 16); in test_mpp_run()
944 region->y = MPP_ALIGN(p->height / 8, 16); in test_mpp_run()
951 mpp_enc_roi_add_region(p->roi_ctx, region); in test_mpp_run()
953 region->x = MPP_ALIGN(p->width / 2, 16); in test_mpp_run()
954 region->y = MPP_ALIGN(p->height / 4, 16); in test_mpp_run()
961 mpp_enc_roi_add_region(p->roi_ctx, region); in test_mpp_run()
964 mpp_enc_roi_setup_meta(p->roi_ctx, meta); in test_mpp_run()
967 if (p->roi_jpeg_enable) { in test_mpp_run()
974 p->roi_jpeg_cfg.change = 1; in test_mpp_run()
975 p->roi_jpeg_cfg.non_roi_en = 1; in test_mpp_run()
976 p->roi_jpeg_cfg.non_roi_level = 0; in test_mpp_run()
979 if ((start_x + width) > p->width || (start_y + height) > p->height) in test_mpp_run()
981 p->roi_jpeg_cfg.regions[index].roi_en = 1; in test_mpp_run()
982 p->roi_jpeg_cfg.regions[index].x = start_x; in test_mpp_run()
983 p->roi_jpeg_cfg.regions[index].y = start_y; in test_mpp_run()
984 p->roi_jpeg_cfg.regions[index].w = width; in test_mpp_run()
985 p->roi_jpeg_cfg.regions[index].h = height; in test_mpp_run()
986 p->roi_jpeg_cfg.regions[index].level = 63; in test_mpp_run()
993 ret = mpi->control(ctx, MPP_ENC_SET_JPEG_ROI_CFG, &p->roi_jpeg_cfg); in test_mpp_run()
995 mpp_meta_set_ptr(meta, KEY_JPEG_ROI_DATA, (void*)&p->roi_jpeg_cfg); in test_mpp_run()
999 if (!p->first_frm) in test_mpp_run()
1000 p->first_frm = mpp_time(); in test_mpp_run()
1034 if (!p->first_pkt) in test_mpp_run()
1035 p->first_pkt = mpp_time(); in test_mpp_run()
1037 p->pkt_eos = mpp_packet_get_eos(packet); in test_mpp_run()
1039 if (p->fp_output) in test_mpp_run()
1040 fwrite(ptr, 1, len, p->fp_output); in test_mpp_run()
1042 if (p->fp_verify && !p->pkt_eos) { in test_mpp_run()
1044 mpp_log("p->frame_count=%d, len=%d\n", p->frame_count, len); in test_mpp_run()
1045 write_data_crc(p->fp_verify, &checkcrc); in test_mpp_run()
1049 "encoded frame %-4d", p->frame_count); in test_mpp_run()
1056 " pkt %d", p->frm_pkt_cnt); in test_mpp_run()
1057 p->frm_pkt_cnt = (eoi) ? (0) : (p->frm_pkt_cnt + 1); in test_mpp_run()
1103 p->stream_size += len; in test_mpp_run()
1104 p->frame_count += eoi; in test_mpp_run()
1106 if (p->pkt_eos) { in test_mpp_run()
1108 mpp_assert(p->frm_eos); in test_mpp_run()
1114 camera_source_put_frame(p->cam_ctx, cam_frm_idx); in test_mpp_run()
1116 if (p->frame_num > 0 && p->frame_count >= p->frame_num) in test_mpp_run()
1119 if (p->loop_end) in test_mpp_run()
1122 if (p->frm_eos && p->pkt_eos) in test_mpp_run()
1135 MpiEncTestData *p = &info->ctx; in enc_test() local
1151 … ret = mpp_buffer_group_get_internal(&p->buf_grp, MPP_BUFFER_TYPE_DRM | MPP_BUFFER_FLAGS_CACHABLE); in enc_test()
1157 ret = mpp_buffer_get(p->buf_grp, &p->frm_buf, p->frame_size + p->header_size); in enc_test()
1163 ret = mpp_buffer_get(p->buf_grp, &p->pkt_buf, p->frame_size); in enc_test()
1169 ret = mpp_buffer_get(p->buf_grp, &p->md_info, p->mdinfo_size); in enc_test()
1176 ret = mpp_create(&p->ctx, &p->mpi); in enc_test()
1183 p->ctx, p->width, p->height, p->type); in enc_test()
1185 ret = p->mpi->control(p->ctx, MPP_SET_OUTPUT_TIMEOUT, &timeout); in enc_test()
1194 ret = mpp_init(p->ctx, MPP_CTX_ENC, p->type); in enc_test()
1201 ret = mpp_enc_cfg_init_k(&p->cfg); in enc_test()
1203 ret = mpp_enc_cfg_init(&p->cfg); in enc_test()
1209 ret = p->mpi->control(p->ctx, MPP_ENC_GET_CFG, p->cfg); in enc_test()
1229 ret = p->mpi->reset(p->ctx); in enc_test()
1236 enc_ret->frame_count = p->frame_count; in enc_test()
1237 enc_ret->stream_size = p->stream_size; in enc_test()
1238 enc_ret->frame_rate = (float)p->frame_count * 1000000 / enc_ret->elapsed_time; in enc_test()
1239 enc_ret->bit_rate = (p->stream_size * 8 * (p->fps_out_num / p->fps_out_den)) / p->frame_count; in enc_test()
1240 enc_ret->delay = p->first_pkt - p->first_frm; in enc_test()
1243 if (p->ctx) { in enc_test()
1244 mpp_destroy(p->ctx); in enc_test()
1245 p->ctx = NULL; in enc_test()
1248 if (p->cfg) { in enc_test()
1249 mpp_enc_cfg_deinit(p->cfg); in enc_test()
1250 p->cfg = NULL; in enc_test()
1253 if (p->frm_buf) { in enc_test()
1254 mpp_buffer_put(p->frm_buf); in enc_test()
1255 p->frm_buf = NULL; in enc_test()
1258 if (p->pkt_buf) { in enc_test()
1259 mpp_buffer_put(p->pkt_buf); in enc_test()
1260 p->pkt_buf = NULL; in enc_test()
1263 if (p->md_info) { in enc_test()
1264 mpp_buffer_put(p->md_info); in enc_test()
1265 p->md_info = NULL; in enc_test()
1268 if (p->osd_data.buf) { in enc_test()
1269 mpp_buffer_put(p->osd_data.buf); in enc_test()
1270 p->osd_data.buf = NULL; in enc_test()
1273 if (p->osd_buffer) { in enc_test()
1274 kmpp_obj_put_f(p->osd_buffer); in enc_test()
1275 p->osd_buffer = NULL; in enc_test()
1278 if (p->buf_grp) { in enc_test()
1279 mpp_buffer_group_put(p->buf_grp); in enc_test()
1280 p->buf_grp = NULL; in enc_test()
1283 if (p->roi_ctx) { in enc_test()
1284 mpp_enc_roi_deinit(p->roi_ctx); in enc_test()
1285 p->roi_ctx = NULL; in enc_test()
1287 if (p->init_kcfg) in enc_test()
1288 mpp_venc_kcfg_deinit(p->init_kcfg); in enc_test()
1290 if (p->osd_pattern) { in enc_test()
1291 free(p->osd_pattern); in enc_test()
1292 p->osd_pattern = NULL; in enc_test()
1295 test_ctx_deinit(p); in enc_test()