当前位置: 首页>>代码示例>>C++>>正文


C++ OFFSET函数代码示例

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


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

示例1: OFFSET

    { NULL }
};

static const AVFilterPad vibrance_outputs[] = {
    {
        .name = "default",
        .type = AVMEDIA_TYPE_VIDEO,
    },
    { NULL }
};

#define OFFSET(x) offsetof(VibranceContext, x)
#define VF AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM

static const AVOption vibrance_options[] = {
    { "intensity", "set the intensity value",   OFFSET(intensity),  AV_OPT_TYPE_FLOAT, {.dbl=0},       -2,  2, VF },
    { "rbal", "set the red balance value",      OFFSET(balance[2]), AV_OPT_TYPE_FLOAT, {.dbl=1},      -10, 10, VF },
    { "gbal", "set the green balance value",    OFFSET(balance[0]), AV_OPT_TYPE_FLOAT, {.dbl=1},      -10, 10, VF },
    { "bbal", "set the blue balance value",     OFFSET(balance[1]), AV_OPT_TYPE_FLOAT, {.dbl=1},      -10, 10, VF },
    { "rlum", "set the red luma coefficient",   OFFSET(lcoeffs[2]), AV_OPT_TYPE_FLOAT, {.dbl=0.072186}, 0,  1, VF },
    { "glum", "set the green luma coefficient", OFFSET(lcoeffs[0]), AV_OPT_TYPE_FLOAT, {.dbl=0.715158}, 0,  1, VF },
    { "blum", "set the blue luma coefficient",  OFFSET(lcoeffs[1]), AV_OPT_TYPE_FLOAT, {.dbl=0.212656}, 0,  1, VF },
    { "alternate", "use alternate colors",      OFFSET(alternate),  AV_OPT_TYPE_BOOL,  {.i64=0},        0,  1, VF },
    { NULL }
};

AVFILTER_DEFINE_CLASS(vibrance);

AVFilter ff_vf_vibrance = {
    .name          = "vibrance",
    .description   = NULL_IF_CONFIG_SMALL("Boost or alter saturation."),
开发者ID:FFmpeg,项目名称:FFmpeg,代码行数:31,代码来源:vf_vibrance.c

示例2: av_hash_final

    av_hash_final(c->hash, md5);
    for (i = 0; i < len; i++) {
        snprintf(buf + offset, 3, "%02"PRIx8, md5[i]);
        offset += 2;
    }
    buf[offset] = '\n';
    buf[offset+1] = 0;

    avio_write(s->pb, buf, strlen(buf));
    avio_flush(s->pb);
}

#define OFFSET(x) offsetof(struct MD5Context, x)
#define ENC AV_OPT_FLAG_ENCODING_PARAM
static const AVOption hash_options[] = {
    { "hash", "set hash to use", OFFSET(hash_name), AV_OPT_TYPE_STRING, {.str = "md5"}, 0, 0, ENC },
    { NULL },
};

static const AVClass md5enc_class = {
    .class_name = "hash encoder class",
    .item_name  = av_default_item_name,
    .option     = hash_options,
    .version    = LIBAVUTIL_VERSION_INT,
};

#if CONFIG_MD5_MUXER
static int write_header(struct AVFormatContext *s)
{
    struct MD5Context *c = s->priv_data;
    int res = av_hash_alloc(&c->hash, c->hash_name);
开发者ID:Bjelijah,项目名称:EcamTurnH265,代码行数:31,代码来源:md5enc.c

示例3: void

    int delay_index;
    uint8_t **delayptrs;
    int max_samples, fade_out;
    int *samples;
    int64_t next_pts;

    void (*echo_samples)(struct AudioEchoContext *ctx, uint8_t **delayptrs,
                         uint8_t * const *src, uint8_t **dst,
                         int nb_samples, int channels);
} AudioEchoContext;

#define OFFSET(x) offsetof(AudioEchoContext, x)
#define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM

static const AVOption aecho_options[] = {
    { "in_gain",  "set signal input gain",  OFFSET(in_gain),  AV_OPT_TYPE_FLOAT,  {.dbl=0.6}, 0, 1, A },
    { "out_gain", "set signal output gain", OFFSET(out_gain), AV_OPT_TYPE_FLOAT,  {.dbl=0.3}, 0, 1, A },
    { "delays",   "set list of signal delays", OFFSET(delays), AV_OPT_TYPE_STRING, {.str="1000"}, 0, 0, A },
    { "decays",   "set list of signal decays", OFFSET(decays), AV_OPT_TYPE_STRING, {.str="0.5"}, 0, 0, A },
    { NULL }
};

AVFILTER_DEFINE_CLASS(aecho);

static void count_items(char *item_str, int *nb_items)
{
    char *p;

    *nb_items = 1;
    for (p = item_str; *p; p++) {
        if (*p == '|')
开发者ID:VFR-maniac,项目名称:ffmpeg,代码行数:31,代码来源:af_aecho.c

示例4: peek_char1

void peek_char1(CL_FORM *base)
{
	if(CL_TRUEP(ARG(1)))
	{
		if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 48))	/* T */
		{
			COPY(SYMVAL(Slisp, 59), ARG(1));	/* *TERMINAL-IO* */
		}
	}
	else
	{
		COPY(SYMVAL(Slisp, 60), ARG(1));	/* *STANDARD-INPUT* */
	}
	COPY(ARG(1), ARG(5));
	LOAD_NIL(ARG(6));
	LOAD_NIL(ARG(7));
	COPY(ARG(4), ARG(8));
	read_char1(ARG(5));
	if(CL_SYMBOLP(ARG(0)) && GET_SYMBOL(ARG(0)) == SYMBOL(Slisp, 48))	/* T */
	{
		M1_1:;
		if(CL_TRUEP(ARG(5)))
		{
		}
		else
		{
			goto RETURN1;
		}
		COPY(SYMVAL(Slisp, 454), ARG(6));	/* *READTABLE* */
		COPY(ARG(6), ARG(7));
		LOAD_SYMBOL(SYMBOL(Slisp, 420), ARG(8));	/* READTABLE */
		rt_struct_typep(ARG(7));
		if(CL_TRUEP(ARG(7)))
		{
			COPY(OFFSET(AR_BASE(GET_FORM(ARG(6))), 0 + 1), ARG(6));
		}
		else
		{
			COPY(SYMVAL(Slisp, 352), ARG(7));	/* NO_STRUCT */
			COPY(ARG(6), ARG(8));
			LOAD_SYMBOL(SYMBOL(Slisp, 420), ARG(9));	/* READTABLE */
			Ferror(ARG(7), 3);
		}
		if(CL_CHARP(ARG(5)))
		{
		}
		else
		{
			COPY(SYMVAL(Slisp, 58), ARG(7));	/* WRONG_TYPE */
			COPY(ARG(5), ARG(8));
			LOAD_SYMBOL(SYMBOL(Slisp, 18), ARG(9));	/* CHARACTER */
			Ferror(ARG(7), 3);
		}
		COPY(ARG(5), ARG(7));
		rt_char_code(ARG(7));
		LOAD_BOOL(CL_SMVECP(ARG(6)), ARG(8));
		if(CL_TRUEP(ARG(8)))
		{
			goto THEN1;
		}
		else
		{
			COPY(ARG(6), ARG(9));
			LOAD_SYMBOL(SYMBOL(Slisp, 150), ARG(10));	/* COMPLEX-VECTOR */
			rt_struct_typep(ARG(9));
		}
		if(CL_TRUEP(ARG(9)))
		{
			THEN1:;
		}
		else
		{
			COPY(SYMVAL(Slisp, 58), ARG(8));	/* WRONG_TYPE */
			COPY(ARG(6), ARG(9));
			LOAD_SYMBOL(SYMBOL(Slisp, 47), ARG(10));	/* VECTOR */
			Ferror(ARG(8), 3);
		}
		Frow_major_aref(ARG(6));
		if(CL_SYMBOLP(ARG(6)) && GET_SYMBOL(ARG(6)) == SYMBOL(Slisp, 462))	/* WHITESPACE */
		{
		}
		else
		{
			goto RETURN1;
		}
		COPY(ARG(1), ARG(6));
		COPY(ARG(4), ARG(7));
		COPY(ARG(6), ARG(8));
		LOAD_NIL(ARG(9));
		LOAD_NIL(ARG(10));
		COPY(ARG(7), ARG(11));
		read_char1(ARG(8));
		COPY(ARG(8), ARG(5));
		goto M1_1;
		RETURN1:;
	}
	else
	{
		if(CL_CHARP(ARG(0)))
		{
//.........这里部分代码省略.........
开发者ID:hoelzl,项目名称:Clicc,代码行数:101,代码来源:peek_char1.c

示例5: SCC_MEM_Free

/**
 * @brief メモリ領域を解放する
 * @param[in] ptr  解放したいメモリ領域の先頭ポインタ
 * @param[in] type メモリ割り当て領域種別
 */
void SCC_MEM_Free(void *ptr, E_SCC_MEM_TYPE type)
{
	E_SC_RESULT ret = e_SC_RESULT_SUCCESS;
	MEM_CELL	*prevFree = NULL;		// 前スロット要素
	MEM_CELL	*nextFree = NULL;		// 次スロット要素
	MEM_CELL	*cur = NULL;			// 現在スロット位置
	MEM_ALLOCAREAINF *inf = NULL;
	SIZE		cellSize = 0;

	// パラメータチェック
	if (NULL == ptr) {
		SCC_LOG_ErrorPrint(SC_TAG_CC, "param error[ptr], " HERE);
		return;
	}
	if (CC_MEM_TYPE_END == type) {
		SCC_LOG_ErrorPrint(SC_TAG_CC, "param error[type], " HERE);
		return;
	}

	inf = &memMngList[type];
	if (NULL == inf->top) {
		// 該当タイプの領域全体が解放されている場合
		return;
	}

	// 排他制御開始
	ret = SCC_LockMutex(&mutexTable[type]);
	if (ret != e_SC_RESULT_SUCCESS) {
		SCC_LOG_ErrorPrint(SC_TAG_CC, "SCC_LockMutext error, " HERE);
		return;
	}

	// 解放対象のスロットアドレスを取得
	cur = OBJMEMCELL(ptr);

	cellSize = cur->size;

	/* 探索開始位置の設定
	 *   前回の解放時に使った際のポインタ位置を有効ならば使ってしまう。
	 *   そうすることによりフリーツリー探索を行う無駄な時間を少し省ける。
	 */
	nextFree = inf->topFreeList;
	if (NULL != inf->latestFree && inf->latestFree < cur) {
		// 前回キャッシュ位置が妥当な場合は使う
		nextFree = inf->latestFree;
	}

	while (NULL != nextFree && nextFree < cur) {
		// 次空き要素があり、次空き要素が未だcurを超過していない場合
		prevFree = nextFree;
		nextFree = nextFree->next;
	}

	// 次要素との後処理(連結処理)
	if (NULL != nextFree) {
		// 次空き要素が存在する場合
		if (OFFSET(cur, cur->size) == nextFree) {
			// 次空き要素と隣接する場合は連結する
			cur->size += nextFree->size;
			cur->next = nextFree->next;
		} else {
			// 次空き要素と隣接しない場合
			cur->next = nextFree;
		}
	} else {
		// 次空き要素が存在しない場合
		cur->next = NULL;
	}

	// キャッシュ設定
	inf->latestFree = cur;

	// 前要素との後処理(連結処理)
	if (NULL != prevFree) {
		if (OFFSET(prevFree, prevFree->size) == cur) {
			// 前の隣接空き要素と連結する
			prevFree->size += cur->size;
			prevFree->next = cur->next;
			// キャッシュはひとつ前に設定
			inf->latestFree = prevFree;
		} else {
			prevFree->next = cur;
		}
	} else {
		// 前空き要素がない場合、curはFreeListの先頭となる
		inf->topFreeList = cur;
		// キャッシュは不要なのでNULL設定 */
		inf->latestFree = NULL;
	}

	freeAreaSize[type] += cellSize;
	useAreaSize[type]  -= cellSize;
	SCC_LOG_DebugPrint(SC_TAG_CC, "[SMCCom]block%d free=%u, use=%u, " HERE, (type + 1), freeAreaSize[type], useAreaSize[type]);

	// 排他制御終了
//.........这里部分代码省略.........
开发者ID:gpsnavi,项目名称:gpsnavi,代码行数:101,代码来源:SMCComMem.c

示例6:

 * u-boot:/board/ti/am335x/mux.c
 *
 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
 *
 * SPDX-License-Identifier:	GPL-2.0+
 */

#include <common.h>
#include <asm/arch/sys_proto.h>
#include <asm/arch/hardware.h>
#include <asm/arch/mux.h>
#include <asm/io.h>
#include <i2c.h>

static struct module_pin_mux uart0_pin_mux[] = {
	{OFFSET(uart0_rxd), (MODE(0) | PULLUDDIS | RXACTIVE)},	/* UART0_RXD */
	{OFFSET(uart0_txd), (MODE(0) | PULLUDDIS)},		/* UART0_TXD */
	{-1},
};

static struct module_pin_mux ddr_pin_mux[] = {
	{OFFSET(ddr_resetn), (MODE(0))},
	{OFFSET(ddr_csn0), (MODE(0) | PULLUP_EN)},
	{OFFSET(ddr_ck), (MODE(0))},
	{OFFSET(ddr_nck), (MODE(0))},
	{OFFSET(ddr_casn), (MODE(0) | PULLUP_EN)},
	{OFFSET(ddr_rasn), (MODE(0) | PULLUP_EN)},
	{OFFSET(ddr_wen), (MODE(0) | PULLUP_EN)},
	{OFFSET(ddr_ba0), (MODE(0) | PULLUP_EN)},
	{OFFSET(ddr_ba1), (MODE(0) | PULLUP_EN)},
	{OFFSET(ddr_ba2), (MODE(0) | PULLUP_EN)},
开发者ID:01hyang,项目名称:u-boot,代码行数:31,代码来源:mux.c

示例7: OFFSET

    int distance_cm;
    int distance_m;
    double dry, wet;
    int temp;

    unsigned delay;
    unsigned w_ptr;
    unsigned buf_size;
    AVFrame *delay_frame;
} CompensationDelayContext;

#define OFFSET(x) offsetof(CompensationDelayContext, x)
#define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM

static const AVOption compensationdelay_options[] = {
    { "mm",   "set mm distance",    OFFSET(distance_mm), AV_OPT_TYPE_INT,    {.i64=0},    0,  10, A },
    { "cm",   "set cm distance",    OFFSET(distance_cm), AV_OPT_TYPE_INT,    {.i64=0},    0, 100, A },
    { "m",    "set meter distance", OFFSET(distance_m),  AV_OPT_TYPE_INT,    {.i64=0},    0, 100, A },
    { "dry",  "set dry amount",     OFFSET(dry),         AV_OPT_TYPE_DOUBLE, {.dbl=0},    0,   1, A },
    { "wet",  "set wet amount",     OFFSET(wet),         AV_OPT_TYPE_DOUBLE, {.dbl=1},    0,   1, A },
    { "temp", "set temperature °C", OFFSET(temp),        AV_OPT_TYPE_INT,    {.i64=20}, -50,  50, A },
    { NULL }
};

AVFILTER_DEFINE_CLASS(compensationdelay);

// The maximum distance for options
#define COMP_DELAY_MAX_DISTANCE            (100.0 * 100.0 + 100.0 * 1.0 + 1.0)
// The actual speed of sound in normal conditions
#define COMP_DELAY_SOUND_SPEED_KM_H(temp)  1.85325 * (643.95 * pow(((temp + 273.15) / 273.15), 0.5))
#define COMP_DELAY_SOUND_SPEED_CM_S(temp)  (COMP_DELAY_SOUND_SPEED_KM_H(temp) * (1000.0 * 100.0) /* cm/km */ / (60.0 * 60.0) /* s/h */)
开发者ID:hookbrother,项目名称:FFmpeg,代码行数:31,代码来源:af_compensationdelay.c

示例8: OFFSET

    FILE *stats_file;
    char *stats_file_str;
    int max[4], average_max;
    int is_rgb;
    uint8_t rgba_map[4];
    char comps[4];
    int nb_components;
    int planewidth[4];
    int planeheight[4];
} PSNRContext;

#define OFFSET(x) offsetof(PSNRContext, x)
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM

static const AVOption psnr_options[] = {
    {"stats_file", "Set file where to store per-frame difference information", OFFSET(stats_file_str), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
    {"f",          "Set file where to store per-frame difference information", OFFSET(stats_file_str), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
    { NULL },
};

AVFILTER_DEFINE_CLASS(psnr);

static inline int pow2(int base)
{
    return base*base;
}

static inline double get_psnr(double mse, uint64_t nb_frames, int max)
{
    return 10.0 * log(pow2(max) / (mse / nb_frames)) / log(10.0);
}
开发者ID:StephanieSpanjian,项目名称:FFmpeg,代码行数:31,代码来源:vf_psnr.c

示例9: FF_MODPLUG_MAX_FILE_SIZE

enum var_name {
    VAR_X, VAR_Y,
    VAR_W, VAR_H,
    VAR_TIME,
    VAR_SPEED, VAR_TEMPO, VAR_ORDER, VAR_PATTERN, VAR_ROW,
    VAR_VARS_NB
};

#define FF_MODPLUG_MAX_FILE_SIZE (100 * 1<<20) // 100M
#define FF_MODPLUG_DEF_FILE_SIZE (  5 * 1<<20) //   5M

#define OFFSET(x) offsetof(ModPlugContext, x)
#define D AV_OPT_FLAG_DECODING_PARAM
static const AVOption options[] = {
    {"noise_reduction", "Enable noise reduction 0(off)-1(on)",  OFFSET(noise_reduction), AV_OPT_TYPE_INT, {.i64 = 0}, 0,       1, D},
    {"reverb_depth",    "Reverb level 0(quiet)-100(loud)",      OFFSET(reverb_depth),    AV_OPT_TYPE_INT, {.i64 = 0}, 0,     100, D},
    {"reverb_delay",    "Reverb delay in ms, usually 40-200ms", OFFSET(reverb_delay),    AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, D},
    {"bass_amount",     "XBass level 0(quiet)-100(loud)",       OFFSET(bass_amount),     AV_OPT_TYPE_INT, {.i64 = 0}, 0,     100, D},
    {"bass_range",      "XBass cutoff in Hz 10-100",            OFFSET(bass_range),      AV_OPT_TYPE_INT, {.i64 = 0}, 0,     100, D},
    {"surround_depth",  "Surround level 0(quiet)-100(heavy)",   OFFSET(surround_depth),  AV_OPT_TYPE_INT, {.i64 = 0}, 0,     100, D},
    {"surround_delay",  "Surround delay in ms, usually 5-40ms", OFFSET(surround_delay),  AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, D},
    {"max_size",        "Max file size supported (in bytes). Default is 5MB. Set to 0 for no limit (not recommended)",
     OFFSET(max_size), AV_OPT_TYPE_INT, {.i64 = FF_MODPLUG_DEF_FILE_SIZE}, 0, FF_MODPLUG_MAX_FILE_SIZE, D},
    {"video_stream_expr", "Color formula",                                  OFFSET(color_eval),     AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, D},
    {"video_stream",      "Make demuxer output a video stream",             OFFSET(video_stream),   AV_OPT_TYPE_INT, {.i64 = 0},   0,   1, D},
    {"video_stream_w",    "Video stream width in char (one char = 8x8px)",  OFFSET(w),              AV_OPT_TYPE_INT, {.i64 = 30}, 20, 512, D},
    {"video_stream_h",    "Video stream height in char (one char = 8x8px)", OFFSET(h),              AV_OPT_TYPE_INT, {.i64 = 30}, 20, 512, D},
    {"video_stream_ptxt", "Print speed, tempo, order, ... in video stream", OFFSET(print_textinfo), AV_OPT_TYPE_INT, {.i64 = 1},   0,   1, D},
    {NULL},
};
开发者ID:DeHackEd,项目名称:FFmpeg,代码行数:30,代码来源:libmodplug.c

示例10: main

int main(void) {

    SetMode(MODE_3 | BG2_ENABLE);
    
    fillScreen(BLACK);
    
    drawImage3(0, 0, STARTSCREEN_WIDTH, STARTSCREEN_HEIGHT, &startScreen[0]);
    int i = 1;
    while(i) {
        if(keyDown(KEY_START)) {
            i = 0;
        }
    }
    
    fillScreen(BLACK);
    
    int x = 120;
    int y = 60;
    int d = 0;
    int t = 20;
    int m = 10;
    int s = 0;
    int p = 0;
    int c = 1;
    u16 color = WHITE;
    
    drawHollowRect(0,0,SCREEN_WIDTH-1, SCREEN_HEIGHT-10, color);
    setPixel(x,y,color);
    
    while(c) {
        
        // Reset
        if(keyDown(KEY_SELECT)) {
            c = 0;
            main();
        }
        
        // Set Direction
        if(keyDown(KEY_DOWN) && (d != 2)){
            d = 0;
        } else if(keyDown(KEY_RIGHT) && (d != 3)) {
            d = 1;
        } else if(keyDown(KEY_UP) && (d != 0)) {
            d = 2;
        } else if(keyDown(KEY_LEFT) && (d != 1)) {
            d = 3;
        }
        
        // Move snake
        if(d==0) {
            y++;
        } else if(d==1) {
            x++;
        } else if(d==2) {
            y--;
        } else if(d==3) {
            x--;
        }
        
        // Check for collisions
        if(videoBuffer[OFFSET(x,y)] != BLACK) {
            fillScreen(BLACK);
            drawImage3(0, 0, GAMEOVER_WIDTH, GAMEOVER_HEIGHT, &gameOver[0]);
            drawImage3(100, 70, RETRY_WIDTH, RETRY_HEIGHT, &retry[0]);
            int i = 1;
            while(i) {
                if(keyDown(KEY_START)) {
                    while(keyDown(KEY_START)) {
                        
                    }
                    i = 0;
                }
            }
            
            c = 0;
            main();
        }
        
        // Draw snake
        setPixel(x,y,color);
        delay(t);
        
        // Increase score
        s++;
        s = s%m;
        
        // Set Speed
        if(s == 0) {
            t--;
            m = m + m/3;
            drawRect(1 + p,152,2,6,WHITE);
            p = p + 4;
        }
        
        // Wait for V blank
        waitForVblank();
    }

    return 0;
}
开发者ID:fenichelar,项目名称:GBA-Snake,代码行数:100,代码来源:main.c

示例11: OFFSET

    double start_time;      ///< pts, in seconds, of the expected first frame

    AVRational framerate;   ///< target framerate
    char *fps;              ///< a string describing target framerate

    /* statistics */
    int frames_in;             ///< number of frames on input
    int frames_out;            ///< number of frames on output
    int dup;                   ///< number of frames duplicated
    int drop;                  ///< number of framed dropped
} FPSContext;

#define OFFSET(x) offsetof(FPSContext, x)
#define V AV_OPT_FLAG_VIDEO_PARAM
static const AVOption options[] = {
    { "fps", "A string describing desired output framerate", OFFSET(fps), AV_OPT_TYPE_STRING, { .str = "25" }, .flags = V },
    { "start_time", "Assume the first PTS should be this value.", OFFSET(start_time), AV_OPT_TYPE_DOUBLE, { .dbl = DBL_MAX}, -DBL_MAX, DBL_MAX, V },
    { NULL },
};

static const AVClass class = {
    .class_name = "FPS filter",
    .item_name  = av_default_item_name,
    .option     = options,
    .version    = LIBAVUTIL_VERSION_INT,
};

static av_cold int init(AVFilterContext *ctx)
{
    FPSContext *s = ctx->priv;
    int ret;
开发者ID:smarter,项目名称:libav,代码行数:31,代码来源:vf_fps.c

示例12: __big_insert

/*
 * Big_insert
 *
 * You need to do an insert and the key/data pair is too big
 *
 * Returns:
 * 0 ==> OK
 *-1 ==> ERROR
 */
extern int
__big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val)
{
    register uint16 *p;
    uint key_size, n, val_size;
    uint16 space, move_bytes, off;
    char *cp, *key_data, *val_data;

    cp = bufp->page; /* Character pointer of p. */
    p = (uint16 *)cp;

    key_data = (char *)key->data;
    key_size = key->size;
    val_data = (char *)val->data;
    val_size = val->size;

    /* First move the Key */
    for (space = FREESPACE(p) - BIGOVERHEAD; key_size;
         space = FREESPACE(p) - BIGOVERHEAD) {
        move_bytes = PR_MIN(space, key_size);
        off = OFFSET(p) - move_bytes;
        memmove(cp + off, key_data, move_bytes);
        key_size -= move_bytes;
        key_data += move_bytes;
        n = p[0];
        p[++n] = off;
        p[0] = ++n;
        FREESPACE(p) = off - PAGE_META(n);
        OFFSET(p) = off;
        p[n] = PARTIAL_KEY;
        bufp = __add_ovflpage(hashp, bufp);
        if (!bufp)
            return (-1);
        n = p[0];
        if (!key_size) {
            if (FREESPACE(p)) {
                move_bytes = PR_MIN(FREESPACE(p), val_size);
                off = OFFSET(p) - move_bytes;
                p[n] = off;
                memmove(cp + off, val_data, move_bytes);
                val_data += move_bytes;
                val_size -= move_bytes;
                p[n - 2] = FULL_KEY_DATA;
                FREESPACE(p) = FREESPACE(p) - move_bytes;
                OFFSET(p) = off;
            }
            else
                p[n - 2] = FULL_KEY;
        }
        p = (uint16 *)bufp->page;
        cp = bufp->page;
        bufp->flags |= BUF_MOD;
    }

    /* Now move the data */
    for (space = FREESPACE(p) - BIGOVERHEAD; val_size;
         space = FREESPACE(p) - BIGOVERHEAD) {
        move_bytes = PR_MIN(space, val_size);
        /*
         * Here's the hack to make sure that if the data ends on the
         * same page as the key ends, FREESPACE is at least one.
         */
        if (space == val_size && val_size == val->size)
            move_bytes--;
        off = OFFSET(p) - move_bytes;
        memmove(cp + off, val_data, move_bytes);
        val_size -= move_bytes;
        val_data += move_bytes;
        n = p[0];
        p[++n] = off;
        p[0] = ++n;
        FREESPACE(p) = off - PAGE_META(n);
        OFFSET(p) = off;
        if (val_size) {
            p[n] = FULL_KEY;
            bufp = __add_ovflpage(hashp, bufp);
            if (!bufp)
                return (-1);
            cp = bufp->page;
            p = (uint16 *)cp;
        }
        else
            p[n] = FULL_KEY_DATA;
        bufp->flags |= BUF_MOD;
    }
    return (0);
}
开发者ID:kitcambridge,项目名称:gecko-dev,代码行数:96,代码来源:h_bigkey.c

示例13: foo

void foo(void)
{
	OFFSET(IA32_SIGCONTEXT_ax, sigcontext, ax);
	OFFSET(IA32_SIGCONTEXT_bx, sigcontext, bx);
	OFFSET(IA32_SIGCONTEXT_cx, sigcontext, cx);
	OFFSET(IA32_SIGCONTEXT_dx, sigcontext, dx);
	OFFSET(IA32_SIGCONTEXT_si, sigcontext, si);
	OFFSET(IA32_SIGCONTEXT_di, sigcontext, di);
	OFFSET(IA32_SIGCONTEXT_bp, sigcontext, bp);
	OFFSET(IA32_SIGCONTEXT_sp, sigcontext, sp);
	OFFSET(IA32_SIGCONTEXT_ip, sigcontext, ip);
	BLANK();

	OFFSET(CPUINFO_x86, cpuinfo_x86, x86);
	OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor);
	OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model);
	OFFSET(CPUINFO_x86_mask, cpuinfo_x86, x86_mask);
	OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level);
	OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability);
	OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
	BLANK();

	OFFSET(TI_sysenter_return, thread_info, sysenter_return);
	OFFSET(TI_cpu, thread_info, cpu);
	BLANK();

	OFFSET(PT_EBX, pt_regs, bx);
	OFFSET(PT_ECX, pt_regs, cx);
	OFFSET(PT_EDX, pt_regs, dx);
	OFFSET(PT_ESI, pt_regs, si);
	OFFSET(PT_EDI, pt_regs, di);
	OFFSET(PT_EBP, pt_regs, bp);
	OFFSET(PT_EAX, pt_regs, ax);
	OFFSET(PT_DS,  pt_regs, ds);
	OFFSET(PT_ES,  pt_regs, es);
	OFFSET(PT_FS,  pt_regs, fs);
	OFFSET(PT_GS,  pt_regs, gs);
	OFFSET(PT_ORIG_EAX, pt_regs, orig_ax);
	OFFSET(PT_EIP, pt_regs, ip);
	OFFSET(PT_CS,  pt_regs, cs);
	OFFSET(PT_EFLAGS, pt_regs, flags);
	OFFSET(PT_OLDESP, pt_regs, sp);
	OFFSET(PT_OLDSS,  pt_regs, ss);
	BLANK();

	OFFSET(IA32_RT_SIGFRAME_sigcontext, rt_sigframe, uc.uc_mcontext);
	BLANK();

	OFFSET(saved_context_gdt_desc, saved_context, gdt_desc);
	BLANK();

	/* Offset from the sysenter stack to tss.sp0 */
	DEFINE(TSS_sysenter_sp0, offsetof(struct tss_struct, x86_tss.sp0) -
		 sizeof(struct tss_struct));

#if defined(CONFIG_LGUEST) || defined(CONFIG_LGUEST_GUEST) || defined(CONFIG_LGUEST_MODULE)
	BLANK();
	OFFSET(LGUEST_DATA_irq_enabled, lguest_data, irq_enabled);
	OFFSET(LGUEST_DATA_irq_pending, lguest_data, irq_pending);

	BLANK();
	OFFSET(LGUEST_PAGES_host_gdt_desc, lguest_pages, state.host_gdt_desc);
	OFFSET(LGUEST_PAGES_host_idt_desc, lguest_pages, state.host_idt_desc);
	OFFSET(LGUEST_PAGES_host_cr3, lguest_pages, state.host_cr3);
	OFFSET(LGUEST_PAGES_host_sp, lguest_pages, state.host_sp);
	OFFSET(LGUEST_PAGES_guest_gdt_desc, lguest_pages,state.guest_gdt_desc);
	OFFSET(LGUEST_PAGES_guest_idt_desc, lguest_pages,state.guest_idt_desc);
	OFFSET(LGUEST_PAGES_guest_gdt, lguest_pages, state.guest_gdt);
	OFFSET(LGUEST_PAGES_regs_trapnum, lguest_pages, regs.trapnum);
	OFFSET(LGUEST_PAGES_regs_errcode, lguest_pages, regs.errcode);
	OFFSET(LGUEST_PAGES_regs, lguest_pages, regs);
#endif
	BLANK();
	DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
	DEFINE(NR_syscalls, sizeof(syscalls));
}
开发者ID:03199618,项目名称:linux,代码行数:76,代码来源:asm-offsets_32.c

示例14: __big_split

/*
 * Returns:
 *  0 => OK
 * -1 => error
 */
int
__big_split(HTAB *hashp,
    BUFHEAD *op,	/* Pointer to where to put keys that go in old bucket */
    BUFHEAD *np,	/* Pointer to new bucket page */
    BUFHEAD *big_keyp,	/* Pointer to first page containing the big key/data */
    int addr,		/* Address of big_keyp */
    u_int32_t obucket,	/* Old Bucket */
    SPLIT_RETURN *ret)
{
	BUFHEAD *bp, *tmpp;
	DBT key, val;
	u_int32_t change;
	u_int16_t free_space, n, off, *tp;

	bp = big_keyp;

	/* Now figure out where the big key/data goes */
	if (__big_keydata(hashp, big_keyp, &key, &val, 0))
		return (-1);
	change = (__call_hash(hashp, key.data, key.size) != obucket);

	if ((ret->next_addr = __find_last_page(hashp, &big_keyp))) {
		if (!(ret->nextp =
		    __get_buf(hashp, ret->next_addr, big_keyp, 0)))
			return (-1);
	} else
		ret->nextp = NULL;

	/* Now make one of np/op point to the big key/data pair */
#ifdef DEBUG
	assert(np->ovfl == NULL);
#endif
	if (change)
		tmpp = np;
	else
		tmpp = op;

	tmpp->flags |= BUF_MOD;
#ifdef DEBUG1
	(void)fprintf(stderr,
	    "BIG_SPLIT: %d->ovfl was %d is now %d\n", tmpp->addr,
	    (tmpp->ovfl ? tmpp->ovfl->addr : 0), (bp ? bp->addr : 0));
#endif
	tmpp->ovfl = bp;	/* one of op/np point to big_keyp */
	tp = (u_int16_t *)tmpp->page;
#ifdef DEBUG
	assert(FREESPACE(tp) >= OVFLSIZE);
#endif
	n = tp[0];
	off = OFFSET(tp);
	free_space = FREESPACE(tp);
	tp[++n] = (u_int16_t)addr;
	tp[++n] = OVFLPAGE;
	tp[0] = n;
	OFFSET(tp) = off;
	FREESPACE(tp) = free_space - OVFLSIZE;

	/*
	 * Finally, set the new and old return values. BIG_KEYP contains a
	 * pointer to the last page of the big key_data pair. Make sure that
	 * big_keyp has no following page (2 elements) or create an empty
	 * following page.
	 */

	ret->newp = np;
	ret->oldp = op;

	tp = (u_int16_t *)big_keyp->page;
	big_keyp->flags |= BUF_MOD;
	if (tp[0] > 2) {
		/*
		 * There may be either one or two offsets on this page.  If
		 * there is one, then the overflow page is linked on normally
		 * and tp[4] is OVFLPAGE.  If there are two, tp[4] contains
		 * the second offset and needs to get stuffed in after the
		 * next overflow page is added.
		 */
		n = tp[4];
		free_space = FREESPACE(tp);
		off = OFFSET(tp);
		tp[0] -= 2;
		FREESPACE(tp) = free_space + OVFLSIZE;
		OFFSET(tp) = off;
		tmpp = __add_ovflpage(hashp, big_keyp);
		if (!tmpp)
			return (-1);
		tp[4] = n;
	} else
		tmpp = big_keyp;

	if (change)
		ret->newp = tmpp;
	else
		ret->oldp = tmpp;
	return (0);
//.........这里部分代码省略.........
开发者ID:mikekmv,项目名称:aeriebsd-src,代码行数:101,代码来源:hash_bigkey.c

示例15: OFFSET

    uint8_t inbuffer [BLOCKSIZE*MAX_BUFFER_BLOCKS],
            outbuffer[BLOCKSIZE*MAX_BUFFER_BLOCKS];
    uint8_t *outptr;
    int indata, indata_used, outdata;
    int eof;
    uint8_t *key;
    int keylen;
    uint8_t *iv;
    int ivlen;
    struct AVAES *aes;
} CryptoContext;

#define OFFSET(x) offsetof(CryptoContext, x)
#define D AV_OPT_FLAG_DECODING_PARAM
static const AVOption options[] = {
    {"key", "AES decryption key", OFFSET(key), AV_OPT_TYPE_BINARY, .flags = D },
    {"iv",  "AES decryption initialization vector", OFFSET(iv), AV_OPT_TYPE_BINARY, .flags = D },
    { NULL }
};

static const AVClass crypto_class = {
    .class_name     = "crypto",
    .item_name      = av_default_item_name,
    .option         = options,
    .version        = LIBAVUTIL_VERSION_INT,
};

static int crypto_open(URLContext *h, const char *uri, int flags)
{
    const char *nested_url;
    int ret = 0;
开发者ID:AVLeo,项目名称:libav,代码行数:31,代码来源:crypto.c


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