本文整理汇总了C++中FF函数的典型用法代码示例。如果您正苦于以下问题:C++ FF函数的具体用法?C++ FF怎么用?C++ FF使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FF函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_nearest_monitor_rect
int
get_nearest_monitor_rect( int *x, int *y, int *width, int *height )
{
SDL_SysWMinfo info;
Display* display;
int screen;
SDL_VERSION(&info.version);
if ( !SDL_GetWMInfo(&info) ) {
D( "%s: SDL_GetWMInfo() failed: %s", __FUNCTION__, SDL_GetError());
return -1;
}
if (x11_lib_init() < 0)
return -1;
display = info.info.x11.display;
screen = FF(XDefaultScreen)(display);
*x = 0;
*y = 0;
*width = FF(XDisplayWidth)(display, screen);
*height = FF(XDisplayHeight)(display, screen);
D("%s: found (x,y,w,h)=(%d,%d,%d,%d)", __FUNCTION__,
*x, *y, *width, *height);
return 0;
}
示例2: D
/* common */
static void *qpa_audio_init (void)
{
void* result = NULL;
D("%s: entering", __FUNCTION__);
pa_lib = dlopen( "libpulse-simple.so", RTLD_NOW );
if (pa_lib == NULL)
pa_lib = dlopen( "libpulse-simple.so.0", RTLD_NOW );
if (pa_lib == NULL) {
D("could not find libpulse on this system\n");
goto Exit;
}
if (pa_dynlink_init(pa_lib) < 0)
goto Fail;
{
pa_sample_spec ss;
int error;
pa_simple* simple;
ss.format = PA_SAMPLE_U8;
ss.rate = 44100;
ss.channels = 1;
/* try to open it for playback */
simple = FF(pa_simple_new) (
conf.server,
"qemu",
PA_STREAM_PLAYBACK,
conf.sink,
"pcm.playback",
&ss,
NULL, /* channel map */
NULL, /* buffering attributes */
&error
);
if (simple == NULL) {
D("%s: error opening open pulse audio library: %s",
__FUNCTION__, FF(pa_strerror)(error));
goto Fail;
}
FF(pa_simple_free)(simple);
}
result = &conf;
goto Exit;
Fail:
D("%s: failed to open library\n", __FUNCTION__);
dlclose(pa_lib);
Exit:
D("%s: exiting", __FUNCTION__);
return result;
}
示例3: configure_filtergraph
void configure_filtergraph(
AVFilterGraph& graph,
const std::string& filtergraph,
AVFilterContext& source_ctx,
AVFilterContext& sink_ctx)
{
AVFilterInOut* outputs = nullptr;
AVFilterInOut* inputs = nullptr;
try
{
if(!filtergraph.empty())
{
outputs = avfilter_inout_alloc();
inputs = avfilter_inout_alloc();
CASPAR_VERIFY(outputs && inputs);
outputs->name = av_strdup("in");
outputs->filter_ctx = &source_ctx;
outputs->pad_idx = 0;
outputs->next = nullptr;
inputs->name = av_strdup("out");
inputs->filter_ctx = &sink_ctx;
inputs->pad_idx = 0;
inputs->next = nullptr;
FF(avfilter_graph_parse(
&graph,
filtergraph.c_str(),
inputs,
outputs,
nullptr));
}
else
{
FF(avfilter_link(
&source_ctx,
0,
&sink_ctx,
0));
}
FF(avfilter_graph_config(
&graph,
nullptr));
}
catch(...)
{
avfilter_inout_free(&outputs);
avfilter_inout_free(&inputs);
throw;
}
}
示例4: qpa_init_in
static int qpa_init_in (HWVoiceIn *hw, struct audsettings *as)
{
int error;
static pa_sample_spec ss;
struct audsettings obt_as = *as;
PAVoiceIn *pa = (PAVoiceIn *) hw;
ss.format = audfmt_to_pa (as->fmt, as->endianness);
ss.channels = as->nchannels;
ss.rate = as->freq;
obt_as.fmt = pa_to_audfmt (ss.format, &obt_as.endianness);
pa->s = FF(pa_simple_new) (
conf.server,
"qemu",
PA_STREAM_RECORD,
conf.source,
"pcm.capture",
&ss,
NULL, /* channel map */
NULL, /* buffering attributes */
&error
);
if (!pa->s) {
qpa_logerr (error, "pa_simple_new for capture failed\n");
goto fail1;
}
audio_pcm_init_info (&hw->info, &obt_as);
hw->samples = conf.samples;
pa->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift);
if (!pa->pcm_buf) {
dolog ("Could not allocate buffer (%d bytes)\n",
hw->samples << hw->info.shift);
goto fail2;
}
if (audio_pt_init (&pa->pt, qpa_thread_in, hw, AUDIO_CAP, AUDIO_FUNC)) {
goto fail3;
}
return 0;
fail3:
qemu_free (pa->pcm_buf);
pa->pcm_buf = NULL;
fail2:
FF(pa_simple_free) (pa->s);
pa->s = NULL;
fail1:
return -1;
}
示例5: re_init_frac
void re_init_frac(t_mlx *f)
{
FF(coef) = 0.78;
FF(zoom) = 0;
FF(r) = 5;
FF(g) = 10;
FF(b) = 5;
if (ft_strcmp(f->name, "Mandelbrot") == 0)
ini_mandelbrot(f);
else if (ft_strcmp(f->name, "Julia") == 0)
ini_julia(f);
else if (ft_strcmp(f->name, "Burning-Ship") == 0)
ini_burning(f);
}
示例6: get_monitor_resolution
int
get_monitor_resolution( int *px_dpi, int *py_dpi )
{
SDL_SysWMinfo info;
Display* display;
int screen;
int width, width_mm, height, height_mm, xdpi, ydpi;
SDL_VERSION(&info.version);
if ( !SDL_GetWMInfo(&info) ) {
D( "%s: SDL_GetWMInfo() failed: %s", __FUNCTION__, SDL_GetError());
return -1;
}
if (x11_lib_init() < 0)
return -1;
display = info.info.x11.display;
screen = FF(XDefaultScreen)(display);
width = FF(XDisplayWidth)(display, screen);
width_mm = FF(XDisplayWidthMM)(display, screen);
height = FF(XDisplayHeight)(display, screen);
height_mm = FF(XDisplayHeightMM)(display, screen);
if (width_mm <= 0 || height_mm <= 0) {
D( "%s: bad screen dimensions: width_mm = %d, height_mm = %d",
__FUNCTION__, width_mm, height_mm);
return -1;
}
D( "%s: found screen width=%d height=%d width_mm=%d height_mm=%d",
__FUNCTION__, width, height, width_mm, height_mm );
xdpi = width * MM_PER_INCH / width_mm;
ydpi = height * MM_PER_INCH / height_mm;
if (xdpi < 20 || xdpi > 400 || ydpi < 20 || ydpi > 400) {
D( "%s: bad resolution: xpi=%d ydpi=%d", __FUNCTION__,
xdpi, ydpi );
return -1;
}
*px_dpi = xdpi;
*py_dpi = ydpi;
return 0;
}
示例7: init_env
void init_env(t_mlx *f)
{
f->wid = WID;
f->hig = HIG;
FF(r) = 5;
FF(g) = 10;
FF(b) = 5;
FF(zoom) = 0;
f->crt_img = 0;
FF(julia) = 1;
f->motion = 0;
f->mlx = mlx_init();
f->win = mlx_new_window(f->mlx, f->wid, f->hig, f->name);
ini_img(f);
}
示例8: FF
void TFfGGen::GenFFGraphs(const double& FProb, const double& BProb, const TStr& FNm) {
const int NRuns = 10;
const int NNodes = 10000;
TGStat::NDiamRuns = 10;
//const double FProb = 0.35, BProb = 0.20; // ff1
//const double FProb = 0.37, BProb = 0.32; // ff2
//const double FProb = 0.37, BProb = 0.325; // ff22
//const double FProb = 0.37, BProb = 0.33; // ff3
//const double FProb = 0.37, BProb = 0.35; // ff4
//const double FProb = 0.38, BProb = 0.35; // ff5
TVec<PGStatVec> GAtTmV;
TFfGGen FF(false, 1, FProb, BProb, 1.0, 0, 0);
for (int r = 0; r < NRuns; r++) {
PGStatVec GV = TGStatVec::New(tmuNodes, TGStat::AllStat());
FF.GenGraph(NNodes, GV, true);
for (int i = 0; i < GV->Len(); i++) {
if (i == GAtTmV.Len()) {
GAtTmV.Add(TGStatVec::New(tmuNodes, TGStat::AllStat()));
}
GAtTmV[i]->Add(GV->At(i));
}
IAssert(GAtTmV.Len() == GV->Len());
}
PGStatVec AvgStat = TGStatVec::New(tmuNodes, TGStat::AllStat());
for (int i = 0; i < GAtTmV.Len(); i++) {
AvgStat->Add(GAtTmV[i]->GetAvgGStat(false));
}
AvgStat->PlotAllVsX(gsvNodes, FNm, TStr::Fmt("Forest Fire: F:%g B:%g (%d runs)", FProb, BProb, NRuns));
AvgStat->Last()->PlotAll(FNm, TStr::Fmt("Forest Fire: F:%g B:%g (%d runs)", FProb, BProb, NRuns));
}
示例9: load_calibration_file
void load_calibration_file(int N) {
QString path=QString("%1/isosplit_calibration_%2.txt").arg(s_calibration_dir).arg(N);
QFile FF(path);
if (FF.open(QFile::ReadOnly|QFile::Text)) {
QString txt=QString(FF.readAll());
FF.close();
QList<QString> lines=txt.split("\n");
if (lines.count()>10) {
calibration_file CF;
CF.curve_len=lines[0].toInt();
CF.num_trials=lines[1].toInt();
for (int j=0; j<CF.curve_len; j++) {
QString line=lines.value(2+j);
QList<QString> tmp=line.split(",");
if (tmp.count()!=2) return;
CF.avg << tmp.value(0).toDouble();
CF.stdev << tmp.value(1).toDouble();
}
for (int j=0; j<CF.num_trials; j++) {
QString line=lines.value(2+CF.curve_len+j);
CF.scores << line.toDouble();
}
s_calibration_files[N]=CF;
}
else return;
}
}
示例10: D
/* common */
static void *qesd_audio_init (void)
{
void* result = NULL;
D("%s: entering", __FUNCTION__);
if (esd_lib == NULL) {
int fd;
esd_lib = dlopen( "libesd.so", RTLD_NOW );
if (esd_lib == NULL)
esd_lib = dlopen( "libesd.so.0", RTLD_NOW );
if (esd_lib == NULL) {
D("could not find libesd on this system");
goto Exit;
}
if (esd_dynlink_init(esd_lib) < 0)
goto Fail;
fd = FF(esd_open_sound)(conf.dac_host);
if (fd < 0) {
D("%s: could not open direct sound server connection, trying localhost",
__FUNCTION__);
fd = FF(esd_open_sound)("localhost");
if (fd < 0) {
D("%s: could not open localhost sound server connection", __FUNCTION__);
goto Fail;
}
}
D("%s: EsounD server connection succeeded", __FUNCTION__);
/* FF(esd_close)(fd); */
}
result = &conf;
goto Exit;
Fail:
D("%s: failed to open library", __FUNCTION__);
dlclose(esd_lib);
esd_lib = NULL;
Exit:
return result;
}
示例11: read_text_file
QString read_text_file(QString path) {
QFile FF(path);
if (!FF.open(QFile::Text|QFile::ReadOnly)) {
return "";
}
QString ret=QString(FF.readAll());
FF.close();
return ret;
}
示例12: push
void push(const std::shared_ptr<AVFrame>& frame)
{
if (fast_path())
fast_path_.push(frame);
else
FF(av_buffersrc_add_frame(
video_graph_in_,
frame.get()));
}
示例13: main
int main()
{
#ifndef ONLINE_JUDGE
freopen("in.txt","r",stdin);
// freopen("textout.txt", "w", stdout);
#endif
while(scanf("%d %d",&n,&m)!=EOF){
int num11=0,num10=0,num01=0,num00=0;
for(i=0;i<n;i++)
for(j=0;j<m;j++){
scanf("%s",f[i][j].a);
if(f[i][j].a[0]=='1' && f[i][j].a[1]=='1') num11++;
else if(f[i][j].a[0]=='1' && f[i][j].a[1]=='0') num10++;
else if(f[i][j].a[0]=='0' && f[i][j].a[1]=='1') num01++;
else num00++;
}
i=1;j=1;flag=1;
FF(num11,"11");
//FF(num10,i,j,flag,"10");
//FF(num01,i,j,flag,"01");
int ii,jj;num10=num10+num01;
char aa[3]="10",bb[3]="01";
ii=i;jj=j;
while(num10--){
if(num10==-1) break;
if(ii==1 || f[ii-1][jj].a[0]=='0' ||(f[ii-1][jj].a[0]=='1' && f[ii-1][jj].a[1]=='1') )
strcpy(f[ii][jj].a,aa);
else strcpy(f[ii][jj].a,bb);
if(flag==1){
jj++;
if(jj==(m+1)){ii++;jj=m;flag=2;}
}
else{
jj--;
if(jj==0){ii++;jj=1;flag=1;}
}
}
i=ii;j=jj;
FF(num00,"00");
Print();
}
return 0;
}
示例14: GCC_FMT_ATTR
static void GCC_FMT_ATTR (2, 3) qpa_logerr (int err, const char *fmt, ...)
{
va_list ap;
va_start (ap, fmt);
AUD_vlog (AUDIO_CAP, fmt, ap);
va_end (ap);
AUD_log (AUDIO_CAP, "Reason: %s\n", FF(pa_strerror) (err));
}
示例15: FF
void FF(int i,int j)
{
int k;
for(k=0;k<4;k++)
if( !(map[i][j] & wall[k]) && !room[i+dir[k][0]][j+dir[k][1]]){
room[i+dir[k][0]][j+dir[k][1]]=num;
count[num]++;
FF(i+dir[k][0],j+dir[k][1]);
}
}