[FFmpeg-devel] [PATCH 4/4] lavfi/misc_vaapi: fix typo and add check for params buffer.
Jun Zhao
mypopydev at gmail.com
Tue Jan 23 06:33:44 EET 2018
-------------- next part --------------
From 021278e2b1a5cee873fbc6c36e5666b2ca7a4e8d Mon Sep 17 00:00:00 2001
From: Jun Zhao <jun.zhao at intel.com>
Date: Tue, 23 Jan 2018 12:12:21 +0800
Subject: [PATCH 4/4] lavfi/misc_vaapi: fix typo and add check for params
buffer.
Signed-off-by: Jun Zhao <jun.zhao at intel.com>
---
libavfilter/vf_misc_vaapi.c | 68 +++++++++++++++++++++------------------------
1 file changed, 32 insertions(+), 36 deletions(-)
diff --git a/libavfilter/vf_misc_vaapi.c b/libavfilter/vf_misc_vaapi.c
index 316f15e38b..8b179fe215 100644
--- a/libavfilter/vf_misc_vaapi.c
+++ b/libavfilter/vf_misc_vaapi.c
@@ -38,13 +38,13 @@
#define SHARPNESS_DEFAULT 44
typedef struct DenoiseVAAPIContext {
- VAAPIVPPContext vpp_ctx; // must be the first fileld
+ VAAPIVPPContext vpp_ctx; // must be the first field
int denoise; // enable denoise algo.
} DenoiseVAAPIContext;
typedef struct SharpnessVAAPIContext {
- VAAPIVPPContext vpp_ctx; // must be the first fileld
+ VAAPIVPPContext vpp_ctx; // must be the first field
int sharpness; // enable sharpness.
} SharpnessVAAPIContext;
@@ -71,24 +71,22 @@ static int denoise_vaapi_build_filter_params(AVFilterContext *avctx)
VAProcFilterParameterBuffer denoise;
- if (ctx->denoise != DENOISE_DEFAULT) {
- vas = vaQueryVideoProcFilterCaps(vpp_ctx->hwctx->display, vpp_ctx->va_context,
- VAProcFilterNoiseReduction,
- &caps, &num_caps);
- if (vas != VA_STATUS_SUCCESS) {
- av_log(avctx, AV_LOG_ERROR, "Failed to query denoise caps "
- "context: %d (%s).\n", vas, vaErrorStr(vas));
- return AVERROR(EIO);
- }
-
- denoise.type = VAProcFilterNoiseReduction;
- denoise.value = map(ctx->denoise, DENOISE_MIN, DENOISE_MAX,
- caps.range.min_value,
- caps.range.max_value);
- ff_vaapi_vpp_make_param_buffers(avctx, VAProcFilterParameterBufferType,
- &denoise, sizeof(denoise), 1);
+ vas = vaQueryVideoProcFilterCaps(vpp_ctx->hwctx->display, vpp_ctx->va_context,
+ VAProcFilterNoiseReduction,
+ &caps, &num_caps);
+ if (vas != VA_STATUS_SUCCESS) {
+ av_log(avctx, AV_LOG_ERROR, "Failed to query denoise caps "
+ "context: %d (%s).\n", vas, vaErrorStr(vas));
+ return AVERROR(EIO);
}
+ denoise.type = VAProcFilterNoiseReduction;
+ denoise.value = map(ctx->denoise, DENOISE_MIN, DENOISE_MAX,
+ caps.range.min_value,
+ caps.range.max_value);
+ ff_vaapi_vpp_make_param_buffers(avctx, VAProcFilterParameterBufferType,
+ &denoise, sizeof(denoise), 1);
+
return 0;
}
@@ -104,26 +102,24 @@ static int sharpness_vaapi_build_filter_params(AVFilterContext *avctx)
VAProcFilterParameterBuffer sharpness;
- if (ctx->sharpness != SHARPNESS_DEFAULT) {
- vas = vaQueryVideoProcFilterCaps(vpp_ctx->hwctx->display, vpp_ctx->va_context,
- VAProcFilterSharpening,
- &caps, &num_caps);
- if (vas != VA_STATUS_SUCCESS) {
- av_log(avctx, AV_LOG_ERROR, "Failed to query sharpness caps "
- "context: %d (%s).\n", vas, vaErrorStr(vas));
- return AVERROR(EIO);
- }
-
- sharpness.type = VAProcFilterSharpening;
- sharpness.value = map(ctx->sharpness,
- SHARPNESS_MIN, SHARPNESS_MAX,
- caps.range.min_value,
- caps.range.max_value);
- ff_vaapi_vpp_make_param_buffers(avctx,
- VAProcFilterParameterBufferType,
- &sharpness, sizeof(sharpness), 1);
+ vas = vaQueryVideoProcFilterCaps(vpp_ctx->hwctx->display, vpp_ctx->va_context,
+ VAProcFilterSharpening,
+ &caps, &num_caps);
+ if (vas != VA_STATUS_SUCCESS) {
+ av_log(avctx, AV_LOG_ERROR, "Failed to query sharpness caps "
+ "context: %d (%s).\n", vas, vaErrorStr(vas));
+ return AVERROR(EIO);
}
+ sharpness.type = VAProcFilterSharpening;
+ sharpness.value = map(ctx->sharpness,
+ SHARPNESS_MIN, SHARPNESS_MAX,
+ caps.range.min_value,
+ caps.range.max_value);
+ ff_vaapi_vpp_make_param_buffers(avctx,
+ VAProcFilterParameterBufferType,
+ &sharpness, sizeof(sharpness), 1);
+
return 0;
}
--
2.14.1
More information about the ffmpeg-devel
mailing list