Lines Matching refs:rice
162 APERice riceX; ///< rice code parameters for the second channel
163 APERice riceY; ///< rice code parameters for the first channel
456 static inline void update_rice(APERice *rice, unsigned int x)
458 int lim = rice->k ? (1 << (rice->k + 4)) : 0;
459 rice->ksum += ((x + 1) / 2) - ((rice->ksum + 16) >> 5);
461 if (rice->ksum < lim)
462 rice->k--;
463 else if (rice->ksum >= (1 << (rice->k + 5)))
464 rice->k++;
480 APERice *rice)
489 rice->k += 4;
493 if (!rice->k)
495 else if(rice->k <= MIN_CACHE_BITS) {
496 x = (overflow << rice->k) + get_bits(gb, rice->k);
498 av_log(ctx->avctx, AV_LOG_ERROR, "Too many bits: %d\n", rice->k);
501 rice->ksum += x - (rice->ksum + 8 >> 4);
502 if (rice->ksum < (rice->k ? 1 << (rice->k + 4) : 0))
503 rice->k--;
504 else if (rice->ksum >= (1 << (rice->k + 5)) && rice->k < 24)
505 rice->k++;
514 static inline int ape_decode_value_3900(APEContext *ctx, APERice *rice)
525 tmpk = (rice->k < 1) ? 0 : rice->k - 1;
542 update_rice(rice, x);
551 static inline int ape_decode_value_3990(APEContext *ctx, APERice *rice)
556 pivot = rice->ksum >> 5;
588 update_rice(rice, x);
598 int32_t *out, APERice *rice, int blockstodecode)
603 rice->ksum = 0;
606 rice->ksum += out[i];
608 rice->k = av_log2(rice->ksum / 10) + 1;
609 if (rice->k >= 24)
612 out[i] = get_rice_ook(&ctx->gb, rice->k);
613 rice->ksum += out[i];
614 rice->k = av_log2(rice->ksum / ((i + 1) * 2)) + 1;
615 if (rice->k >= 24)
618 ksummax = 1 << rice->k + 7;
619 ksummin = rice->k ? (1 << rice->k + 6) : 0;
621 out[i] = get_rice_ook(&ctx->gb, rice->k);
622 rice->ksum += out[i] - out[i - 64];
623 while (rice->ksum < ksummin) {
624 rice->k--;
625 ksummin = rice->k ? ksummin >> 1 : 0;
628 while (rice->ksum >= ksummax) {
629 rice->k++;
630 if (rice->k > 24)
754 /* Initialize the rice structs */