dnxhdenc.c File Reference
#include "libavutil/internal.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "dsputil.h"
#include "internal.h"
#include "mpegvideo.h"
#include "dnxhdenc.h"
Include dependency graph for dnxhdenc.c:

Go to the source code of this file.

Macros

#define RC_VARIANCE   1
 
#define VE   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 
#define DNX10BIT_QMAT_SHIFT   18
 
#define LAMBDA_FRAC_BITS   10
 
#define BUCKET_BITS   8
 
#define RADIX_PASSES   4
 
#define NBUCKETS   (1 << BUCKET_BITS)
 

Functions

static void dnxhd_8bit_get_pixels_8x4_sym (int16_t *av_restrict block, const uint8_t *pixels, int line_size)
 
static av_always_inline void dnxhd_10bit_get_pixels_8x4_sym (int16_t *av_restrict block, const uint8_t *pixels, int line_size)
 
static int dnxhd_10bit_dct_quantize (MpegEncContext *ctx, int16_t *block, int n, int qscale, int *overflow)
 
static int dnxhd_init_vlc (DNXHDEncContext *ctx)
 
static int dnxhd_init_qmat (DNXHDEncContext *ctx, int lbias, int cbias)
 
static int dnxhd_init_rc (DNXHDEncContext *ctx)
 
static int dnxhd_encode_init (AVCodecContext *avctx)
 
static int dnxhd_write_header (AVCodecContext *avctx, uint8_t *buf)
 
static av_always_inline void dnxhd_encode_dc (DNXHDEncContext *ctx, int diff)
 
static av_always_inline void dnxhd_encode_block (DNXHDEncContext *ctx, int16_t *block, int last_index, int n)
 
static av_always_inline void dnxhd_unquantize_c (DNXHDEncContext *ctx, int16_t *block, int n, int qscale, int last_index)
 
static av_always_inline int dnxhd_ssd_block (int16_t *qblock, int16_t *block)
 
static av_always_inline int dnxhd_calc_ac_bits (DNXHDEncContext *ctx, int16_t *block, int last_index)
 
static av_always_inline void dnxhd_get_blocks (DNXHDEncContext *ctx, int mb_x, int mb_y)
 
static av_always_inline int dnxhd_switch_matrix (DNXHDEncContext *ctx, int i)
 
static int dnxhd_calc_bits_thread (AVCodecContext *avctx, void *arg, int jobnr, int threadnr)
 
static int dnxhd_encode_thread (AVCodecContext *avctx, void *arg, int jobnr, int threadnr)
 
static void dnxhd_setup_threads_slices (DNXHDEncContext *ctx)
 
static int dnxhd_mb_var_thread (AVCodecContext *avctx, void *arg, int jobnr, int threadnr)
 
static int dnxhd_encode_rdo (AVCodecContext *avctx, DNXHDEncContext *ctx)
 
static int dnxhd_find_qscale (DNXHDEncContext *ctx)
 
static int get_bucket (int value, int shift)
 
static void radix_count (const RCCMPEntry *data, int size, int buckets[RADIX_PASSES][NBUCKETS])
 
static void radix_sort_pass (RCCMPEntry *dst, const RCCMPEntry *data, int size, int buckets[NBUCKETS], int pass)
 
static void radix_sort (RCCMPEntry *data, int size)
 
static int dnxhd_encode_fast (AVCodecContext *avctx, DNXHDEncContext *ctx)
 
static void dnxhd_load_picture (DNXHDEncContext *ctx, const AVFrame *frame)
 
static int dnxhd_encode_picture (AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
 
static int dnxhd_encode_end (AVCodecContext *avctx)
 

Variables

static const AVOption options []
 
class {
      class_name = "dnxhd"
 
      item_name = av_default_item_name
 
      option = options
 
      version = LIBAVUTIL_VERSION_INT
 
}; 
 
static const AVCodecDefault dnxhd_defaults []
 
AVCodec ff_dnxhd_encoder
 

Macro Definition Documentation

#define BUCKET_BITS   8

Definition at line 829 of file dnxhdenc.c.

Referenced by radix_count(), and radix_sort_pass().

#define DNX10BIT_QMAT_SHIFT   18

Definition at line 39 of file dnxhdenc.c.

Referenced by dnxhd_10bit_dct_quantize(), and dnxhd_init_qmat().

#define LAMBDA_FRAC_BITS   10

Definition at line 53 of file dnxhdenc.c.

Referenced by dnxhd_encode_rdo(), and dnxhd_init_rc().

#define NBUCKETS   (1 << BUCKET_BITS)

Definition at line 831 of file dnxhdenc.c.

Referenced by get_bucket(), and radix_sort().

#define RADIX_PASSES   4

Definition at line 830 of file dnxhdenc.c.

Referenced by radix_count(), and radix_sort().

#define RC_VARIANCE   1

Definition at line 27 of file dnxhdenc.c.

Referenced by dnxhd_calc_bits_thread(), and dnxhd_encode_fast().

Definition at line 38 of file dnxhdenc.c.

Function Documentation

static int dnxhd_10bit_dct_quantize ( MpegEncContext ctx,
int16_t *  block,
int  n,
int  qscale,
int *  overflow 
)
static

Definition at line 92 of file dnxhdenc.c.

Referenced by dnxhd_encode_init().

static av_always_inline void dnxhd_10bit_get_pixels_8x4_sym ( int16_t *av_restrict  block,
const uint8_t pixels,
int  line_size 
)
static

Definition at line 72 of file dnxhdenc.c.

Referenced by dnxhd_encode_init().

static void dnxhd_8bit_get_pixels_8x4_sym ( int16_t *av_restrict  block,
const uint8_t pixels,
int  line_size 
)
static

Definition at line 55 of file dnxhdenc.c.

Referenced by dnxhd_encode_init().

static av_always_inline int dnxhd_calc_ac_bits ( DNXHDEncContext ctx,
int16_t *  block,
int  last_index 
)
static

Definition at line 470 of file dnxhdenc.c.

Referenced by dnxhd_calc_bits_thread().

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

Definition at line 527 of file dnxhdenc.c.

Referenced by dnxhd_encode_rdo(), and dnxhd_find_qscale().

static av_always_inline void dnxhd_encode_block ( DNXHDEncContext ctx,
int16_t *  block,
int  last_index,
int  n 
)
static

Definition at line 397 of file dnxhdenc.c.

Referenced by dnxhd_encode_thread().

static av_always_inline void dnxhd_encode_dc ( DNXHDEncContext ctx,
int  diff 
)
static

Definition at line 384 of file dnxhdenc.c.

Referenced by dnxhd_encode_block().

static int dnxhd_encode_end ( AVCodecContext avctx)
static

Definition at line 1005 of file dnxhdenc.c.

static int dnxhd_encode_fast ( AVCodecContext avctx,
DNXHDEncContext ctx 
)
static

Definition at line 885 of file dnxhdenc.c.

Referenced by dnxhd_encode_picture().

static int dnxhd_encode_init ( AVCodecContext avctx)
static

Definition at line 251 of file dnxhdenc.c.

static int dnxhd_encode_picture ( AVCodecContext avctx,
AVPacket pkt,
const AVFrame frame,
int *  got_packet 
)
static

Definition at line 942 of file dnxhdenc.c.

static int dnxhd_encode_rdo ( AVCodecContext avctx,
DNXHDEncContext ctx 
)
static

Definition at line 695 of file dnxhdenc.c.

Referenced by dnxhd_encode_picture().

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

Definition at line 578 of file dnxhdenc.c.

Referenced by dnxhd_encode_picture().

static int dnxhd_find_qscale ( DNXHDEncContext ctx)
static

Definition at line 771 of file dnxhdenc.c.

Referenced by dnxhd_encode_fast().

static av_always_inline void dnxhd_get_blocks ( DNXHDEncContext ctx,
int  mb_x,
int  mb_y 
)
static

Definition at line 487 of file dnxhdenc.c.

Referenced by dnxhd_calc_bits_thread(), and dnxhd_encode_thread().

static int dnxhd_init_qmat ( DNXHDEncContext ctx,
int  lbias,
int  cbias 
)
static

Definition at line 173 of file dnxhdenc.c.

Referenced by dnxhd_encode_init().

static int dnxhd_init_rc ( DNXHDEncContext ctx)
static

Definition at line 237 of file dnxhdenc.c.

Referenced by dnxhd_encode_init().

static int dnxhd_init_vlc ( DNXHDEncContext ctx)
static

Definition at line 118 of file dnxhdenc.c.

Referenced by dnxhd_encode_init().

static void dnxhd_load_picture ( DNXHDEncContext ctx,
const AVFrame frame 
)
static

Definition at line 922 of file dnxhdenc.c.

Referenced by dnxhd_encode_picture().

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

Definition at line 631 of file dnxhdenc.c.

Referenced by dnxhd_encode_fast().

static void dnxhd_setup_threads_slices ( DNXHDEncContext ctx)
static

Definition at line 612 of file dnxhdenc.c.

Referenced by dnxhd_encode_picture().

static av_always_inline int dnxhd_ssd_block ( int16_t *  qblock,
int16_t *  block 
)
static

Definition at line 461 of file dnxhdenc.c.

Referenced by dnxhd_calc_bits_thread().

static av_always_inline int dnxhd_switch_matrix ( DNXHDEncContext ctx,
int  i 
)
static

Definition at line 521 of file dnxhdenc.c.

Referenced by dnxhd_calc_bits_thread(), and dnxhd_encode_thread().

static av_always_inline void dnxhd_unquantize_c ( DNXHDEncContext ctx,
int16_t *  block,
int  n,
int  qscale,
int  last_index 
)
static

Definition at line 420 of file dnxhdenc.c.

Referenced by dnxhd_calc_bits_thread().

static int dnxhd_write_header ( AVCodecContext avctx,
uint8_t buf 
)
static

Definition at line 353 of file dnxhdenc.c.

Referenced by dnxhd_encode_picture().

static int get_bucket ( int  value,
int  shift 
)
inlinestatic

Definition at line 833 of file dnxhdenc.c.

Referenced by radix_count(), and radix_sort_pass().

static void radix_count ( const RCCMPEntry data,
int  size,
int  buckets[RADIX_PASSES][NBUCKETS] 
)
static

Definition at line 840 of file dnxhdenc.c.

Referenced by radix_sort().

static void radix_sort ( RCCMPEntry data,
int  size 
)
static

Definition at line 871 of file dnxhdenc.c.

Referenced by dnxhd_encode_fast().

static void radix_sort_pass ( RCCMPEntry dst,
const RCCMPEntry data,
int  size,
int  buckets[NBUCKETS],
int  pass 
)
static

Definition at line 860 of file dnxhdenc.c.

Referenced by radix_sort().

Variable Documentation

const { ... }
class_name = "dnxhd"
private

Definition at line 47 of file dnxhdenc.c.

Referenced by av_opt_show2().

const AVCodecDefault dnxhd_defaults[]
static
Initial value:
= {
{ "qmax", "1024" },
{ NULL },
}
NULL
Definition: eval.c:55

Definition at line 1034 of file dnxhdenc.c.

AVCodec ff_dnxhd_encoder
Initial value:
= {
.name = "dnxhd",
.priv_data_size = sizeof(DNXHDEncContext),
.capabilities = CODEC_CAP_SLICE_THREADS,
.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV422P,
.long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"),
.priv_class = &class,
.defaults = dnxhd_defaults,
}
static int dnxhd_encode_end(AVCodecContext *avctx)
Definition: dnxhdenc.c:1005
static int dnxhd_encode_init(AVCodecContext *avctx)
Definition: dnxhdenc.c:251
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:72
static const AVCodecDefault dnxhd_defaults[]
Definition: dnxhdenc.c:1034
static int dnxhd_encode_picture(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
Definition: dnxhdenc.c:942
static void close(AVCodecParserContext *s)
Definition: h264_parser.c:375
struct DNXHDEncContext DNXHDEncContext
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:280
#define CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
AVPixelFormat
Pixel format.
Definition: pixfmt.h:66

Definition at line 1039 of file dnxhdenc.c.

item_name = av_default_item_name
private

Definition at line 48 of file dnxhdenc.c.

option = options
private
const AVOption options[]
static
Initial value:
={
{"nitris_compat", "encode with Avid Nitris compatibility", offsetof(DNXHDEncContext, nitris_compat), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, VE},
}
NULL
Definition: eval.c:55
#define VE
Definition: dnxhdenc.c:38

Definition at line 41 of file dnxhdenc.c.

version = LIBAVUTIL_VERSION_INT
private

Definition at line 50 of file dnxhdenc.c.