91 for (k = 0; (state->
N[Q] << k) < state->
A[Q]; k++)
102 ret = -(ret + 1 >> 1);
107 if (!state->
near && !k && (2 * state->
B[Q] <= -state->
N[Q]))
119 int RItype,
int limit_add)
122 int Q = 365 + RItype;
126 temp += state->
N[Q] >> 1;
128 for (k = 0; (state->
N[Q] << k) < temp; k++)
140 if (!k && (RItype || ret) && (2 * state->
B[Q] < state->
N[Q]))
145 ret = map - (ret + 1 >> 1);
152 state->
A[Q] +=
FFABS(ret) - RItype;
163 void *last,
void *dst,
int last2,
int w,
174 Ra = x ?
R(dst, x - stride) :
R(last, x);
176 Rc = x ?
R(last, x - stride) : last2;
177 Rd = (x >= w -
stride) ?
R(last, x) :
R(last, x + stride);
192 if (x + r * stride > w)
193 r = (w - x) / stride;
194 for (i = 0; i <
r; i++) {
210 if (x + r * stride > w) {
211 r = (w - x) / stride;
213 for (i = 0; i <
r; i++) {
220 RItype = (
FFABS(Ra - Rb) <= state->
near) ? 1 : 0;
226 if (state->
near && RItype) {
240 pred =
mid_pred(Ra, Ra + Rb - Rc, Rb);
250 pred = av_clip(pred - state->
C[context], 0, state->
maxval);
253 pred = av_clip(pred + state->
C[context], 0, state->
maxval);
261 if (pred < -state->near)
265 pred = av_clip(pred, 0, state->
maxval);
275 int point_transform,
int ilv)
299 shift = point_transform + (8 - s->
bits);
301 shift = point_transform + (16 - s->
bits);
305 "JPEG-LS params: %ix%i NEAR=%i MV=%i T(%i,%i,%i) "
306 "RESET=%i, LIMIT=%i, qbpp=%i, RANGE=%i\n",
308 state->
T1, state->
T2, state->
T3,
322 for (i = 0; i < s->
height; i++) {
328 t = *((uint16_t *)last);
338 }
else if (ilv == 1) {
340 int Rc[3] = { 0, 0, 0 };
344 for (i = 0; i < s->
height; i++) {
345 for (j = 0; j <
stride; j++) {
347 Rc[j],
width, stride, j, 8);
358 }
else if (ilv == 2) {
372 for (i = 0; i < s->
height; i++) {
373 for (x = off; x < w; x +=
stride)
381 for (x = 0; x < w; x++)