FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Enumerations | Functions | Variables
hapenc.c File Reference

Hap encoder. More...

#include <stdint.h>
#include "snappy-c.h"
#include "libavutil/frame.h"
#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "bytestream.h"
#include "hap.h"
#include "internal.h"
#include "texturedsp.h"

Go to the source code of this file.

Macros

#define HAP_MAX_CHUNKS   64
 
#define OFFSET(x)   offsetof(HapContext, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 

Enumerations

enum  HapHeaderLength { HAP_HDR_SHORT = 4, HAP_HDR_LONG = 8 }
 

Functions

static void compress_texture (AVCodecContext *avctx, const AVFrame *f)
 
static void hap_write_section_header (PutByteContext *pbc, enum HapHeaderLength header_length, int section_length, enum HapSectionType section_type)
 
static int hap_compress_frame (AVCodecContext *avctx, uint8_t *dst)
 
static int hap_decode_instructions_length (HapContext *ctx)
 
static int hap_header_length (HapContext *ctx)
 
static void hap_write_frame_header (HapContext *ctx, uint8_t *dst, int frame_length)
 
static int hap_encode (AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
 
static av_cold int hap_init (AVCodecContext *avctx)
 
static av_cold int hap_close (AVCodecContext *avctx)
 

Variables

static const AVOption options []
 
static const AVClass hapenc_class
 
AVCodec ff_hap_encoder
 

Detailed Description

Hap encoder.

Fourcc: Hap1, Hap5, HapY

https://github.com/Vidvox/hap/blob/master/documentation/HapVideoDRAFT.md

Definition in file hapenc.c.

Macro Definition Documentation

#define HAP_MAX_CHUNKS   64

Definition at line 46 of file hapenc.c.

Referenced by hap_init().

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

Definition at line 298 of file hapenc.c.

Definition at line 299 of file hapenc.c.

Enumeration Type Documentation

Enumerator
HAP_HDR_SHORT 
HAP_HDR_LONG 

Definition at line 48 of file hapenc.c.

Function Documentation

static void compress_texture ( AVCodecContext avctx,
const AVFrame f 
)
static

Definition at line 55 of file hapenc.c.

Referenced by hap_encode().

static void hap_write_section_header ( PutByteContext pbc,
enum HapHeaderLength  header_length,
int  section_length,
enum HapSectionType  section_type 
)
static

Definition at line 71 of file hapenc.c.

Referenced by hap_write_frame_header().

static int hap_compress_frame ( AVCodecContext avctx,
uint8_t dst 
)
static

Definition at line 88 of file hapenc.c.

Referenced by hap_encode().

static int hap_decode_instructions_length ( HapContext ctx)
static

Definition at line 136 of file hapenc.c.

Referenced by hap_header_length(), and hap_write_frame_header().

static int hap_header_length ( HapContext ctx)
static

Definition at line 145 of file hapenc.c.

Referenced by hap_encode().

static void hap_write_frame_header ( HapContext ctx,
uint8_t dst,
int  frame_length 
)
static

Definition at line 158 of file hapenc.c.

Referenced by hap_encode().

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

Definition at line 190 of file hapenc.c.

static av_cold int hap_init ( AVCodecContext avctx)
static

Definition at line 220 of file hapenc.c.

static av_cold int hap_close ( AVCodecContext avctx)
static

Definition at line 289 of file hapenc.c.

Variable Documentation

const AVOption options[]
static
Initial value:
= {
{ "format", NULL, OFFSET(opt_tex_fmt), AV_OPT_TYPE_INT, { .i64 = HAP_FMT_RGBDXT1 }, HAP_FMT_RGBDXT1, HAP_FMT_YCOCGDXT5, FLAGS, "format" },
{ "hap", "Hap 1 (DXT1 textures)", 0, AV_OPT_TYPE_CONST, { .i64 = HAP_FMT_RGBDXT1 }, 0, 0, FLAGS, "format" },
{ "hap_alpha", "Hap Alpha (DXT5 textures)", 0, AV_OPT_TYPE_CONST, { .i64 = HAP_FMT_RGBADXT5 }, 0, 0, FLAGS, "format" },
{ "hap_q", "Hap Q (DXT5-YCoCg textures)", 0, AV_OPT_TYPE_CONST, { .i64 = HAP_FMT_YCOCGDXT5 }, 0, 0, FLAGS, "format" },
{ "chunks", "chunk count", OFFSET(opt_chunk_count), AV_OPT_TYPE_INT, {.i64 = 1 }, 1, HAP_MAX_CHUNKS, FLAGS, },
{ NULL },
}
#define NULL
Definition: coverity.c:32
#define HAP_MAX_CHUNKS
Definition: hapenc.c:46
#define FLAGS
Definition: hapenc.c:299
#define OFFSET(x)
Definition: hapenc.c:298

Definition at line 300 of file hapenc.c.

const AVClass hapenc_class
static
Initial value:
= {
.class_name = "Hap encoder",
.item_name = av_default_item_name,
.option = options,
}
#define LIBAVUTIL_VERSION_INT
Definition: version.h:62
av_default_item_name
static const AVOption options[]
Definition: hapenc.c:300

Definition at line 309 of file hapenc.c.

AVCodec ff_hap_encoder
Initial value:
= {
.name = "hap",
.long_name = NULL_IF_CONFIG_SMALL("Vidvox Hap encoder"),
.priv_data_size = sizeof(HapContext),
.priv_class = &hapenc_class,
.encode2 = hap_encode,
.close = hap_close,
.pix_fmts = (const enum AVPixelFormat[]) {
},
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE |
}
#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
Definition: hap.h:60
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static av_cold int hap_init(AVCodecContext *avctx)
Definition: hapenc.c:220
#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: internal.h:40
static const AVClass hapenc_class
Definition: hapenc.c:309
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:175
static av_cold int hap_close(AVCodecContext *avctx)
Definition: hapenc.c:289
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: pixfmt.h:95
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:209
static int hap_encode(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
Definition: hapenc.c:190
AVPixelFormat
Pixel format.
Definition: pixfmt.h:61

Definition at line 316 of file hapenc.c.