FFmpeg
Loading...
Searching...
No Matches
load_helper.c
Go to the documentation of this file.
1/*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#include "config.h"
20
21#include "libavutil/hwcontext.h"
24#include "libavutil/mem.h"
25
26#if CONFIG_SHADER_COMPRESSION
28#endif
29
30#include "load_helper.h"
31
32#define CHECK_CU(x) FF_CUDA_CHECK_DL(avctx, cu, x)
33
34int ff_cuda_load_module(void *avctx, AVCUDADeviceContext *hwctx, CUmodule *cu_module,
35 const unsigned char *data, const unsigned int length)
36{
37 CudaFunctions *cu = hwctx->internal->cuda_dl;
38
39#if CONFIG_SHADER_COMPRESSION
40 uint8_t *out;
41 size_t out_len;
42 int ret = ff_zlib_expand(avctx, &out, &out_len,
43 data, length);
44 if (ret < 0)
45 return ret;
46
47 ret = CHECK_CU(cu->cuModuleLoadData(cu_module, out));
48 av_free(out);
49 return ret;
50#else
51 return CHECK_CU(cu->cuModuleLoadData(cu_module, data));
52#endif
53}
static FILE * out
FFmpeg internal API for CUDA.
#define CHECK_CU(x)
Definition load_helper.c:32
int ff_cuda_load_module(void *avctx, AVCUDADeviceContext *hwctx, CUmodule *cu_module, const unsigned char *data, const unsigned int length)
Loads a CUDA module and applies any decompression, if necessary.
Definition load_helper.c:34
Memory handling functions.
const char data[16]
Definition mxf.c:149
This struct is allocated as AVHWDeviceContext.hwctx.
AVCUDADeviceContextInternal * internal
#define av_free(p)
static int ff_zlib_expand(void *ctx, uint8_t **out, size_t *out_len, const uint8_t *src, int src_len)
Definition zlib_utils.h:30