Lines Matching defs:ps_proc
206 * @param[in] ps_proc
215 IH264E_ERROR_T ih264e_init_entropy_ctxt(process_ctxt_t *ps_proc)
218 codec_t *ps_codec = ps_proc->ps_codec;
221 entropy_ctxt_t *ps_entropy = &ps_proc->s_entropy;
230 ps_entropy->i4_cur_slice_idx = ps_proc->pu1_slice_idx[ps_entropy->i4_mb_start_add];
265 * @param[in] ps_proc
275 IH264E_ERROR_T ih264e_entropy(process_ctxt_t *ps_proc)
278 codec_t *ps_codec = ps_proc->ps_codec;
281 entropy_ctxt_t *ps_entropy = &ps_proc->s_entropy;
296 WORD32 i4_slice_type = ps_proc->i4_slice_type;
311 WORD32 ctxt_sel = ps_proc->i4_encode_api_call_cnt % MAX_CTXT_SETS;
337 pu1_proc_map = ps_proc->pu1_proc_map + ps_entropy->i4_mb_y * i4_wd_mbs;
384 ih264e_populate_slice_header(ps_proc, ps_slice_hdr, ps_pps, ps_sps);
420 pu1_proc_map = ps_proc->pu1_proc_map + ps_entropy->i4_mb_y * i4_wd_mbs;
508 ih264e_populate_slice_header(ps_proc, ps_slice_hdr, ps_pps,
586 (ps_proc->ps_codec->i4_poc == 0));
635 * @param[in] ps_proc
644 IH264E_ERROR_T ih264e_pack_header_data(process_ctxt_t *ps_proc)
647 UWORD32 u4_mb_type = ps_proc->u4_mb_type;
653 UWORD8 *pu1_ptr = ps_proc->pv_mb_header_data;
659 *pu1_ptr++ = (ps_proc->u1_c_i8_mode << 6) + u4_mb_type;
662 *pu1_ptr++ = ps_proc->u4_cbp;
665 *pu1_ptr++ = ps_proc->u4_mb_qp - ps_proc->u4_mb_qp_prev;
672 if (ps_proc->au1_predicted_intra_luma_mb_4x4_modes[i4] ==
673 ps_proc->au1_intra_luma_mb_4x4_modes[i4])
680 if (ps_proc->au1_intra_luma_mb_4x4_modes[i4] <
681 ps_proc->au1_predicted_intra_luma_mb_4x4_modes[i4])
683 byte |= (ps_proc->au1_intra_luma_mb_4x4_modes[i4] << 1);
687 byte |= (ps_proc->au1_intra_luma_mb_4x4_modes[i4] - 1) << 1;
693 if (ps_proc->au1_predicted_intra_luma_mb_4x4_modes[i4] ==
694 ps_proc->au1_intra_luma_mb_4x4_modes[i4])
701 if (ps_proc->au1_intra_luma_mb_4x4_modes[i4] <
702 ps_proc->au1_predicted_intra_luma_mb_4x4_modes[i4])
704 byte |= (ps_proc->au1_intra_luma_mb_4x4_modes[i4] << 5);
708 byte |= (ps_proc->au1_intra_luma_mb_4x4_modes[i4] - 1) << 5;
716 ps_proc->pv_mb_header_data = pu1_ptr;
721 UWORD8 *pu1_ptr = ps_proc->pv_mb_header_data;
724 *pu1_ptr++ = (ps_proc->u1_c_i8_mode << 6) + (ps_proc->u1_l_i16_mode << 4) + u4_mb_type;
727 *pu1_ptr++ = ps_proc->u4_cbp;
730 *pu1_ptr++ = ps_proc->u4_mb_qp - ps_proc->u4_mb_qp_prev;
733 ps_proc->pv_mb_header_data = pu1_ptr;
738 UWORD8 *pu1_ptr = ps_proc->pv_mb_header_data;
746 *pu1_ptr++ = ps_proc->u4_cbp;
749 *pu1_ptr++ = ps_proc->u4_mb_qp - ps_proc->u4_mb_qp_prev;
753 *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;
755 *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;
758 ps_proc->pv_mb_header_data = i2_mv_ptr;
763 UWORD8 *pu1_ptr = ps_proc->pv_mb_header_data;
769 ps_proc->pv_mb_header_data = pu1_ptr;
775 UWORD8 *pu1_ptr = ps_proc->pv_mb_header_data;
779 UWORD32 u4_pred_mode = ps_proc->ps_pu->b2_pred_mode;
785 *pu1_ptr++ = ps_proc->u4_cbp;
788 *pu1_ptr++ = ps_proc->u4_mb_qp - ps_proc->u4_mb_qp_prev;
795 *i2_mv_ptr++ = ps_proc->ps_pu->s_me_info[0].s_mv.i2_mvx
796 - ps_proc->ps_pred_mv[0].s_mv.i2_mvx;
798 *i2_mv_ptr++ = ps_proc->ps_pu->s_me_info[0].s_mv.i2_mvy
799 - ps_proc->ps_pred_mv[0].s_mv.i2_mvy;
803 *i2_mv_ptr++ = ps_proc->ps_pu->s_me_info[1].s_mv.i2_mvx
804 - ps_proc->ps_pred_mv[1].s_mv.i2_mvx;
806 *i2_mv_ptr++ = ps_proc->ps_pu->s_me_info[1].s_mv.i2_mvy
807 - ps_proc->ps_pred_mv[1].s_mv.i2_mvy;
811 ps_proc->pv_mb_header_data = i2_mv_ptr;
817 UWORD8 *pu1_ptr = ps_proc->pv_mb_header_data;
823 *pu1_ptr++ = ps_proc->u4_cbp;
826 *pu1_ptr++ = ps_proc->u4_mb_qp - ps_proc->u4_mb_qp_prev;
828 ps_proc->pv_mb_header_data = pu1_ptr;
833 UWORD32 u4_pred_mode = ps_proc->ps_pu->b2_pred_mode;
836 UWORD8 *pu1_ptr = ps_proc->pv_mb_header_data;
842 ps_proc->pv_mb_header_data = pu1_ptr;
866 * @param[in] ps_proc
875 WORD32 ih264e_update_proc_ctxt(process_ctxt_t *ps_proc)
881 codec_t *ps_codec = ps_proc->ps_codec;
884 WORD32 i4_mb_x = ps_proc->i4_mb_x;
885 WORD32 i4_mb_y = ps_proc->i4_mb_y;
888 mb_info_t *ps_left_syn = &ps_proc->s_left_mb_syntax_ele;
889 mb_info_t *ps_top_syn = ps_proc->ps_top_row_mb_syntax_ele + i4_mb_x;
890 mb_info_t *ps_top_left_syn = &ps_proc->s_top_left_mb_syntax_ele;
893 UWORD32 u4_mb_type = ps_proc->u4_mb_type;
896 UWORD32 u4_is_intra = ps_proc->u4_is_intra;
899 WORD32 i4_wd_mbs = ps_proc->i4_wd_mbs;
902 WORD32 i4_ht_mbs = ps_proc->i4_ht_mbs;
905 UWORD8 *pu1_proc_map = ps_proc->pu1_proc_map + (i4_mb_y * i4_wd_mbs);
908 deblk_ctxt_t *ps_deblk = &ps_proc->s_deblk_ctxt;
914 enc_pu_t *ps_top_row_pu = ps_proc->ps_top_row_pu + i4_mb_x;
917 enc_pu_t *ps_top_left_mb_pu = &ps_proc->s_top_left_mb_pu;
920 enc_pu_t *ps_left_mb_pu = &ps_proc->s_left_mb_pu;
923 UWORD8 *pu1_top_mb_intra_modes = ps_proc->pu1_top_mb_intra_modes + (i4_mb_x << 4);
935 if (ps_proc->i4_slice_type != ISLICE)
955 ps_left_syn->u4_csbp = ps_top_syn->u4_csbp = ps_proc->u4_csbp;
958 ps_left_syn->i4_mb_distortion = ps_top_syn->i4_mb_distortion = ps_proc->i4_mb_distortion;
965 pu1_top_mb_intra_modes[0] = ps_proc->au1_left_mb_intra_modes[0] = ps_proc->u1_l_i16_mode;
969 ps_codec->pf_mem_cpy_mul8(ps_proc->au1_left_mb_intra_modes, ps_proc->au1_intra_luma_mb_4x4_modes, 16);
970 ps_codec->pf_mem_cpy_mul8(pu1_top_mb_intra_modes, ps_proc->au1_intra_luma_mb_4x4_modes, 16);
974 memcpy(ps_proc->au1_left_mb_intra_modes, ps_proc->au1_intra_luma_mb_8x8_modes, 4);
975 ps_proc->au1_intra_luma_mb_8x8_modes, 4);
978 if ((ps_proc->i4_slice_type == PSLICE) ||(ps_proc->i4_slice_type == BSLICE))
981 *ps_left_mb_pu = *ps_top_row_pu = *(ps_proc->ps_pu);
984 *ps_proc->pu4_mb_pu_cnt = 1;
989 *ps_left_mb_pu = *ps_top_row_pu = *(ps_proc->ps_pu);
996 ps_proc->pu1_is_intra_coded[i4_mb_x + (i4_mb_y * i4_wd_mbs)] = u4_is_intra;
1001 ih264e_pack_header_data(ps_proc);
1004 ps_proc->u4_mb_qp_prev = ps_proc->u4_mb_qp;
1007 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;
1037 s_job.i2_mb_y = ps_proc->i4_mb_y;
1043 error_status |= ih264_list_queue(ps_proc->pv_entropy_jobq, &s_job, 1);
1045 if(ps_proc->i4_mb_y == (i4_ht_mbs - 1))
1057 ps_proc->i4_mb_x = i4_mb_x;
1059 if (ps_proc->i4_mb_x == i4_wd_mbs)
1061 ps_proc->i4_mb_y++;
1062 ps_proc->i4_mb_x = 0;
1066 ps_proc->i4_cur_slice_idx = ps_proc->pu1_slice_idx[ps_proc->i4_mb_y * i4_wd_mbs + ps_proc->i4_mb_x];
1069 ps_proc->pu1_src_buf_luma += MB_SIZE;
1070 ps_proc->pu1_rec_buf_luma += MB_SIZE;
1071 ps_proc->apu1_ref_buf_luma[0] += MB_SIZE;
1072 ps_proc->apu1_ref_buf_luma[1] += MB_SIZE;
1078 ps_proc->pu1_src_buf_chroma += MB_SIZE;
1079 ps_proc->pu1_rec_buf_chroma += MB_SIZE;
1080 ps_proc->apu1_ref_buf_chroma[0] += MB_SIZE;
1081 ps_proc->apu1_ref_buf_chroma[1] += MB_SIZE;
1086 ps_proc->i4_mb_cost = INT_MAX;
1087 ps_proc->i4_mb_distortion = SHRT_MAX;
1089 ps_proc->ps_pu += *ps_proc->pu4_mb_pu_cnt;
1091 ps_proc->pu4_mb_pu_cnt += 1;
1094 if (ps_proc->i4_slice_type == BSLICE)
1095 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);
1098 if (ps_proc->u4_disable_deblock_level != 1)
1101 ps_bs->i4_mb_x = ps_proc->i4_mb_x;
1102 ps_bs->i4_mb_y = ps_proc->i4_mb_y;
1131 * @param[in] ps_proc
1140 IH264E_ERROR_T ih264e_init_proc_ctxt(process_ctxt_t *ps_proc)
1143 codec_t *ps_codec = ps_proc->ps_codec;
1146 n_mb_process_ctxt_t *ps_n_mb_ctxt = &ps_proc->s_n_mb_ctxt;
1152 WORD32 i4_src_strd = ps_proc->i4_src_strd;
1153 WORD32 i4_src_chroma_strd = ps_proc->i4_src_chroma_strd;
1154 WORD32 i4_rec_strd = ps_proc->i4_rec_strd;
1157 quant_params_t *ps_qp_params = ps_proc->ps_qp_params[0];
1160 deblk_ctxt_t *ps_deblk = &ps_proc->s_deblk_ctxt;
1166 mv_buf_t *ps_cur_mv_buf = ps_proc->ps_cur_mv_buf;
1181 i4_mb_x = ps_proc->i4_mb_x;
1182 i4_mb_y = ps_proc->i4_mb_y;
1185 ps_proc->i4_nmb_ntrpy = ps_proc->i4_wd_mbs;
1186 ps_proc->u4_nmb_me = ps_proc->i4_wd_mbs;
1193 if (ps_proc->i4_mb_y == ps_proc->i4_ht_mbs - 1)
1195 ps_proc->pu1_src_buf_luma_base = ps_codec->pu1_y_csc_buf_base;
1196 i4_src_strd = ps_proc->i4_src_strd = ps_codec->s_cfg.u4_max_wd;
1197 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);
1202 i4_src_strd = ps_proc->i4_src_strd = ps_proc->s_inp_buf.s_raw_buf.au4_strd[0];
1203 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);
1209 ps_proc->i4_mb_y == (ps_proc->i4_ht_mbs - 1) ||
1214 ps_proc->pu1_src_buf_chroma_base = ps_codec->pu1_uv_csc_buf_base;
1216 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);
1217 i4_src_chroma_strd = ps_proc->i4_src_chroma_strd = ps_codec->s_cfg.u4_max_wd;
1221 i4_src_chroma_strd = ps_proc->i4_src_chroma_strd = ps_proc->s_inp_buf.s_raw_buf.au4_strd[1];
1222 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);
1225 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);
1226 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);
1229 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);
1230 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);
1231 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);
1232 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);
1245 if (ps_proc->i4_mb_y == (ps_proc->i4_ht_mbs - 1) || u4_pad_bottom_sz || u4_pad_right_sz)
1251 pu1_src = (UWORD8 *)ps_proc->s_inp_buf.s_raw_buf.apv_bufs[0] + (i4_mb_x * MB_SIZE) +
1252 ps_proc->s_inp_buf.s_raw_buf.au4_strd[0] * (i4_mb_y * MB_SIZE);
1254 pu1_dst = ps_proc->pu1_src_buf_luma;
1258 if (ps_proc->i4_mb_y == (ps_proc->i4_ht_mbs - 1))
1263 pu1_src += ps_proc->s_inp_buf.s_raw_buf.au4_strd[0];
1264 pu1_dst += ps_proc->i4_src_strd;
1267 pu1_src = (UWORD8 *)ps_proc->s_inp_buf.s_raw_buf.apv_bufs[1] + (i4_mb_x * BLK8x8SIZE) +
1268 ps_proc->s_inp_buf.s_raw_buf.au4_strd[1] * (i4_mb_y * BLK8x8SIZE);
1269 pu1_dst = ps_proc->pu1_src_buf_chroma;
1274 if (ps_proc->i4_mb_y == (ps_proc->i4_ht_mbs - 1))
1275 num_rows = (ps_codec->s_cfg.u4_disp_ht >> 1) - (ps_proc->i4_mb_y * BLK8x8SIZE);
1281 pu1_src += ps_proc->s_inp_buf.s_raw_buf.au4_strd[1];
1282 pu1_dst += ps_proc->i4_src_chroma_strd;
1289 pu1_y_buf_base = (UWORD8 *)ps_proc->s_inp_buf.s_raw_buf.apv_bufs[0] + (i4_mb_x * MB_SIZE) +
1290 ps_proc->s_inp_buf.s_raw_buf.au4_strd[0] * (i4_mb_y * MB_SIZE);
1292 pu1_u_buf_base = (UWORD8 *)ps_proc->s_inp_buf.s_raw_buf.apv_bufs[1] + (i4_mb_x * BLK8x8SIZE) +
1293 ps_proc->s_inp_buf.s_raw_buf.au4_strd[1] * (i4_mb_y * BLK8x8SIZE);
1295 pu1_v_buf_base = (UWORD8 *)ps_proc->s_inp_buf.s_raw_buf.apv_bufs[2] + (i4_mb_x * BLK8x8SIZE) +
1296 ps_proc->s_inp_buf.s_raw_buf.au4_strd[2] * (i4_mb_y * BLK8x8SIZE);
1300 ps_proc->pu1_src_buf_luma,
1301 ps_proc->pu1_src_buf_chroma, u2_num_rows,
1303 ps_proc->s_inp_buf.s_raw_buf.au4_strd[0],
1304 ps_proc->s_inp_buf.s_raw_buf.au4_strd[1],
1305 ps_proc->s_inp_buf.s_raw_buf.au4_strd[2],
1306 ps_proc->i4_src_strd, ps_proc->i4_src_chroma_strd,
1311 pu1_y_buf_base = (UWORD8 *)ps_proc->s_inp_buf.s_raw_buf.apv_bufs[0] + (i4_mb_x * MB_SIZE * 2)
1312 + ps_proc->s_inp_buf.s_raw_buf.au4_strd[0] * (i4_mb_y * MB_SIZE);
1315 ps_proc->pu1_src_buf_luma,
1316 ps_proc->pu1_src_buf_chroma,
1317 ps_proc->pu1_src_buf_chroma + 1, pu1_y_buf_base,
1319 ps_proc->i4_src_strd, ps_proc->i4_src_chroma_strd,
1320 ps_proc->i4_src_chroma_strd,
1321 ps_proc->s_inp_buf.s_raw_buf.au4_strd[0] >> 1);
1328 if (u4_pad_right_sz && (ps_proc->i4_mb_x == 0))
1331 u4_pad_wd = (UWORD32)(ps_proc->i4_src_strd - ps_codec->s_cfg.u4_disp_wd);
1334 if(ps_proc->i4_mb_y == ps_proc->i4_ht_mbs - 1)
1338 ps_proc->pu1_src_buf_luma + ps_codec->s_cfg.u4_disp_wd,
1339 ps_proc->i4_src_strd, u4_pad_ht, u4_pad_wd);
1342 ps_proc->pu1_src_buf_chroma + ps_codec->s_cfg.u4_disp_wd,
1343 ps_proc->i4_src_chroma_strd, u4_pad_ht / 2, u4_pad_wd);
1347 if (u4_pad_bottom_sz && (ps_proc->i4_mb_y == ps_proc->i4_ht_mbs - 1) && ps_proc->i4_mb_x == 0)
1349 ih264_pad_bottom(ps_proc->pu1_src_buf_luma + (MB_SIZE - u4_pad_bottom_sz) * ps_proc->i4_src_strd,
1350 ps_proc->i4_src_strd, ps_proc->i4_src_strd, u4_pad_bottom_sz);
1352 ih264_pad_bottom(ps_proc->pu1_src_buf_chroma + (MB_SIZE - u4_pad_bottom_sz) * ps_proc->i4_src_chroma_strd / 2,
1353 ps_proc->i4_src_chroma_strd, ps_proc->i4_src_chroma_strd, (u4_pad_bottom_sz / 2));
1358 ps_proc->pv_mb_coeff_data = ((UWORD8 *)ps_proc->pv_pic_mb_coeff_data) + i4_mb_y * ps_codec->u4_size_coeff_data;
1361 ps_proc->pv_mb_header_data = ((UWORD8 *)ps_proc->pv_pic_mb_header_data) + i4_mb_y * ps_codec->u4_size_header_data;
1364 ps_proc->i4_cur_slice_idx = ps_proc->pu1_slice_idx[i4_mb_y * ps_proc->i4_wd_mbs + i4_mb_x];
1374 ps_proc->ps_pu = ps_cur_mv_buf->ps_pic_pu + (i4_mb_y * ps_proc->i4_wd_mbs *
1378 ps_procps_proc->aps_mv_buf[1]->ps_pic_pu + (i4_mb_y * ps_proc->i4_wd_mbs *
1383 ps_proc->ps_top_row_pu_ME = ps_cur_mv_buf->ps_pic_pu;
1387 ps_proc->ps_top_row_pu_ME = ps_cur_mv_buf->ps_pic_pu + ((i4_mb_y - 1) * ps_proc->i4_wd_mbs *
1391 ps_proc->pu4_mb_pu_cnt = ps_cur_mv_buf->pu4_mb_pu_cnt + (i4_mb_y * ps_proc->i4_wd_mbs);
1394 ps_proc->u4_mb_type = I16x16;
1397 ps_proc->u4_lambda = gu1_qp0[ps_qp_params->u1_mb_qp];
1400 ps_proc->i4_mb_distortion = SHRT_MAX;
1404 ps_proc->s_left_mb_syntax_ele.i4_mb_distortion = 0;
1406 ps_proc->s_top_left_mb_syntax_ele.i4_mb_distortion = 0;
1408 ps_proc->s_top_left_mb_syntax_ME.i4_mb_distortion = 0;
1412 memset(ps_proc->ps_top_row_mb_syntax_ele, 0, (ps_proc->i4_wd_mbs + 1)*sizeof(mb_info_t));
1417 ps_proc->i4_mb_cost = INT_MAX;
1422 ps_deblk->i4_mb_x = ps_proc->i4_mb_x;
1427 ps_deblk->i4_mb_y = ps_proc->i4_mb_y - 1;
1430 ps_deblk->pu1_cur_pic_luma = ps_proc->pu1_rec_buf_luma_base + i4_rec_strd * (ps_deblk->i4_mb_y * MB_SIZE);
1431 ps_deblk->pu1_cur_pic_chroma = ps_proc->pu1_rec_buf_chroma_base + i4_rec_strd * (ps_deblk->i4_mb_y * BLK8x8SIZE);
1435 ps_bs->i4_mb_x = ps_proc->i4_mb_x;
1436 ps_bs->i4_mb_y = ps_proc->i4_mb_y;
1441 ps_n_mb_ctxt->i4_n_mbs = ps_proc->i4_nmb_ntrpy;
1453 * @param[in] ps_proc
1477 IH264E_ERROR_T ih264e_pad_recon_buffer(process_ctxt_t *ps_proc,
1485 codec_t *ps_codec = ps_proc->ps_codec;
1488 WORD32 i4_rec_strd = ps_proc->i4_rec_strd;
1498 if (i4_mb_x == ps_proc->i4_wd_mbs - 1)
1506 if (i4_mb_y == ps_proc->i4_ht_mbs - 1)
1532 if (i4_mb_x == ps_proc->i4_wd_mbs - 1)
1558 * @param[in] ps_proc
1579 IH264E_ERROR_T ih264e_dblk_pad_hpel_processing_n_mbs(process_ctxt_t *ps_proc,
1586 codec_t *ps_codec = ps_proc->ps_codec;
1589 n_mb_process_ctxt_t *ps_n_mb_ctxt = &ps_proc->s_n_mb_ctxt;
1592 deblk_ctxt_t *ps_deblk = &ps_proc->s_deblk_ctxt;
1595 WORD32 i4_rec_strd = ps_proc->i4_rec_strd;
1604 UWORD8 *pu1_deblk_map = ps_proc->pu1_deblk_map + ps_deblk->i4_mb_y * ps_proc->i4_wd_mbs;
1607 UWORD8 *pu1_deblk_map_prev_row = pu1_deblk_map - ps_proc->i4_wd_mbs;
1625 if (ps_proc->u4_disable_deblock_level == 1)
1637 if (i4_mb_x == (ps_proc->i4_wd_mbs - 1))
1647 if ((i4_mb_y > 0) || (i4_mb_y == (ps_proc->i4_ht_mbs - 1)))
1651 if ( ((i4_mb_x - (ps_n_mb_ctxt->i4_mb_x - 1)) < i4_n_mbs) && (i4_mb_x < (ps_proc->i4_wd_mbs - 1)) )
1660 if ((i4_mb_y > 0) && (ps_proc->u4_disable_deblock_level != 1))
1671 if ((ps_deblk->i4_mb_x + i4_n_mb_process_count) != ps_proc->i4_wd_mbs)
1684 ih264e_deblock_mb(ps_proc, ps_deblk);
1699 if (ps_deblk->i4_mb_x == (ps_proc->i4_wd_mbs - 1))/*last column*/
1734 if (i4_mb_x == ps_proc->i4_wd_mbs - 1)
1740 ps_codec->pf_pad_top(ps_proc->pu1_rec_buf_luma_base + u4_pad_top, i4_rec_strd, u4_pad_wd, PAD_TOP);
1743 ps_codec->pf_pad_top(ps_proc->pu1_rec_buf_chroma_base + u4_pad_top, i4_rec_strd, u4_pad_wd, (PAD_TOP >> 1));
1748 if (i4_mb_x == ps_proc->i4_wd_mbs - 1)
1750 if (ps_proc->i4_mb_y == ps_proc->i4_ht_mbs - 1)
1753 if (ps_proc->u4_disable_deblock_level != 1)
1755 ps_deblk->pu1_cur_pic_luma = ps_proc->pu1_rec_buf_luma_base + (ps_proc->i4_ht_mbs - 1) * i4_rec_strd * MB_SIZE;
1757 ps_deblk->pu1_cur_pic_chroma = ps_proc->pu1_rec_buf_chroma_base + (ps_proc->i4_ht_mbs - 1) * i4_rec_strd * BLK8x8SIZE;
1760 ps_n_mb_ctxt->i4_mb_y = ps_proc->i4_mb_y;
1762 ps_deblk->i4_mb_y = ps_proc->i4_mb_y;
1765 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;
1767 i4_n_mb_process_count = (ps_proc->i4_wd_mbs) % i4_n_mbs;
1769 j = (ps_proc->i4_wd_mbs) / i4_n_mbs;
1775 ih264e_deblock_mb(ps_proc, ps_deblk);
1788 ih264e_deblock_mb(ps_proc, ps_deblk);
1798 pu1_pad_src_luma = ps_proc->pu1_rec_buf_luma_base + (ps_proc->i4_ht_mbs - 2) * MB_SIZE * i4_rec_strd;
1800 pu1_pad_src_chroma = ps_proc->pu1_rec_buf_chroma_base + (ps_proc->i4_ht_mbs - 2) * BLK8x8SIZE * i4_rec_strd;
1817 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;
1819 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;
1839 if (ps_proc->i4_ht_mbs <= 2)
1843 pu1_pad_top_src = ps_proc->pu1_rec_buf_luma_base - PAD_LEFT;
1847 pu1_pad_top_src = ps_proc->pu1_rec_buf_chroma_base - PAD_LEFT;
1852 pu1_pad_bottom_src = ps_proc->pu1_rec_buf_luma_base + ps_proc->i4_ht_mbs * MB_SIZE * i4_rec_strd - PAD_LEFT;
1856 pu1_pad_bottom_src = ps_proc->pu1_rec_buf_chroma_base + ps_proc->i4_ht_mbs * (MB_SIZE >> 1) * i4_rec_strd - PAD_LEFT;
1881 * @param[in] ps_proc
1890 WORD32 ih264e_process(process_ctxt_t *ps_proc)
1896 codec_t *ps_codec = ps_proc->ps_codec;
1902 WORD32 i4_wd_mbs = ps_proc->i4_wd_mbs;
1905 WORD32 i4_mb_idx, i4_mb_cnt = ps_proc->i4_mb_cnt;
1917 WORD32 ctxt_sel = ps_proc->i4_encode_api_call_cnt % MAX_CTXT_SETS;
1928 if (ps_proc->i4_slice_type == ISLICE)
1930 if (ps_proc->u4_frame_qp > 10)
1941 u4_valid_modes |= (ps_proc->u4_frame_qp <= 10) << I4x4;
1944 else if (ps_proc->i4_slice_type == PSLICE)
1946 if (ps_proc->u4_frame_qp > 10)
1957 u4_valid_modes |= (ps_proc->u4_frame_qp <= 10) << I4x4;
1962 else if (ps_proc->i4_slice_type == BSLICE)
1964 if (ps_proc->u4_frame_qp > 10)
1975 u4_valid_modes |= (ps_proc->u4_frame_qp <= 10) << I4x4;
1983 ps_proc->s_entropy.i4_mb_x = ps_proc->i4_mb_x;
1984 ps_proc->s_entropy.i4_mb_y = ps_proc->i4_mb_y;
1985 ps_proc->s_entropy.i4_mb_cnt = MIN(ps_proc->i4_nmb_ntrpy, i4_wd_mbs - ps_proc->i4_mb_x);
1991 ps_proc->u4_compute_recon = ps_codec->u4_is_curr_frm_ref ||
2001 ps_proc->u4_min_sad = ps_codec->s_cfg.i4_min_sad;
2002 ps_proc->u4_min_sad_reached = 0;
2007 WORD32 i4_mb_id = ps_proc->i4_mb_x + ps_proc->i4_mb_y * i4_wd_mbs;
2011 (ps_proc->pu1_is_intra_coded[i4_mb_id] != 0) ||
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
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;