Lines Matching refs:ps_ctxt
514 plugin_ctxt_t *ps_ctxt = (plugin_ctxt_t *)pv_ctxt;
515 app_ctxt_t *ps_app_ctxt = &ps_ctxt->s_app_ctxt;
546 ps_ctxt->aaas_out_bufs[i4_res_id][i4_br_id][idx].i4_timestamp_low =
548 ps_ctxt->aaas_out_bufs[i4_res_id][i4_br_id][idx].i4_timestamp_high =
550 ps_ctxt->aaas_out_bufs[i4_res_id][i4_br_id][idx].i4_bytes_gen =
552 ps_ctxt->aaas_out_bufs[i4_res_id][i4_br_id][idx].i4_is_key_frame = 0;
553 ps_ctxt->aaas_out_bufs[i4_res_id][i4_br_id][idx].i4_end_flag = end_flag;
558 ps_ctxt->aaas_out_bufs[i4_res_id][i4_br_id][idx].i4_is_key_frame = 1;
562 ps_ctxt->aaas_out_bufs[i4_res_id][i4_br_id][idx].i4_is_prod = 1;
596 plugin_ctxt_t *ps_ctxt;
626 ps_ctxt = (plugin_ctxt_t *)memory_alloc(NULL, sizeof(plugin_ctxt_t));
627 if(NULL == ps_ctxt)
633 memset(ps_ctxt, 0, sizeof(plugin_ctxt_t));
636 ps_ctxt->ihevce_mem_alloc = memory_alloc;
637 ps_ctxt->ihevce_mem_free = memory_free;
639 ps_ctxt->u8_num_frames_encoded = 0;
646 ps_ctxt->pv_osal_handle = memory_alloc(NULL, OSAL_HANDLE_SIZE);
653 status = osal_init(ps_ctxt->pv_osal_handle);
661 status = osal_register_callbacks(ps_ctxt->pv_osal_handle, &s_cb_funcs);
687 ps_app_ctxt = &ps_ctxt->s_app_ctxt;
689 ps_ctxt->ps_static_cfg_prms = (ihevce_static_cfg_params_t *)ps_ctxt->ihevce_mem_alloc(
691 if(NULL == ps_ctxt->ps_static_cfg_prms)
706 memcpy(ps_ctxt->ps_static_cfg_prms, ps_params, sizeof(ihevce_static_cfg_params_t));
708 ps_ctxt->ps_static_cfg_prms->s_src_prms.i4_orig_width =
709 ps_ctxt->ps_static_cfg_prms->s_src_prms.i4_width;
710 if(HEVCE_MIN_WIDTH > ps_ctxt->ps_static_cfg_prms->s_src_prms.i4_width)
712 ps_ctxt->ps_static_cfg_prms->s_src_prms.i4_width = HEVCE_MIN_WIDTH;
715 ps_ctxt->ps_static_cfg_prms->s_src_prms.i4_orig_height =
716 ps_ctxt->ps_static_cfg_prms->s_src_prms.i4_height;
717 if(HEVCE_MIN_HEIGHT > ps_ctxt->ps_static_cfg_prms->s_src_prms.i4_height)
719 ps_ctxt->ps_static_cfg_prms->s_src_prms.i4_height = HEVCE_MIN_HEIGHT;
723 ps_ctxt->ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[0].i4_width =
724 ps_ctxt->ps_static_cfg_prms->s_src_prms.i4_width;
725 ps_ctxt->ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[0].i4_height =
726 ps_ctxt->ps_static_cfg_prms->s_src_prms.i4_height;
729 ps_ctxt->ps_static_cfg_prms->s_coding_tools_prms.i4_max_closed_gop_period =
731 ps_ctxt->ps_static_cfg_prms->s_coding_tools_prms.i4_max_closed_gop_period);
732 ps_ctxt->ps_static_cfg_prms->s_coding_tools_prms.i4_max_cra_open_gop_period =
734 ps_ctxt->ps_static_cfg_prms->s_coding_tools_prms.i4_max_cra_open_gop_period);
735 ps_ctxt->ps_static_cfg_prms->s_coding_tools_prms.i4_max_i_open_gop_period =
737 ps_ctxt->ps_static_cfg_prms->s_coding_tools_prms.i4_max_i_open_gop_period);
743 (ihevce_hle_ctxt_t *)ps_ctxt->ihevce_mem_alloc(NULL, sizeof(ihevce_hle_ctxt_t));
754 ps_ctxt->pv_hle_interface_ctxt = ps_interface_ctxt;
757 ps_interface_ctxt->ps_static_cfg_prms = ps_ctxt->ps_static_cfg_prms;
760 ps_interface_ctxt->pv_inp_cb_handle = (void *)ps_ctxt;
761 ps_interface_ctxt->pv_out_cb_handle = (void *)ps_ctxt;
762 ps_interface_ctxt->pv_recon_cb_handle = (void *)ps_ctxt;
764 ps_interface_ctxt->pv_osal_handle = ps_ctxt->pv_osal_handle;
780 ps_interface_ctxt->pv_cmd_err_cb_handle = (void *)ps_ctxt;
793 ps_ctxt->ihevce_mem_free(NULL, ps_ctxt->ps_static_cfg_prms);
796 memory_free(NULL, ps_ctxt->pv_osal_handle);
799 memory_free(NULL, ps_ctxt);
831 i4_num_resolutions = ps_ctxt->ps_static_cfg_prms->s_tgt_lyr_prms.i4_num_res_layers;
843 ps_ctxt->ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_res_id]
869 ps_ctxt->s_memtab_inp_data_buf.i4_size = sizeof(iv_mem_rec_t);
870 ps_ctxt->s_memtab_inp_data_buf.i4_mem_alignment = 4;
871 ps_ctxt->s_memtab_inp_data_buf.i4_mem_size =
873 ps_ctxt->s_memtab_inp_data_buf.e_mem_type = IV_EXT_CACHEABLE_NUMA_NODE0_MEM;
876 ps_app_ctxt->pv_mem_mngr_handle, ps_sys_api, &ps_ctxt->s_memtab_inp_data_buf);
878 pu1_tmp_buf = (UWORD8 *)ps_ctxt->s_memtab_inp_data_buf.pv_base;
909 ps_ctxt->as_memtab_out_data_buf[i4_res_id][i4_br_id].i4_size =
911 ps_ctxt->as_memtab_out_data_buf[i4_res_id][i4_br_id].i4_mem_alignment = 4;
915 ps_ctxt->as_memtab_out_data_buf[i4_res_id][i4_br_id].i4_mem_size =
923 ps_ctxt->as_memtab_out_data_buf[i4_res_id][i4_br_id].i4_mem_size =
928 ps_ctxt->as_memtab_out_data_buf[i4_res_id][i4_br_id].e_mem_type =
934 &ps_ctxt->as_memtab_out_data_buf[i4_res_id][i4_br_id]);
937 (UWORD8 *)ps_ctxt->as_memtab_out_data_buf[i4_res_id][i4_br_id].pv_base;
963 ps_ctxt->i4_num_out_bufs = i4_num_out_bufs;
964 ps_ctxt->ai4_free_out_buf_idx[i4_res_id][i4_br_id] = 0;
965 ps_ctxt->i4_prod_out_buf_idx = 0;
967 /* Assert to make sure ps_ctxt->aaas_out_bufs[i4_res_id][i4_br_id][] array
968 has more bufs than ps_ctxt->i4_num_out_bufs. Needed to identify
970 ASSERT(ps_ctxt->i4_num_out_bufs <= MAX_NUM_OUT_DATA_BUFS);
975 ps_ctxt->aaas_out_bufs[i4_res_id][i4_br_id][ctr].i4_idx = ctr;
976 ps_ctxt->aaas_out_bufs[i4_res_id][i4_br_id][ctr].i4_is_free = 1;
977 ps_ctxt->aaas_out_bufs[i4_res_id][i4_br_id][ctr].i4_is_prod = 0;
978 ps_ctxt->aaas_out_bufs[i4_res_id][i4_br_id][ctr].i4_bytes_gen = 0;
979 ps_ctxt->aaas_out_bufs[i4_res_id][i4_br_id][ctr].pu1_buf = pu1_tmp_buf;
980 ps_ctxt->aaas_out_bufs[i4_res_id][i4_br_id][ctr].i4_buf_size = buf_size;
987 .pv_app_out_strm_buf_mutex_hdl = osal_mutex_create(ps_ctxt->pv_osal_handle);
1000 osal_cond_var_create(ps_ctxt->pv_osal_handle);
1017 ps_ctxt->s_memtab_inp_sync_ctrl_buf.i4_size = sizeof(iv_mem_rec_t);
1018 ps_ctxt->s_memtab_inp_sync_ctrl_buf.i4_mem_alignment = 4;
1019 ps_ctxt->s_memtab_inp_sync_ctrl_buf.i4_mem_size =
1021 ps_ctxt->s_memtab_inp_sync_ctrl_buf.e_mem_type = IV_EXT_CACHEABLE_NUMA_NODE0_MEM;
1026 &ps_ctxt->s_memtab_inp_sync_ctrl_buf);
1028 pu1_tmp_buf = (UWORD8 *)ps_ctxt->s_memtab_inp_sync_ctrl_buf.pv_base;
1049 ps_ctxt->pu1_inp_async_ctrl_buf = (UWORD8 *)ps_ctxt->ihevce_mem_alloc(
1051 if(ps_ctxt->pu1_inp_async_ctrl_buf == NULL)
1059 pu1_tmp_buf = ps_ctxt->pu1_inp_async_ctrl_buf;
1159 ps_ctxt->pv_hle_thread_hdl =
1160 osal_thread_create(ps_ctxt->pv_osal_handle, &s_thread_attr);
1161 if(NULL == ps_ctxt->pv_hle_thread_hdl)
1184 ps_ctxt->i4_flush_mode_on = 0;
1194 ps_ctxt->ai4_out_end_flag[i4_res_id][i4_br_id] = 0;
1200 ps_ctxt->i4_field_id = 0;
1203 ps_ctxt->i8_dts = -1;
1205 if(0 != ps_ctxt->ps_static_cfg_prms->s_coding_tools_prms.i4_max_temporal_layers)
1207 ps_ctxt->i8_dts =
1209 (1 << ps_ctxt->ps_static_cfg_prms->s_coding_tools_prms.i4_max_temporal_layers);
1216 max_cu_size = (1 << ps_ctxt->ps_static_cfg_prms->s_config_prms.i4_max_log2_cu_size);
1217 ps_ctxt->i4_frm_stride =
1218 ps_ctxt->ps_static_cfg_prms->s_src_prms.i4_width +
1219 SET_CTB_ALIGN(ps_ctxt->ps_static_cfg_prms->s_src_prms.i4_width, max_cu_size);
1225 memory_free(NULL, ps_ctxt);
1231 memset(&ps_ctxt->ai4_old_bitrate[0][0], 0, sizeof(ps_ctxt->ai4_old_bitrate));
1233 ps_ctxt->ai4_old_bitrate[0][0] = ps_params->s_tgt_lyr_prms.as_tgt_params[0].ai4_tgt_bitrate[0];
1236 *ppv_ihevce_hdl = (void *)ps_ctxt;
1242 ihevce_receive_out_buffer(plugin_ctxt_t *ps_ctxt, ihevce_out_buf_t *ps_out)
1244 app_ctxt_t *ps_app_ctxt = &ps_ctxt->s_app_ctxt;
1249 i4_num_resolutions = ps_ctxt->ps_static_cfg_prms->s_tgt_lyr_prms.i4_num_res_layers;
1253 ps_ctxt->ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_res_id]
1283 ps_ctxt->aaas_out_bufs[i4_res_id][i4_br_id][ps_ctxt->i4_prod_out_buf_idx]
1286 ps_ctxt->aaas_out_bufs[i4_res_id][i4_br_id][ps_ctxt->i4_prod_out_buf_idx]
1322 ps_ctxt->aaas_out_bufs[i4_res_id][i4_br_id][ps_ctxt->i4_prod_out_buf_idx]
1327 ps_ctxt->aaas_out_bufs[0][0][ps_ctxt->i4_prod_out_buf_idx].i4_bytes_gen;
1329 ps_ctxt->aaas_out_bufs[0][0][ps_ctxt->i4_prod_out_buf_idx].pu1_buf;
1336 ps_ctxt->aaas_out_bufs[0][0][ps_ctxt->i4_prod_out_buf_idx].i4_is_key_frame;
1338 ps_ctxt->aaas_out_bufs[0][0][ps_ctxt->i4_prod_out_buf_idx].i4_timestamp_low;
1342 ps_ctxt->aaas_out_bufs[0][0][ps_ctxt->i4_prod_out_buf_idx].i4_timestamp_high)
1345 ps_ctxt->aaas_out_bufs[0][0][ps_ctxt->i4_prod_out_buf_idx].i4_end_flag;
1346 ps_out->i8_dts = ps_ctxt->i8_dts;
1349 ps_ctxt->i8_dts++;
1355 ps_ctxt->i4_prod_out_buf_idx++;
1358 if(ps_ctxt->i4_prod_out_buf_idx == ps_ctxt->i4_num_out_bufs)
1360 ps_ctxt->i4_prod_out_buf_idx = 0;
1375 if(0 == ps_ctxt->i4_flush_mode_on)
1405 ihevce_queue_out_buffer(plugin_ctxt_t *ps_ctxt, WORD32 i4_res_id, WORD32 i4_br_id)
1407 app_ctxt_t *ps_app_ctxt = &ps_ctxt->s_app_ctxt;
1408 ihevce_hle_ctxt_t *ps_interface_ctxt = (ihevce_hle_ctxt_t *)ps_ctxt->pv_hle_interface_ctxt;
1414 if(0 == ps_ctxt->ai4_out_end_flag[i4_res_id][i4_br_id])
1421 free_idx = ps_ctxt->ai4_free_out_buf_idx[i4_res_id][i4_br_id];
1423 if(1 == ps_ctxt->aaas_out_bufs[i4_res_id][i4_br_id][free_idx].i4_is_free)
1442 ps_ctxt->ai4_out_end_flag[i4_res_id][i4_br_id] = 1;
1448 ASSERT(ps_ctxt->aaas_out_bufs[i4_res_id][i4_br_id][free_idx].i4_is_free == 1);
1449 ASSERT(free_idx == ps_ctxt->aaas_out_bufs[i4_res_id][i4_br_id][free_idx].i4_idx);
1452 (void *)ps_ctxt->aaas_out_bufs[i4_res_id][i4_br_id][free_idx].pu1_buf;
1454 ps_ctxt->aaas_out_bufs[i4_res_id][i4_br_id][free_idx].i4_idx;
1455 ps_ctxt->aaas_out_bufs[i4_res_id][i4_br_id][free_idx].i4_is_free = 0;
1456 ps_ctxt->aaas_out_bufs[i4_res_id][i4_br_id][free_idx].i4_is_prod = 0;
1457 ps_ctxt->aaas_out_bufs[i4_res_id][i4_br_id][free_idx].i4_bytes_gen = 0;
1459 ps_ctxt->ai4_free_out_buf_idx[i4_res_id][i4_br_id]++;
1462 if(ps_ctxt->ai4_free_out_buf_idx[i4_res_id][i4_br_id] == ps_ctxt->i4_num_out_bufs)
1464 ps_ctxt->ai4_free_out_buf_idx[i4_res_id][i4_br_id] = 0;
1502 plugin_ctxt_t *ps_ctxt;
1516 ps_ctxt = (plugin_ctxt_t *)pv_ihevce_hdl;
1518 ps_sys_api = &ps_ctxt->ps_static_cfg_prms->s_sys_api;
1520 if((0 == ps_ctxt->ps_static_cfg_prms->i4_res_id) &&
1521 (0 == ps_ctxt->ps_static_cfg_prms->i4_br_id))
1523 ps_interface_ctxt = (ihevce_hle_ctxt_t *)ps_ctxt->pv_hle_interface_ctxt;
1524 ps_app_ctxt = &ps_ctxt->s_app_ctxt;
1525 i4_num_resolutions = ps_ctxt->ps_static_cfg_prms->s_tgt_lyr_prms.i4_num_res_layers;
1527 if(1 != ps_ctxt->i4_flush_mode_on)
1532 ps_ctxt->ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_res_id]
1537 ihevce_queue_out_buffer(ps_ctxt, i4_res_id, i4_br_id);
1577 ps_ctxt->i4_flush_mode_on = 1;
1587 osal_thread_wait(ps_ctxt->pv_hle_thread_hdl);
1590 osal_thread_destroy(ps_ctxt->pv_hle_thread_hdl);
1601 ps_ctxt->ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_res_id]
1608 &ps_ctxt->as_memtab_out_data_buf[i4_res_id][i4_br_id]);
1619 ps_ctxt->ihevce_mem_free(NULL, ps_ctxt->pu1_out_ctrl_buf);
1620 ps_ctxt->ihevce_mem_free(NULL, ps_ctxt->pu1_inp_async_ctrl_buf);
1625 mem_mngr_free(ps_app_ctxt->pv_mem_mngr_handle, &ps_ctxt->s_memtab_inp_data_buf);
1626 mem_mngr_free(ps_app_ctxt->pv_mem_mngr_handle, &ps_ctxt->s_memtab_inp_sync_ctrl_buf);
1635 ps_ctxt->ihevce_mem_free(NULL, ps_ctxt->pv_hle_interface_ctxt);
1637 if(ps_ctxt->ps_static_cfg_prms->i4_enable_csv_dump)
1640 (void *)ps_sys_api->pv_cb_handle, ps_ctxt->ps_static_cfg_prms->apF_csv_file[0][0]);
1644 ps_ctxt->ihevce_mem_free(NULL, ps_ctxt->ps_static_cfg_prms);
1647 memory_free(NULL, ps_ctxt->pv_osal_handle);
1832 plugin_ctxt_t *ps_ctxt = (plugin_ctxt_t *)pv_ihevce_hdl;
1842 if((0 == ps_ctxt->ps_static_cfg_prms->i4_res_id) &&
1843 (0 == ps_ctxt->ps_static_cfg_prms->i4_br_id))
1848 ihevce_queue_out_buffer(ps_ctxt, 0, 0);
1851 ps_interface_ctxt = (ihevce_hle_ctxt_t *)ps_ctxt->pv_hle_interface_ctxt;
1857 ihevce_receive_out_buffer(ps_ctxt, ps_out);
1888 plugin_ctxt_t *ps_ctxt;
1905 ps_ctxt = (plugin_ctxt_t *)pv_ihevce_hdl;
1906 if((0 == ps_ctxt->ps_static_cfg_prms->i4_res_id) &&
1907 (0 == ps_ctxt->ps_static_cfg_prms->i4_br_id))
1909 ps_interface_ctxt = (ihevce_hle_ctxt_t *)ps_ctxt->pv_hle_interface_ctxt;
1910 ps_app_ctxt = &ps_ctxt->s_app_ctxt;
1911 i4_num_resolutions = ps_ctxt->ps_static_cfg_prms->s_tgt_lyr_prms.i4_num_res_layers;
1913 if(ps_ctxt->ps_static_cfg_prms->s_coding_tools_prms.i4_max_temporal_layers)
1916 (1 << ps_ctxt->ps_static_cfg_prms->s_coding_tools_prms.i4_max_temporal_layers);
1919 u4_latency += ps_ctxt->ps_static_cfg_prms->s_lap_prms.i4_rc_look_ahead_pics;
1923 if(ps_ctxt->i4_internal_flush)
1932 ps_ctxt->ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[i4_res_id]
1937 ihevce_queue_out_buffer(ps_ctxt, i4_res_id, i4_br_id);
1944 if(0 == ps_ctxt->i4_flush_mode_on)
1954 frm_width = ps_ctxt->ps_static_cfg_prms->s_src_prms.i4_width;
1955 frm_height = ps_ctxt->ps_static_cfg_prms->s_src_prms.i4_height;
1956 frm_stride = ps_ctxt->i4_frm_stride;
1979 ((ps_ctxt->ps_static_cfg_prms->s_src_prms.inp_chr_format == 13) ? 0 : 1);
1985 ps_curr_inp->i4_bottom_field = ps_ctxt->i4_field_id;
1990 ps_ctxt->i4_field_id = !ps_ctxt->i4_field_id;
2001 ps_ctxt->ps_static_cfg_prms->s_src_prms.inp_chr_format,
2002 ps_ctxt->ps_static_cfg_prms->s_src_prms.i4_orig_width,
2003 ps_ctxt->ps_static_cfg_prms->s_src_prms.i4_orig_height);
2008 if(3 != ps_ctxt->ps_static_cfg_prms->s_config_prms.i4_rate_control_mode)
2012 if(ps_ctxt->ai4_old_bitrate[0][0] != ps_inp->i4_curr_bitrate)
2019 ps_ctxt->ps_static_cfg_prms->s_tgt_lyr_prms.as_tgt_params[0]
2023 [ps_ctxt->ps_static_cfg_prms->s_out_strm_prms.i4_codec_tier] *
2056 ps_ctxt->ai4_old_bitrate[0][0] = ps_inp->i4_curr_bitrate;
2060 ps_ctxt->u8_num_frames_queued++;
2081 ps_ctxt->u8_num_frames_encoded++;
2087 ps_ctxt->i4_flush_mode_on = 1;
2088 ps_ctxt->i4_internal_flush = 1;
2093 if(0 == ps_ctxt->i4_flush_mode_on)
2097 ps_ctxt->i4_flush_mode_on = 1;
2101 if((u4_latency < ps_ctxt->u8_num_frames_queued) || (1 == ps_ctxt->i4_flush_mode_on))
2106 ihevce_receive_out_buffer(ps_ctxt, ps_out);