コード例 #1
0
ファイル: colorbuckets.hpp プロジェクト: uxn/FLIF
    void save(const ColorRanges *srcRanges, RacOut<IO> &rac) const {
        SimpleSymbolCoder<FLIFBitChanceMeta, RacOut<IO>, 24> coder(rac);

//        printf("Saving Y Color Bucket: ");
        prevPlanes pixelL, pixelU;
        save_bucket(cb->bucket0, coder, srcRanges, 0, pixelL, pixelU);
//        printf("\nSaving I Color Buckets\n  ");
        pixelL.push_back(cb->min0);
        pixelU.push_back(cb->min0+CB0a-1);
        for (auto b : cb->bucket1) { save_bucket(b, coder, srcRanges, 1, pixelL, pixelU); pixelL[0] += CB0a; pixelU[0] += CB0a; }
//        printf("\nSaving Q Color Buckets\n  ");
        pixelL[0] = cb->min0;
        pixelU[0] = cb->min0+CB0b-1;
        pixelL.push_back(cb->min1);
        pixelU.push_back(cb->min1+CB1-1);
        for (auto bv : cb->bucket2) {
                pixelL[1] = cb->min1;
                pixelU[1] = cb->min1+CB1-1;
                for (auto b : bv) {
                        save_bucket(b, coder, srcRanges, 2, pixelL, pixelU);
                        pixelL[1] += CB1; pixelU[1] += CB1;
                }
                pixelL[0] += CB0b; pixelU[0] += CB0b;
        }
//        printf("\n");
        if (srcRanges->numPlanes() > 3) {
//          printf("Saving Alpha Color Bucket: ");
          save_bucket(cb->bucket3, coder, srcRanges, 3, pixelL, pixelU);
//          printf("\n");
        }
    }
コード例 #2
0
ファイル: rb.c プロジェクト: ishiikurisu/OA
int main(int argc, char** argv)
{
    bucketmap* bucket = new_bucket(10, dumb, NULL);
    char* line  = read();

    bucket = bucketify_file(argv[1], bucket, ':');
    for ( ; ; )
    {
        if (compare(line, GET_OPTION) == EQUAL)
            line = get_option(bucket);
        else if (compare(line, ADD_OPTION) == EQUAL)
            line = add_option(bucket);
        else if (compare(line, DEL_OPTION) == EQUAL)
            line = del_option(bucket);
        else if (compare(line, QUIT_OPTION) == EQUAL)
            break;
        else
            line = NULL;

        if (line)
            printf("%s\n", line);
        else
            printf("...\n");

        line = read();
    }

    save_bucket(bucket, "new_index.txt");
    return 0;
}