Home | History | Annotate | Download | only in encoder

Lines Matching defs:ps_me_ctxt

123 void ih264e_init_mv_bits(me_ctxt_t *ps_me_ctxt)
146 ps_me_ctxt->pu1_mv_bits[0] = 1;
160 ps_me_ctxt->pu1_mv_bits[-i] = ps_me_ctxt->pu1_mv_bits[i] = codesize;
214 me_ctxt_t *ps_me_ctxt,
227 mb_part_ctxt *ps_mb_part = &ps_me_ctxt->as_mb_part[i4_reflist];
239 WORD32 i4_srch_range_n = ps_me_ctxt->i4_srch_range_n;
240 WORD32 i4_srch_range_s = ps_me_ctxt->i4_srch_range_s;
241 WORD32 i4_srch_range_e = ps_me_ctxt->i4_srch_range_e;
242 WORD32 i4_srch_range_w = ps_me_ctxt->i4_srch_range_w;
258 ps_me_ctxt->as_mv_init_search[i4_reflist][u4_num_candidates].i2_mvx = 0;
259 ps_me_ctxt->as_mv_init_search[i4_reflist][u4_num_candidates].i2_mvy = 0;
272 ps_me_ctxt->as_mv_init_search[i4_reflist][u4_num_candidates].i2_mvx = mvx;
273 ps_me_ctxt->as_mv_init_search[i4_reflist][u4_num_candidates].i2_mvy = mvy;
287 ps_me_ctxt->as_mv_init_search[i4_reflist][u4_num_candidates].i2_mvx = mvx;
288 ps_me_ctxt->as_mv_init_search[i4_reflist][u4_num_candidates].i2_mvy = mvy;
301 ps_me_ctxt->as_mv_init_search[i4_reflist][u4_num_candidates].i2_mvx = mvx;
302 ps_me_ctxt->as_mv_init_search[i4_reflist][u4_num_candidates].i2_mvy = mvy;
315 ps_me_ctxt->as_mv_init_search[i4_reflist][u4_num_candidates].i2_mvx = mvx;
316 ps_me_ctxt->as_mv_init_search[i4_reflist][u4_num_candidates].i2_mvy = mvy;
333 ps_me_ctxt->i4_skip_type = ps_proc->ps_codec->apf_find_skip_params_me
343 ps_me_ctxt->as_mv_init_search[i4_reflist][u4_num_candidates].i2_mvx = mvx;
344 ps_me_ctxt->as_mv_init_search[i4_reflist][u4_num_candidates].i2_mvy = mvy;
356 ps_me_ctxt->as_mv_init_search[i4_reflist][u4_num_candidates].i2_mvx = mvx;
357 ps_me_ctxt->as_mv_init_search[i4_reflist][u4_num_candidates].i2_mvy = mvy;
364 ps_me_ctxt->u4_num_candidates[i4_reflist] = u4_num_candidates;
826 me_ctxt_t *ps_me_ctxt = &ps_proc->s_me_ctxt;
831 ps_me_ctxt->i4_skip_bias[BSLICE] = SKIP_BIAS_B;
835 ps_me_ctxt->i4_skip_bias[PSLICE] = 4 * SKIP_BIAS_P;
839 ps_me_ctxt->i4_skip_bias[PSLICE] = SKIP_BIAS_P;
843 ps_me_ctxt->pu1_src_buf_luma = ps_proc->pu1_src_buf_luma;
845 ps_me_ctxt->i4_src_strd = ps_proc->i4_src_strd;
848 ps_me_ctxt->apu1_ref_buf_luma[0] = ps_proc->apu1_ref_buf_luma[0];
849 ps_me_ctxt->apu1_ref_buf_luma[1] = ps_proc->apu1_ref_buf_luma[1];
851 ps_me_ctxt->u4_lambda_motion = gu1_qp0[ps_me_ctxt->u1_mb_qp];
882 me_ctxt_t *ps_me_ctxt = &ps_proc->s_me_ctxt;
900 ps_me_ctxt->pu2_sad_thrsh = ps_qp_params->pu2_sad_thrsh;
916 ps_me_ctxt->i4_srch_range_w = -MIN(columns_left, DEFAULT_MAX_SRCH_RANGE_X >> 1);
917 ps_me_ctxt->i4_srch_range_e = MIN(columns_right, DEFAULT_MAX_SRCH_RANGE_X >> 1);
918 ps_me_ctxt->i4_srch_range_n = -MIN(rows_above, DEFAULT_MAX_SRCH_RANGE_Y >> 1);
919 ps_me_ctxt->i4_srch_range_s = MIN(rows_below, DEFAULT_MAX_SRCH_RANGE_Y >> 1);
922 ps_me_ctxt->i4_srch_range_w += 1;
923 ps_me_ctxt->i4_srch_range_e -= 1;
924 ps_me_ctxt->i4_srch_range_n += 1;
925 ps_me_ctxt->i4_srch_range_s -= 1;
935 ps_me_ctxt->u4_min_sad_reached = 0;
936 ps_me_ctxt->i4_min_sad = ps_proc->ps_cur_mb->u4_min_sad;
939 ih264e_get_search_candidates(ps_proc, ps_me_ctxt, PRED_L0);
949 ime_compute_skip_cost( ps_me_ctxt,
962 ps_me_ctxt->as_mb_part[PRED_L0].s_mv_curr.i2_mvx = 0;
963 ps_me_ctxt->as_mb_part[PRED_L0].s_mv_curr.i2_mvy = 0;
964 ps_me_ctxt->as_mb_part[PRED_L0].i4_mb_cost = INT_MAX;
965 ps_me_ctxt->as_mb_part[PRED_L0].i4_mb_distortion = INT_MAX;
968 ps_me_ctxt->as_mb_part[PRED_L0].pu1_best_hpel_buf = NULL;
971 if (!ps_me_ctxt
974 ime_evaluate_init_srchposn_16x16(ps_me_ctxt, PRED_L0);
979 ime_full_pel_motion_estimation_16x16(ps_me_ctxt, PRED_L0);
982 ps_me_ctxt->as_mb_part[PRED_L0].s_mv_curr.i2_mvx <<= 2;
983 ps_me_ctxt->as_mb_part[PRED_L0].s_mv_curr.i2_mvy <<= 2;
985 if (ps_me_ctxt->u4_enable_hpel)
988 pu1_hpel_src = ps_me_ctxt->apu1_ref_buf_luma[PRED_L0]
989 + (ps_me_ctxt->as_mb_part[PRED_L0].s_mv_curr.i2_mvx >> 2)
990 + (ps_me_ctxt->as_mb_part[PRED_L0].s_mv_curr.i2_mvy >> 2)* i4_rec_strd;
992 ps_me_ctxt->apu1_subpel_buffs[0] = ps_proc->apu1_subpel_buffs[0];
993 ps_me_ctxt->apu1_subpel_buffs[1] = ps_proc->apu1_subpel_buffs[1];
994 ps_me_ctxt->apu1_subpel_buffs[2] = ps_proc->apu1_subpel_buffs[2];
996 ps_me_ctxt->u4_subpel_buf_strd = HP_BUFF_WD;
1005 ps_me_ctxt->apu1_subpel_buffs[0],
1007 ps_me_ctxt->u4_subpel_buf_strd);
1020 pu1_hpel_src, ps_me_ctxt->apu1_subpel_buffs[1],
1021 ps_me_ctxt->apu1_subpel_buffs[2], i4_rec_strd,
1022 ps_me_ctxt->u4_subpel_buf_strd, ps_proc->ai16_pred1 + 3,
1023 ps_me_ctxt->u4_subpel_buf_strd);
1025 ime_sub_pel_motion_estimation_16x16(ps_me_ctxt, PRED_L0);
1037 if (s_skip_mbpart.i4_mb_cost < ps_me_ctxt->as_mb_part[PRED_L0].i4_mb_cost)
1039 ps_me_ctxt->as_mb_part[PRED_L0].i4_mb_cost = s_skip_mbpart.i4_mb_cost;
1040 ps_me_ctxt->as_mb_part[PRED_L0].i4_mb_distortion = s_skip_mbpart.i4_mb_distortion;
1041 ps_me_ctxt->as_mb_part[PRED_L0].s_mv_curr = s_skip_mbpart.s_mv_curr;
1043 else if (ps_me_ctxt->as_mb_part[PRED_L0].pu1_best_hpel_buf)
1047 ps_me_ctxt->as_mb_part[PRED_L0].pu1_best_hpel_buf,
1049 ps_me_ctxt->u4_subpel_buf_strd,
1057 ps_proc->ps_pu->s_me_info[PRED_L0].s_mv.i2_mvx = ps_me_ctxt->as_mb_part[PRED_L0].s_mv_curr.i2_mvx;
1058 ps_proc->ps_pu->s_me_info[PRED_L0].s_mv.i2_mvy = ps_me_ctxt->as_mb_part[PRED_L0].s_mv_curr.i2_mvy;
1059 ps_proc->ps_cur_mb->i4_mb_cost = ps_me_ctxt->as_mb_part[PRED_L0].i4_mb_cost;
1060 ps_proc->ps_cur_mb->i4_mb_distortion = ps_me_ctxt->as_mb_part[PRED_L0].i4_mb_distortion;
1081 if (ps_me_ctxt->u4_min_sad_reached == 1)
1084 ps_proc->ps_cur_mb->u4_min_sad = ps_me_ctxt->i4_min_sad;
1669 void ih264e_evaluate_bipred(me_ctxt_t *ps_me_ctxt,
1688 u4_fast_sad = ps_me_ctxt->u4_enable_fast_sad;
1691 for (i = 0; i < ps_me_ctxt->u4_num_candidates[PRED_BI]; i += 2)
1693 pu1_dst_buf = ps_me_ctxt->apu1_subpel_buffs[i4_dest_buff];
1695 s_l0_mv.i2_mvx = ps_me_ctxt->as_mv_init_search[PRED_BI][i].i2_mvx >> 2;
1696 s_l0_mv.i2_mvy = ps_me_ctxt->as_mv_init_search[PRED_BI][i].i2_mvy >> 2;
1697 s_l1_mv.i2_mvx = ps_me_ctxt->as_mv_init_search[PRED_BI][i + 1].i2_mvx >> 2;
1698 s_l1_mv.i2_mvy = ps_me_ctxt->as_mv_init_search[PRED_BI][i + 1].i2_mvy >> 2;
1703 if ((ps_me_ctxt->as_mv_init_search[PRED_BI][i].i2_mvx & 0x3)||
1704 (ps_me_ctxt->as_mv_init_search[PRED_BI][i].i2_mvy & 0x3))
1706 pu1_ref_mb_l0 = ps_me_ctxt->as_mb_part[PRED_L0].pu1_best_hpel_buf;
1707 i4_ref_l0_stride = ps_me_ctxt->u4_subpel_buf_strd;
1711 pu1_ref_mb_l0 = ps_me_ctxt->apu1_ref_buf_luma[PRED_L0] + (s_l0_mv.i2_mvx) + ((s_l0_mv.i2_mvy) * ps_me_ctxt->i4_rec_strd);
1712 i4_ref_l0_stride = ps_me_ctxt->i4_rec_strd;
1716 if ((ps_me_ctxt->as_mv_init_search[PRED_BI][i + 1].i2_mvx & 0x3) ||
1717 (ps_me_ctxt->as_mv_init_search[PRED_BI][i + 1].i2_mvy & 0x3))
1719 pu1_ref_mb_l1 = ps_me_ctxt->as_mb_part[PRED_L1].pu1_best_hpel_buf;
1720 i4_ref_l1_stride = ps_me_ctxt->u4_subpel_buf_strd;
1724 pu1_ref_mb_l1 = ps_me_ctxt->apu1_ref_buf_luma[PRED_L1] + (s_l1_mv.i2_mvx) + ((s_l1_mv.i2_mvy) * ps_me_ctxt->i4_rec_strd);
1725 i4_ref_l1_stride = ps_me_ctxt->i4_rec_strd;
1731 ps_me_ctxt->u4_subpel_buf_strd, MB_SIZE, MB_SIZE);
1733 ps_me_ctxt->pf_ime_compute_sad_16x16[u4_fast_sad](
1734 ps_me_ctxt->pu1_src_buf_luma, pu1_dst_buf,
1735 ps_me_ctxt->i4_src_strd, ps_me_ctxt->u4_subpel_buf_strd,
1739 i4_mb_cost = ps_me_ctxt->pu1_mv_bits[ps_me_ctxt->as_mv_init_search[PRED_BI][i].i2_mvx - ps_l0_pred_mv->i2_mvx];
1740 i4_mb_cost += ps_me_ctxt->pu1_mv_bits[ps_me_ctxt->as_mv_init_search[PRED_BI][i].i2_mvy - ps_l0_pred_mv->i2_mvy];
1741 i4_mb_cost += ps_me_ctxt->pu1_mv_bits[ps_me_ctxt->as_mv_init_search[PRED_BI][i + 1].i2_mvx - ps_l1_pred_mv->i2_mvx];
1742 i4_mb_cost += ps_me_ctxt->pu1_mv_bits[ps_me_ctxt->as_mv_init_search[PRED_BI][i + 1].i2_mvy - ps_l1_pred_mv->i2_mvy];
1744 i4_mb_cost -= (ps_me_ctxt->i4_skip_bias[BSLICE]) * (ps_me_ctxt->i4_skip_type == PRED_BI) * (i == 0);
1747 i4_mb_cost *= ps_me_ctxt->u4_lambda_motion;
1786 me_ctxt_t *ps_me_ctxt = &ps_proc->s_me_ctxt;
1807 ps_me_ctxt->pu2_sad_thrsh = ps_qp_params->pu2_sad_thrsh;
1823 ps_me_ctxt->i4_srch_range_w = -MIN(columns_left, DEFAULT_MAX_SRCH_RANGE_X >> 1);
1824 ps_me_ctxt->i4_srch_range_e = MIN(columns_right, DEFAULT_MAX_SRCH_RANGE_X >> 1);
1825 ps_me_ctxt->i4_srch_range_n = -MIN(rows_above, DEFAULT_MAX_SRCH_RANGE_Y >> 1);
1826 ps_me_ctxt->i4_srch_range_s = MIN(rows_below, DEFAULT_MAX_SRCH_RANGE_Y >> 1);
1829 if (ps_me_ctxt->u4_enable_hpel)
1831 ps_me_ctxt->i4_srch_range_w += 1;
1832 ps_me_ctxt->i4_srch_range_e -= 1;
1833 ps_me_ctxt->i4_srch_range_n += 1;
1834 ps_me_ctxt->i4_srch_range_s -= 1;
1848 ps_me_ctxt->u4_min_sad_reached = 0;
1849 ps_me_ctxt->i4_min_sad = ps_proc->ps_cur_mb->u4_min_sad;
1855 ih264e_get_search_candidates(ps_proc, ps_me_ctxt, i4_reflist);
1865 if (ps_me_ctxt->i4_skip_type == i4_reflist)
1867 ime_compute_skip_cost( ps_me_ctxt,
1881 ps_me_ctxt->as_mb_part[i4_reflist].s_mv_curr.i2_mvx = 0;
1882 ps_me_ctxt->as_mb_part[i4_reflist].s_mv_curr.i2_mvy = 0;
1883 ps_me_ctxt->as_mb_part[i4_reflist].i4_mb_cost = INT_MAX;
1884 ps_me_ctxt->as_mb_part[i4_reflist].i4_mb_distortion = INT_MAX;
1887 ps_me_ctxt->as_mb_part[i4_reflist].pu1_best_hpel_buf = NULL;
1890 if (ps_me_ctxt->u4_min_sad_reached)
1898 ime_evaluate_init_srchposn_16x16(ps_me_ctxt, i4_reflist);
1903 ime_full_pel_motion_estimation_16x16(ps_me_ctxt, i4_reflist);
1905 DEBUG_MV_HISTOGRAM_ADD((ps_me_ctxt->s_mb_part.s_mv_curr.i2_mvx >> 2),
1906 (ps_me_ctxt->s_mb_part.s_mv_curr.i2_mvy >> 2));
1908 DEBUG_SAD_HISTOGRAM_ADD(ps_me_ctxt->s_mb_part.i4_mb_distortion, 1);
1911 ps_me_ctxt->as_mb_part[i4_reflist].s_mv_curr.i2_mvx <<= 2;
1912 ps_me_ctxt->as_mb_part[i4_reflist].s_mv_curr.i2_mvy <<= 2;
1914 if (ps_me_ctxt->u4_enable_hpel)
1917 pu1_hpel_src = ps_me_ctxt->apu1_ref_buf_luma[i4_reflist]
1918 + (ps_me_ctxt->as_mb_part[i4_reflist].s_mv_curr.i2_mvx >> 2)
1919 + ((ps_me_ctxt->as_mb_part[i4_reflist].s_mv_curr.i2_mvy >> 2)* i4_rec_strd);
1921 ps_me_ctxt->apu1_subpel_buffs[0] = ps_proc->apu1_subpel_buffs[0];
1922 ps_me_ctxt->apu1_subpel_buffs[1] = ps_proc->apu1_subpel_buffs[1];
1923 ps_me_ctxt->apu1_subpel_buffs[2] = ps_proc->apu1_subpel_buffs[2];
1926 ps_me_ctxt->as_mb_part[i4_reflist].i4_srch_pos_idx = 3;
1929 ps_me_ctxt->apu1_subpel_buffs[ps_me_ctxt->as_mb_part[PRED_L0].i4_srch_pos_idx] =
1933 ps_me_ctxt->u4_subpel_buf_strd = HP_BUFF_WD;
1942 ps_me_ctxt->apu1_subpel_buffs[0],
1944 ps_me_ctxt->u4_subpel_buf_strd);
1957 pu1_hpel_src, ps_me_ctxt->apu1_subpel_buffs[1],
1958 ps_me_ctxt->apu1_subpel_buffs[2], i4_rec_strd,
1959 ps_me_ctxt->u4_subpel_buf_strd, ps_proc->ai16_pred1 + 3,
1960 ps_me_ctxt->u4_subpel_buf_strd);
1962 ime_sub_pel_motion_estimation_16x16(ps_me_ctxt, i4_reflist);
1976 if (as_skip_mbpart[i4_reflist].i4_mb_cost < ps_me_ctxt->as_mb_part[i4_reflist].i4_mb_cost)
1978 ps_me_ctxt->as_mb_part[i4_reflist].i4_mb_cost = as_skip_mbpart[i4_reflist].i4_mb_cost;
1979 ps_me_ctxt->as_mb_part[i4_reflist].i4_mb_distortion = as_skip_mbpart[i4_reflist].i4_mb_distortion;
1980 ps_me_ctxt->as_mb_part[i4_reflist].s_mv_curr = as_skip_mbpart[i4_reflist].s_mv_curr;
1993 if (i4_max_reflist == PRED_L1 && ps_me_ctxt->u4_min_sad_reached == 0)
2000 l0_srch_pos_idx = ps_me_ctxt->as_mb_part[PRED_L0].i4_srch_pos_idx;
2001 l1_srch_pos_idx = ps_me_ctxt->as_mb_part[PRED_L1].i4_srch_pos_idx;
2008 ps_me_ctxt->apu1_subpel_buffs[j] = ps_proc->apu1_subpel_buffs[i];
2012 ps_me_ctxt->u4_subpel_buf_strd = HP_BUFF_WD;
2015 i4_l0_skip_mv_idx = ps_me_ctxt->u4_num_candidates[PRED_L0] - 2;
2016 i4_l1_skip_mv_idx = ps_me_ctxt->u4_num_candidates[PRED_L1] - 2;
2017 ps_me_ctxt->as_mv_init_search[PRED_BI][0].i2_mvx = ps_me_ctxt->as_mv_init_search[PRED_L0][i4_l0_skip_mv_idx].i2_mvx << 2;
2018 ps_me_ctxt->as_mv_init_search[PRED_BI][0].i2_mvy = ps_me_ctxt->as_mv_init_search[PRED_L0][i4_l0_skip_mv_idx].i2_mvy << 2;
2019 ps_me_ctxt->as_mv_init_search[PRED_BI][1].i2_mvx = ps_me_ctxt->as_mv_init_search[PRED_L1][i4_l1_skip_mv_idx].i2_mvx << 2;
2020 ps_me_ctxt->as_mv_init_search[PRED_BI][1].i2_mvy = ps_me_ctxt->as_mv_init_search[PRED_L1][i4_l1_skip_mv_idx].i2_mvy << 2;
2025 ps_me_ctxt->as_mv_init_search[PRED_BI][2].i2_mvx = ps_me_ctxt->as_mv_init_search[PRED_L0][i4_l0_skip_mv_idx].i2_mvx << 2;
2026 ps_me_ctxt->as_mv_init_search[PRED_BI][2].i2_mvy = ps_me_ctxt->as_mv_init_search[PRED_L0][i4_l0_skip_mv_idx].i2_mvy << 2;
2027 ps_me_ctxt->as_mv_init_search[PRED_BI][3].i2_mvx = ps_me_ctxt->as_mv_init_search[PRED_L1][i4_l1_skip_mv_idx].i2_mvx << 2;
2028 ps_me_ctxt->as_mv_init_search[PRED_BI][3].i2_mvy = ps_me_ctxt->as_mv_init_search[PRED_L1][i4_l1_skip_mv_idx].i2_mvy << 2;
2031 ps_me_ctxt->as_mv_init_search[PRED_BI][4] = ps_me_ctxt->as_mb_part[PRED_L0].s_mv_curr;
2032 ps_me_ctxt->as_mv_init_search[PRED_BI][5] = ps_me_ctxt->as_mb_part[PRED_L1].s_mv_curr;
2034 ps_me_ctxt->u4_num_candidates[PRED_BI] = 6;
2036 ps_me_ctxt->as_mb_part[PRED_BI].i4_mb_cost = INT_MAX;
2037 ps_me_ctxt->as_mb_part[PRED_BI].i4_mb_distortion = INT_MAX;
2039 ih264e_evaluate_bipred(ps_me_ctxt, ps_proc,
2040 &ps_me_ctxt->as_mb_part[PRED_BI]);
2052 if (ps_me_ctxt->as_mb_part[i4_reflist].i4_mb_cost < ps_proc->ps_cur_mb->i4_mb_cost)
2054 ps_proc->ps_cur_mb->i4_mb_cost = ps_me_ctxt->as_mb_part[i4_reflist].i4_mb_cost;
2055 ps_proc->ps_cur_mb->i4_mb_distortion = ps_me_ctxt->as_mb_part[i4_reflist].i4_mb_distortion;
2071 WORD32 i4_srch_pos = ps_me_ctxt->as_mb_part[PRED_BI].i4_srch_pos_idx;
2072 UWORD8 *pu1_bi_buf = ps_me_ctxt->as_mb_part[PRED_BI].pu1_best_hpel_buf;
2074 ps_me_ctxt->as_mb_part[PRED_L0].s_mv_curr = ps_me_ctxt->as_mv_init_search[PRED_BI][i4_srch_pos << 1];
2075 ps_me_ctxt->as_mb_part[PRED_L1].s_mv_curr = ps_me_ctxt->as_mv_init_search[PRED_BI][(i4_srch_pos << 1) + 1];
2080 ps_me_ctxt->u4_subpel_buf_strd,
2085 else if (ps_me_ctxt->as_mb_part[ps_proc->ps_pu->b2_pred_mode].pu1_best_hpel_buf)
2089 ps_me_ctxt->as_mb_part[ps_proc->ps_pu->b2_pred_mode].pu1_best_hpel_buf,
2091 ps_me_ctxt->u4_subpel_buf_strd,
2100 ps_proc->ps_pu->s_me_info[PRED_L0].s_mv.i2_mvx = (ps_me_ctxt->as_mb_part[PRED_L0].s_mv_curr.i2_mvx);
2101 ps_proc->ps_pu->s_me_info[PRED_L0].s_mv.i2_mvy = (ps_me_ctxt->as_mb_part[PRED_L0].s_mv_curr.i2_mvy);
2102 ps_proc->ps_pu->s_me_info[PRED_L1].s_mv.i2_mvx = (ps_me_ctxt->as_mb_part[PRED_L1].s_mv_curr.i2_mvx);
2103 ps_proc->ps_pu->s_me_info[PRED_L1].s_mv.i2_mvy = (ps_me_ctxt->as_mb_part[PRED_L1].s_mv_curr.i2_mvy);
2122 if (ps_me_ctxt->u4_min_sad_reached == 1)
2125 ps_proc->ps_cur_mb->u4_min_sad = ps_me_ctxt->i4_min_sad;