extra/f0detectionyin.m
Go to the documentation of this file.
1 function f0 = f0detectionyin(x,fs,ws,minf0,maxf0)
2 % x: input signal, fs: sampling rate, ws: integration window length, minf0: minimum f0, maxf0: maximum f0
3 % f0: fundamental frequency detected in Hz
4 maxlag = ws-2; % maximum lag
5 th = 0.1; % set threshold
6 d = zeros(maxlag,1); % init variable
7 d2 = zeros(maxlag,1); % init variable
8 % compute d(tau)
9 x1 = x(1:ws);
10 cumsumx = sum(x1.^2);
12 xy = xcorr(x(1:ws*2),x1);
13 xy = xy(ws*2+1:ws*3-2);
14 for lag=0:maxlag-1
15  d(1+lag) = cumsumx + cumsumxl - 2*xy(1+lag);
16  cumsumxl = cumsumxl - x(1+lag).^2 + x(1+lag+ws+1)^2;
17 end
18 cumsum = 0;
19 % compute d'(tau)
20 d2(1) = 1;
21 for lag=1:maxlag-1
22  cumsum = cumsum + d(1+lag);
23  d2(1+lag) = d(1+lag)*lag./cumsum;
24 end
25 % limit the search to the target range
26 minf0lag = 1+round(fs./minf0); % compute lag corresponding to minf0
27 maxf0lag = 1+round(fs./maxf0); % compute lag corresponding to maxf0
28 if (maxf0lag>1 && maxf0lag<maxlag)
29  d2(1:maxf0lag) = 100; % avoid lags shorter than maxf0lag
30 end
31 if (minf0lag>1 && minf0lag<maxlag)
32  d2(minf0lag:end) = 100; % avoid lags larger than minf0lag
33 end
34 % find the best candidate
35 mloc = 1 + find((d2(2:end-1)<d2(3:end)).*(d2(2:end-1)<d2(1:end-2))); % minima
36 candf0lag = 0;
37 if (length(mloc)>0)
38  I = find(d2(mloc)<th);
39  if (length(I)>0)
40  candf0lag = mloc(I(1));
41  else
42  [Y,I2] = min(d2(mloc));
43  candf0lag = mloc(I2);
44  end
45  candf0lag = candf0lag; % this is zero-based indexing
46  if (candf0lag>1 & candf0lag<maxlag)
47  % parabolic interpolation
48  lval = d2(candf0lag-1);
49  val = d2(candf0lag);
50  rval= d2(candf0lag+1);
51  candf0lag = candf0lag + .5*(lval-rval)./(lval-2*val+rval);
52  end
53 end
54 ac = min(d2);
55 f0lag = candf0lag-1; % convert to zero-based indexing
56 f0 = fs./f0lag; % compute candidate frequency in Hz
57 if (ac > 0.2) % voiced/unvoiced threshold
58  f0 = 0; % set to unvoiced
59 end
60 
function maxf0
static void set(uint8_t *a[], int ch, int index, int ch_count, enum AVSampleFormat f, double v)
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
location of range
About Git write you should know how to use GIT properly Luckily Git comes with excellent documentation git help man git shows you the available git< command > help man git< command > shows information about the subcommand< command > The most comprehensive manual is the website Git Reference visit they are quite exhaustive You do not need a special username or password All you need is to provide a ssh public key to the Git server admin What follows now is a basic introduction to Git and some FFmpeg specific guidelines Read it at least if you are granted commit privileges to the FFmpeg project you are expected to be familiar with these rules I if not You can get git from etc no matter how small Every one of them has been saved from looking like a fool by this many times It s very easy for stray debug output or cosmetic modifications to slip in
Definition: git-howto.txt:5
N, 1 zeros()
x1
Definition: genspecsines3.m:7
set threshold d
compute lag corresponding to minf0 maxf0lag
end cumsum
#define Y
Definition: vf_boxblur.c:76
end end
end end ac
magnitude of peak bin lval
minima candf0lag
Discrete Time axis x
function fs
#define zero
Definition: regdef.h:64
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame This method is called when a frame is wanted on an output For an input
init variable d2
static av_always_inline av_const double round(double x)
Definition: libm.h:162
overlapping window(triangular window to avoid too much overlapping) ovidx
function ws
else[Y, I2]
static int convert(uint8_t x)
Definition: xbmdec.c:35
the buffer and buffer reference mechanism is intended to avoid
end limit the search to the target range minf0lag
for lag
if(length(mloc)>0) I
compute lag corresponding to maxf0 if(maxf0lag >1 &&maxf0lag< maxlag) d2(1 avoid lags shorter than maxf0lag end if(minf0lag >1 &&minf0lag< maxlag) d2(minf0lag avoid lags larger than minf0lag end find the best candidate mloc
FFmpeg Automated Testing Environment ************************************Table of Contents *****************FFmpeg Automated Testing Environment Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass target exec to configure or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script tests fate sh from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at doc fate_config sh template Create a configuration that suits your based on the configuration template The slot configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern< arch >< os >< compiler >< compiler version > The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the fate_recv variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ssh command with one or more v options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory FATE makefile targets and variables *************************************Makefile can be set to
Definition: fate.txt:142
maximum lag th
function minf0
The official guide to swscale for confused that is
Definition: swscale.txt:2
function f0
const char int length
Definition: avisynth_c.h:668
float min
for(j=16;j >0;--j)