FFmpeg
Data Structures | Macros | Functions | Variables
libopenjpegenc.c File Reference
#include "libavutil/common.h"
#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "codec_internal.h"
#include "encode.h"
#include <openjpeg.h>

Go to the source code of this file.

Data Structures

struct  LibOpenJPEGContext
 
struct  PacketWriter
 

Macros

#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 OPJ_SIZE_T stream_write (void *out_buffer, OPJ_SIZE_T nb_bytes, void *user_data)
 
static OPJ_OFF_T stream_skip (OPJ_OFF_T nb_bytes, void *user_data)
 
static OPJ_BOOL stream_seek (OPJ_OFF_T nb_bytes, void *user_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 uint8_t *src[4], const int linesize[4], opj_image_t *image)
 
static int libopenjpeg_copy_packed12 (AVCodecContext *avctx, const uint8_t *src[4], const int linesize[4], opj_image_t *image)
 
static int libopenjpeg_copy_packed16 (AVCodecContext *avctx, const uint8_t *src[4], const int linesize[4], opj_image_t *image)
 
static int libopenjpeg_copy_unpacked8 (AVCodecContext *avctx, const uint8_t *src[4], const int linesize[4], opj_image_t *image)
 
static int libopenjpeg_copy_unpacked16 (AVCodecContext *avctx, const uint8_t *src[4], const int linesize[4], opj_image_t *image)
 
static int libopenjpeg_encode_frame (AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
 

Variables

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

Detailed Description

JPEG 2000 encoder using libopenjpeg

Definition in file libopenjpegenc.c.

Macro Definition Documentation

◆ OFFSET

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

Definition at line 722 of file libopenjpegenc.c.

◆ VE

Definition at line 723 of file libopenjpegenc.c.

Function Documentation

◆ error_callback()

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

Definition at line 49 of file libopenjpegenc.c.

Referenced by libopenjpeg_encode_frame().

◆ warning_callback()

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

Definition at line 54 of file libopenjpegenc.c.

Referenced by libopenjpeg_encode_frame().

◆ info_callback()

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

Definition at line 59 of file libopenjpegenc.c.

Referenced by libopenjpeg_encode_frame().

◆ stream_write()

static OPJ_SIZE_T stream_write ( void *  out_buffer,
OPJ_SIZE_T  nb_bytes,
void *  user_data 
)
static

Definition at line 69 of file libopenjpegenc.c.

Referenced by libopenjpeg_encode_frame().

◆ stream_skip()

static OPJ_OFF_T stream_skip ( OPJ_OFF_T  nb_bytes,
void *  user_data 
)
static

Definition at line 89 of file libopenjpegenc.c.

Referenced by libopenjpeg_encode_frame().

◆ stream_seek()

static OPJ_BOOL stream_seek ( OPJ_OFF_T  nb_bytes,
void *  user_data 
)
static

Definition at line 117 of file libopenjpegenc.c.

Referenced by libopenjpeg_encode_frame().

◆ cinema_parameters()

static void cinema_parameters ( opj_cparameters_t *  p)
static

Definition at line 134 of file libopenjpegenc.c.

Referenced by libopenjpeg_encode_init().

◆ mj2_create_image()

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

Definition at line 171 of file libopenjpegenc.c.

Referenced by libopenjpeg_encode_frame().

◆ libopenjpeg_encode_init()

static av_cold int libopenjpeg_encode_init ( AVCodecContext avctx)
static

Definition at line 279 of file libopenjpegenc.c.

◆ libopenjpeg_copy_packed8()

static int libopenjpeg_copy_packed8 ( AVCodecContext avctx,
const uint8_t *  src[4],
const int  linesize[4],
opj_image_t *  image 
)
static

Definition at line 348 of file libopenjpegenc.c.

Referenced by libopenjpeg_encode_frame().

◆ libopenjpeg_copy_packed12()

static int libopenjpeg_copy_packed12 ( AVCodecContext avctx,
const uint8_t *  src[4],
const int  linesize[4],
opj_image_t *  image 
)
static

Definition at line 389 of file libopenjpegenc.c.

Referenced by libopenjpeg_encode_frame().

◆ libopenjpeg_copy_packed16()

static int libopenjpeg_copy_packed16 ( AVCodecContext avctx,
const uint8_t *  src[4],
const int  linesize[4],
opj_image_t *  image 
)
static

Definition at line 429 of file libopenjpegenc.c.

Referenced by libopenjpeg_encode_frame().

◆ libopenjpeg_copy_unpacked8()

static int libopenjpeg_copy_unpacked8 ( AVCodecContext avctx,
const uint8_t *  src[4],
const int  linesize[4],
opj_image_t *  image 
)
static

Definition at line 470 of file libopenjpegenc.c.

Referenced by libopenjpeg_encode_frame().

◆ libopenjpeg_copy_unpacked16()

static int libopenjpeg_copy_unpacked16 ( AVCodecContext avctx,
const uint8_t *  src[4],
const int  linesize[4],
opj_image_t *  image 
)
static

Definition at line 512 of file libopenjpegenc.c.

Referenced by libopenjpeg_encode_frame().

◆ libopenjpeg_encode_frame()

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

Definition at line 555 of file libopenjpegenc.c.

Variable Documentation

◆ options

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, .unit = "format" },
{ "j2k", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ_CODEC_J2K }, 0, 0, VE, .unit = "format" },
{ "jp2", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ_CODEC_JP2 }, 0, 0, VE, .unit = "format" },
{ "profile", NULL, OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = OPJ_STD_RSIZ }, OPJ_STD_RSIZ, OPJ_CINEMA4K, VE, .unit = "profile" },
{ "jpeg2000", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ_STD_RSIZ }, 0, 0, VE, .unit = "profile" },
{ "cinema2k", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ_CINEMA2K }, 0, 0, VE, .unit = "profile" },
{ "cinema4k", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ_CINEMA4K }, 0, 0, VE, .unit = "profile" },
{ "cinema_mode", "Digital Cinema", OFFSET(cinema_mode), AV_OPT_TYPE_INT, { .i64 = OPJ_OFF }, OPJ_OFF, OPJ_CINEMA4K_24, VE, .unit = "cinema_mode" },
{ "off", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ_OFF }, 0, 0, VE, .unit = "cinema_mode" },
{ "2k_24", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ_CINEMA2K_24 }, 0, 0, VE, .unit = "cinema_mode" },
{ "2k_48", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ_CINEMA2K_48 }, 0, 0, VE, .unit = "cinema_mode" },
{ "4k_24", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ_CINEMA4K_24 }, 0, 0, VE, .unit = "cinema_mode" },
{ "prog_order", "Progression Order", OFFSET(prog_order), AV_OPT_TYPE_INT, { .i64 = OPJ_LRCP }, OPJ_LRCP, OPJ_CPRL, VE, .unit = "prog_order" },
{ "lrcp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ_LRCP }, 0, 0, VE, .unit = "prog_order" },
{ "rlcp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ_RLCP }, 0, 0, VE, .unit = "prog_order" },
{ "rpcl", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ_RPCL }, 0, 0, VE, .unit = "prog_order" },
{ "pcrl", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ_PCRL }, 0, 0, VE, .unit = "prog_order" },
{ "cprl", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ_CPRL }, 0, 0, VE, .unit = "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 },
}

Definition at line 724 of file libopenjpegenc.c.

◆ openjpeg_class

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

Definition at line 750 of file libopenjpegenc.c.

◆ ff_libopenjpeg_encoder

const FFCodec ff_libopenjpeg_encoder

Definition at line 757 of file libopenjpegenc.c.

format
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample format(the sample packing is implied by the sample format) and sample rate. The lists are not just lists
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:237
options
static const AVOption options[]
Definition: libopenjpegenc.c:724
profile
int profile
Definition: mxfenc.c:2233
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
VE
#define VE
Definition: libopenjpegenc.c:723
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
OFFSET
#define OFFSET(x)
Definition: libopenjpegenc.c:722