Lines Matching refs:dpb

28 void h264e_dpb_dump_usage(H264eDpb *dpb, const char *fmt)  in h264e_dpb_dump_usage()  argument
34 pos += snprintf(buf, sizeof(buf) - 1, "total %2d ", dpb->total_cnt); in h264e_dpb_dump_usage()
36 for (i = 0; i < dpb->total_cnt; i++) { in h264e_dpb_dump_usage()
37 H264eDpbFrm *frm = &dpb->frames[i]; in h264e_dpb_dump_usage()
44 void h264e_dpb_dump_frm(H264eDpb *dpb, const char *caller, RK_S32 line) in h264e_dpb_dump_frm() argument
50 mpp_log_f("dpb %p total count %d size %d\n", dpb, dpb->total_cnt, dpb->dpb_size); in h264e_dpb_dump_frm()
54 for (i = 0; i < dpb->total_cnt; i++) { in h264e_dpb_dump_frm()
55 H264eDpbFrm *frm = &dpb->frames[i]; in h264e_dpb_dump_frm()
90 void h264e_dpb_dump_list(H264eDpb *dpb) in h264e_dpb_dump_list() argument
95 dpb->dpb_size, dpb->used_size, dpb->st_size, dpb->lt_size); in h264e_dpb_dump_list()
97 if (dpb->st_size + dpb->lt_size) { in h264e_dpb_dump_list()
98 mpp_log_f("list slot use seq type tid ref idx mode arg\n", dpb, dpb->total_cnt); in h264e_dpb_dump_list()
100 h264e_dpb_dump_listX(dpb->list, dpb->st_size + dpb->lt_size); in h264e_dpb_dump_list()
104 MPP_RET h264e_dpb_init(H264eDpb *dpb, H264eReorderInfo *reorder, H264eMarkingInfo *marking) in h264e_dpb_init() argument
108 h264e_dbg_dpb("enter %p\n", dpb); in h264e_dpb_init()
110 memset(dpb, 0, sizeof(*dpb)); in h264e_dpb_init()
112 dpb->reorder = reorder; in h264e_dpb_init()
113 dpb->marking = marking; in h264e_dpb_init()
114 for (i = 0; i < (RK_S32)MPP_ARRAY_ELEMS(dpb->frames); i++) in h264e_dpb_init()
115 dpb->frames[i].slot_idx = i; in h264e_dpb_init()
117 h264e_dbg_dpb("leave %p\n", dpb); in h264e_dpb_init()
122 MPP_RET h264e_dpb_setup(H264eDpb *dpb, MppEncCfgSet* cfg, H264eSps *sps) in h264e_dpb_setup() argument
127 h264e_dbg_dpb("enter %p\n", dpb); in h264e_dpb_setup()
134 h264e_dpb_init(dpb, dpb->reorder, dpb->marking); in h264e_dpb_setup()
136 memcpy(&dpb->info, info, sizeof(dpb->info)); in h264e_dpb_setup()
137 dpb->dpb_size = info->dpb_size; in h264e_dpb_setup()
138 dpb->total_cnt = info->dpb_size + 1; in h264e_dpb_setup()
139 dpb->max_frm_num = 1 << log2_max_frm_num; in h264e_dpb_setup()
140 dpb->max_poc_lsb = (1 << log2_max_poc_lsb); in h264e_dpb_setup()
141 dpb->poc_type = sps->pic_order_cnt_type; in h264e_dpb_setup()
144 dpb->total_cnt++; in h264e_dpb_setup()
147 ref_frm_num, dpb->total_cnt); in h264e_dpb_setup()
149 log2_max_frm_num, dpb->max_frm_num); in h264e_dpb_setup()
151 log2_max_poc_lsb, dpb->max_poc_lsb); in h264e_dpb_setup()
153 h264e_dbg_dpb("leave %p\n", dpb); in h264e_dpb_setup()
158 H264eDpbFrm *find_cpb_frame(H264eDpb *dpb, EncFrmStatus *frm) in find_cpb_frame() argument
160 H264eDpbFrm *frms = dpb->frames; in find_cpb_frame()
162 RK_S32 cnt = dpb->total_cnt; in find_cpb_frame()
186 h264e_dpb_dump_frms(dpb); in find_cpb_frame()
226 void h264e_dpb_build_list(H264eDpb *dpb, EncCpbStatus *cpb) in h264e_dpb_build_list() argument
232 h264e_dbg_dpb("enter %p\n", dpb); in h264e_dpb_build_list()
235 memset(dpb->list, 0, sizeof(dpb->list)); in h264e_dpb_build_list()
238 h264e_dbg_dpb("leave %p\n", dpb); in h264e_dpb_build_list()
257 H264eDpbFrm *p = find_cpb_frame(dpb, frm); in h264e_dpb_build_list()
259 dpb->stref[st_size++] = p; in h264e_dpb_build_list()
263 dpb->ltref[lt_size++] = p; in h264e_dpb_build_list()
270 h264e_dbg_dpb("dpb_size %d st_size %d lt_size %d\n", dpb->dpb_size, st_size, lt_size); in h264e_dpb_build_list()
276 h264e_dpb_dump_listX(dpb->stref, st_size); in h264e_dpb_build_list()
279 qsort(dpb->stref, st_size, sizeof(dpb->stref[0]), cmp_st_list); in h264e_dpb_build_list()
283 h264e_dpb_dump_listX(dpb->stref, st_size); in h264e_dpb_build_list()
290 h264e_dpb_dump_listX(dpb->ltref, lt_size); in h264e_dpb_build_list()
293 qsort(dpb->ltref, lt_size, sizeof(dpb->ltref[0]), cmp_lt_list); in h264e_dpb_build_list()
297 h264e_dpb_dump_listX(dpb->ltref, lt_size); in h264e_dpb_build_list()
302 memset(dpb->list, 0, sizeof(dpb->list)); in h264e_dpb_build_list()
305 dpb->list[j++] = dpb->stref[i]; in h264e_dpb_build_list()
308 dpb->list[j++] = dpb->ltref[i]; in h264e_dpb_build_list()
310 dpb->st_size = st_size; in h264e_dpb_build_list()
311 dpb->lt_size = lt_size; in h264e_dpb_build_list()
313 mpp_assert(dpb->dpb_size >= st_size + lt_size); in h264e_dpb_build_list()
316 h264e_dpb_dump_list(dpb); in h264e_dpb_build_list()
319 h264e_reorder_wr_rewind(dpb->reorder); in h264e_dpb_build_list()
321 if (dpb->st_size + dpb->lt_size) { in h264e_dpb_build_list()
322 H264eDpbFrm *curr = dpb->curr; in h264e_dpb_build_list()
323 H264eDpbFrm *refr = dpb->refr; in h264e_dpb_build_list()
324 H264eDpbFrm *def_ref = dpb->list[0]; in h264e_dpb_build_list()
356 h264e_reorder_wr_op(dpb->reorder, &op); in h264e_dpb_build_list()
362 h264e_dbg_dpb("leave %p\n", dpb); in h264e_dpb_build_list()
365 void h264e_dpb_build_marking(H264eDpb *dpb) in h264e_dpb_build_marking() argument
367 H264eDpbFrm *frm = dpb->curr; in h264e_dpb_build_marking()
368 H264eMarkingInfo *marking = dpb->marking; in h264e_dpb_build_marking()
370 h264e_dbg_dpb("enter %p\n", dpb); in h264e_dpb_build_marking()
397 dpb->next_max_lt_idx = dpb->info.max_lt_idx; in h264e_dpb_build_marking()
399 if (dpb->next_max_lt_idx != dpb->curr_max_lt_idx) { in h264e_dpb_build_marking()
400 RK_S32 max_lt_idx_p1 = dpb->next_max_lt_idx + 1; in h264e_dpb_build_marking()
408 dpb->curr_max_lt_idx = dpb->next_max_lt_idx; in h264e_dpb_build_marking()
420 h264e_dbg_dpb("dpb size %d used %d\n", dpb->dpb_size, dpb->used_size); in h264e_dpb_build_marking()
421 h264e_dbg_dpb("leave %p\n", dpb); in h264e_dpb_build_marking()
424 MPP_RET h264e_dpb_proc(H264eDpb *dpb, EncCpbStatus *cpb) in h264e_dpb_proc() argument
429 H264eDpbFrm *frames = dpb->frames; in h264e_dpb_proc()
430 H264eDpbRt *rt = &dpb->rt; in h264e_dpb_proc()
435 h264e_dbg_dpb("enter %p total %d\n", dpb, dpb->total_cnt); in h264e_dpb_proc()
442 dpb->used_size = 0; in h264e_dpb_proc()
443 dpb->curr_max_lt_idx = 0; in h264e_dpb_proc()
444 dpb->next_max_lt_idx = 0; in h264e_dpb_proc()
448 memcpy(rt, &dpb->rt_bak, sizeof(*rt)); in h264e_dpb_proc()
449 memcpy(frames, dpb->frm_bak, sizeof(dpb->frm_bak)); in h264e_dpb_proc()
454 h264e_dpb_dump_frms(dpb); in h264e_dpb_proc()
460 H264eDpbFrm *frm = find_cpb_frame(dpb, &init[i]); in h264e_dpb_proc()
461 dpb->map[i] = frm; in h264e_dpb_proc()
471 mpp_assert(dpb->used_size == used_size); in h264e_dpb_proc()
473 used_size, dpb->used_size); in h264e_dpb_proc()
476 memcpy(&dpb->rt_bak, rt, sizeof(dpb->rt_bak)); in h264e_dpb_proc()
477 memcpy(dpb->frm_bak, frames, sizeof(dpb->frm_bak)); in h264e_dpb_proc()
483 dpb->curr = NULL; in h264e_dpb_proc()
495 if (p == dpb->map[j] || p->as_pskip_ref) { in h264e_dpb_proc()
509 h264e_dpb_dump_frms(dpb); in h264e_dpb_proc()
527 dpb->curr = p; in h264e_dpb_proc()
537 if (curr_frm_num >= dpb->max_frm_num) in h264e_dpb_proc()
542 if (dpb->poc_type == 0) in h264e_dpb_proc()
544 else if (dpb->poc_type == 2) in h264e_dpb_proc()
549 if (curr_poc_lsb >= dpb->max_poc_lsb) { in h264e_dpb_proc()
554 p->poc = curr_poc_lsb + curr_poc_msb * dpb->max_poc_lsb; in h264e_dpb_proc()
571 mpp_assert(dpb->curr); in h264e_dpb_proc()
573 if (NULL == dpb->curr) in h264e_dpb_proc()
577 dpb->refr = find_cpb_frame(dpb, refr); in h264e_dpb_proc()
578 if (NULL == dpb->refr) in h264e_dpb_proc()
579 dpb->refr = dpb->curr; in h264e_dpb_proc()
582 seq_idx, dpb->curr->slot_idx, dpb->refr->slot_idx); in h264e_dpb_proc()
584 h264e_dpb_build_list(dpb, cpb); in h264e_dpb_proc()
587 h264e_dpb_dump_frms(dpb); in h264e_dpb_proc()
589 h264e_dpb_build_marking(dpb); in h264e_dpb_proc()
592 h264e_dpb_dump_frms(dpb); in h264e_dpb_proc()
594 h264e_dbg_dpb("leave %p\n", dpb); in h264e_dpb_proc()
599 void h264e_dpb_check(H264eDpb *dpb, EncCpbStatus *cpb) in h264e_dpb_check() argument
601 H264eDpbFrm *curr = dpb->curr; in h264e_dpb_check()
602 H264eDpbFrm *refr = dpb->refr; in h264e_dpb_check()
605 h264e_dbg_dpb("enter %p\n", dpb); in h264e_dpb_check()
615 RK_S32 used_size = dpb->used_size; in h264e_dpb_check()
616 RK_S32 dpb_size = dpb->dpb_size; in h264e_dpb_check()
628 dpb->lt_size++; in h264e_dpb_check()
630 for (i = 0; i < dpb->total_cnt; i++) { in h264e_dpb_check()
631 H264eDpbFrm *tmp = &dpb->frames[i]; in h264e_dpb_check()
652 dpb->lt_size--; in h264e_dpb_check()
657 dpb->st_size++; in h264e_dpb_check()
661 mpp_assert(dpb->lt_size <= dpb_size); in h264e_dpb_check()
668 dpb->st_size, dpb->lt_size, dpb_size); in h264e_dpb_check()
670 for (i = 0; i < dpb->total_cnt; i++) { in h264e_dpb_check()
671 H264eDpbFrm *tmp = &dpb->frames[i]; in h264e_dpb_check()
704 dpb->st_size--; in h264e_dpb_check()
705 mpp_assert(dpb->st_size >= 0); in h264e_dpb_check()
712 dpb->used_size = used_size; in h264e_dpb_check()
719 h264e_dbg_dpb("curr %d done used_size %d\n", curr->seq_idx, dpb->used_size); in h264e_dpb_check()
723 dpb->map[i] = find_cpb_frame(dpb, &cpb->final[i]); in h264e_dpb_check()
724 if (dpb->map[i]) in h264e_dpb_check()
729 curr->seq_idx, used_size, dpb->used_size); in h264e_dpb_check()
730 mpp_assert(dpb->used_size == used_size); in h264e_dpb_check()
732 h264e_dbg_dpb("leave %p\n", dpb); in h264e_dpb_check()
735 MPP_RET h264e_dpb_hal_start(H264eDpb *dpb, RK_S32 slot_idx) in h264e_dpb_hal_start() argument
737 H264eDpbFrm *frm = &dpb->frames[slot_idx]; in h264e_dpb_hal_start()
744 MPP_RET h264e_dpb_hal_end(H264eDpb *dpb, RK_S32 slot_idx) in h264e_dpb_hal_end() argument
746 H264eDpbFrm *frm = &dpb->frames[slot_idx]; in h264e_dpb_hal_end()