[FFmpeg-devel] [PATCH 5/5] ffmpeg: Add {h, v}scale argument to display_matrix option to allow for scaling via the display matrix

Thilo Borgmann thilo.borgmann at mail.de
Tue Aug 16 16:43:12 EEST 2022


Am 16.08.22 um 15:30 schrieb Thilo Borgmann:
> ---
>   doc/ffmpeg.texi         |  4 ++++
>   fftools/ffmpeg_filter.c | 15 +++++++++++++++
>   fftools/ffmpeg_opt.c    | 10 ++++++++++
>   libavutil/display.c     | 21 +++++++++++++++++++++
>   libavutil/display.h     | 28 ++++++++++++++++++++++++++++
>   5 files changed, 78 insertions(+)
> 
> [...]
> diff --git a/libavutil/display.c b/libavutil/display.c
> index d31061283c..b89763ff48 100644
> --- a/libavutil/display.c
> +++ b/libavutil/display.c
> @@ -28,9 +28,11 @@
>   
>   // fixed point to double
>   #define CONV_FP(x) ((double) (x)) / (1 << 16)
> +#define CONV_FP2(x) ((double) (x)) / (1 << 30)
>   
>   // double to fixed point
>   #define CONV_DB(x) (int32_t) ((x) * (1 << 16))
> +#define CONV_DB2(x) (int32_t) ((x) * (1 << 30))
>   
>   double av_display_rotation_get(const int32_t matrix[9])
>   {
> @@ -48,6 +50,17 @@ double av_display_rotation_get(const int32_t matrix[9])
>       return -rotation;
>   }
>   
> +double av_display_hscale_get(const int32_t matrix[9])
> +{
> +    return fabs(CONV_FP2(matrix[2]));
> +}
> +
> +double av_display_vscale_get(const int32_t matrix[9])
> +{
> +    return fabs(CONV_FP2(matrix[5]));
> +}
> +

> +#include <stdio.h>

obviously wrong and missed to remove... will be fixed locally.

-Thilo


More information about the ffmpeg-devel mailing list