mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
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.
This commit is contained in:
parent
3a9662af6c
commit
bdf7610eb2
@ -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(¶ms, 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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user