|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef AVCODEC_AMFENC_H |
|
#define AVCODEC_AMFENC_H |
|
|
|
#include <AMF/core/Factory.h> |
|
|
|
#include <AMF/components/VideoEncoderVCE.h> |
|
#include <AMF/components/VideoEncoderHEVC.h> |
|
#include <AMF/components/VideoEncoderAV1.h> |
|
|
|
#include "libavutil/fifo.h" |
|
|
|
#include "avcodec.h" |
|
#include "hwconfig.h" |
|
|
|
#define MAX_LOOKAHEAD_DEPTH 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct AmfTraceWriter { |
|
AMFTraceWriterVtbl *vtbl; |
|
AVCodecContext *avctx; |
|
} AmfTraceWriter; |
|
|
|
|
|
|
|
|
|
|
|
typedef struct AmfContext { |
|
AVClass *avclass; |
|
|
|
amf_handle library; |
|
AMFFactory *factory; |
|
AMFDebug *debug; |
|
AMFTrace *trace; |
|
|
|
amf_uint64 version; |
|
AmfTraceWriter tracer; |
|
AMFContext *context; |
|
|
|
AMFComponent *encoder; |
|
amf_bool eof; |
|
AMF_SURFACE_FORMAT format; |
|
|
|
AVBufferRef *hw_device_ctx; |
|
AVBufferRef *hw_frames_ctx; |
|
|
|
int hwsurfaces_in_queue; |
|
int hwsurfaces_in_queue_max; |
|
|
|
|
|
int delayed_drain; |
|
AMFSurface *delayed_surface; |
|
AVFrame *delayed_frame; |
|
|
|
|
|
AVFifo *timestamp_list; |
|
int64_t dts_delay; |
|
|
|
|
|
|
|
int log_to_dbg; |
|
|
|
|
|
int usage; |
|
int profile; |
|
int level; |
|
int preencode; |
|
int quality; |
|
int b_frame_delta_qp; |
|
int ref_b_frame_delta_qp; |
|
|
|
|
|
|
|
int rate_control_mode; |
|
int enforce_hrd; |
|
int filler_data; |
|
int enable_vbaq; |
|
int skip_frame; |
|
int qp_i; |
|
int qp_p; |
|
int qp_b; |
|
int max_au_size; |
|
int header_spacing; |
|
int b_frame_ref; |
|
int intra_refresh_mb; |
|
int coding_mode; |
|
int me_half_pel; |
|
int me_quarter_pel; |
|
int aud; |
|
int max_consecutive_b_frames; |
|
int max_b_frames; |
|
int qvbr_quality_level; |
|
int hw_high_motion_quality_boost; |
|
|
|
|
|
|
|
int gops_per_idr; |
|
int header_insertion_mode; |
|
int min_qp_i; |
|
int max_qp_i; |
|
int min_qp_p; |
|
int max_qp_p; |
|
int tier; |
|
|
|
|
|
|
|
enum AMF_VIDEO_ENCODER_AV1_ALIGNMENT_MODE_ENUM align; |
|
|
|
|
|
|
|
int preanalysis; |
|
int pa_activity_type; |
|
int pa_scene_change_detection; |
|
int pa_scene_change_detection_sensitivity; |
|
int pa_static_scene_detection; |
|
int pa_static_scene_detection_sensitivity; |
|
int pa_initial_qp; |
|
int pa_max_qp; |
|
int pa_caq_strength; |
|
int pa_frame_sad; |
|
int pa_ltr; |
|
int pa_lookahead_buffer_depth; |
|
int pa_paq_mode; |
|
int pa_taq_mode; |
|
int pa_high_motion_quality_boost_mode; |
|
int pa_adaptive_mini_gop; |
|
|
|
|
|
} AmfContext; |
|
|
|
extern const AVCodecHWConfigInternal *const ff_amfenc_hw_configs[]; |
|
|
|
|
|
|
|
|
|
int ff_amf_encode_init(AVCodecContext *avctx); |
|
|
|
|
|
|
|
int ff_amf_encode_close(AVCodecContext *avctx); |
|
|
|
|
|
|
|
|
|
int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket *avpkt); |
|
|
|
|
|
|
|
|
|
extern const enum AVPixelFormat ff_amf_pix_fmts[]; |
|
|
|
|
|
|
|
|
|
#define AMF_RETURN_IF_FALSE(avctx, exp, ret_value, ...) \ |
|
if (!(exp)) { \ |
|
av_log(avctx, AV_LOG_ERROR, __VA_ARGS__); \ |
|
return ret_value; \ |
|
} |
|
|
|
#endif |
|
|