[FFmpeg-soc] [soc]: r1185 - in jpeg2000: j2k.c j2k.h j2kdec.c j2kenc.c
k.nowosad
subversion at mplayerhq.hu
Sat Aug 25 12:51:09 CEST 2007
Author: k.nowosad
Date: Sat Aug 25 12:51:09 2007
New Revision: 1185
Log:
merged common part of initialization
Modified:
jpeg2000/j2k.c
jpeg2000/j2k.h
jpeg2000/j2kdec.c
jpeg2000/j2kenc.c
Modified: jpeg2000/j2k.c
==============================================================================
--- jpeg2000/j2k.c (original)
+++ jpeg2000/j2k.c Sat Aug 25 12:51:09 2007
@@ -28,6 +28,8 @@
#include "j2k.h"
#include "avcodec.h"
+#define SHL(a, n) ((n)>=0 ? (a) << (n) : (a) >> -(n))
+
#if 0
void ff_j2k_printv(int *tab, int l)
{
@@ -178,3 +180,143 @@ void ff_j2k_set_significant(J2kT1Context
t1->flags[y-1][x+1] |= J2K_T1_SIG_SW;
t1->flags[y-1][x-1] |= J2K_T1_SIG_SE;
}
+
+int ff_j2k_init_component(J2kComponent *comp, J2kCodingStyle *codsty, J2kQuantStyle *qntsty, int cbps)
+{
+ int reslevelno, bandno, gbandno = 0, ret;
+
+ if (ret=ff_dwt_init(&comp->dwt,
+ (uint16_t[2][2]){{comp->x0, comp->x1}, {comp->y0, comp->y1}}, // will be changed soon
+ codsty->nreslevels-1, codsty->transform))
+ return ret;
+
+ comp->data = av_malloc((comp->y1 - comp->y0) * (comp->x1 -comp->x0) * sizeof(int));
+ if (!comp->data)
+ return AVERROR(ENOMEM);
+ comp->reslevel = av_malloc(codsty->nreslevels * sizeof(J2kResLevel));
+
+ if (!comp->reslevel)
+ return AVERROR(ENOMEM);
+ for (reslevelno = 0; reslevelno < codsty->nreslevels; reslevelno++){
+ int n = codsty->nreslevels - reslevelno;
+ J2kResLevel *reslevel = comp->reslevel + reslevelno;
+
+ reslevel->x0 = ff_j2k_ceildivpow2(comp->x0, codsty->nreslevels - reslevelno - 1);
+ reslevel->x1 = ff_j2k_ceildivpow2(comp->x1, codsty->nreslevels - reslevelno - 1);
+ reslevel->y0 = ff_j2k_ceildivpow2(comp->y0, codsty->nreslevels - reslevelno - 1);
+ reslevel->y1 = ff_j2k_ceildivpow2(comp->y1, codsty->nreslevels - reslevelno - 1);
+
+ if (reslevelno == 0)
+ reslevel->nbands = 1;
+ else
+ reslevel->nbands = 3;
+
+ if (reslevel->x1 == reslevel->x0)
+ reslevel->num_precincts_x = 0;
+ else
+ reslevel->num_precincts_x = ff_j2k_ceildivpow2(reslevel->x1, codsty->log2_prec_width) - reslevel->x0 / (1<<codsty->log2_prec_width);
+
+ if (reslevel->y1 == reslevel->y0)
+ reslevel->num_precincts_y = 0;
+ else
+ reslevel->num_precincts_y = ff_j2k_ceildivpow2(reslevel->y1, codsty->log2_prec_height) - reslevel->y0 / (1<<codsty->log2_prec_height);
+
+ reslevel->band = av_malloc(reslevel->nbands * sizeof(J2kBand));
+ if (!reslevel->band)
+ return AVERROR(ENOMEM);
+ for (bandno = 0; bandno < reslevel->nbands; bandno++, gbandno++){
+ J2kBand *band = reslevel->band + bandno;
+ int cblkno, precx, precy, precno;
+ int x0, y0, x1, y1;
+ int xi0, yi0, xi1, yi1;
+ int cblkperprecw, cblkperprech;
+
+ if (qntsty->quantsty != J2K_QSTY_NONE){
+ const static uint8_t lut_gain[2][4] = {{0, 0, 0, 0}, {0, 1, 1, 2}};
+ int numbps;
+
+ numbps = cbps + lut_gain[codsty->transform][bandno + reslevelno>0];
+ band->stepsize = SHL(2048 + qntsty->mant[gbandno], 2 + numbps - qntsty->expn[gbandno]);
+ }
+ else
+ band->stepsize = 1 << 13;
+
+ if (reslevelno == 0){ // the same everywhere
+ band->codeblock_width = 1 << FFMIN(codsty->log2_cblk_width, codsty->log2_prec_width-1);
+ band->codeblock_height = 1 << FFMIN(codsty->log2_cblk_height, codsty->log2_prec_height-1);
+
+ band->x0 = ff_j2k_ceildivpow2(comp->x0, n-1);
+ band->x1 = ff_j2k_ceildivpow2(comp->x1, n-1);
+ band->y0 = ff_j2k_ceildivpow2(comp->y0, n-1);
+ band->y1 = ff_j2k_ceildivpow2(comp->y1, n-1);
+ }
+ else{
+ band->codeblock_width = 1 << FFMIN(codsty->log2_cblk_width, codsty->log2_prec_width);
+ band->codeblock_height = 1 << FFMIN(codsty->log2_cblk_height, codsty->log2_prec_height);
+
+ band->x0 = ff_j2k_ceildivpow2(comp->x0 - (1 << (n-1)) * ((bandno+1)&1), n);
+ band->x1 = ff_j2k_ceildivpow2(comp->x1 - (1 << (n-1)) * ((bandno+1)&1), n);
+ band->y0 = ff_j2k_ceildivpow2(comp->y0 - (1 << (n-1)) * (((bandno+1)&2)>>1), n);
+ band->y1 = ff_j2k_ceildivpow2(comp->y1 - (1 << (n-1)) * (((bandno+1)&2)>>1), n);
+ }
+ band->cblknx = ff_j2k_ceildiv(band->x1, band->codeblock_width) - band->x0 / band->codeblock_width;
+ band->cblkny = ff_j2k_ceildiv(band->y1, band->codeblock_height) - band->y0 / band->codeblock_height;
+
+ band->cblk = av_malloc(band->cblknx * band->cblkny * sizeof(J2kCblk));
+ if (!band->cblk)
+ return AVERROR(ENOMEM);
+ band->prec = av_malloc(reslevel->num_precincts_x * reslevel->num_precincts_y * sizeof(J2kPrec));
+ if (!band->prec)
+ return AVERROR(ENOMEM);
+
+ for (cblkno = 0; cblkno < band->cblknx * band->cblkny; cblkno++){
+ J2kCblk *cblk = band->cblk + cblkno;
+ cblk->zero = 0;
+ cblk->lblock = 3;
+ cblk->length = 0;
+ cblk->lengthinc = 0;
+ cblk->npasses = 0;
+ }
+
+ y0 = band->y0;
+ y1 = (band->y0 + (1<<codsty->log2_prec_height))/(1<<codsty->log2_prec_height)*(1<<codsty->log2_prec_height) - band->y0;
+ yi0 = 0;
+ yi1 = ff_j2k_ceildiv(y1 - y0, 1<<codsty->log2_cblk_height) * (1<<codsty->log2_cblk_height);
+ yi1 = FFMIN(yi1, band->cblkny);
+ cblkperprech = 1<<(codsty->log2_prec_height - codsty->log2_cblk_height);
+ for (precy = 0, precno = 0; precy < reslevel->num_precincts_y; precy++){
+ for (precx = 0; precx < reslevel->num_precincts_x; precx++, precno++){
+ band->prec[precno].yi0 = yi0;
+ band->prec[precno].yi1 = yi1;
+ }
+ yi1 += cblkperprech;
+ yi0 = yi1 - cblkperprech;
+ yi1 = FFMIN(yi1, band->cblkny);
+ }
+ x0 = band->x0;
+ x1 = (band->x0 + (1<<codsty->log2_prec_width))/(1<<codsty->log2_prec_width)*(1<<codsty->log2_prec_width) - band->x0;
+ xi0 = 0;
+ xi1 = ff_j2k_ceildiv(x1 - x0, 1<<codsty->log2_cblk_width) * (1<<codsty->log2_cblk_width);
+ xi1 = FFMIN(xi1, band->cblknx);
+
+ cblkperprecw = 1<<(codsty->log2_prec_width - codsty->log2_cblk_width);
+ for (precx = 0, precno = 0; precx < reslevel->num_precincts_x; precx++){
+ for (precy = 0; precy < reslevel->num_precincts_y; precy++, precno = 0){
+ J2kPrec *prec = band->prec + precno;
+ prec->xi0 = xi0;
+ prec->xi1 = xi1;
+ prec->cblkincl = ff_j2k_tag_tree_init(prec->xi1 - prec->xi0,
+ prec->yi1 - prec->yi0);
+ prec->zerobits = ff_j2k_tag_tree_init(prec->xi1 - prec->xi0,
+ prec->yi1 - prec->yi0);
+ if (!prec->cblkincl || !prec->zerobits)
+ return AVERROR(ENOMEM);
+
+ }
+ xi1 += cblkperprecw;
+ xi0 = xi1 - cblkperprecw;
+ xi1 = FFMIN(xi1, band->cblknx);
+ }
+ }
+ }
+}
Modified: jpeg2000/j2k.h
==============================================================================
--- jpeg2000/j2k.h (original)
+++ jpeg2000/j2k.h Sat Aug 25 12:51:09 2007
@@ -211,4 +211,6 @@ static inline int ff_j2k_getsgnctxno(int
return ff_j2k_sgnctxno_lut[flag&15][(flag>>8)&15];
}
+int ff_j2k_init_component(J2kComponent *comp, J2kCodingStyle *codsty, J2kQuantStyle *qntsty, int cbps);
+
#endif /* J2K_H */
Modified: jpeg2000/j2kdec.c
==============================================================================
--- jpeg2000/j2kdec.c (original)
+++ jpeg2000/j2kdec.c Sat Aug 25 12:51:09 2007
@@ -31,8 +31,6 @@
#include "j2k.h"
#include "common.h"
-#define SHL(a, n) ((n)>=0 ? (a) << (n) : (a) >> -(n))
-
#define HAD_COC 0x01
#define HAD_QCC 0x02
@@ -388,7 +386,7 @@ static uint8_t get_sot(J2kDecoderContext
static int init_tile(J2kDecoderContext *s, int tileno)
{
- int compno, reslevelno, bandno, p, q;
+ int compno, p, q;
J2kTile *tile = s->tile + tileno;
p = tileno % s->numXtiles;
@@ -407,140 +405,8 @@ static int init_tile(J2kDecoderContext *
comp->y0 = FFMAX(q * s->tile_height + s->tile_offset_y, s->image_offset_y);
comp->y1 = FFMIN((q+1)*s->tile_height + s->tile_offset_y, s->height);
- if (ret=ff_dwt_init(&comp->dwt,
- (uint16_t[2][2]){{comp->x0, comp->x1}, {comp->y0, comp->y1}}, // will be changed soon
- codsty->nreslevels-1, codsty->transform))
+ if (ret = ff_j2k_init_component(comp, codsty, qntsty, s->cbps[compno]))
return ret;
-
- comp->data = av_malloc((comp->y1 - comp->y0) * (comp->x1 -comp->x0) * sizeof(int));
- if (!comp->data)
- return AVERROR(ENOMEM);
- comp->reslevel = av_malloc(codsty->nreslevels * sizeof(J2kResLevel));
-
- if (!comp->reslevel)
- return AVERROR(ENOMEM);
- for (reslevelno = 0; reslevelno < codsty->nreslevels; reslevelno++){
- int n = codsty->nreslevels - reslevelno;
- J2kResLevel *reslevel = comp->reslevel + reslevelno;
-
- reslevel->x0 = ff_j2k_ceildivpow2(comp->x0, codsty->nreslevels - reslevelno - 1);
- reslevel->x1 = ff_j2k_ceildivpow2(comp->x1, codsty->nreslevels - reslevelno - 1);
- reslevel->y0 = ff_j2k_ceildivpow2(comp->y0, codsty->nreslevels - reslevelno - 1);
- reslevel->y1 = ff_j2k_ceildivpow2(comp->y1, codsty->nreslevels - reslevelno - 1);
-
- if (reslevelno == 0)
- reslevel->nbands = 1;
- else
- reslevel->nbands = 3;
-
- if (reslevel->x1 == reslevel->x0)
- reslevel->num_precincts_x = 0;
- else
- reslevel->num_precincts_x = ff_j2k_ceildivpow2(reslevel->x1, codsty->log2_prec_width) - reslevel->x0 / (1<<codsty->log2_prec_width);
-
- if (reslevel->y1 == reslevel->y0)
- reslevel->num_precincts_y = 0;
- else
- reslevel->num_precincts_y = ff_j2k_ceildivpow2(reslevel->y1, codsty->log2_prec_height) - reslevel->y0 / (1<<codsty->log2_prec_height);
-
- reslevel->band = av_malloc(reslevel->nbands * sizeof(J2kBand));
- if (!reslevel->band)
- return AVERROR(ENOMEM);
- for (bandno = 0; bandno < reslevel->nbands; bandno++, gbandno++){
- J2kBand *band = reslevel->band + bandno;
- int cblkno, precx, precy, precno;
- int x0, y0, x1, y1;
- int xi0, yi0, xi1, yi1;
- int cblkperprecw, cblkperprech;
-
- if (qntsty->quantsty != J2K_QSTY_NONE){
- const static uint8_t lut_gain[2][4] = {{0, 0, 0, 0}, {0, 1, 1, 2}};
- int numbps;
-
- numbps = s->cbps[compno] + lut_gain[codsty->transform][bandno + reslevelno>0];
- band->stepsize = SHL(2048 + qntsty->mant[gbandno], 2 + numbps - qntsty->expn[gbandno]);
- }
- else
- band->stepsize = 1 << 13;
-
- if (reslevelno == 0){ // the same everywhere
- band->codeblock_width = 1 << FFMIN(codsty->log2_cblk_width, codsty->log2_prec_width-1);
- band->codeblock_height = 1 << FFMIN(codsty->log2_cblk_height, codsty->log2_prec_height-1);
-
- band->x0 = ff_j2k_ceildivpow2(comp->x0, n-1);
- band->x1 = ff_j2k_ceildivpow2(comp->x1, n-1);
- band->y0 = ff_j2k_ceildivpow2(comp->y0, n-1);
- band->y1 = ff_j2k_ceildivpow2(comp->y1, n-1);
- }
- else{
- band->codeblock_width = 1 << FFMIN(codsty->log2_cblk_width, codsty->log2_prec_width);
- band->codeblock_height = 1 << FFMIN(codsty->log2_cblk_height, codsty->log2_prec_height);
-
- band->x0 = ff_j2k_ceildivpow2(comp->x0 - (1 << (n-1)) * ((bandno+1)&1), n);
- band->x1 = ff_j2k_ceildivpow2(comp->x1 - (1 << (n-1)) * ((bandno+1)&1), n);
- band->y0 = ff_j2k_ceildivpow2(comp->y0 - (1 << (n-1)) * (((bandno+1)&2)>>1), n);
- band->y1 = ff_j2k_ceildivpow2(comp->y1 - (1 << (n-1)) * (((bandno+1)&2)>>1), n);
- }
- band->cblknx = ff_j2k_ceildiv(band->x1, band->codeblock_width) - band->x0 / band->codeblock_width;
- band->cblkny = ff_j2k_ceildiv(band->y1, band->codeblock_height) - band->y0 / band->codeblock_height;
-
- band->cblk = av_malloc(band->cblknx * band->cblkny * sizeof(J2kCblk));
- if (!band->cblk)
- return AVERROR(ENOMEM);
- band->prec = av_malloc(reslevel->num_precincts_x * reslevel->num_precincts_y * sizeof(J2kPrec));
- if (!band->prec)
- return AVERROR(ENOMEM);
-
- for (cblkno = 0; cblkno < band->cblknx * band->cblkny; cblkno++){
- J2kCblk *cblk = band->cblk + cblkno;
- cblk->zero = 0;
- cblk->lblock = 3;
- cblk->length = 0;
- cblk->lengthinc = 0;
- cblk->npasses = 0;
- }
-
- y0 = band->y0;
- y1 = (band->y0 + (1<<codsty->log2_prec_height))/(1<<codsty->log2_prec_height)*(1<<codsty->log2_prec_height) - band->y0;
- yi0 = 0;
- yi1 = ff_j2k_ceildiv(y1 - y0, 1<<codsty->log2_cblk_height) * (1<<codsty->log2_cblk_height);
- yi1 = FFMIN(yi1, band->cblkny);
- cblkperprech = 1<<(codsty->log2_prec_height - codsty->log2_cblk_height);
- for (precy = 0, precno = 0; precy < reslevel->num_precincts_y; precy++){
- for (precx = 0; precx < reslevel->num_precincts_x; precx++, precno++){
- band->prec[precno].yi0 = yi0;
- band->prec[precno].yi1 = yi1;
- }
- yi1 += cblkperprech;
- yi0 = yi1 - cblkperprech;
- yi1 = FFMIN(yi1, band->cblkny);
- }
- x0 = band->x0;
- x1 = (band->x0 + (1<<codsty->log2_prec_width))/(1<<codsty->log2_prec_width)*(1<<codsty->log2_prec_width) - band->x0;
- xi0 = 0;
- xi1 = ff_j2k_ceildiv(x1 - x0, 1<<codsty->log2_cblk_width) * (1<<codsty->log2_cblk_width);
- xi1 = FFMIN(xi1, band->cblknx);
-
- cblkperprecw = 1<<(codsty->log2_prec_width - codsty->log2_cblk_width);
- for (precx = 0, precno = 0; precx < reslevel->num_precincts_x; precx++){
- for (precy = 0; precy < reslevel->num_precincts_y; precy++, precno = 0){
- J2kPrec *prec = band->prec + precno;
- prec->xi0 = xi0;
- prec->xi1 = xi1;
- prec->cblkincl = ff_j2k_tag_tree_init(prec->xi1 - prec->xi0,
- prec->yi1 - prec->yi0);
- prec->zerobits = ff_j2k_tag_tree_init(prec->xi1 - prec->xi0,
- prec->yi1 - prec->yi0);
- if (!prec->cblkincl || !prec->zerobits)
- return AVERROR(ENOMEM);
-
- }
- xi1 += cblkperprecw;
- xi0 = xi1 - cblkperprecw;
- xi1 = FFMIN(xi1, band->cblknx);
- }
- }
- }
}
return 0;
}
Modified: jpeg2000/j2kenc.c
==============================================================================
--- jpeg2000/j2kenc.c (original)
+++ jpeg2000/j2kenc.c Sat Aug 25 12:51:09 2007
@@ -334,122 +334,8 @@ static int init_tiles(J2kEncoderContext
comp->y0 = tiley * s->tile_height;
comp->y1 = FFMIN((tiley+1)*s->tile_height, s->height);
- if (ret=ff_dwt_init(&comp->dwt,
- (uint16_t[2][2]){{comp->x0, comp->x1}, {comp->y0, comp->y1}}, // will be changed soon
- codsty->nreslevels-1, 1))
+ if (ret = ff_j2k_init_component(comp, codsty, qntsty, s->cbps[compno]))
return ret;
-
- comp->data = av_malloc((comp->y1 - comp->y0) * (comp->x1 -comp->x0) * sizeof(int));
- if (!comp->data)
- return AVERROR(ENOMEM);
- comp->reslevel = av_malloc(codsty->nreslevels * sizeof(J2kResLevel));
- if (!comp->reslevel)
- return AVERROR(ENOMEM);
- for (reslevelno = 0; reslevelno < codsty->nreslevels; reslevelno++){
- int n = codsty->nreslevels - reslevelno;
- J2kResLevel *reslevel = comp->reslevel + reslevelno;
-
- reslevel->x0 = ff_j2k_ceildivpow2(comp->x0, codsty->nreslevels - reslevelno - 1);
- reslevel->x1 = ff_j2k_ceildivpow2(comp->x1, codsty->nreslevels - reslevelno - 1);
- reslevel->y0 = ff_j2k_ceildivpow2(comp->y0, codsty->nreslevels - reslevelno - 1);
- reslevel->y1 = ff_j2k_ceildivpow2(comp->y1, codsty->nreslevels - reslevelno - 1);
-
- if (reslevelno == 0)
- reslevel->nbands = 1;
- else
- reslevel->nbands = 3;
-
- if (reslevel->x1 == reslevel->x0)
- reslevel->num_precincts_x = 0;
- else
- reslevel->num_precincts_x = ff_j2k_ceildivpow2(reslevel->x1, codsty->log2_prec_width) - reslevel->x0 / (1<<codsty->log2_prec_width);
-
- if (reslevel->y1 == reslevel->y0)
- reslevel->num_precincts_y = 0;
- else
- reslevel->num_precincts_y = ff_j2k_ceildivpow2(reslevel->y1, codsty->log2_prec_height) - reslevel->y0 / (1<<codsty->log2_prec_height);
- reslevel->band = av_malloc(reslevel->nbands * sizeof(J2kBand));
- if (!reslevel->band)
- return AVERROR(ENOMEM);
- for (bandno = 0; bandno < reslevel->nbands; bandno++){
- J2kBand *band = reslevel->band + bandno;
- int cblkno, precx, precy, precno;
- int x0, y0, x1, y1;
- int xi0, yi0, xi1, yi1;
- int cblkperprecw, cblkperprech;
-
- if (reslevelno == 0){ // the same everywhere
- band->codeblock_width = 1 << FFMIN(codsty->log2_cblk_width, codsty->log2_prec_width-1);
- band->codeblock_height = 1 << FFMIN(codsty->log2_cblk_height, codsty->log2_prec_height-1);
-
- band->x0 = ff_j2k_ceildivpow2(comp->x0, n-1);
- band->x1 = ff_j2k_ceildivpow2(comp->x1, n-1);
- band->y0 = ff_j2k_ceildivpow2(comp->y0, n-1);
- band->y1 = ff_j2k_ceildivpow2(comp->y1, n-1);
- }
- else{
- band->codeblock_width = 1 << FFMIN(codsty->log2_cblk_width, codsty->log2_prec_width);
- band->codeblock_height = 1 << FFMIN(codsty->log2_cblk_height, codsty->log2_prec_height);
-
- band->x0 = ff_j2k_ceildivpow2(comp->x0 - (1 << (n-1)) * ((bandno+1)&1), n);
- band->x1 = ff_j2k_ceildivpow2(comp->x1 - (1 << (n-1)) * ((bandno+1)&1), n);
- band->y0 = ff_j2k_ceildivpow2(comp->y0 - (1 << (n-1)) * (((bandno+1)&2)>>1), n);
- band->y1 = ff_j2k_ceildivpow2(comp->y1 - (1 << (n-1)) * (((bandno+1)&2)>>1), n);
- }
-
- band->cblknx = ff_j2k_ceildiv(band->x1, band->codeblock_width) - band->x0 / band->codeblock_width;
- band->cblkny = ff_j2k_ceildiv(band->y1, band->codeblock_height) - band->y0 / band->codeblock_height;
-
- band->cblk = av_malloc(band->cblknx * band->cblkny * sizeof(J2kCblk));
- if (!band->cblk)
- return AVERROR(ENOMEM);
- band->prec = av_malloc(reslevel->num_precincts_x * reslevel->num_precincts_y * sizeof(J2kPrec));
- if (!band->prec)
- return AVERROR(ENOMEM);
-
- for (cblkno = 0; cblkno < band->cblknx * band->cblkny; cblkno++){
- band->cblk[cblkno].zero = 0;
- }
-
- y0 = band->y0;
- y1 = (band->y0 + (1<<codsty->log2_prec_height))/(1<<codsty->log2_prec_height)*(1<<codsty->log2_prec_height) - band->y0;
- yi0 = 0;
- yi1 = ff_j2k_ceildiv(y1 - y0, 1<<codsty->log2_cblk_height) * (1<<codsty->log2_cblk_height);
- yi1 = FFMIN(yi1, band->cblkny);
- cblkperprech = 1<<(codsty->log2_prec_height - codsty->log2_cblk_height);
- for (precy = 0, precno = 0; precy < reslevel->num_precincts_y; precy++){
- for (precx = 0; precx < reslevel->num_precincts_x; precx++, precno++){
- band->prec[precno].yi0 = yi0;
- band->prec[precno].yi1 = yi1;
- }
- yi1 += cblkperprech;
- yi0 = yi1 - cblkperprech;
- yi1 = FFMIN(yi1, band->cblkny);
- }
- x0 = band->x0;
- x1 = (band->x0 + (1<<codsty->log2_prec_width))/(1<<codsty->log2_prec_width)*(1<<codsty->log2_prec_width) - band->x0;
- xi0 = 0;
- xi1 = ff_j2k_ceildiv(x1 - x0, 1<<codsty->log2_cblk_width) * (1<<codsty->log2_cblk_width);
- xi1 = FFMIN(xi1, band->cblknx);
- cblkperprecw = 1<<(codsty->log2_prec_width - codsty->log2_cblk_width);
- for (precx = 0, precno = 0; precx < reslevel->num_precincts_x; precx++){
- for (precy = 0; precy < reslevel->num_precincts_y; precy++, precno = 0){
- J2kPrec *prec = band->prec + precno;
-
- prec->xi0 = xi0;
- prec->xi1 = xi1;
-
- prec->cblkincl = ff_j2k_tag_tree_init(prec->xi1 - prec->xi0,
- prec->yi1 - prec->yi0);
- prec->zerobits = ff_j2k_tag_tree_init(prec->xi1 - prec->xi0,
- prec->yi1 - prec->yi0);
- }
- xi1 += cblkperprecw;
- xi0 = xi1 - cblkperprecw;
- xi1 = FFMIN(xi1, band->cblknx);
- }
- }
- }
}
}
for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++){
@@ -949,8 +835,10 @@ static int encode_frame(AVCodecContext *
codsty->nreslevels = 7;
codsty->log2_cblk_width = 4;
codsty->log2_cblk_height = 4;
+ codsty->transform = 1;
qntsty->nguardbits = 1;
+ qntsty->quantsty = J2K_QSTY_NONE;
s->tile_width = 256;
s->tile_height = 256;
More information about the FFmpeg-soc
mailing list