FFmpeg
Data Structures | Macros | Functions | Variables
cfhdenc.c File Reference

Cineform HD video encoder. More...

#include <stdlib.h>
#include <string.h>
#include "libavutil/avassert.h"
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "bytestream.h"
#include "cfhd.h"
#include "put_bits.h"
#include "internal.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 av_always_inline void filter (int16_t *input, ptrdiff_t in_stride, int16_t *low, ptrdiff_t low_stride, int16_t *high, ptrdiff_t high_stride, int len)
 
static void horiz_filter (int16_t *input, int16_t *low, int16_t *high, int width)
 
static void vert_filter (int16_t *input, ptrdiff_t in_stride, int16_t *low, ptrdiff_t low_stride, int16_t *high, ptrdiff_t high_stride, int len)
 
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
 
AVCodec ff_cfhd_encoder
 

Detailed Description

Cineform HD video encoder.

Definition in file cfhdenc.c.

Macro Definition Documentation

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

Definition at line 878 of file cfhdenc.c.

Definition at line 879 of file cfhdenc.c.

Function Documentation

static av_cold int cfhd_encode_init ( AVCodecContext avctx)
static

Definition at line 244 of file cfhdenc.c.

static av_always_inline void filter ( int16_t *  input,
ptrdiff_t  in_stride,
int16_t *  low,
ptrdiff_t  low_stride,
int16_t *  high,
ptrdiff_t  high_stride,
int  len 
)
static

Definition at line 372 of file cfhdenc.c.

Referenced by horiz_filter(), and vert_filter().

static void horiz_filter ( int16_t *  input,
int16_t *  low,
int16_t *  high,
int  width 
)
static

Definition at line 395 of file cfhdenc.c.

Referenced by cfhd_encode_frame().

static void vert_filter ( int16_t *  input,
ptrdiff_t  in_stride,
int16_t *  low,
ptrdiff_t  low_stride,
int16_t *  high,
ptrdiff_t  high_stride,
int  len 
)
static

Definition at line 401 of file cfhdenc.c.

Referenced by cfhd_encode_frame().

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

Definition at line 408 of file cfhdenc.c.

Referenced by cfhd_encode_frame().

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

Definition at line 420 of file cfhdenc.c.

Referenced by cfhd_encode_frame().

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

Definition at line 432 of file cfhdenc.c.

Referenced by cfhd_encode_frame().

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

Definition at line 453 of file cfhdenc.c.

static av_cold int cfhd_encode_close ( AVCodecContext avctx)
static

Definition at line 858 of file cfhdenc.c.

Variable Documentation

const unsigned codebook[256][2]
static
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().

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

Definition at line 109 of file cfhdenc.c.

Referenced by cfhd_encode_frame().

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},
}
#define NULL
Definition: coverity.c:32
#define VE
Definition: cfhdenc.c:879
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about quality
#define OFFSET(x)
Definition: cfhdenc.c:878

Definition at line 880 of file cfhdenc.c.

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

Definition at line 898 of file cfhdenc.c.

AVCodec ff_cfhd_encoder
Initial value:
= {
.name = "cfhd",
.long_name = NULL_IF_CONFIG_SMALL("GoPro CineForm HD"),
.priv_data_size = sizeof(CFHDEncContext),
.priv_class = &cfhd_class,
.encode2 = cfhd_encode_frame,
.capabilities = AV_CODEC_CAP_FRAME_THREADS,
.pix_fmts = (const enum AVPixelFormat[]) {
},
.caps_internal = 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: internal.h:48
static const AVClass cfhd_class
Definition: cfhdenc.c:898
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static av_cold int cfhd_encode_init(AVCodecContext *avctx)
Definition: cfhdenc.c:244
static av_cold int cfhd_encode_close(AVCodecContext *avctx)
Definition: cfhdenc.c:858
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:153
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:420
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition: codec.h:106
static int cfhd_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
Definition: cfhdenc.c:453
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:300
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:416
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:400
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64

Definition at line 905 of file cfhdenc.c.