lavfi/vaapi: Factorise out common code for parameter buffer setup
Also enables cropping on all VAAPI filters, inherited from the existing support in scale_vaapi.
This commit is contained in:
@@ -248,6 +248,52 @@ int ff_vaapi_vpp_colour_standard(enum AVColorSpace av_cs)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ff_vaapi_vpp_init_params(AVFilterContext *avctx,
|
||||||
|
VAProcPipelineParameterBuffer *params,
|
||||||
|
const AVFrame *input_frame,
|
||||||
|
AVFrame *output_frame)
|
||||||
|
{
|
||||||
|
VAAPIVPPContext *ctx = avctx->priv;
|
||||||
|
VASurfaceID input_surface;
|
||||||
|
|
||||||
|
ctx->input_region = (VARectangle) {
|
||||||
|
.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),
|
||||||
|
};
|
||||||
|
output_frame->crop_top = 0;
|
||||||
|
output_frame->crop_bottom = 0;
|
||||||
|
output_frame->crop_left = 0;
|
||||||
|
output_frame->crop_right = 0;
|
||||||
|
|
||||||
|
input_surface = (VASurfaceID)(uintptr_t)input_frame->data[3],
|
||||||
|
|
||||||
|
*params = (VAProcPipelineParameterBuffer) {
|
||||||
|
.surface = input_surface,
|
||||||
|
.surface_region = &ctx->input_region,
|
||||||
|
.surface_color_standard =
|
||||||
|
ff_vaapi_vpp_colour_standard(input_frame->colorspace),
|
||||||
|
.output_region = NULL,
|
||||||
|
.output_background_color = VAAPI_VPP_BACKGROUND_BLACK,
|
||||||
|
.output_color_standard =
|
||||||
|
ff_vaapi_vpp_colour_standard(input_frame->colorspace),
|
||||||
|
.pipeline_flags = 0,
|
||||||
|
.filter_flags = VA_FRAME_PICTURE,
|
||||||
|
|
||||||
|
// Filter and reference data filled by the filter itself.
|
||||||
|
|
||||||
|
#if VA_CHECK_VERSION(1, 1, 0)
|
||||||
|
.rotation_state = VA_ROTATION_NONE,
|
||||||
|
.mirror_state = VA_MIRROR_NONE,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int ff_vaapi_vpp_make_param_buffers(AVFilterContext *avctx,
|
int ff_vaapi_vpp_make_param_buffers(AVFilterContext *avctx,
|
||||||
int type,
|
int type,
|
||||||
const void *data,
|
const void *data,
|
||||||
@@ -279,12 +325,15 @@ int ff_vaapi_vpp_make_param_buffers(AVFilterContext *avctx,
|
|||||||
|
|
||||||
int ff_vaapi_vpp_render_picture(AVFilterContext *avctx,
|
int ff_vaapi_vpp_render_picture(AVFilterContext *avctx,
|
||||||
VAProcPipelineParameterBuffer *params,
|
VAProcPipelineParameterBuffer *params,
|
||||||
VASurfaceID output_surface)
|
AVFrame *output_frame)
|
||||||
{
|
{
|
||||||
|
VAAPIVPPContext *ctx = avctx->priv;
|
||||||
|
VASurfaceID output_surface;
|
||||||
VABufferID params_id;
|
VABufferID params_id;
|
||||||
VAStatus vas;
|
VAStatus vas;
|
||||||
int err = 0;
|
int err;
|
||||||
VAAPIVPPContext *ctx = avctx->priv;
|
|
||||||
|
output_surface = (VASurfaceID)(uintptr_t)output_frame->data[3];
|
||||||
|
|
||||||
vas = vaBeginPicture(ctx->hwctx->display,
|
vas = vaBeginPicture(ctx->hwctx->display,
|
||||||
ctx->va_context, output_surface);
|
ctx->va_context, output_surface);
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ typedef struct VAAPIVPPContext {
|
|||||||
|
|
||||||
AVBufferRef *input_frames_ref;
|
AVBufferRef *input_frames_ref;
|
||||||
AVHWFramesContext *input_frames;
|
AVHWFramesContext *input_frames;
|
||||||
|
VARectangle input_region;
|
||||||
|
|
||||||
enum AVPixelFormat output_format;
|
enum AVPixelFormat output_format;
|
||||||
int output_width; // computed width
|
int output_width; // computed width
|
||||||
@@ -69,6 +70,11 @@ int ff_vaapi_vpp_config_output(AVFilterLink *outlink);
|
|||||||
|
|
||||||
int ff_vaapi_vpp_colour_standard(enum AVColorSpace av_cs);
|
int ff_vaapi_vpp_colour_standard(enum AVColorSpace av_cs);
|
||||||
|
|
||||||
|
int ff_vaapi_vpp_init_params(AVFilterContext *avctx,
|
||||||
|
VAProcPipelineParameterBuffer *params,
|
||||||
|
const AVFrame *input_frame,
|
||||||
|
AVFrame *output_frame);
|
||||||
|
|
||||||
int ff_vaapi_vpp_make_param_buffers(AVFilterContext *avctx,
|
int ff_vaapi_vpp_make_param_buffers(AVFilterContext *avctx,
|
||||||
int type,
|
int type,
|
||||||
const void *data,
|
const void *data,
|
||||||
@@ -77,6 +83,6 @@ int ff_vaapi_vpp_make_param_buffers(AVFilterContext *avctx,
|
|||||||
|
|
||||||
int ff_vaapi_vpp_render_picture(AVFilterContext *avctx,
|
int ff_vaapi_vpp_render_picture(AVFilterContext *avctx,
|
||||||
VAProcPipelineParameterBuffer *params,
|
VAProcPipelineParameterBuffer *params,
|
||||||
VASurfaceID output_surface);
|
AVFrame *output_frame);
|
||||||
|
|
||||||
#endif /* AVFILTER_VAAPI_VPP_H */
|
#endif /* AVFILTER_VAAPI_VPP_H */
|
||||||
|
|||||||
@@ -181,12 +181,11 @@ static int deint_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame)
|
|||||||
VAAPIVPPContext *vpp_ctx = avctx->priv;
|
VAAPIVPPContext *vpp_ctx = avctx->priv;
|
||||||
DeintVAAPIContext *ctx = avctx->priv;
|
DeintVAAPIContext *ctx = avctx->priv;
|
||||||
AVFrame *output_frame = NULL;
|
AVFrame *output_frame = NULL;
|
||||||
VASurfaceID input_surface, output_surface;
|
VASurfaceID input_surface;
|
||||||
VASurfaceID backward_references[MAX_REFERENCES];
|
VASurfaceID backward_references[MAX_REFERENCES];
|
||||||
VASurfaceID forward_references[MAX_REFERENCES];
|
VASurfaceID forward_references[MAX_REFERENCES];
|
||||||
VAProcPipelineParameterBuffer params;
|
VAProcPipelineParameterBuffer params;
|
||||||
VAProcFilterParameterBufferDeinterlacing *filter_params;
|
VAProcFilterParameterBufferDeinterlacing *filter_params;
|
||||||
VARectangle input_region;
|
|
||||||
VAStatus vas;
|
VAStatus vas;
|
||||||
void *filter_params_addr = NULL;
|
void *filter_params_addr = NULL;
|
||||||
int err, i, field, current_frame_index;
|
int err, i, field, current_frame_index;
|
||||||
@@ -238,30 +237,10 @@ static int deint_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame)
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
output_surface = (VASurfaceID)(uintptr_t)output_frame->data[3];
|
err = ff_vaapi_vpp_init_params(avctx, ¶ms,
|
||||||
av_log(avctx, AV_LOG_DEBUG, "Using surface %#x for "
|
input_frame, output_frame);
|
||||||
"deinterlace output.\n", output_surface);
|
if (err < 0)
|
||||||
|
goto fail;
|
||||||
memset(¶ms, 0, sizeof(params));
|
|
||||||
|
|
||||||
input_region = (VARectangle) {
|
|
||||||
.x = 0,
|
|
||||||
.y = 0,
|
|
||||||
.width = input_frame->width,
|
|
||||||
.height = input_frame->height,
|
|
||||||
};
|
|
||||||
|
|
||||||
params.surface = input_surface;
|
|
||||||
params.surface_region = &input_region;
|
|
||||||
params.surface_color_standard =
|
|
||||||
ff_vaapi_vpp_colour_standard(input_frame->colorspace);
|
|
||||||
|
|
||||||
params.output_region = NULL;
|
|
||||||
params.output_background_color = VAAPI_VPP_BACKGROUND_BLACK;
|
|
||||||
params.output_color_standard = params.surface_color_standard;
|
|
||||||
|
|
||||||
params.pipeline_flags = 0;
|
|
||||||
params.filter_flags = VA_FRAME_PICTURE;
|
|
||||||
|
|
||||||
if (!ctx->auto_enable || input_frame->interlaced_frame) {
|
if (!ctx->auto_enable || input_frame->interlaced_frame) {
|
||||||
vas = vaMapBuffer(vpp_ctx->hwctx->display, vpp_ctx->filter_buffers[0],
|
vas = vaMapBuffer(vpp_ctx->hwctx->display, vpp_ctx->filter_buffers[0],
|
||||||
@@ -301,7 +280,7 @@ static int deint_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame)
|
|||||||
params.num_filters = 0;
|
params.num_filters = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ff_vaapi_vpp_render_picture(avctx, ¶ms, output_surface);
|
err = ff_vaapi_vpp_render_picture(avctx, ¶ms, output_frame);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
|||||||
@@ -129,9 +129,6 @@ static int misc_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame)
|
|||||||
AVFilterLink *outlink = avctx->outputs[0];
|
AVFilterLink *outlink = avctx->outputs[0];
|
||||||
VAAPIVPPContext *vpp_ctx = avctx->priv;
|
VAAPIVPPContext *vpp_ctx = avctx->priv;
|
||||||
AVFrame *output_frame = NULL;
|
AVFrame *output_frame = NULL;
|
||||||
VASurfaceID input_surface, output_surface;
|
|
||||||
VARectangle input_region;
|
|
||||||
|
|
||||||
VAProcPipelineParameterBuffer params;
|
VAProcPipelineParameterBuffer params;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
@@ -142,10 +139,6 @@ static int misc_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame)
|
|||||||
if (vpp_ctx->va_context == VA_INVALID_ID)
|
if (vpp_ctx->va_context == VA_INVALID_ID)
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
|
|
||||||
input_surface = (VASurfaceID)(uintptr_t)input_frame->data[3];
|
|
||||||
av_log(avctx, AV_LOG_DEBUG, "Using surface %#x for misc vpp input.\n",
|
|
||||||
input_surface);
|
|
||||||
|
|
||||||
output_frame = ff_get_video_buffer(outlink, vpp_ctx->output_width,
|
output_frame = ff_get_video_buffer(outlink, vpp_ctx->output_width,
|
||||||
vpp_ctx->output_height);
|
vpp_ctx->output_height);
|
||||||
if (!output_frame) {
|
if (!output_frame) {
|
||||||
@@ -153,34 +146,17 @@ static int misc_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame)
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
output_surface = (VASurfaceID)(uintptr_t)output_frame->data[3];
|
err = ff_vaapi_vpp_init_params(avctx, ¶ms,
|
||||||
av_log(avctx, AV_LOG_DEBUG, "Using surface %#x for misc vpp output.\n",
|
input_frame, output_frame);
|
||||||
output_surface);
|
if (err < 0)
|
||||||
memset(¶ms, 0, sizeof(params));
|
goto fail;
|
||||||
input_region = (VARectangle) {
|
|
||||||
.x = 0,
|
|
||||||
.y = 0,
|
|
||||||
.width = input_frame->width,
|
|
||||||
.height = input_frame->height,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (vpp_ctx->nb_filter_buffers) {
|
if (vpp_ctx->nb_filter_buffers) {
|
||||||
params.filters = &vpp_ctx->filter_buffers[0];
|
params.filters = &vpp_ctx->filter_buffers[0];
|
||||||
params.num_filters = vpp_ctx->nb_filter_buffers;
|
params.num_filters = vpp_ctx->nb_filter_buffers;
|
||||||
}
|
}
|
||||||
params.surface = input_surface;
|
|
||||||
params.surface_region = &input_region;
|
|
||||||
params.surface_color_standard =
|
|
||||||
ff_vaapi_vpp_colour_standard(input_frame->colorspace);
|
|
||||||
|
|
||||||
params.output_region = NULL;
|
err = ff_vaapi_vpp_render_picture(avctx, ¶ms, output_frame);
|
||||||
params.output_background_color = VAAPI_VPP_BACKGROUND_BLACK;
|
|
||||||
params.output_color_standard = params.surface_color_standard;
|
|
||||||
|
|
||||||
params.pipeline_flags = 0;
|
|
||||||
params.filter_flags = VA_FRAME_PICTURE;
|
|
||||||
|
|
||||||
err = ff_vaapi_vpp_render_picture(avctx, ¶ms, output_surface);
|
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
|||||||
@@ -131,9 +131,7 @@ static int procamp_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame
|
|||||||
AVFilterLink *outlink = avctx->outputs[0];
|
AVFilterLink *outlink = avctx->outputs[0];
|
||||||
VAAPIVPPContext *vpp_ctx = avctx->priv;
|
VAAPIVPPContext *vpp_ctx = avctx->priv;
|
||||||
AVFrame *output_frame = NULL;
|
AVFrame *output_frame = NULL;
|
||||||
VASurfaceID input_surface, output_surface;
|
|
||||||
VAProcPipelineParameterBuffer params;
|
VAProcPipelineParameterBuffer params;
|
||||||
VARectangle input_region;
|
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
av_log(avctx, AV_LOG_DEBUG, "Filter input: %s, %ux%u (%"PRId64").\n",
|
av_log(avctx, AV_LOG_DEBUG, "Filter input: %s, %ux%u (%"PRId64").\n",
|
||||||
@@ -143,10 +141,6 @@ static int procamp_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame
|
|||||||
if (vpp_ctx->va_context == VA_INVALID_ID)
|
if (vpp_ctx->va_context == VA_INVALID_ID)
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
|
|
||||||
input_surface = (VASurfaceID)(uintptr_t)input_frame->data[3];
|
|
||||||
av_log(avctx, AV_LOG_DEBUG, "Using surface %#x for procamp input.\n",
|
|
||||||
input_surface);
|
|
||||||
|
|
||||||
output_frame = ff_get_video_buffer(outlink, vpp_ctx->output_width,
|
output_frame = ff_get_video_buffer(outlink, vpp_ctx->output_width,
|
||||||
vpp_ctx->output_height);
|
vpp_ctx->output_height);
|
||||||
if (!output_frame) {
|
if (!output_frame) {
|
||||||
@@ -154,33 +148,15 @@ static int procamp_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
output_surface = (VASurfaceID)(uintptr_t)output_frame->data[3];
|
err = ff_vaapi_vpp_init_params(avctx, ¶ms,
|
||||||
av_log(avctx, AV_LOG_DEBUG, "Using surface %#x for procamp output.\n",
|
input_frame, output_frame);
|
||||||
output_surface);
|
if (err < 0)
|
||||||
memset(¶ms, 0, sizeof(params));
|
goto fail;
|
||||||
input_region = (VARectangle) {
|
|
||||||
.x = 0,
|
|
||||||
.y = 0,
|
|
||||||
.width = input_frame->width,
|
|
||||||
.height = input_frame->height,
|
|
||||||
};
|
|
||||||
|
|
||||||
params.surface = input_surface;
|
|
||||||
params.surface_region = &input_region;
|
|
||||||
params.surface_color_standard =
|
|
||||||
ff_vaapi_vpp_colour_standard(input_frame->colorspace);
|
|
||||||
|
|
||||||
params.output_region = NULL;
|
|
||||||
params.output_background_color = VAAPI_VPP_BACKGROUND_BLACK;
|
|
||||||
params.output_color_standard = params.surface_color_standard;
|
|
||||||
|
|
||||||
params.pipeline_flags = 0;
|
|
||||||
params.filter_flags = VA_FRAME_PICTURE;
|
|
||||||
|
|
||||||
params.filters = &vpp_ctx->filter_buffers[0];
|
params.filters = &vpp_ctx->filter_buffers[0];
|
||||||
params.num_filters = 1;
|
params.num_filters = 1;
|
||||||
|
|
||||||
err = ff_vaapi_vpp_render_picture(avctx, ¶ms, output_surface);
|
err = ff_vaapi_vpp_render_picture(avctx, ¶ms, output_frame);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
|||||||
@@ -89,9 +89,7 @@ static int scale_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame)
|
|||||||
VAAPIVPPContext *vpp_ctx = avctx->priv;
|
VAAPIVPPContext *vpp_ctx = avctx->priv;
|
||||||
ScaleVAAPIContext *ctx = avctx->priv;
|
ScaleVAAPIContext *ctx = avctx->priv;
|
||||||
AVFrame *output_frame = NULL;
|
AVFrame *output_frame = NULL;
|
||||||
VASurfaceID input_surface, output_surface;
|
|
||||||
VAProcPipelineParameterBuffer params;
|
VAProcPipelineParameterBuffer params;
|
||||||
VARectangle input_region;
|
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
av_log(avctx, AV_LOG_DEBUG, "Filter input: %s, %ux%u (%"PRId64").\n",
|
av_log(avctx, AV_LOG_DEBUG, "Filter input: %s, %ux%u (%"PRId64").\n",
|
||||||
@@ -101,10 +99,6 @@ static int scale_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame)
|
|||||||
if (vpp_ctx->va_context == VA_INVALID_ID)
|
if (vpp_ctx->va_context == VA_INVALID_ID)
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
|
|
||||||
input_surface = (VASurfaceID)(uintptr_t)input_frame->data[3];
|
|
||||||
av_log(avctx, AV_LOG_DEBUG, "Using surface %#x for scale input.\n",
|
|
||||||
input_surface);
|
|
||||||
|
|
||||||
output_frame = ff_get_video_buffer(outlink, vpp_ctx->output_width,
|
output_frame = ff_get_video_buffer(outlink, vpp_ctx->output_width,
|
||||||
vpp_ctx->output_height);
|
vpp_ctx->output_height);
|
||||||
if (!output_frame) {
|
if (!output_frame) {
|
||||||
@@ -112,34 +106,14 @@ static int scale_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame)
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
output_surface = (VASurfaceID)(uintptr_t)output_frame->data[3];
|
err = ff_vaapi_vpp_init_params(avctx, ¶ms,
|
||||||
av_log(avctx, AV_LOG_DEBUG, "Using surface %#x for scale output.\n",
|
input_frame, output_frame);
|
||||||
output_surface);
|
if (err < 0)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
memset(¶ms, 0, sizeof(params));
|
params.filter_flags |= ctx->mode;
|
||||||
|
|
||||||
input_region = (VARectangle) {
|
err = ff_vaapi_vpp_render_picture(avctx, ¶ms, output_frame);
|
||||||
.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;
|
|
||||||
params.surface_region = &input_region;
|
|
||||||
params.surface_color_standard =
|
|
||||||
ff_vaapi_vpp_colour_standard(input_frame->colorspace);
|
|
||||||
|
|
||||||
params.output_region = 0;
|
|
||||||
params.output_background_color = VAAPI_VPP_BACKGROUND_BLACK;
|
|
||||||
params.output_color_standard = params.surface_color_standard;
|
|
||||||
|
|
||||||
params.pipeline_flags = 0;
|
|
||||||
params.filter_flags = ctx->mode;
|
|
||||||
|
|
||||||
err = ff_vaapi_vpp_render_picture(avctx, ¶ms, output_surface);
|
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
|||||||
@@ -123,9 +123,6 @@ static int transpose_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_fra
|
|||||||
VAAPIVPPContext *vpp_ctx = avctx->priv;
|
VAAPIVPPContext *vpp_ctx = avctx->priv;
|
||||||
TransposeVAAPIContext *ctx = avctx->priv;
|
TransposeVAAPIContext *ctx = avctx->priv;
|
||||||
AVFrame *output_frame = NULL;
|
AVFrame *output_frame = NULL;
|
||||||
VASurfaceID input_surface, output_surface;
|
|
||||||
VARectangle input_region, output_region;
|
|
||||||
|
|
||||||
VAProcPipelineParameterBuffer params;
|
VAProcPipelineParameterBuffer params;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
@@ -139,10 +136,6 @@ static int transpose_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_fra
|
|||||||
if (vpp_ctx->va_context == VA_INVALID_ID)
|
if (vpp_ctx->va_context == VA_INVALID_ID)
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
|
|
||||||
input_surface = (VASurfaceID)(uintptr_t)input_frame->data[3];
|
|
||||||
av_log(avctx, AV_LOG_DEBUG, "Using surface %#x for transpose vpp input.\n",
|
|
||||||
input_surface);
|
|
||||||
|
|
||||||
output_frame = ff_get_video_buffer(outlink, vpp_ctx->output_width,
|
output_frame = ff_get_video_buffer(outlink, vpp_ctx->output_width,
|
||||||
vpp_ctx->output_height);
|
vpp_ctx->output_height);
|
||||||
if (!output_frame) {
|
if (!output_frame) {
|
||||||
@@ -150,40 +143,15 @@ static int transpose_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_fra
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
output_surface = (VASurfaceID)(uintptr_t)output_frame->data[3];
|
err = ff_vaapi_vpp_init_params(avctx, ¶ms,
|
||||||
av_log(avctx, AV_LOG_DEBUG, "Using surface %#x for transpose vpp output.\n",
|
input_frame, output_frame);
|
||||||
output_surface);
|
if (err < 0)
|
||||||
memset(¶ms, 0, sizeof(params));
|
goto fail;
|
||||||
input_region = (VARectangle) {
|
|
||||||
.x = 0,
|
|
||||||
.y = 0,
|
|
||||||
.width = input_frame->width,
|
|
||||||
.height = input_frame->height,
|
|
||||||
};
|
|
||||||
|
|
||||||
output_region = (VARectangle) {
|
|
||||||
.x = 0,
|
|
||||||
.y = 0,
|
|
||||||
.width = output_frame->width,
|
|
||||||
.height = output_frame->height,
|
|
||||||
};
|
|
||||||
|
|
||||||
params.rotation_state = ctx->rotation_state;
|
params.rotation_state = ctx->rotation_state;
|
||||||
params.mirror_state = ctx->mirror_state;
|
params.mirror_state = ctx->mirror_state;
|
||||||
|
|
||||||
params.filters = &vpp_ctx->filter_buffers[0];
|
err = ff_vaapi_vpp_render_picture(avctx, ¶ms, output_frame);
|
||||||
params.num_filters = vpp_ctx->nb_filter_buffers;
|
|
||||||
|
|
||||||
params.surface = input_surface;
|
|
||||||
params.surface_region = &input_region;
|
|
||||||
params.surface_color_standard =
|
|
||||||
ff_vaapi_vpp_colour_standard(input_frame->colorspace);
|
|
||||||
|
|
||||||
params.output_region = &output_region;
|
|
||||||
params.output_background_color = VAAPI_VPP_BACKGROUND_BLACK;
|
|
||||||
params.output_color_standard = params.surface_color_standard;
|
|
||||||
|
|
||||||
err = ff_vaapi_vpp_render_picture(avctx, ¶ms, output_surface);
|
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user