Skip to content

Instantly share code, notes, and snippets.

View lix19937's full-sized avatar
🤖
keep learning new things.

lix19937

🤖
keep learning new things.
View GitHub Profile
@lix19937
lix19937 / build_proto.sh
Last active May 22, 2025 03:15
build_proto_cc.sh
#
# by ljw 20250521
#
#!/bin/bash
if [ -z "$#" ];then
echo -e "\nUsage ./scripts/build_proto.sh Pb_ROOT_DIR\n"
exit 1
fi
@lix19937
lix19937 / CMakeLists.txt
Last active May 22, 2025 03:13
proto_cc.CMakeLists
#
# by ljw 20250521
#
cmake_minimum_required(VERSION 3.12)
project(adc_proto)
find_package(Protobuf REQUIRED)
file(GLOB_RECURSE PROTO_FILES
@lix19937
lix19937 / setBit.cpp
Created May 6, 2025 08:16
setBit.cpp
#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;
#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);
@lix19937
lix19937 / j6_infer.cpp
Created November 15, 2024 02:04
horizon_j6 infer cpp
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <utility>
@lix19937
lix19937 / hwc2chw_cresize.cpp
Last active November 15, 2024 02:04
opencv hwc2chw and crop_resize
#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};
@lix19937
lix19937 / multi_models_tensorrt_benchmark.cpp
Last active November 15, 2024 02:02
multi_models_tensorrt_benchmark
///
/// ref nv impl
///
/// lix19937
///
#include <unistd.h>
#include <fstream>
#include <vector>
#include <cassert>