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

JPEG 2000 decoder using libopenjpeg. More...

#include "libavutil/common.h"
#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "libavutil/pixfmt.h"
#include "avcodec.h"
#include "internal.h"
#include "thread.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 JP2_SIG_TYPE   0x6A502020
 
#define JP2_SIG_VALUE   0x0D0A870A
 
#define RGB_PIXEL_FORMATS
 
#define GRAY_PIXEL_FORMATS
 
#define YUV_PIXEL_FORMATS
 
#define XYZ_PIXEL_FORMATS   AV_PIX_FMT_XYZ12
 
#define OFFSET(x)   offsetof(LibOpenJPEGContext, x)
 
#define VD   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_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 int libopenjpeg_matches_pix_fmt (const opj_image_t *image, enum AVPixelFormat pix_fmt)
 
static enum AVPixelFormat libopenjpeg_guess_pix_fmt (const opj_image_t *image)
 
static int libopenjpeg_ispacked (enum AVPixelFormat pix_fmt)
 
static void libopenjpeg_copy_to_packed8 (AVFrame *picture, opj_image_t *image)
 
static void libopenjpeg_copy_to_packed16 (AVFrame *picture, opj_image_t *image)
 
static void libopenjpeg_copyto8 (AVFrame *picture, opj_image_t *image)
 
static void libopenjpeg_copyto16 (AVFrame *picture, opj_image_t *image)
 
static av_cold int libopenjpeg_decode_init (AVCodecContext *avctx)
 
static int libopenjpeg_decode_frame (AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
 
static av_cold void libopenjpeg_static_init (AVCodec *codec)
 

Variables

static enum AVPixelFormat libopenjpeg_rgb_pix_fmts []
 
static enum AVPixelFormat libopenjpeg_gray_pix_fmts []
 
static enum AVPixelFormat libopenjpeg_yuv_pix_fmts []
 
static enum AVPixelFormat libopenjpeg_all_pix_fmts []
 
static const AVOption options []
 
static const AVClass openjpeg_class
 
AVCodec ff_libopenjpeg_decoder
 

Detailed Description

JPEG 2000 decoder using libopenjpeg.

Definition in file libopenjpegdec.c.

Macro Definition Documentation

#define OPENJPEG_MAJOR_VERSION   1

Definition at line 55 of file libopenjpegdec.c.

#define OPJ (   x)    x

Definition at line 56 of file libopenjpegdec.c.

Referenced by libopenjpeg_decode_frame(), and libopenjpeg_guess_pix_fmt().

#define JP2_SIG_TYPE   0x6A502020

Definition at line 59 of file libopenjpegdec.c.

Referenced by libopenjpeg_decode_frame().

#define JP2_SIG_VALUE   0x0D0A870A

Definition at line 60 of file libopenjpegdec.c.

Referenced by libopenjpeg_decode_frame().

#define RGB_PIXEL_FORMATS
Value:
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:64
#define AV_PIX_FMT_RGBA64
Definition: pixfmt.h:369
#define AV_PIX_FMT_RGB48
Definition: pixfmt.h:365
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: pixfmt.h:94

Definition at line 64 of file libopenjpegdec.c.

#define GRAY_PIXEL_FORMATS
Value:
8 bits gray, 8 bits alpha
Definition: pixfmt.h:154
#define AV_PIX_FMT_YA16
Definition: pixfmt.h:364
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:363
Y , 8bpp.
Definition: pixfmt.h:70

Definition at line 67 of file libopenjpegdec.c.

#define YUV_PIXEL_FORMATS
Value:
#define AV_PIX_FMT_YUVA422P16
Definition: pixfmt.h:418
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:412
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:414
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:389
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:415
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:67
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:383
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:102
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:411
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:392
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:384
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:417
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:188
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:419
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:382
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:66
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:377
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:416
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:378
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:390
#define AV_PIX_FMT_YUV420P14
Definition: pixfmt.h:387
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:189
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:379
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:68
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:376
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:388
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:380
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:386
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:62
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:413
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:69
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:100
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:391

Definition at line 70 of file libopenjpegdec.c.

#define XYZ_PIXEL_FORMATS   AV_PIX_FMT_XYZ12

Definition at line 82 of file libopenjpegdec.c.

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

Definition at line 578 of file libopenjpegdec.c.

Definition at line 579 of file libopenjpegdec.c.

Function Documentation

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

Definition at line 106 of file libopenjpegdec.c.

Referenced by libopenjpeg_decode_frame().

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

Definition at line 111 of file libopenjpegdec.c.

Referenced by libopenjpeg_decode_frame().

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

Definition at line 116 of file libopenjpegdec.c.

Referenced by libopenjpeg_decode_frame().

static int libopenjpeg_matches_pix_fmt ( const opj_image_t *  image,
enum AVPixelFormat  pix_fmt 
)
inlinestatic

Definition at line 181 of file libopenjpegdec.c.

Referenced by libopenjpeg_decode_frame(), and libopenjpeg_guess_pix_fmt().

static enum AVPixelFormat libopenjpeg_guess_pix_fmt ( const opj_image_t *  image)
inlinestatic

Definition at line 218 of file libopenjpegdec.c.

Referenced by libopenjpeg_decode_frame().

static int libopenjpeg_ispacked ( enum AVPixelFormat  pix_fmt)
inlinestatic

Definition at line 250 of file libopenjpegdec.c.

Referenced by libopenjpeg_decode_frame().

static void libopenjpeg_copy_to_packed8 ( AVFrame picture,
opj_image_t *  image 
)
inlinestatic

Definition at line 265 of file libopenjpegdec.c.

Referenced by libopenjpeg_decode_frame().

static void libopenjpeg_copy_to_packed16 ( AVFrame picture,
opj_image_t *  image 
)
inlinestatic

Definition at line 277 of file libopenjpegdec.c.

Referenced by libopenjpeg_decode_frame().

static void libopenjpeg_copyto8 ( AVFrame picture,
opj_image_t *  image 
)
inlinestatic

Definition at line 295 of file libopenjpegdec.c.

Referenced by libopenjpeg_decode_frame().

static void libopenjpeg_copyto16 ( AVFrame picture,
opj_image_t *  image 
)
inlinestatic

Definition at line 313 of file libopenjpegdec.c.

Referenced by libopenjpeg_decode_frame().

static av_cold int libopenjpeg_decode_init ( AVCodecContext avctx)
static

Definition at line 336 of file libopenjpegdec.c.

static int libopenjpeg_decode_frame ( AVCodecContext avctx,
void data,
int got_frame,
AVPacket avpkt 
)
static

Definition at line 344 of file libopenjpegdec.c.

static av_cold void libopenjpeg_static_init ( AVCodec codec)
static

Definition at line 569 of file libopenjpegdec.c.

Variable Documentation

enum AVPixelFormat libopenjpeg_rgb_pix_fmts[]
static
Initial value:
= {
}
#define RGB_PIXEL_FORMATS

Definition at line 84 of file libopenjpegdec.c.

Referenced by libopenjpeg_guess_pix_fmt().

enum AVPixelFormat libopenjpeg_gray_pix_fmts[]
static
Initial value:
= {
}
#define GRAY_PIXEL_FORMATS

Definition at line 87 of file libopenjpegdec.c.

Referenced by libopenjpeg_guess_pix_fmt().

enum AVPixelFormat libopenjpeg_yuv_pix_fmts[]
static
Initial value:
= {
}
#define YUV_PIXEL_FORMATS

Definition at line 90 of file libopenjpegdec.c.

Referenced by libopenjpeg_guess_pix_fmt().

enum AVPixelFormat libopenjpeg_all_pix_fmts[]
static
Initial value:
= {
}
#define XYZ_PIXEL_FORMATS
#define YUV_PIXEL_FORMATS
#define RGB_PIXEL_FORMATS
#define GRAY_PIXEL_FORMATS

Definition at line 93 of file libopenjpegdec.c.

Referenced by libopenjpeg_guess_pix_fmt().

const AVOption options[]
static
Initial value:
= {
{ "lowqual", "Limit the number of layers used for decoding",
OFFSET(lowqual), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VD },
{ NULL },
}
#define NULL
Definition: coverity.c:32
#define VD
#define OFFSET(x)

Definition at line 581 of file libopenjpegdec.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:86
av_default_item_name
static const AVOption options[]

Definition at line 587 of file libopenjpegdec.c.

AVCodec ff_libopenjpeg_decoder
Initial value:
= {
.name = "libopenjpeg",
.long_name = NULL_IF_CONFIG_SMALL("OpenJPEG JPEG 2000"),
.priv_data_size = sizeof(LibOpenJPEGContext),
.max_lowres = 31,
.priv_class = &openjpeg_class,
.init_static_data = libopenjpeg_static_init,
}
static int libopenjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static const AVClass openjpeg_class
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Definition: decode_audio.c:42
static av_cold int libopenjpeg_decode_init(AVCodecContext *avctx)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:179
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition: avcodec.h:1065
static av_cold void libopenjpeg_static_init(AVCodec *codec)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:1002

Definition at line 594 of file libopenjpegdec.c.