Changeset 2671


Ignore:
Timestamp:
Aug 4, 2008, 11:49:57 PM (14 years ago)
Author:
Sam Hocevar
Message:
  • random.c: implement random dithering using a deterministic pseudo-RNG.
Location:
libpipi/trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • libpipi/trunk/examples/dither.c

    r2666 r2671  
    1818        fprintf(stderr, "Usage: %s <src> <method> <dest>\n", argv[0]);
    1919        fprintf(stderr, "Where <method> is one of:\n");
    20         fprintf(stderr, "  1   Floyd-Steinberg (raster)\n");
    21         fprintf(stderr, "  2   Floyd-Steinberg (serpentine)\n");
    22         fprintf(stderr, "  3   Ostromoukhov (raster)\n");
    23         fprintf(stderr, "  4   Ostromoukhov (serpentine)\n");
    24         fprintf(stderr, "  5   Direct binary search\n");
     20        fprintf(stderr, "  1   random dithering\n");
     21        fprintf(stderr, "  2   Floyd-Steinberg (raster)\n");
     22        fprintf(stderr, "  3   Floyd-Steinberg (serpentine)\n");
     23        fprintf(stderr, "  4   Ostromoukhov (raster)\n");
     24        fprintf(stderr, "  5   Ostromoukhov (serpentine)\n");
     25        fprintf(stderr, "  6   Direct binary search\n");
    2526        return EXIT_FAILURE;
    2627    }
     
    3334    switch(atoi(argv[2]))
    3435    {
    35         case 6:
     36        case 7:
    3637            newimg = pipi_dither_dbs(img);
    3738            break;
    38         case 5:
     39        case 6:
    3940            newimg = pipi_dither_ostromoukhov(img, PIPI_SCAN_SERPENTINE);
    4041            break;
    41         case 4:
     42        case 5:
    4243            newimg = pipi_dither_ostromoukhov(img, PIPI_SCAN_RASTER);
    4344            break;
    44         case 3:
     45        case 4:
    4546            newimg = pipi_dither_floydsteinberg(img, PIPI_SCAN_SERPENTINE);
    4647            break;
     48        case 3:
     49            newimg = pipi_dither_floydsteinberg(img, PIPI_SCAN_RASTER);
     50            break;
    4751        case 2:
    48             newimg = pipi_dither_floydsteinberg(img, PIPI_SCAN_RASTER);
     52            newimg = pipi_dither_ordered(img);
    4953            break;
    5054        case 1:
    5155        default:
    52             newimg = pipi_dither_ordered(img);
     56            newimg = pipi_dither_random(img);
    5357            break;
    5458    }
  • libpipi/trunk/pipi/Makefile.am

    r2665 r2671  
    3535        dither/ostromoukhov.c \
    3636        dither/dbs.c \
     37        dither/random.c \
    3738        $(NULL)
    3839libpipi_la_CFLAGS = $(codec_cflags)
  • libpipi/trunk/pipi/pipi.h

    r2668 r2671  
    8585extern pipi_image_t *pipi_dither_floydsteinberg(pipi_image_t *, pipi_scan_t);
    8686extern pipi_image_t *pipi_dither_ordered(pipi_image_t *);
     87extern pipi_image_t *pipi_dither_random(pipi_image_t *);
    8788extern pipi_image_t *pipi_dither_ostromoukhov(pipi_image_t *, pipi_scan_t);
    8889extern pipi_image_t *pipi_dither_dbs(pipi_image_t *);
Note: See TracChangeset for help on using the changeset viewer.