FFmpeg
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 
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;
48 } NVDECFrame;
49 
50 typedef struct NVDECContext {
51  CUVIDPICPARAMS pic_params;
52 
54 
56 
59  unsigned int bitstream_allocated;
60 
61  unsigned *slice_offsets;
62  int nb_slices;
64 
66 } NVDECContext;
67 
74  uint32_t size);
76  AVBufferRef *hw_frames_ctx,
77  int dpb_size,
78  int supports_444);
80 
81 #endif /* AVCODEC_NVDEC_H */
AVBufferRef * decoder_ref
Definition: nvdec.h:47
This structure describes decoded (raw) audio or video data.
Definition: frame.h:295
int ff_nvdec_decode_uninit(AVCodecContext *avctx)
Definition: nvdec.c:254
unsigned * slice_offsets
Definition: nvdec.h:61
int nb_slices
Definition: nvdec.h:62
uint8_t * bitstream
Definition: nvdec.h:57
int ff_nvdec_simple_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
Definition: nvdec.c:556
uint8_t
CUVIDPICPARAMS pic_params
Definition: nvdec.h:51
int ff_nvdec_start_frame(AVCodecContext *avctx, AVFrame *frame)
Definition: nvdec.c:476
AVBufferRef * decoder_ref
Definition: nvdec.h:55
ptrdiff_t size
Definition: opengl_enc.c:100
The buffer pool.
int supports_444
Definition: nvdec.h:65
unsigned int idx
Definition: nvdec.h:45
int ff_nvdec_end_frame(AVCodecContext *avctx)
Definition: nvdec.c:518
reference-counted frame API
int dpb_size
Definition: h264_levels.c:107
int ff_nvdec_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx, int dpb_size, int supports_444)
Definition: nvdec.c:588
int bitstream_len
Definition: nvdec.h:58
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
Libavcodec external API header.
unsigned int bitstream_allocated
Definition: nvdec.h:59
main external API structure.
Definition: avcodec.h:1568
int ff_nvdec_decode_init(AVCodecContext *avctx)
Definition: nvdec.c:272
unsigned int slice_offsets_allocated
Definition: nvdec.h:63
refcounted data buffer API
AVBufferRef * idx_ref
Definition: nvdec.h:46
A reference to a data buffer.
Definition: buffer.h:81
AVBufferPool * decoder_pool
Definition: nvdec.h:53
int ff_nvdec_simple_end_frame(AVCodecContext *avctx)
Definition: nvdec.c:548
int ff_nvdec_get_ref_idx(AVFrame *frame)
Definition: nvdec.c:646
GLuint buffer
Definition: opengl_enc.c:101