'잡동사니'에 해당되는 글 13326건

  1. 2023.04.06 gst-inspector.c
  2. 2023.04.05 fft 0 Hz 2
  3. 2023.04.05 수의사 처방제 확대시행
  4. 2023.04.04 partial fft
  5. 2023.04.04 websocket binarytype
  6. 2023.04.03 외근 야근
  7. 2023.04.02 벚꽃구경
  8. 2023.04.01 만우절
  9. 2023.03.31 chart.js log 스케일
  10. 2023.03.31 fftw plan

한번 빌드해서 원하는 결과만 덤프하는 용도로 수정이 가능하려나?

[링크 : https://github.com/GStreamer/gstreamer/blob/main/subprojects/gstreamer/tools/gst-inspect.c]

 

 gst-inspect 에서 원하는 정보는 아래의 Pad template 부분

Pad Templates:
  SINK template: 'sink_%u'
    Availability: On request
    Capabilities:
      video/x-raw
                 format: { (string)AYUV, (string)BGRA, (string)ARGB, (string)RGBA, (string)ABGR, (string)Y444, (string)Y42B, (string)YUY2, (string)UYVY, (string)YVYU, (string)I420, (string)YV12, (string)NV12, (string)NV21, (string)Y41B, (string)RGB, (string)BGR, (string)xRGB, (string)xBGR, (string)RGBx, (string)BGRx }
                  width: [ 1, 2147483647 ]
                 height: [ 1, 2147483647 ]
              framerate: [ 0/1, 2147483647/1 ]
  
  SRC template: 'src'
    Availability: Always
    Capabilities:
      video/x-raw
                 format: { (string)AYUV, (string)BGRA, (string)ARGB, (string)RGBA, (string)ABGR, (string)Y444, (string)Y42B, (string)YUY2, (string)UYVY, (string)YVYU, (string)I420, (string)YV12, (string)NV12, (string)NV21, (string)Y41B, (string)RGB, (string)BGR, (string)xRGB, (string)xBGR, (string)RGBx, (string)BGRx }
                  width: [ 1, 2147483647 ]
                 height: [ 1, 2147483647 ]
              framerate: [ 0/1, 2147483647/1 ]

Element has no clocking capabilities.
Element has no URI handling capabilities.

 

Pad Templates를 출력하는 함수

static void
print_pad_templates_info (GstElement * element, GstElementFactory * factory)

[링크 : https://github.com/GStreamer/gstreamer/blob/main/subprojects/gstreamer/tools/gst-inspect.c#L816]

 

Capabilities 부분을 출력하는 함수

static void
print_caps (const GstCaps * caps, const gchar * pfx)

[링크 : https://github.com/GStreamer/gstreamer/blob/main/subprojects/gstreamer/tools/gst-inspect.c#L194]

'프로그램 사용 > gstreamer' 카테고리의 다른 글

gst-device-monitor-1.0  (0) 2023.12.06
gstremaer videobox + videomixer  (0) 2023.04.10
gstreamer videomixer 반쪽 성공  (0) 2023.03.27
gstreamer videomixer ... 2?  (0) 2023.03.27
gstreamer pad - sink 와 src  (0) 2023.03.27
Posted by 구차니

정리하자면

FFT를 100개 하면, 1~50 Hz와 0Hz에 대한 분석 결과가 나온다.

그래서 N / 2 + 1개

 

---

도대체 왜 N/2+1이 나오나를 찾는데 이해를 못하겠다.

 

For a real-to-complex transform you get N / 2 + 1 complex outputs for N real inputs (the redundant symmetric outputs are not generated).

The 0 Hz component is in bin 0.

 

Now out contains r0, r1, r2, ..., rn/2, i(n+1)/2-1, ..., i2, i1 , as it is written in the manual.

r0 ,out[0],is the mean value of your data/signal.
r1 ,out[1],is the real part of the first element of the DFT.
...
i0 is 0 because you're using real data , so it isn't stored in out.
i1 ,out[N-1],is the imaginary part of the first element of the DFT.
i2 ,out[N-2],is the imaginary part of the second element of the DFT.
If N is a even number , then r(N/2) out[N/2] is the Nyquist frequency amplitude.

Im new to fftw library

Remember that FFTW computes only the product of your data by the trigonometric functions, but it don't normalize them. You can find more info about the halfcomplex here.

[링크 : https://stackoverflow.com/questions/36637727/fftw-library-what-is-the-output-size-of-fftw-plan-dft-r2c-1d]

[링크 : https://kr.mathworks.com/matlabcentral/answers/42325-fft-is-finding-a-max-amplitude-at-0-hz]

 

chatGPT

The reason that the Fast Fourier Transform (FFT) in the library FFTW produces a result of N/2+1 values when applied to real input data of length N is because of the way that the FFT algorithm works.
In FFTW, the FFT algorithm used is called the "real-to-complex" FFT, which takes real-valued input data and produces complex-valued output data. When applied to real input data, the algorithm takes advantage of the symmetry properties of the Fourier transform of real-valued signals. Specifically, the Fourier transform of a real-valued signal is complex-conjugate symmetric, meaning that if x(t) is a real-valued signal, then its Fourier transform X(f) satisfies X(-f) = conj(X(f)), where "conj" denotes complex conjugation.
Because of this symmetry property, half of the output values of the FFT algorithm are redundant, and can be calculated from the other half. Specifically, the output values for frequencies from 0 to N/2 are unique, while the output values for frequencies from N/2+1 to N-1 can be calculated as the complex conjugate of the corresponding frequency from 1 to N/2-1.
Therefore, to save computation time and memory, FFTW only calculates the unique output values for frequencies from 0 to N/2, as well as the value for frequency N/2 (if N is even). This results in a total of N/2+1 output values.
FFTW 라이브러리에서 Fast Fourier Transform (FFT)를 적용하면, 길이가 N인 실수 입력 데이터에 대해 복소수 출력 데이터 N/2+1개가 생성됩니다. 이는 FFT 알고리즘이 동작하는 방식 때문입니다.
FFTW에서 사용되는 FFT 알고리즘은 "real-to-complex" FFT라고 불리며, 실수값 입력 데이터를 복소수값 출력 데이터로 변환합니다. 이 알고리즘은 실수값 신호의 푸리에 변환의 대칭성(symmetric) 특성을 활용합니다. 구체적으로, 실수값 신호 x(t)의 푸리에 변환 X(f)은 X(-f) = conj(X(f)) 라는 복소수 공액대칭성(complex-conjugate symmetric)을 만족합니다. 여기서 "conj"는 복소수 공액(conjugate)를 의미합니다.
이 대칭성 특성 때문에 FFT 알고리즘의 출력값 중 절반은 중복되는 값이며, 나머지 절반은 이 중복된 값들로부터 계산될 수 있습니다. 구체적으로, 0부터 N/2까지의 주파수 대역에서는 고유한 출력값이 존재하며, N/2+1부터 N-1까지의 주파수 대역에서는 대응하는 1부터 N/2-1까지의 주파수 대역의 복소수 공액값을 계산하여 구할 수 있습니다.
따라서 FFTW는 연산 시간과 메모리를 절약하기 위해, 0부터 N/2까지의 주파수 대역에 대한 고유한 출력값과, N이 짝수인 경우 주파수 N/2에 대한 출력값을 계산합니다. 이렇게 계산된 출력값의 총 개수는 N/2+1개가 됩니다.

 

 

The DFT results are stored in-order in the array out, with the zero-frequency (DC) component in out[0]. 

[링크 : https://www.fftw.org/fftw3_doc/Complex-One_002dDimensional-DFTs.html#Complex-One_002dDimensional-DFTs]

 

+

2023.06.16

 

Size of FFT in 1D is not half of the signal length. It's still the signal length (assuming FFT length was of the signal length). However for real data, due to conjugate symmetryhalf of this is redundant and can be dicarded to reduce storage. Note however that, when it's required to process the FFT data, you have to construct the full length from the half and proceed.

This is also the reason why spectral analysis software display only positive frequencies for real data; i.e, negative frequencies will be a mirror copy (of the magnitude) of positive frequencies.

But you don't have to discard the half. You can just retain it.

For image processing, the symmetry of FFT for real input data again exist and if you wish you can also dicard half of the image FFT data. Whether this will be employed or not depends on the intentions of the package.

[링크 : https://dsp.stackexchange.com/questions/55239/why-is-the-size-of-results-from-fft-half-the-size-of-the-input-while-that-is-no]

[링크 : https://brianmcfee.net/dstbook-site/content/ch06-dft-properties/Conjugate-Symmetry.html]

'프로그램 사용 > fft, fftw' 카테고리의 다른 글

fftw input range?  (0) 2023.04.07
fft 복소수(complex) - 실수, 허수부(real, imaginary)  (0) 2023.04.07
partial fft  (0) 2023.04.04
fftw plan  (0) 2023.03.31
libfftw3 precision  (0) 2023.03.30
Posted by 구차니

22년 11월 13일 부터 약국에서 종합백신을 판매할 수 없도록 법이 바뀌었다고 한다.

머 병원에서 주사를 놔야 하는게 당연하긴 한데.. 동물병원이 너무 비싸다 보니 오히려 백신을 안 놓게 되는 일이 발생할 것 같네..

 

오는 11월 13일부터 동물약국에서 반려견 4종 백신(DHPPi), 반려묘 3종 백신(FVRCP)을 수의사 처방전 없이 판매할 수 없게 됐다. 수의사 처방제가 확대시행됐기 때문이다.

만약 약국에서 개 종합백신, 고양이 종합백신을 처방전 없이 판매하면 약사법 위반으로 1년 이하의 징역 또는 1천만원 이하의 벌금에 처하게 된다.

...

개 5종 백신(DHPPL), 고양이 4종 백신, 5종 백신이 이미 2018년부터 처방대상이었던 점을 고려하면, 사실상 반려견·반려묘의 백신(생물학적제제)의 약국 판매가 금지되는 것이다. 수의사 처방전이 있으면 백신을 구입할 수 있으나, 처방전을 받기 위해서는 동물병원에서 수의사의 진료를 먼저 받아야 한다.

[링크 : https://www.dailyvet.co.kr/news/practice/companion-animal/174690]

 

2년 유예기간을 거쳐 오는 11월 13일부터 동물약국은 주사용 항생‧항균제, 일부 생물학적제제의 경우 반드시 수의사 처방전을 받고 판매해야 한다. 즉 항생제 주사제, 광견병 백신, 개 종합백신 3가지만 수의사 처방전이 필요하다는 것만 기억하면 된다.

[링크 : http://www.dailypharm.com/Users/News/NewsView.html?ID=292399]

'개소리 왈왈 > 육아관련 주저리' 카테고리의 다른 글

줍줍  (0) 2023.04.11
청소조금  (0) 2023.04.08
벚꽃구경  (0) 2023.04.02
심장 사상충약 투약!  (0) 2023.03.17
노랫만에 한강 나들이  (0) 2023.02.26
Posted by 구차니

'프로그램 사용 > fft, fftw' 카테고리의 다른 글

fft 복소수(complex) - 실수, 허수부(real, imaginary)  (0) 2023.04.07
fft 0 Hz  (2) 2023.04.05
fftw plan  (0) 2023.03.31
libfftw3 precision  (0) 2023.03.30
spectrogram  (0) 2023.03.29
Posted by 구차니

웹 브라우저에서 웹 소켓을 열면 기본값은 blob 으로 열리는데

Value
A string:

"blob"
Use Blob objects for binary data. This is the default value.

"arraybuffer"
Use ArrayBuffer objects for binary data.

 

binaryType을 지정하면 blob이 아닌 arraybuffer로 열 수 있다.

// Create WebSocket connection.
const socket = new WebSocket("ws://localhost:8080");

// Change binary type from "blob" to "arraybuffer"
socket.binaryType = "arraybuffer";

[링크 : https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/binaryType]

 

웹 소켓에서 blob이나 arraybuffer로 받는데

blob은 slice를 통해 자를수 있긴 한데 이래저래 행렬 처리가 아니다 보니 번거롭고

개인적인 취향으로는 blob을 받아서 arraybuffer로 변환하기 보다는 arraybuffer로 받아서 적당히 잘라쓰는 쪽 일 듯

blob은 contentType을 멀 지정해야 하나 조금 귀찮은 듯.. (타입이다 보니 int32, float64 이런게 아닐 것 같으니)

Syntax
slice()
slice(start)
slice(start, end)
slice(start, end, contentType)

[링크 : https://developer.mozilla.org/en-US/docs/Web/API/Blob/slice]

 

Convert an ArrayBuffer or typed array to a Blob
#
var array = new Uint8Array([0x04, 0x06, 0x07, 0x08]);
var blob = new Blob([array]);

[링크 : https://riptutorial.com/javascript/example/1390/converting-between-blobs-and-arraybuffers]

[링크 : https://velog.io/@chltjdrhd777/ArrayBuffer-와-Blob]

[링크 : https://heropy.blog/2019/02/28/blob/]

 

strToAB = str =>
  new Uint8Array(str.split('')
    .map(c => c.charCodeAt(0))).buffer;

ABToStr = ab => 
  new Uint8Array(ab).reduce((p, c) =>
  p + String.fromCharCode(c), '');

console.log(ABToStr(strToAB('hello world!')));

[링크 : https://stackoverflow.com/questions/39725716/]

[링크 : https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Int32Array]

 

[링크 : http://mohwa.github.io/blog/javascript/2015/08/31/binary-inJS/]

 

'Programming > javascript & HTML' 카테고리의 다른 글

html canvas와 시간 그래프 흘리기  (0) 2023.07.06
javascript 정수는 정수가 아니다  (0) 2023.04.06
자바스크립트 소수점 자르기  (0) 2023.03.13
Math.min.apply()  (0) 2023.02.07
web 렌더러 벤치마크  (0) 2022.12.22
Posted by 구차니

어우.. 일찍 끝날줄 알았는데 맨날 늦게 끝나 ㅠㅠ

'개소리 왈왈 > 직딩의 비애' 카테고리의 다른 글

도그도그  (0) 2023.04.18
대략 빡침  (0) 2023.04.13
리듬.깨짐  (0) 2023.03.26
외근 외근.야근  (0) 2023.03.21
언제나 피곤  (0) 2023.03.12
Posted by 구차니

우리동네 앞이 가장 좋네

'개소리 왈왈 > 육아관련 주저리' 카테고리의 다른 글

청소조금  (0) 2023.04.08
수의사 처방제 확대시행  (0) 2023.04.05
심장 사상충약 투약!  (0) 2023.03.17
노랫만에 한강 나들이  (0) 2023.02.26
버섯탕수욕 마이쪙!  (0) 2023.02.25
Posted by 구차니

거짓말을 용납할 수 없는 각박한 세상이 되어가는 느낌

Posted by 구차니
Programming/web 관련2023. 3. 31. 12:15

'Programming > web 관련' 카테고리의 다른 글

Canvas2D: Multiple readback operations using getImageData  (0) 2023.07.24
webGPU  (0) 2023.05.18
chatGPT님 가라사대 Server-Sent Events (SSE)  (0) 2023.03.15
JWT 로그인 예제  (0) 2022.08.24
quirks mode  (0) 2022.08.08
Posted by 구차니

fftw를 이용하여 fft 연산을 하려고 하면

fft_plan_dft*() 함수로 plan을 만들고 (이 과정에서 input, output 포인터 지정)

fftw_execute() 함수로 fft 연산을 한다.

 

fft_plan_dft_*() 함수만 해도 수행에 꽤 시간이 걸리는 관계로

포인터를 바꾸어서 다시 할당할게 아니라.. 메모리 복사를 한번 더 하고

plan에 지정된 포인터를 재사용 하는게 cpu 점유율을 낮추는 방법이 될 것 같다.

 

Plans for all transform types in FFTW are stored as type fftw_plan (an opaque pointer type), and are created by one of the various planning routines described in the following sections. An fftw_plan contains all information necessary to compute the transform, including the pointers to the input and output arrays.

[링크 : https://www.fftw.org/fftw3_doc/Using-Plans.html]

'프로그램 사용 > fft, fftw' 카테고리의 다른 글

fft 0 Hz  (2) 2023.04.05
partial fft  (0) 2023.04.04
libfftw3 precision  (0) 2023.03.30
spectrogram  (0) 2023.03.29
fft 분석 패러미터  (0) 2023.03.29
Posted by 구차니