* 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>tags/n2.0
| @@ -316,7 +316,7 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp, | |||||
| break; | break; | ||||
| } | } | ||||
| /* FIXME: In openjepg code stespize = stepsize * 0.5. Why? | /* 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)) | if (!av_codec_is_encoder(avctx->codec)) | ||||
| band->f_stepsize *= 0.5; | band->f_stepsize *= 0.5; | ||||
| @@ -451,14 +451,18 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp, | |||||
| /* Compute Cy1 */ | /* Compute Cy1 */ | ||||
| cblk->coord[1][1] = FFMIN(Cy0 + (1 << band->log2_cblk_height), | cblk->coord[1][1] = FFMIN(Cy0 + (1 << band->log2_cblk_height), | ||||
| prec->coord[1][1]); | 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; | cblk->zero = 0; | ||||
| @@ -86,7 +86,6 @@ typedef struct Jpeg2000DecoderContext { | |||||
| Jpeg2000Tile *tile; | Jpeg2000Tile *tile; | ||||
| /*options parameters*/ | /*options parameters*/ | ||||
| int lowres; | |||||
| int reduction_factor; | int reduction_factor; | ||||
| } Jpeg2000DecoderContext; | } Jpeg2000DecoderContext; | ||||
| @@ -1121,7 +1120,6 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile, | |||||
| cblk->coord[1][1] - cblk->coord[1][0], | cblk->coord[1][1] - cblk->coord[1][0], | ||||
| bandpos); | bandpos); | ||||
| /* Manage band offsets */ | |||||
| x = cblk->coord[0][0]; | x = cblk->coord[0][0]; | ||||
| y = cblk->coord[1][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); | bytestream2_init(&s->g, avpkt->data, avpkt->size); | ||||
| s->curtileno = -1; | 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) { | if (bytestream2_get_bytes_left(&s->g) < 2) { | ||||
| ret = AVERROR_INVALIDDATA; | ret = AVERROR_INVALIDDATA; | ||||
| goto end; | goto end; | ||||
| @@ -1463,7 +1458,7 @@ static void jpeg2000_init_static_data(AVCodec *codec) | |||||
| static const AVOption options[] = { | static const AVOption options[] = { | ||||
| { "lowres", "Lower the decoding resolution by a power of two", | { "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 }, | { NULL }, | ||||
| }; | }; | ||||