MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / hb_limit_rational

Function hb_limit_rational

libhb/common.c:3752–3776  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3750}
3751
3752void hb_limit_rational( int *x, int *y, int64_t num, int64_t den, int limit )
3753{
3754 hb_reduce64( &num, &den, num, den );
3755 if ( num < limit && den < limit )
3756 {
3757 *x = num;
3758 *y = den;
3759 return;
3760 }
3761
3762 if ( num > den )
3763 {
3764 double div = (double)limit / num;
3765 num = limit;
3766 den *= div;
3767 }
3768 else
3769 {
3770 double div = (double)limit / den;
3771 den = limit;
3772 num *= div;
3773 }
3774 *x = num;
3775 *y = den;
3776}
3777
3778int64_t hb_rescale_rational(hb_rational_t q, int b)
3779{

Callers 3

crop_scale_initFunction · 0.85
encavcodecInitFunction · 0.85
crop_scale_vt_initFunction · 0.85

Calls 1

hb_reduce64Function · 0.85

Tested by

no test coverage detected