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

JPEG2000 image decoder. More...

#include "libavutil/avassert.h"
#include "libavutil/common.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "bytestream.h"
#include "internal.h"
#include "thread.h"
#include "jpeg2000.h"

Go to the source code of this file.

Data Structures

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 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)
 
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 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 int jpeg2000_decode_tile (Jpeg2000DecoderContext *s, Jpeg2000Tile *tile, AVFrame *picture)
 
static void jpeg2000_dec_cleanup (Jpeg2000DecoderContext *s)
 
static int jpeg2000_decode_codestream (Jpeg2000DecoderContext *s)
 
static int jp2_find_codestream (Jpeg2000DecoderContext *s)
 
static int jpeg2000_decode_frame (AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
 
static void jpeg2000_init_static_data (AVCodec *codec)
 

Variables

static const float f_ict_params [4]
 
static const int i_ict_params [4]
 
static const AVOption options []
 
static const AVProfile profiles []
 
class {
      class_name = "j2k"
 
      item_name = av_default_item_name
 
      option = options
 
      version = LIBAVUTIL_VERSION_INT
 
}; 
 
AVCodec ff_j2k_decoder
 

Detailed Description

JPEG2000 image decoder.

Author
Kamil Nowosad

Definition in file j2kdec.c.

Macro Definition Documentation

#define JP2_SIG_TYPE   0x6A502020

Definition at line 38 of file j2kdec.c.

Referenced by jpeg2000_decode_frame().

#define JP2_SIG_VALUE   0x0D0A870A

Definition at line 39 of file j2kdec.c.

Referenced by jpeg2000_decode_frame().

#define JP2_CODESTREAM   0x6A703263

Definition at line 40 of file j2kdec.c.

Referenced by jp2_find_codestream().

#define HAD_COC   0x01

Definition at line 42 of file j2kdec.c.

Referenced by get_coc(), and get_cod().

#define HAD_QCC   0x02

Definition at line 43 of file j2kdec.c.

Referenced by get_qcc(), and get_qcd().

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

Definition at line 1243 of file j2kdec.c.

Definition at line 1244 of file j2kdec.c.

Function Documentation

static int get_bits ( Jpeg2000DecoderContext s,
int  n 
)
static

Definition at line 89 of file j2kdec.c.

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

static void jpeg2000_flush ( Jpeg2000DecoderContext s)
static

Definition at line 104 of file j2kdec.c.

Referenced by jpeg2000_decode_packet().

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

Definition at line 112 of file j2kdec.c.

Referenced by jpeg2000_decode_packet().

static int get_siz ( Jpeg2000DecoderContext s)
static

Definition at line 152 of file j2kdec.c.

Referenced by jpeg2000_decode_codestream().

static int get_cox ( Jpeg2000DecoderContext s,
Jpeg2000CodingStyle c 
)
static

Definition at line 259 of file j2kdec.c.

Referenced by get_coc(), and get_cod().

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

Definition at line 310 of file j2kdec.c.

Referenced by jpeg2000_decode_codestream().

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

Definition at line 339 of file j2kdec.c.

Referenced by jpeg2000_decode_codestream().

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

Definition at line 358 of file j2kdec.c.

Referenced by get_qcc(), and get_qcd().

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

Definition at line 401 of file j2kdec.c.

Referenced by jpeg2000_decode_codestream().

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

Definition at line 417 of file j2kdec.c.

Referenced by jpeg2000_decode_codestream().

static int get_sot ( Jpeg2000DecoderContext s)
static

< Isot

< Psot (ignored)

< TPsot

< TNsot

Definition at line 431 of file j2kdec.c.

Referenced by jpeg2000_decode_codestream().

static uint8_t get_tlm ( Jpeg2000DecoderContext s,
int  n 
)
static

Definition at line 464 of file j2kdec.c.

Referenced by jpeg2000_decode_codestream().

static int init_tile ( Jpeg2000DecoderContext s,
int  tileno 
)
static

Definition at line 498 of file j2kdec.c.

Referenced by jpeg2000_decode_codestream().

static int getnpasses ( Jpeg2000DecoderContext s)
static

Definition at line 530 of file j2kdec.c.

Referenced by jpeg2000_decode_packet().

static int getlblockinc ( Jpeg2000DecoderContext s)
static

Definition at line 545 of file j2kdec.c.

Referenced by 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 556 of file j2kdec.c.

Referenced by jpeg2000_decode_packets().

static int jpeg2000_decode_packets ( Jpeg2000DecoderContext s,
Jpeg2000Tile tile 
)
static

Definition at line 642 of file j2kdec.c.

Referenced by jpeg2000_decode_codestream().

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 672 of file j2kdec.c.

Referenced by decode_cblk().

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

Definition at line 702 of file j2kdec.c.

Referenced by decode_cblk().

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 724 of file j2kdec.c.

Referenced by decode_cblk().

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

Definition at line 787 of file j2kdec.c.

Referenced by jpeg2000_decode_tile().

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

Definition at line 835 of file j2kdec.c.

Referenced by jpeg2000_decode_tile().

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

Definition at line 849 of file j2kdec.c.

Referenced by jpeg2000_decode_tile().

static void mct_decode ( Jpeg2000DecoderContext s,
Jpeg2000Tile tile 
)
static

Definition at line 878 of file j2kdec.c.

Referenced by jpeg2000_decode_tile().

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

Definition at line 929 of file j2kdec.c.

Referenced by jpeg2000_decode_frame().

static void jpeg2000_dec_cleanup ( Jpeg2000DecoderContext s)
static

Definition at line 1056 of file j2kdec.c.

Referenced by jpeg2000_decode_frame().

static int jpeg2000_decode_codestream ( Jpeg2000DecoderContext s)
static

Definition at line 1071 of file j2kdec.c.

Referenced by jpeg2000_decode_frame().

static int jp2_find_codestream ( Jpeg2000DecoderContext s)
static

Definition at line 1157 of file j2kdec.c.

Referenced by jpeg2000_decode_frame().

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

Definition at line 1180 of file j2kdec.c.

static void jpeg2000_init_static_data ( AVCodec codec)
static

Definition at line 1238 of file j2kdec.c.

Variable Documentation

const float f_ict_params[4]
static
Initial value:
= {
1.402f,
0.34413f,
0.71414f,
1.772f
}

Definition at line 865 of file j2kdec.c.

Referenced by mct_decode().

const int i_ict_params[4]
static
Initial value:
= {
91881,
22553,
46802,
116130
}

Definition at line 871 of file j2kdec.c.

Referenced by mct_decode().

const AVOption options[]
static
Initial value:
= {
{ "lowres", "Lower the decoding resolution by a power of two",
{ NULL },
}

Definition at line 1246 of file j2kdec.c.

const AVProfile profiles[]
static
Initial value:
= {
{ FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0, "JPEG 2000 codestream restriction 0" },
{ FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1, "JPEG 2000 codestream restriction 1" },
{ FF_PROFILE_JPEG2000_CSTREAM_NO_RESTRICTION, "JPEG 2000 no codestream restrictions" },
{ FF_PROFILE_JPEG2000_DCINEMA_2K, "JPEG 2000 digital cinema 2K" },
{ FF_PROFILE_JPEG2000_DCINEMA_4K, "JPEG 2000 digital cinema 4K" },
}

Definition at line 1252 of file j2kdec.c.

class_name = "j2k"

Definition at line 1262 of file j2kdec.c.

item_name = av_default_item_name

Definition at line 1263 of file j2kdec.c.

option = options

Definition at line 1264 of file j2kdec.c.

Definition at line 1265 of file j2kdec.c.

const { ... }
AVCodec ff_j2k_decoder
Initial value:
= {
.name = "j2k",
.long_name = NULL_IF_CONFIG_SMALL("JPEG 2000"),
.priv_data_size = sizeof(Jpeg2000DecoderContext),
.init_static_data = jpeg2000_init_static_data,
.priv_class = &class,
.max_lowres = 5,
}

Definition at line 1268 of file j2kdec.c.