Lines Matching full:ps_proc
207 * @param[in] ps_proc
216 IH264E_ERROR_T ih264e_init_entropy_ctxt(process_ctxt_t *ps_proc)
219 codec_t *ps_codec = ps_proc->ps_codec;
222 entropy_ctxt_t *ps_entropy = &ps_proc->s_entropy;
231 ps_entropy->i4_cur_slice_idx = ps_proc->pu1_slice_idx[ps_entropy->i4_mb_start_add];
266 * @param[in] ps_proc
276 IH264E_ERROR_T ih264e_entropy(process_ctxt_t *ps_proc)
279 codec_t *ps_codec = ps_proc->ps_codec;
282 entropy_ctxt_t *ps_entropy = &ps_proc->s_entropy;
297 WORD32 i4_slice_type = ps_proc->i4_slice_type;
312 WORD32 ctxt_sel = ps_proc->i4_encode_api_call_cnt % MAX_CTXT_SETS;
338 pu1_proc_map = ps_proc->pu1_proc_map + ps_entropy->i4_mb_y * i4_wd_mbs;
385 ih264e_populate_slice_header(ps_proc, ps_slice_hdr, ps_pps, ps_sps);
421 pu1_proc_map = ps_proc->pu1_proc_map + ps_entropy->i4_mb_y * i4_wd_mbs;
509 ih264e_populate_slice_header(ps_proc, ps_slice_hdr, ps_pps,
587 (ps_proc->ps_codec->i4_poc == 0));
636 * @param[in] ps_proc
645 IH264E_ERROR_T ih264e_pack_header_data(process_ctxt_t *ps_proc)
648 UWORD32 u4_mb_type = ps_proc->u4_mb_type;
654 UWORD8 *pu1_ptr = ps_proc->pv_mb_header_data;
660 *pu1_ptr++ = (ps_proc->u1_c_i8_mode << 6) + u4_mb_type;
663 *pu1_ptr++ = ps_proc->u4_cbp;
666 *pu1_ptr++ = ps_proc->u4_mb_qp - ps_proc->u4_mb_qp_prev;
673 if (ps_proc->au1_predicted_intra_luma_mb_4x4_modes[i4] ==
674 ps_proc->au1_intra_luma_mb_4x4_modes[i4])
681 if (ps_proc->au1_intra_luma_mb_4x4_modes[i4] <
682 ps_proc->au1_predicted_intra_luma_mb_4x4_modes[i4])
684 byte |= (ps_proc->au1_intra_luma_mb_4x4_modes[i4] << 1);
688 byte |= (ps_proc->au1_intra_luma_mb_4x4_modes[i4] - 1) << 1;
694 if (ps_proc->au1_predicted_intra_luma_mb_4x4_modes[i4] ==
695 ps_proc->au1_intra_luma_mb_4x4_modes[i4])
702 if (ps_proc->au1_intra_luma_mb_4x4_modes[i4] <
703 ps_proc->au1_predicted_intra_luma_mb_4x4_modes[i4])
705 byte |= (ps_proc->au1_intra_luma_mb_4x4_modes[i4] << 5);
709 byte |= (ps_proc->au1_intra_luma_mb_4x4_modes[i4] - 1) << 5;
717 ps_proc->pv_mb_header_data = pu1_ptr;
722 UWORD8 *pu1_ptr = ps_proc->pv_mb_header_data;
725 *pu1_ptr++ = (ps_proc->u1_c_i8_mode << 6) + (ps_proc->u1_l_i16_mode << 4) + u4_mb_type;
728 *pu1_ptr++ = ps_proc->u4_cbp;
731 *pu1_ptr++ = ps_proc->u4_mb_qp - ps_proc->u4_mb_qp_prev;
734 ps_proc->pv_mb_header_data = pu1_ptr;
739 UWORD8 *pu1_ptr = ps_proc->pv_mb_header_data;
747 *pu1_ptr++ = ps_proc->u4_cbp;
750 *pu1_ptr++ = ps_proc->u4_mb_qp - ps_proc->u4_mb_qp_prev;
754 *i2_mv_ptr++ = ps_proc->ps_pu->s_me_info[0].s_mv.i2_mvx - ps_proc->ps_pred_mv[0].s_mv.i2_mvx;
756 *i2_mv_ptr++ = ps_proc->ps_pu->s_me_info[0].s_mv.i2_mvy - ps_proc->ps_pred_mv[0].s_mv.i2_mvy;
759 ps_proc->pv_mb_header_data = i2_mv_ptr;
764 UWORD8 *pu1_ptr = ps_proc->pv_mb_header_data;
770 ps_proc->pv_mb_header_data = pu1_ptr;
776 UWORD8 *pu1_ptr = ps_proc->pv_mb_header_data;
780 UWORD32 u4_pred_mode = ps_proc->ps_pu->b2_pred_mode;
786 *pu1_ptr++ = ps_proc->u4_cbp;
789 *pu1_ptr++ = ps_proc->u4_mb_qp - ps_proc->u4_mb_qp_prev;
796 *i2_mv_ptr++ = ps_proc->ps_pu->s_me_info[0].s_mv.i2_mvx
797 - ps_proc->ps_pred_mv[0].s_mv.i2_mvx;
799 *i2_mv_ptr++ = ps_proc->ps_pu->s_me_info[0].s_mv.i2_mvy
800 - ps_proc->ps_pred_mv[0].s_mv.i2_mvy;
804 *i2_mv_ptr++ = ps_proc->ps_pu->s_me_info[1].s_mv.i2_mvx
805 - ps_proc->ps_pred_mv[1].s_mv.i2_mvx;
807 *i2_mv_ptr++ = ps_proc->ps_pu->s_me_info[1].s_mv.i2_mvy
808 - ps_proc->ps_pred_mv[1].s_mv.i2_mvy;
812 ps_proc->pv_mb_header_data = i2_mv_ptr;
818 UWORD8 *pu1_ptr = ps_proc->pv_mb_header_data;
824 *pu1_ptr++ = ps_proc->u4_cbp;
827 *pu1_ptr++ = ps_proc->u4_mb_qp - ps_proc->u4_mb_qp_prev;
829 ps_proc->pv_mb_header_data = pu1_ptr;
834 UWORD32 u4_pred_mode = ps_proc->ps_pu->b2_pred_mode;
837 UWORD8 *pu1_ptr = ps_proc->pv_mb_header_data;
843 ps_proc->pv_mb_header_data = pu1_ptr;
867 * @param[in] ps_proc
876 WORD32 ih264e_update_proc_ctxt(process_ctxt_t *ps_proc)
882 codec_t *ps_codec = ps_proc->ps_codec;
885 WORD32 i4_mb_x = ps_proc->i4_mb_x;
886 WORD32 i4_mb_y = ps_proc->i4_mb_y;
889 mb_info_t *ps_left_syn = &ps_proc->s_left_mb_syntax_ele;
890 mb_info_t *ps_top_syn = ps_proc->ps_top_row_mb_syntax_ele + i4_mb_x;
891 mb_info_t *ps_top_left_syn = &ps_proc->s_top_left_mb_syntax_ele;
894 UWORD32 u4_mb_type = ps_proc->u4_mb_type;
897 UWORD32 u4_is_intra = ps_proc->u4_is_intra;
900 WORD32 i4_wd_mbs = ps_proc->i4_wd_mbs;
903 WORD32 i4_ht_mbs = ps_proc->i4_ht_mbs;
906 UWORD8 *pu1_proc_map = ps_proc->pu1_proc_map + (i4_mb_y * i4_wd_mbs);
909 deblk_ctxt_t *ps_deblk = &ps_proc->s_deblk_ctxt;
915 enc_pu_t *ps_top_row_pu = ps_proc->ps_top_row_pu + i4_mb_x;
918 enc_pu_t *ps_top_left_mb_pu = &ps_proc->s_top_left_mb_pu;
921 enc_pu_t *ps_left_mb_pu = &ps_proc->s_left_mb_pu;
924 UWORD8 *pu1_top_mb_intra_modes = ps_proc->pu1_top_mb_intra_modes + (i4_mb_x << 4);
936 if (ps_proc->i4_slice_type != ISLICE)
956 ps_left_syn->u4_csbp = ps_top_syn->u4_csbp = ps_proc->u4_csbp;
959 ps_left_syn->i4_mb_distortion = ps_top_syn->i4_mb_distortion = ps_proc->i4_mb_distortion;
966 pu1_top_mb_intra_modes[0] = ps_proc->au1_left_mb_intra_modes[0] = ps_proc->u1_l_i16_mode;
970 ps_codec->pf_mem_cpy_mul8(ps_proc->au1_left_mb_intra_modes, ps_proc->au1_intra_luma_mb_4x4_modes, 16);
971 ps_codec->pf_mem_cpy_mul8(pu1_top_mb_intra_modes, ps_proc
975 memcpy(ps_proc->au1_left_mb_intra_modes, ps_proc->au1_intra_luma_mb_8x8_modes, 4);
976 memcpy(pu1_top_mb_intra_modes, ps_proc->au1_intra_luma_mb_8x8_modes, 4);
979 if ((ps_proc->i4_slice_type == PSLICE) ||(ps_proc->i4_slice_type == BSLICE))
982 *ps_left_mb_pu = *ps_top_row_pu = *(ps_proc->ps_pu);
985 *ps_proc->pu4_mb_pu_cnt = 1;
990 *ps_left_mb_pu = *ps_top_row_pu = *(ps_proc->ps_pu);
997 ps_proc->pu1_is_intra_coded[i4_mb_x + (i4_mb_y * i4_wd_mbs)] = u4_is_intra;
1002 ih264e_pack_header_data(ps_proc);
1005 ps_proc->u4_mb_qp_prev = ps_proc->u4_mb_qp;
1008 ps_proc->s_deblk_ctxt.s_bs_ctxt.pu1_pic_qp[(i4_mb_y * i4_wd_mbs) + i4_mb_x] = ps_proc->u4_mb_qp;
1038 s_job.i2_mb_y = ps_proc->i4_mb_y;
1044 error_status |= ih264_list_queue(ps_proc->pv_entropy_jobq, &s_job, 1);
1046 if(ps_proc->i4_mb_y == (i4_ht_mbs - 1))
1058 ps_proc->i4_mb_x = i4_mb_x;
1060 if (ps_proc->i4_mb_x == i4_wd_mbs)
1062 ps_proc->i4_mb_y++;
1063 ps_proc->i4_mb_x = 0;
1067 ps_proc->i4_cur_slice_idx = ps_proc->pu1_slice_idx[ps_proc->i4_mb_y * i4_wd_mbs + ps_proc->i4_mb_x];
1070 ps_proc->pu1_src_buf_luma += MB_SIZE;
1071 ps_proc->pu1_rec_buf_luma += MB_SIZE;
1072 ps_proc->apu1_ref_buf_luma[0] += MB_SIZE;
1073 ps_proc->apu1_ref_buf_luma[1] += MB_SIZE;
1079 ps_proc->pu1_src_buf_chroma += MB_SIZE;
1080 ps_proc->pu1_rec_buf_chroma += MB_SIZE;
1081 ps_proc->apu1_ref_buf_chroma[0] += MB_SIZE;
1082 ps_proc->apu1_ref_buf_chroma[1] += MB_SIZE;
1087 ps_proc->i4_mb_cost = INT_MAX;
1088 ps_proc->i4_mb_distortion = SHRT_MAX;
1090 ps_proc->ps_pu += *ps_proc->pu4_mb_pu_cnt;
1092 ps_proc->pu4_mb_pu_cnt += 1;
1095 if (ps_proc->i4_slice_type == BSLICE)
1096 ps_proc->ps_colpu += *(ps_proc->aps_mv_buf[1]->pu4_mb_pu_cnt + (i4_mb_y * ps_proc->i4_wd_mbs) + i4_mb_x);
1099 if (ps_proc->u4_disable_deblock_level != 1)
1102 ps_bs->i4_mb_x = ps_proc->i4_mb_x;
1103 ps_bs->i4_mb_y = ps_proc->i4_mb_y;
1132 * @param[in] ps_proc
1141 IH264E_ERROR_T ih264e_init_proc_ctxt(process_ctxt_t *ps_proc)
1144 codec_t *ps_codec = ps_proc->ps_codec;
1147 n_mb_process_ctxt_t *ps_n_mb_ctxt = &ps_proc->s_n_mb_ctxt;
1153 WORD32 i4_src_strd = ps_proc->i4_src_strd;
1154 WORD32 i4_src_chroma_strd = ps_proc->i4_src_chroma_strd;
1155 WORD32 i4_rec_strd = ps_proc->i4_rec_strd;
1158 quant_params_t *ps_qp_params = ps_proc->ps_qp_params[0];
1161 deblk_ctxt_t *ps_deblk = &ps_proc->s_deblk_ctxt;
1167 mv_buf_t *ps_cur_mv_buf = ps_proc->ps_cur_mv_buf;
1182 i4_mb_x = ps_proc->i4_mb_x;
1183 i4_mb_y = ps_proc->i4_mb_y;
1186 ps_proc->i4_nmb_ntrpy = ps_proc->i4_wd_mbs;
1187 ps_proc->u4_nmb_me = ps_proc->i4_wd_mbs;
1194 if (ps_proc->i4_mb_y == ps_proc->i4_ht_mbs - 1)
1196 ps_proc->pu1_src_buf_luma_base = ps_codec->pu1_y_csc_buf_base;
1197 i4_src_strd = ps_proc->i4_src_strd = ps_codec->s_cfg.u4_max_wd;
1198 ps_proc->pu1_src_buf_luma = ps_proc->pu1_src_buf_luma_base + (i4_mb_x * MB_SIZE) + ps_codec->s_cfg.u4_max_wd * (i4_mb_y * MB_SIZE);
1203 i4_src_strd = ps_proc->i4_src_strd = ps_proc->s_inp_buf.s_raw_buf.au4_strd[0];
1204 ps_proc->pu1_src_buf_luma = ps_proc->pu1_src_buf_luma_base + (i4_mb_x * MB_SIZE) + i4_src_strd * (i4_mb_y * MB_SIZE);
1210 ps_proc->i4_mb_y == (ps_proc->i4_ht_mbs - 1) ||
1215 ps_proc->pu1_src_buf_chroma_base = ps_codec->pu1_uv_csc_buf_base;
1217 ps_proc->pu1_src_buf_chroma = ps_proc->pu1_src_buf_chroma_base + (i4_mb_x * MB_SIZE) + ps_codec->s_cfg.u4_max_wd * (i4_mb_y * BLK8x8SIZE);
1218 i4_src_chroma_strd = ps_proc->i4_src_chroma_strd = ps_codec->s_cfg.u4_max_wd;
1222 i4_src_chroma_strd = ps_proc->i4_src_chroma_strd = ps_proc->s_inp_buf.s_raw_buf.au4_strd[1];
1223 ps_proc->pu1_src_buf_chroma = ps_proc->pu1_src_buf_chroma_base + (i4_mb_x * MB_SIZE) + i4_src_chroma_strd * (i4_mb_y * BLK8x8SIZE);
1226 ps_proc->pu1_rec_buf_luma = ps_proc->pu1_rec_buf_luma_base + (i4_mb_x * MB_SIZE) + i4_rec_strd * (i4_mb_y * MB_SIZE);
1227 ps_proc->pu1_rec_buf_chroma = ps_proc->pu1_rec_buf_chroma_base + (i4_mb_x * MB_SIZE) + i4_rec_strd * (i4_mb_y * BLK8x8SIZE);
1230 ps_proc->apu1_ref_buf_luma[0] = ps_proc->apu1_ref_buf_luma_base[0] + (i4_mb_x * MB_SIZE) + i4_rec_strd * (i4_mb_y * MB_SIZE);
1231 ps_proc->apu1_ref_buf_chroma[0] = ps_proc->apu1_ref_buf_chroma_base[0] + (i4_mb_x * MB_SIZE) + i4_rec_strd * (i4_mb_y * BLK8x8SIZE);
1232 ps_proc->apu1_ref_buf_luma[1] = ps_proc->apu1_ref_buf_luma_base[1] + (i4_mb_x * MB_SIZE) + i4_rec_strd * (i4_mb_y * MB_SIZE);
1233 ps_proc->apu1_ref_buf_chroma[1] = ps_proc->apu1_ref_buf_chroma_base[1] + (i4_mb_x * MB_SIZE) + i4_rec_strd * (i4_mb_y * BLK8x8SIZE);
1246 if (ps_proc->i4_mb_y == (ps_proc->i4_ht_mbs - 1) || u4_pad_bottom_sz || u4_pad_right_sz)
1252 pu1_src = (UWORD8 *)ps_proc->s_inp_buf.s_raw_buf.apv_bufs[0] + (i4_mb_x * MB_SIZE) +
1253 ps_proc->s_inp_buf.s_raw_buf.au4_strd[0] * (i4_mb_y * MB_SIZE);
1255 pu1_dst = ps_proc->pu1_src_buf_luma;
1259 if (ps_proc->i4_mb_y == (ps_proc->i4_ht_mbs - 1))
1264 pu1_src += ps_proc->s_inp_buf.s_raw_buf.au4_strd[0];
1265 pu1_dst += ps_proc->i4_src_strd;
1268 pu1_src = (UWORD8 *)ps_proc->s_inp_buf.s_raw_buf.apv_bufs[1] + (i4_mb_x * BLK8x8SIZE) +
1269 ps_proc->s_inp_buf.s_raw_buf.au4_strd[1] * (i4_mb_y * BLK8x8SIZE);
1270 pu1_dst = ps_proc->pu1_src_buf_chroma;
1275 if (ps_proc->i4_mb_y == (ps_proc->i4_ht_mbs - 1))
1276 num_rows = (ps_codec->s_cfg.u4_disp_ht >> 1) - (ps_proc->i4_mb_y * BLK8x8SIZE);
1282 pu1_src += ps_proc->s_inp_buf.s_raw_buf.au4_strd[1];
1283 pu1_dst += ps_proc->i4_src_chroma_strd;
1290 pu1_y_buf_base = (UWORD8 *)ps_proc->s_inp_buf.s_raw_buf.apv_bufs[0] + (i4_mb_x * MB_SIZE) +
1291 ps_proc->s_inp_buf.s_raw_buf.au4_strd[0] * (i4_mb_y * MB_SIZE);
1293 pu1_u_buf_base = (UWORD8 *)ps_proc->s_inp_buf.s_raw_buf.apv_bufs[1] + (i4_mb_x * BLK8x8SIZE) +
1294 ps_proc->s_inp_buf.s_raw_buf.au4_strd[1] * (i4_mb_y * BLK8x8SIZE);
1296 pu1_v_buf_base = (UWORD8 *)ps_proc->s_inp_buf.s_raw_buf.apv_bufs[2] + (i4_mb_x * BLK8x8SIZE) +
1297 ps_proc->s_inp_buf.s_raw_buf.au4_strd[2] * (i4_mb_y * BLK8x8SIZE);
1301 ps_proc->pu1_src_buf_luma,
1302 ps_proc->pu1_src_buf_chroma, u2_num_rows,
1304 ps_proc->s_inp_buf.s_raw_buf.au4_strd[0],
1305 ps_proc->s_inp_buf.s_raw_buf.au4_strd[1],
1306 ps_proc->s_inp_buf.s_raw_buf.au4_strd[2],
1307 ps_proc->i4_src_strd, ps_proc->i4_src_chroma_strd,
1312 pu1_y_buf_base = (UWORD8 *)ps_proc->s_inp_buf.s_raw_buf.apv_bufs[0] + (i4_mb_x * MB_SIZE * 2)
1313 + ps_proc->s_inp_buf.s_raw_buf.au4_strd[0] * (i4_mb_y * MB_SIZE);
1316 ps_proc->pu1_src_buf_luma,
1317 ps_proc->pu1_src_buf_chroma,
1318 ps_proc->pu1_src_buf_chroma + 1, pu1_y_buf_base,
1320 ps_proc->i4_src_strd, ps_proc->i4_src_chroma_strd,
1321 ps_proc->i4_src_chroma_strd,
1322 ps_proc->s_inp_buf.s_raw_buf.au4_strd[0] >> 1);
1329 if (u4_pad_right_sz && (ps_proc->i4_mb_x == 0))
1332 u4_pad_wd = (UWORD32)(ps_proc->i4_src_strd - ps_codec->s_cfg.u4_disp_wd);
1335 if(ps_proc->i4_mb_y == ps_proc->i4_ht_mbs - 1)
1339 ps_proc->pu1_src_buf_luma + ps_codec->s_cfg.u4_disp_wd,
1340 ps_proc->i4_src_strd, u4_pad_ht, u4_pad_wd);
1343 ps_proc->pu1_src_buf_chroma + ps_codec->s_cfg.u4_disp_wd,
1344 ps_proc->i4_src_chroma_strd, u4_pad_ht / 2, u4_pad_wd);
1348 if (u4_pad_bottom_sz && (ps_proc->i4_mb_y == ps_proc->i4_ht_mbs - 1) && ps_proc->i4_mb_x == 0)
1350 ih264_pad_bottom(ps_proc->pu1_src_buf_luma + (MB_SIZE - u4_pad_bottom_sz) * ps_proc->i4_src_strd,
1351 ps_proc->i4_src_strd, ps_proc->i4_src_strd, u4_pad_bottom_sz);
1353 ih264_pad_bottom(ps_proc->pu1_src_buf_chroma + (MB_SIZE - u4_pad_bottom_sz) * ps_proc->i4_src_chroma_strd / 2,
1354 ps_proc->i4_src_chroma_strd, ps_proc->i4_src_chroma_strd, (u4_pad_bottom_sz / 2));
1359 ps_proc->pv_mb_coeff_data = ((UWORD8 *)ps_proc->pv_pic_mb_coeff_data) + i4_mb_y * ps_codec->u4_size_coeff_data;
1362 ps_proc->pv_mb_header_data = ((UWORD8 *)ps_proc->pv_pic_mb_header_data) + i4_mb_y * ps_codec->u4_size_header_data;
1365 ps_proc->i4_cur_slice_idx = ps_proc->pu1_slice_idx[i4_mb_y * ps_proc->i4_wd_mbs + i4_mb_x];
1375 ps_procps_proc->i4_wd_mbs *
1379 ps_proc->ps_colpu = ps_proc->aps_mv_buf[1]->ps_pic_pu + (i4_mb_y * ps_proc->i4_wd_mbs *
1384 ps_proc->ps_top_row_pu_ME = ps_cur_mv_buf->ps_pic_pu;
1388 ps_proc->ps_top_row_pu_ME = ps_cur_mv_buf->ps_pic_pu + ((i4_mb_y - 1) * ps_proc->i4_wd_mbs *
1392 ps_proc->pu4_mb_pu_cnt = ps_cur_mv_buf->pu4_mb_pu_cnt + (i4_mb_y * ps_proc->i4_wd_mbs);
1395 ps_proc->u4_mb_type = I16x16;
1398 ps_proc->u4_lambda = gu1_qp0[ps_qp_params->u1_mb_qp];
1401 ps_proc->i4_mb_distortion = SHRT_MAX;
1405 ps_proc->s_left_mb_syntax_ele.i4_mb_distortion = 0;
1407 ps_proc->s_top_left_mb_syntax_ele.i4_mb_distortion = 0;
1409 ps_proc->s_top_left_mb_syntax_ME.i4_mb_distortion = 0;
1413 memset(ps_proc->ps_top_row_mb_syntax_ele, 0, (ps_proc->i4_wd_mbs + 1)*sizeof(mb_info_t));
1418 ps_proc->i4_mb_cost = INT_MAX;
1423 ps_deblk->i4_mb_x = ps_proc->i4_mb_x;
1428 ps_deblk->i4_mb_y = ps_proc->i4_mb_y - 1;
1431 ps_deblk->pu1_cur_pic_luma = ps_proc->pu1_rec_buf_luma_base + i4_rec_strd * (ps_deblk->i4_mb_y * MB_SIZE);
1432 ps_deblk->pu1_cur_pic_chroma = ps_proc->pu1_rec_buf_chroma_base + i4_rec_strd * (ps_deblk->i4_mb_y * BLK8x8SIZE);
1436 ps_bs->i4_mb_x = ps_proc->i4_mb_x;
1437 ps_bs->i4_mb_y = ps_proc->i4_mb_y;
1442 ps_n_mb_ctxt->i4_n_mbs = ps_proc->i4_nmb_ntrpy;
1454 * @param[in] ps_proc
1478 IH264E_ERROR_T ih264e_pad_recon_buffer(process_ctxt_t *ps_proc,
1486 codec_t *ps_codec = ps_proc->ps_codec;
1489 WORD32 i4_rec_strd = ps_proc->i4_rec_strd;
1499 if (i4_mb_x == ps_proc->i4_wd_mbs - 1)
1507 if (i4_mb_y == ps_proc->i4_ht_mbs - 1)
1533 if (i4_mb_x == ps_proc->i4_wd_mbs - 1)
1559 * @param[in] ps_proc
1580 IH264E_ERROR_T ih264e_dblk_pad_hpel_processing_n_mbs(process_ctxt_t *ps_proc,
1587 codec_t *ps_codec = ps_proc->ps_codec;
1590 n_mb_process_ctxt_t *ps_n_mb_ctxt = &ps_proc->s_n_mb_ctxt;
1593 deblk_ctxt_t *ps_deblk = &ps_proc->s_deblk_ctxt;
1596 WORD32 i4_rec_strd = ps_proc->i4_rec_strd;
1605 UWORD8 *pu1_deblk_map = ps_proc->pu1_deblk_map + ps_deblk->i4_mb_y * ps_proc->i4_wd_mbs;
1608 UWORD8 *pu1_deblk_map_prev_row = pu1_deblk_map - ps_proc->i4_wd_mbs;
1626 if (ps_proc->u4_disable_deblock_level == 1)
1638 if (i4_mb_x == (ps_proc->i4_wd_mbs - 1))
1648 if ((i4_mb_y > 0) || (i4_mb_y == (ps_proc->i4_ht_mbs - 1)))
1652 if ( ((i4_mb_x - (ps_n_mb_ctxt->i4_mb_x - 1)) < i4_n_mbs) && (i4_mb_x < (ps_proc->i4_wd_mbs - 1)) )
1661 if ((i4_mb_y > 0) && (ps_proc->u4_disable_deblock_level != 1))
1672 if ((ps_deblk->i4_mb_x + i4_n_mb_process_count) != ps_proc->i4_wd_mbs)
1685 ih264e_deblock_mb(ps_proc, ps_deblk);
1700 if (ps_deblk->i4_mb_x == (ps_proc->i4_wd_mbs - 1))/*last column*/
1735 if (i4_mb_x == ps_proc->i4_wd_mbs - 1)
1741 ps_codec->pf_pad_top(ps_proc->pu1_rec_buf_luma_base + u4_pad_top, i4_rec_strd, u4_pad_wd, PAD_TOP);
1744 ps_codec->pf_pad_top(ps_proc->pu1_rec_buf_chroma_base + u4_pad_top, i4_rec_strd, u4_pad_wd, (PAD_TOP >> 1));
1749 if (i4_mb_x == ps_proc->i4_wd_mbs - 1)
1751 if (ps_proc->i4_mb_y == ps_proc->i4_ht_mbs - 1)
1754 if (ps_proc->u4_disable_deblock_level != 1)
1756 ps_deblk->pu1_cur_pic_luma = ps_proc->pu1_rec_buf_luma_base + (ps_proc->i4_ht_mbs - 1) * i4_rec_strd * MB_SIZE;
1758 ps_deblk->pu1_cur_pic_chroma = ps_proc->pu1_rec_buf_chroma_base + (ps_proc->i4_ht_mbs - 1) * i4_rec_strd * BLK8x8SIZE;
1761 ps_n_mb_ctxt->i4_mb_y = ps_proc->i4_mb_y;
1763 ps_deblk->i4_mb_y = ps_proc->i4_mb_y;
1766 ps_proc->s_deblk_ctxt.s_bs_ctxt.pu1_pic_qp[(i4_mb_y * ps_proc->i4_wd_mbs) + i4_mb_x] = ps_proc->u4_mb_qp;
1768 i4_n_mb_process_count = (ps_proc->i4_wd_mbs) % i4_n_mbs;
1770 j = (ps_proc->i4_wd_mbs) / i4_n_mbs;
1776 ih264e_deblock_mb(ps_proc, ps_deblk);
1789 ih264e_deblock_mb(ps_proc, ps_deblk);
1799 pu1_pad_src_luma = ps_proc->pu1_rec_buf_luma_base + (ps_proc->i4_ht_mbs - 2) * MB_SIZE * i4_rec_strd;
1801 pu1_pad_src_chroma = ps_proc->pu1_rec_buf_chroma_base + (ps_proc->i4_ht_mbs - 2) * BLK8x8SIZE * i4_rec_strd;
1818 pu1_pad_src_luma = ps_proc->pu1_rec_buf_luma_base + (ps_proc->i4_ht_mbs - 2) * MB_SIZE * i4_rec_strd + (ps_proc->i4_wd_mbs) * MB_SIZE;
1820 pu1_pad_src_chroma = ps_proc->pu1_rec_buf_chroma_base + (ps_proc->i4_ht_mbs - 2) * BLK8x8SIZE * i4_rec_strd + (ps_proc->i4_wd_mbs) * MB_SIZE;
1840 if (ps_proc->i4_ht_mbs <= 2)
1844 pu1_pad_top_src = ps_proc->pu1_rec_buf_luma_base - PAD_LEFT;
1848 pu1_pad_top_src = ps_proc->pu1_rec_buf_chroma_base - PAD_LEFT;
1853 pu1_pad_bottom_src = ps_proc->pu1_rec_buf_luma_base + ps_proc->i4_ht_mbs * MB_SIZE * i4_rec_strd - PAD_LEFT;
1857 pu1_pad_bottom_src = ps_proc->pu1_rec_buf_chroma_base + ps_proc->i4_ht_mbs * (MB_SIZE >> 1) * i4_rec_strd - PAD_LEFT;
1882 * @param[in] ps_proc
1891 WORD32 ih264e_process(process_ctxt_t *ps_proc)
1897 codec_t *ps_codec = ps_proc->ps_codec;
1903 WORD32 i4_wd_mbs = ps_proc->i4_wd_mbs;
1906 WORD32 i4_mb_idx, i4_mb_cnt = ps_proc->i4_mb_cnt;
1918 WORD32 ctxt_sel = ps_proc->i4_encode_api_call_cnt % MAX_CTXT_SETS;
1929 if (ps_proc->i4_slice_type == ISLICE)
1931 if (ps_proc->u4_frame_qp > 10)
1942 u4_valid_modes |= (ps_proc->u4_frame_qp <= 10) << I4x4;
1945 else if (ps_proc->i4_slice_type == PSLICE)
1947 if (ps_proc->u4_frame_qp > 10)
1958 u4_valid_modes |= (ps_proc->u4_frame_qp <= 10) << I4x4;
1963 else if (ps_proc->i4_slice_type == BSLICE)
1965 if (ps_proc->u4_frame_qp > 10)
1976 u4_valid_modes |= (ps_proc->u4_frame_qp <= 10) << I4x4;
1984 ps_proc->s_entropy.i4_mb_x = ps_proc->i4_mb_x;
1985 ps_proc->s_entropy.i4_mb_y = ps_proc->i4_mb_y;
1986 ps_proc->s_entropy.i4_mb_cnt = MIN(ps_proc->i4_nmb_ntrpy, i4_wd_mbs - ps_proc->i4_mb_x);
1992 ps_proc->u4_compute_recon = ps_codec->u4_is_curr_frm_ref ||
2002 ps_proc->u4_min_sad = ps_codec->s_cfg.i4_min_sad;
2003 ps_proc->u4_min_sad_reached = 0;
2008 WORD32 i4_mb_id = ps_proc->i4_mb_x + ps_proc->i4_mb_y * i4_wd_mbs;
2018 if (ps_proc->i4_mb_x % ps_proc->u4_nmb_me == 0)
2020 ih264e_compute_me_nmb(ps_proc, MIN((WORD32)ps_proc->u4_nmb_me,
2021 i4_wd_mbs - ps_proc->i4_mb_x));
2026 UWORD32 u4_mb_index = ps_proc->i4_mb_x % ps_proc->u4_nmb_me ;
2029 ps_proc->u4_min_sad_reached = ps_proc->ps_nmb_info[u4_mb_index].u4_min_sad_reached;
2030 ps_proc->u4_min_sad = ps_proc->ps_nmb_info[u4_mb_index].u4_min_sad;
2032 ps_proc->ps_skip_mv = &(ps_proc->ps_nmb_info[u4_mb_index].as_skip_mv[0]);
2033 ps_proc->ps_ngbr_avbl = &(ps_proc->ps_nmb_info[u4_mb_index].s_ngbr_avbl);
2034 ps_proc->ps_pred_mv = &(ps_proc->ps_nmb_info[u4_mb_index].as_pred_mv[0]);
2036 ps_proc->i4_mb_distortion = ps_proc->ps_nmb_info[u4_mb_index].i4_mb_distortion;
2037 ps_proc->i4_mb_cost = ps_proc->ps_nmb_info[u4_mb_index].i4_mb_cost;
2038 ps_proc->u4_min_sad = ps_proc->ps_nmb_info[u4_mb_index].u4_min_sad;
2039 ps_proc->u4_min_sad_reached = ps_proc->ps_nmb_info[u4_mb_index].u4_min_sad_reached;
2040 ps_proc->u4_mb_type = ps_proc->ps_nmb_info[u4_mb_index].u4_mb_type;
2043 ps_proc->pu1_best_subpel_buf = ps_proc->ps_nmb_info[u4_mb_index].pu1_best_sub_pel_buf;
2044 ps_proc->u4_bst_spel_buf_strd = ps_proc->ps_nmb_info[u4_mb_index].u4_bst_spel_buf_strd;
2046 ih264e_derive_nghbr_avbl_of_mbs(ps_proc);
2051 ps_proc->ps_ngbr_avbl = &ps_proc->s_ngbr_avbl;
2053 ih264e_derive_nghbr_avbl_of_mbs(ps_proc);
2062 ps_proc->u4_min_sad_reached = 0;
2063 ps_proc->i4_mb_cost = INT_MAX;
2064 ps_proc->i4_mb_distortion = INT_MAX;
2066 else if (ps_proc->u4_mb_type == PSKIP)
2073 if(ps_proc->i4_mb_y > 0)
2078 pu1_proc_map_top = ps_proc->pu1_proc_map + ((ps_proc->i4_mb_y - 1) * i4_wd_mbs);
2094 if (ps_proc->u4_min_sad_reached == 0)
2098 if (i4_air_enable_inter && ps_proc->i4_slice_type != ISLICE && ps_codec->u4_inter_gate)
2103 i4_distortion[0] = ps_proc->s_left_mb_syntax_ele.i4_mb_distortion;
2105 i4_distortion[1] = ps_proc->ps_top_row_mb_syntax_ele[ps_proc->i4_mb_x].i4_mb_distortion;
2107 i4_distortion[2] = ps_proc->ps_top_row_mb_syntax_ele[ps_proc->i4_mb_x + 1].i4_mb_distortion;
2109 i4_distortion[3] = ps_proc->s_top_left_mb_syntax_ele.i4_mb_distortion;
2117 if ( (!i4_air_enable_inter) || ((i4_gate_threshold + 16 *((WORD32) ps_proc->u4_lambda)) < ps_proc->i4_mb_distortion))
2124 ih264e_evaluate_intra4x4_modes_for_least_cost_rdopton(ps_proc);
2128 ih264e_evaluate_intra4x4_modes_for_least_cost_rdoptoff(ps_proc);
2135 ih264e_evaluate_intra16x16_modes_for_least_cost_rdoptoff(ps_proc);
2141 ih264e_evaluate_intra8x8_modes_for_least_cost_rdoptoff(ps_proc);
2149 if (ps_proc->u4_mb_type == I4x4 || ps_proc->u4_mb_type == I16x16 || ps_proc->u4_mb_type == I8x8)
2151 luma_idx = ps_proc->u4_mb_type;
2156 ih264e_evaluate_chroma_intra8x8_modes_for_least_cost_rdoptoff(ps_proc);
2164 ps_proc->u4_is_intra = is_intra;
2165 ps_proc->ps_pu->b1_intra_flag = is_intra;
2170 if (ps_proc->i4_slice_type != ISLICE)
2172 ih264e_mv_pred(ps_proc, ps_proc->i4_slice_type);
2176 u4_cbp_l = (ps_codec->luma_energy_compaction)[luma_idx](ps_proc);
2179 u4_cbp_c = (ps_codec->chroma_energy_compaction)[chroma_idx](ps_proc);
2182 ps_proc->u4_cbp = (u4_cbp_c << 4) | u4_cbp_l;
2184 if (!ps_proc->u4_is_intra)
2186 if (ps_proc->i4_slice_type == BSLICE)
2188 if (ih264e_find_bskip_params(ps_proc, PRED_L0))
2190 ps_proc->u4_mb_type = (ps_proc->u4_cbp) ? BDIRECT : BSKIP;
2193 else if(!ps_proc->u4_cbp)
2195 if (ih264e_find_pskip_params(ps_proc, PRED_L0))
2197 ps_proc->u4_mb_type = PSKIP;
2205 ih264e_update_rc_mb_info(&ps_proc->s_frame_info, ps_proc);
2221 if (ps_proc->u4_compute_recon)
2225 UWORD8 *pu1_cur_pic_luma = ps_proc->pu1_rec_buf_luma;
2226 UWORD8 *pu1_cur_pic_chroma = ps_proc->pu1_rec_buf_chroma;
2229 UWORD32 i4_mb_x = ps_proc->i4_mb_x;
2230 UWORD32 i4_mb_y = ps_proc->i4_mb_y;
2233 if (ps_proc->u4_disable_deblock_level != 1)
2235 ih264e_compute_bs(ps_proc);
2239 ih264e_dblk_pad_hpel_processing_n_mbs(ps_proc, pu1_cur_pic_luma,
2245 error_status |= ih264e_update_proc_ctxt(ps_proc);
2248 if (ps_proc->i4_ht_mbs == ps_proc->i4_mb_y)
2251 pic_buf_t *ps_cur_pic = ps_proc->ps_cur_pic;
2254 mv_buf_t *ps_cur_mv_buf = ps_proc->ps_cur_mv_buf;
2276 ps_codec->as_rec_buf[ctxt_sel].i4_pic_cnt = ps_proc->i4_pic_cnt;
2279 ps_codec->as_rec_buf[ctxt_sel].s_pic_buf = *ps_proc->ps_cur_pic;
2282 ps_codec->as_rec_buf[ctxt_sel].u4_is_last = ps_proc->s_entropy.u4_is_last;
2285 ps_codec->as_rec_buf[ctxt_sel].u4_timestamp_high = ps_proc->s_entropy.u4_timestamp_high;
2286 ps_codec->as_rec_buf[ctxt_sel].u4_timestamp_low = ps_proc->s_entropy.u4_timestamp_low;
2292 DEBUG_HISTOGRAM_DUMP(ps_codec->s_cfg.i4_ht_mbs == ps_proc->i4_mb_y);
2331 process_ctxt_t *ps_proc = &ps_codec->as_process[i4_proc_ctxt_sel_base];
2363 s_frame_info.num_mbs[j] += ps_proc[i].s_frame_info.num_mbs[j];
2365 s_frame_info.tot_mb_sad[j] += ps_proc[i].s_frame_info.tot_mb_sad[j];
2367 s_frame_info.qp_sum[j] += ps_proc[i].s_frame_info.qp_sum[j];
2370 s_frame_info.intra_mb_cost_sum += ps_proc[i].s_frame_info.intra_mb_cost_sum;
2372 s_frame_info.activity_sum += ps_proc[i].s_frame_info.activity_sum;
2377 ih264e_update_rc_bits_info(&s_frame_info, &ps_proc[i].s_entropy);
2404 (ps_proc->i4_wd_mbs * ps_proc->i4_ht_mbs),
2440 process_ctxt_t *ps_proc = pv_proc;
2443 codec_t *ps_codec = ps_proc->ps_codec;
2453 ithread_set_affinity(ps_proc->i4_id);
2472 ret = ih264_list_dequeue(ps_proc->pv_entropy_jobq, &s_job, is_blocking);
2490 ret = ih264_list_dequeue(ps_proc->pv_proc_jobq, &s_job, 1);
2493 if(ps_proc->i4_id)
2504 ps_proc = &ps_codec->as_process[ps_proc->i4_id + s_job.i2_proc_base_idx];
2509 ps_proc->i4_mb_cnt = s_job.i2_mb_cnt;
2510 ps_proc->i4_mb_x = s_job.i2_mb_x;
2511 ps_proc->i4_mb_y = s_job.i2_mb_y;
2514 ih264e_init_proc_ctxt(ps_proc);
2517 error_status |= ih264e_process(ps_proc);
2521 ps_proc->s_entropy.i4_mb_x = s_job.i2_mb_x;
2522 ps_proc->s_entropy.i4_mb_y = s_job.i2_mb_y;
2523 ps_proc->s_entropy.i4_mb_cnt = s_job.i2_mb_cnt;
2526 ih264e_init_entropy_ctxt(ps_proc);
2529 error_status |= ih264e_entropy(ps_proc);
2539 ps_proc->i4_error_code = error_status;