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

JPEG 2000 encoder using libopenjpeg. More...

#include "libavutil/avassert.h"
#include "libavutil/common.h"
#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "internal.h"
#include <openjpeg.h>

Go to the source code of this file.

Data Structures

struct  LibOpenJPEGContext
 

Macros

#define OPENJPEG_MAJOR_VERSION   1
 
#define OPJ(x)   x
 
#define OFFSET(x)   offsetof(LibOpenJPEGContext, x)
 
#define VE   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 

Functions

static void error_callback (const char *msg, void *data)
 
static void warning_callback (const char *msg, void *data)
 
static void info_callback (const char *msg, void *data)
 
static void cinema_parameters (opj_cparameters_t *p)
 
static opj_image_t * mj2_create_image (AVCodecContext *avctx, opj_cparameters_t *parameters)
 
static av_cold int libopenjpeg_encode_init (AVCodecContext *avctx)
 
static int libopenjpeg_copy_packed8 (AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image)
 
static int libopenjpeg_copy_packed12 (AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image)
 
static int libopenjpeg_copy_packed16 (AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image)
 
static int libopenjpeg_copy_unpacked8 (AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image)
 
static int libopenjpeg_copy_unpacked16 (AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image)
 
static int libopenjpeg_encode_frame (AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
 
static av_cold int libopenjpeg_encode_close (AVCodecContext *avctx)
 

Variables

static const AVOption options []
 
static const AVClass openjpeg_class
 
AVCodec ff_libopenjpeg_encoder
 

Detailed Description

JPEG 2000 encoder using libopenjpeg.

Definition in file libopenjpegenc.c.

Macro Definition Documentation

#define OPENJPEG_MAJOR_VERSION   1

Definition at line 49 of file libopenjpegenc.c.

#define OPJ (   x)    x

Definition at line 50 of file libopenjpegenc.c.

Referenced by cinema_parameters(), and mj2_create_image().

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

Definition at line 818 of file libopenjpegenc.c.

Definition at line 819 of file libopenjpegenc.c.

Function Documentation

static void error_callback ( const char *  msg,
void data 
)
static

Definition at line 72 of file libopenjpegenc.c.

Referenced by libopenjpeg_encode_frame().

static void warning_callback ( const char *  msg,
void data 
)
static

Definition at line 77 of file libopenjpegenc.c.

Referenced by libopenjpeg_encode_frame().

static void info_callback ( const char *  msg,
void data 
)
static

Definition at line 82 of file libopenjpegenc.c.

Referenced by libopenjpeg_encode_frame().

static void cinema_parameters ( opj_cparameters_t *  p)
static

Definition at line 159 of file libopenjpegenc.c.

Referenced by libopenjpeg_encode_init().

static opj_image_t* mj2_create_image ( AVCodecContext avctx,
opj_cparameters_t *  parameters 
)
static

Definition at line 196 of file libopenjpegenc.c.

Referenced by libopenjpeg_encode_frame(), and libopenjpeg_encode_init().

static av_cold int libopenjpeg_encode_init ( AVCodecContext avctx)
static

Definition at line 301 of file libopenjpegenc.c.

static int libopenjpeg_copy_packed8 ( AVCodecContext avctx,
const AVFrame frame,
opj_image_t *  image 
)
static

Definition at line 391 of file libopenjpegenc.c.

Referenced by libopenjpeg_encode_frame().

static int libopenjpeg_copy_packed12 ( AVCodecContext avctx,
const AVFrame frame,
opj_image_t *  image 
)
static

Definition at line 431 of file libopenjpegenc.c.

Referenced by libopenjpeg_encode_frame().

static int libopenjpeg_copy_packed16 ( AVCodecContext avctx,
const AVFrame frame,
opj_image_t *  image 
)
static

Definition at line 470 of file libopenjpegenc.c.

Referenced by libopenjpeg_encode_frame().

static int libopenjpeg_copy_unpacked8 ( AVCodecContext avctx,
const AVFrame frame,
opj_image_t *  image 
)
static

Definition at line 510 of file libopenjpegenc.c.

Referenced by libopenjpeg_encode_frame().

static int libopenjpeg_copy_unpacked16 ( AVCodecContext avctx,
const AVFrame frame,
opj_image_t *  image 
)
static

Definition at line 551 of file libopenjpegenc.c.

Referenced by libopenjpeg_encode_frame().

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

Definition at line 594 of file libopenjpegenc.c.

static av_cold int libopenjpeg_encode_close ( AVCodecContext avctx)
static

Definition at line 807 of file libopenjpegenc.c.

Variable Documentation

const AVOption options[]
static
Initial value:
= {
{ "format", "Codec Format", OFFSET(format), AV_OPT_TYPE_INT, { .i64 = OPJ(CODEC_JP2) }, OPJ(CODEC_J2K), OPJ(CODEC_JP2), VE, "format" },
{ "j2k", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(CODEC_J2K) }, 0, 0, VE, "format" },
{ "jp2", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(CODEC_JP2) }, 0, 0, VE, "format" },
{ "profile", NULL, OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = OPJ(STD_RSIZ) }, OPJ(STD_RSIZ), OPJ(CINEMA4K), VE, "profile" },
{ "jpeg2000", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(STD_RSIZ) }, 0, 0, VE, "profile" },
{ "cinema2k", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(CINEMA2K) }, 0, 0, VE, "profile" },
{ "cinema4k", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(CINEMA4K) }, 0, 0, VE, "profile" },
{ "cinema_mode", "Digital Cinema", OFFSET(cinema_mode), AV_OPT_TYPE_INT, { .i64 = OPJ(OFF) }, OPJ(OFF), OPJ(CINEMA4K_24), VE, "cinema_mode" },
{ "off", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(OFF) }, 0, 0, VE, "cinema_mode" },
{ "2k_24", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(CINEMA2K_24) }, 0, 0, VE, "cinema_mode" },
{ "2k_48", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(CINEMA2K_48) }, 0, 0, VE, "cinema_mode" },
{ "4k_24", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(CINEMA4K_24) }, 0, 0, VE, "cinema_mode" },
{ "prog_order", "Progression Order", OFFSET(prog_order), AV_OPT_TYPE_INT, { .i64 = OPJ(LRCP) }, OPJ(LRCP), OPJ(CPRL), VE, "prog_order" },
{ "lrcp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(LRCP) }, 0, 0, VE, "prog_order" },
{ "rlcp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(RLCP) }, 0, 0, VE, "prog_order" },
{ "rpcl", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(RPCL) }, 0, 0, VE, "prog_order" },
{ "pcrl", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(PCRL) }, 0, 0, VE, "prog_order" },
{ "cprl", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(CPRL) }, 0, 0, VE, "prog_order" },
{ "numresolution", NULL, OFFSET(numresolution), AV_OPT_TYPE_INT, { .i64 = 6 }, 0, 33, VE },
{ "irreversible", NULL, OFFSET(irreversible), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
{ "disto_alloc", NULL, OFFSET(disto_alloc), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, VE },
{ "fixed_quality", NULL, OFFSET(fixed_quality), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
{ NULL },
}
#define NULL
Definition: coverity.c:32
#define CODEC_J2K
Definition: j2kenc.c:80
#define VE
#define CODEC_JP2
Definition: j2kenc.c:79
static const char * format
Definition: movenc.c:47
#define OPJ(x)
mfxU16 profile
Definition: qsvenc.c:44
#define OFFSET(x)

Definition at line 820 of file libopenjpegenc.c.

const AVClass openjpeg_class
static
Initial value:
= {
.class_name = "libopenjpeg",
.item_name = av_default_item_name,
.option = options,
}
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
av_default_item_name
static const AVOption options[]

Definition at line 846 of file libopenjpegenc.c.

AVCodec ff_libopenjpeg_encoder

Definition at line 853 of file libopenjpegenc.c.