diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-07-03 15:20:37 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-07-03 15:20:37 +0200 |
commit | 11cf4b72475f70a35d78b04e3b21d295c2da8a1d (patch) | |
tree | faf09b9f98d831beab3df7ee9bdc10279502d0fa | |
parent | c7a092cb2d573535dbc26e93a1664f3db39df47c (diff) | |
parent | f9581f1414ec8e3e7d0868793cda4f2e4fa113ea (diff) | |
download | android_external_ffmpeg-11cf4b72475f70a35d78b04e3b21d295c2da8a1d.tar.gz android_external_ffmpeg-11cf4b72475f70a35d78b04e3b21d295c2da8a1d.tar.bz2 android_external_ffmpeg-11cf4b72475f70a35d78b04e3b21d295c2da8a1d.zip |
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>
-rw-r--r-- | libavcodec/jpeg2000.c | 20 | ||||
-rw-r--r-- | libavcodec/jpeg2000dec.c | 7 |
2 files changed, 13 insertions, 14 deletions
diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c index 1ab5eb842c..37d7a653db 100644 --- a/libavcodec/jpeg2000.c +++ b/libavcodec/jpeg2000.c @@ -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; diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c index 8b19f8b41e..f45e609c20 100644 --- a/libavcodec/jpeg2000dec.c +++ b/libavcodec/jpeg2000dec.c @@ -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 }, }; |