[FFmpeg-devel,6/7] vf_scale_vaapi: Apply cropping rectangle to input

Submitted by Mark Thompson on March 11, 2018, 10:41 p.m.

Details

Message ID 20180311224156.23986-6-sw@jkqxz.net
State Accepted
Commit abf35afb6f70f2b1fdf99ce48112ad314bd8ca0f
Headers show

Commit Message

Mark Thompson March 11, 2018, 10:41 p.m.
---
 libavfilter/vf_scale_vaapi.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Rostislav Pehlivanov March 12, 2018, 12:04 a.m.
On 11 March 2018 at 22:41, Mark Thompson <sw@jkqxz.net> wrote:

> ---
>  libavfilter/vf_scale_vaapi.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/libavfilter/vf_scale_vaapi.c b/libavfilter/vf_scale_vaapi.c
> index c19e23ccd0..d6529d5235 100644
> --- a/libavfilter/vf_scale_vaapi.c
> +++ b/libavfilter/vf_scale_vaapi.c
> @@ -100,13 +100,13 @@ static int scale_vaapi_filter_frame(AVFilterLink
> *inlink, AVFrame *input_frame)
>
>      memset(&params, 0, sizeof(params));
>
> -    // If there were top/left cropping, it could be taken into
> -    // account here.
>      input_region = (VARectangle) {
> -        .x      = 0,
> -        .y      = 0,
> -        .width  = input_frame->width,
> -        .height = input_frame->height,
> +        .x      = input_frame->crop_left,
> +        .y      = input_frame->crop_top,
> +        .width  = input_frame->width -
> +                 (input_frame->crop_left + input_frame->crop_right),
> +        .height = input_frame->height -
> +                 (input_frame->crop_top + input_frame->crop_bottom),
>      };
>
>      params.surface = input_surface;
> --
> 2.16.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

LGTM

Patch hide | download patch | download mbox

diff --git a/libavfilter/vf_scale_vaapi.c b/libavfilter/vf_scale_vaapi.c
index c19e23ccd0..d6529d5235 100644
--- a/libavfilter/vf_scale_vaapi.c
+++ b/libavfilter/vf_scale_vaapi.c
@@ -100,13 +100,13 @@  static int scale_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame)
 
     memset(&params, 0, sizeof(params));
 
-    // If there were top/left cropping, it could be taken into
-    // account here.
     input_region = (VARectangle) {
-        .x      = 0,
-        .y      = 0,
-        .width  = input_frame->width,
-        .height = input_frame->height,
+        .x      = input_frame->crop_left,
+        .y      = input_frame->crop_top,
+        .width  = input_frame->width -
+                 (input_frame->crop_left + input_frame->crop_right),
+        .height = input_frame->height -
+                 (input_frame->crop_top + input_frame->crop_bottom),
     };
 
     params.surface = input_surface;