libavcodec/j2kenc.c File Reference

JPEG2000 image encoder. More...

#include <float.h>
#include "avcodec.h"
#include "bytestream.h"
#include "j2k.h"
#include "libavutil/common.h"

Go to the source code of this file.

Data Structures

struct  J2kTile
struct  J2kEncoderContext

Defines

#define NMSEDEC_BITS   7
#define NMSEDEC_FRACBITS   (NMSEDEC_BITS-1)
#define WMSEDEC_SHIFT   13
 must be >= 13
#define LAMBDA_SCALE   (100000000LL << (WMSEDEC_SHIFT - 13))

Functions

static void put_bits (J2kEncoderContext *s, int val, int n)
 put n times val bit
static void put_num (J2kEncoderContext *s, int num, int n)
 put n least significant bits of a number num
static void j2k_flush (J2kEncoderContext *s)
 flush the bitstream
static void tag_tree_code (J2kEncoderContext *s, J2kTgtNode *node, int threshold)
 code the value stored in node
static void tag_tree_update (J2kTgtNode *node)
 update the value in node
static int put_siz (J2kEncoderContext *s)
static int put_cod (J2kEncoderContext *s)
static int put_qcd (J2kEncoderContext *s, int compno)
static uint8_t * put_sot (J2kEncoderContext *s, int tileno)
static int init_tiles (J2kEncoderContext *s)
 compute the sizes of tiles, resolution levels, bands, etc.
static void copy_frame (J2kEncoderContext *s)
static void init_quantization (J2kEncoderContext *s)
static void init_luts ()
static int getnmsedec_sig (int x, int bpno)
static int getnmsedec_ref (int x, int bpno)
static void encode_sigpass (J2kT1Context *t1, int width, int height, int bandno, int *nmsedec, int bpno)
static void encode_refpass (J2kT1Context *t1, int width, int height, int *nmsedec, int bpno)
static void encode_clnpass (J2kT1Context *t1, int width, int height, int bandno, int *nmsedec, int bpno)
static void encode_cblk (J2kEncoderContext *s, J2kT1Context *t1, J2kCblk *cblk, J2kTile *tile, int width, int height, int bandpos, int lev)
static void putnumpasses (J2kEncoderContext *s, int n)
static int encode_packet (J2kEncoderContext *s, J2kResLevel *rlevel, int precno, uint8_t *expn, int numgbits)
static int encode_packets (J2kEncoderContext *s, J2kTile *tile, int tileno)
static int getcut (J2kCblk *cblk, int64_t lambda, int dwt_norm)
static void truncpasses (J2kEncoderContext *s, J2kTile *tile)
static int encode_tile (J2kEncoderContext *s, J2kTile *tile, int tileno)
void cleanup (J2kEncoderContext *s)
static void reinit (J2kEncoderContext *s)
static int encode_frame (AVCodecContext *avctx, uint8_t *buf, int buf_size, void *data)
static av_cold int j2kenc_init (AVCodecContext *avctx)
static int j2kenc_destroy (AVCodecContext *avctx)

Variables

static int lut_nmsedec_ref [1<< NMSEDEC_BITS]
static int lut_nmsedec_ref0 [1<< NMSEDEC_BITS]
static int lut_nmsedec_sig [1<< NMSEDEC_BITS]
static int lut_nmsedec_sig0 [1<< NMSEDEC_BITS]
static const int dwt_norms [2][4][10]
AVCodec jpeg2000_encoder


Detailed Description

JPEG2000 image encoder.

Author:
Kamil Nowosad

Definition in file j2kenc.c.


Define Documentation

#define LAMBDA_SCALE   (100000000LL << (WMSEDEC_SHIFT - 13))

Definition at line 37 of file j2kenc.c.

Referenced by encode_frame().

#define NMSEDEC_BITS   7

Definition at line 34 of file j2kenc.c.

Referenced by getnmsedec_ref(), getnmsedec_sig(), and init_luts().

#define NMSEDEC_FRACBITS   (NMSEDEC_BITS-1)

#define WMSEDEC_SHIFT   13

must be >= 13

Definition at line 36 of file j2kenc.c.

Referenced by getcut().


Function Documentation

void cleanup ( J2kEncoderContext s  ) 

Definition at line 891 of file j2kenc.c.

static void copy_frame ( J2kEncoderContext s  )  [static]

Definition at line 387 of file j2kenc.c.

static void encode_cblk ( J2kEncoderContext s,
J2kT1Context t1,
J2kCblk cblk,
J2kTile tile,
int  width,
int  height,
int  bandpos,
int  lev 
) [static]

Definition at line 578 of file j2kenc.c.

Referenced by encode_tile().

static void encode_clnpass ( J2kT1Context t1,
int  width,
int  height,
int  bandno,
int *  nmsedec,
int  bpno 
) [static]

Definition at line 523 of file j2kenc.c.

Referenced by encode_cblk().

static int encode_frame ( AVCodecContext avctx,
uint8_t *  buf,
int  buf_size,
void *  data 
) [static]

Definition at line 916 of file j2kenc.c.

static int encode_packet ( J2kEncoderContext s,
J2kResLevel rlevel,
int  precno,
uint8_t *  expn,
int  numgbits 
) [static]

Definition at line 652 of file j2kenc.c.

Referenced by encode_packets().

static int encode_packets ( J2kEncoderContext s,
J2kTile tile,
int  tileno 
) [static]

Definition at line 747 of file j2kenc.c.

Referenced by encode_tile().

static void encode_refpass ( J2kT1Context t1,
int  width,
int  height,
int *  nmsedec,
int  bpno 
) [static]

Definition at line 509 of file j2kenc.c.

Referenced by encode_cblk().

static void encode_sigpass ( J2kT1Context t1,
int  width,
int  height,
int  bandno,
int *  nmsedec,
int  bpno 
) [static]

Definition at line 487 of file j2kenc.c.

Referenced by encode_cblk().

static int encode_tile ( J2kEncoderContext s,
J2kTile tile,
int  tileno 
) [static]

Definition at line 814 of file j2kenc.c.

Referenced by encode_frame().

static int getcut ( J2kCblk cblk,
int64_t  lambda,
int  dwt_norm 
) [static]

Definition at line 770 of file j2kenc.c.

Referenced by truncpasses().

static int getnmsedec_ref ( int  x,
int  bpno 
) [static]

Definition at line 480 of file j2kenc.c.

Referenced by encode_refpass().

static int getnmsedec_sig ( int  x,
int  bpno 
) [static]

Definition at line 473 of file j2kenc.c.

Referenced by encode_clnpass(), and encode_sigpass().

static void init_luts (  )  [static]

Definition at line 455 of file j2kenc.c.

Referenced by j2kenc_init().

static void init_quantization ( J2kEncoderContext s  )  [static]

Definition at line 425 of file j2kenc.c.

Referenced by j2kenc_init().

static int init_tiles ( J2kEncoderContext s  )  [static]

compute the sizes of tiles, resolution levels, bands, etc.

allocate memory for them divide the input image into tile-components

Definition at line 348 of file j2kenc.c.

Referenced by j2kenc_init().

static void j2k_flush ( J2kEncoderContext s  )  [static]

flush the bitstream

Definition at line 195 of file j2kenc.c.

static int j2kenc_destroy ( AVCodecContext avctx  )  [static]

Definition at line 1022 of file j2kenc.c.

static av_cold int j2kenc_init ( AVCodecContext avctx  )  [static]

Definition at line 963 of file j2kenc.c.

static void put_bits ( J2kEncoderContext s,
int  val,
int  n 
) [static]

put n times val bit

Definition at line 175 of file j2kenc.c.

Referenced by aac_adtstoasc_filter(), aac_encode_frame(), ac3_output_frame_header(), alac_encode_frame(), align_put_bits(), asv1_encode_block(), asv1_put_level(), asv2_encode_block(), asv2_put_bits(), asv2_put_level(), bit_copy(), codebook_trellis_rate(), copy_bits(), dca_convert_bitstream(), dnxhd_encode_block(), dnxhd_encode_dc(), dnxhd_encode_thread(), dv_encode_ac(), dv_encode_video_segment(), encode_bitstream(), encode_block(), encode_dc(), encode_exp_vlc(), encode_ext_header(), encode_frame(), encode_individual_channel(), encode_mb_skip_run(), encode_ms_info(), encode_packet(), encode_picture_ls(), encode_pulses(), encode_scalar(), encode_scale_factors(), encode_superframe(), encode_window_bands_info(), ff_adts_decode_extradata(), ff_adts_write_frame_header(), ff_copy_bits(), ff_eac3_output_frame_header(), ff_flv2_encode_ac_esc(), ff_flv_encode_picture_header(), ff_h261_encode_mb(), ff_h261_encode_picture_header(), ff_h263_encode_mba(), ff_h263_encode_motion(), ff_mjpeg_encode_dc(), ff_mjpeg_encode_picture_header(), ff_mjpeg_encode_stuffing(), ff_mjpeg_find_marker(), ff_mpeg1_encode_slice_header(), ff_mpeg4_encode_video_packet_header(), ff_mpeg4_merge_partitions(), ff_mpeg4_stuffing(), ff_msmpeg4_encode_block(), ff_put_string(), ff_wmv2_encode_mb(), ff_wmv2_encode_picture_header(), ff_write_quant_matrix(), floor_encode(), gif_image_write_image(), h261_encode_block(), h261_encode_gob_header(), h261_encode_motion(), h263_encode_block(), h263_encode_gob_header(), h263_encode_mb(), h263_encode_picture_header(), h263p_encode_umotion(), jpeg_put_comments(), jpeg_table_header(), ls_encode_run(), ls_store_lse(), main(), mov_write_ac3_tag(), mpeg1_encode_block(), mpeg1_encode_mb_internal(), mpeg1_encode_motion(), mpeg1_encode_picture_header(), mpeg1_encode_sequence_header(), mpeg4_encode_block(), mpeg4_encode_dc(), mpeg4_encode_gop_header(), mpeg4_encode_mb(), mpeg4_encode_picture_header(), mpeg4_encode_visual_object_header(), mpeg4_encode_vol_header(), MPV_encode_picture(), msmpeg4_encode_dc(), output_audio_block(), pnm_decode_frame(), put_audio_specific_config(), put_bits32(), put_bitstream_info(), put_cabac_bit(), put_codebook_header(), put_codeword(), put_floor_header(), put_frame_header(), put_header(), put_huffman_table(), put_ics_info(), put_main_header(), put_marker(), put_mb_modes(), put_num(), put_pack_header(), put_primary_audio_header(), put_qscale(), put_residue_header(), put_sample7(), put_sbits(), put_subframe(), put_swf_line_edge(), put_swf_matrix(), put_swf_rect(), put_system_header(), put_xsub_rle(), quantize_and_encode_band_cost_template(), ra144_encode_frame(), ra144_encode_subblock(), rv10_encode_picture_header(), rv20_encode_picture_header(), save_bits(), set_te_golomb(), set_ue_golomb(), set_ur_golomb(), set_ur_golomb_jpegls(), svq1_encode_frame(), svq1_encode_plane(), svq1_write_header(), swf_write_header(), tag_tree_code(), vorbis_encode_frame(), write_compressed_frame(), write_frame_footer(), write_frame_header(), write_header(), write_streaminfo(), write_subframes(), and write_utf8().

static int put_cod ( J2kEncoderContext s  )  [static]

Definition at line 275 of file j2kenc.c.

Referenced by encode_frame().

static void put_num ( J2kEncoderContext s,
int  num,
int  n 
) [static]

put n least significant bits of a number num

Definition at line 188 of file j2kenc.c.

Referenced by encode_packet(), and putnumpasses().

static int put_qcd ( J2kEncoderContext s,
int  compno 
) [static]

Definition at line 298 of file j2kenc.c.

Referenced by encode_frame().

static int put_siz ( J2kEncoderContext s  )  [static]

Definition at line 246 of file j2kenc.c.

Referenced by encode_frame().

static uint8_t* put_sot ( J2kEncoderContext s,
int  tileno 
) [static]

Definition at line 324 of file j2kenc.c.

Referenced by encode_frame().

static void putnumpasses ( J2kEncoderContext s,
int  n 
) [static]

Definition at line 637 of file j2kenc.c.

Referenced by encode_packet().

static void reinit ( J2kEncoderContext s  )  [static]

Definition at line 906 of file j2kenc.c.

Referenced by encode_frame().

static void tag_tree_code ( J2kEncoderContext s,
J2kTgtNode node,
int  threshold 
) [static]

code the value stored in node

Definition at line 206 of file j2kenc.c.

Referenced by encode_packet().

static void tag_tree_update ( J2kTgtNode node  )  [static]

update the value in node

Definition at line 234 of file j2kenc.c.

Referenced by encode_packet().

static void truncpasses ( J2kEncoderContext s,
J2kTile tile 
) [static]

Definition at line 788 of file j2kenc.c.

Referenced by encode_tile().


Variable Documentation

const int dwt_norms[2][4][10] [static]

Initial value:

 { 
    {{10000, 19650, 41770,  84030, 169000, 338400,  676900, 1353000, 2706000, 5409000},
     {20220, 39890, 83550, 170400, 342700, 686300, 1373000, 2746000, 5490000},
     {20220, 39890, 83550, 170400, 342700, 686300, 1373000, 2746000, 5490000},
     {20800, 38650, 83070, 171800, 347100, 695900, 1393000, 2786000, 5572000}},

    {{10000, 15000, 27500, 53750, 106800, 213400, 426700, 853300, 1707000, 3413000},
     {10380, 15920, 29190, 57030, 113300, 226400, 452500, 904800, 1809000},
     {10380, 15920, 29190, 57030, 113300, 226400, 452500, 904800, 1809000},
     { 7186,  9218, 15860, 30430,  60190, 120100, 240000, 479700,  959300}}
}

Definition at line 44 of file j2kenc.c.

Referenced by init_quantization(), and truncpasses().

Initial value:

Definition at line 1030 of file j2kenc.c.

int lut_nmsedec_ref[1<< NMSEDEC_BITS] [static]

Definition at line 39 of file j2kenc.c.

Referenced by getnmsedec_ref(), and init_luts().

int lut_nmsedec_ref0[1<< NMSEDEC_BITS] [static]

Definition at line 39 of file j2kenc.c.

Referenced by getnmsedec_ref(), and init_luts().

int lut_nmsedec_sig[1<< NMSEDEC_BITS] [static]

Definition at line 39 of file j2kenc.c.

Referenced by getnmsedec_sig(), and init_luts().

int lut_nmsedec_sig0[1<< NMSEDEC_BITS] [static]

Definition at line 39 of file j2kenc.c.

Referenced by getnmsedec_sig(), and init_luts().


Generated on Fri Oct 26 02:39:45 2012 for FFmpeg by  doxygen 1.5.8