mirror of
https://github.com/thead-yocto-mirror/xtensa_dsp
synced 2026-07-20 06:58:14 +02:00
48 lines
1.7 KiB
C
48 lines
1.7 KiB
C
/*
|
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
* or more contributor license agreements. See the NOTICE file
|
|
* distributed with this work for additional information
|
|
* regarding copyright ownership. The ASF licenses this file
|
|
* to you under the Apache License, Version 2.0 (the
|
|
* "License"); you may not use this file except in compliance
|
|
* with the License. You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing,
|
|
* software distributed under the License is distributed on an
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
* KIND, either express or implied. See the License for the
|
|
* specific language governing permissions and limitations
|
|
* under the License.
|
|
*/
|
|
|
|
/* auto generate by HHB_VERSION "1.8.x" */
|
|
|
|
#ifndef HHB_IO_H_
|
|
#define HHB_IO_H_
|
|
|
|
#include <math.h>
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#define MAX_FILE_LINE 50001
|
|
#define MAX_INPUT_NUMBER 4
|
|
#define MAX_FILENAME_LEN 128
|
|
|
|
enum file_type { FILE_PNG, FILE_JPEG, FILE_TENSOR, FILE_TXT, FILE_BIN };
|
|
|
|
/* Utils to process image data*/
|
|
enum file_type get_file_type(const char* filename);
|
|
void save_data_to_file(const char* filename, float* data, uint32_t size);
|
|
void save_uint8_to_file(const char* filename, uint8_t* data, uint32_t size);
|
|
void save_uint8_to_binary(const char* filename, uint8_t* data, uint32_t size);
|
|
char* get_binary_from_file(const char* filename);
|
|
int fill_buffer_from_file(const char* filename, char *buffer);
|
|
char** read_string_from_file(const char* filename, int* len);
|
|
uint32_t shape2string(uint32_t* shape, uint32_t dim_num, char* buf, uint32_t buf_sz);
|
|
|
|
#endif // HHB_IO_H_
|