FFmpeg
Loading...
Searching...
No Matches
amfenc.h
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#ifndef AVCODEC_AMFENC_H
20#define AVCODEC_AMFENC_H
21
22#include <AMF/core/Factory.h>
23
24#include <AMF/components/ColorSpace.h>
25#include <AMF/components/VideoEncoderVCE.h>
26#include <AMF/components/VideoEncoderHEVC.h>
27#include <AMF/components/VideoEncoderAV1.h>
28
29#include "libavutil/fifo.h"
30
31#include "avcodec.h"
32#include "hwconfig.h"
33
34#define MAX_LOOKAHEAD_DEPTH 41
35
36/**
37* AMF encoder context
38*/
39
40typedef struct AMFEncoderContext {
42 // access to AMF runtime
44
45 //encoder
46 AMFComponent *encoder; ///< AMF encoder object
47 amf_bool eof; ///< flag indicating EOF happened
48 AMF_SURFACE_FORMAT format; ///< AMF surface format
51
55
56 // helpers to handle async calls
58
59 // shift dts back by max_b_frames in timing
65
66 // common encoder options
67
68 // Static options, have to be set before Init() call
69 int usage;
71 int level;
79
80 // Dynamic options, can be set after Init() call
81
87 int qp_i;
88 int qp_p;
89 int qp_b;
97 int aud;
103
104 // HEVC - specific options
105
114 int tier;
115
116 // AV1 - specific options
117
118 /* enum AMF_VIDEO_ENCODER_AV1_ALIGNMENT_MODE_ENUM, use int for AVOption */
119 int align;
120 /* enum AMF_VIDEO_ENCODER_AV1_AQ_MODE_ENUM */
122
123 // Preanalysis - specific options
124
141
142
144
146
147/**
148* Common encoder initization function
149*/
151/**
152* Common encoder termination function
153*/
155
156/**
157* Ecoding one frame - common function for all AMF encoders
158*/
160
161/**
162* Supported formats
163*/
164extern const enum AVPixelFormat ff_amf_pix_fmts[];
165
166/**
167* Error handling helper
168*/
169#define AMF_RETURN_IF_FALSE(avctx, exp, ret_value, /*message,*/ ...) \
170 if (!(exp)) { \
171 av_log(avctx, AV_LOG_ERROR, __VA_ARGS__); \
172 return ret_value; \
173 }
174
175#endif //AVCODEC_AMFENC_H
const AVCodecHWConfigInternal *const ff_amfenc_hw_configs[]
Definition amfenc.c:714
enum AVPixelFormat ff_amf_pix_fmts[]
Supported formats.
Definition amfenc.c:55
int ff_amf_encode_init(AVCodecContext *avctx)
Common encoder initization function.
Definition amfenc.c:282
int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket *avpkt)
Ecoding one frame - common function for all AMF encoders.
Definition amfenc.c:579
int ff_amf_encode_close(AVCodecContext *avctx)
Common encoder termination function.
Definition amfenc.c:140
Libavcodec external API header.
long long int64_t
Definition coverity.c:34
A generic FIFO API.
AVPixelFormat
Pixel format.
Definition pixfmt.h:71
AMF encoder context.
Definition amfenc.h:40
AMF_SURFACE_FORMAT format
AMF surface format.
Definition amfenc.h:48
int64_t submitted_frame
Definition amfenc.h:62
int b_frame_delta_qp
Definition amfenc.h:75
int pa_scene_change_detection_sensitivity
Definition amfenc.h:128
int pa_high_motion_quality_boost_mode
Definition amfenc.h:139
int header_insertion_mode
Definition amfenc.h:107
int pa_static_scene_detection_sensitivity
Definition amfenc.h:130
int pa_adaptive_mini_gop
Definition amfenc.h:140
AVFifo * output_list
Definition amfenc.h:64
int rate_control_mode
Definition amfenc.h:82
wchar_t * av_frame_property_name
Definition amfenc.h:50
int64_t dts_delay
Definition amfenc.h:61
AMFComponent * encoder
AMF encoder object.
Definition amfenc.h:46
int query_timeout_supported
Definition amfenc.h:54
AVFifo * timestamp_list
Definition amfenc.h:60
int ref_b_frame_delta_qp
Definition amfenc.h:76
int intra_refresh_mb
Definition amfenc.h:93
int hwsurfaces_in_queue_max
Definition amfenc.h:53
AVClass * avclass
Definition amfenc.h:41
AVBufferRef * device_ctx_ref
Definition amfenc.h:43
int qvbr_quality_level
Definition amfenc.h:100
int max_consecutive_b_frames
Definition amfenc.h:98
int smart_access_video
Definition amfenc.h:78
int pa_static_scene_detection
Definition amfenc.h:129
int pa_lookahead_buffer_depth
Definition amfenc.h:136
int pa_scene_change_detection
Definition amfenc.h:127
amf_bool eof
flag indicating EOF happened
Definition amfenc.h:47
wchar_t * pts_property_name
Definition amfenc.h:49
int64_t encoded_frame
Definition amfenc.h:63
int hw_high_motion_quality_boost
Definition amfenc.h:101
int hwsurfaces_in_queue
Definition amfenc.h:52
A reference to a data buffer.
Definition buffer.h:82
Describe the class of an AVClass context structure.
Definition log.h:76
main external API structure.
Definition avcodec.h:443
Definition fifo.c:35
This structure stores compressed data.
Definition packet.h:580