diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-05-16 09:46:19 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-05-16 09:46:19 +0200 |
commit | 39354d608933fe37a5ec86de4c691bcb46df0dac (patch) | |
tree | d503a0a3bf2da5e070d456c1b683bfaf5b92aed8 /libavcodec/jpegls.c | |
parent | 0d83b5722e2875cd4a2ac3574af72b5be633c73d (diff) | |
parent | ff4fc5ef12a37716c5c5d8928a2db92428e916ec (diff) | |
download | ffmpeg-39354d608933fe37a5ec86de4c691bcb46df0dac.tar.gz |
Merge commit 'ff4fc5ef12a37716c5c5d8928a2db92428e916ec'
* commit 'ff4fc5ef12a37716c5c5d8928a2db92428e916ec':
jpegls: K&R formatting cosmetics
Conflicts:
libavcodec/jpegls.c
libavcodec/jpegls.h
libavcodec/jpeglsdec.c
libavcodec/jpeglsenc.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/jpegls.c')
-rw-r--r-- | libavcodec/jpegls.c | 69 |
1 files changed, 41 insertions, 28 deletions
diff --git a/libavcodec/jpegls.c b/libavcodec/jpegls.c index e3e81c4497..216c486001 100644 --- a/libavcodec/jpegls.c +++ b/libavcodec/jpegls.c @@ -27,61 +27,74 @@ #include "jpegls.h" -void ff_jpegls_init_state(JLSState *state){ +void ff_jpegls_init_state(JLSState *state) +{ int i; state->twonear = state->near * 2 + 1; state->range = (state->maxval + state->twonear - 1) / state->twonear + 1; // QBPP = ceil(log2(RANGE)) - for(state->qbpp = 0; (1 << state->qbpp) < state->range; state->qbpp++); + for (state->qbpp = 0; (1 << state->qbpp) < state->range; state->qbpp++) + ; state->bpp = FFMAX(av_log2(state->maxval) + 1, 2); state->limit = 2*(state->bpp + FFMAX(state->bpp, 8)) - state->qbpp; - for(i = 0; i < 367; i++) { + for (i = 0; i < 367; i++) { state->A[i] = FFMAX(state->range + 32 >> 6, 2); state->N[i] = 1; } - } /** * Custom value clipping function used in T1, T2, T3 calculation */ -static inline int iso_clip(int v, int vmin, int vmax){ - if(v > vmax || v < vmin) return vmin; - else return v; +static inline int iso_clip(int v, int vmin, int vmax) +{ + if (v > vmax || v < vmin) + return vmin; + else + return v; } -void ff_jpegls_reset_coding_parameters(JLSState *s, int reset_all){ - const int basic_t1= 3; - const int basic_t2= 7; - const int basic_t3= 21; +void ff_jpegls_reset_coding_parameters(JLSState *s, int reset_all) +{ + const int basic_t1 = 3; + const int basic_t2 = 7; + const int basic_t3 = 21; int factor; - if(s->maxval==0 || reset_all) s->maxval= (1 << s->bpp) - 1; + if (s->maxval == 0 || reset_all) + s->maxval = (1 << s->bpp) - 1; - if(s->maxval >=128){ + if (s->maxval >= 128) { factor = FFMIN(s->maxval, 4095) + 128 >> 8; - if(s->T1==0 || reset_all) - s->T1= iso_clip(factor*(basic_t1-2) + 2 + 3*s->near, s->near+1, s->maxval); - if(s->T2==0 || reset_all) - s->T2= iso_clip(factor*(basic_t2-3) + 3 + 5*s->near, s->T1, s->maxval); - if(s->T3==0 || reset_all) - s->T3= iso_clip(factor*(basic_t3-4) + 4 + 7*s->near, s->T2, s->maxval); - }else{ - factor= 256 / (s->maxval + 1); + if (s->T1 == 0 || reset_all) + s->T1 = iso_clip(factor * (basic_t1 - 2) + 2 + 3 * s->near, + s->near + 1, s->maxval); + if (s->T2 == 0 || reset_all) + s->T2 = iso_clip(factor * (basic_t2 - 3) + 3 + 5 * s->near, + s->T1, s->maxval); + if (s->T3 == 0 || reset_all) + s->T3 = iso_clip(factor * (basic_t3 - 4) + 4 + 7 * s->near, + s->T2, s->maxval); + } else { + factor = 256 / (s->maxval + 1); - if(s->T1==0 || reset_all) - s->T1= iso_clip(FFMAX(2, basic_t1/factor + 3*s->near), s->near+1, s->maxval); - if(s->T2==0 || reset_all) - s->T2= iso_clip(FFMAX(3, basic_t2/factor + 5*s->near), s->T1, s->maxval); - if(s->T3==0 || reset_all) - s->T3= iso_clip(FFMAX(4, basic_t3/factor + 7*s->near), s->T2, s->maxval); + if (s->T1 == 0 || reset_all) + s->T1 = iso_clip(FFMAX(2, basic_t1 / factor + 3 * s->near), + s->near + 1, s->maxval); + if (s->T2 == 0 || reset_all) + s->T2 = iso_clip(FFMAX(3, basic_t2 / factor + 5 * s->near), + s->T1, s->maxval); + if (s->T3 == 0 || reset_all) + s->T3 = iso_clip(FFMAX(4, basic_t3 / factor + 7 * s->near), + s->T2, s->maxval); } - if(s->reset==0 || reset_all) s->reset= 64; + if (s->reset == 0 || reset_all) + s->reset = 64; av_dlog(NULL, "[JPEG-LS RESET] T=%i,%i,%i\n", s->T1, s->T2, s->T3); } |