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

Ut Video encoder. More...

#include "libavutil/avassert.h"
#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "codec_internal.h"
#include "encode.h"
#include "bswapdsp.h"
#include "bytestream.h"
#include "lossless_videoencdsp.h"
#include "put_bits.h"
#include "utvideo.h"
#include "huffman.h"

Go to the source code of this file.

Data Structures

struct  UtvideoContext
 
struct  HuffEntry
 

Macros

#define OFFSET(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, const 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, const 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 AVOption options []
 
static const AVClass utvideo_class
 
const FFCodec ff_utvideo_encoder
 

Detailed Description

Ut Video encoder.

Definition in file utvideoenc.c.

Macro Definition Documentation

◆ OFFSET

#define OFFSET ( x)
Value:

Definition at line 642 of file utvideoenc.c.

◆ VE

Definition at line 643 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 66 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 73 of file utvideoenc.c.

Referenced by calculate_codes().

◆ utvideo_encode_close()

static av_cold int utvideo_encode_close ( AVCodecContext * avctx)
static

Definition at line 79 of file utvideoenc.c.

◆ utvideo_encode_init()

static av_cold int utvideo_encode_init ( AVCodecContext * avctx)
static

Definition at line 91 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 250 of file utvideoenc.c.

Referenced by utvideo_encode_frame().

◆ median_predict()

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

Definition at line 295 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 329 of file utvideoenc.c.

Referenced by encode_plane().

◆ calculate_codes()

static void calculate_codes ( HuffEntry * he)
static

Definition at line 343 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 364 of file utvideoenc.c.

Referenced by encode_plane().

◆ encode_plane()

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

Definition at line 394 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 535 of file utvideoenc.c.

Variable Documentation

◆ 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, .unit = "pred" },
{ "none", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PRED_NONE }, INT_MIN, INT_MAX, VE, .unit = "pred" },
{ "left", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PRED_LEFT }, INT_MIN, INT_MAX, VE, .unit = "pred" },
{ "median", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PRED_MEDIAN }, INT_MIN, INT_MAX, VE, .unit = "pred" },
{ 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
@ PRED_MEDIAN
Definition utvideo.h:36
@ PRED_NONE
Definition utvideo.h:33
@ PRED_LEFT
Definition utvideo.h:34

Definition at line 644 of file utvideoenc.c.

◆ utvideo_class

const AVClass utvideo_class
static
Initial value:
= {
.class_name = "utvideo",
.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 653 of file utvideoenc.c.

◆ ff_utvideo_encoder

const FFCodec ff_utvideo_encoder
Initial value:
= {
.p.name = "utvideo",
CODEC_LONG_NAME("Ut Video"),
.p.type = AVMEDIA_TYPE_VIDEO,
.priv_data_size = sizeof(UtvideoContext),
.p.priv_class = &utvideo_class,
.color_ranges = AVCOL_RANGE_MPEG,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
}
#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_UTVIDEO
Definition codec_id.h:203
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
Definition pixfmt.h:766
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition pixfmt.h:73
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition pixfmt.h:77
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition pixfmt.h:78
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition pixfmt.h:212
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition pixfmt.h:165
static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pic, int *got_packet)
Definition utvideoenc.c:535
static const AVClass utvideo_class
Definition utvideoenc.c:653
static av_cold int utvideo_encode_close(AVCodecContext *avctx)
Definition utvideoenc.c:79
static av_cold int utvideo_encode_init(AVCodecContext *avctx)
Definition utvideoenc.c:91

Definition at line 660 of file utvideoenc.c.