FFmpeg
Data Structures | Macros | Functions | Variables
cfhdenc.c File Reference
#include <stdlib.h>
#include <string.h>
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "bytestream.h"
#include "cfhd.h"
#include "cfhdencdsp.h"
#include "codec_internal.h"
#include "encode.h"
#include "put_bits.h"
#include "thread.h"

Go to the source code of this file.

Data Structures

struct  Codebook
 
struct  Runbook
 
struct  PlaneEnc
 
struct  CFHDEncContext
 

Macros

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

Functions

static av_cold int cfhd_encode_init (AVCodecContext *avctx)
 
static void quantize_band (int16_t *input, int width, int a_width, int height, unsigned quantization)
 
static int put_runcode (PutBitContext *pb, int count, const Runbook *const rb)
 
static void process_alpha (const int16_t *src, int width, int height, ptrdiff_t stride, int16_t *dst)
 
static int cfhd_encode_frame (AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
 
static av_cold int cfhd_encode_close (AVCodecContext *avctx)
 

Variables

static const unsigned codebook [256][2]
 
static const uint16_t runbook [18][3]
 
static const uint16_t quantization_per_subband [2][3][13][9]
 
static const AVOption options []
 
static const AVClass cfhd_class
 
const FFCodec ff_cfhd_encoder
 

Detailed Description

Cineform HD video encoder

Definition in file cfhdenc.c.

Macro Definition Documentation

◆ OFFSET

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

Definition at line 829 of file cfhdenc.c.

◆ VE

Definition at line 830 of file cfhdenc.c.

Function Documentation

◆ cfhd_encode_init()

static av_cold int cfhd_encode_init ( AVCodecContext avctx)
static

Definition at line 247 of file cfhdenc.c.

◆ quantize_band()

static void quantize_band ( int16_t *  input,
int  width,
int  a_width,
int  height,
unsigned  quantization 
)
static

Definition at line 381 of file cfhdenc.c.

Referenced by cfhd_encode_frame().

◆ put_runcode()

static int put_runcode ( PutBitContext pb,
int  count,
const Runbook *const  rb 
)
static

Definition at line 393 of file cfhdenc.c.

Referenced by cfhd_encode_frame().

◆ process_alpha()

static void process_alpha ( const int16_t *  src,
int  width,
int  height,
ptrdiff_t  stride,
int16_t *  dst 
)
static

Definition at line 405 of file cfhdenc.c.

Referenced by cfhd_encode_frame().

◆ cfhd_encode_frame()

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

Definition at line 426 of file cfhdenc.c.

◆ cfhd_encode_close()

static av_cold int cfhd_encode_close ( AVCodecContext avctx)
static

Definition at line 809 of file cfhdenc.c.

Variable Documentation

◆ codebook

const unsigned codebook[256][2]
static

◆ runbook

const uint16_t runbook[18][3]
static
Initial value:
= {
{1, 0x0000, 1}, {2, 0x0000, 2}, {3, 0x0000, 3}, {4, 0x0000, 4},
{5, 0x0000, 5}, {6, 0x0000, 6}, {7, 0x0000, 7}, {8, 0x0000, 8},
{9, 0x0000, 9}, {10, 0x0000, 10}, {11, 0x0000, 11},
{7, 0x0069, 12}, {8, 0x00D1, 20}, {9, 0x018A, 32},
{10, 0x0343, 60}, {11, 0x0685, 100}, {13, 0x18BF, 180}, {13, 0x1BA5, 320},
}

Definition at line 98 of file cfhdenc.c.

Referenced by cfhd_encode_init().

◆ quantization_per_subband

const uint16_t quantization_per_subband[2][3][13][9]
static

Definition at line 110 of file cfhdenc.c.

Referenced by cfhd_encode_frame().

◆ options

const AVOption options[]
static
Initial value:
= {
{ "quality", "set quality", OFFSET(quality), AV_OPT_TYPE_INT, {.i64= 0}, 0, 12, VE, .unit = "q" },
{ "film3+", NULL, 0, AV_OPT_TYPE_CONST, {.i64= 0}, 0, 0, VE, .unit = "q" },
{ "film3", NULL, 0, AV_OPT_TYPE_CONST, {.i64= 1}, 0, 0, VE, .unit = "q" },
{ "film2+", NULL, 0, AV_OPT_TYPE_CONST, {.i64= 2}, 0, 0, VE, .unit = "q" },
{ "film2", NULL, 0, AV_OPT_TYPE_CONST, {.i64= 3}, 0, 0, VE, .unit = "q" },
{ "film1.5", NULL, 0, AV_OPT_TYPE_CONST, {.i64= 4}, 0, 0, VE, .unit = "q" },
{ "film1+", NULL, 0, AV_OPT_TYPE_CONST, {.i64= 5}, 0, 0, VE, .unit = "q" },
{ "film1", NULL, 0, AV_OPT_TYPE_CONST, {.i64= 6}, 0, 0, VE, .unit = "q" },
{ "high+", NULL, 0, AV_OPT_TYPE_CONST, {.i64= 7}, 0, 0, VE, .unit = "q" },
{ "high", NULL, 0, AV_OPT_TYPE_CONST, {.i64= 8}, 0, 0, VE, .unit = "q" },
{ "medium+", NULL, 0, AV_OPT_TYPE_CONST, {.i64= 9}, 0, 0, VE, .unit = "q" },
{ "medium", NULL, 0, AV_OPT_TYPE_CONST, {.i64=10}, 0, 0, VE, .unit = "q" },
{ "low+", NULL, 0, AV_OPT_TYPE_CONST, {.i64=11}, 0, 0, VE, .unit = "q" },
{ "low", NULL, 0, AV_OPT_TYPE_CONST, {.i64=12}, 0, 0, VE, .unit = "q" },
{ NULL},
}

Definition at line 831 of file cfhdenc.c.

◆ cfhd_class

const AVClass cfhd_class
static
Initial value:
= {
.class_name = "cfhd",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 849 of file cfhdenc.c.

◆ ff_cfhd_encoder

const FFCodec ff_cfhd_encoder
Initial value:
= {
.p.name = "cfhd",
CODEC_LONG_NAME("GoPro CineForm HD"),
.p.type = AVMEDIA_TYPE_VIDEO,
.priv_data_size = sizeof(CFHDEncContext),
.p.priv_class = &cfhd_class,
.p.pix_fmts = (const enum AVPixelFormat[]) {
},
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
}

Definition at line 856 of file cfhdenc.c.

AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: codec_internal.h:42
VE
#define VE
Definition: cfhdenc.c:830
cfhd_class
static const AVClass cfhd_class
Definition: cfhdenc.c:849
quality
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about quality
Definition: rate_distortion.txt:12
FF_CODEC_ENCODE_CB
#define FF_CODEC_ENCODE_CB(func)
Definition: codec_internal.h:296
options
static const AVOption options[]
Definition: cfhdenc.c:831
AV_CODEC_ID_CFHD
@ AV_CODEC_ID_CFHD
Definition: codec_id.h:267
AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:499
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
#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:159
cfhd_encode_init
static av_cold int cfhd_encode_init(AVCodecContext *avctx)
Definition: cfhdenc.c:247
cfhd_encode_frame
static int cfhd_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
Definition: cfhdenc.c:426
cfhd_encode_close
static av_cold int cfhd_encode_close(AVCodecContext *avctx)
Definition: cfhdenc.c:809
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:272
AV_CODEC_CAP_FRAME_THREADS
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition: codec.h:110
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:479
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
CFHDEncContext
Definition: cfhdenc.c:227
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:495
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
OFFSET
#define OFFSET(x)
Definition: cfhdenc.c:829
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:244