mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2024-11-24 12:09:55 +00:00
libavcodec/jpeg2000dec.c Fixed WRITE_FRAME and tile co-ordinates:
libopenjpeg2000 uses ceiling division while dividing tile co-ordinates with the sample separation. Also, corrections were made to the WRITE_FRAME macro. Improves: p1_01.j2k and p1_07.j2k Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
2760de16bc
commit
42fdf402a7
@ -978,12 +978,11 @@ static int init_tile(Jpeg2000DecoderContext *s, int tileno)
|
||||
comp->coord_o[0][1] = tile->coord[0][1];
|
||||
comp->coord_o[1][0] = tile->coord[1][0];
|
||||
comp->coord_o[1][1] = tile->coord[1][1];
|
||||
if (compno) {
|
||||
comp->coord_o[0][0] /= s->cdx[compno];
|
||||
comp->coord_o[0][1] /= s->cdx[compno];
|
||||
comp->coord_o[1][0] /= s->cdy[compno];
|
||||
comp->coord_o[1][1] /= s->cdy[compno];
|
||||
}
|
||||
|
||||
comp->coord_o[0][0] = ff_jpeg2000_ceildiv(comp->coord_o[0][0], s->cdx[compno]);
|
||||
comp->coord_o[0][1] = ff_jpeg2000_ceildiv(comp->coord_o[0][1], s->cdx[compno]);
|
||||
comp->coord_o[1][0] = ff_jpeg2000_ceildiv(comp->coord_o[1][0], s->cdy[compno]);
|
||||
comp->coord_o[1][1] = ff_jpeg2000_ceildiv(comp->coord_o[1][1], s->cdy[compno]);
|
||||
|
||||
comp->coord[0][0] = ff_jpeg2000_ceildivpow2(comp->coord_o[0][0], s->reduction_factor);
|
||||
comp->coord[0][1] = ff_jpeg2000_ceildivpow2(comp->coord_o[0][1], s->reduction_factor);
|
||||
@ -1936,18 +1935,23 @@ static inline void tile_codeblocks(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile
|
||||
float *datap = comp->f_data; \
|
||||
int32_t *i_datap = comp->i_data; \
|
||||
int cbps = s->cbps[compno]; \
|
||||
int w = tile->comp[compno].coord[0][1] - s->image_offset_x; \
|
||||
int w = tile->comp[compno].coord[0][1] - \
|
||||
ff_jpeg2000_ceildiv(s->image_offset_x, s->cdx[compno]); \
|
||||
int h = tile->comp[compno].coord[1][1] - \
|
||||
ff_jpeg2000_ceildiv(s->image_offset_y, s->cdy[compno]); \
|
||||
int plane = 0; \
|
||||
\
|
||||
if (planar) \
|
||||
plane = s->cdef[compno] ? s->cdef[compno]-1 : (s->ncomponents-1); \
|
||||
\
|
||||
y = tile->comp[compno].coord[1][0] - s->image_offset_y / s->cdy[compno]; \
|
||||
y = tile->comp[compno].coord[1][0] - \
|
||||
ff_jpeg2000_ceildiv(s->image_offset_y, s->cdy[compno]); \
|
||||
line = (PIXEL *)picture->data[plane] + y * (picture->linesize[plane] / sizeof(PIXEL));\
|
||||
for (; y < tile->comp[compno].coord[1][1] - s->image_offset_y; y++) { \
|
||||
for (; y < h; y++) { \
|
||||
PIXEL *dst; \
|
||||
\
|
||||
x = tile->comp[compno].coord[0][0] - s->image_offset_x / s->cdx[compno]; \
|
||||
x = tile->comp[compno].coord[0][0] - \
|
||||
ff_jpeg2000_ceildiv(s->image_offset_x, s->cdx[compno]); \
|
||||
dst = line + x * pixelsize + compno*!planar; \
|
||||
\
|
||||
if (codsty->transform == FF_DWT97) { \
|
||||
|
Loading…
Reference in New Issue
Block a user