FFmpeg
4.0
libavcodec
nvdec.h
Go to the documentation of this file.
1
/*
2
* HW decode acceleration through NVDEC
3
*
4
* Copyright (c) 2016 Anton Khirnov
5
*
6
* This file is part of FFmpeg.
7
*
8
* FFmpeg is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU Lesser General Public
10
* License as published by the Free Software Foundation; either
11
* version 2.1 of the License, or (at your option) any later version.
12
*
13
* FFmpeg is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* Lesser General Public License for more details.
17
*
18
* You should have received a copy of the GNU Lesser General Public
19
* License along with FFmpeg; if not, write to the Free Software
20
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
*/
22
23
#ifndef AVCODEC_NVDEC_H
24
#define AVCODEC_NVDEC_H
25
26
#include "
compat/cuda/dynlink_loader.h
"
27
28
#include <stdint.h>
29
30
#include "
libavutil/buffer.h
"
31
#include "
libavutil/frame.h
"
32
33
#include "
avcodec.h
"
34
35
#if defined(NVDECAPI_MAJOR_VERSION) && defined(NVDECAPI_MINOR_VERSION)
36
# define NVDECAPI_CHECK_VERSION(major, minor) \
37
((major) < NVDECAPI_MAJOR_VERSION || ((major) == NVDECAPI_MAJOR_VERSION && (minor) <= NVDECAPI_MINOR_VERSION))
38
#else
39
/* version macros were added in SDK 8.1 ffnvcodec */
40
# define NVDECAPI_CHECK_VERSION(major, minor) \
41
((major) < 8 || ((major) == 8 && (minor) <= 0))
42
#endif
43
44
typedef
struct
NVDECFrame
{
45
unsigned
int
idx
;
46
AVBufferRef
*
idx_ref
;
47
AVBufferRef
*
decoder_ref
;
48
}
NVDECFrame
;
49
50
typedef
struct
NVDECContext
{
51
CUVIDPICPARAMS
pic_params
;
52
53
AVBufferPool
*
decoder_pool
;
54
55
AVBufferRef
*
decoder_ref
;
56
57
uint8_t
*
bitstream
;
58
int
bitstream_len
;
59
unsigned
int
bitstream_allocated
;
60
61
unsigned
*
slice_offsets
;
62
int
nb_slices
;
63
unsigned
int
slice_offsets_allocated
;
64
}
NVDECContext
;
65
66
int
ff_nvdec_decode_init
(
AVCodecContext
*avctx);
67
int
ff_nvdec_decode_uninit
(
AVCodecContext
*avctx);
68
int
ff_nvdec_start_frame
(
AVCodecContext
*avctx,
AVFrame
*
frame
);
69
int
ff_nvdec_end_frame
(
AVCodecContext
*avctx);
70
int
ff_nvdec_simple_end_frame
(
AVCodecContext
*avctx);
71
int
ff_nvdec_simple_decode_slice
(
AVCodecContext
*avctx,
const
uint8_t
*
buffer
,
72
uint32_t
size
);
73
int
ff_nvdec_frame_params
(
AVCodecContext
*avctx,
74
AVBufferRef
*hw_frames_ctx,
75
int
dpb_size);
76
int
ff_nvdec_get_ref_idx
(
AVFrame
*
frame
);
77
78
#endif
/* AVCODEC_NVDEC_H */
NVDECFrame::decoder_ref
AVBufferRef * decoder_ref
Definition:
nvdec.h:47
size
int size
Definition:
twinvq_data.h:11134
AVFrame
This structure describes decoded (raw) audio or video data.
Definition:
frame.h:218
ff_nvdec_decode_uninit
int ff_nvdec_decode_uninit(AVCodecContext *avctx)
Definition:
nvdec.c:246
NVDECContext::slice_offsets
unsigned * slice_offsets
Definition:
nvdec.h:61
NVDECContext::nb_slices
int nb_slices
Definition:
nvdec.h:62
NVDECContext::bitstream
uint8_t * bitstream
Definition:
nvdec.h:57
NVDECFrame
Definition:
nvdec.h:44
ff_nvdec_simple_decode_slice
int ff_nvdec_simple_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
Definition:
nvdec.c:502
buffer
static char buffer[20]
Definition:
seek.c:32
uint8_t
uint8_t
Definition:
audio_convert.c:194
NVDECContext::pic_params
CUVIDPICPARAMS pic_params
Definition:
nvdec.h:51
ff_nvdec_frame_params
int ff_nvdec_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx, int dpb_size)
Definition:
nvdec.c:524
ff_nvdec_start_frame
int ff_nvdec_start_frame(AVCodecContext *avctx, AVFrame *frame)
Definition:
nvdec.c:418
frame
static AVFrame * frame
Definition:
demuxing_decoding.c:53
NVDECContext::decoder_ref
AVBufferRef * decoder_ref
Definition:
nvdec.h:55
AVBufferPool
The buffer pool.
Definition:
buffer_internal.h:76
NVDECFrame::idx
unsigned int idx
Definition:
nvdec.h:45
ff_nvdec_end_frame
int ff_nvdec_end_frame(AVCodecContext *avctx)
Definition:
nvdec.c:460
frame.h
reference-counted frame API
NVDECContext::bitstream_len
int bitstream_len
Definition:
nvdec.h:58
avcodec.h
Libavcodec external API header.
NVDECContext::bitstream_allocated
unsigned int bitstream_allocated
Definition:
nvdec.h:59
AVCodecContext
main external API structure.
Definition:
avcodec.h:1518
ff_nvdec_decode_init
int ff_nvdec_decode_init(AVCodecContext *avctx)
Definition:
nvdec.c:264
NVDECContext::slice_offsets_allocated
unsigned int slice_offsets_allocated
Definition:
nvdec.h:63
buffer.h
refcounted data buffer API
NVDECFrame::idx_ref
AVBufferRef * idx_ref
Definition:
nvdec.h:46
NVDECContext
Definition:
nvdec.h:50
dynlink_loader.h
AVBufferRef
A reference to a data buffer.
Definition:
buffer.h:81
NVDECContext::decoder_pool
AVBufferPool * decoder_pool
Definition:
nvdec.h:53
ff_nvdec_simple_end_frame
int ff_nvdec_simple_end_frame(AVCodecContext *avctx)
Definition:
nvdec.c:494
ff_nvdec_get_ref_idx
int ff_nvdec_get_ref_idx(AVFrame *frame)
Definition:
nvdec.c:570
Generated on Tue May 22 2018 07:06:38 for FFmpeg by
1.8.13