u32 ddl_decode_start(u32 *ddl_handle, struct vcd_sequence_hdr *header, void *client_data) { struct ddl_client_context *ddl = (struct ddl_client_context *) ddl_handle; struct ddl_context *ddl_context; struct ddl_decoder_data *decoder; u32 status = VCD_S_SUCCESS; DDL_MSG_HIGH("ddl_decode_start"); if (vidc_msg_timing) { ddl_reset_core_time_variables(DEC_OP_TIME); ddl_reset_core_time_variables(DEC_IP_TIME); } ddl_context = ddl_get_context(); if (!DDL_IS_INITIALIZED(ddl_context)) { DDL_MSG_ERROR("ddl_dec_start:Not_inited"); return VCD_ERR_ILLEGAL_OP; } if (DDL_IS_BUSY(ddl_context)) { DDL_MSG_ERROR("ddl_dec_start:Ddl_busy"); return VCD_ERR_BUSY; } if (!ddl || !ddl->decoding) { DDL_MSG_ERROR("ddl_dec_start:Bad_handle"); return VCD_ERR_BAD_HANDLE; } if (!DDLCLIENT_STATE_IS(ddl, DDL_CLIENT_OPEN)) { DDL_MSG_ERROR("ddl_dec_start:Not_in_opened_state"); return VCD_ERR_ILLEGAL_OP; } if ((header) && ((!header->sequence_header_len) || (!header->sequence_header))) { DDL_MSG_ERROR("ddl_dec_start:Bad_param_seq_header"); return VCD_ERR_ILLEGAL_PARM; } if (!ddl_decoder_ready_to_start(ddl, header)) { DDL_MSG_ERROR("ddl_dec_start:Err_param_settings"); return VCD_ERR_ILLEGAL_OP; } decoder = &ddl->codec_data.decoder; status = ddl_allocate_dec_hw_buffers(ddl); if (status) return status; #ifdef DDL_BUF_LOG ddl_list_buffers(ddl); #endif if (!ddl_take_command_channel(ddl_context, ddl, client_data)) return VCD_ERR_BUSY; if (header) { decoder->header_in_start = true; decoder->decode_config = *header; } else { decoder->header_in_start = false; decoder->decode_config.sequence_header_len = 0; } ddl_vidc_channel_set(ddl); return status; }
u32 ddl_decode_start(u32 *ddl_handle, struct vcd_sequence_hdr *header, void *client_data) { struct ddl_client_context *ddl = (struct ddl_client_context *)ddl_handle; struct ddl_context *ddl_context; struct ddl_decoder_data *decoder; ddl_context = ddl_get_context(); if (!DDL_IS_INITIALIZED(ddl_context)) { VIDC_LOGERR_STRING("ddl_dec_start:Not_inited"); return VCD_ERR_ILLEGAL_OP; } if (DDL_IS_BUSY(ddl_context)) { VIDC_LOGERR_STRING("ddl_dec_start:Ddl_busy"); return VCD_ERR_BUSY; } if (!ddl || !ddl->decoding) { VIDC_LOGERR_STRING("ddl_dec_start:Bad_handle"); return VCD_ERR_BAD_HANDLE; } if (!DDLCLIENT_STATE_IS(ddl, DDL_CLIENT_OPEN)) { VIDC_LOGERR_STRING("ddl_dec_start:Not_in_opened_state"); return VCD_ERR_ILLEGAL_OP; } if ((header) && ((!header->sequence_header_len) || (!header->sequence_header) ) ) { VIDC_LOGERR_STRING("ddl_dec_start:Bad_param_seq_header"); return VCD_ERR_ILLEGAL_PARM; } if (!ddl_decoder_ready_to_start(ddl, header)) { VIDC_LOGERR_STRING("ddl_dec_start:Err_param_settings"); return VCD_ERR_ILLEGAL_OP; } DDL_BUSY(ddl_context); decoder = &ddl->codec_data.decoder; if (header) { decoder->header_in_start = true; decoder->decode_config = *header; } else { decoder->header_in_start = false; decoder->decode_config.sequence_header_len = 0; } if (decoder->codec.codec == VCD_CODEC_H264) { ddl_pmem_alloc(&decoder->h264Vsp_temp_buffer, DDL_DECODE_H264_VSPTEMP_BUFSIZE, DDL_LINEAR_BUFFER_ALIGN_BYTES); if (!decoder->h264Vsp_temp_buffer.virtual_base_addr) { DDL_IDLE(ddl_context); VIDC_LOGERR_STRING ("ddl_dec_start:H264Sps_alloc_failed"); return VCD_ERR_ALLOC_FAIL; } } ddl_context->current_ddl = ddl; ddl_context->client_data = client_data; ddl_channel_set(ddl); return VCD_S_SUCCESS; }
u32 ddl_decode_start(u32 *ddl_handle, struct vcd_sequence_hdr_type *p_header, void *p_client_data) { struct ddl_client_context_type *p_ddl = (struct ddl_client_context_type *)ddl_handle; struct ddl_context_type *p_ddl_context; struct ddl_decoder_data_type *p_decoder; p_ddl_context = ddl_get_context(); if (!DDL_IS_INITIALIZED(p_ddl_context)) { VIDC_LOGERR_STRING("ddl_dec_start:Not_inited"); return VCD_ERR_ILLEGAL_OP; } if (DDL_IS_BUSY(p_ddl_context)) { VIDC_LOGERR_STRING("ddl_dec_start:Ddl_busy"); return VCD_ERR_BUSY; } if (NULL == p_ddl || FALSE == p_ddl->b_decoding) { VIDC_LOGERR_STRING("ddl_dec_start:Bad_handle"); return VCD_ERR_BAD_HANDLE; } if (!DDLCLIENT_STATE_IS(p_ddl, DDL_CLIENT_OPEN)) { VIDC_LOGERR_STRING("ddl_dec_start:Not_in_opened_state"); return VCD_ERR_ILLEGAL_OP; } if ((NULL != p_header) && ((0 == p_header->n_sequence_header_len) || (NULL == p_header->p_sequence_header) ) ) { VIDC_LOGERR_STRING("ddl_dec_start:Bad_param_seq_header"); return VCD_ERR_ILLEGAL_PARM; } if (FALSE == ddl_decoder_ready_to_start(p_ddl, p_header)) { VIDC_LOGERR_STRING("ddl_dec_start:Err_param_settings"); return VCD_ERR_ILLEGAL_OP; } DDL_BUSY(p_ddl_context); p_decoder = &p_ddl->codec_data.decoder; if (p_header) { p_decoder->b_header_in_start = TRUE; p_decoder->decode_config = *p_header; } else { p_decoder->b_header_in_start = FALSE; p_decoder->decode_config.n_sequence_header_len = 0; } if (p_decoder->codec_type.e_codec == VCD_CODEC_H264) { ddl_pmem_alloc(&p_decoder->h264Vsp_temp_buffer, DDL_DECODE_H264_VSPTEMP_BUFSIZE, DDL_LINEAR_BUFFER_ALIGN_BYTES); if (p_decoder->h264Vsp_temp_buffer.p_virtual_base_addr == NULL) { DDL_IDLE(p_ddl_context); VIDC_LOGERR_STRING ("ddl_dec_start:H264Sps_alloc_failed"); return VCD_ERR_ALLOC_FAIL; } } p_ddl_context->p_current_ddl = p_ddl; p_ddl_context->p_client_data = p_client_data; ddl_channel_set(p_ddl); return VCD_S_SUCCESS; }