Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
i-evi committed Sep 20, 2020
1 parent 2f162d0 commit 249bd64
Show file tree
Hide file tree
Showing 14 changed files with 197 additions and 187 deletions.
2 changes: 1 addition & 1 deletion demo/lenet.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ int main(int argc, const char *argv[])
cc_float32 v;
char filepath[256];
/* Image */
utim_image_t *img, *img_read;
UTIM_IMG *img, *img_read;
/* Layers */
cc_tensor_t *input,*l1, *l1_pool, *l2, *l2_pool, *l2_flat, *l3, *l4;
/* Parameters */
Expand Down
2 changes: 1 addition & 1 deletion demo/lenet_unpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ int main(int argc, const char *argv[])
cc_int32 i, j;
cc_float32 v;
/* Image */
utim_image_t *img, *img_read;
UTIM_IMG *img, *img_read;
/* Layers */
cc_tensor_t *input,*l1, *l1_pool, *l2, *l2_pool, *l2_flat, *l3, *l4;
/* Parameters */
Expand Down
15 changes: 12 additions & 3 deletions src/3rd_party/seb/seb.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
#endif /* SEB_SET_FASTLZ */

#ifndef byte
#define SEB_TYPE_BYTE
#define byte unsigned char
#endif
#ifndef uint32
#define SEB_TYPE_UINT32
#define uint32 unsigned int
#endif

Expand Down Expand Up @@ -306,7 +308,7 @@ uint32 sebfwrite(void *ptr, uint32 size, uint32 nmemb, sebFILE *sebfp)
/* Notice: little endian */
static void _seb_read_block(sebFILE *sebfp)
{
int l;
uint32 l;
byte *p;
if (!sebfp->const_blklen) {
fread(&l, sizeof(uint32), 1, sebfp->fp);
Expand All @@ -315,9 +317,9 @@ static void _seb_read_block(sebFILE *sebfp)
p = (byte*)realloc(sebfp->encdat, sebfp->blklen);
sebfp->encdat = p ? p : sebfp->encdat;
}
}
else
} else {
l = sebfp->const_blklen;
}
fread(sebfp->encdat, l, 1, sebfp->fp);
sebfp->decode(sebfp->decode_ctrl,
sebfp->encdat, sebfp->blklen,
Expand Down Expand Up @@ -357,3 +359,10 @@ void sebfclose(sebFILE *sebfp)
fclose(sebfp->fp);
free(sebfp);
}

#ifdef SEB_TYPE_BYTE
#undef byte
#endif
#ifdef SEB_TYPE_UINT32
#undef uint32
#endif
17 changes: 12 additions & 5 deletions src/3rd_party/seb/seb.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
#define SEB_BUFFER_LENGTH (16 * 1024) /* Buffer length by default */

#ifndef byte
#define _SEB_H_TYPE_BYTE
#define SEB_TYPE_BYTE
#define byte unsigned char
#endif
#ifndef uint32
#define _SEB_H_TYPE_UINT32
#define SEB_TYPE_UINT32
#define uint32 unsigned int
#endif

Expand All @@ -65,6 +65,13 @@ typedef int (seb_decode_function)(int ctrl,
void *input, int input_length,
void *output, int max_out_length);

/* #if `stdio.h` has been included */
#ifndef FOPEN_MAX
#define SEB_FPTR_TYPE void*
#else
#define SEB_FPTR_TYPE FILE*
#endif

typedef struct {
byte *buffer; /* Data buffer */
byte *encdat; /* Encoded data */
Expand All @@ -79,7 +86,7 @@ typedef struct {
int decode_ctrl;
seb_encode_function *encode;
seb_decode_function *decode;
void *fp; /* FILE* */
SEB_FPTR_TYPE fp; /* FILE* */
} sebFILE;

void seb_global_encoder(int enctype);
Expand All @@ -94,10 +101,10 @@ uint32 sebfread(void *ptr, uint32 size, uint32 nmemb, sebFILE *sebfp);

#define sebfilelen(sebfp) (sebfp->length)

#ifdef _SEB_H_TYPE_BYTE
#ifdef SEB_TYPE_BYTE
#undef byte
#endif
#ifdef _SEB_H_TYPE_UINT32
#ifdef SEB_TYPE_UINT32
#undef uint32
#endif

Expand Down
5 changes: 0 additions & 5 deletions src/cc_dtype.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ typedef _DT_FLOAT32 cc_float32;
typedef _DT_FLOAT64 cc_float64;

/*
*
* 7 6 5 4 3 ~ 0
* | | | | |_____|
* | | | | |____sub-class code
Expand All @@ -45,10 +44,6 @@ typedef _DT_FLOAT64 cc_float64;
* | |______integer or float(0/1)
* |
* |______unsigned or signed(0/1)
*
* Sub class code:
* bits = 2 ^ n
*
*/

#define CC_FLAG_POINT 6
Expand Down
6 changes: 3 additions & 3 deletions src/cc_image.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#define _CC_IMAGE_C_
#include "cc_image.h"

cc_tensor_t *cc_image2tensor(utim_image_t *img, const char *name)
cc_tensor_t *cc_image2tensor(UTIM_IMG *img, const char *name)
{
cc_uint8 *ptr;
cc_int32 i, j, ch_size;
Expand All @@ -30,9 +30,9 @@ cc_tensor_t *cc_image2tensor(utim_image_t *img, const char *name)
return tensor;
}

utim_image_t *cc_tensor2image(cc_tensor_t *tensor)
UTIM_IMG *cc_tensor2image(cc_tensor_t *tensor)
{
utim_image_t *img;
UTIM_IMG *img;
cc_uint8 *pxls, *ptr;
cc_int32 i, j, ch_size, npxls;
const cc_int32 *sptr = tensor->shape;
Expand Down
4 changes: 2 additions & 2 deletions src/cc_image.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#define CC_IT_SHAPE_H 1
#define CC_IT_SHAPE_W 2

cc_tensor_t *cc_image2tensor(utim_image_t *img, const char *name);
cc_tensor_t *cc_image2tensor(UTIM_IMG *img, const char *name);

utim_image_t *cc_tensor2image(cc_tensor_t *tensor);
UTIM_IMG *cc_tensor2image(cc_tensor_t *tensor);

#ifndef _CC_IMAGE_C_
#undef CC_IT_SHAPE_C
Expand Down
1 change: 0 additions & 1 deletion src/cc_tsrmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ void cc_tsrmgr_init(void)
return;
}


static void _tsrmgr_clear(struct rbt_node *n)
{
if (n != rbt_nil()) {
Expand Down
Loading

0 comments on commit 249bd64

Please sign in to comment.