FFmpeg
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
proresenc_kostya.c File Reference
#include "libavutil/opt.h"
#include "avcodec.h"
#include "put_bits.h"
#include "bytestream.h"
#include "internal.h"
#include "proresdsp.h"
#include "proresdata.h"

Go to the source code of this file.

Data Structures

struct  prores_profile
 
struct  TrellisNode
 
struct  ProresThreadData
 
struct  ProresContext
 

Macros

#define CFACTOR_Y422   2
 
#define CFACTOR_Y444   3
 
#define MAX_MBS_PER_SLICE   8
 
#define MAX_PLANES   3
 
#define NUM_MB_LIMITS   4
 
#define TRELLIS_WIDTH   16
 
#define SCORE_LIMIT   INT_MAX / 2
 
#define MAX_STORED_Q   16
 
#define GET_SIGN(x)   ((x) >> 31)
 
#define MAKE_CODE(x)   (((x) << 1) ^ GET_SIGN(x))
 
#define OFFSET(x)   offsetof(ProresContext, x)
 
#define VE   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 

Enumerations

enum  { PRORES_PROFILE_PROXY = 0, PRORES_PROFILE_LT, PRORES_PROFILE_STANDARD, PRORES_PROFILE_HQ }
 
enum  {
  QUANT_MAT_PROXY = 0, QUANT_MAT_LT, QUANT_MAT_STANDARD, QUANT_MAT_HQ,
  QUANT_MAT_DEFAULT
}
 

Functions

static void get_slice_data (ProresContext *ctx, const uint16_t *src, int linesize, int x, int y, int w, int h, DCTELEM *blocks, uint16_t *emu_buf, int mbs_per_slice, int blocks_per_mb, int is_chroma)
 
static void encode_vlc_codeword (PutBitContext *pb, unsigned codebook, int val)
 Write an unsigned rice/exp golomb codeword.
 
static void encode_dcs (PutBitContext *pb, DCTELEM *blocks, int blocks_per_slice, int scale)
 
static void encode_acs (PutBitContext *pb, DCTELEM *blocks, int blocks_per_slice, int plane_size_factor, const uint8_t *scan, const int16_t *qmat)
 
static int encode_slice_plane (ProresContext *ctx, PutBitContext *pb, const uint16_t *src, int linesize, int mbs_per_slice, DCTELEM *blocks, int blocks_per_mb, int plane_size_factor, const int16_t *qmat)
 
static int encode_slice (AVCodecContext *avctx, const AVFrame *pic, PutBitContext *pb, int sizes[4], int x, int y, int quant, int mbs_per_slice)
 
static int estimate_vlc (unsigned codebook, int val)
 
static int estimate_dcs (int *error, DCTELEM *blocks, int blocks_per_slice, int scale)
 
static int estimate_acs (int *error, DCTELEM *blocks, int blocks_per_slice, int plane_size_factor, const uint8_t *scan, const int16_t *qmat)
 
static int estimate_slice_plane (ProresContext *ctx, int *error, int plane, const uint16_t *src, int linesize, int mbs_per_slice, int blocks_per_mb, int plane_size_factor, const int16_t *qmat, ProresThreadData *td)
 
static int find_slice_quant (AVCodecContext *avctx, const AVFrame *pic, int trellis_node, int x, int y, int mbs_per_slice, ProresThreadData *td)
 
static int find_quant_thread (AVCodecContext *avctx, void *arg, int jobnr, int threadnr)
 
static int encode_frame (AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pic, int *got_packet)
 
static av_cold int encode_close (AVCodecContext *avctx)
 
static av_cold int encode_init (AVCodecContext *avctx)
 

Variables

static const uint8_t prores_quant_matrices [][64]
 
static const int prores_mb_limits [NUM_MB_LIMITS]
 
static struct prores_profile prores_profile_info [4]
 
static const AVOption options []
 
static const AVClass proresenc_class
 
AVCodec ff_prores_kostya_encoder
 

Macro Definition Documentation

#define CFACTOR_Y422   2

Definition at line 34 of file proresenc_kostya.c.

Referenced by encode_init().

#define CFACTOR_Y444   3

Definition at line 35 of file proresenc_kostya.c.

Referenced by encode_init(), encode_slice(), and find_slice_quant().

#define MAX_MBS_PER_SLICE   8

Definition at line 37 of file proresenc_kostya.c.

#define MAX_PLANES   3

Definition at line 39 of file proresenc_kostya.c.

Referenced by find_slice_quant().

#define NUM_MB_LIMITS   4

Definition at line 109 of file proresenc_kostya.c.

Referenced by encode_init().

#define TRELLIS_WIDTH   16

Definition at line 160 of file proresenc_kostya.c.

Referenced by encode_init(), find_quant_thread(), and find_slice_quant().

#define SCORE_LIMIT   INT_MAX / 2

Definition at line 161 of file proresenc_kostya.c.

Referenced by find_slice_quant().

#define MAX_STORED_Q   16

Definition at line 170 of file proresenc_kostya.c.

Referenced by encode_init(), encode_slice(), and find_slice_quant().

#define GET_SIGN (   x)    ((x) >> 31)

Definition at line 317 of file proresenc_kostya.c.

Referenced by encode_acs(), encode_dcs(), and estimate_dcs().

#define MAKE_CODE (   x)    (((x) << 1) ^ GET_SIGN(x))

Definition at line 318 of file proresenc_kostya.c.

Referenced by encode_dcs(), and estimate_dcs().

#define OFFSET (   x)    offsetof(ProresContext, x)

Definition at line 1017 of file proresenc_kostya.c.

Definition at line 1018 of file proresenc_kostya.c.

Enumeration Type Documentation

anonymous enum
Enumerator:
PRORES_PROFILE_PROXY 
PRORES_PROFILE_LT 
PRORES_PROFILE_STANDARD 
PRORES_PROFILE_HQ 

Definition at line 41 of file proresenc_kostya.c.

anonymous enum
Enumerator:
QUANT_MAT_PROXY 
QUANT_MAT_LT 
QUANT_MAT_STANDARD 
QUANT_MAT_HQ 
QUANT_MAT_DEFAULT 

Definition at line 48 of file proresenc_kostya.c.

Function Documentation

static void get_slice_data ( ProresContext ctx,
const uint16_t *  src,
int  linesize,
int  x,
int  y,
int  w,
int  h,
DCTELEM blocks,
uint16_t *  emu_buf,
int  mbs_per_slice,
int  blocks_per_mb,
int  is_chroma 
)
static

Definition at line 214 of file proresenc_kostya.c.

Referenced by encode_slice(), and find_slice_quant().

static void encode_vlc_codeword ( PutBitContext pb,
unsigned  codebook,
int  val 
)
inlinestatic

Write an unsigned rice/exp golomb codeword.

Definition at line 288 of file proresenc_kostya.c.

Referenced by encode_acs(), and encode_dcs().

static void encode_dcs ( PutBitContext pb,
DCTELEM blocks,
int  blocks_per_slice,
int  scale 
)
static

Definition at line 320 of file proresenc_kostya.c.

Referenced by encode_slice_plane().

static void encode_acs ( PutBitContext pb,
DCTELEM blocks,
int  blocks_per_slice,
int  plane_size_factor,
const uint8_t scan,
const int16_t *  qmat 
)
static

Definition at line 346 of file proresenc_kostya.c.

Referenced by encode_slice_plane().

static int encode_slice_plane ( ProresContext ctx,
PutBitContext pb,
const uint16_t *  src,
int  linesize,
int  mbs_per_slice,
DCTELEM blocks,
int  blocks_per_mb,
int  plane_size_factor,
const int16_t *  qmat 
)
static

Definition at line 380 of file proresenc_kostya.c.

Referenced by encode_slice().

static int encode_slice ( AVCodecContext avctx,
const AVFrame pic,
PutBitContext pb,
int  sizes[4],
int  x,
int  y,
int  quant,
int  mbs_per_slice 
)
static

Definition at line 399 of file proresenc_kostya.c.

Referenced by encode_frame().

static int estimate_vlc ( unsigned  codebook,
int  val 
)
inlinestatic

Definition at line 462 of file proresenc_kostya.c.

Referenced by estimate_acs(), and estimate_dcs().

static int estimate_dcs ( int *  error,
DCTELEM blocks,
int  blocks_per_slice,
int  scale 
)
static

Definition at line 484 of file proresenc_kostya.c.

Referenced by estimate_slice_plane().

static int estimate_acs ( int *  error,
DCTELEM blocks,
int  blocks_per_slice,
int  plane_size_factor,
const uint8_t scan,
const int16_t *  qmat 
)
static

Definition at line 515 of file proresenc_kostya.c.

Referenced by estimate_slice_plane().

static int estimate_slice_plane ( ProresContext ctx,
int *  error,
int  plane,
const uint16_t *  src,
int  linesize,
int  mbs_per_slice,
int  blocks_per_mb,
int  plane_size_factor,
const int16_t *  qmat,
ProresThreadData td 
)
static

Definition at line 551 of file proresenc_kostya.c.

Referenced by find_slice_quant().

static int find_slice_quant ( AVCodecContext avctx,
const AVFrame pic,
int  trellis_node,
int  x,
int  y,
int  mbs_per_slice,
ProresThreadData td 
)
static

Definition at line 569 of file proresenc_kostya.c.

Referenced by find_quant_thread().

static int find_quant_thread ( AVCodecContext avctx,
void arg,
int  jobnr,
int  threadnr 
)
static

Definition at line 714 of file proresenc_kostya.c.

Referenced by encode_frame().

static int encode_frame ( AVCodecContext avctx,
AVPacket pkt,
const AVFrame pic,
int *  got_packet 
)
static

Definition at line 738 of file proresenc_kostya.c.

static av_cold int encode_close ( AVCodecContext avctx)
static

Definition at line 863 of file proresenc_kostya.c.

Referenced by encode_init().

static av_cold int encode_init ( AVCodecContext avctx)
static

Definition at line 880 of file proresenc_kostya.c.

Variable Documentation

const uint8_t prores_quant_matrices[][64]
static

Definition at line 56 of file proresenc_kostya.c.

Referenced by encode_init().

const int prores_mb_limits[NUM_MB_LIMITS]
static
Initial value:
= {
1620,
2700,
6075,
9216,
}

Definition at line 110 of file proresenc_kostya.c.

Referenced by encode_init().

struct prores_profile prores_profile_info[4]
static

Referenced by encode_init().

const AVOption options[]
static

Definition at line 1020 of file proresenc_kostya.c.

const AVClass proresenc_class
static
Initial value:
= {
.class_name = "ProRes encoder",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 1055 of file proresenc_kostya.c.

AVCodec ff_prores_kostya_encoder
Initial value:
= {
.name = "prores_kostya",
.priv_data_size = sizeof(ProresContext),
.encode2 = encode_frame,
.capabilities = CODEC_CAP_SLICE_THREADS,
.long_name = NULL_IF_CONFIG_SMALL("Apple ProRes (iCodec Pro)"),
.pix_fmts = (const enum AVPixelFormat[]) {
},
.priv_class = &proresenc_class,
}

Definition at line 1062 of file proresenc_kostya.c.