mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Merge commit 'f9581f1414ec8e3e7d0868793cda4f2e4fa113ea'
* commit 'f9581f1414ec8e3e7d0868793cda4f2e4fa113ea': jpeg2000: Improve reduced resolution decoding jpeg2000: Compute quantization for 'scalar derived' in the correct case. jpeg2000: Calculate code-block coord in ff_jpeg2000_init_component() Conflicts: libavcodec/jpeg2000.c libavcodec/jpeg2000dec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
11cf4b7247
@ -316,7 +316,7 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp,
|
||||
break;
|
||||
}
|
||||
/* FIXME: In openjepg code stespize = stepsize * 0.5. Why?
|
||||
* If not set output of entropic decoder is not correct. */
|
||||
* If not set output of entropic decoder is not correct. */
|
||||
if (!av_codec_is_encoder(avctx->codec))
|
||||
band->f_stepsize *= 0.5;
|
||||
|
||||
@ -451,14 +451,18 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp,
|
||||
/* Compute Cy1 */
|
||||
cblk->coord[1][1] = FFMIN(Cy0 + (1 << band->log2_cblk_height),
|
||||
prec->coord[1][1]);
|
||||
|
||||
if((bandno + !!reslevelno) & 1) {
|
||||
cblk->coord[0][0] += comp->reslevel[reslevelno-1].coord[0][1] - comp->reslevel[reslevelno-1].coord[0][0];
|
||||
cblk->coord[0][1] += comp->reslevel[reslevelno-1].coord[0][1] - comp->reslevel[reslevelno-1].coord[0][0];
|
||||
/* Update code-blocks coordinates according sub-band position */
|
||||
if ((bandno + !!reslevelno) & 1) {
|
||||
cblk->coord[0][0] += comp->reslevel[reslevelno-1].coord[0][1] -
|
||||
comp->reslevel[reslevelno-1].coord[0][0];
|
||||
cblk->coord[0][1] += comp->reslevel[reslevelno-1].coord[0][1] -
|
||||
comp->reslevel[reslevelno-1].coord[0][0];
|
||||
}
|
||||
if((bandno + !!reslevelno) & 2) {
|
||||
cblk->coord[1][0] += comp->reslevel[reslevelno-1].coord[1][1] - comp->reslevel[reslevelno-1].coord[1][0];
|
||||
cblk->coord[1][1] += comp->reslevel[reslevelno-1].coord[1][1] - comp->reslevel[reslevelno-1].coord[1][0];
|
||||
if ((bandno + !!reslevelno) & 2) {
|
||||
cblk->coord[1][0] += comp->reslevel[reslevelno-1].coord[1][1] -
|
||||
comp->reslevel[reslevelno-1].coord[1][0];
|
||||
cblk->coord[1][1] += comp->reslevel[reslevelno-1].coord[1][1] -
|
||||
comp->reslevel[reslevelno-1].coord[1][0];
|
||||
}
|
||||
|
||||
cblk->zero = 0;
|
||||
|
@ -86,7 +86,6 @@ typedef struct Jpeg2000DecoderContext {
|
||||
Jpeg2000Tile *tile;
|
||||
|
||||
/*options parameters*/
|
||||
int lowres;
|
||||
int reduction_factor;
|
||||
} Jpeg2000DecoderContext;
|
||||
|
||||
@ -1121,7 +1120,6 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
|
||||
cblk->coord[1][1] - cblk->coord[1][0],
|
||||
bandpos);
|
||||
|
||||
/* Manage band offsets */
|
||||
x = cblk->coord[0][0];
|
||||
y = cblk->coord[1][0];
|
||||
|
||||
@ -1396,9 +1394,6 @@ static int jpeg2000_decode_frame(AVCodecContext *avctx, void *data,
|
||||
bytestream2_init(&s->g, avpkt->data, avpkt->size);
|
||||
s->curtileno = -1;
|
||||
|
||||
// reduction factor, i.e number of resolution levels to skip
|
||||
s->reduction_factor = s->lowres;
|
||||
|
||||
if (bytestream2_get_bytes_left(&s->g) < 2) {
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto end;
|
||||
@ -1463,7 +1458,7 @@ static void jpeg2000_init_static_data(AVCodec *codec)
|
||||
|
||||
static const AVOption options[] = {
|
||||
{ "lowres", "Lower the decoding resolution by a power of two",
|
||||
OFFSET(lowres), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, JPEG2000_MAX_RESLEVELS - 1, VD },
|
||||
OFFSET(reduction_factor), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, JPEG2000_MAX_RESLEVELS - 1, VD },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user