Changeset 4696


Ignore:
Timestamp:
Oct 17, 2010 2:57:27 AM (4 years ago)
Author:
sam
Message:

Implement bicubic resampling. Lacks some blurring in the pre-pass, maybe.

Location:
libpipi/trunk
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • libpipi/trunk/genethumb/genethumb.c

    r2902 r4696  
    9696    } 
    9797 
    98     dst = pipi_resize(src, w, h); 
     98    dst = pipi_resize_bicubic(src, w, h); 
    9999    if(bpp == 16) 
    100100        pipi_dither_24to16(dst); 
  • libpipi/trunk/pipi-php/php_pipi.c

    r3342 r4696  
    3838        PHP_FE(pipi_measure_msd, NULL) 
    3939        PHP_FE(pipi_measure_rmsd, NULL) 
    40         PHP_FE(pipi_resize, NULL) 
     40        PHP_FE(pipi_resize_bicubic, NULL) 
     41        PHP_FE(pipi_resize_bresenham, NULL) 
    4142        PHP_FE(pipi_render_random, NULL) 
    4243        PHP_FE(pipi_render_bayer, NULL) 
     
    340341} 
    341342 
    342 PHP_FUNCTION(pipi_resize) { 
     343PHP_FUNCTION(pipi_resize_bicubic) { 
    343344        zval *_zval; 
    344345        long width, height = 0; 
     
    349350        ZEND_FETCH_RESOURCE(src, pipi_image_t*, &_zval, -1, PHP_PIPI_IMAGE_RES_NAME, le_pipi_image); 
    350351 
    351         result = pipi_resize(src, width, height); 
     352        result = pipi_resize_bicubic(src, width, height); 
     353        ZEND_REGISTER_RESOURCE(return_value, result, le_pipi_image); 
     354} 
     355 
     356PHP_FUNCTION(pipi_resize_bresenham) { 
     357        zval *_zval; 
     358        long width, height = 0; 
     359        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &_zval, &width, &height) == FAILURE) { 
     360                RETURN_FALSE; 
     361        } 
     362        pipi_image_t *src, *result; 
     363        ZEND_FETCH_RESOURCE(src, pipi_image_t*, &_zval, -1, PHP_PIPI_IMAGE_RES_NAME, le_pipi_image); 
     364 
     365        result = pipi_resize_bresenham(src, width, height); 
    352366        ZEND_REGISTER_RESOURCE(return_value, result, le_pipi_image); 
    353367} 
  • libpipi/trunk/pipi/Makefile.am

    r4690 r4696  
    5252 
    5353resample_sources = \ 
    54         resample/bresenham.c 
     54        resample/bresenham.c \ 
     55        resample/bicubic.c 
    5556 
    5657paint_sources = \ 
  • libpipi/trunk/pipi/codec/oric.c

    r3342 r4696  
    142142 
    143143    if(img->w != WIDTH || img->h != HEIGHT) 
    144         tmp = pipi_resize(img, WIDTH, HEIGHT); 
     144        tmp = pipi_resize_bicubic(img, WIDTH, HEIGHT); 
    145145    else 
    146146        tmp = img; 
  • libpipi/trunk/pipi/context.c

    r3547 r4696  
    296296        switch(cmd[0]) 
    297297        { 
    298             case 'g': dst = pipi_resize(src, w, h); break; 
     298            case 'g': dst = pipi_resize_bicubic(src, w, h); break; 
    299299            case 't': dst = pipi_tile(src, w, h); break; 
    300300        } 
     
    323323        if(w <= 0 || h <= 0) 
    324324            return -1; 
    325         dst = pipi_resize(src, w, h); 
     325        dst = pipi_resize_bicubic(src, w, h); 
    326326        if(dst == NULL) 
    327327            return -1; 
  • libpipi/trunk/pipi/pipi.h

    r4694 r4696  
    160160__extern double pipi_measure_rmsd(pipi_image_t *, pipi_image_t *); 
    161161 
    162 __extern pipi_image_t *pipi_resize(pipi_image_t *, int, int); 
     162__extern pipi_image_t *pipi_resize_bresenham(pipi_image_t *, int, int); 
     163__extern pipi_image_t *pipi_resize_bicubic(pipi_image_t *, int, int); 
    163164__extern pipi_image_t *pipi_crop(pipi_image_t *, int, int, int, int); 
    164165 
  • libpipi/trunk/pipi/resample/bresenham.c

    r4691 r4696  
    3232 * alpha should be the mean alpha value of the neightbouring pixels, but 
    3333 * the colour components should be weighted with the alpha value. */ 
    34 pipi_image_t *pipi_resize(pipi_image_t *src, int w, int h) 
     34pipi_image_t *pipi_resize_bresenham(pipi_image_t *src, int w, int h) 
    3535{ 
    3636    float *srcdata, *dstdata, *aline, *line; 
Note: See TracChangeset for help on using the changeset viewer.