• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ output函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中output函数的典型用法代码示例。如果您正苦于以下问题:C++ output函数的具体用法?C++ output怎么用?C++ output使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了output函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: output

string CCJSONArray::toString() {
    CCMemoryOutputStream mos;
    output(&mos);
    return string(mos.getBuffer(), mos.getLength());
}
开发者ID:GreatFireWall,项目名称:cocos2dx-better,代码行数:5,代码来源:CCJSONArray.cpp


示例2: ngx_http_image_handler

static ngx_int_t ngx_http_image_handler(ngx_http_request_t *r)
{
	u_char                    *last;
	size_t                     root;
	ngx_int_t                  rc;
	ngx_str_t                  path;
	char                       request_uri[255];
	int                        request_uri_len;
	ngx_image_conf_t  *conf;
	conf = ngx_http_get_module_loc_conf(r, ngx_http_image_module);
	if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD)))
	{
		return NGX_HTTP_NOT_ALLOWED;
	}
	if (r->headers_in.if_modified_since)
	{
		return NGX_HTTP_NOT_MODIFIED;
	}

	if (r->uri.data[r->uri.len - 1] == '/')
	{
		return NGX_DECLINED;
	}

	rc = ngx_http_discard_request_body(r);
	if (rc != NGX_OK)
	{
		return rc;
	}
	last = ngx_http_map_uri_to_path(r, &path, &root, 0);
	if (last == NULL)
	{
		return NGX_HTTP_INTERNAL_SERVER_ERROR;
	}
	if(file_exists((char*) path.data) == -1)
	{
		request_uri_len = strlen((char *)r->uri_start) - strlen((char *)r->uri_end);
		strncpy(request_uri, (char *)r->uri_start, request_uri_len);
		request_uri[request_uri_len] = '\0';
		conf->request_dir = dirname(request_uri);
		conf->url = request_uri;//请求的URL地址
		conf->dest_file = (char *)path.data;
		check_image_type(conf);//检查图片类型(根据后缀进行简单判断)
		if( conf->dest_type > 0 )
		{

			if (parse_image_info(conf) == 0)//解析并处理请求的图片URL
			{

				make_thumb(conf);//生成图片缩略图
				water_mark(conf);//图片打上水印
				thumb_to_string(conf);//GD对象转换成二进制字符串
				if(conf->image_output == 0)
				{
					write_img(conf);//保存图片缩略图到文件
				}
				if(conf->src_im != NULL){
					gdImageDestroy(conf->src_im);
				}
				if(conf->dst_im != NULL)
				{
					gdImageDestroy(conf->dst_im);
				}
				if(conf->water_im != NULL)
				{
					gdImageDestroy(info->water_im);
				}
				if(conf->w_margin > 0 && conf->w_im != NULL)
				{
			        	gdImageDestroy(conf->w_im);//释放补白边的对象
				}
				if(conf->image_output == 1)
				{
					return output(r,conf,ngx_http_image_types[conf->dest_type]);
				}
			}
		}
	}
	return NGX_DECLINED;
}
开发者ID:bignuctsl,项目名称:ngx_image_thumb,代码行数:80,代码来源:ngx_http_image_module.c


示例3: MPreFixups

le_int32 IndicReordering::reorder(const LEUnicode *chars, le_int32 charCount, le_int32 scriptCode,
                                  LEUnicode *outChars, LEGlyphStorage &glyphStorage,
                                  MPreFixups **outMPreFixups, LEErrorCode& success)
{
    if (LE_FAILURE(success)) {
        return 0;
    }

    MPreFixups *mpreFixups = NULL;
    const IndicClassTable *classTable = IndicClassTable::getScriptClassTable(scriptCode);

    if (classTable==NULL) {
        success = LE_INTERNAL_ERROR;
        return 0;
    }

    if (classTable->scriptFlags & SF_MPRE_FIXUP) {
        mpreFixups = new MPreFixups(charCount);
        if (mpreFixups == NULL) { 
            success = LE_MEMORY_ALLOCATION_ERROR;
            return 0;
        }
    }

    IndicReorderingOutput output(outChars, glyphStorage, mpreFixups);
    le_int32 i, prev = 0;
    le_bool lastInWord = FALSE;

    while (prev < charCount) {
        le_int32 syllable = findSyllable(classTable, chars, prev, charCount);
        le_int32 matra, markStart = syllable;

        output.reset();
        
        if (classTable->isStressMark(chars[markStart - 1])) {
            markStart -= 1;
            output.noteStressMark(classTable, chars[markStart], markStart, tagArray1);
        }
        
        if (markStart != prev && classTable->isVowelModifier(chars[markStart - 1])) {
            markStart -= 1;
            output.noteVowelModifier(classTable, chars[markStart], markStart, tagArray1);
        }

        matra = markStart - 1;

        while (output.noteMatra(classTable, chars[matra], matra, tagArray1, !lastInWord) && matra != prev) {
            matra -= 1;
        }

        lastInWord = TRUE;

        switch (classTable->getCharClass(chars[prev]) & CF_CLASS_MASK) {
        case CC_RESERVED:
            lastInWord = FALSE;
            /* fall through */

        case CC_INDEPENDENT_VOWEL:
        case CC_ZERO_WIDTH_MARK:
            for (i = prev; i < syllable; i += 1) {
                output.writeChar(chars[i], i, tagArray1);
            }

            break;

        case CC_AL_LAKUNA:
        case CC_NUKTA:
            output.writeChar(C_DOTTED_CIRCLE, prev, tagArray1);
            output.writeChar(chars[prev], prev, tagArray1);
            break;

        case CC_VIRAMA:
            // A lone virama is illegal unless it follows a
            // MALAYALAM_VOWEL_SIGN_U. Such a usage is called
            // "samvruthokaram".
            if (chars[prev - 1] != C_MALAYALAM_VOWEL_SIGN_U) {
                output.writeChar(C_DOTTED_CIRCLE, prev, tagArray1);
            }

            output.writeChar(chars[prev], prev, tagArray1);
            break;

        case CC_DEPENDENT_VOWEL:
        case CC_SPLIT_VOWEL_PIECE_1:
        case CC_SPLIT_VOWEL_PIECE_2:
        case CC_SPLIT_VOWEL_PIECE_3:
        case CC_VOWEL_MODIFIER:
        case CC_STRESS_MARK:
            output.writeMpre();

            output.writeChar(C_DOTTED_CIRCLE, prev, tagArray1);

            output.writeMbelow();
            output.writeSMbelow();
            output.writeMabove();

            if ((classTable->scriptFlags & SF_MATRAS_AFTER_BASE) != 0) {
                output.writeMpost();
            }

//.........这里部分代码省略.........
开发者ID:LocutusOfBorg,项目名称:poedit,代码行数:101,代码来源:IndicReordering.cpp


示例4: ip6_fragment

int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
{
	struct sk_buff *frag;
	struct rt6_info *rt = (struct rt6_info*)skb_dst(skb);
	struct ipv6_pinfo *np = skb->sk ? inet6_sk(skb->sk) : NULL;
	struct ipv6hdr *tmp_hdr;
	struct frag_hdr *fh;
	unsigned int mtu, hlen, left, len;
	int hroom, troom;
	__be32 frag_id = 0;
	int ptr, offset = 0, err=0;
	u8 *prevhdr, nexthdr = 0;
	struct net *net = dev_net(skb_dst(skb)->dev);

	hlen = ip6_find_1stfragopt(skb, &prevhdr);
	nexthdr = *prevhdr;

	mtu = ip6_skb_dst_mtu(skb);

	/* We must not fragment if the socket is set to force MTU discovery
	 * or if the skb it not generated by a local socket.
	 */
	if (unlikely(!skb->local_df && skb->len > mtu) ||
		     (IP6CB(skb)->frag_max_size &&
		      IP6CB(skb)->frag_max_size > mtu)) {
		if (skb->sk && dst_allfrag(skb_dst(skb)))
			sk_nocaps_add(skb->sk, NETIF_F_GSO_MASK);

		skb->dev = skb_dst(skb)->dev;
		icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
		IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
			      IPSTATS_MIB_FRAGFAILS);
		kfree_skb(skb);
		return -EMSGSIZE;
	}

	if (np && np->frag_size < mtu) {
		if (np->frag_size)
			mtu = np->frag_size;
	}
	mtu -= hlen + sizeof(struct frag_hdr);

	if (skb_has_frag_list(skb)) {
		int first_len = skb_pagelen(skb);
		struct sk_buff *frag2;

		if (first_len - hlen > mtu ||
		    ((first_len - hlen) & 7) ||
		    skb_cloned(skb))
			goto slow_path;

		skb_walk_frags(skb, frag) {
			/* Correct geometry. */
			if (frag->len > mtu ||
			    ((frag->len & 7) && frag->next) ||
			    skb_headroom(frag) < hlen)
				goto slow_path_clean;

			/* Partially cloned skb? */
			if (skb_shared(frag))
				goto slow_path_clean;

			BUG_ON(frag->sk);
			if (skb->sk) {
				frag->sk = skb->sk;
				frag->destructor = sock_wfree;
			}
			skb->truesize -= frag->truesize;
		}

		err = 0;
		offset = 0;
		frag = skb_shinfo(skb)->frag_list;
		skb_frag_list_init(skb);
		/* BUILD HEADER */

		*prevhdr = NEXTHDR_FRAGMENT;
		tmp_hdr = kmemdup(skb_network_header(skb), hlen, GFP_ATOMIC);
		if (!tmp_hdr) {
			IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
				      IPSTATS_MIB_FRAGFAILS);
			return -ENOMEM;
		}

		__skb_pull(skb, hlen);
		fh = (struct frag_hdr*)__skb_push(skb, sizeof(struct frag_hdr));
		__skb_push(skb, hlen);
		skb_reset_network_header(skb);
		memcpy(skb_network_header(skb), tmp_hdr, hlen);

		ipv6_select_ident(fh, rt);
		fh->nexthdr = nexthdr;
		fh->reserved = 0;
		fh->frag_off = htons(IP6_MF);
		frag_id = fh->identification;

		first_len = skb_pagelen(skb);
		skb->data_len = first_len - skb_headlen(skb);
		skb->len = first_len;
		ipv6_hdr(skb)->payload_len = htons(first_len -
//.........这里部分代码省略.........
开发者ID:AnadoluPanteri,项目名称:kernel-plus-harmattan,代码行数:101,代码来源:ip6_output.c


示例5: main

int main(void){
	output();
	return 0;
}
开发者ID:alekratz,项目名称:recc,代码行数:4,代码来源:use-local.c


示例6: output

//
// Maya calls this method to have the translator write out a file.
//
MStatus maTranslator::writer(
		const MFileObject& file,
		const MString& /* options */,
		MPxFileTranslator::FileAccessMode mode
)
{
	//
	// For simplicity, we only do full saves/exports.
	//
	if ((mode != kSaveAccessMode) && (mode != kExportAccessMode))
	   	return MS::kNotImplemented;

	//
	// Let's see if we can open the output file.
	//
	fstream	output(file.fullName().asChar(), ios::out | ios::trunc);

	if (!output.good()) return MS::kNotFound;

	//
	// Get some node flags to keep track of those nodes for which we
	// have already done various stages of processing.
	//
	MStatus	status;

	fCreateFlag = MFnDependencyNode::allocateFlag(fPluginName, &status);

	if (status)
		fAttrFlag = MFnDependencyNode::allocateFlag(fPluginName, &status);

	if (status)
		fConnectionFlag = MFnDependencyNode::allocateFlag(fPluginName, &status);

	if (!status)
	{
		MGlobal::displayError(
			"Could not allocate three free node flags."
			"  Try unloading some other plugins."
		);

		return MS::kFailure;
	}

	//
	// Run through all of the nodes in the scene and clear their flags.
	//
	MItDependencyNodes	nodesIter;

	for (; !nodesIter.isDone(); nodesIter.next())
	{
		MObject				node = nodesIter.item();
		MFnDependencyNode	nodeFn(node);

		nodeFn.setFlag(fCreateFlag, false);
		nodeFn.setFlag(fAttrFlag, false);
		nodeFn.setFlag(fConnectionFlag, false);
	}

	//
	// Write out the various sections of the file.
	//
	writeHeader(output, file.name());
	writeFileInfo(output);
	writeReferences(output);
	writeRequirements(output);
	writeUnits(output);
	writeDagNodes(output);
	writeNonDagNodes(output);
	writeDefaultNodes(output);
	writeReferenceNodes(output);
	writeConnections(output);
	writeFooter(output, file.name());

	output.close();

	MFnDependencyNode::deallocateFlag(fPluginName, fCreateFlag);

	return MS::kSuccess;
}
开发者ID:BigRoy,项目名称:Maya-devkit,代码行数:82,代码来源:maTranslator.cpp


示例7: logFileError


//.........这里部分代码省略.........
        {
            result = -1;
        }
#endif
    } else {
        // No config file
#ifndef _WIN32_WCE
        result = system(QFile::encodeName(QString("%1 2> %2").arg(cmd, scriptErr.fileName())));
#else
        QString path_ = QDir::convertSeparators ( QFileInfo ( cmd ).absoluteFilePath() );
        QString file_ = QFileInfo ( cmd ).fileName();
        SHELLEXECUTEINFO execInfo;
        memset ( &execInfo,0,sizeof ( execInfo ) );
        execInfo.cbSize = sizeof ( execInfo );
        execInfo.fMask =  SEE_MASK_FLAG_NO_UI;
        execInfo.lpVerb = L"open";
        execInfo.lpFile = (LPCWSTR) path_.utf16();
        execInfo.lpDirectory = (LPCWSTR) file_.utf16();
        execInfo.lpParameters = (LPCWSTR) QString(" 2> %1").arg( scriptErr.fileName()).utf16();
        result = ShellExecuteEx ( &execInfo );
        if (result != 0)
        {
            result = 0;
        }
        else
        {
            result = -1;
        }
#endif
    }

    // Copy script stderr to log file
    {
        QFile output(scriptErr.fileName());
        if (output.open(QIODevice::ReadOnly)) {
            QTextStream ts(&output);
            ts.setCodec(QTextCodec::codecForName("UTF-8"));
            while (!ts.atEnd()) {
                QString line = ts.readLine();
                log() << "[Script] " << line << endl;
            }
        }
    }

    if (result) {
        log() << m_currentFilename << ": !! An error occurred while running '" << cmd << "'" << endl;
        return;
    }

    if (!m_oldConfig1) {
        return; // Nothing to merge
    }

    if (m_debug) {
        scriptOut.setAutoRemove(false);
        log() << "Script output stored in " << scriptOut.fileName() << endl;
    }

    // Deleting old entries
    {
        QStringList group = m_oldGroup;
        QFile output(scriptOut.fileName());
        if (output.open(QIODevice::ReadOnly)) {
            QTextStream ts(&output);
            ts.setCodec(QTextCodec::codecForName("UTF-8"));
            while (!ts.atEnd()) {
开发者ID:vasi,项目名称:kdelibs,代码行数:67,代码来源:kconf_update.cpp


示例8: main


//.........这里部分代码省略.........
			ungetc(c, fp_restore);

		if (fgetc(fp_restore) == 'x') 
		{
			fscanf(fp_restore, "%lf %lf\n", &lower, &upper);
			while(fscanf(fp_restore,"%d %lf %lf\n",&idx,&fmin,&fmax)==3)
			{
				for(i = next_index;i<idx;i++)
					if(feature_min[i] != feature_max[i])
						fprintf(stderr,
							"WARNING: feature index %d appeared in file %s was not seen in the scaling factor file %s.\n",
							i, argv[argc-1], restore_filename);

				feature_min[idx] = fmin;
				feature_max[idx] = fmax;

				next_index = idx + 1;
			}
			
			for(i=next_index;i<=max_index;i++)
				if(feature_min[i] != feature_max[i])
					fprintf(stderr,
						"WARNING: feature index %d appeared in file %s was not seen in the scaling factor file %s.\n",
						i, argv[argc-1], restore_filename);
		}
		fclose(fp_restore);
	}

	if(save_filename)
	{
		FILE *fp_save = fopen(save_filename,"w");
		if(fp_save==NULL)
		{
			fprintf(stderr,"can't open file %s\n", save_filename);
			exit(1);
		}
		if(y_scaling)
		{
			fprintf(fp_save, "y\n");
			fprintf(fp_save, "%.16g %.16g\n", y_lower, y_upper);
			fprintf(fp_save, "%.16g %.16g\n", y_min, y_max);
		}
		fprintf(fp_save, "x\n");
		fprintf(fp_save, "%.16g %.16g\n", lower, upper);
		for(i=1;i<=max_index;i++)
		{
			if(feature_min[i]!=feature_max[i])
				fprintf(fp_save,"%d %.16g %.16g\n",i,feature_min[i],feature_max[i]);
		}

		if(min_index < 1)
			fprintf(stderr,
				"WARNING: scaling factors with indices smaller than 1 are not stored to the file %s.\n", save_filename);

		fclose(fp_save);
	}
	
	
	while(readline(fp)!=NULL)
	{
		char *p=line;
		int next_index=1;
		double target;
		double value;
		
		sscanf(p,"%lf",&target);
		output_target(target);

		SKIP_TARGET

		while(sscanf(p,"%d:%lf",&index,&value)==2)
		{
			for(i=next_index;i<index;i++)
				output(i,0);
			
			output(index,value);

			SKIP_ELEMENT
			next_index=index+1;
		}		

		for(i=next_index;i<=max_index;i++)
			output(i,0);

		printf("\n");
	}

	if (new_num_nonzeros > num_nonzeros)
		fprintf(stderr, 
			"WARNING: original #nonzeros %ld\n"
			"         new      #nonzeros %ld\n"
			"Use -l 0 if many original feature values are zeros\n",
			num_nonzeros, new_num_nonzeros);

	free(line);
	free(feature_max);
	free(feature_min);
	fclose(fp);
	return 0;
}
开发者ID:HopHill,项目名称:Quantitive-Investing,代码行数:101,代码来源:svm-scale.c


示例9: open_if_block

void
open_if_block (const char *c_cond)
{
	output ("if (%s)", c_cond);
	block_begin ();
}
开发者ID:Dmilo,项目名称:freewpc,代码行数:6,代码来源:dmdcc.c


示例10: block_end

void
block_end (void)
{
	adjust_indent (-3);
	output ("}");
}
开发者ID:Dmilo,项目名称:freewpc,代码行数:6,代码来源:dmdcc.c


示例11: block_begin

void
block_begin (void)
{
	output ("{");
	adjust_indent (+3);
}
开发者ID:Dmilo,项目名称:freewpc,代码行数:6,代码来源:dmdcc.c


示例12: start_i2c

static void start_i2c(void)
{
	output(1, 1, 0); usleep(1000); // stopped (SCL = 1, SDA = 1)
	output(1, 0, 0); usleep(1000); // running (SCL = 0)
}
开发者ID:jnerin,项目名称:vt6307ohciver,代码行数:5,代码来源:vt6307ohciver.c


示例13: main

int main(int argc, char * argv[])
{
	pid_t child;
	
	
	pthread_mutex_t  mtx;
	pthread_mutexattr_t ma[4];
	pthread_mutexattr_t *pma[5];
	
	int ret=0;
	int i;
	int retini[5] = {-1,-1,-1,-1,-1};
	int retdtr[5]= {-1,-1,-1,-1,-1};
	
	void * ptr, *ptr_prev=NULL;
	
	int sz = 0;
	struct rlimit rl;
	
	int status=0;
	
	output_init();

	child = fork();
	
	if (child == (pid_t)-1)
	{ UNRESOLVED(errno, "Fork failed"); }
	
	if (child != 0) /* We are the father */
	{
		if (child != waitpid(child, &status, 0))
		{  UNRESOLVED(errno, "Waitpid failed"); }

		if (WIFSIGNALED(status))
		{ UNRESOLVED(WTERMSIG(status), 
			"The child process was killed."); }

		if (WIFEXITED(status))
			return WEXITSTATUS(status);
		
		UNRESOLVED(0, "Child process neither returned nor was killed.");
	}
	
	/* Only the child goes further */
	
	/* We initialize the different mutex attributes */
	for (i=0; (i<4) && (ret == 0); i++)
	{
		pma[i] = &ma[i];
		ret = pthread_mutexattr_init(pma[i]);
	}
	if (ret)
	{ UNRESOLVED(ret, "Mutex attribute init failed"); }
	pma[4] = (pthread_mutexattr_t *) NULL;
	
	if ((ret = pthread_mutexattr_settype(pma[0], PTHREAD_MUTEX_NORMAL)))
	{ UNRESOLVED(ret, "Mutex attribute NORMAL failed"); }
	if ((ret = pthread_mutexattr_settype(pma[0], PTHREAD_MUTEX_DEFAULT)))
	{ UNRESOLVED(ret, "Mutex attribute DEFAULT failed"); }
	if ((ret = pthread_mutexattr_settype(pma[0], PTHREAD_MUTEX_RECURSIVE)))
	{ UNRESOLVED(ret, "Mutex attribute RECURSIVE failed"); }
	if ((ret = pthread_mutexattr_settype(pma[0], PTHREAD_MUTEX_ERRORCHECK)))
	{ UNRESOLVED(ret, "Mutex attribute ERRORCHECK failed"); }
	
	sz = sysconf(_SC_PAGESIZE);
	
	
	/* Limit the process memory to a small value (64Mb for example). */
	rl.rlim_max=1024*1024*64;
	rl.rlim_cur=1024*1024*64;
	if ((ret = setrlimit(RLIMIT_AS,  &rl)))
	{ UNRESOLVED(ret, "Memory limitation failed"); }


	#if VERBOSE > 1
	output("Ready to take over memory. Page size is %d\n", sz);
	#endif
	
	/* Allocate all available memory */
	while (1)
	{
		ptr = malloc( sz ); /* Allocate one page of memory */
		if (ptr == NULL)
			break;
		#if VERBOSE > 1
		ret++;
		#endif
		*(void **)ptr = ptr_prev; /* Write into the allocated page */
		ptr_prev = ptr;
	}
	#if VERBOSE > 1
	output("%d pages were allocated before failure\n", ret);
	ret = 0;
	#endif
	
	while (1)
	{
		ptr = malloc( sizeof(void*) ); /* Allocate every remaining bits of memory */
		if (ptr == NULL)
			break;
//.........这里部分代码省略.........
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:101,代码来源:5-1.c


示例14: send_bit_i2c

static void send_bit_i2c(uint32_t v)
{
	output(1, 0, v); usleep(100); // running (SCL = 0)
	output(1, 1, v); usleep(100);
	output(1, 0, v); usleep(100); // running (SCL = 0)
}
开发者ID:jnerin,项目名称:vt6307ohciver,代码行数:6,代码来源:vt6307ohciver.c


示例15: output

    ~MP4FileStream()
    {
        if(!bStreamOpened)
            return;

        App->EnableSceneSwitching(false);

        //---------------------------------------------------

        //HWND hwndProgressDialog = CreateDialog(hinstMain, MAKEINTRESOURCE(IDD_BUILDINGMP4), hwndMain, (DLGPROC)MP4ProgressDialogProc);
        //SendMessage(GetDlgItem(hwndProgressDialog, IDC_PROGRESS1), PBM_SETRANGE32, 0, 100);

        mdatStop = fileOut.GetPos();

        BufferOutputSerializer output(endBuffer);

        UINT64 audioFrameSize = App->GetAudioEncoder()->GetFrameSize();

        DWORD macTime = fastHtonl(DWORD(GetMacTime()));
        UINT videoDuration = fastHtonl(lastVideoTimestamp + App->GetFrameTime());
        UINT audioDuration = fastHtonl(lastVideoTimestamp + DWORD(double(audioFrameSize)/44.1));
        UINT width, height;
        App->GetOutputSize(width, height);

        LPCSTR lpVideoTrack = "Video Media Handler";
        LPCSTR lpAudioTrack = "Sound Media Handler";

        char videoCompressionName[31] = "AVC Coding";

        //-------------------------------------------
        // get video headers
        DataPacket videoHeaders;
        App->GetVideoHeaders(videoHeaders);
        List<BYTE> SPS, PPS;

        LPBYTE lpHeaderData = videoHeaders.lpPacket+11;
        SPS.CopyArray(lpHeaderData+2, fastHtons(*(WORD*)lpHeaderData));

        lpHeaderData += SPS.Num()+3;
        PPS.CopyArray(lpHeaderData+2, fastHtons(*(WORD*)lpHeaderData));

        //-------------------------------------------
        // get AAC headers if using AAC
        List<BYTE> AACHeader;
        if(!bMP3)
        {
            DataPacket data;
            App->GetAudioHeaders(data);
            AACHeader.CopyArray(data.lpPacket+2, data.size-2);
        }

        //-------------------------------------------

        EndChunkInfo(videoChunks, videoSampleToChunk, curVideoChunkOffset, numVideoSamples);
        EndChunkInfo(audioChunks, audioSampleToChunk, curAudioChunkOffset, numAudioSamples);

        if (numVideoSamples > 1)
            GetVideoDecodeTime(videoFrames.Last(), true);

        if (numAudioSamples > 1)
            GetAudioDecodeTime(audioFrames.Last(), true);

        UINT audioUnitDuration = fastHtonl(UINT(lastAudioTimeVal));

        //SendMessage(GetDlgItem(hwndProgressDialog, IDC_PROGRESS1), PBM_SETPOS, 25, 0);

        //-------------------------------------------
        // sound descriptor thingy.  this part made me die a little inside admittedly.
        UINT maxBitRate = fastHtonl(App->GetAudioEncoder()->GetBitRate()*1000);

        List<BYTE> esDecoderDescriptor;
        BufferOutputSerializer esDecoderOut(esDecoderDescriptor);
        esDecoderOut.OutputByte(bMP3 ? 107 : 64);
        esDecoderOut.OutputByte(0x15); //stream/type flags.  always 0x15 for my purposes.
        esDecoderOut.OutputByte(0); //buffer size, just set it to 1536 for both mp3 and aac
        esDecoderOut.OutputWord(WORD_BE(0x600)); 
        esDecoderOut.OutputDword(maxBitRate); //max bit rate (cue bill 'o reily meme for these two)
        esDecoderOut.OutputDword(maxBitRate); //avg bit rate

        if(!bMP3) //if AAC, put in headers
        {
            esDecoderOut.OutputByte(0x5);  //decoder specific descriptor type
            /*esDecoderOut.OutputByte(0x80); //some stuff that no one should probably care about
            esDecoderOut.OutputByte(0x80);
            esDecoderOut.OutputByte(0x80);*/
            esDecoderOut.OutputByte(AACHeader.Num());
            esDecoderOut.Serialize((LPVOID)AACHeader.Array(), AACHeader.Num());
        }


        List<BYTE> esDescriptor;
        BufferOutputSerializer esOut(esDescriptor);
        esOut.OutputWord(0); //es id
        esOut.OutputByte(0); //stream priority
        esOut.OutputByte(4); //descriptor type
        /*esOut.OutputByte(0x80); //some stuff that no one should probably care about
        esOut.OutputByte(0x80);
        esOut.OutputByte(0x80);*/
        esOut.OutputByte(esDecoderDescriptor.Num());
        esOut.Serialize((LPVOID)esDecoderDescriptor.Array(), esDecoderDescriptor.Num());
//.........这里部分代码省略.........
开发者ID:AaronMike,项目名称:OBS,代码行数:101,代码来源:MP4FileStream.cpp


示例16: stop

static int stop(sox_effect_t * effp)
{
  priv_t * p = (priv_t *)effp->priv;

  if (!effp->flow) {
    double min_runs = 0, max_count = 0, min = 2, max = -2, max_sigma_x = 0, sigma_x = 0, sigma_x2 = 0, min_sigma_x2 = 2, max_sigma_x2 = 0, avg_peak = 0;
    off_t num_samples = 0, min_count = 0, max_runs = 0;
    uint32_t mask = 0;
    unsigned b1, b2, i, n = effp->flows > 1 ? effp->flows : 0;

    for (i = 0; i < effp->flows; ++i) {
      priv_t * q = (priv_t *)(effp - effp->flow + i)->priv;
      min = min(min, q->min);
      max = max(max, q->max);
      min_sigma_x2 = min(min_sigma_x2, q->min_sigma_x2);
      max_sigma_x2 = max(max_sigma_x2, q->max_sigma_x2);
      sigma_x += q->sigma_x;
      sigma_x2 += q->sigma_x2;
      num_samples += q->num_samples;
      mask |= q->mask;
      if (fabs(q->sigma_x) > fabs(max_sigma_x))
        max_sigma_x = q->sigma_x;
      min_count += q->min_count;
      min_runs += q->min_runs;
      max_count += q->max_count;
      max_runs += q->max_runs;
      avg_peak += max(-q->min, q->max);
    }
    avg_peak /= effp->flows;

    if (!num_samples) {
      lsx_warn("no audio");
      return SOX_SUCCESS;
    }

    if (n == 2)
      fprintf(stderr, "             Overall     Left      Right\n");
    else if (n) {
      fprintf(stderr, "             Overall");
      for (i = 0; i < n; ++i)
        fprintf(stderr, "     Ch%-3i", i + 1);
      fprintf(stderr, "\n");
    }

    fprintf(stderr, "DC offset ");
    output(p, max_sigma_x / p->num_samples);
    for (i = 0; i < n; ++i) {
      priv_t * q = (priv_t *)(effp - effp->flow + i)->priv;
      output(p, q->sigma_x / q->num_samples);
    }

    fprintf(stderr, "\nMin level ");
    output(p, min);
    for (i = 0; i < n; ++i) {
      priv_t * q = (priv_t *)(effp - effp->flow + i)->priv;
      output(p, q->min);
    }

    fprintf(stderr, "\nMax level ");
    output(p, max);
    for (i = 0; i < n; ++i) {
      priv_t * q = (priv_t *)(effp - effp->flow + i)->priv;
      output(p, q->max);
    }

    fprintf(stderr, "\nPk lev dB %10.2f", linear_to_dB(max(-min, max)));
    for (i = 0; i < n; ++i) {
      priv_t * q = (priv_t *)(effp - effp->flow + i)->priv;
      fprintf(stderr, "%10.2f", linear_to_dB(max(-q->min, q->max)));
    }

    fprintf(stderr, "\nRMS lev dB%10.2f", linear_to_dB(sqrt(sigma_x2 / num_samples)));
    for (i = 0; i < n; ++i) {
      priv_t * q = (priv_t *)(effp - effp->flow + i)->priv;
      fprintf(stderr, "%10.2f", linear_to_dB(sqrt(q->sigma_x2 / q->num_samples)));
    }

    fprintf(stderr, "\nRMS Pk dB %10.2f", linear_to_dB(sqrt(max_sigma_x2)));
    for (i = 0; i < n; ++i) {
      priv_t * q = (priv_t *)(effp - effp->flow + i)->priv;
      fprintf(stderr, "%10.2f", linear_to_dB(sqrt(q->max_sigma_x2)));
    }

    fprintf(stderr, "\nRMS Tr dB ");
    if (min_sigma_x2 != 1)
      fprintf(stderr, "%10.2f", linear_to_dB(sqrt(min_sigma_x2)));
    else fprintf(stderr, "         -");
    for (i = 0; i < n; ++i) {
      priv_t * q = (priv_t *)(effp - effp->flow + i)->priv;
      if (q->min_sigma_x2 != 1)
        fprintf(stderr, "%10.2f", linear_to_dB(sqrt(q->min_sigma_x2)));
      else fprintf(stderr, "         -");
    }

    if (effp->flows > 1)
      fprintf(stderr, "\nCrest factor       -");
    else fprintf(stderr, "\nCrest factor %7.2f", sigma_x2 ? avg_peak / sqrt(sigma_x2 / num_samples) : 1);
    for (i = 0; i < n; ++i) {
      priv_t * q = (priv_t *)(effp - effp->flow + i)->priv;
      fprintf(stderr, "%10.2f", q->sigma_x2? max(-q->min, q->max) / sqrt(q->sigma_x2 / q->num_samples) : 1);
//.........这里部分代码省略.........
开发者ID:Amalerd,项目名称:SoxPlayer,代码行数:101,代码来源:stats.c


示例17: main

int
main(int argc, char **argv)
{
     int index;
     int status = EX_OK;
     
     set_program_name(argv[0]);
     argp_version_setup("cflow", program_authors);
     
     setlocale(LC_ALL, "");
     bindtextdomain(PACKAGE, LOCALEDIR);
     textdomain(PACKAGE);
     
     register_output("gnu", gnu_output_handler, NULL);
     register_output("posix", posix_output_handler, NULL);

     symbol_map = SM_FUNCTIONS|SM_STATIC|SM_UNDEFINED;

     if (getenv("POSIXLY_CORRECT")) {
	  if (select_output_driver("posix")) {
	       error(0, 0, _("INTERNAL ERROR: %s: No such output driver"),
		     "posix");
	       abort();
	  }
	  output_init();
     }
     
     sourcerc(&argc, &argv);
     if (argp_parse(&argp, argc, argv, ARGP_IN_ORDER, &index, NULL))
	  exit(EX_USAGE);

     if (print_option == 0)
	  print_option = PRINT_TREE;

     init();

     if (arglist) {
	  struct linked_list_entry *p;

	  for (p = arglist->head; p; p = p->next) {
	       char *s = (char*)p->data;
	       if (s[0] == '-')
		    pp_option(s);
	       else if (source(s) == 0)
		    yyparse();
	  }
     }
     
     argc -= index;
     argv += index;

     while (argc--) {
	  if (source(*argv++) == 0)
	       yyparse();
	  else
	       status = EX_SOFT;
     }

     if (input_file_count == 0)
	     error(EX_USAGE, 0, _("no input files"));

     output();
     return status;
}
开发者ID:lamproae,项目名称:cflow,代码行数:64,代码来源:main.c


示例18: assert

bool CSteadyStateTask::process(const bool & useInitialValues)
{
  if (useInitialValues)
    {
      mpContainer->applyInitialValues();
    }

  mSteadyState = mpContainer->getState(true);

  // A steady-state makes only sense in an autonomous model,
  // i.e., the time of the steady-state must not be changed
  // during simulation.
  C_FLOAT64 InitialTime = mSteadyState[mpContainer->getCountFixedEventTargets()];

  CSteadyStateMethod* pMethod =
    dynamic_cast<CSteadyStateMethod *>(mpMethod);
  assert(pMethod);

  CSteadyStateProblem* pProblem =
    dynamic_cast<CSteadyStateProblem *>(mpProblem);
  assert(pMethod);

  output(COutputInterface::BEFORE);

  //call the method
  mResult = pMethod->process(mSteadyState,
                             mJacobianReduced,
                             mpCallBack);

  // Reset the time for an autonomous model.
  if (mpContainer->isAutonomous())
    {
      mSteadyState[mpContainer->getCountFixedEventTargets()] = InitialTime;
    }

  if (mResult == CSteadyStateMethod::notFound)
    restore();

  //update Jacobian
  if (mpContainer->isStateValid())
    {
      if (pProblem->isJacobianRequested() ||
          pProblem->isStabilityAnalysisRequested())
        {
          pMethod->doJacobian(mJacobian, mJacobianReduced);
        }

      //mpProblem->getModel()->setState(mpSteadyState);
      //mpProblem->getModel()->updateRates();

      //calculate eigenvalues
      if (pProblem->isStabilityAnalysisRequested())
        {
          mEigenValues.calcEigenValues(mJacobian);
          mEigenValuesX.calcEigenValues(mJacobianReduced);

          mEigenValues.stabilityAnalysis(pMethod->getStabilityResolution());
          mEigenValuesX.stabilityAnalysis(pMethod->getStabilityResolution());
        }
    }

  C_FLOAT64 * pTo;
  size_t i;

  // construct Eigenvalues of Jacobian
  CVector< C_FLOAT64 > vectorEigen_R = mEigenValues.getR();
  CVector< C_FLOAT64 > vectorEigen_I = mEigenValues.getI();

#ifdef DEBUG_UI
  C_INT32 size = vectorEigen_R.size() + vectorEigen_I.size();

  std::cout << "vectorEigen_R.size() = " << vectorEigen_R.size() << " + vectorEigen_I.size() = " << vectorEigen_I.size() << " == " << size << std::endl;
  std::cout << "size = " << mEigenvaluesXMatrix.size() << std::endl;
#endif
  assert(vectorEigen_R.size() == vectorEigen_I.size());

  pTo = mEigenvaluesMatrix.array();

  for (i = 0; i < vectorEigen_R.size(); ++i)
    {
      *pTo = vectorEigen_R[i]; ++pTo;
      *pTo = vectorEigen_I[i]; ++pTo;
    }

#ifdef DEBUG_UI
  std::cout << mEigenvaluesMatrix << std::endl;
#endif

  // construct Eigenvalues of Jacobian of reduced system
  CVector< C_FLOAT64 > vectorEigenX_R = mEigenValuesX.getR();
  CVector< C_FLOAT64 > vectorEigenX_I = mEigenValuesX.getI();

#ifdef DEBUG_UI
  C_INT32 sizeX = vectorEigenX_R.size() + vectorEigenX_I.size();

  std::cout << "vectorEigenX_R.size() = " << vectorEigenX_R.size() << " + vectorEigenX_I.size() = " << vectorEigenX_I.size() << " == " << sizeX << std::endl;
  std::cout << "size = " << mEigenvaluesXMatrix.size() << std::endl;
#endif

  assert(vectorEigenX_R.size() == vectorEigenX_I.size());
//.........这里部分代码省略.........
开发者ID:jonasfoe,项目名称:COPASI,代码行数:101,代码来源:CSteadyStateTask.cpp


示例19: runTestType

bool runTestType(cl::Context context, cl::CommandQueue queue)
{
  cl_uint size = 64 * 256;

  std::vector<T> input(size);

  for(size_t i = 0; i < input.size(); ++i)
    input[i] = input.size() - i - 1;
  
  // create input buffer using pinned memory
  cl::Buffer bufferIn(context, CL_MEM_ALLOC_HOST_PTR |
		      CL_MEM_COPY_HOST_PTR | CL_MEM_READ_WRITE, 
		      sizeof(T) * input.size(), &input[0])
    ;
  
  magnet::CL::sort<T> sortFunctor;
  sortFunctor.build(queue, context);
  sortFunctor(bufferIn);

  std::cout << "##Testing generic sort (";
  switch(sortFunctor.getMode())
    {
    case magnet::CL::sort<T>::CPU:
      std::cout << "HeapSort";
      break;
    case magnet::CL::sort<T>::NVIDIA:
      std::cout << "radixNVIDIA";
      break;
    case magnet::CL::sort<T>::AMD:
      std::cout << "radixAMD";
      break;
    default:
      M_throw() << "Could not determine which sorting algorithm is being used";
    }

  std::cout << ") for " << input.size() << " elements and type " 
	    << magnet::CL::detail::traits<T>::kernel_type();
  

  std::vector<T> output(size);
 
  queue.enqueueReadBuffer(bufferIn, CL_TRUE, 0, input.size() *
			  sizeof(T), &output[0]);

  bool failed = !testOutput(input, output);

  std::cout << " key(only) " << (failed ? "FAILED" : "PASSED") << ", "; 

  //Now test with some data!
  //Refresh the input array
  queue.enqueueWriteBuffer(bufferIn, CL_TRUE, 0, input.size() *
			   sizeof(T), &input[0]);

  //Write a data array
  std::vector<cl_uint> data(size);
  for(size_t i = 0; i < input.size(); ++i)
    data[i] = i;

  cl::Buffer dataIn(context, CL_MEM_ALLOC_HOST_PTR |
		    CL_MEM_COPY_HOST_PTR | CL_MEM_READ_WRITE, 
		    sizeof(cl_uint) * data.size(), &data[0])
    ;

  sortFunctor(bufferIn, dataIn);
  
  queue.enqueueReadBuffer(dataIn, CL_TRUE, 0, data.size() *
			  sizeof(cl_uint), &data[0]);

  bool keyfail = false;//!testOutput(input, output);

  std::cout << " key " << (keyfail ? "FAILED" : "PASSED"); 

  bool datafail = false;
  for(size_t i = 0; i < input.size(); ++i)
    if (data[i] != input.size() - 1 - i)
      datafail = true;

  std::cout << " data " << (datafail ? "FAILED" : "PASSED") << std::endl;
  
  return failed || keyfail || datafail;
}
开发者ID:armando-2011,项目名称:DynamO,代码行数:81,代码来源:sorter_test.cpp


示例20: output

le_int32 IndicReordering::v2process(const LEUnicode *chars, le_int32 charCount, le_int32 scriptCode,
                                  LEUnicode *outChars, LEGlyphStorage &glyphStorage)
{
    const IndicClassTable *classTable = IndicClassTable::getScriptClassTable(scriptCode);
    if (classTable == NULL) {
        return 0;
    }

    DynamicProperties dynProps[INDIC_BLOCK_SIZE];
    IndicReordering::getDynamicProperties(dynProps,classTable);

    IndicReorderingOutput output(outChars, glyphStorage, NULL);
    le_int32 i, firstConsonant, baseConsonant, secondConsonant, inv_count = 0, beginSyllable = 0;
    //le_bool lastInWord = FALSE;

    while (beginSyllable < charCount) {
        le_int32 nextSyllable = findSyllable(classTable, chars, beginSyllable, charCount);

        output.reset();

		// Find the First Consonant
		for ( firstConsonant = beginSyllable ; firstConsonant < nextSyllable ; firstConsonant++ ) {
			 if ( classTable->isConsonant(chars[firstConsonant]) ) {
					break;
				}
		}

        // Find the base consonant

        baseConsonant = nextSyllable - 1;
        secondConsonant = firstConsonant;

        // TODO: Use Dynamic Properties for hasBelowBaseForm and hasPostBaseForm()

        while ( baseConsonant > firstConsonant ) {
            if ( classTable->isConsonant(chars[baseConsonant]) && 
                 !classTable->hasBelowBaseForm(chars[baseConsonant]) && 
                 !classTable->hasPostBaseForm(chars[baseConsonant]) ) {
                break;
            }
            else {
                if ( classTable->isConsonant(chars[baseConsonant]) ) {
                    secondConsonant = baseConsonant;
                }
                baseConsonant--;
            }
        }

        // If the syllable starts with Ra + Halant ( in a script that has Reph ) and has more than one
        // consonant, Ra is excluced from candidates for base consonants

        if ( classTable->isReph(chars[beginSyllable]) &&
             beginSyllable+1 < nextSyllable && classTable->isVirama(chars[beginSyllable+1]) &&
             secondConsonant != firstConsonant) {
            baseConsonant = secondConsonant;                     
        }

	    // Populate the output 
		for ( i = beginSyllable ; i < nextSyllable ; i++ ) {

            // Handle invalid combinartions

            if ( classTable->isVirama(chars[beginSyllable]) || 
			     classTable->isMatra(chars[beginSyllable]) ||
			     classTable->isVowelModifier(chars[beginSyllable]) ||
			     classTable->isNukta(chars[beginSyllable]) ) {
                     output.writeChar(C_DOTTED_CIRCLE,beginSyllable,basicShapingFormsMask);
                     inv_count++;
            } 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ outputChannels函数代码示例发布时间:2022-05-30
下一篇:
C++ outportb函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap