Add helpers to calculate det_thresh_flatness and initial_scale_value as these calculations are defined within the DSC spec. Signed-off-by: Jessica Zhang <quic_jesszhan@xxxxxxxxxxx> --- include/drm/display/drm_dsc_helper.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/drm/display/drm_dsc_helper.h b/include/drm/display/drm_dsc_helper.h index 4448c482b092..63175650a45e 100644 --- a/include/drm/display/drm_dsc_helper.h +++ b/include/drm/display/drm_dsc_helper.h @@ -17,6 +17,16 @@ enum drm_dsc_params_kind { DRM_DSC_1_2_420, }; +static inline int drm_dsc_calculate_initial_scale_value(struct drm_dsc_config *dsc) +{ + return 8 * dsc->rc_model_size / (dsc->rc_model_size - dsc->initial_offset); +} + +static inline int drm_dsc_calculate_det_thresh_flatness(struct drm_dsc_config *dsc) +{ + return 2 << (dsc->bits_per_component - 8); +} + void drm_dsc_dp_pps_header_init(struct dp_sdp_header *pps_header); int drm_dsc_dp_rc_buffer_size(u8 rc_buffer_block_size, u8 rc_buffer_size); void drm_dsc_pps_payload_pack(struct drm_dsc_picture_parameter_set *pps_sdp, -- 2.39.2