FFmpeg  4.0
Data Structures | Macros | Functions | Variables
dvenc.c File Reference

DV encoder. More...

#include "config.h"
#include "libavutil/attributes.h"
#include "libavutil/internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avcodec.h"
#include "dv.h"
#include "dv_profile_internal.h"
#include "dv_tablegen.h"
#include "fdctdsp.h"
#include "internal.h"
#include "mathops.h"
#include "me_cmp.h"
#include "pixblockdsp.h"
#include "put_bits.h"

Go to the source code of this file.

Data Structures

struct  EncBlockInfo
 

Macros

#define VE   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 
#define OFFSET(x)   offsetof(DVVideoContext, x)
 

Functions

static av_cold int dvvideo_encode_init (AVCodecContext *avctx)
 
static av_always_inline int dv_rl2vlc (int run, int l, int sign, uint32_t *vlc)
 
static av_always_inline int dv_rl2vlc_size (int run, int l)
 
static av_always_inline PutBitContextdv_encode_ac (EncBlockInfo *bi, PutBitContext *pb_pool, PutBitContext *pb_end)
 
static av_always_inline int dv_guess_dct_mode (DVVideoContext *s, uint8_t *data, ptrdiff_t linesize)
 
static av_always_inline int dv_init_enc_block (EncBlockInfo *bi, uint8_t *data, ptrdiff_t linesize, DVVideoContext *s, int bias)
 
static void dv_guess_qnos (EncBlockInfo *blks, int *qnos)
 
static int dv_encode_video_segment (AVCodecContext *avctx, void *arg)
 
static int dv_write_pack (enum dv_pack_type pack_id, DVVideoContext *c, uint8_t *buf)
 
static int dv_write_dif_id (enum dv_section_type t, uint8_t chan_num, uint8_t seq_num, uint8_t dif_num, uint8_t *buf)
 
static int dv_write_ssyb_id (uint8_t syb_num, uint8_t fr, uint8_t *buf)
 
static void dv_format_frame (DVVideoContext *c, uint8_t *buf)
 
static int dvvideo_encode_frame (AVCodecContext *c, AVPacket *pkt, const AVFrame *frame, int *got_packet)
 

Variables

static const int vs_total_ac_bits = (100 * 4 + 68 * 2) * 5
 
static const int mb_area_start [5] = { 1, 6, 21, 43, 64 }
 
static const int dv_weight_bits = 18
 
static const int dv_weight_88 [64]
 
static const int dv_weight_248 [64]
 
static const AVOption dv_options []
 
static const AVClass dvvideo_encode_class
 
AVCodec ff_dvvideo_encoder
 

Detailed Description

DV encoder.

Definition in file dvenc.c.

Macro Definition Documentation

◆ VE

Definition at line 756 of file dvenc.c.

◆ OFFSET

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

Definition at line 757 of file dvenc.c.

Function Documentation

◆ dvvideo_encode_init()

static av_cold int dvvideo_encode_init ( AVCodecContext avctx)
static

Definition at line 47 of file dvenc.c.

◆ dv_rl2vlc()

static av_always_inline int dv_rl2vlc ( int  run,
int  l,
int  sign,
uint32_t *  vlc 
)
static

Definition at line 137 of file dvenc.c.

Referenced by dv_encode_ac().

◆ dv_rl2vlc_size()

static av_always_inline int dv_rl2vlc_size ( int  run,
int  l 
)
static

Definition at line 143 of file dvenc.c.

Referenced by dv_guess_qnos(), and dv_init_enc_block().

◆ dv_encode_ac()

static av_always_inline PutBitContext* dv_encode_ac ( EncBlockInfo bi,
PutBitContext pb_pool,
PutBitContext pb_end 
)
static

Definition at line 163 of file dvenc.c.

Referenced by dv_encode_video_segment().

◆ dv_guess_dct_mode()

static av_always_inline int dv_guess_dct_mode ( DVVideoContext s,
uint8_t data,
ptrdiff_t  linesize 
)
static

Definition at line 209 of file dvenc.c.

Referenced by dv_init_enc_block().

◆ dv_init_enc_block()

static av_always_inline int dv_init_enc_block ( EncBlockInfo bi,
uint8_t data,
ptrdiff_t  linesize,
DVVideoContext s,
int  bias 
)
static

Definition at line 246 of file dvenc.c.

Referenced by dv_encode_video_segment().

◆ dv_guess_qnos()

static void dv_guess_qnos ( EncBlockInfo blks,
int qnos 
)
inlinestatic

Definition at line 353 of file dvenc.c.

Referenced by dv_encode_video_segment().

◆ dv_encode_video_segment()

static int dv_encode_video_segment ( AVCodecContext avctx,
void arg 
)
static

Definition at line 425 of file dvenc.c.

Referenced by dvvideo_encode_frame().

◆ dv_write_pack()

static int dv_write_pack ( enum dv_pack_type  pack_id,
DVVideoContext c,
uint8_t buf 
)
inlinestatic

Definition at line 565 of file dvenc.c.

Referenced by dv_format_frame().

◆ dv_write_dif_id()

static int dv_write_dif_id ( enum dv_section_type  t,
uint8_t  chan_num,
uint8_t  seq_num,
uint8_t  dif_num,
uint8_t buf 
)
inlinestatic

Definition at line 642 of file dvenc.c.

Referenced by dv_format_frame().

◆ dv_write_ssyb_id()

static int dv_write_ssyb_id ( uint8_t  syb_num,
uint8_t  fr,
uint8_t buf 
)
inlinestatic

Definition at line 654 of file dvenc.c.

Referenced by dv_format_frame().

◆ dv_format_frame()

static void dv_format_frame ( DVVideoContext c,
uint8_t buf 
)
static

Definition at line 674 of file dvenc.c.

Referenced by dvvideo_encode_frame().

◆ dvvideo_encode_frame()

static int dvvideo_encode_frame ( AVCodecContext c,
AVPacket pkt,
const AVFrame frame,
int got_packet 
)
static

Definition at line 724 of file dvenc.c.

Variable Documentation

◆ vs_total_ac_bits

const int vs_total_ac_bits = (100 * 4 + 68 * 2) * 5
static

Definition at line 93 of file dvenc.c.

Referenced by dv_encode_video_segment(), and dv_guess_qnos().

◆ mb_area_start

const int mb_area_start[5] = { 1, 6, 21, 43, 64 }
static

Definition at line 94 of file dvenc.c.

Referenced by dv_guess_qnos(), and dv_init_enc_block().

◆ dv_weight_bits

const int dv_weight_bits = 18
static

Definition at line 224 of file dvenc.c.

Referenced by dv_init_enc_block().

◆ dv_weight_88

const int dv_weight_88[64]
static
Initial value:
= {
131072, 257107, 257107, 242189, 252167, 242189, 235923, 237536,
237536, 235923, 229376, 231390, 223754, 231390, 229376, 222935,
224969, 217965, 217965, 224969, 222935, 200636, 218652, 211916,
212325, 211916, 218652, 200636, 188995, 196781, 205965, 206433,
206433, 205965, 196781, 188995, 185364, 185364, 200636, 200704,
200636, 185364, 185364, 174609, 180568, 195068, 195068, 180568,
174609, 170091, 175557, 189591, 175557, 170091, 165371, 170627,
170627, 165371, 160727, 153560, 160727, 144651, 144651, 136258,
}

Definition at line 225 of file dvenc.c.

Referenced by dv_init_enc_block().

◆ dv_weight_248

const int dv_weight_248[64]
static
Initial value:
= {
131072, 262144, 257107, 257107, 242189, 242189, 242189, 242189,
237536, 237536, 229376, 229376, 200636, 200636, 224973, 224973,
223754, 223754, 235923, 235923, 229376, 229376, 217965, 217965,
211916, 211916, 196781, 196781, 185364, 185364, 206433, 206433,
211916, 211916, 222935, 222935, 200636, 200636, 205964, 205964,
200704, 200704, 180568, 180568, 175557, 175557, 195068, 195068,
185364, 185364, 188995, 188995, 174606, 174606, 175557, 175557,
170627, 170627, 153560, 153560, 165371, 165371, 144651, 144651,
}

Definition at line 235 of file dvenc.c.

Referenced by dv_init_enc_block().

◆ dv_options

const AVOption dv_options[]
static
Initial value:
= {
{ "quant_deadzone", "Quantizer dead zone", OFFSET(quant_deadzone), AV_OPT_TYPE_INT, { .i64 = 7 }, 0, 1024, VE },
{ NULL },
}
#define NULL
Definition: coverity.c:32
#define VE
Definition: dvenc.c:756
#define OFFSET(x)
Definition: dvenc.c:757

Definition at line 758 of file dvenc.c.

◆ dvvideo_encode_class

const AVClass dvvideo_encode_class
static
Initial value:
= {
.class_name = "dvvideo encoder",
.item_name = av_default_item_name,
.option = dv_options,
}
static const AVOption dv_options[]
Definition: dvenc.c:758
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:191

Definition at line 763 of file dvenc.c.

◆ ff_dvvideo_encoder

AVCodec ff_dvvideo_encoder
Initial value:
= {
.name = "dvvideo",
.long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
.priv_data_size = sizeof(DVVideoContext),
.pix_fmts = (const enum AVPixelFormat[]) {
},
.priv_class = &dvvideo_encode_class,
}
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
#define AV_CODEC_CAP_INTRA_ONLY
Codec is intra only.
Definition: avcodec.h:1045
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition: avcodec.h:1015
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:66
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
Definition: avcodec.h:1019
static av_cold int dvvideo_encode_init(AVCodecContext *avctx)
Definition: dvenc.c:47
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:266
static int dvvideo_encode_frame(AVCodecContext *c, AVPacket *pkt, const AVFrame *frame, int *got_packet)
Definition: dvenc.c:724
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:62
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:69
static const AVClass dvvideo_encode_class
Definition: dvenc.c:763
AVPixelFormat
Pixel format.
Definition: pixfmt.h:60

Definition at line 770 of file dvenc.c.