This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int tnbytes = h * w; | |
// std::vector<cv::Mat> tchannels; | |
// cv::split(img_bgr, tchannels); | |
// std::cout << "宽度: " << tchannels[0].cols << std::endl; | |
// std::cout << "高度: " << tchannels[0].rows << std::endl; | |
// std::cout << "通道数: " << tchannels[0].channels() << std::endl; | |
// std::cout << "数据类型: " << tchannels[0].type() << " ---- " << CV_8UC1 << std::endl; | |
// std::cout << "深度: " << tchannels[0].depth() << std::endl; | |
// std::cout << "尺寸: " << tchannels[0].size() << std::endl; | |
// std::cout << "是否连续存储: " << (tchannels[0].isContinuous() ? "是" : "否") << std::endl; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
SHELL_FOLDER=$(cd $(dirname "$0") && pwd) | |
export PROTO_INTERFACE_DIR=$SHELL_FOLDER/../interface/proto | |
# protoc --help |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# by ljw 20250521 | |
# | |
# x86_64 host compile | |
#!/bin/bash | |
if [ -z "$#" ];then | |
echo -e "\nUsage ./scripts/build_proto.sh Pb_ROOT_DIR\n" | |
exit 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# by ljw 20250521 | |
# | |
# compile protos to a shared lib | |
# | |
cmake_minimum_required(VERSION 3.12) | |
project(adc_proto) | |
find_package(Protobuf REQUIRED) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdint.h> | |
#include <iostream> | |
#include <bitset> | |
uint32_t setBit(uint32_t position) { | |
uint32_t num = 0; | |
num |= (1 << position); | |
return num; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <numeric> | |
using namespace std; | |
#define DEFINE_H_D_PTR(name) void *name##_ptr, *name##_d_ptr | |
int main(){ | |
int array[] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; | |
int sum = accumulate(array, array + std::size(array), 0); | |
cout << "array = " << sum << endl; | |
printf(">>>>> %d\n", sum); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> | |
#include <fstream> | |
#include <iomanip> | |
#include <iostream> | |
#include <iterator> | |
#include <map> | |
#include <queue> | |
#include <utility> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "opencv2/opencv.hpp" | |
void hwc2chw(const cv::Mat &hwc, int h, int w, int c, cv::Mat &chw /* fp32 */) | |
{ | |
std::vector<cv::Mat> channels; | |
cv::split(hwc, channels); | |
int nbytes = h * w; | |
int size4[4] = {1, c, h, w}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// | |
/// ref nv impl | |
/// | |
/// lix19937 | |
/// | |
#include <unistd.h> | |
#include <fstream> | |
#include <vector> | |
#include <cassert> |