From c453d1daa65744d8f63e57b48b4c369241cf6f25 Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期四, 19 十二月 2019 17:03:20 +0800 Subject: [PATCH] update --- gohumantrack/gohumantrack.go | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gohumantrack/gohumantrack.go b/gohumantrack/gohumantrack.go index d9a18a7..7b11574 100644 --- a/gohumantrack/gohumantrack.go +++ b/gohumantrack/gohumantrack.go @@ -31,6 +31,7 @@ } int fill_images(void *imgs, const int size, const int index, void *data, const int w, const int h, const int c){ + if (!data) data = (unsigned char*)malloc(w*h*c); c_img *images = (c_img*)imgs; images[index].data_ = (unsigned char*)data; images[index].w_ = w; @@ -190,24 +191,23 @@ } defer C.free(cImgs) - var freeFakeImage []unsafe.Pointer + // var freeFakeImage []unsafe.Pointer for k, v := range imgs { - logo.Infoln("batch~~~~~~", k, " image: ", v, " size: ", wid, "x", hei, "x", chn) if v == nil { - fake := C.create_fake_image(C.int(wid * hei * chn)) - freeFakeImage = append(freeFakeImage, fake) - C.fill_images(cImgs, C.int(h.batchSize), C.int(k), fake, C.int(wid), C.int(hei), C.int(chn)) + // fake := C.create_fake_image(C.int(wid * hei * chn)) + // freeFakeImage = append(freeFakeImage, fake) + C.fill_images(cImgs, C.int(h.batchSize), C.int(k), nil, C.int(wid), C.int(hei), C.int(chn)) } else { logo.Infoln("batch~~~~~~ real image len: ", len(v.Data), " size: ", v.Width, "x", v.Height, "x", v.Channel) C.fill_images(cImgs, C.int(h.batchSize), C.int(k), unsafe.Pointer(&v.Data[0]), C.int(v.Width), C.int(v.Height), C.int(v.Channel)) } } - defer func(f []unsafe.Pointer) { - for _, v := range f { - C.free(v) - } - }(freeFakeImage) + // defer func(f []unsafe.Pointer) { + // for _, v := range f { + // C.free(v) + // } + // }(freeFakeImage) cRet := C.process(h.handle, cImgs, C.int(h.batchSize), h.result) if cRet != 0 { -- Gitblit v1.8.0