46 for(k = 0; (state->
N[Q] << k) < state->
A[Q]; k++);
48 map = !state->
near && !k && (2 * state->
B[Q] <= -state->
N[Q]);
52 if(err >= ((state->
range + 1) >> 1)) {
54 val = 2 *
FFABS(err) - 1 - map;
74 temp += state->
N[Q] >> 1;
75 for(k = 0; (state->
N[Q] << k) < temp; k++);
77 if(!k && err && (2 * state->
B[Q] < state->
N[Q]))
81 val = - (2 * err) - 1 - RItype + map;
83 val = 2 * err - RItype - map;
88 state->
A[Q] += (val + 1 - RItype) >> 1;
125 Ra = x ?
R(cur, x - stride) :
R(last, x);
127 Rc = x ?
R(last, x - stride) : last2;
128 Rd = (x >= w -
stride) ?
R(last, x) :
R(last, x + stride);
135 int RUNval, RItype,
run;
139 while(x < w && (
FFABS(
R(cur, x) - RUNval) <= state->
near)){
148 RItype = (
FFABS(Ra - Rb) <= state->
near);
149 pred = RItype ? Ra : Rb;
150 err =
R(cur, x) -
pred;
152 if(!RItype && Ra > Rb)
161 if(RItype || (Rb >= Ra))
169 if(err >= ((state->
range + 1) >> 1))
180 pred =
mid_pred(Ra, Ra + Rb - Rc, Rb);
185 pred = av_clip(pred - state->
C[context], 0, state->
maxval);
186 err = pred -
R(cur, x);
189 pred = av_clip(pred + state->
C[context], 0, state->
maxval);
190 err =
R(cur, x) -
pred;
217 if(state->
T1 == state2.
T1 && state->
T2 == state2.
T2 && state->
T3 == state2.
T3 && state->
reset == state2.
reset)
231 const AVFrame *pict,
int *got_packet)
269 for(i = 1; i <= comps; i++) {
278 for(i = 1; i <= comps; i++) {
283 put_bits(&pb, 8, (comps > 1) ? 1 : 0);
305 for(i = 0; i < avctx->
height; i++) {
314 for(i = 0; i < avctx->
height; i++) {
316 t = *((uint16_t*)last);
322 int Rc[3] = {0, 0, 0};
324 width = avctx->
width * 3;
325 for(i = 0; i < avctx->
height; i++) {
326 for(j = 0; j < 3; j++) {
327 ls_encode_line(state, &pb2, last + j, cur + j, Rc[j], width, 3, j, 8);
335 int Rc[3] = {0, 0, 0};
337 width = avctx->
width * 3;
338 for(i = 0; i < avctx->
height; i++) {
339 for(j = 2; j >= 0; j--) {
340 ls_encode_line(state, &pb2, last + j, cur + j, Rc[j], width, 3, j, 8);