Go to the documentation of this file.
37 #define SHL(a, n) ((n) >= 0 ? (a) << (n) : (a) >> -(n))
45 while (
w > 1 ||
h > 1) {
46 res +=
w * (int64_t)
h;
66 while (
w > 1 ||
h > 1) {
75 for (
i = 0;
i < ph;
i++)
76 for (j = 0; j < pw; j++)
77 t[
i * pw + j].parent = &
t2[(
i >> 1) *
w + (j >> 1)];
89 for (
i = 0;
i < siz;
i++) {
113 if (
h == 2)
return 8;
115 if (v >= 1)
return 7;
116 if (d >= 1)
return 6;
119 if (v == 2)
return 4;
120 if (v == 1)
return 3;
121 if (d >= 2)
return 2;
122 if (d == 1)
return 1;
124 if (d >= 3)
return 8;
126 if (
h+v >= 1)
return 7;
130 if (
h+v >= 2)
return 5;
131 if (
h+v == 1)
return 4;
134 if (
h+v >= 2)
return 2;
135 if (
h+v == 1)
return 1;
142 static const int contribtab[3][3] = { { 0, -1, 1 }, { -1, -1, 0 }, { 1, 0, 1 } };
143 static const int ctxlbltab[3][3] = { { 13, 12, 11 }, { 10, 9, 10 }, { 11, 12, 13 } };
144 static const int xorbittab[3][3] = { { 1, 1, 1 }, { 1, 0, 0 }, { 0, 0, 0 } };
148 int vcontrib, hcontrib;
162 for (
i = 0;
i < 256;
i++)
163 for (j = 0; j < 4; j++)
165 for (
i = 0;
i < 16;
i++)
166 for (j = 0; j < 16; j++)
200 int bandno,
int gbandno,
int reslevelno,
235 switch (bandno + (reslevelno > 0)) {
266 int precno,
int bandno,
int reslevelno,
267 int log2_band_prec_width,
268 int log2_band_prec_height)
271 int nb_codeblocks, cblkno;
280 (1 << log2_band_prec_width);
284 (1 << log2_band_prec_height);
288 (1 << log2_band_prec_width);
294 (1 << log2_band_prec_height);
329 for (cblkno = 0; cblkno < nb_codeblocks; cblkno++) {
352 if ((bandno + !!reslevelno) & 1) {
353 cblk->
coord[0][0] +=
comp->reslevel[reslevelno-1].coord[0][1] -
354 comp->reslevel[reslevelno-1].coord[0][0];
355 cblk->
coord[0][1] +=
comp->reslevel[reslevelno-1].coord[0][1] -
356 comp->reslevel[reslevelno-1].coord[0][0];
358 if ((bandno + !!reslevelno) & 2) {
359 cblk->
coord[1][0] +=
comp->reslevel[reslevelno-1].coord[1][1] -
360 comp->reslevel[reslevelno-1].coord[1][0];
361 cblk->
coord[1][1] +=
comp->reslevel[reslevelno-1].coord[1][1] -
362 comp->reslevel[reslevelno-1].coord[1][0];
378 int bandno,
int gbandno,
int reslevelno,
379 int cbps,
int dx,
int dy)
382 uint8_t log2_band_prec_width, log2_band_prec_height;
394 if (reslevelno == 0) {
396 for (
i = 0;
i < 2;
i++)
397 for (j = 0; j < 2; j++)
411 for (
i = 0;
i < 2;
i++)
412 for (j = 0; j < 2; j++)
416 (((bandno + 1 >>
i) & 1LL) << declvl - 1),
440 for (precno = 0; precno < nb_precincts; precno++) {
442 precno, bandno, reslevelno,
443 log2_band_prec_width, log2_band_prec_height);
454 int cbps,
int dx,
int dy,
457 int reslevelno, bandno, gbandno = 0,
ret,
i, j;
471 comp->coord[1][1] -
comp->coord[1][0], 0, avctx))
473 csize = (
comp->coord[0][1] -
comp->coord[0][0]) *
474 (
comp->coord[1][1] -
comp->coord[1][0]);
475 if (
comp->coord[0][1] -
comp->coord[0][0] > 32768 ||
476 comp->coord[1][1] -
comp->coord[1][0] > 32768) {
498 for (reslevelno = 0; reslevelno < codsty->
nreslevels; reslevelno++) {
505 for (
i = 0;
i < 2;
i++)
506 for (j = 0; j < 2; j++)
529 if (reslevel->
coord[0][1] == reslevel->
coord[0][0])
537 if (reslevel->
coord[1][1] == reslevel->
coord[1][0])
552 for (bandno = 0; bandno < reslevel->
nbands; bandno++, gbandno++) {
554 comp, codsty, qntsty,
555 bandno, gbandno, reslevelno,
566 int reslevelno, bandno, cblkno, precno;
567 for (reslevelno = 0; reslevelno < codsty->
nreslevels; reslevelno++) {
569 for (bandno = 0; bandno < rlevel->
nbands; bandno++) {
587 int reslevelno, bandno, precno;
596 reslevel =
comp->reslevel + reslevelno;
597 for (bandno = 0; bandno < reslevel->
nbands; bandno++) {
603 band = reslevel->
band + bandno;
613 for (cblkno = 0; cblkno < nb_code_blocks; cblkno ++) {
static const int contribtab[3][3]
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
#define JPEG2000_T1_SGN_N
#define FFSWAP(type, a, b)
static void comp(unsigned char *dst, ptrdiff_t dst_stride, unsigned char *src, ptrdiff_t src_stride, int add)
int ff_jpeg2000_init_component(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty, Jpeg2000QuantStyle *qntsty, int cbps, int dx, int dy, AVCodecContext *avctx)
#define JPEG2000_T1_SIG_NE
static const int xorbittab[3][3]
uint8_t ff_jpeg2000_sgnctxno_lut[16][16]
Jpeg2000TgtNode * zerobits
static void init_band_stepsize(AVCodecContext *avctx, Jpeg2000Band *band, Jpeg2000CodingStyle *codsty, Jpeg2000QuantStyle *qntsty, int bandno, int gbandno, int reslevelno, int cbps)
uint8_t ff_jpeg2000_sigctxno_lut[256][4]
void * av_mallocz_array(size_t nmemb, size_t size)
struct Jpeg2000TgtNode * parent
#define JPEG2000_T1_SIG_N
int av_codec_is_encoder(const AVCodec *codec)
const struct AVCodec * codec
#define JPEG2000_T1_SGN_E
uint8_t log2_prec_heights[JPEG2000_MAX_RESLEVELS]
#define JPEG2000_T1_SIG_E
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_always_inline float ff_exp2fi(int x)
2^(x) for integer x
static Jpeg2000TgtNode * ff_jpeg2000_tag_tree_init(int w, int h)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static int init_band(AVCodecContext *avctx, Jpeg2000ResLevel *reslevel, Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty, Jpeg2000QuantStyle *qntsty, int bandno, int gbandno, int reslevelno, int cbps, int dx, int dy)
int64_t max_pixels
The number of pixels per image to maximally accept.
#define JPEG2000_T1_SGN_W
#define JPEG2000_T1_SIG_S
uint8_t log2_prec_widths[JPEG2000_MAX_RESLEVELS]
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define JPEG2000_T1_SIG_W
static int32_t tag_tree_size(int w, int h)
static void tag_tree_zero(Jpeg2000TgtNode *t, int w, int h)
uint16_t log2_cblk_height
static int getsgnctxno(int flag, uint8_t *xorbit)
#define JPEG2000_T1_SIG_SE
static const int ctxlbltab[3][3]
int ff_jpeg2000_dwt_init(DWTContext *s, int border[2][2], int decomp_levels, int type)
Initialize DWT.
void ff_jpeg2000_cleanup(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty)
#define JPEG2000_T1_SIG_SW
Jpeg2000TgtNode * cblkincl
uint8_t ff_jpeg2000_xorbit_lut[16][16]
void ff_dwt_destroy(DWTContext *s)
void ff_jpeg2000_reinit(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty)
#define i(width, name, range_min, range_max)
uint8_t expn[JPEG2000_MAX_DECLEVELS *3]
uint16_t mant[JPEG2000_MAX_DECLEVELS *3]
static int getsigctxno(int flag, int bandno)
#define AV_INPUT_BUFFER_PADDING_SIZE
main external API structure.
static int ff_jpeg2000_ceildivpow2(int a, int b)
void av_cold ff_jpeg2000_init_tier1_luts(void)
#define JPEG2000_T1_SGN_S
#define JPEG2000_T1_SIG_NW
static int init_prec(Jpeg2000Band *band, Jpeg2000ResLevel *reslevel, Jpeg2000Component *comp, int precno, int bandno, int reslevelno, int log2_band_prec_width, int log2_band_prec_height)
void ff_jpeg2000_set_significance(Jpeg2000T1Context *t1, int x, int y, int negative)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...