星期五, 6月 12, 2020

ubifs tools

https://bootlin.com/blog/creating-flashing-ubi-ubifs-images/

星期二, 6月 09, 2020

Git FW version

https://atadiat.com/en/e-how-to-use-git-to-manage-firmware-versions/


1
2
3
4
GIT_HASH := $(shell git describe --match=NeVeRmAtCh --always --abbrev=7 --dirty)
GIT_BRANCH:=$(shell git rev-parse --abbrev-ref HEAD)
GIT_TAG:= $(shell git describe --abbrev=0)
COMMIT_DATE := $(shell git show -s --format=%cd --date=format:'-%y-%m-%d' $(GIT_HASH))
.i.e: ‘fw-v.1.13.0-8c0ab15-master-10_1_2020.hex’. 

星期三, 6月 03, 2020

Alsa G.711, ulaw encode




Alsa Audio Capture

樹莓派sip視頻電話-2:alsa+g711+rtp傳輸音頻


G711 G723 G729線路占多少帶寬問題

image compare similarity

Image Similarity

感知哈希算法(Perceptual hash algorithm)

巴氏系数计算




ΣCASA

ΣCASA 
https://www.tw.sigmacasa.com/alarm-system

keyword: iot, zwave, apple home kit

u-boot fast boot

https://github.com/ARM-software/u-boot/blob/master/doc/README.android-fastboot-protocol
  
FastBoot Version 0.4
----------------------
The fastboot protocol is a mechanism for communicating with bootloaders
over USB. It is designed to be very straightforward to implement, to
allow it to be used across a wide range of devices and from hosts running
Linux, Windows, or OSX.

EFM32 Gecko


https://siliconlabs.github.io/Gecko_SDK_Doc/efm32g/html/group__LETIMER.html
LETIMER

pthread Barrier

Pthread Barrier:
https://langzi989.github.io/2018/07/05/pthread%E4%BD%BF%E7%94%A8barrier%E6%A0%85%E6%A0%8F%E6%96%B9%E5%BC%8F%E5%90%8C%E6%AD%A5/


1
2
3
4
5
6
7
8
9
10
11
12
#include <pthread.h>
//初始化栅栏,栅栏需要等待到count个线程,才会全部一起放行。
int pthread_barrier_init(pthread_barrier_t *restrict,
const pthread_barrierattr_t *restrict, unsigned count);
//报道函数,当一个线程到达栅栏的时候,就报道。
//所有的线程都报道后,栅栏自然会放行。
int pthread_barrier_wait(pthread_barrier_t *barrier);
栅栏完成历史使命后,当然是功成身退。
int pthread_barrier_destroy(pthread_barrier_t *barrier);

使用示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <unistd.h>
pthread_barrier_t barrier;
void* initor(void* args) {
printf("---------------thread init work(%d)--------------\n", time(NULL));
//模拟初始化工作。
sleep(10);
//到达栅栏
pthread_barrier_wait(&barrier);
printf("--------------thread start work(%d)--------------\n", time(NULL));
sleep(10);
printf("--------------thread stop work(%d)--------------\n", time(NULL));
return NULL;
}
int main(int argc, char* argv[]) {
//初始化栅栏,该栅栏等待两个线程到达时放行
pthread_barrier_init(&barrier, NULL, 2);
printf("**************main thread barrier init done****************\n");
pthread_t pid;
pthread_create(&pid, NULL, &initor, NULL);
printf("**************main waiting(%d)********************\n", time(NULL));
//主线程到达,被阻塞,当初始化线程到达栅栏时才放行。
pthread_barrier_wait(&barrier);
pthread_barrier_destroy(&barrier);
printf("***************main start to work(%d)****************\n", time(NULL));
sleep(30);
pthread_join(pid, NULL);
printf("***************thread complete(%d)***************\n", time(NULL));
return 0;
}

ffmpmeg audio covert


  1. ffmpeg -i filename.mp3 newfilename.wav
  2.  ffmpeg -i INPUT -f alsa hw:1,7
  3.  ffmpeg -i INPUT -f alsa default
  4. ffmpeg -re  -i speaker.aac -f wav -ar 48000 -y ee.wav
  5. sndfile-resample -to 48000 -c 2 error1.wav e2.wav
Reference:

  1. http://manpages.ubuntu.com/manpages/xenial/man1/ffmpeg-devices.1.html
  2. https://www.howtoforge.com/tutorial/ffmpeg-audio-conversion/
  3. linux/ALSA SRC重采样造成的问题及解决


keyword: alsa, resample, ffmpeg, sndfile-resample, sox, resample, alsa hw