53 thr = ((thr >> 1) + 4 * m->
cum_prob[0]) / thr;
55 return FFMIN(thr, 0x3FFF);
114 for (i = val - 1; i >= 0; i--)
135 for (i = 0; i < 15; i++)
136 for (j = 0; j < 4; j++)
141 int full_model_syms,
int special_initial_cache)
152 for (i = 0, idx = 0; i < 4; i++)
154 for (k = 0; k < 4; k++)
160 uint8_t *ngb,
int num_ngb,
int any_ngb)
165 if (val < pctx->num_syms) {
171 for (j = 0; j < num_ngb; j++)
172 if (pctx->
cache[i] == ngb[j])
186 if (pctx->
cache[i] == pix)
191 for (i = val; i > 0; i--)
193 pctx->
cache[0] = pix;
211 memset(neighbours, src[-1], 4);
213 neighbours[
TOP] = src[-stride];
217 neighbours[
TOP_LEFT] = src[-stride - 1];
218 neighbours[
LEFT] = src[-1];
221 neighbours[
TOP_RIGHT] = src[-stride + 1];
227 if (x >= 2 && src[-2] == neighbours[
LEFT])
229 if (y >= 2 && src[-2 * stride] == neighbours[
TOP])
233 ref_pix[0] = neighbours[0];
234 for (i = 1; i < 4; i++) {
235 for (j = 0; j < nlen; j++)
236 if (ref_pix[j] == neighbours[i])
239 ref_pix[nlen++] = neighbours[i];
247 if (neighbours[TOP] == neighbours[
TOP_LEFT]) {
248 if (neighbours[
TOP_RIGHT] == neighbours[TOP_LEFT])
250 else if (neighbours[LEFT] == neighbours[TOP_LEFT])
254 }
else if (neighbours[
TOP_RIGHT] == neighbours[TOP_LEFT]) {
255 if (neighbours[LEFT] == neighbours[TOP_LEFT])
259 }
else if (neighbours[LEFT] == neighbours[TOP_LEFT]) {
266 if (neighbours[TOP] == neighbours[TOP_LEFT])
268 else if (neighbours[
TOP_RIGHT] == neighbours[TOP_LEFT])
270 else if (neighbours[LEFT] == neighbours[TOP_LEFT])
272 else if (neighbours[
TOP_RIGHT] == neighbours[TOP])
274 else if (neighbours[TOP] == neighbours[LEFT])
294 int rgb_stride,
PixContext *pctx,
const uint32_t *pal)
297 uint8_t *rgb_dst = rgb_pic + x * 3 + y * rgb_stride;
299 dst += x + y * stride;
301 for (j = 0; j <
height; j++) {
302 for (i = 0; i <
width; i++) {
307 i, j, width - i - 1);
311 AV_WB24(rgb_dst + i * 3, pal[p]);
314 rgb_dst += rgb_stride;
326 for (j = y; j < y +
height; j++) {
358 for (j = 0; j <
height; j++) {
359 memmove(dst, src, width);
360 memmove(rgb_dst, rgb_src, width * 3);
372 int mask_stride,
int x,
int y,
379 dst += x + y * stride;
380 mask += x + y * mask_stride;
382 for (j = 0; j <
height; j++) {
383 for (i = 0; i <
width; i++) {
385 ( c->
rgb_pic && mask[i] != 0x01 && mask[i] != 0x02 && mask[i] != 0x04 ||
386 !c->
rgb_pic && mask[i] != 0x80 && mask[i] != 0xFF))
389 if (mask[i] == 0x02) {
391 }
else if (mask[i] == 0x04) {
394 }
else if (mask[i] != 0x80) {
399 i, j, width - i - 1);
414 int version,
int full_model_syms)
425 full_model_syms, version ? 1 : 0);
447 if ((base + 1) / 2 - 2 <= 0)
450 val = acoder->
get_number(acoder, (base + 1) / 2 - 2) + 3;
453 if ((
unsigned)val >= base)
456 return inv ? base - val :
val;
468 int i, j, pix, rgb_pix;
475 rgb_pix = c->
pal[pix];
476 for (i = 0; i <
height; i++, dst += stride, rgb_dst += rgb_stride) {
477 memset(dst, pix, width);
479 for (j = 0; j < width * 3; j += 3)
503 ( c->
rgb_pic && mode != 0x01 && mode != 0x02 && mode != 0x04 ||
504 !c->
rgb_pic && mode != 0x80 && mode != 0xFF))
509 else if (mode == 0x04)
511 else if (mode != 0x80)
578 "Insufficient extradata size: expected %"PRIu32
" got %d\n",
601 "Header version doesn't match codec tag\n");
608 "Incorrect number of changeable palette entries: %d\n",
632 "Insufficient extradata size %d for v2\n",
643 "Incorrect number of used colours %d\n",
654 for (i = 0; i < 256; i++)
656 (version ? 8 : 0) + i * 3);