FFmpeg
Data Structures | Macros | Functions | Variables
amfenc.c File Reference
#include "config.h"
#include "config_components.h"
#include "libavutil/avassert.h"
#include "libavutil/imgutils.h"
#include "libavutil/hwcontext.h"
#include "libavutil/mem.h"
#include "libavutil/pixdesc.h"
#include "libavutil/time.h"
#include "amfenc.h"
#include "encode.h"
#include "internal.h"
#include "libavutil/mastering_display_metadata.h"
#include <dlfcn.h>

Go to the source code of this file.

Data Structures

struct  FormatMap
 

Macros

#define FFMPEG_AMF_WRITER_ID   L"ffmpeg_amf"
 
#define PTS_PROP   L"PtsProp"
 

Functions

static int amf_save_hdr_metadata (AVCodecContext *avctx, const AVFrame *frame, AMFHDRMetadata *hdrmeta)
 
static enum AMF_SURFACE_FORMAT amf_av_to_amf_format (enum AVPixelFormat fmt)
 
static void AMF_CDECL_CALL AMFTraceWriter_Write (AMFTraceWriter *pThis, const wchar_t *scope, const wchar_t *message)
 
static void AMF_CDECL_CALL AMFTraceWriter_Flush (AMFTraceWriter *pThis)
 
static int amf_load_library (AVCodecContext *avctx)
 
static int amf_init_context (AVCodecContext *avctx)
 
static int amf_init_encoder (AVCodecContext *avctx)
 
int av_cold ff_amf_encode_close (AVCodecContext *avctx)
 Common encoder termination function. More...
 
static int amf_copy_surface (AVCodecContext *avctx, const AVFrame *frame, AMFSurface *surface)
 
static int amf_copy_buffer (AVCodecContext *avctx, AVPacket *pkt, AMFBuffer *buffer)
 
int ff_amf_encode_init (AVCodecContext *avctx)
 Common encoder initization function. More...
 
static AMF_RESULT amf_set_property_buffer (AMFSurface *object, const wchar_t *name, AMFBuffer *val)
 
static AMF_RESULT amf_get_property_buffer (AMFData *object, const wchar_t *name, AMFBuffer **val)
 
static AMFBuffer * amf_create_buffer_with_frame_ref (const AVFrame *frame, AMFContext *context)
 
static void amf_release_buffer_with_frame_ref (AMFBuffer *frame_ref_storage_buffer)
 
int ff_amf_receive_packet (AVCodecContext *avctx, AVPacket *avpkt)
 Ecoding one frame - common function for all AMF encoders. More...
 
int ff_amf_get_color_profile (AVCodecContext *avctx)
 

Variables

enum AVPixelFormat ff_amf_pix_fmts []
 Supported formats. More...
 
static const FormatMap format_map []
 
static AMFTraceWriterVtbl tracer_vtbl
 
const AVCodecHWConfigInternal *const ff_amfenc_hw_configs []
 

Macro Definition Documentation

◆ FFMPEG_AMF_WRITER_ID

#define FFMPEG_AMF_WRITER_ID   L"ffmpeg_amf"

Definition at line 101 of file amfenc.c.

◆ PTS_PROP

#define PTS_PROP   L"PtsProp"

Definition at line 103 of file amfenc.c.

Function Documentation

◆ amf_save_hdr_metadata()

static int amf_save_hdr_metadata ( AVCodecContext avctx,
const AVFrame frame,
AMFHDRMetadata *  hdrmeta 
)
static

Definition at line 41 of file amfenc.c.

Referenced by ff_amf_receive_packet().

◆ amf_av_to_amf_format()

static enum AMF_SURFACE_FORMAT amf_av_to_amf_format ( enum AVPixelFormat  fmt)
static

Definition at line 135 of file amfenc.c.

Referenced by amf_init_context(), and amf_init_encoder().

◆ AMFTraceWriter_Write()

static void AMF_CDECL_CALL AMFTraceWriter_Write ( AMFTraceWriter *  pThis,
const wchar_t *  scope,
const wchar_t *  message 
)
static

Definition at line 146 of file amfenc.c.

◆ AMFTraceWriter_Flush()

static void AMF_CDECL_CALL AMFTraceWriter_Flush ( AMFTraceWriter *  pThis)
static

Definition at line 153 of file amfenc.c.

◆ amf_load_library()

static int amf_load_library ( AVCodecContext avctx)
static

Definition at line 163 of file amfenc.c.

Referenced by ff_amf_encode_init().

◆ amf_init_context()

static int amf_init_context ( AVCodecContext avctx)
static

Definition at line 269 of file amfenc.c.

Referenced by ff_amf_encode_init().

◆ amf_init_encoder()

static int amf_init_encoder ( AVCodecContext avctx)
static

Definition at line 391 of file amfenc.c.

Referenced by ff_amf_encode_init().

◆ ff_amf_encode_close()

int av_cold ff_amf_encode_close ( AVCodecContext avctx)

Common encoder termination function.

Definition at line 432 of file amfenc.c.

Referenced by ff_amf_encode_init().

◆ amf_copy_surface()

static int amf_copy_surface ( AVCodecContext avctx,
const AVFrame frame,
AMFSurface *  surface 
)
static

Definition at line 473 of file amfenc.c.

Referenced by ff_amf_receive_packet().

◆ amf_copy_buffer()

static int amf_copy_buffer ( AVCodecContext avctx,
AVPacket pkt,
AMFBuffer *  buffer 
)
static

Definition at line 497 of file amfenc.c.

Referenced by ff_amf_receive_packet().

◆ ff_amf_encode_init()

int ff_amf_encode_init ( AVCodecContext avctx)

Common encoder initization function.

Definition at line 558 of file amfenc.c.

Referenced by amf_encode_init_av1(), amf_encode_init_h264(), and amf_encode_init_hevc().

◆ amf_set_property_buffer()

static AMF_RESULT amf_set_property_buffer ( AMFSurface *  object,
const wchar_t *  name,
AMFBuffer *  val 
)
static

Definition at line 573 of file amfenc.c.

Referenced by ff_amf_receive_packet().

◆ amf_get_property_buffer()

static AMF_RESULT amf_get_property_buffer ( AMFData *  object,
const wchar_t *  name,
AMFBuffer **  val 
)
static

Definition at line 595 of file amfenc.c.

Referenced by ff_amf_receive_packet().

◆ amf_create_buffer_with_frame_ref()

static AMFBuffer* amf_create_buffer_with_frame_ref ( const AVFrame frame,
AMFContext *  context 
)
static

Definition at line 616 of file amfenc.c.

Referenced by ff_amf_receive_packet().

◆ amf_release_buffer_with_frame_ref()

static void amf_release_buffer_with_frame_ref ( AMFBuffer *  frame_ref_storage_buffer)
static

Definition at line 635 of file amfenc.c.

Referenced by ff_amf_receive_packet().

◆ ff_amf_receive_packet()

int ff_amf_receive_packet ( AVCodecContext avctx,
AVPacket avpkt 
)

Ecoding one frame - common function for all AMF encoders.

Definition at line 643 of file amfenc.c.

◆ ff_amf_get_color_profile()

int ff_amf_get_color_profile ( AVCodecContext avctx)

Color Space for Full (JPEG) Range

Color Space for Limited (MPEG) range

Definition at line 920 of file amfenc.c.

Referenced by amf_encode_init_av1(), amf_encode_init_h264(), and amf_encode_init_hevc().

Variable Documentation

◆ ff_amf_pix_fmts

enum AVPixelFormat ff_amf_pix_fmts[]
Initial value:

Supported formats.

Definition at line 105 of file amfenc.c.

◆ format_map

const FormatMap format_map[]
static
Initial value:
=
{
{ AV_PIX_FMT_NONE, AMF_SURFACE_UNKNOWN },
{ AV_PIX_FMT_NV12, AMF_SURFACE_NV12 },
{ AV_PIX_FMT_P010, AMF_SURFACE_P010 },
{ AV_PIX_FMT_BGR0, AMF_SURFACE_BGRA },
{ AV_PIX_FMT_RGB0, AMF_SURFACE_RGBA },
{ AV_PIX_FMT_GRAY8, AMF_SURFACE_GRAY8 },
{ AV_PIX_FMT_YUV420P, AMF_SURFACE_YUV420P },
{ AV_PIX_FMT_YUYV422, AMF_SURFACE_YUY2 },
}

Definition at line 123 of file amfenc.c.

Referenced by amf_av_to_amf_format().

◆ tracer_vtbl

AMFTraceWriterVtbl tracer_vtbl
static
Initial value:
=
{
}

Definition at line 157 of file amfenc.c.

Referenced by amf_init_context().

◆ ff_amfenc_hw_configs

const AVCodecHWConfigInternal* const ff_amfenc_hw_configs[]
Initial value:
= {
}

Definition at line 955 of file amfenc.c.

AMFTraceWriter_Write
static void AMF_CDECL_CALL AMFTraceWriter_Write(AMFTraceWriter *pThis, const wchar_t *scope, const wchar_t *message)
Definition: amfenc.c:146
AMFTraceWriter_Flush
static void AMF_CDECL_CALL AMFTraceWriter_Flush(AMFTraceWriter *pThis)
Definition: amfenc.c:153
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:73
NULL
#define NULL
Definition: coverity.c:32
AV_PIX_FMT_YUYV422
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Definition: pixfmt.h:74
AV_PIX_FMT_BGR0
@ AV_PIX_FMT_BGR0
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
Definition: pixfmt.h:265
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:81
AV_PIX_FMT_RGB0
@ AV_PIX_FMT_RGB0
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
Definition: pixfmt.h:263
AV_PIX_FMT_NV12
@ AV_PIX_FMT_NV12
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
Definition: pixfmt.h:96
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_PIX_FMT_P010
#define AV_PIX_FMT_P010
Definition: pixfmt.h:552