]> git.sesse.net Git - ffmpeg/blob - libavcodec/vaapi_decode.h
h264/aarch64: optimize neon loop filter
[ffmpeg] / libavcodec / vaapi_decode.h
1 /*
2  * This file is part of Libav.
3  *
4  * Libav 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  * Libav 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 Libav; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18
19 #ifndef AVCODEC_VAAPI_DECODE_H
20 #define AVCODEC_VAAPI_DECODE_H
21
22 #include <va/va.h>
23
24 #include "libavutil/frame.h"
25 #include "libavutil/hwcontext.h"
26 #include "libavutil/hwcontext_vaapi.h"
27 #include "libavutil/internal.h"
28
29 #include "avcodec.h"
30
31 #include "version.h"
32 #if FF_API_VAAPI_CONTEXT
33 #include "vaapi.h"
34 #endif
35
36 static inline VASurfaceID ff_vaapi_get_surface_id(AVFrame *pic)
37 {
38     return (uintptr_t)pic->data[3];
39 }
40
41 enum {
42     MAX_PARAM_BUFFERS = 16,
43 };
44
45 typedef struct VAAPIDecodePicture {
46     VASurfaceID           output_surface;
47
48     int                nb_param_buffers;
49     VABufferID            param_buffers[MAX_PARAM_BUFFERS];
50
51     int                nb_slices;
52     VABufferID           *slice_buffers;
53     int                   slices_allocated;
54 } VAAPIDecodePicture;
55
56 typedef struct VAAPIDecodeContext {
57     VAConfigID            va_config;
58     VAContextID           va_context;
59
60 #if FF_API_VAAPI_CONTEXT
61 FF_DISABLE_DEPRECATION_WARNINGS
62     int                   have_old_context;
63     struct vaapi_context *old_context;
64     AVBufferRef          *device_ref;
65 FF_ENABLE_DEPRECATION_WARNINGS
66 #endif
67
68     AVHWDeviceContext    *device;
69     AVVAAPIDeviceContext *hwctx;
70
71     AVHWFramesContext    *frames;
72     AVVAAPIFramesContext *hwfc;
73
74     enum AVPixelFormat    surface_format;
75     int                   surface_count;
76 } VAAPIDecodeContext;
77
78
79 int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx,
80                                       VAAPIDecodePicture *pic,
81                                       int type,
82                                       const void *data,
83                                       size_t size);
84
85 int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx,
86                                       VAAPIDecodePicture *pic,
87                                       const void *params_data,
88                                       size_t params_size,
89                                       const void *slice_data,
90                                       size_t slice_size);
91
92 int ff_vaapi_decode_issue(AVCodecContext *avctx,
93                           VAAPIDecodePicture *pic);
94 int ff_vaapi_decode_cancel(AVCodecContext *avctx,
95                            VAAPIDecodePicture *pic);
96
97 int ff_vaapi_decode_init(AVCodecContext *avctx);
98 int ff_vaapi_decode_uninit(AVCodecContext *avctx);
99
100 int ff_vaapi_common_frame_params(AVCodecContext *avctx,
101                                  AVBufferRef *hw_frames_ctx);
102
103 #endif /* AVCODEC_VAAPI_DECODE_H */