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

C++ NELEMENTS函数代码示例

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

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



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

示例1: vp8_destroy

static vpx_codec_err_t vp8_destroy(vpx_codec_alg_priv_t *ctx)
{
    int i;

    vp8dx_remove_decompressor(ctx->pbi);

    for (i = NELEMENTS(ctx->mmaps) - 1; i >= 0; i--)
    {
        if (ctx->mmaps[i].dtor)
            ctx->mmaps[i].dtor(&ctx->mmaps[i]);
    }

#if CONFIG_OPENCL
    if (cl_initialized == CL_SUCCESS){
        cl_destroy(NULL, VP8_CL_NOT_INITIALIZED);
#if HAVE_DLOPEN
        close_cl();
#endif
    }
#endif

    return VPX_CODEC_OK;
}
开发者ID:WebRTC-Labs,项目名称:libvpx.opencl,代码行数:23,代码来源:vp8_dx_iface.c


示例2: vp8_init_ctx

static void vp8_init_ctx(vpx_codec_ctx_t *ctx, const vpx_codec_mmap_t *mmap)
{
    int i;

    ctx->priv = mmap->base;
    ctx->priv->sz = sizeof(*ctx->priv);
    ctx->priv->iface = ctx->iface;
    ctx->priv->alg_priv = mmap->base;

    for (i = 0; i < NELEMENTS(ctx->priv->alg_priv->mmaps); i++)
        ctx->priv->alg_priv->mmaps[i].id = vp8_mem_req_segs[i].id;

    ctx->priv->alg_priv->mmaps[0] = *mmap;
    ctx->priv->alg_priv->si.sz = sizeof(ctx->priv->alg_priv->si);
    ctx->priv->init_flags = ctx->init_flags;

    if (ctx->config.dec)
    {
        /* Update the reference to the config structure to an internal copy. */
        ctx->priv->alg_priv->cfg = *ctx->config.dec;
        ctx->config.dec = &ctx->priv->alg_priv->cfg;
    }
}
开发者ID:alain40,项目名称:webrtc-ios,代码行数:23,代码来源:vp8_dx_iface.c


示例3: TEST_F

TEST_F(I2CVMTest, RegisterIndependence) {
  const uint32_t program[] = {
    I2C_VM_ASM_SET_IMM(VM_R0, 10),
    I2C_VM_ASM_SET_IMM(VM_R1, 11),
    I2C_VM_ASM_SET_IMM(VM_R2, 12),
    I2C_VM_ASM_SET_IMM(VM_R3, 13),
    I2C_VM_ASM_SET_IMM(VM_R4, 14),
    I2C_VM_ASM_SET_IMM(VM_R5, 15),
    I2C_VM_ASM_SET_IMM(VM_R6, 16),
    I2C_VM_ASM_SEND_UAVO(),
  };

  EXPECT_TRUE(i2c_vm_run (program, NELEMENTS(program), 0));

  EXPECT_EQ(7,  uavo_data.pc);
  EXPECT_EQ(10, uavo_data.r0);
  EXPECT_EQ(11, uavo_data.r1);
  EXPECT_EQ(12, uavo_data.r2);
  EXPECT_EQ(13, uavo_data.r3);
  EXPECT_EQ(14, uavo_data.r4);
  EXPECT_EQ(15, uavo_data.r5);
  EXPECT_EQ(16, uavo_data.r6);
}
开发者ID:johnm1,项目名称:flyingf4_int_flash,代码行数:23,代码来源:unittest.cpp


示例4: mmuTestInit

int mmuTestInit(
    void
    )
{
    static SYMBOL symTableMmuTest[] =
    {
        {NULL, "_mmuGlobalMapTest", mmuGlobalMapTest, 0, N_TEXT | N_EXT}
    };

    int i;

    if (mmuInit() != OK)
    {
        fprintf(stderr, "Error - Unable to initialize mmu.\n");
        return ERROR;
    }

    for (i = 0; i < NELEMENTS(symTableMmuTest); i++)
    {
        symTableAdd(sysSymTable, &symTableMmuTest[i]);
    }

    return i;
}
开发者ID:phoboz,项目名称:vmx,代码行数:24,代码来源:mmuTest.c


示例5: write

ssize_t write (int fd, const void *buf, size_t n)
{
    unsigned retries = 10;
    int retcode;

    if (!buf || (fd < 0) || (fd >= (int)NELEMENTS(fdarray)) ||
            !(fdarray[fd].flags & FD_DATA_IS_INUSE)) {
        return (-1);
    }

    if (fdarray[fd].flags & FD_DATA_IS_RAW) {
        do {
            retcode = device_io_tx(fdarray[fd].rawdev, (char *)buf, n);
        } while (retries-- && (retcode == EAGAIN));
        if (retcode < EOK) {
            return (-1);
        }
    } else if (fdarray[fd].flags & FD_DATA_IS_SOCK) {
    } else {
        return (-1);
    }

    return (n);
}
开发者ID:J-F-Sebastian,项目名称:DiegOS,代码行数:24,代码来源:write.c


示例6: fontpc88_read

UINT8 fontpc88_read(const OEMCHAR *filename, UINT8 loading) {

	FILEH	fh;
	UINT8	*work;
	OEMCHAR	fname[MAX_PATH];

	work = (UINT8 *)_MALLOC(0x20000, "pc88font");
	if (work == NULL) {
		goto fr88_err1;
	}
	file_cpyname(fname, filename, NELEMENTS(fname));

	// 第2水準以外を読む必要はある?
	if (loading & (FONT_ANK8 | FONTLOAD_ANK | FONT_KNJ1)) {

		// あったら読み込んでみる
		file_cutname(fname);
		file_catname(fname, pc88knj1name, NELEMENTS(fname));
		fh = file_open_rb(fname);
		if (fh != FILEH_INVALID) {
			if (file_read(fh, work, 0x20000) == 0x20000) {

				// 8dot ANKを読む必要があるか
				if (loading & FONT_ANK8) {
					loading &= ~FONT_ANK8;
					fontdata_ank8store(work + 0x1000, 0, 256);
				}

				// 16dot ASCIIを読む必要があるか
				if (loading & FONT_ANK16a) {
					loading &= ~FONT_ANK16a;
					CopyMemory(fontrom + 0x80000, work + 0x0000, 16*128);
				}

				// 16dot ANK(0x80〜)を読む必要があるか
				if (loading & FONT_ANK16b) {
					loading &= ~FONT_ANK16b;
					CopyMemory(fontrom + 0x80800, work + 0x0800, 16*128);
				}

				// 第一水準漢字を読み込む?
				if (loading & FONT_KNJ1) {
					loading &= ~FONT_KNJ1;
					pc88knjcpy1(fontrom, work, 0x01, 0x30);
					fontdata_patchjis();
				}
			}

			// クローズして セクション終わり
			file_close(fh);
		}
	}

	// 第2水準を読む必要はある?
	if (loading & FONT_KNJ2) {

		// あったら読み込んでみる
		file_cutname(fname);
		file_catname(fname, pc88knj2name, NELEMENTS(fname));
		fh = file_open_rb(fname);
		if (fh != FILEH_INVALID) {
			if (file_read(fh, work, 0x20000) == 0x20000) {

				loading &= ~FONT_KNJ2;
				pc88knjcpy2(fontrom, work, 0x31, 0x56);
			}

			// クローズして セクション終わり
			file_close(fh);
		}
	}

	// ANKを読み込む必要はある?
	if (loading & (FONT_ANK8 | FONTLOAD_ANK)) {

		// あったら読み込んでみる
		file_cutname(fname);
		file_catname(fname, pc88ankname, NELEMENTS(fname));
		fh = file_open_rb(fname);
		if (fh != FILEH_INVALID) {

			// 読み込んでみる
			if (file_read(fh, work, 0x1800) == 0x1800) {

				// 8dot ANKを読む必要があるか
				if (loading & FONT_ANK8) {
					loading &= ~FONT_ANK8;
					fontdata_ank8store(work + 0x0000, 0, 256);
				}

				// 16dot ASCIIを読む必要があるか
				if (loading & FONT_ANK16a) {
					loading &= ~FONT_ANK16a;
					CopyMemory(fontrom + 0x80000, work + 0x0800, 16*128);
				}

				// 16dot ANK(0x80〜)を読む必要があるか
				if (loading & FONT_ANK16b) {
					loading &= ~FONT_ANK16b;
					CopyMemory(fontrom + 0x80800, work + 0x1000, 16*128);
//.........这里部分代码省略.........
开发者ID:FREEWING-JP,项目名称:np2pi,代码行数:101,代码来源:fontpc88.c


示例7: ok_button_clicked

static void
ok_button_clicked(GtkButton *b, gpointer d)
{
	const gchar *bufp = gtk_entry_get_text(GTK_ENTRY(buffer_entry));
	const gchar *base = gtk_entry_get_text(GTK_ENTRY(baseclock_entry));
	const gchar *multp = gtk_entry_get_text(GTK_ENTRY(clockmult_entry));
#if defined(SUPPORT_RESUME)
	gint resume = GTK_TOGGLE_BUTTON(resume_checkbutton)->active;
#endif
#if defined(GCC_CPU_ARCH_IA32)
	gint disablemmx = GTK_TOGGLE_BUTTON(disablemmx_checkbutton)->active;
#endif
	guint bufsize;
	guint mult;
	UINT renewal = 0;
	int i;

	if (strcmp(base, "1.9968MHz") == 0) {
		if (np2cfg.baseclock != PCBASECLOCK20) {
			np2cfg.baseclock = PCBASECLOCK20;
			renewal |= SYS_UPDATECFG|SYS_UPDATECLOCK;
		}
	} else {
		if (np2cfg.baseclock != PCBASECLOCK25) {
			np2cfg.baseclock = PCBASECLOCK25;
			renewal |= SYS_UPDATECFG|SYS_UPDATECLOCK;
		}
	}

	mult = milstr_solveINT(multp);
	switch (mult) {
	case 1: case 2: case 4: case 5: case 6: case 8: case 10: case 12:
	case 16: case 20:
		if (mult != np2cfg.multiple) {
			np2cfg.multiple = mult;
			renewal |= SYS_UPDATECFG|SYS_UPDATECLOCK;
		}
		break;
	}

	for (i = 0; i < NELEMENTS(architecture); i++) {
		if (strcmp(arch, architecture[i].arch) == 0) {
			milstr_ncpy(np2cfg.model, arch, sizeof(np2cfg.model));
			renewal |= SYS_UPDATECFG;
			break;
		}
	}
	if (i == NELEMENTS(architecture)) {
		milstr_ncpy(np2cfg.model, "VX", sizeof(np2cfg.model));
		renewal |= SYS_UPDATECFG;
	}

	switch (rate) {
	case 11025:
	case 22050:
	case 44100:
		if (rate != np2cfg.samplingrate) {
			np2cfg.samplingrate = rate;
			renewal |= SYS_UPDATECFG|SYS_UPDATERATE;
			soundrenewal = 1;
		}
		break;
	}

	bufsize = milstr_solveINT(bufp);
	if (bufsize < 20)
		bufsize = 20;
	else if (bufsize > 1000)
		bufsize = 1000;
	if (np2cfg.delayms != bufsize) {
		np2cfg.delayms = bufsize;
		renewal |= SYS_UPDATECFG|SYS_UPDATESBUF;
		soundrenewal = 1;
	}

#if defined(GCC_CPU_ARCH_IA32)
	if (!(mmxflag & MMXFLAG_NOTSUPPORT)) {
		disablemmx = disablemmx ? MMXFLAG_DISABLE : 0;
		if (np2oscfg.disablemmx != disablemmx) {
			np2oscfg.disablemmx = disablemmx;
			mmxflag &= ~MMXFLAG_DISABLE;
			mmxflag |= disablemmx;
			renewal |= SYS_UPDATEOSCFG;
		}
	}
#endif

#if defined(SUPPORT_RESUME)
	if (np2oscfg.resume != resume) {
		np2oscfg.resume = resume;
		renewal |= SYS_UPDATEOSCFG;
	}
#endif

	if (renewal) {
		sysmng_update(renewal);
	}

	gtk_widget_destroy((GtkWidget *)d);
}
开发者ID:aliaspider,项目名称:np2,代码行数:100,代码来源:dialog_config.c


示例8: PIOS_Board_Init


//.........这里部分代码省略.........
							  rx_buffer, PACKET_SIZE,
							  tx_buffer, PACKET_SIZE)) {
				PIOS_Assert(0);
			}
		}
	}
#endif

#if defined(PIOS_INCLUDE_GCSRCVR)
	GCSReceiverInitialize();
	uint32_t pios_gcsrcvr_id;
	PIOS_GCSRCVR_Init(&pios_gcsrcvr_id);
	uint32_t pios_gcsrcvr_rcvr_id;
	if (PIOS_RCVR_Init(&pios_gcsrcvr_rcvr_id, &pios_gcsrcvr_rcvr_driver, pios_gcsrcvr_id)) {
		PIOS_Assert(0);
	}
	pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_GCS] = pios_gcsrcvr_rcvr_id;
#endif	/* PIOS_INCLUDE_GCSRCVR */

#ifndef PIOS_DEBUG_ENABLE_DEBUG_PINS
	uint8_t hw_output_port;
	HwFreedomOutputGet(&hw_output_port);
	switch (hw_output_port) {
		case HWFREEDOM_OUTPUT_DISABLED:
			break;
		case HWFREEDOM_OUTPUT_PWM:
			/* Set up the servo outputs */
			PIOS_Servo_Init(&pios_servo_cfg);
			break;
		default:
			break;
	}
#else
	PIOS_DEBUG_Init(&pios_tim_servo_all_channels, NELEMENTS(pios_tim_servo_all_channels));
#endif

	PIOS_DELAY_WaitmS(200);

	PIOS_SENSORS_Init();

#if defined(PIOS_INCLUDE_MPU6000)
	if (PIOS_MPU6000_Init(pios_spi_gyro_id,0, &pios_mpu6000_cfg) != 0)
		panic(2);
	if (PIOS_MPU6000_Test() != 0)
		panic(2);
	
	// To be safe map from UAVO enum to driver enum
	uint8_t hw_gyro_range;
	HwFreedomGyroRangeGet(&hw_gyro_range);
	switch(hw_gyro_range) {
		case HWFREEDOM_GYRORANGE_250:
			PIOS_MPU6000_SetGyroRange(PIOS_MPU60X0_SCALE_250_DEG);
			break;
		case HWFREEDOM_GYRORANGE_500:
			PIOS_MPU6000_SetGyroRange(PIOS_MPU60X0_SCALE_500_DEG);
			break;
		case HWFREEDOM_GYRORANGE_1000:
			PIOS_MPU6000_SetGyroRange(PIOS_MPU60X0_SCALE_1000_DEG);
			break;
		case HWFREEDOM_GYRORANGE_2000:
			PIOS_MPU6000_SetGyroRange(PIOS_MPU60X0_SCALE_2000_DEG);
			break;
	}

	uint8_t hw_accel_range;
	HwFreedomAccelRangeGet(&hw_accel_range);
开发者ID:Crash1,项目名称:TauLabs,代码行数:67,代码来源:pios_board.c


示例9: file_setcd

/**
 * カレント パス設定
 * @param[in] lpPathName カレント ファイル名
 */
void DOSIOCALL file_setcd(const OEMCHAR* lpPathName)
{
	file_cpyname(curpath, lpPathName, NELEMENTS(curpath));
	curfilep = file_getname(curpath);
	*curfilep = '\0';
}
开发者ID:LasDesu,项目名称:np2debug,代码行数:10,代码来源:dosio.cpp


示例10: statsave_load

int statsave_load(const OEMCHAR *filename) {

	SFFILEH		sffh;
	int			ret;
	BOOL		done;
const SFENTRY	*tbl;
const SFENTRY	*tblterm;

	sffh = statflag_open(filename, NULL, 0);
	if (sffh == NULL) {
		return(STATFLAG_FAILURE);
	}

	// PCCORE read!
	ret = statflag_readsection(sffh);
	if ((ret != STATFLAG_SUCCESS) ||
		(memcmp(sffh->sfh.hdr.index, np2tbl[0].index, sizeof(sffh->sfh.hdr.index)))) {
		statflag_close(sffh);
		return(STATFLAG_FAILURE);
	}

	soundmng_stop();
	rs232c_midipanic();
	mpu98ii_midipanic();
	pc9861k_midipanic();
	sxsi_alltrash();

	ret |= flagload_common(&sffh->sfh, np2tbl);

	CPU_RESET();
	CPU_SETEXTSIZE((UINT32)pccore.extmem);
	nevent_allreset();

	sound_changeclock();
	beep_changeclock();
	sound_reset();
	fddmtrsnd_bind();

	iocore_reset(&np2cfg);							// サウンドでpicを呼ぶので…
	cbuscore_reset(&np2cfg);
	fmboard_reset(&np2cfg, pccore.sound);

	done = FALSE;
	while((!done) && (ret != STATFLAG_FAILURE)) {
		ret |= statflag_readsection(sffh);
		tbl = np2tbl + 1;
		tblterm = np2tbl + NELEMENTS(np2tbl);
		while(tbl < tblterm) {
			if (!memcmp(sffh->sfh.hdr.index, tbl->index, sizeof(sffh->sfh.hdr.index))) {
				break;
			}
			tbl++;
		}
		if (tbl < tblterm) {
			switch(tbl->type) {
				case STATFLAG_BIN:
					ret |= flagload_common(&sffh->sfh, tbl);
					break;

				case STATFLAG_TERM:
					done = TRUE;
					break;

				case STATFLAG_COM:
					ret |= flagload_com(&sffh->sfh, tbl);
					break;

				case STATFLAG_DMA:
					ret |= flagload_dma(&sffh->sfh, tbl);
					break;

				case STATFLAG_EGC:
					ret |= flagload_egc(&sffh->sfh, tbl);
					break;

				case STATFLAG_EPSON:
					ret |= flagload_epson(&sffh->sfh, tbl);
					break;

				case STATFLAG_EVT:
					ret |= flagload_evt(&sffh->sfh, tbl);
					break;

				case STATFLAG_EXT:
					ret |= flagload_ext(&sffh->sfh, tbl);
					break;

				case STATFLAG_FDD:
					ret |= flagload_fdd(&sffh->sfh, tbl);
					break;

#if !defined(DISABLE_SOUND)
				case STATFLAG_FM:
					ret |= flagload_fm(&sffh->sfh, tbl);
					break;
#endif

				case STATFLAG_GIJ:
					ret |= flagload_gij(&sffh->sfh, tbl);
					break;
//.........这里部分代码省略.........
开发者ID:aliaspider,项目名称:np2,代码行数:101,代码来源:statsave.c


示例11: statsave_save

int statsave_save(const OEMCHAR *filename) {

	SFFILEH		sffh;
	int			ret;
const SFENTRY	*tbl;
const SFENTRY	*tblterm;

	sffh = statflag_create(filename);
	if (sffh == NULL) {
		return(STATFLAG_FAILURE);
	}

	ret = STATFLAG_SUCCESS;
	tbl = np2tbl;
	tblterm = tbl + NELEMENTS(np2tbl);
	while(tbl < tblterm) {
		ret |= statflag_createsection(sffh, tbl);
		switch(tbl->type) {
			case STATFLAG_BIN:
			case STATFLAG_TERM:
				ret |= flagsave_common(&sffh->sfh, tbl);
				break;

			case STATFLAG_COM:
				ret |= flagsave_com(&sffh->sfh, tbl);
				break;

			case STATFLAG_DMA:
				ret |= flagsave_dma(&sffh->sfh, tbl);
				break;

			case STATFLAG_EGC:
				ret |= flagsave_egc(&sffh->sfh, tbl);
				break;

			case STATFLAG_EPSON:
				ret |= flagsave_epson(&sffh->sfh, tbl);
				break;

			case STATFLAG_EVT:
				ret |= flagsave_evt(&sffh->sfh, tbl);
				break;

			case STATFLAG_EXT:
				ret |= flagsave_ext(&sffh->sfh, tbl);
				break;

			case STATFLAG_FDD:
				ret |= flagsave_fdd(&sffh->sfh, tbl);
				break;

#if !defined(DISABLE_SOUND)
			case STATFLAG_FM:
				ret |= flagsave_fm(&sffh->sfh, tbl);
				break;
#endif

			case STATFLAG_GIJ:
				ret |= flagsave_gij(&sffh->sfh, tbl);
				break;

#if defined(SUPPORT_HOSTDRV)
				case STATFLAG_HDRV:
				ret |= hostdrv_sfsave(&sffh->sfh, tbl);
				break;
#endif

			case STATFLAG_MEM:
				ret |= flagsave_mem(&sffh->sfh, tbl);
				break;

			case STATFLAG_SXSI:
				ret |= flagsave_sxsi(&sffh->sfh, tbl);
				break;
		}
		tbl++;
	}
	statflag_close(sffh);
	return(ret);
}
开发者ID:aliaspider,项目名称:np2,代码行数:80,代码来源:statsave.c


示例12: get_move_name

char* get_move_name(uint8 move_id)
{
    return get_name_from_id(move_id, moves, NELEMENTS(moves));
}
开发者ID:awakecoding,项目名称:ttycmd,代码行数:4,代码来源:ttycmd.c


示例13: get_turn_id

uint8 get_turn_id(char* turn_name)
{
    return get_id_from_name(turn_name, turns, NELEMENTS(turns));
}
开发者ID:awakecoding,项目名称:ttycmd,代码行数:4,代码来源:ttycmd.c


示例14: get_turn_name

char* get_turn_name(uint8 turn_id)
{
    return get_name_from_id(turn_id, turns, NELEMENTS(turns));
}
开发者ID:awakecoding,项目名称:ttycmd,代码行数:4,代码来源:ttycmd.c


示例15: vp8_decode

static vpx_codec_err_t vp8_decode(vpx_codec_alg_priv_t  *ctx,
                                  const uint8_t         *data,
                                  unsigned int            data_sz,
                                  void                    *user_priv,
                                  long                    deadline)
{
    vpx_codec_err_t res = VPX_CODEC_OK;
    unsigned int resolution_change = 0;
    unsigned int w, h;

    /* Determine the stream parameters. Note that we rely on peek_si to
     * validate that we have a buffer that does not wrap around the top
     * of the heap.
     */
    w = ctx->si.w;
    h = ctx->si.h;

    res = ctx->base.iface->dec.peek_si(data, data_sz, &ctx->si);

    if((res == VPX_CODEC_UNSUP_BITSTREAM) && !ctx->si.is_kf)
    {
        /* the peek function returns an error for non keyframes, however for
         * this case, it is not an error */
        res = VPX_CODEC_OK;
    }

    if(!ctx->decoder_init && !ctx->si.is_kf)
        res = VPX_CODEC_UNSUP_BITSTREAM;

    if ((ctx->si.h != h) || (ctx->si.w != w))
        resolution_change = 1;

    /* Perform deferred allocations, if required */
    if (!res && ctx->defer_alloc)
    {
        int i;

        for (i = 1; !res && i < NELEMENTS(ctx->mmaps); i++)
        {
            vpx_codec_dec_cfg_t cfg;

            cfg.w = ctx->si.w;
            cfg.h = ctx->si.h;
            ctx->mmaps[i].id = vp8_mem_req_segs[i].id;
            ctx->mmaps[i].sz = vp8_mem_req_segs[i].sz;
            ctx->mmaps[i].align = vp8_mem_req_segs[i].align;
            ctx->mmaps[i].flags = vp8_mem_req_segs[i].flags;

            if (!ctx->mmaps[i].sz)
                ctx->mmaps[i].sz = vp8_mem_req_segs[i].calc_sz(&cfg,
                                   ctx->base.init_flags);

            res = vp8_mmap_alloc(&ctx->mmaps[i]);
        }

        if (!res)
            vp8_finalize_mmaps(ctx);

        ctx->defer_alloc = 0;
    }

    /* Initialize the decoder instance on the first frame*/
    if (!res && !ctx->decoder_init)
    {
        res = vp8_validate_mmaps(&ctx->si, ctx->mmaps, ctx->base.init_flags);

        if (!res)
        {
            VP8D_CONFIG oxcf;
            struct VP8D_COMP* optr;

            oxcf.Width = ctx->si.w;
            oxcf.Height = ctx->si.h;
            oxcf.Version = 9;
            oxcf.postprocess = 0;
            oxcf.max_threads = ctx->cfg.threads;
            oxcf.error_concealment =
                (ctx->base.init_flags & VPX_CODEC_USE_ERROR_CONCEALMENT);
            oxcf.input_fragments =
                (ctx->base.init_flags & VPX_CODEC_USE_INPUT_FRAGMENTS);

            optr = vp8dx_create_decompressor(&oxcf);

            /* If postprocessing was enabled by the application and a
             * configuration has not been provided, default it.
             */
            if (!ctx->postproc_cfg_set
                    && (ctx->base.init_flags & VPX_CODEC_USE_POSTPROC))
            {
                ctx->postproc_cfg.post_proc_flag =
                    VP8_DEBLOCK | VP8_DEMACROBLOCK | VP8_MFQE;
                ctx->postproc_cfg.deblocking_level = 4;
                ctx->postproc_cfg.noise_level = 0;
            }

            if (!optr)
                res = VPX_CODEC_ERROR;
            else
                ctx->pbi = optr;
        }
//.........这里部分代码省略.........
开发者ID:angad,项目名称:libjingle-linux,代码行数:101,代码来源:vp8_dx_iface.c


示例16: wlan_ops_uap_process_txpd

/**
 *  @brief This function fill the txpd for tx packet
 *
 *  @param priv	   A pointer to mlan_private structure
 *  @param pmbuf   A pointer to the mlan_buffer for process
 *
 *  @return        headptr or MNULL
 */
t_void *
wlan_ops_uap_process_txpd(IN t_void *priv, IN pmlan_buffer pmbuf)
{
	pmlan_private pmpriv = (pmlan_private)priv;
	UapTxPD *plocal_tx_pd;
	t_u8 *head_ptr = MNULL;
	t_u32 pkt_type;
	t_u32 tx_control;
	ENTER();

	if (!pmbuf->data_len) {
		PRINTM(MERROR, "uAP Tx Error: Invalid packet length: %d\n",
		       pmbuf->data_len);
		pmbuf->status_code = MLAN_ERROR_PKT_SIZE_INVALID;
		goto done;
	}
	if (pmbuf->buf_type == MLAN_BUF_TYPE_RAW_DATA) {
		memcpy(pmpriv->adapter, &pkt_type,
		       pmbuf->pbuf + pmbuf->data_offset, sizeof(pkt_type));
		memcpy(pmpriv->adapter, &tx_control,
		       pmbuf->pbuf + pmbuf->data_offset + sizeof(pkt_type),
		       sizeof(tx_control));
		pmbuf->data_offset += sizeof(pkt_type) + sizeof(tx_control);
		pmbuf->data_len -= sizeof(pkt_type) + sizeof(tx_control);
	}
	if (pmbuf->data_offset < (sizeof(UapTxPD) + INTF_HEADER_LEN +
				  DMA_ALIGNMENT)) {
		PRINTM(MERROR,
		       "not enough space for UapTxPD: headroom=%d pkt_len=%d, required=%d\n",
		       pmbuf->data_offset, pmbuf->data_len,
		       sizeof(UapTxPD) + INTF_HEADER_LEN + DMA_ALIGNMENT);
		DBG_HEXDUMP(MDAT_D, "drop pkt",
			    pmbuf->pbuf + pmbuf->data_offset, pmbuf->data_len);
		pmbuf->status_code = MLAN_ERROR_PKT_SIZE_INVALID;
		goto done;
	}

	/* head_ptr should be aligned */
	head_ptr =
		pmbuf->pbuf + pmbuf->data_offset - sizeof(UapTxPD) -
		INTF_HEADER_LEN;
	head_ptr = (t_u8 *)((t_ptr)head_ptr & ~((t_ptr)(DMA_ALIGNMENT - 1)));

	plocal_tx_pd = (UapTxPD *)(head_ptr + INTF_HEADER_LEN);
	memset(pmpriv->adapter, plocal_tx_pd, 0, sizeof(UapTxPD));

	/* Set the BSS number to TxPD */
	plocal_tx_pd->bss_num = GET_BSS_NUM(pmpriv);
	plocal_tx_pd->bss_type = pmpriv->bss_type;

	plocal_tx_pd->tx_pkt_length = (t_u16)pmbuf->data_len;

	plocal_tx_pd->priority = (t_u8)pmbuf->priority;
	plocal_tx_pd->pkt_delay_2ms =
		wlan_wmm_compute_driver_packet_delay(pmpriv, pmbuf);

	if (plocal_tx_pd->priority <
	    NELEMENTS(pmpriv->wmm.user_pri_pkt_tx_ctrl))
		/*
		 * Set the priority specific tx_control field, setting of 0 will
		 *   cause the default value to be used later in this function
		 */
		plocal_tx_pd->tx_control
			=
			pmpriv->wmm.user_pri_pkt_tx_ctrl[plocal_tx_pd->
							 priority];

	if (pmbuf->flags & MLAN_BUF_FLAG_TX_STATUS) {
		plocal_tx_pd->tx_token_id = (t_u8)pmbuf->tx_seq_num;
		plocal_tx_pd->flags |= MRVDRV_TxPD_FLAGS_TX_PACKET_STATUS;
	}

	/* Offset of actual data */
	plocal_tx_pd->tx_pkt_offset =
		(t_u16)((t_ptr)pmbuf->pbuf + pmbuf->data_offset -
			(t_ptr)plocal_tx_pd);

	if (!plocal_tx_pd->tx_control) {
		/* TxCtrl set by user or default */
		plocal_tx_pd->tx_control = pmpriv->pkt_tx_ctrl;
	}

	if (pmbuf->buf_type == MLAN_BUF_TYPE_RAW_DATA) {
		plocal_tx_pd->tx_pkt_type = (t_u16)pkt_type;
		plocal_tx_pd->tx_control = tx_control;
	}
	uap_endian_convert_TxPD(plocal_tx_pd);

	/* Adjust the data offset and length to include TxPD in pmbuf */
	pmbuf->data_len += pmbuf->data_offset;
	pmbuf->data_offset = (t_u32)((t_ptr)head_ptr - (t_ptr)pmbuf->pbuf);
	pmbuf->data_len -= pmbuf->data_offset;
//.........这里部分代码省略.........
开发者ID:krysanto,项目名称:steamlink-sdk,代码行数:101,代码来源:mlan_uap_txrx.c


示例17: get_move_id

uint8 get_move_id(char* move_name)
{
    return get_id_from_name(move_name, moves, NELEMENTS(moves));
}
开发者ID:awakecoding,项目名称:ttycmd,代码行数:4,代码来源:ttycmd.c


示例18: statsave_check

int statsave_check(const OEMCHAR *filename, OEMCHAR *buf, int size) {

	SFFILEH		sffh;
	int			ret;
	BOOL		done;
const SFENTRY	*tbl;
const SFENTRY	*tblterm;

	sffh = statflag_open(filename, buf, size);
	if (sffh == NULL) {
		return(STATFLAG_FAILURE);
	}

	done = FALSE;
	ret = STATFLAG_SUCCESS;
	while((!done) && (ret != STATFLAG_FAILURE)) {
		ret |= statflag_readsection(sffh);
		tbl = np2tbl;
		tblterm = tbl + NELEMENTS(np2tbl);
		while(tbl < tblterm) {
			if (!memcmp(sffh->sfh.hdr.index, tbl->index, sizeof(sffh->sfh.hdr.index))) {
				break;
			}
			tbl++;
		}
		if (tbl < tblterm) {
			switch(tbl->type) {
				case STATFLAG_BIN:
				case STATFLAG_MEM:
					ret |= flagcheck_versize(&sffh->sfh, tbl);
					break;

				case STATFLAG_TERM:
					done = TRUE;
					break;

				case STATFLAG_COM:
				case STATFLAG_DMA:
				case STATFLAG_EGC:
				case STATFLAG_EPSON:
				case STATFLAG_EVT:
				case STATFLAG_EXT:
				case STATFLAG_GIJ:
#if !defined(DISABLE_SOUND)
				case STATFLAG_FM:
#endif
#if defined(SUPPORT_HOSTDRV)
				case STATFLAG_HDRV:
#endif
					ret |= flagcheck_veronly(&sffh->sfh, tbl);
					break;

				case STATFLAG_FDD:
					ret |= flagcheck_fdd(&sffh->sfh, tbl);
					break;

				case STATFLAG_SXSI:
					ret |= flagcheck_sxsi(&sffh->sfh, tbl);
					break;

				default:
					ret |= STATFLAG_WARNING;
					break;
			}
		}
		else {
			ret |= STATFLAG_WARNING;
		}
	}
	statflag_close(sffh);
	return(ret);
}
开发者ID:aliaspider,项目名称:np2,代码行数:72,代码来源:statsave.c


示例19: get_state_name

char* get_state_name(uint8 state_id)
{
    return get_name_from_id(state_id, states, NELEMENTS(states));
}
开发者ID:awakecoding,项目名称:ttycmd,代码行数:4,代码来源:ttycmd.c


示例20: viewasm_paint

static void viewasm_paint(NP2VIEW_T *view, RECT *rc, HDC hdc) {

	LONG	x, y, i;
	UINT32	seg4;
	UINT16	off, prevoff;
	UINT32	pos;
	UINT8	*p;
	UINT8	buf[16];
	TCHAR	str[16];
	_UNASM	una;
	int		step;
#if defined(UNICODE)
	TCHAR	cnv[64];
#endif
	COLORREF	bkcol;

	if (view->lock) {
		if ((view->buf1.type != ALLOCTYPE_SEG) ||
			(view->buf1.arg != view->seg)) {
			if (viewcmn_alloc(&view->buf1, view->memsize)) {
				view->lock = FALSE;
				viewmenu_lock(view);
			}
			else {
				view->buf1.type = ALLOCTYPE_SEG;
				view->buf1.arg = view->seg;
				viewmem_read(&view->dmem, seg_to_real(view->buf1.arg), (BYTE *)view->buf1.ptr, view->memsize);
				view->buf2.type = ALLOCTYPE_NONE;
			}
			viewcmn_putcaption(view);
		}
	}

	seg4 = seg_to_real(view->seg);
	pos = view->pos;
	
	if ((view->buf2.type != ALLOCTYPE_ASM) ||
		(view->buf2.arg != (seg4 + view->off))) {
		if (viewcmn_alloc(&view->buf2, view->maxline*2)) {
			pos = 0;
		}
		else {
			DWORD i;
			UINT16 *r;
			r = (UINT16 *)view->buf2.ptr;
			view->buf2.type = ALLOCTYPE_ASM;
			view->buf2.arg = seg4 + view->off;
			off = view->off;
			for (i=0; i<(view->maxline - 1); i++) {
				*r++ = off;
				step = viewasm_unasm_next(NULL, buf, view, off);
				off += (UINT16)step;
			}
			*r = off;
		}
	}

	prevoff = off = viewasm_line_to_off(view, view->pos);

	for (y=0; y<rc->bottom; y+=viewcfg.font_height) {
		x = 0;
		// Emphasize wrapping
		if(prevoff > off)	{
			viewpaint_line_fill(rc, hdc, y, 2, viewcfg.color_hilite);
		}
		
		bkcol = viewpaint_line_set_colors(view, rc, hdc, y, off, CPU_CS, CPU_IP);

		viewpaint_print_addr(hdc, x, y, view->seg, off, TRUE);

		SetBkColor(hdc, bkcol);
		step = viewasm_unasm_next(&una, buf, view, off);
		p = buf;
		if (!step) {
			break;
		}
		x += 11 * np2viewfontwidth;
		for(i = 0; i < step; i++)	{
			wsprintf(str + (i*2), _T("%02x"), *p);
			p++;
		}
		TextOut(hdc, x, y, str, i * 2);
		x += 15 * np2viewfontwidth;
#if defined(UNICODE)
		TextOut(hdc, x, y, cnv, MultiByteToWideChar(CP_ACP, 
					MB_PRECOMPOSED, una.mnemonic, -1, cnv, NELEMENTS(cnv)));
#else
		TextOut(hdc,x, y, una.mnemonic, lstrlen(una.mnemonic));
#endif
		x += 7 * np2viewfontwidth;
		if (una.operand[0]) {
#if defined(UNICODE)
			TextOut(hdc, x, y, cnv, MultiByteToWideChar(CP_ACP,
					MB_PRECOMPOSED, una.operand, -1, cnv, NELEMENTS(cnv)));
#else
			TextOut(hdc, x, y, una.operand, lstrlen(una.operand));
#endif
		}
		prevoff = off;
		off += (UINT16)step;
//.........这里部分代码省略.........
开发者ID:LasDesu,项目名称:np2debug,代码行数:101,代码来源:viewasm.cpp



注:本文中的NELEMENTS函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ NELEMS函数代码示例发布时间:2022-05-30
下一篇:
C++ ND_TCHECK2函数代码示例发布时间: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