From 351996d9f0390ef44412fa678bc7a073a94e23e5 Mon Sep 17 00:00:00 2001
From: AlexeyAB <alexeyab84@gmail.com>
Date: Thu, 16 Mar 2017 18:49:36 +0000
Subject: [PATCH] Fixed memory leak in DLL, added load_image() & free_image(), added read_names_from_file()
---
src/im2col.c | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/src/im2col.c b/src/im2col.c
index 6970c55..69ec98a 100644
--- a/src/im2col.c
+++ b/src/im2col.c
@@ -1,6 +1,6 @@
#include "im2col.h"
#include <stdio.h>
-inline float im2col_get_pixel(float *im, int height, int width, int channels,
+float im2col_get_pixel(float *im, int height, int width, int channels,
int row, int col, int channel, int pad)
{
row -= pad;
@@ -18,13 +18,9 @@
int ksize, int stride, int pad, float* data_col)
{
int c,h,w;
- int height_col = (height - ksize) / stride + 1;
- int width_col = (width - ksize) / stride + 1;
- if (pad){
- height_col = 1 + (height-1) / stride;
- width_col = 1 + (width-1) / stride;
- pad = ksize/2;
- }
+ int height_col = (height + 2*pad - ksize) / stride + 1;
+ int width_col = (width + 2*pad - ksize) / stride + 1;
+
int channels_col = channels * ksize * ksize;
for (c = 0; c < channels_col; ++c) {
int w_offset = c % ksize;
--
Gitblit v1.10.0