FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
exrenc.c File Reference

OpenEXR encoder. More...

#include <float.h>
#include <zlib.h>
#include "libavutil/avassert.h"
#include "libavutil/opt.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/imgutils.h"
#include "libavutil/pixdesc.h"
#include "avcodec.h"
#include "bytestream.h"
#include "internal.h"
#include "float2half.h"

Go to the source code of this file.

Data Structures

struct  EXRScanlineData
 
struct  EXRContext
 

Macros

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

Enumerations

enum  ExrCompr {
  EXR_RAW, EXR_RLE, EXR_ZIP1, EXR_ZIP16,
  EXR_PIZ, EXR_PXR24, EXR_B44, EXR_B44A,
  EXR_DWAA, EXR_DWAB, EXR_UNKN, EXR_RAW,
  EXR_RLE, EXR_ZIP1, EXR_ZIP16, EXR_NBCOMPR
}
 
enum  ExrPixelType {
  EXR_UINT, EXR_HALF, EXR_FLOAT, EXR_UNKNOWN,
  EXR_UINT, EXR_HALF, EXR_FLOAT, EXR_UNKNOWN
}
 

Functions

static int encode_init (AVCodecContext *avctx)
 
static int encode_close (AVCodecContext *avctx)
 
static void reorder_pixels (uint8_t *dst, const uint8_t *src, ptrdiff_t size)
 
static void predictor (uint8_t *src, ptrdiff_t size)
 
static int64_t rle_compress (uint8_t *out, int64_t out_size, const uint8_t *in, int64_t in_size)
 
static int encode_scanline_rle (EXRContext *s, const AVFrame *frame)
 
static int encode_scanline_zip (EXRContext *s, const AVFrame *frame)
 
static int encode_frame (AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
 

Variables

static const char abgr_chlist [4] = { 'A', 'B', 'G', 'R' }
 
static const char bgr_chlist [4] = { 'B', 'G', 'R', 'A' }
 
static const uint8_t gbra_order [4] = { 3, 1, 0, 2 }
 
static const uint8_t gbr_order [4] = { 1, 0, 2, 0 }
 
static const AVOption options []
 
static const AVClass exr_class
 
AVCodec ff_exr_encoder
 

Detailed Description

OpenEXR encoder.

Definition in file exrenc.c.

Macro Definition Documentation

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

Definition at line 515 of file exrenc.c.

Definition at line 516 of file exrenc.c.

Enumeration Type Documentation

enum ExrCompr
Enumerator
EXR_RAW 
EXR_RLE 
EXR_ZIP1 
EXR_ZIP16 
EXR_PIZ 
EXR_PXR24 
EXR_B44 
EXR_B44A 
EXR_DWAA 
EXR_DWAB 
EXR_UNKN 
EXR_RAW 
EXR_RLE 
EXR_ZIP1 
EXR_ZIP16 
EXR_NBCOMPR 

Definition at line 39 of file exrenc.c.

Enumerator
EXR_UINT 
EXR_HALF 
EXR_FLOAT 
EXR_UNKNOWN 
EXR_UINT 
EXR_HALF 
EXR_FLOAT 
EXR_UNKNOWN 

Definition at line 47 of file exrenc.c.

Function Documentation

static int encode_init ( AVCodecContext avctx)
static

Definition at line 91 of file exrenc.c.

static int encode_close ( AVCodecContext avctx)
static

Definition at line 134 of file exrenc.c.

static void reorder_pixels ( uint8_t dst,
const uint8_t src,
ptrdiff_t  size 
)
static

Definition at line 151 of file exrenc.c.

Referenced by encode_scanline_rle(), and encode_scanline_zip().

static void predictor ( uint8_t src,
ptrdiff_t  size 
)
static
static int64_t rle_compress ( uint8_t out,
int64_t  out_size,
const uint8_t in,
int64_t  in_size 
)
static

Definition at line 175 of file exrenc.c.

Referenced by encode_scanline_rle().

static int encode_scanline_rle ( EXRContext s,
const AVFrame frame 
)
static

Definition at line 214 of file exrenc.c.

Referenced by encode_frame().

static int encode_scanline_zip ( EXRContext s,
const AVFrame frame 
)
static

Definition at line 272 of file exrenc.c.

Referenced by encode_frame().

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

Definition at line 343 of file exrenc.c.

Variable Documentation

const char abgr_chlist[4] = { 'A', 'B', 'G', 'R' }
static

Definition at line 54 of file exrenc.c.

Referenced by encode_init().

const char bgr_chlist[4] = { 'B', 'G', 'R', 'A' }
static

Definition at line 55 of file exrenc.c.

Referenced by encode_init().

const uint8_t gbra_order[4] = { 3, 1, 0, 2 }
static

Definition at line 56 of file exrenc.c.

Referenced by encode_init().

const uint8_t gbr_order[4] = { 1, 0, 2, 0 }
static

Definition at line 57 of file exrenc.c.

Referenced by encode_init().

const AVOption options[]
static
Initial value:
= {
{ "compression", "set compression type", OFFSET(compression), AV_OPT_TYPE_INT, {.i64=0}, 0, EXR_NBCOMPR-1, VE, "compr" },
{ "none", "none", 0, AV_OPT_TYPE_CONST, {.i64=EXR_RAW}, 0, 0, VE, "compr" },
{ "rle" , "RLE", 0, AV_OPT_TYPE_CONST, {.i64=EXR_RLE}, 0, 0, VE, "compr" },
{ "zip1", "ZIP1", 0, AV_OPT_TYPE_CONST, {.i64=EXR_ZIP1}, 0, 0, VE, "compr" },
{ "zip16", "ZIP16", 0, AV_OPT_TYPE_CONST, {.i64=EXR_ZIP16}, 0, 0, VE, "compr" },
{ "format", "set pixel type", OFFSET(pixel_type), AV_OPT_TYPE_INT, {.i64=EXR_FLOAT}, EXR_HALF, EXR_UNKNOWN-1, VE, "pixel" },
{ "half" , NULL, 0, AV_OPT_TYPE_CONST, {.i64=EXR_HALF}, 0, 0, VE, "pixel" },
{ "float", NULL, 0, AV_OPT_TYPE_CONST, {.i64=EXR_FLOAT}, 0, 0, VE, "pixel" },
{ "gamma", "set gamma", OFFSET(gamma), AV_OPT_TYPE_FLOAT, {.dbl=1.f}, 0.001, FLT_MAX, VE },
{ NULL},
}
#define NULL
Definition: coverity.c:32
#define OFFSET(x)
Definition: exrenc.c:515
Definition: exrenc.c:40
Definition: exrenc.c:41
#define VE
Definition: exrenc.c:516

Definition at line 517 of file exrenc.c.

const AVClass exr_class
static
Initial value:
= {
.class_name = "exr",
.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: exrenc.c:517

Definition at line 530 of file exrenc.c.

AVCodec ff_exr_encoder
Initial value:
= {
.name = "exr",
.long_name = NULL_IF_CONFIG_SMALL("OpenEXR image"),
.priv_data_size = sizeof(EXRContext),
.priv_class = &exr_class,
.encode2 = encode_frame,
.close = encode_close,
.capabilities = AV_CODEC_CAP_FRAME_THREADS,
.pix_fmts = (const enum AVPixelFormat[]) {
}
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:31
GLint GLenum type
Definition: opengl_enc.c:104
static const AVClass exr_class
Definition: exrenc.c:530
static int encode_close(AVCodecContext *avctx)
Definition: exrenc.c:134
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:117
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition: codec.h:108
static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
Definition: exrenc.c:343
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:303
#define AV_PIX_FMT_GBRPF32
Definition: pixfmt.h:428
#define AV_PIX_FMT_GBRAPF32
Definition: pixfmt.h:429
static int encode_init(AVCodecContext *avctx)
Definition: exrenc.c:91
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64

Definition at line 537 of file exrenc.c.