diff options
author | Michael Grzeschik <m.grzeschik@pengutronix.de> | 2022-09-10 01:13:32 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-09-22 16:52:30 +0300 |
commit | 6ba8b8d45335180523df8f1b6cd1c995a3dbf560 (patch) | |
tree | cc1bb48adb9e162d1d6f65b43a728c91bc48271e /include/media | |
parent | d225ea95e9f9be04914f51aaabab7ed04097cd4e (diff) | |
download | linux-6ba8b8d45335180523df8f1b6cd1c995a3dbf560.tar.xz |
media: v4l: move helper functions for fractions from uvc to v4l2-common
The functions uvc_simplify_fraction and uvc_fraction_to_interval are
generic helpers which are also useful for other v4l2 drivers. This patch
moves them to v4l2-common.
Tested-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20220909221335.15033-2-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/media')
-rw-r--r-- | include/media/v4l2-common.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index b708d63995f4..725ff91b26e0 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h @@ -540,6 +540,10 @@ int v4l2_fill_pixfmt_mp(struct v4l2_pix_format_mplane *pixfmt, u32 pixelformat, s64 v4l2_get_link_freq(struct v4l2_ctrl_handler *handler, unsigned int mul, unsigned int div); +void v4l2_simplify_fraction(u32 *numerator, u32 *denominator, + unsigned int n_terms, unsigned int threshold); +u32 v4l2_fraction_to_interval(u32 numerator, u32 denominator); + static inline u64 v4l2_buffer_get_timestamp(const struct v4l2_buffer *buf) { /* |