Logo Search packages:      
Sourcecode: ffmpeg-debian version File versions

static void shift_codebook ( elbg_data elbg,
int *  indexes,
int *  newcentroid[3] 
) [static]

Add the points in the low utility cell to its closest cell. Split the high utility cell, putting the separed points in the (now empty) low utility cell.

elbg Internal elbg data
indexes {luc, huc, cluc}
newcentroid A vector with the position of the new centroids

Definition at line 191 of file elbg.c.

References elbg_data::cells, elbg_data::dim, cell_s::index, cell_s::next, and elbg_data::points.

Referenced by try_shift_candidate().

    cell *tempdata;
    cell **pp = &elbg->cells[indexes[2]];

        pp= &(*pp)->next;

    *pp = elbg->cells[indexes[0]];

    elbg->cells[indexes[0]] = NULL;
    tempdata = elbg->cells[indexes[1]];
    elbg->cells[indexes[1]] = NULL;

    while(tempdata) {
        cell *tempcell2 = tempdata->next;
        int idx = distance_limited(elbg->points + tempdata->index*elbg->dim,
                           newcentroid[0], elbg->dim, INT_MAX) >
                  distance_limited(elbg->points + tempdata->index*elbg->dim,
                           newcentroid[1], elbg->dim, INT_MAX);

        tempdata->next = elbg->cells[indexes[idx]];
        elbg->cells[indexes[idx]] = tempdata;
        tempdata = tempcell2;

Generated by  Doxygen 1.6.0   Back to index