projects
/
cuda.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8697797
)
uint*_tをuint_fast*_tに変更
author
dev
<dev@fmaj7b5.info>
Sun, 25 Nov 2012 09:07:23 +0000
(18:07 +0900)
committer
dev
<dev@fmaj7b5.info>
Sun, 25 Nov 2012 09:07:23 +0000
(18:07 +0900)
binarize/binarize.cpp
patch
|
blob
|
history
binarize/binarize.cu
patch
|
blob
|
history
binarize/binarize.cuh
patch
|
blob
|
history
binarize/binarize.h
patch
|
blob
|
history
libutils/Image.h
patch
|
blob
|
history
libutils/ImageIO.cpp
patch
|
blob
|
history
libutils/ImageIO.h
patch
|
blob
|
history
libutils/MDView.cuh
patch
|
blob
|
history
diff --git
a/binarize/binarize.cpp
b/binarize/binarize.cpp
index
792b290
..
f25bacd
100644
(file)
--- a/
binarize/binarize.cpp
+++ b/
binarize/binarize.cpp
@@
-27,12
+27,12
@@
using namespace FM7b5;
using namespace FM7b5;
-static void binarize_cpu(ImageGray& out, const ImageGray& in, const uint8_t thres = 128);
+static void binarize_cpu(ImageGray& out, const ImageGray& in, const uint
_fast
8_t thres = 128);
int _tmain(int argc, _TCHAR* argv[])
{
try {
int _tmain(int argc, _TCHAR* argv[])
{
try {
- const uint8_t thres(128);
+ const uint
_fast
8_t thres(128);
ImageGray image;
image = loadPGM("..\\img\\sine.pgm");
ImageGray image;
image = loadPGM("..\\img\\sine.pgm");
@@
-55,7
+55,7
@@
int _tmain(int argc, _TCHAR* argv[])
}
void
}
void
-binarize_cpu(ImageGray& out, const ImageGray& in, const uint8_t thres)
+binarize_cpu(ImageGray& out, const ImageGray& in, const uint
_fast
8_t thres)
{
if (in.width() != out.width() || in.height() != out.height()) {
throw std::runtime_error("sizes of input and output images are diferent.");
{
if (in.width() != out.width() || in.height() != out.height()) {
throw std::runtime_error("sizes of input and output images are diferent.");
diff --git
a/binarize/binarize.cu
b/binarize/binarize.cu
index
3d8a8bd
..
90c056f
100644
(file)
--- a/
binarize/binarize.cu
+++ b/
binarize/binarize.cu
@@
-24,7
+24,7
@@
using namespace FM7b5;
void
using namespace FM7b5;
void
-FM7b5::binarize_gpu(ImageGray& out, const ImageGray& in, const uint8_t thres)
+FM7b5::binarize_gpu(ImageGray& out, const ImageGray& in, const uint
_fast
8_t thres)
{
if (in.width() != out.width() || in.height() != out.height()) {
throw std::runtime_error("sizes of input and output images are diferent.");
{
if (in.width() != out.width() || in.height() != out.height()) {
throw std::runtime_error("sizes of input and output images are diferent.");
@@
-38,7
+38,7
@@
FM7b5::binarize_gpu(ImageGray& out, const ImageGray& in, const uint8_t thres)
(height + threads_per_block.y - 1)/ threads_per_block.y);
// allocate input/output memories
(height + threads_per_block.y - 1)/ threads_per_block.y);
// allocate input/output memories
- memory::LinearPitch<uint8_t> d_in(width, height), d_out(width, height);
+ memory::LinearPitch<uint
_fast
8_t> d_in(width, height), d_out(width, height);
// copy an input image to device memory
d_in.copy_from(in.data(), bpp * width, height, in.stride());
// copy an input image to device memory
d_in.copy_from(in.data(), bpp * width, height, in.stride());
diff --git
a/binarize/binarize.cuh
b/binarize/binarize.cuh
index
e8b690e
..
52d8ddb
100644
(file)
--- a/
binarize/binarize.cuh
+++ b/
binarize/binarize.cuh
@@
-25,7
+25,7
@@
namespace FM7b5
{
template <class T, class U>
__global__ void
{
template <class T, class U>
__global__ void
- binarize(const MDView<T, 2> out, const MDView<U, 2> in, const size_t width, const size_t height, const uint8_t thres)
+ binarize(const MDView<T, 2> out, const MDView<U, 2> in, const size_t width, const size_t height, const uint
_fast
8_t thres)
{
const size_t w(blockDim.x * blockIdx.x + threadIdx.x);
const size_t h(blockDim.y * blockIdx.y + threadIdx.y);
{
const size_t w(blockDim.x * blockIdx.x + threadIdx.x);
const size_t h(blockDim.y * blockIdx.y + threadIdx.y);
diff --git
a/binarize/binarize.h
b/binarize/binarize.h
index
738dc05
..
2de2835
100644
(file)
--- a/
binarize/binarize.h
+++ b/
binarize/binarize.h
@@
-22,7
+22,7
@@
namespace FM7b5
{
namespace FM7b5
{
- void binarize_gpu(ImageGray& out, const ImageGray& in, const uint8_t thres = 128);
+ void binarize_gpu(ImageGray& out, const ImageGray& in, const uint
_fast
8_t thres = 128);
}
#endif /* FM7b5_BINARIZE_H */
}
#endif /* FM7b5_BINARIZE_H */
diff --git
a/libutils/Image.h
b/libutils/Image.h
index
4e60da0
..
2bbc5c0
100644
(file)
--- a/
libutils/Image.h
+++ b/
libutils/Image.h
@@
-31,7
+31,7
@@
namespace FM7b5
public:
typedef T pixel_type;
typedef Image<T> image_type;
public:
typedef T pixel_type;
typedef Image<T> image_type;
- typedef std::uint8_t raw_type;
+ typedef std::uint
_fast
8_t raw_type;
Image();
Image(const size_t width, const size_t height, const size_t stride = 0);
Image();
Image(const size_t width, const size_t height, const size_t stride = 0);
@@
-153,7
+153,7
@@
namespace FM7b5
}
/* typedefs for convinience */
}
/* typedefs for convinience */
- typedef Image<std::uint8_t> ImageGray;
+ typedef Image<std::uint
_fast
8_t> ImageGray;
}
}
-#endif /* FM7b5_IMAGE_H */
\ No newline at end of file
+#endif /* FM7b5_IMAGE_H */
diff --git
a/libutils/ImageIO.cpp
b/libutils/ImageIO.cpp
index
309e8ea
..
de43f35
100644
(file)
--- a/
libutils/ImageIO.cpp
+++ b/
libutils/ImageIO.cpp
@@
-43,7
+43,7
@@
static bool skip_comment(FILE* fp);
static bool read_end_of_line(FILE* fp);
static bool read_end_of_line(FILE* fp);
-Image<std::uint8_t>
+Image<std::uint
_fast
8_t>
FM7b5::loadPGM(const std::string& filename)
{
FILE* fp(nullptr);
FM7b5::loadPGM(const std::string& filename)
{
FILE* fp(nullptr);
@@
-69,7
+69,7
@@
FM7b5::loadPGM(const std::string& filename)
throw std::runtime_error(__FUNCTION__ ": supported depth is 255 only.");
}
throw std::runtime_error(__FUNCTION__ ": supported depth is 255 only.");
}
- Image<std::uint8_t> img(header.width, header.height);
+ Image<std::uint
_fast
8_t> img(header.width, header.height);
switch (header.magic[1]) {
case '2': // Gray ASCII format
switch (header.magic[1]) {
case '2': // Gray ASCII format
@@
-82,7
+82,7
@@
FM7b5::loadPGM(const std::string& filename)
throw std::runtime_error(__FUNCTION__ ": invalid data.");
}
throw std::runtime_error(__FUNCTION__ ": invalid data.");
}
- img(w, h) = static_cast<std::uint8_t>(val);
+ img(w, h) = static_cast<std::uint
_fast
8_t>(val);
}
}
break;
}
}
break;
@@
-90,7
+90,7
@@
FM7b5::loadPGM(const std::string& filename)
case '5': // Gray binary format
{
const size_t size(header.width * header.height);
case '5': // Gray binary format
{
const size_t size(header.width * header.height);
- size_t ret = fread(img.data(), sizeof(std::uint8_t), size, fp);
+ size_t ret = fread(img.data(), sizeof(std::uint
_fast
8_t), size, fp);
if (ret != size) {
throw std::runtime_error(__FUNCTION__ ": insufficient data.");
}
if (ret != size) {
throw std::runtime_error(__FUNCTION__ ": insufficient data.");
}
diff --git
a/libutils/ImageIO.h
b/libutils/ImageIO.h
index
c859b3d
..
65e50d4
100644
(file)
--- a/
libutils/ImageIO.h
+++ b/
libutils/ImageIO.h
@@
-26,7
+26,7
@@
namespace FM7b5
{
namespace FM7b5
{
- Image<std::uint8_t> loadPGM(const std::string& filename);
+ Image<std::uint
_fast
8_t> loadPGM(const std::string& filename);
template <typename T>
void savePGM(const Image<T>& image, const std::string& filename);
template <typename T>
void savePGM(const Image<T>& image, const std::string& filename);
@@
-74,4
+74,4
@@
namespace FM7b5
}
}
}
}
-#endif /* FM7b5_IMAGE_IO_H */
\ No newline at end of file
+#endif /* FM7b5_IMAGE_IO_H */
diff --git
a/libutils/MDView.cuh
b/libutils/MDView.cuh
index
4035de4
..
3f28603
100644
(file)
--- a/
libutils/MDView.cuh
+++ b/
libutils/MDView.cuh
@@
-34,7
+34,7
@@
namespace FM7b5
{
public:
typedef T value_type;
{
public:
typedef T value_type;
- typedef typename copy_const<T, uint8_t>::type* byte_pointer_type;
+ typedef typename copy_const<T, uint
_fast
8_t>::type* byte_pointer_type;
typedef typename copy_const<T, void>::type* void_pointer_type;
protected:
typedef typename copy_const<T, void>::type* void_pointer_type;
protected: