FFmpeg
Loading...
Searching...
No Matches
cfhdenc.c File Reference

Cineform HD video encoder. More...

#include <stddef.h>
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avcodec.h"
#include "bytestream.h"
#include "cfhd.h"
#include "cfhdencdsp.h"
#include "codec_internal.h"
#include "encode.h"
#include "put_bits.h"

Go to the source code of this file.

Data Structures

struct  Codebook
 
struct  Runbook
 
struct  PlaneEnc
 
struct  CFHDEncContext
 

Macros

#define OFFSET(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)
Value:

Definition at line 828 of file cfhdenc.c.

◆ VE

Definition at line 829 of file cfhdenc.c.

Function Documentation

◆ cfhd_encode_init()

static av_cold int cfhd_encode_init ( AVCodecContext * avctx)
static

Definition at line 246 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 380 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 392 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 404 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 425 of file cfhdenc.c.

◆ cfhd_encode_close()

static av_cold int cfhd_encode_close ( AVCodecContext * avctx)
static

Definition at line 808 of file cfhdenc.c.

Variable Documentation

◆ codebook

◆ 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 97 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 109 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},
}
#define VE
Definition amfenc_av1.c:30
#define NULL
Definition coverity.c:32
#define OFFSET(x)
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
static const uint8_t quality[]
Definition vmixdec.c:58

Definition at line 830 of file cfhdenc.c.

◆ cfhd_class

const AVClass cfhd_class
static
Initial value:
= {
.class_name = "cfhd",
.item_name = av_default_item_name,
.option = options,
}
const char * av_default_item_name(void *ptr)
Return the context name.
Definition log.c:241
#define LIBAVUTIL_VERSION_INT
Definition version.h:85

Definition at line 848 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,
.color_ranges = AVCOL_RANGE_MPEG,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
}
static av_cold int cfhd_encode_init(AVCodecContext *avctx)
Definition cfhdenc.c:246
static const AVClass cfhd_class
Definition cfhdenc.c:848
static int cfhd_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
Definition cfhdenc.c:425
static av_cold int cfhd_encode_close(AVCodecContext *avctx)
Definition cfhdenc.c:808
#define CODEC_PIXFMTS(...)
#define FF_CODEC_ENCODE_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
#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:147
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition codec.h:49
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition codec.h:98
@ AV_CODEC_ID_CFHD
Definition codec_id.h:262
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
#define AV_PIX_FMT_GBRAP12
Definition pixfmt.h:569
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
Definition pixfmt.h:766
#define AV_PIX_FMT_YUV422P10
Definition pixfmt.h:546
#define AV_PIX_FMT_GBRP12
Definition pixfmt.h:565

Definition at line 855 of file cfhdenc.c.