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

JPEG 2000 image decoder. More...

#include <inttypes.h>
#include "libavutil/attributes.h"
#include "libavutil/common.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "bytestream.h"
#include "internal.h"
#include "thread.h"
#include "jpeg2000.h"
#include "jpeg2000dsp.h"
#include "profiles.h"

Go to the source code of this file.

Data Structures

struct  Jpeg2000TilePart
 
struct  Jpeg2000Tile
 
struct  Jpeg2000DecoderContext
 

Macros

#define JP2_SIG_TYPE   0x6A502020
 
#define JP2_SIG_VALUE   0x0D0A870A
 
#define JP2_CODESTREAM   0x6A703263
 
#define HAD_COC   0x01
 
#define HAD_QCC   0x02
 
#define WRITE_FRAME(D, PIXEL)
 
#define OFFSET(x)   offsetof(Jpeg2000DecoderContext, x)
 
#define VD   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
 

Functions

static int get_bits (Jpeg2000DecoderContext *s, int n)
 
static void jpeg2000_flush (Jpeg2000DecoderContext *s)
 
static int tag_tree_decode (Jpeg2000DecoderContext *s, Jpeg2000TgtNode *node, int threshold)
 
static int get_siz (Jpeg2000DecoderContext *s)
 
static int get_cox (Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c)
 
static int get_cod (Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c, uint8_t *properties)
 
static int get_coc (Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c, uint8_t *properties)
 
static int get_qcx (Jpeg2000DecoderContext *s, int n, Jpeg2000QuantStyle *q)
 
static int get_qcd (Jpeg2000DecoderContext *s, int n, Jpeg2000QuantStyle *q, uint8_t *properties)
 
static int get_qcc (Jpeg2000DecoderContext *s, int n, Jpeg2000QuantStyle *q, uint8_t *properties)
 
static int get_sot (Jpeg2000DecoderContext *s, int n)
 
static uint8_t get_tlm (Jpeg2000DecoderContext *s, int n)
 
static int init_tile (Jpeg2000DecoderContext *s, int tileno)
 
static int getnpasses (Jpeg2000DecoderContext *s)
 
static int getlblockinc (Jpeg2000DecoderContext *s)
 
static int jpeg2000_decode_packet (Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *codsty, Jpeg2000ResLevel *rlevel, int precno, int layno, uint8_t *expn, int numgbits)
 
static int decode_pgod_lrcp (Jpeg2000DecoderContext *s, Jpeg2000Tile *tile)
 
static int decode_pgod_cprl (Jpeg2000DecoderContext *s, Jpeg2000Tile *tile)
 
static int jpeg2000_decode_packets (Jpeg2000DecoderContext *s, Jpeg2000Tile *tile)
 
static void decode_sigpass (Jpeg2000T1Context *t1, int width, int height, int bpno, int bandno, int bpass_csty_symbol, int vert_causal_ctx_csty_symbol)
 
static void decode_refpass (Jpeg2000T1Context *t1, int width, int height, int bpno)
 
static void decode_clnpass (Jpeg2000DecoderContext *s, Jpeg2000T1Context *t1, int width, int height, int bpno, int bandno, int seg_symbols, int vert_causal_ctx_csty_symbol)
 
static int decode_cblk (Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *codsty, Jpeg2000T1Context *t1, Jpeg2000Cblk *cblk, int width, int height, int bandpos)
 
static void dequantization_float (int x, int y, Jpeg2000Cblk *cblk, Jpeg2000Component *comp, Jpeg2000T1Context *t1, Jpeg2000Band *band)
 
static void dequantization_int (int x, int y, Jpeg2000Cblk *cblk, Jpeg2000Component *comp, Jpeg2000T1Context *t1, Jpeg2000Band *band)
 
static void mct_decode (Jpeg2000DecoderContext *s, Jpeg2000Tile *tile)
 
static void tile_codeblocks (Jpeg2000DecoderContext *s, Jpeg2000Tile *tile)
 
static int jpeg2000_decode_tile (Jpeg2000DecoderContext *s, Jpeg2000Tile *tile, AVFrame *picture)
 
static void jpeg2000_dec_cleanup (Jpeg2000DecoderContext *s)
 
static int jpeg2000_read_main_headers (Jpeg2000DecoderContext *s)
 
static int jpeg2000_read_bitstream_packets (Jpeg2000DecoderContext *s)
 
static int jp2_find_codestream (Jpeg2000DecoderContext *s)
 
static av_cold int jpeg2000_decode_init (AVCodecContext *avctx)
 
static int jpeg2000_decode_frame (AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
 
static av_cold void jpeg2000_init_static_data (AVCodec *codec)
 

Variables

static const AVOption options []
 
class {
      class_name = "jpeg2000"
 
      item_name = av_default_item_name
 
      option = options
 
      version = LIBAVUTIL_VERSION_INT
 
}; 
 
AVCodec ff_jpeg2000_decoder
 

Detailed Description

JPEG 2000 image decoder.

Definition in file jpeg2000dec.c.

Macro Definition Documentation

◆ JP2_SIG_TYPE

#define JP2_SIG_TYPE   0x6A502020

Definition at line 41 of file jpeg2000dec.c.

Referenced by jpeg2000_decode_frame().

◆ JP2_SIG_VALUE

#define JP2_SIG_VALUE   0x0D0A870A

Definition at line 42 of file jpeg2000dec.c.

Referenced by jpeg2000_decode_frame().

◆ JP2_CODESTREAM

#define JP2_CODESTREAM   0x6A703263

Definition at line 43 of file jpeg2000dec.c.

Referenced by jp2_find_codestream().

◆ HAD_COC

#define HAD_COC   0x01

Definition at line 45 of file jpeg2000dec.c.

Referenced by get_coc(), and get_cod().

◆ HAD_QCC

#define HAD_QCC   0x02

Definition at line 46 of file jpeg2000dec.c.

Referenced by get_qcc(), and get_qcd().

◆ WRITE_FRAME

#define WRITE_FRAME (   D,
  PIXEL 
)

Definition at line 1140 of file jpeg2000dec.c.

◆ OFFSET

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

Definition at line 1452 of file jpeg2000dec.c.

◆ VD

Definition at line 1453 of file jpeg2000dec.c.

Function Documentation

◆ get_bits()

static int get_bits ( Jpeg2000DecoderContext s,
int  n 
)
static

Definition at line 100 of file jpeg2000dec.c.

Referenced by getlblockinc(), getnpasses(), jpeg2000_decode_packet(), and tag_tree_decode().

◆ jpeg2000_flush()

static void jpeg2000_flush ( Jpeg2000DecoderContext s)
static

Definition at line 114 of file jpeg2000dec.c.

Referenced by jpeg2000_decode_packet().

◆ tag_tree_decode()

static int tag_tree_decode ( Jpeg2000DecoderContext s,
Jpeg2000TgtNode node,
int  threshold 
)
static

Definition at line 122 of file jpeg2000dec.c.

Referenced by jpeg2000_decode_packet().

◆ get_siz()

static int get_siz ( Jpeg2000DecoderContext s)
static

Definition at line 162 of file jpeg2000dec.c.

Referenced by jpeg2000_read_main_headers().

◆ get_cox()

static int get_cox ( Jpeg2000DecoderContext s,
Jpeg2000CodingStyle c 
)
static

Definition at line 281 of file jpeg2000dec.c.

Referenced by get_coc(), and get_cod().

◆ get_cod()

static int get_cod ( Jpeg2000DecoderContext s,
Jpeg2000CodingStyle c,
uint8_t properties 
)
static

Definition at line 335 of file jpeg2000dec.c.

Referenced by jpeg2000_read_main_headers().

◆ get_coc()

static int get_coc ( Jpeg2000DecoderContext s,
Jpeg2000CodingStyle c,
uint8_t properties 
)
static

Definition at line 370 of file jpeg2000dec.c.

Referenced by jpeg2000_read_main_headers().

◆ get_qcx()

static int get_qcx ( Jpeg2000DecoderContext s,
int  n,
Jpeg2000QuantStyle q 
)
static

Definition at line 398 of file jpeg2000dec.c.

Referenced by get_qcc(), and get_qcd().

◆ get_qcd()

static int get_qcd ( Jpeg2000DecoderContext s,
int  n,
Jpeg2000QuantStyle q,
uint8_t properties 
)
static

Definition at line 443 of file jpeg2000dec.c.

Referenced by jpeg2000_read_main_headers().

◆ get_qcc()

static int get_qcc ( Jpeg2000DecoderContext s,
int  n,
Jpeg2000QuantStyle q,
uint8_t properties 
)
static

Definition at line 459 of file jpeg2000dec.c.

Referenced by jpeg2000_read_main_headers().

◆ get_sot()

static int get_sot ( Jpeg2000DecoderContext s,
int  n 
)
static

Definition at line 481 of file jpeg2000dec.c.

Referenced by jpeg2000_read_main_headers().

◆ get_tlm()

static uint8_t get_tlm ( Jpeg2000DecoderContext s,
int  n 
)
static

Definition at line 539 of file jpeg2000dec.c.

Referenced by jpeg2000_read_main_headers().

◆ init_tile()

static int init_tile ( Jpeg2000DecoderContext s,
int  tileno 
)
static

Definition at line 573 of file jpeg2000dec.c.

Referenced by jpeg2000_read_bitstream_packets().

◆ getnpasses()

static int getnpasses ( Jpeg2000DecoderContext s)
static

Definition at line 608 of file jpeg2000dec.c.

Referenced by jpeg2000_decode_packet().

◆ getlblockinc()

static int getlblockinc ( Jpeg2000DecoderContext s)
static

Definition at line 623 of file jpeg2000dec.c.

Referenced by jpeg2000_decode_packet().

◆ jpeg2000_decode_packet()

static int jpeg2000_decode_packet ( Jpeg2000DecoderContext s,
Jpeg2000CodingStyle codsty,
Jpeg2000ResLevel rlevel,
int  precno,
int  layno,
uint8_t expn,
int  numgbits 
)
static

Definition at line 634 of file jpeg2000dec.c.

Referenced by decode_pgod_cprl(), and decode_pgod_lrcp().

◆ decode_pgod_lrcp()

static int decode_pgod_lrcp ( Jpeg2000DecoderContext s,
Jpeg2000Tile tile 
)
static

Definition at line 736 of file jpeg2000dec.c.

Referenced by jpeg2000_decode_packets().

◆ decode_pgod_cprl()

static int decode_pgod_cprl ( Jpeg2000DecoderContext s,
Jpeg2000Tile tile 
)
static

Definition at line 767 of file jpeg2000dec.c.

Referenced by jpeg2000_decode_packets().

◆ jpeg2000_decode_packets()

static int jpeg2000_decode_packets ( Jpeg2000DecoderContext s,
Jpeg2000Tile tile 
)
static

Definition at line 821 of file jpeg2000dec.c.

Referenced by jpeg2000_read_bitstream_packets().

◆ decode_sigpass()

static void decode_sigpass ( Jpeg2000T1Context t1,
int  width,
int  height,
int  bpno,
int  bandno,
int  bpass_csty_symbol,
int  vert_causal_ctx_csty_symbol 
)
static

Definition at line 861 of file jpeg2000dec.c.

Referenced by decode_cblk().

◆ decode_refpass()

static void decode_refpass ( Jpeg2000T1Context t1,
int  width,
int  height,
int  bpno 
)
static

Definition at line 891 of file jpeg2000dec.c.

Referenced by decode_cblk().

◆ decode_clnpass()

static void decode_clnpass ( Jpeg2000DecoderContext s,
Jpeg2000T1Context t1,
int  width,
int  height,
int  bpno,
int  bandno,
int  seg_symbols,
int  vert_causal_ctx_csty_symbol 
)
static

Definition at line 913 of file jpeg2000dec.c.

Referenced by decode_cblk().

◆ decode_cblk()

static int decode_cblk ( Jpeg2000DecoderContext s,
Jpeg2000CodingStyle codsty,
Jpeg2000T1Context t1,
Jpeg2000Cblk cblk,
int  width,
int  height,
int  bandpos 
)
static

Definition at line 976 of file jpeg2000dec.c.

Referenced by tile_codeblocks().

◆ dequantization_float()

static void dequantization_float ( int  x,
int  y,
Jpeg2000Cblk cblk,
Jpeg2000Component comp,
Jpeg2000T1Context t1,
Jpeg2000Band band 
)
static

Definition at line 1036 of file jpeg2000dec.c.

Referenced by tile_codeblocks().

◆ dequantization_int()

static void dequantization_int ( int  x,
int  y,
Jpeg2000Cblk cblk,
Jpeg2000Component comp,
Jpeg2000T1Context t1,
Jpeg2000Band band 
)
static

Definition at line 1051 of file jpeg2000dec.c.

Referenced by tile_codeblocks().

◆ mct_decode()

static void mct_decode ( Jpeg2000DecoderContext s,
Jpeg2000Tile tile 
)
inlinestatic

Definition at line 1065 of file jpeg2000dec.c.

Referenced by jpeg2000_decode_tile().

◆ tile_codeblocks()

static void tile_codeblocks ( Jpeg2000DecoderContext s,
Jpeg2000Tile tile 
)
inlinestatic

Definition at line 1082 of file jpeg2000dec.c.

Referenced by jpeg2000_decode_tile().

◆ jpeg2000_decode_tile()

static int jpeg2000_decode_tile ( Jpeg2000DecoderContext s,
Jpeg2000Tile tile,
AVFrame picture 
)
static

Definition at line 1195 of file jpeg2000dec.c.

Referenced by jpeg2000_decode_frame().

◆ jpeg2000_dec_cleanup()

static void jpeg2000_dec_cleanup ( Jpeg2000DecoderContext s)
static

Definition at line 1213 of file jpeg2000dec.c.

Referenced by jpeg2000_decode_frame().

◆ jpeg2000_read_main_headers()

static int jpeg2000_read_main_headers ( Jpeg2000DecoderContext s)
static

Definition at line 1229 of file jpeg2000dec.c.

Referenced by jpeg2000_decode_frame().

◆ jpeg2000_read_bitstream_packets()

static int jpeg2000_read_bitstream_packets ( Jpeg2000DecoderContext s)
static

Definition at line 1328 of file jpeg2000dec.c.

Referenced by jpeg2000_decode_frame().

◆ jp2_find_codestream()

static int jp2_find_codestream ( Jpeg2000DecoderContext s)
static

Definition at line 1347 of file jpeg2000dec.c.

Referenced by jpeg2000_decode_frame().

◆ jpeg2000_decode_init()

static av_cold int jpeg2000_decode_init ( AVCodecContext avctx)
static

Definition at line 1372 of file jpeg2000dec.c.

◆ jpeg2000_decode_frame()

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

Definition at line 1381 of file jpeg2000dec.c.

◆ jpeg2000_init_static_data()

static av_cold void jpeg2000_init_static_data ( AVCodec codec)
static

Definition at line 1446 of file jpeg2000dec.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "lowres", "Lower the decoding resolution by a power of two",
OFFSET(reduction_factor), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, JPEG2000_MAX_RESLEVELS - 1, VD },
{ NULL },
}
#define OFFSET(x)
Definition: jpeg2000dec.c:1452
#define JPEG2000_MAX_RESLEVELS
Definition: jpeg2000.h:72
#define VD
Definition: jpeg2000dec.c:1453
NULL
Definition: eval.c:55

Definition at line 1455 of file jpeg2000dec.c.

◆ class_name

class_name = "jpeg2000"
private

Definition at line 1462 of file jpeg2000dec.c.

◆ item_name

item_name = av_default_item_name
private

Definition at line 1463 of file jpeg2000dec.c.

◆ option

option = options
private

Definition at line 1464 of file jpeg2000dec.c.

◆ version

version = LIBAVUTIL_VERSION_INT
private

Definition at line 1465 of file jpeg2000dec.c.

◆ @31

const { ... }

◆ ff_jpeg2000_decoder

AVCodec ff_jpeg2000_decoder
Initial value:
= {
.name = "jpeg2000",
.long_name = NULL_IF_CONFIG_SMALL("JPEG 2000"),
.priv_data_size = sizeof(Jpeg2000DecoderContext),
.init_static_data = jpeg2000_init_static_data,
.priv_class = &class,
}
static av_cold int jpeg2000_decode_init(AVCodecContext *avctx)
Definition: jpeg2000dec.c:1372
static int jpeg2000_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: jpeg2000dec.c:1381
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:148
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition: avcodec.h:893
static int decode(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *pkt)
Definition: avconv.c:1288
static av_cold void jpeg2000_init_static_data(AVCodec *codec)
Definition: jpeg2000dec.c:1446
static const AVProfile profiles[]
Definition: libdcadec.c:181
static av_cold int init(AVCodecParserContext *s)
Definition: h264_parser.c:582
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:838
const AVProfile ff_jpeg2000_profiles[]
Definition: profiles.c:74

Definition at line 1468 of file jpeg2000dec.c.