FFmpeg
Loading...
Searching...
No Matches
proresenc_kostya_vulkan.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/buffer.h"
#include "libavutil/macros.h"
#include "libavutil/mem.h"
#include "libavutil/mem_internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/hwcontext_vulkan.h"
#include "libavutil/vulkan_loader.h"
#include "libavutil/vulkan.h"
#include "avcodec.h"
#include "codec.h"
#include "codec_internal.h"
#include "encode.h"
#include "packet.h"
#include "put_bits.h"
#include "profiles.h"
#include "bytestream.h"
#include "proresdata.h"
#include "proresenc_kostya_common.h"
#include "hwconfig.h"

Go to the source code of this file.

Data Structures

struct  ProresDataTables
 
struct  SliceDataInfo
 
struct  EncodeSliceInfo
 
struct  SegGatherPushData
 
struct  SliceData
 
struct  SliceScore
 
struct  VulkanEncodeProresFrameData
 
struct  ProresVulkanContext
 

Macros

#define DCTSIZE   8
 
#define OFFSET(x)
 
#define VE   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 

Functions

static int init_slice_data_pipeline (ProresVulkanContext *pv, FFVulkanShader *shd, int blocks_per_mb)
 
static int init_alpha_data_pipeline (ProresVulkanContext *pv, FFVulkanShader *shd)
 
static int init_estimate_slice_pipeline (ProresVulkanContext *pv, FFVulkanShader *shd)
 
static int init_trellis_node_pipeline (ProresVulkanContext *pv, FFVulkanShader *shd)
 
static int init_encode_slice_pipeline (ProresVulkanContext *pv, FFVulkanShader *shd)
 
static int init_gather_pipeline (ProresVulkanContext *pv, FFVulkanShader *shd)
 
static int vulkan_encode_prores_submit_frame (AVCodecContext *avctx, FFVkExecContext *exec, AVFrame *frame, int picture_idx)
 
static uint8_t * write_frame_header (AVCodecContext *avctx, ProresContext *ctx, uint8_t **orig_buf, int flags, enum AVColorPrimaries color_primaries, enum AVColorTransferCharacteristic color_trc, enum AVColorSpace colorspace)
 
static void prores_vk_packet_free (void *opaque, uint8_t *data)
 
static int get_packet (AVCodecContext *avctx, FFVkExecContext *exec, AVPacket *pkt)
 
static int vulkan_encode_prores_receive_packet (AVCodecContext *avctx, AVPacket *pkt)
 
static av_cold int encode_close (AVCodecContext *avctx)
 
static av_cold int encode_init (AVCodecContext *avctx)
 

Variables

const unsigned char ff_prores_ks_alpha_data_comp_spv_data []
 
const unsigned int ff_prores_ks_alpha_data_comp_spv_len
 
const unsigned char ff_seg_gather_comp_spv_data []
 
const unsigned int ff_seg_gather_comp_spv_len
 
const unsigned char ff_prores_ks_slice_data_comp_spv_data []
 
const unsigned int ff_prores_ks_slice_data_comp_spv_len
 
const unsigned char ff_prores_ks_estimate_slice_comp_spv_data []
 
const unsigned int ff_prores_ks_estimate_slice_comp_spv_len
 
const unsigned char ff_prores_ks_trellis_node_comp_spv_data []
 
const unsigned int ff_prores_ks_trellis_node_comp_spv_len
 
const unsigned char ff_prores_ks_encode_slice_comp_spv_data []
 
const unsigned int ff_prores_ks_encode_slice_comp_spv_len
 
static const AVOption options []
 
static const AVClass proresenc_class
 
static const AVCodecHWConfigInternal *const prores_ks_hw_configs []
 
const FFCodec ff_prores_ks_vulkan_encoder
 

Macro Definition Documentation

◆ DCTSIZE

#define DCTSIZE   8

Definition at line 46 of file proresenc_kostya_vulkan.c.

◆ OFFSET

#define OFFSET ( x)

◆ VE

Function Documentation

◆ init_slice_data_pipeline()

static int init_slice_data_pipeline ( ProresVulkanContext * pv,
FFVulkanShader * shd,
int blocks_per_mb )
static

Definition at line 160 of file proresenc_kostya_vulkan.c.

Referenced by encode_init().

◆ init_alpha_data_pipeline()

static int init_alpha_data_pipeline ( ProresVulkanContext * pv,
FFVulkanShader * shd )
static

Definition at line 203 of file proresenc_kostya_vulkan.c.

Referenced by encode_init().

◆ init_estimate_slice_pipeline()

static int init_estimate_slice_pipeline ( ProresVulkanContext * pv,
FFVulkanShader * shd )
static

Definition at line 242 of file proresenc_kostya_vulkan.c.

Referenced by encode_init().

◆ init_trellis_node_pipeline()

static int init_trellis_node_pipeline ( ProresVulkanContext * pv,
FFVulkanShader * shd )
static

Definition at line 291 of file proresenc_kostya_vulkan.c.

Referenced by encode_init().

◆ init_encode_slice_pipeline()

static int init_encode_slice_pipeline ( ProresVulkanContext * pv,
FFVulkanShader * shd )
static

Definition at line 336 of file proresenc_kostya_vulkan.c.

Referenced by encode_init().

◆ init_gather_pipeline()

static int init_gather_pipeline ( ProresVulkanContext * pv,
FFVulkanShader * shd )
static

Definition at line 384 of file proresenc_kostya_vulkan.c.

Referenced by encode_init().

◆ vulkan_encode_prores_submit_frame()

static int vulkan_encode_prores_submit_frame ( AVCodecContext * avctx,
FFVkExecContext * exec,
AVFrame * frame,
int picture_idx )
static

Definition at line 415 of file proresenc_kostya_vulkan.c.

Referenced by vulkan_encode_prores_receive_packet().

◆ write_frame_header()

static uint8_t * write_frame_header ( AVCodecContext * avctx,
ProresContext * ctx,
uint8_t ** orig_buf,
int flags,
enum AVColorPrimaries color_primaries,
enum AVColorTransferCharacteristic color_trc,
enum AVColorSpace colorspace )
static

Definition at line 709 of file proresenc_kostya_vulkan.c.

Referenced by encode_init(), and get_packet().

◆ prores_vk_packet_free()

static void prores_vk_packet_free ( void * opaque,
uint8_t * data )
static

Definition at line 754 of file proresenc_kostya_vulkan.c.

Referenced by get_packet().

◆ get_packet()

static int get_packet ( AVCodecContext * avctx,
FFVkExecContext * exec,
AVPacket * pkt )
static

Definition at line 759 of file proresenc_kostya_vulkan.c.

Referenced by vulkan_encode_prores_receive_packet().

◆ vulkan_encode_prores_receive_packet()

static int vulkan_encode_prores_receive_packet ( AVCodecContext * avctx,
AVPacket * pkt )
static

Definition at line 889 of file proresenc_kostya_vulkan.c.

◆ encode_close()

static av_cold int encode_close ( AVCodecContext * avctx)
static

Definition at line 952 of file proresenc_kostya_vulkan.c.

◆ encode_init()

static av_cold int encode_init ( AVCodecContext * avctx)
static

Definition at line 984 of file proresenc_kostya_vulkan.c.

Variable Documentation

◆ ff_prores_ks_alpha_data_comp_spv_data

const unsigned char ff_prores_ks_alpha_data_comp_spv_data[]
extern

◆ ff_prores_ks_alpha_data_comp_spv_len

const unsigned int ff_prores_ks_alpha_data_comp_spv_len
extern

◆ ff_seg_gather_comp_spv_data

const unsigned char ff_seg_gather_comp_spv_data[]
extern

◆ ff_seg_gather_comp_spv_len

const unsigned int ff_seg_gather_comp_spv_len
extern

◆ ff_prores_ks_slice_data_comp_spv_data

const unsigned char ff_prores_ks_slice_data_comp_spv_data[]
extern

◆ ff_prores_ks_slice_data_comp_spv_len

const unsigned int ff_prores_ks_slice_data_comp_spv_len
extern

◆ ff_prores_ks_estimate_slice_comp_spv_data

const unsigned char ff_prores_ks_estimate_slice_comp_spv_data[]
extern

◆ ff_prores_ks_estimate_slice_comp_spv_len

const unsigned int ff_prores_ks_estimate_slice_comp_spv_len
extern

◆ ff_prores_ks_trellis_node_comp_spv_data

const unsigned char ff_prores_ks_trellis_node_comp_spv_data[]
extern

◆ ff_prores_ks_trellis_node_comp_spv_len

const unsigned int ff_prores_ks_trellis_node_comp_spv_len
extern

◆ ff_prores_ks_encode_slice_comp_spv_data

const unsigned char ff_prores_ks_encode_slice_comp_spv_data[]
extern

◆ ff_prores_ks_encode_slice_comp_spv_len

const unsigned int ff_prores_ks_encode_slice_comp_spv_len
extern

◆ options

const AVOption options[]
static

Definition at line 1081 of file proresenc_kostya_vulkan.c.

◆ proresenc_class

const AVClass proresenc_class
static
Initial value:
= {
.class_name = "ProRes vulkan encoder",
.item_name = av_default_item_name,
.option = options,
}
const char * av_default_item_name(void *ptr)
Return the context name.
Definition log.c:241
#define LIBAVUTIL_VERSION_INT
Definition version.h:85

Definition at line 1126 of file proresenc_kostya_vulkan.c.

◆ prores_ks_hw_configs

const AVCodecHWConfigInternal* const prores_ks_hw_configs[]
static
Initial value:
= {
HW_CONFIG_ENCODER_FRAMES(VULKAN, VULKAN),
}
#define NULL
Definition coverity.c:32
#define HW_CONFIG_ENCODER_DEVICE(format, device_type_)
Definition hwconfig.h:97
#define HW_CONFIG_ENCODER_FRAMES(format, device_type_)
Definition hwconfig.h:100
#define NONE
Definition vf_drawvg.c:262

Definition at line 1133 of file proresenc_kostya_vulkan.c.

◆ ff_prores_ks_vulkan_encoder

const FFCodec ff_prores_ks_vulkan_encoder
Initial value:
= {
.p.name = "prores_ks_vulkan",
CODEC_LONG_NAME("Apple ProRes (iCodec Pro)"),
.p.type = AVMEDIA_TYPE_VIDEO,
.priv_data_size = sizeof(ProresVulkanContext),
.p.capabilities = AV_CODEC_CAP_DELAY |
.hw_configs = prores_ks_hw_configs,
.color_ranges = AVCOL_RANGE_MPEG,
.p.priv_class = &proresenc_class,
}
static av_cold void close(AVCodecParserContext *s)
Definition apv_parser.c:197
static av_cold int encode_init(AVCodecContext *avctx)
Definition asvenc.c:373
#define FF_CODEC_CAP_EOF_FLUSH
The encoder has AV_CODEC_CAP_DELAY set, but does not actually have delay - it only wants to be flushe...
#define CODEC_PIXFMTS(...)
#define FF_CODEC_RECEIVE_PACKET_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
static av_cold int encode_close(AVCodecContext *avctx)
Definition dcaenc.c:354
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
Definition codec.h:147
#define AV_CODEC_CAP_ENCODER_FLUSH
This encoder can be flushed using avcodec_flush_buffers().
Definition codec.h:154
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
Definition codec.h:79
#define AV_CODEC_CAP_HARDWARE
Codec is backed by a hardware implementation.
Definition codec.h:133
@ AV_CODEC_ID_PRORES
Definition codec_id.h:198
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
Definition pixfmt.h:766
@ AV_PIX_FMT_VULKAN
Vulkan hardware images.
Definition pixfmt.h:379
const AVProfile ff_prores_profiles[]
Definition profiles.c:175
static const AVClass proresenc_class
static const AVCodecHWConfigInternal *const prores_ks_hw_configs[]
static int vulkan_encode_prores_receive_packet(AVCodecContext *avctx, AVPacket *pkt)

Definition at line 1139 of file proresenc_kostya_vulkan.c.