summaryrefslogtreecommitdiff
path: root/libavfilter/vf_transpose_npp.c
diff options
context:
space:
mode:
authorPhilip Langdale <philipl@overt.org>2018-11-10 22:47:28 -0800
committerPhilip Langdale <philipl@overt.org>2018-11-14 17:39:42 -0800
commit19d3d0c0570981ddc8a224f07d734ff75d76e234 (patch)
tree01f718e1878010605cd28d5947b676d42519dfc9 /libavfilter/vf_transpose_npp.c
parentf0f2832a5ce93bad9b1d29f99df6bda2380fc41c (diff)
avutil/hwcontext_cuda: Define and use common CHECK_CU()
We have a pattern of wrapping CUDA calls to print errors and normalise return values that is used in a couple of places. To avoid duplication and increase consistency, let's put the wrapper implementation in a shared place and use it everywhere. Affects: * avcodec/cuviddec * avcodec/nvdec * avcodec/nvenc * avfilter/vf_scale_cuda * avfilter/vf_scale_npp * avfilter/vf_thumbnail_cuda * avfilter/vf_transpose_npp * avfilter/vf_yadif_cuda
Diffstat (limited to 'libavfilter/vf_transpose_npp.c')
-rw-r--r--libavfilter/vf_transpose_npp.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libavfilter/vf_transpose_npp.c b/libavfilter/vf_transpose_npp.c
index 1b3a5c0c69..3ea031667c 100644
--- a/libavfilter/vf_transpose_npp.c
+++ b/libavfilter/vf_transpose_npp.c
@@ -23,6 +23,7 @@
#include "libavutil/common.h"
#include "libavutil/hwcontext.h"
#include "libavutil/hwcontext_cuda_internal.h"
+#include "libavutil/cuda_check.h"
#include "libavutil/internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
@@ -32,6 +33,8 @@
#include "internal.h"
#include "video.h"
+#define CHECK_CU(x) FF_CUDA_CHECK_DL(ctx, device_hwctx->internal->cuda_dl, x)
+
static const enum AVPixelFormat supported_formats[] = {
AV_PIX_FMT_YUV420P,
AV_PIX_FMT_YUV444P
@@ -397,7 +400,6 @@ static int npptranspose_filter_frame(AVFilterLink *link, AVFrame *in)
AVHWFramesContext *frames_ctx = (AVHWFramesContext*)outlink->hw_frames_ctx->data;
AVCUDADeviceContext *device_hwctx = frames_ctx->device_ctx->hwctx;
AVFrame *out = NULL;
- CUresult err;
CUcontext dummy;
int ret = 0;
@@ -410,15 +412,13 @@ static int npptranspose_filter_frame(AVFilterLink *link, AVFrame *in)
goto fail;
}
- err = device_hwctx->internal->cuda_dl->cuCtxPushCurrent(device_hwctx->cuda_ctx);
- if (err != CUDA_SUCCESS) {
- ret = AVERROR_UNKNOWN;
+ ret = CHECK_CU(device_hwctx->internal->cuda_dl->cuCtxPushCurrent(device_hwctx->cuda_ctx));
+ if (ret < 0)
goto fail;
- }
ret = npptranspose_filter(ctx, out, in);
- device_hwctx->internal->cuda_dl->cuCtxPopCurrent(&dummy);
+ CHECK_CU(device_hwctx->internal->cuda_dl->cuCtxPopCurrent(&dummy));
if (ret < 0)
goto fail;