FFmpeg
Data Structures | Macros | Functions | Variables
utvideoenc.c File Reference
#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "internal.h"
#include "bswapdsp.h"
#include "bytestream.h"
#include "put_bits.h"
#include "mathops.h"
#include "utvideo.h"
#include "huffman.h"

Go to the source code of this file.

Data Structures

struct  HuffEntry
 

Macros

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

Functions

static int ut_huff_cmp_len (const void *a, const void *b)
 
static int huff_cmp_sym (const void *a, const void *b)
 
static av_cold int utvideo_encode_close (AVCodecContext *avctx)
 
static av_cold int utvideo_encode_init (AVCodecContext *avctx)
 
static void mangle_rgb_planes (uint8_t *dst[4], ptrdiff_t dst_stride, uint8_t *const src[4], int planes, const int stride[4], int width, int height)
 
static void median_predict (UtvideoContext *c, uint8_t *src, uint8_t *dst, ptrdiff_t stride, int width, int height)
 
static void count_usage (uint8_t *src, int width, int height, uint64_t *counts)
 
static void calculate_codes (HuffEntry *he)
 
static int write_huff_codes (uint8_t *src, uint8_t *dst, int dst_size, int width, int height, HuffEntry *he)
 
static int encode_plane (AVCodecContext *avctx, uint8_t *src, uint8_t *dst, ptrdiff_t stride, int plane_no, int width, int height, PutByteContext *pb)
 
static int utvideo_encode_frame (AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pic, int *got_packet)
 

Variables

static const int ut_pred_order [5]
 
static const AVOption options []
 
static const AVClass utvideo_class
 
AVCodec ff_utvideo_encoder
 

Detailed Description

Ut Video encoder

Definition in file utvideoenc.c.

Macro Definition Documentation

◆ OFFSET

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

Definition at line 670 of file utvideoenc.c.

◆ VE

Definition at line 671 of file utvideoenc.c.

Function Documentation

◆ ut_huff_cmp_len()

static int ut_huff_cmp_len ( const void *  a,
const void *  b 
)
static

Definition at line 53 of file utvideoenc.c.

Referenced by calculate_codes().

◆ huff_cmp_sym()

static int huff_cmp_sym ( const void *  a,
const void *  b 
)
static

Definition at line 60 of file utvideoenc.c.

Referenced by calculate_codes().

◆ utvideo_encode_close()

static av_cold int utvideo_encode_close ( AVCodecContext avctx)
static

Definition at line 66 of file utvideoenc.c.

Referenced by utvideo_encode_init().

◆ utvideo_encode_init()

static av_cold int utvideo_encode_init ( AVCodecContext avctx)
static

Definition at line 78 of file utvideoenc.c.

◆ mangle_rgb_planes()

static void mangle_rgb_planes ( uint8_t dst[4],
ptrdiff_t  dst_stride,
uint8_t *const  src[4],
int  planes,
const int  stride[4],
int  width,
int  height 
)
static

Definition at line 264 of file utvideoenc.c.

Referenced by utvideo_encode_frame().

◆ median_predict()

static void median_predict ( UtvideoContext c,
uint8_t src,
uint8_t dst,
ptrdiff_t  stride,
int  width,
int  height 
)
static

Definition at line 309 of file utvideoenc.c.

Referenced by encode_plane().

◆ count_usage()

static void count_usage ( uint8_t src,
int  width,
int  height,
uint64_t *  counts 
)
static

Definition at line 343 of file utvideoenc.c.

Referenced by encode_plane().

◆ calculate_codes()

static void calculate_codes ( HuffEntry he)
static

Definition at line 357 of file utvideoenc.c.

Referenced by encode_plane().

◆ write_huff_codes()

static int write_huff_codes ( uint8_t src,
uint8_t dst,
int  dst_size,
int  width,
int  height,
HuffEntry he 
)
static

Definition at line 378 of file utvideoenc.c.

Referenced by encode_plane().

◆ encode_plane()

static int encode_plane ( AVCodecContext avctx,
uint8_t src,
uint8_t dst,
ptrdiff_t  stride,
int  plane_no,
int  width,
int  height,
PutByteContext pb 
)
static

Definition at line 410 of file utvideoenc.c.

Referenced by utvideo_encode_frame().

◆ utvideo_encode_frame()

static int utvideo_encode_frame ( AVCodecContext avctx,
AVPacket pkt,
const AVFrame pic,
int got_packet 
)
static

Definition at line 551 of file utvideoenc.c.

Variable Documentation

◆ ut_pred_order

const int ut_pred_order[5]
static
Initial value:

Definition at line 47 of file utvideoenc.c.

Referenced by utvideo_encode_init().

◆ options

const AVOption options[]
static
Initial value:
= {
{ "pred", "Prediction method", OFFSET(frame_pred), AV_OPT_TYPE_INT, { .i64 = PRED_LEFT }, PRED_NONE, PRED_MEDIAN, VE, "pred" },
{ "none", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PRED_NONE }, INT_MIN, INT_MAX, VE, "pred" },
{ "left", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PRED_LEFT }, INT_MIN, INT_MAX, VE, "pred" },
{ "gradient", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PRED_GRADIENT }, INT_MIN, INT_MAX, VE, "pred" },
{ "median", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PRED_MEDIAN }, INT_MIN, INT_MAX, VE, "pred" },
{ NULL},
}

Definition at line 672 of file utvideoenc.c.

◆ utvideo_class

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

Definition at line 682 of file utvideoenc.c.

◆ ff_utvideo_encoder

AVCodec ff_utvideo_encoder
Initial value:
= {
.name = "utvideo",
.long_name = NULL_IF_CONFIG_SMALL("Ut Video"),
.priv_data_size = sizeof(UtvideoContext),
.priv_class = &utvideo_class,
.capabilities = AV_CODEC_CAP_FRAME_THREADS,
.pix_fmts = (const enum AVPixelFormat[]) {
},
}

Definition at line 689 of file utvideoenc.c.

AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
init
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:31
PRED_GRADIENT
@ PRED_GRADIENT
Definition: utvideo.h:40
utvideo_encode_frame
static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pic, int *got_packet)
Definition: utvideoenc.c:551
AV_PIX_FMT_GBRAP
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:215
PRED_LEFT
@ PRED_LEFT
Definition: utvideo.h:39
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:309
AV_CODEC_ID_UTVIDEO
@ AV_CODEC_ID_UTVIDEO
Definition: codec_id.h:202
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
AV_CODEC_CAP_FRAME_THREADS
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition: codec.h:108
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:235
utvideo_encode_init
static av_cold int utvideo_encode_init(AVCodecContext *avctx)
Definition: utvideoenc.c:78
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
VE
#define VE
Definition: utvideoenc.c:671
utvideo_encode_close
static av_cold int utvideo_encode_close(AVCodecContext *avctx)
Definition: utvideoenc.c:66
options
static const AVOption options[]
Definition: utvideoenc.c:672
UtvideoContext
Definition: utvideo.h:64
PRED_NONE
@ PRED_NONE
Definition: utvideo.h:38
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:168
PRED_MEDIAN
@ PRED_MEDIAN
Definition: utvideo.h:41
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
utvideo_class
static const AVClass utvideo_class
Definition: utvideoenc.c:682
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234
OFFSET
#define OFFSET(x)
Definition: utvideoenc.c:670