gauss_pyramid.c
Go to the documentation of this file.
00001 #include "gauss_pyramid.h"
00002 
00009 static void
00010 filter_horiz_transpose_8u_C1R(const uint8_t* src, int src_stride, int src_width,
00011         int src_height, uint8_t* dest, int dst_stride)
00012 {
00013     int dst_max_row = src_width/2 - 1;
00014     int dst_col;
00015 
00016     for(dst_col=0; dst_col<src_height; dst_col++) {
00017         const uint8_t* s = &src[dst_col * src_stride];
00018         uint16_t sum = 0;
00019         int dst_row;
00020 
00021         // left border
00022         sum = s[0] + 4 * s[1] + 3 * s[2];
00023         dest[dst_col] = sum >> 3;
00024 
00025         // middle
00026         for(dst_row=1; dst_row<dst_max_row; dst_row++) {
00027             sum = s[0] + 4 * s[1] + 6 * s[2] + 4 * s[3] + s[4];
00028             dest[dst_row * dst_stride + dst_col] = sum / 16;
00029             s+=2;
00030         }
00031 
00032         // right border
00033         if(src_width & 0x1) {
00034             sum = 3 * s[0] + 4 * s[1] + s[2];
00035             dest[dst_max_row * dst_stride + dst_col] = sum >> 3;
00036         } else {
00037             sum = s[0] + 4 * s[1] + 7 * s[2] + 4 * s[3];
00038             dest[dst_max_row * dst_stride + dst_col] = sum >> 4;
00039         }
00040     }
00041 }
00042 
00043 int 
00044 gauss_pyr_down_get_buf_size_8u_C1R(int width, int height)
00045 {
00046     return width * height / 2;
00047 }
00048 
00049 int
00050 gauss_pyr_down_8u_C1R(const uint8_t* src, int src_stride, int width,
00051         int height, uint8_t* dest, int dst_stride, uint8_t* buf)
00052 {
00053     filter_horiz_transpose_8u_C1R(src, src_stride, width, height, buf, height);
00054     filter_horiz_transpose_8u_C1R(buf, height, height, width/2, dest, dst_stride);
00055     return 0;
00056 }


libfovis
Author(s): Albert Huang, Maurice Fallon
autogenerated on Thu Jun 6 2019 20:16:12