summaryrefslogtreecommitdiff
path: root/libavfilter/vf_scale_vaapi.c
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2016-09-13 20:50:57 +0100
committerMark Thompson <sw@jkqxz.net>2016-09-14 20:48:36 +0100
commitbdf7610eb266fd3de650040c97328791868abd82 (patch)
treefe197cdbc474da1eecc67c5b2e4fee80d4009daa /libavfilter/vf_scale_vaapi.c
parent3a9662af6c741f8354b1ca97642f78f5c02e2e8f (diff)
vf_scale_vaapi: Crop input surface to active region
If the input has been decoded from a stream which uses edge cropping then the whole surface need not be valid. This defines an input region for the scaler so we only use the active area of the frame.
Diffstat (limited to 'libavfilter/vf_scale_vaapi.c')
-rw-r--r--libavfilter/vf_scale_vaapi.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/libavfilter/vf_scale_vaapi.c b/libavfilter/vf_scale_vaapi.c
index 561e09c4dc..704456dd39 100644
--- a/libavfilter/vf_scale_vaapi.c
+++ b/libavfilter/vf_scale_vaapi.c
@@ -259,6 +259,7 @@ static int scale_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame)
VASurfaceID input_surface, output_surface;
VAProcPipelineParameterBuffer params;
VABufferID params_id;
+ VARectangle input_region;
VAStatus vas;
int err;
@@ -292,8 +293,17 @@ 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,
+ };
+
params.surface = input_surface;
- params.surface_region = 0;
+ params.surface_region = &input_region;
params.surface_color_standard =
vaapi_proc_colour_standard(input_frame->colorspace);