コード例 #1
0
ファイル: lzhuf.c プロジェクト: Grumbel/rfactortools
static void update(int c)
{
    int i, j, k, l;

    if (freq[R] == MAX_FREQ) {
        reconst();
    }
    c = prnt[c + T];
    do {
        k = ++freq[c];

        /* if the order is disturbed, exchange nodes */
        if ((unsigned)k > freq[l = c + 1]) {
            while ((unsigned)k > freq[++l]);
            l--;
            freq[c] = freq[l];
            freq[l] = k;

            i = son[c];
            prnt[i] = l;
            if (i < T) prnt[i + 1] = l;

            j = son[l];
            son[l] = i;

            prnt[j] = c;
            if (j < T) prnt[j + 1] = c;
            son[c] = j;

            c = l;
        }
    } while ((c = prnt[c]) != 0); /* repeat up to root */
}
コード例 #2
0
ファイル: u_deep.c プロジェクト: agwatic/PUAE
INLINE void update(USHORT c){
	USHORT i, j, k, l;

	if (freq[R] == MAX_FREQ) {
		reconst();
	}
	c = prnt[c + T];
	do {
		k = ++freq[c];

		/* if the order is disturbed, exchange nodes */
		if (k > freq[l = (USHORT)(c + 1)]) {
			while (k > freq[++l]);
			l--;
			freq[c] = freq[l];
			freq[l] = k;

			i = son[c];
			prnt[i] = l;
			if (i < T) prnt[i + 1] = l;

			j = son[l];
			son[l] = i;

			prnt[j] = c;
			if (j < T) prnt[j + 1] = c;
			son[c] = j;

			c = l;
		}
	} while ((c = prnt[c]) != 0); /* repeat up to root */
}
コード例 #3
0
void td0dsk_t::update(int c)
{
    int i, j, k, l;

    if (freq[R] == MAX_FREQ) {
        reconst();
    }
    c = prnt[c + T];
    do {
        k = ++freq[c];

        /* swap nodes to keep the tree freq-ordered */
        if (k > freq[l = c + 1]) {
            while (k > freq[++l]);
            l--;
            freq[c] = freq[l];
            freq[l] = k;

            i = son[c];
            prnt[i] = l;
            if (i < T) prnt[i + 1] = l;

            j = son[l];
            son[l] = i;

            prnt[j] = c;
            if (j < T) prnt[j + 1] = c;
            son[c] = j;

            c = l;
        }
    } while ((c = prnt[c]) != 0);    /* do it until reaching the root */
}
コード例 #4
0
ファイル: RegionalMinImage.cpp プロジェクト: rentpath/qgar
void
RegionalMinImage::perform(GreyLevelImage * img)
{
  GreyLevelImage reconst(*img);
  DilatedImage::perform(img);
  GeodesicRecEroImage::perform(img, &reconst);
  *img -= reconst;
}
コード例 #5
0
void
RegionalMinBinaryImage::perform(BinaryImage * img)
{
  BinaryImage reconst(*img);
  DilatedBinaryImage::perform(img);
  GeodesicRecEroBinaryImage::perform(img, &reconst);
  *img -= reconst;
}
コード例 #6
0
ファイル: dhuf.c プロジェクト: ApolloniaUK/PUAE
/* ------------------------------------------------------------------------ */
static void
update_c(int p)
{
	int             q;

	if (freq[ROOT_C] == 0x8000) {
		reconst(0, n_max * 2 - 1);
	}
	freq[ROOT_C]++;
	q = s_node[p];
	do {
		q = swap_inc(q);
	} while (q != ROOT_C);
}
コード例 #7
0
ファイル: dhuf.c プロジェクト: ApolloniaUK/PUAE
/* ------------------------------------------------------------------------ */
static void
update_p(int p)
{
	int             q;

	if (total_p == 0x8000) {
		reconst(ROOT_P, most_p + 1);
		total_p = freq[ROOT_P];
		freq[ROOT_P] = 0xffff;
	}
	q = s_node[p + N_CHAR];
	while (q != ROOT_P) {
		q = swap_inc(q);
	}
	total_p++;
}