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 821 of file cfhdenc.c.

◆ VE

Definition at line 822 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 377 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 389 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 401 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 422 of file cfhdenc.c.

◆ cfhd_encode_close()

static av_cold int cfhd_encode_close ( AVCodecContext avctx)
static

Definition at line 801 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, "q" },
{ "film3+", NULL, 0, AV_OPT_TYPE_CONST, {.i64= 0}, 0, 0, VE, "q" },
{ "film3", NULL, 0, AV_OPT_TYPE_CONST, {.i64= 1}, 0, 0, VE, "q" },
{ "film2+", NULL, 0, AV_OPT_TYPE_CONST, {.i64= 2}, 0, 0, VE, "q" },
{ "film2", NULL, 0, AV_OPT_TYPE_CONST, {.i64= 3}, 0, 0, VE, "q" },
{ "film1.5", NULL, 0, AV_OPT_TYPE_CONST, {.i64= 4}, 0, 0, VE, "q" },
{ "film1+", NULL, 0, AV_OPT_TYPE_CONST, {.i64= 5}, 0, 0, VE, "q" },
{ "film1", NULL, 0, AV_OPT_TYPE_CONST, {.i64= 6}, 0, 0, VE, "q" },
{ "high+", NULL, 0, AV_OPT_TYPE_CONST, {.i64= 7}, 0, 0, VE, "q" },
{ "high", NULL, 0, AV_OPT_TYPE_CONST, {.i64= 8}, 0, 0, VE, "q" },
{ "medium+", NULL, 0, AV_OPT_TYPE_CONST, {.i64= 9}, 0, 0, VE, "q" },
{ "medium", NULL, 0, AV_OPT_TYPE_CONST, {.i64=10}, 0, 0, VE, "q" },
{ "low+", NULL, 0, AV_OPT_TYPE_CONST, {.i64=11}, 0, 0, VE, "q" },
{ "low", NULL, 0, AV_OPT_TYPE_CONST, {.i64=12}, 0, 0, VE, "q" },
{ NULL},
}

Definition at line 823 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 841 of file cfhdenc.c.

◆ ff_cfhd_encoder

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

Definition at line 848 of file cfhdenc.c.

AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
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:39
VE
#define VE
Definition: cfhdenc.c:822
cfhd_class
static const AVClass cfhd_class
Definition: cfhdenc.c:841
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:263
options
static const AVOption options[]
Definition: cfhdenc.c:823
AV_CODEC_ID_CFHD
@ AV_CODEC_ID_CFHD
Definition: codec_id.h:266
AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:427
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:422
cfhd_encode_close
static av_cold int cfhd_encode_close(AVCodecContext *avctx)
Definition: cfhdenc.c:801
AV_CODEC_CAP_FRAME_THREADS
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition: codec.h:113
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:407
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
CFHDEncContext
Definition: cfhdenc.c:227
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:423
FF_CODEC_CAP_INIT_THREADSAFE
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
Definition: codec_internal.h:31
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
OFFSET
#define OFFSET(x)
Definition: cfhdenc.c:821
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234