libopenjpegdec.c File Reference

JPEG 2000 decoder using libopenjpeg. More...

#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/imgutils.h"
#include "libavutil/pixfmt.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "thread.h"
#include <openjpeg.h>
Include dependency graph for libopenjpegdec.c:

Go to the source code of this file.

Data Structures

struct  LibOpenJPEGContext
 

Macros

#define OPJ_STATIC
 
#define JP2_SIG_TYPE   0x6A502020
 
#define JP2_SIG_VALUE   0x0D0A870A
 
#define RGB_PIXEL_FORMATS   AV_PIX_FMT_RGB24,AV_PIX_FMT_RGBA,AV_PIX_FMT_RGB48,AV_PIX_FMT_RGBA64
 
#define GRAY_PIXEL_FORMATS   AV_PIX_FMT_GRAY8,AV_PIX_FMT_GRAY8A,AV_PIX_FMT_GRAY16
 
#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 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)
 

Variables

static enum AVPixelFormat libopenjpeg_rgb_pix_fmts [] = {RGB_PIXEL_FORMATS}
 
static enum AVPixelFormat libopenjpeg_gray_pix_fmts [] = {GRAY_PIXEL_FORMATS}
 
static enum AVPixelFormat libopenjpeg_yuv_pix_fmts [] = {YUV_PIXEL_FORMATS}
 
static enum AVPixelFormat libopenjpeg_all_pix_fmts []
 
static const AVOption options []
 
class {
      class_name = "libopenjpeg"
 
      item_name = av_default_item_name
 
      option = options
 
      version = LIBAVUTIL_VERSION_INT
 
}; 
 
AVCodec ff_libopenjpeg_decoder
 

Detailed Description

JPEG 2000 decoder using libopenjpeg.

Definition in file libopenjpegdec.c.

Macro Definition Documentation

#define GRAY_PIXEL_FORMATS   AV_PIX_FMT_GRAY8,AV_PIX_FMT_GRAY8A,AV_PIX_FMT_GRAY16

Definition at line 49 of file libopenjpegdec.c.

#define JP2_SIG_TYPE   0x6A502020

Definition at line 43 of file libopenjpegdec.c.

Referenced by libopenjpeg_decode_frame().

#define JP2_SIG_VALUE   0x0D0A870A

Definition at line 44 of file libopenjpegdec.c.

Referenced by libopenjpeg_decode_frame().

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

Definition at line 387 of file libopenjpegdec.c.

#define OPJ_STATIC

Definition at line 27 of file libopenjpegdec.c.

Definition at line 48 of file libopenjpegdec.c.

Definition at line 388 of file libopenjpegdec.c.

#define XYZ_PIXEL_FORMATS   AV_PIX_FMT_XYZ12

Definition at line 62 of file libopenjpegdec.c.

#define YUV_PIXEL_FORMATS
Value:
#define AV_PIX_FMT_YUVA422P16
Definition: pixfmt.h:307
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:301
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:303
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:287
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:304
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:73
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:282
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:105
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:300
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:290
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:283
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:306
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:219
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:308
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:281
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:72
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:277
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:305
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:278
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:288
#define AV_PIX_FMT_YUV420P14
Definition: pixfmt.h:285
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:218
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:279
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:74
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:276
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:286
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:280
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:284
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:68
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:302
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:75
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:103
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:289

Definition at line 50 of file libopenjpegdec.c.

Function Documentation

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

Definition at line 170 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 156 of file libopenjpegdec.c.

Referenced by libopenjpeg_decode_frame().

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

Definition at line 206 of file libopenjpegdec.c.

Referenced by libopenjpeg_decode_frame().

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

Definition at line 188 of file libopenjpegdec.c.

Referenced by libopenjpeg_decode_frame().

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

Definition at line 231 of file libopenjpegdec.c.

static av_cold int libopenjpeg_decode_init ( AVCodecContext avctx)
static

Definition at line 223 of file libopenjpegdec.c.

static enum AVPixelFormat libopenjpeg_guess_pix_fmt ( const opj_image_t *  image)
inlinestatic

Definition at line 107 of file libopenjpegdec.c.

Referenced by libopenjpeg_decode_frame().

static int libopenjpeg_ispacked ( enum AVPixelFormat  pix_fmt)
inlinestatic

Definition at line 140 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 78 of file libopenjpegdec.c.

Referenced by libopenjpeg_decode_frame(), and libopenjpeg_guess_pix_fmt().

Variable Documentation

const { ... }
class_name = "libopenjpeg"
private

Definition at line 396 of file libopenjpegdec.c.

AVCodec ff_libopenjpeg_decoder
Initial value:
= {
.name = "libopenjpeg",
.priv_data_size = sizeof(LibOpenJPEGContext),
.max_lowres = 31,
.long_name = NULL_IF_CONFIG_SMALL("OpenJPEG JPEG 2000"),
.priv_class = &class,
}
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 av_cold int libopenjpeg_decode_init(AVCodecContext *avctx)
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
#define CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
static int decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: crystalhd.c:868

Definition at line 402 of file libopenjpegdec.c.

item_name = av_default_item_name
private

Definition at line 397 of file libopenjpegdec.c.

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 67 of file libopenjpegdec.c.

Referenced by libopenjpeg_guess_pix_fmt().

enum AVPixelFormat libopenjpeg_gray_pix_fmts[] = {GRAY_PIXEL_FORMATS}
static

Definition at line 65 of file libopenjpegdec.c.

Referenced by libopenjpeg_guess_pix_fmt().

enum AVPixelFormat libopenjpeg_rgb_pix_fmts[] = {RGB_PIXEL_FORMATS}
static

Definition at line 64 of file libopenjpegdec.c.

Referenced by libopenjpeg_guess_pix_fmt().

enum AVPixelFormat libopenjpeg_yuv_pix_fmts[] = {YUV_PIXEL_FORMATS}
static

Definition at line 66 of file libopenjpegdec.c.

Referenced by libopenjpeg_guess_pix_fmt().

option = options
private

Definition at line 398 of file libopenjpegdec.c.

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 },
}
NULL
Definition: eval.c:55
#define VD
#define OFFSET(x)

Definition at line 390 of file libopenjpegdec.c.

version = LIBAVUTIL_VERSION_INT
private

Definition at line 399 of file libopenjpegdec.c.