Libav
Data Structures | Macros | Functions | Variables
libopenjpegenc.c File Reference

JPEG 2000 encoder using libopenjpeg. More...

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

Go to the source code of this file.

Data Structures

struct  LibOpenJPEGContext
 

Macros

#define OPJ_STATIC
 
#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_image_t * libopenjpeg_create_image (AVCodecContext *avctx, opj_cparameters_t *parameters)
 
static av_cold int libopenjpeg_encode_init (AVCodecContext *avctx)
 
static void libopenjpeg_copy_packed8 (AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image)
 
static void libopenjpeg_copy_packed16 (AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image)
 
static void libopenjpeg_copy_unpacked8 (AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image)
 
static void 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 []
 
class {
      class_name = "libopenjpeg"
 
      item_name = av_default_item_name
 
      option = options
 
      version = LIBAVUTIL_VERSION_INT
 
}; 
 
AVCodec ff_libopenjpeg_encoder
 

Detailed Description

JPEG 2000 encoder using libopenjpeg.

Definition in file libopenjpegenc.c.

Macro Definition Documentation

◆ OPJ_STATIC

#define OPJ_STATIC

Definition at line 27 of file libopenjpegenc.c.

◆ OFFSET

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

Definition at line 370 of file libopenjpegenc.c.

◆ VE

Definition at line 371 of file libopenjpegenc.c.

Function Documentation

◆ error_callback()

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

Definition at line 54 of file libopenjpegenc.c.

Referenced by libopenjpeg_encode_init().

◆ warning_callback()

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

Definition at line 59 of file libopenjpegenc.c.

Referenced by libopenjpeg_encode_init().

◆ info_callback()

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

Definition at line 64 of file libopenjpegenc.c.

Referenced by libopenjpeg_encode_init().

◆ libopenjpeg_create_image()

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

Definition at line 69 of file libopenjpegenc.c.

Referenced by libopenjpeg_encode_init().

◆ libopenjpeg_encode_init()

static av_cold int libopenjpeg_encode_init ( AVCodecContext avctx)
static

Definition at line 148 of file libopenjpegenc.c.

◆ libopenjpeg_copy_packed8()

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

Definition at line 191 of file libopenjpegenc.c.

Referenced by libopenjpeg_encode_frame().

◆ libopenjpeg_copy_packed16()

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

Definition at line 211 of file libopenjpegenc.c.

Referenced by libopenjpeg_encode_frame().

◆ libopenjpeg_copy_unpacked8()

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

Definition at line 232 of file libopenjpegenc.c.

Referenced by libopenjpeg_encode_frame().

◆ libopenjpeg_copy_unpacked16()

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

Definition at line 254 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 279 of file libopenjpegenc.c.

◆ libopenjpeg_encode_close()

static av_cold int libopenjpeg_encode_close ( AVCodecContext avctx)
static

Definition at line 361 of file libopenjpegenc.c.

Variable Documentation

◆ options

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

Definition at line 372 of file libopenjpegenc.c.

◆ class_name

class_name = "libopenjpeg"
private

Definition at line 400 of file libopenjpegenc.c.

◆ item_name

item_name = av_default_item_name
private

Definition at line 401 of file libopenjpegenc.c.

◆ option

option = options
private

Definition at line 402 of file libopenjpegenc.c.

◆ version

version = LIBAVUTIL_VERSION_INT
private

Definition at line 403 of file libopenjpegenc.c.

◆ @39

const { ... }

◆ ff_libopenjpeg_encoder

AVCodec ff_libopenjpeg_encoder
Initial value:
= {
.name = "libopenjpeg",
.long_name = NULL_IF_CONFIG_SMALL("OpenJPEG JPEG 2000"),
.priv_data_size = sizeof(LibOpenJPEGContext),
.capabilities = 0,
.pix_fmts = (const enum AVPixelFormat[]) {
},
.priv_class = &class,
}
8 bits gray, 8 bits alpha
Definition: pixfmt.h:143
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:64
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:61
#define AV_PIX_FMT_RGBA64
Definition: pixfmt.h:253
static av_cold int libopenjpeg_encode_close(AVCodecContext *avctx)
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:98
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:268
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:148
#define AV_PIX_FMT_RGB48
Definition: pixfmt.h:249
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:265
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: pixfmt.h:90
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:63
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:261
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:247
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:262
static av_cold int libopenjpeg_encode_init(AVCodecContext *avctx)
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:266
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:263
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:65
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:260
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:257
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:264
static int libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:59
Y , 8bpp.
Definition: pixfmt.h:67
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:66
static av_cold int init(AVCodecParserContext *s)
Definition: h264_parser.c:582
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:96
AVPixelFormat
Pixel format.
Definition: pixfmt.h:57
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:267

Definition at line 406 of file libopenjpegenc.c.