Lines Matching refs:ps_codec

84 IHEVCD_ERROR_T ihevcd_fmt_conv(codec_t *ps_codec,
91 WORD32 ihevcd_init(codec_t *ps_codec);
178 static void ihevcd_fill_outargs(codec_t *ps_codec, in ihevcd_fill_outargs() argument
183 ps_dec_op->u4_error_code = ihevcd_map_error((IHEVCD_ERROR_T)ps_codec->i4_error_code); in ihevcd_fill_outargs()
185 - ps_codec->i4_bytes_remaining; in ihevcd_fill_outargs()
186 if(ps_codec->i4_error_code == IHEVCD_UNSUPPORTED_DIMENSIONS) in ihevcd_fill_outargs()
188 ps_dec_op->u4_pic_wd = ps_codec->i4_new_max_wd; in ihevcd_fill_outargs()
189 ps_dec_op->u4_pic_ht = ps_codec->i4_new_max_ht; in ihevcd_fill_outargs()
191 else if(ps_codec->i4_sps_done) in ihevcd_fill_outargs()
193 ps_dec_op->u4_pic_wd = ps_codec->i4_disp_wd; in ihevcd_fill_outargs()
194 ps_dec_op->u4_pic_ht = ps_codec->i4_disp_ht; in ihevcd_fill_outargs()
202 ps_dec_op->e_pic_type = ps_codec->e_dec_pic_type; in ihevcd_fill_outargs()
203 ps_dec_op->u4_frame_decoded_flag = ps_codec->i4_pic_present; in ihevcd_fill_outargs()
209 ps_dec_op->e_output_format = ps_codec->e_chroma_fmt; in ihevcd_fill_outargs()
215 ps_dec_op->u4_disp_buf_id = ps_codec->i4_disp_buf_id; in ihevcd_fill_outargs()
216 if(ps_codec->i4_flush_mode) in ihevcd_fill_outargs()
226 if(ps_codec->ps_disp_buf) in ihevcd_fill_outargs()
228 pic_buf_t *ps_disp_buf = ps_codec->ps_disp_buf; in ihevcd_fill_outargs()
232 if((ps_codec->i4_flush_mode == 0) && (ps_codec->s_parse.i4_end_of_frame == 0)) in ihevcd_fill_outargs()
234 ps_dec_op->s_disp_frm_buf.u4_y_wd = ps_codec->i4_disp_wd; in ihevcd_fill_outargs()
235 ps_dec_op->s_disp_frm_buf.u4_y_ht = ps_codec->i4_disp_ht; in ihevcd_fill_outargs()
237 if(ps_codec->i4_share_disp_buf) in ihevcd_fill_outargs()
240 if(ps_codec->e_chroma_fmt != IV_YUV_420P) in ihevcd_fill_outargs()
253 ps_dec_op->s_disp_frm_buf.u4_y_strd = ps_codec->i4_strd; in ihevcd_fill_outargs()
264 ps_dec_op->s_disp_frm_buf.u4_y_strd = ps_codec->i4_disp_strd; in ihevcd_fill_outargs()
267 if((IV_YUV_420SP_VU == ps_codec->e_chroma_fmt) in ihevcd_fill_outargs()
268 || (IV_YUV_420SP_UV == ps_codec->e_chroma_fmt)) in ihevcd_fill_outargs()
280 else if(IV_YUV_420P == ps_codec->e_chroma_fmt) in ihevcd_fill_outargs()
297 else if(ps_codec->i4_flush_mode) in ihevcd_fill_outargs()
301 ps_codec->i4_flush_mode = 0; in ihevcd_fill_outargs()
337 codec_t *ps_codec = (codec_t *)(ps_codec_obj->pv_codec_handle); in ihevcd_decode() local
345 ps_codec->i4_error_code = 0; in ihevcd_decode()
355 if(ps_codec->i4_init_done != 1) in ihevcd_decode()
362 if(ps_codec->u4_pic_cnt >= NUM_FRAMES_LIMIT) in ihevcd_decode()
370 if(ps_codec->i4_reset_flag) in ihevcd_decode()
372 ps_codec->i4_flush_mode = 1; in ihevcd_decode()
378 if(0 == ps_codec->i4_flush_mode) in ihevcd_decode()
404 num_mbs = (ps_codec->i4_wd * ps_codec->i4_ht + 255) >> 8; in ihevcd_decode()
406 ps_codec->mb_count = 0; in ihevcd_decode()
407 memset(ps_codec->mb_map, 0, ((num_mbs + 7) >> 3)); in ihevcd_decode()
411 if(0 == ps_codec->i4_share_disp_buf && ps_codec->i4_header_mode == 0) in ihevcd_decode()
439 ps_codec->ps_out_buffer = &ps_dec_ip->s_out_buffer; in ihevcd_decode()
440 ps_codec->u4_ts = ps_dec_ip->u4_ts; in ihevcd_decode()
441 if(ps_codec->i4_flush_mode) in ihevcd_decode()
444 ps_dec_op->u4_pic_wd = ps_codec->i4_disp_wd; in ihevcd_decode()
445 ps_dec_op->u4_pic_ht = ps_codec->i4_disp_ht; in ihevcd_decode()
449 ps_codec->ps_disp_buf = (pic_buf_t *)ihevc_disp_mgr_get( in ihevcd_decode()
450 (disp_mgr_t *)ps_codec->pv_disp_buf_mgr, &ps_codec->i4_disp_buf_id); in ihevcd_decode()
453 if((ps_codec->ps_disp_buf) in ihevcd_decode()
454 && ((0 == ps_codec->i4_share_disp_buf) in ihevcd_decode()
456 == ps_codec->e_chroma_fmt))) in ihevcd_decode()
459 process_ctxt_t *ps_proc = &ps_codec->as_process[prev_proc_idx]; in ihevcd_decode()
466 ret = ihevcd_fmt_conv(ps_codec, &ps_codec->as_process[prev_proc_idx], in ihevcd_decode()
470 ps_codec->i4_disp_ht); in ihevcd_decode()
472 ihevc_buf_mgr_release((buf_mgr_t *)ps_codec->pv_pic_buf_mgr, in ihevcd_decode()
473 ps_codec->i4_disp_buf_id, BUF_MGR_DISP); in ihevcd_decode()
476 ihevcd_fill_outargs(ps_codec, ps_dec_ip, ps_dec_op); in ihevcd_decode()
480 WORD32 xpos = ps_codec->i4_disp_wd - 32 - LOGO_WD; in ihevcd_decode()
481 WORD32 ypos = ps_codec->i4_disp_ht - 32 - LOGO_HT; in ihevcd_decode()
491 ps_dec_ip->s_out_buffer.pu1_bufs[2], ps_codec->i4_disp_strd, in ihevcd_decode()
494 ps_codec->e_chroma_fmt, in ihevcd_decode()
495 ps_codec->i4_disp_wd, in ihevcd_decode()
496 ps_codec->i4_disp_ht); in ihevcd_decode()
500 if(NULL == ps_codec->ps_disp_buf) in ihevcd_decode()
504 if(ps_codec->i4_reset_flag) in ihevcd_decode()
506 ihevcd_init(ps_codec); in ihevcd_decode()
515 if((0 == ps_codec->i4_header_mode) && (1 == ps_codec->i4_share_disp_buf)) in ihevcd_decode()
519 if(ps_codec->pv_pic_buf_mgr) in ihevcd_decode()
520 buf_status = ihevc_buf_mgr_check_free((buf_mgr_t *)ps_codec->pv_pic_buf_mgr); in ihevcd_decode()
530 ps_codec->i4_bytes_remaining = ps_dec_ip->u4_num_Bytes; in ihevcd_decode()
531 ps_codec->pu1_inp_bitsbuf = (UWORD8 *)ps_dec_ip->pv_stream_buffer; in ihevcd_decode()
532 ps_codec->s_parse.i4_end_of_frame = 0; in ihevcd_decode()
534 ps_codec->i4_pic_present = 0; in ihevcd_decode()
535 ps_codec->i4_slice_error = 0; in ihevcd_decode()
536 ps_codec->ps_disp_buf = NULL; in ihevcd_decode()
538 if(ps_codec->i4_num_cores > 1) in ihevcd_decode()
542 while(MIN_START_CODE_LEN < ps_codec->i4_bytes_remaining) in ihevcd_decode()
548 if(ps_codec->i4_slice_error) in ihevcd_decode()
550 …slice_header_t *ps_slice_hdr_next = ps_codec->s_parse.ps_slice_hdr_base + (ps_codec->s_parse.i4_cu… in ihevcd_decode()
552 … ps_slice_hdr_next->i2_ctb_y * ps_codec->s_parse.ps_sps->i2_pic_wd_in_ctb; in ihevcd_decode()
553 if(ps_codec->s_parse.i4_next_ctb_indx == next_slice_addr) in ihevcd_decode()
554 ps_codec->i4_slice_error = 0; in ihevcd_decode()
557 nal_ofst = ihevcd_nal_search_start_code(ps_codec->pu1_inp_bitsbuf, in ihevcd_decode()
558 ps_codec->i4_bytes_remaining); in ihevcd_decode()
560 ps_codec->i4_nal_ofst = nal_ofst; in ihevcd_decode()
562 WORD32 bytes_remaining = ps_codec->i4_bytes_remaining - nal_ofst; in ihevcd_decode()
564 bytes_remaining = MIN((UWORD32)bytes_remaining, ps_codec->u4_bitsbuf_size); in ihevcd_decode()
565 ihevcd_nal_remv_emuln_bytes(ps_codec->pu1_inp_bitsbuf + nal_ofst, in ihevcd_decode()
566 ps_codec->pu1_bitsbuf, in ihevcd_decode()
571 ps_codec->i4_num_emln_bytes = nal_len - bits_len; in ihevcd_decode()
572 ps_codec->i4_nal_len = nal_len; in ihevcd_decode()
574 ihevcd_bits_init(&ps_codec->s_parse.s_bitstrm, ps_codec->pu1_bitsbuf, in ihevcd_decode()
577 ret = ihevcd_nal_unit(ps_codec); in ihevcd_decode()
582 if(ps_codec->i4_pic_present && in ihevcd_decode()
583 … (ps_codec->s_parse.i4_next_ctb_indx != ps_codec->s_parse.ps_sps->i4_pic_size_in_ctb)) in ihevcd_decode()
585 if((ps_codec->i4_bytes_remaining - (nal_len + nal_ofst) <= MIN_START_CODE_LEN) || in ihevcd_decode()
586 (ps_codec->i4_header_in_slice_mode)) in ihevcd_decode()
590 ps_codec->s_parse.i4_cur_slice_idx--; in ihevcd_decode()
591 if(ps_codec->s_parse.i4_cur_slice_idx < 0) in ihevcd_decode()
592 ps_codec->s_parse.i4_cur_slice_idx = 0; in ihevcd_decode()
594 …ps_slice_hdr_next = ps_codec->s_parse.ps_slice_hdr_base + ((ps_codec->s_parse.i4_cur_slice_idx + 1… in ihevcd_decode()
596 ps_slice_hdr_next->i2_ctb_y = ps_codec->s_parse.ps_sps->i2_pic_ht_in_ctb; in ihevcd_decode()
597 ps_codec->i4_slice_error = 1; in ihevcd_decode()
604 ps_codec->pu1_inp_bitsbuf += (nal_ofst + nal_len); in ihevcd_decode()
605 ps_codec->i4_bytes_remaining -= (nal_ofst + nal_len); in ihevcd_decode()
622 if((0 == ps_codec->i4_slice_error) || in ihevcd_decode()
623 … (ps_codec->i4_bytes_remaining - (nal_len + nal_ofst) <= MIN_START_CODE_LEN)) in ihevcd_decode()
625 ps_codec->pu1_inp_bitsbuf += (nal_ofst + nal_len); in ihevcd_decode()
626 ps_codec->i4_bytes_remaining -= (nal_ofst + nal_len); in ihevcd_decode()
631 if(ps_codec->s_parse.i4_end_of_frame) in ihevcd_decode()
643 if((ps_codec->u4_pic_cnt == 0) && (ret != IHEVCD_SUCCESS)) in ihevcd_decode()
645 ps_codec->i4_error_code = ret; in ihevcd_decode()
647 ihevcd_fill_outargs(ps_codec, ps_dec_ip, ps_dec_op); in ihevcd_decode()
651 if(1 == ps_codec->i4_pic_present) in ihevcd_decode()
654 sps_t *ps_sps = ps_codec->s_parse.ps_sps; in ihevcd_decode()
655 ps_codec->i4_first_pic_done = 1; in ihevcd_decode()
658 if(ps_codec->i4_num_cores > 1 && ps_codec->s_parse.i4_end_of_frame) in ihevcd_decode()
666 ps_proc = &ps_codec->as_process[ps_codec->i4_num_cores - 1]; in ihevcd_decode()
668 if((ps_codec->ps_disp_buf) && in ihevcd_decode()
669 ((0 == ps_codec->i4_share_disp_buf) || (IV_YUV_420P == ps_codec->e_chroma_fmt))) in ihevcd_decode()
672 if((0 == ps_codec->u4_enable_fmt_conv_ahead) || in ihevcd_decode()
673 (ps_codec->i4_disp_buf_id == ps_proc->i4_cur_pic_buf_id)) in ihevcd_decode()
684 ret = ihevcd_jobq_queue((jobq_t *)ps_codec->s_parse.pv_proc_jobq, in ihevcd_decode()
692 ret = ihevcd_jobq_terminate((jobq_t *)ps_codec->s_parse.pv_proc_jobq); in ihevcd_decode()
701 ps_proc = &ps_codec->as_process[ps_codec->i4_num_cores - 1]; in ihevcd_decode()
721 sps_t *ps_sps = ps_codec->s_parse.ps_sps; in ihevcd_decode()
728 … num_rows = MIN(num_rows, (ps_codec->i4_disp_ht - (s_job.i2_ctb_y << ps_sps->i1_log2_ctb_size))); in ihevcd_decode()
732 ihevcd_fmt_conv(ps_codec, ps_proc, in ihevcd_decode()
743 else if((ps_codec->ps_disp_buf) && ((0 == ps_codec->i4_share_disp_buf) || in ihevcd_decode()
744 (IV_YUV_420P == ps_codec->e_chroma_fmt)) && in ihevcd_decode()
745 (ps_codec->s_parse.i4_end_of_frame)) in ihevcd_decode()
747 process_ctxt_t *ps_proc = &ps_codec->as_process[proc_idx]; in ihevcd_decode()
749 ps_codec->s_fmt_conv.i4_num_rows = ps_codec->i4_disp_ht in ihevcd_decode()
750 - ps_codec->s_fmt_conv.i4_cur_row; in ihevcd_decode()
756 if(ps_codec->s_fmt_conv.i4_num_rows < 0) in ihevcd_decode()
757 ps_codec->s_fmt_conv.i4_num_rows = 0; in ihevcd_decode()
759 ret = ihevcd_fmt_conv(ps_codec, ps_proc, in ihevcd_decode()
763 ps_codec->s_fmt_conv.i4_cur_row, in ihevcd_decode()
764 ps_codec->s_fmt_conv.i4_num_rows); in ihevcd_decode()
765 ps_codec->s_fmt_conv.i4_cur_row += ps_codec->s_fmt_conv.i4_num_rows; in ihevcd_decode()
770 DEBUG_DUMP_MV_MAP(ps_codec); in ihevcd_decode()
773 ihevc_buf_mgr_set_status((buf_mgr_t *)ps_codec->pv_mv_buf_mgr, in ihevcd_decode()
774 ps_codec->as_process[proc_idx].i4_cur_mv_bank_buf_id, in ihevcd_decode()
778 ihevc_buf_mgr_set_status((buf_mgr_t *)ps_codec->pv_pic_buf_mgr, in ihevcd_decode()
779 ps_codec->as_process[proc_idx].i4_cur_pic_buf_id, in ihevcd_decode()
783 ihevc_buf_mgr_set_status((buf_mgr_t *)ps_codec->pv_pic_buf_mgr, in ihevcd_decode()
784 ps_codec->as_process[proc_idx].i4_cur_pic_buf_id, in ihevcd_decode()
788 ihevc_dpb_mgr_insert_ref((dpb_mgr_t *)ps_codec->pv_dpb_mgr, in ihevcd_decode()
789 ps_codec->as_process[proc_idx].ps_cur_pic, in ihevcd_decode()
790 ps_codec->as_process[proc_idx].i4_cur_pic_buf_id); in ihevcd_decode()
793 if((0 == ps_codec->i4_share_disp_buf) && (ps_codec->ps_disp_buf)) in ihevcd_decode()
794 ihevc_buf_mgr_release((buf_mgr_t *)ps_codec->pv_pic_buf_mgr, in ihevcd_decode()
795 ps_codec->i4_disp_buf_id, BUF_MGR_DISP); in ihevcd_decode()
798 for(i = 0; i < (ps_codec->i4_num_cores - 1); i++) in ihevcd_decode()
800 if(ps_codec->ai4_process_thread_created[i]) in ihevcd_decode()
802 ithread_join(ps_codec->apv_process_thread_handle[i], NULL); in ihevcd_decode()
803 ps_codec->ai4_process_thread_created[i] = 0; in ihevcd_decode()
807 DEBUG_VALIDATE_PADDED_REGION(&ps_codec->as_process[proc_idx]); in ihevcd_decode()
808 if(ps_codec->u4_pic_cnt > 0) in ihevcd_decode()
810 DEBUG_DUMP_PIC_PU(ps_codec); in ihevcd_decode()
812 DEBUG_DUMP_PIC_BUFFERS(ps_codec); in ihevcd_decode()
815 ps_codec->u4_pic_cnt++; in ihevcd_decode()
817 ihevcd_fill_outargs(ps_codec, ps_dec_ip, ps_dec_op); in ihevcd_decode()
821 WORD32 xpos = ps_codec->i4_disp_wd - 32 - LOGO_WD; in ihevcd_decode()
822 WORD32 ypos = ps_codec->i4_disp_ht - 32 - LOGO_HT; in ihevcd_decode()
832 ps_dec_ip->s_out_buffer.pu1_bufs[2], ps_codec->i4_disp_strd, in ihevcd_decode()
835 ps_codec->e_chroma_fmt, in ihevcd_decode()
836 ps_codec->i4_disp_wd, in ihevcd_decode()
837 ps_codec->i4_disp_ht); in ihevcd_decode()