summaryrefslogtreecommitdiff
path: root/libavcodec/jpeg2000.c
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2015-09-11 05:26:35 +0200
committerLuca Barbato <lu_zero@gentoo.org>2015-09-14 14:48:59 +0200
commit95a41311ac3a44773cc4dc407408aca35b1f8e26 (patch)
tree76721374285c2f7dd9fab88826fa3a4e154085ea /libavcodec/jpeg2000.c
parent7fb93eae43cc89bd7c1c275344e1cdbadab7155b (diff)
jpeg2000: Factor out band stepsize initialization
Diffstat (limited to 'libavcodec/jpeg2000.c')
-rw-r--r--libavcodec/jpeg2000.c39
1 files changed, 25 insertions, 14 deletions
diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c
index a5ce8023b2..77cadd8603 100644
--- a/libavcodec/jpeg2000.c
+++ b/libavcodec/jpeg2000.c
@@ -195,21 +195,13 @@ void ff_jpeg2000_set_significance(Jpeg2000T1Context *t1, int x, int y,
static const uint8_t lut_gain[2][4] = { { 0, 0, 0, 0 }, { 0, 1, 1, 2 } };
-static int init_band(AVCodecContext *avctx,
- Jpeg2000ResLevel *reslevel,
- Jpeg2000Component *comp,
- Jpeg2000CodingStyle *codsty,
- Jpeg2000QuantStyle *qntsty,
- int bandno, int gbandno, int reslevelno,
- int cbps, int dx, int dy)
+static void init_band_stepsize(AVCodecContext *avctx,
+ Jpeg2000Band *band,
+ Jpeg2000CodingStyle *codsty,
+ Jpeg2000QuantStyle *qntsty,
+ int bandno, int gbandno, int reslevelno,
+ int cbps)
{
- Jpeg2000Band *band = reslevel->band + bandno;
- uint8_t log2_band_prec_width, log2_band_prec_height;
- int declvl = codsty->nreslevels - reslevelno; // N_L -r see ISO/IEC 15444-1:2002 B.5
- int cblkno, precno;
- int nb_precincts;
- int i, j;
-
/* TODO: Implementation of quantization step not finished,
* see ISO/IEC 15444-1:2002 E.1 and A.6.4. */
switch (qntsty->quantsty) {
@@ -250,6 +242,25 @@ static int init_band(AVCodecContext *avctx,
band->f_stepsize *= 0.5;
band->i_stepsize = band->f_stepsize * (1 << 16);
+}
+
+static int init_band(AVCodecContext *avctx,
+ Jpeg2000ResLevel *reslevel,
+ Jpeg2000Component *comp,
+ Jpeg2000CodingStyle *codsty,
+ Jpeg2000QuantStyle *qntsty,
+ int bandno, int gbandno, int reslevelno,
+ int cbps, int dx, int dy)
+{
+ Jpeg2000Band *band = reslevel->band + bandno;
+ uint8_t log2_band_prec_width, log2_band_prec_height;
+ int declvl = codsty->nreslevels - reslevelno; // N_L -r see ISO/IEC 15444-1:2002 B.5
+ int cblkno, precno;
+ int nb_precincts;
+ int i, j;
+
+ init_band_stepsize(avctx, band, codsty, qntsty, bandno, gbandno, reslevelno, cbps);
+
/* computation of tbx_0, tbx_1, tby_0, tby_1
* see ISO/IEC 15444-1:2002 B.5 eq. B-15 and tbl B.1