Lines Matching refs:ps_ctxt
333 void ihevce_compute_quant_rel_param(ihevce_enc_loop_ctxt_t *ps_ctxt, WORD8 i1_cu_qp)
337 ps_ctxt->i4_chrm_cu_qp =
338 (ps_ctxt->u1_chroma_array_type == 2)
339 ? MIN(i1_cu_qp + ps_ctxt->i4_chroma_qp_offset, 51)
340 : gai1_ihevc_chroma_qp_scale[i1_cu_qp + ps_ctxt->i4_chroma_qp_offset + MAX_QP_BD_OFFSET];
341 ps_ctxt->i4_cu_qp_div6 = (i1_cu_qp + (6 * (ps_ctxt->u1_bit_depth - 8))) / 6;
344 ps_ctxt->i4_cu_qp_mod6 = (i1_cu_qp + (6 * (ps_ctxt->u1_bit_depth - 8))) % 6;
345 ps_ctxt->i4_chrm_cu_qp_div6 = (ps_ctxt->i4_chrm_cu_qp + (6 * (ps_ctxt->u1_bit_depth - 8))) / 6;
346 ps_ctxt->i4_chrm_cu_qp_mod6 = (ps_ctxt->i4_chrm_cu_qp + (6 * (ps_ctxt->u1_bit_depth - 8))) % 6;
352 ps_ctxt->i4_quant_rnd_factor[PRED_MODE_INTER] =
357 ps_ctxt->i4_quant_rnd_factor[PRED_MODE_INTER] = (1 << QUANT_ROUND_FACTOR_Q) / 3;
360 if(ISLICE == ps_ctxt->i1_slice_type)
363 ps_ctxt->i4_quant_rnd_factor[PRED_MODE_INTRA] =
371 ps_ctxt->i4_quant_rnd_factor[PRED_MODE_INTRA] =
377 ps_ctxt->i4_quant_rnd_factor[PRED_MODE_INTRA] =
378 ps_ctxt->i4_quant_rnd_factor[PRED_MODE_INTER];
406 ihevce_enc_loop_ctxt_t *ps_ctxt,
418 WORD32 i4_qp_bdoffset = 6 * (ps_ctxt->u1_bit_depth - 8);
421 ps_ctxt->i4_lamda_modifier = ps_frm_lamda->lambda_modifier;
422 ps_ctxt->i4_uv_lamda_modifier = ps_frm_lamda->lambda_uv_modifier;
423 ps_ctxt->i4_temporal_layer_id = i4_temporal_lyr_id;
425 for(i4_curr_cu_qp = ps_ctxt->ps_rc_quant_ctxt->i2_min_qp;
426 i4_curr_cu_qp <= ps_ctxt->ps_rc_quant_ctxt->i2_max_qp;
429 WORD32 chroma_qp = (ps_ctxt->i4_chroma_format == IV_YUV_422SP_UV)
433 i4_curr_cu_qp_offset = i4_curr_cu_qp + ps_ctxt->ps_rc_quant_ctxt->i1_qp_offset;
450 if(ps_ctxt->i4_use_const_lamda_modifier)
452 if(ISLICE == ps_ctxt->i1_slice_type)
454 lambda_modifier = ps_ctxt->f_i_pic_lamda_modifier;
455 lambda_uv_modifier = ps_ctxt->f_i_pic_lamda_modifier;
475 ps_ctxt->au4_chroma_cost_weighing_factor_array[i4_curr_cu_qp_offset] =
478 ps_ctxt->i8_cl_ssd_lambda_qf_array[i4_curr_cu_qp_offset] =
481 ps_ctxt->i8_cl_ssd_lambda_chroma_qf_array[i4_curr_cu_qp_offset] =
483 if(ps_ctxt->i4_use_const_lamda_modifier)
485 ps_ctxt->i4_satd_lamda_array[i4_curr_cu_qp_offset] =
490 ps_ctxt->i4_satd_lamda_array[i4_curr_cu_qp_offset] =
494 ps_ctxt->i4_sad_lamda_array[i4_curr_cu_qp_offset] =
497 ps_ctxt->i8_cl_ssd_type2_lambda_qf_array[i4_curr_cu_qp_offset] =
498 ps_ctxt->i8_cl_ssd_lambda_qf_array[i4_curr_cu_qp_offset];
500 ps_ctxt->i8_cl_ssd_type2_lambda_chroma_qf_array[i4_curr_cu_qp_offset] =
501 ps_ctxt->i8_cl_ssd_lambda_chroma_qf_array[i4_curr_cu_qp_offset];
503 ps_ctxt->i4_satd_type2_lamda_array[i4_curr_cu_qp_offset] =
504 ps_ctxt->i4_satd_lamda_array[i4_curr_cu_qp_offset];
506 ps_ctxt->i4_sad_type2_lamda_array[i4_curr_cu_qp_offset] =
507 ps_ctxt->i4_sad_lamda_array[i4_curr_cu_qp_offset];
519 ps_ctxt->au4_chroma_cost_weighing_factor_array[i4_curr_cu_qp_offset] =
522 ps_ctxt->i8_cl_ssd_lambda_qf_array[i4_curr_cu_qp_offset] =
525 ps_ctxt->i8_cl_ssd_lambda_chroma_qf_array[i4_curr_cu_qp_offset] =
527 if(ps_ctxt->i4_use_const_lamda_modifier)
529 ps_ctxt->i4_satd_lamda_array[i4_curr_cu_qp_offset] =
534 ps_ctxt->i4_satd_lamda_array[i4_curr_cu_qp_offset] =
537 ps_ctxt->i4_sad_lamda_array[i4_curr_cu_qp_offset] =
540 ps_ctxt->i8_cl_ssd_type2_lambda_qf_array[i4_curr_cu_qp_offset] =
541 ps_ctxt->i8_cl_ssd_lambda_qf_array[i4_curr_cu_qp_offset];
543 ps_ctxt->i8_cl_ssd_type2_lambda_chroma_qf_array[i4_curr_cu_qp_offset] =
544 ps_ctxt->i8_cl_ssd_lambda_chroma_qf_array[i4_curr_cu_qp_offset];
546 ps_ctxt->i4_satd_type2_lamda_array[i4_curr_cu_qp_offset] =
547 ps_ctxt->i4_satd_lamda_array[i4_curr_cu_qp_offset];
549 ps_ctxt->i4_sad_type2_lamda_array[i4_curr_cu_qp_offset] =
550 ps_ctxt->i4_sad_lamda_array[i4_curr_cu_qp_offset];
562 ps_ctxt->au4_chroma_cost_weighing_factor_array[i4_curr_cu_qp_offset] =
565 ps_ctxt->i8_cl_ssd_lambda_qf_array[i4_curr_cu_qp_offset] =
568 ps_ctxt->i8_cl_ssd_lambda_chroma_qf_array[i4_curr_cu_qp_offset] =
571 if(ps_ctxt->i4_use_const_lamda_modifier)
573 ps_ctxt->i4_satd_lamda_array[i4_curr_cu_qp_offset] =
578 ps_ctxt->i4_satd_lamda_array[i4_curr_cu_qp_offset] =
581 ps_ctxt->i4_sad_lamda_array[i4_curr_cu_qp_offset] =
591 ps_ctxt->au4_chroma_cost_weighing_factor_array[i4_curr_cu_qp_offset] =
594 ps_ctxt->i8_cl_ssd_type2_lambda_qf_array[i4_curr_cu_qp_offset] =
597 ps_ctxt->i8_cl_ssd_type2_lambda_chroma_qf_array[i4_curr_cu_qp_offset] =
599 if(ps_ctxt->i4_use_const_lamda_modifier)
601 ps_ctxt->i4_satd_type2_lamda_array[i4_curr_cu_qp_offset] =
606 ps_ctxt->i4_satd_type2_lamda_array[i4_curr_cu_qp_offset] =
610 ps_ctxt->i4_sad_type2_lamda_array[i4_curr_cu_qp_offset] =
645 void ihevce_get_cl_cu_lambda_prms(ihevce_enc_loop_ctxt_t *ps_ctxt, WORD32 i4_cur_cu_qp)
647 WORD32 chroma_qp = (ps_ctxt->u1_chroma_array_type == 2)
648 ? MIN(i4_cur_cu_qp + ps_ctxt->i4_chroma_qp_offset, 51)
650 [i4_cur_cu_qp + ps_ctxt->i4_chroma_qp_offset + MAX_QP_BD_OFFSET];
653 ps_ctxt->i8_cl_ssd_lambda_qf =
654 ps_ctxt->i8_cl_ssd_lambda_qf_array[i4_cur_cu_qp + ps_ctxt->ps_rc_quant_ctxt->i1_qp_offset];
655 ps_ctxt->i8_cl_ssd_lambda_chroma_qf =
656 ps_ctxt
657 ->i8_cl_ssd_lambda_chroma_qf_array[chroma_qp + ps_ctxt->ps_rc_quant_ctxt->i1_qp_offset];
658 ps_ctxt->u4_chroma_cost_weighing_factor =
659 ps_ctxt->au4_chroma_cost_weighing_factor_array
660 [chroma_qp + ps_ctxt->ps_rc_quant_ctxt->i1_qp_offset];
664 ps_ctxt->i4_satd_lamda =
665 ps_ctxt->i4_satd_lamda_array[i4_cur_cu_qp + ps_ctxt->ps_rc_quant_ctxt->i1_qp_offset];
666 ps_ctxt->i4_sad_lamda =
667 ps_ctxt->i4_sad_type2_lamda_array[i4_cur_cu_qp + ps_ctxt->ps_rc_quant_ctxt->i1_qp_offset];
687 void ihevce_update_pred_qp(ihevce_enc_loop_ctxt_t *ps_ctxt, WORD32 cu_pos_x, WORD32 cu_pos_y)
693 i4_pred_qp = ps_ctxt->i4_prev_QP;
699 i4_top = ps_ctxt->i4_prev_QP;
703 i4_top = ps_ctxt->ai4_qp_qg[(cu_pos_y - 1) * 8 + (cu_pos_x)];
707 i4_left = ps_ctxt->i4_prev_QP;
711 i4_left = ps_ctxt->ai4_qp_qg[(cu_pos_y)*8 + (cu_pos_x - 1)];
715 ps_ctxt->i4_pred_qp = i4_pred_qp;
736 ihevce_enc_loop_ctxt_t *ps_ctxt,
742 WORD32 i4_input_QP = ps_ctxt->i4_frame_mod_qp;
743 WORD32 cu_qp = i4_input_QP + ps_ctxt->ps_rc_quant_ctxt->i1_qp_offset;
749 i4_pred_qp = ps_ctxt->i4_pred_qp;
751 if(ps_ctxt->i4_sub_pic_level_rc)
753 i4_max_qp_allowed = (i4_pred_qp + (25 + (ps_ctxt->ps_rc_quant_ctxt->i1_qp_offset / 2)));
754 i4_min_qp_allowed = (i4_pred_qp - (26 + (ps_ctxt->ps_rc_quant_ctxt->i1_qp_offset / 2)));
758 i4_max_qp_allowed = (i4_input_QP + (7 + (ps_ctxt->ps_rc_quant_ctxt->i1_qp_offset / 4)));
759 i4_min_qp_allowed = (i4_input_QP - (18 + (ps_ctxt->ps_rc_quant_ctxt->i1_qp_offset / 4)));
761 if((ps_ctxt->i1_slice_type == BSLICE) && (ps_ctxt->i4_quality_preset == IHEVCE_QUALITY_P6))
770 cu_qp = (ps_ctxt->ps_rc_quant_ctxt
771 ->pi4_qp_to_qscale[i4_input_QP + ps_ctxt->ps_rc_quant_ctxt->i1_qp_offset]);
772 if(ps_ctxt->i4_qp_mod)
781 if(cu_qp > ps_ctxt->ps_rc_quant_ctxt->i2_max_qscale)
782 cu_qp = ps_ctxt->ps_rc_quant_ctxt->i2_max_qscale;
783 else if(cu_qp < ps_ctxt->ps_rc_quant_ctxt->i2_min_qscale)
784 cu_qp = ps_ctxt->ps_rc_quant_ctxt->i2_min_qscale;
786 cu_qp = ps_ctxt->ps_rc_quant_ctxt->pi4_qscale_to_qp[cu_qp];
798 if(cu_qp > ps_ctxt->ps_rc_quant_ctxt->i2_max_qp)
799 cu_qp = ps_ctxt->ps_rc_quant_ctxt->i2_max_qp;
800 else if(cu_qp < ps_ctxt->ps_rc_quant_ctxt->i2_min_qp)
801 cu_qp = ps_ctxt->ps_rc_quant_ctxt->i2_min_qp;
804 ps_ctxt->i4_cu_qp = cu_qp;
806 ihevce_compute_quant_rel_param(ps_ctxt, cu_qp);
812 cu_qp = (ps_ctxt->ps_rc_quant_ctxt
813 ->pi4_qp_to_qscale[i4_input_QP + ps_ctxt->ps_rc_quant_ctxt->i1_qp_offset]);
815 if(ps_ctxt->i4_qp_mod)
824 if(cu_qp > ps_ctxt->ps_rc_quant_ctxt->i2_max_qscale)
825 cu_qp = ps_ctxt->ps_rc_quant_ctxt->i2_max_qscale;
826 else if(cu_qp < ps_ctxt->ps_rc_quant_ctxt->i2_min_qscale)
827 cu_qp = ps_ctxt->ps_rc_quant_ctxt->i2_min_qscale;
829 cu_qp = ps_ctxt->ps_rc_quant_ctxt->pi4_qscale_to_qp[cu_qp];
838 if(cu_qp > ps_ctxt->ps_rc_quant_ctxt->i2_max_qp)
839 cu_qp = ps_ctxt->ps_rc_quant_ctxt->i2_max_qp;
840 else if(cu_qp < ps_ctxt->ps_rc_quant_ctxt->i2_min_qp)
841 cu_qp = ps_ctxt->ps_rc_quant_ctxt->i2_min_qp;
844 ps_ctxt, MODULATE_LAMDA_WHEN_SPATIAL_MOD_ON ? cu_qp : ps_ctxt->i4_frame_qp);
1469 //WORD32 i4_scan_idx = ps_ctxt->i4_scan_idx;
1911 * \param[in] ps_ctxt enc_loop module ctxt pointer
1945 ihevce_enc_loop_ctxt_t *ps_ctxt,
1987 rdoq_sbh_ctxt_t *ps_rdoq_sbh_ctxt = &ps_ctxt->s_rdoq_sbh_ctxt;
1990 (ps_ctxt->i4_zcbf_rdo_level == ZCBF_ENABLE);
1991 WORD32 i4_perform_coeff_level_rdoq = (ps_ctxt->i4_quant_rounding_level != FIXED_QUANT_ROUNDING);
2006 ps_ctxt->s_cmn_opt_func.pf_ssd_and_sad_calculator(
2018 !ps_ctxt->u1_is_refPic ? ALPHA_FOR_ZERO_CODING_DECISIONS
2024 ps_ctxt->u1_enable_psyRDOPT,
2032 ps_ctxt->s_cmn_opt_func.pf_copy_2d(
2042 ps_ctxt->i8_cu_not_coded_cost += pi8_cost[0];
2055 pi4_trans_scratch = (WORD32 *)&ps_ctxt->ai2_scratch[0];
2056 pi2_quant_coeffs = &ps_ctxt->ai2_scratch[0];
2057 pi2_trans_values = &ps_ctxt->ai2_scratch[0] + (MAX_TRANS_SIZE * 2);
2068 MAX(ps_ctxt->i4_quant_rnd_factor[intra_flag], (1 << QUANT_ROUND_FACTOR_Q) / 3);
2073 MAX(ps_ctxt->pi4_quant_round_factor_tu_0_1[trans_size >> 3][i],
2076 MAX(ps_ctxt->pi4_quant_round_factor_tu_1_2[trans_size >> 3][i],
2133 *pu4_blk_sad = ps_ctxt->apf_resd_trns[trans_idx](
2142 cbf = ps_ctxt->apf_quant_iquant_ssd
2145 ps_ctxt->api2_rescal_mat[trans_idx + quant_scale_mat_offset],
2149 ps_ctxt->i4_cu_qp_div6,
2150 ps_ctxt->i4_cu_qp_mod6,
2152 ps_ctxt->i4_quant_rnd_factor[intra_flag],
2153 ps_ctxt->pi4_quant_round_factor_tu_0_1[trans_size >> 3],
2154 ps_ctxt->pi4_quant_round_factor_tu_1_2[trans_size >> 3],
2157 : ps_ctxt->i4_quant_rnd_factor[intra_flag],
2159 : ps_ctxt->pi4_quant_round_factor_tu_0_1[trans_size >> 3],
2161 : ps_ctxt->pi4_quant_round_factor_tu_1_2[trans_size >> 3],
2170 ps_ctxt->api2_scal_mat[trans_idx + quant_scale_mat_offset],
2187 ps_rdoq_sbh_ctxt->i4_qp_div = ps_ctxt->i4_cu_qp_div6;
2188 ps_rdoq_sbh_ctxt->i2_qp_rem = ps_ctxt->i4_cu_qp_mod6;
2189 ps_rdoq_sbh_ctxt->i4_scan_idx = ps_ctxt->i4_scan_idx;
2194 ps_ctxt->api2_scal_mat[trans_idx + quant_scale_mat_offset];
2209 *pi4_coeff_off = ps_ctxt->s_cmn_opt_func.pf_scan_coeffs(
2212 ps_ctxt->i4_scan_idx,
2235 ps_rdoq_sbh_ctxt->i8_cl_ssd_lambda_qf = ps_ctxt->i8_cl_ssd_lambda_qf;
2248 ps_ctxt->s_cmn_opt_func.pf_ssd_calculator(
2260 &ps_ctxt->s_rdopt_entropy_ctxt,
2288 pi2_quant_coeffs = &ps_ctxt->ai2_scratch[0];
2289 *pi4_coeff_off = ps_ctxt->s_cmn_opt_func.pf_scan_coeffs(
2292 ps_ctxt->i4_scan_idx,
2302 &ps_ctxt->s_rdopt_entropy_ctxt, pu1_ecd_data, trans_size, 1, i4_perform_sbh);
2310 ps_ctxt,
2342 ps_ctxt->u1_enable_psyRDOPT,
2356 ps_ctxt->u1_enable_psyRDOPT,
2363 tu_bits, ps_ctxt->i8_cl_ssd_lambda_qf, LAMBDA_Q_SHIFT);
2376 !ps_ctxt->u1_is_refPic ? ALPHA_FOR_ZERO_CODING_DECISIONS
2382 ps_ctxt->u1_enable_psyRDOPT,
2407 ps_ctxt->s_cmn_opt_func.pf_copy_2d(
2415 ps_ctxt->i8_cu_not_coded_cost += zero_cbf_cost;
2425 ps_ctxt,
2456 !ps_ctxt->u1_is_refPic ? ALPHA_FOR_ZERO_CODING_DECISIONS
2462 ps_ctxt->u1_enable_psyRDOPT,
2473 !ps_ctxt->u1_is_refPic ? ALPHA_FOR_ZERO_CODING_DECISIONS
2479 ps_ctxt->u1_enable_psyRDOPT,
2484 ps_ctxt->i8_cu_not_coded_cost += *pi8_cost;
2500 * \param[in] ps_ctxt enc_loop module ctxt pointer
2523 ihevce_enc_loop_ctxt_t *ps_ctxt,
2553 ps_ctxt->s_cmn_opt_func.pf_2d_square_copy(
2584 ps_ctxt->s_cmn_opt_func.pf_2d_square_copy(
2590 ps_ctxt->s_cmn_opt_func.pf_itrans_recon_dc(
2602 ps_ctxt->apf_it_recon[trans_idx](
2604 &ps_ctxt->ai2_scratch[0],
2622 * \param[in] ps_ctxt enc_loop module ctxt pointer
2644 ihevce_enc_loop_ctxt_t *ps_ctxt,
2680 ps_ctxt->s_cmn_opt_func.pf_chroma_interleave_2d_copy(
2686 ps_ctxt->s_cmn_opt_func.pf_itrans_recon_dc(
2698 ps_ctxt->apf_chrm_it_recon[trans_idx - 1](
2700 &ps_ctxt->ai2_scratch[0],
2721 * \param[in] ps_ctxt : ptr to enc loop context
2736 ihevce_enc_loop_ctxt_t *ps_ctxt,
2760 ps_ctxt->pu1_ctb_nbr_map,
2761 ps_ctxt->i4_nbr_map_strd,
2823 * \param[in] ps_ctxt enc_loop module ctxt pointer
2848 ihevce_enc_loop_ctxt_t *ps_ctxt,
2912 LWORD64 prev_best_rdopt_cost = ps_ctxt->as_cu_prms[!curr_buf_idx].i8_best_rdopt_cost;
2915 ps_ctxt->au1_rdopt_init_ctxt_models[IHEVC_CAB_INTRA_LUMA_PRED_FLAG];
2921 ps_final_prms = &ps_ctxt->as_cu_prms[curr_buf_idx];
2924 csbf_strd = ps_ctxt->i4_cu_csbf_strd;
2925 pu1_csbf_buf = &ps_ctxt->au1_cu_csbf[0];
2929 ps_nbr_4x4 = &ps_ctxt->as_cu_nbr[curr_buf_idx][0];
2939 ps_ctxt->i8_cu_not_coded_cost = 0;
2964 if(IHEVCE_QUALITY_P3 > ps_ctxt->i4_quality_preset)
2966 if(ps_ctxt->i1_slice_type != BSLICE)
2987 if(ps_ctxt->i1_cu_qp_delta_enable)
3020 if(ps_ctxt->i4_use_ctb_level_lamda)
3023 ps_ctxt, ps_cu_analyse->i4_act_factor[i4_act_counter][1], -1, 0);
3028 ps_ctxt,
3034 ps_cu_analyse->i1_cu_qp = ps_ctxt->i4_cu_qp;
3036 if(u1_is_cu_noisy && !ps_ctxt->u1_enable_psyRDOPT)
3038 ps_ctxt->i8_cl_ssd_lambda_qf =
3039 ((float)ps_ctxt->i8_cl_ssd_lambda_qf * (100.0f - RDOPT_LAMBDA_DISCOUNT_WHEN_NOISY) /
3041 ps_ctxt->i8_cl_ssd_lambda_chroma_qf =
3042 ((float)ps_ctxt->i8_cl_ssd_lambda_chroma_qf *
3046 u1_compute_spatial_ssd = (ps_ctxt->i4_cu_qp <= MAX_QP_WHERE_SPATIAL_SSD_ENABLED) &&
3047 (ps_ctxt->i4_quality_preset < IHEVCE_QUALITY_P3) &&
3050 if(u1_is_cu_noisy || ps_ctxt->u1_enable_psyRDOPT)
3052 u1_compute_spatial_ssd = (ps_ctxt->i4_cu_qp <= MAX_HEVC_QP) &&
3089 ps_nbr_4x4->b8_qp = ps_ctxt->i4_cu_qp;
3101 &ps_ctxt->s_rdopt_entropy_ctxt.as_cu_entropy_ctxt[curr_buf_idx]
3103 &ps_ctxt->au1_rdopt_init_ctxt_models[0],
3109 &ps_ctxt->au1_rdopt_init_ctxt_models[0],
3113 &ps_ctxt->au1_rdopt_init_ctxt_models[0],
3154 ps_ctxt->pu1_ctb_nbr_map,
3155 ps_ctxt->i4_nbr_map_strd,
3170 ps_ctxt->pu1_ctb_nbr_map,
3171 ps_ctxt->i4_nbr_map_strd,
3190 ps_ctxt->ps_func_selector->ihevc_intra_pred_luma_ref_substitution_fptr;
3200 (UWORD8 *)ps_ctxt->pv_ref_sub_out,
3204 if((ps_ctxt->i1_slice_type != ISLICE) && (TU_EQ_SUBCU == func_proc_mode) &&
3205 (ps_ctxt->i4_quality_preset >= IHEVCE_QUALITY_P3))
3208 ps_ctxt,
3216 if((TU_EQ_SUBCU == func_proc_mode) && (ps_ctxt->i4_quality_preset < IHEVCE_QUALITY_P3) &&
3309 if(ps_ctxt->i4_quality_preset >= IHEVCE_QUALITY_P3)
3319 ps_ctxt->ps_func_selector->ihevc_intra_pred_ref_filtering_fptr(
3320 (UWORD8 *)ps_ctxt->pv_ref_sub_out,
3322 (UWORD8 *)ps_ctxt->pv_ref_filt_out,
3324 ps_ctxt->i1_strong_intra_smoothing_enable_flag);
3330 ps_ctxt->apf_lum_ip[luma_pred_func_idx](
3331 (UWORD8 *)ps_ctxt->pv_ref_filt_out,
3339 ps_ctxt->i4_scan_idx = SCAN_DIAG_UPRIGHT;
3347 ps_ctxt->i4_scan_idx = SCAN_HORZ;
3352 ps_ctxt->i4_scan_idx = SCAN_VERT;
3358 &ps_ctxt->s_rdopt_entropy_ctxt.as_cu_entropy_ctxt[curr_buf_idx]
3361 &ps_ctxt->au1_rdopt_init_ctxt_models[0] + IHEVC_CAB_COEFFX_PREFIX,
3364 i4_perform_rdoq = ps_ctxt->s_rdoq_sbh_ctxt.i4_perform_all_cand_rdoq;
3365 i4_perform_sbh = ps_ctxt->s_rdoq_sbh_ctxt.i4_perform_all_cand_sbh;
3380 if((ps_ctxt->i4_quant_rounding_level != FIXED_QUANT_ROUNDING))
3382 if((ps_ctxt->i4_quant_rounding_level == TU_LEVEL_QUANT_ROUNDING) && (ctr != 0))
3386 if((BSLICE == ps_ctxt->i1_slice_type) && (ps_ctxt->i4_temporal_layer_id))
3389 ps_ctxt->i4_lamda_modifier *
3390 CLIP3((((double)(ps_ctxt->i4_cu_qp - 12)) / 6.0), 2.00, 4.00);
3394 i4_lamda_modifier = ps_ctxt->i4_lamda_modifier;
3396 if(ps_ctxt->i4_use_const_lamda_modifier)
3398 if(ISLICE == ps_ctxt->i1_slice_type)
3400 i4_lamda_modifier = ps_ctxt->f_i_pic_lamda_modifier;
3408 ps_ctxt->pi4_quant_round_factor_tu_0_1[trans_size >> 3] =
3409 &ps_ctxt->i4_quant_round_tu[0][0];
3410 ps_ctxt->pi4_quant_round_factor_tu_1_2[trans_size >> 3] =
3411 &ps_ctxt->i4_quant_round_tu[1][0];
3414 ps_ctxt->pi4_quant_round_factor_tu_0_1[trans_size >> 3],
3418 ps_ctxt->pi4_quant_round_factor_tu_1_2[trans_size >> 3],
3425 &ps_ctxt->s_rdopt_entropy_ctxt,
3426 ps_ctxt->pi4_quant_round_factor_tu_0_1[trans_size >> 3],
3427 ps_ctxt->pi4_quant_round_factor_tu_1_2[trans_size >> 3],
3433 ps_ctxt->pi4_quant_round_factor_tu_0_1[trans_size >> 3] =
3434 ps_ctxt->pi4_quant_round_factor_cu_ctb_0_1[trans_size >> 3];
3435 ps_ctxt->pi4_quant_round_factor_tu_1_2[trans_size >> 3] =
3436 ps_ctxt->pi4_quant_round_factor_cu_ctb_1_2[trans_size >> 3];
3442 ps_ctxt,
3486 ps_ctxt->u1_enable_psyRDOPT,
3500 ps_ctxt->u1_enable_psyRDOPT,
3514 ps_ctxt->u1_enable_psyRDOPT,
3533 &ps_ctxt->au1_rdopt_init_ctxt_models[0] + IHEVC_CAB_COEFFX_PREFIX,
3542 &ps_ctxt->s_rdopt_entropy_ctxt.as_cu_entropy_ctxt[curr_buf_idx]
3600 COMPUTE_RATE_COST_CLIP30(bits, ps_ctxt->i8_cl_ssd_lambda_qf, LAMBDA_Q_SHIFT);
3620 ps_ctxt->s_cmn_opt_func.pf_copy_2d(
3630 ps_ctxt->s_cmn_opt_func.pf_copy_2d(
3653 ps_ctxt,
3680 &ps_ctxt->au1_rdopt_init_ctxt_models[0] + IHEVC_CAB_COEFFX_PREFIX,
3712 ((ps_ctxt->u1_chroma_array_type == 2)
3719 ((ps_ctxt->u1_chroma_array_type == 2)
3755 ps_final_prms->as_tu_enc_loop[ctr].s_tu.b7_qp = ps_ctxt->i4_cu_qp;
3807 ps_ctxt->pu1_ctb_nbr_map,
3808 ps_ctxt->i4_nbr_map_strd,
3850 ps_ctxt->s_cmn_opt_func.pf_copy_2d(
3919 ai4_tu_bits[best_intra_buf_idx], ps_ctxt->i8_cl_ssd_lambda_qf, LAMBDA_Q_SHIFT);
3925 if(ps_ctxt->i4_bitrate_instance_num || ps_ctxt->i4_num_bitrates == 1)
3942 if(ps_ctxt->u1_enable_psyRDOPT)
3972 ps_ctxt->ai4_source_satd_8x8,
3979 ps_ctxt->i4_satd_lamda, // lambda
3981 ps_ctxt->u1_is_input_data_hbd,
3982 ps_ctxt->u4_psy_strength,
3983 &ps_ctxt->s_cmn_opt_func
4021 if(1 == ps_ctxt->s_chroma_rdopt_ctxt.u1_eval_chrm_rdopt)
4027 ps_ctxt->as_cu_prms[curr_buf_idx].i8_curr_rdopt_cost = total_rdopt_cost;
4030 ps_ctxt,
4047 (chrm_rdopt_cost * ps_ctxt->u4_chroma_cost_weighing_factor +
4061 if(ps_ctxt->i4_bitrate_instance_num || ps_ctxt->i4_num_bitrates == 1)
4076 &ps_ctxt->s_rdopt_entropy_ctxt.as_cu_entropy_ctxt[curr_buf_idx]
4079 &ps_ctxt->au1_rdopt_init_ctxt_models[0] + IHEVC_CAB_COEFFX_PREFIX,
4085 ps_ctxt->pu1_ctb_nbr_map,
4086 ps_ctxt->i4_nbr_map_strd,
4099 &ps_ctxt->s_rdopt_entropy_ctxt,
4119 COMPUTE_RATE_COST_CLIP30(header_bits, ps_ctxt
4131 * \param[in] ps_ctxt enc_loop module ctxt pointer
4150 ihevce_enc_loop_ctxt_t *ps_ctxt,
4200 LWORD64 prev_best_rdopt_cost = ps_ctxt->as_cu_prms[!curr_buf_idx].i8_best_rdopt_cost;
4204 UWORD8 u1_qtroot_cbf_cabac_model = ps_ctxt->au1_rdopt_init_ctxt_models[IHEVC_CAB_NORES_IDX];
4216 ps_final_prms = &ps_ctxt->as_cu_prms[curr_buf_idx];
4217 ps_nbr_4x4 = &ps_ctxt->as_cu_nbr[curr_buf_idx][0];
4220 csbf_strd = ps_ctxt->i4_cu_csbf_strd;
4221 pu1_csbf_buf = &ps_ctxt->au1_cu_csbf[0];
4244 ps_ctxt->i4_scan_idx = SCAN_DIAG_UPRIGHT;
4248 ps_ctxt->i8_cu_not_coded_cost = 0;
4251 memcpy(au1_rdopt_init_ctxt_models, &ps_ctxt->au1_rdopt_init_ctxt_models[0], IHEVC_CAB_CTXT_END);
4372 if(ps_ctxt->i1_cu_qp_delta_enable)
4411 if(ps_ctxt->i4_use_ctb_level_lamda)
4414 ps_ctxt, ps_cu_analyse->i4_act_factor[i4_act_counter][0], -1, 0);
4419 ps_ctxt,
4425 ps_cu_analyse->i1_cu_qp = ps_ctxt->i4_cu_qp;
4427 if(u1_is_cu_noisy && !ps_ctxt->u1_enable_psyRDOPT)
4429 ps_ctxt->i8_cl_ssd_lambda_qf =
4430 ((float)ps_ctxt->i8_cl_ssd_lambda_qf * (100.0f - RDOPT_LAMBDA_DISCOUNT_WHEN_NOISY) /
4432 ps_ctxt->i8_cl_ssd_lambda_chroma_qf =
4433 ((float)ps_ctxt->i8_cl_ssd_lambda_chroma_qf *
4437 u1_compute_spatial_ssd = (ps_ctxt->i4_cu_qp <= MAX_QP_WHERE_SPATIAL_SSD_ENABLED) &&
4438 (ps_ctxt->i4_quality_preset < IHEVCE_QUALITY_P3) &&
4441 if(u1_is_cu_noisy || ps_ctxt->u1_enable_psyRDOPT)
4443 u1_compute_spatial_ssd = (ps_ctxt->i4_cu_qp <= MAX_HEVC_QP) &&
4463 &ps_ctxt->s_rdopt_entropy_ctxt.as_cu_entropy_ctxt[curr_buf_idx]
4465 &ps_ctxt->au1_rdopt_init_ctxt_models[0],
4518 &ps_ctxt->s_rdopt_entropy_ctxt.as_cu_entropy_ctxt[curr_buf_idx]
4521 &ps_ctxt->au1_rdopt_init_ctxt_models[0] + IHEVC_CAB_COEFFX_PREFIX,
4524 i4_perform_rdoq = ps_ctxt->s_rdoq_sbh_ctxt.i4_perform_all_cand_rdoq;
4525 i4_perform_sbh = ps_ctxt->s_rdoq_sbh_ctxt.i4_perform_all_cand_sbh;
4536 if((ps_ctxt->i4_quant_rounding_level == TU_LEVEL_QUANT_ROUNDING) && (ctr != 0))
4540 if((BSLICE == ps_ctxt->i1_slice_type) && (ps_ctxt->i4_temporal_layer_id))
4542 i4_lamda_modifier = ps_ctxt->i4_lamda_modifier *
4543 CLIP3((((double)(ps_ctxt->i4_cu_qp - 12)) / 6.0), 2.00, 4.00);
4547 i4_lamda_modifier = ps_ctxt->i4_lamda_modifier;
4549 if(ps_ctxt->i4_use_const_lamda_modifier)
4551 if(ISLICE == ps_ctxt->i1_slice_type)
4553 i4_lamda_modifier = ps_ctxt->f_i_pic_lamda_modifier;
4560 ps_ctxt->pi4_quant_round_factor_tu_0_1[trans_size >> 3] =
4561 &ps_ctxt->i4_quant_round_tu[0][0];
4562 ps_ctxt->pi4_quant_round_factor_tu_1_2[trans_size >> 3] =
4563 &ps_ctxt->i4_quant_round_tu[1][0];
4566 ps_ctxt->pi4_quant_round_factor_tu_0_1[trans_size >> 3],
4570 ps_ctxt->pi4_quant_round_factor_tu_1_2[trans_size >> 3],
4577 &ps_ctxt->s_rdopt_entropy_ctxt,
4578 ps_ctxt->pi4_quant_round_factor_tu_0_1[trans_size >> 3],
4579 ps_ctxt->pi4_quant_round_factor_tu_1_2[trans_size >> 3],
4585 ps_ctxt->pi4_quant_round_factor_tu_0_1[trans_size >> 3] =
4586 ps_ctxt->pi4_quant_round_factor_cu_ctb_0_1[trans_size >> 3];
4587 ps_ctxt->pi4_quant_round_factor_tu_1_2[trans_size >> 3] =
4588 ps_ctxt->pi4_quant_round_factor_cu_ctb_1_2[trans_size >> 3];
4593 ps_ctxt,
4621 ps_ctxt->u1_use_early_cbf_data ? ps_tu_prms->i4_early_cbf : 1);
4636 ps_ctxt->u1_enable_psyRDOPT,
4663 ps_ctxt->u1_enable_psyRDOPT,
4710 &ps_ctxt->au1_rdopt_init_ctxt_models[0] + IHEVC_CAB_COEFFX_PREFIX,
4711 &ps_ctxt->s_rdopt_entropy_ctxt.as_cu_entropy_ctxt[curr_buf_idx]
4743 ps_final_prms->as_tu_enc_loop[ctr].s_tu.b7_qp = ps_ctxt->i4_cu_qp;
4754 ps_cur_nbr_4x4->b8_qp = ps_ctxt->i4_cu_qp;
4766 ps_tmp_4x4[j].b8_qp = ps_ctxt->i4_cu_qp;
4777 COMPUTE_RATE_COST_CLIP30(tu_bits, ps_ctxt->i8_cl_ssd_lambda_qf, LAMBDA_Q_SHIFT);
4784 if(ps_ctxt->i4_bitrate_instance_num || ps_ctxt->i4_num_bitrates == 1)
4797 if(ps_ctxt->u1_enable_psyRDOPT)
4824 ps_ctxt->ai4_source_satd_8x8,
4831 ps_ctxt->i4_satd_lamda, // lambda
4833 ps_ctxt->u1_is_input_data_hbd,
4834 ps_ctxt->u4_psy_strength,
4835 &ps_ctxt->s_cmn_opt_func); // 8 bit
4854 if(1 == ps_ctxt->s_chroma_rdopt_ctxt.u1_eval_chrm_rdopt)
4860 ps_ctxt->as_cu_prms[curr_buf_idx].i8_curr_rdopt_cost = total_rdopt_cost;
4863 ps_ctxt,
4880 (chrm_rdopt_cost * ps_ctxt->u4_chroma_cost_weighing_factor +
4898 if(ps_ctxt->i4_bitrate_instance_num || ps_ctxt->i4_num_bitrates == 1)
4920 (ps_ctxt->u1_chroma_array_type == 2));
4926 &ps_ctxt->s_rdopt_entropy_ctxt.as_cu_entropy_ctxt[curr_buf_idx]
4929 &ps_ctxt->au1_rdopt_init_ctxt_models[0] + IHEVC_CAB_COEFFX_PREFIX,
4941 ps_ctxt->pu1_ctb_nbr_map,
4942 ps_ctxt->i4_nbr_map_strd,
4950 &ps_ctxt->s_rdopt_entropy_ctxt,
4955 ps_ctxt->u1_disable_intra_eval ? !DISABLE_TOP_SYNC && s_nbr.u1_top_avail
4971 COMPUTE_RATE_COST_CLIP30(header_bits, ps_ctxt->i8_cl_ssd_lambda_qf, LAMBDA_Q_SHIFT);
4975 if(ps_final_prms->u1_is_cu_coded && (ZCBF_ENABLE == ps_ctxt->i4_zcbf_rdo_level))
4977 LWORD64 i8_cu_not_coded_cost = ps_ctxt->i8_cu_not_coded_cost;
4983 &ps_ctxt->s_rdopt_entropy_ctxt.as_cu_entropy_ctxt[curr_buf_idx].s_cabac_ctxt;
4999 ps_ctxt->i8_cl_ssd_lambda_qf,
5002 if(ps_ctxt->u1_enable_psyRDOPT)
5099 ihevce_enc_loop_ctxt_t *ps_ctxt,
5142 LWORD64 prev_best_rdopt_cost = ps_ctxt->as_cu_prms[!curr_buf_idx].i8_best_rdopt_cost;
5145 UWORD8 u1_qtroot_cbf_cabac_model = ps_ctxt->au1_rdopt_init_ctxt_models[IHEVC_CAB_NORES_IDX];
5151 ps_final_prms = &ps_ctxt->as_cu_prms[curr_buf_idx];
5152 ps_nbr_4x4 = &ps_ctxt->as_cu_nbr[curr_buf_idx][0];
5155 csbf_strd = ps_ctxt->i4_cu_csbf_strd;
5156 pu1_csbf_buf = &ps_ctxt->au1_cu_csbf[0];
5175 ps_ctxt->i4_scan_idx = SCAN_DIAG_UPRIGHT;
5179 ps_ctxt->i8_cu_not_coded_cost = 0;
5182 memcpy(au1_rdopt_init_ctxt_models, &ps_ctxt->au1_rdopt_init_ctxt_models[0], IHEVC_CAB_CTXT_END);
5244 if(ps_ctxt->i1_cu_qp_delta_enable)
5282 if(ps_ctxt->i4_use_ctb_level_lamda)
5285 ps_ctxt, ps_cu_analyse->i4_act_factor[i4_act_counter][0], -1, 0);
5290 ps_ctxt,
5296 ps_cu_analyse->i1_cu_qp = ps_ctxt->i4_cu_qp;
5299 if(u1_is_cu_noisy && !ps_ctxt->u1_enable_psyRDOPT)
5301 ps_ctxt->i8_cl_ssd_lambda_qf =
5302 ((float)ps_ctxt->i8_cl_ssd_lambda_qf * (100.0f - RDOPT_LAMBDA_DISCOUNT_WHEN_NOISY) /
5304 ps_ctxt->i8_cl_ssd_lambda_chroma_qf =
5305 ((float)ps_ctxt->i8_cl_ssd_lambda_chroma_qf *
5309 u1_compute_spatial_ssd = (ps_ctxt->i4_cu_qp <= MAX_QP_WHERE_SPATIAL_SSD_ENABLED) &&
5310 (ps_ctxt->i4_quality_preset < IHEVCE_QUALITY_P3) &&
5313 if(u1_is_cu_noisy || ps_ctxt->u1_enable_psyRDOPT)
5315 u1_compute_spatial_ssd = (ps_ctxt->i4_cu_qp <= MAX_HEVC_QP) &&
5328 if(INCLUDE_CHROMA_DURING_TU_RECURSION && (ps_ctxt->i4_quality_preset <= IHEVCE_QUALITY_P0))
5336 &ps_ctxt->s_rdopt_entropy_ctxt.as_cu_entropy_ctxt[curr_buf_idx]
5338 &ps_ctxt->au1_rdopt_init_ctxt_models[0],
5345 ps_inter_cand->b1_skip_flag ? 0 : ps_ctxt->u1_max_inter_tr_depth,
5346 INCLUDE_CHROMA_DURING_TU_RECURSION && (ps_ctxt->i4_quality_preset <= IHEVCE_QUALITY_P0),
5347 ps_ctxt->u1_chroma_array_type == 2);
5349 if(!ps_inter_cand->b1_skip_flag && (ps_ctxt->i4_quality_preset >= IHEVCE_QUALITY_P3))
5356 MAX(MIN_TU_SIZE, (cu_size >> ps_ctxt->u1_max_inter_tr_depth)),
5364 ps_ctxt->i8_cu_not_coded_cost = 0;
5377 ps_ctxt->s_cu_me_intra_pred_prms.pu1_pred_data[CU_ME_INTRA_PRED_CHROMA_IDX] +
5378 curr_buf_idx * ((MAX_CTB_SIZE * MAX_CTB_SIZE >> 1) + ((ps_ctxt->u1_chroma_array_type == 2) *
5385 ps_ctxt->s_cu_me_intra_pred_prms.ai4_pred_data_stride[CU_ME_INTRA_PRED_CHROMA_IDX];
5397 if(INCLUDE_CHROMA_DURING_TU_RECURSION && (ps_ctxt->i4_quality_preset <= IHEVCE_QUALITY_P0))
5414 inter_pu_ht <<= (ps_ctxt->u1_chroma_array_type == 2);
5416 &ps_ctxt->s_mc_ctxt,
5431 if(inter_pu_ht == (cu_size >> !(ps_ctxt->u1_chroma_array_type == 2)))
5441 ps_ctxt,
5444 &ps_ctxt->s_rdopt_entropy_ctxt.as_cu_entropy_ctxt[curr_buf_idx]
5452 ps_ctxt->u1_max_inter_tr_depth,
5457 ps_ctxt,
5460 &ps_ctxt->s_rdopt_entropy_ctxt.as_cu_entropy_ctxt[curr_buf_idx]
5468 ps_ctxt->u1_max_inter_tr_depth,
5470 INCLUDE_CHROMA_DURING_TU_RECURSION && (ps_ctxt->i4_quality_preset <= IHEVCE_QUALITY_P0),
5481 ps_ctxt->i8_cu_not_coded_cost = 0;
5491 &ps_ctxt->i8_cu_not_coded_cost,
5496 ps_ctxt->i4_cu_qp,
5499 INCLUDE_CHROMA_DURING_TU_RECURSION && (ps_ctxt->i4_quality_preset <= IHEVCE_QUALITY_P0),
5500 (ps_ctxt->u1_chroma_array_type == 2),
5503 if(!(INCLUDE_CHROMA_DURING_TU_RECURSION && (ps_ctxt->i4_quality_preset <= IHEVCE_QUALITY_P0)))
5510 if(ps_ctxt->u1_enable_psyRDOPT)
5537 ps_ctxt->ai4_source_satd_8x8,
5544 ps_ctxt->i4_satd_lamda, // lambda
5546 ps_ctxt->u1_is_input_data_hbd,
5547 ps_ctxt->u4_psy_strength,
5548 &ps_ctxt->s_cmn_opt_func); // 8 bit
5561 if(ps_ctxt->s_chroma_rdopt_ctxt.u1_eval_chrm_rdopt &&
5562 !(INCLUDE_CHROMA_DURING_TU_RECURSION && (ps_ctxt->i4_quality_preset <= IHEVCE_QUALITY_P0)))
5568 ps_ctxt->as_cu_prms[curr_buf_idx].i8_curr_rdopt_cost = total_rdopt_cost;
5571 ps_ctxt,
5588 (chrm_rdopt_cost * ps_ctxt->u4_chroma_cost_weighing_factor +
5606 if(ps_ctxt->i4_bitrate_instance_num || ps_ctxt->i4_num_bitrates == 1)
5628 (ps_ctxt->u1_chroma_array_type == 2));
5634 &ps_ctxt->s_rdopt_entropy_ctxt.as_cu_entropy_ctxt[curr_buf_idx]
5637 &ps_ctxt->au1_rdopt_init_ctxt_models[0] + IHEVC_CAB_COEFFX_PREFIX,
5649 ps_ctxt->pu1_ctb_nbr_map,
5650 ps_ctxt->i4_nbr_map_strd,
5658 &ps_ctxt->s_rdopt_entropy_ctxt,
5663 ps_ctxt->u1_disable_intra_eval ? !DISABLE_TOP_SYNC && s_nbr.u1_top_avail
5679 COMPUTE_RATE_COST_CLIP30(header_bits, ps_ctxt->i8_cl_ssd_lambda_qf, LAMBDA_Q_SHIFT);
5683 if(ps_final_prms->u1_is_cu_coded && (ZCBF_ENABLE == ps_ctxt->i4_zcbf_rdo_level))
5685 LWORD64 i8_cu_not_coded_cost = ps_ctxt->i8_cu_not_coded_cost;
5691 &ps_ctxt->s_rdopt_entropy_ctxt.as_cu_entropy_ctxt[curr_buf_idx].s_cabac_ctxt;
5707 ps_ctxt->i8_cl_ssd_lambda_qf,
5710 if(ps_ctxt->u1_enable_psyRDOPT)
5813 * \param[in] ps_ctxt enc_loop module ctxt pointer
5833 ihevce_enc_loop_ctxt_t *ps_ctxt,
5859 ps_nbr_4x4 = &ps_ctxt->as_cu_nbr[curr_buf_idx][0];
5860 ps_final_prms = &ps_ctxt->as_cu_prms[curr_buf_idx];
5902 ps_ctxt->s_mv_pred_ctxt.ps_ref_list[0][ps_pu->mv.i1_l0_ref_idx]->i4_buf_id;
5909 ps_ctxt->s_mv_pred_ctxt.ps_ref_list[1][ps_pu->mv.i1_l1_ref_idx]->i4_buf_id;
5921 ps_ctxt->pu1_ctb_nbr_map,
5922 ps_ctxt->i4_nbr_map_strd,
5928 if(ps_ctxt->u1_disable_intra_eval && DISABLE_TOP_SYNC && (ps_pu->b4_pos_y == 0))
5946 if(!ps_ctxt->u1_use_top_at_ctb_boundary)
5949 ps_ctxt->s_mc_ctxt.i4_ctb_frm_pos_x + (cu_pos_x << 2);
5951 if(ps_ctxt->s_mc_ctxt.i4_ctb_frm_pos_y == 0)
5957 ((ihevce_tile_params_t *)ps_ctxt->pv_tile_params_base +
5958 ps_ctxt->i4_tile_col_idx);
5970 (ps_ctxt->s_mc_ctxt.i4_ctb_frm_pos_y >> 6) - 1;
5974 ps_ctxt->pv_dep_mngr_enc_loop_cu_top_right,
5978 ps_ctxt->i4_tile_col_idx, /* Col Tile No. */
5979 ps_ctxt->thrd_id);
5998 &ps_ctxt->s_mv_pred_ctxt,
6176 ps_ctxt->pu1_ctb_nbr_map,
6177 ps_ctxt->i4_nbr_map_strd,
6190 if(0 == skip_or_merge_flag || (ps_ctxt->u1_high_speed_cu_dec_on))
6193 ihevce_luma_inter_pred_pu(&ps_ctxt->s_mc_ctxt, ps_pu, pu1_pred, pred_stride, 0);
6237 * \param[in] ps_ctxt enc_loop module ctxt pointer
6431 ihevce_enc_loop_ctxt_t *ps_ctxt,
6456 recon_datastore_t *aps_recon_datastore[2] = { &ps_ctxt->as_cu_prms[0].s_recon_datastore,
6457 &ps_ctxt->as_cu_prms[1].s_recon_datastore };
6469 WORD32 i4_perform_rdoq = ps_ctxt->s_rdoq_sbh_ctxt.i4_perform_all_cand_rdoq;
6470 WORD32 i4_perform_sbh = ps_ctxt->s_rdoq_sbh_ctxt.i4_perform_all_cand_sbh;
6471 UWORD8 u1_is_422 = (ps_ctxt->u1_chroma_array_type == 2);
6474 ps_ctxt->ps_func_selector->ihevc_intra_pred_chroma_ref_substitution_fptr;
6486 ps_chr_intra_satd_ctxt = &ps_ctxt->s_chroma_rdopt_ctxt.as_chr_intra_satd_ctxt[tu_mode];
6504 ps_chr_intra_satd_ctxt = &ps_ctxt->s_chroma_rdopt_ctxt.as_chr_intra_satd_ctxt[tu_mode];
6526 ps_ctxt->apf_chrm_ip,
6527 ps_ctxt->apf_chrm_resd_trns_had,
6532 ps_ctxt->pu1_ctb_nbr_map,
6533 ps_ctxt->i4_nbr_map_strd,
6534 (UWORD8 *)ps_ctxt->pv_ref_sub_out,
6541 ps_ctxt->u1_enable_psyRDOPT,
6557 ps_ctxt->au1_rdopt_init_ctxt_models[IHEVC_CAB_CHROMA_PRED_MODE];
6565 if(ps_ctxt->i1_cu_qp_delta_enable)
6603 if(ps_ctxt->i4_use_ctb_level_lamda)
6606 ps_ctxt, ps_cu_analyse->i4_act_factor[i4_act_counter][1], -1, 0);
6611 ps_ctxt,
6617 ps_cu_analyse->i1_cu_qp = ps_ctxt->i4_cu_qp;
6620 u1_compute_spatial_ssd = (ps_ctxt->i4_cu_qp <= MAX_QP_WHERE_SPATIAL_SSD_ENABLED) &&
6621 (ps_ctxt->i4_quality_preset < IHEVCE_QUALITY_P3) &&
6624 if(u1_is_cu_noisy || ps_ctxt->u1_enable_psyRDOPT)
6626 u1_compute_spatial_ssd = (ps_ctxt->i4_cu_qp <= MAX_HEVC_QP) &&
6657 ps_ctxt->pu1_ctb_nbr_map,
6658 ps_ctxt->i4_nbr_map_strd,
6749 &ps_ctxt->s_rdopt_entropy_ctxt.as_cu_entropy_ctxt[rd_opt_curr_idx]
6751 &ps_ctxt->au1_rdopt_init_ctxt_models[0],
6780 (UWORD8 *)ps_ctxt->pv_ref_sub_out,
6787 ps_ctxt->apf_chrm_ip[chrm_pred_func_idx](
6788 (UWORD8 *)ps_ctxt->pv_ref_sub_out,
6800 ps_ctxt,
6810 ps_ctxt->au1_cu_csbf,
6811 ps_ctxt->i4_cu_csbf_strd,
6844 ps_ctxt->u1_enable_psyRDOPT,
6858 ps_ctxt->u1_enable_psyRDOPT,
6872 ps_ctxt->u1_enable_psyRDOPT,
6883 &ps_ctxt->au1_rdopt_init_ctxt_models[0],
6884 &ps_ctxt->s_rdopt_entropy_ctxt.as_cu_entropy_ctxt[rd_opt_curr_idx]
6892 &ps_ctxt->s_rdopt_entropy_ctxt.as_cu_entropy_ctxt[rd_opt_curr_idx]
6894 &ps_ctxt->au1_rdopt_init_ctxt_models[0],
6901 ps_ctxt,
6920 tu_bits, ps_ctxt->i8_cl_ssd_lambda_chroma_qf, LAMBDA_Q_SHIFT);
6932 ps_ctxt,
6942 ps_ctxt->au1_cu_csbf,
6943 ps_ctxt->i4_cu_csbf_strd,
6976 ps_ctxt->u1_enable_psyRDOPT,
6990 ps_ctxt->u1_enable_psyRDOPT,
7004 ps_ctxt->u1_enable_psyRDOPT,
7015 &ps_ctxt->au1_rdopt_init_ctxt_models[0],
7016 &ps_ctxt->s_rdopt_entropy_ctxt.as_cu_entropy_ctxt[rd_opt_curr_idx]
7024 &ps_ctxt->s_rdopt_entropy_ctxt.as_cu_entropy_ctxt[rd_opt_curr_idx]
7026 &ps_ctxt->au1_rdopt_init_ctxt_models[0],
7033 ps_ctxt,
7052 tu_bits, ps_ctxt->i8_cl_ssd_lambda_chroma_qf, LAMBDA_Q_SHIFT);
7065 ps_ctxt->pu1_ctb_nbr_map,
7066 ps_ctxt->i4_nbr_map_strd,
7075 ps_ctxt->pu1_ctb_nbr_map,
7076 ps_ctxt->i4_nbr_map_strd,
7100 ps_ctxt->i8_cl_ssd_lambda_chroma_qf,
7107 if(ps_ctxt->u1_enable_psyRDOPT)
7132 ps_ctxt->ai4_source_chroma_satd,
7139 ps_ctxt->i4_satd_lamda, // lambda
7141 ps_ctxt->u1_is_input_data_hbd, // 8 bit
7142 ps_ctxt->u1_chroma_array_type,
7143 &ps_ctxt->s_cmn_opt_func
7154 &ps_ctxt->au1_rdopt_init_ctxt_models[0],
7166 * \param[in] ps_ctxt enc_loop module ctxt pointer
7188 ihevce_enc_loop_ctxt_t *ps_ctxt,
7218 enc_loop_cu_final_prms_t *ps_best_cu_prms = &ps_ctxt->as_cu_prms[rd_opt_curr_idx];
7229 UWORD8 u1_is_422 = (ps_ctxt->u1_chroma_array_type == 2);
7236 UWORD8 u1_compute_spatial_ssd = (ps_ctxt->i4_cu_qp <= MAX_QP_WHERE_SPATIAL_SSD_ENABLED) &&
7237 (ps_ctxt->i4_quality_preset < IHEVCE_QUALITY_P3) &&
7240 LWORD64 prev_best_rdopt_cost = ps_ctxt->as_cu_prms[!rd_opt_curr_idx].i8_best_rdopt_cost;
7242 LWORD64 curr_rdopt_cost = ps_ctxt->as_cu_prms[rd_opt_curr_idx].i8_curr_rdopt_cost;
7243 WORD32 i4_perform_rdoq = ps_ctxt->s_rdoq_sbh_ctxt.i4_perform_all_cand_rdoq;
7244 WORD32 i4_perform_sbh = ps_ctxt->s_rdoq_sbh_ctxt.i4_perform_all_cand_sbh;
7247 ps_ctxt->ps_func_selector->ihevc_intra_pred_chroma_ref_substitution_fptr;
7249 if(u1_is_cu_noisy || ps_ctxt->u1_enable_psyRDOPT)
7251 u1_compute_spatial_ssd = (ps_ctxt->i4_cu_qp <= MAX_HEVC_QP) &&
7261 pu1_pred = ps_ctxt->s_cu_me_intra_pred_prms.pu1_pred_data[CU_ME_INTRA_PRED_CHROMA_IDX] +
7265 pred_strd = ps_ctxt->s_cu_me_intra_pred_prms.ai4_pred_data_stride[CU_ME_INTRA_PRED_CHROMA_IDX];
7304 ihevce_chroma_inter_pred_pu(&ps_ctxt->s_mc_ctxt, ps_pu, pu1_pred, pred_strd);
7370 if(!ps_best_cu_prms->u1_intra_flag || !ps_ctxt->s_chroma_rdopt_ctxt.u1_eval_chrm_satd ||
7371 (ps_ctxt->s_chroma_rdopt_ctxt.u1_eval_chrm_satd &&
7373 ps_ctxt->s_chroma_rdopt_ctxt.as_chr_intra_satd_ctxt[func_proc_mode].u1_best_cr_mode)))
7403 &ps_ctxt->s_rdopt_entropy_ctxt.as_cu_entropy_ctxt[rd_opt_curr_idx]
7405 &ps_ctxt->au1_rdopt_init_ctxt_models[0],
7540 (UWORD8 *)ps_ctxt->pv_ref_sub_out,
7547 ps_ctxt->apf_chrm_ip[chrm_pred_func_idx](
7548 (UWORD8 *)ps_ctxt->pv_ref_sub_out,
7581 ps_ctxt,
7591 ps_ctxt->au1_cu_csbf,
7592 ps_ctxt->i4_cu_csbf_strd,
7638 ps_ctxt->u1_enable_psyRDOPT,
7652 ps_ctxt->u1_enable_psyRDOPT,
7666 ps_ctxt->u1_enable_psyRDOPT,
7676 tu_bits, ps_ctxt->i8_cl_ssd_lambda_chroma_qf, LAMBDA_Q_SHIFT);
7685 &ps_ctxt->au1_rdopt_init_ctxt_models[0],
7686 &ps_ctxt->s_rdopt_entropy_ctxt
7695 &ps_ctxt->s_rdopt_entropy_ctxt
7698 &ps_ctxt->au1_rdopt_init_ctxt_models[0],
7706 ps_ctxt,
7741 ps_ctxt->s_cmn_opt_func.pf_chroma_interleave_ssd_calculator(
7753 ps_ctxt->s_cmn_opt_func.pf_chroma_interleave_2d_copy(
7778 ps_ctxt->u1_enable_psyRDOPT,
7785 ps_ctxt->i8_cu_not_coded_cost += curr_cb_cod_cost;
7789 ps_ctxt->i8_cu_not_coded_cost += (LWORD64)(
7790 (curr_cb_cod_cost * ps_ctxt->u4_chroma_cost_weighing_factor +
7801 ((curr_cb_cod_cost * ps_ctxt->u4_chroma_cost_weighing_factor +
7808 if(ps_ctxt->i4_bitrate_instance_num || ps_ctxt->i4_num_bitrates == 1)
7847 ps_ctxt,
7857 ps_ctxt->au1_cu_csbf,
7858 ps_ctxt->i4_cu_csbf_strd,
7904 ps_ctxt->u1_enable_psyRDOPT,
7918 ps_ctxt->u1_enable_psyRDOPT,
7932 ps_ctxt->u1_enable_psyRDOPT,
7942 tu_bits, ps_ctxt->i8_cl_ssd_lambda_chroma_qf, LAMBDA_Q_SHIFT);
7950 &ps_ctxt->au1_rdopt_init_ctxt_models[0],
7951 &ps_ctxt->s_rdopt_entropy_ctxt
7960 &ps_ctxt->s_rdopt_entropy_ctxt
7963 &ps_ctxt->au1_rdopt_init_ctxt_models[0],
7971 ps_ctxt,
8006 ps_ctxt->s_cmn_opt_func.pf_chroma_interleave_ssd_calculator(
8017 ps_ctxt->s_cmn_opt_func.pf_chroma_interleave_2d_copy(
8042 ps_ctxt->u1_enable_psyRDOPT,
8049 ps_ctxt->i8_cu_not_coded_cost += curr_cr_cod_cost;
8053 ps_ctxt->i8_cu_not_coded_cost += (LWORD64)(
8054 (curr_cr_cod_cost * ps_ctxt->u4_chroma_cost_weighing_factor +
8065 ((curr_cr_cod_cost * ps_ctxt->u4_chroma_cost_weighing_factor +
8073 if(ps_ctxt->i4_bitrate_instance_num || ps_ctxt->i4_num_bitrates == 1)
8131 if(ps_ctxt->u1_enable_psyRDOPT)
8155 ps_ctxt->ai4_source_chroma_satd,
8162 ps_ctxt->i4_satd_lamda, // lambda
8164 ps_ctxt->u1_is_input_data_hbd, // 8 bit
8165 ps_ctxt->u1_chroma_array_type,
8166 &ps_ctxt->s_cmn_opt_func
8180 (1 == ps_ctxt->s_chroma_rdopt_ctxt.u1_eval_chrm_satd))
8187 if(ps_ctxt->s_chroma_rdopt_ctxt.as_chr_intra_satd_ctxt[func_proc_mode]
8195 &ps_ctxt->s_chroma_rdopt_ctxt.as_chr_intra_satd_ctxt[func_proc_mode];
8197 UWORD8 *pu1_dst = &ps_ctxt->au1_rdopt_init_ctxt_models[0];
8324 ps_ctxt->s_cmn_opt_func.pf_copy_2d(
8332 ps_ctxt->s_cmn_opt_func.pf_copy_2d(
8343 ps_ctxt->s_cmn_opt_func.pf_copy_2d(
8554 ihevce_enc_loop_ctxt_t *ps_ctxt, final_mode_process_prms_t *ps_prms)
8615 UWORD8 u1_is_422 = (ps_ctxt->u1_chroma_array_type == 2);
8624 ps_ctxt->ps_func_selector->ihevc_intra_pred_luma_ref_substitution_fptr;
8627 ps_ctxt->ps_func_selector->ihevc_intra_pred_ref_filtering_fptr;
8630 ps_ctxt->ps_func_selector->ihevc_intra_pred_chroma_ref_substitution_fptr;
8633 ps_best_cu_prms = &ps_ctxt->as_cu_prms[rd_opt_best_idx];
8647 if((ps_ctxt->i1_cu_qp_delta_enable))
8650 ihevce_compute_quant_rel_param(ps_ctxt, i1_cu_qp);
8654 ps_ctxt, MODULATE_LAMDA_WHEN_SPATIAL_MOD_ON ? i1_cu_qp : ps_ctxt->i4_frame_qp);
8682 if((1 == ps_ctxt->s_cu_final_recon_flags.u1_eval_luma_pred_data))
8699 rd_opt_cost = ((pf_inter_rdopt_cu_mc_mvp)ps_ctxt->pv_inter_rdopt_cu_mc_mvp)(
8700 ps_ctxt,
8713 if(1 == ps_ctxt->s_cu_final_recon_flags.u1_eval_chroma_pred_data)
8732 &ps_ctxt->s_mc_ctxt, ps_pu, pu1_cur_pred, pred_chrm_strd);
8783 ps_ctxt->s_cu_final_recon_flags.u1_eval_header_data = 1;
8785 &ps_ctxt->au1_rdopt_init_ctxt_models[0],
8786 &ps_ctxt->s_rdopt_entropy_ctxt.au1_init_cabac_ctxt_states[0],
8792 (&ps_ctxt->au1_rdopt_init_ctxt_models[0] + IHEVC_CAB_COEFFX_PREFIX),
8793 (&ps_ctxt->s_rdopt_entropy_ctxt.au1_init_cabac_ctxt_states[0] +
8800 (&ps_ctxt->au1_rdopt_init_ctxt_models[0] + IHEVC_CAB_COEFFX_PREFIX),
8801 (&ps_ctxt->s_rdopt_entropy_ctxt.as_cu_entropy_ctxt[rd_opt_best_idx]
8806 ps_ctxt->s_rdopt_entropy_ctxt.i4_curr_buf_idx = rd_opt_best_idx;
8810 ps_ctxt->s_cu_final_recon_flags.u1_eval_header_data = 0;
8817 ps_ctxt->i4_zcbf_rdo_level = ZCBF_ENABLE;
8819 ps_ctxt->i4_zcbf_rdo_level = NO_ZCBF;
8825 ps_ctxt->i4_zcbf_rdo_level = NO_ZCBF;
8827 ps_ctxt->i4_zcbf_rdo_level = ZCBF_ENABLE;
8853 ps_ctxt->i4_scan_idx = SCAN_DIAG_UPRIGHT;
8913 if((ps_ctxt->i4_rc_pass == 1) ||
8914 (1 == ps_ctxt
8961 ps_ctxt->pu1_ctb_nbr_map,
8962 ps_ctxt->i4_nbr_map_strd,
8967 if(1 == ps_ctxt->s_cu_final_recon_flags.u1_eval_luma_pred_data)
8979 ps_ctxt->pu1_ctb_nbr_map,
8980 ps_ctxt->i4_nbr_map_strd,
8995 (UWORD8 *)ps_ctxt->pv_ref_sub_out,
9000 (UWORD8 *)ps_ctxt->pv_ref_sub_out,
9002 (UWORD8 *)ps_ctxt->pv_ref_filt_out,
9004 ps_ctxt->i1_strong_intra_smoothing_enable_flag);
9010 ps_ctxt->apf_lum_ip[luma_pred_func_idx](
9011 (UWORD8 *)ps_ctxt->pv_ref_filt_out,
9021 (1 == ps_ctxt->s_cu_final_recon_flags.u1_eval_chroma_pred_data))
9031 ps_ctxt->pu1_ctb_nbr_map,
9032 ps_ctxt->i4_nbr_map_strd,
9058 ps_ctxt->i4_scan_idx = SCAN_HORZ;
9063 ps_ctxt->i4_scan_idx = SCAN_VERT;
9070 &ps_ctxt->s_rdopt_entropy_ctxt.as_cu_entropy_ctxt[rd_opt_best_idx]
9073 &ps_ctxt->au1_rdopt_init_ctxt_models[0] + IHEVC_CAB_COEFFX_PREFIX,
9078 perform_sbh = (ps_ctxt->i4_sbh_level != NO_SBH);
9079 perform_rdoq = (ps_ctxt->i4_rdoq_level != NO_RDOQ);
9084 perform_sbh = ps_ctxt->s_rdoq_sbh_ctxt.i4_perform_best_cand_sbh;
9087 perform_rdoq = ps_ctxt->s_rdoq_sbh_ctxt.i4_perform_best_cand_rdoq;
9100 ASSERT(ps_ctxt->i4_quant_rounding_level != TU_LEVEL_QUANT_ROUNDING);
9104 ps_ctxt,
9125 perform_rdoq, //(BEST_CAND_RDOQ == ps_ctxt->i4_rdoq_level),
9128 !ps_ctxt->u1_is_refPic ? ALPHA_FOR_NOISE_TERM_IN_RDOPT
9136 ); //(BEST_CAND_SBH == ps_ctxt->i4_sbh_level));
9146 &ps_ctxt->au1_rdopt_init_ctxt_models[0] + IHEVC_CAB_COEFFX_PREFIX,
9147 &ps_ctxt->s_rdopt_entropy_ctxt.as_cu_entropy_ctxt[rd_opt_best_idx]
9162 nbr_4x4_t *ps_cur_nbr_4x4 = &ps_ctxt->as_cu_nbr[rd_opt_best_idx][0];
9168 ps_cur_nbr_4x4->b8_qp = ps_ctxt->i4_cu_qp;
9179 ps_tmp_4x4[j].b8_qp = ps_ctxt->i4_cu_qp;
9211 if(ps_ctxt->s_cu_final_recon_flags.u1_eval_recon_data &&
9220 ps_ctxt,
9243 ps_ctxt->s_cmn_opt_func.pf_copy_2d(
9284 (ps_ctxt->i4_quality_preset == IHEVCE_QUALITY_P0) &&
9331 if(ps_ctxt->s_cu_final_recon_flags.u1_eval_recon_data &&
9342 ps_ctxt,
9369 ps_ctxt->s_cmn_opt_func.pf_chroma_interleave_2d_copy(
9425 if(ps_ctxt->s_cu_final_recon_flags.u1_eval_recon_data &&
9436 ps_ctxt,
9463 ps_ctxt->s_cmn_opt_func.pf_chroma_interleave_2d_copy(
9506 (1 == ps_ctxt->s_cu_final_recon_flags.u1_eval_chroma_pred_data))
9560 (UWORD8 *)ps_ctxt->pv_ref_sub_out,
9567 ps_ctxt->apf_chrm_ip[chrm_pred_func_idx](
9568 (UWORD8 *)ps_ctxt->pv_ref_sub_out,
9583 perform_sbh = (ps_ctxt->i4_sbh_level != NO_SBH);
9584 perform_rdoq = (ps_ctxt->i4_rdoq_level != NO_RDOQ);
9589 perform_sbh = ps_ctxt->s_rdoq_sbh_ctxt.i4_perform_best_cand_sbh;
9592 perform_rdoq = ps_ctxt->s_rdoq_sbh_ctxt.i4_perform_best_cand_rdoq;
9596 ps_ctxt->i4_scan_idx = SCAN_DIAG_UPRIGHT;
9606 ps_ctxt->i4_scan_idx = SCAN_HORZ;
9611 ps_ctxt->i4_scan_idx = SCAN_VERT;
9625 &ps_ctxt->s_rdopt_entropy_ctxt.as_cu_entropy_ctxt[rd_opt_best_idx]
9628 &ps_ctxt->au1_rdopt_init_ctxt_models[0] + IHEVC_CAB_COEFFX_PREFIX,
9631 ASSERT(rd_opt_best_idx == ps_ctxt->s_rdopt_entropy_ctxt.i4_curr_buf_idx);
9636 ASSERT(ps_ctxt->i4_quant_rounding_level != TU_LEVEL_QUANT_ROUNDING);
9640 !ps_ctxt->s_chroma_rdopt_ctxt.u1_eval_chrm_rdopt)
9644 ps_ctxt,
9657 ps_ctxt->i4_scan_idx,
9668 !ps_ctxt->u1_is_refPic
9676 ps_ctxt->s_chroma_rdopt_ctxt.u1_eval_chrm_rdopt,
9698 &ps_ctxt->au1_rdopt_init_ctxt_models[0] + IHEVC_CAB_COEFFX_PREFIX,
9699 &ps_ctxt->s_rdopt_entropy_ctxt.as_cu_entropy_ctxt[rd_opt_best_idx]
9708 &ps_ctxt->s_rdopt_entropy_ctxt.as_cu_entropy_ctxt[rd_opt_best_idx]
9711 &ps_ctxt->au1_rdopt_init_ctxt_models[0] + IHEVC_CAB_COEFFX_PREFIX,
9716 !ps_ctxt->s_chroma_rdopt_ctxt.u1_eval_chrm_rdopt)
9720 ps_ctxt,
9733 ps_ctxt->i4_scan_idx,
9744 !ps_ctxt->u1_is_refPic
9752 ps_ctxt->s_chroma_rdopt_ctxt.u1_eval_chrm_rdopt,
9774 &ps_ctxt->au1_rdopt_init_ctxt_models[0] + IHEVC_CAB_COEFFX_PREFIX,
9775 &ps_ctxt->s_rdopt_entropy_ctxt.as_cu_entropy_ctxt[rd_opt_best_idx]
9837 if(ps_ctxt->s_cu_final_recon_flags.u1_eval_recon_data &&
9848 ps_ctxt,
9875 ps_ctxt->s_cmn_opt_func.pf_chroma_interleave_2d_copy(
9898 if(ps_ctxt->s_cu_final_recon_flags.u1_eval_recon_data &&
9909 ps_ctxt,
9936 ps_ctxt->s_cmn_opt_func.pf_chroma_interleave_2d_copy(
9985 ps_ctxt->pu1_ctb_nbr_map,
9986 ps_ctxt->i4_nbr_map_strd,
10013 if(1 == ps_ctxt->s_cu_final_recon_flags.u1_eval_header_data)
10024 &ps_ctxt->s_rdopt_entropy_ctxt.as_cu_entropy_ctxt[rd_opt_best_idx]
10026 &ps_ctxt->au1_rdopt_init_ctxt_models[0],
10032 ps_ctxt->pu1_ctb_nbr_map,
10033 ps_ctxt->i4_nbr_map_strd,
10040 &ps_ctxt->s_rdopt_entropy_ctxt,
10045 ps_ctxt->u1_disable_intra_eval ? !DISABLE_TOP_SYNC && s_nbr.u1_top_avail
10070 * \param[in] ps_ctxt : encoder ctxt pointer
10082 ihevce_enc_loop_ctxt_t *ps_ctxt, enc_loop_cu_final_prms_t *ps_enc_loop_bestprms)
10086 ps_ctxt->s_cu_final_recon_flags.u1_eval_luma_pred_data = 0;
10088 ps_ctxt->s_cu_final_recon_flags.u1_eval_chroma_pred_data =
10089 !ps_ctxt->s_chroma_rdopt_ctxt.u1_eval_chrm_rdopt;
10091 if(ps_ctxt->u1_disable_intra_eval && (!(ps_ctxt->i4_deblk_pad_hpel_cur_pic & 0x1)))
10093 ps_ctxt->s_cu_final_recon_flags.u1_eval_recon_data = 0;
10097 ps_ctxt->s_cu_final_recon_flags.u1_eval_recon_data = 1;
10100 if((1 == ps_ctxt->s_rdoq_sbh_ctxt.i4_perform_best_cand_rdoq) ||
10101 (1 == ps_ctxt->s_rdoq_sbh_ctxt.i4_perform_best_cand_sbh))
10109 ps_ctxt->s_cu_final_recon_flags.u1_eval_luma_pred_data = 1;
10110 ps_ctxt->s_cu_final_recon_flags.u1_eval_chroma_pred_data = 1;
10135 switch(ps_ctxt->i4_quality_preset)
10147 !ps_ctxt->s_chroma_rdopt_ctxt.u1_eval_chrm_rdopt;
10161 !ps_ctxt->s_chroma_rdopt_ctxt.u1_eval_chrm_rdopt;
10175 !ps_ctxt->s_chroma_rdopt_ctxt.u1_eval_chrm_rdopt;
10177 if((ps_ctxt->i1_slice_type == BSLICE) && (ps_ctxt->i4_temporal_layer_id > 1) &&
10188 !ps_ctxt->s_chroma_rdopt_ctxt.u1_eval_chrm_rdopt;
10203 ps_ctxt->s_cu_final_recon_flags.u1_eval_header_data = 1;
10556 ihevce_enc_loop_ctxt_t *ps_ctxt, cu_inter_cand_t *ps_inter_cand, WORD32 cu_size)
10578 ihevce_luma_inter_pred_pu(&ps_ctxt->s_mc_ctxt, ps_pu, pu1_pred, pred_stride, 1);
10598 ihevce_enc_loop_ctxt_t *ps_ctxt,
10618 ps_ctxt,
10632 return ps_ctxt->s_cmn_opt_func.pf_ssd_calculator(
10638 ps_ctxt,
10652 return ps_ctxt->s_cmn_opt_func.pf_chroma_interleave_ssd_calculator(
10669 * \param[in] ps_ctxt enc_loop module ctxt pointer
10697 ihevce_enc_loop_ctxt_t *ps_ctxt,
10739 rdoq_sbh_ctxt_t *ps_rdoq_sbh_ctxt = &ps_ctxt->s_rdoq_sbh_ctxt;
10741 WORD32 i4_perform_zcbf = (ps_ctxt->i4_zcbf_rdo_level == ZCBF_ENABLE) ||
10744 (ps_ctxt->i4_quant_rounding_level != FIXED_QUANT_ROUNDING) &&
10745 (ps_ctxt->i4_chroma_quant_rounding_level == CHROMA_QUANT_ROUNDING);
10754 pi4_trans_scratch = (WORD32 *)&ps_ctxt->ai2_scratch[0];
10755 pi2_quant_coeffs = &ps_ctxt->ai2_scratch[0];
10756 pi2_trans_values = &ps_ctxt->ai2_scratch[0] + (MAX_TRANS_SIZE * 2);
10773 pi8_cost[0] = ps_ctxt->s_cmn_opt_func.pf_chroma_interleave_ssd_calculator(
10784 ps_ctxt->s_cmn_opt_func.pf_chroma_interleave_2d_copy(
10808 ps_ctxt->u1_enable_psyRDOPT,
10816 ps_ctxt->i8_cu_not_coded_cost += pi8_cost[0];
10818 ps_ctxt->i8_cu_not_coded_cost += (pi8_cost[0] * ps_ctxt->u4_chroma_cost_weighing_factor +
10833 MAX(ps_ctxt->i4_quant_rnd_factor[intra_flag], (1 << QUANT_ROUND_FACTOR_Q) / 3);
10838 MAX(ps_ctxt->pi4_quant_round_factor_cr_cu_ctb_0_1[trans_size >> 3][i],
10841 MAX(ps_ctxt->pi4_quant_round_factor_cr_cu_ctb_1_2[trans_size >> 3][i],
10880 u4_blk_sad = ps_ctxt->apf_chrm_resd_trns[trans_idx - 1](
10891 cbf = ps_ctxt->apf_quant_iquant_ssd
10895 ps_ctxt->api2_rescal_mat[trans_idx + quant_scale_mat_offset],
10899 ps_ctxt->i4_chrm_cu_qp_div6,
10900 ps_ctxt->i4_chrm_cu_qp_mod6,
10902 ps_ctxt->i4_quant_rnd_factor[intra_flag],
10903 ps_ctxt->pi4_quant_round_factor_cr_cu_ctb_0_1[trans_size >> 3],
10904 ps_ctxt->pi4_quant_round_factor_cr_cu_ctb_1_2[trans_size >> 3],
10906 intra_flag ? ai4_quant_rounding_factors[0][0] : ps_ctxt->i4_quant_rnd_factor[intra_flag],
10908 : ps_ctxt->pi4_quant_round_factor_cr_cu_ctb_0_1[trans_size >> 3],
10910 : ps_ctxt
10919 ps_ctxt->api2_scal_mat[trans_idx + quant_scale_mat_offset],
10934 ps_rdoq_sbh_ctxt->i4_qp_div = ps_ctxt->i4_chrm_cu_qp_div6;
10935 ps_rdoq_sbh_ctxt->i2_qp_rem = ps_ctxt->i4_chrm_cu_qp_mod6;
10941 ps_ctxt->api2_scal_mat[trans_idx + quant_scale_mat_offset];
10957 *pi4_coeff_off = ps_ctxt->s_cmn_opt_func.pf_scan_coeffs(
10986 ps_rdoq_sbh_ctxt->i8_cl_ssd_lambda_qf = ps_ctxt->i8_cl_ssd_lambda_chroma_qf;
11000 ps_ctxt->s_cmn_opt_func.pf_chroma_interleave_ssd_calculator(
11017 &ps_ctxt->s_rdopt_entropy_ctxt,
11052 *pi4_coeff_off = ps_ctxt->s_cmn_opt_func.pf_scan_coeffs(
11070 &ps_ctxt->s_rdopt_entropy_ctxt, pu1_ecd_data, trans_size, 0, i4_perform_sbh);
11078 ps_ctxt,
11110 ps_ctxt->u1_enable_psyRDOPT,
11124 ps_ctxt->u1_enable_psyRDOPT,
11133 COMPUTE_RATE_COST_CLIP30(tu_bits, ps_ctxt->i8_cl_ssd_lambda_chroma_qf, LAMBDA_Q_SHIFT);
11146 !ps_ctxt->u1_is_refPic ? ALPHA_FOR_ZERO_CODING_DECISIONS
11152 ps_ctxt->u1_enable_psyRDOPT,
11168 ps_ctxt->s_cmn_opt_func.pf_chroma_interleave_2d_copy(
11185 ps_ctxt->i8_cu_not_coded_cost += zero_cbf_cost_u;
11187 ps_ctxt->i8_cu_not_coded_cost += (LWORD64)(
11188 (zero_cbf_cost_u * ps_ctxt->u4_chroma_cost_weighing_factor +
11201 ps_ctxt,
11230 !ps_ctxt->u1_is_refPic ? ALPHA_FOR_ZERO_CODING_DECISIONS
11236 ps_ctxt->u1_enable_psyRDOPT,
11247 !ps_ctxt->u1_is_refPic ? ALPHA_FOR_ZERO_CODING_DECISIONS
11253 ps_ctxt->u1_enable_psyRDOPT,
11263 ps_ctxt->i8_cu_not_coded_cost += pi8_cost[0];
11267 ps_ctxt->i8_cu_not_coded_cost += (LWORD64)(
11268 (pi8_cost[0] * ps_ctxt->u4_chroma_cost_weighing_factor +